diff --git a/Utilities/BGL/boost/aligned_storage.hpp b/Utilities/BGL/boost/aligned_storage.hpp index 9ab94a083552318b159393fadfbc81d2498c6fb4..ce277ab702ad4db26644b86bebce1b74eab59dec 100644 --- a/Utilities/BGL/boost/aligned_storage.hpp +++ b/Utilities/BGL/boost/aligned_storage.hpp @@ -54,6 +54,14 @@ struct aligned_storage_imp , type_with_alignment<alignment_> >::type align_; } data_; + void* address() const { return const_cast<aligned_storage_imp*>(this); } +}; + +template< std::size_t alignment_ > +struct aligned_storage_imp<0u,alignment_> +{ + /* intentionally empty */ + void* address() const { return 0; } }; }} // namespace detail::aligned_storage @@ -62,12 +70,15 @@ template < std::size_t size_ , std::size_t alignment_ = std::size_t(-1) > -class aligned_storage +class aligned_storage : +#ifndef __BORLANDC__ + private +#else + public +#endif + detail::aligned_storage::aligned_storage_imp<size_, alignment_> { -private: // representation - - detail::aligned_storage::aligned_storage_imp<size_, alignment_> data_; - + public: // constants typedef detail::aligned_storage::aligned_storage_imp<size_, alignment_> type; @@ -118,14 +129,14 @@ public: // accessors void* address() { - return this; + return static_cast<type*>(this)->address(); } -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) const void* address() const { - return this; + return static_cast<const type*>(this)->address(); } #else // MSVC6 @@ -136,7 +147,7 @@ public: // accessors }; -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // MSVC6 seems not to like inline functions with const void* returns, so we // declare the following here: diff --git a/Utilities/BGL/boost/any.hpp b/Utilities/BGL/boost/any.hpp deleted file mode 100644 index fe8553201ba6fc86272fc64e06a69dbf6faef1e4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/any.hpp +++ /dev/null @@ -1,238 +0,0 @@ -// See http://www.boost.org/libs/any for Documentation. - -#ifndef BOOST_ANY_INCLUDED -#define BOOST_ANY_INCLUDED - -// what: variant type boost::any -// who: contributed by Kevlin Henney, -// with features contributed and bugs found by -// Ed Brey, Mark Rodgers, Peter Dimov, and James Curran -// when: July 2001 -// where: tested with BCC 5.5, MSVC 6.0, and g++ 2.95 - -#include <algorithm> -#include <typeinfo> - -#include "boost/config.hpp" -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/throw_exception.hpp> -#include <boost/static_assert.hpp> - -namespace boost -{ - class any - { - public: // structors - - any() - : content(0) - { - } - - template<typename ValueType> - any(const ValueType & value) - : content(new holder<ValueType>(value)) - { - } - - any(const any & other) - : content(other.content ? other.content->clone() : 0) - { - } - - ~any() - { - delete content; - } - - public: // modifiers - - any & swap(any & rhs) - { - std::swap(content, rhs.content); - return *this; - } - - template<typename ValueType> - any & operator=(const ValueType & rhs) - { - any(rhs).swap(*this); - return *this; - } - - any & operator=(const any & rhs) - { - any(rhs).swap(*this); - return *this; - } - - public: // queries - - bool empty() const - { - return !content; - } - - const std::type_info & type() const - { - return content ? content->type() : typeid(void); - } - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - private: // types -#else - public: // types (public so any_cast can be non-friend) -#endif - - class placeholder - { - public: // structors - - virtual ~placeholder() - { - } - - public: // queries - - virtual const std::type_info & type() const = 0; - - virtual placeholder * clone() const = 0; - - }; - - template<typename ValueType> - class holder : public placeholder - { - public: // structors - - holder(const ValueType & value) - : held(value) - { - } - - public: // queries - - virtual const std::type_info & type() const - { - return typeid(ValueType); - } - - virtual placeholder * clone() const - { - return new holder(held); - } - - public: // representation - - ValueType held; - - }; - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - - private: // representation - - template<typename ValueType> - friend ValueType * any_cast(any *); - - template<typename ValueType> - friend ValueType * unsafe_any_cast(any *); - -#else - - public: // representation (public so any_cast can be non-friend) - -#endif - - placeholder * content; - - }; - - class bad_any_cast : public std::bad_cast - { - public: - virtual const char * what() const throw() - { - return "boost::bad_any_cast: " - "failed conversion using boost::any_cast"; - } - }; - - template<typename ValueType> - ValueType * any_cast(any * operand) - { - return operand && operand->type() == typeid(ValueType) - ? &static_cast<any::holder<ValueType> *>(operand->content)->held - : 0; - } - - template<typename ValueType> - const ValueType * any_cast(const any * operand) - { - return any_cast<ValueType>(const_cast<any *>(operand)); - } - - template<typename ValueType> - ValueType any_cast(const any & operand) - { - typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref; - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // If 'nonref' is still reference type, it means the user has not - // specialized 'remove_reference'. - - // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro - // to generate specialization of remove_reference for your class - // See type traits library documentation for details - BOOST_STATIC_ASSERT(!is_reference<nonref>::value); -#endif - - const nonref * result = any_cast<nonref>(&operand); - if(!result) - boost::throw_exception(bad_any_cast()); - return *result; - } - - template<typename ValueType> - ValueType any_cast(any & operand) - { - typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref; - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // The comment in the above version of 'any_cast' explains when this - // assert is fired and what to do. - BOOST_STATIC_ASSERT(!is_reference<nonref>::value); -#endif - - nonref * result = any_cast<nonref>(&operand); - if(!result) - boost::throw_exception(bad_any_cast()); - return *result; - } - - // Note: The "unsafe" versions of any_cast are not part of the - // public interface and may be removed at any time. They are - // required where we know what type is stored in the any and can't - // use typeid() comparison, e.g., when our types may travel across - // different shared libraries. - template<typename ValueType> - ValueType * unsafe_any_cast(any * operand) - { - return &static_cast<any::holder<ValueType> *>(operand->content)->held; - } - - template<typename ValueType> - const ValueType * unsafe_any_cast(const any * operand) - { - return any_cast<ValueType>(const_cast<any *>(operand)); - } -} - -// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved. -// -// 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) - -#endif diff --git a/Utilities/BGL/boost/archive/add_facet.hpp b/Utilities/BGL/boost/archive/add_facet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6bafe9bdb24ab95b7798346cfe5baf4e99d6043a --- /dev/null +++ b/Utilities/BGL/boost/archive/add_facet.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_ARCHIVE_ADD_FACET_HPP +#define BOOST_ARCHIVE_ADD_FACET_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// add_facet.hpp + +// (C) Copyright 2003 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 <locale> +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +// does STLport uses native STL for locales? +#if (defined(__SGI_STL_PORT)&& defined(_STLP_NO_OWN_IOSTREAMS)) +// and this native STL lib is old Dinkumware (has not defined _CPPLIB_VER) +# if (defined(_YVALS) && !defined(__IBMCPP__)) || !defined(_CPPLIB_VER) +# define BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT +# endif +#endif + +namespace boost { +namespace archive { + +template<class Facet> +inline std::locale * +add_facet(const std::locale &l, Facet * f){ + return + #if defined BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT + // std namespace used for native locale + new std::locale(std::_Addfac(l, f)); + #elif BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) // old Dinkumwar + // std namespace used for native locale + new std::locale(std::_Addfac(l, f)); + #else + // standard compatible + new std::locale(l, f); + #endif +} + +} // namespace archive +} // namespace boost + +#undef BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT + +#endif // BOOST_ARCHIVE_ADD_FACET_HPP diff --git a/Utilities/BGL/boost/archive/archive_exception.hpp b/Utilities/BGL/boost/archive/archive_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..920fb534f4d38dc797f32006133091c983a34566 --- /dev/null +++ b/Utilities/BGL/boost/archive/archive_exception.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// archive/archive_exception.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 <exception> +#include <cassert> +#include <string> + +#include <boost/config.hpp> +#include <boost/preprocessor/empty.hpp> +#include <boost/archive/detail/decl.hpp> + +// note: the only reason this is in here is that windows header +// includes #define exception_code _exception_code (arrrgghhhh!). +// the most expedient way to address this is be sure that this +// header is always included whenever this header file is included. +#if defined(BOOST_WINDOWS) +#include <excpt.h> +#endif + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by archives +// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception : + public virtual std::exception +{ +public: + typedef enum { + no_exception, // initialized without code + other_exception, // any excepton not listed below + unregistered_class, // attempt to serialize a pointer of an + // an unregistered class + invalid_signature, // first line of archive does not contain + // expected string + unsupported_version,// archive created with library version + // subsequent to this one + pointer_conflict, // an attempt has been made to directly + // serialize an object which has + // already been serialzed through a pointer. + // Were this permited, the archive load would result + // in the creation of an extra copy of the obect. + incompatible_native_format, // attempt to read native binary format + // on incompatible platform + array_size_too_short,// array being loaded doesn't fit in array allocated + stream_error, // i/o error on stream + invalid_class_name, // class name greater than the maximum permitted. + // most likely a corrupted archive or an attempt + // to insert virus via buffer overrun method. + unregistered_cast, // base - derived relationship not registered with + // void_cast_register + unsupported_class_version, // type saved with a version # greater than the + // one used by the program. This indicates that the proggram + // needs to be rebuilt. + multiple_code_instantiation // code for implementing serialization for some + // type has been instantiated in more than one module. + } exception_code; +protected: + std::string m_msg; +public: + exception_code code; + archive_exception( + exception_code c, + const char * e1 = NULL, + const char * e2 = NULL + ); + ~archive_exception() throw (); + virtual const char *what( ) const throw(); +protected: + archive_exception(); +}; + +}// namespace archive +}// namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/Utilities/BGL/boost/archive/basic_archive.hpp b/Utilities/BGL/boost/archive/basic_archive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1c906ef94daee2f174be7f33ff742ef9052f0e47 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_archive.hpp @@ -0,0 +1,136 @@ +#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_ARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_archive.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/cstdint.hpp> +#include <boost/noncopyable.hpp> +#include <boost/integer_traits.hpp> +#include <boost/serialization/strong_typedef.hpp> + +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \ +namespace boost { \ +namespace archive { \ +BOOST_STRONG_TYPEDEF(T, D) \ +} /* archive */ \ +template<> \ +class integer_traits<boost::archive::D> : \ + public integer_traits<boost::T> \ +{}; \ +} /* boost */ \ +/**/ + +BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least16_t, version_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_optional_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_reference_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least32_t, object_id_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least32_t, object_reference_type) + +namespace boost { +namespace archive { + +struct tracking_type { +// typedef bool value_type; + bool t; + explicit tracking_type(const bool t_ = false) + : t(t_) + {}; + tracking_type(const tracking_type & t_) + : t(t_.t) + {} + operator bool () const { + return t; + }; + operator bool & () { + return t; + }; + tracking_type & operator=(const bool t_){ + t = t_; + return *this; + } + bool operator==(const tracking_type & rhs) const { + return t == rhs.t; + } + bool operator==(const bool & rhs) const { + return t == rhs; + } + tracking_type & operator=(const tracking_type & rhs){ + t = rhs.t; + return *this; + } +}; + +struct class_name_type : + private boost::noncopyable +{ + char *t; + operator const char * & () const { + return const_cast<const char * &>(t); + } + operator char * () { + return t; + } + explicit class_name_type(const char *key_) + : t(const_cast<char *>(key_)){} + explicit class_name_type(char *key_) + : t(key_){} + class_name_type & operator=(const class_name_type & rhs){ + t = rhs.t; + return *this; + } +}; + +enum archive_flags { + no_header = 1, // suppress archive header info + no_codecvt = 2, // suppress alteration of codecvt facet + no_xml_tag_checking = 4, // suppress checking of xml tags + no_tracking = 8, // suppress ALL tracking + flags_last = 8 +}; + +#define NULL_POINTER_TAG class_id_type(-1) + +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_SIGNATURE(); + +BOOST_ARCHIVE_DECL(version_type) +BOOST_ARCHIVE_VERSION(); + +}// namespace archive +}// namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#include <boost/serialization/level.hpp> + +// set implementation level to primitive for all types +// used internally by the serialization library + +BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_optional_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_name_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type) + +#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_binary_iarchive.hpp b/Utilities/BGL/boost/archive/basic_binary_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0494c98c9fa03812f69adfc203a1de030a6b42a4 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_binary_iarchive.hpp @@ -0,0 +1,141 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iarchive.hpp +// +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON + +// (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/detail/workaround.hpp> +#include <boost/serialization/pfto.hpp> + +#include <boost/archive/detail/common_iarchive.hpp> +#include <boost/serialization/collection_size_type.hpp> +#include <boost/serialization/string.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_iarchive - read serialized objects from a input binary stream +template<class Archive> +class basic_binary_iarchive : + public detail::common_iarchive<Archive> +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive<Archive>; +#else + friend class detail::interface_iarchive<Archive>; +#endif + // intermediate level to support override of operators + // fot templates in the absence of partial function + // template ordering. If we get here pass to base class + // note extra nonsense to sneak it pass the borland compiers + typedef detail::common_iarchive<Archive> detail_common_iarchive; + template<class T> + void load_override(T & t, BOOST_PFTO int version){ + this->detail_common_iarchive::load_override(t, static_cast<int>(version)); + } + // binary files don't include the optional information + void load_override(class_id_optional_type & /* t */, int){} + + // the following have been overridden to provide specific sizes + // for these pseudo prmitive types. + void load_override(version_type & t, int){ + // upto 255 versions + unsigned char x=0; + * this->This() >> x; + t = version_type(x); + } + void load_override(class_id_type & t, int){ + // upto 32K classes + int_least16_t x=0; + * this->This() >> x; + t = class_id_type(x); + } + void load_override(class_id_reference_type & t, int){ + // upto 32K classes + int_least16_t x=0; + * this->This() >> x; + t = class_id_reference_type(x); + } + void load_override(object_id_type & t, int){ + // upto 2G objects + uint_least32_t x=0; + * this->This() >> x; + t = object_id_type(x); + } + void load_override(object_reference_type & t, int){ + // upto 2G objects + uint_least32_t x=0; + * this->This() >> x; + t = object_reference_type(x); + } + void load_override(tracking_type & t, int){ + char x=0; + * this->This() >> x; + t = (0 != x); + } + void load_override(serialization::collection_size_type & t, int){ + if (this->get_library_version() < 6) { + unsigned int x=0; + * this->This() >> x; + t = serialization::collection_size_type(x); + } + else { + std::size_t x=0; + * this->This() >> x; + t = serialization::collection_size_type(x); + } + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + basic_binary_iarchive(unsigned int flags) : + detail::common_iarchive<Archive>(flags) + {} +}; + +} // 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_BINARY_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_binary_iprimitive.hpp b/Utilities/BGL/boost/archive/basic_binary_iprimitive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c374e0b0cea4af1000deb8f65b3d98c8511eb407 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_binary_iprimitive.hpp @@ -0,0 +1,190 @@ +#ifndef BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP +#define BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(_MSC_VER) +#pragma warning( disable : 4800 ) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iprimitive.hpp +// +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON + +// (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 <iosfwd> +#include <cassert> +#include <locale> +#include <cstring> // std::memcpy +#include <cstddef> // std::size_t +#include <streambuf> // basic_streambuf +#include <string> + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; + using ::size_t; +} // namespace std +#endif + +#include <boost/cstdint.hpp> +#include <boost/scoped_ptr.hpp> +#include <boost/serialization/throw_exception.hpp> +#include <boost/integer.hpp> +#include <boost/integer_traits.hpp> + +#include <boost/archive/basic_streambuf_locale_saver.hpp> +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/mpl/placeholders.hpp> +#include <boost/serialization/is_bitwise_serializable.hpp> +#include <boost/serialization/array.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////////// +// class binary_iarchive - read serialized objects from a input binary stream +template<class Archive, class Elem, class Tr> +class basic_binary_iprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class load_access; +protected: +#else +public: +#endif + std::basic_streambuf<Elem, Tr> & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast<Archive *>(this); + } + + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr<std::locale> archive_locale; + basic_streambuf_locale_saver<Elem, Tr> locale_saver; + #endif + + // main template for serilization of primitive types + template<class T> + void load(T & t){ + load_binary(& t, sizeof(T)); + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + + // trap usage of invalid uninitialized boolean + void load(bool & t){ + load_binary(& t, sizeof(t)); + int i = t; + assert(0 == i || 1 == i); + (void)i; // warning suppression for release builds. + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(char * t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load(wchar_t * t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_binary_iprimitive( + std::basic_streambuf<Elem, Tr> & sb, + bool no_codecvt + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_binary_iprimitive(); +public: + // we provide an optimized load for all fundamental types + // typedef serialization::is_bitwise_serializable<mpl::_1> + // use_array_optimization; + struct use_array_optimization { + template <class T> + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable<T>::type type; + }; + #else + struct apply : public boost::serialization::is_bitwise_serializable<T> {}; + #endif + }; + + // the optimized load_array dispatches to load_binary + template <class ValueType> + void load_array(serialization::array<ValueType>& a, unsigned int) + { + load_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void + load_binary(void *address, std::size_t count); +}; + +template<class Archive, class Elem, class Tr> +inline void +basic_binary_iprimitive<Archive, Elem, Tr>::load_binary( + void *address, + std::size_t count +){ + // note: an optimizer should eliminate the following for char files + assert( + static_cast<std::streamsize>(count / sizeof(Elem)) + <= boost::integer_traits<std::streamsize>::const_max + ); + std::streamsize s = static_cast<std::streamsize>(count / sizeof(Elem)); + std::streamsize scount = m_sb.sgetn( + static_cast<Elem *>(address), + s + ); + if(scount != s) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + // note: an optimizer should eliminate the following for char files + assert(count % sizeof(Elem) <= boost::integer_traits<std::streamsize>::const_max); + s = static_cast<std::streamsize>(count % sizeof(Elem)); + if(0 < s){ +// if(is.fail()) +// boost::serialization::throw_exception( +// archive_exception(archive_exception::stream_error) +// ); + Elem t; + scount = m_sb.sgetn(& t, 1); + if(scount != 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + std::memcpy(static_cast<char*>(address) + (count - s), &t, s); + } +} + +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas + +#endif // BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_binary_oarchive.hpp b/Utilities/BGL/boost/archive/basic_binary_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f6dfd915ba4ea7d4e6b77408ffa2efdef34b0308 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_binary_oarchive.hpp @@ -0,0 +1,145 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_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. + +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON + +#include <cassert> +#include <boost/integer.hpp> +#include <boost/integer_traits.hpp> + +#include <boost/config.hpp> +#include <boost/serialization/pfto.hpp> + +#include <boost/detail/workaround.hpp> +#include <boost/archive/detail/common_oarchive.hpp> +#include <boost/serialization/string.hpp> +#include <boost/serialization/collection_size_type.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 { + +////////////////////////////////////////////////////////////////////// +// class basic_binary_oarchive - write serialized objects to a binary output stream +// note: this archive has no pretensions to portability. Archive format +// may vary across machine architectures and compilers. About the only +// guarentee is that an archive created with this code will be readable +// by a program built with the same tools for the same machne. This class +// does have the virtue of buiding the smalles archive in the minimum amount +// of time. So under some circumstances it may be he right choice. +template<class Archive> +class basic_binary_oarchive : + public archive::detail::common_oarchive<Archive> +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive<Archive>; +#else + friend class detail::interface_oarchive<Archive>; +#endif + // any datatype not specifed below will be handled by base class + typedef detail::common_oarchive<Archive> detail_common_oarchive; + template<class T> + void save_override(const T & t, BOOST_PFTO int version){ + this->detail_common_oarchive::save_override(t, static_cast<int>(version)); + } + + // binary files don't include the optional information + void save_override(const class_id_optional_type & /* t */, int){} + + void save_override(const version_type & t, int){ + // upto 255 versions + // note:t.t resolves borland ambguity + assert(t.t <= boost::integer_traits<unsigned char>::const_max); + const unsigned char x = static_cast<const unsigned char>(t.t); + * this->This() << x; + } + void save_override(const class_id_type & t, int){ + // upto 32K classes + assert(t.t <= boost::integer_traits<boost::int_least16_t>::const_max); + const boost::int_least16_t x = static_cast<const boost::int_least16_t>(t.t); + * this->This() << x; + } + void save_override(const class_id_reference_type & t, int){ + // upto 32K classes + assert(t.t <= boost::integer_traits<boost::int_least16_t>::const_max); + const boost::int_least16_t x = t.t; + * this->This() << x; + } + void save_override(const object_id_type & t, int){ + // upto 2G objects + assert(t.t <= boost::integer_traits<boost::uint_least32_t>::const_max); + const boost::uint_least32_t x = t.t; + * this->This() << x; + } + void save_override(const object_reference_type & t, int){ + // upto 2G objects + assert(t.t <= boost::integer_traits<boost::uint_least32_t>::const_max); + const boost::uint_least32_t x = t.t; + * this->This() << x; + } + void save_override(const tracking_type & t, int){ + const char x = t.t; + * this->This() << x; + } + + // explicitly convert to char * to avoid compile ambiguities + void save_override(const class_name_type & t, int){ + const std::string s(t); + * this->This() << s; + } + + void save_override(const serialization::collection_size_type & t, int){ + // for backward compatibility, 64 bit integer or variable length integer would be preferred + std::size_t x = t.t; + * this->This() << x; + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + basic_binary_oarchive(unsigned int flags) : + detail::common_oarchive<Archive>(flags) + {} +}; + +} // 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_BINARY_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_binary_oprimitive.hpp b/Utilities/BGL/boost/archive/basic_binary_oprimitive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..934744f6c61900cdd4f4ca03e10fbc9281c69438 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_binary_oprimitive.hpp @@ -0,0 +1,184 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oprimitive.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. + +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON + +#include <iosfwd> +#include <cassert> +#include <locale> +#include <streambuf> // basic_streambuf +#include <string> +#include <cstddef> // size_t + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/cstdint.hpp> +#include <boost/integer.hpp> +#include <boost/integer_traits.hpp> +#include <boost/scoped_ptr.hpp> +#include <boost/serialization/throw_exception.hpp> + +#include <boost/archive/basic_streambuf_locale_saver.hpp> +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/serialization/is_bitwise_serializable.hpp> +#include <boost/mpl/placeholders.hpp> +#include <boost/serialization/array.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_oprimitive - binary output of prmitives + +template<class Archive, class Elem, class Tr> +class basic_binary_oprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class save_access; +protected: +#else +public: +#endif + std::basic_streambuf<Elem, Tr> & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast<Archive *>(this); + } + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr<std::locale> archive_locale; + basic_streambuf_locale_saver<Elem, Tr> locale_saver; + #endif + // default saving of primitives. + template<class T> + void save(const T & t) + { + save_binary(& t, sizeof(T)); + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + + // trap usage of invalid uninitialized boolean which would + // otherwise crash on load. + void save(const bool t){ + assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t)); + save_binary(& t, sizeof(t)); + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const char * t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save(const wchar_t * t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_binary_oprimitive( + std::basic_streambuf<Elem, Tr> & sb, + bool no_codecvt + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_binary_oprimitive(); +public: + + // we provide an optimized save for all fundamental types + // typedef serialization::is_bitwise_serializable<mpl::_1> + // use_array_optimization; + // workaround without using mpl lambdas + struct use_array_optimization { + template <class T> + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef BOOST_DEDUCED_TYPENAME boost::serialization::is_bitwise_serializable<T>::type type; + }; + #else + struct apply : public boost::serialization::is_bitwise_serializable<T> {}; + #endif + }; + + + // the optimized save_array dispatches to save_binary + template <class ValueType> + void save_array(boost::serialization::array<ValueType> const& a, unsigned int) + { + save_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void save_binary(const void *address, std::size_t count); +}; + +template<class Archive, class Elem, class Tr> +inline void +basic_binary_oprimitive<Archive, Elem, Tr>::save_binary( + const void *address, + std::size_t count +){ + //assert( + // static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)()) >= count + //); + // note: if the following assertions fail + // a likely cause is that the output stream is set to "text" + // mode where by cr characters recieve special treatment. + // be sure that the output stream is opened with ios::binary + //if(os.fail()) + // boost::serialization::throw_exception( + // archive_exception(archive_exception::stream_error) + // ); + // figure number of elements to output - round up + count = ( count + sizeof(Elem) - 1) + / sizeof(Elem); + assert(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max)); + std::streamsize scount = m_sb.sputn( + static_cast<const Elem *>(address), + static_cast<std::streamsize>(count) + ); + if(count != static_cast<std::size_t>(scount)) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + //os.write( + // static_cast<const BOOST_DEDUCED_TYPENAME OStream::char_type *>(address), + // count + //); + //assert(os.good()); +} + +} //namespace boost +} //namespace archive + +#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_streambuf_locale_saver.hpp b/Utilities/BGL/boost/archive/basic_streambuf_locale_saver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ca764e10483f2241e38ef474ed76ae608f1c7fe6 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_streambuf_locale_saver.hpp @@ -0,0 +1,73 @@ +#ifndef BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP +#define BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_streambuf_local_saver.hpp + +// (C) Copyright 2005 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. + +// note derived from boost/io/ios_state.hpp +// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution +// are subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.) + +// See <http://www.boost.org/libs/io/> for the library's home page. + +#ifndef BOOST_NO_STD_LOCALE + +#include <locale> // for std::locale +#include <streambuf> // for std::basic_streambuf + +#include <boost/config.hpp> +#include <boost/noncopyable.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost{ +namespace archive{ + +template < typename Ch, class Tr > +class basic_streambuf_locale_saver : + private boost::noncopyable +{ +public: + typedef ::std::basic_streambuf<Ch, Tr> state_type; + typedef ::std::locale aspect_type; + explicit basic_streambuf_locale_saver( state_type &s ) + : s_save_( s ), a_save_( s.getloc() ) + {} + basic_streambuf_locale_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.pubimbue(a) ) + {} + ~basic_streambuf_locale_saver() + { this->restore(); } + void restore() + { s_save_.pubimbue( a_save_ ); } +private: + state_type & s_save_; + aspect_type const a_save_; +}; + +} // archive +} // boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_LOCALE +#endif // BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP diff --git a/Utilities/BGL/boost/archive/basic_text_iarchive.hpp b/Utilities/BGL/boost/archive/basic_text_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8d2bc078791ba7804482b9d511c7f4c45fceb7c9 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_text_iarchive.hpp @@ -0,0 +1,93 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iarchive.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. + +// archives stored as text - note these ar templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// note the fact that on libraries without wide characters, ostream is +// is not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream<IStream::char_type> but rather +// use two template parameters + +#include <boost/config.hpp> +#include <boost/serialization/pfto.hpp> +#include <boost/detail/workaround.hpp> + +#include <boost/archive/detail/common_iarchive.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 { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - read serialized objects from a input text stream +template<class Archive> +class basic_text_iarchive : + public detail::common_iarchive<Archive> +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive<Archive>; +#else + friend class detail::interface_iarchive<Archive>; +#endif + // intermediate level to support override of operators + // fot templates in the absence of partial function + // template ordering + typedef detail::common_iarchive<Archive> detail_common_iarchive; + template<class T> + void load_override(T & t, BOOST_PFTO int) + { + this->detail_common_iarchive::load_override(t, 0); + } + // text file don't include the optional information + void load_override(class_id_optional_type & /*t*/, int){} + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(class_name_type & t, int); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(void); + + basic_text_iarchive(unsigned int flags) : + detail::common_iarchive<Archive>(flags) + {} + ~basic_text_iarchive(){} +}; + +} // 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_TEXT_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_text_iprimitive.hpp b/Utilities/BGL/boost/archive/basic_text_iprimitive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..313052a254722c31486e17fff053670719fe4cc4 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_text_iprimitive.hpp @@ -0,0 +1,146 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iprimitive.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. + +// archives stored as text - note these are templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// Note the fact that on libraries without wide characters, ostream is +// not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream<IStream::char_type> but rather +// use two template parameters + +#include <cassert> +#include <locale> +#include <cstddef> // size_t + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT) + using ::locale; + #endif +} // namespace std +#endif + +#include <boost/detail/workaround.hpp> +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include <boost/archive/dinkumware.hpp> +#endif + +#include <boost/limits.hpp> +#include <boost/io/ios_state.hpp> +#include <boost/scoped_ptr.hpp> + +#include <boost/serialization/collection_size_type.hpp> +#include <boost/serialization/throw_exception.hpp> +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/basic_streambuf_locale_saver.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - load serialized objects from a input text stream +template<class IStream> +class basic_text_iprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +protected: +#else +public: +#endif + IStream &is; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr<std::locale> archive_locale; + basic_streambuf_locale_saver< + BOOST_DEDUCED_TYPENAME IStream::char_type, + BOOST_DEDUCED_TYPENAME IStream::traits_type + > locale_saver; + #endif + + template<class T> + void load(T & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + is >> t; + } + void load(unsigned char & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + unsigned short int i; + is >> i; + t = static_cast<unsigned char>(i); + } + void load(signed char & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + signed short int i; + is >> i; + t = static_cast<signed char>(i); + } + void load(char & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + short int i; + is >> i; + t = static_cast<char>(i); + } + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void load(wchar_t & t) + { + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + unsigned i; + is >> i; + t = static_cast<wchar_t>(i); + } + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_text_iprimitive(IStream &is, bool no_codecvt); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_text_iprimitive(); +public: + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_binary(void *address, std::size_t count); +}; + +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_text_oarchive.hpp b/Utilities/BGL/boost/archive/basic_text_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..47c3c0ecfdd17e406dbcf1eb7309007cab261b69 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_text_oarchive.hpp @@ -0,0 +1,143 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_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. + +// archives stored as text - note these ar templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// note the fact that on libraries without wide characters, ostream is +// is not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream<OStream::char_type> but rather +// use two template parameters + +#include <cassert> +#include <boost/config.hpp> +#include <boost/serialization/pfto.hpp> +#include <boost/detail/workaround.hpp> + +#include <boost/archive/detail/common_oarchive.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 { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oarchive +template<class Archive> +class basic_text_oarchive : + public detail::common_oarchive<Archive> +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ +|| BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x560)) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive<Archive>; +#else + friend class detail::interface_oarchive<Archive>; +#endif + enum { + none, + eol, + space + } delimiter; + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + newtoken(); + + void newline(){ + delimiter = eol; + } + + // default processing - kick back to base class. Note the + // extra stuff to get it passed borland compilers + typedef detail::common_oarchive<Archive> detail_common_oarchive; + template<class T> + void save_override(T & t, BOOST_PFTO int){ + this->detail_common_oarchive::save_override(t, 0); + } + + // start new objects on a new line + void save_override(const object_id_type & t, int){ + this->This()->newline(); + // note extra .t to funciton with Borland 5.51 compiler + // and invoke prmitive to underlying value + this->This()->save(t.t); + } + + void save_override(const object_reference_type & t, int){ + this->This()->newline(); + // note extra .t to funciton with Borland 5.51 compiler + // and invoke prmitive to underlying value + this->This()->save(t.t); + } + + // note the following four overrides are necessary for some borland + // compilers(5.51) which don't handle BOOST_STRONG_TYPE properly. + void save_override(const version_type & t, int){ + // note:t.t resolves borland ambguity + const unsigned int x = t.t; + * this->This() << x; + } + void save_override(const class_id_type & t, int){ + // note:t.t resolves borland ambguity + const int x = t.t; + * this->This() << x; + } + void save_override(const class_id_reference_type & t, int){ + // note:t.t resolves borland ambguity + const int x = t.t; + * this->This() << x; + } + + // text file don't include the optional information + void save_override(const class_id_optional_type & /* t */, int){} + + void save_override(const class_name_type & t, int){ + const std::string s(t); + * this->This() << s; + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + basic_text_oarchive(unsigned int flags) : + detail::common_oarchive<Archive>(flags), + delimiter(none) + {} + ~basic_text_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_TEXT_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_text_oprimitive.hpp b/Utilities/BGL/boost/archive/basic_text_oprimitive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3c0c083eeb330dd4ccf23577529da817c906939d --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_text_oprimitive.hpp @@ -0,0 +1,191 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oprimitive.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. + +// archives stored as text - note these ar templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// note the fact that on libraries without wide characters, ostream is +// is not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream<OStream::char_type> but rather +// use two template parameters + +#include <iomanip> +#include <locale> +#include <boost/config/no_tr1/cmath.hpp> // isnan +#include <cassert> +#include <cstddef> // size_t +#include <boost/serialization/collection_size_type.hpp> + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include <boost/archive/dinkumware.hpp> +#endif + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT) + using ::locale; + #endif +} // namespace std +#endif + +#include <boost/limits.hpp> +#include <boost/io/ios_state.hpp> +#include <boost/scoped_ptr.hpp> +#include <boost/serialization/throw_exception.hpp> +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/basic_streambuf_locale_saver.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +class save_access; + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oprimitive - output of prmitives to stream +template<class OStream> +class basic_text_oprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +protected: +#else +public: +#endif + OStream &os; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + boost::scoped_ptr<std::locale> archive_locale; + basic_streambuf_locale_saver< + BOOST_DEDUCED_TYPENAME OStream::char_type, + BOOST_DEDUCED_TYPENAME OStream::traits_type + > locale_saver; + #endif + + // default saving of primitives. + template<class T> + void save(const T &t){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << t; + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + void save(const bool t){ + // trap usage of invalid uninitialized boolean which would + // otherwise crash on load. + assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t)); + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << t; + } + void save(const signed char t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast<short int>(t); + } + void save(const unsigned char t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast<short unsigned int>(t); + } + void save(const char t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast<short int>(t); + } + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void save(const wchar_t t) + { + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << static_cast<int>(t); + } + #endif + void save(const float t) + { + // must be a user mistake - can't serialize un-initialized data + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << std::setprecision(std::numeric_limits<float>::digits10 + 2); + os << t; + } + void save(const double t) + { + // must be a user mistake - can't serialize un-initialized data + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os << std::setprecision(std::numeric_limits<double>::digits10 + 2); + os << t; + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_text_oprimitive(OStream & os, bool no_codecvt); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_text_oprimitive(); +public: + // unformatted append of one character + void put(BOOST_DEDUCED_TYPENAME OStream::char_type c){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + os.put(c); + } + // unformatted append of null terminated string + void put(const char * s){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + while('\0' != *s) + os.put(*s++); + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_binary(const void *address, std::size_t count); +}; + +} //namespace boost +} //namespace archive + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_xml_archive.hpp b/Utilities/BGL/boost/archive/basic_xml_archive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..df99836b97ed7cfbc89e794fe536ee05d0c47cf3 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_xml_archive.hpp @@ -0,0 +1,67 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_archive.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/archive/detail/auto_link_archive.hpp> +#include <boost/archive/archive_exception.hpp> + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +// constant strings used in xml i/o + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_OBJECT_ID(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_OBJECT_REFERENCE(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_CLASS_ID(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_CLASS_NAME(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_TRACKING(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_VERSION(); + +extern +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_XML_SIGNATURE(); + +}// namespace archive +}// namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/basic_xml_iarchive.hpp b/Utilities/BGL/boost/archive/basic_xml_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5351ff353a639eae33c25c24b47c402e1eb13c93 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_xml_iarchive.hpp @@ -0,0 +1,127 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_iarchive.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/serialization/pfto.hpp> +#include <boost/detail/workaround.hpp> + +#include <boost/archive/detail/common_iarchive.hpp> + +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/string.hpp> + +#include <boost/mpl/assert.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 { + +///////////////////////////////////////////////////////////////////////// +// class xml_iarchive - read serialized objects from a input text stream +template<class Archive> +class basic_xml_iarchive : + public detail::common_iarchive<Archive> +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive<Archive>; +#else + friend class detail::interface_oarchive<Archive>; +#endif + unsigned int depth; + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_start(const char *name); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_end(const char *name); + + // Anything not an attribute and not a name-value pair is an + // should be trapped here. + template<class T> + void load_override(T & t, BOOST_PFTO int) + { + // 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_iarchive::load_override(t, 0); + } + + // Anything not an attribute - see below - should be a name value + // pair and be processed here + typedef detail::common_iarchive<Archive> detail_common_iarchive; + template<class T> + void load_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + boost::serialization::nvp<T> & t, + int + ){ + this->This()->load_start(t.name()); + this->detail_common_iarchive::load_override(t.value(), 0); + this->This()->load_end(t.name()); + } + + // specific overrides for attributes - handle as + // primitives. These are not name-value pairs + // so they have to be intercepted here and passed on to load. + // although the class_id is included in the xml text file in order + // to make the file self describing, it isn't used when loading + // an xml archive. So we can skip it here. Note: we MUST override + // it otherwise it will be loaded as a normal primitive w/o tag and + // leaving the archive in an undetermined state + void load_override(class_id_optional_type & /* t */, int){} + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(object_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(version_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(class_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + load_override(tracking_type & t, int); + // class_name_type can't be handled here as it depends upon the + // char type used by the stream. So require the derived implementation + // handle this. + // void load_override(class_name_type & t, int); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_xml_iarchive(unsigned int flags); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~basic_xml_iarchive(); +}; + +} // 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_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/basic_xml_oarchive.hpp b/Utilities/BGL/boost/archive/basic_xml_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..154745a88ad3963f6182bc1fb64d2fb150034a43 --- /dev/null +++ b/Utilities/BGL/boost/archive/basic_xml_oarchive.hpp @@ -0,0 +1,145 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# 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/archive/detail/common_oarchive.hpp> + +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/string.hpp> + +#include <boost/mpl/assert.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 { + +////////////////////////////////////////////////////////////////////// +// class basic_xml_oarchive - write serialized objects to a xml output stream +template<class Archive> +class basic_xml_oarchive : + public detail::common_oarchive<Archive> +{ +protected: +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +public: +#elif defined(BOOST_MSVC) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive<Archive>; + friend class save_access; +#else + friend class detail::interface_oarchive<Archive>; + friend class save_access; +#endif + // special stuff for xml output + unsigned int depth; + bool indent_next; + bool pending_preamble; + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + indent(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + 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, BOOST_PFTO int) + { + // 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, 0); + } + + // special treatment for name-value pairs. + typedef detail::common_oarchive<Archive> detail_common_oarchive; + template<class T> + void save_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + ::boost::serialization::nvp<T> & t, + int + ){ + this->This()->save_start(t.name()); + this->detail_common_oarchive::save_override(t.const_value(), 0); + 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 object_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const object_reference_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const version_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_id_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_id_optional_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_id_reference_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const class_name_type & t, int); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_override(const tracking_type & t, int); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + basic_xml_oarchive(unsigned int flags); + BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~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 diff --git a/Utilities/BGL/boost/archive/binary_iarchive.hpp b/Utilities/BGL/boost/archive/binary_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..638d996729ffb134d20d9089f922ba888c2828d2 --- /dev/null +++ b/Utilities/BGL/boost/archive/binary_iarchive.hpp @@ -0,0 +1,103 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_iarchive.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 <istream> +#include <boost/archive/binary_iarchive_impl.hpp> +#include <boost/archive/detail/register_archive.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as binary_iarchive below - without the shared_ptr_helper +class naked_binary_iarchive : + public binary_iarchive_impl< + boost::archive::naked_binary_iarchive, + std::istream::char_type, + std::istream::traits_type + > +{ +public: + naked_binary_iarchive(std::istream & is, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_iarchive, std::istream::char_type, std::istream::traits_type + >(is, flags) + {} + naked_binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_iarchive, std::istream::char_type, std::istream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include <boost/archive/shared_ptr_helper.hpp> + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_iarchive_impl instead. This will +// preserve correct static polymorphism. +class binary_iarchive : + public binary_iarchive_impl< + boost::archive::binary_iarchive, + std::istream::char_type, + std::istream::traits_type + >, + public detail::shared_ptr_helper +{ +public: + binary_iarchive(std::istream & is, unsigned int flags = 0) : + binary_iarchive_impl< + binary_iarchive, std::istream::char_type, std::istream::traits_type + >(is, flags) + {} + binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + binary_iarchive, std::istream::char_type, std::istream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/binary_iarchive_impl.hpp b/Utilities/BGL/boost/archive/binary_iarchive_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..32c476d64556043ea22d461fc8dde09141537526 --- /dev/null +++ b/Utilities/BGL/boost/archive/binary_iarchive_impl.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_iarchive_impl.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 <istream> +#include <boost/serialization/pfto.hpp> +#include <boost/archive/basic_binary_iprimitive.hpp> +#include <boost/archive/basic_binary_iarchive.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +template<class Archive, class Elem, class Tr> +class binary_iarchive_impl : + public basic_binary_iprimitive<Archive, Elem, Tr>, + public basic_binary_iarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive<Archive>; + friend class basic_binary_iarchive<Archive>; + friend class load_access; +protected: +#endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + // make this protected so it can be called from a derived archive + template<class T> + void load_override(T & t, BOOST_PFTO int){ + this->basic_binary_iarchive<Archive>::load_override(t, 0L); + } + void init(unsigned int flags){ + if(0 != (flags & no_header)) + return; + #if ! defined(__MWERKS__) + this->basic_binary_iarchive<Archive>::init(); + this->basic_binary_iprimitive<Archive, Elem, Tr>::init(); + #else + basic_binary_iarchive<Archive>::init(); + basic_binary_iprimitive<Archive, Elem, Tr>::init(); + #endif + } + binary_iarchive_impl( + std::basic_streambuf<Elem, Tr> & bsb, + unsigned int flags + ) : + basic_binary_iprimitive<Archive, Elem, Tr>( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive<Archive>(flags) + { + init(flags); + } + binary_iarchive_impl( + std::basic_istream<Elem, Tr> & is, + unsigned int flags + ) : + basic_binary_iprimitive<Archive, Elem, Tr>( + * is.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive<Archive>(flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP diff --git a/Utilities/BGL/boost/archive/binary_oarchive.hpp b/Utilities/BGL/boost/archive/binary_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2aac14f9088e2f78f0de03b4c2e08cf3268adff4 --- /dev/null +++ b/Utilities/BGL/boost/archive/binary_oarchive.hpp @@ -0,0 +1,66 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_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 <ostream> +#include <boost/config.hpp> +#include <boost/archive/binary_oarchive_impl.hpp> +#include <boost/archive/detail/register_archive.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_oarchive_impl instead. This will +// preserve correct static polymorphism. +class binary_oarchive : + public binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + > +{ +public: + binary_oarchive(std::ostream & os, unsigned int flags = 0) : + binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + >(os, flags) + {} + binary_oarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + >(bsb, flags) + {} +}; + +typedef binary_oarchive naked_binary_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_oarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/binary_oarchive_impl.hpp b/Utilities/BGL/boost/archive/binary_oarchive_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7ca773b601157b7196481c86d7d95ffed687cfc3 --- /dev/null +++ b/Utilities/BGL/boost/archive/binary_oarchive_impl.hpp @@ -0,0 +1,97 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_oarchive_impl.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 <ostream> +#include <boost/config.hpp> +#include <boost/serialization/pfto.hpp> +#include <boost/archive/basic_binary_oprimitive.hpp> +#include <boost/archive/basic_binary_oarchive.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +template<class Archive, class Elem, class Tr> +class binary_oarchive_impl : + public basic_binary_oprimitive<Archive, Elem, Tr>, + public basic_binary_oarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive<Archive>; + friend class basic_binary_oarchive<Archive>; + friend class save_access; +protected: +#endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + // make this protected so it can be called from a derived archive + template<class T> + void save_override(T & t, BOOST_PFTO int){ + this->basic_binary_oarchive<Archive>::save_override(t, 0L); + } + void init(unsigned int flags) { + if(0 != (flags & no_header)) + return; + #if ! defined(__MWERKS__) + this->basic_binary_oarchive<Archive>::init(); + this->basic_binary_oprimitive<Archive, Elem, Tr>::init(); + #else + basic_binary_oarchive<Archive>::init(); + basic_binary_oprimitive<Archive, Elem, Tr>::init(); + #endif + } + binary_oarchive_impl( + std::basic_streambuf<Elem, Tr> & bsb, + unsigned int flags + ) : + basic_binary_oprimitive<Archive, Elem, Tr>( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive<Archive>(flags) + { + init(flags); + } + binary_oarchive_impl( + std::basic_ostream<Elem, Tr> & os, + unsigned int flags + ) : + basic_binary_oprimitive<Archive, Elem, Tr>( + * os.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive<Archive>(flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP diff --git a/Utilities/BGL/boost/archive/binary_wiarchive.hpp b/Utilities/BGL/boost/archive/binary_wiarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b5f6a7106be9842bf14393255cdf1e6f651dee38 --- /dev/null +++ b/Utilities/BGL/boost/archive/binary_wiarchive.hpp @@ -0,0 +1,93 @@ +#ifndef BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_wiarchive.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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <istream> // wistream +#include <boost/archive/binary_iarchive_impl.hpp> +#include <boost/archive/detail/register_archive.hpp> + +namespace boost { +namespace archive { + +// same as binary_wiarchive below - without the shared_ptr_helper +class naked_binary_wiarchive : + public binary_iarchive_impl< + boost::archive::naked_binary_wiarchive, + std::wistream::char_type, + std::wistream::traits_type + > +{ +public: + naked_binary_wiarchive(std::wistream & is, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_wiarchive, + std::wistream::char_type, + std::wistream::traits_type + >(is, flags) + {} + naked_binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + naked_binary_wiarchive, + std::wistream::char_type, + std::wistream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include <boost/archive/shared_ptr_helper.hpp> + +namespace boost { +namespace archive { + +class binary_wiarchive : + public binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + > +{ +public: + binary_wiarchive(std::wistream & is, unsigned int flags = 0) : + binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + >(is, flags) + {} + binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_wiarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/binary_woarchive.hpp b/Utilities/BGL/boost/archive/binary_woarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2075dac8bca1e4c12fcb7cb2cc6d6c1d36efd54c --- /dev/null +++ b/Utilities/BGL/boost/archive/binary_woarchive.hpp @@ -0,0 +1,61 @@ +#ifndef BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_woarchive.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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <ostream> +#include <boost/archive/binary_oarchive_impl.hpp> +#include <boost/archive/detail/register_archive.hpp> + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_oarchive_impl instead. This will +// preserve correct static polymorphism. +class binary_woarchive : + public binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + > +{ +public: + binary_woarchive(std::wostream & os, unsigned int flags = 0) : + binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + >(os, flags) + {} + binary_woarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + >(bsb, flags) + {} +}; + +typedef binary_woarchive naked_binary_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_woarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/codecvt_null.hpp b/Utilities/BGL/boost/archive/codecvt_null.hpp new file mode 100644 index 0000000000000000000000000000000000000000..910b26156a50eb69a155a2a30055df2dde1e279d --- /dev/null +++ b/Utilities/BGL/boost/archive/codecvt_null.hpp @@ -0,0 +1,100 @@ +#ifndef BOOST_ARCHIVE_CODECVT_NULL_HPP +#define BOOST_ARCHIVE_CODECVT_NULL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// codecvt_null.hpp: + +// (C) Copyright 2004 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 <locale> +#include <cstddef> // NULL, size_t +#include <cwchar> // for mbstate_t +#include <boost/config.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std { +// For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace. +// In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace) +# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + using ::codecvt; +# endif + using ::mbstate_t; + using ::size_t; +} // namespace +#endif + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +template<class Ch> +class codecvt_null; + +template<> +class codecvt_null<char> : public std::codecvt<char, char, std::mbstate_t> +{ + virtual bool do_always_noconv() const throw() { + return true; + } +public: + explicit codecvt_null(std::size_t no_locale_manage = 0) : + std::codecvt<char, char, std::mbstate_t>(no_locale_manage) + {} +}; + +template<> +class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t> +{ + virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result) + do_out( + std::mbstate_t & state, + const wchar_t * first1, + const wchar_t * last1, + const wchar_t * & next1, + char * first2, + char * last2, + char * & next2 + ) const; + virtual BOOST_WARCHIVE_DECL(std::codecvt_base::result) + do_in( + std::mbstate_t & state, + const char * first1, + const char * last1, + const char * & next1, + wchar_t * first2, + wchar_t * last2, + wchar_t * & next2 + ) const; + virtual int do_encoding( ) const throw( ){ + return sizeof(wchar_t) / sizeof(char); + } + virtual int do_max_length( ) const throw( ){ + return do_encoding(); + } +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif +#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas + +#endif //BOOST_ARCHIVE_CODECVT_NULL_HPP diff --git a/Utilities/BGL/boost/archive/detail/abi_prefix.hpp b/Utilities/BGL/boost/archive/detail/abi_prefix.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e39ef11f188233ffdcffd43b13cfbdc6a035716f --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/abi_prefix.hpp @@ -0,0 +1,20 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// abi_prefix.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/abi_prefix.hpp> // must be the last header +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275) +#endif + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/Utilities/BGL/boost/archive/detail/abi_suffix.hpp b/Utilities/BGL/boost/archive/detail/abi_suffix.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a283b36cf3fd083f6448066a684e5ac98a722218 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/abi_suffix.hpp @@ -0,0 +1,19 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// abi_suffix.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. + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/Utilities/BGL/boost/archive/detail/archive_serializer_map.hpp b/Utilities/BGL/boost/archive/detail/archive_serializer_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..096a24be345452b4ba785172c26dd3df9f05aedd --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/archive_serializer_map.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_ARCHIVE_SERIALIZER_MAP_HPP +#define BOOST_ARCHIVE_SERIALIZER_MAP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// archive_serializer_map.hpp: extenstion of type_info required for +// serialization. + +// (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. + +// note: this is nothing more than the thinest of wrappers around +// basic_serializer_map so we can have a one map / archive type. + +#include <boost/config.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_serializer; + +template<class Archive> +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) archive_serializer_map +{ +public: + static bool insert(const basic_serializer * bs); + static void erase(const basic_serializer * bs); + static const basic_serializer * find( + const boost::serialization::extended_type_info & type_ + ); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // must be the last header + +#endif //BOOST_ARCHIVE_SERIALIZER_MAP_HPP diff --git a/Utilities/BGL/boost/archive/detail/auto_link_archive.hpp b/Utilities/BGL/boost/archive/detail/auto_link_archive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..af2788b5366bd5a559bb36d3588f4307175291c8 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/auto_link_archive.hpp @@ -0,0 +1,48 @@ +#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// auto_link_archive.hpp +// +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// enable automatic library variant selection ------------------------------// + +#include <boost/archive/detail/decl.hpp> + +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \ +&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \ +&& !defined(BOOST_SERIALIZATION_SOURCE) + + // Set the name of our library, this will get undef'ed by auto_link.hpp + // once it's done with it: + // + #define BOOST_LIB_NAME boost_serialization + // + // If we're importing code from a dll, then tell auto_link.hpp about it: + // + #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) + # define BOOST_DYN_LINK + #endif + // + // And include the header that does the work: + // + #include <boost/config/auto_link.hpp> +#endif // auto-linking disabled + +#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/detail/auto_link_warchive.hpp b/Utilities/BGL/boost/archive/detail/auto_link_warchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4d4efcd44fa2b6c14dbf4ce6ffdf0cf07fc2b8c0 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/auto_link_warchive.hpp @@ -0,0 +1,47 @@ +#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// auto_link_warchive.hpp +// +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// enable automatic library variant selection ------------------------------// + +#include <boost/archive/detail/decl.hpp> + +#if !defined(BOOST_WARCHIVE_SOURCE) \ +&& !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) + +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_wserialization +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include <boost/config/auto_link.hpp> +#endif // auto-linking disabled + +#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_archive_impl.hpp b/Utilities/BGL/boost/archive/detail/basic_archive_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..589368ddc1af1d8677e22c7e03f2c65651f423d1 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_archive_impl.hpp @@ -0,0 +1,48 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_ARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_ARCHIVE_IMPL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_archive_impl.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. + +// can't use this - much as I'd like to as borland doesn't support it +// #include <boost/scoped_ptr.hpp> + +#include <set> + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +////////////////////////////////////////////////////////////////////// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_archive_impl +{ +}; + +} // namespace detail +} // namespace serialization +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_DETAIL_BASIC_ARCHIVE_IMPL_HPP + + + diff --git a/Utilities/BGL/boost/archive/detail/basic_config.hpp b/Utilities/BGL/boost/archive/detail/basic_config.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5e37cae40bf4014cd42c744e2d2005204d6792ba --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_config.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// basic_config.hpp ---------------------------------------------// + +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include <boost/config.hpp> + +#ifdef BOOST_HAS_DECLSPEC // defined in config system +// we need to import/export our code only if the user has specifically +// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost +// libraries to be dynamically linked, or BOOST_ARCHIVE_DYN_LINK +// if they want just this one to be dynamically linked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_ARCHIVE_DYN_LINK) +// export if this is our own source, otherwise import: +#ifdef BOOST_ARCHIVE_SOURCE +# define BOOST_ARCHIVE_DECL __declspec(dllexport) +#else +# define BOOST_ARCHIVE_DECL __declspec(dllimport) +#endif // BOOST_ARCHIVE_SOURCE +#endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC +// +// if BOOST_ARCHIVE_DECL isn't defined yet define it now: +#ifndef BOOST_ARCHIVE_DECL +#define BOOST_ARCHIVE_DECL +#endif + +#endif // BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_iarchive.hpp b/Utilities/BGL/boost/archive/detail/basic_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c7961775bbbf9c90283bda04fa348b1c3a1acfc9 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_iarchive.hpp @@ -0,0 +1,110 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_iarchive.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. + +// can't use this - much as I'd like to as borland doesn't support it +// #include <boost/scoped_ptr.hpp> + +#include <boost/config.hpp> +#include <boost/noncopyable.hpp> + +#include <boost/type_traits/broken_compiler_spec.hpp> +#include <boost/serialization/tracking_enum.hpp> +#include <boost/archive/basic_archive.hpp> +#include <boost/archive/detail/decl.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_iarchive_impl; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; +////////////////////////////////////////////////////////////////////// +// class basic_iarchive - read serialized objects from a input stream +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive : + private boost::noncopyable +{ + friend class basic_iarchive_impl; + // hide implementation of this class to minimize header conclusion + // in client code. I couldn't used scoped pointer with borland + // boost::scoped_ptr<basic_iarchive_impl> pimpl; + basic_iarchive_impl * pimpl; + + virtual void vload(version_type &t) = 0; + virtual void vload(object_id_type &t) = 0; + virtual void vload(class_id_type &t) = 0; + virtual void vload(class_id_optional_type &t) = 0; + virtual void vload(class_name_type &t) = 0; + virtual void vload(tracking_type &t) = 0; +protected: + basic_iarchive(unsigned int flags); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_iarchive(); +public: + // note: NOT part of the public API. + void next_object_pointer(void *t); + void register_basic_serializer( + const basic_iserializer & bis + ); + void load_object( + void *t, + const basic_iserializer & bis + ); + const basic_pointer_iserializer * + load_pointer( + void * & t, + const basic_pointer_iserializer * bpis_ptr, + const basic_pointer_iserializer * (*finder)( + const boost::serialization::extended_type_info & eti + ) + + ); + // real public API starts here + void + set_library_version(version_type archive_library_version); + unsigned int + get_library_version() const; + unsigned int + get_flags() const; + void + reset_object_address(const void * new_address, const void * old_address); + void + delete_created_pointers(); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +// required by smart_cast for compilers not implementing +// partial template specialization +BOOST_TT_BROKEN_COMPILER_SPEC( + boost::archive::detail::basic_iarchive +) + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_iserializer.hpp b/Utilities/BGL/boost/archive/detail/basic_iserializer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2f4f6d811f9134a6725f80fbc0c701c1d943957a --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_iserializer.hpp @@ -0,0 +1,95 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_iserializer.hpp: extenstion of type_info required for serialization. + +// (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 <cstdlib> // NULL +#include <boost/config.hpp> + +#include <boost/archive/basic_archive.hpp> +#include <boost/archive/detail/decl.hpp> +#include <boost/archive/detail/basic_serializer.hpp> +#include <boost/archive/detail/auto_link_archive.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 serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer : + public basic_serializer +{ +private: + basic_pointer_iserializer *m_bpis; +protected: + explicit basic_iserializer( + const boost::serialization::extended_type_info & type + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_iserializer(); +public: + bool serialized_as_pointer() const { + return m_bpis != NULL; + } + void set_bpis(basic_pointer_iserializer *bpis){ + m_bpis = bpis; + } + const basic_pointer_iserializer * get_bpis_ptr() const { + return m_bpis; + } + virtual void load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version + ) const = 0; + // returns true if class_info should be saved + virtual bool class_info() const = 0 ; + // returns true if objects should be tracked + virtual bool tracking(const unsigned int) const = 0 ; + // returns class version + virtual version_type version() const = 0 ; + // returns true if this class is polymorphic + virtual bool is_polymorphic() const = 0; + virtual void destroy(/*const*/ void *address) const = 0 ; +}; + +} // namespae detail +} // 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_DETAIL_BASIC_ISERIALIZER_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_oarchive.hpp b/Utilities/BGL/boost/archive/detail/basic_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d418afd6483dc6f39a02c7c60b0dd07a0b588856 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_oarchive.hpp @@ -0,0 +1,106 @@ +#ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_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 <cstddef> // NULL +#include <boost/config.hpp> +#include <boost/noncopyable.hpp> + +#include <boost/type_traits/broken_compiler_spec.hpp> + +// can't use this - much as I'd like to as borland doesn't support it +// #include <boost/scoped_ptr.hpp> + +#include <boost/archive/basic_archive.hpp> +#include <boost/serialization/tracking_enum.hpp> + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_oarchive_impl; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; +////////////////////////////////////////////////////////////////////// +// class basic_oarchive - write serialized objects to an output stream +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive : + private boost::noncopyable +{ + friend class basic_oarchive_impl; + // hide implementation of this class to minimize header conclusion + // in client code. note: borland can't use scoped_ptr + //boost::scoped_ptr<basic_oarchive_impl> pimpl; + basic_oarchive_impl * pimpl; + + // overload these to bracket object attributes. Used to implement + // xml archives + virtual void vsave(const version_type t) = 0; + virtual void vsave(const object_id_type t) = 0; + virtual void vsave(const object_reference_type t) = 0; + virtual void vsave(const class_id_type t) = 0; + virtual void vsave(const class_id_optional_type t) = 0; + virtual void vsave(const class_id_reference_type t) = 0; + virtual void vsave(const class_name_type & t) = 0; + virtual void vsave(const tracking_type t) = 0; +protected: + basic_oarchive(unsigned int flags = 0); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_oarchive(); +public: + // note: NOT part of the public interface + void register_basic_serializer( + const basic_oserializer & bos + ); + void save_object( + const void *x, + const basic_oserializer & bos + ); + void save_pointer( + const void * t, + const basic_pointer_oserializer * bpos_ptr + ); + void save_null_pointer(){ + vsave(NULL_POINTER_TAG); + } + // real public interface starts here + void end_preamble(); // default implementation does nothing + unsigned int get_library_version() const; + unsigned int get_flags() const; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +// required by smart_cast for compilers not implementing +// partial template specialization +BOOST_TT_BROKEN_COMPILER_SPEC( + boost::archive::detail::basic_oarchive +) + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_oserializer.hpp b/Utilities/BGL/boost/archive/detail/basic_oserializer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..74af7e657762eff300e25c0392be5b66def153c4 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_oserializer.hpp @@ -0,0 +1,93 @@ +#ifndef BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP +#define BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_oserializer.hpp: extenstion of type_info required for serialization. + +// (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 <cstddef> // NULL +#include <boost/config.hpp> +#include <boost/noncopyable.hpp> + +#include <boost/archive/basic_archive.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/basic_serializer.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 serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer : + public basic_serializer +{ +private: + basic_pointer_oserializer *m_bpos; +protected: + explicit basic_oserializer( + const boost::serialization::extended_type_info & type_ + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_oserializer(); +public: + bool serialized_as_pointer() const { + return m_bpos != NULL; + } + void set_bpos(basic_pointer_oserializer *bpos){ + m_bpos = bpos; + } + const basic_pointer_oserializer * get_bpos() const { + return m_bpos; + } + virtual void save_object_data( + basic_oarchive & ar, const void * x + ) const = 0; + // returns true if class_info should be saved + virtual bool class_info() const = 0; + // returns true if objects should be tracked + virtual bool tracking(const unsigned int flags) const = 0; + // returns class version + virtual version_type version() const = 0; + // returns true if this class is polymorphic + virtual bool is_polymorphic() const = 0; +}; + +} // namespace detail +} // namespace serialization +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_pointer_iserializer.hpp b/Utilities/BGL/boost/archive/detail/basic_pointer_iserializer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d957b83e645732063356c17128406f07d660e534 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_pointer_iserializer.hpp @@ -0,0 +1,73 @@ +#ifndef BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_pointer_oserializer.hpp: extenstion of type_info required for +// serialization. + +// (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/noncopyable.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/basic_serializer.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 serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer + : public basic_serializer { +protected: + explicit basic_pointer_iserializer( + const boost::serialization::extended_type_info & type_ + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_pointer_iserializer(); +public: + virtual const basic_iserializer & get_basic_serializer() const = 0; + virtual void load_object_ptr( + basic_iarchive & ar, + void * & x, + const unsigned int file_version + ) const = 0; +}; + +} // namespace detail +} // 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_POINTER_ISERIALIZER_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_pointer_oserializer.hpp b/Utilities/BGL/boost/archive/detail/basic_pointer_oserializer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b0d3fb9597ca291102095ad3db0929a9f7a5d175 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_pointer_oserializer.hpp @@ -0,0 +1,72 @@ +#ifndef BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_pointer_oserializer.hpp: extenstion of type_info required for +// serialization. + +// (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/noncopyable.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/basic_serializer.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 serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer : + public basic_serializer +{ +protected: + explicit basic_pointer_oserializer( + const boost::serialization::extended_type_info & type_ + ); +public: + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_pointer_oserializer(); + virtual const basic_oserializer & get_basic_serializer() const = 0; + virtual void save_object_ptr( + basic_oarchive & ar, + const void * x + ) const = 0; +}; + +} // namespace detail +} // 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_POINTER_OSERIALIZER_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_serializer.hpp b/Utilities/BGL/boost/archive/detail/basic_serializer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ab2ffe9d08cc3bd1601c5733f9eee18baab35dff --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_serializer.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_ARCHIVE_BASIC_SERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_SERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_serializer.hpp: extenstion of type_info required for serialization. + +// (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 <cassert> +#include <cstddef> // NULL + +#include <boost/noncopyable.hpp> +#include <boost/config.hpp> +#include <boost/serialization/extended_type_info.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { +namespace detail { + +class basic_serializer : + private boost::noncopyable +{ + const boost::serialization::extended_type_info * m_eti; +protected: + explicit basic_serializer( + const boost::serialization::extended_type_info & eti + ) : + m_eti(& eti) + { + assert(NULL != & eti); + } +public: + inline bool + operator<(const basic_serializer & rhs) const { + // can't compare address since there can be multiple eti records + // for the same type in different execution modules (that is, DLLS) + // leave this here as a reminder not to do this! + // return & lhs.get_eti() < & rhs.get_eti(); + return get_eti() < rhs.get_eti(); + } + const char * get_debug_info() const { + return m_eti->get_debug_info(); + } + const boost::serialization::extended_type_info & get_eti() const { + return * m_eti; + } +}; + +class basic_serializer_arg : public basic_serializer { +public: + basic_serializer_arg(const serialization::extended_type_info & eti) : + basic_serializer(eti) + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP diff --git a/Utilities/BGL/boost/archive/detail/basic_serializer_map.hpp b/Utilities/BGL/boost/archive/detail/basic_serializer_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d17c5c3c8a4d52eb914cba101b16b01cf471c94c --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/basic_serializer_map.hpp @@ -0,0 +1,65 @@ +#ifndef BOOST_SERIALIZER_MAP_HPP +#define BOOST_SERIALIZER_MAP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_serializer_map.hpp: extenstion of type_info required for serialization. + +// (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 <set> + +#include <boost/config.hpp> +#include <boost/utility.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} + +namespace archive { +namespace detail { + +class basic_serializer; + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_serializer_map : public + boost::noncopyable +{ + struct type_info_pointer_compare + { + bool operator()( + const basic_serializer * lhs, const basic_serializer * rhs + ) const ; + }; + typedef std::set<const basic_serializer *, type_info_pointer_compare> map_type; + map_type m_map; +public: + bool insert(const basic_serializer * bs); + void erase(const basic_serializer * bs); + const basic_serializer * find( + const boost::serialization::extended_type_info & type_ + ) const; +private: + // cw 8.3 requires this + basic_serializer_map& operator=(basic_serializer_map const&); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // must be the last header + +#endif // BOOST_SERIALIZER_MAP_HPP diff --git a/Utilities/BGL/boost/archive/detail/check.hpp b/Utilities/BGL/boost/archive/detail/check.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7bdbf65248c5e380d4f40ef8cbc0557aede2fa71 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/check.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) && (_MSC_VER >= 1020) +# 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> +void inline check_object_level(){ + typedef + BOOST_DEDUCED_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> +void inline check_object_versioning(){ + typedef + BOOST_DEDUCED_TYPENAME mpl::or_< + BOOST_DEDUCED_TYPENAME mpl::greater< + serialization::implementation_level<T>, + mpl::int_<serialization::object_serializable> + >, + BOOST_DEDUCED_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> +void inline check_object_tracking(){ + // presume it has already been determined that + // T is not a const + BOOST_STATIC_ASSERT(! boost::is_const<T>::value); + typedef BOOST_DEDUCED_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> +void inline check_pointer_level(){ + // we should only invoke this once we KNOW that T + // has been used as a pointer!! + typedef + BOOST_DEDUCED_TYPENAME mpl::or_< + BOOST_DEDUCED_TYPENAME mpl::greater< + serialization::implementation_level<T>, + mpl::int_<serialization::object_serializable> + >, + BOOST_DEDUCED_TYPENAME mpl::not_< + BOOST_DEDUCED_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 BOOST_DEDUCED_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> +void inline check_const_loading(){ + typedef + BOOST_DEDUCED_TYPENAME mpl::or_< + BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper<T>, + BOOST_DEDUCED_TYPENAME mpl::not_< + BOOST_DEDUCED_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 diff --git a/Utilities/BGL/boost/archive/detail/common_iarchive.hpp b/Utilities/BGL/boost/archive/detail/common_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..004e131e78afb96b7c725dc45a15f68095494f55 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/common_iarchive.hpp @@ -0,0 +1,90 @@ +#ifndef BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// common_iarchive.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/archive/detail/basic_iarchive.hpp> +#include <boost/archive/detail/basic_pointer_iserializer.hpp> +#include <boost/archive/detail/interface_iarchive.hpp> +#include <boost/archive/detail/archive_serializer_map.hpp> +#include <boost/serialization/singleton.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { +namespace detail { + +class extended_type_info; + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template<class Archive> +class common_iarchive : + public basic_iarchive, + public interface_iarchive<Archive> +{ + friend class interface_iarchive<Archive>; +private: + virtual void vload(version_type & t){ + * this->This() >> t; + } + virtual void vload(object_id_type & t){ + * this->This() >> t; + } + virtual void vload(class_id_type & t){ + * this->This() >> t; + } + virtual void vload(class_id_optional_type & t){ + * this->This() >> t; + } + virtual void vload(tracking_type & t){ + * this->This() >> t; + } + virtual void vload(class_name_type &s){ + * this->This() >> s; + } +protected: + // default processing - invoke serialization library + template<class T> + void load_override(T & t, BOOST_PFTO int){ + archive::load(* this->This(), t); + } + // default implementations of functions which emit start/end tags for + // archive types that require them. + void load_start(const char * /*name*/){} + void load_end(const char * /*name*/){} + // default archive initialization + common_iarchive(unsigned int flags = 0) : + basic_iarchive(flags), + interface_iarchive<Archive>() + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/detail/common_oarchive.hpp b/Utilities/BGL/boost/archive/detail/common_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7962063a5886484b4a8562505a309daeaa250194 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/common_oarchive.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// common_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/archive/detail/basic_oarchive.hpp> +#include <boost/archive/detail/interface_oarchive.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { +namespace detail { + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template<class Archive> +class common_oarchive : + public basic_oarchive, + public interface_oarchive<Archive> +{ + friend class interface_oarchive<Archive>; +private: + virtual void vsave(const version_type t){ + * this->This() << t; + } + virtual void vsave(const object_id_type t){ + * this->This() << t; + } + virtual void vsave(const object_reference_type t){ + * this->This() << t; + } + virtual void vsave(const class_id_type t){ + * this->This() << t; + } + virtual void vsave(const class_id_reference_type t){ + * this->This() << t; + } + virtual void vsave(const class_id_optional_type t){ + * this->This() << t; + } + virtual void vsave(const class_name_type & t){ + * this->This() << t; + } + virtual void vsave(const tracking_type t){ + * this->This() << t; + } +protected: + // default processing - invoke serialization library + template<class T> + void save_override(T & t, BOOST_PFTO int){ + archive::save(* this->This(), t); + } + void save_start(const char * /*name*/){} + void save_end(const char * /*name*/){} + common_oarchive(unsigned int flags = 0) : + basic_oarchive(flags), + interface_oarchive<Archive>() + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/detail/decl.hpp b/Utilities/BGL/boost/archive/detail/decl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9695001abe98e375f11b570e7c06fc5daecdc453 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/decl.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_ARCHIVE_DETAIL_DECL_HPP +#define BOOST_ARCHIVE_DETAIL_DECL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8 +// decl.hpp +// +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include <boost/config.hpp> +#include <boost/preprocessor/facilities/empty.hpp> + +#if defined(BOOST_HAS_DECLSPEC) + #if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)) + #if defined(BOOST_ARCHIVE_SOURCE) + #if defined(__BORLANDC__) + #define BOOST_ARCHIVE_DECL(T) T __export + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T __export + #else + #define BOOST_ARCHIVE_DECL(T) __declspec(dllexport) T + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) __declspec(dllexport) T + #endif + #else + #if defined(__BORLANDC__) + #define BOOST_ARCHIVE_DECL(T) T __import + #else + #define BOOST_ARCHIVE_DECL(T) __declspec(dllimport) T + #endif + #endif + #if defined(BOOST_WARCHIVE_SOURCE) + #if defined(__BORLANDC__) + #define BOOST_WARCHIVE_DECL(T) T __export + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T __export + #else + #define BOOST_WARCHIVE_DECL(T) __declspec(dllexport) T + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) __declspec(dllexport) T + #endif + #else + #if defined(__BORLANDC__) + #define BOOST_WARCHIVE_DECL(T) T __import + #else + #define BOOST_WARCHIVE_DECL(T) __declspec(dllimport) T + #endif + #endif + #if !defined(BOOST_WARCHIVE_SOURCE) && !defined(BOOST_ARCHIVE_SOURCE) + #if defined(__BORLANDC__) + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T __import + #else + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) __declspec(dllimport) T + #endif + #endif + #endif +#endif // BOOST_HAS_DECLSPEC + +#if ! defined(BOOST_ARCHIVE_DECL) + #define BOOST_ARCHIVE_DECL(T) T +#endif +#if ! defined(BOOST_WARCHIVE_DECL) + #define BOOST_WARCHIVE_DECL(T) T +#endif +#if ! defined(BOOST_ARCHIVE_OR_WARCHIVE_DECL) + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL(T) T +#endif + +#endif // BOOST_ARCHIVE_DETAIL_DECL_HPP diff --git a/Utilities/BGL/boost/archive/detail/interface_iarchive.hpp b/Utilities/BGL/boost/archive/detail/interface_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7fd363d059c1363bf7a096c1c234663eb71da50a --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/interface_iarchive.hpp @@ -0,0 +1,78 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// interface_iarchive.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 <string> +#include <cstddef> // NULL +#include <boost/cstdint.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/iserializer.hpp> +#include <boost/serialization/singleton.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; + +template<class Archive> +class interface_iarchive +{ +protected: + interface_iarchive(){}; +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_<true> is_loading; + typedef mpl::bool_<false> is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast<Archive *>(this); + } + + template<class T> + const basic_pointer_iserializer * + register_type(T * = NULL){ + const basic_pointer_iserializer & bpis = + boost::serialization::singleton< + pointer_iserializer<Archive, T> + >::get_const_instance(); + this->This()->register_basic_serializer(bpis.get_basic_serializer()); + return & bpis; + } + template<class T> + Archive & operator>>(T & t){ + this->This()->load_override(t, 0); + return * this->This(); + } + + // the & operator + template<class T> + Archive & operator&(T & t){ + return *(this->This()) >> t; + } +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/detail/interface_oarchive.hpp b/Utilities/BGL/boost/archive/detail/interface_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6331e0ea8f159b115854b08e9957d1a22de32088 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/interface_oarchive.hpp @@ -0,0 +1,85 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// interface_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 <string> +#include <cstddef> // NULL +#include <boost/cstdint.hpp> +#include <boost/mpl/bool.hpp> + +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/detail/oserializer.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +#include <boost/serialization/singleton.hpp> + +namespace boost { +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + +template<class Archive> +class interface_oarchive +{ +protected: + interface_oarchive(){}; +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_<false> is_loading; + typedef mpl::bool_<true> is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast<Archive *>(this); + } + + template<class T> + const basic_pointer_oserializer * + register_type(const T * = NULL){ + const basic_pointer_oserializer & bpos = + boost::serialization::singleton< + pointer_oserializer<Archive, T> + >::get_const_instance(); + this->This()->register_basic_serializer(bpos.get_basic_serializer()); + return & bpos; + } + + template<class T> + Archive & operator<<(T & t){ + this->This()->save_override(t, 0); + return * this->This(); + } + + // the & operator + template<class T> + Archive & operator&(T & t){ + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + return * this->This() << const_cast<const T &>(t); + #else + return * this->This() << t; + #endif + } +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/detail/iserializer.hpp b/Utilities/BGL/boost/archive/detail/iserializer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..915f771b4ee7e2ce486be992c80cc98eabaeb560 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/iserializer.hpp @@ -0,0 +1,620 @@ +#ifndef BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP +#define BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# 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 +// iserializer.hpp: interface for serialization system. + +// (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 <new> // for placement new +#include <memory> // for auto_ptr +#include <cstddef> // size_t, NULL + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/static_assert.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/greater_equal.hpp> +#include <boost/mpl/equal_to.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/detail/no_exceptions_support.hpp> + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include <boost/serialization/extended_type_info_typeid.hpp> +#endif +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/smart_cast.hpp> +#include <boost/serialization/static_warning.hpp> + +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/type_traits/remove_extent.hpp> +#include <boost/type_traits/is_polymorphic.hpp> + +#include <boost/serialization/assume_abstract.hpp> + +#define DONT_USE_HAS_NEW_OPERATOR ( \ + defined(__BORLANDC__) \ + || defined(__IBMCPP__) \ + || defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \ + || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ +) + +#if ! DONT_USE_HAS_NEW_OPERATOR +#include <boost/type_traits/has_new_operator.hpp> +#endif + +#include <boost/serialization/serialization.hpp> +#include <boost/serialization/version.hpp> +#include <boost/serialization/level.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/type_info_implementation.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/void_cast.hpp> +#include <boost/serialization/array.hpp> +#include <boost/serialization/collection_size_type.hpp> +#include <boost/serialization/singleton.hpp> +#include <boost/serialization/wrapper.hpp> + +// the following is need only for dynamic cast of polymorphic pointers +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/detail/basic_iarchive.hpp> +#include <boost/archive/detail/basic_iserializer.hpp> +#include <boost/archive/detail/basic_pointer_iserializer.hpp> +#include <boost/archive/detail/archive_serializer_map.hpp> +#include <boost/archive/detail/check.hpp> + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { + +// an accessor to permit friend access to archives. Needed because +// some compilers don't handle friend templates completely +class load_access { +public: + template<class Archive, class T> + static void load_primitive(Archive &ar, T &t){ + ar.load(t); + } +}; + +namespace detail { + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template<class Archive, class T> +class iserializer : public basic_iserializer +{ +private: + virtual void destroy(/*const*/ void *address) const { + boost::serialization::access::destroy(static_cast<T *>(address)); + } +protected: + // protected constructor since it's always created by singleton + explicit iserializer() : + basic_iserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance() + ) + {} +public: + virtual BOOST_DLLEXPORT void load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version + ) const BOOST_USED; + virtual bool class_info() const { + return boost::serialization::implementation_level<T>::value + >= boost::serialization::object_class_info; + } + virtual bool tracking(const unsigned int /* flags */) const { + return boost::serialization::tracking_level<T>::value + == boost::serialization::track_always + || ( boost::serialization::tracking_level<T>::value + == boost::serialization::track_selectively + && serialized_as_pointer()); + } + virtual version_type version() const { + return version_type(::boost::serialization::version<T>::value); + } + virtual bool is_polymorphic() const { + return boost::is_polymorphic<T>::value; + } + virtual ~iserializer(){}; +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template<class Archive, class T> +BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version +) const { + // trap case where the program cannot handle the current version + if(file_version > static_cast<const unsigned int>(version())) + boost::serialization::throw_exception( + archive::archive_exception( + boost::archive::archive_exception::unsupported_class_version, + get_debug_info() + ) + ); + + // make sure call is routed through the higest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + boost::serialization::smart_cast_reference<Archive &>(ar), + * static_cast<T *>(x), + file_version + ); +} + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template<class Archive, class T> +class pointer_iserializer : + public basic_pointer_iserializer +{ +private: + virtual const basic_iserializer & get_basic_serializer() const { + return boost::serialization::singleton< + iserializer<Archive, T> + >::get_const_instance(); + } + BOOST_DLLEXPORT virtual void load_object_ptr( + basic_iarchive & ar, + void * & x, + const unsigned int file_version + ) const BOOST_USED; +protected: + // this should alway be a singleton so make the constructor protected + pointer_iserializer(); + ~pointer_iserializer(); +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +// note trick to be sure that operator new is using class specific +// version if such exists. Due to Peter Dimov. +// note: the following fails if T has no default constructor. +// otherwise it would have been ideal +//struct heap_allocator : public T +//{ +// T * invoke(){ +// return ::new(sizeof(T)); +// } +//} + +template<class T> +struct heap_allocator +{ + // boost::has_new_operator<T> doesn't work on these compilers + #if DONT_USE_HAS_NEW_OPERATOR + // This doesn't handle operator new overload for class T + static T * invoke(){ + return static_cast<T *>(operator new(sizeof(T))); + } + #else + struct has_new_operator { + static T* invoke() { + return static_cast<T *>((T::operator new)(sizeof(T))); + } + }; + struct doesnt_have_new_operator { + static T* invoke() { + return static_cast<T *>(operator new(sizeof(T))); + } + }; + static T * invoke() { + typedef BOOST_DEDUCED_TYPENAME + mpl::eval_if< + boost::has_new_operator<T>, + mpl::identity<has_new_operator >, + mpl::identity<doesnt_have_new_operator > + >::type typex; + return typex::invoke(); + } + #endif +}; + +// due to Martin Ecker +template <typename T> +class auto_ptr_with_deleter +{ +public: + explicit auto_ptr_with_deleter(T* p) : + m_p(p) + {} + ~auto_ptr_with_deleter(){ + if (m_p) + boost::serialization::access::destroy(m_p); + } + T* get() const { + return m_p; + } + + T* release() { + T* p = m_p; + m_p = NULL; + return p; + } +private: + T* m_p; +}; + +// note: BOOST_DLLEXPORT is so that code for polymorphic class +// serialized only through base class won't get optimized out +template<class Archive, class T> +BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr( + basic_iarchive & ar, + void * & x, + const unsigned int file_version +) const +{ + Archive & ar_impl = + boost::serialization::smart_cast_reference<Archive &>(ar); + + auto_ptr_with_deleter<T> ap(heap_allocator<T>::invoke()); + if(NULL == ap.get()) + boost::serialization::throw_exception(std::bad_alloc()) ; + + T * t = ap.get(); + x = t; + + // catch exception during load_construct_data so that we don't + // automatically delete the t which is most likely not fully + // constructed + BOOST_TRY { + // this addresses an obscure situtation that occurs when + // load_constructor de-serializes something through a pointer. + ar.next_object_pointer(t); + boost::serialization::load_construct_data_adl<Archive, T>( + ar_impl, + t, + file_version + ); + } + BOOST_CATCH(...){ + ap.release(); + BOOST_RETHROW; + } + BOOST_CATCH_END + + ar_impl >> boost::serialization::make_nvp(NULL, * t); + ap.release(); +} + +template<class Archive, class T> +pointer_iserializer<Archive, T>::pointer_iserializer() : + basic_pointer_iserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance() + ) +{ + boost::serialization::singleton< + iserializer<Archive, T> + >::get_mutable_instance().set_bpis(this); + archive_serializer_map<Archive>::insert(this); +} + +template<class Archive, class T> +pointer_iserializer<Archive, T>::~pointer_iserializer(){ + archive_serializer_map<Archive>::erase(this); +} + +template<class Archive> +struct load_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct load_primitive { + template<class T> + static void invoke(Archive & ar, T & t){ + load_access::load_primitive(ar, t); + } + }; + // note this bounces the call right back to the archive + // with no runtime overhead + struct load_only { + template<class T> + static void invoke(Archive & ar, const T & t){ + // short cut to user's serializer + // make sure call is routed through the higest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + ar, + const_cast<T &>(t), + boost::serialization::version<T>::value + ); + } + }; + + // note this save class information including version + // and serialization level to the archive + struct load_standard { + template<class T> + static void invoke(Archive &ar, const T & t){ + void * x = & const_cast<T &>(t); + ar.load_object( + x, + boost::serialization::singleton< + iserializer<Archive, T> + >::get_const_instance() + ); + } + }; + + struct load_conditional { + template<class T> + static void invoke(Archive &ar, T &t){ + //if(0 == (ar.get_flags() & no_tracking)) + load_standard::invoke(ar, t); + //else + // load_only::invoke(ar, t); + } + }; + + template<class T> + static void invoke(Archive & ar, T &t){ + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + // if its primitive + mpl::equal_to< + boost::serialization::implementation_level<T>, + mpl::int_<boost::serialization::primitive_type> + >, + mpl::identity<load_primitive>, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // class info / version + mpl::greater_equal< + boost::serialization::implementation_level<T>, + mpl::int_<boost::serialization::object_class_info> + >, + // do standard load + mpl::identity<load_standard>, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // no tracking + mpl::equal_to< + boost::serialization::tracking_level<T>, + mpl::int_<boost::serialization::track_never> + >, + // do a fast load + mpl::identity<load_only>, + // else + // do a fast load only tracking is turned off + mpl::identity<load_conditional> + > > >::type typex; + check_object_versioning<T>(); + check_object_level<T>(); + typex::invoke(ar, t); + } +}; + +template<class Archive> +struct load_pointer_type { + struct abstract + { + template<class T> + static const basic_pointer_iserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(boost::is_polymorphic<T>::value); + return static_cast<basic_pointer_iserializer *>(NULL); + } + }; + + struct non_abstract + { + template<class T> + static const basic_pointer_iserializer * register_type(Archive & ar){ + return ar.register_type(static_cast<T *>(NULL)); + } + }; + + template<class T> + static const basic_pointer_iserializer * register_type(Archive &ar, T & /*t*/){ + // there should never be any need to load an abstract polymorphic + // class pointer. Inhibiting code generation for this + // permits abstract base classes to be used - note: exception + // virtual serialize functions used for plug-ins + typedef BOOST_DEDUCED_TYPENAME + mpl::eval_if< + boost::serialization::is_abstract<const T>, + boost::mpl::identity<abstract>, + boost::mpl::identity<non_abstract> + >::type typex; + return typex::template register_type<T>(ar); + } + + template<class T> + static T * pointer_tweak( + const boost::serialization::extended_type_info & eti, + void * t, + T & + ) { + // tweak the pointer back to the base class + return static_cast<T *>( + boost::serialization::void_upcast( + eti, + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance(), + t + ) + ); + } + + template<class T> + static void load(Archive & /* ar */ , T & /* t */){ + check_pointer_level<T>(); + check_pointer_tracking<T>(); + } + + static const basic_pointer_iserializer * + find(const boost::serialization::extended_type_info & type){ + return static_cast<const basic_pointer_iserializer *>( + archive_serializer_map<Archive>::find(type) + ); + } + + template<class Tptr> + static void invoke(Archive & ar, Tptr & t){ + load(ar, *t); + const basic_pointer_iserializer * bpis_ptr = register_type(ar, *t); + const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer( + * reinterpret_cast<void **>(&t), + bpis_ptr, + find + ); + // if the pointer isn't that of the base class + if(newbpis_ptr != bpis_ptr){ + t = pointer_tweak(newbpis_ptr->get_eti(), t, *t); + } + } +}; + +template<class Archive> +struct load_enum_type { + template<class T> + static void invoke(Archive &ar, T &t){ + // convert integers to correct enum to load + int i; + ar >> boost::serialization::make_nvp(NULL, i); + t = static_cast<T>(i); + } +}; + +template<class Archive> +struct load_array_type { + template<class T> + static void invoke(Archive &ar, T &t){ + typedef BOOST_DEDUCED_TYPENAME remove_extent<T>::type value_type; + + // convert integers to correct enum to load + // determine number of elements in the array. Consider the + // fact that some machines will align elements on boundries + // other than characters. + std::size_t current_count = sizeof(t) / ( + static_cast<char *>(static_cast<void *>(&t[1])) + - static_cast<char *>(static_cast<void *>(&t[0])) + ); + boost::serialization::collection_size_type count; + ar >> BOOST_SERIALIZATION_NVP(count); + if(static_cast<std::size_t>(count) > current_count) + boost::serialization::throw_exception( + archive::archive_exception( + boost::archive::archive_exception::array_size_too_short + ) + ); + ar >> serialization::make_array(static_cast<value_type*>(&t[0]),count); + } +}; + +} // detail + +template<class Archive, class T> +inline void load(Archive & ar, T &t){ + // if this assertion trips. It means we're trying to load a + // const object with a compiler that doesn't have correct + // funtion template ordering. On other compilers, this is + // handled below. + detail::check_const_loading<T>(); + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer<T>, + mpl::identity<detail::load_pointer_type<Archive> > + ,//else + BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array<T>, + mpl::identity<detail::load_array_type<Archive> > + ,//else + BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum<T>, + mpl::identity<detail::load_enum_type<Archive> > + ,//else + mpl::identity<detail::load_non_pointer_type<Archive> > + > + > + >::type typex; + typex::invoke(ar, t); +} + +#if 0 + +// BORLAND +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) +// borland has a couple of problems +// a) if function is partially specialized - see below +// const paramters are transformed to non-const ones +// b) implementation of base_object can't be made to work +// correctly which results in all base_object s being const. +// So, strip off the const for borland. This breaks the trap +// for loading const objects - but I see no alternative +template<class Archive, class T> +inline void load(Archive &ar, const T & t){ + load(ar, const_cast<T &>(t)); +} +#endif + +// let wrappers through. +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template<class Archive, class T> +inline void load_wrapper(Archive &ar, const T&t, mpl::true_){ + boost::archive::load(ar, const_cast<T&>(t)); +} + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) +template<class Archive, class T> +inline void load(Archive &ar, const T&t){ + load_wrapper(ar,t,serialization::is_wrapper<T>()); +} +#endif +#endif + +#endif + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP diff --git a/Utilities/BGL/boost/archive/detail/oserializer.hpp b/Utilities/BGL/boost/archive/detail/oserializer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1e311101eefda215eceec74fa44e5dfaa4af975a --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/oserializer.hpp @@ -0,0 +1,531 @@ +#ifndef BOOST_ARCHIVE_OSERIALIZER_HPP +#define BOOST_ARCHIVE_OSERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# 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 +// oserializer.hpp: interface for serialization system. + +// (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 <cassert> +#include <cstddef> // NULL + +#include <boost/config.hpp> +#include <boost/static_assert.hpp> +#include <boost/detail/workaround.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/equal_to.hpp> +#include <boost/mpl/greater_equal.hpp> +#include <boost/mpl/identity.hpp> + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include <boost/serialization/extended_type_info_typeid.hpp> +#endif +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/smart_cast.hpp> +#include <boost/serialization/assume_abstract.hpp> +#include <boost/serialization/static_warning.hpp> + +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_polymorphic.hpp> +#include <boost/type_traits/remove_extent.hpp> + +#include <boost/serialization/serialization.hpp> +#include <boost/serialization/version.hpp> +#include <boost/serialization/level.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/type_info_implementation.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/void_cast.hpp> +#include <boost/serialization/array.hpp> +#include <boost/serialization/collection_size_type.hpp> +#include <boost/serialization/singleton.hpp> + +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/detail/basic_oarchive.hpp> +#include <boost/archive/detail/basic_oserializer.hpp> +#include <boost/archive/detail/basic_pointer_oserializer.hpp> +#include <boost/archive/detail/archive_serializer_map.hpp> +#include <boost/archive/detail/check.hpp> + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { + +// an accessor to permit friend access to archives. Needed because +// some compilers don't handle friend templates completely +class save_access { +public: + template<class Archive> + static void end_preamble(Archive & ar){ + ar.end_preamble(); + } + template<class Archive, class T> + static void save_primitive(Archive & ar, const T & t){ + ar.end_preamble(); + ar.save(t); + } +}; + +namespace detail { + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template<class Archive, class T> +class oserializer : public basic_oserializer +{ +private: + // private constructor to inhibit any existence other than the + // static one +public: + explicit BOOST_DLLEXPORT oserializer() : + basic_oserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance() + ) + {} + virtual BOOST_DLLEXPORT void save_object_data( + basic_oarchive & ar, + const void *x + ) const BOOST_USED; + virtual bool class_info() const { + return boost::serialization::implementation_level<T>::value + >= boost::serialization::object_class_info; + } + virtual bool tracking(const unsigned int /* flags */) const { + return boost::serialization::tracking_level<T>::value == boost::serialization::track_always + || (boost::serialization::tracking_level<T>::value == boost::serialization::track_selectively + && serialized_as_pointer()); + } + virtual version_type version() const { + return version_type(::boost::serialization::version<T>::value); + } + virtual bool is_polymorphic() const { + return boost::is_polymorphic<T>::value; + } + virtual ~oserializer(){} +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template<class Archive, class T> +BOOST_DLLEXPORT void oserializer<Archive, T>::save_object_data( + basic_oarchive & ar, + const void *x +) const { + // make sure call is routed through the highest interface that might + // be specialized by the user. + BOOST_STATIC_ASSERT(boost::is_const<T>::value == false); + boost::serialization::serialize_adl( + boost::serialization::smart_cast_reference<Archive &>(ar), + * static_cast<T *>(const_cast<void *>(x)), + version() + ); +} + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template<class Archive, class T> +class pointer_oserializer : + public basic_pointer_oserializer +{ +private: + const basic_oserializer & + get_basic_serializer() const { + return boost::serialization::singleton< + oserializer<Archive, T> + >::get_const_instance(); + } + virtual BOOST_DLLEXPORT void save_object_ptr( + basic_oarchive & ar, + const void * x + ) const BOOST_USED; +public: + pointer_oserializer(); + ~pointer_oserializer(); +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template<class Archive, class T> +BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr( + basic_oarchive & ar, + const void * x +) const { + assert(NULL != x); + // make sure call is routed through the highest interface that might + // be specialized by the user. + T * t = static_cast<T *>(const_cast<void *>(x)); + const unsigned int file_version = boost::serialization::version<T>::value; + Archive & ar_impl + = boost::serialization::smart_cast_reference<Archive &>(ar); + boost::serialization::save_construct_data_adl<Archive, T>( + ar_impl, + t, + file_version + ); + ar_impl << boost::serialization::make_nvp(NULL, * t); +} + +template<class Archive, class T> +pointer_oserializer<Archive, T>::pointer_oserializer() : + basic_pointer_oserializer( + boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance() + ) +{ + // make sure appropriate member function is instantiated + boost::serialization::singleton< + oserializer<Archive, T> + >::get_mutable_instance().set_bpos(this); + archive_serializer_map<Archive>::insert(this); +} + +template<class Archive, class T> +pointer_oserializer<Archive, T>::~pointer_oserializer(){ + archive_serializer_map<Archive>::erase(this); +} + +template<class Archive> +struct save_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct save_primitive { + template<class T> + static void invoke(Archive & ar, const T & t){ + save_access::save_primitive(ar, t); + } + }; + // same as above but passes through serialization + struct save_only { + template<class T> + static void invoke(Archive & ar, const T & t){ + // make sure call is routed through the highest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + ar, + const_cast<T &>(t), + ::boost::serialization::version<T>::value + ); + } + }; + // adds class information to the archive. This includes + // serialization level and class version + struct save_standard { + template<class T> + static void invoke(Archive &ar, const T & t){ + ar.save_object( + & t, + boost::serialization::singleton< + oserializer<Archive, T> + >::get_const_instance() + ); + } + }; + + // adds class information to the archive. This includes + // serialization level and class version + struct save_conditional { + template<class T> + static void invoke(Archive &ar, const T &t){ + //if(0 == (ar.get_flags() & no_tracking)) + save_standard::invoke(ar, t); + //else + // save_only::invoke(ar, t); + } + }; + + + template<class T> + static void invoke(Archive & ar, const T & t){ + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // if its primitive + mpl::equal_to< + boost::serialization::implementation_level<T>, + mpl::int_<boost::serialization::primitive_type> + >, + mpl::identity<save_primitive>, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // class info / version + mpl::greater_equal< + boost::serialization::implementation_level<T>, + mpl::int_<boost::serialization::object_class_info> + >, + // do standard save + mpl::identity<save_standard>, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // no tracking + mpl::equal_to< + boost::serialization::tracking_level<T>, + mpl::int_<boost::serialization::track_never> + >, + // do a fast save + mpl::identity<save_only>, + // else + // do a fast save only tracking is turned off + mpl::identity<save_conditional> + > > >::type typex; + check_object_versioning<T>(); + typex::invoke(ar, t); + } + template<class T> + static void invoke(Archive & ar, T & t){ + check_object_level<T>(); + check_object_tracking<T>(); + invoke(ar, const_cast<const T &>(t)); + } +}; + +template<class Archive> +struct save_pointer_type { + struct abstract + { + template<class T> + static const basic_pointer_oserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(boost::is_polymorphic<T>::value); + return NULL; + } + }; + + struct non_abstract + { + template<class T> + static const basic_pointer_oserializer * register_type(Archive & ar){ + return ar.register_type(static_cast<T *>(NULL)); + } + }; + + template<class T> + static const basic_pointer_oserializer * register_type(Archive &ar, T & /*t*/){ + // there should never be any need to save an abstract polymorphic + // class pointer. Inhibiting code generation for this + // permits abstract base classes to be used - note: exception + // virtual serialize functions used for plug-ins + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + boost::serialization::is_abstract<T>, + mpl::identity<abstract>, + mpl::identity<non_abstract> + >::type typex; + return typex::template register_type<T>(ar); + } + + struct non_polymorphic + { + template<class T> + static void save( + Archive &ar, + T & t + ){ + const basic_pointer_oserializer & bpos = + boost::serialization::singleton< + pointer_oserializer<Archive, T> + >::get_const_instance(); + // save the requested pointer type + ar.save_pointer(& t, & bpos); + } + }; + + struct polymorphic + { + template<class T> + static void save( + Archive &ar, + T & t + ){ + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type const + & i = boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance(); + + boost::serialization::extended_type_info const * const this_type = & i; + + // retrieve the true type of the object pointed to + // if this assertion fails its an error in this library + assert(NULL != this_type); + + const boost::serialization::extended_type_info * true_type = + i.get_derived_extended_type_info(t); + + // note:if this exception is thrown, be sure that derived pointer + // is either registered or exported. + if(NULL == true_type){ + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + true_type->get_debug_info() + ) + ); + } + + // if its not a pointer to a more derived type + const void *vp = static_cast<const void *>(&t); + if(*this_type == *true_type){ + const basic_pointer_oserializer * bpos = register_type(ar, t); + ar.save_pointer(vp, bpos); + return; + } + // convert pointer to more derived type. if this is thrown + // it means that the base/derived relationship hasn't be registered + vp = serialization::void_downcast( + *true_type, + *this_type, + static_cast<const void *>(&t) + ); + if(NULL == vp){ + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_cast, + true_type->get_debug_info(), + this_type->get_debug_info() + ) + ); + } + + // since true_type is valid, and this only gets made if the + // pointer oserializer object has been created, this should never + // fail + const basic_pointer_oserializer * bpos + = static_cast<const basic_pointer_oserializer *>( + boost::serialization::singleton< + archive_serializer_map<Archive> + >::get_const_instance().find(*true_type) + ); + assert(NULL != bpos); + if(NULL == bpos) + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + bpos->get_debug_info() + ) + ); + ar.save_pointer(vp, bpos); + } + }; + + template<class T> + static void save( + Archive & ar, + const T & t + ){ + check_pointer_level<T>(); + check_pointer_tracking<T>(); + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_polymorphic<T>, + mpl::identity<polymorphic>, + mpl::identity<non_polymorphic> + >::type type; + type::save(ar, const_cast<T &>(t)); + } + + template<class TPtr> + static void invoke(Archive &ar, const TPtr t){ + register_type(ar, * t); + if(NULL == t){ + basic_oarchive & boa + = boost::serialization::smart_cast_reference<basic_oarchive &>(ar); + boa.save_null_pointer(); + save_access::end_preamble(ar); + return; + } + save(ar, * t); + } +}; + +template<class Archive> +struct save_enum_type +{ + template<class T> + static void invoke(Archive &ar, const T &t){ + // convert enum to integers on save + const int i = static_cast<int>(t); + ar << boost::serialization::make_nvp(NULL, i); + } +}; + +template<class Archive> +struct save_array_type +{ + template<class T> + static void invoke(Archive &ar, const T &t){ + typedef BOOST_DEDUCED_TYPENAME boost::remove_extent<T>::type value_type; + + save_access::end_preamble(ar); + // consider alignment + std::size_t c = sizeof(t) / ( + static_cast<const char *>(static_cast<const void *>(&t[1])) + - static_cast<const char *>(static_cast<const void *>(&t[0])) + ); + boost::serialization::collection_size_type count(c); + ar << BOOST_SERIALIZATION_NVP(count); + ar << serialization::make_array(static_cast<value_type const*>(&t[0]),count); + } +}; + +} // detail + +template<class Archive, class T> +inline void save(Archive & ar, /*const*/ T &t){ + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer<T>, + mpl::identity<detail::save_pointer_type<Archive> >, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum<T>, + mpl::identity<detail::save_enum_type<Archive> >, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array<T>, + mpl::identity<detail::save_array_type<Archive> >, + //else + mpl::identity<detail::save_non_pointer_type<Archive> > + > + > + >::type typex; + typex::invoke(ar, t); +} + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_OSERIALIZER_HPP diff --git a/Utilities/BGL/boost/archive/detail/polymorphic_iarchive_route.hpp b/Utilities/BGL/boost/archive/detail/polymorphic_iarchive_route.hpp new file mode 100644 index 0000000000000000000000000000000000000000..707a2969e15510b7ca42ed74c410cb957195ef03 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -0,0 +1,203 @@ +#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP +#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_iarchive_route.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 <string> +#include <ostream> +#include <cstddef> + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/cstdint.hpp> +#include <boost/archive/polymorphic_iarchive.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail{ + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template<class ArchiveImplementation> +class polymorphic_iarchive_route : + public polymorphic_iarchive, + // note: gcc dynamic cross cast fails if the the derivation below is + // not public. I think this is a mistake. + public /*protected*/ ArchiveImplementation +{ +private: + // these are used by the serialization library. + virtual void load_object( + void *t, + const basic_iserializer & bis + ){ + ArchiveImplementation::load_object(t, bis); + } + virtual const basic_pointer_iserializer * load_pointer( + void * & t, + const basic_pointer_iserializer * bpis_ptr, + const basic_pointer_iserializer * (*finder)( + const boost::serialization::extended_type_info & type + ) + ){ + return ArchiveImplementation::load_pointer(t, bpis_ptr, finder); + } + virtual void set_library_version(version_type archive_library_version){ + ArchiveImplementation::set_library_version(archive_library_version); + } + virtual unsigned int get_library_version() const{ + return ArchiveImplementation::get_library_version(); + } + virtual unsigned int get_flags() const { + return ArchiveImplementation::get_flags(); + } + virtual void delete_created_pointers(){ + ArchiveImplementation::delete_created_pointers(); + } + virtual void reset_object_address( + const void * new_address, + const void * old_address + ){ + ArchiveImplementation::reset_object_address(new_address, old_address); + } + virtual void load_binary(void * t, std::size_t size){ + ArchiveImplementation::load_binary(t, size); + } + // primitive types the only ones permitted by polymorphic archives + virtual void load(bool & t){ + ArchiveImplementation::load(t); + } + virtual void load(char & t){ + ArchiveImplementation::load(t); + } + virtual void load(signed char & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned char & t){ + ArchiveImplementation::load(t); + } + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void load(wchar_t & t){ + ArchiveImplementation::load(t); + } + #endif + #endif + virtual void load(short & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned short & t){ + ArchiveImplementation::load(t); + } + virtual void load(int & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned int & t){ + ArchiveImplementation::load(t); + } + virtual void load(long & t){ + ArchiveImplementation::load(t); + } + virtual void load(unsigned long & t){ + ArchiveImplementation::load(t); + } + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void load(boost::int64_t & t){ + ArchiveImplementation::load(t); + } + virtual void load(boost::uint64_t & t){ + ArchiveImplementation::load(t); + } + #endif + virtual void load(float & t){ + ArchiveImplementation::load(t); + } + virtual void load(double & t){ + ArchiveImplementation::load(t); + } + virtual void load(std::string & t){ + ArchiveImplementation::load(t); + } + #ifndef BOOST_NO_STD_WSTRING + virtual void load(std::wstring & t){ + ArchiveImplementation::load(t); + } + #endif + // used for xml and other tagged formats default does nothing + virtual void load_start(const char * name){ + ArchiveImplementation::load_start(name); + } + virtual void load_end(const char * name){ + ArchiveImplementation::load_end(name); + } + + virtual void register_basic_serializer(const basic_iserializer & bis){ + ArchiveImplementation::register_basic_serializer(bis); + } +public: + // this can't be inheriteded because they appear in mulitple + // parents + typedef mpl::bool_<true> is_loading; + typedef mpl::bool_<false> is_saving; + // the >> operator + template<class T> + polymorphic_iarchive & operator>>(T & t){ + return polymorphic_iarchive::operator>>(t); + } + + // the & operator + template<class T> + polymorphic_iarchive & operator&(T & t){ + return polymorphic_iarchive::operator&(t); + } + + // all current archives take a stream as constructor argument + template <class _Elem, class _Tr> + polymorphic_iarchive_route( + std::basic_istream<_Elem, _Tr> & is, + unsigned int flags = 0 + ) : + ArchiveImplementation(is, flags) + {} + virtual ~polymorphic_iarchive_route(){}; +}; + +} // namespace detail +} // 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_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_HPP diff --git a/Utilities/BGL/boost/archive/detail/polymorphic_oarchive_route.hpp b/Utilities/BGL/boost/archive/detail/polymorphic_oarchive_route.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4c8e626f61c7dff1416d6d0c75eb0377a9c2f3b --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -0,0 +1,191 @@ +#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP +#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_oarchive_route.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 <string> +#include <ostream> +#include <boost/cstdint.hpp> +#include <cstddef> // size_t + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/archive/polymorphic_oarchive.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail{ + +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template<class ArchiveImplementation> +class polymorphic_oarchive_route : + public polymorphic_oarchive, + // note: gcc dynamic cross cast fails if the the derivation below is + // not public. I think this is a mistake. + public /*protected*/ ArchiveImplementation +{ +private: + // these are used by the serialization library. + virtual void save_object( + const void *x, + const detail::basic_oserializer & bos + ){ + ArchiveImplementation::save_object(x, bos); + } + virtual void save_pointer( + const void * t, + const detail::basic_pointer_oserializer * bpos_ptr + ){ + ArchiveImplementation::save_pointer(t, bpos_ptr); + } + virtual void save_null_pointer(){ + ArchiveImplementation::save_null_pointer(); + } + // primitive types the only ones permitted by polymorphic archives + virtual void save(const bool t){ + ArchiveImplementation::save(t); + } + virtual void save(const char t){ + ArchiveImplementation::save(t); + } + virtual void save(const signed char t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned char t){ + ArchiveImplementation::save(t); + } + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void save(const wchar_t t){ + ArchiveImplementation::save(t); + } + #endif + #endif + virtual void save(const short t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned short t){ + ArchiveImplementation::save(t); + } + virtual void save(const int t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned int t){ + ArchiveImplementation::save(t); + } + virtual void save(const long t){ + ArchiveImplementation::save(t); + } + virtual void save(const unsigned long t){ + ArchiveImplementation::save(t); + } + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void save(const boost::int64_t t){ + ArchiveImplementation::save(t); + } + virtual void save(const boost::uint64_t t){ + ArchiveImplementation::save(t); + } + #endif + virtual void save(const float t){ + ArchiveImplementation::save(t); + } + virtual void save(const double t){ + ArchiveImplementation::save(t); + } + virtual void save(const std::string & t){ + ArchiveImplementation::save(t); + } + #ifndef BOOST_NO_STD_WSTRING + virtual void save(const std::wstring & t){ + ArchiveImplementation::save(t); + } + #endif + virtual unsigned int get_library_version() const{ + return ArchiveImplementation::get_library_version(); + } + virtual unsigned int get_flags() const { + return ArchiveImplementation::get_flags(); + } + virtual void save_binary(const void * t, std::size_t size){ + ArchiveImplementation::save_binary(t, size); + } + // used for xml and other tagged formats default does nothing + virtual void save_start(const char * name){ + ArchiveImplementation::save_start(name); + } + virtual void save_end(const char * name){ + ArchiveImplementation::save_end(name); + } + virtual void end_preamble(){ + ArchiveImplementation::end_preamble(); + } + virtual void register_basic_serializer(const detail::basic_oserializer & bos){ + ArchiveImplementation::register_basic_serializer(bos); + } +public: + // this can't be inheriteded because they appear in mulitple + // parents + typedef mpl::bool_<false> is_loading; + typedef mpl::bool_<true> is_saving; + // the << operator + template<class T> + polymorphic_oarchive & operator<<(T & t){ + return polymorphic_oarchive::operator<<(t); + } + // the & operator + template<class T> + polymorphic_oarchive & operator&(T & t){ + return polymorphic_oarchive::operator&(t); + } + // all current archives take a stream as constructor argument + template <class _Elem, class _Tr> + polymorphic_oarchive_route( + std::basic_ostream<_Elem, _Tr> & os, + unsigned int flags = 0 + ) : + ArchiveImplementation(os, flags) + {} + virtual ~polymorphic_oarchive_route(){}; +}; + +} // namespace detail +} // 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_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP diff --git a/Utilities/BGL/boost/archive/detail/register_archive.hpp b/Utilities/BGL/boost/archive/detail/register_archive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..87fedcbe865a1089905ed2d734c8978cbd9b683a --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/register_archive.hpp @@ -0,0 +1,91 @@ +// Copyright David Abrahams 2006. 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_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP +# define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP + +namespace boost { namespace archive { namespace detail { + +// No instantiate_ptr_serialization overloads generated by +// BOOST_SERIALIZATION_REGISTER_ARCHIVE that lexically follow the call +// will be seen *unless* they are in an associated namespace of one of +// the arguments, so we pass one of these along to make sure this +// namespace is considered. See temp.dep.candidate (14.6.4.2) in the +// standard. +struct adl_tag {}; + +template <class Archive, class Serializable> +struct ptr_serialization_support; + +// We could've just used ptr_serialization_support, above, but using +// it with only a forward declaration causes vc6/7 to complain about a +// missing instantiate member, even if it has one. This is just a +// friendly layer of indirection. +template <class Archive, class Serializable> +struct _ptr_serialization_support + : ptr_serialization_support<Archive,Serializable> +{ + typedef int type; +}; + +#ifdef __SUNPRO_CC + +template<int N> +struct counter : counter<N-1> {}; +template<> +struct counter<0> {}; + +template<class Serializable> +void instantiate_ptr_serialization(Serializable* s, int, adl_tag) { + instantiate_ptr_serialization(s, counter<20>()); +} + +template<class Archive> +struct get_counter { + static const int value = sizeof(adjust_counter(counter<20>())); + typedef counter<value> type; + typedef counter<value - 1> prior; + typedef char (&next)[value+1]; +}; + +char adjust_counter(counter<0>); +template<class Serializable> +void instantiate_ptr_serialization(Serializable*, counter<0>) {} + +#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ +namespace boost { namespace archive { namespace detail { \ + get_counter<Archive>::next adjust_counter(get_counter<Archive>::type);\ + template<class Serializable> \ + void instantiate_ptr_serialization(Serializable* s, \ + get_counter<Archive>::type) { \ + ptr_serialization_support<Archive, Serializable> x; \ + instantiate_ptr_serialization(s, get_counter<Archive>::prior()); \ + }\ +}}} + + +#else + +// This function gets called, but its only purpose is to participate +// in overload resolution with the functions declared by +// BOOST_SERIALIZATION_REGISTER_ARCHIVE, below. +template <class Serializable> +void instantiate_ptr_serialization(Serializable*, int, adl_tag ) {} + +// The function declaration generated by this macro never actually +// gets called, but its return type gets instantiated, and that's +// enough to cause registration of serialization functions between +// Archive and any exported Serializable type. See also: +// boost/serialization/export.hpp +# define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ +namespace boost { namespace archive { namespace detail { \ + \ +template <class Serializable> \ +BOOST_DEDUCED_TYPENAME _ptr_serialization_support<Archive, Serializable>::type \ +instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \ + \ +}}} +#endif +}}} // namespace boost::archive::detail + +#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP diff --git a/Utilities/BGL/boost/archive/detail/utf8_codecvt_facet.hpp b/Utilities/BGL/boost/archive/detail/utf8_codecvt_facet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bd859ffebd6513db1b80d45d712503e503febf51 --- /dev/null +++ b/Utilities/BGL/boost/archive/detail/utf8_codecvt_facet.hpp @@ -0,0 +1,21 @@ +// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) +// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). +// 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_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP +#define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP + +#define BOOST_UTF8_BEGIN_NAMESPACE \ + namespace boost { namespace archive { namespace detail { +#define BOOST_UTF8_DECL +#define BOOST_UTF8_END_NAMESPACE }}} + +#include <boost/detail/utf8_codecvt_facet.hpp> + +#undef BOOST_UTF8_END_NAMESPACE +#undef BOOST_UTF8_DECL +#undef BOOST_UTF8_BEGIN_NAMESPACE + +#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP diff --git a/Utilities/BGL/boost/archive/dinkumware.hpp b/Utilities/BGL/boost/archive/dinkumware.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bfa828d53d81ebcc10fbe40e2a8fa8199ba0c386 --- /dev/null +++ b/Utilities/BGL/boost/archive/dinkumware.hpp @@ -0,0 +1,224 @@ +#ifndef BOOST_ARCHIVE_DINKUMWARE_HPP +#define BOOST_ARCHIVE_DINKUMWARE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dinkumware.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. + +// this file adds a couple of things that are missing from the dinkumware +// implementation of the standard library. + +#include <iterator> +#include <string> + +#include <boost/config.hpp> +#include <boost/cstdint.hpp> + +namespace std { + +// define i/o operators for 64 bit integers +template<class CharType> +basic_ostream<CharType> & +operator<<(basic_ostream<CharType> & os, boost::uint64_t t){ + // octal rendering of 64 bit number would be 22 octets + eos + CharType d[23]; + unsigned int radix; + + if(os.flags() & (int)std::ios_base::hex) + radix = 16; + else + if(os.flags() & (int)std::ios_base::oct) + radix = 8; + else + //if(s.flags() & (int)std::ios_base::dec) + radix = 10; + unsigned int i = 0; + do{ + unsigned int j = t % radix; + d[i++] = j + ((j < 10) ? '0' : ('a' - 10)); + t /= radix; + } + while(t > 0); + d[i--] = '\0'; + + // reverse digits + unsigned int j = 0; + while(j < i){ + CharType k = d[i]; + d[i] = d[j]; + d[j] = k; + --i;++j; + } + os << d; + return os; + +} + +template<class CharType> +basic_ostream<CharType> & +operator<<(basic_ostream<CharType> &os, boost::int64_t t){ + if(0 <= t){ + os << static_cast<boost::uint64_t>(t); + } + else{ + os.put('-'); + os << -t; + } + return os; +} + +template<class CharType> +basic_istream<CharType> & +operator>>(basic_istream<CharType> &is, boost::int64_t & t){ + CharType d; + do{ + d = is.get(); + } + while(::isspace(d)); + bool negative = (d == '-'); + if(negative) + d = is.get(); + unsigned int radix; + if(is.flags() & (int)std::ios_base::hex) + radix = 16; + else + if(is.flags() & (int)std::ios_base::oct) + radix = 8; + else + //if(s.flags() & (int)std::ios_base::dec) + radix = 10; + t = 0; + do{ + if('0' <= d && d <= '9') + t = t * radix + (d - '0'); + else + if('a' <= d && d <= 'f') + t = t * radix + (d - 'a' + 10); + else + break; + d = is.get(); + } + while(!is.fail()); + // restore the delimiter + is.putback(d); + is.clear(); + if(negative) + t = -t; + return is; +} + +template<class CharType> +basic_istream<CharType> & +operator>>(basic_istream<CharType> &is, boost::uint64_t & t){ + boost::int64_t it; + is >> it; + t = it; + return is; +} + +//#endif + +template<> +class back_insert_iterator<basic_string<char> > : public + iterator<output_iterator_tag, char> +{ +public: + typedef basic_string<char> container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator<container_type> & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator<container_type> & operator*(){ + return (*this); + } + + back_insert_iterator<container_type> & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator<container_type> operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template<char> +inline back_insert_iterator<basic_string<char> > back_inserter( + basic_string<char> & s +){ + return (std::back_insert_iterator<basic_string<char> >(s)); +} + +template<> +class back_insert_iterator<basic_string<wchar_t> > : public + iterator<output_iterator_tag, wchar_t> +{ +public: + typedef basic_string<wchar_t> container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator<container_type> & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator<container_type> & operator*(){ + return (*this); + } + + back_insert_iterator<container_type> & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator<container_type> operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template<wchar_t> +inline back_insert_iterator<basic_string<wchar_t> > back_inserter( + basic_string<wchar_t> & s +){ + return (std::back_insert_iterator<basic_string<wchar_t> >(s)); +} + +} // namespace std + +#endif //BOOST_ARCHIVE_DINKUMWARE_HPP diff --git a/Utilities/BGL/boost/archive/impl/archive_serializer_map.ipp b/Utilities/BGL/boost/archive/impl/archive_serializer_map.ipp new file mode 100644 index 0000000000000000000000000000000000000000..f8e6ab5169d3c974c7b8078081f2257c2a12166f --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/archive_serializer_map.ipp @@ -0,0 +1,71 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// archive_serializer_map.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_iprimitive overrides for the combination +// of template parameters used to implement a text_iprimitive + +#include <boost/config.hpp> +#include <boost/archive/detail/archive_serializer_map.hpp> +#include <boost/archive/detail/basic_serializer_map.hpp> +#include <boost/serialization/singleton.hpp> + +namespace boost { +namespace archive { +namespace detail { + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace { // anon + template<class Archive> + class map : public basic_serializer_map + {}; +} + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(bool) +archive_serializer_map<Archive>::insert(const basic_serializer * bs){ + return boost::serialization::singleton< + map<Archive> + >::get_mutable_instance().insert(bs); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +archive_serializer_map<Archive>::erase(const basic_serializer * bs){ + if(boost::serialization::singleton< + map<Archive> + >::is_destroyed()) + return; + boost::serialization::singleton< + map<Archive> + >::get_mutable_instance().erase(bs); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_serializer *) +archive_serializer_map<Archive>::find( + const boost::serialization::extended_type_info & eti +) { + return boost::serialization::singleton< + map<Archive> + >::get_const_instance().find(eti); +} + +} // namespace detail +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_binary_iarchive.ipp b/Utilities/BGL/boost/archive/impl/basic_binary_iarchive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..230fb928971f2a270cea44cd8dcf4f8ee8e5b745 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_binary_iarchive.ipp @@ -0,0 +1,79 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iarchive.ipp: + +// (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 <string> +#include <cassert> +#include <algorithm> +#include <cstring> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include <boost/detail/workaround.hpp> + +#include <boost/archive/basic_binary_iarchive.hpp> + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_archive +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iarchive<Archive>::load_override(class_name_type & t, int){ + std::string cn; + cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE); + load_override(cn, 0); + if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + std::memcpy(t, cn.data(), cn.size()); + // borland tweak + t.t[cn.size()] = '\0'; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iarchive<Archive>::init(){ + // read signature in an archive version independent manner + std::string file_signature; + * this->This() >> file_signature; + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_signature) + ); + + // make sure the version of the reading archive library can + // support the format of the archive being read + version_type input_library_version; + * this->This() >> input_library_version; + + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->set_library_version(input_library_version); + #else + #if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + detail:: + #endif + basic_iarchive::set_library_version(input_library_version); + #endif + + // extra little .t is to get around borland quirk + if(BOOST_ARCHIVE_VERSION() < input_library_version.t) + boost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_binary_iprimitive.ipp b/Utilities/BGL/boost/archive/impl/basic_binary_iprimitive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..f6095713263b6e2e3fec8c57d7f877c7b5935b58 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_binary_iprimitive.ipp @@ -0,0 +1,209 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iprimitive.ipp: + +// (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 <cassert> +#include <cstddef> // size_t, NULL +#include <cstring> // memcpy + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + using ::memcpy; +} // namespace std +#endif + +#include <boost/detail/workaround.hpp> // fixup for RogueWave + +#include <boost/serialization/throw_exception.hpp> +#include <boost/scoped_ptr.hpp> + +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/codecvt_null.hpp> +#include <boost/archive/add_facet.hpp> + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_iprimitive + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive<Archive, Elem, Tr>::init() +{ + // Detect attempts to pass native binary archives across + // incompatible platforms. This is not fool proof but its + // better than nothing. + unsigned char size; + this->This()->load(size); + if(sizeof(int) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of int" + ) + ); + this->This()->load(size); + if(sizeof(long) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of long" + ) + ); + this->This()->load(size); + if(sizeof(float) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of float" + ) + ); + this->This()->load(size); + if(sizeof(double) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of double" + ) + ); + + // for checking endian + int i; + this->This()->load(i); + if(1 != i) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "endian setting" + ) + ); +} + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws) +{ + std::size_t l; // number of wchar_t !!! + this->This()->load(l); + load_binary(ws, l * sizeof(wchar_t) / sizeof(char)); + ws[l] = L'\0'; +} + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive<Archive, Elem, Tr>::load(std::string & s) +{ + std::size_t l; + this->This()->load(l); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(l); + // note breaking a rule here - could be a problem on some platform + if(0 < l) + load_binary(&(*s.begin()), l); +} + +#ifndef BOOST_NO_CWCHAR +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s) +{ + std::size_t l; + this->This()->load(l); + load_binary(s, l); + s[l] = '\0'; +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive<Archive, Elem, Tr>::load(std::wstring & ws) +{ + std::size_t l; + this->This()->load(l); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(l); + // note breaking a rule here - is could be a problem on some platform + load_binary(const_cast<wchar_t *>(ws.data()), l * sizeof(wchar_t) / sizeof(char)); +} +#endif + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_iprimitive<Archive, Elem, Tr>::basic_binary_iprimitive( + std::basic_streambuf<Elem, Tr> & sb, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + m_sb(sb), + archive_locale(NULL), + locale_saver(m_sb) +{ + if(! no_codecvt){ + archive_locale.reset( + boost::archive::add_facet( + std::locale::classic(), + new codecvt_null<Elem> + ) + ); + m_sb.pubimbue(* archive_locale); + } +} +#else + m_sb(sb) +{} +#endif + +// some libraries including stl and libcomo fail if the +// buffer isn't flushed before the code_cvt facet is changed. +// I think this is a bug. We explicity invoke sync to when +// we're done with the streambuf to work around this problem. +// Note that sync is a protected member of stream buff so we +// have to invoke it through a contrived derived class. +namespace detail { +// note: use "using" to get past msvc bug +using namespace std; +template<class Elem, class Tr> +class input_streambuf_access : public std::basic_streambuf<Elem, Tr> { + public: + virtual int sync(){ +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + return this->basic_streambuf::sync(); +#else + return this->basic_streambuf<Elem, Tr>::sync(); +#endif + } +}; +} // detail + +// scoped_ptr requires that archive_locale be a complete type at time of +// destruction so define destructor here rather than in the header +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_iprimitive<Archive, Elem, Tr>::~basic_binary_iprimitive(){ + // push back unread characters + //destructor can't throw ! + try{ + static_cast<detail::input_streambuf_access<Elem, Tr> &>(m_sb).sync(); + } + catch(...){ + } +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_binary_oarchive.ipp b/Utilities/BGL/boost/archive/impl/basic_binary_oarchive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..4a8301ea45e66d352fa03c6b93da7a640cca0efb --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_binary_oarchive.ipp @@ -0,0 +1,46 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oarchive.ipp: + +// (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 <string> +#include <cassert> +#include <algorithm> +#include <cstring> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include <boost/archive/basic_binary_oarchive.hpp> + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_oarchive + +template<class Archive> +#if !defined(__BORLANDC__) +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +#else +void +#endif +basic_binary_oarchive<Archive>::init(){ + // write signature in an archive version independent manner + const std::string file_signature(BOOST_ARCHIVE_SIGNATURE()); + * this->This() << file_signature; + // write library version + const version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_binary_oprimitive.ipp b/Utilities/BGL/boost/archive/impl/basic_binary_oprimitive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..1b25c227f9bde127422ea76258ab6ee4e492ebda --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_binary_oprimitive.ipp @@ -0,0 +1,164 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oprimitive.ipp: + +// (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 <ostream> +#include <cstddef> // NULL +#include <cstring> + +#include <boost/config.hpp> + +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + + +#ifndef BOOST_NO_CWCHAR +#include <cwchar> +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include <boost/detail/workaround.hpp> + +#include <boost/serialization/throw_exception.hpp> +#include <boost/scoped_ptr.hpp> +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/add_facet.hpp> +#include <boost/archive/codecvt_null.hpp> + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_oprimitive + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive<Archive, Elem, Tr>::init() +{ + // record native sizes of fundamental types + // this is to permit detection of attempts to pass + // native binary archives accross incompatible machines. + // This is not foolproof but its better than nothing. + this->This()->save(static_cast<unsigned char>(sizeof(int))); + this->This()->save(static_cast<unsigned char>(sizeof(long))); + this->This()->save(static_cast<unsigned char>(sizeof(float))); + this->This()->save(static_cast<unsigned char>(sizeof(double))); + // for checking endianness + this->This()->save(int(1)); +} + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive<Archive, Elem, Tr>::save(const char * s) +{ + std::size_t l = std::strlen(s); + this->This()->save(l); + save_binary(s, l); +} + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::string &s) +{ + std::size_t l = static_cast<std::size_t>(s.size()); + this->This()->save(l); + save_binary(s.data(), l); +} + +#ifndef BOOST_NO_CWCHAR +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive<Archive, Elem, Tr>::save(const wchar_t * ws) +{ + std::size_t l = std::wcslen(ws); + this->This()->save(l); + save_binary(ws, l * sizeof(wchar_t) / sizeof(char)); +} + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::wstring &ws) +{ + std::size_t l = ws.size(); + this->This()->save(l); + save_binary(ws.data(), l * sizeof(wchar_t) / sizeof(char)); +} +#endif +#endif + +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive( + std::basic_streambuf<Elem, Tr> & sb, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + m_sb(sb), + archive_locale(NULL), + locale_saver(m_sb) +{ + if(! no_codecvt){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new codecvt_null<Elem> + ) + ); + m_sb.pubimbue(* archive_locale); + } +} +#else + m_sb(sb) +{} +#endif + +// some libraries including stl and libcomo fail if the +// buffer isn't flushed before the code_cvt facet is changed. +// I think this is a bug. We explicity invoke sync to when +// we're done with the streambuf to work around this problem. +// Note that sync is a protected member of stream buff so we +// have to invoke it through a contrived derived class. +namespace detail { +// note: use "using" to get past msvc bug +using namespace std; +template<class Elem, class Tr> +class output_streambuf_access : public std::basic_streambuf<Elem, Tr> { + public: + virtual int sync(){ +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + return this->basic_streambuf::sync(); +#else + return this->basic_streambuf<Elem, Tr>::sync(); +#endif + } +}; +} // detail + +// scoped_ptr requires that g be a complete type at time of +// destruction so define destructor here rather than in the header +template<class Archive, class Elem, class Tr> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_oprimitive<Archive, Elem, Tr>::~basic_binary_oprimitive(){ + // flush buffer + //destructor can't throw + try{ + static_cast<detail::output_streambuf_access<Elem, Tr> &>(m_sb).sync(); + } + catch(...){ + } +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_text_iarchive.ipp b/Utilities/BGL/boost/archive/impl/basic_text_iarchive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..2ea7257af27d4eef4874a7c2dfdcb5a8ecb09e14 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_text_iarchive.ipp @@ -0,0 +1,78 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iarchive.ipp: + +// (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 <string> +#include <algorithm> +#include <cstring> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include <boost/detail/workaround.hpp> + +#include <boost/archive/basic_text_iarchive.hpp> + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of text_text_archive +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iarchive<Archive>::load_override(class_name_type & t, int){ + std::string cn; + cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE); + load_override(cn, 0); + if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + std::memcpy(t, cn.data(), cn.size()); + // borland tweak + t.t[cn.size()] = '\0'; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iarchive<Archive>::init(void){ + // read signature in an archive version independent manner + std::string file_signature; + * this->This() >> file_signature; + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_signature) + ); + + // make sure the version of the reading archive library can + // support the format of the archive being read + version_type input_library_version; + * this->This() >> input_library_version; + + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->set_library_version(input_library_version); + #else + #if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1200) + detail:: + #endif + basic_iarchive::set_library_version(input_library_version); + #endif + + // extra little .t is to get around borland quirk + if(BOOST_ARCHIVE_VERSION() < input_library_version) + boost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_text_iprimitive.ipp b/Utilities/BGL/boost/archive/impl/basic_text_iprimitive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..b91432bf996f6d7b533fb6e5391c909a655c7e82 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_text_iprimitive.ipp @@ -0,0 +1,154 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +#include <cstddef> // size_t +#include <cstddef> // NULL + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/pfto.hpp> + +#include <boost/archive/basic_text_iprimitive.hpp> +#include <boost/archive/codecvt_null.hpp> +#include <boost/archive/add_facet.hpp> + +#include <boost/archive/iterators/remove_whitespace.hpp> +#include <boost/archive/iterators/istream_iterator.hpp> +#include <boost/archive/iterators/binary_from_base64.hpp> +#include <boost/archive/iterators/transform_width.hpp> + +namespace boost { +namespace archive { + +namespace { + template<class CharType> + bool is_whitespace(CharType c); + + template<> + bool is_whitespace(char t){ + return 0 != std::isspace(t); + } + + #ifndef BOOST_NO_CWCHAR + template<> + bool is_whitespace(wchar_t t){ + return 0 != std::iswspace(t); + } + #endif +} + +// translate base64 text into binary and copy into buffer +// until buffer is full. +template<class IStream> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iprimitive<IStream>::load_binary( + void *address, + std::size_t count +){ + typedef BOOST_DEDUCED_TYPENAME IStream::char_type CharType; + + if(0 == count) + return; + + assert( + static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)()) + > (count + sizeof(CharType) - 1)/sizeof(CharType) + ); + + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + // convert from base64 to binary + typedef BOOST_DEDUCED_TYPENAME + iterators::transform_width< + iterators::binary_from_base64< + iterators::remove_whitespace< + iterators::istream_iterator<CharType> + > + ,CharType + > + ,8 + ,6 + ,CharType + > + binary; + + binary ti_begin = binary( + BOOST_MAKE_PFTO_WRAPPER( + iterators::istream_iterator<CharType>(is) + ) + ); + + char * caddr = static_cast<char *>(address); + + // take care that we don't increment anymore than necessary + while(--count > 0){ + *caddr++ = static_cast<char>(*ti_begin); + ++ti_begin; + } + *caddr++ = static_cast<char>(*ti_begin); + + iterators::istream_iterator<CharType> i; + for(;;){ + BOOST_DEDUCED_TYPENAME IStream::int_type r; + r = is.get(); + if(is.eof()) + break; + if(is_whitespace(static_cast<CharType>(r))) + break; + } +} + +template<class IStream> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_iprimitive<IStream>::basic_text_iprimitive( + IStream &is_, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + is(is_), + flags_saver(is_), + precision_saver(is_), + archive_locale(NULL), + locale_saver(* is_.rdbuf()) +{ + if(! no_codecvt){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new codecvt_null<BOOST_DEDUCED_TYPENAME IStream::char_type> + ) + ); + is.imbue(* archive_locale); + } + is >> std::noboolalpha; +} +#else + is(is_), + flags_saver(is_), + precision_saver(is_) +{} +#endif + +template<class IStream> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_iprimitive<IStream>::~basic_text_iprimitive(){ + is.sync(); +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_text_oarchive.ipp b/Utilities/BGL/boost/archive/impl/basic_text_oarchive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..3b7c7b03267f346272e3ed2139bc02a2822dc05e --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_text_oarchive.ipp @@ -0,0 +1,62 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oarchive.ipp: + +// (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 <string> +#include <cassert> +#include <cstring> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include <boost/archive/basic_text_oarchive.hpp> + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of basic_text_oarchive + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oarchive<Archive>::newtoken() +{ + switch(delimiter){ + default: + assert(false); + break; + case eol: + this->This()->put('\n'); + delimiter = space; + break; + case space: + this->This()->put(' '); + break; + case none: + delimiter = space; + break; + } +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oarchive<Archive>::init(){ + // write signature in an archive version independent manner + const std::string file_signature(BOOST_ARCHIVE_SIGNATURE()); + * this->This() << file_signature; + // write library version + const version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_text_oprimitive.ipp b/Utilities/BGL/boost/archive/impl/basic_text_oprimitive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..e27bd37c6186cc3883e450160ceb97d50e5c0460 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_text_oprimitive.ipp @@ -0,0 +1,114 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oprimitive.ipp: + +// (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 <cstddef> // NULL +#include <boost/serialization/pfto.hpp> + +#include <boost/archive/basic_text_oprimitive.hpp> +#include <boost/archive/codecvt_null.hpp> +#include <boost/archive/add_facet.hpp> + +#include <boost/archive/iterators/base64_from_binary.hpp> +#include <boost/archive/iterators/insert_linebreaks.hpp> +#include <boost/archive/iterators/transform_width.hpp> +#include <boost/archive/iterators/ostream_iterator.hpp> + +namespace boost { +namespace archive { + +// translate to base64 and copy in to buffer. +template<class OStream> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oprimitive<OStream>::save_binary( + const void *address, + std::size_t count +){ + typedef BOOST_DEDUCED_TYPENAME OStream::char_type CharType; + + if(0 == count) + return; + + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + + os.put('\n'); + + typedef + boost::archive::iterators::insert_linebreaks< + boost::archive::iterators::base64_from_binary< + boost::archive::iterators::transform_width< + const char *, + 6, + 8 + > + > + ,72 + ,const char // cwpro8 needs this + > + base64_text; + + boost::archive::iterators::ostream_iterator<CharType> oi(os); + std::copy( + base64_text(BOOST_MAKE_PFTO_WRAPPER(static_cast<const char *>(address))), + base64_text( + BOOST_MAKE_PFTO_WRAPPER(static_cast<const char *>(address) + count) + ), + oi + ); + + std::size_t tail = count % 3; + if(tail > 0){ + *oi++ = '='; + if(tail < 2) + *oi = '='; + } +} + +template<class OStream> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_oprimitive<OStream>::basic_text_oprimitive( + OStream & os_, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + os(os_), + flags_saver(os_), + precision_saver(os_), + archive_locale(NULL), + locale_saver(* os_.rdbuf()) +{ + if(! no_codecvt){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new codecvt_null<BOOST_DEDUCED_TYPENAME OStream::char_type> + ) + ); + os.imbue(* archive_locale); + } + os << std::noboolalpha; +} +#else + os(os_), + flags_saver(os_), + precision_saver(os_) +{} +#endif + +template<class OStream> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_oprimitive<OStream>::~basic_text_oprimitive(){ + os << std::endl; +} + +} //namespace boost +} //namespace archive diff --git a/Utilities/BGL/boost/archive/impl/basic_xml_grammar.hpp b/Utilities/BGL/boost/archive/impl/basic_xml_grammar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..768009cafb9c93d77091b517e7727303766801dd --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_xml_grammar.hpp @@ -0,0 +1,193 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP +#define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_grammar.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. + +// this module is derived from simplexml.cpp - an example shipped as part of +// the spirit parser. This example contains the following notice: +/*============================================================================= + simplexml.cpp + + Spirit V1.3 + URL: http://spirit.sourceforge.net/ + + Copyright (c) 2001, Daniel C. Nuffer + + This software is provided 'as-is', without any express or implied + warranty. In no event will the copyright holder be held liable for + any damages arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute + it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation + would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. +=============================================================================*/ +#include <string> + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +// supress noise +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +//#define BOOST_SPIRIT_DEBUG +#include <boost/spirit/core/non_terminal/rule.hpp> + +// the following hack is to evade a bogus error generated by using the +// word "arg" when bind.hpp has been included +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#define arg xarg +#endif + +// spirit stuff +#if (defined __BORLANDC__) && (__BORLANDC__ < 0x593) \ + || (defined _MSC_VER) && (_MSC_VER <= 1300) +#include <boost/spirit/utility/chset.hpp> +#else +#include <boost/spirit/include/classic_chset.hpp> +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#undef arg +#endif + +#include <boost/archive/basic_archive.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/version.hpp> + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// XML grammar parsing + +template<class CharType> +class basic_xml_grammar { +public: + // The following is not necessary according to DR45, but at least + // one compiler (Compaq C++ 6.5 in strict_ansi mode) chokes otherwise. + struct return_values; + friend struct return_values; + +private: + typedef BOOST_DEDUCED_TYPENAME std::basic_istream<CharType> IStream; + typedef BOOST_DEDUCED_TYPENAME std::basic_string<CharType> StringType; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::chset<CharType> chset_t; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::chlit<CharType> chlit_t; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::scanner< + BOOST_DEDUCED_TYPENAME std::basic_string<CharType>::iterator + > scanner_t; + typedef BOOST_DEDUCED_TYPENAME boost::spirit::rule<scanner_t> rule_t; + // Start grammar definition + rule_t + Reference, + Eq, + STag, + ETag, + LetterOrUnderscoreOrColon, + AttValue, + CharRef1, + CharRef2, + CharRef, + AmpRef, + LTRef, + GTRef, + AposRef, + QuoteRef, + CharData, + CharDataChars, + content, + AmpName, + LTName, + GTName, + ClassNameChar, + ClassName, + Name, + XMLDecl, + XMLDeclChars, + DocTypeDecl, + DocTypeDeclChars, + ClassIDAttribute, + ObjectIDAttribute, + ClassNameAttribute, + TrackingAttribute, + VersionAttribute, + UnusedAttribute, + Attribute, + SignatureAttribute, + SerializationWrapper, + NameHead, + NameTail, + AttributeList, + S; + + // XML Character classes + chset_t + BaseChar, + Ideographic, + Char, + Letter, + Digit, + CombiningChar, + Extender, + Sch, + NameChar; + + void init_chset(); + + bool my_parse( + IStream & is, + const rule_t &rule_, + const CharType delimiter = L'>' + ) const ; +public: + struct return_values { + StringType object_name; + StringType contents; + class_id_type class_id; + object_id_type object_id; + version_type version; + tracking_type tracking_level; + StringType class_name; + return_values() : + version(0), + tracking_level(false) + {} + } rv; + bool parse_start_tag(IStream & is) /*const*/; + bool parse_end_tag(IStream & is) const; + bool parse_string(IStream & is, StringType & s) /*const*/; + void init(IStream & is); + void windup(IStream & is); + basic_xml_grammar(); +}; + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP diff --git a/Utilities/BGL/boost/archive/impl/basic_xml_iarchive.ipp b/Utilities/BGL/boost/archive/impl/basic_xml_iarchive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..a74844d7fab0e21a44e403d5ef879068bddcf70f --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_xml_iarchive.ipp @@ -0,0 +1,114 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_iarchive.ipp: + +// (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 <cassert> +#include <cstddef> // NULL +#include <algorithm> + +#include <boost/serialization/throw_exception.hpp> +#include <boost/archive/xml_archive_exception.hpp> +#include <boost/archive/basic_xml_iarchive.hpp> +#include <boost/serialization/tracking.hpp> + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of xml_text_archive + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive<Archive>::load_start(const char *name){ + // if there's no name + if(NULL == name) + return; + bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is()); + if(true != result){ + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + } + // don't check start tag at highest level + ++depth; + return; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive<Archive>::load_end(const char *name){ + // if there's no name + if(NULL == name) + return; + bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is()); + if(true != result){ + boost::serialization::throw_exception( + archive_exception(archive_exception::stream_error) + ); + } + + // don't check start tag at highest level + if(0 == --depth) + return; + + if(0 == (this->get_flags() & no_xml_tag_checking)){ + // double check that the tag matches what is expected - useful for debug + if(0 != name[this->This()->gimpl->rv.object_name.size()] + || ! std::equal( + this->This()->gimpl->rv.object_name.begin(), + this->This()->gimpl->rv.object_name.end(), + name + ) + ){ + boost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_tag_mismatch, + name + ) + ); + } + } +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive<Archive>::load_override(object_id_type & t, int){ + t = this->This()->gimpl->rv.object_id; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive<Archive>::load_override(version_type & t, int){ + t = this->This()->gimpl->rv.version; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive<Archive>::load_override(class_id_type & t, int){ + t = this->This()->gimpl->rv.class_id; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive<Archive>::load_override(tracking_type & t, int){ + t = this->This()->gimpl->rv.tracking_level; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_iarchive<Archive>::basic_xml_iarchive(unsigned int flags) : + detail::common_iarchive<Archive>(flags), + depth(0) +{} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_iarchive<Archive>::~basic_xml_iarchive(){} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/basic_xml_oarchive.ipp b/Utilities/BGL/boost/archive/impl/basic_xml_oarchive.ipp new file mode 100644 index 0000000000000000000000000000000000000000..518d8a791c91eef40d9e52fca82c80bee54bb341 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/basic_xml_oarchive.ipp @@ -0,0 +1,275 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_oarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +#include <algorithm> +#include <cstddef> // NULL +#include <cstring> +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include <boost/archive/basic_xml_archive.hpp> +#include <boost/archive/basic_xml_oarchive.hpp> +#include <boost/archive/xml_archive_exception.hpp> +#include <boost/detail/no_exceptions_support.hpp> + +namespace boost { +namespace archive { + +namespace detail { +template<class CharType> +struct XML_name { + void operator()(CharType t) const{ + const unsigned char lookup_table[] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0, // -. + 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, // 0-9 + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // A- + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, // -Z _ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // a- + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, // -z + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + }; + if((unsigned)t > 127) + return; + if(0 == lookup_table[(unsigned)t]) + boost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_tag_name_error + ) + ); + } +}; + +} // namespace detail + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions common to both types of xml output + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::write_attribute( + const char *attribute_name, + int t, + const char *conjunction +){ + this->This()->put(' '); + this->This()->put(attribute_name); + this->This()->put(conjunction); + this->This()->save(t); + this->This()->put('"'); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::write_attribute( + const char *attribute_name, + const char *key +){ + this->This()->put(' '); + this->This()->put(attribute_name); + this->This()->put("=\""); + this->This()->save(key); + this->This()->put('"'); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::indent(){ + int i; + for(i = depth; i-- > 0;) + this->This()->put('\t'); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_start(const char *name) +{ + if(NULL == name) + return; + + // be sure name has no invalid characters + std::for_each(name, name + std::strlen(name), detail::XML_name<const char>()); + + end_preamble(); + if(depth > 0){ + this->This()->put('\n'); + indent(); + } + ++depth; + this->This()->put('<'); + this->This()->save(name); + pending_preamble = true; + indent_next = false; +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_end(const char *name) +{ + if(NULL == name) + return; + + // be sure name has no invalid characters + std::for_each(name, name + std::strlen(name), detail::XML_name<const char>()); + + end_preamble(); + --depth; + if(indent_next){ + this->This()->put('\n'); + indent(); + } + indent_next = true; + this->This()->put("</"); + this->This()->save(name); + this->This()->put('>'); + if(0 == depth) + this->This()->put('\n'); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::end_preamble(){ + if(pending_preamble){ + this->This()->put('>'); + pending_preamble = false; + } +} +#if 0 +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override(const object_id_type & t, int) +{ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_"); +} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override( + const object_reference_type & t, + int +){ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_"); +} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override(const version_type & t, int) +{ + int i = t.t; // extra .t is for borland + write_attribute(VBOOST_ARCHIVE_XML_ERSION(), i); +} +#endif + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override(const object_id_type & t, int) +{ + // borland doesn't do conversion of STRONG_TYPEDEFs very well + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_"); +} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override( + const object_reference_type & t, + int +){ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_"); +} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override(const version_type & t, int) +{ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_VERSION(), i); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override(const class_id_type & t, int) +{ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override( + const class_id_reference_type & t, + int +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(), t); +} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override( + const class_id_optional_type & t, + int +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override(const class_name_type & t, int) +{ + const char * key = t; + if(NULL == key) + return; + write_attribute(BOOST_ARCHIVE_XML_CLASS_NAME(), key); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::save_override(const tracking_type & t, int) +{ + write_attribute(BOOST_ARCHIVE_XML_TRACKING(), t.t); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive<Archive>::init(){ + // xml header + this->This()->put("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n"); + this->This()->put("<!DOCTYPE boost_serialization>\n"); + // xml document wrapper - outer root + this->This()->put("<boost_serialization"); + write_attribute("signature", BOOST_ARCHIVE_SIGNATURE()); + write_attribute("version", BOOST_ARCHIVE_VERSION()); + this->This()->put(">\n"); +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_oarchive<Archive>::basic_xml_oarchive(unsigned int flags) : + detail::common_oarchive<Archive>(flags), + depth(0), + indent_next(false), + pending_preamble(false) +{ +} + +template<class Archive> +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_oarchive<Archive>::~basic_xml_oarchive(){ + if(0 == (this->get_flags() & no_header)){ + BOOST_TRY{ + this->This()->put("</boost_serialization>\n"); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/text_iarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/text_iarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..f14c0d8e2afe92e3b3254ddc9dbcdf98db9dae82 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/text_iarchive_impl.ipp @@ -0,0 +1,128 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_iarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_iprimitive overrides for the combination +// of template parameters used to implement a text_iprimitive + +#include <cstddef> // size_t, NULL +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/detail/workaround.hpp> // RogueWave + +#include <boost/archive/text_iarchive.hpp> + +namespace boost { +namespace archive { + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl<Archive>::load(char *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // Works on all tested platforms + is.read(s, size); + s[size] = '\0'; +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl<Archive>::load(std::string &s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(size); + if(0 < size) + is.read(&(*s.begin()), size); +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl<Archive>::load(wchar_t *ws) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + is.read((char *)ws, size * sizeof(wchar_t)/sizeof(char)); + ws[size] = L'\0'; +} +#endif // BOOST_NO_INTRINSIC_WCHAR_T + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl<Archive>::load(std::wstring &ws) +{ + std::size_t size; + * this->This() >> size; + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(size); + // skip separating space + is.get(); + is.read((char *)ws.data(), size * sizeof(wchar_t)/sizeof(char)); +} + +#endif // BOOST_NO_STD_WSTRING +#endif // BOOST_NO_CWCHAR + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl<Archive>::load_override(class_name_type & t, int){ + basic_text_iarchive<Archive>::load_override(t, 0); +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl<Archive>::init(){ + basic_text_iarchive<Archive>::init(); +} + +template<class Archive> +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +text_iarchive_impl<Archive>::text_iarchive_impl( + std::istream & is, + unsigned int flags +) : + basic_text_iprimitive<std::istream>( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive<Archive>(flags) +{ + if(0 == (flags & no_header)) + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->init(); + #else + this->basic_text_iarchive<Archive>::init(); + #endif +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/text_oarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/text_oarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..2df0b46019acaaacebadcb991e0105a81d083bbd --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/text_oarchive_impl.ipp @@ -0,0 +1,124 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_oarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +#include <string> +#include <boost/config.hpp> +#include <locale> +#include <cstddef> // size_t + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include <cwchar> +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include <boost/archive/add_facet.hpp> +#include <boost/archive/text_oarchive.hpp> + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_oprimitive overrides for the combination +// of template parameters used to create a text_oprimitive + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl<Archive>::save(const char * s) +{ + const std::size_t len = std::ostream::traits_type::length(s); + *this->This() << len; + this->This()->newtoken(); + os << s; +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl<Archive>::save(const std::string &s) +{ + const std::size_t size = s.size(); + *this->This() << size; + this->This()->newtoken(); + os << s; +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl<Archive>::save(const wchar_t * ws) +{ + const std::size_t l = std::wcslen(ws); + * this->This() << l; + this->This()->newtoken(); + os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char)); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl<Archive>::save(const std::wstring &ws) +{ + const std::size_t l = ws.size(); + * this->This() << l; + this->This()->newtoken(); + os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char)); +} +#endif +#endif // BOOST_NO_CWCHAR + +template<class Archive> +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +text_oarchive_impl<Archive>::text_oarchive_impl( + std::ostream & os, + unsigned int flags +) : + basic_text_oprimitive<std::ostream>( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive<Archive>(flags) +{ + if(0 == (flags & no_header)) + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->init(); + #else + this->basic_text_oarchive<Archive>::init(); + #endif +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){ + put('\n'); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive<std::ostream>::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->delimiter = this->eol; +} + +} // namespace archive +} // namespace boost + diff --git a/Utilities/BGL/boost/archive/impl/text_wiarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/text_wiarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..6938c22659be07576bf4957164bf86203450529d --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/text_wiarchive_impl.ipp @@ -0,0 +1,118 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_text_wiarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +#include <cstddef> // size_t, NULL + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/detail/workaround.hpp> // fixup for RogueWave + +#ifndef BOOST_NO_STD_WSTREAMBUF +#include <boost/archive/basic_text_iprimitive.hpp> + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of wiprimtives functions +// +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl<Archive>::load(char *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + while(size-- > 0){ + *s++ = is.narrow(is.get(), '\0'); + } + *s = '\0'; +} + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl<Archive>::load(std::string &s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(0); + s.reserve(size); + while(size-- > 0){ + int x = is.narrow(is.get(), '\0'); + s += x; + } +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl<Archive>::load(wchar_t *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // Works on all tested platforms + is.read(s, size); + s[size] = L'\0'; +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl<Archive>::load(std::wstring &ws) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // borland complains about resize + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(size); + // note breaking a rule here - is this a problem on some platform + is.read(const_cast<wchar_t *>(ws.data()), size); +} +#endif + +template<class Archive> +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +text_wiarchive_impl<Archive>::text_wiarchive_impl( + std::wistream & is, + unsigned int flags +) : + basic_text_iprimitive<std::wistream>( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive<Archive>(flags) +{ + if(0 == (flags & no_header)) + basic_text_iarchive<Archive>::init(); +} + +} // archive +} // boost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/Utilities/BGL/boost/archive/impl/text_woarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/text_woarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..6683f528c036ed117ff7e2a19c1f6e218ca93c93 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/text_woarchive_impl.ipp @@ -0,0 +1,85 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_woarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +#include <boost/config.hpp> +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include <cstring> +#include <cstddef> // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; + using ::size_t; +} // namespace std +#endif + +#include <ostream> + +#include <boost/archive/text_woarchive.hpp> + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of woarchive functions +// +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl<Archive>::save(const char *s) +{ + // note: superfluous local variable fixes borland warning + const std::size_t size = std::strlen(s); + * this->This() << size; + this->This()->newtoken(); + while(*s != '\0') + os.put(os.widen(*s++)); +} + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl<Archive>::save(const std::string &s) +{ + const std::size_t size = s.size(); + * this->This() << size; + this->This()->newtoken(); + const char * cptr = s.data(); + for(std::size_t i = size; i-- > 0;) + os.put(os.widen(*cptr++)); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl<Archive>::save(const wchar_t *ws) +{ + const std::size_t size = std::wostream::traits_type::length(ws); + * this->This() << size; + this->This()->newtoken(); + os.write(ws, size); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl<Archive>::save(const std::wstring &ws) +{ + const std::size_t size = ws.length(); + * this->This() << size; + this->This()->newtoken(); + os.write(ws.data(), size); +} +#endif + +} // namespace archive +} // namespace boost + +#endif + diff --git a/Utilities/BGL/boost/archive/impl/xml_iarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/xml_iarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..daa3e594b33f7901b46c57bd06e0dc8f947598af --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/xml_iarchive_impl.ipp @@ -0,0 +1,204 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_iarchive_impl.cpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +#include <boost/config.hpp> +#include <cstring> // memcpy +#include <cstddef> // NULL +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include <cstdlib> // mbtowc +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mbtowc; + } // namespace std +#endif +#endif // BOOST_NO_CWCHAR + +#include <boost/detail/workaround.hpp> // RogueWave and Dinkumware +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include <boost/archive/dinkumware.hpp> +#endif + +#include <boost/detail/no_exceptions_support.hpp> + +#include <boost/archive/xml_archive_exception.hpp> +#include <boost/archive/iterators/dataflow_exception.hpp> +#include <boost/archive/basic_xml_archive.hpp> +#include <boost/archive/xml_iarchive.hpp> + +#include "basic_xml_grammar.hpp" + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to char archives + +// wide char stuff used by char archives + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl<Archive>::load(std::wstring &ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(0); + const char * start = s.data(); + const char * end = start + s.size(); + while(start < end){ + wchar_t wc; + int resultx = std::mbtowc(&wc, start, end - start); + if(0 < resultx){ + start += resultx; + ws += wc; + continue; + } + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + } +} +#endif // BOOST_NO_STD_WSTRING + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl<Archive>::load(wchar_t * ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + + const char * start = s.data(); + const char * end = start + s.size(); + while(start < end){ + wchar_t wc; + int result = std::mbtowc(&wc, start, end - start); + if(0 < result){ + start += result; + *ws++ = wc; + continue; + } + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + } + *ws = L'\0'; +} +#endif + +#endif // BOOST_NO_CWCHAR + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl<Archive>::load(std::string &s){ + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl<Archive>::load(char * s){ + std::string tstring; + bool result = gimpl->parse_string(is, tstring); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + std::memcpy(s, tstring.data(), tstring.size()); + s[tstring.size()] = 0; +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl<Archive>::load_override(class_name_type & t, int){ + const std::string & s = gimpl->rv.class_name; + if(s.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + char * tptr = t; + std::memcpy(tptr, s.data(), s.size()); + tptr[s.size()] = '\0'; +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl<Archive>::init(){ + gimpl->init(is); + this->set_library_version( + version_type(gimpl->rv.version) + ); +} + +template<class Archive> +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_iarchive_impl<Archive>::xml_iarchive_impl( + std::istream &is_, + unsigned int flags +) : + basic_text_iprimitive<std::istream>( + is_, + 0 != (flags & no_codecvt) + ), + basic_xml_iarchive<Archive>(flags), + gimpl(new xml_grammar()) +{ + if(0 == (flags & no_header)){ + BOOST_TRY{ + init(); + } + BOOST_CATCH(...){ + delete gimpl; + #ifndef BOOST_NO_EXCEPTIONS + throw; // re-throw + #endif + } + BOOST_CATCH_END + } +} + +template<class Archive> +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_iarchive_impl<Archive>::~xml_iarchive_impl(){ + if(0 == (this->get_flags() & no_header)){ + BOOST_TRY{ + gimpl->windup(is); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } + delete gimpl; +} +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/xml_oarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/xml_oarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..8ab954f4a34c70e3080172b0c347ef92e3f3d9e5 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/xml_oarchive_impl.ipp @@ -0,0 +1,117 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_oarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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) + +#include <ostream> +#include <iomanip> +#include <algorithm> +#include <string> + +#include <cstring> // strlen +#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include <boost/archive/iterators/xml_escape.hpp> +#include <boost/archive/iterators/ostream_iterator.hpp> + +#ifndef BOOST_NO_CWCHAR +#include <boost/archive/wcslen.hpp> +#include <boost/archive/iterators/mb_from_wchar.hpp> +#endif + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to char archives + +// wide char stuff used by char archives +#ifndef BOOST_NO_CWCHAR +// copy chars to output escaping to xml and translating wide chars to mb chars +template<class InputIterator> +void save_iterator(std::ostream &os, InputIterator begin, InputIterator end){ + typedef boost::archive::iterators::mb_from_wchar< + boost::archive::iterators::xml_escape<InputIterator> + > translator; + std::copy( + translator(BOOST_MAKE_PFTO_WRAPPER(begin)), + translator(BOOST_MAKE_PFTO_WRAPPER(end)), + boost::archive::iterators::ostream_iterator<char>(os) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl<Archive>::save(const std::wstring & ws){ +// at least one library doesn't typedef value_type for strings +// so rather than using string directly make a pointer iterator out of it +// save_iterator(os, ws.data(), ws.data() + std::wcslen(ws.data())); + save_iterator(os, ws.data(), ws.data() + ws.size()); +} +#endif + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl<Archive>::save(const wchar_t * ws){ + save_iterator(os, ws, ws + std::wcslen(ws)); +} +#endif + +#endif // BOOST_NO_CWCHAR + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl<Archive>::save(const std::string & s){ +// at least one library doesn't typedef value_type for strings +// so rather than using string directly make a pointer iterator out of it + typedef boost::archive::iterators::xml_escape< + const char * + > xml_escape_translator; + std::copy( + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s.data())), + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s.data()+ s.size())), + boost::archive::iterators::ostream_iterator<char>(os) + ); +} + +template<class Archive> +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl<Archive>::save(const char * s){ + typedef boost::archive::iterators::xml_escape< + const char * + > xml_escape_translator; + std::copy( + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s)), + xml_escape_translator(BOOST_MAKE_PFTO_WRAPPER(s + std::strlen(s))), + boost::archive::iterators::ostream_iterator<char>(os) + ); +} + +template<class Archive> +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_oarchive_impl<Archive>::xml_oarchive_impl( + std::ostream & os_, + unsigned int flags +) : + basic_text_oprimitive<std::ostream>( + os_, + 0 != (flags & no_codecvt) + ), + basic_xml_oarchive<Archive>(flags) +{ + if(0 == (flags & no_header)) + this->init(); +} + +} // namespace archive +} // namespace boost diff --git a/Utilities/BGL/boost/archive/impl/xml_wiarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/xml_wiarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..c600eb815c731e3c9c2cd87cb6f8507661a4a401 --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/xml_wiarchive_impl.ipp @@ -0,0 +1,206 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_wiprimitive.cpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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://www.boost.org for updates, documentation, and revision history. + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME + +#include <cstring> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} //std +#endif + +#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include <cassert> +#include <algorithm> + +#include <boost/detail/workaround.hpp> // Dinkumware and RogueWave +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include <boost/archive/dinkumware.hpp> +#endif + +#include <boost/io/ios_state.hpp> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/serialization/pfto.hpp> + +#include <boost/serialization/string.hpp> +#include <boost/archive/add_facet.hpp> +#include <boost/archive/xml_archive_exception.hpp> +#include <boost/archive/detail/utf8_codecvt_facet.hpp> + +#include <boost/archive/iterators/mb_from_wchar.hpp> + +#include <boost/archive/basic_xml_archive.hpp> +#include <boost/archive/xml_wiarchive.hpp> + +#include "basic_xml_grammar.hpp" + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to wide char archives + +namespace { // anonymous + +void copy_to_ptr(char * s, const std::wstring & ws){ + std::copy( + iterators::mb_from_wchar<std::wstring::const_iterator>( + BOOST_MAKE_PFTO_WRAPPER(ws.begin()) + ), + iterators::mb_from_wchar<std::wstring::const_iterator>( + BOOST_MAKE_PFTO_WRAPPER(ws.end()) + ), + s + ); + s[ws.size()] = 0; +} + +} // anonymous + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl<Archive>::load(std::string & s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(0); + s.reserve(ws.size()); + std::copy( + iterators::mb_from_wchar<std::wstring::iterator>( + BOOST_MAKE_PFTO_WRAPPER(ws.begin()) + ), + iterators::mb_from_wchar<std::wstring::iterator>( + BOOST_MAKE_PFTO_WRAPPER(ws.end()) + ), + std::back_inserter(s) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl<Archive>::load(std::wstring & ws){ + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} +#endif + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl<Archive>::load(char * s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + copy_to_ptr(s, ws); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl<Archive>::load(wchar_t * ws){ + std::wstring twstring; + bool result = gimpl->parse_string(is, twstring); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + std::memcpy(ws, twstring.c_str(), twstring.size()); + ws[twstring.size()] = L'\0'; +} +#endif + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl<Archive>::load_override(class_name_type & t, int){ + const std::wstring & ws = gimpl->rv.class_name; + if(ws.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + copy_to_ptr(t, ws); +} + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl<Archive>::init(){ + gimpl->init(is); + this->set_library_version( + version_type(gimpl->rv.version) + ); +} + +template<class Archive> +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_wiarchive_impl<Archive>::xml_wiarchive_impl( + std::wistream &is_, + unsigned int flags +) : + basic_text_iprimitive<std::wistream>( + is_, + true // don't change the codecvt - use the one below + ), + basic_xml_iarchive<Archive>(flags), + gimpl(new xml_wgrammar()) +{ + if(0 == (flags & no_codecvt)){ + archive_locale.reset( + add_facet( + std::locale::classic(), + new boost::archive::detail::utf8_codecvt_facet + ) + ); + is.imbue(* archive_locale); + } + if(0 == (flags & no_header)){ + BOOST_TRY{ + this->init(); + } + BOOST_CATCH(...){ + delete gimpl; + #ifndef BOOST_NO_EXCEPTIONS + throw; // re-throw + #endif + } + BOOST_CATCH_END + } +} + +template<class Archive> +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_wiarchive_impl<Archive>::~xml_wiarchive_impl(){ + if(0 == (this->get_flags() & no_header)){ + BOOST_TRY{ + gimpl->windup(is); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } + delete gimpl; +} + +} // namespace archive +} // namespace boost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/Utilities/BGL/boost/archive/impl/xml_woarchive_impl.ipp b/Utilities/BGL/boost/archive/impl/xml_woarchive_impl.ipp new file mode 100644 index 0000000000000000000000000000000000000000..3bf42bdacecbf5ac66f9fac3b214600b27fd7eff --- /dev/null +++ b/Utilities/BGL/boost/archive/impl/xml_woarchive_impl.ipp @@ -0,0 +1,160 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_woarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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) + +#include <boost/config.hpp> +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include <ostream> +#include <string> +#include <algorithm> +#include <locale> + +#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings + // for BOOST_DEDUCED_TYPENAME +#include <cstring> // strlen +#include <cstdlib> // mbtowc +#include <cwchar> // wcslen + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::strlen; + #if ! defined(BOOST_NO_INTRINSIC_WCHAR_T) + using ::mbtowc; + using ::wcslen; + #endif +} // namespace std +#endif + +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/pfto.hpp> + +#include <boost/archive/iterators/xml_escape.hpp> +#include <boost/archive/iterators/wchar_from_mb.hpp> +#include <boost/archive/iterators/ostream_iterator.hpp> +#include <boost/archive/iterators/dataflow_exception.hpp> + +#include <boost/archive/add_facet.hpp> +#include <boost/archive/detail/utf8_codecvt_facet.hpp> + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to wide char archives + +// copy chars to output escaping to xml and widening characters as we go +template<class InputIterator> +void save_iterator(std::wostream &os, InputIterator begin, InputIterator end){ + typedef iterators::wchar_from_mb< + iterators::xml_escape<InputIterator> + > xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(begin)), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(end)), + boost::archive::iterators::ostream_iterator<wchar_t>(os) + ); +} + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl<Archive>::save(const std::string & s){ + // note: we don't use s.begin() and s.end() because dinkumware + // doesn't have string::value_type defined. So use a wrapper + // around these values to implement the definitions. + const char * begin = s.data(); + const char * end = begin + s.size(); + save_iterator(os, begin, end); +} + +#ifndef BOOST_NO_STD_WSTRING +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl<Archive>::save(const std::wstring & ws){ +#if 0 + typedef iterators::xml_escape<std::wstring::const_iterator> xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.begin())), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.end())), + boost::archive::iterators::ostream_iterator<wchar_t>(os) + ); +#endif + typedef iterators::xml_escape<const wchar_t *> xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.data())), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.data() + ws.size())), + boost::archive::iterators::ostream_iterator<wchar_t>(os) + ); +} +#endif //BOOST_NO_STD_WSTRING + +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl<Archive>::save(const char * s){ + save_iterator(os, s, s + std::strlen(s)); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<class Archive> +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl<Archive>::save(const wchar_t * ws){ + os << ws; + typedef iterators::xml_escape<const wchar_t *> xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws)), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws + std::wcslen(ws))), + boost::archive::iterators::ostream_iterator<wchar_t>(os) + ); +} +#endif + +template<class Archive> +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_woarchive_impl<Archive>::xml_woarchive_impl( + std::wostream & os_, + unsigned int flags +) : + basic_text_oprimitive<std::wostream>( + os_, + true // don't change the codecvt - use the one below + ), + basic_xml_oarchive<Archive>(flags) +{ + // Standard behavior is that imbue can be called + // a) before output is invoked or + // b) after flush has been called. This prevents one-to-many + // transforms (such as one to many transforms from getting + // mixed up. Unfortunately, STLPort doesn't respect b) above + // so the restoration of the original archive locale done by + // the locale_saver doesn't get processed, + // before the current one is destroyed. + // so the codecvt doesn't get replaced with the orginal + // so closing the stream invokes codecvt::do_unshift + // so it crashes because the corresponding locale that contained + // the codecvt isn't around any more. + // we can hack around this by using a static codecvt that never + // gets destroyed. + if(0 == (flags & no_codecvt)){ + boost::archive::detail::utf8_codecvt_facet *pfacet; + #if defined(__SGI_STL_PORT) + static boost::archive::detail::utf8_codecvt_facet + facet(static_cast<size_t>(1)); + pfacet = & facet; + #else + pfacet = new boost::archive::detail::utf8_codecvt_facet; + #endif + archive_locale.reset(add_facet(std::locale::classic(), pfacet)); + os.imbue(* archive_locale); + } + if(0 == (flags & no_header)) + this->init(); +} + +} // namespace archive +} // namespace boost + +#endif //BOOST_NO_STD_WSTREAMBUF diff --git a/Utilities/BGL/boost/archive/iterators/base64_exception.hpp b/Utilities/BGL/boost/archive/iterators/base64_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eb2d2e1ba0642be51757e6b337300047a01999ce --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/base64_exception.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_HPP +#define BOOST_ARCHIVE_ITERATORS_BASE64_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// base64_exception.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> +#ifndef BOOST_NO_EXCEPTIONS +#include <exception> + +#include <cassert> + +namespace boost { +namespace archive { +namespace iterators { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by base64s +// +class base64_exception : public std::exception +{ +public: + typedef enum { + invalid_code, // attempt to encode a value > 6 bits + invalid_character, // decode a value not in base64 char set + other_exception + } exception_code; + exception_code code; + + base64_exception(exception_code c = other_exception) : code(c) + {} + + virtual const char *what( ) const throw( ) + { + const char *msg = "unknown exception code"; + switch(code){ + case invalid_code: + msg = "attempt to encode a value > 6 bits"; + break; + case invalid_character: + msg = "attempt to decode a value not in base64 char set"; + break; + default: + assert(false); + break; + } + return msg; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif //BOOST_NO_EXCEPTIONS +#endif //BOOST_ARCHIVE_ITERATORS_ARCHIVE_EXCEPTION_HPP diff --git a/Utilities/BGL/boost/archive/iterators/base64_from_binary.hpp b/Utilities/BGL/boost/archive/iterators/base64_from_binary.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a46137d1d57b0c44ce3ddc20d9234d886e4505c4 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/base64_from_binary.hpp @@ -0,0 +1,112 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP +#define BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// base64_from_binary.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 <cassert> + +#include <cstddef> // size_t +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/serialization/pfto.hpp> + +#include <boost/iterator/transform_iterator.hpp> +#include <boost/archive/iterators/dataflow_exception.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert binary integers to base64 characters + +namespace detail { + +template<class CharType> +struct from_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + const char * lookup_table = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/"; + assert(t < 64); + return lookup_table[static_cast<size_t>(t)]; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template<class Base, class CharType = BOOST_DEDUCED_TYPENAME Base::value_type> +// typedef transform_iterator< +// from_6_bit<CharType>, +// transform_width<Base, 6, sizeof(Base::value_type) * 8, CharType> +// > base64_from_binary; +// but C++ won't accept this. Rather than using a "type generator" and +// using a different syntax, make a derivation which should be equivalent. +// +// Another issue addressed here is that the transform_iterator doesn't have +// a templated constructor. This makes it incompatible with the dataflow +// ideal. This is also addressed here. + +//template<class Base, class CharType = BOOST_DEDUCED_TYPENAME Base::value_type> +template< + class Base, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type +> +class base64_from_binary : + public transform_iterator< + detail::from_6_bit<CharType>, + Base + > +{ + friend class boost::iterator_core_access; + typedef transform_iterator< + BOOST_DEDUCED_TYPENAME detail::from_6_bit<CharType>, + Base + > super_t; + +public: + // make composible buy using templated constructor + template<class T> + base64_from_binary(BOOST_PFTO_WRAPPER(T) start) : + super_t( + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start))), + detail::from_6_bit<CharType>() + ) + {} + // intel 7.1 doesn't like default copy constructor + base64_from_binary(const base64_from_binary & rhs) : + super_t( + Base(rhs.base_reference()), + detail::from_6_bit<CharType>() + ) + {} +// base64_from_binary(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP diff --git a/Utilities/BGL/boost/archive/iterators/binary_from_base64.hpp b/Utilities/BGL/boost/archive/iterators/binary_from_base64.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b75e0b10ccd1dc4391f004d058175af3f7322c69 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/binary_from_base64.hpp @@ -0,0 +1,120 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP +#define BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_from_base64.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 <cassert> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/pfto.hpp> +#include <boost/static_assert.hpp> + +#include <boost/iterator/transform_iterator.hpp> +#include <boost/archive/iterators/dataflow_exception.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert base64 characters to binary data + +namespace detail { + +template<class CharType> +struct to_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + const char lookup_table[] = { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, + 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, + 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, + -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, + 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1 + }; + // metrowerks trips this assertion - how come? + #if ! defined(__MWERKS__) + BOOST_STATIC_ASSERT(128 == sizeof(lookup_table)); + #endif + signed char value = -1; + if((unsigned)t <= 127) + value = lookup_table[(unsigned)t]; + if(-1 == value) + boost::serialization::throw_exception( + dataflow_exception(dataflow_exception::invalid_base64_character) + ); + return value; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template<class Base, class CharType = BOOST_DEDUCED_TYPENAME Base::value_type> +// typedef transform_iterator< +// from_6_bit<CharType>, +// transform_width<Base, 6, sizeof(Base::value_type) * 8, CharType> +// > base64_from_binary; +// but C++ won't accept this. Rather than using a "type generator" and +// using a different syntax, make a derivation which should be equivalent. +// +// Another issue addressed here is that the transform_iterator doesn't have +// a templated constructor. This makes it incompatible with the dataflow +// ideal. This is also addressed here. + +template< + class Base, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type +> +class binary_from_base64 : public + transform_iterator< + detail::to_6_bit<CharType>, + Base + > +{ + friend class boost::iterator_core_access; + typedef transform_iterator< + detail::to_6_bit<CharType>, + Base + > super_t; +public: + // make composible buy using templated constructor + template<class T> + binary_from_base64(BOOST_PFTO_WRAPPER(T) start) : + super_t( + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start))), + detail::to_6_bit<CharType>() + ) + {} + // intel 7.1 doesn't like default copy constructor + binary_from_base64(const binary_from_base64 & rhs) : + super_t( + Base(rhs.base_reference()), + detail::to_6_bit<CharType>() + ) + {} +// binary_from_base64(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP diff --git a/Utilities/BGL/boost/archive/iterators/dataflow.hpp b/Utilities/BGL/boost/archive/iterators/dataflow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..795848240194c376a05993931b6ce19117871135 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/dataflow.hpp @@ -0,0 +1,105 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_DATAFLOW_HPP +#define BOOST_ARCHIVE_ITERATORS_DATAFLOW_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dataflow.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 <cassert> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/apply.hpp> +#include <boost/mpl/plus.hpp> +#include <boost/mpl/int.hpp> + +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/iterator/iterator_traits.hpp> +#include <boost/static_assert.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +// poor man's tri-state +struct tri_state { + enum state_enum { + is_false = false, + is_true = true, + is_indeterminant + } m_state; + // convert to bool + operator bool (){ + assert(is_indeterminant != m_state); + return is_true == m_state ? true : false; + } + // assign from bool + tri_state & operator=(bool rhs) { + m_state = rhs ? is_true : is_false; + return *this; + } + tri_state(bool rhs) : + m_state(rhs ? is_true : is_false) + {} + tri_state(state_enum state) : + m_state(state) + {} + bool operator==(const tri_state & rhs) const { + return m_state == rhs.m_state; + } + bool operator!=(const tri_state & rhs) const { + return m_state != rhs.m_state; + } +}; + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implement functions common to dataflow iterators +template<class Derived> +class dataflow { + bool m_eoi; +protected: + // test for iterator equality + tri_state equal(const Derived & rhs) const { + if(m_eoi && rhs.m_eoi) + return true; + if(m_eoi || rhs.m_eoi) + return false; + return tri_state(tri_state::is_indeterminant); + } + void eoi(bool tf){ + m_eoi = tf; + } + bool eoi() const { + return m_eoi; + } +public: + dataflow(bool tf) : + m_eoi(tf) + {} + dataflow() : // used for iterator end + m_eoi(true) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_DATAFLOW_HPP diff --git a/Utilities/BGL/boost/archive/iterators/dataflow_exception.hpp b/Utilities/BGL/boost/archive/iterators/dataflow_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..765661e47098b9ad6a234e3f18a9e1a692218320 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/dataflow_exception.hpp @@ -0,0 +1,80 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP +#define BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dataflow_exception.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> +#ifndef BOOST_NO_EXCEPTIONS +#include <exception> +#endif //BOOST_NO_EXCEPTIONS + +#include <cassert> + +namespace boost { +namespace archive { +namespace iterators { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by dataflows +// +class dataflow_exception : public std::exception +{ +public: + typedef enum { + invalid_6_bitcode, + invalid_base64_character, + invalid_xml_escape_sequence, + comparison_not_permitted, + invalid_conversion, + other_exception + } exception_code; + exception_code code; + + dataflow_exception(exception_code c = other_exception) : code(c) + {} + + virtual const char *what( ) const throw( ) + { + const char *msg = "unknown exception code"; + switch(code){ + case invalid_6_bitcode: + msg = "attempt to encode a value > 6 bits"; + break; + case invalid_base64_character: + msg = "attempt to decode a value not in base64 char set"; + break; + case invalid_xml_escape_sequence: + msg = "invalid xml escape_sequence"; + break; + case comparison_not_permitted: + msg = "cannot invoke iterator comparison now"; + break; + case invalid_conversion: + msg = "invalid multbyte/wide char conversion"; + break; + default: + assert(false); + break; + } + return msg; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif //BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP diff --git a/Utilities/BGL/boost/archive/iterators/escape.hpp b/Utilities/BGL/boost/archive/iterators/escape.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b11d1a6722d2d06f93e08b9d573a97384ee53fe8 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/escape.hpp @@ -0,0 +1,115 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// escape.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 <cassert> +#include <cstddef> // NULL + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/iterator/iterator_traits.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into text + +template<class Derived, class Base> +class escape : + public boost::iterator_adaptor< + Derived, + Base, + BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type, + single_pass_traversal_tag, + BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type + > +{ + typedef BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type base_value_type; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<Base>::type reference_type; + friend class boost::iterator_core_access; + + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + Derived, + Base, + base_value_type, + single_pass_traversal_tag, + base_value_type + > super_t; + + typedef escape<Derived, Base> this_t; + + void dereference_impl() { + m_current_value = static_cast<Derived *>(this)->fill(m_bnext, m_bend); + m_full = true; + } + + //Access the value referred to + reference_type dereference() const { + if(!m_full) + const_cast<this_t *>(this)->dereference_impl(); + return m_current_value; + } + + bool equal(const this_t & rhs) const { + if(m_full){ + if(! rhs.m_full) + const_cast<this_t *>(& rhs)->dereference_impl(); + } + else{ + if(rhs.m_full) + const_cast<this_t *>(this)->dereference_impl(); + } + if(m_bnext != rhs.m_bnext) + return false; + if(this->base_reference() != rhs.base_reference()) + return false; + return true; + } + + void increment(){ + if(++m_bnext < m_bend){ + m_current_value = *m_bnext; + return; + } + ++(this->base_reference()); + m_bnext = NULL; + m_bend = NULL; + m_full = false; + } + + // buffer to handle pending characters + const base_value_type *m_bnext; + const base_value_type *m_bend; + bool m_full; + base_value_type m_current_value; +public: + escape(Base base) : + super_t(base), + m_bnext(NULL), + m_bend(NULL), + m_full(false) + { + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP diff --git a/Utilities/BGL/boost/archive/iterators/head_iterator.hpp b/Utilities/BGL/boost/archive/iterators/head_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..279b2025ce510dab67d9d6e6adfdfc09c6352005 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/head_iterator.hpp @@ -0,0 +1,81 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// head_iterator.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/type_traits/is_same.hpp> +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/iterator/iterator_traits.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +template<class Predicate, class Base> +class head_iterator + : public boost::iterator_adaptor< + head_iterator<Predicate, Base>, + Base, + use_default, + single_pass_traversal_tag + > +{ +private: + friend class iterator_core_access; + typedef boost::iterator_adaptor< + head_iterator<Predicate, Base>, + Base, + use_default, + single_pass_traversal_tag + > super_t; + + typedef head_iterator<Predicate, Base> this_t; + typedef BOOST_DEDUCED_TYPENAME super_t::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type; + + reference_type dereference_impl(){ + if(! m_end){ + while(! m_predicate(* this->base_reference())) + ++ this->base_reference(); + m_end = true; + } + return * this->base_reference(); + } + + reference_type dereference() const { + return const_cast<this_t *>(this)->dereference_impl(); + } + + void increment(){ + ++base_reference(); + } + Predicate m_predicate; + bool m_end; +public: + template<class T> + head_iterator(Predicate f, T start) : + super_t(Base(start)), + m_predicate(f), + m_end(false) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP diff --git a/Utilities/BGL/boost/archive/iterators/insert_linebreaks.hpp b/Utilities/BGL/boost/archive/iterators/insert_linebreaks.hpp new file mode 100644 index 0000000000000000000000000000000000000000..feb8c5bb842e261b5443b81a4c1d5426fb2d7aa4 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/insert_linebreaks.hpp @@ -0,0 +1,101 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP +#define BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert_linebreaks.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 <cassert> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::memcpy; } +#endif + +#include <boost/serialization/pfto.hpp> + +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/iterator/iterator_traits.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert line break every N characters +template< + class Base, + int N, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type +> +class insert_linebreaks : + public iterator_adaptor< + insert_linebreaks<Base, N, CharType>, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ +private: + friend class boost::iterator_core_access; + typedef iterator_adaptor< + insert_linebreaks<Base, N, CharType>, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + bool equal(const insert_linebreaks<Base, N, CharType> & rhs) const { + return +// m_count == rhs.m_count +// && base_reference() == rhs.base_reference() + this->base_reference() == rhs.base_reference() + ; + } + + void increment() { + if(m_count == N){ + m_count = 0; + return; + } + ++m_count; + ++(this->base_reference()); + } + CharType dereference() const { + if(m_count == N) + return '\n'; + return * (this->base_reference()); + } + unsigned int m_count; +public: + // make composible buy using templated constructor + template<class T> + insert_linebreaks(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start)))), + m_count(0) + {} + // intel 7.1 doesn't like default copy constructor + insert_linebreaks(const insert_linebreaks & rhs) : + super_t(rhs.base_reference()), + m_count(rhs.m_count) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP diff --git a/Utilities/BGL/boost/archive/iterators/istream_iterator.hpp b/Utilities/BGL/boost/archive/iterators/istream_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1df612dc8d14cd562a2efd980ee6e694e7600127 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/istream_iterator.hpp @@ -0,0 +1,95 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// istream_iterator.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. + +// note: this is a custom version of the standard istream_iterator. +// This is necessary as the standard version doesn't work as expected +// for wchar_t based streams on systems for which wchar_t not a true +// type but rather a synonym for some integer type. + +#include <cstddef> // NULL +#include <istream> +#include <boost/iterator/iterator_facade.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template<class Elem = char> +class istream_iterator : + public boost::iterator_facade< + istream_iterator<Elem>, + Elem, + std::input_iterator_tag, + Elem + > +{ + friend class boost::iterator_core_access; + typedef istream_iterator this_t ; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_facade< + istream_iterator<Elem>, + Elem, + std::input_iterator_tag, + Elem + > super_t; + typedef BOOST_DEDUCED_TYPENAME std::basic_istream<Elem> istream_type; + + //Access the value referred to + Elem dereference() const { + return m_current_value; + } + + bool equal(const this_t & rhs) const { + // note: only works for comparison against end of stream + return m_istream == rhs.m_istream; + } + + void increment(){ + if(NULL != m_istream){ + m_current_value = static_cast<Elem>(m_istream->get()); + if(! m_istream->good()){ + const_cast<this_t *>(this)->m_istream = NULL; + } + } + } + + istream_type *m_istream; + Elem m_current_value; +public: + istream_iterator(istream_type & is) : + m_istream(& is) + { + increment(); + } + + istream_iterator() : + m_istream(NULL) + {} + + istream_iterator(const istream_iterator<Elem> & rhs) : + m_istream(rhs.m_istream), + m_current_value(rhs.m_current_value) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP diff --git a/Utilities/BGL/boost/archive/iterators/mb_from_wchar.hpp b/Utilities/BGL/boost/archive/iterators/mb_from_wchar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..22ee9504e5f4cf11483c00544290ea01e9703efa --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/mb_from_wchar.hpp @@ -0,0 +1,136 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP +#define BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// mb_from_wchar.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 <cassert> +#include <cstddef> // size_t +#include <cstdlib> // for wctomb() + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + using ::wctomb; +} // namespace std +#endif + +#include <boost/serialization/pfto.hpp> +#include <boost/iterator/iterator_adaptor.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate wide strings and to char +// strings of the currently selected locale +template<class Base> // the input iterator +class mb_from_wchar + : public boost::iterator_adaptor< + mb_from_wchar<Base>, + Base, + wchar_t, + single_pass_traversal_tag, + char + > +{ + friend class boost::iterator_core_access; + + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + mb_from_wchar<Base>, + Base, + wchar_t, + single_pass_traversal_tag, + char + > super_t; + + typedef mb_from_wchar<Base> this_t; + + char dereference_impl() { + if(! m_full){ + fill(); + m_full = true; + } + return m_buffer[m_bnext]; + } + char dereference() const { + return (const_cast<this_t *>(this))->dereference_impl(); + } + + // test for iterator equality + bool equal(const mb_from_wchar<Base> & rhs) const { + // once the value is filled, the base_reference has been incremented + // so don't permit comparison anymore. + return + 0 == m_bend + && 0 == m_bnext + && this->base_reference() == rhs.base_reference() + ; + } + + void fill(){ + wchar_t value = * this->base_reference(); + #if (defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) \ + || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8)))) + m_bend = std::wcrtomb(m_buffer, value, 0); + #else + m_bend = std::wctomb(m_buffer, value); + #endif + assert(-1 != m_bend); + assert((std::size_t)m_bend <= sizeof(m_buffer)); + assert(m_bend > 0); + m_bnext = 0; + } + + void increment(){ + if(++m_bnext < m_bend) + return; + m_bend = + m_bnext = 0; + ++(this->base_reference()); + m_full = false; + } + + // buffer to handle pending characters + int m_bend; + int m_bnext; + char m_buffer[9]; + bool m_full; + +public: + // make composible buy using templated constructor + template<class T> + mb_from_wchar(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start)))), + m_bend(0), + m_bnext(0), + m_full(false) + {} + // intel 7.1 doesn't like default copy constructor + mb_from_wchar(const mb_from_wchar & rhs) : + super_t(rhs.base_reference()), + m_bend(rhs.m_bend), + m_bnext(rhs.m_bnext), + m_full(rhs.m_full) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP diff --git a/Utilities/BGL/boost/archive/iterators/ostream_iterator.hpp b/Utilities/BGL/boost/archive/iterators/ostream_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7c3203f1258618730ace1502e53a209c6d89ec7b --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/ostream_iterator.hpp @@ -0,0 +1,83 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// ostream_iterator.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. + +// note: this is a custom version of the standard ostream_iterator. +// This is necessary as the standard version doesn't work as expected +// for wchar_t based streams on systems for which wchar_t not a true +// type but rather a synonym for some integer type. + +#include <ostream> +#include <boost/iterator/iterator_facade.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template<class Elem> +class ostream_iterator : + public boost::iterator_facade< + ostream_iterator<Elem>, + Elem, + std::output_iterator_tag, + ostream_iterator<Elem> & + > +{ + friend class boost::iterator_core_access; + typedef ostream_iterator this_t ; + typedef Elem char_type; + typedef std::basic_ostream<char_type> ostream_type; + + //emulate the behavior of std::ostream + ostream_iterator & dereference() const { + return const_cast<ostream_iterator &>(*this); + } + bool equal(const this_t & rhs) const { + return m_ostream == rhs.m_ostream; + } + void increment(){} +protected: + ostream_type *m_ostream; + void put_val(char_type e){ + if(NULL != m_ostream){ + m_ostream->put(e); + if(! m_ostream->good()) + m_ostream = NULL; + } + } +public: + this_t & operator=(char_type c){ + put_val(c); + return *this; + } + ostream_iterator(ostream_type & os) : + m_ostream (& os) + {} + ostream_iterator() : + m_ostream (NULL) + {} + ostream_iterator(const ostream_iterator & rhs) : + m_ostream (rhs.m_ostream) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP diff --git a/Utilities/BGL/boost/archive/iterators/remove_whitespace.hpp b/Utilities/BGL/boost/archive/iterators/remove_whitespace.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c5e581d99ffbd586120721b0094f19beef572cd8 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/remove_whitespace.hpp @@ -0,0 +1,169 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP +#define BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// remove_whitespace.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 <cassert> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME + +#include <boost/serialization/pfto.hpp> + +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/iterator/filter_iterator.hpp> + +//#include <boost/detail/workaround.hpp> +//#if ! BOOST_WORKAROUND(BOOST_MSVC, <=1300) + +// here is the default standard implementation of the functor used +// by the filter iterator to remove spaces. Unfortunately usage +// of this implementation in combination with spirit trips a bug +// VC 6.5. The only way I can find to work around it is to +// implement a special non-standard version for this platform + +#ifndef BOOST_NO_CWCTYPE +#include <cwctype> // iswspace +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::iswspace; } +#endif +#endif + +#include <cctype> // isspace +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::isspace; } +#endif + +#if defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) +// this is required for the RW STL on Linux and Tru64. +#undef isspace +#undef iswspace +#endif + +//#endif // BOOST_WORKAROUND + +namespace { // anonymous + +template<class CharType> +struct remove_whitespace_predicate; + +template<> +struct remove_whitespace_predicate<char> +{ + bool operator()(unsigned char t){ + return ! std::isspace(t); + } +}; + +#ifndef BOOST_NO_CWCHAR +template<> +struct remove_whitespace_predicate<wchar_t> +{ + bool operator()(wchar_t t){ + return ! std::iswspace(t); + } +}; +#endif + +} // namespace anonymous + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert base64 file data (including whitespace and padding) to binary + +namespace boost { +namespace archive { +namespace iterators { + +// custom version of filter iterator which doesn't look ahead further than +// necessary + +template<class Predicate, class Base> +class filter_iterator + : public boost::iterator_adaptor< + filter_iterator<Predicate, Base>, + Base, + use_default, + single_pass_traversal_tag + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + filter_iterator<Predicate, Base>, + Base, + use_default, + single_pass_traversal_tag + > super_t; + typedef filter_iterator<Predicate, Base> this_t; + typedef BOOST_DEDUCED_TYPENAME super_t::reference reference_type; + + reference_type dereference_impl(){ + if(! m_full){ + while(! m_predicate(* this->base_reference())) + ++(this->base_reference()); + m_full = true; + } + return * this->base_reference(); + } + + reference_type dereference() const { + return const_cast<this_t *>(this)->dereference_impl(); + } + + Predicate m_predicate; + bool m_full; +public: + // note: this function is public only because comeau compiler complained + // I don't know if this is because the compiler is wrong or what + void increment(){ + m_full = false; + ++(this->base_reference()); + } + filter_iterator(Base start) : + super_t(start), + m_full(false) + {} + filter_iterator(){} +}; + +template<class Base> +class remove_whitespace : + public filter_iterator< + remove_whitespace_predicate<BOOST_DEDUCED_TYPENAME Base::value_type>, + Base + > +{ + friend class boost::iterator_core_access; + typedef filter_iterator< + remove_whitespace_predicate<BOOST_DEDUCED_TYPENAME Base::value_type>, + Base + > super_t; +public: +// remove_whitespace(){} // why is this needed? + // make composible buy using templated constructor + template<class T> + remove_whitespace(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start)))) + {} + // intel 7.1 doesn't like default copy constructor + remove_whitespace(const remove_whitespace & rhs) : + super_t(rhs.base_reference()) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP diff --git a/Utilities/BGL/boost/archive/iterators/transform_width.hpp b/Utilities/BGL/boost/archive/iterators/transform_width.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c2e9bee12e3a6fcfcbcc8df227a3792f756cc307 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/transform_width.hpp @@ -0,0 +1,168 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP +#define BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// transform_width.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. + +// iterator which takes elements of x bits and returns elements of y bits. +// used to change streams of 8 bit characters into streams of 6 bit characters. +// and vice-versa for implementing base64 encodeing/decoding. Be very careful +// when using and end iterator. end is only reliable detected when the input +// stream length is some common multiple of x and y. E.G. Base64 6 bit +// character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters +// or 3 8 bit characters + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME & PTFO +#include <boost/serialization/pfto.hpp> + +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/iterator/iterator_traits.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template< + class Base, + int BitsOut, + int BitsIn, + class CharType = BOOST_DEDUCED_TYPENAME boost::iterator_value<Base>::type // output character +> +class transform_width : + public boost::iterator_adaptor< + transform_width<Base, BitsOut, BitsIn, CharType>, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + transform_width<Base, BitsOut, BitsIn, CharType>, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + typedef transform_width<Base, BitsOut, BitsIn, CharType> this_t; + typedef BOOST_DEDUCED_TYPENAME iterator_value<Base>::type base_value_type; + + CharType fill(); + + CharType dereference_impl(){ + if(! m_full){ + m_current_value = fill(); + m_full = true; + } + return m_current_value; + } + + CharType dereference() const { + return const_cast<this_t *>(this)->dereference_impl(); + } + + // test for iterator equality + bool equal(const this_t & rhs) const { + return + this->base_reference() == rhs.base_reference(); + ; + } + + void increment(){ + m_displacement += BitsOut; + + while(m_displacement >= BitsIn){ + m_displacement -= BitsIn; + if(0 == m_displacement) + m_bufferfull = false; + if(! m_bufferfull){ + // note: suspect that this is not invoked for borland + ++(this->base_reference()); + } + } + m_full = false; + } + + CharType m_current_value; + // number of bits left in current input character buffer + unsigned int m_displacement; + base_value_type m_buffer; + // flag to current output character is ready - just used to save time + bool m_full; + // flag to indicate that m_buffer has data + bool m_bufferfull; + +public: + // make composible buy using templated constructor + template<class T> + transform_width(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start)))), + m_displacement(0), + m_full(false), + m_bufferfull(false) + {} + // intel 7.1 doesn't like default copy constructor + transform_width(const transform_width & rhs) : + super_t(rhs.base_reference()), + m_current_value(rhs.m_current_value), + m_displacement(rhs.m_displacement), + m_buffer(rhs.m_buffer), + m_full(rhs.m_full), + m_bufferfull(rhs.m_bufferfull) + {} +}; + +template<class Base, int BitsOut, int BitsIn, class CharType> +CharType transform_width<Base, BitsOut, BitsIn, CharType>::fill(){ + CharType retval = 0; + unsigned int missing_bits = BitsOut; + for(;;){ + unsigned int bcount; + if(! m_bufferfull){ + m_buffer = * this->base_reference(); + m_bufferfull = true; + bcount = BitsIn; + } + else + bcount = BitsIn - m_displacement; + unsigned int i = (std::min)(bcount, missing_bits); + // shift interesting bits to least significant position + unsigned int j = m_buffer >> (bcount - i); + // strip off uninteresting bits + // (note presumption of two's complement arithmetic) + j &= ~(-(1 << i)); + // append then interesting bits to the output value + retval <<= i; + retval |= j; + missing_bits -= i; + if(0 == missing_bits) + break; + // note: suspect that this is not invoked for borland 5.51 + ++(this->base_reference()); + m_bufferfull = false; + } + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP diff --git a/Utilities/BGL/boost/archive/iterators/unescape.hpp b/Utilities/BGL/boost/archive/iterators/unescape.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f437c388e7f286f349ad6d916cb567aa15146ca7 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/unescape.hpp @@ -0,0 +1,91 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// unescape.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 <cassert> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#include <boost/iterator/iterator_adaptor.hpp> +//#include <boost/iterator/iterator_traits.hpp> +#include <boost/pointee.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template<class Derived, class Base> +class unescape + : public boost::iterator_adaptor< + unescape<Derived, Base>, + Base, + BOOST_DEDUCED_TYPENAME pointee<Base>::type, + single_pass_traversal_tag, + BOOST_DEDUCED_TYPENAME pointee<Base>::type + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + unescape<Derived, Base>, + Base, + BOOST_DEDUCED_TYPENAME pointee<Base>::type, + single_pass_traversal_tag, + BOOST_DEDUCED_TYPENAME pointee<Base>::type + > super_t; + + typedef unescape<Derived, Base> this_t; +public: + typedef BOOST_DEDUCED_TYPENAME this_t::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME this_t::reference reference; +private: + value_type dereference_impl() { + if(! m_full){ + m_current_value = static_cast<Derived *>(this)->drain(); + m_full = true; + } + return m_current_value; + } + + reference dereference() const { + return const_cast<this_t *>(this)->dereference_impl(); + } + + value_type m_current_value; + bool m_full; + + void increment(){ + ++(this->base_reference()); + dereference_impl(); + m_full = false; + }; + +public: + + unescape(Base base) : + super_t(base), + m_full(false) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP diff --git a/Utilities/BGL/boost/archive/iterators/wchar_from_mb.hpp b/Utilities/BGL/boost/archive/iterators/wchar_from_mb.hpp new file mode 100644 index 0000000000000000000000000000000000000000..18f06225f9f0a2cc44950c7fdfa9d23d0270ebab --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/wchar_from_mb.hpp @@ -0,0 +1,129 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP +#define BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// wchar_from_mb.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 <cassert> +#include <cctype> +#include <cstddef> // size_t +#include <cstdlib> // mblen + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mblen; + using ::mbtowc; +} // namespace std +#endif + +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/pfto.hpp> + +#include <boost/iterator/iterator_adaptor.hpp> +#include <boost/archive/iterators/dataflow_exception.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template<class Base> +class wchar_from_mb + : public boost::iterator_adaptor< + wchar_from_mb<Base>, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > +{ + friend class boost::iterator_core_access; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_adaptor< + wchar_from_mb<Base>, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > super_t; + + typedef wchar_from_mb<Base> this_t; + + wchar_t drain(); + + wchar_t dereference_impl() { + if(! m_full){ + m_current_value = drain(); + m_full = true; + } + return m_current_value; + } + + wchar_t dereference() const { + return const_cast<this_t *>(this)->dereference_impl(); + } + + void increment(){ + dereference_impl(); + m_full = false; + ++(this->base_reference()); + }; + + wchar_t m_current_value; + bool m_full; + +public: + // make composible buy using templated constructor + template<class T> + wchar_from_mb(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start)))), + m_full(false) + {} + // intel 7.1 doesn't like default copy constructor + wchar_from_mb(const wchar_from_mb & rhs) : + super_t(rhs.base_reference()), + m_full(rhs.m_full) + {} +}; + +template<class Base> +wchar_t wchar_from_mb<Base>::drain(){ + char buffer[9]; + char * bptr = buffer; + char val; + for(std::size_t i = 0; i++ < (unsigned)MB_CUR_MAX;){ + val = * this->base_reference(); + *bptr++ = val; + int result = std::mblen(buffer, i); + if(-1 != result) + break; + ++(this->base_reference()); + } + wchar_t retval; + int result = std::mbtowc(& retval, buffer, MB_CUR_MAX); + if(0 >= result) + boost::serialization::throw_exception(iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + )); + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP diff --git a/Utilities/BGL/boost/archive/iterators/xml_escape.hpp b/Utilities/BGL/boost/archive/iterators/xml_escape.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8eb87f42465de9e5991959100bcd400d0ef31dc9 --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/xml_escape.hpp @@ -0,0 +1,125 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_escape.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 <cassert> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME +#include <boost/serialization/pfto.hpp> + +#include <boost/archive/iterators/escape.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into xml text + +template<class Base> +class xml_escape + : public escape<xml_escape<Base>, Base> +{ + friend class boost::iterator_core_access; + + typedef escape<xml_escape<Base>, Base> super_t; + +public: + char fill(const char * & bstart, const char * & bend); + wchar_t fill(const wchar_t * & bstart, const wchar_t * & bend); + + template<class T> + xml_escape(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start)))) + {} + // intel 7.1 doesn't like default copy constructor + xml_escape(const xml_escape & rhs) : + super_t(rhs.base_reference()) + {} +}; + +template<class Base> +char xml_escape<Base>::fill( + const char * & bstart, + const char * & bend +){ + char current_value = * this->base_reference(); + switch(current_value){ + case '<': + bstart = "<"; + bend = bstart + 4; + break; + case '>': + bstart = ">"; + bend = bstart + 4; + break; + case '&': + bstart = "&"; + bend = bstart + 5; + break; + case '"': + bstart = """; + bend = bstart + 6; + break; + case '\'': + bstart = "'"; + bend = bstart + 6; + break; + default: + return current_value; + } + return *bstart; +} + +template<class Base> +wchar_t xml_escape<Base>::fill( + const wchar_t * & bstart, + const wchar_t * & bend +){ + wchar_t current_value = * this->base_reference(); + switch(current_value){ + case '<': + bstart = L"<"; + bend = bstart + 4; + break; + case '>': + bstart = L">"; + bend = bstart + 4; + break; + case '&': + bstart = L"&"; + bend = bstart + 5; + break; + case '"': + bstart = L"""; + bend = bstart + 6; + break; + case '\'': + bstart = L"'"; + bend = bstart + 6; + break; + default: + return current_value; + } + return *bstart; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP diff --git a/Utilities/BGL/boost/archive/iterators/xml_unescape.hpp b/Utilities/BGL/boost/archive/iterators/xml_unescape.hpp new file mode 100644 index 0000000000000000000000000000000000000000..25b7edf4603f3964b265fb94467809c1222d443f --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/xml_unescape.hpp @@ -0,0 +1,128 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_unescape.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 <cassert> + +#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME + +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/pfto.hpp> + +#include <boost/archive/iterators/unescape.hpp> +#include <boost/archive/iterators/dataflow_exception.hpp> + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// replace &??? xml escape sequences with the corresponding characters +template<class Base> +class xml_unescape + : public unescape<xml_unescape<Base>, Base> +{ + friend class boost::iterator_core_access; + typedef xml_unescape<Base> this_t; + typedef unescape<this_t, Base> super_t; + typedef BOOST_DEDUCED_TYPENAME boost::iterator_reference<this_t> reference_type; + + reference_type dereference() const { + return unescape<xml_unescape<Base>, Base>::dereference(); + } +public: + // workaround msvc 7.1 ICU crash + #if defined(BOOST_MSVC) + typedef int value_type; + #else + typedef BOOST_DEDUCED_TYPENAME this_t::value_type value_type; + #endif + + void drain_residue(const char *literal); + value_type drain(); + + template<class T> + xml_unescape(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast<T>(start)))) + {} + // intel 7.1 doesn't like default copy constructor + xml_unescape(const xml_unescape & rhs) : + super_t(rhs.base_reference()) + {} +}; + +template<class Base> +void xml_unescape<Base>::drain_residue(const char * literal){ + do{ + if(* literal != * ++(this->base_reference())) + boost::serialization::throw_exception( + dataflow_exception( + dataflow_exception::invalid_xml_escape_sequence + ) + ); + } + while('\0' != * ++literal); +} + +// note key constraint on this function is that can't "look ahead" any +// more than necessary into base iterator. Doing so would alter the base +// iterator refenence which would make subsequent iterator comparisons +// incorrect and thereby break the composiblity of iterators. +template<class Base> +BOOST_DEDUCED_TYPENAME xml_unescape<Base>::value_type +//int +xml_unescape<Base>::drain(){ + value_type retval = * this->base_reference(); + if('&' != retval){ + return retval; + } + retval = * ++(this->base_reference()); + switch(retval){ + case 'l': // < + drain_residue("t;"); + retval = '<'; + break; + case 'g': // > + drain_residue("t;"); + retval = '>'; + break; + case 'a': + retval = * ++(this->base_reference()); + switch(retval){ + case 'p': // ' + drain_residue("os;"); + retval = '\''; + break; + case 'm': // & + drain_residue("p;"); + retval = '&'; + break; + } + break; + case 'q': + drain_residue("uot;"); + retval = '"'; + break; + } + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP diff --git a/Utilities/BGL/boost/archive/iterators/xml_unescape_exception.hpp b/Utilities/BGL/boost/archive/iterators/xml_unescape_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a141737347c0396cce7bf079cab291f190a7bf2e --- /dev/null +++ b/Utilities/BGL/boost/archive/iterators/xml_unescape_exception.hpp @@ -0,0 +1,49 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_EXCEPTION_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_unescape_exception.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> +#ifndef BOOST_NO_EXCEPTIONS +#include <exception> + +#include <cassert> + +namespace boost { +namespace archive { +namespace iterators { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by xml_unescapes +// +class xml_unescape_exception : public std::exception +{ +public: + xml_unescape_exception() + {} + + virtual const char *what( ) const throw( ) + { + return "xml contained un-recognized escape code"; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif //BOOST_NO_EXCEPTIONS +#endif //BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_EXCEPTION_HPP diff --git a/Utilities/BGL/boost/archive/polymorphic_binary_iarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_binary_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ce7e3b0609e0f2d44d79fecfd90c3ea0a0f7a6ad --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_binary_iarchive.hpp @@ -0,0 +1,54 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_binary_iarchive.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/archive/binary_iarchive.hpp> +#include <boost/archive/detail/polymorphic_iarchive_route.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class polymorphic_binary_iarchive : + public detail::polymorphic_iarchive_route<naked_binary_iarchive> +{ +public: + polymorphic_binary_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route<naked_binary_iarchive>(is, flags) + {} + ~polymorphic_binary_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_binary_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_binary_oarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_binary_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a66ebddca665ba108a5e630a5b5dc844ae56cc97 --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_binary_oarchive.hpp @@ -0,0 +1,43 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_binary_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/archive/binary_oarchive.hpp> +#include <boost/archive/detail/polymorphic_oarchive_route.hpp> + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + binary_oarchive_impl< + naked_binary_oarchive, + std::ostream::char_type, + std::ostream::traits_type + > + > polymorphic_binary_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_binary_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_iarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4c69094291d76f618a8087c3b2661ee5a45453d0 --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_iarchive.hpp @@ -0,0 +1,197 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_iarchive.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 <cstddef> // std::size_t +#include <climits> // ULONG_MAX +#include <string> + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/cstdint.hpp> + +#include <boost/serialization/pfto.hpp> +#include <boost/archive/detail/iserializer.hpp> +#include <boost/archive/detail/interface_iarchive.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/archive/detail/register_archive.hpp> + +#include <boost/archive/detail/decl.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +// determine if its necessary to handle (u)int64_t specifically +// i.e. that its not a synonym for (unsigned) long +// if there is no 64 bit int or if its the same as a long +// we shouldn't define separate functions for int64 data types. +#if defined(BOOST_NO_INT64_T) + #define BOOST_NO_INTRINSIC_INT64_T +#else + #if defined(ULLONG_MAX) + #if(ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #elif defined(ULONG_MAX) + #if(ULONG_MAX != 0xffffffff && ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #else + #define BOOST_NO_INTRINSIC_INT64_T + #endif +#endif + +namespace boost { +template<class T> +class shared_ptr; +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail { + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive; +} + +class polymorphic_iarchive; + +class polymorphic_iarchive_impl : + public detail::interface_iarchive<polymorphic_iarchive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive<polymorphic_iarchive>; + friend class load_access; +#endif + // primitive types the only ones permitted by polymorphic archives + virtual void load(bool & t) = 0; + + virtual void load(char & t) = 0; + virtual void load(signed char & t) = 0; + virtual void load(unsigned char & t) = 0; + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void load(wchar_t & t) = 0; + #endif + #endif + virtual void load(short & t) = 0; + virtual void load(unsigned short & t) = 0; + virtual void load(int & t) = 0; + virtual void load(unsigned int & t) = 0; + virtual void load(long & t) = 0; + virtual void load(unsigned long & t) = 0; + + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void load(boost::int64_t & t) = 0; + virtual void load(boost::uint64_t & t) = 0; + #endif + virtual void load(float & t) = 0; + virtual void load(double & t) = 0; + + // string types are treated as primitives + virtual void load(std::string & t) = 0; + #ifndef BOOST_NO_STD_WSTRING + virtual void load(std::wstring & t) = 0; + #endif + + // used for xml and other tagged formats + virtual void load_start(const char * name) = 0; + virtual void load_end(const char * name) = 0; + virtual void register_basic_serializer(const detail::basic_iserializer & bis) = 0; + + // msvc and borland won't automatically pass these to the base class so + // make it explicit here + template<class T> + void load_override(T & t, BOOST_PFTO int) + { + archive::load(* this->This(), t); + } + // special treatment for name-value pairs. + template<class T> + void load_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + boost::serialization::nvp<T> & t, + int + ){ + load_start(t.name()); + archive::load(* this->This(), t.value()); + load_end(t.name()); + } +protected: + virtual ~polymorphic_iarchive_impl(){}; +public: + // utility function implemented by all legal archives + virtual void set_library_version(version_type archive_library_version) = 0; + virtual unsigned int get_library_version() const = 0; + virtual unsigned int get_flags() const = 0; + virtual void delete_created_pointers() = 0; + virtual void reset_object_address( + const void * new_address, + const void * old_address + ) = 0; + + virtual void load_binary(void * t, std::size_t size) = 0; + + // these are used by the serialization library implementation. + virtual void load_object( + void *t, + const detail::basic_iserializer & bis + ) = 0; + virtual const detail::basic_pointer_iserializer * load_pointer( + void * & t, + const detail::basic_pointer_iserializer * bpis_ptr, + const detail::basic_pointer_iserializer * (*finder)( + const boost::serialization::extended_type_info & type + ) + ) = 0; +}; + +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include <boost/archive/shared_ptr_helper.hpp> + +namespace boost { +namespace archive { + +class polymorphic_iarchive : + public polymorphic_iarchive_impl, + public detail::shared_ptr_helper +{ +public: + virtual ~polymorphic_iarchive(){}; +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/polymorphic_oarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..19aedf5f44623ad0cf32f2add45bf1b0f7beb4a0 --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_oarchive.hpp @@ -0,0 +1,174 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_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 <cstddef> // size_t +#include <climits> // ULONG_MAX +#include <string> + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/cstdint.hpp> +#include <boost/serialization/pfto.hpp> +#include <boost/archive/detail/oserializer.hpp> +#include <boost/archive/detail/interface_oarchive.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/archive/detail/register_archive.hpp> + +#include <boost/archive/detail/decl.hpp> +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +// determine if its necessary to handle (u)int64_t specifically +// i.e. that its not a synonym for (unsigned) long +// if there is no 64 bit int or if its the same as a long +// we shouldn't define separate functions for int64 data types. +#if defined(BOOST_NO_INT64_T) + #define BOOST_NO_INTRINSIC_INT64_T +#else + #if defined(ULLONG_MAX) + #if(ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #elif defined(ULONG_MAX) + #if(ULONG_MAX != 0xffffffff && ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #else + #define BOOST_NO_INTRINSIC_INT64_T + #endif +#endif + +namespace boost { +template<class T> +class shared_ptr; +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail { + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive; + class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; +} + +class polymorphic_oarchive; + +class polymorphic_oarchive_impl : + public detail::interface_oarchive<polymorphic_oarchive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive<polymorphic_oarchive>; + friend class save_access; +#endif + // primitive types the only ones permitted by polymorphic archives + virtual void save(const bool t) = 0; + + virtual void save(const char t) = 0; + virtual void save(const signed char t) = 0; + virtual void save(const unsigned char t) = 0; + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void save(const wchar_t t) = 0; + #endif + #endif + virtual void save(const short t) = 0; + virtual void save(const unsigned short t) = 0; + virtual void save(const int t) = 0; + virtual void save(const unsigned int t) = 0; + virtual void save(const long t) = 0; + virtual void save(const unsigned long t) = 0; + #if !defined(BOOST_NO_INTRINSIC_INT64_T) + virtual void save(const boost::int64_t t) = 0; + virtual void save(const boost::uint64_t t) = 0; + #endif + virtual void save(const float t) = 0; + virtual void save(const double t) = 0; + + // string types are treated as primitives + virtual void save(const std::string & t) = 0; + #ifndef BOOST_NO_STD_WSTRING + virtual void save(const std::wstring & t) = 0; + #endif + + virtual void save_null_pointer() = 0; + // used for xml and other tagged formats + virtual void save_start(const char * name) = 0; + virtual void save_end(const char * name) = 0; + virtual void register_basic_serializer(const detail::basic_oserializer & bos) = 0; + + virtual void end_preamble() = 0; + + // msvc and borland won't automatically pass these to the base class so + // make it explicit here + template<class T> + void save_override(T & t, BOOST_PFTO int) + { + archive::save(* this->This(), t); + } + // special treatment for name-value pairs. + template<class T> + void save_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + ::boost::serialization::nvp<T> & t, int + ){ + save_start(t.name()); + archive::save(* this->This(), t.const_value()); + save_end(t.name()); + } +protected: + virtual ~polymorphic_oarchive_impl(){}; +public: + // utility functions implemented by all legal archives + virtual unsigned int get_flags() const = 0; + virtual unsigned int get_library_version() const = 0; + virtual void save_binary(const void * t, std::size_t size) = 0; + + virtual void save_object( + const void *x, + const detail::basic_oserializer & bos + ) = 0; + virtual void save_pointer( + const void * t, + const detail::basic_pointer_oserializer * bpos_ptr + ) = 0; +}; + +// note: preserve naming symmetry +class polymorphic_oarchive : + public polymorphic_oarchive_impl +{ +public: + virtual ~polymorphic_oarchive(){}; +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive) + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/polymorphic_text_iarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_text_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..931a9287c7496a6c55f8a3fa51ca2bc972b7caed --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_text_iarchive.hpp @@ -0,0 +1,54 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_iarchive.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/archive/text_iarchive.hpp> +#include <boost/archive/detail/polymorphic_iarchive_route.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class polymorphic_text_iarchive : + public detail::polymorphic_iarchive_route<naked_text_iarchive> +{ +public: + polymorphic_text_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route<naked_text_iarchive>(is, flags) + {} + ~polymorphic_text_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_text_oarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_text_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..82b48924f9d0dced304f2a8e099d6e7750b7543d --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_text_oarchive.hpp @@ -0,0 +1,39 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_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/archive/text_oarchive.hpp> +#include <boost/archive/detail/polymorphic_oarchive_route.hpp> + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + text_oarchive_impl<naked_text_oarchive> +> polymorphic_text_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_text_wiarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_text_wiarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4df3d473517f660461a34ecf5391381e748c0a9f --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_text_wiarchive.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_wiarchive.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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <boost/archive/text_wiarchive.hpp> +#include <boost/archive/detail/polymorphic_iarchive_route.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class polymorphic_text_wiarchive : + public detail::polymorphic_iarchive_route<naked_text_wiarchive> +{ +public: + polymorphic_text_wiarchive(std::wistream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route<naked_text_wiarchive>(is, flags) + {} + ~polymorphic_text_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_wiarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_text_woarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_text_woarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bc4494741662799129339d0a4b06752d6f215f46 --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_text_woarchive.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <boost/archive/text_woarchive.hpp> +#include <boost/archive/detail/polymorphic_oarchive_route.hpp> + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + text_woarchive_impl<naked_text_woarchive> +> polymorphic_text_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_woarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_xml_iarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_xml_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..feb0b99bc2ab32153425142ff25de7c2cd76955d --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_xml_iarchive.hpp @@ -0,0 +1,54 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_xml_iarchive.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/archive/xml_iarchive.hpp> +#include <boost/archive/detail/polymorphic_iarchive_route.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class polymorphic_xml_iarchive : + public detail::polymorphic_iarchive_route<naked_xml_iarchive> +{ +public: + polymorphic_xml_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route<naked_xml_iarchive>(is, flags) + {} + ~polymorphic_xml_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_xml_oarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_xml_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..85766942880f2025ab7bc15f94959198de90612f --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_xml_oarchive.hpp @@ -0,0 +1,39 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_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/archive/xml_oarchive.hpp> +#include <boost/archive/detail/polymorphic_oarchive_route.hpp> + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + xml_oarchive_impl<naked_xml_oarchive> +> polymorphic_xml_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_xml_wiarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_xml_wiarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b3f7db258271014b9ce85594f9f66bfef21ee729 --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_xml_wiarchive.hpp @@ -0,0 +1,50 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_xml_wiarchive.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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <boost/archive/xml_wiarchive.hpp> +#include <boost/archive/detail/polymorphic_iarchive_route.hpp> + +namespace boost { +namespace archive { + +class polymorphic_xml_wiarchive : + public detail::polymorphic_iarchive_route<naked_xml_wiarchive> +{ +public: + polymorphic_xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route<naked_xml_wiarchive>(is, flags) + {} + ~polymorphic_xml_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_wiarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/polymorphic_xml_woarchive.hpp b/Utilities/BGL/boost/archive/polymorphic_xml_woarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8884b43c752ac3986975a494985832c3100c516d --- /dev/null +++ b/Utilities/BGL/boost/archive/polymorphic_xml_woarchive.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <boost/archive/xml_woarchive.hpp> +#include <boost/archive/detail/polymorphic_oarchive_route.hpp> + +namespace boost { +namespace archive { + +typedef detail::polymorphic_oarchive_route< + xml_woarchive_impl<naked_xml_woarchive> +> polymorphic_xml_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_woarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP + diff --git a/Utilities/BGL/boost/archive/shared_ptr_helper.hpp b/Utilities/BGL/boost/archive/shared_ptr_helper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a8aa0a785480a41747cfd49b1fd734146ae6f302 --- /dev/null +++ b/Utilities/BGL/boost/archive/shared_ptr_helper.hpp @@ -0,0 +1,209 @@ +#ifndef BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP +#define BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// shared_ptr_helper.hpp: serialization for boost shared pointer + +// (C) Copyright 2004-2009 Robert Ramey, Martin Ecker and Takatoshi Kondo +// 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 <set> +#include <list> +#include <utility> +#include <cstddef> // NULL + +#include <boost/config.hpp> +#include <boost/shared_ptr.hpp> + +#include <boost/type_traits/is_polymorphic.hpp> +#include <boost/serialization/type_info_implementation.hpp> +#include <boost/serialization/shared_ptr_132.hpp> +#include <boost/serialization/throw_exception.hpp> + +#include <boost/archive/archive_exception.hpp> +#include <boost/archive/detail/decl.hpp> + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost_132 { + template<class T> class shared_ptr; +} +namespace boost { + template<class T> class shared_ptr; + namespace serialization { + class extended_type_info; + template<class Archive, class T> + inline void load( + Archive & ar, + boost::shared_ptr<T> &t, + const unsigned int file_version + ); + } +namespace archive{ +namespace detail { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// a common class for holding various types of shared pointers + +class shared_ptr_helper { + struct collection_type_compare { + bool operator()( + const shared_ptr<const void> &lhs, + const shared_ptr<const void> &rhs + )const{ + return lhs.get() < rhs.get(); + } + }; + typedef std::set< + boost::shared_ptr<const void>, + collection_type_compare + > collection_type; + typedef collection_type::const_iterator iterator_type; + // list of shared_pointers create accessable by raw pointer. This + // is used to "match up" shared pointers loaded at different + // points in the archive. Note, we delay construction until + // it is actually used since this is by default included as + // a "mix-in" even if shared_ptr isn't used. + collection_type * m_pointers; + + struct null_deleter { + void operator()(void const *) const {} + }; + + struct void_deleter { + const boost::serialization::extended_type_info * m_eti; + void_deleter(const boost::serialization::extended_type_info *eti) : + m_eti(eti) + {} + void operator()(void *vp) const { + m_eti->destroy(vp); + } + }; + +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + template<class Archive, class T> + friend inline void boost::serialization::load( + Archive & ar, + boost::shared_ptr<T> &t, + const unsigned int file_version + ); +#endif + +// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP + // list of loaded pointers. This is used to be sure that the pointers + // stay around long enough to be "matched" with other pointers loaded + // by the same archive. These are created with a "null_deleter" so that + // when this list is destroyed - the underlaying raw pointers are not + // destroyed. This has to be done because the pointers are also held by + // new system which is disjoint from this set. This is implemented + // by a change in load_construct_data below. It makes this file suitable + // only for loading pointers into a 1.33 or later boost system. + std::list<boost_132::shared_ptr<void> > * m_pointers_132; +// #endif + + // returns pointer to object and an indicator whether this is a + // new entry (true) or a previous one (false) + BOOST_ARCHIVE_DECL(shared_ptr<void>) + get_od( + const void * od, + const boost::serialization::extended_type_info * true_type, + const boost::serialization::extended_type_info * this_type + ); + + template<class T> + struct non_polymorphic { + static const boost::serialization::extended_type_info * + get_object_identifier(T & t){ + return & boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance(); + } + }; + template<class T> + struct polymorphic { + static const boost::serialization::extended_type_info * + get_object_identifier(T & t){ + return boost::serialization::singleton< + BOOST_DEDUCED_TYPENAME + boost::serialization::type_info_implementation<T>::type + >::get_const_instance().get_derived_extended_type_info(t); + } + }; +public: + template<class T> + void reset(shared_ptr<T> & s, T * t){ + if(NULL == t){ + s.reset(); + return; + } + const boost::serialization::extended_type_info * this_type + = & boost::serialization::type_info_implementation<T>::type + ::get_const_instance(); + + // get pointer to the most derived object. This is effectively + // the object identifer + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_polymorphic<T>, + mpl::identity<polymorphic<T> >, + mpl::identity<non_polymorphic<T> > + >::type type; + + const boost::serialization::extended_type_info * true_type + = type::get_object_identifier(*t); + + // note:if this exception is thrown, be sure that derived pointer + // is either registered or exported. + if(NULL == true_type) + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + this_type->get_debug_info() + ) + ); + shared_ptr<void> r = + get_od( + static_cast<const void *>(t), + true_type, + this_type + ); + + s = shared_ptr<T>( + r, + static_cast<T *>(r.get()) + ); + + //s = static_pointer_cast<T,void>( + // const_pointer_cast<void, const void>(*r) + //); + } + +// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP + BOOST_ARCHIVE_DECL(void) + append(const boost_132::shared_ptr<void> & t); +// #endif +public: + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + shared_ptr_helper(); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~shared_ptr_helper(); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP diff --git a/Utilities/BGL/boost/archive/text_iarchive.hpp b/Utilities/BGL/boost/archive/text_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1a6b75771848b3eab78466879675000f8cea47a5 --- /dev/null +++ b/Utilities/BGL/boost/archive/text_iarchive.hpp @@ -0,0 +1,144 @@ +#ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_iarchive.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 <istream> + +#include <boost/config.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/basic_text_iprimitive.hpp> +#include <boost/archive/basic_text_iarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +template<class Archive> +class text_iarchive_impl : + public basic_text_iprimitive<std::istream>, + public basic_text_iarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive<Archive>; + friend class basic_text_iarchive<Archive>; + friend class load_access; +protected: +#endif + template<class T> + void load(T & t){ + basic_text_iprimitive<std::istream>::load(t); + } + BOOST_ARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + // make this protected so it can be called from a derived archive + template<class T> + void load_override(T & t, BOOST_PFTO int){ + basic_text_iarchive<Archive>::load_override(t, 0); + } + BOOST_ARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_ARCHIVE_DECL(void) + init(); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + text_iarchive_impl(std::istream & is, unsigned int flags); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~text_iarchive_impl(){}; +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as text_iarchive below - without the shared_ptr_helper +class naked_text_iarchive : + public text_iarchive_impl<naked_text_iarchive> +{ +public: + naked_text_iarchive(std::istream & is_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_iarchive_impl<naked_text_iarchive>(is_, flags) + {} + ~naked_text_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include <boost/archive/shared_ptr_helper.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class text_iarchive : + public text_iarchive_impl<text_iarchive>, + public detail::shared_ptr_helper +{ +public: + text_iarchive(std::istream & is_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_iarchive_impl<text_iarchive>(is_, flags) + {} + ~text_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/text_oarchive.hpp b/Utilities/BGL/boost/archive/text_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a01f29bbf19ba6a8635cd8b1b77b30f6f117f762 --- /dev/null +++ b/Utilities/BGL/boost/archive/text_oarchive.hpp @@ -0,0 +1,111 @@ +#ifndef BOOST_ARCHIVE_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_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 <ostream> +#include <cstddef> // std::size_t + +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/basic_text_oprimitive.hpp> +#include <boost/archive/basic_text_oarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +template<class Archive> +class text_oarchive_impl : + /* protected ? */ public basic_text_oprimitive<std::ostream>, + public basic_text_oarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive<Archive>; + friend class basic_text_oarchive<Archive>; + friend class save_access; +protected: +#endif + template<class T> + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive<std::ostream>::save(t); + } + BOOST_ARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + text_oarchive_impl(std::ostream & os, unsigned int flags); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~text_oarchive_impl(){}; +public: + BOOST_ARCHIVE_DECL(void) + save_binary(const void *address, std::size_t count); +}; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from text_oarchive_impl instead. This will +// preserve correct static polymorphism. +class text_oarchive : + public text_oarchive_impl<text_oarchive> +{ +public: + text_oarchive(std::ostream & os_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_oarchive_impl<text_oarchive>(os_, flags) + {} + ~text_oarchive(){} +}; + +typedef text_oarchive naked_text_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_TEXT_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/text_wiarchive.hpp b/Utilities/BGL/boost/archive/text_wiarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d5d7171471329d68fa9021523e2325f523dc0b7a --- /dev/null +++ b/Utilities/BGL/boost/archive/text_wiarchive.hpp @@ -0,0 +1,141 @@ +#ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_wiarchive.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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <istream> + +#include <boost/archive/detail/auto_link_warchive.hpp> +#include <boost/archive/basic_text_iprimitive.hpp> +#include <boost/archive/basic_text_iarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +template<class Archive> +class text_wiarchive_impl : + public basic_text_iprimitive<std::wistream>, + public basic_text_iarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive<Archive>; + friend class basic_text_iarchive<Archive>; + friend class load_access; +protected: +#endif + template<class T> + void load(T & t){ + basic_text_iprimitive<std::wistream>::load(t); + } + BOOST_WARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + // note: the following should not needed - but one compiler (vc 7.1) + // fails to compile one test (test_shared_ptr) without it !!! + template<class T> + void load_override(T & t, BOOST_PFTO int){ + basic_text_iarchive<Archive>::load_override(t, 0); + } + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + text_wiarchive_impl(std::wistream & is, unsigned int flags); + ~text_wiarchive_impl(){}; +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as text_wiarchive below - without the shared_ptr_helper +class naked_text_wiarchive : + public text_wiarchive_impl<naked_text_wiarchive> +{ +public: + naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) : + text_wiarchive_impl<naked_text_wiarchive>(is, flags) + {} + ~naked_text_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include <boost/archive/shared_ptr_helper.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class text_wiarchive : + public text_wiarchive_impl<text_wiarchive>, + public detail::shared_ptr_helper +{ +public: + text_wiarchive(std::wistream & is, unsigned int flags = 0) : + text_wiarchive_impl<text_wiarchive>(is, flags) + {} + ~text_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/text_woarchive.hpp b/Utilities/BGL/boost/archive/text_woarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff9b4c8854e8be917b8035fe60aec1dfba1b8ea5 --- /dev/null +++ b/Utilities/BGL/boost/archive/text_woarchive.hpp @@ -0,0 +1,138 @@ +#ifndef BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_woarchive.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> + +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <ostream> +#include <cstddef> // size_t + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/archive/detail/auto_link_warchive.hpp> +#include <boost/archive/basic_text_oprimitive.hpp> +#include <boost/archive/basic_text_oarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +template<class Archive> +class text_woarchive_impl : + public basic_text_oprimitive<std::wostream>, + public basic_text_oarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive<Archive>; + friend class basic_text_oarchive<Archive>; + friend class save_access; +protected: +#endif + template<class T> + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive<std::wostream>::save(t); + } + BOOST_WARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + text_woarchive_impl(std::wostream & os, unsigned int flags) : + basic_text_oprimitive<std::wostream>( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive<Archive>(flags) + { + if(0 == (flags & no_header)) + basic_text_oarchive<Archive>::init(); + } +public: + void save_binary(const void *address, std::size_t count){ + put(static_cast<wchar_t>('\n')); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive<std::wostream>::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + put(static_cast<wchar_t>('\n')); + this->delimiter = this->none; + } + +}; + +// we use the following because we can't use +// typedef text_oarchive_impl<text_oarchive_impl<...> > text_oarchive; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from text_oarchive_impl instead. This will +// preserve correct static polymorphism. +class text_woarchive : + public text_woarchive_impl<text_woarchive> +{ +public: + text_woarchive(std::wostream & os, unsigned int flags = 0) : + text_woarchive_impl<text_woarchive>(os, flags) + {} + ~text_woarchive(){} +}; + +typedef text_woarchive naked_text_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/tmpdir.hpp b/Utilities/BGL/boost/archive/tmpdir.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f962e1160b38c54aa8a88082b5e6c3d7246e7e6a --- /dev/null +++ b/Utilities/BGL/boost/archive/tmpdir.hpp @@ -0,0 +1,50 @@ +#ifndef BOOST_ARCHIVE_TMPDIR_HPP +#define BOOST_ARCHIVE_TMPDIR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// tmpdir.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 <cstdlib> // getenv +#include <cstddef> // NULL +//#include <cassert> + +#include <boost/config.hpp> +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { + using ::getenv; +} +#endif + +namespace boost { +namespace archive { + +inline const char * tmpdir(){ + const char *dirname; + dirname = std::getenv("TMP"); + if(NULL == dirname) + dirname = std::getenv("TMPDIR"); + if(NULL == dirname) + dirname = std::getenv("TEMP"); + if(NULL == dirname){ + //assert(false); // no temp directory found + dirname = "."; + } + return dirname; +} + +} // archive +} // boost + +#endif // BOOST_ARCHIVE_TMPDIR_HPP diff --git a/Utilities/BGL/boost/archive/wcslen.hpp b/Utilities/BGL/boost/archive/wcslen.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5c14acfff35e21c1d7799f7ce93c0e33af29b4e8 --- /dev/null +++ b/Utilities/BGL/boost/archive/wcslen.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_ARCHIVE_WCSLEN_HPP +#define BOOST_ARCHIVE_WCSLEN_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// wcslen.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 <cstddef> // size_t +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR + +// a couple of libraries which include wchar_t don't include +// wcslen + +#if defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB < 306 \ +|| defined(__LIBCOMO__) + +namespace std { +inline std::size_t wcslen(const wchar_t * ws) +{ + const wchar_t * eows = ws; + while(* eows != 0) + ++eows; + return eows - ws; +} +} // namespace std + +#else + +#include <cwchar> +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif + +#endif // wcslen + +#endif //BOOST_NO_CWCHAR + +#endif //BOOST_ARCHIVE_WCSLEN_HPP diff --git a/Utilities/BGL/boost/archive/xml_archive_exception.hpp b/Utilities/BGL/boost/archive/xml_archive_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..741c46868696ef4f45ada47dfe11b7e9670cd885 --- /dev/null +++ b/Utilities/BGL/boost/archive/xml_archive_exception.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_archive_exception.hpp: + +// (C) Copyright 2007 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 <exception> +#include <cassert> + +#include <boost/archive/archive_exception.hpp> +#include <boost/preprocessor/empty.hpp> +#include <boost/archive/detail/decl.hpp> + +#include <boost/archive/detail/abi_prefix.hpp> // must be the last header + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by xml archives +// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) xml_archive_exception : + public virtual archive_exception +{ +public: + typedef enum { + xml_archive_parsing_error, // see save_register + xml_archive_tag_mismatch, + xml_archive_tag_name_error + } exception_code; + xml_archive_exception( + exception_code c, + const char * e1 = NULL, + const char * e2 = NULL + ); +}; + +}// namespace archive +}// namespace boost + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif //BOOST_XML_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/Utilities/BGL/boost/archive/xml_iarchive.hpp b/Utilities/BGL/boost/archive/xml_iarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c697e849ce61d4a388baaf471295aadd70b99682 --- /dev/null +++ b/Utilities/BGL/boost/archive/xml_iarchive.hpp @@ -0,0 +1,151 @@ +#ifndef BOOST_ARCHIVE_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_iarchive.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 <istream> + +//#include <boost/scoped_ptr.hpp> +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/basic_text_iprimitive.hpp> +#include <boost/archive/basic_xml_iarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +template<class CharType> +class basic_xml_grammar; +typedef basic_xml_grammar<char> xml_grammar; + +template<class Archive> +class xml_iarchive_impl : + public basic_text_iprimitive<std::istream>, + public basic_xml_iarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive<Archive>; + friend class basic_xml_iarchive<Archive>; + friend class load_access; +protected: +#endif + // instances of micro xml parser to parse start preambles + // scoped_ptr doesn't play nice with borland - so use a naked pointer + // scoped_ptr<xml_grammar> gimpl; + xml_grammar *gimpl; + + std::istream & get_is(){ + return is; + } + template<class T> + void load(T & t){ + basic_text_iprimitive<std::istream>::load(t); + } + BOOST_ARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + template<class T> + void load_override(T & t, BOOST_PFTO int){ + basic_xml_iarchive<Archive>::load_override(t, 0); + } + BOOST_ARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_ARCHIVE_DECL(void) + init(); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_iarchive_impl(std::istream & is, unsigned int flags); + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~xml_iarchive_impl(); +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from text_iarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as xml_iarchive below - without the shared_ptr_helper +class naked_xml_iarchive : + public xml_iarchive_impl<naked_xml_iarchive> +{ +public: + naked_xml_iarchive(std::istream & is, unsigned int flags = 0) : + xml_iarchive_impl<naked_xml_iarchive>(is, flags) + {} + ~naked_xml_iarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include <boost/archive/shared_ptr_helper.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class xml_iarchive : + public xml_iarchive_impl<xml_iarchive>, + public detail::shared_ptr_helper +{ +public: + xml_iarchive(std::istream & is, unsigned int flags = 0) : + xml_iarchive_impl<xml_iarchive>(is, flags) + {} + ~xml_iarchive(){}; +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_XML_IARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/xml_oarchive.hpp b/Utilities/BGL/boost/archive/xml_oarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3d9f20db4b56a10ca5a49fb7db3744f7c8032c77 --- /dev/null +++ b/Utilities/BGL/boost/archive/xml_oarchive.hpp @@ -0,0 +1,124 @@ +#ifndef BOOST_ARCHIVE_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// 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 <ostream> + +#include <cstddef> // size_t +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/archive/detail/auto_link_archive.hpp> +#include <boost/archive/basic_text_oprimitive.hpp> +#include <boost/archive/basic_xml_oarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +template<class Archive> +class xml_oarchive_impl : + public basic_text_oprimitive<std::ostream>, + public basic_xml_oarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive<Archive>; + friend class basic_xml_oarchive<Archive>; + friend class save_access; +protected: +#endif + //void end_preamble(){ + // basic_xml_oarchive<Archive>::end_preamble(); + //} + template<class T> + void save(const T & t){ + basic_text_oprimitive<std::ostream>::save(t); + } + BOOST_ARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_ARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_oarchive_impl(std::ostream & os, unsigned int flags); + ~xml_oarchive_impl(){} +public: + void save_binary(const void *address, std::size_t count){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive<std::ostream>::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; + } +}; + +// we use the following because we can't use +// typedef xml_oarchive_impl<xml_oarchive_impl<...> > xml_oarchive; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from xml_oarchive_impl instead. This will +// preserve correct static polymorphism. +class xml_oarchive : + public xml_oarchive_impl<xml_oarchive> +{ +public: + xml_oarchive(std::ostream & os, unsigned int flags = 0) : + xml_oarchive_impl<xml_oarchive>(os, flags) + {} + ~xml_oarchive(){} +}; + +typedef xml_oarchive naked_xml_oarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/xml_wiarchive.hpp b/Utilities/BGL/boost/archive/xml_wiarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0e2ee29d668c0d6bc199f8b17ad4a89a66f7789c --- /dev/null +++ b/Utilities/BGL/boost/archive/xml_wiarchive.hpp @@ -0,0 +1,157 @@ +#ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_wiarchive.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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <istream> + +//#include <boost/scoped_ptr.hpp> +#include <boost/archive/detail/auto_link_warchive.hpp> +#include <boost/archive/basic_text_iprimitive.hpp> +#include <boost/archive/basic_xml_iarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +template<class CharType> +class basic_xml_grammar; +typedef basic_xml_grammar<wchar_t> xml_wgrammar; + +template<class Archive> +class xml_wiarchive_impl : + public basic_text_iprimitive<std::wistream>, + public basic_xml_iarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive<Archive>; + friend class basic_xml_iarchive<Archive>; + friend class load_access; +protected: +#endif + // instances of micro xml parser to parse start preambles + // scoped_ptr doesn't play nice with borland - so use a naked pointer + // scoped_ptr<xml_wgrammar> gimpl; + xml_wgrammar *gimpl; + std::wistream & get_is(){ + return is; + } + template<class T> + void load(T & t){ + basic_text_iprimitive<std::wistream>::load(t); + } + BOOST_WARCHIVE_DECL(void) + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + load(wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + load(std::wstring &ws); + #endif + template<class T> + void load_override(T & t, BOOST_PFTO int){ + basic_xml_iarchive<Archive>::load_override(t, 0); + } + BOOST_WARCHIVE_DECL(void) + load_override(class_name_type & t, int); + BOOST_WARCHIVE_DECL(void) + init(); + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_wiarchive_impl(std::wistream & is, unsigned int flags) ; + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + ~xml_wiarchive_impl(); +}; + +// do not derive from the classes below. If you want to extend this functionality +// via inhertance, derived from xml_wiarchive_impl instead. This will +// preserve correct static polymorphism. + +// same as xml_wiarchive below - without the shared_ptr_helper +class naked_xml_wiarchive : + public xml_wiarchive_impl<naked_xml_wiarchive> +{ +public: + naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + xml_wiarchive_impl<naked_xml_wiarchive>(is, flags) + {} + ~naked_xml_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +// note special treatment of shared_ptr. This type needs a special +// structure associated with every archive. We created a "mix-in" +// class to provide this functionality. Since shared_ptr holds a +// special esteem in the boost library - we included it here by default. +#include <boost/archive/shared_ptr_helper.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class xml_wiarchive : + public xml_wiarchive_impl<xml_wiarchive>, + public detail::shared_ptr_helper +{ +public: + xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + xml_wiarchive_impl<xml_wiarchive>(is, flags) + {} + ~xml_wiarchive(){} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP diff --git a/Utilities/BGL/boost/archive/xml_woarchive.hpp b/Utilities/BGL/boost/archive/xml_woarchive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fdcf8c72bbe63c0027c92c821e41c6a688ead5d7 --- /dev/null +++ b/Utilities/BGL/boost/archive/xml_woarchive.hpp @@ -0,0 +1,139 @@ +#ifndef BOOST_ARCHIVE_XML_WOARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_woarchive.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> +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include <cstddef> // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <ostream> + +#include <boost/archive/detail/auto_link_warchive.hpp> +#include <boost/archive/basic_text_oprimitive.hpp> +#include <boost/archive/basic_xml_oarchive.hpp> +#include <boost/archive/detail/register_archive.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 { + +#if 0 +BOOST_WARCHIVE_DECL(std::wostream &) +operator<<(std::wostream &os, const char *t); + +BOOST_WARCHIVE_DECL(std::wostream &) +operator<<(std::wostream &os, const char t); +#endif + +template<class Archive> +class xml_woarchive_impl : + public basic_text_oprimitive<std::wostream>, + public basic_xml_oarchive<Archive> +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive<Archive>; + friend class basic_xml_oarchive<Archive>; + friend class save_access; +protected: +#endif + //void end_preamble(){ + // basic_xml_oarchive<Archive>::end_preamble(); + //} + template<class T> + void + save(const T & t){ + basic_text_oprimitive<std::wostream>::save(t); + } + BOOST_WARCHIVE_DECL(void) + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL(void) + save(const wchar_t * t); + #endif + BOOST_WARCHIVE_DECL(void) + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL(void) + save(const std::wstring &ws); + #endif + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + xml_woarchive_impl(std::wostream & os, unsigned int flags); + ~xml_woarchive_impl(){} +public: + void + save_binary(const void *address, std::size_t count){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive<std::wostream>::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; + } +}; + +// we use the following because we can't use +// typedef xml_woarchive_impl<xml_woarchive_impl<...> > xml_woarchive; + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from xml_woarchive_impl instead. This will +// preserve correct static polymorphism. +class xml_woarchive : + public xml_woarchive_impl<xml_woarchive> +{ +public: + xml_woarchive(std::wostream & os, unsigned int flags = 0) : + xml_woarchive_impl<xml_woarchive>(os, flags) + {} + ~xml_woarchive(){} +}; + +typedef xml_woarchive naked_xml_woarchive; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_woarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/Utilities/BGL/boost/assert.hpp b/Utilities/BGL/boost/assert.hpp deleted file mode 100644 index ebc67ae9d8be86be0e99f3eabb81c47a86c20477..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/assert.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// boost/assert.hpp - BOOST_ASSERT(expr) -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// -// 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) -// -// Note: There are no include guards. This is intentional. -// -// See http://www.boost.org/libs/butility/assert.html for documentation. -// - -#undef BOOST_ASSERT - -#if defined(BOOST_DISABLE_ASSERTS) - -# define BOOST_ASSERT(expr) ((void)0) - -#elif defined(BOOST_ENABLE_ASSERT_HANDLER) - -#include <boost/current_function.hpp> - -namespace boost -{ - -void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined - -} // namespace boost - -#define BOOST_ASSERT(expr) ((expr)? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) - -#else -# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same -# define BOOST_ASSERT(expr) assert(expr) -#endif diff --git a/Utilities/BGL/boost/bfunctional/detail/float_functions.hpp b/Utilities/BGL/boost/bfunctional/detail/float_functions.hpp deleted file mode 100644 index aea49f85b76b08452dcfae00e4bccb09ab65b25e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/detail/float_functions.hpp +++ /dev/null @@ -1,152 +0,0 @@ -// (C) Copyright Daniel James 2005. -// 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) - -#if !defined(BOOST_FUNCTIONAL_DETAIL_FLOAT_FUNCTIONS_HPP) -#define BOOST_FUNCTIONAL_DETAIL_FLOAT_FUNCTIONS_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// The C++ standard requires that the C float functions are overloarded -// for float, double and long double in the std namespace, but some of the older -// library implementations don't support this. On some that don't, the C99 -// float functions (frexpf, frexpl, etc.) are available. -// -// Some of this is based on guess work. If I don't know any better I assume that -// the standard C++ overloaded functions are available. If they're not then this -// means that the argument is cast to a double and back, which is inefficient -// and will give pretty bad results for long doubles - so if you know better -// let me know. - -// STLport: -#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# if defined(__GNUC__) && __GNUC__ < 3 && (defined(linux) || defined(__linux) || defined(__linux__)) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# elif defined(BOOST_MSVC) && BOOST_MSVC <= 1200 -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# endif - -// Roguewave: -// -// On borland 5.51, with roguewave 2.1.1 the standard C++ overloads aren't -// defined, but for the same version of roguewave on sunpro they are. -#elif defined(_RWSTD_VER) -# if defined(__BORLANDC__) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# define BOOST_HASH_C99_NO_FLOAT_FUNCS -# elif defined(__DECCXX) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# endif - -// libstdc++ (gcc 3.0 onwards, I think) -#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS - -// SGI: -#elif defined(__STL_CONFIG_H) -# if defined(linux) || defined(__linux) || defined(__linux__) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# endif - -// Dinkumware. -#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) -// Overloaded float functions were probably introduced in an earlier version -// than this. -# if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 402) -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -# else -# define BOOST_HASH_USE_C99_FLOAT_FUNCS -# endif - -// Digital Mars -#elif defined(__DMC__) -# define BOOST_HASH_USE_C99_FLOAT_FUNCS - -// Use overloaded float functions by default. -#else -# define BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -#endif - -namespace boost -{ - namespace hash_detail - { - - inline float call_ldexp(float v, int exp) - { - using namespace std; -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \ - defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) - return ldexp(v, exp); -#else - return ldexpf(v, exp); -#endif - } - - inline double call_ldexp(double v, int exp) - { - using namespace std; - return ldexp(v, exp); - } - - inline long double call_ldexp(long double v, int exp) - { - using namespace std; -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) - return ldexp(v, exp); -#else - return ldexpl(v, exp); -#endif - } - - inline float call_frexp(float v, int* exp) - { - using namespace std; -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) || \ - defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) - return frexp(v, exp); -#else - return frexpf(v, exp); -#endif - } - - inline double call_frexp(double v, int* exp) - { - using namespace std; - return frexp(v, exp); - } - - inline long double call_frexp(long double v, int* exp) - { - using namespace std; -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) - return frexp(v, exp); -#else - return frexpl(v, exp); -#endif - } - } -} - -#if defined(BOOST_HASH_USE_C99_FLOAT_FUNCS) -#undef BOOST_HASH_USE_C99_FLOAT_FUNCS -#endif - -#if defined(BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS) -#undef BOOST_HASH_USE_OVERLOAD_FLOAT_FUNCS -#endif - -#if defined(BOOST_HASH_C99_NO_FLOAT_FUNCS) -#undef BOOST_HASH_C99_NO_FLOAT_FUNCS -#endif - -#endif diff --git a/Utilities/BGL/boost/bfunctional/hash.hpp b/Utilities/BGL/boost/bfunctional/hash.hpp deleted file mode 100644 index 0870ed2f53c4dd74f58dce678f76130960e88ee4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash.hpp +++ /dev/null @@ -1,25 +0,0 @@ -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_HPP) -#define BOOST_FUNCTIONAL_HASH_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/bfunctional/hash/hash.hpp> -#include <boost/bfunctional/hash/pair.hpp> -#include <boost/bfunctional/hash/vector.hpp> -#include <boost/bfunctional/hash/list.hpp> -#include <boost/bfunctional/hash/deque.hpp> -#include <boost/bfunctional/hash/set.hpp> -#include <boost/bfunctional/hash/map.hpp> - -#endif diff --git a/Utilities/BGL/boost/bfunctional/hash/deque.hpp b/Utilities/BGL/boost/bfunctional/hash/deque.hpp deleted file mode 100644 index cbbfd4dec6b3615205ffd7fd335801a514820016..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash/deque.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_DEQUE_HPP) -#define BOOST_FUNCTIONAL_HASH_DEQUE_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> -#include <deque> -#include <boost/bfunctional/hash/hash.hpp> - -namespace boost -{ - template <class T, class A> - std::size_t hash_value(std::deque<T, A> const& v) - { - return hash_range(v.begin(), v.end()); - } - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - namespace hash_detail - { - template <class T, class A> - struct call_hash<std::deque<T, A> > - { - static std::size_t call(std::deque<T, A> const& val) - { - return boost::hash_value(val); - } - }; - } -#endif -} - -#endif - diff --git a/Utilities/BGL/boost/bfunctional/hash/hash.hpp b/Utilities/BGL/boost/bfunctional/hash/hash.hpp deleted file mode 100644 index 24f06be34850db5782d6fa93a1869304020efb99..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash/hash.hpp +++ /dev/null @@ -1,328 +0,0 @@ - -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) -#define BOOST_FUNCTIONAL_HASH_HASH_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> -#include <cstddef> -#include <cmath> -#include <string> -#include <functional> -#include <errno.h> -#include <boost/limits.hpp> -#include <boost/bfunctional/detail/float_functions.hpp> -#include <boost/detail/workaround.hpp> - -#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) -#include <boost/type_traits/is_array.hpp> -#endif - -namespace boost -{ -#if defined(__BORLANDC__) - // Borland complains about an ambiguous function overload - // when compiling boost::hash<bool>. - std::size_t hash_value(bool); -#endif - - std::size_t hash_value(int); - std::size_t hash_value(unsigned int); - std::size_t hash_value(long); - std::size_t hash_value(unsigned long); - - template <class T> std::size_t hash_value(T* const&); - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - template< class T, unsigned N > - std::size_t hash_value(const T (&array)[N]); - - template< class T, unsigned N > - std::size_t hash_value(T (&array)[N]); -#endif - - std::size_t hash_value(float v); - std::size_t hash_value(double v); - std::size_t hash_value(long double v); - -#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) - template <class Ch, class A> - std::size_t hash_value(std::basic_string<Ch, std::string_char_traits<Ch>, A> const&); -#else - template <class Ch, class A> - std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const&); -#endif - - template <class It> std::size_t hash_range(It first, It last); - template <class It> void hash_range(std::size_t&, It first, It last); -#if defined(__BORLANDC__) - template <class T> inline std::size_t hash_range(T*, T*); - template <class T> inline void hash_range(std::size_t&, T*, T*); -#endif - -#if defined(BOOST_MSVC) && BOOST_MSVC < 1300 - template <class T> void hash_combine(std::size_t& seed, T& v); -#else - template <class T> void hash_combine(std::size_t& seed, T const& v); -#endif - - // Implementation - -#if defined(__BORLANDC__) - inline std::size_t hash_value(bool v) - { - return static_cast<std::size_t>(v); - } -#endif - - inline std::size_t hash_value(int v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned int v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(long v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned long v) - { - return static_cast<std::size_t>(v); - } - - // Implementation by Alberto Barbati and Dave Harris. - template <class T> std::size_t hash_value(T* const& v) - { - std::size_t x = static_cast<std::size_t>( - reinterpret_cast<std::ptrdiff_t>(v)); - return x + (x >> 3); - } - - namespace hash_detail - { -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - // This allows boost::hash to be specialised for classes in the - // standard namespace. It appears that a strict two phase template - // implementation only finds overloads that are in the current - // namespace at the point of definition (at instantiation - // it only finds new overloads via. ADL on the dependant paramters or - // something like that). - template <class T> - struct call_hash - { - static std::size_t call(T const& v) - { - using namespace boost; - return hash_value(v); - } - }; -#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - template <bool IsArray> - struct call_hash_impl - { - template <class T> - struct inner - { - static std::size_t call(T const& v) - { - using namespace boost; - return hash_value(v); - } - }; - }; - - template <> - struct call_hash_impl<true> - { - template <class Array> - struct inner - { -#if defined(BOOST_MSVC) && BOOST_MSVC < 1300 - static std::size_t call(Array& v) -#else - static std::size_t call(Array const& v) -#endif - { - const int size = sizeof(v) / sizeof(*v); - return boost::hash_range(v, v + size); - } - }; - }; - - template <class T> - struct call_hash - : public call_hash_impl<boost::is_array<T>::value> - ::BOOST_NESTED_TEMPLATE inner<T> - { - }; -#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - } - -#if defined(BOOST_MSVC) && BOOST_MSVC < 1300 - template <class T> - inline void hash_combine(std::size_t& seed, T& v) -#else - template <class T> - inline void hash_combine(std::size_t& seed, T const& v) -#endif - { - seed ^= hash_detail::call_hash<T>::call(v) - + 0x9e3779b9 + (seed<<6) + (seed>>2); - } - - template <class It> - inline std::size_t hash_range(It first, It last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - hash_combine(seed, *first); - } - - return seed; - } - - template <class It> - inline void hash_range(std::size_t& seed, It first, It last) - { - for(; first != last; ++first) - { - hash_combine(seed, *first); - } - } - -#if defined(__BORLANDC__) - template <class T> - inline std::size_t hash_range(T* first, T* last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - seed ^= hash_detail::call_hash<T>::call(*first) - + 0x9e3779b9 + (seed<<6) + (seed>>2); - } - - return seed; - } - - template <class T> - inline void hash_range(std::size_t& seed, T* first, T* last) - { - for(; first != last; ++first) - { - seed ^= hash_detail::call_hash<T>::call(*first) - + 0x9e3779b9 + (seed<<6) + (seed>>2); - } - } -#endif - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - template< class T, unsigned N > - inline std::size_t hash_value(const T (&array)[N]) - { - return hash_range(array, array + N); - } - - template< class T, unsigned N > - inline std::size_t hash_value(T (&array)[N]) - { - return hash_range(array, array + N); - } -#endif - -#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) - template <class Ch, class A> - inline std::size_t hash_value(std::basic_string<Ch, std::string_char_traits<Ch>, A> const& v) -#else - template <class Ch, class A> - inline std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const& v) -#endif - { - return hash_range(v.begin(), v.end()); - } - - namespace hash_detail - { - template <class T> - inline std::size_t float_hash_value(T v) - { - int exp = 0; - errno = 0; - v = boost::hash_detail::call_frexp(v, &exp); - if(errno) return 0; - - std::size_t seed = 0; - - std::size_t const length - = (std::numeric_limits<T>::digits + - std::numeric_limits<int>::digits - 1) - / std::numeric_limits<int>::digits; - - for(std::size_t i = 0; i < length; ++i) - { - v = boost::hash_detail::call_ldexp(v, std::numeric_limits<int>::digits); - int const part = static_cast<int>(v); - v -= part; - boost::hash_combine(seed, part); - } - - boost::hash_combine(seed, exp); - - return seed; - } - } - - inline std::size_t hash_value(float v) - { - return boost::hash_detail::float_hash_value(v); - } - - inline std::size_t hash_value(double v) - { - return boost::hash_detail::float_hash_value(v); - } - - inline std::size_t hash_value(long double v) - { - return boost::hash_detail::float_hash_value(v); - } - - // boost::hash - - template <class T> struct hash - : std::unary_function<T, std::size_t> - { - std::size_t operator()(T const& val) const - { - return hash_detail::call_hash<T>::call(val); - } - -#if defined(BOOST_MSVC) && BOOST_MSVC < 1300 - std::size_t operator()(T& val) const - { - return hash_detail::call_hash<T>::call(val); - } -#endif - }; -} - -#endif - diff --git a/Utilities/BGL/boost/bfunctional/hash/list.hpp b/Utilities/BGL/boost/bfunctional/hash/list.hpp deleted file mode 100644 index 0a1904c6ba56334ff05dcb66247976fc90d69b02..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash/list.hpp +++ /dev/null @@ -1,46 +0,0 @@ - -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_LIST_HPP) -#define BOOST_FUNCTIONAL_HASH_LIST_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> -#include <list> -#include <boost/bfunctional/hash/hash.hpp> - -namespace boost -{ - template <class T, class A> - std::size_t hash_value(std::list<T, A> const& v) - { - return hash_range(v.begin(), v.end()); - } - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - namespace hash_detail - { - template <class T, class A> - struct call_hash<std::list<T, A> > - { - static std::size_t call(std::list<T, A> const& val) - { - return boost::hash_value(val); - } - }; - } -#endif -} - -#endif - diff --git a/Utilities/BGL/boost/bfunctional/hash/map.hpp b/Utilities/BGL/boost/bfunctional/hash/map.hpp deleted file mode 100644 index 67290a017826e6aeb8ee566e24b633df868ac429..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash/map.hpp +++ /dev/null @@ -1,63 +0,0 @@ - -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_MAP_HPP) -#define BOOST_FUNCTIONAL_HASH_MAP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> -#include <map> -#include <boost/bfunctional/hash/hash.hpp> -#include <boost/bfunctional/hash/pair.hpp> - -namespace boost -{ - template <class K, class T, class C, class A> - std::size_t hash_value(std::map<K, T, C, A> const& v) - { - return hash_range(v.begin(), v.end()); - } - - template <class K, class T, class C, class A> - std::size_t hash_value(std::multimap<K, T, C, A> const& v) - { - return hash_range(v.begin(), v.end()); - } - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - namespace hash_detail - { - template <class K, class T, class C, class A> - struct call_hash<std::map<K, T, C, A> > - { - static std::size_t call(std::map<K, T, C, A> const& val) - { - return boost::hash_value(val); - } - }; - - template <class K, class T, class C, class A> - struct call_hash<std::multimap<K, T, C, A> > - { - static std::size_t call(std::multimap<K, T, C, A> const& val) - { - return boost::hash_value(val); - } - }; - } -#endif -} - -#endif - - diff --git a/Utilities/BGL/boost/bfunctional/hash/pair.hpp b/Utilities/BGL/boost/bfunctional/hash/pair.hpp deleted file mode 100644 index bd45e557128e67f8168a015a9cce7c7d11addfb8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash/pair.hpp +++ /dev/null @@ -1,48 +0,0 @@ - -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_PAIR_HPP) -#define BOOST_FUNCTIONAL_HASH_PAIR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> -#include <utility> -#include <boost/bfunctional/hash/hash.hpp> - -namespace boost -{ - template <class A, class B> - std::size_t hash_value(std::pair<A, B> const& v) - { - std::size_t seed = 0; - hash_combine(seed, v.first); - hash_combine(seed, v.second); - return seed; - } - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - namespace hash_detail - { - template <class A, class B> - struct call_hash<std::pair<A, B> > - { - static std::size_t call(std::pair<A, B> const& val) - { - return boost::hash_value(val); - } - }; - } -#endif -} - -#endif diff --git a/Utilities/BGL/boost/bfunctional/hash/set.hpp b/Utilities/BGL/boost/bfunctional/hash/set.hpp deleted file mode 100644 index e5941e8a2b71e3cfccfb7c8a41e67ab05725479a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash/set.hpp +++ /dev/null @@ -1,61 +0,0 @@ - -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_SET_HPP) -#define BOOST_FUNCTIONAL_HASH_SET_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> -#include <set> -#include <boost/bfunctional/hash/hash.hpp> - -namespace boost -{ - template <class K, class C, class A> - std::size_t hash_value(std::set<K, C, A> const& v) - { - return hash_range(v.begin(), v.end()); - } - - template <class K, class C, class A> - std::size_t hash_value(std::multiset<K, C, A> const& v) - { - return hash_range(v.begin(), v.end()); - } - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - namespace hash_detail - { - template <class K, class C, class A> - struct call_hash<std::set<K, C, A> > - { - static std::size_t call(std::set<K, C, A> const& val) - { - return boost::hash_value(val); - } - }; - - template <class K, class C, class A> - struct call_hash<std::multiset<K, C, A> > - { - static std::size_t call(std::multiset<K, C, A> const& val) - { - return boost::hash_value(val); - } - }; - } -#endif -} - -#endif - diff --git a/Utilities/BGL/boost/bfunctional/hash/vector.hpp b/Utilities/BGL/boost/bfunctional/hash/vector.hpp deleted file mode 100644 index 7a93fc26aff523cc1c436d169e89946ba3a6ca1f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bfunctional/hash/vector.hpp +++ /dev/null @@ -1,45 +0,0 @@ - -// (C) Copyright Daniel James 2005. -// 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) -// -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -#if !defined(BOOST_FUNCTIONAL_HASH_VECTOR_HPP) -#define BOOST_FUNCTIONAL_HASH_VECTOR_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> -#include <vector> -#include <boost/bfunctional/hash/hash.hpp> - -namespace boost -{ - template <class T, class A> - std::size_t hash_value(std::vector<T, A> const& v) - { - return hash_range(v.begin(), v.end()); - } - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - namespace hash_detail - { - template <class T, class A> - struct call_hash<std::vector<T, A> > - { - static std::size_t call(std::vector<T, A> const& val) - { - return boost::hash_value(val); - } - }; - } -#endif -} - -#endif diff --git a/Utilities/BGL/boost/bind.hpp b/Utilities/BGL/boost/bind.hpp deleted file mode 100644 index 3eba772a694556e1d0c2520f7bc5d359951702d7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind.hpp +++ /dev/null @@ -1,1636 +0,0 @@ -#ifndef BOOST_BIND_HPP_INCLUDED -#define BOOST_BIND_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind.hpp - binds function objects to arguments -// -// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2001 David Abrahams -// Copyright (c) 2005 Peter Dimov -// -// 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/bind/bind.html for documentation. -// - -#include <boost/config.hpp> -#include <boost/ref.hpp> -#include <boost/mem_fn.hpp> -#include <boost/type.hpp> -#include <boost/bind/arg.hpp> -#include <boost/detail/workaround.hpp> - -// Borland-specific bug, visit_each() silently fails to produce code - -#if defined(__BORLANDC__) -# define BOOST_BIND_VISIT_EACH boost::visit_each -#else -# define BOOST_BIND_VISIT_EACH visit_each -#endif - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4512) // assignment operator could not be generated -#endif - -namespace boost -{ - -namespace _bi // implementation details -{ - -// result_traits - -template<class R, class F> struct result_traits -{ - typedef R type; -}; - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -struct unspecified {}; - -template<class F> struct result_traits<unspecified, F> -{ - typedef typename F::result_type type; -}; - -template<class F> struct result_traits< unspecified, reference_wrapper<F> > -{ - typedef typename F::result_type type; -}; - -#endif - -// ref_compare - -template<class T> bool ref_compare(T const & a, T const & b, long) -{ - return a == b; -} - -template<class T> bool ref_compare(reference_wrapper<T> const & a, reference_wrapper<T> const & b, int) -{ - return a.get_pointer() == b.get_pointer(); -} - -// bind_t forward declaration for listN - -template<class R, class F, class L> class bind_t; - -// value - -template<class T> class value -{ -public: - - value(T const & t): t_(t) {} - - T & get() { return t_; } - T const & get() const { return t_; } - - bool operator==(value const & rhs) const - { - return t_ == rhs.t_; - } - -private: - - T t_; -}; - -// type - -template<class T> class type {}; - -// unwrap - -template<class F> inline F & unwrap(F * f, long) -{ - return *f; -} - -template<class F> inline F & unwrap(reference_wrapper<F> * f, int) -{ - return f->get(); -} - -template<class F> inline F & unwrap(reference_wrapper<F> const * f, int) -{ - return f->get(); -} - -#if !( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, <= 0x3004) ) - -template<class R, class T> inline _mfi::dm<R, T> unwrap(R T::* * pm, int) -{ - return _mfi::dm<R, T>(*pm); -} - -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -// IBM/VisualAge 6.0 is not able to handle this overload. -template<class R, class T> inline _mfi::dm<R, T> unwrap(R T::* const * pm, int) -{ - return _mfi::dm<R, T>(*pm); -} -#endif - - -#endif - -// listN - -class list0 -{ -public: - - list0() {} - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A &, long) - { - return unwrap(&f, 0)(); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const - { - return unwrap(&f, 0)(); - } - - template<class F, class A> void operator()(type<void>, F & f, A &, int) - { - unwrap(&f, 0)(); - } - - template<class F, class A> void operator()(type<void>, F const & f, A &, int) const - { - unwrap(&f, 0)(); - } - - template<class V> void accept(V &) const - { - } - - bool operator==(list0 const &) const - { - return true; - } -}; - -template<class A1> class list1 -{ -public: - - explicit list1(A1 a1): a1_(a1) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - - template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); } - - template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - } - - bool operator==(list1 const & rhs) const - { - return ref_compare(a1_, rhs.a1_, 0); - } - -private: - - A1 a1_; -}; - -template<class A1, class A2> class list2 -{ -public: - - list2(A1 a1, A2 a2): a1_(a1), a2_(a2) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - } - - bool operator==(list2 const & rhs) const - { - return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0); - } - -private: - - A1 a1_; - A2 a2_; -}; - -template<class A1, class A2, class A3> class list3 -{ -public: - - list3(A1 a1, A2 a2, A3 a3): a1_(a1), a2_(a2), a3_(a3) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - } - - bool operator==(list3 const & rhs) const - { - return ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0); - } - -private: - - A1 a1_; - A2 a2_; - A3 a3_; -}; - -template<class A1, class A2, class A3, class A4> class list4 -{ -public: - - list4(A1 a1, A2 a2, A3 a3, A4 a4): a1_(a1), a2_(a2), a3_(a3), a4_(a4) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - } - - bool operator==(list4 const & rhs) const - { - return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0); - } - -private: - - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; -}; - -template<class A1, class A2, class A3, class A4, class A5> class list5 -{ -public: - - list5(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - } - - bool operator==(list5 const & rhs) const - { - return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0); - } - -private: - - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6> class list6 -{ -public: - - list6(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - } - - bool operator==(list6 const & rhs) const - { - return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0); - } - -private: - - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> class list7 -{ -public: - - list7(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } - A7 operator[] (boost::arg<7>) const { return a7_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return a7_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - BOOST_BIND_VISIT_EACH(v, a7_, 0); - } - - bool operator==(list7 const & rhs) const - { - return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) && - ref_compare(a7_, rhs.a7_, 0); - } - -private: - - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; - A7 a7_; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> class list8 -{ -public: - - list8(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7), a8_(a8) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } - A7 operator[] (boost::arg<7>) const { return a7_; } - A8 operator[] (boost::arg<8>) const { return a8_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return a7_; } - A8 operator[] (boost::arg<8> (*) ()) const { return a8_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - BOOST_BIND_VISIT_EACH(v, a7_, 0); - BOOST_BIND_VISIT_EACH(v, a8_, 0); - } - - bool operator==(list8 const & rhs) const - { - return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) && - ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0); - } - -private: - - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; - A7 a7_; - A8 a8_; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> class list9 -{ -public: - - list9(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9): a1_(a1), a2_(a2), a3_(a3), a4_(a4), a5_(a5), a6_(a6), a7_(a7), a8_(a8), a9_(a9) {} - - A1 operator[] (boost::arg<1>) const { return a1_; } - A2 operator[] (boost::arg<2>) const { return a2_; } - A3 operator[] (boost::arg<3>) const { return a3_; } - A4 operator[] (boost::arg<4>) const { return a4_; } - A5 operator[] (boost::arg<5>) const { return a5_; } - A6 operator[] (boost::arg<6>) const { return a6_; } - A7 operator[] (boost::arg<7>) const { return a7_; } - A8 operator[] (boost::arg<8>) const { return a8_; } - A9 operator[] (boost::arg<9>) const { return a9_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return a7_; } - A8 operator[] (boost::arg<8> (*) ()) const { return a8_; } - A9 operator[] (boost::arg<9> (*) ()) const { return a9_; } - - template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } - - template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } - - template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } - - template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } - - template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); - } - - template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const - { - return unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); - } - - template<class F, class A> void operator()(type<void>, F & f, A & a, int) - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); - } - - template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const - { - unwrap(&f, 0)(a[a1_], a[a2_], a[a3_], a[a4_], a[a5_], a[a6_], a[a7_], a[a8_], a[a9_]); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - BOOST_BIND_VISIT_EACH(v, a7_, 0); - BOOST_BIND_VISIT_EACH(v, a8_, 0); - BOOST_BIND_VISIT_EACH(v, a9_, 0); - } - - bool operator==(list9 const & rhs) const - { - return - ref_compare(a1_, rhs.a1_, 0) && ref_compare(a2_, rhs.a2_, 0) && ref_compare(a3_, rhs.a3_, 0) && - ref_compare(a4_, rhs.a4_, 0) && ref_compare(a5_, rhs.a5_, 0) && ref_compare(a6_, rhs.a6_, 0) && - ref_compare(a7_, rhs.a7_, 0) && ref_compare(a8_, rhs.a8_, 0) && ref_compare(a9_, rhs.a9_, 0); - } - -private: - - A1 a1_; - A2 a2_; - A3 a3_; - A4 a4_; - A5 a5_; - A6 a6_; - A7 a7_; - A8 a8_; - A9 a9_; -}; - -// bind_t - -#ifndef BOOST_NO_VOID_RETURNS - -template<class R, class F, class L> class bind_t -{ -public: - - typedef bind_t this_type; - - bind_t(F f, L const & l): f_(f), l_(l) {} - -#define BOOST_BIND_RETURN return -#include <boost/bind/bind_template.hpp> -#undef BOOST_BIND_RETURN - -}; - -#else - -template<class R> struct bind_t_generator -{ - -template<class F, class L> class implementation -{ -public: - - typedef implementation this_type; - - implementation(F f, L const & l): f_(f), l_(l) {} - -#define BOOST_BIND_RETURN return -#include <boost/bind/bind_template.hpp> -#undef BOOST_BIND_RETURN - -}; - -}; - -template<> struct bind_t_generator<void> -{ - -template<class F, class L> class implementation -{ -private: - - typedef void R; - -public: - - typedef implementation this_type; - - implementation(F f, L const & l): f_(f), l_(l) {} - -#define BOOST_BIND_RETURN -#include <boost/bind/bind_template.hpp> -#undef BOOST_BIND_RETURN - -}; - -}; - -template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L> -{ -public: - - bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {} - -}; - -#endif - -// function_equal - -#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - -// put overloads in _bi, rely on ADL - -# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b ) -{ - return a.compare(b); -} - -# else - -template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int ) -{ - return a.compare(b); -} - -# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - -// put overloads in boost - -} // namespace _bi - -# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b ) -{ - return a.compare(b); -} - -# else - -template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int ) -{ - return a.compare(b); -} - -# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -namespace _bi -{ - -#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - -// add_value - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530) - -template<class T> struct add_value -{ - typedef _bi::value<T> type; -}; - -template<class T> struct add_value< value<T> > -{ - typedef _bi::value<T> type; -}; - -template<class T> struct add_value< reference_wrapper<T> > -{ - typedef reference_wrapper<T> type; -}; - -template<int I> struct add_value< arg<I> > -{ - typedef boost::arg<I> type; -}; - -template<int I> struct add_value< arg<I> (*) () > -{ - typedef boost::arg<I> (*type) (); -}; - -template<class R, class F, class L> struct add_value< bind_t<R, F, L> > -{ - typedef bind_t<R, F, L> type; -}; - -#else - -template<int I> struct _avt_0; - -template<> struct _avt_0<1> -{ - template<class T> struct inner - { - typedef T type; - }; -}; - -template<> struct _avt_0<2> -{ - template<class T> struct inner - { - typedef value<T> type; - }; -}; - -typedef char (&_avt_r1) [1]; -typedef char (&_avt_r2) [2]; - -template<class T> _avt_r1 _avt_f(value<T>); -template<class T> _avt_r1 _avt_f(reference_wrapper<T>); -template<int I> _avt_r1 _avt_f(arg<I>); -template<int I> _avt_r1 _avt_f(arg<I> (*) ()); -template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>); - -_avt_r2 _avt_f(...); - -template<class T> struct add_value -{ - static T t(); - typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type; -}; - -#endif - -// list_av_N - -template<class A1> struct list_av_1 -{ - typedef typename add_value<A1>::type B1; - typedef list1<B1> type; -}; - -template<class A1, class A2> struct list_av_2 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef list2<B1, B2> type; -}; - -template<class A1, class A2, class A3> struct list_av_3 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef typename add_value<A3>::type B3; - typedef list3<B1, B2, B3> type; -}; - -template<class A1, class A2, class A3, class A4> struct list_av_4 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef typename add_value<A3>::type B3; - typedef typename add_value<A4>::type B4; - typedef list4<B1, B2, B3, B4> type; -}; - -template<class A1, class A2, class A3, class A4, class A5> struct list_av_5 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef typename add_value<A3>::type B3; - typedef typename add_value<A4>::type B4; - typedef typename add_value<A5>::type B5; - typedef list5<B1, B2, B3, B4, B5> type; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef typename add_value<A3>::type B3; - typedef typename add_value<A4>::type B4; - typedef typename add_value<A5>::type B5; - typedef typename add_value<A6>::type B6; - typedef list6<B1, B2, B3, B4, B5, B6> type; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef typename add_value<A3>::type B3; - typedef typename add_value<A4>::type B4; - typedef typename add_value<A5>::type B5; - typedef typename add_value<A6>::type B6; - typedef typename add_value<A7>::type B7; - typedef list7<B1, B2, B3, B4, B5, B6, B7> type; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef typename add_value<A3>::type B3; - typedef typename add_value<A4>::type B4; - typedef typename add_value<A5>::type B5; - typedef typename add_value<A6>::type B6; - typedef typename add_value<A7>::type B7; - typedef typename add_value<A8>::type B8; - typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type; -}; - -template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9 -{ - typedef typename add_value<A1>::type B1; - typedef typename add_value<A2>::type B2; - typedef typename add_value<A3>::type B3; - typedef typename add_value<A4>::type B4; - typedef typename add_value<A5>::type B5; - typedef typename add_value<A6>::type B6; - typedef typename add_value<A7>::type B7; - typedef typename add_value<A8>::type B8; - typedef typename add_value<A9>::type B9; - typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type; -}; - -// operator! - -struct logical_not -{ - template<class V> bool operator()(V const & v) const { return !v; } -}; - -template<class R, class F, class L> - bind_t< bool, logical_not, list1< bind_t<R, F, L> > > - operator! (bind_t<R, F, L> const & f) -{ - typedef list1< bind_t<R, F, L> > list_type; - return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) ); -} - -// relational operators - -#define BOOST_BIND_OPERATOR( op, name ) \ -\ -struct name \ -{ \ - template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \ -}; \ - \ -template<class R, class F, class L, class A2> \ - bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \ - operator op (bind_t<R, F, L> const & f, A2 a2) \ -{ \ - typedef typename add_value<A2>::type B2; \ - typedef list2< bind_t<R, F, L>, B2> list_type; \ - return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \ -} - -BOOST_BIND_OPERATOR( ==, equal ) -BOOST_BIND_OPERATOR( !=, not_equal ) - -BOOST_BIND_OPERATOR( <, less ) -BOOST_BIND_OPERATOR( <=, less_equal ) - -BOOST_BIND_OPERATOR( >, greater ) -BOOST_BIND_OPERATOR( >=, greater_equal ) - -#undef BOOST_BIND_OPERATOR - -#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) - -// resolve ambiguity with rel_ops - -#define BOOST_BIND_OPERATOR( op, name ) \ -\ -template<class R, class F, class L> \ - bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \ - operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \ -{ \ - typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \ - return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \ -} - -BOOST_BIND_OPERATOR( !=, not_equal ) -BOOST_BIND_OPERATOR( <=, less_equal ) -BOOST_BIND_OPERATOR( >, greater ) -BOOST_BIND_OPERATOR( >=, greater_equal ) - -#endif - -} // namespace _bi - -// visit_each - -template<class V, class T> void visit_each(V & v, _bi::value<T> const & t, int) -{ - BOOST_BIND_VISIT_EACH(v, t.get(), 0); -} - -template<class V, class R, class F, class L> void visit_each(V & v, _bi::bind_t<R, F, L> const & t, int) -{ - t.accept(v); -} - -// bind - -#ifndef BOOST_BIND -#define BOOST_BIND bind -#endif - -// generic function objects - -template<class R, class F> - _bi::bind_t<R, F, _bi::list0> - BOOST_BIND(F f) -{ - typedef _bi::list0 list_type; - return _bi::bind_t<R, F, list_type> (f, list_type()); -} - -template<class R, class F, class A1> - _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type> - BOOST_BIND(F f, A1 a1) -{ - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<R, F, list_type> (f, list_type(a1)); -} - -template<class R, class F, class A1, class A2> - _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type> - BOOST_BIND(F f, A1 a1, A2 a2) -{ - typedef typename _bi::list_av_2<A1, A2>::type list_type; - return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2)); -} - -template<class R, class F, class A1, class A2, class A3> - _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) -{ - typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3)); -} - -template<class R, class F, class A1, class A2, class A3, class A4> - _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5> - _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6> - _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> - _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> - _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> - _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -// generic function objects, alternative syntax - -template<class R, class F> - _bi::bind_t<R, F, _bi::list0> - BOOST_BIND(boost::type<R>, F f) -{ - typedef _bi::list0 list_type; - return _bi::bind_t<R, F, list_type> (f, list_type()); -} - -template<class R, class F, class A1> - _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1) -{ - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<R, F, list_type> (f, list_type(a1)); -} - -template<class R, class F, class A1, class A2> - _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2) -{ - typedef typename _bi::list_av_2<A1, A2>::type list_type; - return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2)); -} - -template<class R, class F, class A1, class A2, class A3> - _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3) -{ - typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3)); -} - -template<class R, class F, class A1, class A2, class A3, class A4> - _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5> - _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6> - _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> - _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> - _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> - _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> - BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -// adaptable function objects - -template<class F> - _bi::bind_t<_bi::unspecified, F, _bi::list0> - BOOST_BIND(F f) -{ - typedef _bi::list0 list_type; - return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type()); -} - -template<class F, class A1> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type> - BOOST_BIND(F f, A1 a1) -{ - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); -} - -template<class F, class A1, class A2> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type> - BOOST_BIND(F f, A1 a1, A2 a2) -{ - typedef typename _bi::list_av_2<A1, A2>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); -} - -template<class F, class A1, class A2, class A3> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) -{ - typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); -} - -template<class F, class A1, class A2, class A3, class A4> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); -} - -template<class F, class A1, class A2, class A3, class A4, class A5> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); -} - -template<class F, class A1, class A2, class A3, class A4, class A5, class A6> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -// function pointers - -#define BOOST_BIND_CC -#define BOOST_BIND_ST - -#include <boost/bind/bind_cc.hpp> - -#undef BOOST_BIND_CC -#undef BOOST_BIND_ST - -#ifdef BOOST_BIND_ENABLE_STDCALL - -#define BOOST_BIND_CC __stdcall -#define BOOST_BIND_ST - -#include <boost/bind/bind_cc.hpp> - -#undef BOOST_BIND_CC -#undef BOOST_BIND_ST - -#endif - -#ifdef BOOST_BIND_ENABLE_FASTCALL - -#define BOOST_BIND_CC __fastcall -#define BOOST_BIND_ST - -#include <boost/bind/bind_cc.hpp> - -#undef BOOST_BIND_CC -#undef BOOST_BIND_ST - -#endif - -#ifdef BOOST_BIND_ENABLE_PASCAL - -#define BOOST_BIND_ST pascal -#define BOOST_BIND_CC - -#include <boost/bind/bind_cc.hpp> - -#undef BOOST_BIND_ST -#undef BOOST_BIND_CC - -#endif - -// member function pointers - -#define BOOST_BIND_MF_NAME(X) X -#define BOOST_BIND_MF_CC - -#include <boost/bind/bind_mf_cc.hpp> - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_BIND_MF_NAME(X) X##_cdecl -#define BOOST_BIND_MF_CC __cdecl - -#include <boost/bind/bind_mf_cc.hpp> - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_BIND_MF_NAME(X) X##_stdcall -#define BOOST_BIND_MF_CC __stdcall - -#include <boost/bind/bind_mf_cc.hpp> - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_BIND_MF_NAME(X) X##_fastcall -#define BOOST_BIND_MF_CC __fastcall - -#include <boost/bind/bind_mf_cc.hpp> - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC - -#endif - -// data member pointers - -/* - -#if defined(__GNUC__) && (__GNUC__ == 2) - -namespace _bi -{ - -template<class T> struct add_cref -{ - typedef T const & type; -}; - -template<class T> struct add_cref< T & > -{ - typedef T const & type; -}; - -template<> struct add_cref<void> -{ - typedef void type; -}; - -} // namespace _bi - -template<class R, class T, class A1> -_bi::bind_t< typename _bi::add_cref<R>::type, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type > - BOOST_BIND(R T::*f, A1 a1) -{ - typedef _mfi::dm<R, T> F; - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<typename _bi::add_cref<R>::type, F, list_type>(F(f), list_type(a1)); -} - -#else - -template<class R, class T, class A1> -_bi::bind_t< R const &, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type > - BOOST_BIND(R T::*f, A1 a1) -{ - typedef _mfi::dm<R, T> F; - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<R const &, F, list_type>(F(f), list_type(a1)); -} - -#endif - -*/ - -template<class R, class T, class A1> -_bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type > - BOOST_BIND(R T::*f, A1 a1) -{ - typedef _mfi::dm<R, T> F; - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) ); -} - -} // namespace boost - -#ifndef BOOST_BIND_NO_PLACEHOLDERS - -# include <boost/bind/placeholders.hpp> - -#endif - -#ifdef BOOST_MSVC -# pragma warning(default: 4512) // assignment operator could not be generated -# pragma warning(pop) -#endif - -#endif // #ifndef BOOST_BIND_HPP_INCLUDED diff --git a/Utilities/BGL/boost/bind/apply.hpp b/Utilities/BGL/boost/bind/apply.hpp deleted file mode 100644 index 6a43a89ac8530e8fce927e5f592636429590f910..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/apply.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef BOOST_BIND_APPLY_HPP_INCLUDED -#define BOOST_BIND_APPLY_HPP_INCLUDED - -// -// apply.hpp -// -// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// 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) -// - -namespace boost -{ - -template<class R> struct apply -{ - typedef R result_type; - - template<class F> result_type operator()(F & f) const - { - return f(); - } - - template<class F, class A1> result_type operator()(F & f, A1 & a1) const - { - return f(a1); - } - - template<class F, class A1, class A2> result_type operator()(F & f, A1 & a1, A2 & a2) const - { - return f(a1, a2); - } - - template<class F, class A1, class A2, class A3> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3) const - { - return f(a1, a2, a3); - } - - template<class F, class A1, class A2, class A3, class A4> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4) const - { - return f(a1, a2, a3, a4); - } - - template<class F, class A1, class A2, class A3, class A4, class A5> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const - { - return f(a1, a2, a3, a4, a5); - } - - template<class F, class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const - { - return f(a1, a2, a3, a4, a5, a6); - } - - template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const - { - return f(a1, a2, a3, a4, a5, a6, a7); - } - - template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const - { - return f(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(F & f, A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const - { - return f(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } -}; - -} // namespace boost - -#endif // #ifndef BOOST_BIND_APPLY_HPP_INCLUDED diff --git a/Utilities/BGL/boost/bind/arg.hpp b/Utilities/BGL/boost/bind/arg.hpp deleted file mode 100644 index 90e966e5f4e3de3890bfbc1961ea355d1023dddb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/arg.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef BOOST_BIND_ARG_HPP_INCLUDED -#define BOOST_BIND_ARG_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind/arg.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// 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/bind/bind.html for documentation. -// - -namespace boost -{ - -template<int I> class arg -{ -}; - -template<int I> bool operator==(arg<I> const &, arg<I> const &) -{ - return true; -} - -} // namespace boost - -#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED diff --git a/Utilities/BGL/boost/bind/bind_cc.hpp b/Utilities/BGL/boost/bind/bind_cc.hpp deleted file mode 100644 index 35f8eceb9e51bc6366f4df3af664b29520e0a0c0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/bind_cc.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// -// bind/bind_cc.hpp - support for different calling conventions -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// 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/bind/bind.html for documentation. -// - -template<class R> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (), _bi::list0> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) ()) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (); - typedef _bi::list0 list_type; - return _bi::bind_t<R, F, list_type> (f, list_type()); -} - -template<class R, class B1, class A1> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1), typename _bi::list_av_1<A1>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1), A1 a1) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1); - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<R, F, list_type> (f, list_type(a1)); -} - -template<class R, class B1, class B2, class A1, class A2> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2), typename _bi::list_av_2<A1, A2>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2), A1 a1, A2 a2) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2); - typedef typename _bi::list_av_2<A1, A2>::type list_type; - return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2)); -} - -template<class R, - class B1, class B2, class B3, - class A1, class A2, class A3> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3), typename _bi::list_av_3<A1, A2, A3>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3), A1 a1, A2 a2, A3 a3) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3); - typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3)); -} - -template<class R, - class B1, class B2, class B3, class B4, - class A1, class A2, class A3, class A4> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4), typename _bi::list_av_4<A1, A2, A3, A4>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4); - typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4)); -} - -template<class R, - class B1, class B2, class B3, class B4, class B5, - class A1, class A2, class A3, class A4, class A5> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5), typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5); - typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); -} - -template<class R, - class B1, class B2, class B3, class B4, class B5, class B6, - class A1, class A2, class A3, class A4, class A5, class A6> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6), typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6); - typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template<class R, - class B1, class B2, class B3, class B4, class B5, class B6, class B7, - class A1, class A2, class A3, class A4, class A5, class A6, class A7> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7), typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7); - typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template<class R, - class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8, - class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7, B8), typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8); - typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template<class R, - class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8, class B9, - class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> - _bi::bind_t<R, BOOST_BIND_ST R (BOOST_BIND_CC *) (B1, B2, B3, B4, B5, B6, B7, B8, B9), typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8, B9), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8, B9); - typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; - return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} diff --git a/Utilities/BGL/boost/bind/bind_mf_cc.hpp b/Utilities/BGL/boost/bind/bind_mf_cc.hpp deleted file mode 100644 index 88be8222f3989deeebe57b4262b826cc89666dd9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/bind_mf_cc.hpp +++ /dev/null @@ -1,227 +0,0 @@ -// -// bind/bind_mf_cc.hpp - support for different calling conventions -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// 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/bind/bind.html for documentation. -// - -// 0 - -template<class R, class T, - class A1> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf0)<R, T>, typename _bi::list_av_1<A1>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (), A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf0)<R, T> F; - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1)); -} - -template<class R, class T, - class A1> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T>, typename _bi::list_av_1<A1>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const, A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf0)<R, T> F; - typedef typename _bi::list_av_1<A1>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1)); -} - -// 1 - -template<class R, class T, - class B1, - class A1, class A2> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf1)<R, T, B1> F; - typedef typename _bi::list_av_2<A1, A2>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2)); -} - -template<class R, class T, - class B1, - class A1, class A2> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1>, typename _bi::list_av_2<A1, A2>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf1)<R, T, B1> F; - typedef typename _bi::list_av_2<A1, A2>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2)); -} - -// 2 - -template<class R, class T, - class B1, class B2, - class A1, class A2, class A3> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2), A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf2)<R, T, B1, B2> F; - typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3)); -} - -template<class R, class T, - class B1, class B2, - class A1, class A2, class A3> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2>, typename _bi::list_av_3<A1, A2, A3>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const, A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf2)<R, T, B1, B2> F; - typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3)); -} - -// 3 - -template<class R, class T, - class B1, class B2, class B3, - class A1, class A2, class A3, class A4> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3), A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf3)<R, T, B1, B2, B3> F; - typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4)); -} - -template<class R, class T, - class B1, class B2, class B3, - class A1, class A2, class A3, class A4> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3>, typename _bi::list_av_4<A1, A2, A3, A4>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf3)<R, T, B1, B2, B3> F; - typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4)); -} - -// 4 - -template<class R, class T, - class B1, class B2, class B3, class B4, - class A1, class A2, class A3, class A4, class A5> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf4)<R, T, B1, B2, B3, B4> F; - typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5)); -} - -template<class R, class T, - class B1, class B2, class B3, class B4, - class A1, class A2, class A3, class A4, class A5> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4>, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf4)<R, T, B1, B2, B3, B4> F; - typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5)); -} - -// 5 - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, - class A1, class A2, class A3, class A4, class A5, class A6> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf5)<R, T, B1, B2, B3, B4, B5> F; - typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, - class A1, class A2, class A3, class A4, class A5, class A6> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5>, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf5)<R, T, B1, B2, B3, B4, B5> F; - typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -// 6 - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, class B6, - class A1, class A2, class A3, class A4, class A5, class A6, class A7> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf6)<R, T, B1, B2, B3, B4, B5, B6> F; - typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, class B6, - class A1, class A2, class A3, class A4, class A5, class A6, class A7> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6>, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf6)<R, T, B1, B2, B3, B4, B5, B6> F; - typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -// 7 - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, class B6, class B7, - class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F; - typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, class B6, class B7, - class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7>, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf7)<R, T, B1, B2, B3, B4, B5, B6, B7> F; - typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -// 8 - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8, - class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F; - typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -template<class R, class T, - class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8, - class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> - _bi::bind_t<R, _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8>, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf8)<R, T, B1, B2, B3, B4, B5, B6, B7, B8> F; - typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; - return _bi::bind_t<R, F, list_type>(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} diff --git a/Utilities/BGL/boost/bind/bind_template.hpp b/Utilities/BGL/boost/bind/bind_template.hpp deleted file mode 100644 index 60d78b31bb94cc81a1ddfe462010007823c7695d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/bind_template.hpp +++ /dev/null @@ -1,161 +0,0 @@ -// -// bind/bind_template.hpp -// -// Do not include this header directly. -// -// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. -// -// 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/bind/bind.html for documentation. -// - - typedef typename result_traits<R, F>::type result_type; - - result_type operator()() - { - list0 a; - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - result_type operator()() const - { - list0 a; - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1> result_type operator()(A1 & a1) - { - list1<A1 &> a(a1); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1> result_type operator()(A1 & a1) const - { - list1<A1 &> a(a1); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) - { - list2<A1 &, A2 &> a(a1, a2); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const - { - list2<A1 &, A2 &> a(a1, a2); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) - { - list3<A1 &, A2 &, A3 &> a(a1, a2, a3); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const - { - list3<A1 &, A2 &, A3 &> a(a1, a2, a3); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) - { - list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const - { - list4<A1 &, A2 &, A3 &, A4 &> a(a1, a2, a3, a4); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) - { - list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const - { - list5<A1 &, A2 &, A3 &, A4 &, A5 &> a(a1, a2, a3, a4, a5); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) - { - list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const - { - list6<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &> a(a1, a2, a3, a4, a5, a6); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) - { - list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const - { - list7<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &> a(a1, a2, a3, a4, a5, a6, a7); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) - { - list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const - { - list8<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &> a(a1, a2, a3, a4, a5, a6, a7, a8); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) - { - list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const - { - list9<A1 &, A2 &, A3 &, A4 &, A5 &, A6 &, A7 &, A8 &, A9 &> a(a1, a2, a3, a4, a5, a6, a7, a8, a9); - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A> result_type eval(A & a) - { - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class A> result_type eval(A & a) const - { - BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0); - } - - template<class V> void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, f_, 0); - l_.accept(v); - } - - bool compare(this_type const & rhs) const - { - return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_; - } - -private: - - F f_; - L l_; diff --git a/Utilities/BGL/boost/bind/make_adaptable.hpp b/Utilities/BGL/boost/bind/make_adaptable.hpp deleted file mode 100644 index b9f083e307dbd492cf03a6071ca3cd94a5e452bb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/make_adaptable.hpp +++ /dev/null @@ -1,187 +0,0 @@ -#ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED -#define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED - -// -// make_adaptable.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// 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) -// - -namespace boost -{ - -namespace _bi -{ - -template<class R, class F> class af0 -{ -public: - - typedef R result_type; - - explicit af0(F f): f_(f) - { - } - - result_type operator()() - { - return f_(); - } - - result_type operator()() const - { - return f_(); - } - -private: - - F f_; -}; - -template<class R, class A1, class F> class af1 -{ -public: - - typedef R result_type; - typedef A1 argument_type; - typedef A1 arg1_type; - - explicit af1(F f): f_(f) - { - } - - result_type operator()(A1 a1) - { - return f_(a1); - } - - result_type operator()(A1 a1) const - { - return f_(a1); - } - -private: - - F f_; -}; - -template<class R, class A1, class A2, class F> class af2 -{ -public: - - typedef R result_type; - typedef A1 first_argument_type; - typedef A2 second_argument_type; - typedef A1 arg1_type; - typedef A2 arg2_type; - - explicit af2(F f): f_(f) - { - } - - result_type operator()(A1 a1, A2 a2) - { - return f_(a1, a2); - } - - result_type operator()(A1 a1, A2 a2) const - { - return f_(a1, a2); - } - -private: - - F f_; -}; - -template<class R, class A1, class A2, class A3, class F> class af3 -{ -public: - - typedef R result_type; - typedef A1 arg1_type; - typedef A2 arg2_type; - typedef A3 arg3_type; - - explicit af3(F f): f_(f) - { - } - - result_type operator()(A1 a1, A2 a2, A3 a3) - { - return f_(a1, a2, a3); - } - - result_type operator()(A1 a1, A2 a2, A3 a3) const - { - return f_(a1, a2, a3); - } - -private: - - F f_; -}; - -template<class R, class A1, class A2, class A3, class A4, class F> class af4 -{ -public: - - typedef R result_type; - typedef A1 arg1_type; - typedef A2 arg2_type; - typedef A3 arg3_type; - typedef A4 arg4_type; - - explicit af4(F f): f_(f) - { - } - - result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) - { - return f_(a1, a2, a3, a4); - } - - result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const - { - return f_(a1, a2, a3, a4); - } - -private: - - F f_; -}; - -} // namespace _bi - -template<class R, class F> _bi::af0<R, F> make_adaptable(F f) -{ - return _bi::af0<R, F>(f); -} - -template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f) -{ - return _bi::af1<R, A1, F>(f); -} - -template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f) -{ - return _bi::af2<R, A1, A2, F>(f); -} - -template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f) -{ - return _bi::af3<R, A1, A2, A3, F>(f); -} - -template<class R, class A1, class A2, class A3, class A4, class F> _bi::af4<R, A1, A2, A3, A4, F> make_adaptable(F f) -{ - return _bi::af4<R, A1, A2, A3, A4, F>(f); -} - -} // namespace boost - -#endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/bind/mem_fn_cc.hpp b/Utilities/BGL/boost/bind/mem_fn_cc.hpp deleted file mode 100644 index 8b6ea0ba13dcaebd946c2e109e19dd3857f96498..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/mem_fn_cc.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// -// bind/mem_fn_cc.hpp - support for different calling conventions -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// 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/bind/mem_fn.html for documentation. -// - -template<class R, class T> _mfi::BOOST_MEM_FN_NAME(mf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) ()) -{ - return _mfi::BOOST_MEM_FN_NAME(mf0)<R, T>(f); -} - -template<class R, class T> _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) () const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T>(f); -} - -template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1>(f); -} - -template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1>(f); -} - -template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2>(f); -} - -template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2>(f); -} - -template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3>(f); -} - -template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f); -} - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f); -} diff --git a/Utilities/BGL/boost/bind/mem_fn_template.hpp b/Utilities/BGL/boost/bind/mem_fn_template.hpp deleted file mode 100644 index 6368bf25c263027a0de77d97255a1dbbc72882d2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/mem_fn_template.hpp +++ /dev/null @@ -1,934 +0,0 @@ -// -// bind/mem_fn_template.hpp -// -// Do not include this header directly -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// 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/bind/mem_fn.html for documentation. -// - -// mf0 - -template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf0) -{ -public: - - typedef R result_type; - typedef T * argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ()) - F f_; - - template<class U> R call(U & u, T const *) const - { - BOOST_MEM_FN_RETURN (u.*f_)(); - } - - template<class U> R call(U & u, void const *) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {} - - R operator()(T * p) const - { - BOOST_MEM_FN_RETURN (p->*f_)(); - } - - template<class U> R operator()(U & u) const - { - BOOST_MEM_FN_RETURN call(u, &u); - } - - R operator()(T & t) const - { - BOOST_MEM_FN_RETURN (t.*f_)(); - } - - bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf0 - -template<class R, class T BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf0) -{ -public: - - typedef R result_type; - typedef T const * argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const) - F f_; - - template<class U> R call(U & u, T const *) const - { - BOOST_MEM_FN_RETURN (u.*f_)(); - } - - template<class U> R call(U & u, void const *) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {} - - template<class U> R operator()(U const & u) const - { - BOOST_MEM_FN_RETURN call(u, &u); - } - - R operator()(T const & t) const - { - BOOST_MEM_FN_RETURN (t.*f_)(); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf1 - -template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf1) -{ -public: - - typedef R result_type; - typedef T * first_argument_type; - typedef A1 second_argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1)) - F f_; - - template<class U, class B1> R call(U & u, T const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1); - } - - template<class U, class B1> R call(U & u, void const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {} - - R operator()(T * p, A1 a1) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1); - } - - template<class U> R operator()(U & u, A1 a1) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1); - } - - R operator()(T & t, A1 a1) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1); - } - - bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf1 - -template<class R, class T, class A1 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf1) -{ -public: - - typedef R result_type; - typedef T const * first_argument_type; - typedef A1 second_argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const) - F f_; - - template<class U, class B1> R call(U & u, T const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1); - } - - template<class U, class B1> R call(U & u, void const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {} - - template<class U> R operator()(U const & u, A1 a1) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1); - } - - R operator()(T const & t, A1 a1) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf2 - -template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf2) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2)) - F f_; - - template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); - } - - template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2); - } - - template<class U> R operator()(U & u, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2); - } - - R operator()(T & t, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); - } - - bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf2 - -template<class R, class T, class A1, class A2 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf2) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const) - F f_; - - template<class U, class B1, class B2> R call(U & u, T const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); - } - - template<class U, class B1, class B2> R call(U & u, void const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {} - - template<class U> R operator()(U const & u, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2); - } - - R operator()(T const & t, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf3 - -template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf3) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3)) - F f_; - - template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); - } - - template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3); - } - - template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3); - } - - R operator()(T & t, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); - } - - bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf3 - -template<class R, class T, class A1, class A2, class A3 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf3) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const) - F f_; - - template<class U, class B1, class B2, class B3> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); - } - - template<class U, class B1, class B2, class B3> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {} - - template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf4 - -template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf4) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4)) - F f_; - - template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); - } - - template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4); - } - - template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4); - } - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); - } - - bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf4 - -template<class R, class T, class A1, class A2, class A3, class A4 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf4) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const) - F f_; - - template<class U, class B1, class B2, class B3, class B4> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); - } - - template<class U, class B1, class B2, class B3, class B4> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {} - - template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf5 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf5) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5)) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); - } - - template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5); - } - - template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5); - } - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); - } - - bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf5 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf5) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); - } - - template<class U, class B1, class B2, class B3, class B4, class B5> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {} - - template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf6 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf6) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6)) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); - } - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6); - } - - template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6); - } - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); - } - - bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf6 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf6) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); - } - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {} - - template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf7 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf7) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7)) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); - } - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7); - } - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf7 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf7) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); - } - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {} - - template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf8 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(mf8) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8)) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8); - } - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf8 - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 BOOST_MEM_FN_CLASS_F> class BOOST_MEM_FN_NAME(cmf8) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const) - F f_; - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - - template<class U, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8> R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {} - - R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const - { - return f_ != rhs.f_; - } -}; - diff --git a/Utilities/BGL/boost/bind/mem_fn_vw.hpp b/Utilities/BGL/boost/bind/mem_fn_vw.hpp deleted file mode 100644 index f3fc58db04e29ee5ea920cd1bf74c44931b92797..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/mem_fn_vw.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// -// bind/mem_fn_vw.hpp - void return helper wrappers -// -// Do not include this header directly -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// 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/bind/mem_fn.html for documentation. -// - -template<class R, class T> struct BOOST_MEM_FN_NAME(mf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, R (BOOST_MEM_FN_CC T::*) ()> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (); - explicit BOOST_MEM_FN_NAME(mf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)<R, T, F>(f) {} -}; - -template<class R, class T> struct BOOST_MEM_FN_NAME(cmf0): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, R (BOOST_MEM_FN_CC T::*) () const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) () const; - explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)<R, T, F>(f) {} -}; - - -template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(mf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1); - explicit BOOST_MEM_FN_NAME(mf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)<R, T, A1, F>(f) {} -}; - -template<class R, class T, class A1> struct BOOST_MEM_FN_NAME(cmf1): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, R (BOOST_MEM_FN_CC T::*) (A1) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1) const; - explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)<R, T, A1, F>(f) {} -}; - - -template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(mf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2); - explicit BOOST_MEM_FN_NAME(mf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)<R, T, A1, A2, F>(f) {} -}; - -template<class R, class T, class A1, class A2> struct BOOST_MEM_FN_NAME(cmf2): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, R (BOOST_MEM_FN_CC T::*) (A1, A2) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const; - explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)<R, T, A1, A2, F>(f) {} -}; - - -template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(mf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3); - explicit BOOST_MEM_FN_NAME(mf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)<R, T, A1, A2, A3, F>(f) {} -}; - -template<class R, class T, class A1, class A2, class A3> struct BOOST_MEM_FN_NAME(cmf3): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const; - explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)<R, T, A1, A2, A3, F>(f) {} -}; - - -template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(mf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4); - explicit BOOST_MEM_FN_NAME(mf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)<R, T, A1, A2, A3, A4, F>(f) {} -}; - -template<class R, class T, class A1, class A2, class A3, class A4> struct BOOST_MEM_FN_NAME(cmf4): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const; - explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)<R, T, A1, A2, A3, A4, F>(f) {} -}; - - -template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(mf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5); - explicit BOOST_MEM_FN_NAME(mf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)<R, T, A1, A2, A3, A4, A5, F>(f) {} -}; - -template<class R, class T, class A1, class A2, class A3, class A4, class A5> struct BOOST_MEM_FN_NAME(cmf5): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const; - explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)<R, T, A1, A2, A3, A4, A5, F>(f) {} -}; - - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(mf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6); - explicit BOOST_MEM_FN_NAME(mf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {} -}; - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> struct BOOST_MEM_FN_NAME(cmf6): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const; - explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)<R, T, A1, A2, A3, A4, A5, A6, F>(f) {} -}; - - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(mf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7); - explicit BOOST_MEM_FN_NAME(mf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {} -}; - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct BOOST_MEM_FN_NAME(cmf7): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const; - explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7, F>(f) {} -}; - - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(mf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8)> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8); - explicit BOOST_MEM_FN_NAME(mf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {} -}; - -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct BOOST_MEM_FN_NAME(cmf8): public mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, R (BOOST_MEM_FN_CC T::*) (A1, A2, A3, A4, A5, A6, A7, A8) const> -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const; - explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf<R>::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8, F>(f) {} -}; - diff --git a/Utilities/BGL/boost/bind/placeholders.hpp b/Utilities/BGL/boost/bind/placeholders.hpp deleted file mode 100644 index 8feed589057caf70a8f5fe3de3d5c21f2a73dd5e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/placeholders.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED -#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind/placeholders.hpp - _N definitions -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// 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/bind/bind.html for documentation. -// - -#include <boost/bind/arg.hpp> -#include <boost/config.hpp> - -namespace -{ - -#if defined(__BORLANDC__) - -static inline boost::arg<1> _1() { return boost::arg<1>(); } -static inline boost::arg<2> _2() { return boost::arg<2>(); } -static inline boost::arg<3> _3() { return boost::arg<3>(); } -static inline boost::arg<4> _4() { return boost::arg<4>(); } -static inline boost::arg<5> _5() { return boost::arg<5>(); } -static inline boost::arg<6> _6() { return boost::arg<6>(); } -static inline boost::arg<7> _7() { return boost::arg<7>(); } -static inline boost::arg<8> _8() { return boost::arg<8>(); } -static inline boost::arg<9> _9() { return boost::arg<9>(); } - -#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__) - -static boost::arg<1> _1; -static boost::arg<2> _2; -static boost::arg<3> _3; -static boost::arg<4> _4; -static boost::arg<5> _5; -static boost::arg<6> _6; -static boost::arg<7> _7; -static boost::arg<8> _8; -static boost::arg<9> _9; - -#else - -boost::arg<1> _1; -boost::arg<2> _2; -boost::arg<3> _3; -boost::arg<4> _4; -boost::arg<5> _5; -boost::arg<6> _6; -boost::arg<7> _7; -boost::arg<8> _8; -boost::arg<9> _9; - -#endif - -} // unnamed namespace - -#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/bind/protect.hpp b/Utilities/BGL/boost/bind/protect.hpp deleted file mode 100644 index b1ff2a2a8e94b14a3c2e243c307faff4b7bae513..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/bind/protect.hpp +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED -#define BOOST_BIND_PROTECT_HPP_INCLUDED - -// -// protect.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// 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) -// - -namespace boost -{ - -namespace _bi -{ - -template<class F> class protected_bind_t -{ -public: - - typedef typename F::result_type result_type; - - explicit protected_bind_t(F f): f_(f) - { - } - - result_type operator()() - { - return f_(); - } - - result_type operator()() const - { - return f_(); - } - - template<class A1> result_type operator()(A1 & a1) - { - return f_(a1); - } - - template<class A1> result_type operator()(A1 & a1) const - { - return f_(a1); - } - - template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) - { - return f_(a1, a2); - } - - template<class A1, class A2> result_type operator()(A1 & a1, A2 & a2) const - { - return f_(a1, a2); - } - - template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) - { - return f_(a1, a2, a3); - } - - template<class A1, class A2, class A3> result_type operator()(A1 & a1, A2 & a2, A3 & a3) const - { - return f_(a1, a2, a3); - } - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) - { - return f_(a1, a2, a3, a4); - } - - template<class A1, class A2, class A3, class A4> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const - { - return f_(a1, a2, a3, a4); - } - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) - { - return f_(a1, a2, a3, a4, a5); - } - - template<class A1, class A2, class A3, class A4, class A5> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const - { - return f_(a1, a2, a3, a4, a5); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) - { - return f_(a1, a2, a3, a4, a5, a6); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const - { - return f_(a1, a2, a3, a4, a5, a6); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) - { - return f_(a1, a2, a3, a4, a5, a6, a7); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const - { - return f_(a1, a2, a3, a4, a5, a6, a7); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } - - template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const - { - return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); - } - -private: - - F f_; -}; - -} // namespace _bi - -template<class F> _bi::protected_bind_t<F> protect(F f) -{ - return _bi::protected_bind_t<F>(f); -} - -} // namespace boost - -#endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/butility/addressof.hpp b/Utilities/BGL/boost/butility/addressof.hpp deleted file mode 100644 index 76294886ad539ea696e1e8a4762b902150f2721b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/butility/addressof.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2002 Brad King (brad.king@kitware.com) -// Douglas Gregor (gregod@cs.rpi.edu) -// Peter Dimov -// -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_UTILITY_ADDRESSOF_HPP -# define BOOST_UTILITY_ADDRESSOF_HPP - -# include <boost/config.hpp> -# include <boost/detail/workaround.hpp> - -namespace boost { - -// Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov) - -// VC7 strips const from nested classes unless we add indirection here -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - -template<class T> struct _addp -{ - typedef T * type; -}; - -template <typename T> typename _addp<T>::type - -# else -template <typename T> T* -# endif -addressof(T& v) -{ - return reinterpret_cast<T*>( - &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); -} - -// Borland doesn't like casting an array reference to a char reference -// but these overloads work around the problem. -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -template<typename T,std::size_t N> -T (*addressof(T (&t)[N]))[N] -{ - return reinterpret_cast<T(*)[N]>(&t); -} - -template<typename T,std::size_t N> -const T (*addressof(const T (&t)[N]))[N] -{ - return reinterpret_cast<const T(*)[N]>(&t); -} -# endif - -} - -#endif // BOOST_UTILITY_ADDRESSOF_HPP diff --git a/Utilities/BGL/boost/butility/in_place_factory.hpp b/Utilities/BGL/boost/butility/in_place_factory.hpp deleted file mode 100644 index 99d181e9f259ec6c63322846f6609fa4f006c22b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/butility/in_place_factory.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. -// -// 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/lib/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -#ifndef BOOST_UTILITY_INPLACE_FACTORY_25AGO2003_HPP -#define BOOST_UTILITY_INPLACE_FACTORY_25AGO2003_HPP - -#include <boost/butility/detail/in_place_factory_prefix.hpp> - -#include <boost/type.hpp> - -namespace boost { - -class in_place_factory_base {} ; - -#define BOOST_DEFINE_INPLACE_FACTORY_CLASS(z,n,_) \ -template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -class BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) : public in_place_factory_base \ -{ \ -public: \ -\ - BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A,const& a) ) \ - : \ - BOOST_PP_ENUM( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _ ) \ - {} \ -\ - template<class T> \ - void apply ( void* address BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T) ) const \ - { \ - new ( address ) T ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), m_a ) ) ; \ - } \ -\ - BOOST_PP_REPEAT( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) \ -} ; \ -\ -template< BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) < BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ -in_place ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A, const& a) ) \ -{ \ - return BOOST_PP_CAT(in_place_factory, BOOST_PP_INC(n) ) < BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ - ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), a ) ) ; \ -} ; \ - -BOOST_PP_REPEAT( BOOST_MAX_INPLACE_FACTORY_ARITY, BOOST_DEFINE_INPLACE_FACTORY_CLASS, BOOST_PP_EMPTY() ) - -} // namespace boost - -#include <boost/butility/detail/in_place_factory_suffix.hpp> - -#endif - diff --git a/Utilities/BGL/boost/butility/typed_in_place_factory.hpp b/Utilities/BGL/boost/butility/typed_in_place_factory.hpp deleted file mode 100644 index f8df6f60e2a40143ebbffdda1368fb988281ee92..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/butility/typed_in_place_factory.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. -// -// 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/lib/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -#ifndef BOOST_UTILITY_TYPED_INPLACE_FACTORY_25AGO2003_HPP -#define BOOST_UTILITY_TYPED_INPLACE_FACTORY_25AGO2003_HPP - -#include <boost/butility/detail/in_place_factory_prefix.hpp> - -namespace boost { - -class typed_in_place_factory_base {} ; - -#define BOOST_DEFINE_TYPED_INPLACE_FACTORY_CLASS(z,n,_) \ -template< class T, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -class BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) : public typed_in_place_factory_base \ -{ \ -public: \ -\ - typedef T value_type ; \ -\ - BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A,const& a) ) \ - : \ - BOOST_PP_ENUM( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _ ) \ - {} \ -\ - void apply ( void* address ) const \ - { \ - new ( address ) T ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), m_a ) ) ; \ - } \ -\ - BOOST_PP_REPEAT( BOOST_PP_INC(n), BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) \ -} ; \ -\ -template< class T, BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(n),class A) > \ -BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) < T , BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ -in_place ( BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_INC(n),A, const& a) ) \ -{ \ - return BOOST_PP_CAT(typed_in_place_factory, BOOST_PP_INC(n) ) < T, BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), A ) > \ - ( BOOST_PP_ENUM_PARAMS( BOOST_PP_INC(n), a ) ) ; \ -} ; \ - -BOOST_PP_REPEAT( BOOST_MAX_INPLACE_FACTORY_ARITY, BOOST_DEFINE_TYPED_INPLACE_FACTORY_CLASS, BOOST_PP_EMPTY() ) - -} // namespace boost - -#include <boost/butility/detail/in_place_factory_suffix.hpp> - -#endif - diff --git a/Utilities/BGL/boost/butility/value_init.hpp b/Utilities/BGL/boost/butility/value_init.hpp deleted file mode 100644 index d9914864d231a3849ecf3198dcbaf794fbcbfb2a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/butility/value_init.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// (C) 2002, Fernando Luis Cacciola Carballal. -// -// 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) -// -// 21 Ago 2002 (Created) Fernando Cacciola -// -#ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP -#define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP - -#include "boost/detail/select_type.hpp" -#include "boost/type_traits/cv_traits.hpp" - -namespace boost { - -namespace vinit_detail { - -template<class T> -class const_T_base -{ - protected : - - const_T_base() : x() {} - - T x ; -} ; - -template<class T> -struct non_const_T_base -{ - protected : - - non_const_T_base() : x() {} - - mutable T x ; -} ; - -template<class T> -struct select_base -{ - typedef typename - detail::if_true< ::boost::is_const<T>::value > - ::template then< const_T_base<T>, non_const_T_base<T> >::type type ; -} ; - -} // namespace vinit_detail - -template<class T> -class value_initialized : private vinit_detail::select_base<T>::type -{ - public : - - value_initialized() {} - - operator T&() const { return this->x ; } - - T& data() const { return this->x ; } - -} ; - -template<class T> -T const& get ( value_initialized<T> const& x ) -{ - return x.data() ; -} -template<class T> -T& get ( value_initialized<T>& x ) -{ - return x.data() ; -} - -} // namespace boost - - -#endif - diff --git a/Utilities/BGL/boost/call_traits.hpp b/Utilities/BGL/boost/call_traits.hpp index 72c6474f5704b339b802f30b7ec4b86fad9e220e..5253a6de587f7dc3e50d5be892cf592dc06d19aa 100644 --- a/Utilities/BGL/boost/call_traits.hpp +++ b/Utilities/BGL/boost/call_traits.hpp @@ -3,7 +3,7 @@ // 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/butility for most recent version including documentation. +// See http://www.boost.org/libs/utility for most recent version including documentation. // See boost/detail/call_traits.hpp and boost/detail/ob_call_traits.hpp // for full copyright notices. diff --git a/Utilities/BGL/boost/checked_delete.hpp b/Utilities/BGL/boost/checked_delete.hpp deleted file mode 100644 index 5fd9ae8bbe65a5632c50e31653701a5b4a134503..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/checked_delete.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED -#define BOOST_CHECKED_DELETE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/checked_delete.hpp -// -// Copyright (c) 2002, 2003 Peter Dimov -// Copyright (c) 2003 Daniel Frey -// Copyright (c) 2003 Howard Hinnant -// -// 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/butility/checked_delete.html for documentation. -// - -namespace boost -{ - -// verify that types are complete for increased safety - -template<class T> inline void checked_delete(T * x) -{ - // intentionally complex - simplification causes regressions - typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; - (void) sizeof(type_must_be_complete); - delete x; -} - -template<class T> inline void checked_array_delete(T * x) -{ - typedef char type_must_be_complete[ sizeof(T)? 1: -1 ]; - (void) sizeof(type_must_be_complete); - delete [] x; -} - -template<class T> struct checked_deleter -{ - typedef void result_type; - typedef T * argument_type; - - void operator()(T * x) const - { - // boost:: disables ADL - boost::checked_delete(x); - } -}; - -template<class T> struct checked_array_deleter -{ - typedef void result_type; - typedef T * argument_type; - - void operator()(T * x) const - { - boost::checked_array_delete(x); - } -}; - -} // namespace boost - -#endif // #ifndef BOOST_CHECKED_DELETE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/compressed_pair.hpp b/Utilities/BGL/boost/compressed_pair.hpp index 24e157b1d4b887fdc97e1c614a25f9d71f17f96d..e6cd6a074a8952caeaa469a424cbe69018c757ce 100644 --- a/Utilities/BGL/boost/compressed_pair.hpp +++ b/Utilities/BGL/boost/compressed_pair.hpp @@ -3,7 +3,7 @@ // 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/butility for most recent version including documentation. +// See http://www.boost.org/libs/utility for most recent version including documentation. // See boost/detail/compressed_pair.hpp and boost/detail/ob_compressed_pair.hpp // for full copyright notices. diff --git a/Utilities/BGL/boost/concept/assert.hpp b/Utilities/BGL/boost/concept/assert.hpp new file mode 100644 index 0000000000000000000000000000000000000000..80eca817ac3c7e2075844e6b77e015f8287879df --- /dev/null +++ b/Utilities/BGL/boost/concept/assert.hpp @@ -0,0 +1,46 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_ASSERT_DWA2006430_HPP +# define BOOST_CONCEPT_ASSERT_DWA2006430_HPP + +# include <boost/config.hpp> +# include <boost/detail/workaround.hpp> + +// The old protocol used a constraints() member function in concept +// checking classes. If the compiler supports SFINAE, we can detect +// that function and seamlessly support the old concept checking +// classes. In this release, backward compatibility with the old +// concept checking classes is enabled by default, where available. +// The old protocol is deprecated, though, and backward compatibility +// will no longer be the default in the next release. + +# if !defined(BOOST_NO_OLD_CONCEPT_SUPPORT) \ + && !defined(BOOST_NO_SFINAE) \ + \ + && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4)) \ + && !(BOOST_WORKAROUND(__GNUC__, == 2)) + +// Note: gcc-2.96 through 3.3.x have some SFINAE, but no ability to +// check for the presence of particularmember functions. + +# define BOOST_OLD_CONCEPT_SUPPORT + +# endif + +# ifdef BOOST_MSVC +# include <boost/concept/detail/msvc.hpp> +# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# include <boost/concept/detail/borland.hpp> +# else +# include <boost/concept/detail/general.hpp> +# endif + + // Usage, in class or function context: + // + // BOOST_CONCEPT_ASSERT((UnaryFunctionConcept<F,bool,int>)); + // +# define BOOST_CONCEPT_ASSERT(ModelInParens) \ + BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens) + +#endif // BOOST_CONCEPT_ASSERT_DWA2006430_HPP diff --git a/Utilities/BGL/boost/concept/detail/borland.hpp b/Utilities/BGL/boost/concept/detail/borland.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59fec55bad0877e8da855c12d492bea708bb5c10 --- /dev/null +++ b/Utilities/BGL/boost/concept/detail/borland.hpp @@ -0,0 +1,29 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP +# define BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP + +# include <boost/preprocessor/cat.hpp> + +namespace boost { namespace concept { + +template <class ModelFnPtr> +struct require; + +template <class Model> +struct require<void(*)(Model)> +{ + enum { instantiate = sizeof((((Model*)0)->~Model()), 3) }; +}; + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ + enum \ + { \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + boost::concept::require<ModelFnPtr>::instantiate \ + } + +}} // namespace boost::concept + +#endif // BOOST_CONCEPT_DETAIL_BORLAND_DWA2006429_HPP diff --git a/Utilities/BGL/boost/concept/detail/concept_def.hpp b/Utilities/BGL/boost/concept/detail/concept_def.hpp new file mode 100644 index 0000000000000000000000000000000000000000..79f628e9990044893fe81ce57f0052d16fd659b2 --- /dev/null +++ b/Utilities/BGL/boost/concept/detail/concept_def.hpp @@ -0,0 +1,51 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP +# define BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP +# include <boost/preprocessor/seq/for_each_i.hpp> +# include <boost/preprocessor/seq/enum.hpp> +# include <boost/preprocessor/comma_if.hpp> +# include <boost/preprocessor/cat.hpp> +#endif // BOOST_CONCEPT_DETAIL_CONCEPT_DEF_DWA200651_HPP + +// BOOST_concept(SomeName, (p1)(p2)...(pN)) +// +// Expands to "template <class p1, class p2, ...class pN> struct SomeName" +// +// Also defines an equivalent SomeNameConcept for backward compatibility. +// Maybe in the next release we can kill off the "Concept" suffix for good. +#if BOOST_WORKAROUND(__GNUC__, <= 3) +# define BOOST_concept(name, params) \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name; /* forward declaration */ \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct BOOST_PP_CAT(name,Concept) \ + : name< BOOST_PP_SEQ_ENUM(params) > \ + { \ + /* at least 2.96 and 3.4.3 both need this */ \ + BOOST_PP_CAT(name,Concept)(); \ + }; \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name +#else +# define BOOST_concept(name, params) \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name; /* forward declaration */ \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct BOOST_PP_CAT(name,Concept) \ + : name< BOOST_PP_SEQ_ENUM(params) > \ + { \ + }; \ + \ + template < BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONCEPT_typename,~,params) > \ + struct name +#endif + +// Helper for BOOST_concept, above. +# define BOOST_CONCEPT_typename(r, ignored, index, t) \ + BOOST_PP_COMMA_IF(index) typename t + diff --git a/Utilities/BGL/boost/concept/detail/concept_undef.hpp b/Utilities/BGL/boost/concept/detail/concept_undef.hpp new file mode 100644 index 0000000000000000000000000000000000000000..713db89123b3f7bcc77fb1a1c9da1032e0f9b0f5 --- /dev/null +++ b/Utilities/BGL/boost/concept/detail/concept_undef.hpp @@ -0,0 +1,5 @@ +// Copyright David Abrahams 2006. 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) +# undef BOOST_concept_typename +# undef BOOST_concept diff --git a/Utilities/BGL/boost/concept/detail/general.hpp b/Utilities/BGL/boost/concept/detail/general.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f36f9c44e908371457a644146e6354bab9f95ddc --- /dev/null +++ b/Utilities/BGL/boost/concept/detail/general.hpp @@ -0,0 +1,66 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP +# define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP + +# include <boost/preprocessor/cat.hpp> + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include <boost/concept/detail/has_constraints.hpp> +# include <boost/mpl/if.hpp> +# endif + +// This implementation works on Comeau and GCC, all the way back to +// 2.95 +namespace boost { namespace concept { + +template <class ModelFn> +struct requirement_; + +namespace detail +{ + template <void(*)()> struct instantiate {}; +} + +template <class Model> +struct requirement +{ + static void failed() { ((Model*)0)->~Model(); } +}; + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + +template <class Model> +struct constraint +{ + static void failed() { ((Model*)0)->constraints(); } +}; + +template <class Model> +struct requirement_<void(*)(Model)> + : mpl::if_< + concept::not_satisfied<Model> + , constraint<Model> + , requirement<Model> + >::type +{}; + +# else + +// For GCC-2.x, these can't have exactly the same name +template <class Model> +struct requirement_<void(*)(Model)> + : requirement<Model> +{}; + +# endif + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ + typedef ::boost::concept::detail::instantiate< \ + &::boost::concept::requirement_<ModelFnPtr>::failed> \ + BOOST_PP_CAT(boost_concept_check,__LINE__) + +}} + +#endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP diff --git a/Utilities/BGL/boost/concept/detail/has_constraints.hpp b/Utilities/BGL/boost/concept/detail/has_constraints.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3112b55514ab27b3672dd9ed7371f507a4fb9c7c --- /dev/null +++ b/Utilities/BGL/boost/concept/detail/has_constraints.hpp @@ -0,0 +1,48 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP +# define BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP + +# include <boost/mpl/bool.hpp> +# include <boost/detail/workaround.hpp> +namespace boost { namespace concept { + +namespace detail +{ + +// Here we implement the metafunction that detects whether a +// constraints metafunction exists + typedef char yes; + typedef char (&no)[2]; + + template <class Model, void (Model::*)()> + struct wrap_constraints {}; + +#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) + // Work around the following bogus error in Sun Studio 11, by + // turning off the has_constraints function entirely: + // Error: complex expression not allowed in dependent template + // argument expression + inline no has_constraints_(...); +#else + template <class Model> + inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0); + inline no has_constraints_(...); +#endif +} + +// This would be called "detail::has_constraints," but it has a strong +// tendency to show up in error messages. +template <class Model> +struct not_satisfied +{ + BOOST_STATIC_CONSTANT( + bool + , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) ); + typedef mpl::bool_<value> type; +}; + +}} // namespace boost::concept::detail + +#endif // BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP diff --git a/Utilities/BGL/boost/concept/detail/msvc.hpp b/Utilities/BGL/boost/concept/detail/msvc.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3aadb792161c66a4e59459154013caba85361db0 --- /dev/null +++ b/Utilities/BGL/boost/concept/detail/msvc.hpp @@ -0,0 +1,92 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_CHECK_MSVC_DWA2006429_HPP +# define BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP + +# include <boost/preprocessor/cat.hpp> + +# ifdef BOOST_OLD_CONCEPT_SUPPORT +# include <boost/concept/detail/has_constraints.hpp> +# include <boost/mpl/if.hpp> +# endif + + +namespace boost { namespace concept { + +template <class Model> +struct check +{ + virtual void failed(Model* x) + { + x->~Model(); + } +}; + +# ifdef BOOST_OLD_CONCEPT_SUPPORT + +namespace detail +{ + // No need for a virtual function here, since evaluating + // not_satisfied below will have already instantiated the + // constraints() member. + struct constraint {}; +} + +template <class Model> +struct require + : mpl::if_c< + not_satisfied<Model>::value + , detail::constraint + , check<Model> + >::type +{}; + +# else + +template <class Model> +struct require + : check<Model> +{}; + +# endif + +# if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + +// +// The iterator library sees some really strange errors unless we +// do things this way. +// +template <class Model> +struct require<void(*)(Model)> +{ + virtual void failed(Model*) + { + require<Model>(); + } +}; + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ +enum \ +{ \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept::require<ModelFnPtr>) \ +} + +# else // Not vc-7.1 + +template <class Model> +require<Model> +require_(void(*)(Model)); + +# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \ +enum \ +{ \ + BOOST_PP_CAT(boost_concept_check,__LINE__) = \ + sizeof(::boost::concept::require_((ModelFnPtr)0)) \ +} + +# endif +}} + +#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP diff --git a/Utilities/BGL/boost/concept/requires.hpp b/Utilities/BGL/boost/concept/requires.hpp new file mode 100644 index 0000000000000000000000000000000000000000..024ba742c9c96bd0dae3e83a5754de36d13910f3 --- /dev/null +++ b/Utilities/BGL/boost/concept/requires.hpp @@ -0,0 +1,78 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_REQUIRES_DWA2006430_HPP +# define BOOST_CONCEPT_REQUIRES_DWA2006430_HPP + +# include <boost/config.hpp> +# include <boost/parameter/aux_/parenthesized_type.hpp> +# include <boost/concept/assert.hpp> +# include <boost/preprocessor/seq/for_each.hpp> + +namespace boost { + +// Template for use in handwritten assertions +template <class Model, class More> +struct requires_ : More +{ +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + typedef typename More::type type; +# endif + BOOST_CONCEPT_ASSERT((Model)); +}; + +// Template for use by macros, where models must be wrapped in parens. +// This isn't in namespace detail to keep extra cruft out of resulting +// error messages. +template <class ModelFn> +struct _requires_ +{ + enum { value = 0 }; + BOOST_CONCEPT_ASSERT_FN(ModelFn); +}; + +template <int check, class Result> +struct Requires_ : ::boost::parameter::aux::unaryfunptr_arg_type<Result> +{ +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + typedef typename ::boost::parameter::aux::unaryfunptr_arg_type<Result>::type type; +# endif +}; + +# if BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(1010)) +# define BOOST_CONCEPT_REQUIRES_(r,data,t) | (::boost::_requires_<void(*)t>::value) +# else +# define BOOST_CONCEPT_REQUIRES_(r,data,t) + (::boost::_requires_<void(*)t>::value) +# endif + +#if defined(NDEBUG) || BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +# define BOOST_CONCEPT_REQUIRES(models, result) \ + typename ::boost::parameter::aux::unaryfunptr_arg_type<void(*)result>::type + +#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + +// Same thing as below without the initial typename +# define BOOST_CONCEPT_REQUIRES(models, result) \ + ::boost::Requires_< \ + (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \ + ::boost::parameter::aux::unaryfunptr_arg_type<void(*)result> \ + >::type + +#else + +// This just ICEs on MSVC6 :( +# define BOOST_CONCEPT_REQUIRES(models, result) \ + typename ::boost::Requires_< \ + (0 BOOST_PP_SEQ_FOR_EACH(BOOST_CONCEPT_REQUIRES_, ~, models)), \ + void(*)result \ + >::type + +#endif + +// C++0x proposed syntax changed. This supports an older usage +#define BOOST_CONCEPT_WHERE(models,result) BOOST_CONCEPT_REQUIRES(models,result) + +} // namespace boost::concept_check + +#endif // BOOST_CONCEPT_REQUIRES_DWA2006430_HPP diff --git a/Utilities/BGL/boost/concept/usage.hpp b/Utilities/BGL/boost/concept/usage.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9af8ca3cc232c3c82354b686e734be9b7b74eebd --- /dev/null +++ b/Utilities/BGL/boost/concept/usage.hpp @@ -0,0 +1,43 @@ +// Copyright David Abrahams 2006. 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_CONCEPT_USAGE_DWA2006919_HPP +# define BOOST_CONCEPT_USAGE_DWA2006919_HPP + +# include <boost/concept/assert.hpp> +# include <boost/detail/workaround.hpp> + +namespace boost { namespace concept { + +# if BOOST_WORKAROUND(__GNUC__, == 2) + +# define BOOST_CONCEPT_USAGE(model) ~model() + +# else + +template <class Model> +struct usage_requirements +{ + ~usage_requirements() { ((Model*)0)->~Model(); } +}; + +# if BOOST_WORKAROUND(__GNUC__, <= 3) + +# define BOOST_CONCEPT_USAGE(model) \ + model(); /* at least 2.96 and 3.4.3 both need this :( */ \ + BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements<model>)); \ + ~model() + +# else + +# define BOOST_CONCEPT_USAGE(model) \ + BOOST_CONCEPT_ASSERT((boost::concept::usage_requirements<model>)); \ + ~model() + +# endif + +# endif + +}} // namespace boost::concept + +#endif // BOOST_CONCEPT_USAGE_DWA2006919_HPP diff --git a/Utilities/BGL/boost/concept_check.hpp b/Utilities/BGL/boost/concept_check.hpp index 8b090d0232cbf3830ce355fc03ed29efbbd4a57d..12ec2ad77525e1fbe0884d7ce12a275f0fafd16e 100644 --- a/Utilities/BGL/boost/concept_check.hpp +++ b/Utilities/BGL/boost/concept_check.hpp @@ -13,234 +13,155 @@ // See http://www.boost.org/libs/concept_check for documentation. #ifndef BOOST_CONCEPT_CHECKS_HPP -#define BOOST_CONCEPT_CHECKS_HPP +# define BOOST_CONCEPT_CHECKS_HPP -#include <boost/config.hpp> -#include <boost/iterator.hpp> -#include <boost/type_traits/conversion_traits.hpp> -#include <utility> -#include <boost/type_traits/conversion_traits.hpp> -#include <boost/static_assert.hpp> -#include <boost/mpl/identity.hpp> +# include <boost/concept/assert.hpp> +# include <boost/iterator.hpp> +# include <boost/type_traits/conversion_traits.hpp> +# include <utility> +# include <boost/type_traits/is_same.hpp> +# include <boost/type_traits/is_void.hpp> +# include <boost/mpl/assert.hpp> +# include <boost/mpl/bool.hpp> +# include <boost/detail/workaround.hpp> +# include <boost/detail/iterator.hpp> -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__) -#define BOOST_FPTR -#else -#define BOOST_FPTR & -#endif - -namespace boost { - -/* - "inline" is used for ignore_unused_variable_warning() - and function_requires() to make sure there is no - overhead with g++. - */ +# include <boost/concept/usage.hpp> +# include <boost/concept/detail/concept_def.hpp> -template <class T> inline void ignore_unused_variable_warning(const T&) { } - -// the unused, defaulted parameter is a workaround for MSVC and Compaq C++ -template <class Concept> -inline void function_requires(mpl::identity<Concept>* = 0) +namespace boost { -#if !defined(NDEBUG) - void (Concept::*x)() = BOOST_FPTR Concept::constraints; - ignore_unused_variable_warning(x); -#endif -} - -#define BOOST_CLASS_REQUIRE(type_var, ns, concept) \ - typedef void (ns::concept <type_var>::* func##type_var##concept)(); \ - template <func##type_var##concept Tp1_> \ - struct concept_checking_##type_var##concept { }; \ - typedef concept_checking_##type_var##concept< \ - BOOST_FPTR ns::concept<type_var>::constraints> \ - concept_checking_typedef_##type_var##concept - -#define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ - typedef void (ns::concept <type_var1,type_var2>::* \ - func##type_var1##type_var2##concept)(); \ - template <func##type_var1##type_var2##concept Tp1_> \ - struct concept_checking_##type_var1##type_var2##concept { }; \ - typedef concept_checking_##type_var1##type_var2##concept< \ - BOOST_FPTR ns::concept<type_var1,type_var2>::constraints> \ - concept_checking_typedef_##type_var1##type_var2##concept - -#define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ - typedef void (ns::concept <tv1,tv2,tv3>::* \ - func##tv1##tv2##tv3##concept)(); \ - template <func##tv1##tv2##tv3##concept Tp1_> \ - struct concept_checking_##tv1##tv2##tv3##concept { }; \ - typedef concept_checking_##tv1##tv2##tv3##concept< \ - BOOST_FPTR ns::concept<tv1,tv2,tv3>::constraints> \ - concept_checking_typedef_##tv1##tv2##tv3##concept - -#define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ - typedef void (ns::concept <tv1,tv2,tv3,tv4>::* \ - func##tv1##tv2##tv3##tv4##concept)(); \ - template <func##tv1##tv2##tv3##tv4##concept Tp1_> \ - struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \ - typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \ - BOOST_FPTR ns::concept<tv1,tv2,tv3,tv4>::constraints> \ - concept_checking_typedef_##tv1##tv2##tv3##tv4##concept - -// NOTE: The BOOST_CLASS_REQUIRES (with an 'S' at the end) is deprecated. - -// The BOOST_CLASS_REQUIRES macros use function pointers as -// template parameters, which VC++ does not support. - -#if defined(BOOST_NO_FUNCTION_PTR_TEMPLATE_PARAMETERS) - -#define BOOST_CLASS_REQUIRES(type_var, concept) -#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) -#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) -#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept) - -#else - -#define BOOST_CLASS_REQUIRES(type_var, concept) \ - typedef void (concept <type_var>::* func##type_var##concept)(); \ - template <func##type_var##concept Tp1_> \ - struct concept_checking_##type_var##concept { }; \ - typedef concept_checking_##type_var##concept< \ - BOOST_FPTR concept <type_var>::constraints> \ - concept_checking_typedef_##type_var##concept - -#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) \ - typedef void (concept <type_var1,type_var2>::* func##type_var1##type_var2##concept)(); \ - template <func##type_var1##type_var2##concept Tp1_> \ - struct concept_checking_##type_var1##type_var2##concept { }; \ - typedef concept_checking_##type_var1##type_var2##concept< \ - BOOST_FPTR concept <type_var1,type_var2>::constraints> \ - concept_checking_typedef_##type_var1##type_var2##concept - -#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) \ - typedef void (concept <type_var1,type_var2,type_var3>::* func##type_var1##type_var2##type_var3##concept)(); \ - template <func##type_var1##type_var2##type_var3##concept Tp1_> \ - struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \ - typedef concept_checking_##type_var1##type_var2##type_var3##concept< \ - BOOST_FPTR concept <type_var1,type_var2,type_var3>::constraints> \ - concept_checking_typedef_##type_var1##type_var2##type_var3##concept - -#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept) \ - typedef void (concept <type_var1,type_var2,type_var3,type_var4>::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \ - template <func##type_var1##type_var2##type_var3##type_var4##concept Tp1_> \ - struct concept_checking_##type_var1##type_var2##type_var3##type_var4##concept { }; \ - typedef concept_checking_##type_var1##type_var2##type_var3##type_var4##concept< \ - BOOST_FPTR concept <type_var1,type_var2,type_var3,type_var4>::constraints> \ - concept_checking_typedef_##type_var1##type_var2##type_var3##type_var4##concept + // + // Backward compatibility + // + + template <class Model> + inline void function_requires(Model* = 0) + { + BOOST_CONCEPT_ASSERT((Model)); + } + template <class T> inline void ignore_unused_variable_warning(T const&) {} + +# define BOOST_CLASS_REQUIRE(type_var, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept<type_var>)) + +# define BOOST_CLASS_REQUIRE2(type_var1, type_var2, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept<type_var1,type_var2>)) + +# define BOOST_CLASS_REQUIRE3(tv1, tv2, tv3, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept<tv1,tv2,tv3>)) + +# define BOOST_CLASS_REQUIRE4(tv1, tv2, tv3, tv4, ns, concept) \ + BOOST_CONCEPT_ASSERT((ns::concept<tv1,tv2,tv3,tv4>)) + + + // + // Begin concept definitions + // + BOOST_concept(Integer, (T)) + { + BOOST_CONCEPT_USAGE(Integer) + { + x.error_type_must_be_an_integer_type(); + } + private: + T x; + }; + + template <> struct Integer<signed char> {}; + template <> struct Integer<unsigned char> {}; + template <> struct Integer<short> {}; + template <> struct Integer<unsigned short> {}; + template <> struct Integer<int> {}; + template <> struct Integer<unsigned int> {}; + template <> struct Integer<long> {}; + template <> struct Integer<unsigned long> {}; +# if defined(BOOST_HAS_LONG_LONG) + template <> struct Integer< ::boost::long_long_type> {}; + template <> struct Integer< ::boost::ulong_long_type> {}; +# elif defined(BOOST_HAS_MS_INT64) + template <> struct Integer<__int64> {}; + template <> struct Integer<unsigned __int64> {}; +# endif -#endif - -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template <class T, class U> -struct require_same { }; - -template <class T> -struct require_same<T,T> { typedef T type; }; -#else -// This version does not perform checking, but will not do any harm. -template <class T, class U> -struct require_same { typedef T type; }; -#endif - - template <class T> - struct IntegerConcept { - void constraints() { -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - x.error_type_must_be_an_integer_type(); -#endif - } - T x; - }; -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <> struct IntegerConcept<short> { void constraints() {} }; - template <> struct IntegerConcept<unsigned short> { void constraints() {} }; - template <> struct IntegerConcept<int> { void constraints() {} }; - template <> struct IntegerConcept<unsigned int> { void constraints() {} }; - template <> struct IntegerConcept<long> { void constraints() {} }; - template <> struct IntegerConcept<unsigned long> { void constraints() {} }; - // etc. -#endif - - template <class T> - struct SignedIntegerConcept { - void constraints() { -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + BOOST_concept(SignedInteger,(T)) { + BOOST_CONCEPT_USAGE(SignedInteger) { x.error_type_must_be_a_signed_integer_type(); -#endif } + private: T x; }; -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <> struct SignedIntegerConcept<short> { void constraints() {} }; - template <> struct SignedIntegerConcept<int> { void constraints() {} }; - template <> struct SignedIntegerConcept<long> { void constraints() {} }; + template <> struct SignedInteger<signed char> { }; + template <> struct SignedInteger<short> {}; + template <> struct SignedInteger<int> {}; + template <> struct SignedInteger<long> {}; # if defined(BOOST_HAS_LONG_LONG) - template <> struct SignedIntegerConcept< ::boost::long_long_type> { void constraints() {} }; -# endif - // etc. -#endif + template <> struct SignedInteger< ::boost::long_long_type> {}; +# elif defined(BOOST_HAS_MS_INT64) + template <> struct SignedInteger<__int64> {}; +# endif - template <class T> - struct UnsignedIntegerConcept { - void constraints() { -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + BOOST_concept(UnsignedInteger,(T)) { + BOOST_CONCEPT_USAGE(UnsignedInteger) { x.error_type_must_be_an_unsigned_integer_type(); -#endif } + private: T x; }; -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <> struct UnsignedIntegerConcept<unsigned short> - { void constraints() {} }; - template <> struct UnsignedIntegerConcept<unsigned int> - { void constraints() {} }; - template <> struct UnsignedIntegerConcept<unsigned long> - { void constraints() {} }; - // etc. -#endif + + template <> struct UnsignedInteger<unsigned char> {}; + template <> struct UnsignedInteger<unsigned short> {}; + template <> struct UnsignedInteger<unsigned int> {}; + template <> struct UnsignedInteger<unsigned long> {}; +# if defined(BOOST_HAS_LONG_LONG) + template <> struct UnsignedInteger< ::boost::ulong_long_type> {}; +# elif defined(BOOST_HAS_MS_INT64) + template <> struct UnsignedInteger<unsigned __int64> {}; +# endif //=========================================================================== // Basic Concepts - template <class TT> - struct DefaultConstructibleConcept + BOOST_concept(DefaultConstructible,(TT)) { - void constraints() { + BOOST_CONCEPT_USAGE(DefaultConstructible) { TT a; // require default constructor ignore_unused_variable_warning(a); } }; - template <class TT> - struct AssignableConcept + BOOST_concept(Assignable,(TT)) { - void constraints() { + BOOST_CONCEPT_USAGE(Assignable) { #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL - a = a; // require assignment operator + a = a; // require assignment operator #endif const_constraints(a); } + private: void const_constraints(const TT& b) { #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL a = b; // const required for argument to assignment +#else + ignore_unused_variable_warning(b); #endif } + private: TT a; }; - template <class TT> - struct CopyConstructibleConcept + + BOOST_concept(CopyConstructible,(TT)) { - void constraints() { + BOOST_CONCEPT_USAGE(CopyConstructible) { TT a(b); // require copy constructor TT* ptr = &a; // require address of operator const_constraints(a); ignore_unused_variable_warning(ptr); } + private: void const_constraints(const TT& a) { TT c(a); // require const copy constructor const TT* ptr = &a; // require const address of operator @@ -250,11 +171,15 @@ struct require_same { typedef T type; }; TT b; }; +#if (defined _MSC_VER) +# pragma warning( push ) +# pragma warning( disable : 4510 ) // default constructor could not be generated +# pragma warning( disable : 4610 ) // object 'class' can never be instantiated - user-defined constructor required +#endif // The SGI STL version of Assignable requires copy constructor and operator= - template <class TT> - struct SGIAssignableConcept + BOOST_concept(SGIAssignable,(TT)) { - void constraints() { + BOOST_CONCEPT_USAGE(SGIAssignable) { TT b(a); #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL a = a; // require assignment operator @@ -262,6 +187,7 @@ struct require_same { typedef T type; }; const_constraints(a); ignore_unused_variable_warning(b); } + private: void const_constraints(const TT& b) { TT c(b); #if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL @@ -271,14 +197,17 @@ struct require_same { typedef T type; }; } TT a; }; +#if (defined _MSC_VER) +# pragma warning( pop ) +#endif - template <class X, class Y> - struct ConvertibleConcept + BOOST_concept(Convertible,(X)(Y)) { - void constraints() { + BOOST_CONCEPT_USAGE(Convertible) { Y y = x; ignore_unused_variable_warning(y); } + private: X x; }; @@ -297,177 +226,166 @@ struct require_same { typedef T type; }; ignore_unused_variable_warning(x); } - template <class TT> - struct EqualityComparableConcept + BOOST_concept(EqualityComparable,(TT)) { - void constraints() { + BOOST_CONCEPT_USAGE(EqualityComparable) { require_boolean_expr(a == b); require_boolean_expr(a != b); } + private: TT a, b; }; - template <class TT> - struct LessThanComparableConcept + BOOST_concept(LessThanComparable,(TT)) { - void constraints() { + BOOST_CONCEPT_USAGE(LessThanComparable) { require_boolean_expr(a < b); } + private: TT a, b; }; // This is equivalent to SGI STL's LessThanComparable. - template <class TT> - struct ComparableConcept + BOOST_concept(Comparable,(TT)) { - void constraints() { + BOOST_CONCEPT_USAGE(Comparable) { require_boolean_expr(a < b); require_boolean_expr(a > b); require_boolean_expr(a <= b); require_boolean_expr(a >= b); } + private: TT a, b; }; -#define BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(OP,NAME) \ - template <class First, class Second> \ - struct NAME { \ - void constraints() { (void)constraints_(); } \ - bool constraints_() { \ - return a OP b; \ - } \ - First a; \ - Second b; \ +#define BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(OP,NAME) \ + BOOST_concept(NAME, (First)(Second)) \ + { \ + BOOST_CONCEPT_USAGE(NAME) { (void)constraints_(); } \ + private: \ + bool constraints_() { return a OP b; } \ + First a; \ + Second b; \ } -#define BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(OP,NAME) \ - template <class Ret, class First, class Second> \ - struct NAME { \ - void constraints() { (void)constraints_(); } \ - Ret constraints_() { \ - return a OP b; \ - } \ - First a; \ - Second b; \ +#define BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(OP,NAME) \ + BOOST_concept(NAME, (Ret)(First)(Second)) \ + { \ + BOOST_CONCEPT_USAGE(NAME) { (void)constraints_(); } \ + private: \ + Ret constraints_() { return a OP b; } \ + First a; \ + Second b; \ } - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOpConcept); - BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOpConcept); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, EqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, NotEqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, LessThanOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, LessEqualOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, GreaterThanOp); + BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, GreaterEqualOp); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOpConcept); - BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOpConcept); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, PlusOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, TimesOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, DivideOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOp); + BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOp); //=========================================================================== // Function Object Concepts - template <class Func, class Return> - struct GeneratorConcept - { - void constraints() { - const Return& r = f(); // require operator() member function - ignore_unused_variable_warning(r); - } - Func f; - }; - - -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <class Func> - struct GeneratorConcept<Func,void> + BOOST_concept(Generator,(Func)(Return)) { - void constraints() { - f(); // require operator() member function - } - Func f; - }; -#endif - - template <class Func, class Return, class Arg> - struct UnaryFunctionConcept - { - // required in case any of our template args are const-qualified: - UnaryFunctionConcept(); - - void constraints() { - r = f(arg); // require operator() - } - Func f; - Arg arg; - Return r; - }; - -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <class Func, class Arg> - struct UnaryFunctionConcept<Func, void, Arg> { - void constraints() { - f(arg); // require operator() - } - Func f; - Arg arg; + BOOST_CONCEPT_USAGE(Generator) { test(is_void<Return>()); } + + private: + void test(boost::mpl::false_) + { + // Do we really want a reference here? + const Return& r = f(); + ignore_unused_variable_warning(r); + } + + void test(boost::mpl::true_) + { + f(); + } + + Func f; }; -#endif - template <class Func, class Return, class First, class Second> - struct BinaryFunctionConcept + BOOST_concept(UnaryFunction,(Func)(Return)(Arg)) { - void constraints() { - r = f(first, second); // require operator() - } - Func f; - First first; - Second second; - Return r; + BOOST_CONCEPT_USAGE(UnaryFunction) { test(is_void<Return>()); } + + private: + void test(boost::mpl::false_) + { + f(arg); // "priming the pump" this way keeps msvc6 happy (ICE) + Return r = f(arg); + ignore_unused_variable_warning(r); + } + + void test(boost::mpl::true_) + { + f(arg); + } + + Func f; + Arg arg; }; -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <class Func, class First, class Second> - struct BinaryFunctionConcept<Func, void, First, Second> + BOOST_concept(BinaryFunction,(Func)(Return)(First)(Second)) { - void constraints() { - f(first, second); // require operator() - } - Func f; - First first; - Second second; + BOOST_CONCEPT_USAGE(BinaryFunction) { test(is_void<Return>()); } + private: + void test(boost::mpl::false_) + { + f(first,second); + Return r = f(first, second); // require operator() + (void)r; + } + + void test(boost::mpl::true_) + { + f(first,second); + } + + Func f; + First first; + Second second; }; -#endif - template <class Func, class Arg> - struct UnaryPredicateConcept + BOOST_concept(UnaryPredicate,(Func)(Arg)) { - void constraints() { + BOOST_CONCEPT_USAGE(UnaryPredicate) { require_boolean_expr(f(arg)); // require operator() returning bool } + private: Func f; Arg arg; }; - template <class Func, class First, class Second> - struct BinaryPredicateConcept + BOOST_concept(BinaryPredicate,(Func)(First)(Second)) { - void constraints() { + BOOST_CONCEPT_USAGE(BinaryPredicate) { require_boolean_expr(f(a, b)); // require operator() returning bool } + private: Func f; First a; Second b; }; // use this when functor is used inside a container class like std::set - template <class Func, class First, class Second> - struct Const_BinaryPredicateConcept { - void constraints() { + BOOST_concept(Const_BinaryPredicate,(Func)(First)(Second)) + : BinaryPredicate<Func, First, Second> + { + BOOST_CONCEPT_USAGE(Const_BinaryPredicate) { const_constraints(f); } + private: void const_constraints(const Func& fun) { - function_requires<BinaryPredicateConcept<Func, First, Second> >(); // operator() must be a const member function require_boolean_expr(fun(a, b)); } @@ -476,581 +394,605 @@ struct require_same { typedef T type; }; Second b; }; - template <class Func, class Return> - struct AdaptableGeneratorConcept + BOOST_concept(AdaptableGenerator,(Func)(Return)) + : Generator<Func, typename Func::result_type> { - void constraints() { typedef typename Func::result_type result_type; - BOOST_STATIC_ASSERT((is_convertible<result_type, Return>::value)); - function_requires< GeneratorConcept<Func, result_type> >(); - } + + BOOST_CONCEPT_USAGE(AdaptableGenerator) + { + BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>)); + } }; - template <class Func, class Return, class Arg> - struct AdaptableUnaryFunctionConcept + BOOST_concept(AdaptableUnaryFunction,(Func)(Return)(Arg)) + : UnaryFunction<Func, typename Func::result_type, typename Func::argument_type> { - void constraints() { typedef typename Func::argument_type argument_type; typedef typename Func::result_type result_type; - BOOST_STATIC_ASSERT((is_convertible<result_type, Return>::value)); - BOOST_STATIC_ASSERT((is_convertible<Arg, argument_type>::value)); - function_requires< UnaryFunctionConcept<Func, result_type, argument_type> >(); - } + + ~AdaptableUnaryFunction() + { + BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>)); + BOOST_CONCEPT_ASSERT((Convertible<Arg, argument_type>)); + } }; - template <class Func, class Return, class First, class Second> - struct AdaptableBinaryFunctionConcept + BOOST_concept(AdaptableBinaryFunction,(Func)(Return)(First)(Second)) + : BinaryFunction< + Func + , typename Func::result_type + , typename Func::first_argument_type + , typename Func::second_argument_type + > { - void constraints() { typedef typename Func::first_argument_type first_argument_type; typedef typename Func::second_argument_type second_argument_type; typedef typename Func::result_type result_type; - BOOST_STATIC_ASSERT((is_convertible<result_type, Return>::value)); - BOOST_STATIC_ASSERT((is_convertible<First, first_argument_type>::value)); - BOOST_STATIC_ASSERT((is_convertible<Second, second_argument_type>::value)); - function_requires< BinaryFunctionConcept<Func, result_type, - first_argument_type, second_argument_type> >(); - } + + ~AdaptableBinaryFunction() + { + BOOST_CONCEPT_ASSERT((Convertible<result_type, Return>)); + BOOST_CONCEPT_ASSERT((Convertible<First, first_argument_type>)); + BOOST_CONCEPT_ASSERT((Convertible<Second, second_argument_type>)); + } }; - template <class Func, class Arg> - struct AdaptablePredicateConcept + BOOST_concept(AdaptablePredicate,(Func)(Arg)) + : UnaryPredicate<Func, Arg> + , AdaptableUnaryFunction<Func, bool, Arg> { - void constraints() { - function_requires< UnaryPredicateConcept<Func, Arg> >(); - function_requires< AdaptableUnaryFunctionConcept<Func, bool, Arg> >(); - } }; - template <class Func, class First, class Second> - struct AdaptableBinaryPredicateConcept + BOOST_concept(AdaptableBinaryPredicate,(Func)(First)(Second)) + : BinaryPredicate<Func, First, Second> + , AdaptableBinaryFunction<Func, bool, First, Second> { - void constraints() { - function_requires< BinaryPredicateConcept<Func, First, Second> >(); - function_requires< AdaptableBinaryFunctionConcept<Func, bool, First, Second> >(); - } }; //=========================================================================== // Iterator Concepts - template <class TT> - struct InputIteratorConcept - { - void constraints() { - function_requires< AssignableConcept<TT> >(); - function_requires< EqualityComparableConcept<TT> >(); - TT j(i); - (void)*i; // require dereference operator -#ifndef BOOST_NO_STD_ITERATOR_TRAITS - // require iterator_traits typedef's - typedef typename std::iterator_traits<TT>::difference_type D; - // Hmm, the following is a bit fragile - //function_requires< SignedIntegerConcept<D> >(); - typedef typename std::iterator_traits<TT>::reference R; - typedef typename std::iterator_traits<TT>::pointer P; - typedef typename std::iterator_traits<TT>::iterator_category C; - function_requires< ConvertibleConcept<C, std::input_iterator_tag> >(); -#endif - ++j; // require preincrement operator - i++; // require postincrement operator - } + BOOST_concept(InputIterator,(TT)) + : Assignable<TT> + , EqualityComparable<TT> + { + typedef typename boost::detail::iterator_traits<TT>::value_type value_type; + typedef typename boost::detail::iterator_traits<TT>::difference_type difference_type; + typedef typename boost::detail::iterator_traits<TT>::reference reference; + typedef typename boost::detail::iterator_traits<TT>::pointer pointer; + typedef typename boost::detail::iterator_traits<TT>::iterator_category iterator_category; + + BOOST_CONCEPT_USAGE(InputIterator) + { + BOOST_CONCEPT_ASSERT((SignedInteger<difference_type>)); + BOOST_CONCEPT_ASSERT((Convertible<iterator_category, std::input_iterator_tag>)); + + TT j(i); + (void)*i; // require dereference operator + ++j; // require preincrement operator + i++; // require postincrement operator + } + private: TT i; }; - template <class TT, class ValueT> - struct OutputIteratorConcept + BOOST_concept(OutputIterator,(TT)(ValueT)) + : Assignable<TT> { - void constraints() { - function_requires< AssignableConcept<TT> >(); + BOOST_CONCEPT_USAGE(OutputIterator) { + ++i; // require preincrement operator i++; // require postincrement operator *i++ = t; // require postincrement and assignment } + private: TT i, j; ValueT t; }; - template <class TT> - struct ForwardIteratorConcept - { - void constraints() { - function_requires< InputIteratorConcept<TT> >(); -#ifndef BOOST_NO_STD_ITERATOR_TRAITS - typedef typename std::iterator_traits<TT>::iterator_category C; - function_requires< ConvertibleConcept<C, std::forward_iterator_tag> >(); - typedef typename std::iterator_traits<TT>::reference reference; - reference r = *i; - ignore_unused_variable_warning(r); -#endif - } - TT i; - }; - - template <class TT> - struct Mutable_ForwardIteratorConcept - { - void constraints() { - function_requires< ForwardIteratorConcept<TT> >(); - *i++ = *i; // require postincrement and assignment - } - TT i; - }; - - template <class TT> - struct BidirectionalIteratorConcept + BOOST_concept(ForwardIterator,(TT)) + : InputIterator<TT> { - void constraints() { - function_requires< ForwardIteratorConcept<TT> >(); -#ifndef BOOST_NO_STD_ITERATOR_TRAITS - typedef typename std::iterator_traits<TT>::iterator_category C; - function_requires< ConvertibleConcept<C, - std::bidirectional_iterator_tag> >(); -#endif - --i; // require predecrement operator - i--; // require postdecrement operator - } - TT i; - }; - - template <class TT> - struct Mutable_BidirectionalIteratorConcept - { - void constraints() { - function_requires< BidirectionalIteratorConcept<TT> >(); - function_requires< Mutable_ForwardIteratorConcept<TT> >(); - *i-- = *i; // require postdecrement and assignment - } - TT i; - }; - - - template <class TT> - struct RandomAccessIteratorConcept - { - void constraints() { - function_requires< BidirectionalIteratorConcept<TT> >(); - function_requires< ComparableConcept<TT> >(); -#ifndef BOOST_NO_STD_ITERATOR_TRAITS - typedef typename std::iterator_traits<TT>::iterator_category C; - function_requires< ConvertibleConcept< C, - std::random_access_iterator_tag> >(); - typedef typename std::iterator_traits<TT>::reference R; -#endif - - i += n; // require assignment addition operator - i = i + n; i = n + i; // require addition with difference type - i -= n; // require assignment subtraction operator - i = i - n; // require subtraction with difference type - n = i - j; // require difference operator - (void)i[n]; // require element access operator - } + BOOST_CONCEPT_USAGE(ForwardIterator) + { + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME ForwardIterator::iterator_category + , std::forward_iterator_tag + >)); + + typename InputIterator<TT>::reference r = *i; + ignore_unused_variable_warning(r); + } + + private: + TT i; + }; + + BOOST_concept(Mutable_ForwardIterator,(TT)) + : ForwardIterator<TT> + { + BOOST_CONCEPT_USAGE(Mutable_ForwardIterator) { + *i++ = *i; // require postincrement and assignment + } + private: + TT i; + }; + + BOOST_concept(BidirectionalIterator,(TT)) + : ForwardIterator<TT> + { + BOOST_CONCEPT_USAGE(BidirectionalIterator) + { + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalIterator::iterator_category + , std::bidirectional_iterator_tag + >)); + + --i; // require predecrement operator + i--; // require postdecrement operator + } + private: + TT i; + }; + + BOOST_concept(Mutable_BidirectionalIterator,(TT)) + : BidirectionalIterator<TT> + , Mutable_ForwardIterator<TT> + { + BOOST_CONCEPT_USAGE(Mutable_BidirectionalIterator) + { + *i-- = *i; // require postdecrement and assignment + } + private: + TT i; + }; + + BOOST_concept(RandomAccessIterator,(TT)) + : BidirectionalIterator<TT> + , Comparable<TT> + { + BOOST_CONCEPT_USAGE(RandomAccessIterator) + { + BOOST_CONCEPT_ASSERT((Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalIterator<TT>::iterator_category + , std::random_access_iterator_tag + >)); + + i += n; // require assignment addition operator + i = i + n; i = n + i; // require addition with difference type + i -= n; // require assignment subtraction operator + i = i - n; // require subtraction with difference type + n = i - j; // require difference operator + (void)i[n]; // require element access operator + } + + private: TT a, b; TT i, j; -#ifndef BOOST_NO_STD_ITERATOR_TRAITS - typename std::iterator_traits<TT>::difference_type n; -#else - std::ptrdiff_t n; -#endif + typename boost::detail::iterator_traits<TT>::difference_type n; }; - template <class TT> - struct Mutable_RandomAccessIteratorConcept + BOOST_concept(Mutable_RandomAccessIterator,(TT)) + : RandomAccessIterator<TT> + , Mutable_BidirectionalIterator<TT> { - void constraints() { - function_requires< RandomAccessIteratorConcept<TT> >(); - function_requires< Mutable_BidirectionalIteratorConcept<TT> >(); - i[n] = *i; // require element access and assignment - } + BOOST_CONCEPT_USAGE(Mutable_RandomAccessIterator) + { + i[n] = *i; // require element access and assignment + } + private: TT i; -#ifndef BOOST_NO_STD_ITERATOR_TRAITS - typename std::iterator_traits<TT>::difference_type n; -#else - std::ptrdiff_t n; -#endif + typename boost::detail::iterator_traits<TT>::difference_type n; }; //=========================================================================== - // Container Concepts - - template <class Container> - struct ContainerConcept - { - typedef typename Container::value_type value_type; - typedef typename Container::difference_type difference_type; - typedef typename Container::size_type size_type; - typedef typename Container::const_reference const_reference; - typedef typename Container::const_pointer const_pointer; - typedef typename Container::const_iterator const_iterator; - - void constraints() { - function_requires< InputIteratorConcept<const_iterator> >(); - function_requires< AssignableConcept<Container> >(); - const_constraints(c); - } - void const_constraints(const Container& cc) { - i = cc.begin(); - i = cc.end(); - n = cc.size(); - n = cc.max_size(); - b = cc.empty(); - } - Container c; - bool b; - const_iterator i; - size_type n; - }; - - template <class Container> - struct Mutable_ContainerConcept - { - typedef typename Container::value_type value_type; - typedef typename Container::reference reference; - typedef typename Container::iterator iterator; - typedef typename Container::pointer pointer; + // Container s + + BOOST_concept(Container,(C)) + : Assignable<C> + { + typedef typename C::value_type value_type; + typedef typename C::difference_type difference_type; + typedef typename C::size_type size_type; + typedef typename C::const_reference const_reference; + typedef typename C::const_pointer const_pointer; + typedef typename C::const_iterator const_iterator; + + BOOST_CONCEPT_USAGE(Container) + { + BOOST_CONCEPT_ASSERT((InputIterator<const_iterator>)); + const_constraints(c); + } + + private: + void const_constraints(const C& cc) { + i = cc.begin(); + i = cc.end(); + n = cc.size(); + n = cc.max_size(); + b = cc.empty(); + } + C c; + bool b; + const_iterator i; + size_type n; + }; + + BOOST_concept(Mutable_Container,(C)) + : Container<C> + { + typedef typename C::reference reference; + typedef typename C::iterator iterator; + typedef typename C::pointer pointer; - void constraints() { - function_requires< ContainerConcept<Container> >(); - function_requires< AssignableConcept<value_type> >(); - function_requires< InputIteratorConcept<iterator> >(); - - i = c.begin(); - i = c.end(); - c.swap(c2); - } - iterator i; - Container c, c2; + BOOST_CONCEPT_USAGE(Mutable_Container) + { + BOOST_CONCEPT_ASSERT(( + Assignable<typename Mutable_Container::value_type>)); + + BOOST_CONCEPT_ASSERT((InputIterator<iterator>)); + + i = c.begin(); + i = c.end(); + c.swap(c2); + } + + private: + iterator i; + C c, c2; }; - template <class ForwardContainer> - struct ForwardContainerConcept + BOOST_concept(ForwardContainer,(C)) + : Container<C> { - void constraints() { - function_requires< ContainerConcept<ForwardContainer> >(); - typedef typename ForwardContainer::const_iterator const_iterator; - function_requires< ForwardIteratorConcept<const_iterator> >(); - } + BOOST_CONCEPT_USAGE(ForwardContainer) + { + BOOST_CONCEPT_ASSERT(( + ForwardIterator< + typename ForwardContainer::const_iterator + >)); + } }; - template <class ForwardContainer> - struct Mutable_ForwardContainerConcept - { - void constraints() { - function_requires< ForwardContainerConcept<ForwardContainer> >(); - function_requires< Mutable_ContainerConcept<ForwardContainer> >(); - typedef typename ForwardContainer::iterator iterator; - function_requires< Mutable_ForwardIteratorConcept<iterator> >(); - } + BOOST_concept(Mutable_ForwardContainer,(C)) + : ForwardContainer<C> + , Mutable_Container<C> + { + BOOST_CONCEPT_USAGE(Mutable_ForwardContainer) + { + BOOST_CONCEPT_ASSERT(( + Mutable_ForwardIterator< + typename Mutable_ForwardContainer::iterator + >)); + } }; - template <class ReversibleContainer> - struct ReversibleContainerConcept - { - typedef typename ReversibleContainer::const_iterator const_iterator; - typedef typename ReversibleContainer::const_reverse_iterator - const_reverse_iterator; - - void constraints() { - function_requires< ForwardContainerConcept<ReversibleContainer> >(); - function_requires< BidirectionalIteratorConcept<const_iterator> >(); - function_requires< - BidirectionalIteratorConcept<const_reverse_iterator> >(); - const_constraints(c); - } - void const_constraints(const ReversibleContainer& cc) { - const_reverse_iterator i = cc.rbegin(); - i = cc.rend(); - } - ReversibleContainer c; - }; - - template <class ReversibleContainer> - struct Mutable_ReversibleContainerConcept - { - typedef typename ReversibleContainer::iterator iterator; - typedef typename ReversibleContainer::reverse_iterator reverse_iterator; - - void constraints() { - function_requires< ReversibleContainerConcept<ReversibleContainer> >(); - function_requires< - Mutable_ForwardContainerConcept<ReversibleContainer> >(); - function_requires< Mutable_BidirectionalIteratorConcept<iterator> >(); - function_requires< - Mutable_BidirectionalIteratorConcept<reverse_iterator> >(); - - reverse_iterator i = c.rbegin(); - i = c.rend(); - } - ReversibleContainer c; - }; - - template <class RandomAccessContainer> - struct RandomAccessContainerConcept + BOOST_concept(ReversibleContainer,(C)) + : ForwardContainer<C> { - typedef typename RandomAccessContainer::size_type size_type; - typedef typename RandomAccessContainer::const_reference const_reference; - typedef typename RandomAccessContainer::const_iterator const_iterator; - typedef typename RandomAccessContainer::const_reverse_iterator + typedef typename + C::const_reverse_iterator const_reverse_iterator; - void constraints() { - function_requires< ReversibleContainerConcept<RandomAccessContainer> >(); - function_requires< RandomAccessIteratorConcept<const_iterator> >(); - function_requires< - RandomAccessIteratorConcept<const_reverse_iterator> >(); - - const_constraints(c); - } - void const_constraints(const RandomAccessContainer& cc) { - const_reference r = cc[n]; - ignore_unused_variable_warning(r); - } - RandomAccessContainer c; - size_type n; - }; - - template <class RandomAccessContainer> - struct Mutable_RandomAccessContainerConcept - { - typedef typename RandomAccessContainer::size_type size_type; - typedef typename RandomAccessContainer::reference reference; - typedef typename RandomAccessContainer::iterator iterator; - typedef typename RandomAccessContainer::reverse_iterator reverse_iterator; - - void constraints() { - function_requires< - RandomAccessContainerConcept<RandomAccessContainer> >(); - function_requires< - Mutable_ReversibleContainerConcept<RandomAccessContainer> >(); - function_requires< Mutable_RandomAccessIteratorConcept<iterator> >(); - function_requires< - Mutable_RandomAccessIteratorConcept<reverse_iterator> >(); - - reference r = c[i]; - ignore_unused_variable_warning(r); - } - size_type i; - RandomAccessContainer c; + BOOST_CONCEPT_USAGE(ReversibleContainer) + { + BOOST_CONCEPT_ASSERT(( + BidirectionalIterator< + typename ReversibleContainer::const_iterator>)); + + BOOST_CONCEPT_ASSERT((BidirectionalIterator<const_reverse_iterator>)); + + const_constraints(c); + } + private: + void const_constraints(const C& cc) + { + const_reverse_iterator i = cc.rbegin(); + i = cc.rend(); + } + C c; + }; + + BOOST_concept(Mutable_ReversibleContainer,(C)) + : Mutable_ForwardContainer<C> + , ReversibleContainer<C> + { + typedef typename C::reverse_iterator reverse_iterator; + + BOOST_CONCEPT_USAGE(Mutable_ReversibleContainer) + { + typedef typename Mutable_ForwardContainer<C>::iterator iterator; + BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator<iterator>)); + BOOST_CONCEPT_ASSERT((Mutable_BidirectionalIterator<reverse_iterator>)); + + reverse_iterator i = c.rbegin(); + i = c.rend(); + } + private: + C c; + }; + + BOOST_concept(RandomAccessContainer,(C)) + : ReversibleContainer<C> + { + typedef typename C::size_type size_type; + typedef typename C::const_reference const_reference; + + BOOST_CONCEPT_USAGE(RandomAccessContainer) + { + BOOST_CONCEPT_ASSERT(( + RandomAccessIterator< + typename RandomAccessContainer::const_iterator + >)); + + const_constraints(c); + } + private: + void const_constraints(const C& cc) + { + const_reference r = cc[n]; + ignore_unused_variable_warning(r); + } + + C c; + size_type n; + }; + + BOOST_concept(Mutable_RandomAccessContainer,(C)) + : Mutable_ReversibleContainer<C> + , RandomAccessContainer<C> + { + private: + typedef Mutable_RandomAccessContainer self; + public: + BOOST_CONCEPT_USAGE(Mutable_RandomAccessContainer) + { + BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<typename self::iterator>)); + BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<typename self::reverse_iterator>)); + + typename self::reference r = c[i]; + ignore_unused_variable_warning(r); + } + + private: + typename Mutable_ReversibleContainer<C>::size_type i; + C c; }; // A Sequence is inherently mutable - template <class Sequence> - struct SequenceConcept - { - - typedef typename Sequence::reference reference; - typedef typename Sequence::const_reference const_reference; - - void constraints() { + BOOST_concept(Sequence,(S)) + : Mutable_ForwardContainer<S> // Matt Austern's book puts DefaultConstructible here, the C++ - // standard places it in Container - // function_requires< DefaultConstructible<Sequence> >(); - function_requires< Mutable_ForwardContainerConcept<Sequence> >(); - function_requires< DefaultConstructibleConcept<Sequence> >(); - - Sequence - c(n), - c2(n, t), - c3(first, last); - - c.insert(p, t); - c.insert(p, n, t); - c.insert(p, first, last); - - c.erase(p); - c.erase(p, q); - - reference r = c.front(); - - ignore_unused_variable_warning(c); - ignore_unused_variable_warning(c2); - ignore_unused_variable_warning(c3); - ignore_unused_variable_warning(r); - const_constraints(c); - } - void const_constraints(const Sequence& c) { - const_reference r = c.front(); - ignore_unused_variable_warning(r); - } - typename Sequence::value_type t; - typename Sequence::size_type n; - typename Sequence::value_type* first, *last; - typename Sequence::iterator p, q; - }; - - template <class FrontInsertionSequence> - struct FrontInsertionSequenceConcept - { - void constraints() { - function_requires< SequenceConcept<FrontInsertionSequence> >(); - - c.push_front(t); - c.pop_front(); - } - FrontInsertionSequence c; - typename FrontInsertionSequence::value_type t; - }; - - template <class BackInsertionSequence> - struct BackInsertionSequenceConcept - { - typedef typename BackInsertionSequence::reference reference; - typedef typename BackInsertionSequence::const_reference const_reference; - - void constraints() { - function_requires< SequenceConcept<BackInsertionSequence> >(); - - c.push_back(t); - c.pop_back(); - reference r = c.back(); - ignore_unused_variable_warning(r); - } - void const_constraints(const BackInsertionSequence& cc) { - const_reference r = cc.back(); - ignore_unused_variable_warning(r); - }; - BackInsertionSequence c; - typename BackInsertionSequence::value_type t; - }; - - template <class AssociativeContainer> - struct AssociativeContainerConcept - { - void constraints() { - function_requires< ForwardContainerConcept<AssociativeContainer> >(); - function_requires< DefaultConstructibleConcept<AssociativeContainer> >(); + // standard places it in Container --JGS + // ... so why aren't we following the standard? --DWA + , DefaultConstructible<S> + { + BOOST_CONCEPT_USAGE(Sequence) + { + S + c(n), + c2(n, t), + c3(first, last); + + c.insert(p, t); + c.insert(p, n, t); + c.insert(p, first, last); + + c.erase(p); + c.erase(p, q); + + typename Sequence::reference r = c.front(); + + ignore_unused_variable_warning(c); + ignore_unused_variable_warning(c2); + ignore_unused_variable_warning(c3); + ignore_unused_variable_warning(r); + const_constraints(c); + } + private: + void const_constraints(const S& c) { + typename Sequence::const_reference r = c.front(); + ignore_unused_variable_warning(r); + } - i = c.find(k); - r = c.equal_range(k); - c.erase(k); - c.erase(i); - c.erase(r.first, r.second); - const_constraints(c); - } - void const_constraints(const AssociativeContainer& cc) { - ci = cc.find(k); - n = cc.count(k); - cr = cc.equal_range(k); - } - typedef typename AssociativeContainer::iterator iterator; - typedef typename AssociativeContainer::const_iterator const_iterator; - - AssociativeContainer c; - iterator i; - std::pair<iterator,iterator> r; - const_iterator ci; - std::pair<const_iterator,const_iterator> cr; - typename AssociativeContainer::key_type k; - typename AssociativeContainer::size_type n; - }; - - template <class UniqueAssociativeContainer> - struct UniqueAssociativeContainerConcept - { - void constraints() { - function_requires< AssociativeContainerConcept<UniqueAssociativeContainer> >(); - - UniqueAssociativeContainer c(first, last); + typename S::value_type t; + typename S::size_type n; + typename S::value_type* first, *last; + typename S::iterator p, q; + }; + + BOOST_concept(FrontInsertionSequence,(S)) + : Sequence<S> + { + BOOST_CONCEPT_USAGE(FrontInsertionSequence) + { + c.push_front(t); + c.pop_front(); + } + private: + S c; + typename S::value_type t; + }; + + BOOST_concept(BackInsertionSequence,(S)) + : Sequence<S> + { + BOOST_CONCEPT_USAGE(BackInsertionSequence) + { + c.push_back(t); + c.pop_back(); + typename BackInsertionSequence::reference r = c.back(); + ignore_unused_variable_warning(r); + const_constraints(c); + } + private: + void const_constraints(const S& cc) { + typename BackInsertionSequence::const_reference + r = cc.back(); + ignore_unused_variable_warning(r); + }; + S c; + typename S::value_type t; + }; + + BOOST_concept(AssociativeContainer,(C)) + : ForwardContainer<C> + , DefaultConstructible<C> + { + typedef typename C::key_type key_type; + typedef typename C::key_compare key_compare; + typedef typename C::value_compare value_compare; + typedef typename C::iterator iterator; + + BOOST_CONCEPT_USAGE(AssociativeContainer) + { + i = c.find(k); + r = c.equal_range(k); + c.erase(k); + c.erase(i); + c.erase(r.first, r.second); + const_constraints(c); + BOOST_CONCEPT_ASSERT((BinaryPredicate<key_compare,key_type,key_type>)); + + typedef typename AssociativeContainer::value_type value_type_; + BOOST_CONCEPT_ASSERT((BinaryPredicate<value_compare,value_type_,value_type_>)); + } - pos_flag = c.insert(t); - c.insert(first, last); - - ignore_unused_variable_warning(c); - } - std::pair<typename UniqueAssociativeContainer::iterator, bool> pos_flag; - typename UniqueAssociativeContainer::value_type t; - typename UniqueAssociativeContainer::value_type* first, *last; - }; - - template <class MultipleAssociativeContainer> - struct MultipleAssociativeContainerConcept - { - void constraints() { - function_requires< AssociativeContainerConcept<MultipleAssociativeContainer> >(); - - MultipleAssociativeContainer c(first, last); + // Redundant with the base concept, but it helps below. + typedef typename C::const_iterator const_iterator; + private: + void const_constraints(const C& cc) + { + ci = cc.find(k); + n = cc.count(k); + cr = cc.equal_range(k); + } + + C c; + iterator i; + std::pair<iterator,iterator> r; + const_iterator ci; + std::pair<const_iterator,const_iterator> cr; + typename C::key_type k; + typename C::size_type n; + }; + + BOOST_concept(UniqueAssociativeContainer,(C)) + : AssociativeContainer<C> + { + BOOST_CONCEPT_USAGE(UniqueAssociativeContainer) + { + C c(first, last); - pos = c.insert(t); - c.insert(first, last); - - ignore_unused_variable_warning(c); - ignore_unused_variable_warning(pos); - } - typename MultipleAssociativeContainer::iterator pos; - typename MultipleAssociativeContainer::value_type t; - typename MultipleAssociativeContainer::value_type* first, *last; - }; - - template <class SimpleAssociativeContainer> - struct SimpleAssociativeContainerConcept - { - void constraints() { - function_requires< AssociativeContainerConcept<SimpleAssociativeContainer> >(); - typedef typename SimpleAssociativeContainer::key_type key_type; - typedef typename SimpleAssociativeContainer::value_type value_type; - typedef typename require_same<key_type, value_type>::type req; - } - }; + pos_flag = c.insert(t); + c.insert(first, last); - template <class SimpleAssociativeContainer> - struct PairAssociativeContainerConcept - { - void constraints() { - function_requires< AssociativeContainerConcept<SimpleAssociativeContainer> >(); - typedef typename SimpleAssociativeContainer::key_type key_type; - typedef typename SimpleAssociativeContainer::value_type value_type; - typedef typename SimpleAssociativeContainer::mapped_type mapped_type; - typedef std::pair<const key_type, mapped_type> required_value_type; - typedef typename require_same<value_type, required_value_type>::type req; - } + ignore_unused_variable_warning(c); + } + private: + std::pair<typename C::iterator, bool> pos_flag; + typename C::value_type t; + typename C::value_type* first, *last; }; - template <class SortedAssociativeContainer> - struct SortedAssociativeContainerConcept + BOOST_concept(MultipleAssociativeContainer,(C)) + : AssociativeContainer<C> { - void constraints() { - function_requires< AssociativeContainerConcept<SortedAssociativeContainer> >(); - function_requires< ReversibleContainerConcept<SortedAssociativeContainer> >(); - - SortedAssociativeContainer - c(kc), - c2(first, last), - c3(first, last, kc); - - p = c.upper_bound(k); - p = c.lower_bound(k); - r = c.equal_range(k); + BOOST_CONCEPT_USAGE(MultipleAssociativeContainer) + { + C c(first, last); - c.insert(p, t); + pos = c.insert(t); + c.insert(first, last); + + ignore_unused_variable_warning(c); + ignore_unused_variable_warning(pos); + } + private: + typename C::iterator pos; + typename C::value_type t; + typename C::value_type* first, *last; + }; + + BOOST_concept(SimpleAssociativeContainer,(C)) + : AssociativeContainer<C> + { + BOOST_CONCEPT_USAGE(SimpleAssociativeContainer) + { + typedef typename C::key_type key_type; + typedef typename C::value_type value_type; + BOOST_MPL_ASSERT((boost::is_same<key_type,value_type>)); + } + }; + + BOOST_concept(PairAssociativeContainer,(C)) + : AssociativeContainer<C> + { + BOOST_CONCEPT_USAGE(PairAssociativeContainer) + { + typedef typename C::key_type key_type; + typedef typename C::value_type value_type; + typedef typename C::mapped_type mapped_type; + typedef std::pair<const key_type, mapped_type> required_value_type; + BOOST_MPL_ASSERT((boost::is_same<value_type,required_value_type>)); + } + }; + + BOOST_concept(SortedAssociativeContainer,(C)) + : AssociativeContainer<C> + , ReversibleContainer<C> + { + BOOST_CONCEPT_USAGE(SortedAssociativeContainer) + { + C + c(kc), + c2(first, last), + c3(first, last, kc); + + p = c.upper_bound(k); + p = c.lower_bound(k); + r = c.equal_range(k); - ignore_unused_variable_warning(c); - ignore_unused_variable_warning(c2); - ignore_unused_variable_warning(c3); - } - void const_constraints(const SortedAssociativeContainer& c) { - kc = c.key_comp(); - vc = c.value_comp(); - - cp = c.upper_bound(k); - cp = c.lower_bound(k); - cr = c.equal_range(k); - } - typename SortedAssociativeContainer::key_compare kc; - typename SortedAssociativeContainer::value_compare vc; - typename SortedAssociativeContainer::value_type t; - typename SortedAssociativeContainer::key_type k; - typedef typename SortedAssociativeContainer::iterator iterator; - typedef typename SortedAssociativeContainer::const_iterator const_iterator; - iterator p; - const_iterator cp; - std::pair<iterator,iterator> r; - std::pair<const_iterator,const_iterator> cr; - typename SortedAssociativeContainer::value_type* first, *last; + c.insert(p, t); + + ignore_unused_variable_warning(c); + ignore_unused_variable_warning(c2); + ignore_unused_variable_warning(c3); + const_constraints(c); + } + + void const_constraints(const C& c) + { + kc = c.key_comp(); + vc = c.value_comp(); + + cp = c.upper_bound(k); + cp = c.lower_bound(k); + cr = c.equal_range(k); + } + + private: + typename C::key_compare kc; + typename C::value_compare vc; + typename C::value_type t; + typename C::key_type k; + typedef typename C::iterator iterator; + typedef typename C::const_iterator const_iterator; + + typedef SortedAssociativeContainer self; + iterator p; + const_iterator cp; + std::pair<typename self::iterator,typename self::iterator> r; + std::pair<typename self::const_iterator,typename self::const_iterator> cr; + typename C::value_type* first, *last; }; // HashedAssociativeContainer } // namespace boost +# include <boost/concept/detail/concept_undef.hpp> + #endif // BOOST_CONCEPT_CHECKS_HPP diff --git a/Utilities/BGL/boost/config.hpp b/Utilities/BGL/boost/config.hpp deleted file mode 100644 index 055a27855b128e7614c3d99758bd899a8cd043b0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/config.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Boost config.hpp configuration header file ------------------------------// - -// (C) Copyright John Maddock 2002. -// 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/libs/config for most recent version. - -// Boost config.hpp policy and rationale documentation has been moved to -// http://www.boost.org/libs/config -// -// CAUTION: This file is intended to be completely stable - -// DO NOT MODIFY THIS FILE! -// - -#ifndef BOOST_CONFIG_HPP -#define BOOST_CONFIG_HPP - -// if we don't have a user config, then use the default location: -#if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG) -# define BOOST_USER_CONFIG <boost/config/user.hpp> -#endif -// include it first: -#ifdef BOOST_USER_CONFIG -# include BOOST_USER_CONFIG -#endif - -// if we don't have a compiler config set, try and find one: -#if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG) && !defined(BOOST_NO_CONFIG) -# include <boost/config/select_compiler_config.hpp> -#endif -// if we have a compiler config, include it now: -#ifdef BOOST_COMPILER_CONFIG -# include BOOST_COMPILER_CONFIG -#endif - -// if we don't have a std library config set, try and find one: -#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) -# include <boost/config/select_stdlib_config.hpp> -#endif -// if we have a std library config, include it now: -#ifdef BOOST_STDLIB_CONFIG -# include BOOST_STDLIB_CONFIG -#endif - -// if we don't have a platform config set, try and find one: -#if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG) && !defined(BOOST_NO_CONFIG) -# include <boost/config/select_platform_config.hpp> -#endif -// if we have a platform config, include it now: -#ifdef BOOST_PLATFORM_CONFIG -# include BOOST_PLATFORM_CONFIG -#endif - -// get config suffix code: -#include <boost/config/suffix.hpp> - -#endif // BOOST_CONFIG_HPP - - - - - - - - - - - diff --git a/Utilities/BGL/boost/config/abi/msvc_prefix.hpp b/Utilities/BGL/boost/config/abi/msvc_prefix.hpp index 3d3905c2148fec50f4a9812d292e16806d96a4a9..97f06cdc0c2eb000fefa1aa35a2d087b1a868c0a 100644 --- a/Utilities/BGL/boost/config/abi/msvc_prefix.hpp +++ b/Utilities/BGL/boost/config/abi/msvc_prefix.hpp @@ -3,6 +3,20 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#pragma pack(push,8) +// +// Boost binaries are built with the compiler's default ABI settings, +// if the user changes their default alignment in the VS IDE then their +// code will no longer be binary compatible with the bjam built binaries +// unless this header is included to force Boost code into a consistent ABI. +// +// Note that inclusion of this header is only necessary for libraries with +// separate source, header only libraries DO NOT need this as long as all +// translation units are built with the same options. +// +#if defined(_M_X64) +# pragma pack(push,16) +#else +# pragma pack(push,8) +#endif diff --git a/Utilities/BGL/boost/config/abi_prefix.hpp b/Utilities/BGL/boost/config/abi_prefix.hpp index 1733dc036b61b11338413da80bf04fe83842b791..3b1347492cab03c0491345bffe8b1c25193f7390 100644 --- a/Utilities/BGL/boost/config/abi_prefix.hpp +++ b/Utilities/BGL/boost/config/abi_prefix.hpp @@ -1,6 +1,6 @@ // abi_prefix header -------------------------------------------------------// -// � Copyright John Maddock 2003 +// (c) Copyright John Maddock 2003 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -18,3 +18,8 @@ #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/Utilities/BGL/boost/config/abi_suffix.hpp b/Utilities/BGL/boost/config/abi_suffix.hpp index 6339da63114cffe8bf34d3b99d62358dde99f0ff..939161662aefd79f0a38fb8a74de8ae26f87a132 100644 --- a/Utilities/BGL/boost/config/abi_suffix.hpp +++ b/Utilities/BGL/boost/config/abi_suffix.hpp @@ -1,6 +1,6 @@ // abi_sufffix header -------------------------------------------------------// -// � Copyright John Maddock 2003 +// (c) Copyright John Maddock 2003 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -10,7 +10,7 @@ // <boost/config/abi_prefix.hpp>. #ifndef BOOST_CONFIG_ABI_PREFIX_HPP -# error Header boost/config/abi_prefix.hpp must only be used after boost/config/abi_prefix.hpp +# error Header boost/config/abi_suffix.hpp must only be used after boost/config/abi_prefix.hpp #else # undef BOOST_CONFIG_ABI_PREFIX_HPP #endif @@ -20,4 +20,8 @@ # include BOOST_ABI_SUFFIX #endif +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/Utilities/BGL/boost/config/auto_link.hpp b/Utilities/BGL/boost/config/auto_link.hpp index 3fbe4173bbdf90b0cb7ded7c797bf55316375b3d..f2eb583f0435111a2ede8d47119448ee63311c27 100644 --- a/Utilities/BGL/boost/config/auto_link.hpp +++ b/Utilities/BGL/boost/config/auto_link.hpp @@ -109,10 +109,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // select toolset if not defined already: // #ifndef BOOST_LIB_TOOLSET -#if defined(BOOST_MSVC) && (BOOST_MSVC == 1200) +// Note: no compilers before 1200 are supported +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) - // vc6: -# define BOOST_LIB_TOOLSET "vc6" +# ifdef UNDER_CE + // vc6: +# define BOOST_LIB_TOOLSET "evc4" +# else + // vc6: +# define BOOST_LIB_TOOLSET "vc6" +# endif #elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) @@ -124,11 +130,21 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // vc71: # define BOOST_LIB_TOOLSET "vc71" -#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400) // vc80: # define BOOST_LIB_TOOLSET "vc80" +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500) + + // vc90: +# define BOOST_LIB_TOOLSET "vc90" + +#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) + + // vc10: +# define BOOST_LIB_TOOLSET "vc100" + #elif defined(__BORLANDC__) // CBuilder 6: diff --git a/Utilities/BGL/boost/config/compiler/borland.hpp b/Utilities/BGL/boost/config/compiler/borland.hpp index 66769bec54ed3183db09c70be9de15869cae29ba..6a7b988d166b9edfbebc4c25a024992d5ee406ae 100644 --- a/Utilities/BGL/boost/config/compiler/borland.hpp +++ b/Utilities/BGL/boost/config/compiler/borland.hpp @@ -9,6 +9,35 @@ // Borland C++ compiler setup: +// +// versions check: +// we don't support Borland prior to version 5.4: +#if __BORLANDC__ < 0x540 +# error "Compiler not supported or configured - please reconfigure" +#endif + +// last known compiler version: +#if (__BORLANDC__ > 0x613) +//# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +//# else +//# pragma message( "Unknown compiler version - please run the configure tests and report the results") +//# endif +#elif (__BORLANDC__ == 0x600) +# error "CBuilderX preview compiler is no longer supported" +#endif + +// +// Support macros to help with standard library detection +#if (__BORLANDC__ < 0x560) || defined(_USE_OLD_RW_STL) +# define BOOST_BCB_WITH_ROGUE_WAVE +#elif __BORLANDC__ < 0x570 +# define BOOST_BCB_WITH_STLPORT +#else +# define BOOST_BCB_WITH_DINKUMWARE +#endif + +// // Version 5.0 and below: # if __BORLANDC__ <= 0x0550 // Borland C++Builder 4 and 5: @@ -23,7 +52,6 @@ #if (__BORLANDC__ <= 0x551) # define BOOST_NO_CV_SPECIALIZATIONS # define BOOST_NO_CV_VOID_SPECIALIZATIONS -# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_DEDUCED_TYPENAME // workaround for missing WCHAR_MAX/WCHAR_MIN: #include <climits> @@ -36,35 +64,37 @@ #endif #endif -// Version 7.0 (Kylix) and below: -#if (__BORLANDC__ <= 0x570) -# define BOOST_NO_SFINAE -# define BOOST_NO_INTEGRAL_INT64_T -# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS -# define BOOST_NO_PRIVATE_IN_AGGREGATE -# define BOOST_NO_USING_TEMPLATE -# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG -# define BOOST_NO_TEMPLATE_TEMPLATES -# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE -# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS - // we shouldn't really need this - but too many things choke - // without it, this needs more investigation: -# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS -# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL -# define BOOST_NO_IS_ABSTRACT +// Borland C++ Builder 6 and below: +#if (__BORLANDC__ <= 0x564) + # ifdef NDEBUG // fix broken <cstring> so that Boost.test works: # include <cstring> # undef strcmp +# endif + // fix broken errno declaration: +# include <errno.h> +# ifndef errno +# define errno errno # endif +#endif + // // new bug in 5.61: -#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x570) +#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x580) // this seems to be needed by the command line compiler, but not the IDE: # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS #endif +// Borland C++ Builder 2006 Update 2 and below: +#if (__BORLANDC__ <= 0x582) +# define BOOST_NO_SFINAE +# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG +# define BOOST_NO_TEMPLATE_TEMPLATES + +# define BOOST_NO_PRIVATE_IN_AGGREGATE + # ifdef _WIN32 # define BOOST_NO_SWPRINTF # elif defined(linux) || defined(__linux__) || defined(__linux) @@ -76,11 +106,93 @@ # endif #endif +#if (__BORLANDC__ <= 0x613) // Beman has asked Alisdair for more info + // we shouldn't really need this - but too many things choke + // without it, this needs more investigation: +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_NO_IS_ABSTRACT +# define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS +# define BOOST_NO_USING_TEMPLATE +# define BOOST_SP_NO_SP_CONVERTIBLE + +// Temporary workaround +#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS +#endif + +// Borland C++ Builder 2008 and below: +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +# define BOOST_NO_NESTED_FRIENDSHIP +# define BOOST_NO_TYPENAME_WITH_CTOR +#if (__BORLANDC__ < 0x600) +# define BOOST_ILLEGAL_CV_REFERENCES +#endif + +// +// Positive Feature detection +// +// Borland C++ Builder 2008 and below: +#if (__BORLANDC__ >= 0x599) +# pragma defineonoption BOOST_CODEGEAR_0X_SUPPORT -Ax +#endif +// +// C++0x Macros: +// +#if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) +# define BOOST_NO_CHAR16_T +# define BOOST_NO_CHAR32_T +# define BOOST_NO_DECLTYPE +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_STATIC_ASSERT +#else +# define BOOST_HAS_ALIGNOF +# define BOOST_HAS_CHAR16_T +# define BOOST_HAS_CHAR32_T +# define BOOST_HAS_DECLTYPE +# define BOOST_HAS_EXPLICIT_CONVERSION_OPS +# define BOOST_HAS_REF_QUALIFIER +# define BOOST_HAS_RVALUE_REFS +# define BOOST_HAS_STATIC_ASSERT +#endif + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported +#define BOOST_NO_VARIADIC_TEMPLATES + +#if __BORLANDC__ >= 0x590 +# define BOOST_HAS_TR1_HASH + +# define BOOST_HAS_MACRO_USE_FACET +#endif + // // Post 0x561 we have long long and stdint.h: #if __BORLANDC__ >= 0x561 # ifndef __NO_LONG_LONG # define BOOST_HAS_LONG_LONG +# else +# define BOOST_NO_LONG_LONG # endif // On non-Win32 platforms let the platform config figure this out: # ifdef _WIN32 @@ -91,7 +203,7 @@ // Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is // defined, then we have 0x560 or greater with the Rogue Wave implementation // which presumably has the std::DBL_MAX bug. -#if ((__BORLANDC__ >= 0x550) && (__BORLANDC__ < 0x560)) || defined(_USE_OLD_RW_STL) +#if defined( BOOST_BCB_WITH_ROGUE_WAVE ) // <climits> is partly broken, some macros define symbols that are really in // namespace std, so you end up having to use illegal constructs like // std::DBL_MAX, as a fix we'll just include float.h and have done with: @@ -124,7 +236,7 @@ // // ABI fixing headers: // -#if __BORLANDC__ < 0x600 // not implemented for version 6 compiler yet +#if __BORLANDC__ != 0x600 // not implemented for version 6 compiler yet #ifndef BOOST_ABI_PREFIX # define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" #endif @@ -142,6 +254,7 @@ #endif // // MSVC compatibility mode does some nasty things: +// TODO: look up if this doesn't apply to the whole 12xx range // #if defined(_MSC_VER) && (_MSC_VER <= 1200) # define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP @@ -150,26 +263,5 @@ #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) -// -// versions check: -// we don't support Borland prior to version 5.4: -#if __BORLANDC__ < 0x540 -# error "Compiler not supported or configured - please reconfigure" -#endif -// -// last known and checked version is 1536 (Builder X preview): -#if (__BORLANDC__ > 1536) -# if defined(BOOST_ASSERT_CONFIG) -# error "Unknown compiler version - please run the configure tests and report the results" -# else -# pragma message( "Unknown compiler version - please run the configure tests and report the results") -# endif -#endif - - - - - - diff --git a/Utilities/BGL/boost/config/compiler/codegear.hpp b/Utilities/BGL/boost/config/compiler/codegear.hpp new file mode 100644 index 0000000000000000000000000000000000000000..698624ece2971f946149f87c322420f9d27ed845 --- /dev/null +++ b/Utilities/BGL/boost/config/compiler/codegear.hpp @@ -0,0 +1,163 @@ +// (C) Copyright John Maddock 2001 - 2003. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002. +// 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. + +// CodeGear C++ compiler setup: + +#if !defined( BOOST_WITH_CODEGEAR_WARNINGS ) +// these warnings occur frequently in optimized template code +# pragma warn -8004 // var assigned value, but never used +# pragma warn -8008 // condition always true/false +# pragma warn -8066 // dead code can never execute +# pragma warn -8104 // static members with ctors not threadsafe +# pragma warn -8105 // reference member in class without ctors +#endif +// +// versions check: +// last known and checked version is 0x620 +#if (__CODEGEARC__ > 0x620) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# else +# pragma message( "Unknown compiler version - please run the configure tests and report the results") +# endif +#endif + +// CodeGear C++ Builder 2009 +#if (__CODEGEARC__ <= 0x613) +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# define BOOST_NO_PRIVATE_IN_AGGREGATE +# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE + // we shouldn't really need this - but too many things choke + // without it, this needs more investigation: +# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +// CodeGear C++ Builder 2010 +#if (__CODEGEARC__ <= 0x620) +# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type +# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member +# define BOOST_NO_USING_TEMPLATE +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +// Temporary hack, until specific MPL preprocessed headers are generated +# define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS + +# ifdef NDEBUG + // fix broken <cstring> so that Boost.test works: +# include <cstring> +# undef strcmp +# endif + // fix broken errno declaration: +# include <errno.h> +# ifndef errno +# define errno errno +# endif + +#endif +// +// C++0x macros: +// +#define BOOST_HAS_CHAR16_T +#define BOOST_HAS_CHAR32_T +#define BOOST_HAS_LONG_LONG +// #define BOOST_HAS_ALIGNOF +#define BOOST_HAS_DECLTYPE +#define BOOST_HAS_EXPLICIT_CONVERSION_OPS +// #define BOOST_HAS_RVALUE_REFS +#define BOOST_HAS_SCOPED_ENUM +// #define BOOST_HAS_STATIC_ASSERT +#define BOOST_HAS_STD_TYPE_TRAITS + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + +// +// TR1 macros: +// +#define BOOST_HAS_TR1_HASH +#define BOOST_HAS_TR1_TYPE_TRAITS +#define BOOST_HAS_TR1_UNORDERED_MAP +#define BOOST_HAS_TR1_UNORDERED_SET + +#define BOOST_HAS_MACRO_USE_FACET + +#define BOOST_NO_INITIALIZER_LISTS + +// On non-Win32 platforms let the platform config figure this out: +#ifdef _WIN32 +# define BOOST_HAS_STDINT_H +#endif + +// +// __int64: +// +#if !defined(__STRICT_ANSI__) +# define BOOST_HAS_MS_INT64 +#endif +// +// check for exception handling support: +// +#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS) +# define BOOST_NO_EXCEPTIONS +#endif +// +// all versions have a <dirent.h>: +// +#if !defined(__STRICT_ANSI__) +# define BOOST_HAS_DIRENT_H +#endif +// +// all versions support __declspec: +// +#if !defined(__STRICT_ANSI__) +# define BOOST_HAS_DECLSPEC +#endif +// +// ABI fixing headers: +// +#ifndef BOOST_ABI_PREFIX +# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp" +#endif +#ifndef BOOST_ABI_SUFFIX +# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp" +#endif +// +// Disable Win32 support in ANSI mode: +// +# pragma defineonoption BOOST_DISABLE_WIN32 -A +// +// MSVC compatibility mode does some nasty things: +// TODO: look up if this doesn't apply to the whole 12xx range +// +#if defined(_MSC_VER) && (_MSC_VER <= 1200) +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# define BOOST_NO_VOID_RETURNS +#endif + +#define BOOST_COMPILER "CodeGear C++ version " BOOST_STRINGIZE(__CODEGEARC__) + diff --git a/Utilities/BGL/boost/config/compiler/comeau.hpp b/Utilities/BGL/boost/config/compiler/comeau.hpp index 1b71008e0fd0bfc170d7324d9f1896007dea2f37..278222dcfdde3a32cbfeb65313b4d3e04a71ba07 100644 --- a/Utilities/BGL/boost/config/compiler/comeau.hpp +++ b/Utilities/BGL/boost/config/compiler/comeau.hpp @@ -24,8 +24,8 @@ # endif // Void returns don't work when emulating VC 6 (Peter Dimov) - -# if defined(_MSC_VER) && (_MSC_VER == 1200) +// TODO: look up if this doesn't apply to the whole 12xx range +# if defined(_MSC_VER) && (_MSC_VER < 1300) # define BOOST_NO_VOID_RETURNS # endif diff --git a/Utilities/BGL/boost/config/compiler/common_edg.hpp b/Utilities/BGL/boost/config/compiler/common_edg.hpp index 0443be1aea2ff9154cbf3a4473a38f679c4b6363..9dc4cef8eb5b31478cd61bde8e68be2715dc9d81 100644 --- a/Utilities/BGL/boost/config/compiler/common_edg.hpp +++ b/Utilities/BGL/boost/config/compiler/common_edg.hpp @@ -50,8 +50,43 @@ # if !defined(__NO_LONG_LONG) # define BOOST_HAS_LONG_LONG +# else +# define BOOST_NO_LONG_LONG # endif +// +// C++0x features +// +// See above for BOOST_NO_LONG_LONG +// +#if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) +// No support for initializer lists +# define BOOST_NO_INITIALIZER_LISTS +#endif + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support diff --git a/Utilities/BGL/boost/config/compiler/compaq_cxx.hpp b/Utilities/BGL/boost/config/compiler/compaq_cxx.hpp index a52e66a29cdf8af54cf3895eba634c23128ac091..b44486c6739f17faed43ff6b6c066f5a1dcd2c9c 100644 --- a/Utilities/BGL/boost/config/compiler/compaq_cxx.hpp +++ b/Utilities/BGL/boost/config/compiler/compaq_cxx.hpp @@ -5,9 +5,9 @@ // See http://www.boost.org for most recent version. -// Dec Alpha True64 C++ compiler setup: +// Tru64 C++ compiler setup (now HP): -#define BOOST_COMPILER "Dec Alpha True64 " BOOST_STRINGIZE(__DECCXX_VER) +#define BOOST_COMPILER "HP Tru64 C++ " BOOST_STRINGIZE(__DECCXX_VER) #include "boost/config/compiler/common_edg.hpp" diff --git a/Utilities/BGL/boost/config/compiler/digitalmars.hpp b/Utilities/BGL/boost/config/compiler/digitalmars.hpp index 32fc71faf5a6fe0089d276874a5276f1e4526984..a01b4c28ec48231c517a132b8a409cba77d835d6 100644 --- a/Utilities/BGL/boost/config/compiler/digitalmars.hpp +++ b/Utilities/BGL/boost/config/compiler/digitalmars.hpp @@ -36,13 +36,57 @@ #define BOOST_HAS_WINTHREADS #endif +#if (__DMC__ >= 0x847) +#define BOOST_HAS_EXPM1 +#define BOOST_HAS_LOG1P +#endif + +// +// Is this really the best way to detect whether the std lib is in namespace std? +// +#include <cstddef> +#if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD) +# define BOOST_NO_STDC_NAMESPACE +#endif + // check for exception handling support: #ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif -#if (__DMC__ < 0x840) +// +// C++0x features +// +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + +#if __DMC__ < 0x800 +#error "Compiler not supported or configured - please reconfigure" +#endif +// +// last known and checked version is ...: +#if (__DMC__ > 0x848) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif diff --git a/Utilities/BGL/boost/config/compiler/gcc.hpp b/Utilities/BGL/boost/config/compiler/gcc.hpp index d94b16b761024992ef43aa672effb0f0b75e7979..6cae94cae679ef7f8705fce838613f1946477930 100644 --- a/Utilities/BGL/boost/config/compiler/gcc.hpp +++ b/Utilities/BGL/boost/config/compiler/gcc.hpp @@ -43,6 +43,10 @@ # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT #elif __GNUC__ == 3 +# if defined (__PATHSCALE__) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +# define BOOST_NO_IS_ABSTRACT +# endif // // gcc-3.x problems: // @@ -55,6 +59,15 @@ # define BOOST_NO_IS_ABSTRACT # endif #endif +#if __GNUC__ < 4 +// +// All problems to gcc-3.x and earlier here: +// +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +# ifdef __OPEN64__ +# define BOOST_NO_IS_ABSTRACT +# endif +#endif #ifndef __EXCEPTIONS # define BOOST_NO_EXCEPTIONS @@ -81,8 +94,94 @@ #if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) #define BOOST_HAS_NRVO #endif +// +// RTTI and typeinfo detection is possible post gcc-4.3: +// +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 403 +# ifndef __GXX_RTTI +# define BOOST_NO_TYPEID +# define BOOST_NO_RTTI +# endif +#endif + +// C++0x features not implemented in any GCC version +// +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS -#define BOOST_COMPILER "GNU C++ version " __VERSION__ +// C++0x features in 4.3.n and later +// +#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__) +// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are +// passed on the command line, which in turn defines +// __GXX_EXPERIMENTAL_CXX0X__. +# define BOOST_HAS_DECLTYPE +# define BOOST_HAS_RVALUE_REFS +# define BOOST_HAS_STATIC_ASSERT +# define BOOST_HAS_VARIADIC_TMPL +#else +# define BOOST_NO_DECLTYPE +# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_STATIC_ASSERT + +// Variadic templates compiler: +// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html +# ifdef __VARIADIC_TEMPLATES +# define BOOST_HAS_VARIADIC_TMPL +# else +# define BOOST_NO_VARIADIC_TEMPLATES +# endif +#endif + +// C++0x features in 4.4.n and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_AUTO_DECLARATIONS +# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CHAR16_T +# define BOOST_NO_CHAR32_T +# define BOOST_NO_DEFAULTED_FUNCTIONS +# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_SCOPED_ENUMS +#endif + +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) +# define BOOST_NO_SFINAE_EXPR +#endif + +// C++0x features in 4.4.1 and later +// +#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40401) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.4.1 +// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 +# define BOOST_NO_SCOPED_ENUMS +#endif + +// C++0x features in 4.5.n and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#endif + +// ConceptGCC compiler: +// http://www.generic-programming.org/software/ConceptGCC/ +#ifdef __GXX_CONCEPTS__ +# define BOOST_HAS_CONCEPTS +# define BOOST_COMPILER "ConceptGCC version " __VERSION__ +#else +# define BOOST_NO_CONCEPTS +#endif + +#ifndef BOOST_COMPILER +# define BOOST_COMPILER "GNU C++ version " __VERSION__ +#endif // // versions check: @@ -91,8 +190,8 @@ # error "Compiler not configured - please reconfigure" #endif // -// last known and checked version is 4.0 (Pre-release): -#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 0)) +// last known and checked version is 4.4 (Pre-release): +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 4)) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/Utilities/BGL/boost/config/compiler/gcc_xml.hpp b/Utilities/BGL/boost/config/compiler/gcc_xml.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5dd67c760402aa46a30ff5fbf628e71ca0e3a7c0 --- /dev/null +++ b/Utilities/BGL/boost/config/compiler/gcc_xml.hpp @@ -0,0 +1,30 @@ +// (C) Copyright John Maddock 2006. +// 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. + +// GCC-XML C++ compiler setup: + +# if !defined(__GCCXML_GNUC__) || ((__GCCXML_GNUC__ <= 3) && (__GCCXML_GNUC_MINOR__ <= 3)) +# define BOOST_NO_IS_ABSTRACT +# endif + +// +// Threading support: Turn this on unconditionally here (except for +// those platforms where we can know for sure). It will get turned off again +// later if no threading API is detected. +// +#if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(linux) && !defined(__linux) && !defined(__linux__) +# define BOOST_HAS_THREADS +#endif + +// +// gcc has "long long" +// +#define BOOST_HAS_LONG_LONG + +#define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ + + diff --git a/Utilities/BGL/boost/config/compiler/hp_acc.hpp b/Utilities/BGL/boost/config/compiler/hp_acc.hpp index 3d05ba5635ad474b49d43ab56dde73ab9c403c72..98e7772af281522d6c94898b5bf8f84dc445dd49 100644 --- a/Utilities/BGL/boost/config/compiler/hp_acc.hpp +++ b/Utilities/BGL/boost/config/compiler/hp_acc.hpp @@ -3,6 +3,7 @@ // (C) Copyright Aleksey Gurtovoy 2002. // (C) Copyright David Abrahams 2002 - 2003. // (C) Copyright Toon Knapen 2003. +// (C) Copyright Boris Gubenko 2006 - 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) @@ -11,6 +12,10 @@ // HP aCC C++ compiler setup: +#if defined(__EDG__) +#include "boost/config/compiler/common_edg.hpp" +#endif + #if (__HP_aCC <= 33100) # define BOOST_NO_INTEGRAL_INT64_T # define BOOST_NO_OPERATORS_IN_NAMESPACE @@ -27,14 +32,17 @@ # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE #endif -#if (__HP_aCC <= 33900) || !defined(BOOST_STRICT_CONFIG) +#if (__HP_aCC <= 38000) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +#if (__HP_aCC > 50000) && (__HP_aCC < 60000) # define BOOST_NO_UNREACHABLE_RETURN_DETECTION # define BOOST_NO_TEMPLATE_TEMPLATES # define BOOST_NO_SWPRINTF # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_IS_ABSTRACT -// std lib config should set this one already: -//# define BOOST_NO_STD_ALLOCATOR +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif // optional features rather than defects: @@ -47,24 +55,73 @@ # define BOOST_NO_MEMBER_TEMPLATE_KEYWORD #endif -#define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +// This macro should not be defined when compiling in strict ansi +// mode, but, currently, we don't have the ability to determine +// what standard mode we are compiling with. Some future version +// of aCC6 compiler will provide predefined macros reflecting the +// compilation options, including the standard mode. +#if (__HP_aCC >= 60000) || ((__HP_aCC > 38000) && defined(__hpxstd98)) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif #define BOOST_COMPILER "HP aCC version " BOOST_STRINGIZE(__HP_aCC) // // versions check: -// we don't support HP aCC prior to version 0: +// we don't support HP aCC prior to version 33000: #if __HP_aCC < 33000 # error "Compiler not supported or configured - please reconfigure" #endif + // -// last known and checked version is 0: -#if (__HP_aCC > 53800) -# if defined(BOOST_ASSERT_CONFIG) -# error "Unknown compiler version - please run the configure tests and report the results" -# endif +// Extended checks for supporting aCC on PA-RISC +#if __HP_aCC > 30000 && __HP_aCC < 50000 +# if __HP_aCC < 38000 + // versions prior to version A.03.80 not supported +# error "Compiler version not supported - version A.03.80 or higher is required" +# elif !defined(__hpxstd98) + // must compile using the option +hpxstd98 with version A.03.80 and above +# error "Compiler option '+hpxstd98' is required for proper support" +# endif //PA-RISC #endif +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#if !defined(__EDG__) +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES +#endif - +// +// last known and checked version for HP-UX/ia64 is 61300 +// last known and checked version for PA-RISC is 38000 +#if ((__HP_aCC > 61300) || ((__HP_aCC > 38000) && defined(__hpxstd98))) +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown compiler version - please run the configure tests and report the results" +# endif +#endif diff --git a/Utilities/BGL/boost/config/compiler/intel.hpp b/Utilities/BGL/boost/config/compiler/intel.hpp index d47c345a5e69da1fd5c31c2eaef5d2b531a58128..531242e9642b28258673cb5b68e3756e21e11b14 100644 --- a/Utilities/BGL/boost/config/compiler/intel.hpp +++ b/Utilities/BGL/boost/config/compiler/intel.hpp @@ -1,13 +1,13 @@ -// (C) Copyright John Maddock 2001. -// (C) Copyright Peter Dimov 2001. -// (C) Copyright Jens Maurer 2001. -// (C) Copyright David Abrahams 2002 - 2003. -// (C) Copyright Aleksey Gurtovoy 2002 - 2003. -// (C) Copyright Guillaume Melquiond 2002 - 2003. -// (C) Copyright Beman Dawes 2003. -// (C) Copyright Martin Wille 2003. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright John Maddock 2001-8. +// (C) Copyright Peter Dimov 2001. +// (C) Copyright Jens Maurer 2001. +// (C) Copyright David Abrahams 2002 - 2003. +// (C) Copyright Aleksey Gurtovoy 2002 - 2003. +// (C) Copyright Guillaume Melquiond 2002 - 2003. +// (C) Copyright Beman Dawes 2003. +// (C) Copyright Martin Wille 2003. +// 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. @@ -79,9 +79,9 @@ // supports wchar_t natively. *BUT* there is a problem here: the standard // headers define this macro if they typedef wchar_t. Anyway, we're lucky // because they define it without a value, while Intel C++ defines it -// to 1. So we can check its value to see if the macro was defined natively -// or not. -// Under UNIX, the situation is exactly the same, but the macro _WCHAR_T +// to 1. So we can check its value to see if the macro was defined natively +// or not. +// Under UNIX, the situation is exactly the same, but the macro _WCHAR_T // is used instead. # if ((_WCHAR_T_DEFINED + 0) == 0) && ((_WCHAR_T + 0) == 0) # define BOOST_NO_INTRINSIC_WCHAR_T @@ -90,13 +90,19 @@ #if defined(__GNUC__) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) // -// Figure out when Intel is emulating this gcc bug: +// Figure out when Intel is emulating this gcc bug +// (All Intel versions prior to 9.0.26, and versions +// later than that if they are set up to emulate gcc 3.2 +// or earlier): // -# if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL <= 900) +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL < 900) || (__INTEL_COMPILER_BUILD_DATE < 20050912) # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # endif #endif - +#if (defined(__GNUC__) && (__GNUC__ < 4)) || defined(_WIN32) || (BOOST_INTEL_CXX_VERSION <= 1110) +// GCC or VC emulation: +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif // // Verify that we have actually got BOOST_NO_INTRINSIC_WCHAR_T // set correctly, if we don't do this now, we will get errors later @@ -122,6 +128,7 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {}; # define BOOST_HAS_MS_INT64 # endif # define BOOST_NO_SWPRINTF +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP #elif defined(_WIN32) # define BOOST_DISABLE_WIN32 #endif @@ -139,17 +146,28 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {}; #if BOOST_INTEL_CXX_VERSION < 500 # error "Compiler not supported or configured - please reconfigure" #endif + +// Intel on MacOS requires +#if defined(__APPLE__) && defined(__INTEL_COMPILER) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +// Intel on Altix Itanium +#if defined(__itanium__) && defined(__INTEL_COMPILER) +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + // // last known and checked version: -#if (BOOST_INTEL_CXX_VERSION > 900) +#if (BOOST_INTEL_CXX_VERSION > 1110) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) -# pragma message("Unknown compiler version - please run the configure tests and report the results") +// +// We don't emit this warning any more, since we have so few +// defect macros set anyway (just the one). +// +//# pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif - - - - diff --git a/Utilities/BGL/boost/config/compiler/kai.hpp b/Utilities/BGL/boost/config/compiler/kai.hpp index de16f1a67583ae58c59e1114e7e99379be11583b..ea06f9f4d06741dddbd4d7e5f7e47dcd9b8267c9 100644 --- a/Utilities/BGL/boost/config/compiler/kai.hpp +++ b/Utilities/BGL/boost/config/compiler/kai.hpp @@ -21,8 +21,6 @@ # define BOOST_NO_EXCEPTIONS # endif -#define BOOST_COMPILER "Kai C++ version " BOOST_STRINGIZE(__KCC_VERSION) - // // last known and checked version is 4001: #if (__KCC_VERSION > 4001) diff --git a/Utilities/BGL/boost/config/compiler/metrowerks.hpp b/Utilities/BGL/boost/config/compiler/metrowerks.hpp index f173295eb840e6904c8f3759d7323ad9822c430b..aeba7f805c82fae5bd44b452ca6c75654161f75f 100644 --- a/Utilities/BGL/boost/config/compiler/metrowerks.hpp +++ b/Utilities/BGL/boost/config/compiler/metrowerks.hpp @@ -39,7 +39,7 @@ // the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last // tested version *only*: -# if(__MWERKS__ <= 0x3206) || !defined(BOOST_STRICT_CONFIG) // 9.5 +# if(__MWERKS__ <= 0x3207) || !defined(BOOST_STRICT_CONFIG) // 9.6 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_IS_ABSTRACT # endif @@ -73,6 +73,8 @@ # define BOOST_COMPILER_VERSION 9.4 # elif __MWERKS__ == 0x3206 # define BOOST_COMPILER_VERSION 9.5 +# elif __MWERKS__ == 0x3207 +# define BOOST_COMPILER_VERSION 9.6 # else # define BOOST_COMPILER_VERSION __MWERKS__ # endif @@ -80,6 +82,39 @@ # define BOOST_COMPILER_VERSION __MWERKS__ #endif +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#if __MWERKS__ > 0x3206 && __option(rvalue_refs) +# define BOOST_HAS_RVALUE_REFS +#else +# define BOOST_NO_RVALUE_REFERENCES +#endif +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // diff --git a/Utilities/BGL/boost/config/compiler/mpw.hpp b/Utilities/BGL/boost/config/compiler/mpw.hpp index 8ab2aacb6e7eedbcb957a44ff3ca1822d985039b..4db14ddef3a22380c6f70b2c634b1a926356a614 100644 --- a/Utilities/BGL/boost/config/compiler/mpw.hpp +++ b/Utilities/BGL/boost/config/compiler/mpw.hpp @@ -32,8 +32,38 @@ # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */ + #endif +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + // // versions check: // we don't support MPW prior to version 8.9: diff --git a/Utilities/BGL/boost/config/compiler/pgi.hpp b/Utilities/BGL/boost/config/compiler/pgi.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e40553efc04e18d3775f64cdbcbcdd9baaa82628 --- /dev/null +++ b/Utilities/BGL/boost/config/compiler/pgi.hpp @@ -0,0 +1,62 @@ +// (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(_COMPILER_VERSION) + +// +// Threading support: +// Turn this on unconditionally here, it will get turned off again later +// if no threading API is detected. +// + +#if (__PGIC__ >= 7) + +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_SWPRINTF + +#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_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + +// +// version check: +// probably nothing to do here? + diff --git a/Utilities/BGL/boost/config/compiler/sgi_mipspro.hpp b/Utilities/BGL/boost/config/compiler/sgi_mipspro.hpp index 689b67eeb184f5fe23f8bda28e611c17ec4393b1..90688314ad5b5ccb88d3487be827730abb5ee61c 100644 --- a/Utilities/BGL/boost/config/compiler/sgi_mipspro.hpp +++ b/Utilities/BGL/boost/config/compiler/sgi_mipspro.hpp @@ -17,6 +17,11 @@ // if no threading API is detected. // #define BOOST_HAS_THREADS +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP + +#undef BOOST_NO_SWPRINTF +#undef BOOST_DEDUCED_TYPENAME + // // version check: // probably nothing to do here? diff --git a/Utilities/BGL/boost/config/compiler/sunpro_cc.hpp b/Utilities/BGL/boost/config/compiler/sunpro_cc.hpp index eca19feb0bc536252172b827defacce1e50f53a5..f5184887f11ece05b826b4b8a020384afae34019 100644 --- a/Utilities/BGL/boost/config/compiler/sunpro_cc.hpp +++ b/Utilities/BGL/boost/config/compiler/sunpro_cc.hpp @@ -40,7 +40,7 @@ // initialized in-class. // >> Assertion: (../links/dbg_cstabs.cc, line 611) // while processing ../test.cpp at line 0. - // (Jens Maurer according to Gottfried Gan�auge 04 Mar 2002) + // (Jens Maurer according to Gottfried Ganssauge 04 Mar 2002) # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION // SunPro 5.3 has better support for partial specialization, @@ -64,9 +64,55 @@ # define BOOST_NO_INCLASS_MEMBER_INITIALIZATION # define BOOST_NO_SFINAE # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +# endif +# if (__SUNPRO_CC <= 0x580) # define BOOST_NO_IS_ABSTRACT # endif +// +// Issues that effect all known versions: +// +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_ADL_BARRIER + +// +// C++0x features +// + +#if(__SUNPRO_CC >= 0x590) +# define BOOST_HAS_LONG_LONG +#else +# define BOOST_NO_LONG_LONG +#endif + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + +// +// Version +// + #define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC) // @@ -76,15 +122,9 @@ #error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 0x570: -#if (__SUNPRO_CC > 0x570) +// last known and checked version is 0x590: +#if (__SUNPRO_CC > 0x590) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif - - - - - - diff --git a/Utilities/BGL/boost/config/compiler/vacpp.hpp b/Utilities/BGL/boost/config/compiler/vacpp.hpp index 4cf0de7c19022bd0f5e4214c3e77fada33efb95e..01956d3a7026142a68581747587bbc851595482b 100644 --- a/Utilities/BGL/boost/config/compiler/vacpp.hpp +++ b/Utilities/BGL/boost/config/compiler/vacpp.hpp @@ -1,7 +1,7 @@ // (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Toon Knapen 2001 - 2003. // (C) Copyright Lie-Quan Lee 2001. -// (C) Copyright Markus Sch�pflin 2002 - 2003. +// (C) Copyright Markus Schoepflin 2002 - 2003. // (C) Copyright Beman Dawes 2002 - 2003. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file @@ -27,7 +27,7 @@ #if (__IBMCPP__ <= 600) || !defined(BOOST_STRICT_CONFIG) # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS -# define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES 1 +# define BOOST_NO_INITIALIZER_LISTS #endif // @@ -47,12 +47,42 @@ #endif // // last known and checked version is 600: -#if (__IBMCPP__ > 600) +#if (__IBMCPP__ > 1010) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif #endif +// Some versions of the compiler have issues with default arguments on partial specializations +#define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS + +// +// C++0x features +// +// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG +// +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DECLTYPE +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES diff --git a/Utilities/BGL/boost/config/compiler/visualc.hpp b/Utilities/BGL/boost/config/compiler/visualc.hpp index aa8ce21046e02cdfc0e244c43e8f5e22c6fec81b..990901f0489871fbba8854700befdc4f53785955 100644 --- a/Utilities/BGL/boost/config/compiler/visualc.hpp +++ b/Utilities/BGL/boost/config/compiler/visualc.hpp @@ -14,6 +14,12 @@ #define BOOST_MSVC _MSC_VER +#if _MSC_FULL_VER > 100000000 +# define BOOST_MSVC_FULL_VER _MSC_FULL_VER +#else +# define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) +#endif + // turn off the warnings before we #include anything #pragma warning( disable : 4503 ) // warning: decorated name length exceeded @@ -22,6 +28,11 @@ # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE + +# if BOOST_MSVC == 1202 +# define BOOST_NO_STD_TYPEINFO +# endif + // disable min/max macro defines on vc6: // #endif @@ -56,6 +67,7 @@ # define BOOST_NO_SFINAE # define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS # define BOOST_NO_IS_ABSTRACT +# define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS @@ -63,7 +75,14 @@ #endif -#if _MSC_VER < 1310 // 1310 == VC++ 7.1 +#if _MSC_VER < 1400 +// although a conforming signature for swprint exists in VC7.1 +// it appears not to actually work: +# define BOOST_NO_SWPRINTF +#endif + +#if defined(UNDER_CE) +// Windows CE does not have a conforming signature for swprintf # define BOOST_NO_SWPRINTF #endif @@ -71,18 +90,32 @@ # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif +#if _MSC_VER <= 1600 // 1600 == VC++ 10.0 +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif + +#if _MSC_VER == 1500 // 1500 == VC++ 9.0 + // A bug in VC9: +# define BOOST_NO_ADL_BARRIER +#endif + +#if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 +# define BOOST_NO_INITIALIZER_LISTS +#endif + #ifndef _NATIVE_WCHAR_T_DEFINED # define BOOST_NO_INTRINSIC_WCHAR_T #endif -#ifdef _WIN32_WCE +#if defined(_WIN32_WCE) || defined(UNDER_CE) # define BOOST_NO_THREADEX # define BOOST_NO_GETSYSTEMTIMEASFILETIME +# define BOOST_NO_SWPRINTF #endif // // check for exception handling support: -#ifndef _CPPUNWIND +#ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif @@ -92,21 +125,65 @@ #if (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 #endif -#if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) +#if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1500)) # define BOOST_HAS_LONG_LONG +#else +# define BOOST_NO_LONG_LONG +#endif +#if (_MSC_VER >= 1400) && !defined(_DEBUG) +# define BOOST_HAS_NRVO #endif // // disable Win32 API's if compiler extentions are // turned off: // -#ifndef _MSC_EXTENSIONS +#if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32) # define BOOST_DISABLE_WIN32 #endif +#if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI) +# define BOOST_NO_RTTI +#endif // // all versions support __declspec: // #define BOOST_HAS_DECLSPEC + +// +// C++0x features +// +// See above for BOOST_NO_LONG_LONG + +// C++ features supported by VC++ 10 (aka 2010) +// +#if _MSC_VER < 1600 +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_DECLTYPE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_STATIC_ASSERT +#endif // _MSC_VER < 1600 + +// C++0x features not supported by any versions +#define BOOST_NO_CHAR16_T +#define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_VARIADIC_TEMPLATES + // // prefix and suffix headers: // @@ -128,9 +205,18 @@ // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 -# error unknown CE compiler +# elif _MSC_VER == 1400 +# define BOOST_COMPILER_VERSION evc8 +# elif _MSC_VER == 1500 +# define BOOST_COMPILER_VERSION evc9 +# elif _MSC_VER == 1600 +# define BOOST_COMPILER_VERSION evc10 # else -# error unknown CE compiler +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown EVC++ compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") +# endif # endif # else # if _MSC_VER < 1200 @@ -144,6 +230,10 @@ # define BOOST_COMPILER_VERSION 7.1 # elif _MSC_VER == 1400 # define BOOST_COMPILER_VERSION 8.0 +# elif _MSC_VER == 1500 +# define BOOST_COMPILER_VERSION 9.0 +# elif _MSC_VER == 1600 +# define BOOST_COMPILER_VERSION 10.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif @@ -158,8 +248,8 @@ #error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 1400 (VC8): -#if (_MSC_VER > 1400) +// last known and checked version is 1600 (VC10, aka 2010): +#if (_MSC_VER > 1600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/Utilities/BGL/boost/config/no_tr1/cmath.hpp b/Utilities/BGL/boost/config/no_tr1/cmath.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d8268d842a78c04513614dea908446b0649755e3 --- /dev/null +++ b/Utilities/BGL/boost/config/no_tr1/cmath.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2008. +// 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) +// +// The aim of this header is just to include <cmath> but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/cmath is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_CMATH +# define BOOST_CONFIG_CMATH + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_CMATH_RECURSION +# endif + +# include <cmath> + +# ifdef BOOST_CONFIG_NO_CMATH_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_CMATH_RECURSION +# endif + +#endif diff --git a/Utilities/BGL/boost/config/no_tr1/complex.hpp b/Utilities/BGL/boost/config/no_tr1/complex.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ca200922b3cb89e9c8dfd57d86c950ea34b88a2c --- /dev/null +++ b/Utilities/BGL/boost/config/no_tr1/complex.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include <complex> but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/complex is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_COMPLEX +# define BOOST_CONFIG_COMPLEX + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_COMPLEX_RECURSION +# endif + +# include <complex> + +# ifdef BOOST_CONFIG_NO_COMPLEX_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_COMPLEX_RECURSION +# endif + +#endif diff --git a/Utilities/BGL/boost/config/no_tr1/functional.hpp b/Utilities/BGL/boost/config/no_tr1/functional.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e395efc1977dfc4c8a09c5a20d15bc28f424ddbb --- /dev/null +++ b/Utilities/BGL/boost/config/no_tr1/functional.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include <functional> but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/functional is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_FUNCTIONAL +# define BOOST_CONFIG_FUNCTIONAL + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_FUNCTIONAL_RECURSION +# endif + +# include <functional> + +# ifdef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_FUNCTIONAL_RECURSION +# endif + +#endif diff --git a/Utilities/BGL/boost/config/no_tr1/memory.hpp b/Utilities/BGL/boost/config/no_tr1/memory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2b5d2080272cfb3f7bd5c29789906343cb4638ca --- /dev/null +++ b/Utilities/BGL/boost/config/no_tr1/memory.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include <memory> but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/memory is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_MEMORY +# define BOOST_CONFIG_MEMORY + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_MEMORY_RECURSION +# endif + +# include <memory> + +# ifdef BOOST_CONFIG_NO_MEMORY_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_MEMORY_RECURSION +# endif + +#endif diff --git a/Utilities/BGL/boost/config/no_tr1/utility.hpp b/Utilities/BGL/boost/config/no_tr1/utility.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dea8f115bce50e06559587ecfcdf9d8a5acd283b --- /dev/null +++ b/Utilities/BGL/boost/config/no_tr1/utility.hpp @@ -0,0 +1,28 @@ +// (C) Copyright John Maddock 2005. +// 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) +// +// The aim of this header is just to include <utility> but to do +// so in a way that does not result in recursive inclusion of +// the Boost TR1 components if boost/tr1/tr1/utility is in the +// include search path. We have to do this to avoid circular +// dependencies: +// + +#ifndef BOOST_CONFIG_UTILITY +# define BOOST_CONFIG_UTILITY + +# ifndef BOOST_TR1_NO_RECURSION +# define BOOST_TR1_NO_RECURSION +# define BOOST_CONFIG_NO_UTILITY_RECURSION +# endif + +# include <utility> + +# ifdef BOOST_CONFIG_NO_UTILITY_RECURSION +# undef BOOST_TR1_NO_RECURSION +# undef BOOST_CONFIG_NO_UTILITY_RECURSION +# endif + +#endif diff --git a/Utilities/BGL/boost/config/platform/bsd.hpp b/Utilities/BGL/boost/config/platform/bsd.hpp index 17496d85bb62a5a077f36aeb09955acb8b328191..f02b0e2630ada627b788492f03d6c31c16a07de7 100644 --- a/Utilities/BGL/boost/config/platform/bsd.hpp +++ b/Utilities/BGL/boost/config/platform/bsd.hpp @@ -36,20 +36,33 @@ // FreeBSD 3.x has pthreads support, but defines _POSIX_THREADS in <pthread.h> // and not in <unistd.h> // -#if defined(__FreeBSD__) && (__FreeBSD__ <= 3) +#if (defined(__FreeBSD__) && (__FreeBSD__ <= 3))\ + || defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_HAS_PTHREADS #endif // // No wide character support in the BSD header files: // -#if !(defined(__FreeBSD__) && (__FreeBSD__ >= 5)) +#if defined(__NetBSD__) +#define __NetBSD_GCC__ (__GNUC__ * 1000000 \ + + __GNUC_MINOR__ * 1000 \ + + __GNUC_PATCHLEVEL__) +// XXX - the following is required until c++config.h +// defines _GLIBCXX_HAVE_SWPRINTF and friends +// or the preprocessor conditionals are removed +// from the cwchar header. +#define _GLIBCXX_HAVE_SWPRINTF 1 +#endif + +#if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \ + || (__NetBSD_GCC__ >= 2095003) || defined(__DragonFly__)) # define BOOST_NO_CWCHAR #endif // // The BSD <ctype.h> has macros only, no functions: // -#if !defined(__OpenBSD__) +#if !defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_NO_CTYPE_FUNCTIONS #endif diff --git a/Utilities/BGL/boost/config/platform/cygwin.hpp b/Utilities/BGL/boost/config/platform/cygwin.hpp index 0fd2ebe2d87cf624a4ff08259789d75aa1d7b412..41fcaa10c78dfa67b093d7d297b2dacda1d3820f 100644 --- a/Utilities/BGL/boost/config/platform/cygwin.hpp +++ b/Utilities/BGL/boost/config/platform/cygwin.hpp @@ -12,6 +12,8 @@ #define BOOST_NO_CWCHAR #define BOOST_NO_SWPRINTF #define BOOST_HAS_DIRENT_H +#define BOOST_HAS_LOG1P +#define BOOST_HAS_EXPM1 // // Threading API: @@ -46,3 +48,4 @@ + diff --git a/Utilities/BGL/boost/config/platform/hpux.hpp b/Utilities/BGL/boost/config/platform/hpux.hpp index fa773aa79e2c03db249f95e474af5d41d172f067..19ce68e59731b999828a6b0f54c2c0499b69c5db 100644 --- a/Utilities/BGL/boost/config/platform/hpux.hpp +++ b/Utilities/BGL/boost/config/platform/hpux.hpp @@ -2,6 +2,7 @@ // (C) Copyright Jens Maurer 2001 - 2003. // (C) Copyright David Abrahams 2002. // (C) Copyright Toon Knapen 2003. +// (C) Copyright Boris Gubenko 2006 - 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) @@ -15,11 +16,17 @@ // In principle, HP-UX has a nice <stdint.h> under the name <inttypes.h> // However, it has the following problem: // Use of UINT32_C(0) results in "0u l" for the preprocessed source -// (verifyable with gcc 2.95.3, assumed for HP aCC) -// #define BOOST_HAS_STDINT_H +// (verifyable with gcc 2.95.3) +#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__HP_aCC) +# define BOOST_HAS_STDINT_H +#endif -#define BOOST_NO_SWPRINTF -#define BOOST_NO_CWCTYPE +#if !(defined(__HP_aCC) || !defined(_INCLUDE__STDC_A1_SOURCE)) +# define BOOST_NO_SWPRINTF +#endif +#if defined(__HP_aCC) && !defined(_INCLUDE__STDC_A1_SOURCE) +# define BOOST_NO_CWCTYPE +#endif #if defined(__GNUC__) # if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)) @@ -30,6 +37,8 @@ # define BOOST_HAS_THREADS # define BOOST_HAS_PTHREADS # endif +#elif defined(__HP_aCC) && !defined(BOOST_DISABLE_THREADS) +# define BOOST_HAS_PTHREADS #endif // boilerplate code: @@ -64,5 +73,15 @@ #ifndef BOOST_HAS_SIGACTION # define BOOST_HAS_SIGACTION #endif - +#ifndef BOOST_HAS_NRVO +# ifndef __parisc +# define BOOST_HAS_NRVO +# endif +#endif +#ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +#endif +#ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +#endif diff --git a/Utilities/BGL/boost/config/platform/macos.hpp b/Utilities/BGL/boost/config/platform/macos.hpp index d6877d31127d295be537d3da18fb2c929e746550..2780ef99e9e80e0d7731fdc4ae613ea1f023bfa7 100644 --- a/Utilities/BGL/boost/config/platform/macos.hpp +++ b/Utilities/BGL/boost/config/platform/macos.hpp @@ -47,6 +47,14 @@ # define BOOST_NO_STDC_NAMESPACE # endif +# if (__GNUC__ == 4) + +// Both gcc and intel require these. +# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# define BOOST_HAS_NANOSLEEP + +# endif + #else // Using the MSL C library. diff --git a/Utilities/BGL/boost/config/platform/qnxnto.hpp b/Utilities/BGL/boost/config/platform/qnxnto.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b1377c8d2c3d991d3acb2c70c9201146a25939b1 --- /dev/null +++ b/Utilities/BGL/boost/config/platform/qnxnto.hpp @@ -0,0 +1,31 @@ +// (C) Copyright Jim Douglas 2005. +// 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. + +// QNX specific config options: + +#define BOOST_PLATFORM "QNX" + +#define BOOST_HAS_UNISTD_H +#include <boost/config/posix_features.hpp> + +// QNX claims XOpen version 5 compatibility, but doesn't have an nl_types.h +// or log1p and expm1: +#undef BOOST_HAS_NL_TYPES_H +#undef BOOST_HAS_LOG1P +#undef BOOST_HAS_EXPM1 + +#define BOOST_HAS_PTHREADS +#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE + +#define BOOST_HAS_GETTIMEOFDAY +#define BOOST_HAS_CLOCK_GETTIME +#define BOOST_HAS_NANOSLEEP + + + + + diff --git a/Utilities/BGL/boost/config/platform/solaris.hpp b/Utilities/BGL/boost/config/platform/solaris.hpp index 700dc3ce67f094f64be38c897549f91a2499bb07..9f9256664bd49ebbb2408a198808fad66f9f7fb1 100644 --- a/Utilities/BGL/boost/config/platform/solaris.hpp +++ b/Utilities/BGL/boost/config/platform/solaris.hpp @@ -16,6 +16,13 @@ #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> +// +// pthreads don't actually work with gcc unless _PTHREADS is defined: +// +#if defined(__GNUC__) && defined(_POSIX_THREADS) && !defined(_PTHREADS) +# undef BOOST_HAS_PTHREADS +#endif + diff --git a/Utilities/BGL/boost/config/platform/vxworks.hpp b/Utilities/BGL/boost/config/platform/vxworks.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6ec5171e390df14e4530b42895d67407d76f10b3 --- /dev/null +++ b/Utilities/BGL/boost/config/platform/vxworks.hpp @@ -0,0 +1,31 @@ +// (C) Copyright Dustin Spicuzza 2009. +// 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. + +// vxWorks specific config options: + +#define BOOST_PLATFORM "vxWorks" + +#define BOOST_NO_CWCHAR +#define BOOST_NO_INTRINSIC_WCHAR_T + +#if defined(__GNUC__) && defined(__STRICT_ANSI__) +#define BOOST_NO_INT64_T +#endif + +#define BOOST_HAS_UNISTD_H + +// these allow posix_features to work, since vxWorks doesn't +// define them itself +#define _POSIX_TIMERS 1 +#define _POSIX_THREADS 1 + +// vxworks doesn't work with asio serial ports +#define BOOST_ASIO_DISABLE_SERIAL_PORT + +// boilerplate code: +#include <boost/config/posix_features.hpp> + diff --git a/Utilities/BGL/boost/config/posix_features.hpp b/Utilities/BGL/boost/config/posix_features.hpp index 4afb476b7f23286cb3da6d59128ee5fdd42fd988..d12954797f9612148bcc8376a9f824eaec9d22c1 100644 --- a/Utilities/BGL/boost/config/posix_features.hpp +++ b/Utilities/BGL/boost/config/posix_features.hpp @@ -74,14 +74,22 @@ // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: // These are predicated on _XOPEN_VERSION, and appears to be first released // in issue 4, version 2 (_XOPEN_VERSION > 500). + // Likewise for the functions log1p and expm1. # if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500) # define BOOST_HAS_GETTIMEOFDAY # if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE # endif +# ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +# endif +# ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +# endif # endif # endif + diff --git a/Utilities/BGL/boost/config/select_compiler_config.hpp b/Utilities/BGL/boost/config/select_compiler_config.hpp index 3453f1a35faa3216a47210df6caec85552230e83..9141cd6376ac10b1de03dfa391393276a3fe1cc6 100644 --- a/Utilities/BGL/boost/config/select_compiler_config.hpp +++ b/Utilities/BGL/boost/config/select_compiler_config.hpp @@ -2,17 +2,45 @@ // (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Martin Wille 2003. -// (C) Copyright Guillaume Melquiond 2003. -// 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) +// (C) Copyright Guillaume Melquiond 2003. +// +// 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. + + +// one identification macro for each of the +// compilers we support: + +# define BOOST_CXX_GCCXML 0 +# define BOOST_CXX_COMO 0 +# define BOOST_CXX_DMC 0 +# define BOOST_CXX_INTEL 0 +# define BOOST_CXX_GNUC 0 +# define BOOST_CXX_KCC 0 +# define BOOST_CXX_SGI 0 +# define BOOST_CXX_TRU64 0 +# define BOOST_CXX_GHS 0 +# define BOOST_CXX_BORLAND 0 +# define BOOST_CXX_CW 0 +# define BOOST_CXX_SUNPRO 0 +# define BOOST_CXX_HPACC 0 +# define BOOST_CXX_MPW 0 +# define BOOST_CXX_IBMCPP 0 +# define BOOST_CXX_MSVC 0 +# define BOOST_CXX_PGI 0 -// See http://www.boost.org for most recent version. // locate which compiler we are using and define // BOOST_COMPILER_CONFIG as needed: -# if defined __COMO__ +#if defined(__GCCXML__) +// GCC-XML emulates other compilers, it has to appear first here! +# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" + +#elif defined __COMO__ // Comeau C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" @@ -44,6 +72,10 @@ // Greenhills C++ # define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp" +#elif defined __CODEGEARC__ +// CodeGear - must be checked for before Borland +# define BOOST_COMPILER_CONFIG "boost/config/compiler/codegear.hpp" + #elif defined __BORLANDC__ // Borland # define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp" @@ -68,6 +100,10 @@ // IBM Visual Age # define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp" +#elif defined(__PGI) +// Portland Group Inc. +# define BOOST_COMPILER_CONFIG "boost/config/compiler/pgi.hpp" + #elif defined _MSC_VER // Microsoft Visual C++ // diff --git a/Utilities/BGL/boost/config/select_platform_config.hpp b/Utilities/BGL/boost/config/select_platform_config.hpp index 2101ed431d59862c53a1f6a623a5f74c4fbb7bc8..615bb064ff8c3baad511f095764d85aed9d05e56 100644 --- a/Utilities/BGL/boost/config/select_platform_config.hpp +++ b/Utilities/BGL/boost/config/select_platform_config.hpp @@ -13,8 +13,8 @@ // <header_name> in order to prevent macro expansion within the header // name (for example "linux" is a macro on linux systems). -#if defined(linux) || defined(__linux) || defined(__linux__) -// linux: +#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +// linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though? # define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) @@ -57,6 +57,14 @@ // AmigaOS # define BOOST_PLATFORM_CONFIG "boost/config/platform/amigaos.hpp" +#elif defined(__QNXNTO__) +// QNX: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" + +#elif defined(__VXWORKS__) +// vxWorks: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp" + #else # if defined(unix) \ diff --git a/Utilities/BGL/boost/config/select_stdlib_config.hpp b/Utilities/BGL/boost/config/select_stdlib_config.hpp index b7bf591434f55ace6f7bd1d12b71d5e098a963b9..2a1430aef4b0749c26b006110e39deee58c184df 100644 --- a/Utilities/BGL/boost/config/select_stdlib_config.hpp +++ b/Utilities/BGL/boost/config/select_stdlib_config.hpp @@ -11,13 +11,10 @@ // locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: -// we need to include a std lib header here in order to detect which -// library is in use, use <utility> as it's about the smallest -// of the std lib headers - do not rely on this header being included - -// users can short-circuit this header if they know whose std lib -// they are using. - -#include <utility> +// First include <cstddef> to determine if some version of STLport is in use as the std lib +// (do not rely on this header being included since users can short-circuit this header +// if they know whose std lib they are using.) +#include <cstddef> #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) // STLPort library; this _must_ come first, otherwise since @@ -25,7 +22,17 @@ // can end up detecting that first rather than STLport: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" -#elif defined(__LIBCOMO__) +#else + +// If our std lib was not some version of STLport, then include <utility> as it is about +// the smallest of the std lib headers that includes real C++ stuff. (Some std libs do not +// include their C++-related macros in <cstddef> so this additional include makes sure +// we get those definitions) +// (again do not rely on this header being included since users can short-circuit this +// header if they know whose std lib they are using.) +#include <boost/config/no_tr1/utility.hpp> + +#if defined(__LIBCOMO__) // Comeau STL: #define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" @@ -64,5 +71,7 @@ #endif +#endif + diff --git a/Utilities/BGL/boost/config/stdlib/dinkumware.hpp b/Utilities/BGL/boost/config/stdlib/dinkumware.hpp index aa214fc1b0b757c69ea1a88b835edba3813197ba..ab770599a7da27da9dab8102e49c87a3d7b07301 100644 --- a/Utilities/BGL/boost/config/stdlib/dinkumware.hpp +++ b/Utilities/BGL/boost/config/stdlib/dinkumware.hpp @@ -12,7 +12,7 @@ // Dinkumware standard library config: #if !defined(_YVALS) && !defined(_CPPLIB_VER) -#include <utility> +#include <boost/config/no_tr1/utility.hpp> #if !defined(_YVALS) && !defined(_CPPLIB_VER) #error This is not the Dinkumware lib! #endif @@ -55,8 +55,10 @@ # define BOOST_HAS_MACRO_USE_FACET # ifndef _CPPLIB_VER // Updated Dinkum library defines this, and provides - // its own min and max definitions. -# define BOOST_NO_STD_MIN_MAX + // its own min and max definitions, as does MTA version. +# ifndef __MTA__ +# define BOOST_NO_STD_MIN_MAX +# endif # define BOOST_NO_MS_INT64_NUMERIC_LIMITS # endif #endif @@ -84,6 +86,36 @@ # define BOOST_NO_STD_LOCALE #endif +// C++0x headers implemented in 520 (as shipped by Microsoft) +// +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE + #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER #else diff --git a/Utilities/BGL/boost/config/stdlib/libcomo.hpp b/Utilities/BGL/boost/config/stdlib/libcomo.hpp index b2c8e4400262175d7932d7c47d5522ea8d4c4e43..06731e32e7053dfb8910b27e5d6f2687c4fcfa35 100644 --- a/Utilities/BGL/boost/config/stdlib/libcomo.hpp +++ b/Utilities/BGL/boost/config/stdlib/libcomo.hpp @@ -10,7 +10,7 @@ // Comeau STL: #if !defined(__LIBCOMO__) -# include <utility> +# include <boost/config/no_tr1/utility.hpp> # if !defined(__LIBCOMO__) # error "This is not the Comeau STL!" # endif @@ -33,6 +33,31 @@ # define BOOST_HAS_SLIST #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + // // Intrinsic type_traits support. // The SGI STL has it's own __type_traits class, which diff --git a/Utilities/BGL/boost/config/stdlib/libstdcpp3.hpp b/Utilities/BGL/boost/config/stdlib/libstdcpp3.hpp index 5cf5ef773fdb755308f6360f42e444a108d40b4f..6a57319ffd267a15ac5f4b4c9814e251aa24937d 100644 --- a/Utilities/BGL/boost/config/stdlib/libstdcpp3.hpp +++ b/Utilities/BGL/boost/config/stdlib/libstdcpp3.hpp @@ -62,3 +62,66 @@ // support is useless. # undef BOOST_HAS_LONG_LONG #endif + +#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0 +# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx +# define BOOST_HAS_SLIST +# define BOOST_HAS_HASH +# define BOOST_SLIST_HEADER <ext/slist> +# if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) +# define BOOST_HASH_SET_HEADER <ext/hash_set> +# define BOOST_HASH_MAP_HEADER <ext/hash_map> +# else +# define BOOST_HASH_SET_HEADER <backward/hash_set> +# define BOOST_HASH_MAP_HEADER <backward/hash_map> +# endif +#endif + +// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly +// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++ +// developers. He also commented: +// +// "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in +// GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305. +// Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support +// than any release in the 4.2 series." +// +// Another resource for understanding stdlibc++ features is: +// http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x + +// C++0x headers in GCC 4.3.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// C++0x headers in GCC 4.4.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +#endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS + +// --- end --- diff --git a/Utilities/BGL/boost/config/stdlib/modena.hpp b/Utilities/BGL/boost/config/stdlib/modena.hpp index 61e31b7d1ca205d2136d74e9f3f1f98794d28146..7bd50cecb7c51986fb8b564e0a91619e792e225c 100644 --- a/Utilities/BGL/boost/config/stdlib/modena.hpp +++ b/Utilities/BGL/boost/config/stdlib/modena.hpp @@ -8,7 +8,7 @@ // Modena C++ standard library (comes with KAI C++) #if !defined(MSIPL_COMPILE_H) -# include <utility> +# include <boost/config/no_tr1/utility.hpp> # if !defined(__MSIPL_COMPILE_H) # error "This is not the Modena C++ library!" # endif @@ -22,6 +22,31 @@ #define BOOST_NO_STD_WSTRING #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "Modena C++ standard library" diff --git a/Utilities/BGL/boost/config/stdlib/msl.hpp b/Utilities/BGL/boost/config/stdlib/msl.hpp index 0df8e0e3bca5c185bed2b71b3ffdf8c264e246fe..6bcd232a57350e13a802774c3816d675e5d7cd76 100644 --- a/Utilities/BGL/boost/config/stdlib/msl.hpp +++ b/Utilities/BGL/boost/config/stdlib/msl.hpp @@ -9,7 +9,7 @@ // Metrowerks standard library: #ifndef __MSL_CPP__ -# include <utility> +# include <boost/config/no_tr1/utility.hpp> # ifndef __MSL_CPP__ # error This is not the MSL standard library! # endif @@ -46,6 +46,30 @@ # define BOOST_HAS_TWO_ARG_USE_FACET #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/Utilities/BGL/boost/config/stdlib/roguewave.hpp b/Utilities/BGL/boost/config/stdlib/roguewave.hpp index b331f6538ba74f9fd4850ce063b980a55d7c7ef5..cba2f54a1a0a2d02f942f460e68ad6da0c3b9027 100644 --- a/Utilities/BGL/boost/config/stdlib/roguewave.hpp +++ b/Utilities/BGL/boost/config/stdlib/roguewave.hpp @@ -1,6 +1,7 @@ // (C) Copyright John Maddock 2001 - 2003. // (C) Copyright Jens Maurer 2001. // (C) Copyright David Abrahams 2003. +// (C) Copyright Boris Gubenko 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) @@ -10,7 +11,7 @@ // Rogue Wave std lib: #if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) -# include <utility> +# include <boost/config/no_tr1/utility.hpp> # if !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER) # error This is not the Rogue Wave standard library # endif @@ -28,8 +29,14 @@ #ifndef _RWSTD_VER # define BOOST_STDLIB "Rogue Wave standard library version (Unknown version)" +#elif _RWSTD_VER < 0x04010200 + # define BOOST_STDLIB "Rogue Wave standard library version " BOOST_STRINGIZE(_RWSTD_VER) #else -# define BOOST_STDLIB "Rogue Wave standard library version " BOOST_STRINGIZE(_RWSTD_VER) +# ifdef _RWSTD_VER_STR +# define BOOST_STDLIB "Apache STDCXX standard library version " _RWSTD_VER_STR +# else +# define BOOST_STDLIB "Apache STDCXX standard library version " BOOST_STRINGIZE(_RWSTD_VER) +# endif #endif // @@ -125,3 +132,48 @@ #if !defined(_RWSTD_LONG_LONG) && defined(BOOST_HAS_LONG_LONG) # undef BOOST_HAS_LONG_LONG #endif + +// +// check that on HP-UX, the proper RW library is used +// +#if defined(__HP_aCC) && !defined(_HP_NAMESPACE_STD) +# error "Boost requires Standard RW library. Please compile and link with -AA" +#endif + +// +// Define macros specific to RW V2.2 on HP-UX +// +#if defined(__HP_aCC) && (BOOST_RWSTD_VER == 0x02020100) +# ifndef __HP_TC1_MAKE_PAIR +# define __HP_TC1_MAKE_PAIR +# endif +# ifndef _HP_INSTANTIATE_STD2_VL +# define _HP_INSTANTIATE_STD2_VL +# endif +#endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + diff --git a/Utilities/BGL/boost/config/stdlib/sgi.hpp b/Utilities/BGL/boost/config/stdlib/sgi.hpp index 67f7a0a4bf95a17d2b1fd682f0579437d2cba9b7..c505008b7d77d5e6603011184db0361506a629b3 100644 --- a/Utilities/BGL/boost/config/stdlib/sgi.hpp +++ b/Utilities/BGL/boost/config/stdlib/sgi.hpp @@ -10,7 +10,7 @@ // generic SGI STL: #if !defined(__STL_CONFIG_H) -# include <utility> +# include <boost/config/no_tr1/utility.hpp> # if !defined(__STL_CONFIG_H) # error "This is not the SGI STL!" # endif @@ -105,6 +105,31 @@ // #define BOOST_HAS_SGI_TYPE_TRAITS +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "SGI standard library" diff --git a/Utilities/BGL/boost/config/stdlib/stlport.hpp b/Utilities/BGL/boost/config/stdlib/stlport.hpp index 294f96ed6f4f2e352e924489b5dac671bc2736de..3dfd529effb940a797959b23cc5a5c035fd87c7b 100644 --- a/Utilities/BGL/boost/config/stdlib/stlport.hpp +++ b/Utilities/BGL/boost/config/stdlib/stlport.hpp @@ -10,7 +10,7 @@ // STLPort standard library config: #if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) -# include <utility> +# include <cstddef> # if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) # error "This is not STLPort!" # endif @@ -61,6 +61,14 @@ # endif #endif +#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) +# define BOOST_NO_STD_UNORDERED +#endif + +#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) +# define BOOST_HAS_TR1_UNORDERED_SET +# define BOOST_HAS_TR1_UNORDERED_MAP +#endif // // Without member template support enabled, their are no template // iterate constructors, and no std::allocator: @@ -98,8 +106,10 @@ // // We always have SGI style hash_set, hash_map, and slist: // +#ifndef _STLP_NO_EXTENSIONS #define BOOST_HAS_HASH #define BOOST_HAS_SLIST +#endif // // STLport does a good job of importing names into namespace std::, @@ -190,6 +200,31 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; namespace boost { using std::min; using std::max; } #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/Utilities/BGL/boost/config/stdlib/vacpp.hpp b/Utilities/BGL/boost/config/stdlib/vacpp.hpp index 8321ee0ccf9255c5f7a4af8868e53a434dc334ac..c8d6d5ad697e66fb353ad18c7377962534deeb6f 100644 --- a/Utilities/BGL/boost/config/stdlib/vacpp.hpp +++ b/Utilities/BGL/boost/config/stdlib/vacpp.hpp @@ -12,6 +12,31 @@ #define BOOST_HAS_MACRO_USE_FACET #define BOOST_NO_STD_MESSAGES +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "Visual Age default standard library" diff --git a/Utilities/BGL/boost/config/suffix.hpp b/Utilities/BGL/boost/config/suffix.hpp index d4d9502d4a831d9c82fdd8e2d1e771577cd3eff2..fa44986946cb70aa3fc589ea6d829da072ad8a9b 100644 --- a/Utilities/BGL/boost/config/suffix.hpp +++ b/Utilities/BGL/boost/config/suffix.hpp @@ -1,21 +1,22 @@ // Boost config.hpp configuration header file ------------------------------// -// (C) Copyright John Maddock 2001 - 2003. -// (C) Copyright Darin Adler 2001. -// (C) Copyright Peter Dimov 2001. -// (C) Copyright Bill Kempf 2002. -// (C) Copyright Jens Maurer 2002. -// (C) Copyright David Abrahams 2002 - 2003. -// (C) Copyright Gennaro Prota 2003. -// (C) Copyright Eric Friedman 2003. -// 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. +// Copyright (c) 2001-2003 John Maddock +// Copyright (c) 2001 Darin Adler +// Copyright (c) 2001 Peter Dimov +// Copyright (c) 2002 Bill Kempf +// Copyright (c) 2002 Jens Maurer +// Copyright (c) 2002-2003 David Abrahams +// Copyright (c) 2003 Gennaro Prota +// Copyright (c) 2003 Eric Friedman +// +// 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. // Boost config.hpp policy and rationale documentation has been moved to -// http://www.boost.org/libs/config +// http://www.boost.org/libs/config/ // // This file is intended to be stable, and relatively unchanging. // It should contain boilerplate code only - no compiler specific @@ -30,18 +31,14 @@ // remember that since these just declare a bunch of macros, there should be // no namespace issues from this. // -#include <limits.h> -# if !defined(BOOST_HAS_LONG_LONG) \ - && !defined(BOOST_MSVC) && !defined(__BORLANDC__) \ - && (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) -# define BOOST_HAS_LONG_LONG -#endif - -// TODO: Remove the following lines after the 1.33 release because the presence -// of an integral 64 bit type has nothing to do with support for long long. - -#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(__DECCXX_VER) -# define BOOST_NO_INTEGRAL_INT64_T +#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG) \ + && !defined(BOOST_MSVC) && !defined(__BORLANDC__) +# include <limits.h> +# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) +# define BOOST_HAS_LONG_LONG +# else +# define BOOST_NO_LONG_LONG +# endif #endif // GCC 3.x will clean up all of those nasty macro definitions that @@ -51,7 +48,6 @@ # undef BOOST_NO_CTYPE_FUNCTIONS #endif - // // Assume any extensions are in namespace std:: unless stated otherwise: // @@ -127,6 +123,15 @@ # define BOOST_NO_STD_ITERATOR_TRAITS # endif +// +// Without partial specialization, partial +// specialization with default args won't work either: +// +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && !defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) +# define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS +# endif + // // Without member template support, we can't have template constructors // in the standard library either: @@ -154,6 +159,13 @@ # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #endif +// +// Without typeid support we have no dynamic RTTI either: +// +#if defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) +# define BOOST_NO_RTTI +#endif + // // If we have a standard allocator, then we have a partial one as well: // @@ -213,7 +225,8 @@ // from here then add to the appropriate compiler section): // #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ - || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS) + || defined(_PTHREADS) || defined(__APPLE__) || defined(__DragonFly__)) \ + && !defined(BOOST_HAS_THREADS) # define BOOST_HAS_THREADS #endif @@ -239,6 +252,8 @@ #ifndef BOOST_HAS_THREADS # undef BOOST_HAS_PTHREADS # undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE +# undef BOOST_HAS_PTHREAD_YIELD +# undef BOOST_HAS_PTHREAD_DELAY_NP # undef BOOST_HAS_WINTHREADS # undef BOOST_HAS_BETHREADS # undef BOOST_HAS_MPTASKS @@ -250,20 +265,55 @@ // # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) # define BOOST_HAS_STDINT_H +# ifndef BOOST_HAS_LOG1P +# define BOOST_HAS_LOG1P +# endif +# ifndef BOOST_HAS_EXPM1 +# define BOOST_HAS_EXPM1 +# endif # endif // // Define BOOST_NO_SLIST and BOOST_NO_HASH if required. // Note that this is for backwards compatibility only. // -# ifndef BOOST_HAS_SLIST +# if !defined(BOOST_HAS_SLIST) && !defined(BOOST_NO_SLIST) # define BOOST_NO_SLIST # endif -# ifndef BOOST_HAS_HASH +# if !defined(BOOST_HAS_HASH) && !defined(BOOST_NO_HASH) # define BOOST_NO_HASH # endif +// +// Set BOOST_SLIST_HEADER if not set already: +// +#if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER) +# define BOOST_SLIST_HEADER <slist> +#endif + +// +// Set BOOST_HASH_SET_HEADER if not set already: +// +#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER) +# define BOOST_HASH_SET_HEADER <hash_set> +#endif + +// +// Set BOOST_HASH_MAP_HEADER if not set already: +// +#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER) +# define BOOST_HASH_MAP_HEADER <hash_map> +#endif + +// +// Set BOOST_NO_INITIALIZER_LISTS if there is no library support. +// + +#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) +# define BOOST_NO_INITIALIZER_LISTS +#endif + // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: @@ -341,7 +391,7 @@ namespace std { // with // BOOST_USE_FACET(Type, loc); // Note do not add a std:: prefix to the front of BOOST_USE_FACET! -// Use for BOOST_HAS_FACET is analagous. +// Use for BOOST_HAS_FACET is analogous. #if defined(BOOST_NO_STD_USE_FACET) # ifdef BOOST_HAS_TWO_ARG_USE_FACET @@ -403,6 +453,12 @@ namespace std { # define BOOST_DEDUCED_TYPENAME #endif +#ifndef BOOST_NO_TYPENAME_WITH_CTOR +# define BOOST_CTOR_TYPENAME typename +#else +# define BOOST_CTOR_TYPENAME +#endif + // long long workaround ------------------------------------------// // On gcc (and maybe other compilers?) long long is alway supported // but it's use may generate either warnings (with -ansi), or errors @@ -422,12 +478,11 @@ namespace boost{ // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// // -// Some compilers have problems with function templates whose -// template parameters don't appear in the function parameter -// list (basically they just link one instantiation of the -// template in the final executable). These macros provide a -// uniform way to cope with the problem with no effects on the -// calling syntax. +// Some compilers have problems with function templates whose template +// parameters don't appear in the function parameter list (basically +// they just link one instantiation of the template in the final +// executable). These macros provide a uniform way to cope with the +// problem with no effects on the calling syntax. // Example: // @@ -468,18 +523,18 @@ namespace boost{ # include "boost/type.hpp" # include "boost/non_type.hpp" -# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0 -# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>* -# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0 +# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0 +# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>* +# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>* -# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ , BOOST_EXPLICIT_TEMPLATE_TYPE(t) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ +# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ +# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) #else @@ -544,4 +599,3 @@ namespace boost{ #endif - diff --git a/Utilities/BGL/boost/config/warning_disable.hpp b/Utilities/BGL/boost/config/warning_disable.hpp new file mode 100644 index 0000000000000000000000000000000000000000..26ff1323c0379541707c737ad4d1f5e9077f3dc8 --- /dev/null +++ b/Utilities/BGL/boost/config/warning_disable.hpp @@ -0,0 +1,47 @@ +// Copyright John Maddock 2008 +// 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) +// +// This file exists to turn off some overly-pedantic warning emitted +// by certain compilers. You should include this header only in: +// +// * A test case, before any other headers, or, +// * A library source file before any other headers. +// +// IT SHOULD NOT BE INCLUDED BY ANY BOOST HEADER. +// +// YOU SHOULD NOT INCLUDE IT IF YOU CAN REASONABLY FIX THE WARNING. +// +// The only warnings disabled here are those that are: +// +// * Quite unreasonably pedantic. +// * Generally only emitted by a single compiler. +// * Can't easily be fixed: for example if the vendors own std lib +// code emits these warnings! +// +// Note that THIS HEADER MUST NOT INCLUDE ANY OTHER HEADERS: +// not even std library ones! Doing so may turn the warning +// off too late to be of any use. For example the VC++ C4996 +// warning can be omitted from <iosfwd> if that header is included +// before or by this one :-( +// + +#ifndef BOOST_CONFIG_WARNING_DISABLE_HPP +#define BOOST_CONFIG_WARNING_DISABLE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + // Error 'function': was declared deprecated + // http://msdn2.microsoft.com/en-us/library/ttcz0bys(VS.80).aspx + // This error is emitted when you use some perfectly conforming + // std lib functions in a perfectly correct way, and also by + // some of Microsoft's own std lib code ! +# pragma warning(disable:4996) +#endif +#if defined(__INTEL_COMPILER) || defined(__ICL) + // As above: gives warning when a "deprecated" + // std library function is encountered. +# pragma warning(disable:1786) +#endif + +#endif // BOOST_CONFIG_WARNING_DISABLE_HPP diff --git a/Utilities/BGL/boost/cstdint.hpp b/Utilities/BGL/boost/cstdint.hpp index 698c149f58864d42c590eaa0716f7740addcea48..47e6a160c6c50829233f18a6b4ac97cf3d0f1664 100644 --- a/Utilities/BGL/boost/cstdint.hpp +++ b/Utilities/BGL/boost/cstdint.hpp @@ -23,10 +23,25 @@ #ifndef BOOST_CSTDINT_HPP #define BOOST_CSTDINT_HPP -#include <boost/config.hpp> +// +// Since we always define the INT#_C macros as per C++0x, +// define __STDC_CONSTANT_MACROS so that <stdint.h> does the right +// thing if possible, and so that the user knows that the macros +// are actually defined as per C99. +// +#ifndef __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS +#endif +#include <boost/config.hpp> -#ifdef BOOST_HAS_STDINT_H +// +// Note that GLIBC is a bit inconsistent about whether int64_t is defined or not +// depending upon what headers happen to have been included first... +// so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG. +// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990 +// +#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG)) // The following #include is an implementation artifact; not part of interface. # ifdef __hpux @@ -36,7 +51,7 @@ // this is triggered with GCC, because it defines __cplusplus < 199707L # define BOOST_NO_INT64_T # endif -# elif defined(__FreeBSD__) || defined(__IBMCPP__) +# elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX) # include <inttypes.h> # else # include <stdint.h> @@ -173,6 +188,7 @@ namespace boost { #else // BOOST_HAS_STDINT_H # include <boost/limits.hpp> // implementation artifact; not part of interface +# include <limits.h> // needed for limits macros namespace boost @@ -219,6 +235,15 @@ namespace boost typedef unsigned short uint_least16_t; typedef unsigned short uint_fast16_t; # endif +# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__) + // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified + // MTA / XMT does support the following non-standard integer types + typedef __short16 int16_t; + typedef __short16 int_least16_t; + typedef __short16 int_fast16_t; + typedef unsigned __short16 uint16_t; + typedef unsigned __short16 uint_least16_t; + typedef unsigned __short16 uint_fast16_t; # elif (USHRT_MAX == 0xffffffff) && defined(CRAY) // no 16-bit types on Cray: typedef short int_least16_t; @@ -245,6 +270,14 @@ namespace boost typedef unsigned int uint32_t; typedef unsigned int uint_least32_t; typedef unsigned int uint_fast32_t; +# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__) + // Integers are 64 bits on the MTA / XMT + typedef __int32 int32_t; + typedef __int32 int_least32_t; + typedef __int32 int_fast32_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int32 uint_least32_t; + typedef unsigned __int32 uint_fast32_t; # else # error defaults not correct; you must hand modify boost/cstdint.hpp # endif @@ -325,19 +358,16 @@ namespace boost Macro definition section: -Define various INTXX_C macros only if -__STDC_CONSTANT_MACROS is defined. - -Undefine the macros if __STDC_CONSTANT_MACROS is -not defined and the macros are (cf <cassert>). - Added 23rd September 2000 (John Maddock). Modified 11th September 2001 to be excluded when BOOST_HAS_STDINT_H is defined (John Maddock). +Modified 11th Dec 2009 to always define the +INT#_C macros if they're not already defined (John Maddock). ******************************************************/ -#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H) +#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(INT8_C) +#include <limits.h> # define BOOST__STDC_CONSTANT_MACROS_DEFINED # if defined(BOOST_HAS_MS_INT64) // @@ -389,27 +419,40 @@ BOOST_HAS_STDINT_H is defined (John Maddock). // 64-bit types + intmax_t and uintmax_t ----------------------------------// # if defined(BOOST_HAS_LONG_LONG) && \ - (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) + (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX)) # if defined(__hpux) - // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions -# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) || \ - (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) || \ - (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U) - + // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions +# define INT64_C(value) value##LL +# define UINT64_C(value) value##uLL +# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || \ + (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || \ + (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \ + (defined(_LLONG_MAX) && _LLONG_MAX == 18446744073709551615ULL) + +# define INT64_C(value) value##LL +# define UINT64_C(value) value##uLL # else # error defaults not correct; you must hand modify boost/cstdint.hpp # endif -# define INT64_C(value) value##LL -# define UINT64_C(value) value##uLL # elif ULONG_MAX != 0xffffffff -# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 +# if ULONG_MAX == 18446744073709551615U // 2**64 - 1 # define INT64_C(value) value##L # define UINT64_C(value) value##uL # else # error defaults not correct; you must hand modify boost/cstdint.hpp # endif +# elif defined(BOOST_HAS_LONG_LONG) + // Usual macros not defined, work things out for ourselves: +# if(~0uLL == 18446744073709551615ULL) +# define INT64_C(value) value##LL +# define UINT64_C(value) value##uLL +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp +# endif +# else +# error defaults not correct; you must hand modify boost/cstdint.hpp # endif # ifdef BOOST_NO_INT64_T @@ -422,23 +465,7 @@ BOOST_HAS_STDINT_H is defined (John Maddock). # endif // Borland/Microsoft specific width suffixes - -#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H) -// -// undef all the macros: -// -# undef INT8_C -# undef INT16_C -# undef INT32_C -# undef INT64_C -# undef UINT8_C -# undef UINT16_C -# undef UINT32_C -# undef UINT64_C -# undef INTMAX_C -# undef UINTMAX_C - -#endif // __STDC_CONSTANT_MACROS_DEFINED etc. +#endif // INT#_C macros. diff --git a/Utilities/BGL/boost/current_function.hpp b/Utilities/BGL/boost/current_function.hpp new file mode 100644 index 0000000000000000000000000000000000000000..aa5756e0a5b83f77da042af5189c3947686f815b --- /dev/null +++ b/Utilities/BGL/boost/current_function.hpp @@ -0,0 +1,67 @@ +#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED +#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/current_function.hpp - BOOST_CURRENT_FUNCTION +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// +// http://www.boost.org/libs/utility/current_function.html +// + +namespace boost +{ + +namespace detail +{ + +inline void current_function_helper() +{ + +#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) + +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ + +#elif defined(__DMC__) && (__DMC__ >= 0x810) + +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ + +#elif defined(__FUNCSIG__) + +# define BOOST_CURRENT_FUNCTION __FUNCSIG__ + +#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) + +# define BOOST_CURRENT_FUNCTION __FUNCTION__ + +#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) + +# define BOOST_CURRENT_FUNCTION __FUNC__ + +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) + +# define BOOST_CURRENT_FUNCTION __func__ + +#else + +# define BOOST_CURRENT_FUNCTION "(unknown)" + +#endif + +} + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/algorithm.hpp b/Utilities/BGL/boost/detail/algorithm.hpp index 4cc52c1e762e9cbf55bd4c48b4eb64ea4c69b9c9..252e9f461c54e2d4573bbbc28933ff9c419a17f3 100644 --- a/Utilities/BGL/boost/detail/algorithm.hpp +++ b/Utilities/BGL/boost/detail/algorithm.hpp @@ -1,8 +1,6 @@ -// (C) Copyright Jeremy Siek 2001. Permission to copy, use, modify, -// sell and distribute this software is granted provided this -// copyright notice appears in all copies. This software is provided -// "as is" without express or implied warranty, and with no claim as -// to its suitability for any purpose. +// (C) Copyright Jeremy Siek 2001. +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /* * @@ -154,39 +152,14 @@ namespace boost { } template <typename InputIterator, typename T> - bool contains(InputIterator first, InputIterator last, T value) + bool container_contains(InputIterator first, InputIterator last, T value) { return std::find(first, last, value) != last; } template <typename Container, typename T> - bool contains(const Container& c, const T& value) + bool container_contains(const Container& c, const T& value) { - return contains(begin(c), end(c), value); - } - - template <typename InputIterator, typename Predicate> - bool all(InputIterator first, InputIterator last, Predicate p) - { - for (; first != last; ++first) - if (!p(*first)) - return false; - return true; - } - template <typename Container, typename Predicate> - bool all(const Container& c, Predicate p) - { - return all(begin(c), end(c), p); - } - - template <typename InputIterator, typename Predicate> - bool none(InputIterator first, InputIterator last, Predicate p) - { - return std::find_if(first, last, p) == last; - } - template <typename Container, typename Predicate> - bool none(const Container& c, Predicate p) - { - return none(begin(c), end(c), p); + return container_contains(begin(c), end(c), value); } template <typename Container, typename T> diff --git a/Utilities/BGL/boost/detail/allocator_utilities.hpp b/Utilities/BGL/boost/detail/allocator_utilities.hpp index 69290878f64780231aef1b783993829983735e00..5d6ef48b05b149bded13d98e70a4757e3a2e3ad7 100644 --- a/Utilities/BGL/boost/detail/allocator_utilities.hpp +++ b/Utilities/BGL/boost/detail/allocator_utilities.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2005 Joaqu�n M L�pez Mu�oz. +/* Copyright 2003-2009 Joaquin M Lopez Munoz. * 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) @@ -30,13 +30,21 @@ namespace detail{ namespace allocator{ /* partial_std_allocator_wrapper inherits the functionality of a std - * allocator while providing a templatized ctor. + * allocator while providing a templatized ctor and other bits missing + * in some stdlib implementation or another. */ template<typename Type> class partial_std_allocator_wrapper:public std::allocator<Type> { public: + /* Oddly enough, STLport does not define std::allocator<void>::value_type + * when configured to work without partial template specialization. + * No harm in supplying the definition here unconditionally. + */ + + typedef Type value_type; + partial_std_allocator_wrapper(){}; template<typename Other> @@ -170,12 +178,31 @@ void construct(void* p,const Type& t) new (p) Type(t); } +#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) +/* MSVC++ issues spurious warnings about unreferencend formal parameters + * in destroy<Type> when Type is a class with trivial dtor. + */ + +#pragma warning(push) +#pragma warning(disable:4100) +#endif + template<typename Type> void destroy(const Type* p) { + +#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590)) + const_cast<Type*>(p)->~Type(); +#else p->~Type(); +#endif + } +#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) +#pragma warning(pop) +#endif + } /* namespace boost::detail::allocator */ } /* namespace boost::detail */ diff --git a/Utilities/BGL/boost/detail/atomic_count.hpp b/Utilities/BGL/boost/detail/atomic_count.hpp index 9985b2cede5bb0b4ffdbaa4fc8fdc3db035ffc17..5411c7ae99041fbf6c61dd90789ca0f6ca09330a 100644 --- a/Utilities/BGL/boost/detail/atomic_count.hpp +++ b/Utilities/BGL/boost/detail/atomic_count.hpp @@ -12,97 +12,10 @@ // // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. // -// 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) -// -// typedef <implementation-defined> boost::detail::atomic_count; -// -// atomic_count a(n); -// -// (n is convertible to long) -// -// Effects: Constructs an atomic_count with an initial value of n -// -// a; -// -// Returns: (long) the current value of a -// -// ++a; -// -// Effects: Atomically increments the value of a -// Returns: nothing -// -// --a; -// -// Effects: Atomically decrements the value of a -// Returns: (long) zero if the new value of a is zero, -// unspecified non-zero value otherwise (usually the new value) -// -// Important note: when --a returns zero, it must act as a -// read memory barrier (RMB); i.e. the calling thread must -// have a synchronized view of the memory -// -// On Intel IA-32 (x86) memory is always synchronized, so this -// is not a problem. -// -// On many architectures the atomic instructions already act as -// a memory barrier. -// -// This property is necessary for proper reference counting, since -// a thread can update the contents of a shared object, then -// release its reference, and another thread may immediately -// release the last reference causing object destruction. -// -// The destructor needs to have a synchronized view of the -// object to perform proper cleanup. -// -// Original example by Alexander Terekhov: -// -// Given: -// -// - a mutable shared object OBJ; -// - two threads THREAD1 and THREAD2 each holding -// a private smart_ptr object pointing to that OBJ. -// -// t1: THREAD1 updates OBJ (thread-safe via some synchronization) -// and a few cycles later (after "unlock") destroys smart_ptr; -// -// t2: THREAD2 destroys smart_ptr WITHOUT doing any synchronization -// with respect to shared mutable object OBJ; OBJ destructors -// are called driven by smart_ptr interface... -// - -#include <boost/config.hpp> - -#ifndef BOOST_HAS_THREADS - -namespace boost -{ +// 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 -namespace detail -{ - -typedef long atomic_count; - -} - -} - -#elif defined(BOOST_AC_USE_PTHREADS) -# include <boost/detail/atomic_count_pthreads.hpp> -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) -# include <boost/detail/atomic_count_win32.hpp> -#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -# include <boost/detail/atomic_count_gcc.hpp> -#elif defined(BOOST_HAS_PTHREADS) -# define BOOST_AC_USE_PTHREADS -# include <boost/detail/atomic_count_pthreads.hpp> -#else - -// Use #define BOOST_DISABLE_THREADS to avoid the error -#error Unrecognized threading platform - -#endif +#include <boost/smart_ptr/detail/atomic_count.hpp> #endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/call_traits.hpp b/Utilities/BGL/boost/detail/call_traits.hpp index f330eb8d03b22e82aa6d1a2d348175dfcb4bcd04..6ad646ec60b9c07f56ddd927fcd85afda62b4c48 100644 --- a/Utilities/BGL/boost/detail/call_traits.hpp +++ b/Utilities/BGL/boost/detail/call_traits.hpp @@ -3,10 +3,10 @@ // 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/butility for most recent version including documentation. +// See http://www.boost.org/libs/utility for most recent version including documentation. // call_traits: defines typedefs for function usage -// (see libs/butility/call_traits.htm) +// (see libs/utility/call_traits.htm) /* Release notes: 23rd July 2000: @@ -58,7 +58,7 @@ struct ct_imp<T, isp, true> template <typename T, bool b1> struct ct_imp<T, true, b1> { - typedef T const param_type; + typedef const T param_type; }; } @@ -76,7 +76,7 @@ public: // however compiler bugs prevent this - instead pass three bool's to // ct_imp<T,bool,bool,bool> and add an extra partial specialisation // of ct_imp to handle the logic. (JM) - typedef typename detail::ct_imp< + typedef typename boost::detail::ct_imp< T, ::boost::is_pointer<T>::value, ::boost::is_arithmetic<T>::value @@ -92,7 +92,7 @@ struct call_traits<T&> typedef T& param_type; // hh removed const }; -#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) +#if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 ) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified @@ -121,6 +121,15 @@ struct call_traits<T&const volatile> typedef const T& const_reference; typedef T& param_type; // hh removed const }; + +template <typename T> +struct call_traits< T * > +{ + typedef T * value_type; + typedef T * & reference; + typedef T * const & const_reference; + typedef T * const param_type; // hh removed const +}; #endif #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) template <typename T, std::size_t N> diff --git a/Utilities/BGL/boost/detail/compressed_pair.hpp b/Utilities/BGL/boost/detail/compressed_pair.hpp index ddec0886187bcc009a6899283db4d5fe70f4f166..3f326456ce7c2ba981c209c74394a9d2ed024f00 100644 --- a/Utilities/BGL/boost/detail/compressed_pair.hpp +++ b/Utilities/BGL/boost/detail/compressed_pair.hpp @@ -3,10 +3,10 @@ // 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/butility for most recent version including documentation. +// See http://www.boost.org/libs/utility for most recent version including documentation. // compressed_pair: pair that "compresses" empty members -// (see libs/butility/compressed_pair.htm) +// (see libs/utility/compressed_pair.htm) // // JM changes 25 Jan 2004: // For the case where T1 == T2 and both are empty, then first() and second() @@ -27,6 +27,10 @@ #include <boost/type_traits/is_same.hpp> #include <boost/call_traits.hpp> +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4512) +#endif namespace boost { @@ -132,7 +136,7 @@ namespace details template <class T1, class T2> class compressed_pair_imp<T1, T2, 1> - : private ::boost::remove_cv<T1>::type + : protected ::boost::remove_cv<T1>::type { public: typedef T1 first_type; @@ -174,7 +178,7 @@ namespace details template <class T1, class T2> class compressed_pair_imp<T1, T2, 2> - : private ::boost::remove_cv<T2>::type + : protected ::boost::remove_cv<T2>::type { public: typedef T1 first_type; @@ -217,8 +221,8 @@ namespace details template <class T1, class T2> class compressed_pair_imp<T1, T2, 3> - : private ::boost::remove_cv<T1>::type, - private ::boost::remove_cv<T2>::type + : protected ::boost::remove_cv<T1>::type, + protected ::boost::remove_cv<T2>::type { public: typedef T1 first_type; @@ -253,11 +257,14 @@ namespace details // JM // 4 T1 == T2, T1 and T2 both empty - // Note does not actually store an instance of T2 at all - - // but reuses T1 base class for both first() and second(). + // Originally this did not store an instance of T2 at all + // but that led to problems beause it meant &x.first() == &x.second() + // which is not true for any other kind of pair, so now we store an instance + // of T2 just in case the user is relying on first() and second() returning + // different objects (albeit both empty). template <class T1, class T2> class compressed_pair_imp<T1, T2, 4> - : private ::boost::remove_cv<T1>::type + : protected ::boost::remove_cv<T1>::type { public: typedef T1 first_type; @@ -428,5 +435,9 @@ swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) } // boost +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + #endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP diff --git a/Utilities/BGL/boost/detail/container_fwd.hpp b/Utilities/BGL/boost/detail/container_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bc7f780b060965c5e96ed47b5ce4ec1613c9d522 --- /dev/null +++ b/Utilities/BGL/boost/detail/container_fwd.hpp @@ -0,0 +1,99 @@ + +// Copyright 2005-2008 Daniel James. +// 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(BOOST_DETAIL_CONTAINER_FWD_HPP) +#define BOOST_DETAIL_CONTAINER_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#if ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_DEBUG)) \ + || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \ + || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ + || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) + +#include <deque> +#include <list> +#include <vector> +#include <map> +#include <set> +#include <bitset> +#include <string> +#include <complex> + +#else + +#include <cstddef> + +#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \ + defined(__STL_CONFIG_H) + +#define BOOST_CONTAINER_FWD_BAD_BITSET + +#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) +#define BOOST_CONTAINER_FWD_BAD_DEQUE +#endif + +#endif + +#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE) +#include <deque> +#endif + +#if defined(BOOST_CONTAINER_FWD_BAD_BITSET) +#include <bitset> +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4099) // struct/class mismatch in fwd declarations +#endif + +namespace std +{ + template <class T> class allocator; + template <class charT, class traits, class Allocator> class basic_string; + +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + template <class charT> struct string_char_traits; +#else + template <class charT> struct char_traits; +#endif + + template <class T> class complex; +} + +// gcc 3.4 and greater +namespace std +{ +#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE) + template <class T, class Allocator> class deque; +#endif + + template <class T, class Allocator> class list; + template <class T, class Allocator> class vector; + template <class Key, class T, class Compare, class Allocator> class map; + template <class Key, class T, class Compare, class Allocator> + class multimap; + template <class Key, class Compare, class Allocator> class set; + template <class Key, class Compare, class Allocator> class multiset; + +#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET) + template <size_t N> class bitset; +#endif + template <class T1, class T2> struct pair; +} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif + +#endif diff --git a/Utilities/BGL/boost/detail/dynamic_bitset.hpp b/Utilities/BGL/boost/detail/dynamic_bitset.hpp index f83f781dfa2fceaf6946958e737b1e28928f12f3..281aa55cd6725b3593bd14b5eb0037b00596478f 100644 --- a/Utilities/BGL/boost/detail/dynamic_bitset.hpp +++ b/Utilities/BGL/boost/detail/dynamic_bitset.hpp @@ -1,7 +1,7 @@ -// -------------------------------------------------- +// ----------------------------------------------------------- // -// (C) Copyright Chuck Allison and Jeremy Siek 2001 - 2002. -// (C) Copyright Gennaro Prota 2003 - 2004. +// Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek +// Copyright (c) 2003-2006, 2008 Gennaro Prota // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -9,21 +9,18 @@ // // ----------------------------------------------------------- -// See http://www.boost.org/libs/dynamic_bitset for documentation. - - #ifndef BOOST_DETAIL_DYNAMIC_BITSET_HPP #define BOOST_DETAIL_DYNAMIC_BITSET_HPP -#include <cstddef> // for std::size_t +#include <cstddef> #include "boost/config.hpp" #include "boost/detail/workaround.hpp" -//#include "boost/static_assert.hpp" // gps namespace boost { namespace detail { + namespace dynamic_bitset_impl { // Gives (read-)access to the object representation // of an object of type T (3.9p4). CANNOT be used @@ -35,16 +32,41 @@ namespace boost { return static_cast<const unsigned char *>(static_cast<const void *>(p)); } + template<typename T, int amount, int width /* = default */> + struct shifter + { + static void left_shift(T & v) { + amount >= width ? (v = 0) + : (v >>= BOOST_DYNAMIC_BITSET_WRAP_CONSTANT(amount)); + } + }; // ------- count function implementation -------------- - namespace dynamic_bitset_count_impl { - typedef unsigned char byte_type; - enum mode { access_by_bytes, access_by_blocks }; + // These two entities + // + // enum mode { access_by_bytes, access_by_blocks }; + // template <mode> struct mode_to_type {}; + // + // were removed, since the regression logs (as of 24 Aug 2008) + // showed that several compilers had troubles with recognizing + // + // const mode m = access_by_bytes + // + // as a constant expression + // + // * So, we'll use bool, instead of enum *. + // + template <bool value> + struct value_to_type + { + value_to_type() {} + }; + const bool access_by_bytes = true; + const bool access_by_blocks = false; - template <mode> struct mode_to_type {}; // the table: wrapped in a class template, so // that it is only instantiated if/when needed @@ -79,7 +101,7 @@ namespace boost { template <typename Iterator> inline std::size_t do_count(Iterator first, std::size_t length, int /*dummy param*/, - mode_to_type<access_by_bytes>* ) + value_to_type<access_by_bytes>* ) { std::size_t num = 0; if (length) @@ -103,7 +125,7 @@ namespace boost { // template <typename Iterator, typename ValueType> inline std::size_t do_count(Iterator first, std::size_t length, ValueType, - mode_to_type<access_by_blocks>*) + value_to_type<access_by_blocks>*) { std::size_t num = 0; while (length){ @@ -121,8 +143,6 @@ namespace boost { return num; } - - } // dynamic_bitset_count_impl // ------------------------------------------------------- @@ -131,7 +151,7 @@ namespace boost { // // size_type(-1) / sizeof(T) // - // from vector<>::max_size. This tries to get out more + // from vector<>::max_size. This tries to get more // meaningful info. // template <typename T> @@ -150,16 +170,57 @@ namespace boost { // for static_asserts template <typename T> - struct dynamic_bitset_allowed_block_type { + struct allowed_block_type { enum { value = T(-1) > 0 }; // ensure T has no sign }; template <> - struct dynamic_bitset_allowed_block_type<bool> { + struct allowed_block_type<bool> { enum { value = false }; }; + template <typename T> + struct is_numeric { + enum { value = false }; + }; + +# define BOOST_dynamic_bitset_is_numeric(x) \ + template<> \ + struct is_numeric< x > { \ + enum { value = true }; \ + } /**/ + + BOOST_dynamic_bitset_is_numeric(bool); + BOOST_dynamic_bitset_is_numeric(char); + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + BOOST_dynamic_bitset_is_numeric(wchar_t); +#endif + + BOOST_dynamic_bitset_is_numeric(signed char); + BOOST_dynamic_bitset_is_numeric(short int); + BOOST_dynamic_bitset_is_numeric(int); + BOOST_dynamic_bitset_is_numeric(long int); + + BOOST_dynamic_bitset_is_numeric(unsigned char); + BOOST_dynamic_bitset_is_numeric(unsigned short); + BOOST_dynamic_bitset_is_numeric(unsigned int); + BOOST_dynamic_bitset_is_numeric(unsigned long); + +#if defined(BOOST_HAS_LONG_LONG) + BOOST_dynamic_bitset_is_numeric(::boost::long_long_type); + BOOST_dynamic_bitset_is_numeric(::boost::ulong_long_type); +#endif + + // intentionally omitted + //BOOST_dynamic_bitset_is_numeric(float); + //BOOST_dynamic_bitset_is_numeric(double); + //BOOST_dynamic_bitset_is_numeric(long double); + +#undef BOOST_dynamic_bitset_is_numeric + + } // dynamic_bitset_impl } // namespace detail } // namespace boost diff --git a/Utilities/BGL/boost/detail/endian.hpp b/Utilities/BGL/boost/detail/endian.hpp index 5f12fbe26d1502bb3ab11050a7d644b9a0f7ff4f..36ddb7e1e5d0f9d59c824f40afe9e15866985b49 100644 --- a/Utilities/BGL/boost/detail/endian.hpp +++ b/Utilities/BGL/boost/detail/endian.hpp @@ -1,3 +1,8 @@ +// Copyright 2005 Caleb Epstein +// Copyright 2006 John Maddock +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. @@ -37,9 +42,15 @@ # error Unknown machine endianness detected. # endif # define BOOST_BYTE_ORDER __BYTE_ORDER +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) +# define BOOST_BIG_ENDIAN +# define BOOST_BYTE_ORDER 4321 +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define BOOST_LITTLE_ENDIAN +# define BOOST_BYTE_ORDER 1234 #elif defined(__sparc) || defined(__sparc__) \ || defined(_POWER) || defined(__powerpc__) \ - || defined(__ppc__) || defined(__hppa) \ + || defined(__ppc__) || defined(__hpux) || defined(__hppa) \ || defined(_MIPSEB) || defined(_POWER) \ || defined(__s390__) # define BOOST_BIG_ENDIAN @@ -47,7 +58,11 @@ #elif defined(__i386__) || defined(__alpha__) \ || defined(__ia64) || defined(__ia64__) \ || defined(_M_IX86) || defined(_M_IA64) \ - || defined(_M_ALPHA) + || defined(_M_ALPHA) || defined(__amd64) \ + || defined(__amd64__) || defined(_M_AMD64) \ + || defined(__x86_64) || defined(__x86_64__) \ + || defined(_M_X64) || defined(__bfin__) + # define BOOST_LITTLE_ENDIAN # define BOOST_BYTE_ORDER 1234 #else diff --git a/Utilities/BGL/boost/detail/has_default_constructor.hpp b/Utilities/BGL/boost/detail/has_default_constructor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..319b30abcd0a533987b3ec126e42790b0c1971e4 --- /dev/null +++ b/Utilities/BGL/boost/detail/has_default_constructor.hpp @@ -0,0 +1,29 @@ + +// (C) Copyright Matthias Troyerk 2006. +// 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/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED +#define BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED + +#include <boost/type_traits/has_trivial_constructor.hpp> + +namespace boost { namespace detail { + +/// type trait to check for a default constructor +/// +/// The default implementation just checks for a trivial constructor. +/// Using some compiler magic it might be possible to provide a better default + +template <class T> +struct has_default_constructor + : public has_trivial_constructor<T> +{}; + +} } // namespace boost::detail + + +#endif // BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/identifier.hpp b/Utilities/BGL/boost/detail/identifier.hpp new file mode 100644 index 0000000000000000000000000000000000000000..688a664f7d954a0f9be8e3416dedff0224de23c6 --- /dev/null +++ b/Utilities/BGL/boost/detail/identifier.hpp @@ -0,0 +1,89 @@ +// boost/identifier.hpp ----------------------------------------------------// + +// Copyright Beman Dawes 2006 + +// 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 documentation at http://www.boost.org/libs/utility + +#ifndef BOOST_IDENTIFIER_HPP +#define BOOST_IDENTIFIER_HPP + +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_base_of.hpp> +#include <iosfwd> + +namespace boost +{ + namespace detail + { + // class template identifier ---------------------------------------------// + + // Always used as a base class so that different instantiations result in + // different class types even if instantiated with the same value type T. + + // Expected usage is that T is often an integer type, best passed by + // value. There is no reason why T can't be a possibly larger class such as + // std::string, best passed by const reference. + + // This implementation uses pass by value, based on expected common uses. + + template <typename T, typename D> + class identifier + { + public: + typedef T value_type; + + const value_type value() const { return m_value; } + void assign( value_type v ) { m_value = v; } + + bool operator==( const D & rhs ) const { return m_value == rhs.m_value; } + bool operator!=( const D & rhs ) const { return m_value != rhs.m_value; } + bool operator< ( const D & rhs ) const { return m_value < rhs.m_value; } + bool operator<=( const D & rhs ) const { return m_value <= rhs.m_value; } + bool operator> ( const D & rhs ) const { return m_value > rhs.m_value; } + bool operator>=( const D & rhs ) const { return m_value >= rhs.m_value; } + + typedef void (*unspecified_bool_type)(D); // without the D, unspecified_bool_type + static void unspecified_bool_true(D){} // conversion allows relational operators + // between different identifier types + + operator unspecified_bool_type() const { return m_value == value_type() ? 0 : unspecified_bool_true; } + bool operator!() const { return m_value == value_type(); } + + // constructors are protected so that class can only be used as a base class + protected: + identifier() {} + explicit identifier( value_type v ) : m_value(v) {} + + #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround + private: + #endif + T m_value; + }; + + //#ifndef BOOST_NO_SFINAE + + // template <class Ostream, class Id> + // typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >, + // Ostream & >::type operator<<( Ostream & os, const Id & id ) + // { + // return os << id.value(); + // } + + // template <class Istream, class Id> + // typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >, + // Istream & >::type operator>>( Istream & is, Id & id ) + // { + // typename Id::value_type v; + // is >> v; + // id.value( v ); + // return is; + // } + //#endif + + } // namespace detail +} // namespace boost + +#endif // BOOST_IDENTIFIER_HPP diff --git a/Utilities/BGL/boost/detail/indirect_traits.hpp b/Utilities/BGL/boost/detail/indirect_traits.hpp index 6ee8a10a49620a66cf23d2e34efdd8d9ee63109d..f9c0cd6a04c5baf1044d5f13631500de630347b1 100644 --- a/Utilities/BGL/boost/detail/indirect_traits.hpp +++ b/Utilities/BGL/boost/detail/indirect_traits.hpp @@ -388,27 +388,27 @@ typename is_pointer_help<V>::type reference_to_pointer_helper(V&); outer_no_type reference_to_pointer_helper(...); template <class T> -struct is_reference_to_pointer +struct reference_to_pointer_impl { static T t; BOOST_STATIC_CONSTANT( bool, value - = (is_reference<T>::value - && sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type)) + = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type)) ); typedef mpl::bool_<value> type; +}; +template <class T> +struct is_reference_to_pointer + : mpl::eval_if<is_reference<T>, reference_to_pointer_impl<T>, mpl::false_>::type +{ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T)) }; template <class T> struct is_reference_to_function_pointer - : mpl::if_< - is_reference<T> - , is_pointer_to_function_aux<T> - , mpl::bool_<false> - >::type + : mpl::eval_if<is_reference<T>, is_pointer_to_function_aux<T>, mpl::false_>::type { BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T)) }; diff --git a/Utilities/BGL/boost/detail/interlocked.hpp b/Utilities/BGL/boost/detail/interlocked.hpp index 025f3b542ceec180edeb2e1c04a00bfc31f5a772..fccebc3f707cdec7688303f17f9e3bb22d31e641 100644 --- a/Utilities/BGL/boost/detail/interlocked.hpp +++ b/Utilities/BGL/boost/detail/interlocked.hpp @@ -26,22 +26,85 @@ # define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement # define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement # define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer + +#elif defined(_WIN32_WCE) + +// under Windows CE we still have old-style Interlocked* functions + +extern "C" long __cdecl InterlockedIncrement( long* ); +extern "C" long __cdecl InterlockedDecrement( long* ); +extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); +extern "C" long __cdecl InterlockedExchange( long*, long ); +extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); + +# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long*)(dest),(long)(exchange))) #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) +#if defined( __CLRCALL_PURE_OR_CDECL ) + +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long ); + +#else + extern "C" long __cdecl _InterlockedIncrement( long volatile * ); extern "C" long __cdecl _InterlockedDecrement( long volatile * ); extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); + +#endif # pragma intrinsic( _InterlockedIncrement ) # pragma intrinsic( _InterlockedDecrement ) # pragma intrinsic( _InterlockedCompareExchange ) +# pragma intrinsic( _InterlockedExchange ) +# pragma intrinsic( _InterlockedExchangeAdd ) + +# if defined(_M_IA64) || defined(_M_AMD64) + +extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* ); +extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); + +# pragma intrinsic( _InterlockedCompareExchangePointer ) +# pragma intrinsic( _InterlockedExchangePointer ) + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer + +# else + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) + +# endif # define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement # define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement # define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) namespace boost { @@ -52,14 +115,23 @@ namespace detail extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); } // namespace detail } // namespace boost -# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement -# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement -# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) #else diff --git a/Utilities/BGL/boost/detail/is_incrementable.hpp b/Utilities/BGL/boost/detail/is_incrementable.hpp index 0ae4eca84ffcc13dba1bf5921981e05e533d7533..1c8fd5785b5aedebd3eb04ac4ec2d83386d5c80d 100644 --- a/Utilities/BGL/boost/detail/is_incrementable.hpp +++ b/Utilities/BGL/boost/detail/is_incrementable.hpp @@ -4,13 +4,15 @@ #ifndef IS_INCREMENTABLE_DWA200415_HPP # define IS_INCREMENTABLE_DWA200415_HPP -# include <boost/type_traits/detail/bool_trait_def.hpp> # include <boost/type_traits/detail/template_arity_spec.hpp> # include <boost/type_traits/remove_cv.hpp> # include <boost/mpl/aux_/lambda_support.hpp> # include <boost/mpl/bool.hpp> # include <boost/detail/workaround.hpp> +// Must be the last include +# include <boost/type_traits/detail/bool_trait_def.hpp> + namespace boost { namespace detail { // is_incrementable<T> metafunction @@ -61,7 +63,12 @@ namespace is_incrementable_ tag operator,(tag,int); # define BOOST_comma(a,b) (a,b) # endif - + +# if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4913) // Warning about operator, +# endif + // two check overloads help us identify which operator++ was picked char (& check(tag) )[2]; @@ -90,6 +97,11 @@ namespace is_incrementable_ , value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1 ); }; + +# if defined(BOOST_MSVC) +# pragma warning(pop) +# endif + } # undef BOOST_comma @@ -117,5 +129,6 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable) } // namespace boost +# include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // IS_INCREMENTABLE_DWA200415_HPP diff --git a/Utilities/BGL/boost/detail/lcast_precision.hpp b/Utilities/BGL/boost/detail/lcast_precision.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d40ca21eb3c2f4225d45d9686cfa94598b8b5f20 --- /dev/null +++ b/Utilities/BGL/boost/detail/lcast_precision.hpp @@ -0,0 +1,184 @@ +// Copyright Alexander Nasonov & Paul A. Bristow 2006. + +// 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_DETAIL_LCAST_PRECISION_HPP_INCLUDED +#define BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED + +#include <climits> +#include <ios> +#include <limits> + +#include <boost/config.hpp> +#include <boost/integer_traits.hpp> + +#ifndef BOOST_NO_IS_ABSTRACT +// Fix for SF:1358600 - lexical_cast & pure virtual functions & VC 8 STL +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_abstract.hpp> +#endif + +#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || \ + (defined(BOOST_MSVC) && (BOOST_MSVC<1310)) + +#define BOOST_LCAST_NO_COMPILE_TIME_PRECISION +#endif + +#ifdef BOOST_LCAST_NO_COMPILE_TIME_PRECISION +#include <boost/assert.hpp> +#else +#include <boost/static_assert.hpp> +#endif + +namespace boost { namespace detail { + +class lcast_abstract_stub {}; + +#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION +// Calculate an argument to pass to std::ios_base::precision from +// lexical_cast. See alternative implementation for broken standard +// libraries in lcast_get_precision below. Keep them in sync, please. +template<class T> +struct lcast_precision +{ +#ifdef BOOST_NO_IS_ABSTRACT + typedef std::numeric_limits<T> limits; // No fix for SF:1358600. +#else + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::is_abstract<T> + , std::numeric_limits<lcast_abstract_stub> + , std::numeric_limits<T> + >::type limits; +#endif + + BOOST_STATIC_CONSTANT(bool, use_default_precision = + !limits::is_specialized || limits::is_exact + ); + + BOOST_STATIC_CONSTANT(bool, is_specialized_bin = + !use_default_precision && + limits::radix == 2 && limits::digits > 0 + ); + + BOOST_STATIC_CONSTANT(bool, is_specialized_dec = + !use_default_precision && + limits::radix == 10 && limits::digits10 > 0 + ); + + BOOST_STATIC_CONSTANT(std::streamsize, streamsize_max = + boost::integer_traits<std::streamsize>::const_max + ); + + BOOST_STATIC_CONSTANT(unsigned int, precision_dec = limits::digits10 + 1U); + + BOOST_STATIC_ASSERT(!is_specialized_dec || + precision_dec <= streamsize_max + 0UL + ); + + BOOST_STATIC_CONSTANT(unsigned long, precision_bin = + 2UL + limits::digits * 30103UL / 100000UL + ); + + BOOST_STATIC_ASSERT(!is_specialized_bin || + (limits::digits + 0UL < ULONG_MAX / 30103UL && + precision_bin > limits::digits10 + 0UL && + precision_bin <= streamsize_max + 0UL) + ); + + BOOST_STATIC_CONSTANT(std::streamsize, value = + is_specialized_bin ? precision_bin + : is_specialized_dec ? precision_dec : 6 + ); +}; +#endif + +template<class T> +inline std::streamsize lcast_get_precision(T* = 0) +{ +#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION + return lcast_precision<T>::value; +#else // Follow lcast_precision algorithm at run-time: + +#ifdef BOOST_NO_IS_ABSTRACT + typedef std::numeric_limits<T> limits; // No fix for SF:1358600. +#else + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::is_abstract<T> + , std::numeric_limits<lcast_abstract_stub> + , std::numeric_limits<T> + >::type limits; +#endif + + bool const use_default_precision = + !limits::is_specialized || limits::is_exact; + + if(!use_default_precision) + { // Includes all built-in floating-point types, float, double ... + // and UDT types for which digits (significand bits) is defined (not zero) + + bool const is_specialized_bin = + limits::radix == 2 && limits::digits > 0; + bool const is_specialized_dec = + limits::radix == 10 && limits::digits10 > 0; + std::streamsize const streamsize_max = + (boost::integer_traits<std::streamsize>::max)(); + + if(is_specialized_bin) + { // Floating-point types with + // limits::digits defined by the specialization. + + unsigned long const digits = limits::digits; + unsigned long const precision = 2UL + digits * 30103UL / 100000UL; + // unsigned long is selected because it is at least 32-bits + // and thus ULONG_MAX / 30103UL is big enough for all types. + BOOST_ASSERT( + digits < ULONG_MAX / 30103UL && + precision > limits::digits10 + 0UL && + precision <= streamsize_max + 0UL + ); + return precision; + } + else if(is_specialized_dec) + { // Decimal Floating-point type, most likely a User Defined Type + // rather than a real floating-point hardware type. + unsigned int const precision = limits::digits10 + 1U; + BOOST_ASSERT(precision <= streamsize_max + 0UL); + return precision; + } + } + + // Integral type (for which precision has no effect) + // or type T for which limits is NOT specialized, + // so assume stream precision remains the default 6 decimal digits. + // Warning: if your User-defined Floating-point type T is NOT specialized, + // then you may lose accuracy by only using 6 decimal digits. + // To avoid this, you need to specialize T with either + // radix == 2 and digits == the number of significand bits, + // OR + // radix = 10 and digits10 == the number of decimal digits. + + return 6; +#endif +} + +template<class T> +inline void lcast_set_precision(std::ios_base& stream, T*) +{ + stream.precision(lcast_get_precision<T>()); +} + +template<class Source, class Target> +inline void lcast_set_precision(std::ios_base& stream, Source*, Target*) +{ + std::streamsize const s = lcast_get_precision((Source*)0); + std::streamsize const t = lcast_get_precision((Target*)0); + stream.precision(s > t ? s : t); +} + +}} + +#endif // BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED + diff --git a/Utilities/BGL/boost/detail/lightweight_mutex.hpp b/Utilities/BGL/boost/detail/lightweight_mutex.hpp index a0936cbb95ad4c52ba2c283fd1ff9c9563c3232e..b7a7f6dd4ed6139f1c18bf8d33e5a7e7020669e0 100644 --- a/Utilities/BGL/boost/detail/lightweight_mutex.hpp +++ b/Utilities/BGL/boost/detail/lightweight_mutex.hpp @@ -12,31 +12,11 @@ // // Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. // -// 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) +// 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 // -// typedef <unspecified> boost::detail::lightweight_mutex; -// -// boost::detail::lightweight_mutex is a header-only implementation of -// a subset of the Mutex concept requirements: -// -// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex -// -// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. -// - -#include <boost/config.hpp> -#if !defined(BOOST_HAS_THREADS) -# include <boost/detail/lwm_nop.hpp> -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) -# include <boost/detail/lwm_win32_cs.hpp> -#elif defined(BOOST_HAS_PTHREADS) -# include <boost/detail/lwm_pthreads.hpp> -#else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform -#endif +#include <boost/smart_ptr/detail/lightweight_mutex.hpp> #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/lightweight_test.hpp b/Utilities/BGL/boost/detail/lightweight_test.hpp index b651e0e335a67fd575c0741c0da8af50ef142f4f..ffa750d324e7735e04f20eff6b44e6e9567557ff 100644 --- a/Utilities/BGL/boost/detail/lightweight_test.hpp +++ b/Utilities/BGL/boost/detail/lightweight_test.hpp @@ -10,14 +10,15 @@ // // boost/detail/lightweight_test.hpp - lightweight test library // -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2002, 2009 Peter Dimov // -// 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) +// 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 // // BOOST_TEST(expression) // BOOST_ERROR(message) +// BOOST_TEST_EQ(expr1, expr2) // // int boost::report_errors() // @@ -49,13 +50,27 @@ inline void error_impl(char const * msg, char const * file, int line, char const ++test_errors(); } +template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u ) +{ + if( t == u ) + { + } + else + { + std::cerr << file << "(" << line << "): test '" << expr1 << " == " << expr2 + << "' failed in function '" << function << "': " + << "'" << t << "' != '" << u << "'" << std::endl; + ++test_errors(); + } +} + } // namespace detail inline int report_errors() { int errors = detail::test_errors(); - if(errors == 0) + if( errors == 0 ) { std::cerr << "No errors detected." << std::endl; return 0; @@ -71,5 +86,6 @@ inline int report_errors() #define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)) #define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) +#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/lightweight_thread.hpp b/Utilities/BGL/boost/detail/lightweight_thread.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6fe70a613d297c24f0536544158747be4dc7bf50 --- /dev/null +++ b/Utilities/BGL/boost/detail/lightweight_thread.hpp @@ -0,0 +1,135 @@ +#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED +#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/detail/lightweight_thread.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/config.hpp> +#include <memory> +#include <cerrno> + +// pthread_create, pthread_join + +#if defined( BOOST_HAS_PTHREADS ) + +#include <pthread.h> + +#else + +#include <windows.h> +#include <process.h> + +typedef HANDLE pthread_t; + +int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg ) +{ + HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 ); + + if( h != 0 ) + { + *thread = h; + return 0; + } + else + { + return EAGAIN; + } +} + +int pthread_join( pthread_t thread, void ** /*value_ptr*/ ) +{ + ::WaitForSingleObject( thread, INFINITE ); + ::CloseHandle( thread ); + return 0; +} + +#endif + +// template<class F> int lw_thread_create( pthread_t & pt, F f ); + +namespace boost +{ + +namespace detail +{ + +class lw_abstract_thread +{ +public: + + virtual ~lw_abstract_thread() {} + virtual void run() = 0; +}; + +#if defined( BOOST_HAS_PTHREADS ) + +extern "C" void * lw_thread_routine( void * pv ) +{ + std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); + + pt->run(); + + return 0; +} + +#else + +unsigned __stdcall lw_thread_routine( void * pv ) +{ + std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); + + pt->run(); + + return 0; +} + +#endif + +template<class F> class lw_thread_impl: public lw_abstract_thread +{ +public: + + explicit lw_thread_impl( F f ): f_( f ) + { + } + + void run() + { + f_(); + } + +private: + + F f_; +}; + +template<class F> int lw_thread_create( pthread_t & pt, F f ) +{ + std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) ); + + int r = pthread_create( &pt, 0, lw_thread_routine, p.get() ); + + if( r == 0 ) + { + p.release(); + } + + return r; +} + +} // namespace detail +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/limits.hpp b/Utilities/BGL/boost/detail/limits.hpp index 414ca9759071ef360f5e92b50fd6e95a97b85ecf..6f018dfaca79badd4842f5e4cbbb623b06b0f6d2 100644 --- a/Utilities/BGL/boost/detail/limits.hpp +++ b/Utilities/BGL/boost/detail/limits.hpp @@ -1,3 +1,7 @@ +// Copyright 2001 John Maddock +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + /* * Copyright (c) 1997 * Silicon Graphics Computer Systems, Inc. diff --git a/Utilities/BGL/boost/detail/ob_call_traits.hpp b/Utilities/BGL/boost/detail/ob_call_traits.hpp index 42f12fdc6d5b3cb3742ee25e00748999647d8f98..eb4df7a30f1969e0fb33d09578c83f4912f09e9a 100644 --- a/Utilities/BGL/boost/detail/ob_call_traits.hpp +++ b/Utilities/BGL/boost/detail/ob_call_traits.hpp @@ -3,10 +3,10 @@ // 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/butility for most recent version including documentation. +// See http://www.boost.org/libs/utility for most recent version including documentation. // // Crippled version for crippled compilers: -// see libs/butility/call_traits.htm +// see libs/utility/call_traits.htm // /* Release notes: diff --git a/Utilities/BGL/boost/detail/ob_compressed_pair.hpp b/Utilities/BGL/boost/detail/ob_compressed_pair.hpp index 280fe43dd5a2d711d67870febdc190f22e9c4d56..727acab6da498aa212c3c7d20057f9f661e7063d 100644 --- a/Utilities/BGL/boost/detail/ob_compressed_pair.hpp +++ b/Utilities/BGL/boost/detail/ob_compressed_pair.hpp @@ -3,8 +3,8 @@ // 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/butility for most recent version including documentation. -// see libs/butility/compressed_pair.hpp +// See http://www.boost.org/libs/utility for most recent version including documentation. +// see libs/utility/compressed_pair.hpp // /* Release notes: 20 Jan 2001: diff --git a/Utilities/BGL/boost/detail/quick_allocator.hpp b/Utilities/BGL/boost/detail/quick_allocator.hpp index eb6398ce3a8c56dc594106cbfa38aa167551ac8e..d54b3a792d7ca03bf715f5c50a7c556f9389cb3f 100644 --- a/Utilities/BGL/boost/detail/quick_allocator.hpp +++ b/Utilities/BGL/boost/detail/quick_allocator.hpp @@ -13,176 +13,11 @@ // Copyright (c) 2003 David Abrahams // Copyright (c) 2003 Peter Dimov // -// 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) +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt // -#include <boost/config.hpp> - -#include <boost/detail/lightweight_mutex.hpp> -#include <boost/type_traits/type_with_alignment.hpp> -#include <boost/type_traits/alignment_of.hpp> - -#include <new> // ::operator new, ::operator delete -#include <cstddef> // std::size_t - -namespace boost -{ - -namespace detail -{ - -template<unsigned size, unsigned align_> union freeblock -{ - typedef typename boost::type_with_alignment<align_>::type aligner_type; - aligner_type aligner; - char bytes[size]; - freeblock * next; -}; - -template<unsigned size, unsigned align_> struct allocator_impl -{ - typedef freeblock<size, align_> block; - - // It may seem odd to use such small pages. - // - // However, on a typical Windows implementation that uses - // the OS allocator, "normal size" pages interact with the - // "ordinary" operator new, slowing it down dramatically. - // - // 512 byte pages are handled by the small object allocator, - // and don't interfere with ::new. - // - // The other alternative is to use much bigger pages (1M.) - // - // It is surprisingly easy to hit pathological behavior by - // varying the page size. g++ 2.96 on Red Hat Linux 7.2, - // for example, passionately dislikes 496. 512 seems OK. - -#if defined(BOOST_QA_PAGE_SIZE) - - enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; - -#else - - enum { items_per_page = 512 / size }; // 1048560 / size - -#endif - -#ifdef BOOST_HAS_THREADS - static lightweight_mutex mutex; -#endif - - static block * free; - static block * page; - static unsigned last; - - static inline void * alloc() - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock(mutex); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - // "Listen to me carefully: there is no memory leak" - // -- Scott Meyers, Eff C++ 2nd Ed Item 10 - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - - static inline void * alloc(std::size_t n) - { - if(n != size) // class-specific new called for a derived object - { - return ::operator new(n); - } - else - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock(mutex); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - } - - static inline void dealloc(void * pv) - { - if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock(mutex); -#endif - block * pb = static_cast<block *>(pv); - pb->next = free; - free = pb; - } - } - - static inline void dealloc(void * pv, std::size_t n) - { - if(n != size) // class-specific delete called for a derived object - { - ::operator delete(pv); - } - else if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock(mutex); -#endif - block * pb = static_cast<block *>(pv); - pb->next = free; - free = pb; - } - } -}; - -#ifdef BOOST_HAS_THREADS -template<unsigned size, unsigned align_> - lightweight_mutex allocator_impl<size, align_>::mutex; -#endif - -template<unsigned size, unsigned align_> - freeblock<size, align_> * allocator_impl<size, align_>::free = 0; - -template<unsigned size, unsigned align_> - freeblock<size, align_> * allocator_impl<size, align_>::page = 0; - -template<unsigned size, unsigned align_> - unsigned allocator_impl<size, align_>::last = allocator_impl<size, align_>::items_per_page; - -template<class T> -struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of<T>::value > -{ -}; - -} // namespace detail - -} // namespace boost +#include <boost/smart_ptr/detail/quick_allocator.hpp> #endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/scoped_enum_emulation.hpp b/Utilities/BGL/boost/detail/scoped_enum_emulation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..644c1386b7a4c3f2fd5e327350b831a329eaf80c --- /dev/null +++ b/Utilities/BGL/boost/detail/scoped_enum_emulation.hpp @@ -0,0 +1,56 @@ +// scoped_enum_emulation.hpp ---------------------------------------------------------// + +// Copyright Beman Dawes, 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x +// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS +// macro is used to detect feature support. +// +// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a +// description of the scoped enum feature. Note that the committee changed the name +// from strongly typed enum to scoped enum. +// +// Caution: only the syntax is emulated; the semantics are not emulated and +// the syntax emulation doesn't include being able to specify the underlying +// representation type. +// +// The emulation is via struct rather than namespace to allow use within classes. +// Thanks to Andrey Semashev for pointing that out. +// +// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, +// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente +// Botet, and Daniel James. +// +// Sample usage: +// +// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END +// ... +// BOOST_SCOPED_ENUM(algae) sample( algae::red ); +// void foo( BOOST_SCOPED_ENUM(algae) color ); +// ... +// sample = algae::green; +// foo( algae::cyan ); + +#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP +#define BOOST_SCOPED_ENUM_EMULATION_HPP + +#include <boost/config.hpp> + +#ifdef BOOST_NO_SCOPED_ENUMS + +# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t +# define BOOST_SCOPED_ENUM_END }; +# define BOOST_SCOPED_ENUM(name) name::enum_t + +#else + +# define BOOST_SCOPED_ENUM_START(name) enum class name +# define BOOST_SCOPED_ENUM_END +# define BOOST_SCOPED_ENUM(name) name + +#endif + +#endif // BOOST_SCOPED_ENUM_EMULATION_HPP diff --git a/Utilities/BGL/boost/detail/sp_counted_base.hpp b/Utilities/BGL/boost/detail/sp_counted_base.hpp deleted file mode 100644 index bc170caf035e4998c0756a5730d7d242d26bd2f9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/detail/sp_counted_base.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base.hpp -// -// Copyright 2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include <boost/config.hpp> - -#if defined( BOOST_SP_DISABLE_THREADS ) - -# include <boost/detail/sp_counted_base_nt.hpp> - -#elif defined( BOOST_SP_USE_PTHREADS ) - -# include <boost/detail/sp_counted_base_pt.hpp> - -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) - -# include <boost/detail/sp_counted_base_gcc_x86.hpp> - -//~ #elif defined( __MWERKS__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) - -//~ # include <boost/detail/sp_counted_base_cw_x86.hpp> - -#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) - -# include <boost/detail/sp_counted_base_gcc_ia64.hpp> - -#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) - -# include <boost/detail/sp_counted_base_cw_ppc.hpp> - -#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) ) - -# include <boost/detail/sp_counted_base_gcc_ppc.hpp> - -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) - -# include <boost/detail/sp_counted_base_w32.hpp> - -#elif !defined( BOOST_HAS_THREADS ) - -# include <boost/detail/sp_counted_base_nt.hpp> - -#elif defined( BOOST_HAS_PTHREADS ) - -# include <boost/detail/sp_counted_base_pt.hpp> - -#else - -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform - -#endif - -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_typeinfo.hpp b/Utilities/BGL/boost/detail/sp_typeinfo.hpp new file mode 100644 index 0000000000000000000000000000000000000000..636fe277bc0e867c4142bd9810e616b9b8ac6921 --- /dev/null +++ b/Utilities/BGL/boost/detail/sp_typeinfo.hpp @@ -0,0 +1,129 @@ +#ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED +#define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_typeinfo.hpp +// +// Copyright 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/config.hpp> + +#if defined( BOOST_NO_TYPEID ) + +#include <boost/current_function.hpp> +#include <functional> + +namespace boost +{ + +namespace detail +{ + +class sp_typeinfo +{ +private: + + sp_typeinfo( sp_typeinfo const& ); + sp_typeinfo& operator=( sp_typeinfo const& ); + + char const * name_; + +public: + + explicit sp_typeinfo( char const * name ): name_( name ) + { + } + + bool operator==( sp_typeinfo const& rhs ) const + { + return this == &rhs; + } + + bool operator!=( sp_typeinfo const& rhs ) const + { + return this != &rhs; + } + + bool before( sp_typeinfo const& rhs ) const + { + return std::less< sp_typeinfo const* >()( this, &rhs ); + } + + char const* name() const + { + return name_; + } +}; + +template<class T> struct sp_typeid_ +{ + static sp_typeinfo ti_; + + static char const * name() + { + return BOOST_CURRENT_FUNCTION; + } +}; + +template<class T> sp_typeinfo sp_typeid_< T >::ti_( sp_typeid_< T >::name() ); + +template<class T> struct sp_typeid_< T & >: sp_typeid_< T > +{ +}; + +template<class T> struct sp_typeid_< T const >: sp_typeid_< T > +{ +}; + +template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T > +{ +}; + +template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T > +{ +}; + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_) + +#else + +#include <typeinfo> + +namespace boost +{ + +namespace detail +{ + +#if defined( BOOST_NO_STD_TYPEINFO ) + +typedef ::type_info sp_typeinfo; + +#else + +typedef std::type_info sp_typeinfo; + +#endif + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID(T) typeid(T) + +#endif + +#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/utf8_codecvt_facet.hpp b/Utilities/BGL/boost/detail/utf8_codecvt_facet.hpp index 97e6ddc110cb1a361d5c230b6931fe5d7f65dd2c..b777ff934ebfed8964c89ee0a2dc0b42e8694ccf 100644 --- a/Utilities/BGL/boost/detail/utf8_codecvt_facet.hpp +++ b/Utilities/BGL/boost/detail/utf8_codecvt_facet.hpp @@ -1,9 +1,7 @@ -// Copyright � 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) -// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). Permission to copy, -// use, modify, sell and distribute this software is granted provided this -// copyright notice appears in all copies. This software is provided "as is" -// without express or implied warranty, and with no claim as to its suitability -// for any purpose. +// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) +// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UTF8_CODECVT_FACET_HPP #define BOOST_UTF8_CODECVT_FACET_HPP @@ -81,25 +79,18 @@ // specialized on those types for this to work. #include <locale> -// for mbstate_t -#include <wchar.h> -// for std::size_t -#include <cstddef> +#include <cwchar> // for mbstate_t +#include <cstddef> // for std::size_t #include <boost/config.hpp> #include <boost/detail/workaround.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) namespace std { - #if defined(__LIBCOMO__) - using ::mbstate_t; - #elif defined(BOOST_DINKUMWARE_STDLIB) - using ::mbstate_t; - #elif defined(__SGI_STL_PORT) - #elif defined(BOOST_NO_STDC_NAMESPACE) - using ::mbstate_t; - using ::codecvt; - #endif -} // namespace std + using ::mbstate_t; + using ::size_t; +} +#endif #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) #define BOOST_CODECVT_DO_LENGTH_CONST const @@ -162,7 +153,7 @@ protected: virtual std::codecvt_base::result do_unshift( std::mbstate_t&, char * from, - char * to, + char * /*to*/, char * & next ) const { diff --git a/Utilities/BGL/boost/detail/workaround.hpp b/Utilities/BGL/boost/detail/workaround.hpp index b5ecad77446a6119cf4443e9634b2104c0dcd02f..b6b64125c6a8165ac7e033f6d872cfd5be5edfcb 100644 --- a/Utilities/BGL/boost/detail/workaround.hpp +++ b/Utilities/BGL/boost/detail/workaround.hpp @@ -9,7 +9,8 @@ // // Usage: // -// #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +// #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// // workaround for eVC4 and VC6 // ... // workaround code here // #endif // @@ -17,7 +18,7 @@ // first argument must be undefined or expand to a numeric // value. The above expands to: // -// (BOOST_MSVC) != 0 && (BOOST_MSVC) <= 1200 +// (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300 // // When used for workarounds that apply to the latest known version // and all earlier versions of a compiler, the following convention @@ -37,8 +38,196 @@ # ifndef BOOST_STRICT_CONFIG +#include <boost/config.hpp> + +#ifndef __BORLANDC__ +#define __BORLANDC___WORKAROUND_GUARD 1 +#else +#define __BORLANDC___WORKAROUND_GUARD 0 +#endif +#ifndef __CODEGEARC__ +#define __CODEGEARC___WORKAROUND_GUARD 1 +#else +#define __CODEGEARC___WORKAROUND_GUARD 0 +#endif +#ifndef _MSC_VER +#define _MSC_VER_WORKAROUND_GUARD 1 +#else +#define _MSC_VER_WORKAROUND_GUARD 0 +#endif +#ifndef _MSC_FULL_VER +#define _MSC_FULL_VER_WORKAROUND_GUARD 1 +#else +#define _MSC_FULL_VER_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_MSVC +#define BOOST_MSVC_WORKAROUND_GUARD 1 +#else +#define BOOST_MSVC_WORKAROUND_GUARD 0 +#endif +#ifndef __GNUC__ +#define __GNUC___WORKAROUND_GUARD 1 +#else +#define __GNUC___WORKAROUND_GUARD 0 +#endif +#ifndef __GNUC_MINOR__ +#define __GNUC_MINOR___WORKAROUND_GUARD 1 +#else +#define __GNUC_MINOR___WORKAROUND_GUARD 0 +#endif +#ifndef __GNUC_PATCHLEVEL__ +#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1 +#else +#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0 +#endif +#ifndef __IBMCPP__ +#define __IBMCPP___WORKAROUND_GUARD 1 +#else +#define __IBMCPP___WORKAROUND_GUARD 0 +#endif +#ifndef __SUNPRO_CC +#define __SUNPRO_CC_WORKAROUND_GUARD 1 +#else +#define __SUNPRO_CC_WORKAROUND_GUARD 0 +#endif +#ifndef __DECCXX_VER +#define __DECCXX_VER_WORKAROUND_GUARD 1 +#else +#define __DECCXX_VER_WORKAROUND_GUARD 0 +#endif +#ifndef __MWERKS__ +#define __MWERKS___WORKAROUND_GUARD 1 +#else +#define __MWERKS___WORKAROUND_GUARD 0 +#endif +#ifndef __EDG__ +#define __EDG___WORKAROUND_GUARD 1 +#else +#define __EDG___WORKAROUND_GUARD 0 +#endif +#ifndef __EDG_VERSION__ +#define __EDG_VERSION___WORKAROUND_GUARD 1 +#else +#define __EDG_VERSION___WORKAROUND_GUARD 0 +#endif +#ifndef __HP_aCC +#define __HP_aCC_WORKAROUND_GUARD 1 +#else +#define __HP_aCC_WORKAROUND_GUARD 0 +#endif +#ifndef __hpxstd98 +#define __hpxstd98_WORKAROUND_GUARD 1 +#else +#define __hpxstd98_WORKAROUND_GUARD 0 +#endif +#ifndef _CRAYC +#define _CRAYC_WORKAROUND_GUARD 1 +#else +#define _CRAYC_WORKAROUND_GUARD 0 +#endif +#ifndef __DMC__ +#define __DMC___WORKAROUND_GUARD 1 +#else +#define __DMC___WORKAROUND_GUARD 0 +#endif +#ifndef MPW_CPLUS +#define MPW_CPLUS_WORKAROUND_GUARD 1 +#else +#define MPW_CPLUS_WORKAROUND_GUARD 0 +#endif +#ifndef __COMO__ +#define __COMO___WORKAROUND_GUARD 1 +#else +#define __COMO___WORKAROUND_GUARD 0 +#endif +#ifndef __COMO_VERSION__ +#define __COMO_VERSION___WORKAROUND_GUARD 1 +#else +#define __COMO_VERSION___WORKAROUND_GUARD 0 +#endif +#ifndef __INTEL_COMPILER +#define __INTEL_COMPILER_WORKAROUND_GUARD 1 +#else +#define __INTEL_COMPILER_WORKAROUND_GUARD 0 +#endif +#ifndef __ICL +#define __ICL_WORKAROUND_GUARD 1 +#else +#define __ICL_WORKAROUND_GUARD 0 +#endif +#ifndef _COMPILER_VERSION +#define _COMPILER_VERSION_WORKAROUND_GUARD 1 +#else +#define _COMPILER_VERSION_WORKAROUND_GUARD 0 +#endif + +#ifndef _RWSTD_VER +#define _RWSTD_VER_WORKAROUND_GUARD 1 +#else +#define _RWSTD_VER_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_RWSTD_VER +#define BOOST_RWSTD_VER_WORKAROUND_GUARD 1 +#else +#define BOOST_RWSTD_VER_WORKAROUND_GUARD 0 +#endif +#ifndef __GLIBCPP__ +#define __GLIBCPP___WORKAROUND_GUARD 1 +#else +#define __GLIBCPP___WORKAROUND_GUARD 0 +#endif +#ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC +#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1 +#else +#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0 +#endif +#ifndef __SGI_STL_PORT +#define __SGI_STL_PORT_WORKAROUND_GUARD 1 +#else +#define __SGI_STL_PORT_WORKAROUND_GUARD 0 +#endif +#ifndef _STLPORT_VERSION +#define _STLPORT_VERSION_WORKAROUND_GUARD 1 +#else +#define _STLPORT_VERSION_WORKAROUND_GUARD 0 +#endif +#ifndef __LIBCOMO_VERSION__ +#define __LIBCOMO_VERSION___WORKAROUND_GUARD 1 +#else +#define __LIBCOMO_VERSION___WORKAROUND_GUARD 0 +#endif +#ifndef _CPPLIB_VER +#define _CPPLIB_VER_WORKAROUND_GUARD 1 +#else +#define _CPPLIB_VER_WORKAROUND_GUARD 0 +#endif + +#ifndef BOOST_INTEL_CXX_VERSION +#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1 +#else +#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_INTEL_WIN +#define BOOST_INTEL_WIN_WORKAROUND_GUARD 1 +#else +#define BOOST_INTEL_WIN_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_DINKUMWARE_STDLIB +#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1 +#else +#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0 +#endif +#ifndef BOOST_INTEL +#define BOOST_INTEL_WORKAROUND_GUARD 1 +#else +#define BOOST_INTEL_WORKAROUND_GUARD 0 +#endif +// Always define to zero, if it's used it'll be defined my MPL: +#define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0 + # define BOOST_WORKAROUND(symbol, test) \ - ((symbol != 0) && (1 % (( (symbol test) ) + 1))) + ((symbol ## _WORKAROUND_GUARD + 0 == 0) && \ + (symbol != 0) && (1 % (( (symbol test) ) + 1))) // ^ ^ ^ ^ // The extra level of parenthesis nesting above, along with the // BOOST_OPEN_PAREN indirection below, is required to satisfy the diff --git a/Utilities/BGL/boost/exception/all.hpp b/Utilities/BGL/boost/exception/all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9ffe42a9d0cf15cb5abb309795df82c6e880363e --- /dev/null +++ b/Utilities/BGL/boost/exception/all.hpp @@ -0,0 +1,36 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_316FDA946C0D11DEA9CBAE5255D89593 +#define UUID_316FDA946C0D11DEA9CBAE5255D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/exception/diagnostic_information.hpp> +#include <boost/exception/error_info.hpp> +#include <boost/exception/exception.hpp> +#include <boost/exception/get_error_info.hpp> +#include <boost/exception/info.hpp> +#include <boost/exception/info_tuple.hpp> +#include <boost/exception/errinfo_api_function.hpp> +#include <boost/exception/errinfo_at_line.hpp> +#include <boost/exception/errinfo_errno.hpp> +#include <boost/exception/errinfo_file_handle.hpp> +#include <boost/exception/errinfo_file_name.hpp> +#include <boost/exception/errinfo_file_open_mode.hpp> +#include <boost/exception/errinfo_type_info_name.hpp> +#ifndef BOOST_NO_EXCEPTIONS +#include <boost/exception/errinfo_nested_exception.hpp> +#include <boost/exception_ptr.hpp> +#endif + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/current_exception_cast.hpp b/Utilities/BGL/boost/exception/current_exception_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..af2f15311300795128bb672a0f9f8dd7a6402e2b --- /dev/null +++ b/Utilities/BGL/boost/exception/current_exception_cast.hpp @@ -0,0 +1,43 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_7E83C166200811DE885E826156D89593 +#define UUID_7E83C166200811DE885E826156D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +namespace +boost + { + template <class E> + inline + E * + current_exception_cast() + { + try + { + throw; + } + catch( + E & e ) + { + return &e; + } + catch( + ...) + { + return 0; + } + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/detail/attribute_noreturn.hpp b/Utilities/BGL/boost/exception/detail/attribute_noreturn.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f6a0b5903e36bed2e827e6430e14f2a150ce9645 --- /dev/null +++ b/Utilities/BGL/boost/exception/detail/attribute_noreturn.hpp @@ -0,0 +1,17 @@ +//Copyright (c) 2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_61531AB0680611DEADD5846855D89593 +#define UUID_61531AB0680611DEADD5846855D89593 + +#if defined(_MSC_VER) +#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn) +#elif defined(__GNUC__) +#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#else +#define BOOST_ATTRIBUTE_NORETURN +#endif + +#endif diff --git a/Utilities/BGL/boost/exception/detail/error_info_impl.hpp b/Utilities/BGL/boost/exception/detail/error_info_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..32113b1391e52a1f3fb2dbcfa6049f0b9c2f990a --- /dev/null +++ b/Utilities/BGL/boost/exception/detail/error_info_impl.hpp @@ -0,0 +1,75 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_CE6983AC753411DDA764247956D89593 +#define UUID_CE6983AC753411DDA764247956D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <string> + +namespace +boost + { + namespace + exception_detail + { + class + error_info_base + { + public: + + virtual char const * tag_typeid_name() const = 0; + virtual std::string value_as_string() const = 0; + + protected: + + ~error_info_base() throw() + { + } + }; + } + + template <class Tag,class T> + class + error_info: + public exception_detail::error_info_base + { + public: + + typedef T value_type; + + error_info( value_type const & value ); + ~error_info() throw(); + + value_type const & + value() const + { + return value_; + } + + value_type & + value() + { + return value_; + } + + private: + + char const * tag_typeid_name() const; + std::string value_as_string() const; + + value_type value_; + }; + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/detail/exception_ptr.hpp b/Utilities/BGL/boost/exception/detail/exception_ptr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..78db17c065b41f20b67b5edb26c44627c165cd8a --- /dev/null +++ b/Utilities/BGL/boost/exception/detail/exception_ptr.hpp @@ -0,0 +1,490 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_618474C2DE1511DEB74A388C56D89593 +#define UUID_618474C2DE1511DEB74A388C56D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/config.hpp> +#ifdef BOOST_NO_EXCEPTIONS +#error This header requires exception handling to be enabled. +#endif +#include <boost/exception/exception.hpp> +#include <boost/exception/info.hpp> +#include <boost/exception/diagnostic_information.hpp> +#include <boost/exception/detail/type_info.hpp> +#include <boost/shared_ptr.hpp> +#include <stdexcept> +#include <new> +#include <ios> + +namespace +boost + { +#ifndef BOOST_NO_RTTI + typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type; + + inline + std::string + to_string( original_exception_type const & x ) + { + return x.value()->name(); + } +#endif + + class exception_ptr; + exception_ptr current_exception(); + void rethrow_exception( exception_ptr const & ); + + class + exception_ptr + { + typedef bool exception_ptr::*unspecified_bool_type; + friend exception_ptr current_exception(); + friend void rethrow_exception( exception_ptr const & ); + + shared_ptr<exception_detail::clone_base const> c_; + bool bad_alloc_; + + struct + bad_alloc_tag + { + }; + + explicit + exception_ptr( bad_alloc_tag ): + bad_alloc_(true) + { + } + + explicit + exception_ptr( shared_ptr<exception_detail::clone_base const> const & c ): + c_(c), + bad_alloc_(false) + { + BOOST_ASSERT(c); + } + + void + rethrow() const + { + BOOST_ASSERT(*this); + if( bad_alloc_ ) + throw enable_current_exception(std::bad_alloc()); + else + c_->rethrow(); + } + + bool + empty() const + { + return !bad_alloc_ && !c_; + } + + public: + + exception_ptr(): + bad_alloc_(false) + { + } + + ~exception_ptr() throw() + { + } + + operator unspecified_bool_type() const + { + return empty() ? 0 : &exception_ptr::bad_alloc_; + } + + friend + bool + operator==( exception_ptr const & a, exception_ptr const & b ) + { + return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_; + } + + friend + bool + operator!=( exception_ptr const & a, exception_ptr const & b ) + { + return !(a==b); + } + }; + + class + unknown_exception: + public exception, + public std::exception, + public exception_detail::clone_base + { + public: + + unknown_exception() + { + } + + explicit + unknown_exception( std::exception const & e ) + { + add_original_type(e); + } + + explicit + unknown_exception( boost::exception const & e ): + boost::exception(e) + { + add_original_type(e); + } + + ~unknown_exception() throw() + { + } + + private: + + exception_detail::clone_base const * + clone() const + { + return new unknown_exception(*this); + } + + void + rethrow() const + { + throw*this; + } + + template <class E> + void + add_original_type( E const & e ) + { +#ifndef BOOST_NO_RTTI + (*this) << original_exception_type(&typeid(e)); +#endif + } + }; + + namespace + exception_detail + { + template <class T> + class + current_exception_std_exception_wrapper: + public T, + public boost::exception, + public clone_base + { + public: + + explicit + current_exception_std_exception_wrapper( T const & e1 ): + T(e1) + { + add_original_type(e1); + } + + current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ): + T(e1), + boost::exception(e2) + { + add_original_type(e1); + } + + ~current_exception_std_exception_wrapper() throw() + { + } + + private: + + clone_base const * + clone() const + { + return new current_exception_std_exception_wrapper(*this); + } + + void + rethrow() const + { + throw *this; + } + + template <class E> + void + add_original_type( E const & e ) + { +#ifndef BOOST_NO_RTTI + (*this) << original_exception_type(&typeid(e)); +#endif + } + }; + +#ifdef BOOST_NO_RTTI + template <class T> + exception const * + get_boost_exception( T const * ) + { + try + { + throw; + } + catch( + exception & x ) + { + return &x; + } + catch(...) + { + return 0; + } + } +#else + template <class T> + exception const * + get_boost_exception( T const * x ) + { + return dynamic_cast<exception const *>(x); + } +#endif + + template <class T> + inline + shared_ptr<clone_base const> + current_exception_std_exception( T const & e1 ) + { + if( boost::exception const * e2 = get_boost_exception(&e1) ) + return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1,*e2)); + else + return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1)); + } + + inline + shared_ptr<clone_base const> + current_exception_unknown_exception() + { + return shared_ptr<unknown_exception const>(new unknown_exception()); + } + + inline + shared_ptr<clone_base const> + current_exception_unknown_boost_exception( boost::exception const & e ) + { + return shared_ptr<unknown_exception const>(new unknown_exception(e)); + } + + inline + shared_ptr<clone_base const> + current_exception_unknown_std_exception( std::exception const & e ) + { + if( boost::exception const * be = get_boost_exception(&e) ) + return current_exception_unknown_boost_exception(*be); + else + return shared_ptr<unknown_exception const>(new unknown_exception(e)); + } + + inline + shared_ptr<clone_base const> + current_exception_impl() + { + try + { + throw; + } + catch( + exception_detail::clone_base & e ) + { + return shared_ptr<exception_detail::clone_base const>(e.clone()); + } + catch( + std::domain_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::invalid_argument & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::length_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::out_of_range & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::logic_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::range_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::overflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::underflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::ios_base::failure & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::runtime_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_alloc & e ) + { + return exception_detail::current_exception_std_exception(e); + } +#ifndef BOOST_NO_TYPEID + catch( + std::bad_cast & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_typeid & e ) + { + return exception_detail::current_exception_std_exception(e); + } +#endif + catch( + std::bad_exception & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::exception & e ) + { + return exception_detail::current_exception_unknown_std_exception(e); + } + catch( + boost::exception & e ) + { + return exception_detail::current_exception_unknown_boost_exception(e); + } + catch( + ... ) + { + return exception_detail::current_exception_unknown_exception(); + } + } + } + + inline + exception_ptr + current_exception() + { + try + { + return exception_ptr(exception_detail::current_exception_impl()); + } + catch( + std::bad_alloc & ) + { + } + catch( + ... ) + { + try + { + return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception())); + } + catch( + std::bad_alloc & ) + { + } + catch( + ... ) + { + BOOST_ASSERT(0); + } + } + return exception_ptr(exception_ptr::bad_alloc_tag()); + } + + template <class T> + inline + exception_ptr + copy_exception( T const & e ) + { + try + { + throw enable_current_exception(e); + } + catch( + ... ) + { + return current_exception(); + } + } + + inline + void + rethrow_exception( exception_ptr const & p ) + { + p.rethrow(); + } + + inline + std::string + diagnostic_information( exception_ptr const & p ) + { + if( p ) + try + { + rethrow_exception(p); + } + catch( + ... ) + { + return current_exception_diagnostic_information(); + } + return "<empty>"; + } + + inline + std::string + to_string( exception_ptr const & p ) + { + std::string s='\n'+diagnostic_information(p); + std::string padding(" "); + std::string r; + bool f=false; + for( std::string::const_iterator i=s.begin(),e=s.end(); i!=e; ++i ) + { + if( f ) + r+=padding; + char c=*i; + r+=c; + f=(c=='\n'); + } + return r; + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/detail/is_output_streamable.hpp b/Utilities/BGL/boost/exception/detail/is_output_streamable.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5eb1695d2a20ae8ddd4f8316b8da153637f4a11b --- /dev/null +++ b/Utilities/BGL/boost/exception/detail/is_output_streamable.hpp @@ -0,0 +1,47 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_898984B4076411DD973EDFA055D89593 +#define UUID_898984B4076411DD973EDFA055D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <ostream> + +namespace +boost + { + namespace + to_string_detail + { + template <class T,class CharT,class Traits> + char operator<<( std::basic_ostream<CharT,Traits> &, T const & ); + + template <class T,class CharT,class Traits> + struct + is_output_streamable_impl + { + static std::basic_ostream<CharT,Traits> & f(); + static T const & g(); + enum e { value=1!=(sizeof(f()<<g())) }; + }; + } + + template <class T, class CharT=char, class Traits=std::char_traits<CharT> > + struct + is_output_streamable + { + enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value }; + }; + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/detail/object_hex_dump.hpp b/Utilities/BGL/boost/exception/detail/object_hex_dump.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ccf1bac3f74006920f3860385b4c5db97d51fdb9 --- /dev/null +++ b/Utilities/BGL/boost/exception/detail/object_hex_dump.hpp @@ -0,0 +1,50 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_6F463AC838DF11DDA3E6909F56D89593 +#define UUID_6F463AC838DF11DDA3E6909F56D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/exception/detail/type_info.hpp> +#include <iomanip> +#include <ios> +#include <string> +#include <sstream> +#include <cstdlib> + +namespace +boost + { + namespace + exception_detail + { + template <class T> + inline + std::string + object_hex_dump( T const & x, std::size_t max_size=16 ) + { + std::ostringstream s; + s << "type: " << type_name<T>() << ", size: " << sizeof(T) << ", dump: "; + std::size_t n=sizeof(T)>max_size?max_size:sizeof(T); + s.fill('0'); + s.width(2); + unsigned char const * b=reinterpret_cast<unsigned char const *>(&x); + s << std::setw(2) << std::hex << (unsigned int)*b; + for( unsigned char const * e=b+n; ++b!=e; ) + s << " " << std::setw(2) << std::hex << (unsigned int)*b; + return s.str(); + } + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/detail/type_info.hpp b/Utilities/BGL/boost/exception/detail/type_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..60709a1f6c08991262c371b7eb9d0085bec401c0 --- /dev/null +++ b/Utilities/BGL/boost/exception/detail/type_info.hpp @@ -0,0 +1,79 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_C3E1741C754311DDB2834CCA55D89593 +#define UUID_C3E1741C754311DDB2834CCA55D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/detail/sp_typeinfo.hpp> +#include <boost/current_function.hpp> +#include <boost/config.hpp> + +namespace +boost + { + template <class T> + inline + char const * + tag_type_name() + { +#ifdef BOOST_NO_TYPEID + return BOOST_CURRENT_FUNCTION; +#else + return typeid(T*).name(); +#endif + } + + template <class T> + inline + char const * + type_name() + { +#ifdef BOOST_NO_TYPEID + return BOOST_CURRENT_FUNCTION; +#else + return typeid(T).name(); +#endif + } + + namespace + exception_detail + { + struct + type_info_ + { + detail::sp_typeinfo const & type_; + + explicit + type_info_( detail::sp_typeinfo const & type ): + type_(type) + { + } + + friend + bool + operator<( type_info_ const & a, type_info_ const & b ) + { + return 0!=(a.type_.before(b.type_)); + } + }; + } + } + +#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T)) + +#ifndef BOOST_NO_RTTI +#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x)) +#endif + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/diagnostic_information.hpp b/Utilities/BGL/boost/exception/diagnostic_information.hpp new file mode 100644 index 0000000000000000000000000000000000000000..632a5a333978c07049c620da7735c0f794a07ffb --- /dev/null +++ b/Utilities/BGL/boost/exception/diagnostic_information.hpp @@ -0,0 +1,182 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_0552D49838DD11DD90146B8956D89593 +#define UUID_0552D49838DD11DD90146B8956D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/config.hpp> +#include <boost/exception/get_error_info.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/config.hpp> +#include <exception> +#include <sstream> +#include <string> + +#ifndef BOOST_NO_EXCEPTIONS +#include <boost/exception/current_exception_cast.hpp> +namespace +boost + { + namespace + exception_detail + { + std::string diagnostic_information_impl( boost::exception const *, std::exception const *, bool ); + } + + inline + std::string + current_exception_diagnostic_information() + { + boost::exception const * be=current_exception_cast<boost::exception const>(); + std::exception const * se=current_exception_cast<std::exception const>(); + if( be || se ) + return exception_detail::diagnostic_information_impl(be,se,true); + else + return "No diagnostic information available."; + } + } +#endif + +namespace +boost + { + namespace + exception_detail + { + inline + exception const * + get_boost_exception( exception const * e ) + { + return e; + } + + inline + exception const * + get_boost_exception( ... ) + { + return 0; + } + + inline + std::exception const * + get_std_exception( std::exception const * e ) + { + return e; + } + + inline + std::exception const * + get_std_exception( ... ) + { + return 0; + } + + inline + char const * + get_diagnostic_information( exception const & x, char const * header ) + { + if( error_info_container * c=x.data_.get() ) +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + return c->diagnostic_information(header); +#ifndef BOOST_NO_EXCEPTIONS + } + catch(...) + { + } +#endif + return 0; + } + + inline + std::string + diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what ) + { + if( !be && !se ) + return "Unknown exception."; +#ifndef BOOST_NO_RTTI + if( !be ) + be=dynamic_cast<boost::exception const *>(se); + if( !se ) + se=dynamic_cast<std::exception const *>(be); +#endif + char const * wh=0; + if( with_what && se ) + { + wh=se->what(); + if( be && exception_detail::get_diagnostic_information(*be,0)==wh ) + return wh; + } + std::ostringstream tmp; + if( be ) + { + if( char const * const * f=get_error_info<throw_file>(*be) ) + { + tmp << *f; + if( int const * l=get_error_info<throw_line>(*be) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( char const * const * fn=get_error_info<throw_function>(*be) ) + tmp << *fn; + else + tmp << "(unknown)"; + tmp << '\n'; + } +#ifndef BOOST_NO_RTTI + tmp << std::string("Dynamic exception type: ") << + (be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name() << '\n'; +#endif + if( with_what && se ) + tmp << "std::exception::what: " << wh << '\n'; + if( be ) + if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) ) + if( *s ) + return s; + return tmp.str(); + } + } + + template <class T> + std::string + diagnostic_information( T const & e ) + { + return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true); + } + + inline + char const * + diagnostic_information_what( exception const & e ) throw() + { + char const * w=0; +#ifndef BOOST_NO_EXCEPTIONS + try + { +#endif + (void) exception_detail::diagnostic_information_impl(&e,0,false); + return exception_detail::get_diagnostic_information(e,0); +#ifndef BOOST_NO_EXCEPTIONS + } + catch( + ... ) + { + } +#endif + return w; + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/enable_current_exception.hpp b/Utilities/BGL/boost/exception/enable_current_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..988105378cc7e67af18ea4c834f9f078a087b9d8 --- /dev/null +++ b/Utilities/BGL/boost/exception/enable_current_exception.hpp @@ -0,0 +1,6 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/exception/exception.hpp> diff --git a/Utilities/BGL/boost/exception/enable_error_info.hpp b/Utilities/BGL/boost/exception/enable_error_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..988105378cc7e67af18ea4c834f9f078a087b9d8 --- /dev/null +++ b/Utilities/BGL/boost/exception/enable_error_info.hpp @@ -0,0 +1,6 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/exception/exception.hpp> diff --git a/Utilities/BGL/boost/exception/errinfo_api_function.hpp b/Utilities/BGL/boost/exception/errinfo_api_function.hpp new file mode 100644 index 0000000000000000000000000000000000000000..481c61314e35623b113583e08d196e1e3e474373 --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_api_function.hpp @@ -0,0 +1,22 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_DDFBB4546C1211DEA4659E9055D89593 +#define UUID_DDFBB4546C1211DEA4659E9055D89593 + +#include "boost/exception/error_info.hpp" + +namespace +boost + { + //Usage hint: + //if( api_function(....)!=0 ) + // BOOST_THROW_EXCEPTION( + // failure() << + // errinfo_api_function("api_function") ); + typedef error_info<struct errinfo_api_function_,char const *> errinfo_api_function; + } + +#endif diff --git a/Utilities/BGL/boost/exception/errinfo_at_line.hpp b/Utilities/BGL/boost/exception/errinfo_at_line.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cbd5ccefba0456edcb7e7187a1edcd6c34c982d0 --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_at_line.hpp @@ -0,0 +1,18 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_E7255CE26C1211DE85800C9155D89593 +#define UUID_E7255CE26C1211DE85800C9155D89593 + +namespace +boost + { + template <class Tag,class T> class error_info; + + //Use with parsing errors exceptions, for example in a XML file parser. + typedef error_info<struct errinfo_at_line_,int> errinfo_at_line; + } + +#endif diff --git a/Utilities/BGL/boost/exception/errinfo_errno.hpp b/Utilities/BGL/boost/exception/errinfo_errno.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ea74010c9445bb16dee101f5108ed25211da4ef9 --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_errno.hpp @@ -0,0 +1,44 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_F0EE17BE6C1211DE87FF459155D89593 +#define UUID_F0EE17BE6C1211DE87FF459155D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include "boost/exception/info.hpp" +#include <errno.h> +#include <string.h> + +namespace +boost + { + typedef error_info<struct errinfo_errno_,int> errinfo_errno; + + //Usage hint: + //if( c_function(....)!=0 ) + // BOOST_THROW_EXCEPTION( + // failure() << + // errinfo_errno(errno) << + // errinfo_api_function("c_function") ); + inline + std::string + to_string( errinfo_errno const & e ) + { + std::ostringstream tmp; + int v=e.value(); + tmp << v << ", \"" << strerror(v) << "\""; + return tmp.str(); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/errinfo_file_handle.hpp b/Utilities/BGL/boost/exception/errinfo_file_handle.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8e6cff8fd89e9c5e264721a205dc0180e9528ffd --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_file_handle.hpp @@ -0,0 +1,20 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_F79E6EE26C1211DEB26E929155D89593 +#define UUID_F79E6EE26C1211DEB26E929155D89593 + +#include <stdio.h> + +namespace +boost + { + template <class> class weak_ptr; + template <class Tag,class T> class error_info; + + typedef error_info<struct errinfo_file_handle_,weak_ptr<FILE> > errinfo_file_handle; + } + +#endif diff --git a/Utilities/BGL/boost/exception/errinfo_file_name.hpp b/Utilities/BGL/boost/exception/errinfo_file_name.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d3cce4d356b8ef8565c4d258d9d94c8d0f720981 --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_file_name.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_FEE5120A6C1211DE94E8BC9155D89593 +#define UUID_FEE5120A6C1211DE94E8BC9155D89593 + +#include <string> + +namespace +boost + { + template <class Tag,class T> class error_info; + + //Usage hint: + //FILE * f=fopen(name,mode); + //if( !f ) + // BOOST_THROW_EXCEPTION( + // file_open_error() << + // errinfo_file_name(name) << + // errinfo_file_open_mode(mode) ); + typedef error_info<struct errinfo_file_name_,std::string> errinfo_file_name; + } + +#endif diff --git a/Utilities/BGL/boost/exception/errinfo_file_open_mode.hpp b/Utilities/BGL/boost/exception/errinfo_file_open_mode.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4fba0d5cc0b3f44a740b33d8a991f4ee6c731b0 --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_file_open_mode.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_056F1F266C1311DE8E74299255D89593 +#define UUID_056F1F266C1311DE8E74299255D89593 + +#include <string> + +namespace +boost + { + template <class Tag,class T> class error_info; + + //Usage hint: + //FILE * f=fopen(name,mode); + //if( !f ) + // BOOST_THROW_EXCEPTION( + // file_open_error() << + // errinfo_file_name(name) << + // errinfo_file_open_mode(mode) ); + typedef error_info<struct errinfo_file_open_mode_,std::string> errinfo_file_open_mode; + } + +#endif diff --git a/Utilities/BGL/boost/exception/errinfo_nested_exception.hpp b/Utilities/BGL/boost/exception/errinfo_nested_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..de055e035f8307443f634a1eff821bc803b5e62e --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_nested_exception.hpp @@ -0,0 +1,17 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_45CC9A82B77511DEB330FC4956D89593 +#define UUID_45CC9A82B77511DEB330FC4956D89593 + +namespace +boost + { + template <class Tag,class T> class error_info; + class exception_ptr; + typedef error_info<struct errinfo_nested_exception_,exception_ptr> errinfo_nested_exception; + } + +#endif diff --git a/Utilities/BGL/boost/exception/errinfo_type_info_name.hpp b/Utilities/BGL/boost/exception/errinfo_type_info_name.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0b060e2e11c0ce98e035b4e8b4d0c85e1bf3be5d --- /dev/null +++ b/Utilities/BGL/boost/exception/errinfo_type_info_name.hpp @@ -0,0 +1,23 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_0E11109E6C1311DEB7EA649255D89593 +#define UUID_0E11109E6C1311DEB7EA649255D89593 + +#include <string> + +namespace +boost + { + template <class Tag,class T> class error_info; + + //Usage hint: + //BOOST_THROW_EXCEPTION( + // bad_type() << + // errinfo_type_info_name(typeid(x).name()) ); + typedef error_info<struct errinfo_type_info_name_,std::string> errinfo_type_info_name; + } + +#endif diff --git a/Utilities/BGL/boost/exception/error_info.hpp b/Utilities/BGL/boost/exception/error_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2e6832a338e12ea654d39399f0def106427cab1f --- /dev/null +++ b/Utilities/BGL/boost/exception/error_info.hpp @@ -0,0 +1,6 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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) + +namespace boost { template <class Tag,class T> class error_info; } diff --git a/Utilities/BGL/boost/exception/exception.hpp b/Utilities/BGL/boost/exception/exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..79b273999c3a5d59ed8ba409e8aa856f5d978fd6 --- /dev/null +++ b/Utilities/BGL/boost/exception/exception.hpp @@ -0,0 +1,422 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_274DA366004E11DCB1DDFE2E56D89593 +#define UUID_274DA366004E11DCB1DDFE2E56D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +namespace +boost + { + namespace + exception_detail + { + template <class T> + class + refcount_ptr + { + public: + + refcount_ptr(): + px_(0) + { + } + + ~refcount_ptr() + { + release(); + } + + refcount_ptr( refcount_ptr const & x ): + px_(x.px_) + { + add_ref(); + } + + refcount_ptr & + operator=( refcount_ptr const & x ) + { + adopt(x.px_); + return *this; + } + + void + adopt( T * px ) + { + release(); + px_=px; + add_ref(); + } + + T * + get() const + { + return px_; + } + + private: + + T * px_; + + void + add_ref() + { + if( px_ ) + px_->add_ref(); + } + + void + release() + { + if( px_ ) + px_->release(); + } + }; + } + + //////////////////////////////////////////////////////////////////////// + + template <class Tag,class T> + class error_info; + + typedef error_info<struct throw_function_,char const *> throw_function; + typedef error_info<struct throw_file_,char const *> throw_file; + typedef error_info<struct throw_line_,int> throw_line; + + template <> + class + error_info<throw_function_,char const *> + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info<throw_file_,char const *> + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info<throw_line_,int> + { + public: + typedef int value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <class E,class Tag,class T> + E const & operator<<( E const &, error_info<Tag,T> const & ); + + template <class E> + E const & operator<<( E const &, throw_function const & ); + + template <class E> + E const & operator<<( E const &, throw_file const & ); + + template <class E> + E const & operator<<( E const &, throw_line const & ); + + class exception; + + template <class> + class shared_ptr; + + namespace + exception_detail + { + class error_info_base; + struct type_info_; + + struct + error_info_container + { + virtual char const * diagnostic_information( char const * ) const = 0; + virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0; + virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0; + virtual void add_ref() const = 0; + virtual void release() const = 0; + + protected: + + ~error_info_container() throw() + { + } + }; + + template <class> + struct get_info; + + template <> + struct get_info<throw_function>; + + template <> + struct get_info<throw_file>; + + template <> + struct get_info<throw_line>; + + char const * get_diagnostic_information( exception const &, char const * ); + } + + class + exception + { + protected: + + exception(): + throw_function_(0), + throw_file_(0), + throw_line_(-1) + { + } + +#ifdef __HP_aCC + //On HP aCC, this protected copy constructor prevents throwing boost::exception. + //On all other platforms, the same effect is achieved by the pure virtual destructor. + exception( exception const & x ) throw(): + data_(x.data_), + throw_function_(x.throw_function_), + throw_file_(x.throw_file_), + throw_line_(x.throw_line_) + { + } +#endif + + virtual ~exception() throw() +#ifndef __HP_aCC + = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors. +#endif + ; + +#if defined(__MWERKS__) && __MWERKS__<=0x3207 + public: +#else + private: + + template <class E> + friend E const & operator<<( E const &, throw_function const & ); + + template <class E> + friend E const & operator<<( E const &, throw_file const & ); + + template <class E> + friend E const & operator<<( E const &, throw_line const & ); + + friend char const * exception_detail::get_diagnostic_information( exception const &, char const * ); + + template <class E,class Tag,class T> + friend E const & operator<<( E const &, error_info<Tag,T> const & ); + + template <class> + friend struct exception_detail::get_info; + friend struct exception_detail::get_info<throw_function>; + friend struct exception_detail::get_info<throw_file>; + friend struct exception_detail::get_info<throw_line>; +#endif + mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_; + mutable char const * throw_function_; + mutable char const * throw_file_; + mutable int throw_line_; + }; + + inline + exception:: + ~exception() throw() + { + } + + template <class E> + E const & + operator<<( E const & x, throw_function const & y ) + { + x.throw_function_=y.v_; + return x; + } + + template <class E> + E const & + operator<<( E const & x, throw_file const & y ) + { + x.throw_file_=y.v_; + return x; + } + + template <class E> + E const & + operator<<( E const & x, throw_line const & y ) + { + x.throw_line_=y.v_; + return x; + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { + template <class T> + struct + error_info_injector: + public T, + public exception + { + explicit + error_info_injector( T const & x ): + T(x) + { + } + + ~error_info_injector() throw() + { + } + }; + + struct large_size { char c[256]; }; + large_size dispatch( exception * ); + + struct small_size { }; + small_size dispatch( void * ); + + template <class,int> + struct enable_error_info_helper; + + template <class T> + struct + enable_error_info_helper<T,sizeof(large_size)> + { + typedef T type; + }; + + template <class T> + struct + enable_error_info_helper<T,sizeof(small_size)> + { + typedef error_info_injector<T> type; + }; + + template <class T> + struct + enable_error_info_return_type + { + typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch((T*)0))>::type type; + }; + } + + template <class T> + inline + typename + exception_detail::enable_error_info_return_type<T>::type + enable_error_info( T const & x ) + { + typedef typename exception_detail::enable_error_info_return_type<T>::type rt; + return rt(x); + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { + class + clone_base + { + public: + + virtual clone_base const * clone() const = 0; + virtual void rethrow() const = 0; + + virtual + ~clone_base() throw() + { + } + }; + + inline + void + copy_boost_exception( exception * a, exception const * b ) + { + *a = *b; + } + + inline + void + copy_boost_exception( void *, void const * ) + { + } + + template <class T> + class + clone_impl: + public T, + public clone_base + { + public: + + explicit + clone_impl( T const & x ): + T(x) + { + copy_boost_exception(this,&x); + } + + ~clone_impl() throw() + { + } + + private: + + clone_base const * + clone() const + { + return new clone_impl(*this); + } + + void + rethrow() const + { + throw*this; + } + }; + } + + template <class T> + inline + exception_detail::clone_impl<T> + enable_current_exception( T const & x ) + { + return exception_detail::clone_impl<T>(x); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/get_error_info.hpp b/Utilities/BGL/boost/exception/get_error_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..046f05aeefd0bf9153c4fba259bd5b45fe32f3cb --- /dev/null +++ b/Utilities/BGL/boost/exception/get_error_info.hpp @@ -0,0 +1,130 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_1A590226753311DD9E4CCF6156D89593 +#define UUID_1A590226753311DD9E4CCF6156D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/exception/exception.hpp> +#include <boost/exception/detail/error_info_impl.hpp> +#include <boost/exception/detail/type_info.hpp> +#include <boost/shared_ptr.hpp> + +namespace +boost + { + namespace + exception_detail + { + template <class ErrorInfo> + struct + get_info + { + static + typename ErrorInfo::value_type * + get( exception const & x ) + { + if( exception_detail::error_info_container * c=x.data_.get() ) + if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) ) + { +#ifndef BOOST_NO_RTTI + BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) ); +#endif + ErrorInfo * w = static_cast<ErrorInfo *>(eib.get()); + return &w->value(); + } + return 0; + } + }; + + template <> + struct + get_info<throw_function> + { + static + char const * * + get( exception const & x ) + { + return x.throw_function_ ? &x.throw_function_ : 0; + } + }; + + template <> + struct + get_info<throw_file> + { + static + char const * * + get( exception const & x ) + { + return x.throw_file_ ? &x.throw_file_ : 0; + } + }; + + template <> + struct + get_info<throw_line> + { + static + int * + get( exception const & x ) + { + return x.throw_line_!=-1 ? &x.throw_line_ : 0; + } + }; + + template <class T,class R> + struct + get_error_info_return_type + { + typedef R * type; + }; + + template <class T,class R> + struct + get_error_info_return_type<T const,R> + { + typedef R const * type; + }; + } + +#ifdef BOOST_NO_RTTI + template <class ErrorInfo> + inline + typename ErrorInfo::value_type const * + get_error_info( boost::exception const & x ) + { + return exception_detail::get_info<ErrorInfo>::get(x); + } + template <class ErrorInfo> + inline + typename ErrorInfo::value_type * + get_error_info( boost::exception & x ) + { + return exception_detail::get_info<ErrorInfo>::get(x); + } +#else + template <class ErrorInfo,class E> + inline + typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type + get_error_info( E & some_exception ) + { + if( exception const * x = dynamic_cast<exception const *>(&some_exception) ) + return exception_detail::get_info<ErrorInfo>::get(*x); + else + return 0; + } +#endif + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/info.hpp b/Utilities/BGL/boost/exception/info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cbbc2c0b2f1349985c1aa638205815244f6dd01b --- /dev/null +++ b/Utilities/BGL/boost/exception/info.hpp @@ -0,0 +1,167 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_8D22C4CA9CC811DCAA9133D256D89593 +#define UUID_8D22C4CA9CC811DCAA9133D256D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/exception/exception.hpp> +#include <boost/exception/to_string_stub.hpp> +#include <boost/exception/detail/error_info_impl.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/config.hpp> +#include <map> + +namespace +boost + { + template <class Tag,class T> + inline + typename enable_if<has_to_string<T>,std::string>::type + to_string( error_info<Tag,T> const & x ) + { + return to_string(x.value()); + } + + template <class Tag,class T> + inline + error_info<Tag,T>:: + error_info( value_type const & value ): + value_(value) + { + } + + template <class Tag,class T> + inline + error_info<Tag,T>:: + ~error_info() throw() + { + } + + template <class Tag,class T> + inline + char const * + error_info<Tag,T>:: + tag_typeid_name() const + { + return tag_type_name<Tag>(); + } + + template <class Tag,class T> + inline + std::string + error_info<Tag,T>:: + value_as_string() const + { + return to_string_stub(*this); + } + + namespace + exception_detail + { + class + error_info_container_impl: + public error_info_container + { + public: + + error_info_container_impl(): + count_(0) + { + } + + ~error_info_container_impl() throw() + { + } + + void + set( shared_ptr<error_info_base> const & x, type_info_ const & typeid_ ) + { + BOOST_ASSERT(x); + info_[typeid_] = x; + diagnostic_info_str_.clear(); + } + + shared_ptr<error_info_base> + get( type_info_ const & ti ) const + { + error_info_map::const_iterator i=info_.find(ti); + if( info_.end()!=i ) + { + shared_ptr<error_info_base> const & p = i->second; +#ifndef BOOST_NO_RTTI + BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ ); +#endif + return p; + } + return shared_ptr<error_info_base>(); + } + + char const * + diagnostic_information( char const * header ) const + { + if( header ) + { + BOOST_ASSERT(*header!=0); + std::ostringstream tmp; + tmp << header; + for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) + { + shared_ptr<error_info_base const> const & x = i->second; + tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n'; + } + tmp.str().swap(diagnostic_info_str_); + } + return diagnostic_info_str_.c_str(); + } + + private: + + friend class boost::exception; + + typedef std::map< type_info_, shared_ptr<error_info_base> > error_info_map; + error_info_map info_; + mutable std::string diagnostic_info_str_; + mutable int count_; + + void + add_ref() const + { + ++count_; + } + + void + release() const + { + if( !--count_ ) + delete this; + } + }; + } + + template <class E,class Tag,class T> + inline + E const & + operator<<( E const & x, error_info<Tag,T> const & v ) + { + typedef error_info<Tag,T> error_info_tag_t; + shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) ); + exception_detail::error_info_container * c=x.data_.get(); + if( !c ) + x.data_.adopt(c=new exception_detail::error_info_container_impl); + c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t)); + return x; + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/info_tuple.hpp b/Utilities/BGL/boost/exception/info_tuple.hpp new file mode 100644 index 0000000000000000000000000000000000000000..34afe421b16fe36d4e77579bfe8fee7defbc4ba8 --- /dev/null +++ b/Utilities/BGL/boost/exception/info_tuple.hpp @@ -0,0 +1,76 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_63EE924290FB11DC87BB856555D89593 +#define UUID_63EE924290FB11DC87BB856555D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/exception/info.hpp> +#include <boost/tuple/tuple.hpp> + +namespace +boost + { + template < + class E, + class Tag1,class T1, + class Tag2,class T2 > + inline + E const & + operator<<( + E const & x, + tuple< + error_info<Tag1,T1>, + error_info<Tag2,T2> > const & v ) + { + return x << v.template get<0>() << v.template get<1>(); + } + + template < + class E, + class Tag1,class T1, + class Tag2,class T2, + class Tag3,class T3 > + inline + E const & + operator<<( + E const & x, + tuple< + error_info<Tag1,T1>, + error_info<Tag2,T2>, + error_info<Tag3,T3> > const & v ) + { + return x << v.template get<0>() << v.template get<1>() << v.template get<2>(); + } + + template < + class E, + class Tag1,class T1, + class Tag2,class T2, + class Tag3,class T3, + class Tag4,class T4 > + inline + E const & + operator<<( + E const & x, + tuple< + error_info<Tag1,T1>, + error_info<Tag2,T2>, + error_info<Tag3,T3>, + error_info<Tag4,T4> > const & v ) + { + return x << v.template get<0>() << v.template get<1>() << v.template get<2>() << v.template get<3>(); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/to_string.hpp b/Utilities/BGL/boost/exception/to_string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59bf83d4c01bd43ba2dba8c11fbc25d0656006ea --- /dev/null +++ b/Utilities/BGL/boost/exception/to_string.hpp @@ -0,0 +1,83 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_7E48761AD92811DC9011477D56D89593 +#define UUID_7E48761AD92811DC9011477D56D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/utility/enable_if.hpp> +#include <boost/exception/detail/is_output_streamable.hpp> +#include <sstream> + +namespace +boost + { + namespace + to_string_detail + { + template <class T> + typename disable_if<is_output_streamable<T>,char>::type to_string( T const & ); + + template <class,bool IsOutputStreamable> + struct has_to_string_impl; + + template <class T> + struct + has_to_string_impl<T,true> + { + enum e { value=1 }; + }; + + template <class T> + struct + has_to_string_impl<T,false> + { + static T const & f(); + enum e { value=1!=sizeof(to_string(f())) }; + }; + } + + template <class T> + inline + typename enable_if<is_output_streamable<T>,std::string>::type + to_string( T const & x ) + { + std::ostringstream out; + out << x; + return out.str(); + } + + template <class T> + struct + has_to_string + { + enum e { value=to_string_detail::has_to_string_impl<T,is_output_streamable<T>::value>::value }; + }; + + template <class T,class U> + inline + std::string + to_string( std::pair<T,U> const & x ) + { + return std::string("(") + to_string(x.first) + ',' + to_string(x.second) + ')'; + } + + inline + std::string + to_string( std::exception const & x ) + { + return x.what(); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/exception/to_string_stub.hpp b/Utilities/BGL/boost/exception/to_string_stub.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e41d3697751535349736a43c8a172add2bbcb65a --- /dev/null +++ b/Utilities/BGL/boost/exception/to_string_stub.hpp @@ -0,0 +1,109 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_E788439ED9F011DCB181F25B55D89593 +#define UUID_E788439ED9F011DCB181F25B55D89593 +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#include <boost/exception/to_string.hpp> +#include <boost/exception/detail/object_hex_dump.hpp> +#include <boost/assert.hpp> + +namespace +boost + { + namespace + exception_detail + { + template <bool ToStringAvailable> + struct + to_string_dispatcher + { + template <class T,class Stub> + static + std::string + convert( T const & x, Stub ) + { + return to_string(x); + } + }; + + template <> + struct + to_string_dispatcher<false> + { + template <class T,class Stub> + static + std::string + convert( T const & x, Stub s ) + { + return s(x); + } + + template <class T> + static + std::string + convert( T const & x, std::string s ) + { + return s; + } + + template <class T> + static + std::string + convert( T const & x, char const * s ) + { + BOOST_ASSERT(s!=0); + return s; + } + }; + + namespace + to_string_dispatch + { + template <class T,class Stub> + inline + std::string + dispatch( T const & x, Stub s ) + { + return to_string_dispatcher<has_to_string<T>::value>::convert(x,s); + } + } + + template <class T> + inline + std::string + string_stub_dump( T const & x ) + { + return "[ " + exception_detail::object_hex_dump(x) + " ]"; + } + } + + template <class T> + inline + std::string + to_string_stub( T const & x ) + { + return exception_detail::to_string_dispatch::dispatch(x,&exception_detail::string_stub_dump<T>); + } + + template <class T,class Stub> + inline + std::string + to_string_stub( T const & x, Stub s ) + { + return exception_detail::to_string_dispatch::dispatch(x,s); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/Utilities/BGL/boost/function.hpp b/Utilities/BGL/boost/function.hpp deleted file mode 100644 index 1a5cca2b4efb8e68564e4129c3972e6f1728d33a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2001-2003. 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/function - -// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the -// design of this library. - -#include <boost/preprocessor/iterate.hpp> -#include <boost/detail/workaround.hpp> - -#ifndef BOOST_FUNCTION_MAX_ARGS -# define BOOST_FUNCTION_MAX_ARGS 10 -#endif // BOOST_FUNCTION_MAX_ARGS - -// Include the prologue here so that the use of file-level iteration -// in anything that may be included by function_template.hpp doesn't break -#include <boost/function/detail/prologue.hpp> - -// Visual Age C++ doesn't handle the file iteration well -#if BOOST_WORKAROUND(__IBMCPP__, >= 500) -# if BOOST_FUNCTION_MAX_ARGS >= 0 -# include <boost/function/function0.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 1 -# include <boost/function/function1.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 2 -# include <boost/function/function2.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 3 -# include <boost/function/function3.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 4 -# include <boost/function/function4.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 5 -# include <boost/function/function5.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 6 -# include <boost/function/function6.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 7 -# include <boost/function/function7.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 8 -# include <boost/function/function8.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 9 -# include <boost/function/function9.hpp> -# endif -# if BOOST_FUNCTION_MAX_ARGS >= 10 -# include <boost/function/function10.hpp> -# endif -#else -// What is the '3' for? -# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_FUNCTION_MAX_ARGS,<boost/function/detail/function_iterate.hpp>)) -# include BOOST_PP_ITERATE() -# undef BOOST_PP_ITERATION_PARAMS_1 -#endif diff --git a/Utilities/BGL/boost/function/detail/function_iterate.hpp b/Utilities/BGL/boost/function/detail/function_iterate.hpp deleted file mode 100644 index 5370b36aac5c7923dfc9b3e8a2280be8ce037f72..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/detail/function_iterate.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2003. 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 -#if !defined(BOOST_PP_IS_ITERATING) -# error Boost.Function - do not include this file! -#endif - -#define BOOST_FUNCTION_NUM_ARGS BOOST_PP_ITERATION() -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS - diff --git a/Utilities/BGL/boost/function/detail/gen_maybe_include.pl b/Utilities/BGL/boost/function/detail/gen_maybe_include.pl deleted file mode 100644 index d0629205e101d4d758736cd3929962c432c77e20..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/detail/gen_maybe_include.pl +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/perl -w -# -# Boost.Function library -# -# Copyright (C) 2001-2003 Douglas Gregor (gregod@cs.rpi.edu) -# -# Permission to copy, use, sell and distribute this software is granted -# provided this copyright notice appears in all copies. -# Permission to modify the code and to distribute modified code is granted -# provided this copyright notice appears in all copies, and a notice -# that the code was modified is included with the copyright notice. -# -# This software is provided "as is" without express or implied warranty, -# and with no claim as to its suitability for any purpose. -# -# For more information, see http://www.boost.org -use English; - -$max_args = $ARGV[0]; - -open (OUT, ">maybe_include.hpp") or die("Cannot write to maybe_include.hpp"); -for($on_arg = 0; $on_arg <= $max_args; ++$on_arg) { - if ($on_arg == 0) { - print OUT "#if"; - } - else { - print OUT "#elif"; - } - print OUT " BOOST_FUNCTION_NUM_ARGS == $on_arg\n"; - print OUT "# ifndef BOOST_FUNCTION_$on_arg\n"; - print OUT "# define BOOST_FUNCTION_$on_arg\n"; - print OUT "# include <boost/function/function_template.hpp>\n"; - print OUT "# endif\n"; -} -print OUT "#else\n"; -print OUT "# error Cannot handle Boost.Function objects that accept more than $max_args arguments!\n"; -print OUT "#endif\n"; diff --git a/Utilities/BGL/boost/function/detail/maybe_include.hpp b/Utilities/BGL/boost/function/detail/maybe_include.hpp deleted file mode 100644 index 92f71bb22738cf9d4cd7e6cec400d4a8c96da13f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/detail/maybe_include.hpp +++ /dev/null @@ -1,267 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2003. 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 - -#if BOOST_FUNCTION_NUM_ARGS == 0 -# ifndef BOOST_FUNCTION_0 -# define BOOST_FUNCTION_0 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 1 -# ifndef BOOST_FUNCTION_1 -# define BOOST_FUNCTION_1 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 2 -# ifndef BOOST_FUNCTION_2 -# define BOOST_FUNCTION_2 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 3 -# ifndef BOOST_FUNCTION_3 -# define BOOST_FUNCTION_3 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 4 -# ifndef BOOST_FUNCTION_4 -# define BOOST_FUNCTION_4 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 5 -# ifndef BOOST_FUNCTION_5 -# define BOOST_FUNCTION_5 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 6 -# ifndef BOOST_FUNCTION_6 -# define BOOST_FUNCTION_6 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 7 -# ifndef BOOST_FUNCTION_7 -# define BOOST_FUNCTION_7 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 8 -# ifndef BOOST_FUNCTION_8 -# define BOOST_FUNCTION_8 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 9 -# ifndef BOOST_FUNCTION_9 -# define BOOST_FUNCTION_9 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 10 -# ifndef BOOST_FUNCTION_10 -# define BOOST_FUNCTION_10 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 11 -# ifndef BOOST_FUNCTION_11 -# define BOOST_FUNCTION_11 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 12 -# ifndef BOOST_FUNCTION_12 -# define BOOST_FUNCTION_12 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 13 -# ifndef BOOST_FUNCTION_13 -# define BOOST_FUNCTION_13 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 14 -# ifndef BOOST_FUNCTION_14 -# define BOOST_FUNCTION_14 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 15 -# ifndef BOOST_FUNCTION_15 -# define BOOST_FUNCTION_15 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 16 -# ifndef BOOST_FUNCTION_16 -# define BOOST_FUNCTION_16 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 17 -# ifndef BOOST_FUNCTION_17 -# define BOOST_FUNCTION_17 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 18 -# ifndef BOOST_FUNCTION_18 -# define BOOST_FUNCTION_18 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 19 -# ifndef BOOST_FUNCTION_19 -# define BOOST_FUNCTION_19 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 20 -# ifndef BOOST_FUNCTION_20 -# define BOOST_FUNCTION_20 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 21 -# ifndef BOOST_FUNCTION_21 -# define BOOST_FUNCTION_21 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 22 -# ifndef BOOST_FUNCTION_22 -# define BOOST_FUNCTION_22 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 23 -# ifndef BOOST_FUNCTION_23 -# define BOOST_FUNCTION_23 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 24 -# ifndef BOOST_FUNCTION_24 -# define BOOST_FUNCTION_24 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 25 -# ifndef BOOST_FUNCTION_25 -# define BOOST_FUNCTION_25 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 26 -# ifndef BOOST_FUNCTION_26 -# define BOOST_FUNCTION_26 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 27 -# ifndef BOOST_FUNCTION_27 -# define BOOST_FUNCTION_27 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 28 -# ifndef BOOST_FUNCTION_28 -# define BOOST_FUNCTION_28 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 29 -# ifndef BOOST_FUNCTION_29 -# define BOOST_FUNCTION_29 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 30 -# ifndef BOOST_FUNCTION_30 -# define BOOST_FUNCTION_30 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 31 -# ifndef BOOST_FUNCTION_31 -# define BOOST_FUNCTION_31 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 32 -# ifndef BOOST_FUNCTION_32 -# define BOOST_FUNCTION_32 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 33 -# ifndef BOOST_FUNCTION_33 -# define BOOST_FUNCTION_33 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 34 -# ifndef BOOST_FUNCTION_34 -# define BOOST_FUNCTION_34 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 35 -# ifndef BOOST_FUNCTION_35 -# define BOOST_FUNCTION_35 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 36 -# ifndef BOOST_FUNCTION_36 -# define BOOST_FUNCTION_36 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 37 -# ifndef BOOST_FUNCTION_37 -# define BOOST_FUNCTION_37 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 38 -# ifndef BOOST_FUNCTION_38 -# define BOOST_FUNCTION_38 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 39 -# ifndef BOOST_FUNCTION_39 -# define BOOST_FUNCTION_39 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 40 -# ifndef BOOST_FUNCTION_40 -# define BOOST_FUNCTION_40 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 41 -# ifndef BOOST_FUNCTION_41 -# define BOOST_FUNCTION_41 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 42 -# ifndef BOOST_FUNCTION_42 -# define BOOST_FUNCTION_42 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 43 -# ifndef BOOST_FUNCTION_43 -# define BOOST_FUNCTION_43 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 44 -# ifndef BOOST_FUNCTION_44 -# define BOOST_FUNCTION_44 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 45 -# ifndef BOOST_FUNCTION_45 -# define BOOST_FUNCTION_45 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 46 -# ifndef BOOST_FUNCTION_46 -# define BOOST_FUNCTION_46 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 47 -# ifndef BOOST_FUNCTION_47 -# define BOOST_FUNCTION_47 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 48 -# ifndef BOOST_FUNCTION_48 -# define BOOST_FUNCTION_48 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 49 -# ifndef BOOST_FUNCTION_49 -# define BOOST_FUNCTION_49 -# include <boost/function/function_template.hpp> -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 50 -# ifndef BOOST_FUNCTION_50 -# define BOOST_FUNCTION_50 -# include <boost/function/function_template.hpp> -# endif -#else -# error Cannot handle Boost.Function objects that accept more than 50 arguments! -#endif diff --git a/Utilities/BGL/boost/function/detail/prologue.hpp b/Utilities/BGL/boost/function/detail/prologue.hpp deleted file mode 100644 index 1ef5f6e3127d4be1e808050089d7fe8bee4defea..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/detail/prologue.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#ifndef BOOST_FUNCTION_PROLOGUE_HPP -#define BOOST_FUNCTION_PROLOGUE_HPP -# include <cassert> -# include <algorithm> -# include <boost/throw_exception.hpp> -# include <boost/config.hpp> -# include <boost/function/function_base.hpp> -# include <boost/mem_fn.hpp> -# include <boost/type_traits/is_integral.hpp> -# include <boost/preprocessor/enum.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/cat.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/inc.hpp> -#endif // BOOST_FUNCTION_PROLOGUE_HPP diff --git a/Utilities/BGL/boost/function/function0.hpp b/Utilities/BGL/boost/function/function0.hpp deleted file mode 100644 index 65a02e5facb47505f164692cf9b006cec16ae652..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function0.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 0 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function1.hpp b/Utilities/BGL/boost/function/function1.hpp deleted file mode 100644 index 9089715155cf4617f0590aa55d88f386d9e3dea7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function1.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 1 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function10.hpp b/Utilities/BGL/boost/function/function10.hpp deleted file mode 100644 index 65627248496fe0c7fa02c26284b4e7ab01039a11..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function10.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 10 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function2.hpp b/Utilities/BGL/boost/function/function2.hpp deleted file mode 100644 index dc8bf97521dc7da6cd2f5b80d1fb5241f20cadf0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function2.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 2 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function3.hpp b/Utilities/BGL/boost/function/function3.hpp deleted file mode 100644 index 19d1a49dd5a120b062316dd2ca0614ff5702847e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function3.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 3 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function4.hpp b/Utilities/BGL/boost/function/function4.hpp deleted file mode 100644 index f3349e2dc97bf00fb1b220421375d9f355e99539..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function4.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 4 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function5.hpp b/Utilities/BGL/boost/function/function5.hpp deleted file mode 100644 index a1305eb5ce21544a25530cf87d6b29e8cf178d25..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function5.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 5 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function6.hpp b/Utilities/BGL/boost/function/function6.hpp deleted file mode 100644 index 1f609149196a786b240e7b33ec0c2ad18c5b5991..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function6.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 6 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function7.hpp b/Utilities/BGL/boost/function/function7.hpp deleted file mode 100644 index 68542ed46aa5cd2d0204614e801db7b002325152..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function7.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 7 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function8.hpp b/Utilities/BGL/boost/function/function8.hpp deleted file mode 100644 index cf2c37661f7acac846b37cd34484fa6eeb8cbc1f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function8.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 8 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function9.hpp b/Utilities/BGL/boost/function/function9.hpp deleted file mode 100644 index 590e0883d7872a94f6ec6fe16dccacb7b2ede1c2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function9.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. 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 - -#define BOOST_FUNCTION_NUM_ARGS 9 -#include <boost/function/detail/maybe_include.hpp> -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/Utilities/BGL/boost/function/function_base.hpp b/Utilities/BGL/boost/function/function_base.hpp deleted file mode 100644 index ab039fe48d322a859166f47a0a93bcf56f0543d5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function_base.hpp +++ /dev/null @@ -1,698 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2001-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 - -#ifndef BOOST_FUNCTION_BASE_HEADER -#define BOOST_FUNCTION_BASE_HEADER - -#include <stdexcept> -#include <string> -#include <memory> -#include <new> -#include <typeinfo> -#include <boost/config.hpp> -#include <boost/assert.hpp> -#include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/composite_traits.hpp> -#include <boost/type_traits/is_stateless.hpp> -#include <boost/ref.hpp> -#include <boost/pending/ct_if.hpp> -#include <boost/detail/workaround.hpp> -#ifndef BOOST_NO_SFINAE -# include "boost/butility/enable_if.hpp" -#else -# include "boost/mpl/bool.hpp" -#endif -#include <boost/function_equal.hpp> - -// Borrowed from Boost.Python library: determines the cases where we -// need to use std::type_info::name to compare instead of operator==. -# if (defined(__GNUC__) && __GNUC__ >= 3) \ - || defined(_AIX) \ - || ( defined(__sgi) && defined(__host_mips)) -# include <cstring> -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \ - (std::strcmp((X).name(),(Y).name()) == 0) -# else -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y)) -#endif - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_TARGET_FIX(x) x -#else -# define BOOST_FUNCTION_TARGET_FIX(x) -#endif // not MSVC - -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -// Work around a compiler bug. -// boost::python::objects::function has to be seen by the compiler before the -// boost::function class template. -namespace boost { namespace python { namespace objects { - class function; -}}} -#endif - -#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - || defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ - || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) -# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX -#endif - -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) -# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ - typename ::boost::enable_if_c<(::boost::type_traits::ice_not< \ - (::boost::is_integral<Functor>::value)>::value), \ - Type>::type -#else -// BCC doesn't recognize this depends on a template argument and complains -// about the use of 'typename' -# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ - ::boost::enable_if_c<(::boost::type_traits::ice_not< \ - (::boost::is_integral<Functor>::value)>::value), \ - Type>::type -#endif - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) -namespace boost { - -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -// The library shipping with MIPSpro 7.3.1.3m has a broken allocator<void> -class function_base; - -template<typename Signature, - typename Allocator = std::allocator<function_base> > -class function; -#else -template<typename Signature, typename Allocator = std::allocator<void> > -class function; -#endif - -template<typename Signature, typename Allocator> -inline void swap(function<Signature, Allocator>& f1, - function<Signature, Allocator>& f2) -{ - f1.swap(f2); -} - -} // end namespace boost -#endif // have partial specialization - -namespace boost { - namespace detail { - namespace function { - /** - * A union of a function pointer and a void pointer. This is necessary - * because 5.2.10/6 allows reinterpret_cast<> to safely cast between - * function pointer types and 5.2.9/10 allows static_cast<> to safely - * cast between a void pointer and an object pointer. But it is not legal - * to cast between a function pointer and a void* (in either direction), - * so function requires a union of the two. */ - union any_pointer - { - void* obj_ptr; - const void* const_obj_ptr; - void (*func_ptr)(); - char data[1]; - }; - - inline any_pointer make_any_pointer(void* o) - { - any_pointer p; - p.obj_ptr = o; - return p; - } - - inline any_pointer make_any_pointer(const void* o) - { - any_pointer p; - p.const_obj_ptr = o; - return p; - } - - inline any_pointer make_any_pointer(void (*f)()) - { - any_pointer p; - p.func_ptr = f; - return p; - } - - /** - * The unusable class is a placeholder for unused function arguments - * It is also completely unusable except that it constructable from - * anything. This helps compilers without partial specialization to - * handle Boost.Function objects returning void. - */ - struct unusable - { - unusable() {} - template<typename T> unusable(const T&) {} - }; - - /* Determine the return type. This supports compilers that do not support - * void returns or partial specialization by silently changing the return - * type to "unusable". - */ - template<typename T> struct function_return_type { typedef T type; }; - - template<> - struct function_return_type<void> - { - typedef unusable type; - }; - - // The operation type to perform on the given functor/function pointer - enum functor_manager_operation_type { - clone_functor_tag, - destroy_functor_tag, - check_functor_type_tag - }; - - // Tags used to decide between different types of functions - struct function_ptr_tag {}; - struct function_obj_tag {}; - struct member_ptr_tag {}; - struct function_obj_ref_tag {}; - struct stateless_function_obj_tag {}; - - template<typename F> - class get_function_tag - { - typedef typename ct_if<(is_pointer<F>::value), - function_ptr_tag, - function_obj_tag>::type ptr_or_obj_tag; - - typedef typename ct_if<(is_member_pointer<F>::value), - member_ptr_tag, - ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; - - typedef typename ct_if<(is_reference_wrapper<F>::value), - function_obj_ref_tag, - ptr_or_obj_or_mem_tag>::type or_ref_tag; - - public: - typedef typename ct_if<(is_stateless<F>::value), - stateless_function_obj_tag, - or_ref_tag>::type type; - }; - - // The trivial manager does nothing but return the same pointer (if we - // are cloning) or return the null pointer (if we are deleting). - template<typename F> - struct trivial_manager - { - static inline any_pointer - get(any_pointer f, functor_manager_operation_type op) - { - switch (op) { - case clone_functor_tag: return f; - - case destroy_functor_tag: - return make_any_pointer(reinterpret_cast<void*>(0)); - - case check_functor_type_tag: - { - std::type_info* t = static_cast<std::type_info*>(f.obj_ptr); - return BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(F), *t)? - f - : make_any_pointer(reinterpret_cast<void*>(0)); - } - } - - // Clears up a warning with GCC 3.2.3 - return make_any_pointer(reinterpret_cast<void*>(0)); - } - }; - - /** - * The functor_manager class contains a static function "manage" which - * can clone or destroy the given function/function object pointer. - */ - template<typename Functor, typename Allocator> - struct functor_manager - { - private: - typedef Functor functor_type; - - // For function pointers, the manager is trivial - static inline any_pointer - manager(any_pointer function_ptr, - functor_manager_operation_type op, - function_ptr_tag) - { - if (op == clone_functor_tag) - return function_ptr; - else - return make_any_pointer(static_cast<void (*)()>(0)); - } - - // For function object pointers, we clone the pointer to each - // function has its own version. - static inline any_pointer - manager(any_pointer function_obj_ptr, - functor_manager_operation_type op, - function_obj_tag) - { -#ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind<functor_type>::other - allocator_type; - typedef typename allocator_type::pointer pointer_type; -#else - typedef functor_type* pointer_type; -#endif // BOOST_NO_STD_ALLOCATOR - -# ifndef BOOST_NO_STD_ALLOCATOR - allocator_type allocator; -# endif // BOOST_NO_STD_ALLOCATOR - - if (op == clone_functor_tag) { - functor_type* f = - static_cast<functor_type*>(function_obj_ptr.obj_ptr); - - // Clone the functor -# ifndef BOOST_NO_STD_ALLOCATOR - pointer_type copy = allocator.allocate(1); - allocator.construct(copy, *f); - - // Get back to the original pointer type - functor_type* new_f = static_cast<functor_type*>(copy); -# else - functor_type* new_f = new functor_type(*f); -# endif // BOOST_NO_STD_ALLOCATOR - return make_any_pointer(static_cast<void*>(new_f)); - } - else { - /* Cast from the void pointer to the functor pointer type */ - functor_type* f = - reinterpret_cast<functor_type*>(function_obj_ptr.obj_ptr); - -# ifndef BOOST_NO_STD_ALLOCATOR - /* Cast from the functor pointer type to the allocator's pointer - type */ - pointer_type victim = static_cast<pointer_type>(f); - - // Destroy and deallocate the functor - allocator.destroy(victim); - allocator.deallocate(victim, 1); -# else - delete f; -# endif // BOOST_NO_STD_ALLOCATOR - - return make_any_pointer(static_cast<void*>(0)); - } - } - public: - /* Dispatch to an appropriate manager based on whether we have a - function pointer or a function object pointer. */ - static any_pointer - manage(any_pointer functor_ptr, functor_manager_operation_type op) - { - if (op == check_functor_type_tag) { - std::type_info* type = - static_cast<std::type_info*>(functor_ptr.obj_ptr); - return (BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type)? - functor_ptr - : make_any_pointer(reinterpret_cast<void*>(0))); - } - else { - typedef typename get_function_tag<functor_type>::type tag_type; - return manager(functor_ptr, op, tag_type()); - } - } - }; - - // A type that is only used for comparisons against zero - struct useless_clear_type {}; - -#ifdef BOOST_NO_SFINAE - // These routines perform comparisons between a Boost.Function - // object and an arbitrary function object (when the last - // parameter is mpl::bool_<false>) or against zero (when the - // last parameter is mpl::bool_<true>). They are only necessary - // for compilers that don't support SFINAE. - template<typename Function, typename Functor> - bool - compare_equal(const Function& f, const Functor&, int, mpl::bool_<true>) - { return f.empty(); } - - template<typename Function, typename Functor> - bool - compare_not_equal(const Function& f, const Functor&, int, - mpl::bool_<true>) - { return !f.empty(); } - - template<typename Function, typename Functor> - bool - compare_equal(const Function& f, const Functor& g, long, - mpl::bool_<false>) - { - if (const Functor* fp = f.template target<Functor>()) - return function_equal(*fp, g); - else return false; - } - - template<typename Function, typename Functor> - bool - compare_equal(const Function& f, const reference_wrapper<Functor>& g, - int, mpl::bool_<false>) - { - if (const Functor* fp = f.template target<Functor>()) - return fp == g.get_pointer(); - else return false; - } - - template<typename Function, typename Functor> - bool - compare_not_equal(const Function& f, const Functor& g, long, - mpl::bool_<false>) - { - if (const Functor* fp = f.template target<Functor>()) - return !function_equal(*fp, g); - else return true; - } - - template<typename Function, typename Functor> - bool - compare_not_equal(const Function& f, - const reference_wrapper<Functor>& g, int, - mpl::bool_<false>) - { - if (const Functor* fp = f.template target<Functor>()) - return fp != g.get_pointer(); - else return true; - } -#endif // BOOST_NO_SFINAE - } // end namespace function - } // end namespace detail - -/** - * The function_base class contains the basic elements needed for the - * function1, function2, function3, etc. classes. It is common to all - * functions (and as such can be used to tell if we have one of the - * functionN objects). - */ -class function_base -{ -public: - function_base() : manager(0) - { - functor.obj_ptr = 0; - } - - // Is this function empty? - bool empty() const { return !manager; } - - template<typename Functor> - Functor* target() - { - if (!manager) return 0; - - detail::function::any_pointer result = - manager(detail::function::make_any_pointer(&typeid(Functor)), - detail::function::check_functor_type_tag); - if (!result.obj_ptr) return 0; - else { - typedef typename detail::function::get_function_tag<Functor>::type tag; - return get_functor_pointer<Functor>(tag(), 0); - } - } - - template<typename Functor> - -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - const Functor* target( Functor * = 0 ) const -#else - const Functor* target() const -#endif - { - if (!manager) return 0; - - detail::function::any_pointer result = - manager(detail::function::make_any_pointer(&typeid(Functor)), - detail::function::check_functor_type_tag); - if (!result.obj_ptr) return 0; - else { - typedef typename detail::function::get_function_tag<Functor>::type tag; - -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - return get_functor_pointer(tag(), 0, (Functor*)0); -#else - return get_functor_pointer<Functor>(tag(), 0); -#endif - } - } - - template<typename F> - bool contains(const F& f) const - { -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - if (const F* fp = this->target( (F*)0 )) { -#else - if (const F* fp = this->template target<F>()) { -#endif - return function_equal(*fp, f); - } else { - return false; - } - } - -#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3 - // GCC 3.3 and newer cannot copy with the global operator==, due to - // problems with instantiation of function return types before it - // has been verified that the argument types match up. - template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(Functor g) const - { - if (const Functor* fp = target<Functor>()) - return function_equal(*fp, g); - else return false; - } - - template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(Functor g) const - { - if (const Functor* fp = target<Functor>()) - return !function_equal(*fp, g); - else return true; - } -#endif - -public: // should be protected, but GCC 2.95.3 will fail to allow access - detail::function::any_pointer (*manager)( - detail::function::any_pointer, - detail::function::functor_manager_operation_type); - detail::function::any_pointer functor; - -private: - template<typename Functor> -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - Functor* get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) -#else - Functor* get_functor_pointer(detail::function::function_ptr_tag, int) -#endif - { return reinterpret_cast<Functor*>(&functor.func_ptr); } - - template<typename Functor, typename Tag> -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - Functor* get_functor_pointer(Tag, long, Functor * = 0) -#else - Functor* get_functor_pointer(Tag, long) -#endif - { return static_cast<Functor*>(functor.obj_ptr); } - - template<typename Functor> - const Functor* -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) const -#else - get_functor_pointer(detail::function::function_ptr_tag, int) const -#endif - { return reinterpret_cast<const Functor*>(&functor.func_ptr); } - - template<typename Functor, typename Tag> -#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300) - const Functor* get_functor_pointer(Tag, long, Functor * = 0) const -#else - const Functor* get_functor_pointer(Tag, long) const -#endif - { return static_cast<const Functor*>(functor.const_obj_ptr); } -}; - -/** - * The bad_function_call exception class is thrown when a boost::function - * object is invoked - */ -class bad_function_call : public std::runtime_error -{ -public: - bad_function_call() : std::runtime_error("call to empty boost::function") {} -}; - -#ifndef BOOST_NO_SFINAE -inline bool operator==(const function_base& f, - detail::function::useless_clear_type*) -{ - return f.empty(); -} - -inline bool operator!=(const function_base& f, - detail::function::useless_clear_type*) -{ - return !f.empty(); -} - -inline bool operator==(detail::function::useless_clear_type*, - const function_base& f) -{ - return f.empty(); -} - -inline bool operator!=(detail::function::useless_clear_type*, - const function_base& f) -{ - return !f.empty(); -} -#endif - -#ifdef BOOST_NO_SFINAE -// Comparisons between boost::function objects and arbitrary function objects -template<typename Functor> - inline bool operator==(const function_base& f, Functor g) - { - typedef mpl::bool_<(is_integral<Functor>::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template<typename Functor> - inline bool operator==(Functor g, const function_base& f) - { - typedef mpl::bool_<(is_integral<Functor>::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template<typename Functor> - inline bool operator!=(const function_base& f, Functor g) - { - typedef mpl::bool_<(is_integral<Functor>::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } - -template<typename Functor> - inline bool operator!=(Functor g, const function_base& f) - { - typedef mpl::bool_<(is_integral<Functor>::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } -#else - -# if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) -// Comparisons between boost::function objects and arbitrary function -// objects. GCC 3.3 and before has an obnoxious bug that prevents this -// from working. -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(const function_base& f, Functor g) - { - if (const Functor* fp = f.template target<Functor>()) - return function_equal(*fp, g); - else return false; - } - -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(Functor g, const function_base& f) - { - if (const Functor* fp = f.template target<Functor>()) - return function_equal(g, *fp); - else return false; - } - -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(const function_base& f, Functor g) - { - if (const Functor* fp = f.template target<Functor>()) - return !function_equal(*fp, g); - else return true; - } - -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(Functor g, const function_base& f) - { - if (const Functor* fp = f.template target<Functor>()) - return !function_equal(g, *fp); - else return true; - } -# endif - -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(const function_base& f, reference_wrapper<Functor> g) - { - if (const Functor* fp = f.template target<Functor>()) - return fp == g.get_pointer(); - else return false; - } - -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(reference_wrapper<Functor> g, const function_base& f) - { - if (const Functor* fp = f.template target<Functor>()) - return g.get_pointer() == fp; - else return false; - } - -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(const function_base& f, reference_wrapper<Functor> g) - { - if (const Functor* fp = f.template target<Functor>()) - return fp != g.get_pointer(); - else return true; - } - -template<typename Functor> - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(reference_wrapper<Functor> g, const function_base& f) - { - if (const Functor* fp = f.template target<Functor>()) - return g.get_pointer() != fp; - else return true; - } - -#endif // Compiler supporting SFINAE - -namespace detail { - namespace function { - inline bool has_empty_target(const function_base* f) - { - return f->empty(); - } - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) - inline bool has_empty_target(const void*) - { - return false; - } -#else - inline bool has_empty_target(...) - { - return false; - } -#endif - } // end namespace function -} // end namespace detail -} // end namespace boost - -#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL -#undef BOOST_FUNCTION_COMPARE_TYPE_ID - -#endif // BOOST_FUNCTION_BASE_HEADER diff --git a/Utilities/BGL/boost/function/function_template.hpp b/Utilities/BGL/boost/function/function_template.hpp deleted file mode 100644 index 3730f421ceb3e1acc8120c31c2f3c8dfbe98cc61..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/function_template.hpp +++ /dev/null @@ -1,712 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2001-2003. 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 - -// Note: this header is a header template and must NOT have multiple-inclusion -// protection. -#include <boost/function/detail/prologue.hpp> - -#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) - -#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T) - -#define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I) - -#define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY) - -#define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) - -#define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ - typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(arg, BOOST_PP_CAT(BOOST_PP_INC(I),_type)); - -#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) - -// Type of the default allocator -#ifndef BOOST_NO_STD_ALLOCATOR -# define BOOST_FUNCTION_DEFAULT_ALLOCATOR std::allocator<function_base> -#else -# define BOOST_FUNCTION_DEFAULT_ALLOCATOR int -#endif // BOOST_NO_STD_ALLOCATOR - -// Comma if nonzero number of arguments -#if BOOST_FUNCTION_NUM_ARGS == 0 -# define BOOST_FUNCTION_COMMA -#else -# define BOOST_FUNCTION_COMMA , -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - -// Class names used in this version of the code -#define BOOST_FUNCTION_FUNCTION BOOST_JOIN(function,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_INVOKER \ - BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ - BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(stateless_void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ - BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(get_stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) - -#ifndef BOOST_NO_VOID_RETURNS -# define BOOST_FUNCTION_VOID_RETURN_TYPE void -# define BOOST_FUNCTION_RETURN(X) X -#else -# define BOOST_FUNCTION_VOID_RETURN_TYPE ::boost::detail::function::unusable -# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE () -#endif - -namespace boost { - namespace detail { - namespace function { - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_FUNCTION_INVOKER - { - static R invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - { - FunctionPtr f = reinterpret_cast<FunctionPtr>(function_ptr.func_ptr); - return f(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER - { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionPtr f = reinterpret_cast<FunctionPtr>(function_ptr.func_ptr); - BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS)); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER - { - static R invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); - return (*f)(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER - { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); - BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER - { - static R invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) - { - FunctionObj f = FunctionObj(); - return f(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER - { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) - - { - FunctionObj f = FunctionObj(); - BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS)); - } - }; - - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_FUNCTION_INVOKER - { - typedef typename ct_if<(is_void<R>::value), - BOOST_FUNCTION_VOID_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER - { - typedef typename ct_if<(is_void<R>::value), - BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER - { - typedef typename ct_if<(is_void<R>::value), - BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - } // end namespace function - } // end namespace detail - - template< - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS, - typename Allocator = BOOST_FUNCTION_DEFAULT_ALLOCATOR - > - class BOOST_FUNCTION_FUNCTION : public function_base - { - public: -#ifndef BOOST_NO_VOID_RETURNS - typedef R result_type; -#else - typedef typename detail::function::function_return_type<R>::type - result_type; -#endif // BOOST_NO_VOID_RETURNS - - private: - struct clear_type {}; - - public: - BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); - - // add signature for boost::lambda - template<typename Args> - struct sig - { - typedef result_type type; - }; - -#if BOOST_FUNCTION_NUM_ARGS == 1 - typedef T0 argument_type; -#elif BOOST_FUNCTION_NUM_ARGS == 2 - typedef T0 first_argument_type; - typedef T1 second_argument_type; -#endif - - BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS); - BOOST_FUNCTION_ARG_TYPES - - typedef Allocator allocator_type; - typedef BOOST_FUNCTION_FUNCTION self_type; - - BOOST_FUNCTION_FUNCTION() : function_base() - , invoker(0) {} - - // MSVC chokes if the following two constructors are collapsed into - // one with a default parameter. - template<typename Functor> - BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f -#ifndef BOOST_NO_SFINAE - ,typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral<Functor>::value)>::value), - int>::type = 0 -#endif // BOOST_NO_SFINAE - ) : - function_base(), - invoker(0) - { - this->assign_to(f); - } - -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {} -#else - BOOST_FUNCTION_FUNCTION(int zero) : function_base(), invoker(0) - { - BOOST_ASSERT(zero == 0); - } -#endif - - BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : - function_base(), - invoker(0) - { - this->assign_to_own(f); - } - - ~BOOST_FUNCTION_FUNCTION() { clear(); } - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) - // MSVC 6.0 and prior require all definitions to be inline, but - // these definitions can become very costly. - result_type operator()(BOOST_FUNCTION_PARMS) const - { - if (this->empty()) - boost::throw_exception(bad_function_call()); - - return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); - } -#else - result_type operator()(BOOST_FUNCTION_PARMS) const; -#endif - - // The distinction between when to use BOOST_FUNCTION_FUNCTION and - // when to use self_type is obnoxious. MSVC cannot handle self_type as - // the return type of these assignment operators, but Borland C++ cannot - // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to - // construct. - template<typename Functor> -#ifndef BOOST_NO_SFINAE - typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral<Functor>::value)>::value), - BOOST_FUNCTION_FUNCTION&>::type -#else - BOOST_FUNCTION_FUNCTION& -#endif - operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) - { - self_type(f).swap(*this); - return *this; - } - -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION& operator=(clear_type*) - { - this->clear(); - return *this; - } -#else - BOOST_FUNCTION_FUNCTION& operator=(int zero) - { - BOOST_ASSERT(zero == 0); - this->clear(); - return *this; - } -#endif - - // Assignment from another BOOST_FUNCTION_FUNCTION - BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) - { - if (&f == this) - return *this; - - self_type(f).swap(*this); - return *this; - } - - void swap(BOOST_FUNCTION_FUNCTION& other) - { - if (&other == this) - return; - - std::swap(this->manager, other.manager); - std::swap(this->functor, other.functor); - std::swap(invoker, other.invoker); - } - - // Clear out a target, if there is one - void clear() - { - if (this->manager) { - function_base::functor = - this->manager(this->functor, detail::function::destroy_functor_tag); - } - - this->manager = 0; - invoker = 0; - } - -#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) - // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it - operator bool () const { return !this->empty(); } -#else - private: - struct dummy { - void nonnull() {}; - }; - - typedef void (dummy::*safe_bool)(); - - public: - operator safe_bool () const - { return (this->empty())? 0 : &dummy::nonnull; } - - bool operator!() const - { return this->empty(); } -#endif - - private: - void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) - { - if (!f.empty()) { - invoker = f.invoker; - this->manager = f.manager; - this->functor = - f.manager(f.functor, detail::function::clone_functor_tag); - } - } - - template<typename Functor> - void assign_to(Functor f) - { - typedef typename detail::function::get_function_tag<Functor>::type tag; - this->assign_to(f, tag()); - } - - template<typename FunctionPtr> - void assign_to(FunctionPtr f, detail::function::function_ptr_tag) - { - clear(); - - if (f) { - typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = - &detail::function::functor_manager<FunctionPtr, Allocator>::manage; - this->functor = - this->manager(detail::function::make_any_pointer( - // should be a reinterpret cast, but some compilers - // insist on giving cv-qualifiers to free functions - (void (*)())(f) - ), - detail::function::clone_functor_tag); - } - } - -#if BOOST_FUNCTION_NUM_ARGS > 0 - template<typename MemberPtr> - void assign_to(MemberPtr f, detail::function::member_ptr_tag) - { - this->assign_to(mem_fn(f)); - } -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - - template<typename FunctionObj> - void assign_to(FunctionObj f, detail::function::function_obj_tag) - { - if (!detail::function::has_empty_target(boost::addressof(f))) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::functor_manager< - FunctionObj, Allocator>::manage; -#ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind<FunctionObj>::other - rebound_allocator_type; - typedef typename rebound_allocator_type::pointer pointer_type; - rebound_allocator_type allocator; - pointer_type copy = allocator.allocate(1); - allocator.construct(copy, f); - - // Get back to the original pointer type - FunctionObj* new_f = static_cast<FunctionObj*>(copy); -#else - FunctionObj* new_f = new FunctionObj(f); -#endif // BOOST_NO_STD_ALLOCATOR - this->functor = - detail::function::make_any_pointer(static_cast<void*>(new_f)); - } - } - - template<typename FunctionObj> - void assign_to(const reference_wrapper<FunctionObj>& f, - detail::function::function_obj_ref_tag) - { - if (!detail::function::has_empty_target(f.get_pointer())) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::trivial_manager<FunctionObj>::get; - this->functor = - this->manager( - detail::function::make_any_pointer( - const_cast<FunctionObj*>(f.get_pointer())), - detail::function::clone_functor_tag); - } - } - - template<typename FunctionObj> - void assign_to(FunctionObj, detail::function::stateless_function_obj_tag) - { - typedef - typename detail::function:: - BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::trivial_manager<FunctionObj>::get; - this->functor = detail::function::make_any_pointer(this); - } - - typedef result_type (*invoker_type)(detail::function::any_pointer - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS); - - invoker_type invoker; - }; - - template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS , - typename Allocator> - inline void swap(BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator - >& f1, - BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS, - Allocator - >& f2) - { - f1.swap(f2); - } - -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) - template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS, - typename Allocator> - typename BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, - Allocator>::result_type - BOOST_FUNCTION_FUNCTION<R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, - - Allocator> - ::operator()(BOOST_FUNCTION_PARMS) const - { - if (this->empty()) - boost::throw_exception(bad_function_call()); - - return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); - } -#endif - -// Poison comparisons between boost::function objects of the same type. -template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS , - typename Allocator> - void operator==(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&); -template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS , - typename Allocator> - void operator!=(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&); - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) - -#if BOOST_FUNCTION_NUM_ARGS == 0 -#define BOOST_FUNCTION_PARTIAL_SPEC R (void) -#else -#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T)) -#endif - -template<typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS, - typename Allocator> -class function<BOOST_FUNCTION_PARTIAL_SPEC, Allocator> - : public BOOST_FUNCTION_FUNCTION<R, BOOST_FUNCTION_TEMPLATE_ARGS - BOOST_FUNCTION_COMMA Allocator> -{ - typedef BOOST_FUNCTION_FUNCTION<R, BOOST_FUNCTION_TEMPLATE_ARGS - BOOST_FUNCTION_COMMA Allocator> base_type; - typedef function self_type; - - struct clear_type {}; - -public: - typedef typename base_type::allocator_type allocator_type; - - function() : base_type() {} - - template<typename Functor> - function(Functor f -#ifndef BOOST_NO_SFINAE - ,typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral<Functor>::value)>::value), - int>::type = 0 -#endif - ) : - base_type(f) - { - } - -#ifndef BOOST_NO_SFINAE - function(clear_type*) : base_type() {} -#endif - - function(const self_type& f) : base_type(static_cast<const base_type&>(f)){} - - function(const base_type& f) : base_type(static_cast<const base_type&>(f)){} - - self_type& operator=(const self_type& f) - { - self_type(f).swap(*this); - return *this; - } - - template<typename Functor> -#ifndef BOOST_NO_SFINAE - typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral<Functor>::value)>::value), - self_type&>::type -#else - self_type& -#endif - operator=(Functor f) - { - self_type(f).swap(*this); - return *this; - } - -#ifndef BOOST_NO_SFINAE - self_type& operator=(clear_type*) - { - this->clear(); - return *this; - } -#endif - - self_type& operator=(const base_type& f) - { - self_type(f).swap(*this); - return *this; - } -}; - -#undef BOOST_FUNCTION_PARTIAL_SPEC -#endif // have partial specialization - -} // end namespace boost - -// Cleanup after ourselves... -#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR -#undef BOOST_FUNCTION_COMMA -#undef BOOST_FUNCTION_FUNCTION -#undef BOOST_FUNCTION_FUNCTION_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER -#undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER -#undef BOOST_FUNCTION_TEMPLATE_PARMS -#undef BOOST_FUNCTION_TEMPLATE_ARGS -#undef BOOST_FUNCTION_PARMS -#undef BOOST_FUNCTION_PARM -#undef BOOST_FUNCTION_ARGS -#undef BOOST_FUNCTION_ARG_TYPE -#undef BOOST_FUNCTION_ARG_TYPES -#undef BOOST_FUNCTION_VOID_RETURN_TYPE -#undef BOOST_FUNCTION_RETURN diff --git a/Utilities/BGL/boost/function/gen_function_N.pl b/Utilities/BGL/boost/function/gen_function_N.pl deleted file mode 100644 index d8f1249b07a20b72c98f3e5f07dc50647d9ed4a1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function/gen_function_N.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl -w -# -# Boost.Function library -# -# Copyright Douglas Gregor 2001-2003. 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 -use English; - -if ($#ARGV < 0) { - print "Usage: perl gen_function_N <number of arguments>\n"; - exit; -} - - -$totalNumArgs = $ARGV[0]; -for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) { - open OUT, ">function$numArgs.hpp"; - print OUT "#define BOOST_FUNCTION_NUM_ARGS $numArgs\n"; - print OUT "#include <boost/function/detail/maybe_include.hpp>\n"; - print OUT "#undef BOOST_FUNCTION_NUM_ARGS\n"; - close OUT; -} diff --git a/Utilities/BGL/boost/function_equal.hpp b/Utilities/BGL/boost/function_equal.hpp deleted file mode 100644 index 2d76c75bc90c50c4d91b839ca53350491eb26010..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/function_equal.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright Douglas Gregor 2004. -// Copyright 2005 Peter Dimov - -// 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 -#ifndef BOOST_FUNCTION_EQUAL_HPP -#define BOOST_FUNCTION_EQUAL_HPP - -namespace boost { - -template<typename F, typename G> - bool function_equal_impl(const F& f, const G& g, long) - { return f == g; } - -// function_equal_impl needs to be unqualified to pick -// user overloads on two-phase compilers - -template<typename F, typename G> - bool function_equal(const F& f, const G& g) - { return function_equal_impl(f, g, 0); } - -} // end namespace boost - -#endif // BOOST_FUNCTION_EQUAL_HPP diff --git a/Utilities/BGL/boost/functional.hpp b/Utilities/BGL/boost/functional.hpp deleted file mode 100644 index e13267267e4d067c8ba258190c87afc28c7a5e3b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/functional.hpp +++ /dev/null @@ -1,556 +0,0 @@ -// ------------------------------------------------------------------------------ -// Boost functional.hpp header file -// See http://www.boost.org/libs/functional for documentation. -// ------------------------------------------------------------------------------ -// Copyright (c) 2000 -// Cadenza New Zealand Ltd -// -// Permission to use, copy, modify, distribute and sell this software -// and its documentation for any purpose is hereby granted without -// fee, provided that the above copyright notice appears in all copies -// and that both the copyright notice and this permission notice -// appear in supporting documentation. Cadenza New Zealand Ltd makes -// no representations about the suitability of this software for any -// purpose. It is provided "as is" without express or implied -// warranty. -// ------------------------------------------------------------------------------ -// $Id: functional.hpp,v 1.4 2002/12/27 16:51:52 beman_dawes Exp $ -// ------------------------------------------------------------------------------ - -#ifndef BOOST_FUNCTIONAL_HPP -#define BOOST_FUNCTIONAL_HPP - -#include <boost/config.hpp> -#include <boost/call_traits.hpp> -#include <functional> - -namespace boost -{ -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // -------------------------------------------------------------------------- - // The following traits classes allow us to avoid the need for ptr_fun - // because the types of arguments and the result of a function can be - // deduced. - // - // In addition to the standard types defined in unary_function and - // binary_function, we add - // - // - function_type, the type of the function or function object itself. - // - // - param_type, the type that should be used for passing the function or - // function object as an argument. - // -------------------------------------------------------------------------- - namespace detail - { - template <class Operation> - struct unary_traits_imp; - - template <class Operation> - struct unary_traits_imp<Operation*> - { - typedef Operation function_type; - typedef const function_type & param_type; - typedef typename Operation::result_type result_type; - typedef typename Operation::argument_type argument_type; - }; - - template <class R, class A> - struct unary_traits_imp<R(*)(A)> - { - typedef R (*function_type)(A); - typedef R (*param_type)(A); - typedef R result_type; - typedef A argument_type; - }; - - template <class Operation> - struct binary_traits_imp; - - template <class Operation> - struct binary_traits_imp<Operation*> - { - typedef Operation function_type; - typedef const function_type & param_type; - typedef typename Operation::result_type result_type; - typedef typename Operation::first_argument_type first_argument_type; - typedef typename Operation::second_argument_type second_argument_type; - }; - - template <class R, class A1, class A2> - struct binary_traits_imp<R(*)(A1,A2)> - { - typedef R (*function_type)(A1,A2); - typedef R (*param_type)(A1,A2); - typedef R result_type; - typedef A1 first_argument_type; - typedef A2 second_argument_type; - }; - } // namespace detail - - template <class Operation> - struct unary_traits - { - typedef typename detail::unary_traits_imp<Operation*>::function_type function_type; - typedef typename detail::unary_traits_imp<Operation*>::param_type param_type; - typedef typename detail::unary_traits_imp<Operation*>::result_type result_type; - typedef typename detail::unary_traits_imp<Operation*>::argument_type argument_type; - }; - - template <class R, class A> - struct unary_traits<R(*)(A)> - { - typedef R (*function_type)(A); - typedef R (*param_type)(A); - typedef R result_type; - typedef A argument_type; - }; - - template <class Operation> - struct binary_traits - { - typedef typename detail::binary_traits_imp<Operation*>::function_type function_type; - typedef typename detail::binary_traits_imp<Operation*>::param_type param_type; - typedef typename detail::binary_traits_imp<Operation*>::result_type result_type; - typedef typename detail::binary_traits_imp<Operation*>::first_argument_type first_argument_type; - typedef typename detail::binary_traits_imp<Operation*>::second_argument_type second_argument_type; - }; - - template <class R, class A1, class A2> - struct binary_traits<R(*)(A1,A2)> - { - typedef R (*function_type)(A1,A2); - typedef R (*param_type)(A1,A2); - typedef R result_type; - typedef A1 first_argument_type; - typedef A2 second_argument_type; - }; -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // -------------------------------------------------------------------------- - // If we have no partial specialisation available, decay to a situation - // that is no worse than in the Standard, i.e., ptr_fun will be required. - // -------------------------------------------------------------------------- - - template <class Operation> - struct unary_traits - { - typedef Operation function_type; - typedef const Operation& param_type; - typedef typename Operation::result_type result_type; - typedef typename Operation::argument_type argument_type; - }; - - template <class Operation> - struct binary_traits - { - typedef Operation function_type; - typedef const Operation & param_type; - typedef typename Operation::result_type result_type; - typedef typename Operation::first_argument_type first_argument_type; - typedef typename Operation::second_argument_type second_argument_type; - }; -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - // -------------------------------------------------------------------------- - // unary_negate, not1 - // -------------------------------------------------------------------------- - template <class Predicate> - class unary_negate - : public std::unary_function<typename unary_traits<Predicate>::argument_type,bool> - { - public: - explicit unary_negate(typename unary_traits<Predicate>::param_type x) - : - pred(x) - {} - bool operator()(typename call_traits<typename unary_traits<Predicate>::argument_type>::param_type x) const - { - return !pred(x); - } - private: - typename unary_traits<Predicate>::function_type pred; - }; - - template <class Predicate> - unary_negate<Predicate> not1(const Predicate &pred) - { - // The cast is to placate Borland C++Builder in certain circumstances. - // I don't think it should be necessary. - return unary_negate<Predicate>((typename unary_traits<Predicate>::param_type)pred); - } - - template <class Predicate> - unary_negate<Predicate> not1(Predicate &pred) - { - return unary_negate<Predicate>(pred); - } - - // -------------------------------------------------------------------------- - // binary_negate, not2 - // -------------------------------------------------------------------------- - template <class Predicate> - class binary_negate - : public std::binary_function<typename binary_traits<Predicate>::first_argument_type, - typename binary_traits<Predicate>::second_argument_type, - bool> - { - public: - explicit binary_negate(typename binary_traits<Predicate>::param_type x) - : - pred(x) - {} - bool operator()(typename call_traits<typename binary_traits<Predicate>::first_argument_type>::param_type x, - typename call_traits<typename binary_traits<Predicate>::second_argument_type>::param_type y) const - { - return !pred(x,y); - } - private: - typename binary_traits<Predicate>::function_type pred; - }; - - template <class Predicate> - binary_negate<Predicate> not2(const Predicate &pred) - { - // The cast is to placate Borland C++Builder in certain circumstances. - // I don't think it should be necessary. - return binary_negate<Predicate>((typename binary_traits<Predicate>::param_type)pred); - } - - template <class Predicate> - binary_negate<Predicate> not2(Predicate &pred) - { - return binary_negate<Predicate>(pred); - } - - // -------------------------------------------------------------------------- - // binder1st, bind1st - // -------------------------------------------------------------------------- - template <class Operation> - class binder1st - : public std::unary_function<typename binary_traits<Operation>::second_argument_type, - typename binary_traits<Operation>::result_type> - { - public: - binder1st(typename binary_traits<Operation>::param_type x, - typename call_traits<typename binary_traits<Operation>::first_argument_type>::param_type y) - : - op(x), value(y) - {} - - typename binary_traits<Operation>::result_type - operator()(typename call_traits<typename binary_traits<Operation>::second_argument_type>::param_type x) const - { - return op(value, x); - } - - protected: - typename binary_traits<Operation>::function_type op; - typename binary_traits<Operation>::first_argument_type value; - }; - - template <class Operation> - inline binder1st<Operation> bind1st(const Operation &op, - typename call_traits< - typename binary_traits<Operation>::first_argument_type - >::param_type x) - { - // The cast is to placate Borland C++Builder in certain circumstances. - // I don't think it should be necessary. - return binder1st<Operation>((typename binary_traits<Operation>::param_type)op, x); - } - - template <class Operation> - inline binder1st<Operation> bind1st(Operation &op, - typename call_traits< - typename binary_traits<Operation>::first_argument_type - >::param_type x) - { - return binder1st<Operation>(op, x); - } - - // -------------------------------------------------------------------------- - // binder2nd, bind2nd - // -------------------------------------------------------------------------- - template <class Operation> - class binder2nd - : public std::unary_function<typename binary_traits<Operation>::first_argument_type, - typename binary_traits<Operation>::result_type> - { - public: - binder2nd(typename binary_traits<Operation>::param_type x, - typename call_traits<typename binary_traits<Operation>::second_argument_type>::param_type y) - : - op(x), value(y) - {} - - typename binary_traits<Operation>::result_type - operator()(typename call_traits<typename binary_traits<Operation>::first_argument_type>::param_type x) const - { - return op(x, value); - } - - protected: - typename binary_traits<Operation>::function_type op; - typename binary_traits<Operation>::second_argument_type value; - }; - - template <class Operation> - inline binder2nd<Operation> bind2nd(const Operation &op, - typename call_traits< - typename binary_traits<Operation>::second_argument_type - >::param_type x) - { - // The cast is to placate Borland C++Builder in certain circumstances. - // I don't think it should be necessary. - return binder2nd<Operation>((typename binary_traits<Operation>::param_type)op, x); - } - - template <class Operation> - inline binder2nd<Operation> bind2nd(Operation &op, - typename call_traits< - typename binary_traits<Operation>::second_argument_type - >::param_type x) - { - return binder2nd<Operation>(op, x); - } - - // -------------------------------------------------------------------------- - // mem_fun, etc - // -------------------------------------------------------------------------- - template <class S, class T> - class mem_fun_t : public std::unary_function<T*, S> - { - public: - explicit mem_fun_t(S (T::*p)()) - : - ptr(p) - {} - S operator()(T* p) const - { - return (p->*ptr)(); - } - private: - S (T::*ptr)(); - }; - - template <class S, class T, class A> - class mem_fun1_t : public std::binary_function<T*, A, S> - { - public: - explicit mem_fun1_t(S (T::*p)(A)) - : - ptr(p) - {} - S operator()(T* p, typename call_traits<A>::param_type x) const - { - return (p->*ptr)(x); - } - private: - S (T::*ptr)(A); - }; - - template <class S, class T> - class const_mem_fun_t : public std::unary_function<const T*, S> - { - public: - explicit const_mem_fun_t(S (T::*p)() const) - : - ptr(p) - {} - S operator()(const T* p) const - { - return (p->*ptr)(); - } - private: - S (T::*ptr)() const; - }; - - template <class S, class T, class A> - class const_mem_fun1_t : public std::binary_function<const T*, A, S> - { - public: - explicit const_mem_fun1_t(S (T::*p)(A) const) - : - ptr(p) - {} - S operator()(const T* p, typename call_traits<A>::param_type x) const - { - return (p->*ptr)(x); - } - private: - S (T::*ptr)(A) const; - }; - - template<class S, class T> - inline mem_fun_t<S,T> mem_fun(S (T::*f)()) - { - return mem_fun_t<S,T>(f); - } - - template<class S, class T, class A> - inline mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A)) - { - return mem_fun1_t<S,T,A>(f); - } - -#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST - template<class S, class T> - inline const_mem_fun_t<S,T> mem_fun(S (T::*f)() const) - { - return const_mem_fun_t<S,T>(f); - } - - template<class S, class T, class A> - inline const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const) - { - return const_mem_fun1_t<S,T,A>(f); - } -#endif // BOOST_NO_POINTER_TO_MEMBER_CONST - - // -------------------------------------------------------------------------- - // mem_fun_ref, etc - // -------------------------------------------------------------------------- - template <class S, class T> - class mem_fun_ref_t : public std::unary_function<T&, S> - { - public: - explicit mem_fun_ref_t(S (T::*p)()) - : - ptr(p) - {} - S operator()(T& p) const - { - return (p.*ptr)(); - } - private: - S (T::*ptr)(); - }; - - template <class S, class T, class A> - class mem_fun1_ref_t : public std::binary_function<T&, A, S> - { - public: - explicit mem_fun1_ref_t(S (T::*p)(A)) - : - ptr(p) - {} - S operator()(T& p, typename call_traits<A>::param_type x) const - { - return (p.*ptr)(x); - } - private: - S (T::*ptr)(A); - }; - - template <class S, class T> - class const_mem_fun_ref_t : public std::unary_function<const T&, S> - { - public: - explicit const_mem_fun_ref_t(S (T::*p)() const) - : - ptr(p) - {} - - S operator()(const T &p) const - { - return (p.*ptr)(); - } - private: - S (T::*ptr)() const; - }; - - template <class S, class T, class A> - class const_mem_fun1_ref_t : public std::binary_function<const T&, A, S> - { - public: - explicit const_mem_fun1_ref_t(S (T::*p)(A) const) - : - ptr(p) - {} - - S operator()(const T& p, typename call_traits<A>::param_type x) const - { - return (p.*ptr)(x); - } - private: - S (T::*ptr)(A) const; - }; - - template<class S, class T> - inline mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()) - { - return mem_fun_ref_t<S,T>(f); - } - - template<class S, class T, class A> - inline mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)) - { - return mem_fun1_ref_t<S,T,A>(f); - } - -#ifndef BOOST_NO_POINTER_TO_MEMBER_CONST - template<class S, class T> - inline const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const) - { - return const_mem_fun_ref_t<S,T>(f); - } - - template<class S, class T, class A> - inline const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const) - { - return const_mem_fun1_ref_t<S,T,A>(f); - } -#endif // BOOST_NO_POINTER_TO_MEMBER_CONST - - // -------------------------------------------------------------------------- - // ptr_fun - // -------------------------------------------------------------------------- - template <class Arg, class Result> - class pointer_to_unary_function : public std::unary_function<Arg,Result> - { - public: - explicit pointer_to_unary_function(Result (*f)(Arg)) - : - func(f) - {} - - Result operator()(typename call_traits<Arg>::param_type x) const - { - return func(x); - } - - private: - Result (*func)(Arg); - }; - - template <class Arg, class Result> - inline pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)) - { - return pointer_to_unary_function<Arg,Result>(f); - } - - template <class Arg1, class Arg2, class Result> - class pointer_to_binary_function : public std::binary_function<Arg1,Arg2,Result> - { - public: - explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2)) - : - func(f) - {} - - Result operator()(typename call_traits<Arg1>::param_type x, typename call_traits<Arg2>::param_type y) const - { - return func(x,y); - } - - private: - Result (*func)(Arg1, Arg2); - }; - - template <class Arg1, class Arg2, class Result> - inline pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1, Arg2)) - { - return pointer_to_binary_function<Arg1,Arg2,Result>(f); - } -} // namespace boost - -#endif diff --git a/Utilities/BGL/boost/functional/detail/container_fwd.hpp b/Utilities/BGL/boost/functional/detail/container_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9a69d155b2a1d0249d2c8c247c316fbae28b7513 --- /dev/null +++ b/Utilities/BGL/boost/functional/detail/container_fwd.hpp @@ -0,0 +1,19 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Forwarding header for container_fwd.hpp's new location. +// This header is deprecated, I'll be adding a warning in a future release, +// then converting it to an error and finally removing this header completely. + +#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP) +#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/detail/container_fwd.hpp> + +#endif diff --git a/Utilities/BGL/boost/functional/hash.hpp b/Utilities/BGL/boost/functional/hash.hpp new file mode 100644 index 0000000000000000000000000000000000000000..44983f19b2670e932f8ad94b4a27386b5a567e4f --- /dev/null +++ b/Utilities/BGL/boost/functional/hash.hpp @@ -0,0 +1,7 @@ + +// Copyright 2005-2009 Daniel James. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/functional/hash/hash.hpp> + diff --git a/Utilities/BGL/boost/functional/hash/detail/float_functions.hpp b/Utilities/BGL/boost/functional/hash/detail/float_functions.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ae03ff091ee270b578ef9ef9c25eb77765b861b3 --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/detail/float_functions.hpp @@ -0,0 +1,246 @@ + +// Copyright 2005-2009 Daniel James. +// 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(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP) +#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP + +#include <boost/config.hpp> +#include <boost/config/no_tr1/cmath.hpp> + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// The C++ standard requires that the C float functions are overloarded +// for float, double and long double in the std namespace, but some of the older +// library implementations don't support this. On some that don't, the C99 +// float functions (frexpf, frexpl, etc.) are available. +// +// The following tries to automatically detect which are available. + +namespace boost { + namespace hash_detail { + + // Returned by dummy versions of the float functions. + + struct not_found { + // Implicitly convertible to float and long double in order to avoid + // a compile error when the dummy float functions are used. + + inline operator float() const { return 0; } + inline operator long double() const { return 0; } + }; + + // A type for detecting the return type of functions. + + template <typename T> struct is; + template <> struct is<float> { char x[10]; }; + template <> struct is<double> { char x[20]; }; + template <> struct is<long double> { char x[30]; }; + template <> struct is<boost::hash_detail::not_found> { char x[40]; }; + + // Used to convert the return type of a function to a type for sizeof. + + template <typename T> is<T> float_type(T); + + // call_ldexp + // + // This will get specialized for float and long double + + template <typename Float> struct call_ldexp + { + typedef double float_type; + + inline double operator()(double a, int b) const + { + using namespace std; + return ldexp(a, b); + } + }; + + // call_frexp + // + // This will get specialized for float and long double + + template <typename Float> struct call_frexp + { + typedef double float_type; + + inline double operator()(double a, int* b) const + { + using namespace std; + return frexp(a, b); + } + }; + } +} + +// A namespace for dummy functions to detect when the actual function we want +// isn't available. ldexpl, ldexpf etc. might be added tby the macros below. +// +// AFAICT these have to be outside of the boost namespace, as if they're in +// the boost namespace they'll always be preferable to any other function +// (since the arguments are built in types, ADL can't be used). + +namespace boost_hash_detect_float_functions { + template <class Float> boost::hash_detail::not_found ldexp(Float, int); + template <class Float> boost::hash_detail::not_found frexp(Float, int*); +} + +// Macros for generating specializations of call_ldexp and call_frexp. +// +// check_cpp and check_c99 check if the C++ or C99 functions are available. +// +// Then the call_* functions select an appropriate implementation. +// +// I used c99_func in a few places just to get a unique name. +// +// Important: when using 'using namespace' at namespace level, include as +// little as possible in that namespace, as Visual C++ has an odd bug which +// can cause the namespace to be imported at the global level. This seems to +// happen mainly when there's a template in the same namesapce. + +#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \ +namespace boost_hash_detect_float_functions { \ + template <class Float> \ + boost::hash_detail::not_found c99_func(Float, type2); \ +} \ + \ +namespace boost { \ + namespace hash_detail { \ + namespace c99_func##_detect { \ + using namespace std; \ + using namespace boost_hash_detect_float_functions; \ + \ + struct check { \ + static type1 x; \ + static type2 y; \ + BOOST_STATIC_CONSTANT(bool, cpp = \ + sizeof(float_type(cpp_func(x,y))) \ + == sizeof(is<type1>)); \ + BOOST_STATIC_CONSTANT(bool, c99 = \ + sizeof(float_type(c99_func(x,y))) \ + == sizeof(is<type1>)); \ + }; \ + } \ + \ + template <bool x> \ + struct call_c99_##c99_func : \ + boost::hash_detail::call_##cpp_func<double> {}; \ + \ + template <> \ + struct call_c99_##c99_func<true> { \ + typedef type1 float_type; \ + \ + template <typename T> \ + inline type1 operator()(type1 a, T b) const \ + { \ + using namespace std; \ + return c99_func(a, b); \ + } \ + }; \ + \ + template <bool x> \ + struct call_cpp_##c99_func : \ + call_c99_##c99_func< \ + ::boost::hash_detail::c99_func##_detect::check::c99 \ + > {}; \ + \ + template <> \ + struct call_cpp_##c99_func<true> { \ + typedef type1 float_type; \ + \ + template <typename T> \ + inline type1 operator()(type1 a, T b) const \ + { \ + using namespace std; \ + return cpp_func(a, b); \ + } \ + }; \ + \ + template <> \ + struct call_##cpp_func<type1> : \ + call_cpp_##c99_func< \ + ::boost::hash_detail::c99_func##_detect::check::cpp \ + > {}; \ + } \ +} + +#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \ +namespace boost { \ + namespace hash_detail { \ + \ + template <> \ + struct call_##cpp_func<type1> { \ + typedef type1 float_type; \ + inline type1 operator()(type1 x, type2 y) const { \ + return c99_func(x, y); \ + } \ + }; \ + } \ +} + +#if defined(ldexpf) +BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int) +#else +BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int) +#endif + +#if defined(ldexpl) +BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int) +#else +BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int) +#endif + +#if defined(frexpf) +BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*) +#else +BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*) +#endif + +#if defined(frexpl) +BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*) +#else +BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*) +#endif + +#undef BOOST_HASH_CALL_FLOAT_MACRO +#undef BOOST_HASH_CALL_FLOAT_FUNC + + +namespace boost +{ + namespace hash_detail + { + template <typename Float1, typename Float2> + struct select_hash_type_impl { + typedef double type; + }; + + template <> + struct select_hash_type_impl<float, float> { + typedef float type; + }; + + template <> + struct select_hash_type_impl<long double, long double> { + typedef long double type; + }; + + + // select_hash_type + // + // If there is support for a particular floating point type, use that + // otherwise use double (there's always support for double). + + template <typename Float> + struct select_hash_type : select_hash_type_impl< + BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type, + BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type + > {}; + } +} + +#endif diff --git a/Utilities/BGL/boost/functional/hash/detail/hash_float.hpp b/Utilities/BGL/boost/functional/hash/detail/hash_float.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ea1bc25f483a1a8aacc0de0fa75f4af61d12cc34 --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/detail/hash_float.hpp @@ -0,0 +1,101 @@ + +// Copyright 2005-2009 Daniel James. +// 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(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/config.hpp> +#include <boost/functional/hash/detail/float_functions.hpp> +#include <boost/functional/hash/detail/limits.hpp> +#include <boost/integer/static_log2.hpp> +#include <boost/cstdint.hpp> +#include <boost/assert.hpp> + +// Include hash implementation for the current platform. + +// Cygwn +#if defined(__CYGWIN__) +# if defined(__i386__) || defined(_M_IX86) +# include <boost/functional/hash/detail/hash_float_x86.hpp> +# else +# include <boost/functional/hash/detail/hash_float_generic.hpp> +# endif +#else +# include <boost/functional/hash/detail/hash_float_generic.hpp> +#endif + +// Can we use fpclassify? + +// STLport +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +#define BOOST_HASH_USE_FPCLASSIFY 0 + +// GNU libstdc++ 3 +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \ + !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) +# define BOOST_HASH_USE_FPCLASSIFY 1 +# else +# define BOOST_HASH_USE_FPCLASSIFY 0 +# endif + +// Everything else +#else +# define BOOST_HASH_USE_FPCLASSIFY 0 +#endif + +#if BOOST_HASH_USE_FPCLASSIFY + +#include <boost/config/no_tr1/cmath.hpp> + +namespace boost +{ + namespace hash_detail + { + template <class T> + inline std::size_t float_hash_value(T v) + { + using namespace std; + switch (fpclassify(v)) { + case FP_ZERO: + return 0; + case FP_INFINITE: + return (std::size_t)(v > 0 ? -1 : -2); + case FP_NAN: + return (std::size_t)(-3); + case FP_NORMAL: + case FP_SUBNORMAL: + return float_hash_impl(v); + default: + BOOST_ASSERT(0); + return 0; + } + } + } +} + +#else // !BOOST_HASH_USE_FPCLASSIFY + +namespace boost +{ + namespace hash_detail + { + template <class T> + inline std::size_t float_hash_value(T v) + { + return v == 0 ? 0 : float_hash_impl(v); + } + } +} + +#endif // BOOST_HASH_USE_FPCLASSIFY + +#undef BOOST_HASH_USE_FPCLASSIFY + +#endif diff --git a/Utilities/BGL/boost/functional/hash/detail/hash_float_generic.hpp b/Utilities/BGL/boost/functional/hash/detail/hash_float_generic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f9acee9cd1ecb34ced8fe5cdca5fb3d7d066162a --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/detail/hash_float_generic.hpp @@ -0,0 +1,93 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// A general purpose hash function for non-zero floating point values. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER + +#include <boost/functional/hash/detail/float_functions.hpp> +#include <boost/integer/static_log2.hpp> +#include <boost/functional/hash/detail/limits.hpp> + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC >= 1400 +#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does + // not satisfy test. Loop body not executed +#endif +#endif + +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + template <class T> + inline std::size_t float_hash_impl2(T v) + { + boost::hash_detail::call_frexp<T> frexp; + boost::hash_detail::call_ldexp<T> ldexp; + + int exp = 0; + + v = frexp(v, &exp); + + // A postive value is easier to hash, so combine the + // sign with the exponent and use the absolute value. + if(v < 0) { + v = -v; + exp += limits<T>::max_exponent - + limits<T>::min_exponent; + } + + // The result of frexp is always between 0.5 and 1, so its + // top bit will always be 1. Subtract by 0.5 to remove that. + v -= T(0.5); + v = ldexp(v, limits<std::size_t>::digits + 1); + std::size_t seed = static_cast<std::size_t>(v); + v -= seed; + + // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; + std::size_t const length + = (limits<T>::digits * + boost::static_log2<limits<T>::radix>::value - 1) + / limits<std::size_t>::digits; + + for(std::size_t i = 0; i != length; ++i) + { + v = ldexp(v, limits<std::size_t>::digits); + std::size_t part = static_cast<std::size_t>(v); + v -= part; + hash_float_combine(seed, part); + } + + hash_float_combine(seed, exp); + + return seed; + } + + template <class T> + inline std::size_t float_hash_impl(T v) + { + typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type; + return float_hash_impl2(static_cast<type>(v)); + } + } +} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif diff --git a/Utilities/BGL/boost/functional/hash/detail/hash_float_x86.hpp b/Utilities/BGL/boost/functional/hash/detail/hash_float_x86.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b39bb0d081767474f48554feae091c10052d1022 --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/detail/hash_float_x86.hpp @@ -0,0 +1,56 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// A non-portable hash function form non-zero floats on x86. +// +// Even if you're on an x86 platform, this might not work if their floating +// point isn't set up as this expects. So this should only be used if it's +// absolutely certain that it will work. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER + +#include <boost/cstdint.hpp> + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + inline std::size_t float_hash_impl(float v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr; + return seed; + } + + inline std::size_t float_hash_impl(double v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr++; + hash_float_combine(seed, *ptr); + return seed; + } + + inline std::size_t float_hash_impl(long double v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr++; + hash_float_combine(seed, *ptr++); + hash_float_combine(seed, *(boost::uint16_t*)ptr); + return seed; + } + } +} + +#endif diff --git a/Utilities/BGL/boost/functional/hash/detail/limits.hpp b/Utilities/BGL/boost/functional/hash/detail/limits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f5b520ea9d7355b25ebdb18bc93b1af27cc5050f --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/detail/limits.hpp @@ -0,0 +1,61 @@ + +// Copyright 2005-2009 Daniel James. +// 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) +// +// On some platforms std::limits gives incorrect values for long double. +// This tries to work around them. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/limits.hpp> + +// On OpenBSD, numeric_limits is not reliable for long doubles, but +// the macros defined in <float.h> are and support long double when STLport +// doesn't. + +#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) +#include <float.h> +#endif + +namespace boost +{ + namespace hash_detail + { + template <class T> + struct limits : std::numeric_limits<T> {}; + +#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) + template <> + struct limits<long double> + : std::numeric_limits<long double> + { + static long double epsilon() { + return LDBL_EPSILON; + } + + static long double (max)() { + return LDBL_MAX; + } + + static long double (min)() { + return LDBL_MIN; + } + + BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG); + BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP); + BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP); +#if defined(_STLP_NO_LONG_DOUBLE) + BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX); +#endif + }; +#endif // __OpenBSD__ + } +} + +#endif diff --git a/Utilities/BGL/boost/functional/hash/extensions.hpp b/Utilities/BGL/boost/functional/hash/extensions.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3c587a3bf5de05c8e61bb95b75009480c3e2ea46 --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/extensions.hpp @@ -0,0 +1,286 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +// This implements the extensions to the standard. +// It's undocumented, so you shouldn't use it.... + +#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) +#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP + +#include <boost/functional/hash/hash.hpp> +#include <boost/detail/container_fwd.hpp> + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +#include <boost/type_traits/is_array.hpp> +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#include <boost/type_traits/is_const.hpp> +#endif + +namespace boost +{ + template <class A, class B> + std::size_t hash_value(std::pair<A, B> const&); + template <class T, class A> + std::size_t hash_value(std::vector<T, A> const&); + template <class T, class A> + std::size_t hash_value(std::list<T, A> const& v); + template <class T, class A> + std::size_t hash_value(std::deque<T, A> const& v); + template <class K, class C, class A> + std::size_t hash_value(std::set<K, C, A> const& v); + template <class K, class C, class A> + std::size_t hash_value(std::multiset<K, C, A> const& v); + template <class K, class T, class C, class A> + std::size_t hash_value(std::map<K, T, C, A> const& v); + template <class K, class T, class C, class A> + std::size_t hash_value(std::multimap<K, T, C, A> const& v); + + template <class T> + std::size_t hash_value(std::complex<T> const&); + + template <class A, class B> + std::size_t hash_value(std::pair<A, B> const& v) + { + std::size_t seed = 0; + hash_combine(seed, v.first); + hash_combine(seed, v.second); + return seed; + } + + template <class T, class A> + std::size_t hash_value(std::vector<T, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class T, class A> + std::size_t hash_value(std::list<T, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class T, class A> + std::size_t hash_value(std::deque<T, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class C, class A> + std::size_t hash_value(std::set<K, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class C, class A> + std::size_t hash_value(std::multiset<K, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class T, class C, class A> + std::size_t hash_value(std::map<K, T, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class K, class T, class C, class A> + std::size_t hash_value(std::multimap<K, T, C, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + template <class T> + std::size_t hash_value(std::complex<T> const& v) + { + boost::hash<T> hasher; + std::size_t seed = hasher(v.imag()); + seed ^= hasher(v.real()) + (seed<<6) + (seed>>2); + return seed; + } + + // + // call_hash_impl + // + + // On compilers without function template ordering, this deals with arrays. + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + namespace hash_detail + { + template <bool IsArray> + struct call_hash_impl + { + template <class T> + struct inner + { + static std::size_t call(T const& v) + { + using namespace boost; + return hash_value(v); + } + }; + }; + + template <> + struct call_hash_impl<true> + { + template <class Array> + struct inner + { +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + static std::size_t call(Array const& v) +#else + static std::size_t call(Array& v) +#endif + { + const int size = sizeof(v) / sizeof(*v); + return boost::hash_range(v, v + size); + } + }; + }; + + template <class T> + struct call_hash + : public call_hash_impl<boost::is_array<T>::value> + ::BOOST_NESTED_TEMPLATE inner<T> + { + }; + } +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + + // + // boost::hash + // + + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + + template <class T> struct hash + : std::unary_function<T, std::size_t> + { +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + std::size_t operator()(T const& val) const + { + return hash_value(val); + } +#else + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash<T>::call(val); + } +#endif + }; + +#if BOOST_WORKAROUND(__DMC__, <= 0x848) + template <class T, unsigned int n> struct hash<T[n]> + : std::unary_function<T[n], std::size_t> + { + std::size_t operator()(const T* val) const + { + return boost::hash_range(val, val+n); + } + }; +#endif + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // On compilers without partial specialization, boost::hash<T> + // has already been declared to deal with pointers, so just + // need to supply the non-pointer version of hash_impl. + + namespace hash_detail + { + template <bool IsPointer> + struct hash_impl; + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + + template <> + struct hash_impl<false> + { + template <class T> + struct inner + : std::unary_function<T, std::size_t> + { +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + std::size_t operator()(T const& val) const + { + return hash_value(val); + } +#else + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash<T>::call(val); + } +#endif + }; + }; + +#else // Visual C++ 6.5 + + // Visual C++ 6.5 has problems with nested member functions and + // applying const to const types in templates. So we get this: + + template <bool IsConst> + struct hash_impl_msvc + { + template <class T> + struct inner + : public std::unary_function<T, std::size_t> + { + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash<T const>::call(val); + } + + std::size_t operator()(T& val) const + { + return hash_detail::call_hash<T>::call(val); + } + }; + }; + + template <> + struct hash_impl_msvc<true> + { + template <class T> + struct inner + : public std::unary_function<T, std::size_t> + { + std::size_t operator()(T& val) const + { + return hash_detail::call_hash<T>::call(val); + } + }; + }; + + template <class T> + struct hash_impl_msvc2 + : public hash_impl_msvc<boost::is_const<T>::value> + ::BOOST_NESTED_TEMPLATE inner<T> {}; + + template <> + struct hash_impl<false> + { + template <class T> + struct inner : public hash_impl_msvc2<T> {}; + }; + +#endif // Visual C++ 6.5 + } +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +} + +#endif diff --git a/Utilities/BGL/boost/functional/hash/hash.hpp b/Utilities/BGL/boost/functional/hash/hash.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f33b9ea9d9bfaf08b6fd68742b995d4c52e4919 --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/hash.hpp @@ -0,0 +1,495 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) +#define BOOST_FUNCTIONAL_HASH_HASH_HPP + +#include <boost/functional/hash/hash_fwd.hpp> +#include <functional> +#include <boost/functional/hash/detail/hash_float.hpp> +#include <string> +#include <boost/limits.hpp> + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#include <boost/type_traits/is_pointer.hpp> +#endif + +#if BOOST_WORKAROUND(__GNUC__, < 3) \ + && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +#define BOOST_HASH_CHAR_TRAITS string_char_traits +#else +#define BOOST_HASH_CHAR_TRAITS char_traits +#endif + +namespace boost +{ + std::size_t hash_value(bool); + std::size_t hash_value(char); + std::size_t hash_value(unsigned char); + std::size_t hash_value(signed char); + std::size_t hash_value(short); + std::size_t hash_value(unsigned short); + std::size_t hash_value(int); + std::size_t hash_value(unsigned int); + std::size_t hash_value(long); + std::size_t hash_value(unsigned long); + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + std::size_t hash_value(wchar_t); +#endif + +#if defined(BOOST_HAS_LONG_LONG) + std::size_t hash_value(boost::long_long_type); + std::size_t hash_value(boost::ulong_long_type); +#endif + +#if !BOOST_WORKAROUND(__DMC__, <= 0x848) + template <class T> std::size_t hash_value(T* const&); +#else + template <class T> std::size_t hash_value(T*); +#endif + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template< class T, unsigned N > + std::size_t hash_value(const T (&x)[N]); + + template< class T, unsigned N > + std::size_t hash_value(T (&x)[N]); +#endif + + std::size_t hash_value(float v); + std::size_t hash_value(double v); + std::size_t hash_value(long double v); + + template <class Ch, class A> + std::size_t hash_value( + std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&); + + // Implementation + + namespace hash_detail + { + template <class T> + inline std::size_t hash_value_signed(T val) + { + const int size_t_bits = std::numeric_limits<std::size_t>::digits; + // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1 + const int length = (std::numeric_limits<T>::digits - 1) + / size_t_bits; + + std::size_t seed = 0; + T positive = val < 0 ? -1 - val : val; + + // Hopefully, this loop can be unrolled. + for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) + { + seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2); + } + seed ^= (std::size_t) val + (seed<<6) + (seed>>2); + + return seed; + } + + template <class T> + inline std::size_t hash_value_unsigned(T val) + { + const int size_t_bits = std::numeric_limits<std::size_t>::digits; + // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1 + const int length = (std::numeric_limits<T>::digits - 1) + / size_t_bits; + + std::size_t seed = 0; + + // Hopefully, this loop can be unrolled. + for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) + { + seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2); + } + seed ^= (std::size_t) val + (seed<<6) + (seed>>2); + + return seed; + } + } + + inline std::size_t hash_value(bool v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(char v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(unsigned char v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(signed char v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(short v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(unsigned short v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(int v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(unsigned int v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(long v) + { + return static_cast<std::size_t>(v); + } + + inline std::size_t hash_value(unsigned long v) + { + return static_cast<std::size_t>(v); + } + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + inline std::size_t hash_value(wchar_t v) + { + return static_cast<std::size_t>(v); + } +#endif + +#if defined(BOOST_HAS_LONG_LONG) + inline std::size_t hash_value(boost::long_long_type v) + { + return hash_detail::hash_value_signed(v); + } + + inline std::size_t hash_value(boost::ulong_long_type v) + { + return hash_detail::hash_value_unsigned(v); + } +#endif + + // Implementation by Alberto Barbati and Dave Harris. +#if !BOOST_WORKAROUND(__DMC__, <= 0x848) + template <class T> std::size_t hash_value(T* const& v) +#else + template <class T> std::size_t hash_value(T* v) +#endif + { + std::size_t x = static_cast<std::size_t>( + reinterpret_cast<std::ptrdiff_t>(v)); + + return x + (x >> 3); + } + +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC <= 1400 +#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to + // 'unsigned int', possible loss of data + // A misguided attempt to detect 64-bit + // incompatability. +#endif +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template <class T> + inline void hash_combine(std::size_t& seed, T& v) +#else + template <class T> + inline void hash_combine(std::size_t& seed, T const& v) +#endif + { + boost::hash<T> hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + + template <class It> + inline std::size_t hash_range(It first, It last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + + return seed; + } + + template <class It> + inline void hash_range(std::size_t& seed, It first, It last) + { + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + } + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + template <class T> + inline std::size_t hash_range(T* first, T* last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + boost::hash<T> hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + + return seed; + } + + template <class T> + inline void hash_range(std::size_t& seed, T* first, T* last) + { + for(; first != last; ++first) + { + boost::hash<T> hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + } +#endif + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template< class T, unsigned N > + inline std::size_t hash_value(const T (&x)[N]) + { + return hash_range(x, x + N); + } + + template< class T, unsigned N > + inline std::size_t hash_value(T (&x)[N]) + { + return hash_range(x, x + N); + } +#endif + + template <class Ch, class A> + inline std::size_t hash_value( + std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + inline std::size_t hash_value(float v) + { + return boost::hash_detail::float_hash_value(v); + } + + inline std::size_t hash_value(double v) + { + return boost::hash_detail::float_hash_value(v); + } + + inline std::size_t hash_value(long double v) + { + return boost::hash_detail::float_hash_value(v); + } + + // + // boost::hash + // + + // Define the specializations required by the standard. The general purpose + // boost::hash is defined later in extensions.hpp if + // BOOST_HASH_NO_EXTENSIONS is not defined. + + // BOOST_HASH_SPECIALIZE - define a specialization for a type which is + // passed by copy. + // + // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is + // passed by copy. + // + // These are undefined later. + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#define BOOST_HASH_SPECIALIZE(type) \ + template <> struct hash<type> \ + : public std::unary_function<type, std::size_t> \ + { \ + std::size_t operator()(type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> struct hash<type> \ + : public std::unary_function<type, std::size_t> \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; +#else +#define BOOST_HASH_SPECIALIZE(type) \ + template <> struct hash<type> \ + : public std::unary_function<type, std::size_t> \ + { \ + std::size_t operator()(type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash<const type> \ + : public std::unary_function<const type, std::size_t> \ + { \ + std::size_t operator()(const type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> struct hash<type> \ + : public std::unary_function<type, std::size_t> \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash<const type> \ + : public std::unary_function<const type, std::size_t> \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; +#endif + + BOOST_HASH_SPECIALIZE(bool) + BOOST_HASH_SPECIALIZE(char) + BOOST_HASH_SPECIALIZE(signed char) + BOOST_HASH_SPECIALIZE(unsigned char) +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + BOOST_HASH_SPECIALIZE(wchar_t) +#endif + BOOST_HASH_SPECIALIZE(short) + BOOST_HASH_SPECIALIZE(unsigned short) + BOOST_HASH_SPECIALIZE(int) + BOOST_HASH_SPECIALIZE(unsigned int) + BOOST_HASH_SPECIALIZE(long) + BOOST_HASH_SPECIALIZE(unsigned long) + + BOOST_HASH_SPECIALIZE(float) + BOOST_HASH_SPECIALIZE(double) + BOOST_HASH_SPECIALIZE(long double) + + BOOST_HASH_SPECIALIZE_REF(std::string) +#if !defined(BOOST_NO_STD_WSTRING) + BOOST_HASH_SPECIALIZE_REF(std::wstring) +#endif + +#if defined(BOOST_HAS_LONG_LONG) + BOOST_HASH_SPECIALIZE(boost::long_long_type) + BOOST_HASH_SPECIALIZE(boost::ulong_long_type) +#endif + +#undef BOOST_HASH_SPECIALIZE +#undef BOOST_HASH_SPECIALIZE_REF + +// Specializing boost::hash for pointers. + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + + template <class T> + struct hash<T*> + : public std::unary_function<T*, std::size_t> + { + std::size_t operator()(T* v) const + { +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) + return boost::hash_value(v); +#else + std::size_t x = static_cast<std::size_t>( + reinterpret_cast<std::ptrdiff_t>(v)); + + return x + (x >> 3); +#endif + } + }; + +#else + + // For compilers without partial specialization, we define a + // boost::hash for all remaining types. But hash_impl is only defined + // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS + // is defined there will still be a compile error for types not supported + // in the standard. + + namespace hash_detail + { + template <bool IsPointer> + struct hash_impl; + + template <> + struct hash_impl<true> + { + template <class T> + struct inner + : public std::unary_function<T, std::size_t> + { + std::size_t operator()(T val) const + { +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590) + return boost::hash_value(val); +#else + std::size_t x = static_cast<std::size_t>( + reinterpret_cast<std::ptrdiff_t>(val)); + + return x + (x >> 3); +#endif + } + }; + }; + } + + template <class T> struct hash + : public boost::hash_detail::hash_impl<boost::is_pointer<T>::value> + ::BOOST_NESTED_TEMPLATE inner<T> + { + }; + +#endif +} + +#undef BOOST_HASH_CHAR_TRAITS + +#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP + +// Include this outside of the include guards in case the file is included +// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it +// undefined. + +#if !defined(BOOST_HASH_NO_EXTENSIONS) \ + && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) +#include <boost/functional/hash/extensions.hpp> +#endif diff --git a/Utilities/BGL/boost/functional/hash/hash_fwd.hpp b/Utilities/BGL/boost/functional/hash/hash_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1d51b07f2de4488e7cdeb522d12676e52d4c3b3a --- /dev/null +++ b/Utilities/BGL/boost/functional/hash/hash_fwd.hpp @@ -0,0 +1,40 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP) +#define BOOST_FUNCTIONAL_HASH_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/config.hpp> +#include <cstddef> +#include <boost/detail/workaround.hpp> + +namespace boost +{ + template <class T> struct hash; + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template <class T> void hash_combine(std::size_t& seed, T& v); +#else + template <class T> void hash_combine(std::size_t& seed, T const& v); +#endif + + template <class It> std::size_t hash_range(It, It); + template <class It> void hash_range(std::size_t&, It, It); + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + template <class T> inline std::size_t hash_range(T*, T*); + template <class T> inline void hash_range(std::size_t&, T*, T*); +#endif +} + +#endif diff --git a/Utilities/BGL/boost/functional/hash_fwd.hpp b/Utilities/BGL/boost/functional/hash_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b6409886181db5224bb352c529bdaf446f0799ba --- /dev/null +++ b/Utilities/BGL/boost/functional/hash_fwd.hpp @@ -0,0 +1,7 @@ + +// Copyright 2005-2009 Daniel James. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/functional/hash/hash_fwd.hpp> + diff --git a/Utilities/BGL/boost/get_pointer.hpp b/Utilities/BGL/boost/get_pointer.hpp deleted file mode 100644 index 17d11b8fef73b47500e28297da63af926bb71f68..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/get_pointer.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Peter Dimov and 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 GET_POINTER_DWA20021219_HPP -# define GET_POINTER_DWA20021219_HPP - -# include <memory> - -namespace boost { - -// get_pointer(p) extracts a ->* capable pointer from p - -template<class T> T * get_pointer(T * p) -{ - return p; -} - -// get_pointer(shared_ptr<T> const & p) has been moved to shared_ptr.hpp - -template<class T> T * get_pointer(std::auto_ptr<T> const& p) -{ - return p.get(); -} - - -} // namespace boost - -#endif // GET_POINTER_DWA20021219_HPP diff --git a/Utilities/BGL/boost/graph/LICENSE b/Utilities/BGL/boost/graph/LICENSE deleted file mode 100644 index f16b99f0e3b6f708a209435e3ee7856b4dff3ea8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/LICENSE +++ /dev/null @@ -1,100 +0,0 @@ -COPYRIGHT NOTICE: - -Copyright 1997-2000, University of Notre Dame. -Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek - -The Boost Graph Library "Artistic License" - -Preamble - -The intent of this document is to state the conditions under which a -Package may be copied, such that the Copyright Holder maintains some -semblance of artistic control over the development of the package, -while giving the users of the package the right to use and distribute -the Package in a more-or-less free fashion, plus the right to make -reasonable modifications. - -Definitions - -"Package" refers to the collection of files distributed by the -Copyright Holder, and derivatives of that collection of files created -through textual modification. - -"Standard Version" refers to such a Package if it has not been -modified, or has been modified in accordance with the wishes of the -Copyright Holder as specified below. - -"Copyright Holder" is whoever is named in the copyright or copyrights for the package. - -"You" is you, if you're thinking about copying or distributing this Package. - -"Reasonable copying fee" is whatever you can justify on the basis of -media cost, duplication charges, time of people involved, and so -on. (You will not be required to justify it to the Copyright Holder, -but only to the computing community at large as a market that must -bear the fee.) - -"Freely Available" means that no fee is charged for the item itself, -though there may be fees involved in handling the item. It also means -that recipients of the item may redistribute it under the same -conditions they received it. - -1. You may make and give away verbatim copies of the source form of -the Standard Version of this Package without restriction, provided -that you duplicate all of the original copyright notices and -associated disclaimers. - -2. You may apply bug fixes, portability fixes and other modifications -derived from the Public Domain or from the Copyright Holder. A Package -modified in such a way shall still be considered the Standard Version. - -3. You may otherwise modify your copy of this Package in any way, -provided that you insert a prominent notice in each changed file -stating how and when you changed that file, and provided that you do -at least ONE of the following: - - a. place your modifications in the Public Domain or otherwise make - them Freely Available, such as by posting said modifications to Usenet - or an equivalent medium, or placing the modifications on a major - archive site such as uunet.uu.net, or by allowing the Copyright Holder - to include your modifications in the Standard Version of the Package. - b. use the modified Package only within your corporation or organization. - c. rename any non-standard types and functions so the names do not - conflict with Standard Vibrary, which must also be provided, and - provide a separate documentation for each non-standard type of function - that clearly documents how it differs from the Standard Version. - d. make other distribution arrangements with the Copyright Holder. - -4. You may charge a reasonable copying fee for any distribution of this -Package. You may charge any fee you choose for support of this -Package. You may not charge a fee for this Package itself. However, -you may distribute this Package in aggregate with other (possibly -commercial) programs as part of a larger (possibly commercial) -software distribution provided that you do not advertise this Package -as a product of your own. - -5. The name of the Copyright Holder may not be used to endorse or -promote products derived from this software without specific prior -written permission. - -DISCLAIMER: - -LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -By way of example, but not limitation, Licensor MAKES NO -REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -OR OTHER RIGHTS. - -The Authors and the University of Notre Dame du Lac shall not be held -liable for any liability nor for any direct, indirect or consequential -damages with respect to any claim by LICENSEE or any third party on -account of or arising from this Agreement or use of this software. - -Any disputes arising out of this Agreement or LICENSEE'S use of the -software at any time shall be resolved by the courts of the state of -Indiana. LICENSEE hereby consents to the jurisdiction of the Indiana -courts and waives the right to challenge the jurisdiction thereof in -any dispute arising out of this Agreement or Licensee's use of the -software. - diff --git a/Utilities/BGL/boost/graph/accounting.hpp b/Utilities/BGL/boost/graph/accounting.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6643e7529013650d87cbc45446134188baf82818 --- /dev/null +++ b/Utilities/BGL/boost/graph/accounting.hpp @@ -0,0 +1,36 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_ACCOUNTING_HPP +#define BOOST_GRAPH_ACCOUNTING_HPP + +#include <iomanip> +#include <iostream> +#include <string> +#include <sstream> +#include <boost/mpi/config.hpp> + +namespace boost { namespace graph { namespace accounting { + +typedef double time_type; + +inline time_type get_time() +{ + return MPI_Wtime(); +} + +inline std::string print_time(time_type t) +{ + std::ostringstream out; + out << std::setiosflags(std::ios::fixed) << std::setprecision(2) << t; + return out.str(); +} + +} } } // end namespace boost::graph::accounting + +#endif // BOOST_GRAPH_ACCOUNTING_HPP diff --git a/Utilities/BGL/boost/graph/adj_list_serialize.hpp b/Utilities/BGL/boost/graph/adj_list_serialize.hpp new file mode 100644 index 0000000000000000000000000000000000000000..af0c0d89760410f0874ab109591e72f661bbcd15 --- /dev/null +++ b/Utilities/BGL/boost/graph/adj_list_serialize.hpp @@ -0,0 +1,113 @@ +//======================================================================= +// Copyright 2005 Jeremy G. Siek +// Authors: 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 ADJ_LIST_SERIALIZE_HPP +#define ADJ_LIST_SERIALIZE_HPP + +#include <boost/graph/adjacency_list.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/pending/property_serialize.hpp> +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { + +namespace serialization { + +// Turn off tracking for adjacency_list. It's not polymorphic, and we +// need to do this to enable saving of non-const adjacency lists. +template<class OEL, class VL, class D, class VP, class EP, class GP, class EL> +struct tracking_level<boost::adjacency_list<OEL,VL,D,VP,EP,GP,EL> > { + typedef mpl::integral_c_tag tag; + typedef mpl::int_<track_never> type; + BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value); +}; + +template<class Archive, class OEL, class VL, class D, + class VP, class EP, class GP, class EL> +inline void save( + Archive & ar, + const boost::adjacency_list<OEL,VL,D,VP,EP,GP,EL> &graph, + const unsigned int /* file_version */ +){ + typedef adjacency_list<OEL,VL,D,VP,EP,GP,EL> Graph; + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + + int V = num_vertices(graph); + int E = num_edges(graph); + ar << BOOST_SERIALIZATION_NVP(V); + ar << BOOST_SERIALIZATION_NVP(E); + + // assign indices to vertices + std::map<Vertex,int> indices; + int num = 0; + BGL_FORALL_VERTICES_T(v, graph, Graph) { + indices[v] = num++; + ar << serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, v) ); + } + + // write edges + BGL_FORALL_EDGES_T(e, graph, Graph) { + ar << serialization::make_nvp("u" , indices[source(e,graph)]); + ar << serialization::make_nvp("v" , indices[target(e,graph)]); + ar << serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); + } +} + + +template<class Archive, class OEL, class VL, class D, + class VP, class EP, class GP, class EL> +inline void load( + Archive & ar, + boost::adjacency_list<OEL,VL,D,VP,EP,GP,EL> &graph, + const unsigned int /* file_version */ +){ + typedef adjacency_list<OEL,VL,D,VP,EP,GP,EL> Graph; + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + unsigned int V; + ar >> BOOST_SERIALIZATION_NVP(V); + unsigned int E; + ar >> BOOST_SERIALIZATION_NVP(E); + + std::vector<Vertex> verts(V); + int i = 0; + while(V-- > 0){ + Vertex v = add_vertex(graph); + verts[i++] = v; + ar >> serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, v) ); + } + while(E-- > 0){ + int u; int v; + ar >> BOOST_SERIALIZATION_NVP(u); + ar >> BOOST_SERIALIZATION_NVP(v); + Edge e; bool inserted; + tie(e,inserted) = add_edge(verts[u], verts[v], graph); + ar >> serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); + } +} + +template<class Archive, class OEL, class VL, class D, class VP, class EP, class GP, class EL> +inline void serialize( + Archive & ar, + boost::adjacency_list<OEL,VL,D,VP,EP,GP,EL> &graph, + const unsigned int file_version +){ + boost::serialization::split_free(ar, graph, file_version); +} + +}//serialization +}//boost + + +#endif // ADJ_LIST_SERIALIZE_HPP diff --git a/Utilities/BGL/boost/graph/adjacency_list.hpp b/Utilities/BGL/boost/graph/adjacency_list.hpp index b92b9feb263be0afaae492e28f84d4b898129de3..625ab24d6f943eb839b05715cedaada67f1562b1 100644 --- a/Utilities/BGL/boost/graph/adjacency_list.hpp +++ b/Utilities/BGL/boost/graph/adjacency_list.hpp @@ -17,22 +17,29 @@ #include <list> #include <set> -#if !defined BOOST_NO_HASH -#include <hash_set> -#endif +#include <boost/unordered_set.hpp> #if !defined BOOST_NO_SLIST -#include <slist> +# ifdef BOOST_SLIST_HEADER +# include BOOST_SLIST_HEADER +# else +# include <slist> +# endif #endif #include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_mutability_traits.hpp> #include <boost/graph/graph_selectors.hpp> -#include <boost/property_map.hpp> -#include <boost/pending/ct_if.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/bool.hpp> #include <boost/graph/detail/edge.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/detail/workaround.hpp> #include <boost/graph/properties.hpp> +#include <boost/graph/named_graph.hpp> namespace boost { @@ -48,18 +55,19 @@ namespace boost { #if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #if !defined BOOST_NO_SLIST - struct slistS {}; + struct slistS {}; #endif struct vecS { }; struct listS { }; struct setS { }; - struct multisetS { }; struct mapS { }; -#if !defined BOOST_NO_HASH - struct hash_mapS { }; + struct multisetS { }; + struct multimapS { }; struct hash_setS { }; -#endif + struct hash_mapS { }; + struct hash_multisetS { }; + struct hash_multimapS { }; template <class Selector, class ValueType> struct container_gen { }; @@ -94,24 +102,37 @@ namespace boost { typedef std::multiset<ValueType> type; }; -#if !defined BOOST_NO_HASH template <class ValueType> - struct container_gen<hash_mapS, ValueType> { - typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set<ValueType> type; + struct container_gen<multimapS, ValueType> { + typedef std::multiset<ValueType> type; }; template <class ValueType> struct container_gen<hash_setS, ValueType> { - typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set<ValueType> type; + typedef boost::unordered_set<ValueType> type; + }; + + template <class ValueType> + struct container_gen<hash_mapS, ValueType> { + typedef boost::unordered_set<ValueType> type; + }; + + template <class ValueType> + struct container_gen<hash_multisetS, ValueType> { + typedef boost::unordered_multiset<ValueType> type; + }; + + template <class ValueType> + struct container_gen<hash_multimapS, ValueType> { + typedef boost::unordered_multiset<ValueType> type; }; -#endif #else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #if !defined BOOST_NO_SLIST struct slistS { template <class T> - struct bind_ { typedef std::slist<T> type; }; + struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::slist<T> type; }; }; #endif @@ -120,39 +141,51 @@ namespace boost { struct bind_ { typedef std::vector<T> type; }; }; - struct listS { + struct listS { template <class T> struct bind_ { typedef std::list<T> type; }; }; - struct setS { + struct setS { + template <class T> + struct bind_ { typedef std::set<T, std::less<T> > type; }; + }; + + + struct mapS { template <class T> struct bind_ { typedef std::set<T, std::less<T> > type; }; }; - struct multisetS { + struct multisetS { template <class T> struct bind_ { typedef std::multiset<T, std::less<T> > type; }; }; -#if !defined BOOST_NO_HASH - struct hash_setS { + struct multimapS { template <class T> - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set<T, std::less<T> > type; }; + struct bind_ { typedef std::multiset<T, std::less<T> > type; }; }; -#endif - struct mapS { + struct hash_setS { template <class T> - struct bind_ { typedef std::set<T, std::less<T> > type; }; + struct bind_ { typedef boost::unordered_set<T> type; }; }; -#if !defined BOOST_NO_HASH - struct hash_mapS { + struct hash_mapS { template <class T> - struct bind_ { typedef BOOST_STD_EXTENSION_NAMESPACE::hash_set<T, std::less<T> > type; }; + struct bind_ { typedef boost::unordered_set<T> type; }; + }; + + struct hash_multisetS { + template <class T> + struct bind_ { typedef boost::unordered_multiset<T> type; }; + }; + + struct hash_multimapS { + template <class T> + struct bind_ { typedef boost::unordered_multiset<T> type; }; }; -#endif template <class Selector> struct container_selector { typedef vecS type; @@ -168,9 +201,7 @@ namespace boost { BOOST_CONTAINER_SELECTOR(mapS); BOOST_CONTAINER_SELECTOR(setS); BOOST_CONTAINER_SELECTOR(multisetS); -#if !defined BOOST_NO_HASH BOOST_CONTAINER_SELECTOR(hash_mapS); -#endif #if !defined BOOST_NO_SLIST BOOST_CONTAINER_SELECTOR(slistS); #endif @@ -187,55 +218,51 @@ namespace boost { struct parallel_edge_traits { }; template <> - struct parallel_edge_traits<vecS> { + struct parallel_edge_traits<vecS> { typedef allow_parallel_edge_tag type; }; template <> - struct parallel_edge_traits<listS> { + struct parallel_edge_traits<listS> { typedef allow_parallel_edge_tag type; }; #if !defined BOOST_NO_SLIST template <> - struct parallel_edge_traits<slistS> { + struct parallel_edge_traits<slistS> { typedef allow_parallel_edge_tag type; }; #endif template <> - struct parallel_edge_traits<setS> { + struct parallel_edge_traits<setS> { typedef disallow_parallel_edge_tag type; }; template <> - struct parallel_edge_traits<multisetS> { + struct parallel_edge_traits<multisetS> { typedef allow_parallel_edge_tag type; }; -#if !defined BOOST_NO_HASH template <> struct parallel_edge_traits<hash_setS> { - typedef disallow_parallel_edge_tag type; + typedef disallow_parallel_edge_tag type; }; -#endif // mapS is obsolete, replaced with setS template <> - struct parallel_edge_traits<mapS> { + struct parallel_edge_traits<mapS> { typedef disallow_parallel_edge_tag type; }; -#if !defined BOOST_NO_HASH template <> struct parallel_edge_traits<hash_mapS> { - typedef disallow_parallel_edge_tag type; + typedef disallow_parallel_edge_tag type; }; -#endif namespace detail { - template <class Directed> struct is_random_access { + template <class Directed> struct is_random_access { enum { value = false}; - typedef false_type type; + typedef mpl::false_ type; }; template <> - struct is_random_access<vecS> { - enum { value = true }; - typedef true_type type; + struct is_random_access<vecS> { + enum { value = true }; + typedef mpl::true_ type; }; } // namespace detail @@ -251,7 +278,8 @@ namespace boost { template <class OutEdgeListS = vecS, class VertexListS = vecS, - class DirectedS = directedS> + class DirectedS = directedS, + class EdgeListS = listS> struct adjacency_list_traits { typedef typename detail::is_random_access<VertexListS>::type @@ -259,9 +287,9 @@ namespace boost { typedef typename DirectedS::is_bidir_t is_bidir; typedef typename DirectedS::is_directed_t is_directed; - typedef typename boost::ct_if_t<is_bidir, + typedef typename mpl::if_<is_bidir, bidirectional_tag, - typename boost::ct_if_t<is_directed, + typename mpl::if_<is_directed, directed_tag, undirected_tag >::type >::type directed_category; @@ -269,11 +297,26 @@ namespace boost { typedef typename parallel_edge_traits<OutEdgeListS>::type edge_parallel_category; + typedef std::size_t vertices_size_type; typedef void* vertex_ptr; - typedef typename boost::ct_if_t<is_rand_access, - std::size_t, vertex_ptr>::type vertex_descriptor; + typedef typename mpl::if_<is_rand_access, + vertices_size_type, vertex_ptr>::type vertex_descriptor; typedef detail::edge_desc_impl<directed_category, vertex_descriptor> edge_descriptor; + + private: + // Logic to figure out the edges_size_type + struct dummy {}; + typedef typename container_gen<EdgeListS, dummy>::type EdgeContainer; + typedef typename DirectedS::is_bidir_t BidirectionalT; + typedef typename DirectedS::is_directed_t DirectedT; + typedef typename mpl::and_<DirectedT, + typename mpl::not_<BidirectionalT>::type >::type on_edge_storage; + public: + typedef typename mpl::if_<on_edge_storage, + std::size_t, typename EdgeContainer::size_type + >::type edges_size_type; + }; } // namespace boost @@ -297,7 +340,7 @@ namespace boost { : public detail::adj_list_gen< adjacency_list<OutEdgeListS,VertexListS,DirectedS, VertexProperty,EdgeProperty,GraphProperty,EdgeListS>, - VertexListS, OutEdgeListS, DirectedS, + VertexListS, OutEdgeListS, DirectedS, #if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) typename detail::retag_property_list<vertex_bundle_t, VertexProperty>::type, @@ -305,8 +348,16 @@ namespace boost { #else VertexProperty, EdgeProperty, #endif - GraphProperty, EdgeListS>::type + GraphProperty, EdgeListS>::type, + // Support for named vertices + public graph::maybe_named_graph< + adjacency_list<OutEdgeListS,VertexListS,DirectedS, + VertexProperty,EdgeProperty,GraphProperty,EdgeListS>, + typename adjacency_list_traits<OutEdgeListS, VertexListS, DirectedS, + EdgeListS>::vertex_descriptor, + VertexProperty> { + public: // TODO Remove me #if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) typedef typename detail::retag_property_list<vertex_bundle_t, VertexProperty>::retagged @@ -327,10 +378,10 @@ namespace boost { edge_property_type; // The types that are actually bundled - typedef typename ct_if<(is_same<maybe_vertex_bundled, no_property>::value), + typedef typename mpl::if_c<(is_same<maybe_vertex_bundled, no_property>::value), no_vertex_bundle, maybe_vertex_bundled>::type vertex_bundled; - typedef typename ct_if<(is_same<maybe_edge_bundled, no_property>::value), + typedef typename mpl::if_c<(is_same<maybe_edge_bundled, no_property>::value), no_edge_bundle, maybe_edge_bundled>::type edge_bundled; #else @@ -343,7 +394,7 @@ namespace boost { private: typedef adjacency_list self; typedef typename detail::adj_list_gen< - self, VertexListS, OutEdgeListS, DirectedS, + self, VertexListS, OutEdgeListS, DirectedS, vertex_property_type, edge_property_type, GraphProperty, EdgeListS >::type Base; @@ -361,7 +412,7 @@ namespace boost { typedef GraphProperty graph_property_type; - inline adjacency_list(const GraphProperty& p = GraphProperty()) + inline adjacency_list(const GraphProperty& p = GraphProperty()) : m_property(p) { } inline adjacency_list(const adjacency_list& x) @@ -377,7 +428,7 @@ namespace boost { } // Required by Mutable Graph - inline adjacency_list(vertices_size_type num_vertices, + inline adjacency_list(vertices_size_type num_vertices, const GraphProperty& p = GraphProperty()) : Base(num_vertices), m_property(p) { } @@ -406,6 +457,12 @@ namespace boost { *this = tmp; } + void clear() + { + this->clearing_graph(); + Base::clear(); + } + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Directly access a vertex or edge bundle vertex_bundled& operator[](vertex_descriptor v) @@ -487,12 +544,12 @@ namespace boost { get(T Bundle::* p, adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS>& g) { - typedef typename property_map<adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, + typedef typename property_map<adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS>, T Bundle::*>::type result_type; return result_type(&g, p); } - + template<typename OutEdgeListS, typename VertexListS, typename DirectedS, typename VertexProperty, typename EdgeProperty, typename GraphProperty, typename EdgeListS, typename T, typename Bundle> inline @@ -501,7 +558,7 @@ namespace boost { get(T Bundle::* p, adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS> const & g) { - typedef typename property_map<adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, + typedef typename property_map<adjacency_list<OutEdgeListS, VertexListS, DirectedS, VertexProperty, EdgeProperty, GraphProperty, EdgeListS>, T Bundle::*>::const_type result_type; return result_type(&g, p); @@ -529,6 +586,24 @@ namespace boost { #endif +// Mutability Traits +#define ADJLIST_PARAMS \ + typename OEL, typename VL, typename D, typename VP, typename EP, \ + typename GP, typename EL +#define ADJLIST adjacency_list<OEL,VL,D,VP,EP,GP,EL> +template <ADJLIST_PARAMS> +struct graph_mutability_traits<ADJLIST> { + typedef mutable_property_graph_tag category; +}; + +// Can't remove vertices from adjacency lists with VL==vecS +template <typename OEL, typename D, typename VP, typename EP, typename GP, typename EL> +struct graph_mutability_traits< adjacency_list<OEL,vecS,D,VP,EP,GP,EL> > { + typedef add_only_property_graph_tag category; +}; +#undef ADJLIST_PARAMS +#undef ADJLIST + } // namespace boost diff --git a/Utilities/BGL/boost/graph/adjacency_list_io.hpp b/Utilities/BGL/boost/graph/adjacency_list_io.hpp index 437f732d42ecc4ce186796888cb978dc7f16abdd..91b0b465d7268eeea9ff4111d0cb890d382b29b9 100644 --- a/Utilities/BGL/boost/graph/adjacency_list_io.hpp +++ b/Utilities/BGL/boost/graph/adjacency_list_io.hpp @@ -1,35 +1,18 @@ //======================================================================= // Copyright 2001 Universite Joseph Fourier, Grenoble. -// Author: Fran�ois Faure +// Author: Francois Faure // -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. +// 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 ______adj_list_io_______ -#define ______adj_list_io_______ +#ifndef BOOST_GRAPH_ADJACENCY_LIST_IO_HPP +#define BOOST_GRAPH_ADJACENCY_LIST_IO_HPP #include <iostream> #include <vector> #include <boost/graph/adjacency_list.hpp> +#include <boost/graph/iteration_macros.hpp> #include <cctype> // Method read to parse an adjacency list from an input stream. Examples: @@ -105,19 +88,35 @@ void getSubset template<class Tag, class Value, class Next, class Stag, class Svalue> void getSubset -( property<Tag,Value,Next>& p, const property<Stag,Svalue,no_property>& s ) +( property<Tag,Value,Next>& p, const property<Stag,Svalue,no_property>& s) { get( p, s.m_value, Stag() ); } inline void getSubset -( no_property& p, const no_property& s ) +( no_property&, const no_property& ) +{ +} + +#if !defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) +template<typename T, typename U> +void getSubset(T& p, const U& s) +{ + p = s; +} + +template<typename T> +void getSubset(T&, const no_property&) { } + +#endif + // get property subset //=========================================================================== // graph parser +typedef enum{ PARSE_NUM_NODES, PARSE_VERTEX, PARSE_EDGE } GraphParserState; template<class Graph_t, class VertexProperty, class EdgeProperty, class VertexPropertySubset, class EdgePropertySubset> @@ -134,8 +133,7 @@ struct GraphParser typedef typename graph_traits<Graph>::vertex_descriptor Vertex; std::vector<Vertex> nodes; - typedef enum{ PARSE_NUM_NODES, PARSE_VERTEX, PARSE_EDGE } State; - State state = PARSE_VERTEX; + GraphParserState state = PARSE_VERTEX; unsigned int numLine = 1; char c; @@ -204,6 +202,7 @@ protected: //======================================================================= // property printer +#if defined(BOOST_GRAPH_NO_BUNDLED_PROPERTIES) template<class Graph, class Property> struct PropertyPrinter { @@ -211,27 +210,62 @@ struct PropertyPrinter typedef typename Property::tag_type Tag; typedef typename Property::next_type Next; - PropertyPrinter( Graph& g ):graph(&g){} + PropertyPrinter( const Graph& g ):graph(&g){} - template<class Iterator> - PropertyPrinter& operator () ( std::ostream& out, Iterator it ) + template<class Val> + PropertyPrinter& operator () ( std::ostream& out, const Val& v ) { typename property_map<Graph,Tag>::type ps = get(Tag(), *graph); - out << ps[ *it ] <<" "; + out << ps[ v ] <<" "; PropertyPrinter<Graph,Next> print(*graph); - print(out, it); + print(out, v); return (*this); } private: - Graph* graph; + const Graph* graph; }; +#else +template<class Graph, typename Property> +struct PropertyPrinter +{ + PropertyPrinter( const Graph& g ):graph(&g){} + + template<class Val> + PropertyPrinter& operator () ( std::ostream& out, const Val& v ) + { + out << (*graph)[ v ] <<" "; + return (*this); + } +private: + const Graph* graph; +}; + +template<class Graph, typename Tag, typename Value, typename Next> +struct PropertyPrinter<Graph, property<Tag, Value, Next> > +{ + PropertyPrinter( const Graph& g ):graph(&g){} + + template<class Val> + PropertyPrinter& operator () ( std::ostream& out, const Val& v ) + { + typename property_map<Graph,Tag>::type ps = get(Tag(), *graph); + out << ps[ v ] <<" "; + PropertyPrinter<Graph,Next> print(*graph); + print(out, v); + return (*this); + } +private: + const Graph* graph; +}; +#endif + template<class Graph> struct PropertyPrinter<Graph, no_property> { - PropertyPrinter( Graph& ){} + PropertyPrinter( const Graph& ){} - template<class Iterator> - PropertyPrinter& operator () ( std::ostream&, Iterator it ){ return *this; } + template<class Val> + PropertyPrinter& operator () ( std::ostream&, const Val& ){ return *this; } }; // property printer @@ -245,7 +279,7 @@ struct EdgePrinter typedef Graph_t Graph; typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - EdgePrinter( Graph& g ) + EdgePrinter( const Graph& g ) : graph(g) {} @@ -254,18 +288,16 @@ struct EdgePrinter // assign indices to vertices std::map<Vertex,int> indices; int num = 0; - typename graph_traits<Graph>::vertex_iterator vi; - for (vi = vertices(graph).first; vi != vertices(graph).second; ++vi){ - indices[*vi] = num++; + BGL_FORALL_VERTICES_T(v, graph, Graph) { + indices[v] = num++; } // write edges PropertyPrinter<Graph, EdgeProperty> print_Edge(graph); out << "e" << std::endl; - typename graph_traits<Graph>::edge_iterator ei; - for (ei = edges(graph).first; ei != edges(graph).second; ++ei){ - out << indices[source(*ei,graph)] << " " << indices[target(*ei,graph)] << " "; - print_Edge(out,ei); + BGL_FORALL_EDGES_T(e, graph, Graph) { + out << indices[source(e,graph)] << " " << indices[target(e,graph)] << " "; + print_Edge(out,e); out << std::endl; } out << std::endl; @@ -274,14 +306,14 @@ struct EdgePrinter protected: - Graph& graph; + const Graph& graph; }; template<class Graph, class V, class E> struct GraphPrinter: public EdgePrinter<Graph,E> { - GraphPrinter( Graph& g ) + GraphPrinter( const Graph& g ) : EdgePrinter<Graph,E>(g) {} @@ -289,9 +321,8 @@ struct GraphPrinter: public EdgePrinter<Graph,E> { PropertyPrinter<Graph, V> printNode(this->graph); out << "v"<<std::endl; - typename graph_traits<Graph>::vertex_iterator vi; - for (vi = vertices(this->graph).first; vi != vertices(this->graph).second; ++vi){ - printNode(out,vi); + BGL_FORALL_VERTICES_T(v, this->graph, Graph) { + printNode(out,v); out << std::endl; } @@ -304,7 +335,7 @@ template<class Graph, class E> struct GraphPrinter<Graph,no_property,E> : public EdgePrinter<Graph,E> { - GraphPrinter( Graph& g ) + GraphPrinter( const Graph& g ) : EdgePrinter<Graph,E>(g) {} @@ -356,7 +387,7 @@ std::ostream& operator << ( std::ostream& out, const GraphPrinter<Graph,VP,EP>& /// write the graph with given property subsets template<class EL, class VL, class D, class VP, class EP, class GP, class VPS, class EPS> GraphPrinter<adjacency_list<EL,VL,D,VP,EP,GP>,VPS,EPS> -write( adjacency_list<EL,VL,D,VP,EP,GP>& g, VPS, EPS ) +write( const adjacency_list<EL,VL,D,VP,EP,GP>& g, VPS, EPS ) { return GraphPrinter<adjacency_list<EL,VL,D,VP,EP,GP>,VPS,EPS>(g); } @@ -364,7 +395,7 @@ write( adjacency_list<EL,VL,D,VP,EP,GP>& g, VPS, EPS ) /// write the graph with all internal vertex and edge properties template<class EL, class VL, class D, class VP, class EP, class GP> GraphPrinter<adjacency_list<EL,VL,D,VP,EP,GP>,VP,EP> -write( adjacency_list<EL,VL,D,VP,EP,GP>& g ) +write( const adjacency_list<EL,VL,D,VP,EP,GP>& g ) { return GraphPrinter<adjacency_list<EL,VL,D,VP,EP,GP>,VP,EP>(g); } diff --git a/Utilities/BGL/boost/graph/adjacency_matrix.hpp b/Utilities/BGL/boost/graph/adjacency_matrix.hpp index 92f8d09e2e84f1ea7f3ea6fcf1de03cae00a8909..a3694dab7477189f6f38bb831c569380c46aad32 100644 --- a/Utilities/BGL/boost/graph/adjacency_matrix.hpp +++ b/Utilities/BGL/boost/graph/adjacency_matrix.hpp @@ -1,6 +1,7 @@ //======================================================================= // Copyright 2001 University of Notre Dame. -// Author: Jeremy G. Siek +// Copyright 2006 Trustees of Indiana University +// Authors: Jeremy G. Siek and Douglas Gregor <dgregor@cs.indiana.edu> // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -17,8 +18,9 @@ #include <boost/limits.hpp> #include <boost/iterator.hpp> #include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_mutability_traits.hpp> #include <boost/graph/graph_selectors.hpp> -#include <boost/pending/ct_if.hpp> +#include <boost/mpl/if.hpp> #include <boost/graph/adjacency_iterator.hpp> #include <boost/graph/detail/edge.hpp> #include <boost/iterator/iterator_adaptor.hpp> @@ -26,9 +28,11 @@ #include <boost/pending/integer_range.hpp> #include <boost/graph/properties.hpp> #include <boost/tuple/tuple.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/ice.hpp> namespace boost { - + namespace detail { template <class Directed, class Vertex> @@ -37,7 +41,7 @@ namespace boost { typedef edge_desc_impl<Directed,Vertex> Base; public: matrix_edge_desc_impl() { } - matrix_edge_desc_impl(bool exists, Vertex s, Vertex d, + matrix_edge_desc_impl(bool exists, Vertex s, Vertex d, const void* ep = 0) : Base(s, d, ep), m_exists(exists) { } bool exists() const { return m_exists; } @@ -50,13 +54,15 @@ namespace boost { bool operator()(const Edge& e) const { return e.exists(); } }; + // Note to self... The int for get_edge_exists and set_edge exist helps + // make these calls unambiguous. template <typename EdgeProperty> bool get_edge_exists(const std::pair<bool, EdgeProperty>& stored_edge, int) { return stored_edge.first; } template <typename EdgeProperty> void set_edge_exists( - std::pair<bool, EdgeProperty>& stored_edge, + std::pair<bool, EdgeProperty>& stored_edge, bool flag, int ) { @@ -88,7 +94,7 @@ namespace boost { template <typename StoredEdgeProperty, typename EdgeProperty> inline void - set_property(std::pair<bool, StoredEdgeProperty>& stored_edge, + set_property(std::pair<bool, StoredEdgeProperty>& stored_edge, const EdgeProperty& ep, int) { stored_edge.second = ep; } @@ -104,7 +110,7 @@ namespace boost { template <typename EdgeProxy, typename EdgeProperty> inline void set_property(EdgeProxy, const EdgeProperty&, ...) {} - + //======================================================================= // Directed Out Edge Iterator @@ -130,9 +136,9 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + dir_adj_matrix_out_edge_iter() { } - + dir_adj_matrix_out_edge_iter( const MatrixIter& i , const VertexDescriptor& src @@ -145,13 +151,70 @@ namespace boost { ++this->base_reference(); ++m_targ; } - + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, + &get_property(*this->base())); + } + VertexDescriptor m_src, m_targ; + VerticesSizeType m_n; + }; + + //======================================================================= + // Directed In Edge Iterator + + template < + typename VertexDescriptor, typename MatrixIter + , typename VerticesSizeType, typename EdgeDescriptor + > + struct dir_adj_matrix_in_edge_iter + : iterator_adaptor< + dir_adj_matrix_in_edge_iter<VertexDescriptor, MatrixIter, VerticesSizeType, EdgeDescriptor> + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > + { + typedef iterator_adaptor< + dir_adj_matrix_in_edge_iter<VertexDescriptor, MatrixIter, VerticesSizeType, EdgeDescriptor> + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > super_t; + + dir_adj_matrix_in_edge_iter() { } + + dir_adj_matrix_in_edge_iter( + const MatrixIter& i + , const MatrixIter& last + , const VertexDescriptor& tgt + , const VerticesSizeType& n + ) + : super_t(i), m_last(last), m_src(0), m_targ(tgt), m_n(n) + { } + + void increment() { + if (VerticesSizeType(m_last - this->base_reference()) >= m_n) { + this->base_reference() += m_n; + ++m_src; + } else { + this->base_reference() = m_last; + } + } + inline EdgeDescriptor - dereference() const + dereference() const { - return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, + return EdgeDescriptor(get_edge_exists(*this->base(), 0), m_src, m_targ, &get_property(*this->base())); } + MatrixIter m_last; VertexDescriptor m_src, m_targ; VerticesSizeType m_n; }; @@ -163,7 +226,7 @@ namespace boost { typename VertexDescriptor, typename MatrixIter , typename VerticesSizeType, typename EdgeDescriptor > - struct undir_adj_matrix_out_edge_iter + struct undir_adj_matrix_out_edge_iter : iterator_adaptor< undir_adj_matrix_out_edge_iter<VertexDescriptor, MatrixIter, VerticesSizeType, EdgeDescriptor> , MatrixIter @@ -181,9 +244,9 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + undir_adj_matrix_out_edge_iter() { } - + undir_adj_matrix_out_edge_iter( const MatrixIter& i , const VertexDescriptor& src @@ -209,16 +272,83 @@ namespace boost { } ++m_targ; } - + inline EdgeDescriptor - dereference() const + dereference() const { return EdgeDescriptor( get_edge_exists(*this->base(), 0), m_src, m_targ , &get_property(*this->base()) ); } - + + VertexDescriptor m_src, m_inc, m_targ; + VerticesSizeType m_n; + }; + + //======================================================================= + // Undirected In Edge Iterator + + template < + typename VertexDescriptor, typename MatrixIter + , typename VerticesSizeType, typename EdgeDescriptor + > + struct undir_adj_matrix_in_edge_iter + : iterator_adaptor< + undir_adj_matrix_in_edge_iter<VertexDescriptor, MatrixIter, VerticesSizeType, EdgeDescriptor> + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > + { + typedef iterator_adaptor< + undir_adj_matrix_in_edge_iter<VertexDescriptor, MatrixIter, VerticesSizeType, EdgeDescriptor> + , MatrixIter + , EdgeDescriptor + , use_default + , EdgeDescriptor + , std::ptrdiff_t + > super_t; + + undir_adj_matrix_in_edge_iter() { } + + undir_adj_matrix_in_edge_iter( + const MatrixIter& i + , const VertexDescriptor& src + , const VerticesSizeType& n + ) + : super_t(i), m_src(src), m_inc(src), m_targ(0), m_n(n) + {} + + void increment() + { + if (m_targ < m_src) // first half + { + ++this->base_reference(); + } + else if (m_targ < m_n - 1) + { // second half + ++m_inc; + this->base_reference() += m_inc; + } + else + { // past-the-end + this->base_reference() += m_n - m_src; + } + ++m_targ; + } + + inline EdgeDescriptor + dereference() const + { + return EdgeDescriptor( + get_edge_exists(*this->base(), 0), m_targ, m_src + , &get_property(*this->base()) + ); + } + VertexDescriptor m_src, m_inc, m_targ; VerticesSizeType m_n; }; @@ -226,7 +356,7 @@ namespace boost { //======================================================================= // Edge Iterator - template <typename Directed, typename MatrixIter, + template <typename Directed, typename MatrixIter, typename VerticesSizeType, typename EdgeDescriptor> struct adj_matrix_edge_iter : iterator_adaptor< @@ -246,17 +376,17 @@ namespace boost { , EdgeDescriptor , std::ptrdiff_t > super_t; - + adj_matrix_edge_iter() { } - - adj_matrix_edge_iter(const MatrixIter& i, const MatrixIter& start, const VerticesSizeType& n) + + adj_matrix_edge_iter(const MatrixIter& i, const MatrixIter& start, const VerticesSizeType& n) : super_t(i), m_start(start), m_src(0), m_targ(0), m_n(n) { } void increment() { increment_dispatch(this->base_reference(), Directed()); } - + void increment_dispatch(MatrixIter& i, directedS) { ++i; @@ -270,7 +400,7 @@ namespace boost { ++m_targ; } } - + void increment_dispatch(MatrixIter& i, undirectedS) { ++i; @@ -286,14 +416,14 @@ namespace boost { } inline EdgeDescriptor - dereference() const + dereference() const { return EdgeDescriptor( get_edge_exists( *this->base(), 0), m_src, m_targ, &get_property(*this->base()) ); } - + MatrixIter m_start; VerticesSizeType m_src, m_targ, m_n; }; @@ -304,18 +434,22 @@ namespace boost { // Adjacency Matrix Traits template <typename Directed = directedS> class adjacency_matrix_traits { - typedef typename Directed::is_bidir_t is_bidir; typedef typename Directed::is_directed_t is_directed; public: - typedef typename boost::ct_if_t<is_bidir, - bidirectional_tag, - typename boost::ct_if_t<is_directed, - directed_tag, undirected_tag - >::type - >::type directed_category; - + // The bidirectionalS tag is not allowed with the adjacency_matrix + // graph type. Instead, use directedS, which also provides the + // functionality required for a Bidirectional Graph (in_edges, + // in_degree, etc.). +#if !defined(_MSC_VER) || _MSC_VER > 1300 + BOOST_STATIC_ASSERT(type_traits::ice_not<(is_same<Directed, bidirectionalS>::value)>::value); +#endif + + typedef typename mpl::if_<is_directed, + bidirectional_tag, undirected_tag>::type + directed_category; + typedef disallow_parallel_edge_tag edge_parallel_category; - + typedef std::size_t vertex_descriptor; typedef detail::matrix_edge_desc_impl<directed_category, @@ -330,7 +464,7 @@ namespace boost { public virtual incidence_graph_tag, public virtual adjacency_graph_tag, public virtual edge_list_graph_tag { }; - + //========================================================================= // Adjacency Matrix Class template <typename Directed = directedS, @@ -341,27 +475,35 @@ namespace boost { class adjacency_matrix { typedef adjacency_matrix self; typedef adjacency_matrix_traits<Directed> Traits; - + public: +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 + // The bidirectionalS tag is not allowed with the adjacency_matrix + // graph type. Instead, use directedS, which also provides the + // functionality required for a Bidirectional Graph (in_edges, + // in_degree, etc.). + BOOST_STATIC_ASSERT(!(is_same<Directed, bidirectionalS>::value)); +#endif + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES typedef typename detail::retag_property_list<vertex_bundle_t, VertexProperty>::type vertex_property_type; typedef typename detail::retag_property_list<edge_bundle_t, EdgeProperty>::type edge_property_type; - + private: typedef typename detail::retag_property_list<vertex_bundle_t, VertexProperty>::retagged maybe_vertex_bundled; typedef typename detail::retag_property_list<edge_bundle_t, EdgeProperty>::retagged maybe_edge_bundled; - + public: // The types that are actually bundled - typedef typename ct_if<(is_same<maybe_vertex_bundled, no_property>::value), + typedef typename mpl::if_c<(is_same<maybe_vertex_bundled, no_property>::value), no_vertex_bundle, maybe_vertex_bundled>::type vertex_bundled; - typedef typename ct_if<(is_same<maybe_edge_bundled, no_property>::value), + typedef typename mpl::if_c<(is_same<maybe_edge_bundled, no_property>::value), no_edge_bundle, maybe_edge_bundled>::type edge_bundled; #else @@ -370,9 +512,10 @@ namespace boost { typedef no_vertex_bundle vertex_bundled; typedef no_edge_bundle edge_bundled; #endif + typedef GraphProperty graph_property_type; public: // should be private - typedef typename ct_if_t<typename has_property<edge_property_type>::type, + typedef typename mpl::if_<typename has_property<edge_property_type>::type, std::pair<bool, edge_property_type>, char>::type StoredEdge; #if (defined(BOOST_MSVC) && BOOST_MSVC <= 1300) || defined(BOOST_NO_STD_ALLOCATOR) typedef std::vector<StoredEdge> Matrix; @@ -395,7 +538,7 @@ namespace boost { { return (std::numeric_limits<vertex_descriptor>::max)(); } - + //private: if friends worked, these would be private typedef detail::dir_adj_matrix_out_edge_iter< @@ -406,14 +549,26 @@ namespace boost { vertex_descriptor, MatrixIter, size_type, edge_descriptor > UnDirOutEdgeIter; - typedef typename ct_if_t< + typedef typename mpl::if_< typename Directed::is_directed_t, DirOutEdgeIter, UnDirOutEdgeIter >::type unfiltered_out_edge_iter; - + + typedef detail::dir_adj_matrix_in_edge_iter< + vertex_descriptor, MatrixIter, size_type, edge_descriptor + > DirInEdgeIter; + + typedef detail::undir_adj_matrix_in_edge_iter< + vertex_descriptor, MatrixIter, size_type, edge_descriptor + > UnDirInEdgeIter; + + typedef typename mpl::if_< + typename Directed::is_directed_t, DirInEdgeIter, UnDirInEdgeIter + >::type unfiltered_in_edge_iter; + typedef detail::adj_matrix_edge_iter< Directed, MatrixIter, size_type, edge_descriptor > unfiltered_edge_iter; - + public: // IncidenceGraph concept required types @@ -423,7 +578,8 @@ namespace boost { typedef size_type degree_size_type; // BidirectionalGraph required types - typedef void in_edge_iterator; + typedef filter_iterator<detail::does_edge_exist, unfiltered_in_edge_iter> + in_edge_iterator; // AdjacencyGraph required types typedef typename adjacency_iterator_generator<self, @@ -434,7 +590,7 @@ namespace boost { typedef integer_range<vertex_descriptor> VertexList; typedef typename VertexList::iterator vertex_iterator; - // EdgeListGrpah required types + // EdgeListGraph required types typedef size_type edges_size_type; typedef filter_iterator< detail::does_edge_exist, unfiltered_edge_iter @@ -444,13 +600,52 @@ namespace boost { typedef adjacency_matrix_class_tag graph_tag; // Constructor required by MutableGraph - adjacency_matrix(vertices_size_type n_vertices) - : m_matrix(Directed::is_directed ? + adjacency_matrix(vertices_size_type n_vertices, + const GraphProperty& p = GraphProperty()) + : m_matrix(Directed::is_directed ? (n_vertices * n_vertices) : (n_vertices * (n_vertices + 1) / 2)), m_vertex_set(0, n_vertices), m_vertex_properties(n_vertices), - m_num_edges(0) { } + m_num_edges(0), + m_property(p) { } + + template <typename EdgeIterator> + adjacency_matrix(EdgeIterator first, + EdgeIterator last, + vertices_size_type n_vertices, + const GraphProperty& p = GraphProperty()) + : m_matrix(Directed::is_directed ? + (n_vertices * n_vertices) + : (n_vertices * (n_vertices + 1) / 2)), + m_vertex_set(0, n_vertices), + m_vertex_properties(n_vertices), + m_num_edges(0), + m_property(p) + { + for (; first != last; ++first) { + add_edge(first->first, first->second, *this); + } + } + + template <typename EdgeIterator, typename EdgePropertyIterator> + adjacency_matrix(EdgeIterator first, + EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n_vertices, + const GraphProperty& p = GraphProperty()) + : m_matrix(Directed::is_directed ? + (n_vertices * n_vertices) + : (n_vertices * (n_vertices + 1) / 2)), + m_vertex_set(0, n_vertices), + m_vertex_properties(n_vertices), + m_num_edges(0), + m_property(p) + { + for (; first != last; ++first, ++ep_iter) { + add_edge(first->first, first->second, *ep_iter, *this); + } + } #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES // Directly access a vertex or edge bundle @@ -466,7 +661,7 @@ namespace boost { const edge_bundled& operator[](edge_descriptor e) const { return get(edge_bundle, *this)[e]; } #endif - + //private: if friends worked, these would be private typename Matrix::const_reference @@ -494,10 +689,11 @@ namespace boost { VertexList m_vertex_set; std::vector<vertex_property_type> m_vertex_properties; size_type m_num_edges; + GraphProperty m_property; }; - + //========================================================================= - // Functions required by the AdjacencyMatrix concept + // Functions required by the AdjacencyMatrix concept template <typename D, typename VP, typename EP, typename GP, typename A> std::pair<typename adjacency_matrix<D,VP,EP,GP,A>::edge_descriptor, @@ -513,7 +709,7 @@ namespace boost { } //========================================================================= - // Functions required by the IncidenceGraph concept + // Functions required by the IncidenceGraph concept // O(1) template <typename VP, typename EP, typename GP, typename A> @@ -533,7 +729,7 @@ namespace boost { , last(l, u, g.m_vertex_set.size()); detail::does_edge_exist pred; typedef typename Graph::out_edge_iterator out_edge_iterator; - return std::make_pair(out_edge_iterator(pred, first, last), + return std::make_pair(out_edge_iterator(pred, first, last), out_edge_iterator(pred, last, last)); } @@ -555,15 +751,15 @@ namespace boost { typename Graph::unfiltered_out_edge_iter first(f, u, g.m_vertex_set.size()) , last(l, u, g.m_vertex_set.size()); - + detail::does_edge_exist pred; typedef typename Graph::out_edge_iterator out_edge_iterator; - return std::make_pair(out_edge_iterator(pred, first, last), + return std::make_pair(out_edge_iterator(pred, first, last), out_edge_iterator(pred, last, last)); } - + // O(N) - template <typename D, typename VP, typename EP, typename GP, typename A> + template <typename D, typename VP, typename EP, typename GP, typename A> typename adjacency_matrix<D,VP,EP,GP,A>::degree_size_type out_degree(typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor u, const adjacency_matrix<D,VP,EP,GP,A>& g) @@ -577,7 +773,7 @@ namespace boost { // O(1) template <typename D, typename VP, typename EP, typename GP, typename A, - typename Dir, typename Vertex> + typename Dir, typename Vertex> typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor source(const detail::matrix_edge_desc_impl<Dir,Vertex>& e, const adjacency_matrix<D,VP,EP,GP,A>&) @@ -587,7 +783,7 @@ namespace boost { // O(1) template <typename D, typename VP, typename EP, typename GP, typename A, - typename Dir, typename Vertex> + typename Dir, typename Vertex> typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor target(const detail::matrix_edge_desc_impl<Dir,Vertex>& e, const adjacency_matrix<D,VP,EP,GP,A>&) @@ -596,7 +792,69 @@ namespace boost { } //========================================================================= - // Functions required by the AdjacencyGraph concept + // Functions required by the BidirectionalGraph concept + + // O(1) + template <typename VP, typename EP, typename GP, typename A> + std::pair<typename adjacency_matrix<directedS,VP,EP,GP,A>::in_edge_iterator, + typename adjacency_matrix<directedS,VP,EP,GP,A>::in_edge_iterator> + in_edges + (typename adjacency_matrix<directedS,VP,EP,GP,A>::vertex_descriptor u, + const adjacency_matrix<directedS,VP,EP,GP,A>& g_) + { + typedef adjacency_matrix<directedS,VP,EP,GP,A> Graph; + Graph& g = const_cast<Graph&>(g_); + typename Graph::MatrixIter f = g.m_matrix.begin() + u; + typename Graph::MatrixIter l = g.m_matrix.end(); + typename Graph::unfiltered_in_edge_iter + first(f, l, u, g.m_vertex_set.size()) + , last(l, l, u, g.m_vertex_set.size()); + detail::does_edge_exist pred; + typedef typename Graph::in_edge_iterator in_edge_iterator; + return std::make_pair(in_edge_iterator(pred, first, last), + in_edge_iterator(pred, last, last)); + } + + // O(1) + template <typename VP, typename EP, typename GP, typename A> + std::pair< + typename adjacency_matrix<undirectedS,VP,EP,GP,A>::in_edge_iterator, + typename adjacency_matrix<undirectedS,VP,EP,GP,A>::in_edge_iterator> + in_edges + (typename adjacency_matrix<undirectedS,VP,EP,GP,A>::vertex_descriptor u, + const adjacency_matrix<undirectedS,VP,EP,GP,A>& g_) + { + typedef adjacency_matrix<undirectedS,VP,EP,GP,A> Graph; + Graph& g = const_cast<Graph&>(g_); + typename Graph::vertices_size_type offset = u * (u + 1) / 2; + typename Graph::MatrixIter f = g.m_matrix.begin() + offset; + typename Graph::MatrixIter l = g.m_matrix.end(); + + typename Graph::unfiltered_in_edge_iter + first(f, u, g.m_vertex_set.size()) + , last(l, u, g.m_vertex_set.size()); + + detail::does_edge_exist pred; + typedef typename Graph::in_edge_iterator in_edge_iterator; + return std::make_pair(in_edge_iterator(pred, first, last), + in_edge_iterator(pred, last, last)); + } + + // O(N) + template <typename D, typename VP, typename EP, typename GP, typename A> + typename adjacency_matrix<D,VP,EP,GP,A>::degree_size_type + in_degree(typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor u, + const adjacency_matrix<D,VP,EP,GP,A>& g) + { + typename adjacency_matrix<D,VP,EP,GP,A>::degree_size_type n = 0; + typename adjacency_matrix<D,VP,EP,GP,A>::in_edge_iterator f, l; + for (tie(f, l) = in_edges(u, g); f != l; ++f) + ++n; + return n; + } + + //========================================================================= + // Functions required by the AdjacencyGraph concept template <typename D, typename VP, typename EP, typename GP, typename A> std::pair<typename adjacency_matrix<D,VP,EP,GP,A>::adjacency_iterator, @@ -616,7 +874,7 @@ namespace boost { } //========================================================================= - // Functions required by the VertexListGraph concept + // Functions required by the VertexListGraph concept template <typename D, typename VP, typename EP, typename GP, typename A> std::pair<typename adjacency_matrix<D,VP,EP,GP,A>::vertex_iterator, @@ -632,10 +890,10 @@ namespace boost { num_vertices(const adjacency_matrix<D,VP,EP,GP,A>& g) { return g.m_vertex_set.size(); } - + //========================================================================= - // Functions required by the EdgeListGraph concept - + // Functions required by the EdgeListGraph concept + template <typename D, typename VP, typename EP, typename GP, typename A> std::pair<typename adjacency_matrix<D,VP,EP,GP,A>::edge_iterator, typename adjacency_matrix<D,VP,EP,GP,A>::edge_iterator> @@ -643,11 +901,11 @@ namespace boost { { typedef adjacency_matrix<D,VP,EP,GP,A> Graph; Graph& g = const_cast<Graph&>(g_); - + typename Graph::unfiltered_edge_iter - first(g.m_matrix.begin(), g.m_matrix.begin(), + first(g.m_matrix.begin(), g.m_matrix.begin(), g.m_vertex_set.size()), - last(g.m_matrix.end(), g.m_matrix.begin(), + last(g.m_matrix.end(), g.m_matrix.begin(), g.m_vertex_set.size()); detail::does_edge_exist pred; typedef typename Graph::edge_iterator edge_iterator; @@ -662,26 +920,27 @@ namespace boost { { return g.m_num_edges; } - + //========================================================================= - // Functions required by the MutableGraph concept + // Functions required by the MutableGraph concept // O(1) - template <typename D, typename VP, typename EP, typename GP, typename A> + template <typename D, typename VP, typename EP, typename GP, typename A, + typename EP2> std::pair<typename adjacency_matrix<D,VP,EP,GP,A>::edge_descriptor, bool> add_edge(typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor u, typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor v, - const EP& ep, + const EP2& ep, adjacency_matrix<D,VP,EP,GP,A>& g) { - typedef typename adjacency_matrix<D,VP,EP,GP,A>::edge_descriptor + typedef typename adjacency_matrix<D,VP,EP,GP,A>::edge_descriptor edge_descriptor; if (detail::get_edge_exists(g.get_edge(u,v), 0) == false) { ++(g.m_num_edges); - detail::set_property(g.get_edge(u,v), ep, 0); + detail::set_property(g.get_edge(u,v), EP(ep), 0); detail::set_edge_exists(g.get_edge(u,v), true, 0); return std::make_pair - (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), + (edge_descriptor(true, u, v, &detail::get_property(g.get_edge(u,v))), true); } else return std::make_pair @@ -699,15 +958,18 @@ namespace boost { return add_edge(u, v, ep, g); } - // O(1) + // O(1) template <typename D, typename VP, typename EP, typename GP, typename A> void remove_edge(typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor u, typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor v, adjacency_matrix<D,VP,EP,GP,A>& g) { - --(g.m_num_edges); - detail::set_edge_exists(g.get_edge(u,v), false, 0); + // Don'remove the edge unless it already exists. + if(detail::get_edge_exists(g.get_edge(u,v), 0)) { + --(g.m_num_edges); + detail::set_edge_exists(g.get_edge(u,v), false, 0); + } } // O(1) @@ -719,7 +981,7 @@ namespace boost { remove_edge(source(e, g), target(e, g), g); } - + template <typename D, typename VP, typename EP, typename GP, typename A> inline typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor add_vertex(adjacency_matrix<D,VP,EP,GP,A>& g) { @@ -728,9 +990,10 @@ namespace boost { return *vertices(g).first; } - template <typename D, typename VP, typename EP, typename GP, typename A> + template <typename D, typename VP, typename EP, typename GP, typename A, + typename VP2> inline typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor - add_vertex(const VP& vp, adjacency_matrix<D,VP,EP,GP,A>& g) { + add_vertex(const VP2& /*vp*/, adjacency_matrix<D,VP,EP,GP,A>& g) { // UNDER CONSTRUCTION assert(false); return *vertices(g).first; @@ -738,8 +1001,8 @@ namespace boost { template <typename D, typename VP, typename EP, typename GP, typename A> inline void - remove_vertex(typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor u, - adjacency_matrix<D,VP,EP,GP,A>& g) + remove_vertex(typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor /*u*/, + adjacency_matrix<D,VP,EP,GP,A>& /*g*/) { // UNDER CONSTRUCTION assert(false); @@ -752,7 +1015,7 @@ namespace boost { (typename adjacency_matrix<directedS,VP,EP,GP,A>::vertex_descriptor u, adjacency_matrix<directedS,VP,EP,GP,A>& g) { - typename adjacency_matrix<directedS,VP,EP,GP,A>::vertex_iterator + typename adjacency_matrix<directedS,VP,EP,GP,A>::vertex_iterator vi, vi_end; for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) remove_edge(u, *vi, g); @@ -773,12 +1036,43 @@ namespace boost { remove_edge(u, *vi, g); } + //========================================================================= + // Functions required by the PropertyGraph concept + + // O(1) + template <typename D, typename VP, typename EP, typename GP, typename A, + typename Tag, typename Value> + inline void + set_property(adjacency_matrix<D,VP,EP,GP,A>& g, Tag, const Value& value) + { + get_property_value(g.m_property, Tag()) = value; + } + + template <typename D, typename VP, typename EP, typename GP, typename A, + typename Tag> + inline + typename graph_property<adjacency_matrix<D,VP,EP,GP,A>, Tag>::type& + get_property(adjacency_matrix<D,VP,EP,GP,A>& g, Tag) + { + return get_property_value(g.m_property, Tag()); + } + + template <typename D, typename VP, typename EP, typename GP, typename A, + typename Tag> + inline + const + typename graph_property<adjacency_matrix<D,VP,EP,GP,A>, Tag>::type& + get_property(const adjacency_matrix<D,VP,EP,GP,A>& g, Tag) + { + return get_property_value(g.m_property, Tag()); + } + //========================================================================= // Vertex Property Map - - template <typename GraphPtr, typename Vertex, typename T, typename R, - typename Tag> - class adj_matrix_vertex_property_map + + template <typename GraphPtr, typename Vertex, typename T, typename R, + typename Tag> + class adj_matrix_vertex_property_map : public put_get_helper<R, adj_matrix_vertex_property_map<GraphPtr, Vertex, T, R, Tag> > { @@ -817,10 +1111,10 @@ namespace boost { struct bind_ { typedef typename property_value<Property,Tag>::type Value; typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex; - + typedef adj_matrix_vertex_property_map<Graph*, Vertex, Value, Value&, Tag> type; - typedef adj_matrix_vertex_property_map<const Graph*, Vertex, Value, + typedef adj_matrix_vertex_property_map<const Graph*, Vertex, Value, const Value&, Tag> const_type; }; }; @@ -865,14 +1159,14 @@ namespace boost { struct vertex_property_selector<adjacency_matrix_class_tag> { typedef detail::adj_matrix_vertex_property_selector type; }; - + //========================================================================= // Edge Property Map - template <typename Directed, typename Property, typename Vertex, - typename T, typename R, typename Tag> - class adj_matrix_edge_property_map + template <typename Directed, typename Property, typename Vertex, + typename T, typename R, typename Tag> + class adj_matrix_edge_property_map : public put_get_helper<R, adj_matrix_edge_property_map<Directed, Property, Vertex, T, R, Tag> > { @@ -907,56 +1201,56 @@ namespace boost { namespace detail { - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A> - typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::type get_dispatch(adjacency_matrix<D,VP,EP,GP,A>& g, Property, vertex_property_tag) { typedef adjacency_matrix<D,VP,EP,GP,A> Graph; - typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::type PA; return PA(&g); } - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A> - typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::type get_dispatch(adjacency_matrix<D,VP,EP,GP,A>&, Property, edge_property_tag) { - typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::type PA; return PA(); } - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A> - typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::const_type get_dispatch(const adjacency_matrix<D,VP,EP,GP,A>& g, Property, vertex_property_tag) { typedef adjacency_matrix<D,VP,EP,GP,A> Graph; - typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::const_type PA; return PA(&g); } - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A> - typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::const_type get_dispatch(const adjacency_matrix<D,VP,EP,GP,A>&, Property, edge_property_tag) { - typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, + typedef typename boost::property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::const_type PA; return PA(); } } // namespace detail - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A> inline typename property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::type @@ -966,7 +1260,7 @@ namespace boost { return detail::get_dispatch(g, p, Kind()); } - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A> inline typename property_map<adjacency_matrix<D,VP,EP,GP,A>, Property>::const_type @@ -976,7 +1270,7 @@ namespace boost { return detail::get_dispatch(g, p, Kind()); } - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A, typename Key> inline typename property_traits< @@ -988,7 +1282,7 @@ namespace boost { return get(get(p, g), key); } - template <typename Property, typename D, typename VP, typename EP, + template <typename Property, typename D, typename VP, typename EP, typename GP, typename A, typename Key, typename Value> inline void put(Property p, adjacency_matrix<D,VP,EP,GP,A>& g, @@ -999,14 +1293,14 @@ namespace boost { Map pmap = get(p, g); put(pmap, key, value); } - + //========================================================================= // Other Functions - template <typename D, typename VP, typename EP, typename GP, typename A> + template <typename D, typename VP, typename EP, typename GP, typename A> typename adjacency_matrix<D,VP,EP,GP,A>::vertex_descriptor vertex(typename adjacency_matrix<D,VP,EP,GP,A>::vertices_size_type n, - const adjacency_matrix<D,VP,EP,GP,A>& g) + const adjacency_matrix<D,VP,EP,GP,A>&) { return n; } @@ -1038,7 +1332,7 @@ namespace boost { result_type; return result_type(&g, p); } - + template <typename Directed, typename VertexProperty, typename EdgeProperty, typename GraphProperty, typename Allocator, typename T, typename Bundle, typename Key> inline T @@ -1059,6 +1353,17 @@ namespace boost { #endif +#define ADJMAT_PARAMS \ + typename D, typename VP, typename EP, typename GP, typename A +#define ADJMAT adjacency_matrix<D,VP,EP,GP,A> +template <ADJMAT_PARAMS> +struct graph_mutability_traits<ADJMAT> { + typedef mutable_edge_property_graph_tag category; +}; +#undef ADJMAT_PARAMS +#undef ADJMAT + + } // namespace boost #endif // BOOST_ADJACENCY_MATRIX_HPP diff --git a/Utilities/BGL/boost/graph/astar_search.hpp b/Utilities/BGL/boost/graph/astar_search.hpp index 8dbdd3a03d8a5831654551156f084d7923b07fa7..4f9563292ebab173500f51fcd69fff7c15a00511 100644 --- a/Utilities/BGL/boost/graph/astar_search.hpp +++ b/Utilities/BGL/boost/graph/astar_search.hpp @@ -15,18 +15,20 @@ #include <functional> +#include <vector> #include <boost/limits.hpp> #include <boost/graph/named_function_params.hpp> -#include <boost/pending/mutable_queue.hpp> #include <boost/graph/relax.hpp> -#include <boost/pending/indirect_cmp.hpp> #include <boost/graph/exception.hpp> #include <boost/graph/breadth_first_search.hpp> +#include <boost/graph/detail/d_ary_heap.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/property_map/vector_property_map.hpp> namespace boost { - + template <class Heuristic, class Graph> struct AStarHeuristicConcept { void constraints() @@ -37,8 +39,8 @@ namespace boost { Heuristic h; typename graph_traits<Graph>::vertex_descriptor u; }; - - + + template <class Graph, class CostType> class astar_heuristic : public std::unary_function< typename graph_traits<Graph>::vertex_descriptor, CostType> @@ -48,9 +50,9 @@ namespace boost { astar_heuristic() {} CostType operator()(Vertex u) { return static_cast<CostType>(0); } }; - - + + template <class Visitor, class Graph> struct AStarVisitorConcept { void constraints() @@ -70,22 +72,22 @@ namespace boost { typename graph_traits<Graph>::vertex_descriptor u; typename graph_traits<Graph>::edge_descriptor e; }; - - + + template <class Visitors = null_visitor> class astar_visitor : public bfs_visitor<Visitors> { public: astar_visitor() {} astar_visitor(Visitors vis) : bfs_visitor<Visitors>(vis) {} - + template <class Edge, class Graph> void edge_relaxed(Edge e, Graph& g) { invoke_visitors(this->m_vis, e, g, on_edge_relaxed()); } template <class Edge, class Graph> void edge_not_relaxed(Edge e, Graph& g) { - invoke_visitors(this->m_vis, e, g, on_edge_not_relaxed()); + invoke_visitors(this->m_vis, e, g, on_edge_not_relaxed()); } private: template <class Edge, class Graph> @@ -99,10 +101,10 @@ namespace boost { return astar_visitor<Visitors>(vis); } typedef astar_visitor<> default_astar_visitor; - + namespace detail { - + template <class AStarHeuristic, class UniformCostVisitor, class UpdatableQueue, class PredecessorMap, class CostMap, class DistanceMap, class WeightMap, @@ -110,12 +112,12 @@ namespace boost { class BinaryPredicate> struct astar_bfs_visitor { - + typedef typename property_traits<CostMap>::value_type C; typedef typename property_traits<ColorMap>::value_type ColorValue; typedef color_traits<ColorValue> Color; - - + typedef typename property_traits<DistanceMap>::value_type distance_type; + astar_bfs_visitor(AStarHeuristic h, UniformCostVisitor vis, UpdatableQueue& Q, PredecessorMap p, CostMap c, DistanceMap d, WeightMap w, @@ -124,8 +126,8 @@ namespace boost { : m_h(h), m_vis(vis), m_Q(Q), m_predecessor(p), m_cost(c), m_distance(d), m_weight(w), m_color(col), m_combine(combine), m_compare(compare), m_zero(zero) {} - - + + template <class Vertex, class Graph> void initialize_vertex(Vertex u, Graph& g) { m_vis.initialize_vertex(u, g); @@ -143,20 +145,21 @@ namespace boost { m_vis.finish_vertex(u, g); } template <class Edge, class Graph> - void examine_edge(Edge e, Graph& g) { + void examine_edge(Edge e, Graph& g) { if (m_compare(get(m_weight, e), m_zero)) throw negative_edge(); m_vis.examine_edge(e, g); } template <class Edge, class Graph> void non_tree_edge(Edge, Graph&) {} - - - + + + template <class Edge, class Graph> void tree_edge(Edge e, Graph& g) { m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, m_combine, m_compare); + if(m_decreased) { m_vis.edge_relaxed(e, g); put(m_cost, target(e, g), @@ -165,12 +168,13 @@ namespace boost { } else m_vis.edge_not_relaxed(e, g); } - - + + template <class Edge, class Graph> void gray_target(Edge e, Graph& g) { m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, m_combine, m_compare); + if(m_decreased) { put(m_cost, target(e, g), m_combine(get(m_distance, target(e, g)), @@ -180,12 +184,13 @@ namespace boost { } else m_vis.edge_not_relaxed(e, g); } - - + + template <class Edge, class Graph> void black_target(Edge e, Graph& g) { m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, m_combine, m_compare); + if(m_decreased) { m_vis.edge_relaxed(e, g); put(m_cost, target(e, g), @@ -197,9 +202,9 @@ namespace boost { } else m_vis.edge_not_relaxed(e, g); } - - - + + + AStarHeuristic m_h; UniformCostVisitor m_vis; UpdatableQueue& m_Q; @@ -212,13 +217,13 @@ namespace boost { BinaryPredicate m_compare; bool m_decreased; C m_zero; - + }; - + } // namespace detail - - + + template <typename VertexListGraph, typename AStarHeuristic, typename AStarVisitor, typename PredecessorMap, typename CostMap, typename DistanceMap, @@ -233,30 +238,28 @@ namespace boost { AStarHeuristic h, AStarVisitor vis, PredecessorMap predecessor, CostMap cost, DistanceMap distance, WeightMap weight, - ColorMap color, VertexIndexMap index_map, + ColorMap color, VertexIndexMap /*index_map*/, CompareFunction compare, CombineFunction combine, - CostInf inf, CostZero zero) + CostInf /*inf*/, CostZero zero) { - typedef indirect_cmp<CostMap, CompareFunction> IndirectCmp; - IndirectCmp icmp(cost, compare); - typedef typename graph_traits<VertexListGraph>::vertex_descriptor Vertex; - typedef mutable_queue<Vertex, std::vector<Vertex>, - IndirectCmp, VertexIndexMap> + typedef boost::vector_property_map<std::size_t> IndexInHeapMap; + IndexInHeapMap index_in_heap; + typedef d_ary_heap_indirect<Vertex, 4, IndexInHeapMap, CostMap, CompareFunction> MutableQueue; - MutableQueue Q(num_vertices(g), icmp, index_map); - + MutableQueue Q(cost, index_in_heap, compare); + detail::astar_bfs_visitor<AStarHeuristic, AStarVisitor, MutableQueue, PredecessorMap, CostMap, DistanceMap, WeightMap, ColorMap, CombineFunction, CompareFunction> bfs_vis(h, vis, Q, predecessor, cost, distance, weight, color, combine, compare, zero); - + breadth_first_visit(g, s, Q, bfs_vis, color); } - - + + // Non-named parameter interface template <typename VertexListGraph, typename AStarHeuristic, typename AStarVisitor, typename PredecessorMap, @@ -276,7 +279,7 @@ namespace boost { CompareFunction compare, CombineFunction combine, CostInf inf, CostZero zero) { - + typedef typename property_traits<ColorMap>::value_type ColorValue; typedef color_traits<ColorValue> Color; typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end; @@ -285,18 +288,19 @@ namespace boost { put(distance, *ui, inf); put(cost, *ui, inf); put(predecessor, *ui, *ui); + vis.initialize_vertex(*ui, g); } put(distance, s, zero); put(cost, s, h(s)); - + astar_search_no_init (g, s, h, vis, predecessor, cost, distance, weight, color, index_map, compare, combine, inf, zero); - + } - - - + + + namespace detail { template <class VertexListGraph, class AStarHeuristic, class CostMap, class DistanceMap, class WeightMap, @@ -326,7 +330,7 @@ namespace boost { choose_param(get_param(params, distance_zero_t()), C())); } - + template <class VertexListGraph, class AStarHeuristic, class CostMap, class DistanceMap, class WeightMap, class IndexMap, class ColorMap, class Params> @@ -339,30 +343,21 @@ namespace boost { const Params& params) { typedef typename property_traits<WeightMap>::value_type D; - typename std::vector<D>::size_type - n = is_default_param(distance) ? num_vertices(g) : 1; - std::vector<D> distance_map(n); - n = is_default_param(cost) ? num_vertices(g) : 1; - std::vector<D> cost_map(n); - std::vector<default_color_type> color_map(num_vertices(g)); - default_color_type c = white_color; - + std::vector<D> distance_map; + std::vector<D> cost_map; + std::vector<default_color_type> color_map; + detail::astar_dispatch2 (g, s, h, - choose_param(cost, make_iterator_property_map - (cost_map.begin(), index_map, - cost_map[0])), - choose_param(distance, make_iterator_property_map - (distance_map.begin(), index_map, - distance_map[0])), + choose_param(cost, vector_property_map<D, IndexMap>(index_map)), + choose_param(distance, vector_property_map<D, IndexMap>(index_map)), weight, index_map, - choose_param(color, make_iterator_property_map - (color_map.begin(), index_map, c)), + choose_param(color, vector_property_map<default_color_type, IndexMap>(index_map)), params); } } // namespace detail - - + + // Named parameter interface template <typename VertexListGraph, typename AStarHeuristic, @@ -373,7 +368,7 @@ namespace boost { typename graph_traits<VertexListGraph>::vertex_descriptor s, AStarHeuristic h, const bgl_named_params<P, T, R>& params) { - + detail::astar_dispatch1 (g, s, h, get_param(params, vertex_rank), @@ -382,9 +377,9 @@ namespace boost { choose_const_pmap(get_param(params, vertex_index), g, vertex_index), get_param(params, vertex_color), params); - + } - + } // namespace boost #endif // BOOST_GRAPH_ASTAR_SEARCH_HPP diff --git a/Utilities/BGL/boost/graph/bc_clustering.hpp b/Utilities/BGL/boost/graph/bc_clustering.hpp index c412ff5f579eb7a3d6137245b81e09fa86462062..6f4bbf40b81af6d3bbc87601690bd8c547adb6e7 100644 --- a/Utilities/BGL/boost/graph/bc_clustering.hpp +++ b/Utilities/BGL/boost/graph/bc_clustering.hpp @@ -1,7 +1,7 @@ // Copyright 2004 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -11,10 +11,11 @@ #include <boost/graph/betweenness_centrality.hpp> #include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_utility.hpp> #include <boost/pending/indirect_cmp.hpp> #include <algorithm> #include <vector> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> namespace boost { @@ -116,7 +117,7 @@ betweenness_centrality_clustering(MutableGraph& g, Done done, typedef typename graph_traits<MutableGraph>::vertices_size_type vertices_size_type; - if (edges(g).first == edges(g).second) return; + if (has_no_edges(g)) return; // Function object that compares the centrality of edges indirect_cmp<EdgeCentralityMap, std::less<centrality_type> > @@ -127,10 +128,11 @@ betweenness_centrality_clustering(MutableGraph& g, Done done, brandes_betweenness_centrality(g, edge_centrality_map(edge_centrality) .vertex_index_map(vertex_index)); - edge_descriptor e = *max_element(edges(g).first, edges(g).second, cmp); + std::pair<edge_iterator, edge_iterator> edges_iters = edges(g); + edge_descriptor e = *max_element(edges_iters.first, edges_iters.second, cmp); is_done = done(get(edge_centrality, e), e, g); if (!is_done) remove_edge(e, g); - } while (!is_done && edges(g).first != edges(g).second); + } while (!is_done && !has_no_edges(g)); } /** diff --git a/Utilities/BGL/boost/graph/betweenness_centrality.hpp b/Utilities/BGL/boost/graph/betweenness_centrality.hpp index 538026347a4555a036368fd1f19679e47bd25f43..06b7be062227ac72d51ea04d06dab22fad4ec14d 100644 --- a/Utilities/BGL/boost/graph/betweenness_centrality.hpp +++ b/Utilities/BGL/boost/graph/betweenness_centrality.hpp @@ -1,7 +1,7 @@ // Copyright 2004 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -11,6 +11,7 @@ #include <stack> #include <vector> +#include <boost/graph/overloading.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/breadth_first_search.hpp> #include <boost/graph/relax.hpp> @@ -19,7 +20,7 @@ #include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/mpl/if.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/named_function_params.hpp> #include <algorithm> @@ -369,7 +370,8 @@ brandes_betweenness_centrality(const Graph& g, DistanceMap distance, // d DependencyMap dependency, // delta PathCountMap path_count, // sigma - VertexIndexMap vertex_index) + VertexIndexMap vertex_index + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_unweighted_shortest_paths shortest_paths; @@ -394,7 +396,8 @@ brandes_betweenness_centrality(const Graph& g, DependencyMap dependency, // delta PathCountMap path_count, // sigma VertexIndexMap vertex_index, - WeightMap weight_map) + WeightMap weight_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_dijkstra_shortest_paths<WeightMap> shortest_paths(weight_map); @@ -509,12 +512,23 @@ namespace detail { namespace graph { } }; + template <typename T> + struct is_bgl_named_params { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + + template <typename Param, typename Tag, typename Rest> + struct is_bgl_named_params<bgl_named_params<Param, Tag, Rest> > { + BOOST_STATIC_CONSTANT(bool, value = true); + }; + } } // end namespace detail::graph template<typename Graph, typename Param, typename Tag, typename Rest> void brandes_betweenness_centrality(const Graph& g, - const bgl_named_params<Param,Tag,Rest>& params) + const bgl_named_params<Param,Tag,Rest>& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { typedef bgl_named_params<Param,Tag,Rest> named_params; @@ -529,9 +543,13 @@ brandes_betweenness_centrality(const Graph& g, get_param(params, edge_weight)); } +// disable_if is required to work around problem with MSVC 7.1 (it seems to not +// get partial ordering getween this overload and the previous one correct) template<typename Graph, typename CentralityMap> -void -brandes_betweenness_centrality(const Graph& g, CentralityMap centrality) +typename disable_if<detail::graph::is_bgl_named_params<CentralityMap>, + void>::type +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_betweenness_centrality_dispatch2( g, centrality, dummy_property_map(), get(vertex_index, g)); @@ -540,7 +558,8 @@ brandes_betweenness_centrality(const Graph& g, CentralityMap centrality) template<typename Graph, typename CentralityMap, typename EdgeCentralityMap> void brandes_betweenness_centrality(const Graph& g, CentralityMap centrality, - EdgeCentralityMap edge_centrality_map) + EdgeCentralityMap edge_centrality_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { detail::graph::brandes_betweenness_centrality_dispatch2( g, centrality, edge_centrality_map, get(vertex_index, g)); @@ -570,7 +589,8 @@ relative_betweenness_centrality(const Graph& g, CentralityMap centrality) // Compute the central point dominance of a graph. template<typename Graph, typename CentralityMap> typename property_traits<CentralityMap>::value_type -central_point_dominance(const Graph& g, CentralityMap centrality) +central_point_dominance(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { using std::max; diff --git a/Utilities/BGL/boost/graph/biconnected_components.hpp b/Utilities/BGL/boost/graph/biconnected_components.hpp index 6baf586ce4da4f0e3ea56e660d220a8e048579dd..0345963642f3bd16affc17d977724a221ae69bec 100644 --- a/Utilities/BGL/boost/graph/biconnected_components.hpp +++ b/Utilities/BGL/boost/graph/biconnected_components.hpp @@ -17,7 +17,7 @@ #include <boost/limits.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/graph_concepts.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/depth_first_search.hpp> #include <boost/graph/graph_utility.hpp> @@ -27,27 +27,42 @@ namespace boost { template<typename ComponentMap, typename DiscoverTimeMap, typename LowPointMap, typename PredecessorMap, - typename OutputIterator, typename Stack> + typename OutputIterator, typename Stack, + typename DFSVisitor> struct biconnected_components_visitor : public dfs_visitor<> { biconnected_components_visitor (ComponentMap comp, std::size_t& c, DiscoverTimeMap dtm, std::size_t& dfs_time, LowPointMap lowpt, PredecessorMap pred, - OutputIterator out, Stack& S) + OutputIterator out, Stack& S, DFSVisitor vis) : comp(comp), c(c), dtm(dtm), dfs_time(dfs_time), lowpt(lowpt), - pred(pred), out(out), S(S) { } + pred(pred), out(out), S(S), vis(vis) { } template <typename Vertex, typename Graph> - void start_vertex(const Vertex& u, Graph&) + void initialize_vertex(const Vertex& u, Graph& g) + { + vis.initialize_vertex(u, g); + } + + template <typename Vertex, typename Graph> + void start_vertex(const Vertex& u, Graph& g) { put(pred, u, u); + vis.start_vertex(u, g); } template <typename Vertex, typename Graph> - void discover_vertex(const Vertex& u, Graph&) + void discover_vertex(const Vertex& u, Graph& g) { put(dtm, u, ++dfs_time); put(lowpt, u, get(dtm, u)); + vis.discover_vertex(u, g); + } + + template <typename Edge, typename Graph> + void examine_edge(const Edge& e, Graph& g) + { + vis.examine_edge(e, g); } template <typename Edge, typename Graph> @@ -55,6 +70,7 @@ namespace boost { S.push(e); put(pred, target(e, g), source(e, g)); + vis.tree_edge(e, g); } template <typename Edge, typename Graph> @@ -68,6 +84,13 @@ namespace boost min BOOST_PREVENT_MACRO_SUBSTITUTION(get(lowpt, source(e, g)), get(dtm, target(e, g)))); } + vis.back_edge(e, g); + } + + template <typename Edge, typename Graph> + void forward_or_cross_edge(const Edge& e, Graph& g) + { + vis.forward_or_cross_edge(e, g); } template <typename Vertex, typename Graph> @@ -75,14 +98,17 @@ namespace boost { BOOST_USING_STD_MIN(); Vertex parent = get(pred, u); + const std::size_t dtm_of_dubious_parent = get(dtm, parent); bool is_art_point = false; - if ( get(dtm, parent) > get(dtm, u) ) { + if ( dtm_of_dubious_parent > get(dtm, u) ) { parent = get(pred, parent); is_art_point = true; + put(pred, get(pred, u), u); + put(pred, u, parent); } if ( parent == u ) { // at top - if ( get(dtm, u) + 1 == get(dtm, get(pred, u)) ) + if ( get(dtm, u) + 1 == dtm_of_dubious_parent ) is_art_point = false; } else { put(lowpt, parent, @@ -110,6 +136,7 @@ namespace boost } if ( is_art_point ) *out++ = u; + vis.finish_vertex(u, g); } ComponentMap comp; @@ -120,17 +147,16 @@ namespace boost PredecessorMap pred; OutputIterator out; Stack& S; + DFSVisitor vis; }; - } // namespace detail template<typename Graph, typename ComponentMap, typename OutputIterator, - typename DiscoverTimeMap, typename LowPointMap, - typename PredecessorMap, typename VertexIndexMap> + typename VertexIndexMap, typename DiscoverTimeMap, typename LowPointMap, + typename PredecessorMap, typename DFSVisitor> std::pair<std::size_t, OutputIterator> - biconnected_components(const Graph & g, ComponentMap comp, - OutputIterator out, DiscoverTimeMap discover_time, - LowPointMap lowpt, PredecessorMap pred, - VertexIndexMap index_map) + biconnected_components_impl(const Graph & g, ComponentMap comp, + OutputIterator out, VertexIndexMap index_map, DiscoverTimeMap dtm, + LowPointMap lowpt, PredecessorMap pred, DFSVisitor dfs_vis) { typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; typedef typename graph_traits<Graph>::edge_descriptor edge_t; @@ -145,61 +171,188 @@ namespace boost std::size_t num_components = 0; std::size_t dfs_time = 0; - std::stack < edge_t > S; + std::stack<edge_t> S; - detail::biconnected_components_visitor<ComponentMap, DiscoverTimeMap, - LowPointMap, PredecessorMap, OutputIterator, std::stack<edge_t> > - vis(comp, num_components, discover_time, dfs_time, lowpt, pred, out, S); + biconnected_components_visitor<ComponentMap, DiscoverTimeMap, + LowPointMap, PredecessorMap, OutputIterator, std::stack<edge_t>, + DFSVisitor> + vis(comp, num_components, dtm, dfs_time, lowpt, pred, out, + S, dfs_vis); depth_first_search(g, visitor(vis).vertex_index_map(index_map)); return std::pair<std::size_t, OutputIterator>(num_components, vis.out); } + template <typename PredecessorMap> + struct bicomp_dispatch3 + { template<typename Graph, typename ComponentMap, typename OutputIterator, - typename DiscoverTimeMap, typename LowPointMap, - typename VertexIndexMap> - std::pair<std::size_t, OutputIterator> - biconnected_components(const Graph & g, ComponentMap comp, - OutputIterator out, DiscoverTimeMap discover_time, - LowPointMap lowpt, VertexIndexMap index_map) + typename VertexIndexMap, typename DiscoverTimeMap, + typename LowPointMap, class P, class T, class R> + static std::pair<std::size_t, OutputIterator> apply (const Graph & g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, LowPointMap lowpt, + const bgl_named_params<P, T, R>& params, PredecessorMap pred) + { + return biconnected_components_impl + (g, comp, out, index_map, dtm, lowpt, pred, + choose_param(get_param(params, graph_visitor), + make_dfs_visitor(null_visitor()))); + } + }; + + template <> + struct bicomp_dispatch3<error_property_not_found> + { + template<typename Graph, typename ComponentMap, typename OutputIterator, + typename VertexIndexMap, typename DiscoverTimeMap, + typename LowPointMap, class P, class T, class R> + static std::pair<std::size_t, OutputIterator> apply (const Graph & g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, LowPointMap lowpt, + const bgl_named_params<P, T, R>& params, + error_property_not_found) { typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; std::vector<vertex_t> pred(num_vertices(g)); vertex_t vert = graph_traits<Graph>::null_vertex(); - return biconnected_components - (g, comp, out, discover_time, lowpt, + + return biconnected_components_impl + (g, comp, out, index_map, dtm, lowpt, make_iterator_property_map(pred.begin(), index_map, vert), - index_map); + choose_param(get_param(params, graph_visitor), + make_dfs_visitor(null_visitor()))); } + }; + template <typename LowPointMap> + struct bicomp_dispatch2 + { template<typename Graph, typename ComponentMap, typename OutputIterator, - typename VertexIndexMap> - std::pair<std::size_t, OutputIterator> - biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out, - VertexIndexMap index_map) + typename VertexIndexMap, typename DiscoverTimeMap, + typename P, typename T, typename R> + static std::pair<std::size_t, OutputIterator> apply (const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, const bgl_named_params<P, T, R>& params, + LowPointMap lowpt) + { + typedef typename property_value< bgl_named_params<P,T,R>, + vertex_predecessor_t>::type dispatch_type; + + return bicomp_dispatch3<dispatch_type>::apply + (g, comp, out, index_map, dtm, lowpt, params, + get_param(params, vertex_predecessor)); + } + }; + + + template <> + struct bicomp_dispatch2<error_property_not_found> + { + template<typename Graph, typename ComponentMap, typename OutputIterator, + typename VertexIndexMap, typename DiscoverTimeMap, + typename P, typename T, typename R> + static std::pair<std::size_t, OutputIterator> apply (const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + DiscoverTimeMap dtm, const bgl_named_params<P, T, R>& params, + error_property_not_found) { - typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; - - std::vector<vertices_size_type> discover_time(num_vertices(g)); std::vector<vertices_size_type> lowpt(num_vertices(g)); + vertices_size_type vst(0); + + typedef typename property_value< bgl_named_params<P,T,R>, + vertex_predecessor_t>::type dispatch_type; + + return bicomp_dispatch3<dispatch_type>::apply + (g, comp, out, index_map, dtm, + make_iterator_property_map(lowpt.begin(), index_map, vst), + params, get_param(params, vertex_predecessor)); + } + }; + + template <typename DiscoverTimeMap> + struct bicomp_dispatch1 + { + template<typename Graph, typename ComponentMap, typename OutputIterator, + typename VertexIndexMap, class P, class T, class R> + static std::pair<std::size_t, OutputIterator> apply(const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + const bgl_named_params<P, T, R>& params, DiscoverTimeMap dtm) + { + typedef typename property_value< bgl_named_params<P,T,R>, + vertex_lowpoint_t>::type dispatch_type; + return bicomp_dispatch2<dispatch_type>::apply + (g, comp, out, index_map, dtm, params, + get_param(params, vertex_lowpoint)); + } + }; + + template <> + struct bicomp_dispatch1<error_property_not_found> + { + template<typename Graph, typename ComponentMap, typename OutputIterator, + typename VertexIndexMap, class P, class T, class R> + static std::pair<std::size_t, OutputIterator> apply(const Graph& g, + ComponentMap comp, OutputIterator out, VertexIndexMap index_map, + const bgl_named_params<P, T, R>& params, error_property_not_found) + { + typedef typename graph_traits<Graph>::vertices_size_type + vertices_size_type; + std::vector<vertices_size_type> discover_time(num_vertices(g)); vertices_size_type vst(0); - return biconnected_components - (g, comp, out, + typedef typename property_value< bgl_named_params<P,T,R>, + vertex_lowpoint_t>::type dispatch_type; + + return bicomp_dispatch2<dispatch_type>::apply + (g, comp, out, index_map, make_iterator_property_map(discover_time.begin(), index_map, vst), - make_iterator_property_map(lowpt.begin(), index_map, vst), - index_map); + params, get_param(params, vertex_lowpoint)); + } + }; + + } + + template<typename Graph, typename ComponentMap, typename OutputIterator, + typename DiscoverTimeMap, typename LowPointMap> + std::pair<std::size_t, OutputIterator> + biconnected_components(const Graph& g, ComponentMap comp, + OutputIterator out, DiscoverTimeMap dtm, LowPointMap lowpt) + { + typedef detail::error_property_not_found dispatch_type; + + return detail::bicomp_dispatch3<dispatch_type>::apply + (g, comp, out, + get(vertex_index, g), + dtm, lowpt, + bgl_named_params<int, buffer_param_t>(0), + detail::error_property_not_found()); + } + + template <typename Graph, typename ComponentMap, typename OutputIterator, + typename P, typename T, typename R> + std::pair<std::size_t, OutputIterator> + biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out, + const bgl_named_params<P, T, R>& params) + { + typedef typename property_value< bgl_named_params<P,T,R>, + vertex_discover_time_t>::type dispatch_type; + + return detail::bicomp_dispatch1<dispatch_type>::apply(g, comp, out, + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + params, get_param(params, vertex_discover_time)); } template < typename Graph, typename ComponentMap, typename OutputIterator> std::pair<std::size_t, OutputIterator> biconnected_components(const Graph& g, ComponentMap comp, OutputIterator out) { - return biconnected_components(g, comp, out, get(vertex_index, g)); + return biconnected_components(g, comp, out, + bgl_named_params<int, buffer_param_t>(0)); } namespace graph_detail { @@ -221,6 +374,16 @@ namespace boost }; } // end namespace graph_detail + template <typename Graph, typename ComponentMap, + typename P, typename T, typename R> + std::size_t + biconnected_components(const Graph& g, ComponentMap comp, + const bgl_named_params<P, T, R>& params) + { + return biconnected_components(g, comp, + graph_detail::dummy_output_iterator(), params).first; + } + template <typename Graph, typename ComponentMap> std::size_t biconnected_components(const Graph& g, ComponentMap comp) @@ -229,13 +392,14 @@ namespace boost graph_detail::dummy_output_iterator()).first; } - template<typename Graph, typename OutputIterator, typename VertexIndexMap> + template<typename Graph, typename OutputIterator, + typename P, typename T, typename R> OutputIterator articulation_points(const Graph& g, OutputIterator out, - VertexIndexMap index_map) + const bgl_named_params<P, T, R>& params) { return biconnected_components(g, dummy_property_map(), out, - index_map).second; + params).second; } template<typename Graph, typename OutputIterator> @@ -243,7 +407,7 @@ namespace boost articulation_points(const Graph& g, OutputIterator out) { return biconnected_components(g, dummy_property_map(), out, - get(vertex_index, g)).second; + bgl_named_params<int, buffer_param_t>(0)).second; } } // namespace boost diff --git a/Utilities/BGL/boost/graph/boyer_myrvold_planar_test.hpp b/Utilities/BGL/boost/graph/boyer_myrvold_planar_test.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dc0158687f00511f50dc2090fb2401947dd44eb7 --- /dev/null +++ b/Utilities/BGL/boost/graph/boyer_myrvold_planar_test.hpp @@ -0,0 +1,322 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __BOYER_MYRVOLD_PLANAR_TEST_HPP__ +#define __BOYER_MYRVOLD_PLANAR_TEST_HPP__ + +#include <boost/graph/planar_detail/boyer_myrvold_impl.hpp> +#include <boost/parameter.hpp> +#include <boost/type_traits.hpp> +#include <boost/mpl/bool.hpp> + + +namespace boost +{ + + struct no_kuratowski_subgraph_isolation {}; + struct no_planar_embedding {}; + + namespace boyer_myrvold_params + { + + BOOST_PARAMETER_KEYWORD(tag, graph) + BOOST_PARAMETER_KEYWORD(tag, embedding) + BOOST_PARAMETER_KEYWORD(tag, kuratowski_subgraph) + BOOST_PARAMETER_KEYWORD(tag, vertex_index_map) + BOOST_PARAMETER_KEYWORD(tag, edge_index_map) + + typedef parameter::parameters< parameter::required<tag::graph>, + tag::embedding, + tag::kuratowski_subgraph, + tag::vertex_index_map, + tag::edge_index_map + > boyer_myrvold_params_t; + + namespace core + { + + template <typename ArgumentPack> + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::true_, + mpl::true_ + ) + { + //Dispatch for no planar embedding, no kuratowski subgraph isolation + + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map + < typename remove_reference<graph_t>::type, + vertex_index_t>::const_type + >::type vertex_index_map_t; + + boyer_myrvold_impl + <graph_t, + vertex_index_map_t, + graph::detail::no_old_handles, + graph::detail::no_embedding + > + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + return planarity_tester.is_planar() ? true : false; + } + + + + template <typename ArgumentPack> + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::true_, + mpl::false_ + ) + { + //Dispatch for no planar embedding, kuratowski subgraph isolation + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map<graph_t, vertex_index_t>::type + >::type vertex_index_map_t; + + boyer_myrvold_impl + <graph_t, + vertex_index_map_t, + graph::detail::store_old_handles, + graph::detail::no_embedding + > + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + if (planarity_tester.is_planar()) + return true; + else + { + planarity_tester.extract_kuratowski_subgraph + (args[kuratowski_subgraph], + args[edge_index_map|get(edge_index, args[graph])] + ); + return false; + } + } + + + + + template <typename ArgumentPack> + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::false_, + mpl::true_ + ) + { + //Dispatch for planar embedding, no kuratowski subgraph isolation + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map<graph_t, vertex_index_t>::type + >::type vertex_index_map_t; + + boyer_myrvold_impl + <graph_t, + vertex_index_map_t, + graph::detail::no_old_handles, +#ifdef BOOST_GRAPH_PREFER_STD_LIB + graph::detail::std_list +#else + graph::detail::recursive_lazy_list +#endif + > + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + if (planarity_tester.is_planar()) + { + planarity_tester.make_edge_permutation(args[embedding]); + return true; + } + else + return false; + } + + + + template <typename ArgumentPack> + bool dispatched_boyer_myrvold(ArgumentPack const& args, + mpl::false_, + mpl::false_ + ) + { + //Dispatch for planar embedding, kuratowski subgraph isolation + typedef typename remove_const + < + typename remove_reference + < typename parameter::binding + < ArgumentPack, tag::graph>::type + >::type + >::type graph_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::vertex_index_map, + typename property_map<graph_t, vertex_index_t>::type + >::type vertex_index_map_t; + + boyer_myrvold_impl + <graph_t, + vertex_index_map_t, + graph::detail::store_old_handles, +#ifdef BOOST_BGL_PREFER_STD_LIB + graph::detail::std_list +#else + graph::detail::recursive_lazy_list +#endif + > + planarity_tester(args[graph], + args[vertex_index_map | + get(vertex_index, args[graph]) + ] + ); + + if (planarity_tester.is_planar()) + { + planarity_tester.make_edge_permutation(args[embedding]); + return true; + } + else + { + planarity_tester.extract_kuratowski_subgraph + (args[kuratowski_subgraph], + args[edge_index_map | get(edge_index, args[graph])] + ); + return false; + } + } + + + + + template <typename ArgumentPack> + bool boyer_myrvold_planarity_test(ArgumentPack const& args) + { + + typedef typename parameter::binding + < ArgumentPack, + tag::kuratowski_subgraph, + const no_kuratowski_subgraph_isolation& + >::type + kuratowski_arg_t; + + typedef typename parameter::binding + < ArgumentPack, + tag::embedding, + const no_planar_embedding& + >::type + embedding_arg_t; + + return dispatched_boyer_myrvold + (args, + boost::is_same + <embedding_arg_t, const no_planar_embedding&>(), + boost::is_same + <kuratowski_arg_t, const no_kuratowski_subgraph_isolation&>() + ); + } + + + + } //namespace core + + } //namespace boyer_myrvold_params + + + template <typename A0> + bool boyer_myrvold_planarity_test(A0 const& arg0) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0)); + } + + template <typename A0, typename A1> + // bool boyer_myrvold_planarity_test(A0 const& arg0, A1 const& arg1) + bool boyer_myrvold_planarity_test(A0 const& arg0, A1 const& arg1) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1)); + } + + template <typename A0, typename A1, typename A2> + bool boyer_myrvold_planarity_test(A0 const& arg0, + A1 const& arg1, + A2 const& arg2 + ) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1,arg2)); + } + + template <typename A0, typename A1, typename A2, typename A3> + bool boyer_myrvold_planarity_test(A0 const& arg0, + A1 const& arg1, + A2 const& arg2, + A3 const& arg3 + ) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1,arg2,arg3)); + } + + template <typename A0, typename A1, typename A2, typename A3, typename A4> + bool boyer_myrvold_planarity_test(A0 const& arg0, + A1 const& arg1, + A2 const& arg2, + A3 const& arg3, + A4 const& arg4 + ) + { + return boyer_myrvold_params::core::boyer_myrvold_planarity_test + (boyer_myrvold_params::boyer_myrvold_params_t() + (arg0,arg1,arg2,arg3,arg4) + ); + } + + +} + +#endif //__BOYER_MYRVOLD_PLANAR_TEST_HPP__ diff --git a/Utilities/BGL/boost/graph/breadth_first_search.hpp b/Utilities/BGL/boost/graph/breadth_first_search.hpp index 73416a485dbd47beb020337c7f68ec2f43d4e667..1cf06cf7e1f3d5459ff7350f05bf13cd5248d7cf 100644 --- a/Utilities/BGL/boost/graph/breadth_first_search.hpp +++ b/Utilities/BGL/boost/graph/breadth_first_search.hpp @@ -21,6 +21,13 @@ #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> + +#ifdef BOOST_GRAPH_USE_MPI +#include <boost/graph/distributed/concepts.hpp> +#endif // BOOST_GRAPH_USE_MPI namespace boost { @@ -94,12 +101,14 @@ namespace boost { typedef color_traits<ColorValue> Color; typename boost::graph_traits<VertexListGraph>::vertex_iterator i, i_end; for (tie(i, i_end) = vertices(g); i != i_end; ++i) { - put(color, *i, Color::white()); vis.initialize_vertex(*i, g); + put(color, *i, Color::white()); } breadth_first_visit(g, s, Q, vis, color); } + namespace graph { struct bfs_visitor_event_not_overridden {}; } + template <class Visitors = null_visitor> class bfs_visitor { @@ -108,40 +117,75 @@ namespace boost { bfs_visitor(Visitors vis) : m_vis(vis) { } template <class Vertex, class Graph> - void initialize_vertex(Vertex u, Graph& g) { + 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> - void discover_vertex(Vertex u, Graph& g) { + 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> - void examine_vertex(Vertex u, Graph& g) { + 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> - void examine_edge(Edge e, Graph& g) { + 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> - void tree_edge(Edge e, Graph& g) { + 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> - void non_tree_edge(Edge e, Graph& g) { + 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> - void gray_target(Edge e, Graph& g) { + 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> - void black_target(Edge e, Graph& g) { + 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> - void finish_vertex(Vertex u, Graph& g) { + 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) @@ -174,20 +218,34 @@ namespace boost { typename graph_traits<VertexListGraph>::vertex_descriptor s, ColorMap color, BFSVisitor vis, - const bgl_named_params<P, T, R>& params) + const bgl_named_params<P, T, R>& params, + BOOST_GRAPH_ENABLE_IF_MODELS(VertexListGraph, vertex_list_graph_tag, + void)* = 0) { typedef graph_traits<VertexListGraph> Traits; // Buffer default typedef typename Traits::vertex_descriptor Vertex; typedef boost::queue<Vertex> queue_t; queue_t Q; - detail::wrap_ref<queue_t> Qref(Q); breadth_first_search (g, s, - choose_param(get_param(params, buffer_param_t()), Qref).ref, + 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_GRAPH_ENABLE_IF_MODELS(DistributedGraph, distributed_graph_tag, + void)* = 0); +#endif // BOOST_GRAPH_USE_MPI + //------------------------------------------------------------------------- // Choose between default color and color parameters. Using // function dispatching so that we don't require vertex index if @@ -219,16 +277,14 @@ namespace boost { const bgl_named_params<P, T, R>& params, detail::error_property_not_found) { - std::vector<default_color_type> color_vec(num_vertices(g)); - default_color_type c = white_color; null_visitor null_vis; bfs_helper (g, s, - make_iterator_property_map - (color_vec.begin(), + make_two_bit_color_map + (num_vertices(g), choose_const_pmap(get_param(params, vertex_index), - g, vertex_index), c), + g, vertex_index)), choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_vis)), params); @@ -276,11 +332,10 @@ namespace boost { typedef typename Traits::vertex_descriptor vertex_descriptor; typedef boost::queue<vertex_descriptor> queue_t; queue_t Q; - detail::wrap_ref<queue_t> Qref(Q); breadth_first_visit (ng, s, - choose_param(get_param(params, buffer_param_t()), Qref).ref, + 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) @@ -289,5 +344,9 @@ namespace boost { } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/breadth_first_search.hpp> +#endif + #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP diff --git a/Utilities/BGL/boost/graph/bron_kerbosch_all_cliques.hpp b/Utilities/BGL/boost/graph/bron_kerbosch_all_cliques.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f6d253b1a26684d685ed5953e65da541cabc7baf --- /dev/null +++ b/Utilities/BGL/boost/graph/bron_kerbosch_all_cliques.hpp @@ -0,0 +1,309 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CLIQUE_HPP +#define BOOST_GRAPH_CLIQUE_HPP + +#include <vector> +#include <deque> +#include <boost/config.hpp> + +#include <boost/graph/graph_concepts.hpp> +#include <boost/graph/lookup_edge.hpp> + +#include <boost/concept/detail/concept_def.hpp> +namespace boost { + namespace concepts { + BOOST_concept(CliqueVisitor,(Visitor)(Clique)(Graph)) + { + BOOST_CONCEPT_USAGE(CliqueVisitor) + { + vis.clique(k, g); + } + private: + Visitor vis; + Graph g; + Clique k; + }; + } /* namespace concepts */ +using concepts::CliqueVisitorConcept; +} /* namespace boost */ +#include <boost/concept/detail/concept_undef.hpp> + +namespace boost +{ +// The algorithm implemented in this paper is based on the so-called +// Algorithm 457, published as: +// +// @article{362367, +// author = {Coen Bron and Joep Kerbosch}, +// title = {Algorithm 457: finding all cliques of an undirected graph}, +// journal = {Communications of the ACM}, +// volume = {16}, +// number = {9}, +// year = {1973}, +// issn = {0001-0782}, +// pages = {575--577}, +// doi = {http://doi.acm.org/10.1145/362342.362367}, +// publisher = {ACM Press}, +// address = {New York, NY, USA}, +// } +// +// Sort of. This implementation is adapted from the 1st version of the +// algorithm and does not implement the candidate selection optimization +// described as published - it could, it just doesn't yet. +// +// The algorithm is given as proportional to (3.14)^(n/3) power. This is +// not the same as O(...), but based on time measures and approximation. +// +// Unfortunately, this implementation may be less efficient on non- +// AdjacencyMatrix modeled graphs due to the non-constant implementation +// of the edge(u,v,g) functions. +// +// TODO: It might be worthwhile to provide functionality for passing +// a connectivity matrix to improve the efficiency of those lookups +// when needed. This could simply be passed as a BooleanMatrix +// s.t. edge(u,v,B) returns true or false. This could easily be +// abstracted for adjacency matricies. +// +// The following paper is interesting for a number of reasons. First, +// it lists a number of other such algorithms and second, it describes +// a new algorithm (that does not appear to require the edge(u,v,g) +// function and appears fairly efficient. It is probably worth investigating. +// +// @article{DBLP:journals/tcs/TomitaTT06, +// author = {Etsuji Tomita and Akira Tanaka and Haruhisa Takahashi}, +// title = {The worst-case time complexity for generating all maximal cliques and computational experiments}, +// journal = {Theor. Comput. Sci.}, +// volume = {363}, +// number = {1}, +// year = {2006}, +// pages = {28-42} +// ee = {http://dx.doi.org/10.1016/j.tcs.2006.06.015} +// } + +/** + * The default clique_visitor supplies an empty visitation function. + */ +struct clique_visitor +{ + template <typename VertexSet, typename Graph> + void clique(const VertexSet&, Graph&) + { } +}; + +/** + * The max_clique_visitor records the size of the maximum clique (but not the + * clique itself). + */ +struct max_clique_visitor +{ + max_clique_visitor(std::size_t& max) + : maximum(max) + { } + + template <typename Clique, typename Graph> + inline void clique(const Clique& p, const Graph& g) + { + BOOST_USING_STD_MAX(); + maximum = max BOOST_PREVENT_MACRO_SUBSTITUTION (maximum, p.size()); + } + std::size_t& maximum; +}; + +inline max_clique_visitor find_max_clique(std::size_t& max) +{ return max_clique_visitor(max); } + +namespace detail +{ + template <typename Graph> + inline bool + is_connected_to_clique(const Graph& g, + typename graph_traits<Graph>::vertex_descriptor u, + typename graph_traits<Graph>::vertex_descriptor v, + typename graph_traits<Graph>::undirected_category) + { + return lookup_edge(u, v, g).second; + } + + template <typename Graph> + inline bool + is_connected_to_clique(const Graph& g, + typename graph_traits<Graph>::vertex_descriptor u, + typename graph_traits<Graph>::vertex_descriptor v, + typename graph_traits<Graph>::directed_category) + { + // Note that this could alternate between using an || to determine + // full connectivity. I believe that this should produce strongly + // connected components. Note that using && instead of || will + // change the results to a fully connected subgraph (i.e., symmetric + // edges between all vertices s.t., if a->b, then b->a. + return lookup_edge(u, v, g).second && lookup_edge(v, u, g).second; + } + + template <typename Graph, typename Container> + inline void + filter_unconnected_vertices(const Graph& g, + typename graph_traits<Graph>::vertex_descriptor v, + const Container& in, + Container& out) + { + function_requires< GraphConcept<Graph> >(); + + typename graph_traits<Graph>::directed_category cat; + typename Container::const_iterator i, end = in.end(); + for(i = in.begin(); i != end; ++i) { + if(is_connected_to_clique(g, v, *i, cat)) { + out.push_back(*i); + } + } + } + + template < + typename Graph, + typename Clique, // compsub type + typename Container, // candidates/not type + typename Visitor> + void extend_clique(const Graph& g, + Clique& clique, + Container& cands, + Container& nots, + Visitor vis, + std::size_t min) + { + function_requires< GraphConcept<Graph> >(); + function_requires< CliqueVisitorConcept<Visitor,Clique,Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + + // Is there vertex in nots that is connected to all vertices + // in the candidate set? If so, no clique can ever be found. + // This could be broken out into a separate function. + { + typename Container::iterator ni, nend = nots.end(); + typename Container::iterator ci, cend = cands.end(); + for(ni = nots.begin(); ni != nend; ++ni) { + for(ci = cands.begin(); ci != cend; ++ci) { + // if we don't find an edge, then we're okay. + if(!lookup_edge(*ni, *ci, g).second) break; + } + // if we iterated all the way to the end, then *ni + // is connected to all *ci + if(ci == cend) break; + } + // if we broke early, we found *ni connected to all *ci + if(ni != nend) return; + } + + // TODO: the original algorithm 457 describes an alternative + // (albeit really complicated) mechanism for selecting candidates. + // The given optimizaiton seeks to bring about the above + // condition sooner (i.e., there is a vertex in the not set + // that is connected to all candidates). unfortunately, the + // method they give for doing this is fairly unclear. + + // basically, for every vertex in not, we should know how many + // vertices it is disconnected from in the candidate set. if + // we fix some vertex in the not set, then we want to keep + // choosing vertices that are not connected to that fixed vertex. + // apparently, by selecting fix point with the minimum number + // of disconnections (i.e., the maximum number of connections + // within the candidate set), then the previous condition wil + // be reached sooner. + + // there's some other stuff about using the number of disconnects + // as a counter, but i'm jot really sure i followed it. + + // TODO: If we min-sized cliques to visit, then theoretically, we + // should be able to stop recursing if the clique falls below that + // size - maybe? + + // otherwise, iterate over candidates and and test + // for maxmimal cliquiness. + typename Container::iterator i, j, end = cands.end(); + for(i = cands.begin(); i != cands.end(); ) { + Vertex candidate = *i; + + // add the candidate to the clique (keeping the iterator!) + // typename Clique::iterator ci = clique.insert(clique.end(), candidate); + clique.push_back(candidate); + + // remove it from the candidate set + i = cands.erase(i); + + // build new candidate and not sets by removing all vertices + // that are not connected to the current candidate vertex. + // these actually invert the operation, adding them to the new + // sets if the vertices are connected. its semantically the same. + Container new_cands, new_nots; + filter_unconnected_vertices(g, candidate, cands, new_cands); + filter_unconnected_vertices(g, candidate, nots, new_nots); + + if(new_cands.empty() && new_nots.empty()) { + // our current clique is maximal since there's nothing + // that's connected that we haven't already visited. If + // the clique is below our radar, then we won't visit it. + if(clique.size() >= min) { + vis.clique(clique, g); + } + } + else { + // recurse to explore the new candidates + extend_clique(g, clique, new_cands, new_nots, vis, min); + } + + // we're done with this vertex, so we need to move it + // to the nots, and remove the candidate from the clique. + nots.push_back(candidate); + clique.pop_back(); + } + } +} /* namespace detail */ + +template <typename Graph, typename Visitor> +inline void +bron_kerbosch_all_cliques(const Graph& g, Visitor vis, std::size_t min) +{ + function_requires< IncidenceGraphConcept<Graph> >(); + function_requires< VertexListGraphConcept<Graph> >(); + function_requires< VertexIndexGraphConcept<Graph> >(); + function_requires< AdjacencyMatrixConcept<Graph> >(); // Structural requirement only + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + typedef std::vector<Vertex> VertexSet; + typedef std::deque<Vertex> Clique; + function_requires< CliqueVisitorConcept<Visitor,Clique,Graph> >(); + + // NOTE: We're using a deque to implement the clique, because it provides + // constant inserts and removals at the end and also a constant size. + + VertexIterator i, end; + tie(i, end) = vertices(g); + VertexSet cands(i, end); // start with all vertices as candidates + VertexSet nots; // start with no vertices visited + + Clique clique; // the first clique is an empty vertex set + detail::extend_clique(g, clique, cands, nots, vis, min); +} + +// NOTE: By default the minimum number of vertices per clique is set at 2 +// because singleton cliques aren't really very interesting. +template <typename Graph, typename Visitor> +inline void +bron_kerbosch_all_cliques(const Graph& g, Visitor vis) +{ bron_kerbosch_all_cliques(g, vis, 2); } + +template <typename Graph> +inline std::size_t +bron_kerbosch_clique_number(const Graph& g) +{ + std::size_t ret = 0; + bron_kerbosch_all_cliques(g, find_max_clique(ret)); + return ret; +} + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/chrobak_payne_drawing.hpp b/Utilities/BGL/boost/graph/chrobak_payne_drawing.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9e3a2f368e2e941e2ed4f7d71e57f7d5fb58faba --- /dev/null +++ b/Utilities/BGL/boost/graph/chrobak_payne_drawing.hpp @@ -0,0 +1,270 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __CHROBAK_PAYNE_DRAWING_HPP__ +#define __CHROBAK_PAYNE_DRAWING_HPP__ + +#include <vector> +#include <list> +#include <boost/config.hpp> +#include <boost/utility.hpp> //for next and prior +#include <boost/graph/graph_traits.hpp> +#include <boost/property_map/property_map.hpp> + + +namespace boost +{ + + namespace graph { namespace detail + { + + template<typename Graph, + typename VertexToVertexMap, + typename VertexTo1DCoordMap> + void accumulate_offsets(typename graph_traits<Graph>::vertex_descriptor v, + std::size_t offset, + const Graph& g, + VertexTo1DCoordMap x, + VertexTo1DCoordMap delta_x, + VertexToVertexMap left, + VertexToVertexMap right) + { + if (v != graph_traits<Graph>::null_vertex()) + { + x[v] += delta_x[v] + offset; + accumulate_offsets(left[v], x[v], g, x, delta_x, left, right); + accumulate_offsets(right[v], x[v], g, x, delta_x, left, right); + } + } + + } /*namespace detail*/ } /*namespace graph*/ + + + + + + template<typename Graph, + typename PlanarEmbedding, + typename ForwardIterator, + typename GridPositionMap, + typename VertexIndexMap> + void chrobak_payne_straight_line_drawing(const Graph& g, + PlanarEmbedding embedding, + ForwardIterator ordering_begin, + ForwardIterator ordering_end, + GridPositionMap drawing, + VertexIndexMap vm + ) + { + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename PlanarEmbedding::value_type::const_iterator + edge_permutation_iterator_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + typedef std::vector<vertex_t> vertex_vector_t; + typedef std::vector<v_size_t> vsize_vector_t; + typedef std::vector<bool> bool_vector_t; + typedef boost::iterator_property_map + <typename vertex_vector_t::iterator, VertexIndexMap> + vertex_to_vertex_map_t; + typedef boost::iterator_property_map + <typename vsize_vector_t::iterator, VertexIndexMap> + vertex_to_vsize_map_t; + typedef boost::iterator_property_map + <typename bool_vector_t::iterator, VertexIndexMap> + vertex_to_bool_map_t; + + vertex_vector_t left_vector(num_vertices(g), + graph_traits<Graph>::null_vertex() + ); + vertex_vector_t right_vector(num_vertices(g), + graph_traits<Graph>::null_vertex() + ); + vsize_vector_t seen_as_right_vector(num_vertices(g), 0); + vsize_vector_t seen_vector(num_vertices(g), 0); + vsize_vector_t delta_x_vector(num_vertices(g),0); + vsize_vector_t y_vector(num_vertices(g)); + vsize_vector_t x_vector(num_vertices(g),0); + bool_vector_t installed_vector(num_vertices(g),false); + + vertex_to_vertex_map_t left(left_vector.begin(), vm); + vertex_to_vertex_map_t right(right_vector.begin(), vm); + vertex_to_vsize_map_t seen_as_right(seen_as_right_vector.begin(), vm); + vertex_to_vsize_map_t seen(seen_vector.begin(), vm); + vertex_to_vsize_map_t delta_x(delta_x_vector.begin(), vm); + vertex_to_vsize_map_t y(y_vector.begin(), vm); + vertex_to_vsize_map_t x(x_vector.begin(), vm); + vertex_to_bool_map_t installed(installed_vector.begin(), vm); + + v_size_t timestamp = 1; + vertex_vector_t installed_neighbors; + + ForwardIterator itr = ordering_begin; + vertex_t v1 = *itr; ++itr; + vertex_t v2 = *itr; ++itr; + vertex_t v3 = *itr; ++itr; + + delta_x[v2] = 1; + delta_x[v3] = 1; + + y[v1] = 0; + y[v2] = 0; + y[v3] = 1; + + right[v1] = v3; + right[v3] = v2; + + installed[v1] = installed[v2] = installed[v3] = true; + + for(ForwardIterator itr_end = ordering_end; itr != itr_end; ++itr) + { + vertex_t v = *itr; + + // First, find the leftmost and rightmost neighbor of v on the outer + // cycle of the embedding. + // Note: since we're moving clockwise through the edges adjacent to v, + // we're actually moving from right to left among v's neighbors on the + // outer face (since v will be installed above them all) looking for + // the leftmost and rightmost installed neigbhors + + vertex_t leftmost = graph_traits<Graph>::null_vertex(); + vertex_t rightmost = graph_traits<Graph>::null_vertex(); + + installed_neighbors.clear(); + + vertex_t prev_vertex = graph_traits<Graph>::null_vertex(); + edge_permutation_iterator_t pi, pi_end; + pi_end = embedding[v].end(); + for(pi = embedding[v].begin(); pi != pi_end; ++pi) + { + vertex_t curr_vertex = source(*pi,g) == v ? + target(*pi,g) : source(*pi,g); + + // Skip any self-loops or parallel edges + if (curr_vertex == v || curr_vertex == prev_vertex) + continue; + + if (installed[curr_vertex]) + { + seen[curr_vertex] = timestamp; + + if (right[curr_vertex] != graph_traits<Graph>::null_vertex()) + { + seen_as_right[right[curr_vertex]] = timestamp; + } + installed_neighbors.push_back(curr_vertex); + } + + prev_vertex = curr_vertex; + } + + typename vertex_vector_t::iterator vi, vi_end; + vi_end = installed_neighbors.end(); + for(vi = installed_neighbors.begin(); vi != vi_end; ++vi) + { + if (right[*vi] == graph_traits<Graph>::null_vertex() || + seen[right[*vi]] != timestamp + ) + rightmost = *vi; + if (seen_as_right[*vi] != timestamp) + leftmost = *vi; + } + + ++timestamp; + + //stretch gaps + ++delta_x[right[leftmost]]; + ++delta_x[rightmost]; + + //adjust offsets + std::size_t delta_p_q = 0; + vertex_t stopping_vertex = right[rightmost]; + for(vertex_t temp = right[leftmost]; temp != stopping_vertex; + temp = right[temp] + ) + { + delta_p_q += delta_x[temp]; + } + + delta_x[v] = ((y[rightmost] + delta_p_q) - y[leftmost])/2; + y[v] = y[leftmost] + delta_x[v]; + delta_x[rightmost] = delta_p_q - delta_x[v]; + + bool leftmost_and_rightmost_adjacent = right[leftmost] == rightmost; + if (!leftmost_and_rightmost_adjacent) + delta_x[right[leftmost]] -= delta_x[v]; + + //install v + if (!leftmost_and_rightmost_adjacent) + { + left[v] = right[leftmost]; + vertex_t next_to_rightmost; + for(vertex_t temp = leftmost; temp != rightmost; + temp = right[temp] + ) + { + next_to_rightmost = temp; + } + + right[next_to_rightmost] = graph_traits<Graph>::null_vertex(); + } + else + { + left[v] = graph_traits<Graph>::null_vertex(); + } + + right[leftmost] = v; + right[v] = rightmost; + installed[v] = true; + + } + + graph::detail::accumulate_offsets + (*ordering_begin,0,g,x,delta_x,left,right); + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + drawing[v].x = x[v]; + drawing[v].y = y[v]; + } + + } + + + + + template<typename Graph, + typename PlanarEmbedding, + typename ForwardIterator, + typename GridPositionMap> + inline void chrobak_payne_straight_line_drawing(const Graph& g, + PlanarEmbedding embedding, + ForwardIterator ord_begin, + ForwardIterator ord_end, + GridPositionMap drawing + ) + { + chrobak_payne_straight_line_drawing(g, + embedding, + ord_begin, + ord_end, + drawing, + get(vertex_index,g) + ); + } + + + + +} // namespace boost + +#endif //__CHROBAK_PAYNE_DRAWING_HPP__ diff --git a/Utilities/BGL/boost/graph/circle_layout.hpp b/Utilities/BGL/boost/graph/circle_layout.hpp index e601c5328c949ccfdf2184fcb594c0a809e156e8..9c6ca6ef57bdc4a55592bfced82eb20d1983a22a 100644 --- a/Utilities/BGL/boost/graph/circle_layout.hpp +++ b/Utilities/BGL/boost/graph/circle_layout.hpp @@ -1,16 +1,20 @@ // Copyright 2004 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor // Andrew Lumsdaine #ifndef BOOST_GRAPH_CIRCLE_LAYOUT_HPP #define BOOST_GRAPH_CIRCLE_LAYOUT_HPP -#include <cmath> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/math/constants/constants.hpp> #include <utility> #include <boost/graph/graph_traits.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/graph/topology.hpp> +#include <boost/static_assert.hpp> namespace boost { /** @@ -28,7 +32,8 @@ namespace boost { circle_graph_layout(const VertexListGraph& g, PositionMap position, Radius radius) { - const double pi = 3.14159; + BOOST_STATIC_ASSERT (property_traits<PositionMap>::value_type::dimensions >= 2); + const double pi = boost::math::constants::pi<double>(); #ifndef BOOST_NO_STDC_NAMESPACE using std::sin; @@ -40,14 +45,12 @@ namespace boost { vertices_size_type n = num_vertices(g); - typedef typename graph_traits<VertexListGraph>::vertex_iterator - vertex_iterator; - vertices_size_type i = 0; - for(std::pair<vertex_iterator, vertex_iterator> v = vertices(g); - v.first != v.second; ++v.first, ++i) { - position[*v.first].x = radius * cos(i * 2 * pi / n); - position[*v.first].y = radius * sin(i * 2 * pi / n); + double two_pi_over_n = 2. * pi / n; + BGL_FORALL_VERTICES_T(v, g, VertexListGraph) { + position[v][0] = radius * cos(i * two_pi_over_n); + position[v][1] = radius * sin(i * two_pi_over_n); + ++i; } } } // end namespace boost diff --git a/Utilities/BGL/boost/graph/closeness_centrality.hpp b/Utilities/BGL/boost/graph/closeness_centrality.hpp new file mode 100644 index 0000000000000000000000000000000000000000..77cea7b0e775602b7bf53ef871bd7fba85b864fb --- /dev/null +++ b/Utilities/BGL/boost/graph/closeness_centrality.hpp @@ -0,0 +1,157 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CLOSENESS_CENTRALITY_HPP +#define BOOST_GRAPH_CLOSENESS_CENTRALITY_HPP + +#include <boost/graph/detail/geodesic.hpp> +#include <boost/graph/exterior_property.hpp> + +namespace boost +{ +template <typename Graph, + typename DistanceType, + typename ResultType, + typename Reciprocal = detail::reciprocal<ResultType> > +struct closeness_measure + : public geodesic_measure<Graph, DistanceType, ResultType> +{ + typedef geodesic_measure< Graph, DistanceType, ResultType> base_type; + typedef typename base_type::distance_type distance_type; + typedef typename base_type::result_type result_type; + + result_type operator ()(distance_type d, const Graph&) + { + function_requires< NumericValueConcept<DistanceType> >(); + function_requires< NumericValueConcept<ResultType> >(); + function_requires< AdaptableUnaryFunctionConcept<Reciprocal,ResultType,ResultType> >(); + return (d == base_type::infinite_distance()) + ? base_type::zero_result() + : rec(result_type(d)); + } + Reciprocal rec; +}; + +template <typename Graph, typename DistanceMap> +inline closeness_measure< + Graph, typename property_traits<DistanceMap>::value_type, double, + detail::reciprocal<double> > +measure_closeness(const Graph&, DistanceMap) +{ + typedef typename property_traits<DistanceMap>::value_type Distance; + return closeness_measure<Graph, Distance, double, detail::reciprocal<double> >(); +} + +template <typename T, typename Graph, typename DistanceMap> +inline closeness_measure< + Graph, typename property_traits<DistanceMap>::value_type, T, + detail::reciprocal<T> > +measure_closeness(const Graph&, DistanceMap) +{ + typedef typename property_traits<DistanceMap>::value_type Distance; + return closeness_measure<Graph, Distance, T, detail::reciprocal<T> >(); +} + +template <typename T, typename Graph, typename DistanceMap, typename Reciprocal> +inline closeness_measure< + Graph, typename property_traits<DistanceMap>::value_type, T, + Reciprocal> +measure_closeness(const Graph&, DistanceMap) +{ + typedef typename property_traits<DistanceMap>::value_type Distance; + return closeness_measure<Graph, Distance, T, Reciprocal>(); +} + +template <typename Graph, + typename DistanceMap, + typename Measure, + typename Combinator> +inline typename Measure::result_type +closeness_centrality(const Graph& g, + DistanceMap dist, + Measure measure, + Combinator combine) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >(); + typedef typename property_traits<DistanceMap>::value_type Distance; + function_requires< NumericValueConcept<Distance> >(); + function_requires< DistanceMeasureConcept<Measure,Graph> >(); + + Distance n = detail::combine_distances(g, dist, combine, Distance(0)); + return measure(n, g); +} + +template <typename Graph, typename DistanceMap, typename Measure> +inline typename Measure::result_type +closeness_centrality(const Graph& g, DistanceMap dist, Measure measure) +{ + function_requires< GraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >(); + typedef typename property_traits<DistanceMap>::value_type Distance; + + return closeness_centrality(g, dist, measure, std::plus<Distance>()); +} + +template <typename Graph, typename DistanceMap> +inline double closeness_centrality(const Graph& g, DistanceMap dist) +{ return closeness_centrality(g, dist, measure_closeness(g, dist)); } + +template <typename T, typename Graph, typename DistanceMap> +inline T closeness_centrality(const Graph& g, DistanceMap dist) +{ return closeness_centrality(g, dist, measure_closeness<T>(g, dist)); } + +template <typename Graph, + typename DistanceMatrixMap, + typename CentralityMap, + typename Measure> +inline void +all_closeness_centralities(const Graph& g, + DistanceMatrixMap dist, + CentralityMap cent, + Measure measure) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >(); + typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap; + function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >(); + function_requires< WritablePropertyMapConcept<CentralityMap,Vertex> >(); + typedef typename property_traits<DistanceMap>::value_type Distance; + typedef typename property_traits<CentralityMap>::value_type Centrality; + + typename graph_traits<Graph>::vertex_iterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + DistanceMap dm = get(dist, *i); + Centrality c = closeness_centrality(g, dm, measure); + put(cent, *i, c); + } +} + +template <typename Graph, + typename DistanceMatrixMap, + typename CentralityMap> +inline void +all_closeness_centralities(const Graph& g, + DistanceMatrixMap dist, + CentralityMap cent) +{ + function_requires< GraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >(); + typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap; + function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >(); + typedef typename property_traits<DistanceMap>::value_type Distance; + typedef typename property_traits<CentralityMap>::value_type Result; + + all_closeness_centralities(g, dist, cent, measure_closeness<Result>(g, DistanceMap())); +} + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/clustering_coefficient.hpp b/Utilities/BGL/boost/graph/clustering_coefficient.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e5f94d9fa0aae9fc1b56385bd0090debd57743d4 --- /dev/null +++ b/Utilities/BGL/boost/graph/clustering_coefficient.hpp @@ -0,0 +1,158 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP +#define BOOST_GRAPH_CLUSTERING_COEFFICIENT_HPP + +#include <boost/utility.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_concepts.hpp> +#include <boost/graph/lookup_edge.hpp> + +namespace boost +{ +namespace detail +{ + template <class Graph> + inline typename graph_traits<Graph>::degree_size_type + possible_edges(const Graph& g, std::size_t k, directed_tag) + { + function_requires< GraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::degree_size_type T; + return T(k) * (T(k) - 1); + } + + template <class Graph> + inline typename graph_traits<Graph>::degree_size_type + possible_edges(const Graph& g, size_t k, undirected_tag) + { + // dirty little trick... + return possible_edges(g, k, directed_tag()) / 2; + } + + // This template matches directedS and bidirectionalS. + template <class Graph> + inline typename graph_traits<Graph>::degree_size_type + count_edges(const Graph& g, + typename Graph::vertex_descriptor u, + typename Graph::vertex_descriptor v, + directed_tag) + + { + function_requires< AdjacencyMatrixConcept<Graph> >(); + return (lookup_edge(u, v, g).second ? 1 : 0) + + (lookup_edge(v, u, g).second ? 1 : 0); + } + + // This template matches undirectedS + template <class Graph> + inline typename graph_traits<Graph>::degree_size_type + count_edges(const Graph& g, + typename Graph::vertex_descriptor u, + typename Graph::vertex_descriptor v, + undirected_tag) + { + function_requires< AdjacencyMatrixConcept<Graph> >(); + return lookup_edge(u, v, g).second ? 1 : 0; + } +} + +template <typename Graph, typename Vertex> +inline typename graph_traits<Graph>::degree_size_type +num_paths_through_vertex(const Graph& g, Vertex v) +{ + function_requires< AdjacencyGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::directed_category Directed; + typedef typename graph_traits<Graph>::adjacency_iterator AdjacencyIterator; + + // TODO: There should actually be a set of neighborhood functions + // for things like this (num_neighbors() would be great). + + AdjacencyIterator i, end; + tie(i, end) = adjacent_vertices(v, g); + std::size_t k = std::distance(i, end); + return detail::possible_edges(g, k, Directed()); +} + +template <typename Graph, typename Vertex> +inline typename graph_traits<Graph>::degree_size_type +num_triangles_on_vertex(const Graph& g, Vertex v) +{ + function_requires< IncidenceGraphConcept<Graph> >(); + function_requires< AdjacencyGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::degree_size_type Degree; + typedef typename graph_traits<Graph>::directed_category Directed; + typedef typename graph_traits<Graph>::adjacency_iterator AdjacencyIterator; + + // TODO: I might be able to reduce the requirement from adjacency graph + // to incidence graph by using out edges. + + Degree count(0); + AdjacencyIterator i, j, end; + for(tie(i, end) = adjacent_vertices(v, g); i != end; ++i) { + for(j = boost::next(i); j != end; ++j) { + count += detail::count_edges(g, *i, *j, Directed()); + } + } + return count; +} /* namespace detail */ + +template <typename T, typename Graph, typename Vertex> +inline T +clustering_coefficient(const Graph& g, Vertex v) +{ + T zero(0); + T routes = T(num_paths_through_vertex(g, v)); + return (routes > zero) ? + T(num_triangles_on_vertex(g, v)) / routes : zero; +} + +template <typename Graph, typename Vertex> +inline double +clustering_coefficient(const Graph& g, Vertex v) +{ return clustering_coefficient<double>(g, v); } + +template <typename Graph, typename ClusteringMap> +inline typename property_traits<ClusteringMap>::value_type +all_clustering_coefficients(const Graph& g, ClusteringMap cm) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + function_requires< WritablePropertyMapConcept<ClusteringMap,Vertex> >(); + typedef typename property_traits<ClusteringMap>::value_type Coefficient; + + Coefficient sum(0); + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + Coefficient cc = clustering_coefficient<Coefficient>(g, *i); + put(cm, *i, cc); + sum += cc; + } + return sum / Coefficient(num_vertices(g)); +} + +template <typename Graph, typename ClusteringMap> +inline typename property_traits<ClusteringMap>::value_type +mean_clustering_coefficient(const Graph& g, ClusteringMap cm) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept<ClusteringMap,Vertex> >(); + typedef typename property_traits<ClusteringMap>::value_type Coefficient; + + Coefficient cc(0); + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + cc += get(cm, *i); + } + return cc / Coefficient(num_vertices(g)); +} + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/compressed_sparse_row_graph.hpp b/Utilities/BGL/boost/graph/compressed_sparse_row_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b62b3b26607b9c5a2f5db24988fc2a719c25c3f --- /dev/null +++ b/Utilities/BGL/boost/graph/compressed_sparse_row_graph.hpp @@ -0,0 +1,1516 @@ +// Copyright 2005-2009 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine + +// Compressed sparse row graph type + +#ifndef BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP +#define BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP + +#include <vector> +#include <utility> +#include <algorithm> +#include <climits> +#include <cassert> +#include <iterator> +#if 0 +#include <iostream> // For some debugging code below +#endif +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/properties.hpp> +#include <boost/graph/filtered_graph.hpp> // For keep_all +#include <boost/graph/detail/indexed_properties.hpp> +#include <boost/graph/detail/compressed_sparse_row_struct.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/iterator/counting_iterator.hpp> +#include <boost/iterator/reverse_iterator.hpp> +#include <boost/iterator/zip_iterator.hpp> +#include <boost/iterator/transform_iterator.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/integer.hpp> +#include <boost/iterator/iterator_facade.hpp> +#include <boost/mpl/if.hpp> +#include <boost/graph/graph_selectors.hpp> +#include <boost/static_assert.hpp> +#include <boost/functional/hash.hpp> +#include <boost/utility.hpp> + +#ifdef BOOST_GRAPH_NO_BUNDLED_PROPERTIES +# error The Compressed Sparse Row graph only supports bundled properties. +# error You will need a compiler that conforms better to the C++ standard. +#endif + +namespace boost { + +// A tag type indicating that the graph in question is a compressed +// sparse row graph. This is an internal detail of the BGL. +struct csr_graph_tag; + +// A type (edges_are_sorted_t) and a value (edges_are_sorted) used to indicate +// that the edge list passed into the CSR graph is already sorted by source +// vertex. +enum edges_are_sorted_t {edges_are_sorted}; + +// A type (edges_are_sorted_global_t) and a value (edges_are_sorted_global) +// used to indicate that the edge list passed into the CSR graph is already +// sorted by source vertex. +enum edges_are_sorted_global_t {edges_are_sorted_global}; + +// A type (edges_are_unsorted_t) and a value (edges_are_unsorted) used to +// indicate that the edge list passed into the CSR graph is not sorted by +// source vertex. This version caches the edge information in memory, and thus +// requires only a single pass over the input data. +enum edges_are_unsorted_t {edges_are_unsorted}; + +// A type (edges_are_unsorted_multi_pass_t) and a value +// (edges_are_unsorted_multi_pass) used to indicate that the edge list passed +// into the CSR graph is not sorted by source vertex. This version uses less +// memory but requires multi-pass capability on the iterators. +enum edges_are_unsorted_multi_pass_t {edges_are_unsorted_multi_pass}; + +// A type (edges_are_unsorted_multi_pass_global_t) and a value +// (edges_are_unsorted_multi_pass_global) used to indicate that the edge list +// passed into the CSR graph is not sorted by source vertex. This version uses +// less memory but requires multi-pass capability on the iterators. The +// global mapping and filtering is done here because it is often faster and it +// greatly simplifies handling of edge properties. +enum edges_are_unsorted_multi_pass_global_t {edges_are_unsorted_multi_pass_global}; + +// A type (construct_inplace_from_sources_and_targets_t) and a value +// (construct_inplace_from_sources_and_targets) used to indicate that mutable +// vectors of sources and targets (and possibly edge properties) are being used +// to construct the CSR graph. These vectors are sorted in-place and then the +// targets and properties are swapped into the graph data structure. +enum construct_inplace_from_sources_and_targets_t {construct_inplace_from_sources_and_targets}; + +// A type (construct_inplace_from_sources_and_targets_global_t) and a value +// (construct_inplace_from_sources_and_targets_global) used to indicate that +// mutable vectors of sources and targets (and possibly edge properties) are +// being used to construct the CSR graph. These vectors are sorted in-place +// and then the targets and properties are swapped into the graph data +// structure. It is assumed that global indices (for distributed CSR) are +// used, and a map is required to convert those to local indices. This +// constructor is intended for internal use by the various CSR graphs +// (sequential and distributed). +enum construct_inplace_from_sources_and_targets_global_t {construct_inplace_from_sources_and_targets_global}; + +// A type (edges_are_unsorted_global_t) and a value (edges_are_unsorted_global) +// used to indicate that the edge list passed into the CSR graph is not sorted +// by source vertex. The data is also stored using global vertex indices, and +// must be filtered to choose only local vertices. This constructor caches the +// edge information in memory, and thus requires only a single pass over the +// input data. This constructor is intended for internal use by the +// distributed CSR constructors. +enum edges_are_unsorted_global_t {edges_are_unsorted_global}; + +/**************************************************************************** + * Local helper macros to reduce typing and clutter later on. * + ****************************************************************************/ +#define BOOST_CSR_GRAPH_TEMPLATE_PARMS \ + typename Directed, typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename Vertex, typename EdgeIndex +#define BOOST_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph<Directed, VertexProperty, EdgeProperty, \ + GraphProperty, Vertex, EdgeIndex> +#define BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS \ + typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename Vertex, typename EdgeIndex +#define BOOST_DIR_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph<directedS, VertexProperty, EdgeProperty, \ + GraphProperty, Vertex, EdgeIndex> +#define BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS \ + typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename Vertex, typename EdgeIndex +#define BOOST_BIDIR_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph<bidirectionalS, VertexProperty, EdgeProperty, \ + GraphProperty, Vertex, EdgeIndex> + +namespace detail { + template <typename T> + struct default_construct_iterator: public boost::iterator_facade<default_construct_iterator<T>, T, boost::random_access_traversal_tag, const T&> { + typedef boost::iterator_facade<default_construct_iterator<T>, T, std::random_access_iterator_tag, const T&> base_type; + T saved_value; + const T& dereference() const {return saved_value;} + bool equal(default_construct_iterator i) const {return true;} + void increment() {} + void decrement() {} + void advance(typename base_type::difference_type) {} + typename base_type::difference_type distance_to(default_construct_iterator) const {return 0;} + }; + + template <typename Less> + struct compare_first { + Less less; + compare_first(Less less = Less()): less(less) {} + template <typename Tuple> + bool operator()(const Tuple& a, const Tuple& b) const { + return less(a.template get<0>(), b.template get<0>()); + } + }; + + template <int N, typename Result> + struct my_tuple_get_class { + typedef const Result& result_type; + template <typename Tuple> + result_type operator()(const Tuple& t) const { + return t.template get<N>(); + } + }; +} + +/** Compressed sparse row graph. + * + * Vertex and EdgeIndex should be unsigned integral types and should + * specialize numeric_limits. + */ +template<typename Directed = directedS, + typename VertexProperty = no_property, + typename EdgeProperty = no_property, + typename GraphProperty = no_property, + typename Vertex = std::size_t, + typename EdgeIndex = Vertex> +class compressed_sparse_row_graph; // Not defined + +template<typename VertexProperty, + typename EdgeProperty, + typename GraphProperty, + typename Vertex, + typename EdgeIndex> +class compressed_sparse_row_graph<directedS, VertexProperty, EdgeProperty, GraphProperty, Vertex, EdgeIndex> + : public detail::indexed_vertex_properties<BOOST_DIR_CSR_GRAPH_TYPE, + VertexProperty, Vertex> +{ + public: + typedef detail::indexed_vertex_properties<compressed_sparse_row_graph, + VertexProperty, Vertex> + inherited_vertex_properties; + + public: + // For Property Graph + typedef GraphProperty graph_property_type; + + typedef detail::compressed_sparse_row_structure<EdgeProperty, Vertex, EdgeIndex> forward_type; + + public: + /* At this time, the compressed sparse row graph can only be used to + * create directed and bidirectional graphs. In the future, + * undirected CSR graphs will also be supported. + */ + // BOOST_STATIC_ASSERT((is_same<Directed, directedS>::value)); + + // Concept requirements: + // For Graph + typedef Vertex vertex_descriptor; + typedef detail::csr_edge_descriptor<Vertex, EdgeIndex> edge_descriptor; + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + + class traversal_category: public incidence_graph_tag, + public adjacency_graph_tag, + public vertex_list_graph_tag, + public edge_list_graph_tag {}; + + static vertex_descriptor null_vertex() { return vertex_descriptor(-1); } + + // For VertexListGraph + typedef counting_iterator<Vertex> vertex_iterator; + typedef Vertex vertices_size_type; + + // For EdgeListGraph + typedef EdgeIndex edges_size_type; + + // For IncidenceGraph + typedef detail::csr_out_edge_iterator<compressed_sparse_row_graph> out_edge_iterator; + typedef EdgeIndex degree_size_type; + + // For AdjacencyGraph + typedef typename std::vector<Vertex>::const_iterator adjacency_iterator; + + // For EdgeListGraph + typedef detail::csr_edge_iterator<compressed_sparse_row_graph> edge_iterator; + + // For BidirectionalGraph (not implemented) + typedef void in_edge_iterator; + + // For internal use + typedef csr_graph_tag graph_tag; + + typedef typename forward_type::inherited_edge_properties::edge_bundled edge_bundled; + typedef typename forward_type::inherited_edge_properties::edge_push_back_type edge_push_back_type; + typedef typename forward_type::inherited_edge_properties::edge_property_type edge_property_type; + + // Constructors + + // Default constructor: an empty graph. + compressed_sparse_row_graph(): m_property() {} + + // With numverts vertices + compressed_sparse_row_graph(vertices_size_type numverts) + : inherited_vertex_properties(numverts), m_forward(numverts) {} + + // From number of vertices and unsorted list of edges + template <typename MultiPassInputIterator> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numverts, identity_property_map(), keep_all()); + } + + // From number of vertices and unsorted list of edges, plus edge properties + template <typename MultiPassInputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numverts, identity_property_map(), keep_all()); + } + + // From number of vertices and unsorted list of edges, with filter and + // global-to-local map + template <typename MultiPassInputIterator, typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numlocalverts, global_to_local, source_pred); + } + + // From number of vertices and unsorted list of edges, plus edge properties, + // with filter and global-to-local map + template <typename MultiPassInputIterator, typename EdgePropertyIterator, typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numlocalverts, global_to_local, source_pred); + } + + // From number of vertices and sorted list of edges (new interface) + template<typename InputIterator> + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges = 0, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, identity_property_map(), keep_all(), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and sorted list of edges (new interface) + template<typename InputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + edges_size_type numedges = 0, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, ep_iter, identity_property_map(), keep_all(), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and sorted list of edges, filtered and global (new interface) + template<typename InputIterator, typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_sorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, global_to_local, source_pred, numverts, 0); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and sorted list of edges (new interface) + template<typename InputIterator, typename EdgePropertyIterator, typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_sorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : m_property(prop) + { + m_forward.assign_from_sorted_edges(edge_begin, edge_end, ep_iter, global_to_local, source_pred, numverts, 0); + inherited_vertex_properties::resize(numverts); + } + + // From number of vertices and mutable vectors of sources and targets; + // vectors are returned with unspecified contents but are guaranteed not to + // share storage with the constructed graph. + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_t, + std::vector<vertex_descriptor>& sources, + std::vector<vertex_descriptor>& targets, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, numverts, boost::identity_property_map()); + } + + // From number of vertices and mutable vectors of sources and targets, + // expressed with global vertex indices; vectors are returned with + // unspecified contents but are guaranteed not to share storage with the + // constructed graph. This constructor should only be used by the + // distributed CSR graph. + template <typename GlobalToLocal> + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_global_t, + std::vector<vertex_descriptor>& sources, + std::vector<vertex_descriptor>& targets, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, numlocalverts, global_to_local); + } + + // From number of vertices and mutable vectors of sources, targets, and edge + // properties; vectors are returned with unspecified contents but are + // guaranteed not to share storage with the constructed graph. + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_t, + std::vector<vertex_descriptor>& sources, + std::vector<vertex_descriptor>& targets, + std::vector<typename forward_type::inherited_edge_properties::edge_bundled>& edge_props, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numverts, boost::identity_property_map()); + } + + // From number of vertices and mutable vectors of sources and targets and + // edge properties, expressed with global vertex indices; vectors are + // returned with unspecified contents but are guaranteed not to share + // storage with the constructed graph. This constructor should only be used + // by the distributed CSR graph. + template <typename GlobalToLocal> + compressed_sparse_row_graph(construct_inplace_from_sources_and_targets_global_t, + std::vector<vertex_descriptor>& sources, + std::vector<vertex_descriptor>& targets, + std::vector<typename forward_type::inherited_edge_properties::edge_bundled>& edge_props, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numlocalverts, global_to_local); + } + + // From number of vertices and single-pass range of unsorted edges. Data is + // cached in coordinate form before creating the actual graph. + template<typename InputIterator> + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + std::vector<vertex_descriptor> sources, targets; + boost::graph::detail::split_into_separate_coords + (edge_begin, edge_end, sources, targets); + m_forward.assign_sources_and_targets_global(sources, targets, numverts, boost::identity_property_map()); + } + + // From number of vertices and single-pass range of unsorted edges and + // single-pass range of edge properties. Data is cached in coordinate form + // before creating the actual graph. + template<typename InputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + std::vector<vertex_descriptor> sources, targets; + boost::graph::detail::split_into_separate_coords + (edge_begin, edge_end, sources, targets); + size_t numedges = sources.size(); + std::vector<typename forward_type::inherited_edge_properties::edge_bundled> edge_props(numedges); + for (size_t i = 0; i < numedges; ++i) { + edge_props[i] = *ep_iter++; + } + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numverts, boost::identity_property_map()); + } + + // From number of vertices and single-pass range of unsorted edges. Data is + // cached in coordinate form before creating the actual graph. Edges are + // filtered and transformed for use in a distributed graph. + template<typename InputIterator, typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_unsorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + std::vector<vertex_descriptor> sources, targets; + boost::graph::detail::split_into_separate_coords_filtered + (edge_begin, edge_end, sources, targets, source_pred); + m_forward.assign_sources_and_targets_global(sources, targets, numlocalverts, global_to_local); + } + + // From number of vertices and single-pass range of unsorted edges and + // single-pass range of edge properties. Data is cached in coordinate form + // before creating the actual graph. Edges are filtered and transformed for + // use in a distributed graph. + template<typename InputIterator, typename EdgePropertyIterator, + typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_unsorted_global_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + GlobalToLocal global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_property(prop) + { + std::vector<vertex_descriptor> sources, targets; + std::vector<edge_bundled> edge_props; + boost::graph::detail::split_into_separate_coords_filtered + (edge_begin, edge_end, ep_iter, sources, targets, edge_props, source_pred); + m_forward.assign_sources_and_targets_global(sources, targets, edge_props, numlocalverts, global_to_local); + } + + + // Requires IncidenceGraph and a vertex index map + template<typename Graph, typename VertexIndexMap> + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, + edges_size_type numedges) + : m_property() + { + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires VertexListGraph and EdgeListGraph + template<typename Graph, typename VertexIndexMap> + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi) + : m_property() + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires vertex index map plus requirements of previous constructor + template<typename Graph> + explicit compressed_sparse_row_graph(const Graph& g) + : m_property() + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + assign(g, get(vertex_index, g), num_vertices(g), numedges); + } + + // From any graph (slow and uses a lot of memory) + // Requires IncidenceGraph and a vertex index map + // Internal helper function + // Note that numedges must be doubled for undirected source graphs + template<typename Graph, typename VertexIndexMap> + void + assign(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, edges_size_type numedges) + { + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus VertexListGraph and EdgeListGraph + template<typename Graph, typename VertexIndexMap> + void assign(const Graph& g, const VertexIndexMap& vi) + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus a vertex_index map. + template<typename Graph> + void assign(const Graph& g) + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, get(vertex_index, g), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template <typename BidirectionalIteratorOrig, typename EPIterOrig, + typename GlobalToLocal> + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + template <typename BidirectionalIteratorOrig, typename EPIterOrig> + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, identity_property_map()); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template <typename BidirectionalIteratorOrig> + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator<edge_bundled>()); + } + + template <typename BidirectionalIteratorOrig, typename GlobalToLocal> + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator<edge_bundled>(), global_to_local); + } + + template <typename BidirectionalIteratorOrig, typename EPIterOrig, + typename GlobalToLocal> + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template <typename InputIterator, typename GlobalToLocal> + inline void + add_edges_internal(InputIterator first, InputIterator last, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename boost::graph_traits<Graph>::vertices_size_type vertex_num; + typedef typename boost::graph_traits<Graph>::edges_size_type edge_num; + typedef std::vector<std::pair<vertex_t, vertex_t> > edge_vector_t; + edge_vector_t new_edges(first, last); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end()); + this->add_edges_sorted_internal_global(new_edges.begin(), new_edges.end(), global_to_local); + } + + template <typename InputIterator> + inline void + add_edges_internal(InputIterator first, InputIterator last) { + this->add_edges_internal(first, last, identity_property_map()); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template <typename InputIterator, typename EPIterator, typename GlobalToLocal> + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename boost::graph_traits<Graph>::vertices_size_type vertex_num; + typedef typename boost::graph_traits<Graph>::edges_size_type edge_num; + typedef std::pair<vertex_t, vertex_t> vertex_pair; + typedef std::vector< + boost::tuple<vertex_pair, + edge_bundled> > + edge_vector_t; + edge_vector_t new_edges + (boost::make_zip_iterator(boost::make_tuple(first, ep_iter)), + boost::make_zip_iterator(boost::make_tuple(last, ep_iter_end))); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end(), + boost::detail::compare_first< + std::less<vertex_pair> >()); + m_forward.add_edges_sorted_internal + (boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.end(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class + <1, edge_bundled>()), + global_to_local); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template <typename InputIterator, typename EPIterator> + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end) { + this->add_edges_internal(first, last, ep_iter, ep_iter_end, identity_property_map()); + } + + using inherited_vertex_properties::operator[]; + + // Directly access a edge or edge bundle + edge_push_back_type& operator[](const edge_descriptor& v) + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + const edge_push_back_type& operator[](const edge_descriptor& v) const + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + // private: non-portable, requires friend templates + inherited_vertex_properties& vertex_properties() {return *this;} + const inherited_vertex_properties& vertex_properties() const {return *this;} + typename forward_type::inherited_edge_properties& edge_properties() { return m_forward; } + const typename forward_type::inherited_edge_properties& edge_properties() const { return m_forward; } + + forward_type m_forward; + GraphProperty m_property; +}; + +template<typename VertexProperty, + typename EdgeProperty, + typename GraphProperty, + typename Vertex, + typename EdgeIndex> +class compressed_sparse_row_graph<bidirectionalS, VertexProperty, EdgeProperty, GraphProperty, Vertex, EdgeIndex> + : public detail::indexed_vertex_properties<BOOST_BIDIR_CSR_GRAPH_TYPE, + VertexProperty, Vertex> +{ + public: + typedef detail::indexed_vertex_properties<compressed_sparse_row_graph, + VertexProperty, Vertex> + inherited_vertex_properties; + + public: + // For Property Graph + typedef GraphProperty graph_property_type; + + typedef detail::compressed_sparse_row_structure<EdgeProperty, Vertex, EdgeIndex> forward_type; + typedef EdgeIndex /* typename boost::mpl::if_c<boost::is_same<EdgeProperty, boost::no_property>, boost::no_property, EdgeIndex> */ backward_edge_property; + typedef detail::compressed_sparse_row_structure<backward_edge_property, Vertex, EdgeIndex> backward_type; + + public: + // Concept requirements: + // For Graph + typedef Vertex vertex_descriptor; + typedef detail::csr_edge_descriptor<Vertex, EdgeIndex> edge_descriptor; + typedef bidirectional_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + + class traversal_category: public bidirectional_graph_tag, + public adjacency_graph_tag, + public vertex_list_graph_tag, + public edge_list_graph_tag {}; + + static vertex_descriptor null_vertex() { return vertex_descriptor(-1); } + + // For VertexListGraph + typedef counting_iterator<Vertex> vertex_iterator; + typedef Vertex vertices_size_type; + + // For EdgeListGraph + typedef EdgeIndex edges_size_type; + + // For IncidenceGraph + typedef detail::csr_out_edge_iterator<compressed_sparse_row_graph> out_edge_iterator; + typedef EdgeIndex degree_size_type; + + // For AdjacencyGraph + typedef typename std::vector<Vertex>::const_iterator adjacency_iterator; + + // For EdgeListGraph + typedef detail::csr_edge_iterator<compressed_sparse_row_graph> edge_iterator; + + // For BidirectionalGraph (not implemented) + typedef detail::csr_in_edge_iterator<compressed_sparse_row_graph> in_edge_iterator; + + // For internal use + typedef csr_graph_tag graph_tag; + + typedef typename forward_type::inherited_edge_properties::edge_bundled edge_bundled; + typedef typename forward_type::inherited_edge_properties::edge_push_back_type edge_push_back_type; + typedef typename forward_type::inherited_edge_properties::edge_property_type edge_property_type; + + // Constructors + + // Default constructor: an empty graph. + compressed_sparse_row_graph(): m_property() {} + + // With numverts vertices + compressed_sparse_row_graph(vertices_size_type numverts) + : inherited_vertex_properties(numverts), + m_forward(numverts), m_backward(numverts) {} + + private: + + void set_up_backward_property_links() { + std::pair<edge_iterator, edge_iterator> e = edges(*this); + m_backward.assign_unsorted_multi_pass_edges + (detail::transpose_edges( + detail::make_edge_to_index_pair_iter + (*this, get(vertex_index, *this), e.first)), + detail::transpose_edges( + detail::make_edge_to_index_pair_iter + (*this, get(vertex_index, *this), e.second)), + boost::counting_iterator<EdgeIndex>(0), + m_forward.m_rowstart.size() - 1, + identity_property_map(), + keep_all()); + } + + public: + + // From number of vertices and unsorted list of edges + template <typename MultiPassInputIterator> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numverts, identity_property_map(), keep_all()); + set_up_backward_property_links(); + } + + // From number of vertices and unsorted list of edges, plus edge properties + template <typename MultiPassInputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numverts, identity_property_map(), keep_all()); + set_up_backward_property_links(); + } + + // From number of vertices and unsorted list of edges, with filter and + // global-to-local map + template <typename MultiPassInputIterator, typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, numlocalverts, global_to_local, source_pred); + set_up_backward_property_links(); + } + + // From number of vertices and unsorted list of edges, plus edge properties, + // with filter and global-to-local map + template <typename MultiPassInputIterator, typename EdgePropertyIterator, typename GlobalToLocal, typename SourcePred> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_global_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + const GraphProperty& prop = GraphProperty()) + : inherited_vertex_properties(numlocalverts), m_forward(), m_property(prop) + { + m_forward.assign_unsorted_multi_pass_edges(edge_begin, edge_end, ep_iter, numlocalverts, global_to_local, source_pred); + set_up_backward_property_links(); + } + + // Requires IncidenceGraph and a vertex index map + template<typename Graph, typename VertexIndexMap> + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, + edges_size_type numedges) + : m_property() + { + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires VertexListGraph and EdgeListGraph + template<typename Graph, typename VertexIndexMap> + compressed_sparse_row_graph(const Graph& g, const VertexIndexMap& vi) + : m_property() + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires vertex index map plus requirements of previous constructor + template<typename Graph> + explicit compressed_sparse_row_graph(const Graph& g) + : m_property() + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + assign(g, get(vertex_index, g), num_vertices(g), numedges); + } + + // From any graph (slow and uses a lot of memory) + // Requires IncidenceGraph and a vertex index map + // Internal helper function + // Note that numedges must be doubled for undirected source graphs + template<typename Graph, typename VertexIndexMap> + void + assign(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, edges_size_type numedges) + { + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus VertexListGraph and EdgeListGraph + template<typename Graph, typename VertexIndexMap> + void assign(const Graph& g, const VertexIndexMap& vi) + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, vi, numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Requires the above, plus a vertex_index map. + template<typename Graph> + void assign(const Graph& g) + { + typename graph_traits<Graph>::edges_size_type numedges = num_edges(g); + if (is_same<typename graph_traits<Graph>::directed_category, undirectedS>::value) { + numedges *= 2; // Double each edge (actual doubling done by out_edges function) + } + vertices_size_type numverts = num_vertices(g); + m_forward.assign(g, get(vertex_index, g), numverts, numedges); + inherited_vertex_properties::resize(numverts); + } + + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template <typename BidirectionalIteratorOrig, typename EPIterOrig, + typename GlobalToLocal> + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + template <typename BidirectionalIteratorOrig, typename EPIterOrig> + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, identity_property_map()); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template <typename BidirectionalIteratorOrig> + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator<edge_bundled>()); + } + + template <typename BidirectionalIteratorOrig, typename GlobalToLocal> + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator<edge_bundled>(), global_to_local); + } + + template <typename BidirectionalIteratorOrig, typename EPIterOrig, + typename GlobalToLocal> + void + add_edges_sorted_internal_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + m_forward.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template <typename InputIterator, typename GlobalToLocal> + inline void + add_edges_internal(InputIterator first, InputIterator last, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename boost::graph_traits<Graph>::vertices_size_type vertex_num; + typedef typename boost::graph_traits<Graph>::edges_size_type edge_num; + typedef std::vector<std::pair<vertex_t, vertex_t> > edge_vector_t; + edge_vector_t new_edges(first, last); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end()); + this->add_edges_sorted_internal_global(new_edges.begin(), new_edges.end(), global_to_local); + } + + template <typename InputIterator> + inline void + add_edges_internal(InputIterator first, InputIterator last) { + this->add_edges_internal(first, last, identity_property_map()); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template <typename InputIterator, typename EPIterator, typename GlobalToLocal> + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + const GlobalToLocal& global_to_local) { + typedef compressed_sparse_row_graph Graph; + typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename boost::graph_traits<Graph>::vertices_size_type vertex_num; + typedef typename boost::graph_traits<Graph>::edges_size_type edge_num; + typedef std::pair<vertex_t, vertex_t> vertex_pair; + typedef std::vector< + boost::tuple<vertex_pair, + edge_bundled> > + edge_vector_t; + edge_vector_t new_edges + (boost::make_zip_iterator(boost::make_tuple(first, ep_iter)), + boost::make_zip_iterator(boost::make_tuple(last, ep_iter_end))); + if (new_edges.empty()) return; + std::sort(new_edges.begin(), new_edges.end(), + boost::detail::compare_first< + std::less<vertex_pair> >()); + m_forward.add_edges_sorted_internal + (boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.end(), + boost::detail::my_tuple_get_class<0, vertex_pair>()), + boost::make_transform_iterator( + new_edges.begin(), + boost::detail::my_tuple_get_class + <1, edge_bundled>()), + global_to_local); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template <typename InputIterator, typename EPIterator> + inline void + add_edges_internal(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end) { + this->add_edges_internal(first, last, ep_iter, ep_iter_end, identity_property_map()); + } + + using inherited_vertex_properties::operator[]; + + // Directly access a edge or edge bundle + edge_push_back_type& operator[](const edge_descriptor& v) + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + const edge_push_back_type& operator[](const edge_descriptor& v) const + { return m_forward.m_edge_properties[get(edge_index, *this, v)]; } + + // private: non-portable, requires friend templates + inherited_vertex_properties& vertex_properties() {return *this;} + const inherited_vertex_properties& vertex_properties() const {return *this;} + typename forward_type::inherited_edge_properties& edge_properties() { return m_forward; } + const typename forward_type::inherited_edge_properties& edge_properties() const { return m_forward; } + + forward_type m_forward; + backward_type m_backward; + GraphProperty m_property; +}; + +// Construction functions +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +add_vertex(BOOST_CSR_GRAPH_TYPE& g) { + add_vertex(g, typename BOOST_CSR_GRAPH_TYPE::vertex_bundled()); +} + +template<BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +add_vertex(BOOST_DIR_CSR_GRAPH_TYPE& g, + typename BOOST_DIR_CSR_GRAPH_TYPE::vertex_bundled const& p) { + Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); + g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back()); + g.vertex_properties().push_back(p); + return old_num_verts_plus_one - 1; +} + +template<BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +add_vertex(BOOST_BIDIR_CSR_GRAPH_TYPE& g, + typename BOOST_BIDIR_CSR_GRAPH_TYPE::vertex_bundled const& p) { + Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); + g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back()); + g.m_backward.m_rowstart.push_back(g.m_backward.m_rowstart.back()); + g.vertex_properties().push_back(p); + return old_num_verts_plus_one - 1; +} + +template<BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +add_vertices(typename BOOST_DIR_CSR_GRAPH_TYPE::vertices_size_type count, BOOST_DIR_CSR_GRAPH_TYPE& g) { + Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size(); + EdgeIndex numedges = g.m_forward.m_rowstart.back(); + g.m_forward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); + g.m_backward.m_rowstart.resize(old_num_verts_plus_one + count, numedges); + g.vertex_properties().resize(num_vertices(g)); + return old_num_verts_plus_one - 1; +} + + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, typename BidirectionalIteratorOrig, + typename EPIterOrig> + void + add_edges_sorted( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal(first_sorted, last_sorted, ep_iter_sorted); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, typename BidirectionalIteratorOrig> + void + add_edges_sorted( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal(first_sorted, last_sorted); + } + + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, typename BidirectionalIteratorOrig, + typename EPIterOrig, typename GlobalToLocal> + void + add_edges_sorted_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal_global(first_sorted, last_sorted, ep_iter_sorted, + global_to_local); + } + + // Add edges from a sorted (smallest sources first) range of pairs + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, typename BidirectionalIteratorOrig, + typename GlobalToLocal> + void + add_edges_sorted_global( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + const GlobalToLocal& global_to_local, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_sorted_internal_global(first_sorted, last_sorted, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, typename InputIterator, + typename GlobalToLocal> + inline void + add_edges_global(InputIterator first, InputIterator last, + const GlobalToLocal& global_to_local, BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last, global_to_local); + } + + // Add edges from a range of (source, target) pairs that are unsorted + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, typename InputIterator> + inline void + add_edges(InputIterator first, InputIterator last, BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last); + } + + // Add edges from a range of (source, target) pairs and edge properties that + // are unsorted + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, + typename InputIterator, typename EPIterator> + inline void + add_edges(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last, ep_iter, ep_iter_end); + } + + template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, + typename InputIterator, typename EPIterator, typename GlobalToLocal> + inline void + add_edges_global(InputIterator first, InputIterator last, + EPIterator ep_iter, EPIterator ep_iter_end, + const GlobalToLocal& global_to_local, + BOOST_DIR_CSR_GRAPH_TYPE& g) { + g.add_edges_internal(first, last, ep_iter, ep_iter_end, global_to_local); + } + +// From VertexListGraph +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +num_vertices(const BOOST_CSR_GRAPH_TYPE& g) { + return g.m_forward.m_rowstart.size() - 1; +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +std::pair<counting_iterator<Vertex>, counting_iterator<Vertex> > +inline vertices(const BOOST_CSR_GRAPH_TYPE& g) { + return std::make_pair(counting_iterator<Vertex>(0), + counting_iterator<Vertex>(num_vertices(g))); +} + +// From IncidenceGraph +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +source(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_CSR_GRAPH_TYPE&) +{ + return e.src; +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +target(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_CSR_GRAPH_TYPE& g) +{ + return g.m_forward.m_column[e.idx]; +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator, + typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator> +out_edges(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_CSR_GRAPH_TYPE::edge_descriptor ed; + typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator it; + EdgeIndex v_row_start = g.m_forward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; + return std::make_pair(it(ed(v, v_row_start)), + it(ed(v, next_row_start))); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline EdgeIndex +out_degree(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) +{ + EdgeIndex v_row_start = g.m_forward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; + return next_row_start - v_row_start; +} + +template<BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_BIDIR_CSR_GRAPH_TYPE::in_edge_iterator, + typename BOOST_BIDIR_CSR_GRAPH_TYPE::in_edge_iterator> +in_edges(Vertex v, const BOOST_BIDIR_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_BIDIR_CSR_GRAPH_TYPE::edge_descriptor ed; + typedef typename BOOST_BIDIR_CSR_GRAPH_TYPE::in_edge_iterator it; + EdgeIndex v_row_start = g.m_backward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_backward.m_rowstart[v + 1]; + return std::make_pair(it(ed(v, v_row_start)), + it(ed(v, next_row_start))); +} + +template<BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS> +inline EdgeIndex +in_degree(Vertex v, const BOOST_BIDIR_CSR_GRAPH_TYPE& g) +{ + EdgeIndex v_row_start = g.m_backward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_backward.m_rowstart[v + 1]; + return next_row_start - v_row_start; +} + +// From AdjacencyGraph +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_CSR_GRAPH_TYPE::adjacency_iterator, + typename BOOST_CSR_GRAPH_TYPE::adjacency_iterator> +adjacent_vertices(Vertex v, const BOOST_CSR_GRAPH_TYPE& g) +{ + EdgeIndex v_row_start = g.m_forward.m_rowstart[v]; + EdgeIndex next_row_start = g.m_forward.m_rowstart[v + 1]; + return std::make_pair(g.m_forward.m_column.begin() + v_row_start, + g.m_forward.m_column.begin() + next_row_start); +} + +// Extra, common functions +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline typename graph_traits<BOOST_CSR_GRAPH_TYPE>::vertex_descriptor +vertex(typename graph_traits<BOOST_CSR_GRAPH_TYPE>::vertex_descriptor i, + const BOOST_CSR_GRAPH_TYPE&) +{ + return i; +} + +// edge() can be provided in linear time for the new interface + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_CSR_GRAPH_TYPE::edge_descriptor, bool> +edge(Vertex i, Vertex j, const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; + std::pair<out_edge_iter, out_edge_iter> range = out_edges(i, g); + for (; range.first != range.second; ++range.first) { + if (target(*range.first) == j) + return std::make_pair(*range.first, true); + } + return std::make_pair(typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(), + false); +} + +// Find an edge given its index in the graph +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_CSR_GRAPH_TYPE::edge_descriptor +edge_from_index(EdgeIndex idx, const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename std::vector<EdgeIndex>::const_iterator row_start_iter; + assert (idx < num_edges(g)); + row_start_iter src_plus_1 = + std::upper_bound(g.m_forward.m_rowstart.begin(), + g.m_forward.m_rowstart.end(), + idx); + // Get last source whose rowstart is at most idx + // upper_bound returns this position plus 1 + Vertex src = (src_plus_1 - g.m_forward.m_rowstart.begin()) - 1; + return typename BOOST_CSR_GRAPH_TYPE::edge_descriptor(src, idx); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline EdgeIndex +num_edges(const BOOST_CSR_GRAPH_TYPE& g) +{ + return g.m_forward.m_column.size(); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +std::pair<typename BOOST_CSR_GRAPH_TYPE::edge_iterator, + typename BOOST_CSR_GRAPH_TYPE::edge_iterator> +edges(const BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_CSR_GRAPH_TYPE::edge_iterator ei; + typedef typename BOOST_CSR_GRAPH_TYPE::edge_descriptor edgedesc; + if (g.m_forward.m_rowstart.size() == 1 || g.m_forward.m_column.empty()) { + return std::make_pair(ei(), ei()); + } else { + // Find the first vertex that has outgoing edges + Vertex src = 0; + while (g.m_forward.m_rowstart[src + 1] == 0) ++src; + return std::make_pair(ei(g, edgedesc(src, 0), g.m_forward.m_rowstart[src + 1]), + ei(g, edgedesc(num_vertices(g), g.m_forward.m_column.size()), 0)); + } +} + +// For Property Graph + +// Graph properties +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS, class Tag, class Value> +inline void +set_property(BOOST_CSR_GRAPH_TYPE& g, Tag, const Value& value) +{ + get_property_value(g.m_property, Tag()) = value; +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS, class Tag> +inline +typename graph_property<BOOST_CSR_GRAPH_TYPE, Tag>::type& +get_property(BOOST_CSR_GRAPH_TYPE& g, Tag) +{ + return get_property_value(g.m_property, Tag()); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS, class Tag> +inline +const +typename graph_property<BOOST_CSR_GRAPH_TYPE, Tag>::type& +get_property(const BOOST_CSR_GRAPH_TYPE& g, Tag) +{ + return get_property_value(g.m_property, Tag()); +} + +// Add edge_index property map +template<typename Index, typename Descriptor> +struct csr_edge_index_map +{ + typedef Index value_type; + typedef Index reference; + typedef Descriptor key_type; + typedef readable_property_map_tag category; +}; + +template<typename Index, typename Descriptor> +inline Index +get(const csr_edge_index_map<Index, Descriptor>&, + const typename csr_edge_index_map<Index, Descriptor>::key_type& key) +{ + return key.idx; +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +struct property_map<BOOST_CSR_GRAPH_TYPE, vertex_index_t> +{ + typedef identity_property_map type; + typedef type const_type; +}; + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +struct property_map<BOOST_CSR_GRAPH_TYPE, edge_index_t> +{ +private: + typedef typename graph_traits<BOOST_CSR_GRAPH_TYPE>::edge_descriptor + edge_descriptor; + typedef csr_edge_index_map<EdgeIndex, edge_descriptor> edge_index_type; + +public: + typedef edge_index_type type; + typedef type const_type; +}; + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline identity_property_map +get(vertex_index_t, const BOOST_CSR_GRAPH_TYPE&) +{ + return identity_property_map(); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline Vertex +get(vertex_index_t, + const BOOST_CSR_GRAPH_TYPE&, Vertex v) +{ + return v; +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline typename property_map<BOOST_CSR_GRAPH_TYPE, edge_index_t>::const_type +get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&) +{ + typedef typename property_map<BOOST_CSR_GRAPH_TYPE, edge_index_t>::const_type + result_type; + return result_type(); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS> +inline EdgeIndex +get(edge_index_t, const BOOST_CSR_GRAPH_TYPE&, + typename BOOST_CSR_GRAPH_TYPE::edge_descriptor e) +{ + return e.idx; +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename T, typename Bundle> +inline +typename property_map<BOOST_CSR_GRAPH_TYPE, T Bundle::*>::type +get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_CSR_GRAPH_TYPE, + T Bundle::*>::type + result_type; + return result_type(&g, p); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename T, typename Bundle> +inline +typename property_map<BOOST_CSR_GRAPH_TYPE, T Bundle::*>::const_type +get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g) +{ + typedef typename property_map<BOOST_CSR_GRAPH_TYPE, + T Bundle::*>::const_type + result_type; + return result_type(&g, p); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename T, typename Bundle, + typename Key> +inline T +get(T Bundle::* p, BOOST_CSR_GRAPH_TYPE const & g, + const Key& key) +{ + return get(get(p, g), key); +} + +template<BOOST_CSR_GRAPH_TEMPLATE_PARMS, typename T, typename Bundle, + typename Key> +inline void +put(T Bundle::* p, BOOST_CSR_GRAPH_TYPE& g, + const Key& key, const T& value) +{ + put(get(p, g), key, value); +} + +#undef BOOST_CSR_GRAPH_TYPE +#undef BOOST_CSR_GRAPH_TEMPLATE_PARMS +#undef BOOST_DIR_CSR_GRAPH_TYPE +#undef BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS +#undef BOOST_BIDIR_CSR_GRAPH_TYPE +#undef BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS + +} // end namespace boost + +#endif // BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP diff --git a/Utilities/BGL/boost/graph/connected_components.hpp b/Utilities/BGL/boost/graph/connected_components.hpp index df9084ce360266fbc6d4df3fec2d044ebe72ac5a..90015e6703d833838b09e1768945da0bac56eabf 100644 --- a/Utilities/BGL/boost/graph/connected_components.hpp +++ b/Utilities/BGL/boost/graph/connected_components.hpp @@ -15,7 +15,7 @@ #include <boost/graph/depth_first_search.hpp> #include <boost/graph/properties.hpp> #include <boost/graph/graph_concepts.hpp> - +#include <boost/graph/overloading.hpp> #include <boost/static_assert.hpp> namespace boost { @@ -58,7 +58,8 @@ namespace boost { template <class Graph, class ComponentMap, class P, class T, class R> inline typename property_traits<ComponentMap>::value_type connected_components(const Graph& g, ComponentMap c, - const bgl_named_params<P, T, R>& params) + const bgl_named_params<P, T, R>& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag)) { if (num_vertices(g) == 0) return 0; @@ -77,14 +78,15 @@ namespace boost { template <class Graph, class ComponentMap> inline typename property_traits<ComponentMap>::value_type - connected_components(const Graph& g, ComponentMap c) + connected_components(const Graph& g, ComponentMap c + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag)) { if (num_vertices(g) == 0) return 0; typedef typename graph_traits<Graph>::vertex_descriptor Vertex; function_requires< WritablePropertyMapConcept<ComponentMap, Vertex> >(); typedef typename boost::graph_traits<Graph>::directed_category directed; - BOOST_STATIC_ASSERT((boost::is_same<directed, undirected_tag>::value)); + // BOOST_STATIC_ASSERT((boost::is_same<directed, undirected_tag>::value)); typedef typename property_traits<ComponentMap>::value_type comp_type; // c_count initialized to "nil" (with nil represented by (max)()) @@ -97,5 +99,8 @@ namespace boost { } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/connected_components.hpp> +#endif #endif // BOOST_GRAPH_CONNECTED_COMPONENTS_HPP diff --git a/Utilities/BGL/boost/graph/copy.hpp b/Utilities/BGL/boost/graph/copy.hpp index fd98a426a42a292e7f82e34ed388d822db10e4b5..c566503af0b4fe538a97091fb748e4b6f119e789 100644 --- a/Utilities/BGL/boost/graph/copy.hpp +++ b/Utilities/BGL/boost/graph/copy.hpp @@ -44,7 +44,7 @@ #include <boost/config.hpp> #include <vector> #include <boost/graph/graph_traits.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/named_function_params.hpp> #include <boost/graph/breadth_first_search.hpp> #include <boost/type_traits/conversion_traits.hpp> diff --git a/Utilities/BGL/boost/graph/core_numbers.hpp b/Utilities/BGL/boost/graph/core_numbers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..da072bf1eb9670148f1ab026820d8b786eddce97 --- /dev/null +++ b/Utilities/BGL/boost/graph/core_numbers.hpp @@ -0,0 +1,350 @@ +// +//======================================================================= +// Copyright 2007 Stanford University +// Authors: David Gleich +// +// 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_CORE_NUMBERS_HPP +#define BOOST_GRAPH_CORE_NUMBERS_HPP + +#include <boost/pending/mutable_queue.hpp> +#include <boost/pending/indirect_cmp.hpp> +#include <boost/graph/breadth_first_search.hpp> +#include <boost/iterator/reverse_iterator.hpp> + +/* + * core_numbers + * + * Requirement: IncidenceGraph + */ + +// History +// +// 30 July 2007 +// Added visitors to the implementation +// +// 8 February 2008 +// Fixed headers and missing typename + +namespace boost { + + // A linear time O(m) algorithm to compute the indegree core number + // of a graph for unweighted graphs. + // + // and a O((n+m) log n) algorithm to compute the in-edge-weight core + // numbers of a weighted graph. + // + // The linear algorithm comes from: + // Vladimir Batagelj and Matjaz Zaversnik, "An O(m) Algorithm for Cores + // Decomposition of Networks." Sept. 1 2002. + + template <typename Visitor, typename Graph> + struct CoreNumbersVisitorConcept { + void constraints() + { + function_requires< CopyConstructibleConcept<Visitor> >(); + vis.examine_vertex(u,g); + vis.finish_vertex(u,g); + vis.examine_edge(e,g); + } + Visitor vis; + Graph g; + typename graph_traits<Graph>::vertex_descriptor u; + typename graph_traits<Graph>::edge_descriptor e; + }; + + template <class Visitors = null_visitor> + class core_numbers_visitor : public bfs_visitor<Visitors> { + public: + core_numbers_visitor() {} + core_numbers_visitor(Visitors vis) + : bfs_visitor<Visitors>(vis) {} + + private: + template <class Vertex, class Graph> + void initialize_vertex(Vertex, Graph&) {} + + template <class Vertex, class Graph> + void discover_vertex(Vertex , Graph&) {} + + template <class Vertex, class Graph> + void gray_target(Vertex, Graph&) {} + + template <class Vertex, class Graph> + void black_target(Vertex, Graph&) {} + + template <class Edge, class Graph> + void tree_edge(Edge, Graph&) {} + + template <class Edge, class Graph> + void non_tree_edge(Edge, Graph&) {} + }; + + template <class Visitors> + core_numbers_visitor<Visitors> make_core_numbers_visitor(Visitors vis) + { return core_numbers_visitor<Visitors>(vis); } + + typedef core_numbers_visitor<> default_core_numbers_visitor; + + namespace detail { + + // implement a constant_property_map to simplify compute_in_degree + // for the weighted and unweighted case + // this is based on dummy property map + template <typename ValueType> + class constant_value_property_map + : public boost::put_get_helper<ValueType, + constant_value_property_map<ValueType> > + { + public: + typedef void key_type; + typedef ValueType value_type; + typedef const ValueType& reference; + typedef boost::readable_property_map_tag category; + inline constant_value_property_map(ValueType cc) : c(cc) { } + inline constant_value_property_map(const constant_value_property_map<ValueType>& x) + : c(x.c) { } + template <class Vertex> + inline reference operator[](Vertex) const { return c; } + protected: + ValueType c; + }; + + + // the core numbers start as the indegree or inweight. This function + // will initialize these values + template <typename Graph, typename CoreMap, typename EdgeWeightMap> + void compute_in_degree_map(Graph& g, CoreMap d, EdgeWeightMap wm) + { + typename graph_traits<Graph>::vertex_iterator vi,vi_end; + typename graph_traits<Graph>::out_edge_iterator ei,ei_end; + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + put(d,*vi,0); + } + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + for (tie(ei,ei_end) = out_edges(*vi,g); ei!=ei_end; ++ei) { + put(d,target(*ei,g),get(d,target(*ei,g))+get(wm,*ei)); + } + } + } + + // the version for weighted graphs is a little different + template <typename Graph, typename CoreMap, + typename EdgeWeightMap, typename MutableQueue, + typename Visitor> + typename property_traits<CoreMap>::value_type + core_numbers_impl(Graph& g, CoreMap c, EdgeWeightMap wm, + MutableQueue& Q, Visitor vis) + { + typename property_traits<CoreMap>::value_type v_cn = 0; + typedef typename graph_traits<Graph>::vertex_descriptor vertex; + while (!Q.empty()) + { + // remove v from the Q, and then decrease the core numbers + // of its successors + vertex v = Q.top(); + vis.examine_vertex(v,g); + Q.pop(); + v_cn = get(c,v); + typename graph_traits<Graph>::out_edge_iterator oi,oi_end; + for (tie(oi,oi_end) = out_edges(v,g); oi!=oi_end; ++oi) { + vis.examine_edge(*oi,g); + vertex u = target(*oi,g); + // if c[u] > c[v], then u is still in the graph, + if (get(c,u) > v_cn) { + // remove the edge + put(c,u,get(c,u)-get(wm,*oi)); + Q.update(u); + } + } + vis.finish_vertex(v,g); + } + return (v_cn); + } + + template <typename Graph, typename CoreMap, typename EdgeWeightMap, + typename IndexMap, typename CoreNumVisitor> + typename property_traits<CoreMap>::value_type + core_numbers_dispatch(Graph&g, CoreMap c, EdgeWeightMap wm, + IndexMap im, CoreNumVisitor vis) + { + typedef typename property_traits<CoreMap>::value_type D; + typedef std::less<D> Cmp; + typedef indirect_cmp<CoreMap,Cmp > IndirectCmp; + IndirectCmp icmp(c, Cmp()); + // build the mutable queue + typedef typename graph_traits<Graph>::vertex_descriptor vertex; + typedef mutable_queue<vertex, std::vector<vertex>, IndirectCmp, + IndexMap> MutableQueue; + MutableQueue Q(num_vertices(g), icmp, im); + typename graph_traits<Graph>::vertex_iterator vi,vi_end; + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + Q.push(*vi); + } + return core_numbers_impl(g, c, wm, Q, vis); + } + + // the version for the unweighted case + // for this functions CoreMap must be initialized + // with the in degree of each vertex + template <typename Graph, typename CoreMap, typename PositionMap, + typename Visitor> + typename property_traits<CoreMap>::value_type + core_numbers_impl(Graph& g, CoreMap c, PositionMap pos, Visitor vis) + { + typedef typename graph_traits<Graph>::vertices_size_type size_type; + typedef typename graph_traits<Graph>::degree_size_type degree_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex; + typename graph_traits<Graph>::vertex_iterator vi,vi_end; + + // store the vertex core numbers + typename property_traits<CoreMap>::value_type v_cn = 0; + + // compute the maximum degree (degrees are in the coremap) + typename graph_traits<Graph>::degree_size_type max_deg = 0; + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + max_deg = (std::max<typename graph_traits<Graph>::degree_size_type>)(max_deg, get(c,*vi)); + } + + // store the vertices in bins by their degree + // allocate two extra locations to ease boundary cases + std::vector<size_type> bin(max_deg+2); + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + ++bin[get(c,*vi)]; + } + + // this loop sets bin[d] to the starting position of vertices + // with degree d in the vert array for the bucket sort + size_type cur_pos = 0; + for (degree_type cur_deg = 0; cur_deg < max_deg+2; ++cur_deg) { + degree_type tmp = bin[cur_deg]; + bin[cur_deg] = cur_pos; + cur_pos += tmp; + } + + // perform the bucket sort with pos and vert so that + // pos[0] is the vertex of smallest degree + std::vector<vertex> vert(num_vertices(g)); + for (tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) { + vertex v=*vi; + size_type p=bin[get(c,v)]; + put(pos,v,p); + vert[p]=v; + ++bin[get(c,v)]; + } + // we ``abused'' bin while placing the vertices, now, + // we need to restore it + std::copy(boost::make_reverse_iterator(bin.end()-2), + boost::make_reverse_iterator(bin.begin()), + boost::make_reverse_iterator(bin.end()-1)); + // now simulate removing the vertices + for (size_type i=0; i < num_vertices(g); ++i) { + vertex v = vert[i]; + vis.examine_vertex(v,g); + v_cn = get(c,v); + typename graph_traits<Graph>::out_edge_iterator oi,oi_end; + for (tie(oi,oi_end) = out_edges(v,g); oi!=oi_end; ++oi) { + vis.examine_edge(*oi,g); + vertex u = target(*oi,g); + // if c[u] > c[v], then u is still in the graph, + if (get(c,u) > v_cn) { + degree_type deg_u = get(c,u); + degree_type pos_u = get(pos,u); + // w is the first vertex with the same degree as u + // (this is the resort operation!) + degree_type pos_w = bin[deg_u]; + vertex w = vert[pos_w]; + if (u!=v) { + // swap u and w + put(pos,u,pos_w); + put(pos,w,pos_u); + vert[pos_w] = u; + vert[pos_u] = w; + } + // now, the vertices array is sorted assuming + // we perform the following step + // start the set of vertices with degree of u + // one into the future (this now points at vertex + // w which we swapped with u). + ++bin[deg_u]; + // we are removing v from the graph, so u's degree + // decreases + put(c,u,get(c,u)-1); + } + } + vis.finish_vertex(v,g); + } + return v_cn; + } + + } // namespace detail + + // non-named parameter version for the unweighted case + template <typename Graph, typename CoreMap, typename CoreNumVisitor> + typename property_traits<CoreMap>::value_type + core_numbers(Graph& g, CoreMap c, CoreNumVisitor vis) + { + typedef typename graph_traits<Graph>::vertices_size_type size_type; + detail::compute_in_degree_map(g,c, + detail::constant_value_property_map< + typename property_traits<CoreMap>::value_type>(1) ); + return detail::core_numbers_impl(g,c, + make_iterator_property_map( + std::vector<size_type>(num_vertices(g)).begin(),get(vertex_index, g)), + vis + ); + } + + // non-named paramter version for the unweighted case + template <typename Graph, typename CoreMap> + typename property_traits<CoreMap>::value_type + core_numbers(Graph& g, CoreMap c) + { + return core_numbers(g, c, make_core_numbers_visitor(null_visitor())); + } + + // non-named parameter version for the weighted case + template <typename Graph, typename CoreMap, typename EdgeWeightMap, + typename VertexIndexMap, typename CoreNumVisitor> + typename property_traits<CoreMap>::value_type + core_numbers(Graph& g, CoreMap c, EdgeWeightMap wm, VertexIndexMap vim, + CoreNumVisitor vis) + { + typedef typename graph_traits<Graph>::vertices_size_type size_type; + detail::compute_in_degree_map(g,c,wm); + return detail::core_numbers_dispatch(g,c,wm,vim,vis); + } + + // non-named parameter version for the weighted case +// template <typename Graph, typename CoreMap, typename EdgeWeightMap> +// typename property_traits<CoreMap>::value_type +// core_numbers(Graph& g, CoreMap c, EdgeWeightMap wm) +// { +// typedef typename graph_traits<Graph>::vertices_size_type size_type; +// detail::compute_in_degree_map(g,c,wm); +// return detail::core_numbers_dispatch(g,c,wm,get(vertex_index,g), +// make_core_numbers_visitor(null_visitor())); +// } + + template <typename Graph, typename CoreMap> + typename property_traits<CoreMap>::value_type + weighted_core_numbers(Graph& g, CoreMap c) + { + return weighted_core_numbers( + g,c, make_core_numbers_visitor(null_visitor()) + ); + } + + template <typename Graph, typename CoreMap, typename CoreNumVisitor> + typename property_traits<CoreMap>::value_type + weighted_core_numbers(Graph& g, CoreMap c, CoreNumVisitor vis) + { return core_numbers(g,c,get(edge_weight,g),get(vertex_index,g),vis); } + +} // namespace boost + +#endif // BOOST_GRAPH_CORE_NUMBERS_HPP + diff --git a/Utilities/BGL/boost/graph/create_condensation_graph.hpp b/Utilities/BGL/boost/graph/create_condensation_graph.hpp index f3d1113a3dc2c35985eb8b12a7fc741b404dc5bf..4f3316f6a13c3d967f5fe7cc7270027cfdbf2ffd 100644 --- a/Utilities/BGL/boost/graph/create_condensation_graph.hpp +++ b/Utilities/BGL/boost/graph/create_condensation_graph.hpp @@ -11,7 +11,7 @@ #define BOOST_CREATE_CONDENSATION_GRAPH_HPP #include <boost/graph/graph_traits.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> namespace boost { diff --git a/Utilities/BGL/boost/graph/cuthill_mckee_ordering.hpp b/Utilities/BGL/boost/graph/cuthill_mckee_ordering.hpp index 5bfe9c12ab0408fc0bf4623bb26a382c403e2680..c930bab3eeeb3a0a36d0aa63e585af6f9250f3ac 100644 --- a/Utilities/BGL/boost/graph/cuthill_mckee_ordering.hpp +++ b/Utilities/BGL/boost/graph/cuthill_mckee_ordering.hpp @@ -1,35 +1,19 @@ -// //======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2004, 2005 Trustees of Indiana University // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, // Doug Gregor, D. Kevin McGrath // -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. +// 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_CUTHILL_MCKEE_HPP #define BOOST_GRAPH_CUTHILL_MCKEE_HPP #include <boost/config.hpp> #include <boost/graph/detail/sparse_ordering.hpp> +#include <boost/graph/graph_utility.hpp> #include <algorithm> @@ -58,9 +42,9 @@ namespace boost { void finish_vertex(Vertex, Graph&) { using std::sort; - typedef typename property_traits<DegreeMap>::value_type DS; + typedef typename property_traits<DegreeMap>::value_type ds_type; - typedef indirect_cmp<DegreeMap, std::less<DS> > Compare; + typedef indirect_cmp<DegreeMap, std::less<ds_type> > Compare; Compare comp(degree); sort(Qptr->begin()+index_begin, Qptr->end(), comp); @@ -91,7 +75,7 @@ namespace boost { { //create queue, visitor...don't forget namespaces! - typedef typename property_traits<DegreeMap>::value_type DS; + typedef typename property_traits<DegreeMap>::value_type ds_type; typedef typename graph_traits<Graph>::vertex_descriptor Vertex; typedef typename boost::sparse::sparse_ordering_queue<Vertex> queue; typedef typename detail::bfs_rcm_visitor<OutputIterator, queue, DegreeMap> Visitor; @@ -149,7 +133,7 @@ namespace boost { cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, ColorMap color, DegreeMap degree) { - if (vertices(G).first == vertices(G).second) + if (boost::graph::has_no_vertices(G)) return permutation; typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex; @@ -185,7 +169,7 @@ namespace boost { cuthill_mckee_ordering(const Graph& G, OutputIterator permutation, VertexIndexMap index_map) { - if (vertices(G).first == vertices(G).second) + if (boost::graph::has_no_vertices(G)) return permutation; typedef out_degree_property_map<Graph> DegreeMap; diff --git a/Utilities/BGL/boost/graph/dag_shortest_paths.hpp b/Utilities/BGL/boost/graph/dag_shortest_paths.hpp index cc071de1f3cc6211bfecbf9672d3f98488b480e9..d8b47ac62f60018c469f72a05b27005488a5c5c6 100644 --- a/Utilities/BGL/boost/graph/dag_shortest_paths.hpp +++ b/Utilities/BGL/boost/graph/dag_shortest_paths.hpp @@ -83,7 +83,7 @@ namespace boost { dag_sp_dispatch2 (const VertexListGraph& g, typename graph_traits<VertexListGraph>::vertex_descriptor s, - DistanceMap distance, WeightMap weight, ColorMap color, IndexMap id, + DistanceMap distance, WeightMap weight, ColorMap color, IndexMap /*id*/, DijkstraVisitor vis, const Params& params) { typedef typename property_traits<DistanceMap>::value_type D; diff --git a/Utilities/BGL/boost/graph/degree_centrality.hpp b/Utilities/BGL/boost/graph/degree_centrality.hpp new file mode 100644 index 0000000000000000000000000000000000000000..24ecb6c511a5db69a1d92f308fe71489322c4cb6 --- /dev/null +++ b/Utilities/BGL/boost/graph/degree_centrality.hpp @@ -0,0 +1,130 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DEGREE_CENTRALITY_HPP +#define BOOST_GRAPH_DEGREE_CENTRALITY_HPP + +#include <boost/graph/graph_concepts.hpp> + +namespace boost { + +template <typename Graph> +struct degree_centrality_measure +{ + typedef typename graph_traits<Graph>::degree_size_type degree_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_type; +}; + +template <typename Graph> +struct influence_measure + : public degree_centrality_measure<Graph> +{ + typedef degree_centrality_measure<Graph> base_type; + typedef typename base_type::degree_type degree_type; + typedef typename base_type::vertex_type vertex_type; + + inline degree_type operator ()(vertex_type v, const Graph& g) + { + function_requires< IncidenceGraphConcept<Graph> >(); + return out_degree(v, g); + } +}; + +template <typename Graph> +inline influence_measure<Graph> +measure_influence(const Graph&) +{ return influence_measure<Graph>(); } + + +template <typename Graph> +struct prestige_measure + : public degree_centrality_measure<Graph> +{ + typedef degree_centrality_measure<Graph> base_type; + typedef typename base_type::degree_type degree_type; + typedef typename base_type::vertex_type vertex_type; + + inline degree_type operator ()(vertex_type v, const Graph& g) + { + function_requires< BidirectionalGraphConcept<Graph> >(); + return in_degree(v, g); + } +}; + +template <typename Graph> +inline prestige_measure<Graph> +measure_prestige(const Graph&) +{ return prestige_measure<Graph>(); } + + +template <typename Graph, typename Vertex, typename Measure> +inline typename Measure::degree_type +degree_centrality(const Graph& g, Vertex v, Measure measure) +{ + function_requires< DegreeMeasureConcept<Measure, Graph> >(); + return measure(v, g); +} + +template <typename Graph, typename Vertex> +inline typename graph_traits<Graph>::degree_size_type +degree_centrality(const Graph& g, Vertex v) +{ + return degree_centrality(g, v, measure_influence(g)); +} + + +// These are alias functions, intended to provide a more expressive interface. + +template <typename Graph, typename Vertex> +inline typename graph_traits<Graph>::degree_size_type +influence(const Graph& g, Vertex v) +{ return degree_centrality(g, v, measure_influence(g)); } + + +template <typename Graph, typename Vertex> +inline typename graph_traits<Graph>::degree_size_type +prestige(const Graph& g, Vertex v) +{ return degree_centrality(g, v, measure_prestige(g)); } + + +template <typename Graph, typename CentralityMap, typename Measure> +inline void +all_degree_centralities(const Graph& g, CentralityMap cent, Measure measure) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + function_requires< WritablePropertyMapConcept<CentralityMap,Vertex> >(); + typedef typename property_traits<CentralityMap>::value_type Centrality; + + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + Centrality c = degree_centrality(g, *i, measure); + put(cent, *i, c); + } +} + +template <typename Graph, typename CentralityMap> +inline void all_degree_centralities(const Graph& g, CentralityMap cent) +{ all_degree_centralities(g, cent, measure_influence(g)); } + +// More helper functions for computing influence and prestige. +// I hate the names of these functions, but influence and prestige +// don't pluralize too well. + +template <typename Graph, typename CentralityMap> +inline void all_influence_values(const Graph& g, CentralityMap cent) +{ all_degree_centralities(g, cent, measure_influence(g)); } + +template <typename Graph, typename CentralityMap> +inline void all_prestige_values(const Graph& g, CentralityMap cent) +{ all_degree_centralities(g, cent, measure_prestige(g)); } + +} /* namespace boost */ + +#endif + + diff --git a/Utilities/BGL/boost/graph/depth_first_search.hpp b/Utilities/BGL/boost/graph/depth_first_search.hpp index 588aa83fddde43cc759fc368d1239d81e85fbdbf..fcc616464745220e8ce56bd4a61308704881590f 100644 --- a/Utilities/BGL/boost/graph/depth_first_search.hpp +++ b/Utilities/BGL/boost/graph/depth_first_search.hpp @@ -19,7 +19,6 @@ #include <boost/graph/properties.hpp> #include <boost/graph/visitors.hpp> #include <boost/graph/named_function_params.hpp> - #include <boost/ref.hpp> #include <boost/implicit_cast.hpp> @@ -194,7 +193,8 @@ namespace boost { typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end; for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { - put(color, *ui, Color::white()); vis.initialize_vertex(*ui, g); + Vertex u = implicit_cast<Vertex>(*ui); + put(color, u, Color::white()); vis.initialize_vertex(u, g); } if (start_vertex != implicit_cast<Vertex>(*vertices(g).first)){ vis.start_vertex(start_vertex, g); @@ -203,9 +203,10 @@ namespace boost { } for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { - ColorValue u_color = get(color, *ui); - if (u_color == Color::white()) { vis.start_vertex(*ui, g); - detail::depth_first_visit_impl(g, *ui, vis, color, detail::nontruth2()); + Vertex u = implicit_cast<Vertex>(*ui); + ColorValue u_color = get(color, u); + if (u_color == Color::white()) { vis.start_vertex(u, g); + detail::depth_first_visit_impl(g, u, vis, color, detail::nontruth2()); } } } @@ -214,45 +215,13 @@ namespace boost { void depth_first_search(const VertexListGraph& g, DFSVisitor vis, ColorMap color) { - depth_first_search(g, vis, color, *vertices(g).first); - } - - namespace detail { - template <class ColorMap> - struct dfs_dispatch { - - template <class VertexListGraph, class Vertex, class DFSVisitor, - class P, class T, class R> - static void - apply(const VertexListGraph& g, DFSVisitor vis, Vertex start_vertex, - const bgl_named_params<P, T, R>&, - ColorMap color) - { - depth_first_search(g, vis, color, start_vertex); - } - }; - - template <> - struct dfs_dispatch<detail::error_property_not_found> { - template <class VertexListGraph, class Vertex, class DFSVisitor, - class P, class T, class R> - static void - apply(const VertexListGraph& g, DFSVisitor vis, Vertex start_vertex, - const bgl_named_params<P, T, R>& params, - detail::error_property_not_found) - { - std::vector<default_color_type> color_vec(num_vertices(g)); - default_color_type c = white_color; // avoid warning about un-init - depth_first_search - (g, vis, make_iterator_property_map - (color_vec.begin(), - choose_const_pmap(get_param(params, vertex_index), - g, vertex_index), c), - start_vertex); - } - }; - } // namespace detail + typedef typename boost::graph_traits<VertexListGraph>::vertex_iterator vi; + std::pair<vi, vi> verts = vertices(g); + if (verts.first == verts.second) + return; + depth_first_search(g, vis, color, *verts.first); + } template <class Visitors = null_visitor> class dfs_visitor { @@ -312,24 +281,25 @@ namespace boost { } typedef dfs_visitor<> default_dfs_visitor; - // Named Parameter Variant template <class VertexListGraph, class P, class T, class R> void depth_first_search(const VertexListGraph& g, const bgl_named_params<P, T, R>& params) { - typedef typename property_value< bgl_named_params<P, T, R>, - vertex_color_t>::type C; - detail::dfs_dispatch<C>::apply + typedef typename boost::graph_traits<VertexListGraph>::vertex_iterator vi; + std::pair<vi, vi> verts = vertices(g); + if (verts.first == verts.second) + return; + using namespace boost::graph::keywords; + typedef bgl_named_params<P, T, R> params_type; + BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params) + depth_first_search (g, - choose_param(get_param(params, graph_visitor), - make_dfs_visitor(null_visitor())), - choose_param(get_param(params, root_vertex_t()), - *vertices(g).first), - params, - get_param(params, vertex_color) - ); + arg_pack[_visitor | make_dfs_visitor(null_visitor())], + boost::detail::color_map_maker<VertexListGraph, arg_pack_type>::make_map(g, arg_pack), + arg_pack[_root_vertex | *vertices(g).first] + ); } template <class IncidenceGraph, class DFSVisitor, class ColorMap> @@ -352,9 +322,10 @@ namespace boost { vis.start_vertex(u, g); detail::depth_first_visit_impl(g, u, vis, color, func); } - - } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/depth_first_search.hpp> +#endif #endif diff --git a/Utilities/BGL/boost/graph/detail/adjacency_list.hpp b/Utilities/BGL/boost/graph/detail/adjacency_list.hpp index c27b0a6cbbfa78b422007ffd8b97ad6c64882e8d..674942e1ec2c04a3744ee137a3fda23808a108e7 100644 --- a/Utilities/BGL/boost/graph/detail/adjacency_list.hpp +++ b/Utilities/BGL/boost/graph/detail/adjacency_list.hpp @@ -15,7 +15,7 @@ #include <boost/config.hpp> #include <boost/detail/workaround.hpp> #include <boost/operators.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/pending/integer_range.hpp> #include <boost/graph/graph_traits.hpp> #include <memory> @@ -24,13 +24,16 @@ #include <boost/iterator/iterator_adaptor.hpp> -#include <boost/pending/ct_if.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/and.hpp> #include <boost/graph/graph_concepts.hpp> #include <boost/pending/container_traits.hpp> #include <boost/graph/detail/adj_list_edge_iterator.hpp> #include <boost/graph/properties.hpp> #include <boost/pending/property.hpp> #include <boost/graph/adjacency_iterator.hpp> +#include <boost/static_assert.hpp> // Symbol truncation problems with MSVC, trying to shorten names. #define stored_edge se_ @@ -58,10 +61,14 @@ Note: it would be nice to merge some of the undirected and - bidirectional code... it is aweful similar. + bidirectional code... it is awful similar. */ +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define Graph Graph_ +#endif namespace boost { @@ -133,7 +140,7 @@ namespace boost { , EdgeDescriptor , Difference > super_t; - + inline out_edge_iter() { } inline out_edge_iter(const BaseIter& i, const VertexDescriptor& src) : super_t(i), m_src(src) { } @@ -141,12 +148,12 @@ namespace boost { inline EdgeDescriptor dereference() const { - return EdgeDescriptor(m_src, (*this->base()).get_target(), + return EdgeDescriptor(m_src, (*this->base()).get_target(), &(*this->base()).get_property()); } VertexDescriptor m_src; }; - + template <class BaseIter, class VertexDescriptor, class EdgeDescriptor, class Difference> struct in_edge_iter : iterator_adaptor< @@ -166,9 +173,9 @@ namespace boost { , EdgeDescriptor , Difference > super_t; - + inline in_edge_iter() { } - inline in_edge_iter(const BaseIter& i, const VertexDescriptor& src) + inline in_edge_iter(const BaseIter& i, const VertexDescriptor& src) : super_t(i), m_src(src) { } inline EdgeDescriptor @@ -204,10 +211,10 @@ namespace boost { > super_t; undirected_edge_iter() {} - + explicit undirected_edge_iter(EdgeIter i) : super_t(i) {} - + inline EdgeDescriptor dereference() const { return EdgeDescriptor( @@ -261,11 +268,11 @@ namespace boost { inline stored_edge_property(Vertex target, const Property& p = Property()) : stored_edge<Vertex>(target), m_property(new Property(p)) { } - stored_edge_property(const self& x) + stored_edge_property(const self& x) : Base(x), m_property(const_cast<self&>(x).m_property) { } self& operator=(const self& x) { Base::operator=(x); - m_property = const_cast<self&>(x).m_property; + m_property = const_cast<self&>(x).m_property; return *this; } inline Property& get_property() { return *m_property; } @@ -291,7 +298,7 @@ namespace boost { inline stored_edge_iter(Vertex v, Iter i, void* = 0) : stored_edge<Vertex>(v), m_iter(i) { } inline Property& get_property() { return m_iter->get_property(); } - inline const Property& get_property() const { + inline const Property& get_property() const { return m_iter->get_property(); } inline Iter get_iter() const { return m_iter; } @@ -310,11 +317,11 @@ namespace boost { public: typedef Property property_type; inline stored_ra_edge_iter() { } - inline stored_ra_edge_iter(Vertex v, Iter i = Iter(), + inline stored_ra_edge_iter(Vertex v, Iter i = Iter(), EdgeVec* edge_vec = 0) : stored_edge<Vertex>(v), m_i(i - edge_vec->begin()), m_vec(edge_vec){ } inline Property& get_property() { return (*m_vec)[m_i].get_property(); } - inline const Property& get_property() const { + inline const Property& get_property() const { return (*m_vec)[m_i].get_property(); } inline Iter get_iter() const { return m_vec->begin() + m_i; } @@ -324,7 +331,7 @@ namespace boost { }; } // namespace detail - + template <class Tag, class Vertex, class Property> const typename property_value<Property,Tag>::type& get(Tag property_tag, @@ -348,7 +355,7 @@ namespace boost { { return get_property_value(e.get_property(), property_tag); } - + //========================================================================= // Directed Edges Helper Class @@ -371,7 +378,7 @@ namespace boost { template <class incidence_iterator, class EdgeList, class Predicate> inline void remove_directed_edge_if_dispatch(incidence_iterator first, - incidence_iterator last, + incidence_iterator last, EdgeList& el, Predicate pred, boost::allow_parallel_edge_tag) { @@ -380,7 +387,7 @@ namespace boost { ++first; incidence_iterator i = first; if (first != last) - for (; i != last; ++i) + for (++i; i != last; ++i) if (!pred(*i)) { *first.base() = *i.base(); ++first; @@ -390,8 +397,8 @@ namespace boost { template <class incidence_iterator, class EdgeList, class Predicate> inline void remove_directed_edge_if_dispatch(incidence_iterator first, - incidence_iterator last, - EdgeList& el, + incidence_iterator last, + EdgeList& el, Predicate pred, boost::disallow_parallel_edge_tag) { @@ -403,15 +410,18 @@ namespace boost { } } - template <class PropT, class Graph, class incidence_iterator, + template <class PropT, class Graph, class incidence_iterator, class EdgeList, class Predicate> inline void - undirected_remove_out_edge_if_dispatch(Graph& g, + undirected_remove_out_edge_if_dispatch(Graph& g, incidence_iterator first, - incidence_iterator last, + incidence_iterator last, EdgeList& el, Predicate pred, boost::allow_parallel_edge_tag) { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + // remove_if while (first != last && !pred(*first)) ++first; @@ -434,8 +444,8 @@ namespace boost { else { // Remove the edge from the target detail::remove_directed_edge_dispatch - (*i, - g.out_edge_list(target(*i, g)), + (*i, + g.out_edge_list(target(*i, g)), *(PropT*)(*i).get_property()); } @@ -445,16 +455,19 @@ namespace boost { } el.erase(first.base(), el.end()); } - template <class PropT, class Graph, class incidence_iterator, + template <class PropT, class Graph, class incidence_iterator, class EdgeList, class Predicate> inline void - undirected_remove_out_edge_if_dispatch(Graph& g, + undirected_remove_out_edge_if_dispatch(Graph& g, incidence_iterator first, - incidence_iterator last, - EdgeList& el, + incidence_iterator last, + EdgeList& el, Predicate pred, boost::disallow_parallel_edge_tag) { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + for (incidence_iterator next = first; first != last; first = next) { ++next; @@ -462,8 +475,8 @@ namespace boost { if (source(*first, g) != target(*first, g)) { // Remove the edge from the target detail::remove_directed_edge_dispatch - (*first, - g.out_edge_list(target(*first, g)), + (*first, + g.out_edge_list(target(*first, g)), *(PropT*)(*first).get_property()); } @@ -497,7 +510,7 @@ namespace boost { // Placement of these overloaded remove_edge() functions // inside the class avoids a VC++ bug. - + // O(E/V) inline void remove_edge(typename Config::edge_descriptor e) @@ -525,7 +538,7 @@ namespace boost { // O(1) template <class Config> - inline std::pair<typename Config::edge_iterator, + inline std::pair<typename Config::edge_iterator, typename Config::edge_iterator> edges(const directed_edges_helper<Config>& g_) { @@ -533,8 +546,8 @@ namespace boost { typedef typename Config::edge_iterator edge_iterator; const graph_type& cg = static_cast<const graph_type&>(g_); graph_type& g = const_cast<graph_type&>(cg); - return std::make_pair( edge_iterator(g.vertex_set().begin(), - g.vertex_set().begin(), + return std::make_pair( edge_iterator(g.vertex_set().begin(), + g.vertex_set().begin(), g.vertex_set().end(), g), edge_iterator(g.vertex_set().begin(), g.vertex_set().end(), @@ -552,7 +565,7 @@ namespace boost { template <class Config> struct directed_graph_helper - : public directed_edges_helper<Config> { + : public directed_edges_helper<Config> { typedef typename Config::edge_descriptor edge_descriptor; typedef adj_list_dir_traversal_tag traversal_category; }; @@ -594,7 +607,7 @@ namespace boost { typename Config::vertex_iterator vi, vi_end; for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) remove_out_edge_if(*vi, pred, g); - } + } template <class EdgeOrIter, class Config> inline void @@ -606,7 +619,7 @@ namespace boost { // O(V + E) for allow_parallel_edges // O(V * log(E/V)) for disallow_parallel_edges template <class Config> - inline void + inline void clear_vertex(typename Config::vertex_descriptor u, directed_graph_helper<Config>& g_) { @@ -622,7 +635,7 @@ namespace boost { } template <class Config> - inline void + inline void clear_out_edges(typename Config::vertex_descriptor u, directed_graph_helper<Config>& g_) { @@ -651,27 +664,27 @@ namespace boost { // O(log(E/V)) for disallow_parallel_edge_tag template <class Config> inline std::pair<typename directed_graph_helper<Config>::edge_descriptor, bool> - add_edge(typename Config::vertex_descriptor u, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, - const typename Config::edge_property_type& p, + const typename Config::edge_property_type& p, directed_graph_helper<Config>& g_) { typedef typename Config::edge_descriptor edge_descriptor; typedef typename Config::graph_type graph_type; typedef typename Config::StoredEdge StoredEdge; graph_type& g = static_cast<graph_type&>(g_); - typename Config::OutEdgeList::iterator i; + typename Config::OutEdgeList::iterator i; bool inserted; - boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), + boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), StoredEdge(v, p)); - return std::make_pair(edge_descriptor(u, v, &(*i).get_property()), + return std::make_pair(edge_descriptor(u, v, &(*i).get_property()), inserted); } // Did not use default argument here because that // causes Visual C++ to get confused. template <class Config> inline std::pair<typename Config::edge_descriptor, bool> - add_edge(typename Config::vertex_descriptor u, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, directed_graph_helper<Config>& g_) { @@ -684,7 +697,7 @@ namespace boost { template <class Config> struct undirected_graph_helper; - struct undir_adj_list_traversal_tag : + struct undir_adj_list_traversal_tag : public virtual vertex_list_graph_tag, public virtual incidence_graph_tag, public virtual adjacency_graph_tag, @@ -700,13 +713,16 @@ namespace boost { // O(E/V) template <class edge_descriptor, class Config> static void - apply(edge_descriptor e, - undirected_graph_helper<Config>& g_, + apply(edge_descriptor e, + undirected_graph_helper<Config>& g_, StoredProperty& p) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(g_); - + typename Config::OutEdgeList& out_el = g.out_edge_list(source(e, g)); typename Config::OutEdgeList::iterator out_i = out_el.begin(); for (; out_i != out_el.end(); ++out_i) @@ -734,6 +750,9 @@ namespace boost { undirected_graph_helper<Config>& g_, no_property&) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(g_); no_property* p = (no_property*)e.get_property(); @@ -758,22 +777,36 @@ namespace boost { // O(E/V) template <class Graph, class EdgeList, class Vertex> inline void - remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, + remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, boost::allow_parallel_edge_tag cat) { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename EdgeList::value_type StoredEdge; typename EdgeList::iterator i = el.begin(), end = el.end(); - for (; i != end; ++i) - if ((*i).get_target() == v) + for (; i != end; ++i) { + if ((*i).get_target() == v) { + // NOTE: Wihtout this skip, this loop will double-delete properties + // of loop edges. This solution is based on the observation that + // the incidence edges of a vertex with a loop are adjacent in the + // out edge list. This *may* actually hold for multisets also. + bool skip = (boost::next(i) != end && i->get_iter() == boost::next(i)->get_iter()); g.m_edges.erase((*i).get_iter()); + if (skip) ++i; + } + } detail::erase_from_incidence_list(el, v, cat); } // O(log(E/V)) template <class Graph, class EdgeList, class Vertex> inline void - remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, + remove_edge_and_property(Graph& g, EdgeList& el, Vertex v, boost::disallow_parallel_edge_tag) { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename EdgeList::value_type StoredEdge; typename EdgeList::iterator i = el.find(StoredEdge(v)), end = el.end(); if (i != end) { @@ -814,6 +847,9 @@ namespace boost { inline void remove_edge(typename Config::edge_descriptor e) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::OutEdgeList::value_type::property_type PType; detail::remove_undirected_edge_dispatch<PType>::apply (e, *this, *(PType*)e.get_property()); @@ -829,15 +865,15 @@ namespace boost { // Had to make these non-members to avoid accidental instantiation // on SGI MIPSpro C++ template <class C> - inline typename C::InEdgeList& - in_edge_list(undirected_graph_helper<C>&, + inline typename C::InEdgeList& + in_edge_list(undirected_graph_helper<C>&, typename C::vertex_descriptor v) { typename C::stored_vertex* sv = (typename C::stored_vertex*)v; return sv->m_out_edges; } template <class C> - inline const typename C::InEdgeList& + inline const typename C::InEdgeList& in_edge_list(const undirected_graph_helper<C>&, typename C::vertex_descriptor v) { typename C::stored_vertex* sv = (typename C::stored_vertex*)v; @@ -849,28 +885,37 @@ namespace boost { inline void remove_edge(EdgeOrIter e, undirected_graph_helper<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + g_.remove_edge(e); } // O(E/V) or O(log(E/V)) template <class Config> void - remove_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + remove_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, undirected_graph_helper<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(g_); typedef typename Config::edge_parallel_category Cat; detail::remove_edge_and_property(g, g.out_edge_list(u), v, Cat()); detail::erase_from_incidence_list(g.out_edge_list(v), u, Cat()); } - + template <class Config, class Predicate> void remove_out_edge_if(typename Config::vertex_descriptor u, Predicate pred, undirected_graph_helper<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; typedef typename Config::OutEdgeList::value_type::property_type PropT; graph_type& g = static_cast<graph_type&>(g_); @@ -885,6 +930,9 @@ namespace boost { remove_in_edge_if(typename Config::vertex_descriptor u, Predicate pred, undirected_graph_helper<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + remove_out_edge_if(u, pred, g_); } @@ -893,6 +941,9 @@ namespace boost { void remove_edge_if(Predicate pred, undirected_graph_helper<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(g_); typename Config::edge_iterator ei, ei_end, next; @@ -906,7 +957,7 @@ namespace boost { // O(1) template <class Config> - inline std::pair<typename Config::edge_iterator, + inline std::pair<typename Config::edge_iterator, typename Config::edge_iterator> edges(const undirected_graph_helper<Config>& g_) { @@ -920,7 +971,7 @@ namespace boost { // O(1) template <class Config> inline typename Config::edges_size_type - num_edges(const undirected_graph_helper<Config>& g_) + num_edges(const undirected_graph_helper<Config>& g_) { typedef typename Config::graph_type graph_type; const graph_type& g = static_cast<const graph_type&>(g_); @@ -928,15 +979,18 @@ namespace boost { } // O(E/V * E/V) template <class Config> - inline void + inline void clear_vertex(typename Config::vertex_descriptor u, undirected_graph_helper<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; typedef typename Config::edge_parallel_category Cat; graph_type& g = static_cast<graph_type&>(g_); typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::iterator + typename Config::OutEdgeList::iterator ei = el.begin(), ei_end = el.end(); for (; ei != ei_end; ++ei) { detail::erase_from_incidence_list @@ -949,8 +1003,8 @@ namespace boost { // O(log(E/V)) for disallow_parallel_edge_tag template <class Config> inline std::pair<typename Config::edge_descriptor, bool> - add_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, const typename Config::edge_property_type& p, undirected_graph_helper<Config>& g_) { @@ -961,11 +1015,11 @@ namespace boost { bool inserted; typename Config::EdgeContainer::value_type e(u, v, p); - g.m_edges.push_back(e); - typename Config::EdgeContainer::iterator p_iter - = boost::prior(g.m_edges.end()); + typename Config::EdgeContainer::iterator p_iter + = graph_detail::push(g.m_edges, e).first; + typename Config::OutEdgeList::iterator i; - boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), + boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), StoredEdge(v, p_iter, &g.m_edges)); if (inserted) { boost::graph_detail::push(g.out_edge_list(v), StoredEdge(u, p_iter, &g.m_edges)); @@ -979,8 +1033,8 @@ namespace boost { } template <class Config> inline std::pair<typename Config::edge_descriptor, bool> - add_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + add_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, undirected_graph_helper<Config>& g_) { typename Config::edge_property_type p; @@ -990,7 +1044,7 @@ namespace boost { // O(1) template <class Config> inline typename Config::degree_size_type - degree(typename Config::vertex_descriptor u, + degree(typename Config::vertex_descriptor u, const undirected_graph_helper<Config>& g_) { typedef typename Config::graph_type Graph; @@ -999,9 +1053,9 @@ namespace boost { } template <class Config> - inline std::pair<typename Config::in_edge_iterator, + inline std::pair<typename Config::in_edge_iterator, typename Config::in_edge_iterator> - in_edges(typename Config::vertex_descriptor u, + in_edges(typename Config::vertex_descriptor u, const undirected_graph_helper<Config>& g_) { typedef typename Config::graph_type Graph; @@ -1022,7 +1076,7 @@ namespace boost { //========================================================================= // Bidirectional Graph Helper Class - struct bidir_adj_list_traversal_tag : + struct bidir_adj_list_traversal_tag : public virtual vertex_list_graph_tag, public virtual incidence_graph_tag, public virtual adjacency_graph_tag, @@ -1038,15 +1092,15 @@ namespace boost { // Had to make these non-members to avoid accidental instantiation // on SGI MIPSpro C++ template <class C> - inline typename C::InEdgeList& - in_edge_list(bidirectional_graph_helper<C>&, + inline typename C::InEdgeList& + in_edge_list(bidirectional_graph_helper<C>&, typename C::vertex_descriptor v) { typename C::stored_vertex* sv = (typename C::stored_vertex*)v; return sv->m_in_edges; } template <class C> - inline const typename C::InEdgeList& + inline const typename C::InEdgeList& in_edge_list(const bidirectional_graph_helper<C>&, typename C::vertex_descriptor v) { typename C::stored_vertex* sv = (typename C::stored_vertex*)v; @@ -1057,6 +1111,9 @@ namespace boost { inline void remove_edge_if(Predicate pred, bidirectional_graph_helper<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(g_); typename Config::edge_iterator ei, ei_end, next; @@ -1069,9 +1126,9 @@ namespace boost { } template <class Config> - inline std::pair<typename Config::in_edge_iterator, + inline std::pair<typename Config::in_edge_iterator, typename Config::in_edge_iterator> - in_edges(typename Config::vertex_descriptor u, + in_edges(typename Config::vertex_descriptor u, const bidirectional_graph_helper<Config>& g_) { typedef typename Config::graph_type graph_type; @@ -1085,7 +1142,7 @@ namespace boost { // O(1) template <class Config> - inline std::pair<typename Config::edge_iterator, + inline std::pair<typename Config::edge_iterator, typename Config::edge_iterator> edges(const bidirectional_graph_helper<Config>& g_) { @@ -1107,7 +1164,7 @@ namespace boost { { typedef typename Config::graph_type graph_type; typedef typename Config::out_edge_iterator out_edge_iterator; - + std::pair<out_edge_iterator, out_edge_iterator> get_parallel_edge_sublist(typename Config::edge_descriptor e, const graph_type& g, @@ -1126,13 +1183,11 @@ namespace boost { multisetS*) { return edge_range(source(e, g), target(e, g), g); } -#if !defined BOOST_NO_HASH std::pair<out_edge_iterator, out_edge_iterator> get_parallel_edge_sublist(typename Config::edge_descriptor e, const graph_type& g, hash_setS*) { return edge_range(source(e, g), target(e, g), g); } -#endif // Placement of these overloaded remove_edge() functions // inside the class avoids a VC++ bug. @@ -1141,11 +1196,14 @@ namespace boost { void remove_edge(typename Config::edge_descriptor e) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + graph_type& g = static_cast<graph_type&>(*this); typedef typename Config::edgelist_selector OutEdgeListS; - std::pair<out_edge_iterator, out_edge_iterator> rng = + std::pair<out_edge_iterator, out_edge_iterator> rng = get_parallel_edge_sublist(e, g, (OutEdgeListS*)(0)); rng.first = std::find(rng.first, rng.second, e); assert(rng.first != rng.second); @@ -1155,6 +1213,9 @@ namespace boost { inline void remove_edge(typename Config::out_edge_iterator iter) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(*this); typename Config::edge_descriptor e = *iter; @@ -1172,10 +1233,13 @@ namespace boost { // O(log(E/V)) for disallow_parallel_edge_tag template <class Config> inline void - remove_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + remove_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, bidirectional_graph_helper_with_property<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(g_); typedef typename Config::edge_parallel_category Cat; @@ -1189,6 +1253,9 @@ namespace boost { remove_edge(EdgeOrIter e, bidirectional_graph_helper_with_property<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + g_.remove_edge(e); } @@ -1197,10 +1264,13 @@ namespace boost { remove_out_edge_if(typename Config::vertex_descriptor u, Predicate pred, bidirectional_graph_helper_with_property<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; typedef typename Config::OutEdgeList::value_type::property_type PropT; graph_type& g = static_cast<graph_type&>(g_); - + typedef typename Config::EdgeIter EdgeIter; typedef std::vector<EdgeIter> Garbage; Garbage garbage; @@ -1235,6 +1305,9 @@ namespace boost { remove_in_edge_if(typename Config::vertex_descriptor v, Predicate pred, bidirectional_graph_helper_with_property<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; typedef typename Config::OutEdgeList::value_type::property_type PropT; graph_type& g = static_cast<graph_type&>(g_); @@ -1271,7 +1344,7 @@ namespace boost { // O(1) template <class Config> inline typename Config::edges_size_type - num_edges(const bidirectional_graph_helper_with_property<Config>& g_) + num_edges(const bidirectional_graph_helper_with_property<Config>& g_) { typedef typename Config::graph_type graph_type; const graph_type& g = static_cast<const graph_type&>(g_); @@ -1284,24 +1357,27 @@ namespace boost { clear_vertex(typename Config::vertex_descriptor u, bidirectional_graph_helper_with_property<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; typedef typename Config::edge_parallel_category Cat; graph_type& g = static_cast<graph_type&>(g_); typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::iterator + typename Config::OutEdgeList::iterator ei = el.begin(), ei_end = el.end(); for (; ei != ei_end; ++ei) { detail::erase_from_incidence_list (in_edge_list(g, (*ei).get_target()), u, Cat()); g.m_edges.erase((*ei).get_iter()); - } + } typename Config::InEdgeList& in_el = in_edge_list(g, u); - typename Config::InEdgeList::iterator + typename Config::InEdgeList::iterator in_ei = in_el.begin(), in_ei_end = in_el.end(); for (; in_ei != in_ei_end; ++in_ei) { detail::erase_from_incidence_list (g.out_edge_list((*in_ei).get_target()), u, Cat()); - g.m_edges.erase((*in_ei).get_iter()); + g.m_edges.erase((*in_ei).get_iter()); } g.out_edge_list(u).clear(); in_edge_list(g, u).clear(); @@ -1312,17 +1388,20 @@ namespace boost { clear_out_edges(typename Config::vertex_descriptor u, bidirectional_graph_helper_with_property<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; typedef typename Config::edge_parallel_category Cat; graph_type& g = static_cast<graph_type&>(g_); typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::iterator + typename Config::OutEdgeList::iterator ei = el.begin(), ei_end = el.end(); for (; ei != ei_end; ++ei) { detail::erase_from_incidence_list (in_edge_list(g, (*ei).get_target()), u, Cat()); g.m_edges.erase((*ei).get_iter()); - } + } g.out_edge_list(u).clear(); } @@ -1331,16 +1410,19 @@ namespace boost { clear_in_edges(typename Config::vertex_descriptor u, bidirectional_graph_helper_with_property<Config>& g_) { + typedef typename Config::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Config::graph_type graph_type; typedef typename Config::edge_parallel_category Cat; graph_type& g = static_cast<graph_type&>(g_); typename Config::InEdgeList& in_el = in_edge_list(g, u); - typename Config::InEdgeList::iterator + typename Config::InEdgeList::iterator in_ei = in_el.begin(), in_ei_end = in_el.end(); for (; in_ei != in_ei_end; ++in_ei) { detail::erase_from_incidence_list (g.out_edge_list((*in_ei).get_target()), u, Cat()); - g.m_edges.erase((*in_ei).get_iter()); + g.m_edges.erase((*in_ei).get_iter()); } in_edge_list(g, u).clear(); } @@ -1350,7 +1432,7 @@ namespace boost { template <class Config> inline std::pair<typename Config::edge_descriptor, bool> add_edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + typename Config::vertex_descriptor v, const typename Config::edge_property_type& p, bidirectional_graph_helper_with_property<Config>& g_) { @@ -1360,20 +1442,19 @@ namespace boost { typedef typename Config::StoredEdge StoredEdge; bool inserted; typename Config::EdgeContainer::value_type e(u, v, p); - g.m_edges.push_back(e); - typename Config::EdgeContainer::iterator p_iter - = boost::prior(g.m_edges.end()); + typename Config::EdgeContainer::iterator p_iter + = graph_detail::push(g.m_edges, e).first; typename Config::OutEdgeList::iterator i; - boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), + boost::tie(i, inserted) = boost::graph_detail::push(g.out_edge_list(u), StoredEdge(v, p_iter, &g.m_edges)); if (inserted) { boost::graph_detail::push(in_edge_list(g, v), StoredEdge(u, p_iter, &g.m_edges)); - return std::make_pair(edge_descriptor(u, v, &p_iter->m_property), + return std::make_pair(edge_descriptor(u, v, &p_iter->m_property), true); } else { g.m_edges.erase(p_iter); - return std::make_pair(edge_descriptor(u, v, - &i->get_iter()->get_property()), + return std::make_pair(edge_descriptor(u, v, + &i->get_iter()->get_property()), false); } } @@ -1390,7 +1471,7 @@ namespace boost { // O(1) template <class Config> inline typename Config::degree_size_type - degree(typename Config::vertex_descriptor u, + degree(typename Config::vertex_descriptor u, const bidirectional_graph_helper_with_property<Config>& g_) { typedef typename Config::graph_type graph_type; @@ -1421,21 +1502,24 @@ namespace boost { typedef typename Config::StoredEdge StoredEdge; typedef typename Config::edge_property_type edge_property_type; + typedef typename Config::global_edgelist_selector + global_edgelist_selector; + // protected: // The edge_dispatch() functions should be static, but // Borland gets confused about constness. // O(E/V) - inline std::pair<edge_descriptor,bool> - edge_dispatch(const AdjList& g, - vertex_descriptor u, vertex_descriptor v, + inline std::pair<edge_descriptor,bool> + edge_dispatch(const AdjList& g, + vertex_descriptor u, vertex_descriptor v, boost::allow_parallel_edge_tag) const { bool found; const typename Config::OutEdgeList& el = g.out_edge_list(u); - typename Config::OutEdgeList::const_iterator - i = std::find_if(el.begin(), el.end(), + typename Config::OutEdgeList::const_iterator + i = std::find_if(el.begin(), el.end(), detail::target_is<vertex_descriptor>(v)); found = (i != g.out_edge_list(u).end()); if (found) @@ -1445,9 +1529,9 @@ namespace boost { return std::make_pair(edge_descriptor(u, v, 0), false); } // O(log(E/V)) - inline std::pair<edge_descriptor,bool> - edge_dispatch(const AdjList& g, - vertex_descriptor u, vertex_descriptor v, + inline std::pair<edge_descriptor,bool> + edge_dispatch(const AdjList& g, + vertex_descriptor u, vertex_descriptor v, boost::disallow_parallel_edge_tag) const { bool found; @@ -1455,7 +1539,7 @@ namespace boost { but the VC++ std::set::find() const returns const_iterator. And since iterator should be convertible to const_iterator, the following should work everywhere. -Jeremy */ - typename Config::OutEdgeList::const_iterator + typename Config::OutEdgeList::const_iterator i = g.out_edge_list(u).find(StoredEdge(v)), end = g.out_edge_list(u).end(); found = (i != end); @@ -1468,9 +1552,9 @@ namespace boost { }; template <class Config, class Base> - inline std::pair<typename Config::adjacency_iterator, + inline std::pair<typename Config::adjacency_iterator, typename Config::adjacency_iterator> - adjacent_vertices(typename Config::vertex_descriptor u, + adjacent_vertices(typename Config::vertex_descriptor u, const adj_list_helper<Config, Base>& g_) { typedef typename Config::graph_type AdjList; @@ -1483,9 +1567,9 @@ namespace boost { adjacency_iterator(last, &g)); } template <class Config, class Base> - inline std::pair<typename Config::inv_adjacency_iterator, + inline std::pair<typename Config::inv_adjacency_iterator, typename Config::inv_adjacency_iterator> - inv_adjacent_vertices(typename Config::vertex_descriptor u, + inv_adjacent_vertices(typename Config::vertex_descriptor u, const adj_list_helper<Config, Base>& g_) { typedef typename Config::graph_type AdjList; @@ -1498,9 +1582,9 @@ namespace boost { inv_adjacency_iterator(last, &g)); } template <class Config, class Base> - inline std::pair<typename Config::out_edge_iterator, + inline std::pair<typename Config::out_edge_iterator, typename Config::out_edge_iterator> - out_edges(typename Config::vertex_descriptor u, + out_edges(typename Config::vertex_descriptor u, const adj_list_helper<Config, Base>& g_) { typedef typename Config::graph_type AdjList; @@ -1512,7 +1596,7 @@ namespace boost { out_edge_iterator(g.out_edge_list(u).end(), u)); } template <class Config, class Base> - inline std::pair<typename Config::vertex_iterator, + inline std::pair<typename Config::vertex_iterator, typename Config::vertex_iterator> vertices(const adj_list_helper<Config, Base>& g_) { @@ -1531,7 +1615,7 @@ namespace boost { } template <class Config, class Base> inline typename Config::degree_size_type - out_degree(typename Config::vertex_descriptor u, + out_degree(typename Config::vertex_descriptor u, const adj_list_helper<Config, Base>& g_) { typedef typename Config::graph_type AdjList; @@ -1540,8 +1624,8 @@ namespace boost { } template <class Config, class Base> inline std::pair<typename Config::edge_descriptor, bool> - edge(typename Config::vertex_descriptor u, - typename Config::vertex_descriptor v, + edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, const adj_list_helper<Config, Base>& g_) { typedef typename Config::graph_type Graph; @@ -1564,8 +1648,8 @@ namespace boost { typename Config::OutEdgeList& el = g.out_edge_list(u); typename Config::OutEdgeList::iterator first, last; typename Config::EdgeContainer fake_edge_container; - tie(first, last) = - std::equal_range(el.begin(), el.end(), + tie(first, last) = + std::equal_range(el.begin(), el.end(), StoredEdge(v, fake_edge_container.end(), &fake_edge_container)); return std::make_pair(out_edge_iterator(first, u), @@ -1574,7 +1658,7 @@ namespace boost { template <class Config> inline typename Config::degree_size_type - in_degree(typename Config::vertex_descriptor u, + in_degree(typename Config::vertex_descriptor u, const directed_edges_helper<Config>& g_) { typedef typename Config::graph_type Graph; @@ -1588,7 +1672,7 @@ namespace boost { inline typename boost::property_map<typename Config::graph_type, Property>::type - get_dispatch(adj_list_helper<Config,Base>&, Property, + get_dispatch(adj_list_helper<Config,Base>&, Property, boost::edge_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map<Graph, Property>::type PA; @@ -1596,9 +1680,9 @@ namespace boost { } template <class Config, class Base, class Property> inline - typename boost::property_map<typename Config::graph_type, + typename boost::property_map<typename Config::graph_type, Property>::const_type - get_dispatch(const adj_list_helper<Config,Base>&, Property, + get_dispatch(const adj_list_helper<Config,Base>&, Property, boost::edge_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map<Graph, Property>::const_type PA; @@ -1607,9 +1691,9 @@ namespace boost { template <class Config, class Base, class Property> inline - typename boost::property_map<typename Config::graph_type, + typename boost::property_map<typename Config::graph_type, Property>::type - get_dispatch(adj_list_helper<Config,Base>& g, Property, + get_dispatch(adj_list_helper<Config,Base>& g, Property, boost::vertex_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map<Graph, Property>::type PA; @@ -1619,7 +1703,7 @@ namespace boost { inline typename boost::property_map<typename Config::graph_type, Property>::const_type - get_dispatch(const adj_list_helper<Config, Base>& g, Property, + get_dispatch(const adj_list_helper<Config, Base>& g, Property, boost::vertex_property_tag) { typedef typename Config::graph_type Graph; typedef typename boost::property_map<Graph, Property>::const_type PA; @@ -1639,7 +1723,7 @@ namespace boost { } template <class Config, class Base, class Property> inline - typename boost::property_map<typename Config::graph_type, + typename boost::property_map<typename Config::graph_type, Property>::const_type get(Property p, const adj_list_helper<Config, Base>& g) { typedef typename property_kind<Property>::type Kind; @@ -1649,16 +1733,26 @@ namespace boost { template <class Config, class Base, class Property, class Key> inline typename boost::property_traits< - typename boost::property_map<typename Config::graph_type, + typename boost::property_map<typename Config::graph_type, + Property>::type + >::reference + get(Property p, adj_list_helper<Config, Base>& g, const Key& key) { + return get(get(p, g), key); + } + + template <class Config, class Base, class Property, class Key> + inline + typename boost::property_traits< + typename boost::property_map<typename Config::graph_type, Property>::const_type - >::value_type + >::reference get(Property p, const adj_list_helper<Config, Base>& g, const Key& key) { return get(get(p, g), key); } template <class Config, class Base, class Property, class Key,class Value> inline void - put(Property p, adj_list_helper<Config, Base>& g, + put(Property p, adj_list_helper<Config, Base>& g, const Key& key, const Value& value) { typedef typename Config::graph_type Graph; @@ -1698,7 +1792,7 @@ namespace boost { { return 0; } - + inline adj_list_impl() { } inline adj_list_impl(const adj_list_impl& x) { @@ -1767,7 +1861,7 @@ namespace boost { inline StoredVertexList& vertex_set() { return m_vertices; } inline const StoredVertexList& vertex_set() const { return m_vertices; } - inline void copy_impl(const adj_list_impl& x_) + inline void copy_impl(const adj_list_impl& x_) { const Derived& x = static_cast<const Derived&>(x_); @@ -1788,9 +1882,9 @@ namespace boost { edge_iterator ei, ei_end; for (tie(ei, ei_end) = edges(x); ei != ei_end; ++ei) { edge_descriptor e; - bool inserted; + bool inserted; vertex_descriptor s = source(*ei,x), t = target(*ei,x); - tie(e, inserted) = add_edge(vertex_map[(stored_vertex*)s], + tie(e, inserted) = add_edge(vertex_map[(stored_vertex*)s], vertex_map[(stored_vertex*)t], *this); *((edge_property_type*)e.m_eproperty) = *((edge_property_type*)(*ei).m_eproperty); @@ -1814,6 +1908,7 @@ namespace boost { bool inserted; boost::tie(pos,inserted) = boost::graph_detail::push(g.m_vertices, v); v->m_position = pos; + g.added_vertex(v); return v; } // O(1) @@ -1822,13 +1917,19 @@ namespace boost { add_vertex(const typename Config::vertex_property_type& p, adj_list_impl<Derived, Config, Base>& g_) { + typedef typename Config::vertex_descriptor vertex_descriptor; Derived& g = static_cast<Derived&>(g_); + if (optional<vertex_descriptor> v + = g.vertex_by_property(get_property_value(p, vertex_bundle))) + return *v; + typedef typename Config::stored_vertex stored_vertex; stored_vertex* v = new stored_vertex(p); typename Config::StoredVertexList::iterator pos; bool inserted; boost::tie(pos,inserted) = boost::graph_detail::push(g.m_vertices, v); v->m_position = pos; + g.added_vertex(v); return v; } // O(1) @@ -1838,6 +1939,7 @@ namespace boost { { typedef typename Config::stored_vertex stored_vertex; Derived& g = static_cast<Derived&>(g_); + g.removing_vertex(u); stored_vertex* su = (stored_vertex*)u; g.m_vertices.erase(su->m_position); delete su; @@ -1845,7 +1947,7 @@ namespace boost { // O(V) template <class Derived, class Config, class Base> inline typename Config::vertex_descriptor - vertex(typename Config::vertices_size_type n, + vertex(typename Config::vertices_size_type n, const adj_list_impl<Derived, Config, Base>& g_) { const Derived& g = static_cast<const Derived&>(g_); @@ -1860,8 +1962,8 @@ namespace boost { namespace detail { template <class Graph, class vertex_descriptor> - inline void - remove_vertex_dispatch(Graph& g, vertex_descriptor u, + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, boost::directed_tag) { typedef typename Graph::edge_parallel_category edge_parallel_category; @@ -1874,15 +1976,18 @@ namespace boost { } template <class Graph, class vertex_descriptor> - inline void - remove_vertex_dispatch(Graph& g, vertex_descriptor u, + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, boost::undirected_tag) { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Graph::edge_parallel_category edge_parallel_category; g.m_vertices.erase(g.m_vertices.begin() + u); vertex_descriptor V = num_vertices(g); for (vertex_descriptor v = 0; v < V; ++v) - reindex_edge_list(g.out_edge_list(v), u, + reindex_edge_list(g.out_edge_list(v), u, edge_parallel_category()); typedef typename Graph::EdgeContainer Container; typedef typename Container::iterator Iter; @@ -1895,20 +2000,23 @@ namespace boost { } } template <class Graph, class vertex_descriptor> - inline void - remove_vertex_dispatch(Graph& g, vertex_descriptor u, + inline void + remove_vertex_dispatch(Graph& g, vertex_descriptor u, boost::bidirectional_tag) { + typedef typename Graph::global_edgelist_selector EdgeListS; + BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); + typedef typename Graph::edge_parallel_category edge_parallel_category; g.m_vertices.erase(g.m_vertices.begin() + u); vertex_descriptor V = num_vertices(g); vertex_descriptor v; if (u != V) { for (v = 0; v < V; ++v) - reindex_edge_list(g.out_edge_list(v), u, + reindex_edge_list(g.out_edge_list(v), u, edge_parallel_category()); for (v = 0; v < V; ++v) - reindex_edge_list(in_edge_list(g, v), u, + reindex_edge_list(in_edge_list(g, v), u, edge_parallel_category()); typedef typename Graph::EdgeContainer Container; @@ -1925,7 +2033,7 @@ namespace boost { template <class EdgeList, class vertex_descriptor> inline void - reindex_edge_list(EdgeList& el, vertex_descriptor u, + reindex_edge_list(EdgeList& el, vertex_descriptor u, boost::allow_parallel_edge_tag) { typename EdgeList::iterator ei = el.begin(), e_end = el.end(); @@ -1935,7 +2043,7 @@ namespace boost { } template <class EdgeList, class vertex_descriptor> inline void - reindex_edge_list(EdgeList& el, vertex_descriptor u, + reindex_edge_list(EdgeList& el, vertex_descriptor u, boost::disallow_parallel_edge_tag) { typename EdgeList::iterator ei = el.begin(), e_end = el.end(); @@ -1952,14 +2060,14 @@ namespace boost { } // namespace detail struct vec_adj_list_tag { }; - + template <class Graph, class Config, class Base> class vec_adj_list_impl : public adj_list_helper<Config, Base> { typedef typename Config::OutEdgeList OutEdgeList; typedef typename Config::InEdgeList InEdgeList; - typedef typename Config::StoredVertexList StoredVertexList; + typedef typename Config::StoredVertexList StoredVertexList; public: typedef typename Config::vertex_descriptor vertex_descriptor; typedef typename Config::edge_descriptor edge_descriptor; @@ -1979,7 +2087,7 @@ namespace boost { { return (std::numeric_limits<vertex_descriptor>::max)(); } - + inline vec_adj_list_impl() { } inline vec_adj_list_impl(const vec_adj_list_impl& x) { @@ -2004,7 +2112,7 @@ namespace boost { : m_vertices(num_vertices) { while (first != last) { - add_edge((*first).first, (*first).second, + add_edge((*first).first, (*first).second, static_cast<Graph&>(*this)); ++first; } @@ -2016,7 +2124,7 @@ namespace boost { : m_vertices(num_vertices) { while (first != last) { - add_edge((*first).first, (*first).second, *ep_iter, + add_edge((*first).first, (*first).second, *ep_iter, static_cast<Graph&>(*this)); ++first; ++ep_iter; @@ -2033,7 +2141,7 @@ namespace boost { inline const OutEdgeList& out_edge_list(vertex_descriptor v) const { return m_vertices[v].m_out_edges; } - inline void copy_impl(const vec_adj_list_impl& x_) + inline void copy_impl(const vec_adj_list_impl& x_) { const Graph& x = static_cast<const Graph&>(x_); // Copy the stored vertex objects by adding each vertex @@ -2047,7 +2155,7 @@ namespace boost { edge_iterator ei, ei_end; for (tie(ei, ei_end) = edges(x); ei != ei_end; ++ei) { edge_descriptor e; - bool inserted; + bool inserted; tie(e, inserted) = add_edge(source(*ei,x), target(*ei,x) , *this); *((edge_property_type*)e.m_eproperty) = *((edge_property_type*)(*ei).m_eproperty); @@ -2059,14 +2167,14 @@ namespace boost { // Had to make these non-members to avoid accidental instantiation // on SGI MIPSpro C++ template <class G, class C, class B> - inline typename C::InEdgeList& - in_edge_list(vec_adj_list_impl<G,C,B>& g, + inline typename C::InEdgeList& + in_edge_list(vec_adj_list_impl<G,C,B>& g, typename C::vertex_descriptor v) { return g.m_vertices[v].m_in_edges; } template <class G, class C, class B> - inline const typename C::InEdgeList& - in_edge_list(const vec_adj_list_impl<G,C,B>& g, + inline const typename C::InEdgeList& + in_edge_list(const vec_adj_list_impl<G,C,B>& g, typename C::vertex_descriptor v) { return g.m_vertices[v].m_in_edges; } @@ -2077,6 +2185,7 @@ namespace boost { add_vertex(vec_adj_list_impl<Graph, Config, Base>& g_) { Graph& g = static_cast<Graph&>(g_); g.m_vertices.resize(g.m_vertices.size() + 1); + g.added_vertex(g.m_vertices.size() - 1); return g.m_vertices.size() - 1; } @@ -2084,9 +2193,14 @@ namespace boost { inline typename Config::vertex_descriptor add_vertex(const typename Config::vertex_property_type& p, vec_adj_list_impl<Graph, Config, Base>& g_) { + typedef typename Config::vertex_descriptor vertex_descriptor; Graph& g = static_cast<Graph&>(g_); + if (optional<vertex_descriptor> v + = g.vertex_by_property(get_property_value(p, vertex_bundle))) + return *v; typedef typename Config::stored_vertex stored_vertex; g.m_vertices.push_back(stored_vertex(p)); + g.added_vertex(g.m_vertices.size() - 1); return g.m_vertices.size() - 1; } @@ -2095,7 +2209,7 @@ namespace boost { // either u or v is greater than the number of vertices. template <class Graph, class Config, class Base> inline std::pair<typename Config::edge_descriptor, bool> - add_edge(typename Config::vertex_descriptor u, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, const typename Config::edge_property_type& p, vec_adj_list_impl<Graph, Config, Base>& g_) @@ -2109,7 +2223,7 @@ namespace boost { } template <class Graph, class Config, class Base> inline std::pair<typename Config::edge_descriptor, bool> - add_edge(typename Config::vertex_descriptor u, + add_edge(typename Config::vertex_descriptor u, typename Config::vertex_descriptor v, vec_adj_list_impl<Graph, Config, Base>& g_) { @@ -2125,12 +2239,13 @@ namespace boost { { typedef typename Config::directed_category Cat; Graph& g = static_cast<Graph&>(g_); + g.removing_vertex(v); detail::remove_vertex_dispatch(g, v, Cat()); } // O(1) template <class Graph, class Config, class Base> - inline typename Config::vertex_descriptor - vertex(typename Config::vertices_size_type n, + inline typename Config::vertex_descriptor + vertex(typename Config::vertices_size_type n, const vec_adj_list_impl<Graph, Config, Base>&) { return n; @@ -2143,19 +2258,20 @@ namespace boost { // Adjacency List Generator template <class Graph, class VertexListS, class OutEdgeListS, - class DirectedS, class VertexProperty, class EdgeProperty, + class DirectedS, class VertexProperty, class EdgeProperty, class GraphProperty, class EdgeListS> struct adj_list_gen { - typedef typename detail::is_random_access<VertexListS>::type + typedef typename detail::is_random_access<VertexListS>::type is_rand_access; - typedef typename has_property<EdgeProperty>::type has_edge_property; + typedef typename has_property<EdgeProperty>::type has_edge_property; typedef typename DirectedS::is_directed_t DirectedT; typedef typename DirectedS::is_bidir_t BidirectionalT; struct config { typedef OutEdgeListS edgelist_selector; + typedef EdgeListS global_edgelist_selector; typedef Graph graph_type; typedef EdgeProperty edge_property_type; @@ -2163,7 +2279,7 @@ namespace boost { typedef GraphProperty graph_property_type; typedef std::size_t vertices_size_type; - typedef adjacency_list_traits<OutEdgeListS, VertexListS, DirectedS> + typedef adjacency_list_traits<OutEdgeListS, VertexListS, DirectedS> Traits; typedef typename Traits::directed_category directed_category; @@ -2171,29 +2287,29 @@ namespace boost { typedef typename Traits::vertex_descriptor vertex_descriptor; typedef typename Traits::edge_descriptor edge_descriptor; - typedef void* vertex_ptr; + typedef void* vertex_ptr; // need to reorganize this to avoid instantiating stuff // that doesn't get used -JGS // VertexList and vertex_iterator - typedef typename container_gen<VertexListS, + typedef typename container_gen<VertexListS, vertex_ptr>::type SeqVertexList; - typedef boost::integer_range<std::size_t> RandVertexList; - typedef typename boost::ct_if_t<is_rand_access, + typedef boost::integer_range<vertex_descriptor> RandVertexList; + typedef typename mpl::if_<is_rand_access, RandVertexList, SeqVertexList>::type VertexList; typedef typename VertexList::iterator vertex_iterator; // EdgeContainer and StoredEdge - typedef typename container_gen<EdgeListS, + typedef typename container_gen<EdgeListS, list_edge<vertex_descriptor, EdgeProperty> >::type EdgeContainer; - typedef typename ct_and<DirectedT, - typename ct_not<BidirectionalT>::type >::type on_edge_storage; + typedef typename mpl::and_<DirectedT, + typename mpl::not_<BidirectionalT>::type >::type on_edge_storage; - typedef typename boost::ct_if_t<on_edge_storage, + typedef typename mpl::if_<on_edge_storage, std::size_t, typename EdgeContainer::size_type >::type edges_size_type; @@ -2201,9 +2317,9 @@ namespace boost { typedef typename detail::is_random_access<EdgeListS>::type is_edge_ra; - typedef typename boost::ct_if_t<on_edge_storage, + typedef typename mpl::if_<on_edge_storage, stored_edge_property<vertex_descriptor, EdgeProperty>, - typename boost::ct_if_t<is_edge_ra, + typename mpl::if_<is_edge_ra, stored_ra_edge_iter<vertex_descriptor, EdgeContainer, EdgeProperty>, stored_edge_iter<vertex_descriptor, EdgeIter, EdgeProperty> >::type @@ -2211,7 +2327,7 @@ namespace boost { // Adjacency Types - typedef typename container_gen<OutEdgeListS, StoredEdge>::type + typedef typename container_gen<OutEdgeListS, StoredEdge>::type OutEdgeList; typedef typename OutEdgeList::size_type degree_size_type; typedef typename OutEdgeList::iterator OutEdgeIter; @@ -2248,13 +2364,13 @@ namespace boost { typedef undirected_edge_iter< EdgeIter , edge_descriptor - , EdgeIterDiff + , EdgeIterDiff > UndirectedEdgeIter; // also used for bidirectional - typedef adj_list_edge_iterator<vertex_iterator, out_edge_iterator, + typedef adj_list_edge_iterator<vertex_iterator, out_edge_iterator, graph_type> DirectedEdgeIter; - typedef typename boost::ct_if_t<on_edge_storage, + typedef typename mpl::if_<on_edge_storage, DirectedEdgeIter, UndirectedEdgeIter>::type edge_iterator; // stored_vertex and StoredVertexList @@ -2288,10 +2404,10 @@ namespace boost { InEdgeList m_in_edges; VertexProperty m_property; }; - typedef typename boost::ct_if_t<is_rand_access, - typename boost::ct_if_t<BidirectionalT, + typedef typename mpl::if_<is_rand_access, + typename mpl::if_<BidirectionalT, bidir_rand_stored_vertex, rand_stored_vertex>::type, - typename boost::ct_if_t<BidirectionalT, + typename mpl::if_<BidirectionalT, bidir_seq_stored_vertex, seq_stored_vertex>::type >::type StoredVertex; struct stored_vertex : public StoredVertex { @@ -2301,20 +2417,20 @@ namespace boost { typedef typename container_gen<VertexListS, stored_vertex>::type RandStoredVertexList; - typedef typename boost::ct_if_t< is_rand_access, + typedef typename mpl::if_< is_rand_access, RandStoredVertexList, SeqStoredVertexList>::type StoredVertexList; }; // end of config - typedef typename boost::ct_if_t<BidirectionalT, + typedef typename mpl::if_<BidirectionalT, bidirectional_graph_helper_with_property<config>, - typename boost::ct_if_t<DirectedT, + typename mpl::if_<DirectedT, directed_graph_helper<config>, undirected_graph_helper<config> >::type >::type DirectedHelper; - typedef typename boost::ct_if_t<is_rand_access, + typedef typename mpl::if_<is_rand_access, vec_adj_list_impl<Graph, config, DirectedHelper>, adj_list_impl<Graph, config, DirectedHelper> >::type type; @@ -2527,16 +2643,16 @@ namespace boost { typedef typename Bind::const_type const_type; }; } // namespace detail - + //========================================================================= // Edge Property Map template <class Directed, class Value, class Ref, class Vertex, class Property, class Tag> struct adj_list_edge_property_map - : public put_get_helper< + : public put_get_helper< Ref, - adj_list_edge_property_map<Directed, Value, Ref, Vertex, Property, + adj_list_edge_property_map<Directed, Value, Ref, Vertex, Property, Tag> > { @@ -2557,7 +2673,7 @@ namespace boost { class Vertex> struct adj_list_edge_all_properties_map : public put_get_helper<PropRef, - adj_list_edge_all_properties_map<Directed, Property, PropRef, + adj_list_edge_all_properties_map<Directed, Property, PropRef, PropPtr, Vertex> > { @@ -2582,12 +2698,12 @@ namespace boost { typedef typename property_value<Property,Tag>::type value_type; typedef value_type& reference; typedef const value_type& const_reference; - + typedef adj_list_edge_property_map - <typename Graph::directed_category, value_type, reference, + <typename Graph::directed_category, value_type, reference, typename Graph::vertex_descriptor,Property,Tag> type; typedef adj_list_edge_property_map - <typename Graph::directed_category, value_type, const_reference, + <typename Graph::directed_category, value_type, const_reference, typename Graph::vertex_descriptor,const Property, Tag> const_type; }; }; @@ -2598,7 +2714,7 @@ namespace boost { <typename Graph::directed_category, Property, Property&, Property*, typename Graph::vertex_descriptor> type; typedef adj_list_edge_all_properties_map - <typename Graph::directed_category, Property, const Property&, + <typename Graph::directed_category, Property, const Property&, const Property*, typename Graph::vertex_descriptor> const_type; }; }; @@ -2628,11 +2744,11 @@ namespace boost { }; } // namespace detail - template <> + template <> struct edge_property_selector<adj_list_tag> { typedef detail::adj_list_edge_property_selector type; }; - template <> + template <> struct edge_property_selector<vec_adj_list_tag> { typedef detail::adj_list_edge_property_selector type; }; @@ -2647,7 +2763,7 @@ namespace boost { typedef typename Choice::const_type const_type; }; }; - template <> + template <> struct vertex_property_selector<adj_list_tag> { typedef adj_list_vertex_property_selector type; }; @@ -2660,15 +2776,15 @@ namespace boost { typedef typename Choice::const_type const_type; }; }; - template <> + template <> struct vertex_property_selector<vec_adj_list_tag> { typedef vec_adj_list_vertex_property_selector type; }; } // namespace boost -#if !defined(BOOST_NO_HASH) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -namespace BOOST_STD_EXTENSION_NAMESPACE { +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +namespace boost { #if BOOST_WORKAROUND( _STLPORT_VERSION, >= 0x500 ) // STLport 5 already defines a hash<void*> specialization. @@ -2682,7 +2798,7 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { #endif template <typename V> - struct hash< boost::detail::stored_edge<V> > + struct hash< boost::detail::stored_edge<V> > { std::size_t operator()(const boost::detail::stored_edge<V>& e) const @@ -2692,7 +2808,7 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { }; template <typename V, typename P> - struct hash< boost::detail::stored_edge_property <V,P> > + struct hash< boost::detail::stored_edge_property <V,P> > { std::size_t operator()(const boost::detail::stored_edge_property<V,P>& e) const @@ -2702,7 +2818,7 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { }; template <typename V, typename I, typename P> - struct hash< boost::detail::stored_edge_iter<V,I, P> > + struct hash< boost::detail::stored_edge_iter<V,I, P> > { std::size_t operator()(const boost::detail::stored_edge_iter<V,I,P>& e) const @@ -2719,21 +2835,26 @@ namespace BOOST_STD_EXTENSION_NAMESPACE { #undef stored_edge_property #undef stored_edge_iter +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +#undef Graph +#endif + #endif // BOOST_GRAPH_DETAIL_DETAIL_ADJACENCY_LIST_CCT /* Implementation Notes: - + Many of the public interface functions in this file would have been more conveniently implemented as inline friend functions. However there are a few compiler bugs that make that approach non-portable. - + 1. g++ inline friend in namespace bug 2. g++ using clause doesn't work with inline friends 3. VC++ doesn't have Koenig lookup - For these reasons, the functions were all written as non-inline free + For these reasons, the functions were all written as non-inline free functions, and static cast was used to convert from the helper class to the adjacency_list derived class. diff --git a/Utilities/BGL/boost/graph/detail/array_binary_tree.hpp b/Utilities/BGL/boost/graph/detail/array_binary_tree.hpp index 30e022efbc27f61b630bb105f7f48ce683723ebd..6f337e91218fd64532cde43d7ba21968741efef1 100644 --- a/Utilities/BGL/boost/graph/detail/array_binary_tree.hpp +++ b/Utilities/BGL/boost/graph/detail/array_binary_tree.hpp @@ -135,11 +135,13 @@ public: */ template <class ExternalData> inline void swap(ArrayBinaryTreeNode x, ExternalData& edata ) { + using boost::get; + value_type tmp = x.value(); /*swap external data*/ - edata[ boost::get(id, tmp) ] = i; - edata[ boost::get(id, value()) ] = x.i; + edata[ get(id, tmp) ] = i; + edata[ get(id, value()) ] = x.i; x.value() = value(); value() = tmp; diff --git a/Utilities/BGL/boost/graph/detail/bitset.hpp b/Utilities/BGL/boost/graph/detail/bitset.hpp deleted file mode 100644 index c09c47b16cdfba9ecd835a6316656c16a2854c1f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/detail/bitset.hpp +++ /dev/null @@ -1,907 +0,0 @@ -// (C) Copyright Jeremy Siek 2001. Permission to copy, use, modify, -// sell and distribute this software is granted provided this -// copyright notice appears in all copies. This software is provided -// "as is" without express or implied warranty, and with no claim as -// to its suitability for any purpose. - -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#include <boost/config.hpp> -#include <memory> -#include <stdexcept> -#include <algorithm> -#include <string> -#include <boost/config.hpp> -#include <boost/pending/ct_if.hpp> -#include <boost/graph/detail/bitset_adaptor.hpp> - -// This provides versions of std::bitset with both static and dynamic size. - -// UNDER CONSTRUCTION - - -// replace this later -#include <cassert> -#define BOOST_ASSERT_THROW(expr, except) assert(expr) - -namespace boost { - - namespace detail { - // structure to aid in counting bits - template<bool dummy = true> - struct bit_count { - static unsigned char value[256]; - }; - - // Mapping from 8 bit unsigned integers to the index of the first bit - template<bool dummy = true> - struct first_bit_location { - static unsigned char value[256]; - }; - - template <typename WordType> // this size is in bits - struct word_traits { - typedef WordType word_type; - static const std::size_t word_size = CHAR_BIT * sizeof(word_type); - }; - - //========================================================================= - template <class WordTraits, class SizeType, class Derived> - class bitset_base - : public bitset_adaptor< SizeType, - bitset_base<WordTraits, SizeType, Derived> > - { - // private: - public: - typedef SizeType size_type; - typedef typename WordTraits::word_type word_type; - - static size_type s_which_word(size_type pos) { - return pos / WordTraits::word_size; - } - static size_type s_which_byte(size_type pos) { - return (pos % WordTraits::word_size) / CHAR_BIT; - } - static size_type s_which_bit(size_type pos) { - return pos % WordTraits::word_size; - } - static word_type s_mask_bit(size_type pos) { - return (static_cast<word_type>(1)) << s_which_bit(pos); - } - word_type& m_get_word(size_type pos) { - return data()[s_which_word(pos)]; - } - word_type m_get_word(size_type pos) const { - return data()[s_which_word(pos)]; - } - word_type& m_hi_word() { return data()[num_words() - 1]; } - word_type m_hi_word() const { return data()[num_words() - 1]; } - - void m_sanitize_highest() { - size_type extra_bits = size() % WordTraits::word_size; - if (extra_bits) - m_hi_word() &= ~((~static_cast<word_type>(0)) << extra_bits); - } - public: - - class reference { - friend class bitset_base; - - word_type *m_word_ptr; - size_type m_bit_pos; - - // left undefined - reference(); - - reference(bitset_base& b, size_type pos ) { - m_word_ptr = &b.m_get_word(pos); - m_bit_pos = s_which_bit(pos); - } - - public: - ~reference() {} - - // for b[i] = x; - reference& operator=(bool x) { - if ( x ) - *m_word_ptr |= s_mask_bit(m_bit_pos); - else - *m_word_ptr &= ~s_mask_bit(m_bit_pos); - - return *this; - } - // for b[i] = b[j]; - reference& operator=(const reference& j) { - if ( (*(j.m_word_ptr) & s_mask_bit(j.m_bit_pos)) ) - *m_word_ptr |= s_mask_bit(m_bit_pos); - else - *m_word_ptr &= ~s_mask_bit(m_bit_pos); - - return *this; - } - // flips the bit - bool operator~() const { - return (*(m_word_ptr) & s_mask_bit(m_bit_pos)) == 0; - } - // for x = b[i]; - operator bool() const { - return (*(m_word_ptr) & s_mask_bit(m_bit_pos)) != 0; - } - // for b[i].flip(); - reference& flip() { - *m_word_ptr ^= s_mask_bit(m_bit_pos); - return *this; - } - }; - - void init_from_ulong(unsigned long val) { - reset(); - const size_type n = (std::min)(sizeof(unsigned long) * CHAR_BIT, - WordTraits::word_size * num_words()); - for(size_type i = 0; i < n; ++i, val >>= 1) - if ( val & 0x1 ) - m_get_word(i) |= s_mask_bit(i); - } - - // intersection: this = this & x - Derived& operator&=(const Derived& x) { - for (size_type i = 0; i < num_words(); ++i) - data()[i] &= x.data()[i]; - return static_cast<Derived&>(*this); - } - // union: this = this | x - Derived& operator|=(const Derived& x) { - for (size_type i = 0; i < num_words(); ++i) - data()[i] |= x.data()[i]; - return static_cast<Derived&>(*this); - } - // exclusive or: this = this ^ x - Derived& operator^=(const Derived& x) { - for (size_type i = 0; i < num_words(); ++i) - data()[i] ^= x.data()[i]; - return static_cast<Derived&>(*this); - } - // left shift - Derived& operator<<=(size_type pos); - - // right shift - Derived& operator>>=(size_type pos); - - Derived& set() { - for (size_type i = 0; i < num_words(); ++i) - data()[i] = ~static_cast<word_type>(0); - m_sanitize_highest(); - return static_cast<Derived&>(*this); - } - - Derived& set(size_type pos, int val = true) - { - BOOST_ASSERT_THROW(pos < size(), std::out_of_range("boost::bitset::set(pos,value)")); - if (val) - m_get_word(pos) |= s_mask_bit(pos); - else - m_get_word(pos) &= ~s_mask_bit(pos); - return static_cast<Derived&>(*this); - } - - Derived& reset() { - for (size_type i = 0; i < num_words(); ++i) - data()[i] = 0; - return static_cast<Derived&>(*this); - } - - Derived& reset(size_type pos) { - BOOST_ASSERT_THROW(pos < size(), std::out_of_range("boost::bitset::reset(pos)")); - m_get_word(pos) &= ~s_mask_bit(pos); - return static_cast<Derived&>(*this); - } - - // compliment - Derived operator~() const { - return Derived(static_cast<const Derived&>(*this)).flip(); - } - - Derived& flip() { - for (size_type i = 0; i < num_words(); ++i) - data()[i] = ~data()[i]; - m_sanitize_highest(); - return static_cast<Derived&>(*this); - } - Derived& flip(size_type pos) { - BOOST_ASSERT_THROW(pos < size(), std::out_of_range("boost::bitset::flip(pos)")); - m_get_word(pos) ^= s_mask_bit(pos); - return static_cast<Derived&>(*this); - } - - // element access - reference operator[](size_type pos) { return reference(*this, pos); } - bool operator[](size_type pos) const { return test(pos); } - - unsigned long to_ulong() const; - - // to_string - - - size_type count() const { - size_type result = 0; - const unsigned char* byte_ptr = (const unsigned char*)data(); - const unsigned char* end_ptr = - (const unsigned char*)(data() + num_words()); - while ( byte_ptr < end_ptr ) { - result += bit_count<>::value[*byte_ptr]; - byte_ptr++; - } - return result; - } - - // size() must be provided by Derived class - - bool operator==(const Derived& x) const { - return std::equal(data(), data() + num_words(), x.data()); - } - - bool operator!=(const Derived& x) const { - return ! this->operator==(x); - } - - bool test(size_type pos) const { - BOOST_ASSERT_THROW(pos < size(), std::out_of_range("boost::bitset::test(pos)")); - return (m_get_word(pos) & s_mask_bit(pos)) - != static_cast<word_type>(0); - } - - bool any() const { - for (size_type i = 0; i < num_words(); ++i) { - if ( data()[i] != static_cast<word_type>(0) ) - return true; - } - return false; - } - bool none() const { - return !any(); - } - - Derived operator<<(size_type pos) const - { return Derived(static_cast<const Derived&>(*this)) <<= pos; } - - Derived operator>>(size_type pos) const - { return Derived(static_cast<const Derived&>(*this)) >>= pos; } - - template <class CharT, class Traits, class Alloc> - void m_copy_from_string(const basic_string<CharT,Traits,Alloc>& s, - size_type pos, size_type n) - { - reset(); - const size_type nbits = (std::min)(size(), (std::min)(n, s.size() - pos)); - for (size_type i = 0; i < nbits; ++i) { - switch(s[pos + nbits - i - 1]) { - case '0': - break; - case '1': - this->set(i); - break; - default: - throw std::invalid_argument - ("boost::bitset_base::m_copy_from_string(s, pos, n)"); - } - } - } - - template <class CharT, class Traits, class Alloc> - void m_copy_to_string(basic_string<CharT, Traits, Alloc>& s) const - { - s.assign(size(), '0'); - - for (size_type i = 0; i < size(); ++i) - if (test(i)) - s[size() - 1 - i] = '1'; - } - - //----------------------------------------------------------------------- - // Stuff not in std::bitset - - // difference: this = this - x - Derived& operator-=(const Derived& x) { - for (size_type i = 0; i < num_words(); ++i) - data()[i] &= ~x.data()[i]; - return static_cast<Derived&>(*this); - } - - // this wasn't working, why? - int compare_3way(const Derived& x) const { - return std::lexicographical_compare_3way - (data(), data() + num_words(), x.data(), x.data() + x.num_words()); - } - - // less-than compare - bool operator<(const Derived& x) const { - return std::lexicographical_compare - (data(), data() + num_words(), x.data(), x.data() + x.num_words()); - } - - // find the index of the first "on" bit - size_type find_first() const; - - // find the index of the next "on" bit after prev - size_type find_next(size_type prev) const; - - - size_type _Find_first() const { return find_first(); } - - // find the index of the next "on" bit after prev - size_type _Find_next(size_type prev) const { return find_next(prev); } - - // private: - word_type* data() - { return static_cast<Derived*>(this)->data(); } - - const word_type* data() const - { return static_cast<const Derived*>(this)->data(); } - - size_type num_words() const - { return static_cast<const Derived*>(this)->num_words(); } - - size_type size() const - { return static_cast<const Derived*>(this)->size(); } - }; - - // 23.3.5.3 bitset operations: - template <class W, class S, class D> - inline D operator&(const bitset_base<W,S,D>& x, - const bitset_base<W,S,D>& y) { - D result(static_cast<const D&>(x)); - result &= static_cast<const D&>(y); - return result; - } - - template <class W, class S, class D> - inline D operator|(const bitset_base<W,S,D>& x, - const bitset_base<W,S,D>& y) { - D result(static_cast<const D&>(x)); - result |= static_cast<const D&>(y); - return result; - } - - template <class W, class S, class D> - inline D operator^(const bitset_base<W,S,D>& x, - const bitset_base<W,S,D>& y) { - D result(static_cast<const D&>(x)); - result ^= static_cast<const D&>(y); - return result; - } - - // this one is an extension - template <class W, class S, class D> - inline D operator-(const bitset_base<W,S,D>& x, - const bitset_base<W,S,D>& y) { - D result(static_cast<const D&>(x)); - result -= static_cast<const D&>(y); - return result; - } - - template <class W, class S, class D> - inline int compare_3way(const bitset_base<W,S,D>& x, - const bitset_base<W,S,D>& y) { - return std::lexicographical_compare_3way - (x.data(), x.data() + x.num_words(), - y.data(), y.data() + y.num_words()); - } - - - template <class W, class S, class D> - std::istream& - operator>>(std::istream& is, bitset_base<W,S,D>& x) { - std::string tmp; - tmp.reserve(x.size()); - - // In new templatized iostreams, use istream::sentry - if (is.flags() & ios::skipws) { - char c; - do - is.get(c); - while (is && isspace(c)); - if (is) - is.putback(c); - } - - for (S i = 0; i < x.size(); ++i) { - char c; - is.get(c); - - if (!is) - break; - else if (c != '0' && c != '1') { - is.putback(c); - break; - } - else - // tmp.push_back(c); - tmp += c; - } - - if (tmp.empty()) - is.clear(is.rdstate() | ios::failbit); - else - x.m_copy_from_string(tmp, static_cast<S>(0), x.size()); - - return is; - } - - template <class W, class S, class D> - std::ostream& operator<<(std::ostream& os, - const bitset_base<W,S,D>& x) { - std::string tmp; - x.m_copy_to_string(tmp); - return os << tmp; - } - - //========================================================================= - template <typename WordType = unsigned long, - typename SizeType = std::size_t, - typename Allocator = std::allocator<WordType> - > - class dyn_size_bitset - : public bitset_base<word_traits<WordType>, SizeType, - dyn_size_bitset<WordType,SizeType,Allocator> > - { - typedef dyn_size_bitset self; - public: - typedef SizeType size_type; - private: - typedef word_traits<WordType> WordTraits; - static const size_type word_size = WordTraits::word_size; - - public: - dyn_size_bitset(unsigned long val, - size_type n, - const Allocator& alloc = Allocator()) - : m_data(alloc.allocate((n + word_size - 1) / word_size)), - m_size(n), - m_num_words((n + word_size - 1) / word_size), - m_alloc(alloc) - { - init_from_ulong(val); - } - - dyn_size_bitset(size_type n, // size of the set's "universe" - const Allocator& alloc = Allocator()) - : m_data(alloc.allocate((n + word_size - 1) / word_size)), - m_size(n), m_num_words((n + word_size - 1) / word_size), - m_alloc(alloc) - { } - - template<class CharT, class Traits, class Alloc> - explicit dyn_size_bitset - (const basic_string<CharT,Traits,Alloc>& s, - std::size_t pos = 0, - std::size_t n = std::size_t(basic_string<CharT,Traits,Alloc>::npos), - const Allocator& alloc = Allocator()) - : m_data(alloc.allocate((n + word_size - 1) / word_size)), - m_size(n), m_num_words((n + word_size - 1) / word_size), - m_alloc(alloc) - { - BOOST_ASSERT_THROW(pos < s.size(), std::out_of_range("dyn_size_bitset::dyn_size_bitset(s,pos,n,alloc)")); - m_copy_from_string(s, pos, n); - } - - template <typename InputIterator> - explicit dyn_size_bitset - (InputIterator first, InputIterator last, - size_type n, // size of the set's "universe" - const Allocator& alloc = Allocator()) - : m_data(alloc.allocate((n + word_size - 1) / word_size)), - m_size(N), m_num_words((n + word_size - 1) / word_size), - m_alloc(alloc) - { - while (first != last) - this->set(*first++); - } - - ~dyn_size_bitset() { - m_alloc.deallocate(m_data, m_num_words); - } - - size_type size() const { return m_size; } - - // protected: - size_type num_words() const { return m_num_words; } - - word_type* data() { return m_data; } - const word_type* data() const { return m_data; } - - protected: - word_type* m_data; - SizeType m_size; - SizeType m_num_words; - Allocator m_alloc; - }; - - //========================================================================= - template <std::size_t N, typename WordType = unsigned long, - typename SizeType = std::size_t> - class bitset - : public bitset_base<word_traits<WordType>, SizeType, - bitset<N, WordType, SizeType> > - { - typedef bitset self; - static const std::size_t word_size = word_traits<WordType>::word_size; - public: - // 23.3.5.1 constructors: - bitset() { -#if defined(__GNUC__) - for (size_type i = 0; i < num_words(); ++i) - m_data[i] = static_cast<WordType>(0); -#endif - } - - bitset(unsigned long val) { - init_from_ulong(val); - } - - template<class CharT, class Traits, class Alloc> - explicit bitset - (const basic_string<CharT,Traits,Alloc>& s, - std::size_t pos = 0, - std::size_t n = std::size_t(basic_string<CharT,Traits,Alloc>::npos)) - { - BOOST_ASSERT_THROW - (pos < s.size(), std::out_of_range("bitset::bitset(s,pos,n)")); - m_copy_from_string(s, pos, n); - } - - size_type size() const { return N; } - - // protected: - size_type num_words() const { return (N + word_size - 1) / word_size; } - - word_type* data() { return m_data; } - const word_type* data() const { return m_data; } - protected: - word_type m_data[(N + word_size - 1) / word_size]; - }; - - //========================================================================= - struct select_static_bitset { - template <std::size_t N, typename WordT, typename SizeT, typename Alloc> - struct bind_ { - typedef bitset<N, WordT, SizeT> type; - }; - }; - struct select_dyn_size_bitset { - template <std::size_t N, typename WordT, typename SizeT, typename Alloc> - struct bind_ { - typedef dyn_size_bitset<WordT, SizeT, Alloc> type; - }; - }; - - template <std::size_t N = 0, // 0 means use dynamic - typename WordType = unsigned long, - typename Size_type = std::size_t, - typename Allocator = std::allocator<WordType> - > - class bitset_generator { - typedef typename ct_if<N, select_dyn_size_bitset, - select_static_bitset>::type selector; - public: - typedef typename selector - ::template bind_<N, WordType, SizeType, Allocator>::type type; - }; - - - //========================================================================= - // bitset_base non-inline member function implementations - - template <class WordTraits, class SizeType, class Derived> - Derived& - bitset_base<WordTraits, SizeType, Derived>:: - operator<<=(size_type shift) - { - typedef typename WordTraits::word_type word_type; - typedef SizeType size_type; - if (shift != 0) { - const size_type wshift = shift / WordTraits::word_size; - const size_type offset = shift % WordTraits::word_size; - const size_type sub_offset = WordTraits::word_size - offset; - size_type n = num_words() - 1; - for ( ; n > wshift; --n) - data()[n] = (data()[n - wshift] << offset) | - (data()[n - wshift - 1] >> sub_offset); - if (n == wshift) - data()[n] = data()[0] << offset; - for (size_type n1 = 0; n1 < n; ++n1) - data()[n1] = static_cast<word_type>(0); - } - m_sanitize_highest(); - return static_cast<Derived&>(*this); - } // end operator<<= - - - template <class WordTraits, class SizeType, class Derived> - Derived& - bitset_base<WordTraits, SizeType, Derived>:: - operator>>=(size_type shift) - { - typedef typename WordTraits::word_type word_type; - typedef SizeType size_type; - if (shift != 0) { - const size_type wshift = shift / WordTraits::word_size; - const size_type offset = shift % WordTraits::word_size; - const size_type sub_offset = WordTraits::word_size - offset; - const size_type limit = num_words() - wshift - 1; - size_type n = 0; - for ( ; n < limit; ++n) - data()[n] = (data()[n + wshift] >> offset) | - (data()[n + wshift + 1] << sub_offset); - data()[limit] = data()[num_words()-1] >> offset; - for (size_type n1 = limit + 1; n1 < num_words(); ++n1) - data()[n1] = static_cast<word_type>(0); - } - m_sanitize_highest(); - return static_cast<Derived&>(*this); - } // end operator>>= - - - template <class WordTraits, class SizeType, class Derived> - unsigned long bitset_base<WordTraits, SizeType, Derived>:: - to_ulong() const - { - typedef typename WordTraits::word_type word_type; - typedef SizeType size_type; - const std::overflow_error - overflow("boost::bit_set::operator unsigned long()"); - - if (sizeof(word_type) >= sizeof(unsigned long)) { - for (size_type i = 1; i < num_words(); ++i) - BOOST_ASSERT_THROW(! data()[i], overflow); - - const word_type mask - = static_cast<word_type>(static_cast<unsigned long>(-1)); - BOOST_ASSERT_THROW(! (data()[0] & ~mask), overflow); - - return static_cast<unsigned long>(data()[0] & mask); - } - else { // sizeof(word_type) < sizeof(unsigned long). - const size_type nwords = - (sizeof(unsigned long) + sizeof(word_type) - 1) / sizeof(word_type); - - size_type min_nwords = nwords; - if (num_words() > nwords) { - for (size_type i = nwords; i < num_words(); ++i) - BOOST_ASSERT_THROW(!data()[i], overflow); - } - else - min_nwords = num_words(); - - // If unsigned long is 8 bytes and word_type is 6 bytes, then - // an unsigned long consists of all of one word plus 2 bytes - // from another word. - const size_type part = sizeof(unsigned long) % sizeof(word_type); - -#if 0 - // bug in here? - // >> to far? - BOOST_ASSERT_THROW((part != 0 - && nwords <= num_words() - && (data()[min_nwords - 1] >> - ((sizeof(word_type) - part) * CHAR_BIT)) != 0), - overflow); -#endif - - unsigned long result = 0; - for (size_type i = 0; i < min_nwords; ++i) { - result |= static_cast<unsigned long>( - data()[i]) << (i * sizeof(word_type) * CHAR_BIT); - } - return result; - } - }// end operator unsigned long() - - - template <class WordTraits, class SizeType, class Derived> - SizeType bitset_base<WordTraits,SizeType,Derived>:: - find_first() const - { - SizeType not_found = size(); - for (size_type i = 0; i < num_words(); i++ ) { - word_type thisword = data()[i]; - if ( thisword != static_cast<word_type>(0) ) { - // find byte within word - for ( std::size_t j = 0; j < sizeof(word_type); j++ ) { - unsigned char this_byte - = static_cast<unsigned char>(thisword & (~(unsigned char)0)); - if ( this_byte ) - return i * WordTraits::word_size + j * CHAR_BIT + - first_bit_location<>::value[this_byte]; - - thisword >>= CHAR_BIT; - } - } - } - // not found, so return an indication of failure. - return not_found; - } - - template <class WordTraits, class SizeType, class Derived> - SizeType bitset_base<WordTraits, SizeType, Derived>:: - bitset_base<WordTraits,SizeType,Derived>:: - find_next(size_type prev) const - { - SizeType not_found = size(); - // make bound inclusive - ++prev; - - // check out of bounds - if ( prev >= num_words() * WordTraits::word_size ) - return not_found; - - // search first word - size_type i = s_which_word(prev); - word_type thisword = data()[i]; - - // mask off bits below bound - thisword &= (~static_cast<word_type>(0)) << s_which_bit(prev); - - if ( thisword != static_cast<word_type>(0) ) { - // find byte within word - // get first byte into place - thisword >>= s_which_byte(prev) * CHAR_BIT; - for ( size_type j = s_which_byte(prev); j < sizeof(word_type); j++ ) { - unsigned char this_byte - = static_cast<unsigned char>(thisword & (~(unsigned char)0)); - if ( this_byte ) - return i * WordTraits::word_size + j * CHAR_BIT + - first_bit_location<>::value[this_byte]; - - thisword >>= CHAR_BIT; - } - } - - // check subsequent words - i++; - for ( ; i < num_words(); i++ ) { - word_type thisword = data()[i]; - if ( thisword != static_cast<word_type>(0) ) { - // find byte within word - for ( size_type j = 0; j < sizeof(word_type); j++ ) { - unsigned char this_byte - = static_cast<unsigned char>(thisword & (~(unsigned char)0)); - if ( this_byte ) - return i * WordTraits::word_size + j * CHAR_BIT + - first_bit_location<>::value[this_byte]; - - thisword >>= CHAR_BIT; - } - } - } - - // not found, so return an indication of failure. - return not_found; - } // end find_next - - - template <bool dummy> - unsigned char bit_count<dummy>::value[] = { - 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ - 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ - 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */ - 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */ - 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */ - 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */ - 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */ - 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */ - 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */ - 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */ - 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */ - 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */ - 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */ - 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */ - 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */ - 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */ - 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */ - 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */ - 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */ - 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */ - 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */ - 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */ - 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */ - 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */ - 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */ - 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */ - 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */ - 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */ - 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */ - 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */ - 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */ - 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */ - 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */ - 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */ - 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */ - 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */ - 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */ - 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */ - 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */ - 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */ - 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */ - 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */ - 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */ - 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */ - 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */ - 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */ - 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */ - 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */ - 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */ - 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */ - 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */ - 8 /* 255 */ - }; // end _Bit_count - - template <bool dummy> - unsigned char first_bit_location<dummy>::value[] = { - 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ - 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ - 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */ - 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */ - 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */ - 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */ - 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */ - 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */ - 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */ - 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */ - 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */ - 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */ - 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */ - 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */ - 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */ - 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */ - 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */ - 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */ - 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */ - 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */ - 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */ - 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */ - 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */ - 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */ - 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */ - 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */ - 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */ - 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */ - 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */ - 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */ - 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */ - 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */ - 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */ - 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */ - 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */ - 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */ - 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */ - 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */ - 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */ - 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */ - 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */ - 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */ - 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */ - 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */ - 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */ - 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */ - 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */ - 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */ - 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */ - 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */ - 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */ - 0, /* 255 */ - }; // end _First_one - - } // namespace detail - -} // namespace boost diff --git a/Utilities/BGL/boost/graph/detail/bitset_adaptor.hpp b/Utilities/BGL/boost/graph/detail/bitset_adaptor.hpp deleted file mode 100644 index d301b7d623d13cf1c16cc7d823f6e9fdecede70c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/detail/bitset_adaptor.hpp +++ /dev/null @@ -1,90 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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_BITSET_ADAPTOR_HPP -#define BOOST_BITSET_ADAPTOR_HPP - - template <class T, class Derived> - struct bitset_adaptor { - Derived& derived() { return static_cast<Derived&>(*this); } - const Derived& derived() const { - return static_cast<const Derived&>(*this); - } - }; - - template <class T, class D, class V> - bool set_contains(const bitset_adaptor<T,D>& s, const V& x) { - return s.derived().test(x); - } - - template <class T, class D> - bool set_equal(const bitset_adaptor<T,D>& x, - const bitset_adaptor<T,D>& y) { - return x.derived() == y.derived(); - } - - template <class T, class D> - int set_lex_order(const bitset_adaptor<T,D>& x, - const bitset_adaptor<T,D>& y) { - return compare_3way(x.derived(), y.derived()); - } - - template <class T, class D> - void set_clear(bitset_adaptor<T,D>& x) { - x.derived().reset(); - } - - template <class T, class D> - bool set_empty(const bitset_adaptor<T,D>& x) { - return x.derived().none(); - } - - template <class T, class D, class V> - void set_insert(bitset_adaptor<T,D>& x, const V& a) { - x.derived().set(a); - } - - template <class T, class D, class V> - void set_remove(bitset_adaptor<T,D>& x, const V& a) { - x.derived().set(a, false); - } - - template <class T, class D> - void set_intersect(const bitset_adaptor<T,D>& x, - const bitset_adaptor<T,D>& y, - bitset_adaptor<T,D>& z) - { - z.derived() = x.derived() & y.derived(); - } - - template <class T, class D> - void set_union(const bitset_adaptor<T,D>& x, - const bitset_adaptor<T,D>& y, - bitset_adaptor<T,D>& z) - { - z.derived() = x.derived() | y.derived(); - } - - template <class T, class D> - void set_difference(const bitset_adaptor<T,D>& x, - const bitset_adaptor<T,D>& y, - bitset_adaptor<T,D>& z) - { - z.derived() = x.derived() - y.derived(); - } - - template <class T, class D> - void set_compliment(const bitset_adaptor<T,D>& x, - bitset_adaptor<T,D>& z) - { - z.derived() = x.derived(); - z.derived().flip(); - } - -#endif // BOOST_BITSET_ADAPTOR_HPP diff --git a/Utilities/BGL/boost/graph/detail/compressed_sparse_row_struct.hpp b/Utilities/BGL/boost/graph/detail/compressed_sparse_row_struct.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6b4e3913c9054bf4cbc4b27024fc0e8509ea0600 --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/compressed_sparse_row_struct.hpp @@ -0,0 +1,629 @@ +// Copyright 2005-2009 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine + +// Compressed sparse row graph type internal structure + +#ifndef BOOST_GRAPH_COMPRESSED_SPARSE_ROW_STRUCT_HPP +#define BOOST_GRAPH_COMPRESSED_SPARSE_ROW_STRUCT_HPP + +#ifndef BOOST_GRAPH_COMPRESSED_SPARSE_ROW_GRAPH_HPP +#error This file should only be included from boost/graph/compressed_sparse_row_graph.hpp +#endif + +#include <vector> +#include <utility> +#include <algorithm> +#include <climits> +#include <cassert> +#include <iterator> +#if 0 +#include <iostream> // For some debugging code below +#endif +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/properties.hpp> +#include <boost/graph/filtered_graph.hpp> // For keep_all +#include <boost/graph/detail/indexed_properties.hpp> +#include <boost/graph/detail/histogram_sort.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/iterator/counting_iterator.hpp> +#include <boost/iterator/reverse_iterator.hpp> +#include <boost/iterator/zip_iterator.hpp> +#include <boost/iterator/transform_iterator.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/integer.hpp> +#include <boost/iterator/iterator_facade.hpp> +#include <boost/mpl/if.hpp> +#include <boost/graph/graph_selectors.hpp> +#include <boost/static_assert.hpp> +#include <boost/functional/hash.hpp> +#include <boost/utility.hpp> + +namespace boost { + +namespace detail { + // Forward declaration of CSR edge descriptor type, needed to pass to + // indexed_edge_properties. + template<typename Vertex, typename EdgeIndex> + class csr_edge_descriptor; + + /** Compressed sparse row graph internal structure. + * + * Vertex and EdgeIndex should be unsigned integral types and should + * specialize numeric_limits. + */ + template <typename EdgeProperty, + typename Vertex = std::size_t, typename EdgeIndex = Vertex> + class compressed_sparse_row_structure : + public detail::indexed_edge_properties< + compressed_sparse_row_structure<EdgeProperty, Vertex, EdgeIndex>, + EdgeProperty, + csr_edge_descriptor<Vertex, EdgeIndex> > { + public: + typedef detail::indexed_edge_properties< + compressed_sparse_row_structure<EdgeProperty, Vertex, EdgeIndex>, + EdgeProperty, + csr_edge_descriptor<Vertex, EdgeIndex> > + inherited_edge_properties; + + typedef Vertex vertices_size_type; + typedef Vertex vertex_descriptor; + typedef EdgeIndex edges_size_type; + + static vertex_descriptor null_vertex() { return vertex_descriptor(-1); } + + std::vector<EdgeIndex> m_rowstart; + std::vector<Vertex> m_column; + + compressed_sparse_row_structure(Vertex numverts = 0) + : m_rowstart(numverts + 1, EdgeIndex(0)), m_column() + {} + + // Rebuild graph from number of vertices and multi-pass unsorted list of + // edges (filtered using source_pred and mapped using global_to_local) + template <typename MultiPassInputIterator, typename GlobalToLocal, typename SourcePred> + void + assign_unsorted_multi_pass_edges(MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred) { + m_rowstart.clear(); + m_rowstart.resize(numlocalverts + 1, 0); + typedef std::pair<vertices_size_type, vertices_size_type> edge_type; + typedef boost::transform_iterator<boost::graph::detail::project1st<edge_type>, MultiPassInputIterator> source_iterator; + typedef boost::transform_iterator<boost::graph::detail::project2nd<edge_type>, MultiPassInputIterator> target_iterator; + source_iterator sources_begin(edge_begin, boost::graph::detail::project1st<edge_type>()); + source_iterator sources_end(edge_end, boost::graph::detail::project1st<edge_type>()); + target_iterator targets_begin(edge_begin, boost::graph::detail::project2nd<edge_type>()); + target_iterator targets_end(edge_end, boost::graph::detail::project2nd<edge_type>()); + + boost::graph::detail::count_starts + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + source_pred, boost::make_property_map_function(global_to_local)); + + m_column.resize(m_rowstart.back()); + + boost::graph::detail::histogram_sort + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + targets_begin, m_column.begin(), + source_pred, boost::make_property_map_function(global_to_local)); + } + + // Rebuild graph from number of vertices and multi-pass unsorted list of + // edges and their properties (filtered using source_pred and mapped using + // global_to_local) + template <typename MultiPassInputIterator, typename EdgePropertyIterator, typename GlobalToLocal, typename SourcePred> + void + assign_unsorted_multi_pass_edges(MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numlocalverts, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred) { + m_rowstart.clear(); + m_rowstart.resize(numlocalverts + 1, 0); + typedef std::pair<vertices_size_type, vertices_size_type> edge_type; + typedef boost::transform_iterator<boost::graph::detail::project1st<edge_type>, MultiPassInputIterator> source_iterator; + typedef boost::transform_iterator<boost::graph::detail::project2nd<edge_type>, MultiPassInputIterator> target_iterator; + source_iterator sources_begin(edge_begin, boost::graph::detail::project1st<edge_type>()); + source_iterator sources_end(edge_end, boost::graph::detail::project1st<edge_type>()); + target_iterator targets_begin(edge_begin, boost::graph::detail::project2nd<edge_type>()); + target_iterator targets_end(edge_end, boost::graph::detail::project2nd<edge_type>()); + + boost::graph::detail::count_starts + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + source_pred, boost::make_property_map_function(global_to_local)); + + m_column.resize(m_rowstart.back()); + inherited_edge_properties::resize(m_rowstart.back()); + + boost::graph::detail::histogram_sort + (sources_begin, sources_end, m_rowstart.begin(), numlocalverts, + targets_begin, m_column.begin(), + ep_iter, inherited_edge_properties::begin(), + source_pred, boost::make_property_map_function(global_to_local)); + } + + // Assign from number of vertices and sorted list of edges + template<typename InputIterator, typename GlobalToLocal, typename SourcePred> + void assign_from_sorted_edges( + InputIterator edge_begin, InputIterator edge_end, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numlocalverts, + edges_size_type numedges_or_zero) { + m_column.clear(); + m_column.reserve(numedges_or_zero); + m_rowstart.resize(numlocalverts + 1); + EdgeIndex current_edge = 0; + Vertex current_vertex_plus_one = 1; + m_rowstart[0] = 0; + for (InputIterator ei = edge_begin; ei != edge_end; ++ei) { + if (!source_pred(ei->first)) continue; + Vertex src = get(global_to_local, ei->first); + Vertex tgt = ei->second; + for (; current_vertex_plus_one != src + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + m_column.push_back(tgt); + ++current_edge; + } + + // The remaining vertices have no edges + for (; current_vertex_plus_one != numlocalverts + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + + // Default-construct properties for edges + inherited_edge_properties::resize(m_column.size()); + } + + // Assign from number of vertices and sorted list of edges + template<typename InputIterator, typename EdgePropertyIterator, typename GlobalToLocal, typename SourcePred> + void assign_from_sorted_edges( + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + const GlobalToLocal& global_to_local, + const SourcePred& source_pred, + vertices_size_type numlocalverts, + edges_size_type numedges_or_zero) { + // Reserving storage in advance can save us lots of time and + // memory, but it can only be done if we have forward iterators or + // the user has supplied the number of edges. + edges_size_type numedges = numedges_or_zero; + if (numedges == 0) { + typedef typename std::iterator_traits<InputIterator>::iterator_category + category; + numedges = boost::graph::detail::reserve_count_for_single_pass(edge_begin, edge_end); + } + m_column.clear(); + m_column.reserve(numedges_or_zero); + inherited_edge_properties::clear(); + inherited_edge_properties::reserve(numedges_or_zero); + m_rowstart.resize(numlocalverts + 1); + EdgeIndex current_edge = 0; + Vertex current_vertex_plus_one = 1; + m_rowstart[0] = 0; + for (InputIterator ei = edge_begin; ei != edge_end; ++ei, ++ep_iter) { + if (!source_pred(ei->first)) continue; + Vertex src = get(global_to_local, ei->first); + Vertex tgt = ei->second; + for (; current_vertex_plus_one != src + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + m_column.push_back(tgt); + inherited_edge_properties::push_back(*ep_iter); + ++current_edge; + } + + // The remaining vertices have no edges + for (; current_vertex_plus_one != numlocalverts + 1; ++current_vertex_plus_one) + m_rowstart[current_vertex_plus_one] = current_edge; + } + + // Replace graph with sources and targets given, sorting them in-place, and + // using the given global-to-local property map to get local indices from + // global ones in the two arrays. + template <typename GlobalToLocal> + void assign_sources_and_targets_global(std::vector<vertex_descriptor>& sources, + std::vector<vertex_descriptor>& targets, + vertices_size_type numverts, + GlobalToLocal global_to_local) { + assert (sources.size() == targets.size()); + // Do an in-place histogram sort (at least that's what I think it is) to + // sort sources and targets + m_rowstart.clear(); + m_rowstart.resize(numverts + 1); + boost::graph::detail::count_starts + (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + keep_all(), boost::make_property_map_function(global_to_local)); + boost::graph::detail::histogram_sort_inplace + (sources.begin(), m_rowstart.begin(), numverts, + targets.begin(), boost::make_property_map_function(global_to_local)); + // Now targets is the correct vector (properly sorted by source) for + // m_column + m_column.swap(targets); + } + + // Replace graph with sources and targets and edge properties given, sorting + // them in-place, and using the given global-to-local property map to get + // local indices from global ones in the two arrays. + template <typename GlobalToLocal> + void assign_sources_and_targets_global(std::vector<vertex_descriptor>& sources, + std::vector<vertex_descriptor>& targets, + std::vector<typename inherited_edge_properties::edge_bundled>& edge_props, + vertices_size_type numverts, + GlobalToLocal global_to_local) { + assert (sources.size() == targets.size()); + assert (sources.size() == edge_props.size()); + // Do an in-place histogram sort (at least that's what I think it is) to + // sort sources and targets + m_rowstart.clear(); + m_rowstart.resize(numverts + 1); + boost::graph::detail::count_starts + (sources.begin(), sources.end(), m_rowstart.begin(), numverts, + keep_all(), boost::make_property_map_function(global_to_local)); + boost::graph::detail::histogram_sort_inplace + (sources.begin(), m_rowstart.begin(), numverts, + targets.begin(), edge_props.begin(), + boost::make_property_map_function(global_to_local)); + // Now targets is the correct vector (properly sorted by source) for + // m_column, and edge_props for m_edge_properties + m_column.swap(targets); + this->m_edge_properties.swap(edge_props); + } + + // From any graph (slow and uses a lot of memory) + // Requires IncidenceGraph and a vertex index map + // Internal helper function + // Note that numedges must be doubled for undirected source graphs + template<typename Graph, typename VertexIndexMap> + void + assign(const Graph& g, const VertexIndexMap& vi, + vertices_size_type numverts, edges_size_type numedges) + { + m_rowstart.resize(numverts + 1); + m_column.resize(numedges); + EdgeIndex current_edge = 0; + typedef typename boost::graph_traits<Graph>::vertex_descriptor g_vertex; + typedef typename boost::graph_traits<Graph>::edge_descriptor g_edge; + typedef typename boost::graph_traits<Graph>::out_edge_iterator + g_out_edge_iter; + + std::vector<g_vertex> ordered_verts_of_g(numverts); + BGL_FORALL_VERTICES_T(v, g, Graph) { + ordered_verts_of_g[get(vertex_index, g, v)] = v; + } + for (Vertex i = 0; i != numverts; ++i) { + m_rowstart[i] = current_edge; + g_vertex v = ordered_verts_of_g[i]; + g_out_edge_iter ei, ei_end; + for (tie(ei, ei_end) = out_edges(v, g); ei != ei_end; ++ei) { + m_column[current_edge++] = get(vi, target(*ei, g)); + } + } + m_rowstart[numverts] = current_edge; + } + + // Add edges from a sorted (smallest sources first) range of pairs and edge + // properties + template <typename BidirectionalIteratorOrig, typename EPIterOrig, + typename GlobalToLocal> + void + add_edges_sorted_internal( + BidirectionalIteratorOrig first_sorted, + BidirectionalIteratorOrig last_sorted, + EPIterOrig ep_iter_sorted, + const GlobalToLocal& global_to_local) { + typedef boost::reverse_iterator<BidirectionalIteratorOrig> BidirectionalIterator; + typedef boost::reverse_iterator<EPIterOrig> EPIter; + // Flip sequence + BidirectionalIterator first(last_sorted); + BidirectionalIterator last(first_sorted); + typedef Vertex vertex_t; + typedef Vertex vertex_num; + typedef EdgeIndex edge_num; + edge_num new_edge_count = std::distance(first, last); + + EPIter ep_iter(ep_iter_sorted); + std::advance(ep_iter, -(std::ptrdiff_t)new_edge_count); + edge_num edges_added_before_i = new_edge_count; // Count increment to add to rowstarts + m_column.resize(m_column.size() + new_edge_count); + inherited_edge_properties::resize(inherited_edge_properties::size() + new_edge_count); + BidirectionalIterator current_new_edge = first, prev_new_edge = first; + EPIter current_new_edge_prop = ep_iter; + for (vertex_num i_plus_1 = m_rowstart.size() - 1; i_plus_1 > 0; --i_plus_1) { + vertex_num i = i_plus_1 - 1; + prev_new_edge = current_new_edge; + // edges_added_to_this_vertex = #mbrs of new_edges with first == i + edge_num edges_added_to_this_vertex = 0; + while (current_new_edge != last) { + if (get(global_to_local, current_new_edge->first) != i) break; + ++current_new_edge; + ++current_new_edge_prop; + ++edges_added_to_this_vertex; + } + edges_added_before_i -= edges_added_to_this_vertex; + // Invariant: edges_added_before_i = #mbrs of new_edges with first < i + edge_num old_rowstart = m_rowstart[i]; + edge_num new_rowstart = m_rowstart[i] + edges_added_before_i; + edge_num old_degree = m_rowstart[i + 1] - m_rowstart[i]; + edge_num new_degree = old_degree + edges_added_to_this_vertex; + // Move old edges forward (by #new_edges before this i) to make room + // new_rowstart > old_rowstart, so use copy_backwards + if (old_rowstart != new_rowstart) { + std::copy_backward(m_column.begin() + old_rowstart, + m_column.begin() + old_rowstart + old_degree, + m_column.begin() + new_rowstart + old_degree); + inherited_edge_properties::move_range(old_rowstart, old_rowstart + old_degree, new_rowstart); + } + // Add new edges (reversed because current_new_edge is a + // const_reverse_iterator) + BidirectionalIterator temp = current_new_edge; + EPIter temp_prop = current_new_edge_prop; + for (; temp != prev_new_edge; ++old_degree) { + --temp; + --temp_prop; + m_column[new_rowstart + old_degree] = temp->second; + inherited_edge_properties::write_by_index(new_rowstart + old_degree, *temp_prop); + } + m_rowstart[i + 1] = new_rowstart + new_degree; + if (edges_added_before_i == 0) break; // No more edges inserted before this point + // m_rowstart[i] will be fixed up on the next iteration (to avoid + // changing the degree of vertex i - 1); the last iteration never changes + // it (either because of the condition of the break or because + // m_rowstart[0] is always 0) + } + } + + }; + + template<typename Vertex, typename EdgeIndex> + class csr_edge_descriptor + { + public: + Vertex src; + EdgeIndex idx; + + csr_edge_descriptor(Vertex src, EdgeIndex idx): src(src), idx(idx) {} + csr_edge_descriptor(): src(0), idx(0) {} + + bool operator==(const csr_edge_descriptor& e) const {return idx == e.idx;} + bool operator!=(const csr_edge_descriptor& e) const {return idx != e.idx;} + bool operator<(const csr_edge_descriptor& e) const {return idx < e.idx;} + bool operator>(const csr_edge_descriptor& e) const {return idx > e.idx;} + bool operator<=(const csr_edge_descriptor& e) const {return idx <= e.idx;} + bool operator>=(const csr_edge_descriptor& e) const {return idx >= e.idx;} + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & src & idx; + } + }; + + // Common out edge and edge iterators + template<typename CSRGraph> + class csr_out_edge_iterator + : public iterator_facade<csr_out_edge_iterator<CSRGraph>, + typename CSRGraph::edge_descriptor, + std::random_access_iterator_tag, + const typename CSRGraph::edge_descriptor&, + typename int_t<CHAR_BIT * sizeof(typename CSRGraph::edges_size_type)>::fast> + { + public: + typedef typename CSRGraph::edges_size_type EdgeIndex; + typedef typename CSRGraph::edge_descriptor edge_descriptor; + typedef typename int_t<CHAR_BIT * sizeof(EdgeIndex)>::fast difference_type; + + csr_out_edge_iterator() {} + // Implicit copy constructor OK + explicit csr_out_edge_iterator(edge_descriptor edge) : m_edge(edge) { } + + public: // GCC 4.2.1 doesn't like the private-and-friend thing + // iterator_facade requirements + const edge_descriptor& dereference() const { return m_edge; } + + bool equal(const csr_out_edge_iterator& other) const + { return m_edge == other.m_edge; } + + void increment() { ++m_edge.idx; } + void decrement() { --m_edge.idx; } + void advance(difference_type n) { m_edge.idx += n; } + + difference_type distance_to(const csr_out_edge_iterator& other) const + { return other.m_edge.idx - m_edge.idx; } + + edge_descriptor m_edge; + + friend class iterator_core_access; + }; + + template<typename CSRGraph> + class csr_edge_iterator + : public iterator_facade<csr_edge_iterator<CSRGraph>, + typename CSRGraph::edge_descriptor, + boost::forward_traversal_tag, + typename CSRGraph::edge_descriptor> + { + private: + typedef typename CSRGraph::edge_descriptor edge_descriptor; + typedef typename CSRGraph::edges_size_type EdgeIndex; + + public: + csr_edge_iterator() : rowstart_array(0), current_edge(), end_of_this_vertex(0), total_num_edges(0) {} + + csr_edge_iterator(const CSRGraph& graph, + edge_descriptor current_edge, + EdgeIndex end_of_this_vertex) + : rowstart_array(&graph.m_forward.m_rowstart[0]), + current_edge(current_edge), + end_of_this_vertex(end_of_this_vertex), + total_num_edges(num_edges(graph)) {} + + public: // See above + friend class boost::iterator_core_access; + + edge_descriptor dereference() const {return current_edge;} + + bool equal(const csr_edge_iterator& o) const { + return current_edge == o.current_edge; + } + + void increment() { + ++current_edge.idx; + if (current_edge.idx == total_num_edges) return; + while (current_edge.idx == end_of_this_vertex) { + ++current_edge.src; + end_of_this_vertex = rowstart_array[current_edge.src + 1]; + } + } + + const EdgeIndex* rowstart_array; + edge_descriptor current_edge; + EdgeIndex end_of_this_vertex; + EdgeIndex total_num_edges; + }; + + // Only for bidirectional graphs + template<typename CSRGraph> + class csr_in_edge_iterator + : public iterator_facade<csr_in_edge_iterator<CSRGraph>, + typename CSRGraph::edge_descriptor, + boost::forward_traversal_tag, + typename CSRGraph::edge_descriptor> + { + public: + typedef typename CSRGraph::edges_size_type EdgeIndex; + typedef typename CSRGraph::edge_descriptor edge_descriptor; + + csr_in_edge_iterator() {} + // Implicit copy constructor OK + csr_in_edge_iterator(const CSRGraph& graph, + EdgeIndex index_in_backward_graph) + : m_graph(graph), m_index_in_backward_graph(index_in_backward_graph) {} + + public: // See above + // iterator_facade requirements + edge_descriptor dereference() const { + return edge_descriptor( + m_graph.m_backward.m_column[m_index_in_backward_graph], + m_graph.m_backward.m_edge_properties[m_index_in_backward_graph]); + } + + bool equal(const csr_in_edge_iterator& other) const + { return m_index_in_backward_graph == other.m_index_in_backward_graph; } + + void increment() { ++m_index_in_backward_graph; } + void decrement() { --m_index_in_backward_graph; } + void advance(std::ptrdiff_t n) { m_index_in_backward_graph += n; } + + std::ptrdiff_t distance_to(const csr_in_edge_iterator& other) const + { return other.m_index_in_backward_graph - m_index_in_backward_graph; } + + EdgeIndex m_index_in_backward_graph; + const CSRGraph& m_graph; + + friend class iterator_core_access; + }; + + template <typename A, typename B> + struct transpose_pair { + typedef std::pair<B, A> result_type; + result_type operator()(const std::pair<A, B>& p) const { + return result_type(p.second, p.first); + } + }; + + template <typename Iter> + struct transpose_iterator_gen { + typedef typename std::iterator_traits<Iter>::value_type vt; + typedef typename vt::first_type first_type; + typedef typename vt::second_type second_type; + typedef transpose_pair<first_type, second_type> transpose; + typedef boost::transform_iterator<transpose, Iter> type; + static type make(Iter it) { + return type(it, transpose()); + } + }; + + template <typename Iter> + typename transpose_iterator_gen<Iter>::type transpose_edges(Iter i) { + return transpose_iterator_gen<Iter>::make(i); + } + + template<typename GraphT, typename VertexIndexMap> + class edge_to_index_pair + { + typedef typename boost::graph_traits<GraphT>::vertices_size_type + vertices_size_type; + typedef typename boost::graph_traits<GraphT>::edge_descriptor edge_descriptor; + + public: + typedef std::pair<vertices_size_type, vertices_size_type> result_type; + + edge_to_index_pair() : g(0), index() { } + edge_to_index_pair(const GraphT& g, const VertexIndexMap& index) + : g(&g), index(index) + { } + + result_type operator()(edge_descriptor e) const + { + return result_type(get(index, source(e, *g)), get(index, target(e, *g))); + } + + private: + const GraphT* g; + VertexIndexMap index; + }; + + template<typename GraphT, typename VertexIndexMap> + edge_to_index_pair<GraphT, VertexIndexMap> + make_edge_to_index_pair(const GraphT& g, const VertexIndexMap& index) + { + return edge_to_index_pair<GraphT, VertexIndexMap>(g, index); + } + + template<typename GraphT> + edge_to_index_pair + <GraphT, + typename boost::property_map<GraphT,boost::vertex_index_t>::const_type> + make_edge_to_index_pair(const GraphT& g) + { + typedef typename boost::property_map<GraphT, + boost::vertex_index_t>::const_type + VertexIndexMap; + return edge_to_index_pair<GraphT, VertexIndexMap>(g, + get(boost::vertex_index, + g)); + } + + template<typename GraphT, typename VertexIndexMap, typename Iter> + boost::transform_iterator<edge_to_index_pair<GraphT, VertexIndexMap>, Iter> + make_edge_to_index_pair_iter(const GraphT& g, const VertexIndexMap& index, + Iter it) { + return boost::transform_iterator<edge_to_index_pair<GraphT, VertexIndexMap>, Iter>(it, edge_to_index_pair<GraphT, VertexIndexMap>(g, index)); + } + +} // namespace detail + + template<typename Vertex, typename EdgeIndex> + struct hash<detail::csr_edge_descriptor<Vertex, EdgeIndex> > + { + std::size_t operator() + (detail::csr_edge_descriptor<Vertex, EdgeIndex> const& x) const + { + std::size_t hash = hash_value(x.src); + hash_combine(hash, x.idx); + return hash; + } + }; + +} // namespace boost + +#endif // BOOST_GRAPH_COMPRESSED_SPARSE_ROW_STRUCT_HPP diff --git a/Utilities/BGL/boost/graph/detail/d_ary_heap.hpp b/Utilities/BGL/boost/graph/detail/d_ary_heap.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2ec716d3af322663a882c199452babb5cc75d7e0 --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/d_ary_heap.hpp @@ -0,0 +1,305 @@ +// +//======================================================================= +// Copyright 2009 Trustees of Indiana University +// Authors: Jeremiah J. Willcock, Andrew Lumsdaine +// +// 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_D_ARY_HEAP_HPP +#define BOOST_D_ARY_HEAP_HPP + +#include <vector> +#include <cstddef> +#include <algorithm> +#include <utility> +#include <cassert> +#include <boost/static_assert.hpp> +#include <boost/shared_array.hpp> +#include <boost/property_map/property_map.hpp> + +namespace boost { + + // Swap two elements in a property map without assuming they model + // LvaluePropertyMap -- currently not used + template <typename PropMap> + inline void property_map_swap( + PropMap prop_map, + const typename boost::property_traits<PropMap>::key_type& ka, + const typename boost::property_traits<PropMap>::key_type& kb) { + typename boost::property_traits<PropMap>::value_type va = get(prop_map, ka); + put(prop_map, ka, get(prop_map, kb)); + put(prop_map, kb, va); + } + + namespace detail { + template <typename Value> + class fixed_max_size_vector { + boost::shared_array<Value> m_data; + std::size_t m_size; + + public: + typedef std::size_t size_type; + fixed_max_size_vector(std::size_t max_size) + : m_data(new Value[max_size]), m_size(0) {} + std::size_t size() const {return m_size;} + bool empty() const {return m_size == 0;} + Value& operator[](std::size_t i) {return m_data[i];} + const Value& operator[](std::size_t i) const {return m_data[i];} + void push_back(Value v) {m_data[m_size++] = v;} + void pop_back() {--m_size;} + Value& back() {return m_data[m_size - 1];} + const Value& back() const {return m_data[m_size - 1];} + }; + } + + // D-ary heap using an indirect compare operator (use identity_property_map + // as DistanceMap to get a direct compare operator). This heap appears to be + // commonly used for Dijkstra's algorithm for its good practical performance + // on some platforms; asymptotically, it has an O(lg N) decrease-key + // operation while that can be done in constant time on a relaxed heap. The + // implementation is mostly based on the binary heap page on Wikipedia and + // online sources that state that the operations are the same for d-ary + // heaps. This code is not based on the old Boost d-ary heap code. + // + // - d_ary_heap_indirect is a model of UpdatableQueue as is needed for + // dijkstra_shortest_paths. + // + // - Value must model Assignable. + // - Arity must be at least 2 (optimal value appears to be 4, both in my and + // third-party experiments). + // - IndexInHeapMap must be a ReadWritePropertyMap from Value to + // Container::size_type (to store the index of each stored value within the + // heap for decrease-key aka update). + // - DistanceMap must be a ReadablePropertyMap from Value to something + // (typedef'ed as distance_type). + // - Compare must be a BinaryPredicate used as a less-than operator on + // distance_type. + // - Container must be a random-access, contiguous container (in practice, + // the operations used probably require that it is std::vector<Value>). + // + template <typename Value, + std::size_t Arity, + typename IndexInHeapPropertyMap, + typename DistanceMap, + typename Compare = std::less<Value>, + typename Container = std::vector<Value> > + class d_ary_heap_indirect { + BOOST_STATIC_ASSERT (Arity >= 2); + + public: + typedef typename Container::size_type size_type; + typedef Value value_type; + + d_ary_heap_indirect(DistanceMap distance, + IndexInHeapPropertyMap index_in_heap, + const Compare& compare = Compare(), + const Container& data = Container()) + : compare(compare), data(data), distance(distance), + index_in_heap(index_in_heap) {} + /* Implicit copy constructor */ + /* Implicit assignment operator */ + + size_type size() const { + return data.size(); + } + + bool empty() const { + return data.empty(); + } + + void push(const Value& v) { + size_type index = data.size(); + data.push_back(v); + put(index_in_heap, v, index); + preserve_heap_property_up(index); + verify_heap(); + } + + Value& top() { + return data[0]; + } + + const Value& top() const { + return data[0]; + } + + void pop() { + put(index_in_heap, data[0], (size_type)(-1)); + if (data.size() != 1) { + data[0] = data.back(); + put(index_in_heap, data[0], 0); + data.pop_back(); + preserve_heap_property_down(); + verify_heap(); + } else { + data.pop_back(); + } + } + + // This function assumes the key has been updated (using an external write + // to the distance map or such) + // See http://coding.derkeiler.com/Archive/General/comp.theory/2007-05/msg00043.html + void update(const Value& v) { /* decrease-key */ + size_type index = get(index_in_heap, v); + preserve_heap_property_up(index); + verify_heap(); + } + + bool contains(const Value& v) const { + size_type index = get(index_in_heap, v); + return (index != (size_type)(-1)); + } + + void push_or_update(const Value& v) { /* insert if not present, else update */ + size_type index = get(index_in_heap, v); + if (index == (size_type)(-1)) { + index = data.size(); + data.push_back(v); + put(index_in_heap, v, index); + } + preserve_heap_property_up(index); + verify_heap(); + } + + private: + Compare compare; + Container data; + DistanceMap distance; + IndexInHeapPropertyMap index_in_heap; + + // The distances being compared using compare and that are stored in the + // distance map + typedef typename boost::property_traits<DistanceMap>::value_type distance_type; + + // Get the parent of a given node in the heap + static size_type parent(size_type index) { + return (index - 1) / Arity; + } + + // Get the child_idx'th child of a given node; 0 <= child_idx < Arity + static size_type child(size_type index, std::size_t child_idx) { + return index * Arity + child_idx + 1; + } + + // Swap two elements in the heap by index, updating index_in_heap + void swap_heap_elements(size_type index_a, size_type index_b) { + using std::swap; + Value value_a = data[index_a]; + Value value_b = data[index_b]; + data[index_a] = value_b; + data[index_b] = value_a; + put(index_in_heap, value_a, index_b); + put(index_in_heap, value_b, index_a); + } + + // Emulate the indirect_cmp that is now folded into this heap class + bool compare_indirect(const Value& a, const Value& b) const { + return compare(get(distance, a), get(distance, b)); + } + + // Verify that the array forms a heap; commented out by default + void verify_heap() const { + // This is a very expensive test so it should be disabled even when + // NDEBUG is not defined +#if 0 + for (size_t i = 1; i < data.size(); ++i) { + if (compare_indirect(data[i], data[parent(i)])) { + assert (!"Element is smaller than its parent"); + } + } +#endif + } + + // Starting at a node, move up the tree swapping elements to preserve the + // heap property + void preserve_heap_property_up(size_type index) { + size_type orig_index = index; + size_type num_levels_moved = 0; + // The first loop just saves swaps that need to be done in order to avoid + // aliasing issues in its search; there is a second loop that does the + // necessary swap operations + if (index == 0) return; // Do nothing on root + Value currently_being_moved = data[index]; + distance_type currently_being_moved_dist = + get(distance, currently_being_moved); + for (;;) { + if (index == 0) break; // Stop at root + size_type parent_index = parent(index); + Value parent_value = data[parent_index]; + if (compare(currently_being_moved_dist, get(distance, parent_value))) { + ++num_levels_moved; + index = parent_index; + continue; + } else { + break; // Heap property satisfied + } + } + // Actually do the moves -- move num_levels_moved elements down in the + // tree, then put currently_being_moved at the top + index = orig_index; + for (size_type i = 0; i < num_levels_moved; ++i) { + size_type parent_index = parent(index); + Value parent_value = data[parent_index]; + put(index_in_heap, parent_value, index); + data[index] = parent_value; + index = parent_index; + } + data[index] = currently_being_moved; + put(index_in_heap, currently_being_moved, index); + verify_heap(); + } + + // From the root, swap elements (each one with its smallest child) if there + // are any parent-child pairs that violate the heap property + void preserve_heap_property_down() { + if (data.empty()) return; + size_type index = 0; + Value currently_being_moved = data[0]; + distance_type currently_being_moved_dist = + get(distance, currently_being_moved); + size_type heap_size = data.size(); + Value* data_ptr = &data[0]; + for (;;) { + size_type first_child_index = child(index, 0); + if (first_child_index >= heap_size) break; /* No children */ + Value* child_base_ptr = data_ptr + first_child_index; + size_type smallest_child_index = 0; + distance_type smallest_child_dist = get(distance, child_base_ptr[smallest_child_index]); + if (first_child_index + Arity <= heap_size) { + // Special case for a statically known loop count (common case) + for (size_t i = 1; i < Arity; ++i) { + Value i_value = child_base_ptr[i]; + distance_type i_dist = get(distance, i_value); + if (compare(i_dist, smallest_child_dist)) { + smallest_child_index = i; + smallest_child_dist = i_dist; + } + } + } else { + for (size_t i = 1; i < heap_size - first_child_index; ++i) { + distance_type i_dist = get(distance, child_base_ptr[i]); + if (compare(i_dist, smallest_child_dist)) { + smallest_child_index = i; + smallest_child_dist = i_dist; + } + } + } + if (compare(smallest_child_dist, currently_being_moved_dist)) { + swap_heap_elements(smallest_child_index + first_child_index, index); + index = smallest_child_index + first_child_index; + continue; + } else { + break; // Heap property satisfied + } + } + verify_heap(); + } + + }; + +} // namespace boost + +#endif // BOOST_D_ARY_HEAP_HPP diff --git a/Utilities/BGL/boost/graph/detail/edge.hpp b/Utilities/BGL/boost/graph/detail/edge.hpp index 8ab375f064cb855a0a318b7ad9c21bbfede8a0cc..da085973a75b2820849f4ae11ae6a461a0b915ed 100644 --- a/Utilities/BGL/boost/graph/detail/edge.hpp +++ b/Utilities/BGL/boost/graph/detail/edge.hpp @@ -49,7 +49,7 @@ namespace boost { // protected: property_type* m_eproperty; }; - + template <class D, class V> inline bool operator==(const detail::edge_desc_impl<D,V>& a, @@ -65,6 +65,36 @@ namespace boost { return ! (a.get_property() == b.get_property()); } + // Order edges according to the address of their property object + template <class D, class V> + inline bool + operator<(const detail::edge_desc_impl<D,V>& a, + const detail::edge_desc_impl<D,V>& b) + { + return a.get_property() < b.get_property(); + } + template <class D, class V> + inline bool + operator<=(const detail::edge_desc_impl<D,V>& a, + const detail::edge_desc_impl<D,V>& b) + { + return a.get_property() <= b.get_property(); + } + template <class D, class V> + inline bool + operator>(const detail::edge_desc_impl<D,V>& a, + const detail::edge_desc_impl<D,V>& b) + { + return a.get_property() > b.get_property(); + } + template <class D, class V> + inline bool + operator>=(const detail::edge_desc_impl<D,V>& a, + const detail::edge_desc_impl<D,V>& b) + { + return a.get_property() >= b.get_property(); + } + } //namespace detail } // namespace boost diff --git a/Utilities/BGL/boost/graph/detail/geodesic.hpp b/Utilities/BGL/boost/graph/detail/geodesic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..99edaf9e39966757bcfb7703f36d088358ebb5c6 --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/geodesic.hpp @@ -0,0 +1,130 @@ +// (C) Copyright 2007 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DETAIL_GEODESIC_HPP +#define BOOST_GRAPH_DETAIL_GEODESIC_HPP + +#include <functional> +#include <boost/config.hpp> +#include <boost/graph/graph_concepts.hpp> +#include <boost/graph/numeric_values.hpp> + +// TODO: Should this really be in detail? + +namespace boost +{ +// This is a very good discussion on centrality measures. While I can't +// say that this has been the motivating factor for the design and +// implementation of ths centrality framework, it does provide a single +// point of reference for defining things like degree and closeness +// centrality. Plus, the bibliography seems fairly complete. +// +// @article{citeulike:1144245, +// author = {Borgatti, Stephen P. and Everett, Martin G.}, +// citeulike-article-id = {1144245}, +// doi = {10.1016/j.socnet.2005.11.005}, +// journal = {Social Networks}, +// month = {October}, +// number = {4}, +// pages = {466--484}, +// priority = {0}, +// title = {A Graph-theoretic perspective on centrality}, +// url = {http://dx.doi.org/10.1016/j.socnet.2005.11.005}, +// volume = {28}, +// year = {2006} +// } +// } + +namespace detail { + // Note that this assumes T == property_traits<DistanceMap>::value_type + // and that the args and return of combine are also T. + template <typename Graph, + typename DistanceMap, + typename Combinator, + typename Distance> + inline Distance + combine_distances(const Graph& g, + DistanceMap dist, + Combinator combine, + Distance init) + { + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >(); + function_requires< NumericValueConcept<Distance> >(); + typedef numeric_values<Distance> DistanceNumbers; + function_requires< AdaptableBinaryFunction<Combinator,Distance,Distance,Distance> >(); + + // If there's ever an infinite distance, then we simply return + // infinity. Note that this /will/ include the a non-zero + // distance-to-self in the combined values. However, this is usually + // zero, so it shouldn't be too problematic. + Distance ret = init; + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + Vertex v = *i; + if(get(dist, v) != DistanceNumbers::infinity()) { + ret = combine(ret, get(dist, v)); + } + else { + ret = DistanceNumbers::infinity(); + break; + } + } + return ret; + } + + // Similar to std::plus<T>, but maximizes parameters + // rather than adding them. + template <typename T> + struct maximize : public std::binary_function<T, T, T> + { + T operator ()(T x, T y) const + { BOOST_USING_STD_MAX(); return max BOOST_PREVENT_MACRO_SUBSTITUTION (x, y); } + }; + + // Another helper, like maximize() to help abstract functional + // concepts. This is trivially instantiated for builtin numeric + // types, but should be specialized for those types that have + // discrete notions of reciprocals. + template <typename T> + struct reciprocal : public std::unary_function<T, T> + { + typedef std::unary_function<T, T> function_type; + typedef typename function_type::result_type result_type; + typedef typename function_type::argument_type argument_type; + T operator ()(T t) + { return T(1) / t; } + }; +} /* namespace detail */ + +// This type defines the basic facilities used for computing values +// based on the geodesic distances between vertices. Examples include +// closeness centrality and mean geodesic distance. +template <typename Graph, typename DistanceType, typename ResultType> +struct geodesic_measure +{ + typedef DistanceType distance_type; + typedef ResultType result_type; + typedef typename graph_traits<Graph>::vertices_size_type size_type; + + typedef numeric_values<distance_type> distance_values; + typedef numeric_values<result_type> result_values; + + static inline distance_type infinite_distance() + { return distance_values::infinity(); } + + static inline result_type infinite_result() + { return result_values::infinity(); } + + static inline result_type zero_result() + { return result_values::zero(); } +}; + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/detail/histogram_sort.hpp b/Utilities/BGL/boost/graph/detail/histogram_sort.hpp new file mode 100644 index 0000000000000000000000000000000000000000..742c6f96397d7721cd0a858f4a8b54f39479c9fd --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/histogram_sort.hpp @@ -0,0 +1,286 @@ +// Copyright 2009 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_DETAIL_HISTOGRAM_SORT_HPP +#define BOOST_GRAPH_DETAIL_HISTOGRAM_SORT_HPP + +namespace boost { + namespace graph { + namespace detail { + +template<typename InputIterator> +size_t +reserve_count_for_single_pass_helper(InputIterator, InputIterator, + std::input_iterator_tag) +{ + // Do nothing: we have no idea how much storage to reserve. + return 0; +} + +template<typename InputIterator> +size_t +reserve_count_for_single_pass_helper(InputIterator first, InputIterator last, + std::random_access_iterator_tag) +{ + using std::distance; + typename std::iterator_traits<InputIterator>::difference_type n = + distance(first, last); + return (size_t)n; +} + +template<typename InputIterator> +size_t +reserve_count_for_single_pass(InputIterator first, InputIterator last) { + typedef typename std::iterator_traits<InputIterator>::iterator_category + category; + return reserve_count_for_single_pass_helper(first, last, category()); +} + +template <typename KeyIterator, typename RowstartIterator, + typename VerticesSize, typename KeyFilter, typename KeyTransform> +void +count_starts + (KeyIterator begin, KeyIterator end, + RowstartIterator starts, // Must support numverts + 1 elements + VerticesSize numkeys, + KeyFilter key_filter, + KeyTransform key_transform) { + + typedef VerticesSize vertices_size_type; + typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; + + // Put the degree of each vertex v into m_rowstart[v + 1] + for (KeyIterator i = begin; i != end; ++i) { + if (key_filter(*i)) { + ++starts[key_transform(*i) + 1]; + } + } + + // Compute the partial sum of the degrees to get the actual values of + // m_rowstart + EdgeIndex start_of_this_row = 0; + starts[0] = start_of_this_row; + for (vertices_size_type i = 1; i <= numkeys; ++i) { + start_of_this_row += starts[i]; + starts[i] = start_of_this_row; + } +} + +template <typename KeyIterator, typename RowstartIterator, + typename NumKeys, + typename Value1InputIter, + typename Value1OutputIter, typename KeyFilter, typename KeyTransform> +void +histogram_sort(KeyIterator key_begin, KeyIterator key_end, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1InputIter values1_begin, + Value1OutputIter values1_out, + KeyFilter key_filter, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; + + // Histogram sort the edges by their source vertices, putting the targets + // into m_column. The index current_insert_positions[v] contains the next + // location to insert out edges for vertex v. + std::vector<EdgeIndex> + current_insert_positions(rowstart, rowstart + numkeys); + Value1InputIter v1i = values1_begin; + for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i) { + if (key_filter(*i)) { + vertices_size_type source = key_transform(*i); + EdgeIndex insert_pos = current_insert_positions[source]; + ++current_insert_positions[source]; + values1_out[insert_pos] = *v1i; + } + } +} + +template <typename KeyIterator, typename RowstartIterator, + typename NumKeys, + typename Value1InputIter, + typename Value1OutputIter, + typename Value2InputIter, + typename Value2OutputIter, + typename KeyFilter, typename KeyTransform> +void +histogram_sort(KeyIterator key_begin, KeyIterator key_end, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1InputIter values1_begin, + Value1OutputIter values1_out, + Value2InputIter values2_begin, + Value2OutputIter values2_out, + KeyFilter key_filter, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; + + // Histogram sort the edges by their source vertices, putting the targets + // into m_column. The index current_insert_positions[v] contains the next + // location to insert out edges for vertex v. + std::vector<EdgeIndex> + current_insert_positions(rowstart, rowstart + numkeys); + Value1InputIter v1i = values1_begin; + Value2InputIter v2i = values2_begin; + for (KeyIterator i = key_begin; i != key_end; ++i, ++v1i, ++v2i) { + if (key_filter(*i)) { + vertices_size_type source = key_transform(*i); + EdgeIndex insert_pos = current_insert_positions[source]; + ++current_insert_positions[source]; + values1_out[insert_pos] = *v1i; + values2_out[insert_pos] = *v2i; + } + } +} + +template <typename KeyIterator, typename RowstartIterator, + typename NumKeys, + typename Value1Iter, + typename KeyTransform> +void +histogram_sort_inplace(KeyIterator key_begin, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1Iter values1, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; + + // 1. Copy m_rowstart (except last element) to get insert positions + std::vector<EdgeIndex> insert_positions(rowstart, rowstart + numkeys); + // 2. Swap the sources and targets into place + for (size_t i = 0; i < rowstart[numkeys]; ++i) { + // While edge i is not in the right bucket: + while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { + // Add a slot in the right bucket + size_t target_pos = insert_positions[key_transform(key_begin[i])]++; + assert (target_pos < rowstart[key_transform(key_begin[i]) + 1]); + if (target_pos == i) continue; + // Swap this edge into place + using std::swap; + swap(key_begin[i], key_begin[target_pos]); + swap(values1[i], values1[target_pos]); + } + } +} + +template <typename KeyIterator, typename RowstartIterator, + typename NumKeys, + typename Value1Iter, + typename Value2Iter, + typename KeyTransform> +void +histogram_sort_inplace(KeyIterator key_begin, + RowstartIterator rowstart, // Must support numkeys + 1 elements and be precomputed + NumKeys numkeys, + Value1Iter values1, + Value2Iter values2, + KeyTransform key_transform) { + + typedef NumKeys vertices_size_type; + typedef typename std::iterator_traits<RowstartIterator>::value_type EdgeIndex; + + // 1. Copy m_rowstart (except last element) to get insert positions + std::vector<EdgeIndex> insert_positions(rowstart, rowstart + numkeys); + // 2. Swap the sources and targets into place + for (size_t i = 0; i < rowstart[numkeys]; ++i) { + // While edge i is not in the right bucket: + while (!(i >= rowstart[key_transform(key_begin[i])] && i < insert_positions[key_transform(key_begin[i])])) { + // Add a slot in the right bucket + size_t target_pos = insert_positions[key_transform(key_begin[i])]++; + assert (target_pos < rowstart[key_transform(key_begin[i]) + 1]); + if (target_pos == i) continue; + // Swap this edge into place + using std::swap; + swap(key_begin[i], key_begin[target_pos]); + swap(values1[i], values1[target_pos]); + swap(values2[i], values2[target_pos]); + } + } +} + +template <typename InputIterator, typename VerticesSize> +void split_into_separate_coords(InputIterator begin, InputIterator end, + std::vector<VerticesSize>& firsts, + std::vector<VerticesSize>& seconds) { + firsts.clear(); + seconds.clear(); + size_t reserve_size + = detail::reserve_count_for_single_pass(begin, end); + firsts.reserve(reserve_size); + seconds.reserve(reserve_size); + for (; begin != end; ++begin) { + std::pair<VerticesSize, VerticesSize> edge = *begin; + firsts.push_back(edge.first); + seconds.push_back(edge.second); + } +} + +template <typename InputIterator, typename VerticesSize, typename SourceFilter> +void split_into_separate_coords_filtered + (InputIterator begin, InputIterator end, + std::vector<VerticesSize>& firsts, + std::vector<VerticesSize>& seconds, + const SourceFilter& filter) { + firsts.clear(); + seconds.clear(); + for (; begin != end; ++begin) { + std::pair<VerticesSize, VerticesSize> edge = *begin; + if (filter(edge.first)) { + firsts.push_back(edge.first); + seconds.push_back(edge.second); + } + } +} + +template <typename InputIterator, typename PropInputIterator, + typename VerticesSize, typename PropType, typename SourceFilter> +void split_into_separate_coords_filtered + (InputIterator begin, InputIterator end, + PropInputIterator props, + std::vector<VerticesSize>& firsts, + std::vector<VerticesSize>& seconds, + std::vector<PropType>& props_out, + const SourceFilter& filter) { + firsts.clear(); + seconds.clear(); + props_out.clear(); + for (; begin != end; ++begin) { + std::pair<VerticesSize, VerticesSize> edge = *begin; + if (filter(edge.first)) { + firsts.push_back(edge.first); + seconds.push_back(edge.second); + props_out.push_back(*props); + } + ++props; + } +} + +template <typename Pair> +struct project1st { + typedef typename Pair::first_type result_type; + const result_type& operator()(const Pair& p) const {return p.first;} +}; + +template <typename Pair> +struct project2nd { + typedef typename Pair::second_type result_type; + const result_type& operator()(const Pair& p) const {return p.second;} +}; + + } + } +} + +#endif // BOOST_GRAPH_DETAIL_HISTOGRAM_SORT_HPP diff --git a/Utilities/BGL/boost/graph/detail/incremental_components.hpp b/Utilities/BGL/boost/graph/detail/incremental_components.hpp index cf08bea09121dd19297f362d9a4a3013619eebbc..b13b93dabef548e82d5fa1022c8dcb49306576e2 100644 --- a/Utilities/BGL/boost/graph/detail/incremental_components.hpp +++ b/Utilities/BGL/boost/graph/detail/incremental_components.hpp @@ -1,6 +1,7 @@ //======================================================================= // Copyright 2002 Indiana University. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// Copyright 2009 Trustees of Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Michael Hansen // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -11,129 +12,64 @@ #define BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP #include <boost/operators.hpp> -#include <boost/pending/disjoint_sets.hpp> namespace boost { namespace detail { - //========================================================================= - // Implementation detail of incremental_components + // Iterator for a component index linked list. The contents of + // each array element represent the next index in the list. A + // special value (the maximum index + 1) is used to terminate a + // list. + template <typename IndexRandomAccessIterator> + class component_index_iterator : + boost::forward_iterator_helper<component_index_iterator<IndexRandomAccessIterator>, + typename std::iterator_traits<IndexRandomAccessIterator>::value_type, + typename std::iterator_traits<IndexRandomAccessIterator>::difference_type, + typename std::iterator_traits<IndexRandomAccessIterator>::pointer, + typename std::iterator_traits<IndexRandomAccessIterator>::reference> { + private: + typedef component_index_iterator<IndexRandomAccessIterator> self; - //------------------------------------------------------------------------- - // Helper functions for the component_index class - - // Record the representative vertices in the header array. - // Representative vertices now point to the component number. - - template <class Parent, class OutputIterator, class Integer> - inline void - build_components_header(Parent p, - OutputIterator header, - Integer num_nodes) - { - Parent component = p; - Integer component_num = 0; - for (Integer v = 0; v != num_nodes; ++v) - if (p[v] == v) { - *header++ = v; - component[v] = component_num++; - } - } - - - // Pushes x onto the front of the list. The list is represented in - // an array. - template <class Next, class T, class V> - inline void array_push_front(Next next, T& head, V x) - { - T tmp = head; - head = x; - next[x] = tmp; - } - - - // Create a linked list of the vertices in each component - // by reusing the representative array. - template <class Parent1, class Parent2, - class Integer> - void - link_components(Parent1 component, Parent2 header, - Integer num_nodes, Integer num_components) - { - // Make the non-representative vertices point to their component - Parent1 representative = component; - for (Integer v = 0; v != num_nodes; ++v) - if (component[v] >= num_components - || header[component[v]] != v) - component[v] = component[representative[v]]; - - // initialize the "head" of the lists to "NULL" - std::fill_n(header, num_components, num_nodes); - - // Add each vertex to the linked list for its component - Parent1 next = component; - for (Integer k = 0; k != num_nodes; ++k) - array_push_front(next, header[component[k]], k); - } - - - - template <class IndexContainer, class HeaderContainer> - void - construct_component_index(IndexContainer& index, HeaderContainer& header) - { - typedef typename IndexContainer::value_type Integer; - build_components_header(index.begin(), - std::back_inserter(header), - Integer(index.end() - index.begin())); - - link_components(index.begin(), header.begin(), - Integer(index.end() - index.begin()), - Integer(header.end() - header.begin())); - } - - - - template <class IndexIterator, class Integer, class Distance> - class component_iterator - : boost::forward_iterator_helper< - component_iterator<IndexIterator,Integer,Distance>, - Integer, Distance,Integer*, Integer&> - { public: - typedef component_iterator self; - - IndexIterator next; - Integer node; - typedef std::forward_iterator_tag iterator_category; - typedef Integer value_type; - typedef Integer& reference; - typedef Integer* pointer; - typedef Distance difference_type; - - component_iterator() {} - component_iterator(IndexIterator x, Integer i) - : next(x), node(i) {} - Integer operator*() const { - return node; + typedef typename std::iterator_traits<IndexRandomAccessIterator>::value_type value_type; + typedef typename std::iterator_traits<IndexRandomAccessIterator>::difference_type reference; + typedef typename std::iterator_traits<IndexRandomAccessIterator>::pointer pointer; + typedef typename std::iterator_traits<IndexRandomAccessIterator>::reference difference_type; + + // Constructor for "begin" iterator + component_index_iterator(IndexRandomAccessIterator index_iterator, + value_type begin_index) : + m_index_iterator(index_iterator), + m_current_index(begin_index) { } + + // Constructor for "end" iterator (end_index should be the linked + // list terminator). + component_index_iterator(value_type end_index) : + m_current_index(end_index) { } + + inline value_type operator*() const { + return (m_current_index); } + self& operator++() { - node = next[node]; - return *this; + // Move to the next element in the linked list + m_current_index = m_index_iterator[m_current_index]; + return (*this); } - }; - - template <class IndexIterator, class Integer, class Distance> - inline bool - operator==(const component_iterator<IndexIterator, Integer, Distance>& x, - const component_iterator<IndexIterator, Integer, Distance>& y) - { - return x.node == y.node; - } - + + bool operator==(self& other_iterator) { + return (m_current_index == *other_iterator); + } + + protected: + IndexRandomAccessIterator m_index_iterator; + value_type m_current_index; + + }; // class component_index_iterator + } // namespace detail } // namespace detail diff --git a/Utilities/BGL/boost/graph/detail/index.hpp b/Utilities/BGL/boost/graph/detail/index.hpp new file mode 100644 index 0000000000000000000000000000000000000000..db1152f8c4be38dd95107106f49de26e3834b88d --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/index.hpp @@ -0,0 +1,74 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DETAIL_INDEX_HPP +#define BOOST_GRAPH_DETAIL_INDEX_HPP + +#include <boost/graph/graph_traits.hpp> + +// The structures in this module are responsible for selecting and defining +// types for accessing a builting index map. Note that the selection of these +// types requires the Graph parameter to model either VertexIndexGraph or +// EdgeIndexGraph. + +namespace boost +{ + namespace detail + { + template <typename Graph> + struct vertex_indexer + { + typedef vertex_index_t index_type; + typedef typename property_map<Graph, vertex_index_t>::type map_type; + typedef typename property_map<Graph, vertex_index_t>::const_type const_map_type; + typedef typename property_traits<map_type>::value_type value_type; + typedef typename graph_traits<Graph>::vertex_descriptor key_type; + + static const_map_type index_map(const Graph& g) + { return get(vertex_index, g); } + + static map_type index_map(Graph& g) + { return get(vertex_index, g); } + + static value_type index(key_type k, const Graph& g) + { return get(vertex_index, g, k); } + }; + + template <typename Graph> + struct edge_indexer + { + typedef edge_index_t index_type; + typedef typename property_map<Graph, edge_index_t>::type map_type; + typedef typename property_map<Graph, edge_index_t>::const_type const_map_type; + typedef typename property_traits<map_type>::value_type value_type; + typedef typename graph_traits<Graph>::edge_descriptor key_type; + + static const_map_type index_map(const Graph& g) + { return get(edge_index, g); } + + static map_type index_map(Graph& g) + { return get(edge_index, g); } + + static value_type index(key_type k, const Graph& g) + { return get(edge_index, g, k); } + }; + + // NOTE: The Graph parameter MUST be a model of VertexIndexGraph or + // VertexEdgeGraph - whichever type Key is selecting. + template <typename Graph, typename Key> + struct choose_indexer + { + typedef typename mpl::if_< + is_same<Key, typename graph_traits<Graph>::vertex_descriptor>, + vertex_indexer<Graph>, + edge_indexer<Graph> + >::type indexer_type; + typedef typename indexer_type::index_type index_type; + }; + } +} + +#endif diff --git a/Utilities/BGL/boost/graph/detail/indexed_properties.hpp b/Utilities/BGL/boost/graph/detail/indexed_properties.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7fa1548e240831a79e9b6d7b7cadf5d534dcb91d --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/indexed_properties.hpp @@ -0,0 +1,243 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine + +// Indexed properties -- used for CSR and CSR-like graphs + +#ifndef BOOST_GRAPH_INDEXED_PROPERTIES_HPP +#define BOOST_GRAPH_INDEXED_PROPERTIES_HPP + +#include <vector> +#include <utility> +#include <algorithm> +#include <climits> +#include <iterator> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/properties.hpp> +#include <boost/iterator/counting_iterator.hpp> +#include <boost/integer.hpp> +#include <boost/iterator/iterator_facade.hpp> +#include <boost/mpl/if.hpp> + +namespace boost { +namespace detail { + +template<typename Derived, typename Property, typename Descriptor> +class indexed_vertex_properties +{ +public: + typedef no_property vertex_property_type; + typedef Property vertex_bundled; + + // Directly access a vertex or edge bundle + Property& operator[](Descriptor v) + { return m_vertex_properties[get(vertex_index, derived(), v)]; } + + const Property& operator[](Descriptor v) const + { return m_vertex_properties[get(vertex_index, derived(), v)]; } + +protected: + // Default-construct with no property values + indexed_vertex_properties() {} + + // Initialize with n default-constructed property values + indexed_vertex_properties(std::size_t n) : m_vertex_properties(n) { } + +public: + // Clear the properties vector + void clear() + { + m_vertex_properties.clear(); + } + + // Resize the properties vector + void resize(std::size_t n) + { + m_vertex_properties.resize(n); + } + + // Reserve space in the vector of properties + void reserve(std::size_t n) + { + m_vertex_properties.reserve(n); + } + + // Add a new property value to the back + void push_back(const Property& prop) + { + m_vertex_properties.push_back(prop); + } + + // Write an element by raw index + void write_by_index(std::size_t idx, const Property& prop) + { + m_vertex_properties[idx] = prop; + } + + // Access to the derived object + Derived& derived() { return *static_cast<Derived*>(this); } + + const Derived& derived() const + { return *static_cast<const Derived*>(this); } + +public: // should be private, but friend templates not portable + std::vector<Property> m_vertex_properties; +}; + +template<typename Derived, typename Descriptor> +class indexed_vertex_properties<Derived, void, Descriptor> +{ + struct secret {}; + + public: + typedef no_property vertex_property_type; + typedef void vertex_bundled; + + secret operator[](secret) { return secret(); } + + protected: + // All operations do nothing. + indexed_vertex_properties() { } + indexed_vertex_properties(std::size_t) { } + +public: + void clear() { } + void resize(std::size_t) { } + void reserve(std::size_t) { } +}; + +template<typename Derived, typename Property, typename Descriptor> +class indexed_edge_properties +{ +public: + typedef no_property edge_property_type; + typedef Property edge_bundled; + typedef Property edge_push_back_type; + + // Directly access a edge or edge bundle + Property& operator[](Descriptor v) + { return m_edge_properties[get(edge_index, derived(), v)]; } + + const Property& operator[](Descriptor v) const + { return m_edge_properties[get(edge_index, derived(), v)]; } + +protected: + // Default-construct with no property values + indexed_edge_properties() {} + + // Initialize with n default-constructed property values + indexed_edge_properties(std::size_t n) : m_edge_properties(n) { } + + // Get the size of the properties vector + std::size_t size() const + { + return m_edge_properties.size(); + } + + // Clear the properties vector + void clear() + { + m_edge_properties.clear(); + } + + // Resize the properties vector + void resize(std::size_t n) + { + m_edge_properties.resize(n); + } + + // Reserve space in the vector of properties + void reserve(std::size_t n) + { + m_edge_properties.reserve(n); + } + + // Write an element by raw index + void write_by_index(std::size_t idx, const Property& prop) + { + m_edge_properties[idx] = prop; + } + + public: + // Add a new property value to the back + void push_back(const Property& prop) + { + m_edge_properties.push_back(prop); + } + + // Move range of properties backwards + void move_range(std::size_t src_begin, std::size_t src_end, std::size_t dest_begin) { + std::copy_backward( + m_edge_properties.begin() + src_begin, + m_edge_properties.begin() + src_end, + m_edge_properties.begin() + dest_begin + (src_end - src_begin)); + } + + typedef typename std::vector<Property>::iterator iterator; + iterator begin() {return m_edge_properties.begin();} + iterator end() {return m_edge_properties.end();} + + private: + // Access to the derived object + Derived& derived() { return *static_cast<Derived*>(this); } + + const Derived& derived() const + { return *static_cast<const Derived*>(this); } + +public: // should be private, but friend templates not portable + std::vector<Property> m_edge_properties; +}; + +struct dummy_no_property_iterator +: public boost::iterator_facade<dummy_no_property_iterator, no_property, std::random_access_iterator_tag> { + mutable no_property prop; + no_property& dereference() const {return prop;} + bool equal(const dummy_no_property_iterator&) const {return true;} + void increment() {} + void decrement() {} + void advance(std::ptrdiff_t) {} + std::ptrdiff_t distance_to(const dummy_no_property_iterator) const {return 0;} +}; + +template<typename Derived, typename Descriptor> +class indexed_edge_properties<Derived, void, Descriptor> +{ + struct secret {}; + + public: + typedef no_property edge_property_type; + typedef void edge_bundled; + typedef void* edge_push_back_type; + + secret operator[](secret) { return secret(); } + void write_by_index(std::size_t idx, const no_property& prop) {} + + protected: + // All operations do nothing. + indexed_edge_properties() { } + indexed_edge_properties(std::size_t) { } + std::size_t size() const {return 0;} + void clear() { } + void resize(std::size_t) { } + void reserve(std::size_t) { } + + public: + void push_back(const edge_push_back_type&) { } + void move_range(std::size_t src_begin, std::size_t src_end, std::size_t dest_begin) {} + + typedef dummy_no_property_iterator iterator; + iterator begin() {return dummy_no_property_iterator();} + iterator end() {return dummy_no_property_iterator();} + +}; + +} +} + +#endif // BOOST_GRAPH_INDEXED_PROPERTIES_HPP diff --git a/Utilities/BGL/boost/graph/detail/is_same.hpp b/Utilities/BGL/boost/graph/detail/is_same.hpp index cda8d561147eb4ebc15b935260af2ad9cf5d0d77..07330d301e980b707466786d25ddec43881e5402 100644 --- a/Utilities/BGL/boost/graph/detail/is_same.hpp +++ b/Utilities/BGL/boost/graph/detail/is_same.hpp @@ -9,7 +9,15 @@ #ifndef BOOST_GRAPH_DETAIL_IS_SAME_HPP #define BOOST_GRAPH_DETAIL_IS_SAME_HPP -#include <boost/pending/ct_if.hpp> +// Deprecate the use of this header. +// TODO: Remove this file from trunk/release in 1.41/1.42. +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/type_traits/is_same.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/type_traits/is_same.hpp" +#endif + +#include <boost/mpl/if.hpp> namespace boost { struct false_tag; @@ -30,7 +38,7 @@ namespace boost { template <class U, class V> struct is_same { enum { Unum = U::num, Vnum = V::num }; - typedef typename boost::ct_if< (Unum == Vnum), + typedef typename mpl::if_c< (Unum == Vnum), boost::true_tag, boost::false_tag>::type is_same_tag; }; #endif diff --git a/Utilities/BGL/boost/graph/detail/labeled_graph_traits.hpp b/Utilities/BGL/boost/graph/detail/labeled_graph_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f61c24a4080dd8c1a7664e65417ec34cf3d37b55 --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/labeled_graph_traits.hpp @@ -0,0 +1,237 @@ +// Copyright (C) 2009 Andrew Sutton + +// 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) + +#ifndef BOOST_GRAPH_LABELED_GRAPH_TRAITS_HPP +#define BOOST_GRAPH_LABELED_GRAPH_TRAITS_HPP + +#include <boost/graph/graph_mutability_traits.hpp> + +namespace boost { + +// Extend the graph mutability traits (and metafunctions) to include options +// for labeled graphs. + +// NOTE: the label_vertex tag denotes the fact that you can basically assign +// arbitrary labels to vertices without modifying the actual graph. + +// TODO: We might also overlay the uniqueness/multiplicity of labels in this +// hierarchy also. For now, we just assumed that labels are unique. + +struct label_vertex_tag { }; +struct labeled_add_vertex_tag : virtual label_vertex_tag { }; +struct labeled_add_vertex_property_tag : virtual labeled_add_vertex_tag { }; +struct labeled_remove_vertex_tag { }; +struct labeled_add_edge_tag : virtual label_vertex_tag { }; +struct labeled_add_edge_property_tag : virtual labeled_add_edge_tag{ }; +struct labeled_remove_edge_tag { }; + +struct labeled_mutable_vertex_graph_tag + : virtual labeled_add_vertex_tag, virtual labeled_remove_vertex_tag +{ }; +struct labeled_mutable_vertex_property_graph_tag + : virtual labeled_add_vertex_property_tag, virtual labeled_remove_vertex_tag +{ }; +struct labeled_mutable_edge_graph_tag + : virtual labeled_add_edge_tag, virtual labeled_remove_edge_tag +{ }; +struct labeled_mutable_edge_property_graph_tag + : virtual labeled_add_edge_property_tag, virtual labeled_remove_edge_tag +{ }; + +struct labeled_graph_tag + : virtual label_vertex_tag +{ }; +struct labeled_mutable_graph_tag + : virtual labeled_mutable_vertex_graph_tag + , virtual labeled_mutable_edge_graph_tag +{ }; +struct labeled_mutable_property_graph_tag + : virtual labeled_mutable_vertex_property_graph_tag + , virtual labeled_mutable_edge_property_graph_tag +{ }; +struct labeled_add_only_property_graph_tag + : virtual labeled_add_vertex_property_tag + , virtual labeled_mutable_edge_property_graph_tag +{ }; + +// Metafunctions + +template <typename Graph> +struct graph_has_add_vertex_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + labeled_add_vertex_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_add_vertex_by_label_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + labeled_add_vertex_property_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_remove_vertex_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + labeled_remove_vertex_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_add_edge_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + labeled_add_edge_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_add_edge_by_label_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + labeled_add_edge_property_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_remove_edge_by_label + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + labeled_remove_edge_tag + >::value + > +{ }; + +template <typename Graph> +struct is_labeled_mutable_vertex_graph + : mpl::and_< + graph_has_add_vertex_by_label<Graph>, + graph_has_remove_vertex_by_label<Graph> + > +{ }; + +template <typename Graph> +struct is_labeled_mutable_vertex_property_graph + : mpl::and_< + graph_has_add_vertex_by_label<Graph>, + graph_has_remove_vertex_by_label<Graph> + > +{ }; + +template <typename Graph> +struct is_labeled_mutable_edge_graph + : mpl::and_< + graph_has_add_edge_by_label<Graph>, + graph_has_remove_edge_by_label<Graph> + > +{ }; + +template <typename Graph> +struct is_labeled_mutable_edge_property_graph + : mpl::and_< + graph_has_add_edge_by_label<Graph>, + graph_has_remove_edge_by_label<Graph> + > +{ }; + +template <typename Graph> +struct is_labeled_mutable_graph + : mpl::and_< + is_labeled_mutable_vertex_graph<Graph>, + is_labeled_mutable_edge_graph<Graph> + > +{ }; + +template <typename Graph> +struct is_labeled_mutable_property_graph + : mpl::and_< + is_labeled_mutable_vertex_property_graph<Graph>, + is_labeled_mutable_edge_property_graph<Graph> + > +{ }; + +template <typename Graph> +struct is_labeled_add_only_property_graph + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + labeled_add_only_property_graph_tag + >::value + > +{ }; + +template <typename Graph> +struct is_labeled_graph + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + label_vertex_tag + >::value + > +{ }; + +template <typename> class graph_mutability_traits; + +namespace graph_detail { + // The determine mutability metafunction computes a labeled mutability tag + // based on the mutability of the given graph type. This is used by the + // graph_mutability_traits specialization below. + template <typename Graph> + struct determine_mutability { + typedef typename mpl::if_< + is_add_only_property_graph<Graph>, + labeled_add_only_property_graph_tag, + typename mpl::if_< + is_mutable_property_graph<Graph>, + labeled_mutable_property_graph_tag, + typename mpl::if_< + is_mutable_graph<Graph>, + labeled_mutable_graph_tag, + typename mpl::if_< + is_mutable_edge_graph<Graph>, + labeled_graph_tag, + typename graph_mutability_traits<Graph>::category + >::type + >::type + >::type + >::type type; + }; +} // namespace graph_detail + +#define LABELED_GRAPH_PARAMS typename G, typename L, typename S +#define LABELED_GRAPH labeled_graph<G,L,S> + +// Specialize mutability traits for for the labeled graph. +// This specialization depends on the mutability of the underlying graph type. +// If the underlying graph is fully mutable, this this is also fully mutable. +// Otherwise, it's different. +template <LABELED_GRAPH_PARAMS> +struct graph_mutability_traits< LABELED_GRAPH > { + typedef typename graph_detail::determine_mutability< + typename LABELED_GRAPH::graph_type + >::type category; +}; + +#undef LABELED_GRAPH_PARAMS +#undef LABELED_GRAPH + +} // namespace boost + +#endif diff --git a/Utilities/BGL/boost/graph/detail/read_graphviz_new.hpp b/Utilities/BGL/boost/graph/detail/read_graphviz_new.hpp new file mode 100644 index 0000000000000000000000000000000000000000..215f9ef939d44217b2d17e11dbc6a3fff11e6322 --- /dev/null +++ b/Utilities/BGL/boost/graph/detail/read_graphviz_new.hpp @@ -0,0 +1,116 @@ +// Copyright 2004-9 Trustees of Indiana University + +// 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) + +// +// read_graphviz_new.hpp - +// Initialize a model of the BGL's MutableGraph concept and an associated +// collection of property maps using a graph expressed in the GraphViz +// DOT Language. +// +// Based on the grammar found at: +// http://www.graphviz.org/cvs/doc/info/lang.html +// +// Jeremiah rewrite used grammar found at: +// http://www.graphviz.org/doc/info/lang.html +// and page 34 or http://www.graphviz.org/pdf/dotguide.pdf +// +// See documentation for this code at: +// http://www.boost.org/libs/graph/doc/read-graphviz.html +// + +// Author: Jeremiah Willcock +// Ronald Garcia +// + +#ifndef BOOST_READ_GRAPHVIZ_NEW_HPP +#define BOOST_READ_GRAPHVIZ_NEW_HPP + +#include <boost/ref.hpp> +#include <boost/property_map/dynamic_property_map.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/detail/workaround.hpp> +#include <algorithm> +#include <string> +#include <vector> +#include <set> +#include <utility> +#include <map> +#include <iostream> +#include <cstdlib> + +namespace boost { + +namespace read_graphviz_detail { + typedef std::string node_name; + typedef std::string subgraph_name; + + typedef std::map<std::string, std::string> properties; + + struct node_and_port { + node_name name; + std::string angle; // Or empty if no angle + std::vector<std::string> location; // Up to two identifiers + + friend inline bool operator==(const node_and_port& a, const node_and_port& b) { + return a.name == b.name && + a.angle == b.angle && + a.location == b.location; + } + + friend inline bool operator<(const node_and_port& a, const node_and_port& b) { + if (a.name != b.name) return a.name < b.name; + if (a.angle != b.angle) return a.angle < b.angle; + return a.location < b.location; + } + }; + + struct edge_info { + node_and_port source; + node_and_port target; + properties props; + }; + + struct parser_result { + bool graph_is_directed; + bool graph_is_strict; + std::map<node_name, properties> nodes; // Global set + std::vector<edge_info> edges; + std::map<subgraph_name, properties> graph_props; // Root and subgraphs + }; + + // The actual parser, from libs/graph/src/read_graphviz_new.cpp + void parse_graphviz_from_string(const std::string& str, parser_result& result, bool want_directed); + + // Translate from those results to a graph + void translate_results_to_graph(const parser_result& r, ::boost::detail::graph::mutate_graph* mg); + +} // namespace read_graphviz_detail + +// This is also in boost/graph/graphviz.hpp +namespace detail { + namespace graph { + BOOST_GRAPH_DECL bool read_graphviz(const std::string& str, boost::detail::graph::mutate_graph* mg); + } // end namespace graph +} // end namespace detail + +template <typename MutableGraph> +bool read_graphviz(const std::string& str, + MutableGraph& graph, boost::dynamic_properties& dp, + std::string const& node_id = "node_id") { + boost::detail::graph::mutate_graph_impl<MutableGraph> mg(graph, dp, node_id); + return detail::graph::read_graphviz(str, &mg); +} + +template <typename InputIter, typename MutableGraph> +bool read_graphviz(InputIter begin, InputIter end, + MutableGraph& graph, boost::dynamic_properties& dp, + std::string const& node_id = "node_id") { + return read_graphviz(std::string(begin, end), graph, dp, node_id); +} + +} // namespace boost + +#endif // BOOST_READ_GRAPHVIZ_NEW_HPP diff --git a/Utilities/BGL/boost/graph/detail/read_graphviz_spirit.hpp b/Utilities/BGL/boost/graph/detail/read_graphviz_spirit.hpp index 42f8dae6e6edd224e03a7ea8ab26f8e15d73475d..815befe91f3be476881285d4755bafc480c7fe5f 100644 --- a/Utilities/BGL/boost/graph/detail/read_graphviz_spirit.hpp +++ b/Utilities/BGL/boost/graph/detail/read_graphviz_spirit.hpp @@ -1,7 +1,7 @@ -// Copyright 2004-5 Trustees of Indiana University +// Copyright 2004-9 Trustees of Indiana University -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // @@ -28,21 +28,22 @@ #define BOOST_SPIRIT_CLOSURE_LIMIT 6 -#include <boost/spirit/iterator/multi_pass.hpp> -#include <boost/spirit/core.hpp> -#include <boost/spirit/butility/confix.hpp> -#include <boost/spirit/butility/distinct.hpp> -#include <boost/spirit/butility/lists.hpp> -#include <boost/spirit/butility/escape_char.hpp> -#include <boost/spirit/attribute.hpp> -#include <boost/spirit/dynamic.hpp> -#include <boost/spirit/actor.hpp> -#include <boost/spirit/phoenix.hpp> -#include <boost/spirit/phoenix/binders.hpp> +#include <boost/spirit/include/classic_multi_pass.hpp> +#include <boost/spirit/include/classic_core.hpp> +#include <boost/spirit/include/classic_confix.hpp> +#include <boost/spirit/include/classic_distinct.hpp> +#include <boost/spirit/include/classic_lists.hpp> +#include <boost/spirit/include/classic_escape_char.hpp> +#include <boost/spirit/include/classic_attribute.hpp> +#include <boost/spirit/include/classic_dynamic.hpp> +#include <boost/spirit/include/classic_actor.hpp> +#include <boost/spirit/include/classic_closure.hpp> +#include <boost/spirit/include/phoenix1.hpp> +#include <boost/spirit/include/phoenix1_binders.hpp> #include <boost/ref.hpp> #include <boost/function/function2.hpp> #include <boost/type_traits/is_same.hpp> -#include <boost/dynamic_property_map.hpp> +#include <boost/property_map/dynamic_property_map.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/detail/workaround.hpp> #include <algorithm> @@ -53,6 +54,7 @@ #include <utility> #include <map> #include <boost/graph/graphviz.hpp> +#include <boost/throw_exception.hpp> namespace phoenix { // Workaround: std::map::operator[] uses a different return type than all @@ -70,10 +72,6 @@ namespace boost { namespace detail { namespace graph { -using namespace std; -using namespace boost; -using namespace boost::spirit; -using namespace phoenix; ///////////////////////////////////////////////////////////////////////////// // Application-specific type definitions @@ -96,25 +94,25 @@ typedef std::map<id_t,edges_t> subgraph_edges_t; ///////////////////////////////////////////////////////////////////////////// // Stack frames used by semantic actions ///////////////////////////////////////////////////////////////////////////// -struct id_closure : boost::spirit::closure<id_closure, node_t> { +struct id_closure : boost::spirit::classic::closure<id_closure, node_t> { member1 name; }; -struct node_id_closure : boost::spirit::closure<node_id_closure, node_t> { +struct node_id_closure : boost::spirit::classic::closure<node_id_closure, node_t> { member1 name; }; -struct attr_list_closure : boost::spirit::closure<attr_list_closure, actor_t> { +struct attr_list_closure : boost::spirit::classic::closure<attr_list_closure, actor_t> { member1 prop_actor; }; -struct property_closure : boost::spirit::closure<property_closure, id_t, id_t> { +struct property_closure : boost::spirit::classic::closure<property_closure, id_t, id_t> { member1 key; member2 value; }; -struct data_stmt_closure : boost::spirit::closure<data_stmt_closure, +struct data_stmt_closure : boost::spirit::classic::closure<data_stmt_closure, nodes_t,nodes_t,edge_stack_t,bool,node_t> { member1 sources; member2 dests; @@ -123,7 +121,7 @@ struct data_stmt_closure : boost::spirit::closure<data_stmt_closure, member5 active_node; }; -struct subgraph_closure : boost::spirit::closure<subgraph_closure, +struct subgraph_closure : boost::spirit::classic::closure<subgraph_closure, nodes_t, edges_t, node_t> { member1 nodes; member2 edges; @@ -135,25 +133,25 @@ struct subgraph_closure : boost::spirit::closure<subgraph_closure, ///////////////////////////////////////////////////////////////////////////// // Grammar for a dot file. -struct dot_grammar : public grammar<dot_grammar> { +struct dot_grammar : public boost::spirit::classic::grammar<dot_grammar> { mutate_graph& graph_; explicit dot_grammar(mutate_graph& graph) : graph_(graph) { } template <class ScannerT> struct definition { - + definition(dot_grammar const& self) : self(self), subgraph_depth(0), keyword_p("0-9a-zA-Z_") { - + using namespace boost::spirit::classic; + using namespace phoenix; // RG - Future Work // - Handle multi-line strings using \ line continuation // - Make keywords case insensitive - ID = ( lexeme_d[((alpha_p | ch_p('_')) >> *(alnum_p | ch_p('_')))] | real_p - | confix_p('"', *c_escape_ch_p, '"') + | lexeme_d[confix_p('"', *c_escape_ch_p, '"')] | comment_nest_p('<', '>') )[ID.name = construct_<std::string>(arg1,arg2)] ; @@ -165,7 +163,7 @@ struct dot_grammar : public grammar<dot_grammar> { >> !( ch_p('=') >> ID[a_list.value = arg1]) [phoenix::bind(&definition::call_prop_actor) - (var(*this),a_list.key,a_list.value)],ch_p(',')); + (var(*this),a_list.key,a_list.value)],!ch_p(',')); attr_list = +(ch_p('[') >> !a_list >> ch_p(']')); @@ -186,6 +184,14 @@ struct dot_grammar : public grammar<dot_grammar> { = ( ID[node_id.name = arg1] >> (!port) ) [phoenix::bind(&definition::memoize_node)(var(*this))]; + graph_stmt + = (ID[graph_stmt.key = arg1] >> + ch_p('=') >> + ID[graph_stmt.value = arg1]) + [phoenix::bind(&definition::call_graph_prop) + (var(*this),graph_stmt.key,graph_stmt.value)] + ; // Graph property. + attr_stmt = (as_lower_d[keyword_p("graph")] >> attr_list(actor_t(phoenix::bind(&definition::default_graph_prop) @@ -240,7 +246,7 @@ struct dot_grammar : public grammar<dot_grammar> { stmt - = (ID >> ch_p('=') >> ID) // Graph property -- ignore. + = graph_stmt | attr_stmt | data_stmt ; @@ -277,7 +283,7 @@ struct dot_grammar : public grammar<dot_grammar> { } // definition() - typedef rule<ScannerT> rule_t; + typedef boost::spirit::classic::rule<ScannerT> rule_t; rule_t const& start() const { return the_grammar; } @@ -288,12 +294,12 @@ struct dot_grammar : public grammar<dot_grammar> { void check_undirected() { if(self.graph_.is_directed()) - throw boost::undirected_graph_error(); + boost::throw_exception(boost::undirected_graph_error()); } void check_directed() { if(!self.graph_.is_directed()) - throw boost::directed_graph_error(); + boost::throw_exception(boost::directed_graph_error()); } void memoize_node() { @@ -335,7 +341,7 @@ struct dot_grammar : public grammar<dot_grammar> { edge_stack_t& edge_stack = data_stmt.edge_stack(); for(nodes_t::iterator i = sources.begin(); i != sources.end(); ++i) { for(nodes_t::iterator j = dests.begin(); j != dests.end(); ++j) { - // Create the edge and and push onto the edge stack. + // Create the edge and push onto the edge stack. #ifdef BOOST_GRAPH_DEBUG std::cout << "Edge " << *i << " to " << *j << std::endl; #endif // BOOST_GRAPH_DEBUG @@ -380,8 +386,13 @@ struct dot_grammar : public grammar<dot_grammar> { } } - // default_graph_prop - Just ignore graph properties. - void default_graph_prop(id_t const&, id_t const&) { } + // default_graph_prop - Store as a graph property. + void default_graph_prop(id_t const& key, id_t const& value) { +#ifdef BOOST_GRAPH_DEBUG + std::cout << key << " = " << value << std::endl; +#endif // BOOST_GRAPH_DEBUG + self.graph_.set_graph_property(key, value); + } // default_node_prop - declare default properties for any future new nodes void default_node_prop(id_t const& key, id_t const& value) { @@ -436,6 +447,15 @@ struct dot_grammar : public grammar<dot_grammar> { actor(lhs,rhs); } + void call_graph_prop(std::string const& lhs, std::string const& rhs) { + // If first and last characters of the rhs are double-quotes, + // remove them. + if (!rhs.empty() && rhs[0] == '"' && rhs[rhs.size() - 1] == '"') + this->default_graph_prop(lhs, rhs.substr(1, rhs.size()-2)); + else + this->default_graph_prop(lhs,rhs); + } + void set_node_property(node_t const& node, id_t const& key, id_t const& value) { @@ -458,7 +478,11 @@ struct dot_grammar : public grammar<dot_grammar> { self.graph_.set_edge_property(key, edge, value); #ifdef BOOST_GRAPH_DEBUG // Tell the world - std::cout << "(" << edge.first << "," << edge.second << "): " +#if 0 // RG - edge representation changed, + std::cout << "(" << edge.first << "," << edge.second << "): " +#else + std::cout << "an edge: " +#endif // 0 << key << " = " << value << std::endl; #endif // BOOST_GRAPH_DEBUG } @@ -469,20 +493,21 @@ struct dot_grammar : public grammar<dot_grammar> { int subgraph_depth; // Keywords; - const distinct_parser<> keyword_p; + const boost::spirit::classic::distinct_parser<> keyword_p; // // rules that make up the grammar // - rule<ScannerT,id_closure::context_t> ID; - rule<ScannerT,property_closure::context_t> a_list; - rule<ScannerT,attr_list_closure::context_t> attr_list; + boost::spirit::classic::rule<ScannerT,id_closure::context_t> ID; + boost::spirit::classic::rule<ScannerT,property_closure::context_t> a_list; + boost::spirit::classic::rule<ScannerT,attr_list_closure::context_t> attr_list; rule_t port_location; rule_t port_angle; rule_t port; - rule<ScannerT,node_id_closure::context_t> node_id; + boost::spirit::classic::rule<ScannerT,node_id_closure::context_t> node_id; + boost::spirit::classic::rule<ScannerT,property_closure::context_t> graph_stmt; rule_t attr_stmt; - rule<ScannerT,data_stmt_closure::context_t> data_stmt; - rule<ScannerT,subgraph_closure::context_t> subgraph; + boost::spirit::classic::rule<ScannerT,data_stmt_closure::context_t> data_stmt; + boost::spirit::classic::rule<ScannerT,subgraph_closure::context_t> subgraph; rule_t edgeop; rule_t edgeRHS; rule_t stmt; @@ -520,7 +545,7 @@ struct dot_grammar : public grammar<dot_grammar> { // // dot_skipper - GraphViz whitespace and comment skipper // -struct dot_skipper : public grammar<dot_skipper> +struct dot_skipper : public boost::spirit::classic::grammar<dot_skipper> { dot_skipper() {} @@ -528,10 +553,12 @@ struct dot_skipper : public grammar<dot_skipper> struct definition { definition(dot_skipper const& /*self*/) { + using namespace boost::spirit::classic; + using namespace phoenix; // comment forms - skip = space_p + skip = eol_p >> comment_p("#") + | space_p | comment_p("//") - | comment_p("#") #if BOOST_WORKAROUND(BOOST_MSVC, <= 1400) | confix_p(str_p("/*") ,*anychar_p, str_p("*/")) #else @@ -544,8 +571,8 @@ struct dot_skipper : public grammar<dot_skipper> #endif } - rule<ScannerT> skip; - rule<ScannerT> const& + boost::spirit::classic::rule<ScannerT> skip; + boost::spirit::classic::rule<ScannerT> const& start() const { return skip; } }; // definition }; // dot_skipper @@ -558,7 +585,7 @@ bool read_graphviz(MultiPassIterator begin, MultiPassIterator end, MutableGraph& graph, dynamic_properties& dp, std::string const& node_id = "node_id") { using namespace boost; - using namespace boost::spirit; + using namespace boost::spirit::classic; typedef MultiPassIterator iterator_t; typedef skip_parser_iteration_policy< boost::detail::graph::dot_skipper> @@ -566,10 +593,11 @@ bool read_graphviz(MultiPassIterator begin, MultiPassIterator end, typedef scanner_policies<iter_policy_t> scanner_policies_t; typedef scanner<iterator_t, scanner_policies_t> scanner_t; - detail::graph::mutate_graph_impl<MutableGraph> m_graph(graph, dp, node_id); + ::boost::detail::graph::mutate_graph_impl<MutableGraph> + m_graph(graph, dp, node_id); - boost::detail::graph::dot_grammar p(m_graph); - boost::detail::graph::dot_skipper skip_p; + ::boost::detail::graph::dot_grammar p(m_graph); + ::boost::detail::graph::dot_skipper skip_p; iter_policy_t iter_policy(skip_p); scanner_policies_t policies(iter_policy); diff --git a/Utilities/BGL/boost/graph/detail/self_avoiding_walk.hpp b/Utilities/BGL/boost/graph/detail/self_avoiding_walk.hpp index def0c6eef2a02a4e0744e13e0c227e137105b9f3..c171897f22860b5bd14ed93dc53e23987a10b74e 100644 --- a/Utilities/BGL/boost/graph/detail/self_avoiding_walk.hpp +++ b/Utilities/BGL/boost/graph/detail/self_avoiding_walk.hpp @@ -29,7 +29,7 @@ #include <utility> #include <boost/config.hpp> #include <boost/graph/graph_traits.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #define SAW_SENTINAL -1 diff --git a/Utilities/BGL/boost/graph/detail/sparse_ordering.hpp b/Utilities/BGL/boost/graph/detail/sparse_ordering.hpp index 1124531466421458ccd4b2b21aec1fb4e3ea7ef2..593d8c857921192eb39b87fd05187f7e83fc6fdb 100644 --- a/Utilities/BGL/boost/graph/detail/sparse_ordering.hpp +++ b/Utilities/BGL/boost/graph/detail/sparse_ordering.hpp @@ -1,29 +1,13 @@ -// //======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. -//======================================================================= +// Copyright 2004, 2005 Trustees of Indiana University +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, +// Doug Gregor, D. Kevin McGrath // +// 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_SPARSE_ORDERING_HPP #define BOOST_GRAPH_DETAIL_SPARSE_ORDERING_HPP @@ -36,7 +20,7 @@ #include <boost/graph/breadth_first_search.hpp> #include <boost/graph/properties.hpp> #include <boost/pending/indirect_cmp.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/bind.hpp> #include <boost/graph/iteration_macros.hpp> #include <boost/graph/depth_first_search.hpp> @@ -122,7 +106,7 @@ namespace boost { public: typedef typename Sequence::iterator iterator; typedef typename Sequence::reverse_iterator reverse_iterator; - typedef queue<Tp,Sequence> queue; + typedef queue<Tp,Sequence> base; typedef typename Sequence::size_type size_type; inline iterator begin() { return this->c.begin(); } @@ -144,7 +128,7 @@ namespace boost { // template <class Graph, class Vertex, class ColorMap, class DegreeMap> Vertex - pseudo_peripheral_pair(Graph& G, const Vertex& u, int& ecc, + pseudo_peripheral_pair(Graph const& G, const Vertex& u, int& ecc, ColorMap color, DegreeMap degree) { typedef typename property_traits<ColorMap>::value_type ColorValue; @@ -168,7 +152,7 @@ namespace boost { // of the ordering generated by RCM. // template <class Graph, class Vertex, class Color, class Degree> - Vertex find_starting_node(Graph& G, Vertex r, Color color, Degree degree) + Vertex find_starting_node(Graph const& G, Vertex r, Color color, Degree degree) { Vertex x, y; int eccen_r, eccen_x; diff --git a/Utilities/BGL/boost/graph/dijkstra_shortest_paths.hpp b/Utilities/BGL/boost/graph/dijkstra_shortest_paths.hpp index 95a995c12f098a49cf744eb0d3990312b473d3ed..d7456734ea86ea4263ef57f9051fc3701e31841e 100644 --- a/Utilities/BGL/boost/graph/dijkstra_shortest_paths.hpp +++ b/Utilities/BGL/boost/graph/dijkstra_shortest_paths.hpp @@ -6,6 +6,12 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= +// +// +// Revision History: +// 04 April 2001: Added named parameter variant. (Jeremy Siek) +// 01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock) +// #ifndef BOOST_GRAPH_DIJKSTRA_HPP #define BOOST_GRAPH_DIJKSTRA_HPP @@ -17,6 +23,13 @@ #include <boost/pending/indirect_cmp.hpp> #include <boost/graph/exception.hpp> #include <boost/pending/relaxed_heap.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/smart_ptr.hpp> +#include <boost/graph/detail/d_ary_heap.hpp> +#include <boost/graph/two_bit_color_map.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/property_map/vector_property_map.hpp> +#include <boost/type_traits.hpp> #ifdef BOOST_GRAPH_DIJKSTRA_TESTING # include <boost/pending/mutable_queue.hpp> @@ -24,7 +37,31 @@ namespace boost { + /** + * @brief Updates a particular value in a queue used by Dijkstra's + * algorithm. + * + * This routine is called by Dijkstra's algorithm after it has + * decreased the distance from the source vertex to the given @p + * vertex. By default, this routine will just call @c + * Q.update(vertex). However, other queues may provide more + * specialized versions of this routine. + * + * @param Q the queue that will be updated. + * @param vertex the vertex whose distance has been updated + * @param old_distance the previous distance to @p vertex + */ + template<typename Buffer, typename Vertex, typename DistanceType> + inline void + dijkstra_queue_update(Buffer& Q, Vertex vertex, DistanceType old_distance) + { + (void)old_distance; + Q.update(vertex); + } + #ifdef BOOST_GRAPH_DIJKSTRA_TESTING + // This is a misnomer now: it now just refers to the "default heap", which is + // currently d-ary (d=4) but can be changed by a #define. static bool dijkstra_relaxed_heap = true; #endif @@ -32,6 +69,7 @@ namespace boost { struct DijkstraVisitorConcept { void constraints() { function_requires< CopyConstructibleConcept<Visitor> >(); + vis.initialize_vertex(u, g); vis.discover_vertex(u, g); vis.examine_vertex(u, g); vis.examine_edge(e, g); @@ -89,19 +127,21 @@ namespace boost { template <class Edge, class Graph> void tree_edge(Edge e, Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); - if (m_decreased) + bool decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + if (decreased) m_vis.edge_relaxed(e, g); else m_vis.edge_not_relaxed(e, g); } template <class Edge, class Graph> void gray_target(Edge e, Graph& g) { - m_decreased = relax(e, g, m_weight, m_predecessor, m_distance, - m_combine, m_compare); - if (m_decreased) { - m_Q.update(target(e, g)); + D old_distance = get(m_distance, target(e, g)); + + bool decreased = relax(e, g, m_weight, m_predecessor, m_distance, + m_combine, m_compare); + if (decreased) { + dijkstra_queue_update(m_Q, target(e, g), old_distance); m_vis.edge_relaxed(e, g); } else m_vis.edge_not_relaxed(e, g); @@ -119,7 +159,7 @@ namespace boost { template <class Edge, class Graph> void examine_edge(Edge e, Graph& g) { if (m_compare(get(m_weight, e), m_zero)) - throw negative_edge(); + boost::throw_exception(negative_edge()); m_vis.examine_edge(e, g); } template <class Edge, class Graph> @@ -134,42 +174,116 @@ namespace boost { DistanceMap m_distance; BinaryFunction m_combine; BinaryPredicate m_compare; - bool m_decreased; D m_zero; }; } // namespace detail + namespace detail { + template <class Graph, class IndexMap, class Value, bool KnownNumVertices> + struct vertex_property_map_generator_helper {}; + + template <class Graph, class IndexMap, class Value> + struct vertex_property_map_generator_helper<Graph, IndexMap, Value, true> { + typedef boost::iterator_property_map<Value*, IndexMap> type; + static type build(const Graph& g, const IndexMap& index, boost::scoped_array<Value>& array_holder) { + array_holder.reset(new Value[num_vertices(g)]); + std::fill(array_holder.get(), array_holder.get() + num_vertices(g), Value()); + return make_iterator_property_map(array_holder.get(), index); + } + }; + + template <class Graph, class IndexMap, class Value> + struct vertex_property_map_generator_helper<Graph, IndexMap, Value, false> { + typedef boost::vector_property_map<Value, IndexMap> type; + static type build(const Graph& g, const IndexMap& index, boost::scoped_array<Value>& array_holder) { + return boost::make_vector_property_map<Value>(index); + } + }; + + template <class Graph, class IndexMap, class Value> + struct vertex_property_map_generator { + typedef boost::is_base_and_derived< + boost::vertex_list_graph_tag, + typename boost::graph_traits<Graph>::traversal_category> + known_num_vertices; + typedef vertex_property_map_generator_helper<Graph, IndexMap, Value, known_num_vertices::value> helper; + typedef typename helper::type type; + static type build(const Graph& g, const IndexMap& index, boost::scoped_array<Value>& array_holder) { + return helper::build(g, index, array_holder); + } + }; + } + + namespace detail { + template <class Graph, class IndexMap, bool KnownNumVertices> + struct default_color_map_generator_helper {}; + + template <class Graph, class IndexMap> + struct default_color_map_generator_helper<Graph, IndexMap, true> { + typedef boost::two_bit_color_map<IndexMap> type; + static type build(const Graph& g, const IndexMap& index) { + size_t nv = num_vertices(g); + return boost::two_bit_color_map<IndexMap>(nv, index); + } + }; + + template <class Graph, class IndexMap> + struct default_color_map_generator_helper<Graph, IndexMap, false> { + typedef boost::vector_property_map<boost::two_bit_color_type, IndexMap> type; + static type build(const Graph& g, const IndexMap& index) { + return boost::make_vector_property_map<boost::two_bit_color_type>(index); + } + }; + + template <class Graph, class IndexMap> + struct default_color_map_generator { + typedef boost::is_base_and_derived< + boost::vertex_list_graph_tag, + typename boost::graph_traits<Graph>::traversal_category> + known_num_vertices; + typedef default_color_map_generator_helper<Graph, IndexMap, known_num_vertices::value> helper; + typedef typename helper::type type; + static type build(const Graph& g, const IndexMap& index) { + return helper::build(g, index); + } + }; + } + // Call breadth first search with default color map. - template <class VertexListGraph, class DijkstraVisitor, + template <class Graph, class DijkstraVisitor, class PredecessorMap, class DistanceMap, class WeightMap, class IndexMap, class Compare, class Combine, class DistZero> inline void dijkstra_shortest_paths_no_init - (const VertexListGraph& g, - typename graph_traits<VertexListGraph>::vertex_descriptor s, + (const Graph& g, + typename graph_traits<Graph>::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistZero zero, DijkstraVisitor vis) { - std::vector<default_color_type> color(num_vertices(g)); - default_color_type c = white_color; + typedef + detail::default_color_map_generator<Graph, IndexMap> + ColorMapHelper; + typedef typename ColorMapHelper::type ColorMap; + ColorMap color = + ColorMapHelper::build(g, index_map); dijkstra_shortest_paths_no_init( g, s, predecessor, distance, weight, index_map, compare, combine, zero, vis, - make_iterator_property_map(&color[0], index_map, c)); + color); } // Call breadth first search - template <class VertexListGraph, class DijkstraVisitor, + template <class Graph, class DijkstraVisitor, class PredecessorMap, class DistanceMap, class WeightMap, class IndexMap, class Compare, class Combine, class DistZero, class ColorMap> inline void dijkstra_shortest_paths_no_init - (const VertexListGraph& g, - typename graph_traits<VertexListGraph>::vertex_descriptor s, + (const Graph& g, + typename graph_traits<Graph>::vertex_descriptor s, PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistZero zero, @@ -178,7 +292,7 @@ namespace boost { typedef indirect_cmp<DistanceMap, Compare> IndirectCmp; IndirectCmp icmp(distance, compare); - typedef typename graph_traits<VertexListGraph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; #ifdef BOOST_GRAPH_DIJKSTRA_TESTING if (!dijkstra_relaxed_heap) { @@ -186,7 +300,6 @@ namespace boost { MutableQueue; MutableQueue Q(num_vertices(g), icmp, index_map); - detail::dijkstra_bfs_visitor<DijkstraVisitor, MutableQueue, WeightMap, PredecessorMap, DistanceMap, Combine, Compare> bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, zero); @@ -196,9 +309,21 @@ namespace boost { } #endif // BOOST_GRAPH_DIJKSTRA_TESTING +#ifdef BOOST_GRAPH_DIJKSTRA_USE_RELAXED_HEAP typedef relaxed_heap<Vertex, IndirectCmp, IndexMap> MutableQueue; - MutableQueue Q(num_vertices(g), icmp, index_map); +#else // Now the default: use a d-ary heap + boost::scoped_array<std::size_t> index_in_heap_map_holder; + typedef + detail::vertex_property_map_generator<Graph, IndexMap, std::size_t> + IndexInHeapMapHelper; + typedef typename IndexInHeapMapHelper::type IndexInHeapMap; + IndexInHeapMap index_in_heap = + IndexInHeapMapHelper::build(g, index_map, index_in_heap_map_holder); + typedef d_ary_heap_indirect<Vertex, 4, IndexInHeapMap, DistanceMap, Compare> + MutableQueue; + MutableQueue Q(distance, index_in_heap, compare); +#endif // Relaxed heap detail::dijkstra_bfs_visitor<DijkstraVisitor, MutableQueue, WeightMap, PredecessorMap, DistanceMap, Combine, Compare> @@ -211,7 +336,8 @@ namespace boost { template <class VertexListGraph, class DijkstraVisitor, class PredecessorMap, class DistanceMap, class WeightMap, class IndexMap, class Compare, class Combine, - class DistInf, class DistZero> + class DistInf, class DistZero, typename T, typename Tag, + typename Base> inline void dijkstra_shortest_paths (const VertexListGraph& g, @@ -219,14 +345,14 @@ namespace boost { PredecessorMap predecessor, DistanceMap distance, WeightMap weight, IndexMap index_map, Compare compare, Combine combine, DistInf inf, DistZero zero, - DijkstraVisitor vis) + DijkstraVisitor vis, + const bgl_named_params<T, Tag, Base>& + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(VertexListGraph,vertex_list_graph_tag)) { - std::vector<default_color_type> color(num_vertices(g)); - default_color_type c = white_color; + boost::two_bit_color_map<IndexMap> color(num_vertices(g), index_map); dijkstra_shortest_paths(g, s, predecessor, distance, weight, index_map, compare, combine, inf, zero, vis, - make_iterator_property_map(&color[0], index_map, - c)); + color); } // Initialize distances and call breadth first search @@ -247,6 +373,7 @@ namespace boost { typedef color_traits<ColorValue> Color; typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end; for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + vis.initialize_vertex(*ui, g); put(distance, *ui, inf); put(predecessor, *ui, *ui); put(color, *ui, Color::white()); @@ -257,18 +384,37 @@ namespace boost { index_map, compare, combine, zero, vis, color); } + // Initialize distances and call breadth first search + template <class VertexListGraph, class DijkstraVisitor, + class PredecessorMap, class DistanceMap, + class WeightMap, class IndexMap, class Compare, class Combine, + class DistInf, class DistZero> + inline void + dijkstra_shortest_paths + (const VertexListGraph& g, + typename graph_traits<VertexListGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + dijkstra_shortest_paths(g, s, predecessor, distance, weight, index_map, + compare, combine, inf, zero, vis, + no_named_parameters()); + } + namespace detail { // Handle defaults for PredecessorMap and // Distance Compare, Combine, Inf and Zero template <class VertexListGraph, class DistanceMap, class WeightMap, - class IndexMap, class Params, class ColorMap> + class IndexMap, class Params> inline void dijkstra_dispatch2 (const VertexListGraph& g, typename graph_traits<VertexListGraph>::vertex_descriptor s, DistanceMap distance, WeightMap weight, IndexMap index_map, - const Params& params, ColorMap color) + const Params& params) { // Default for predecessor map dummy_property_map p_map; @@ -288,17 +434,17 @@ namespace boost { D()), choose_param(get_param(params, graph_visitor), make_dijkstra_visitor(null_visitor())), - color); + params); } template <class VertexListGraph, class DistanceMap, class WeightMap, - class IndexMap, class Params, class ColorMap> + class IndexMap, class Params> inline void dijkstra_dispatch1 (const VertexListGraph& g, typename graph_traits<VertexListGraph>::vertex_descriptor s, DistanceMap distance, WeightMap weight, IndexMap index_map, - const Params& params, ColorMap color) + const Params& params) { // Default for distance map typedef typename property_traits<WeightMap>::value_type D; @@ -306,19 +452,11 @@ namespace boost { n = is_default_param(distance) ? num_vertices(g) : 1; std::vector<D> distance_map(n); - // Default for color map - typename std::vector<default_color_type>::size_type - m = is_default_param(color) ? num_vertices(g) : 1; - std::vector<default_color_type> color_map(m); - detail::dijkstra_dispatch2 (g, s, choose_param(distance, make_iterator_property_map (distance_map.begin(), index_map, distance_map[0])), - weight, index_map, params, - choose_param(color, make_iterator_property_map - (color_map.begin(), index_map, - color_map[0]))); + weight, index_map, params); } } // namespace detail @@ -337,10 +475,13 @@ namespace boost { get_param(params, vertex_distance), choose_const_pmap(get_param(params, edge_weight), g, edge_weight), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), - params, - get_param(params, vertex_color)); + params); } } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/dijkstra_shortest_paths.hpp> +#endif + #endif // BOOST_GRAPH_DIJKSTRA_HPP diff --git a/Utilities/BGL/boost/graph/dijkstra_shortest_paths_no_color_map.hpp b/Utilities/BGL/boost/graph/dijkstra_shortest_paths_no_color_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..443984ff0c1e5bb8b08ed8ca87b0b8d72dc843fa --- /dev/null +++ b/Utilities/BGL/boost/graph/dijkstra_shortest_paths_no_color_map.hpp @@ -0,0 +1,249 @@ +//======================================================================= +// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2009 Trustees of Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Michael Hansen +// +// 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_DIJKSTRA_NO_COLOR_MAP_HPP +#define BOOST_GRAPH_DIJKSTRA_NO_COLOR_MAP_HPP + +#include <boost/pending/indirect_cmp.hpp> +#include <boost/graph/relax.hpp> +#include <boost/pending/relaxed_heap.hpp> +#include <boost/graph/detail/d_ary_heap.hpp> +#include <boost/graph/dijkstra_shortest_paths.hpp> +#include <boost/graph/iteration_macros.hpp> + +namespace boost { + + // No init version + template <typename Graph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename WeightMap, typename VertexIndexMap, + typename DistanceCompare, typename DistanceWeightCombine, + typename DistanceInfinity, typename DistanceZero> + void dijkstra_shortest_paths_no_color_map_no_init + (const Graph& graph, + typename graph_traits<Graph>::vertex_descriptor start_vertex, + PredecessorMap predecessor_map, + DistanceMap distance_map, + WeightMap weight_map, + VertexIndexMap index_map, + DistanceCompare distance_compare, + DistanceWeightCombine distance_weight_combine, + DistanceInfinity distance_infinity, + DistanceZero distance_zero, + DijkstraVisitor visitor) + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename property_traits<DistanceMap>::value_type Distance; + typedef typename property_traits<WeightMap>::value_type Weight; + + typedef indirect_cmp<DistanceMap, DistanceCompare> DistanceIndirectCompare; + DistanceIndirectCompare + distance_indirect_compare(distance_map, distance_compare); + + // Choose vertex queue type +#if BOOST_GRAPH_DIJKSTRA_USE_RELAXED_HEAP + typedef relaxed_heap<Vertex, DistanceIndirectCompare, VertexIndexMap> + VertexQueue; + VertexQueue vertex_queue(num_vertices(graph), + distance_indirect_compare, + index_map); +#else + // Default - use d-ary heap (d = 4) + typedef + detail::vertex_property_map_generator<Graph, VertexIndexMap, std::size_t> + IndexInHeapMapHelper; + typedef typename IndexInHeapMapHelper::type IndexInHeapMap; + typedef + d_ary_heap_indirect<Vertex, 4, IndexInHeapMap, DistanceMap, DistanceCompare> + VertexQueue; + + boost::scoped_array<std::size_t> index_in_heap_map_holder; + IndexInHeapMap index_in_heap = + IndexInHeapMapHelper::build(graph, index_map, + index_in_heap_map_holder); + VertexQueue vertex_queue(distance_map, index_in_heap, distance_compare); +#endif + + // Add vertex to the queue + vertex_queue.push(start_vertex); + + // Starting vertex will always be the first discovered vertex + visitor.discover_vertex(start_vertex, graph); + + while (!vertex_queue.empty()) { + Vertex min_vertex = vertex_queue.top(); + vertex_queue.pop(); + + visitor.examine_vertex(min_vertex, graph); + + // Check if any other vertices can be reached + Distance min_vertex_distance = get(distance_map, min_vertex); + + if (!distance_compare(min_vertex_distance, distance_infinity)) { + // This is the minimum vertex, so all other vertices are unreachable + return; + } + + // Examine neighbors of min_vertex + typedef typename graph_traits<Graph>::edge_descriptor Edge; + BGL_FORALL_OUTEDGES_T(min_vertex, current_edge, graph, Graph) { + visitor.examine_edge(current_edge, graph); + + // Check if the edge has a negative weight + if (distance_compare(get(weight_map, current_edge), distance_zero)) { + boost::throw_exception(negative_edge()); + } + + // Extract the neighboring vertex and get its distance + Vertex neighbor_vertex = target(current_edge, graph); + Distance neighbor_vertex_distance = get(distance_map, neighbor_vertex); + bool is_neighbor_undiscovered = + !distance_compare(neighbor_vertex_distance, distance_infinity); + + // Attempt to relax the edge + bool was_edge_relaxed = relax(current_edge, graph, weight_map, + predecessor_map, distance_map, + distance_weight_combine, distance_compare); + + if (was_edge_relaxed) { + vertex_queue.update(neighbor_vertex); + visitor.edge_relaxed(current_edge, graph); + } else { + visitor.edge_not_relaxed(current_edge, graph); + } + + if (is_neighbor_undiscovered) { + visitor.discover_vertex(neighbor_vertex, graph); + vertex_queue.push(neighbor_vertex); + } + } // end out edge iteration + + visitor.finish_vertex(min_vertex, graph); + } // end while queue not empty + } + + // Full init version + template <typename Graph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename WeightMap, typename VertexIndexMap, + typename DistanceCompare, typename DistanceWeightCombine, + typename DistanceInfinity, typename DistanceZero> + void dijkstra_shortest_paths_no_color_map + (const Graph& graph, + typename graph_traits<Graph>::vertex_descriptor start_vertex, + PredecessorMap predecessor_map, + DistanceMap distance_map, + WeightMap weight_map, + VertexIndexMap index_map, + DistanceCompare distance_compare, + DistanceWeightCombine distance_weight_combine, + DistanceInfinity distance_infinity, + DistanceZero distance_zero, + DijkstraVisitor visitor) + { + // Initialize vertices + BGL_FORALL_VERTICES_T(current_vertex, graph, Graph) { + visitor.initialize_vertex(current_vertex, graph); + + // Default all distances to infinity + put(distance_map, current_vertex, distance_infinity); + + // Default all vertex predecessors to the vertex itself + put(predecessor_map, current_vertex, current_vertex); + } + + // Set distance for start_vertex to zero + put(distance_map, start_vertex, distance_zero); + + // Pass everything on to the no_init version + dijkstra_shortest_paths_no_color_map_no_init(graph, + start_vertex, predecessor_map, distance_map, weight_map, + index_map, distance_compare, distance_weight_combine, + distance_infinity, distance_zero, visitor); + } + + namespace detail { + + // Handle defaults for PredecessorMap, DistanceCompare, + // DistanceWeightCombine, DistanceInfinity and DistanceZero + template <typename Graph, typename DistanceMap, typename WeightMap, + typename VertexIndexMap, typename Params> + inline void + dijkstra_no_color_map_dispatch2 + (const Graph& graph, + typename graph_traits<Graph>::vertex_descriptor start_vertex, + DistanceMap distance_map, WeightMap weight_map, + VertexIndexMap index_map, const Params& params) + { + // Default for predecessor map + dummy_property_map predecessor_map; + + typedef typename property_traits<DistanceMap>::value_type DistanceType; + dijkstra_shortest_paths_no_color_map + (graph, start_vertex, + choose_param(get_param(params, vertex_predecessor), predecessor_map), + distance_map, weight_map, index_map, + choose_param(get_param(params, distance_compare_t()), + std::less<DistanceType>()), + choose_param(get_param(params, distance_combine_t()), + closed_plus<DistanceType>()), + choose_param(get_param(params, distance_inf_t()), + (std::numeric_limits<DistanceType>::max)()), + choose_param(get_param(params, distance_zero_t()), + DistanceType()), + choose_param(get_param(params, graph_visitor), + make_dijkstra_visitor(null_visitor()))); + } + + template <typename Graph, typename DistanceMap, typename WeightMap, + typename IndexMap, typename Params> + inline void + dijkstra_no_color_map_dispatch1 + (const Graph& graph, + typename graph_traits<Graph>::vertex_descriptor start_vertex, + DistanceMap distance_map, WeightMap weight_map, + IndexMap index_map, const Params& params) + { + // Default for distance map + typedef typename property_traits<WeightMap>::value_type DistanceType; + typename std::vector<DistanceType>::size_type + vertex_count = is_default_param(distance_map) ? num_vertices(graph) : 1; + + std::vector<DistanceType> default_distance_map(vertex_count); + + detail::dijkstra_no_color_map_dispatch2 + (graph, start_vertex, choose_param(distance_map, + make_iterator_property_map(default_distance_map.begin(), index_map, + default_distance_map[0])), + weight_map, index_map, params); + } + } // namespace detail + + // Named parameter version + template <typename Graph, typename Param, typename Tag, typename Rest> + inline void + dijkstra_shortest_paths_no_color_map + (const Graph& graph, + typename graph_traits<Graph>::vertex_descriptor start_vertex, + const bgl_named_params<Param, Tag, Rest>& params) + { + // Default for edge weight and vertex index map is to ask for them + // from the graph. Default for the visitor is null_visitor. + detail::dijkstra_no_color_map_dispatch1 + (graph, start_vertex, + get_param(params, vertex_distance), + choose_const_pmap(get_param(params, edge_weight), graph, edge_weight), + choose_const_pmap(get_param(params, vertex_index), graph, vertex_index), + params); + } + +} // namespace boost + +#endif // BOOST_GRAPH_DIJKSTRA_NO_COLOR_MAP_HPP diff --git a/Utilities/BGL/boost/graph/dimacs.hpp b/Utilities/BGL/boost/graph/dimacs.hpp new file mode 100644 index 0000000000000000000000000000000000000000..195ad3b651045ac3808e066363e811f9507e326c --- /dev/null +++ b/Utilities/BGL/boost/graph/dimacs.hpp @@ -0,0 +1,309 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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: Alex Breuer +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DIMACS_HPP +#define BOOST_GRAPH_DIMACS_HPP + +#include <string> +#include <sstream> +#include <iostream> +#include <fstream> +#include <iterator> +#include <exception> +#include <vector> +#include <queue> + +namespace boost { namespace graph { + +class dimacs_exception : public std::exception {}; + +class dimacs_basic_reader { +public: + typedef std::size_t vertices_size_type; + typedef std::size_t edges_size_type; + typedef double vertex_weight_type; + typedef double edge_weight_type; + typedef std::pair<vertices_size_type, + vertices_size_type> edge_type; + enum incr_mode {edge, edge_weight}; + + dimacs_basic_reader( std::istream& in, bool want_weights = true ) : + inpt( in ), seen_edges( 0 ), want_weights(want_weights) + { + while( getline( inpt, buf ) && !buf.empty() && buf[0] == 'c' ); + + if( buf[0] != 'p' ) { + boost::throw_exception(dimacs_exception()); + } + + std::stringstream instr( buf ); + std::string junk; + + instr >> junk >> junk >> num_vertices >> num_edges; + read_edge_weights.push( -1 ); + incr( edge_weight ); + } + + //for a past the end iterator + dimacs_basic_reader() : inpt( std::cin ), num_vertices( 0 ), + num_edges( 0 ), seen_edges( 0 ), want_weights(false) {} + + edge_type edge_deref() { + assert( !read_edges.empty() ); + return read_edges.front(); + } + + inline edge_type* edge_ref() { + assert( !read_edges.empty() ); + return &read_edges.front(); + } + + inline edge_weight_type edge_weight_deref() { + assert( !read_edge_weights.empty() ); + return read_edge_weights.front(); + } + + inline dimacs_basic_reader incr( incr_mode mode ) { + if( mode == edge ) { + assert( !read_edges.empty() ); + read_edges.pop(); + } + else if( mode == edge_weight ) { + assert( !read_edge_weights.empty() ); + read_edge_weights.pop(); + } + + if( (mode == edge && read_edges.empty()) || + (mode == edge_weight && read_edge_weights.empty() )) { + + if( seen_edges > num_edges ) { + boost::throw_exception(dimacs_exception()); + } + + while( getline( inpt, buf ) && !buf.empty() && buf[0] == 'c' ); + + if( !inpt.eof() ) { + int source, dest, weight; + read_edge_line((char*) buf.c_str(), source, dest, weight); + + seen_edges++; + source--; + dest--; + + read_edges.push( edge_type( source, dest ) ); + if (want_weights) { + read_edge_weights.push( weight ); + } + } + assert( read_edges.size() < 100 ); + assert( read_edge_weights.size() < 100 ); + } + + // the 1000000 just happens to be about how many edges can be read in + // 10s +// if( !(seen_edges % 1000000) && !process_id( pg ) && mode == edge ) { +// std::cout << "read " << seen_edges << " edges" << std::endl; +// } + return *this; + } + + inline bool done_edges() { + return inpt.eof() && read_edges.size() == 0; + } + + inline bool done_edge_weights() { + return inpt.eof() && read_edge_weights.size() == 0; + } + + inline vertices_size_type n_vertices() { + return num_vertices; + } + + inline vertices_size_type processed_edges() { + return seen_edges - read_edges.size(); + } + + inline vertices_size_type processed_edge_weights() { + return seen_edges - read_edge_weights.size(); + } + + inline vertices_size_type n_edges() { + return num_edges; + } + +protected: + bool read_edge_line(char *linebuf, int &from, int &to, int &weight) + { + char *fs = NULL, *ts = NULL, *ws = NULL; + char *tmp = linebuf + 2; + + fs = tmp; + if ('e' == linebuf[0]) { + while (*tmp != '\n' && *tmp != '\0') { + if (*tmp == ' ') { + *tmp = '\0'; + ts = ++tmp; + break; + } + tmp++; + } + *tmp = '\0'; + if (NULL == fs || NULL == ts) return false; + from = atoi(fs); to = atoi(ts); weight = 0; + + } else if ('a' == linebuf[0]) { + while (*tmp != '\n' && *tmp != '\0') { + if (*tmp == ' ') { + *tmp = '\0'; + ts = ++tmp; + break; + } + tmp++; + } + while (*tmp != '\n' && *tmp != '\0') { + if (*tmp == ' ') { + *tmp = '\0'; + ws = ++tmp; + break; + } + tmp++; + } + while (*tmp != '\n' && *tmp != '\0') tmp++; + *tmp = '\0'; + if (fs == NULL || ts == NULL || ws == NULL) return false; + from = atoi(fs); to = atoi(ts) ; + if (want_weights) weight = atoi(ws); else weight = 0; + + } else { + return false; + } + + return true; + } + + std::queue<edge_type> read_edges; + std::queue<edge_weight_type> read_edge_weights; + + std::istream& inpt; + std::string buf; + vertices_size_type num_vertices, num_edges, seen_edges; + bool want_weights; +}; + +template<typename T> +class dimacs_edge_iterator { +public: + typedef dimacs_basic_reader::edge_type edge_type; + typedef dimacs_basic_reader::incr_mode incr_mode; + + typedef std::input_iterator_tag iterator_category; + typedef edge_type value_type; + typedef value_type reference; + typedef edge_type* pointer; + typedef std::ptrdiff_t difference_type; + + dimacs_edge_iterator( T& reader ) : + reader( reader ) {} + + inline dimacs_edge_iterator& operator++() { + reader.incr( dimacs_basic_reader::edge ); + return *this; + } + + inline edge_type operator*() { + return reader.edge_deref(); + } + + inline edge_type* operator->() { + return reader.edge_ref(); + } + + // don't expect this to do the right thing if you're not comparing against a + // general past-the-end-iterator made with the default constructor for + // dimacs_basic_reader + inline bool operator==( dimacs_edge_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return arg.reader.done_edges(); + } + else if( arg.reader.n_vertices() == 0 ) { + return reader.done_edges(); + } + else { + return false; + } + return false; + } + + inline bool operator!=( dimacs_edge_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return !arg.reader.done_edges(); + } + else if( arg.reader.n_vertices() == 0 ) { + return !reader.done_edges(); + } + else { + return true; + } + return true; + } + +private: + T& reader; +}; + +template<typename T> +class dimacs_edge_weight_iterator { +public: + typedef dimacs_basic_reader::edge_weight_type edge_weight_type; + typedef dimacs_basic_reader::incr_mode incr_mode; + + dimacs_edge_weight_iterator( T& reader ) : reader( reader ) {} + + inline dimacs_edge_weight_iterator& operator++() { + reader.incr( dimacs_basic_reader::edge_weight ); + return *this; + } + + inline edge_weight_type operator*() { + return reader.edge_weight_deref(); + } + + // don't expect this to do the right thing if you're not comparing against a + // general past-the-end-iterator made with the default constructor for + // dimacs_basic_reader + inline bool operator==( dimacs_edge_weight_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return arg.reader.done_edge_weights(); + } + else if( arg.reader.n_vertices() == 0 ) { + return reader.done_edge_weights(); + } + else { + return false; + } + return false; + } + + inline bool operator!=( dimacs_edge_weight_iterator arg ) { + if( reader.n_vertices() == 0 ) { + return !arg.reader.done_edge_weights(); + } + else if( arg.reader.n_vertices() == 0 ) { + return !reader.done_edge_weights(); + } + else { + return true; + } + return true; + } +private: + T& reader; +}; + +} } // end namespace boost::graph +#endif diff --git a/Utilities/BGL/boost/graph/directed_graph.hpp b/Utilities/BGL/boost/graph/directed_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..28b085dd1c9f2d859e0ac16e79d36b5a504ec4b7 --- /dev/null +++ b/Utilities/BGL/boost/graph/directed_graph.hpp @@ -0,0 +1,678 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_DIRECTED_GRAPH_HPP +#define BOOST_GRAPH_DIRECTED_GRAPH_HPP + +#include <boost/utility.hpp> +#include <boost/graph/adjacency_list.hpp> +#include <boost/graph/properties.hpp> + +namespace boost +{ +struct directed_graph_tag { }; + +/** + * The directed_graph class template is a simplified version of the BGL + * adjacency list. This class is provided for ease of use, but may not + * perform as well as custom-defined adjacency list classes. Instances of + * this template model the BidirectionalGraph, VertexIndexGraph, and + * EdgeIndexGraph concepts. The graph is also fully mutable, supporting + * both insertions and removals of vertices and edges. + * + * @note Special care must be taken when removing vertices or edges since + * those operations can invalidate the numbering of vertices. + */ +template < + typename VertexProp = no_property, + typename EdgeProp= no_property, + typename GraphProp= no_property> +class directed_graph +{ +public: + typedef typename graph_detail::vertex_prop<VertexProp>::type vertex_property_type; + typedef typename graph_detail::vertex_prop<VertexProp>::bundle vertex_bundled; + typedef typename graph_detail::edge_prop<EdgeProp>::type edge_property_type; + typedef typename graph_detail::edge_prop<EdgeProp>::bundle edge_bundled; + +private: + // Wrap the user-specified properties with an index. + typedef property<vertex_index_t, unsigned, vertex_property_type> vertex_property; + typedef property<edge_index_t, unsigned, edge_property_type> edge_property; + +public: + typedef adjacency_list< + listS, listS, bidirectionalS, + vertex_property, edge_property, GraphProp, + listS + > graph_type; + +private: + // storage selectors + typedef typename graph_type::vertex_list_selector vertex_list_selector; + typedef typename graph_type::edge_list_selector edge_list_selector; + typedef typename graph_type::out_edge_list_selector out_edge_list_selector; + typedef typename graph_type::directed_selector directed_selector; + +public: + typedef directed_graph_tag graph_tag; + typedef typename graph_type::graph_property_type graph_property_type; + + // more commonly used graph types + typedef typename graph_type::stored_vertex stored_vertex; + typedef typename graph_type::vertices_size_type vertices_size_type; + typedef typename graph_type::edges_size_type edges_size_type; + typedef typename graph_type::degree_size_type degree_size_type; + typedef typename graph_type::vertex_descriptor vertex_descriptor; + typedef typename graph_type::edge_descriptor edge_descriptor; + + // iterator types + typedef typename graph_type::vertex_iterator vertex_iterator; + typedef typename graph_type::edge_iterator edge_iterator; + typedef typename graph_type::out_edge_iterator out_edge_iterator; + typedef typename graph_type::in_edge_iterator in_edge_iterator; + typedef typename graph_type::adjacency_iterator adjacency_iterator; + + // miscellaneous types + typedef typename graph_type::directed_category directed_category; + typedef typename graph_type::edge_parallel_category edge_parallel_category; + typedef typename graph_type::traversal_category traversal_category; + + typedef unsigned vertex_index_type; + typedef unsigned edge_index_type; + + directed_graph(GraphProp const& p = GraphProp()) + : m_graph(p), m_num_vertices(0), m_num_edges(0), m_max_vertex_index(0) + , m_max_edge_index(0) + { } + + directed_graph(directed_graph const& x) + : m_graph(x), m_num_vertices(x.m_num_vertices), m_num_edges(x.m_num_edges) + , m_max_vertex_index(x.m_max_vertex_index), m_max_edge_index(x.m_max_edge_index) + { } + + directed_graph(vertices_size_type n, GraphProp const& p = GraphProp()) + : m_graph(n, p), m_num_vertices(n), m_num_edges(0), m_max_vertex_index(n) + , m_max_edge_index(0) + { renumber_vertex_indices(); } + + template <typename EdgeIterator> + directed_graph(EdgeIterator f, + EdgeIterator l, + vertices_size_type n, + edges_size_type m = 0, + GraphProp const& p = GraphProp()) + : m_graph(f, l, n, m, p), m_num_vertices(n), m_num_edges(0) + , m_max_vertex_index(n), m_max_edge_index(0) + { + // Unfortunately, we have to renumber the entire graph. + renumber_indices(); + + // Can't always guarantee that the number of edges is actually + // m if distance(f, l) != m (or is undefined). + m_num_edges = m_max_edge_index = boost::num_edges(m_graph); + } + + directed_graph& operator=(directed_graph const& g) { + if(&g != this) { + m_graph = g.m_graph; + m_num_vertices = g.m_num_vertices; + m_num_edges = g.m_num_edges; + m_max_vertex_index = g.m_max_vertex_index; + m_max_edge_index = g.m_max_edge_index; + } + return *this; + } + + // The impl_() methods are not part of the public interface. + graph_type& impl() + { return m_graph; } + + graph_type const& impl() const + { return m_graph; } + + // The following methods are not part of the public interface + vertices_size_type num_vertices() const + { return m_num_vertices; } + +private: + // This helper function manages the attribution of vertex indices. + vertex_descriptor make_index(vertex_descriptor v) { + boost::put(vertex_index, m_graph, v, m_max_vertex_index); + m_num_vertices++; + m_max_vertex_index++; + return v; + } +public: + vertex_descriptor add_vertex() + { return make_index(boost::add_vertex(m_graph)); } + + vertex_descriptor add_vertex(vertex_property_type const& p) + { return make_index(boost::add_vertex(vertex_property(0u, p), m_graph)); } + + void clear_vertex(vertex_descriptor v) + { + m_num_edges -= boost::degree(v, m_graph); + boost::clear_vertex(v, m_graph); + } + + void remove_vertex(vertex_descriptor v) + { + boost::remove_vertex(v, m_graph); + --m_num_vertices; + } + + edges_size_type num_edges() const + { return m_num_edges; } + +private: + // A helper fucntion for managing edge index attributes. + std::pair<edge_descriptor, bool> const& + make_index(std::pair<edge_descriptor, bool> const& x) + { + if(x.second) { + boost::put(edge_index, m_graph, x.first, m_max_edge_index); + ++m_num_edges; + ++m_max_edge_index; + } + return x; + } +public: + std::pair<edge_descriptor, bool> + add_edge(vertex_descriptor u, vertex_descriptor v) + { return make_index(boost::add_edge(u, v, m_graph)); } + + std::pair<edge_descriptor, bool> + add_edge(vertex_descriptor u, vertex_descriptor v, edge_property_type const& p) + { return make_index(boost::add_edge(u, v, edge_property(0u, p), m_graph)); } + + void remove_edge(vertex_descriptor u, vertex_descriptor v) + { + // find all edges, (u, v) + std::vector<edge_descriptor> edges; + out_edge_iterator i, i_end; + for(tie(i, i_end) = boost::out_edges(u, m_graph); i != i_end; ++i) { + if(boost::target(*i, m_graph) == v) { + edges.push_back(*i); + } + } + // remove all edges, (u, v) + typename std::vector<edge_descriptor>::iterator + j = edges.begin(), j_end = edges.end(); + for( ; j != j_end; ++j) { + remove_edge(*j); + } + } + + void remove_edge(edge_iterator i) + { + remove_edge(*i); + } + + void remove_edge(edge_descriptor e) + { + boost::remove_edge(e, m_graph); + --m_num_edges; + } + + vertex_index_type max_vertex_index() const + { return m_max_vertex_index; } + + void + renumber_vertex_indices() + { + vertex_iterator i, end; + tie(i, end) = vertices(m_graph); + m_max_vertex_index = renumber_vertex_indices(i, end, 0); + } + + void + remove_vertex_and_renumber_indices(vertex_iterator i) + { + vertex_iterator j = next(i), end = vertices(m_graph).second; + vertex_index_type n = get(vertex_index, m_graph, *i); + + // remove the offending vertex and renumber everything after + remove_vertex(*i); + m_max_vertex_index = renumber_vertex_indices(j, end, n); + } + + edge_index_type + max_edge_index() const + { return m_max_edge_index; } + + void + renumber_edge_indices() + { + edge_iterator i, end; + tie(i, end) = edges(m_graph); + m_max_edge_index = renumber_edge_indices(i, end, 0); + } + + void + remove_edge_and_renumber_indices(edge_iterator i) + { + edge_iterator j = next(i), end = edges(m_graph).second; + edge_index_type n = get(edge_index, m_graph, *i); + + // remove the offending edge and renumber everything after + remove_edge(*i); + m_max_edge_index = renumber_edge_indices(j, end, n); + } + + void + renumber_indices() + { + renumber_vertex_indices(); + renumber_edge_indices(); + } + + // bundled property support +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + vertex_bundled& operator[](vertex_descriptor v) + { return m_graph[v]; } + + vertex_bundled const& operator[](vertex_descriptor v) const + { return m_graph[v]; } + + edge_bundled& operator[](edge_descriptor e) + { return m_graph[e]; } + + edge_bundled const& operator[](edge_descriptor e) const + { return m_graph[e]; } +#endif + + // Graph concepts + static vertex_descriptor null_vertex() + { return graph_type::null_vertex(); } + + void clear() + { + m_graph.clear(); + m_num_vertices = m_max_vertex_index = 0; + m_num_edges = m_max_edge_index = 0; + } + + void swap(directed_graph& g) + { + m_graph.swap(g); + std::swap(m_num_vertices, g.m_num_vertices); + std::swap(m_max_vertex_index, g.m_max_vertex_index); + std::swap(m_num_edges, g.m_num_edges); + std::swap(m_max_edge_index, g.m_max_edge_index); + } + +private: + vertices_size_type + renumber_vertex_indices(vertex_iterator i, + vertex_iterator end, + vertices_size_type n) + { + typedef typename property_map<graph_type, vertex_index_t>::type IndexMap; + IndexMap indices = get(vertex_index, m_graph); + for( ; i != end; ++i) { + indices[*i] = n++; + } + return n; + } + + vertices_size_type + renumber_edge_indices(edge_iterator i, + edge_iterator end, + vertices_size_type n) + { + typedef typename property_map<graph_type, edge_index_t>::type IndexMap; + IndexMap indices = get(edge_index, m_graph); + for( ; i != end; ++i) { + indices[*i] = n++; + } + return n; + } + + graph_type m_graph; + vertices_size_type m_num_vertices; + edges_size_type m_num_edges; + vertex_index_type m_max_vertex_index; + edge_index_type m_max_edge_index; +}; + +#define DIRECTED_GRAPH_PARAMS typename VP, typename EP, typename GP +#define DIRECTED_GRAPH directed_graph<VP,EP,GP> + +// IncidenceGraph concepts +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::vertex_descriptor +source(typename DIRECTED_GRAPH::edge_descriptor e, + DIRECTED_GRAPH const& g) +{ return source(e, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::vertex_descriptor +target(typename DIRECTED_GRAPH::edge_descriptor e, + DIRECTED_GRAPH const& g) +{ return target(e, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::degree_size_type +out_degree(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH const& g) +{ return out_degree(v, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS> +inline std::pair< + typename DIRECTED_GRAPH::out_edge_iterator, + typename DIRECTED_GRAPH::out_edge_iterator +> +out_edges(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return out_edges(v, g.impl()); } + +// BidirectionalGraph concepts +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::degree_size_type +in_degree(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH const& g) +{ return in_degree(v, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS> +inline std::pair< + typename DIRECTED_GRAPH::in_edge_iterator, + typename DIRECTED_GRAPH::in_edge_iterator +> +in_edges(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return in_edges(v, g.impl()); } + + +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::degree_size_type +degree(typename DIRECTED_GRAPH::vertex_descriptor v, DIRECTED_GRAPH const& g) +{ return degree(v, g.impl()); } + +// AdjacencyGraph concepts +template <DIRECTED_GRAPH_PARAMS> +inline std::pair< + typename DIRECTED_GRAPH::adjacency_iterator, + typename DIRECTED_GRAPH::adjacency_iterator + > +adjacent_vertices(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return adjacent_vertices(v, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS> +typename DIRECTED_GRAPH::vertex_descriptor +vertex(typename DIRECTED_GRAPH::vertices_size_type n, + DIRECTED_GRAPH const& g) +{ return vertex(g.impl()); } + +template <DIRECTED_GRAPH_PARAMS> +std::pair<typename DIRECTED_GRAPH::edge_descriptor, bool> +edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return edge(u, v, g.impl()); } + +// VertexListGraph concepts +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::vertices_size_type +num_vertices(DIRECTED_GRAPH const& g) +{ return g.num_vertices(); } + +template <DIRECTED_GRAPH_PARAMS> +inline std::pair< + typename DIRECTED_GRAPH::vertex_iterator, + typename DIRECTED_GRAPH::vertex_iterator +> +vertices(DIRECTED_GRAPH const& g) +{ return vertices(g.impl()); } + +// EdgeListGraph concepts +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::edges_size_type +num_edges(DIRECTED_GRAPH const& g) +{ return g.num_edges(); } + +template <DIRECTED_GRAPH_PARAMS> +inline std::pair< + typename DIRECTED_GRAPH::edge_iterator, + typename DIRECTED_GRAPH::edge_iterator +> +edges(DIRECTED_GRAPH const& g) +{ return edges(g.impl()); } + +// MutableGraph concepts +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::vertex_descriptor +add_vertex(DIRECTED_GRAPH& g) +{ return g.add_vertex(); } + +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::vertex_descriptor +add_vertex(typename DIRECTED_GRAPH::vertex_property_type const& p, + DIRECTED_GRAPH& g) +{ return g.add_vertex(p); } + +template <DIRECTED_GRAPH_PARAMS> +inline void +clear_vertex(typename DIRECTED_GRAPH::vertex_descriptor v, +DIRECTED_GRAPH& g) +{ return g.clear_vertex(v); } + +template <DIRECTED_GRAPH_PARAMS> +inline void +remove_vertex(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH& g) +{ return g.remove_vertex(v); } + +template <DIRECTED_GRAPH_PARAMS> +inline std::pair<typename DIRECTED_GRAPH::edge_descriptor, bool> +add_edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH& g) +{ return g.add_edge(u, v); } + +template <DIRECTED_GRAPH_PARAMS> +inline std::pair<typename DIRECTED_GRAPH::edge_descriptor, bool> +add_edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + typename DIRECTED_GRAPH::edge_property_type const& p, + DIRECTED_GRAPH& g) +{ return g.add_edge(u, v, p); } + +template <DIRECTED_GRAPH_PARAMS> +inline void remove_edge(typename DIRECTED_GRAPH::vertex_descriptor u, + typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH& g) +{ return g.remove_edge(u, v); } + + +template <DIRECTED_GRAPH_PARAMS> +inline void remove_edge(typename DIRECTED_GRAPH::edge_descriptor e, DIRECTED_GRAPH& g) +{ return g.remove_edge(e); } + +template <DIRECTED_GRAPH_PARAMS> +inline void remove_edge(typename DIRECTED_GRAPH::edge_iterator i, DIRECTED_GRAPH& g) +{ return g.remove_edge(i); } + +template <DIRECTED_GRAPH_PARAMS, class Predicate> +inline void remove_edge_if(Predicate pred, DIRECTED_GRAPH& g) +{ return remove_edge_if(pred, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS, class Predicate> +inline void +remove_out_edge_if(typename DIRECTED_GRAPH::vertex_descriptor v, + Predicate pred, + DIRECTED_GRAPH& g) +{ return remove_out_edge_if(v, pred, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS, class Predicate> +inline void +remove_in_edge_if(typename DIRECTED_GRAPH::vertex_descriptor v, + Predicate pred, + DIRECTED_GRAPH& g) +{ return remove_in_edge_if(v, pred, g.impl()); } + +// Helper code for working with property maps +namespace detail +{ + struct directed_graph_vertex_property_selector { + template <class DirectedGraph, class Property, class Tag> + struct bind_ { + typedef typename DirectedGraph::graph_type Graph; + typedef property_map<Graph, Tag> PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; + + struct directed_graph_edge_property_selector { + template <class DirectedGraph, class Property, class Tag> + struct bind_ { + typedef typename DirectedGraph::graph_type Graph; + typedef property_map<Graph, Tag> PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; +} + +template <> +struct vertex_property_selector<directed_graph_tag> +{ typedef detail::directed_graph_vertex_property_selector type; }; + +template <> +struct edge_property_selector<directed_graph_tag> +{ typedef detail::directed_graph_edge_property_selector type; }; + +// PropertyGraph concepts +template <DIRECTED_GRAPH_PARAMS, typename Property> +inline typename property_map<DIRECTED_GRAPH, Property>::type +get(Property p, DIRECTED_GRAPH& g) +{ return get(p, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS, typename Property> +inline typename property_map<DIRECTED_GRAPH, Property>::const_type +get(Property p, DIRECTED_GRAPH const& g) +{ return get(p, g.impl()); } + +template <DIRECTED_GRAPH_PARAMS, typename Property, typename Key> +inline typename property_traits< + typename property_map< + typename DIRECTED_GRAPH::graph_type, Property + >::const_type +>::value_type +get(Property p, DIRECTED_GRAPH const& g, Key const& k) +{ return get(p, g.impl(), k); } + +template <DIRECTED_GRAPH_PARAMS, typename Property, typename Key, typename Value> +inline void put(Property p, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(p, g.impl(), k, v); } + +template <DIRECTED_GRAPH_PARAMS, class Property> +typename graph_property<DIRECTED_GRAPH, Property>::type& +get_property(DIRECTED_GRAPH& g, Property p) +{ return get_property(g.impl(), p); } + +template <DIRECTED_GRAPH_PARAMS, class Property> +typename graph_property<DIRECTED_GRAPH, Property>::type const& +get_property(DIRECTED_GRAPH const& g, Property p) +{ return get_property(g.impl(), p); } + +template <DIRECTED_GRAPH_PARAMS, class Property, class Value> +void +set_property(DIRECTED_GRAPH& g, Property p, Value v) +{ return set_property(g.impl(), p, v); } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + +template <DIRECTED_GRAPH_PARAMS, typename Type, typename Bundle> +inline typename property_map<DIRECTED_GRAPH, Type Bundle::*>::type +get(Type Bundle::* p, DIRECTED_GRAPH& g) { + typedef typename property_map< + DIRECTED_GRAPH, Type Bundle::* + >::type return_type; + return return_type(&g, p); +} + +template <DIRECTED_GRAPH_PARAMS, typename Type, typename Bundle> +inline typename property_map<DIRECTED_GRAPH, Type Bundle::*>::const_type +get(Type Bundle::* p, DIRECTED_GRAPH const& g) { + typedef typename property_map< + DIRECTED_GRAPH, Type Bundle::* + >::const_type return_type; + return return_type(&g, p); +} + +template <DIRECTED_GRAPH_PARAMS, typename Type, typename Bundle, typename Key> +inline Type get(Type Bundle::* p, DIRECTED_GRAPH const& g, Key const& k) +{ return get(p, g.impl(), k); } + +template <DIRECTED_GRAPH_PARAMS, typename Type, typename Bundle, typename Key, typename Value> +inline void put(Type Bundle::* p, DIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(p, g.impl(), k, v); } +#endif + +// Vertex index management + +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::vertex_index_type +get_vertex_index(typename DIRECTED_GRAPH::vertex_descriptor v, + DIRECTED_GRAPH const& g) +{ return get(vertex_index, g, v); } + +template <DIRECTED_GRAPH_PARAMS> +typename DIRECTED_GRAPH::vertex_index_type +max_vertex_index(DIRECTED_GRAPH const& g) +{ return g.max_vertex_index(); } + +template <DIRECTED_GRAPH_PARAMS> +inline void +renumber_vertex_indices(DIRECTED_GRAPH& g) +{ g.renumber_vertex_indices(); } + +template <DIRECTED_GRAPH_PARAMS> +inline void +remove_vertex_and_renumber_indices(typename DIRECTED_GRAPH::vertex_iterator i, + DIRECTED_GRAPH& g) +{ g.remove_vertex_and_renumber_indices(i); } + +// Edge index management +template <DIRECTED_GRAPH_PARAMS> +inline typename DIRECTED_GRAPH::edge_index_type +get_edge_index(typename DIRECTED_GRAPH::edge_descriptor v, DIRECTED_GRAPH const& g) +{ return get(edge_index, g, v); } + +template <DIRECTED_GRAPH_PARAMS> +typename DIRECTED_GRAPH::edge_index_type +max_edge_index(DIRECTED_GRAPH const& g) +{ return g.max_edge_index(); } + +template <DIRECTED_GRAPH_PARAMS> +inline void renumber_edge_indices(DIRECTED_GRAPH& g) +{ g.renumber_edge_indices(); } + +template <DIRECTED_GRAPH_PARAMS> +inline void +remove_edge_and_renumber_indices(typename DIRECTED_GRAPH::edge_iterator i, + DIRECTED_GRAPH& g) +{ g.remove_edge_and_renumber_indices(i); } + +// Index management +template <DIRECTED_GRAPH_PARAMS> +inline void +renumber_indices(DIRECTED_GRAPH& g) +{ g.renumber_indices(); } + +// Mutability Traits +template <DIRECTED_GRAPH_PARAMS> +struct graph_mutability_traits<DIRECTED_GRAPH> { + typedef mutable_property_graph_tag category; +}; + +#undef DIRECTED_GRAPH_PARAMS +#undef DIRECTED_GRAPH + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/distributed/adjacency_list.hpp b/Utilities/BGL/boost/graph/distributed/adjacency_list.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f16b96426d1d17ef41f2ca241d6638ba6acf5600 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/adjacency_list.hpp @@ -0,0 +1,3963 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. +// Copyright (C) 2007 Douglas Gregor + +// 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 +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJACENCY_LIST_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJACENCY_LIST_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/adjacency_list.hpp> +#include <boost/graph/properties.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/iterator/transform_iterator.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/adjacency_iterator.hpp> +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/property_map/parallel/local_property_map.hpp> +#include <boost/graph/parallel/detail/property_holders.hpp> +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_same.hpp> +#include <cassert> +#include <list> +#include <algorithm> +#include <boost/limits.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/parallel/distribution.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/graph/distributed/selector.hpp> +#include <boost/graph/parallel/process_group.hpp> + +// Callbacks +#include <boost/function/function2.hpp> + +// Serialization +#include <boost/serialization/base_object.hpp> +#include <boost/mpi/datatype.hpp> +#include <boost/pending/property_serialize.hpp> +#include <boost/graph/distributed/unsafe_serialize.hpp> + +// Named vertices +#include <boost/graph/distributed/named_graph.hpp> + +#include <boost/graph/distributed/shuffled_distribution.hpp> + +namespace boost { + + /// The type used to store an identifier that uniquely names a processor. + // NGE: I doubt we'll be running on more than 32768 procs for the time being + typedef /*int*/ short processor_id_type; + + // Tell which processor the target of an edge resides on (for + // directed graphs) or which processor the other end point of the + // edge resides on (for undirected graphs). + enum edge_target_processor_id_t { edge_target_processor_id }; + BOOST_INSTALL_PROPERTY(edge, target_processor_id); + + // For undirected graphs, tells whether the edge is locally owned. + enum edge_locally_owned_t { edge_locally_owned }; + BOOST_INSTALL_PROPERTY(edge, locally_owned); + + // For bidirectional graphs, stores the incoming edges. + enum vertex_in_edges_t { vertex_in_edges }; + BOOST_INSTALL_PROPERTY(vertex, in_edges); + + /// Tag class for directed, distributed adjacency list + struct directed_distributed_adj_list_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag {}; + + /// Tag class for bidirectional, distributed adjacency list + struct bidirectional_distributed_adj_list_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual bidirectional_graph_tag {}; + + /// Tag class for undirected, distributed adjacency list + struct undirected_distributed_adj_list_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag, + public virtual bidirectional_graph_tag {}; + + namespace detail { + template<typename Archiver, typename Directed, typename Vertex> + void + serialize(Archiver& ar, edge_base<Directed, Vertex>& e, + const unsigned int /*version*/) + { + ar & unsafe_serialize(e.m_source) + & unsafe_serialize(e.m_target); + } + + template<typename Archiver, typename Directed, typename Vertex> + void + serialize(Archiver& ar, edge_desc_impl<Directed, Vertex>& e, + const unsigned int /*version*/) + { + ar & boost::serialization::base_object<edge_base<Directed, Vertex> >(e) + & unsafe_serialize(e.m_eproperty); + } + } + + namespace detail { namespace parallel { + + /** + * A distributed vertex descriptor. These descriptors contain both + * the ID of the processor that owns the vertex and a local vertex + * descriptor that identifies the particular vertex for that + * processor. + */ + template<typename LocalDescriptor> + struct global_descriptor + { + typedef LocalDescriptor local_descriptor_type; + + global_descriptor() : owner(), local() { } + + global_descriptor(processor_id_type owner, LocalDescriptor local) + : owner(owner), local(local) { } + + processor_id_type owner; + LocalDescriptor local; + + /** + * A function object that, given a processor ID, generates + * distributed vertex descriptors from local vertex + * descriptors. This function object is used by the + * vertex_iterator of the distributed adjacency list. + */ + struct generator + { + typedef global_descriptor<LocalDescriptor> result_type; + typedef LocalDescriptor argument_type; + + generator() {} + generator(processor_id_type owner) : owner(owner) {} + + result_type operator()(argument_type v) const + { return result_type(owner, v); } + + private: + processor_id_type owner; + }; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & owner & unsafe_serialize(local); + } + }; + + /// Determine the process that owns the given descriptor + template<typename LocalDescriptor> + inline processor_id_type owner(const global_descriptor<LocalDescriptor>& v) + { return v.owner; } + + /// Determine the local portion of the given descriptor + template<typename LocalDescriptor> + inline LocalDescriptor local(const global_descriptor<LocalDescriptor>& v) + { return v.local; } + + /// Compare distributed vertex descriptors for equality + template<typename LocalDescriptor> + inline bool + operator==(const global_descriptor<LocalDescriptor>& u, + const global_descriptor<LocalDescriptor>& v) + { + return u.owner == v.owner && u.local == v.local; + } + + /// Compare distributed vertex descriptors for inequality + template<typename LocalDescriptor> + inline bool + operator!=(const global_descriptor<LocalDescriptor>& u, + const global_descriptor<LocalDescriptor>& v) + { return !(u == v); } + + template<typename LocalDescriptor> + inline bool + operator<(const global_descriptor<LocalDescriptor>& u, + const global_descriptor<LocalDescriptor>& v) + { + return (u.owner) < v.owner || (u.owner == v.owner && (u.local) < v.local); + } + + template<typename LocalDescriptor> + inline bool + operator<=(const global_descriptor<LocalDescriptor>& u, + const global_descriptor<LocalDescriptor>& v) + { + return u.owner <= v.owner || (u.owner == v.owner && u.local <= v.local); + } + + template<typename LocalDescriptor> + inline bool + operator>(const global_descriptor<LocalDescriptor>& u, + const global_descriptor<LocalDescriptor>& v) + { + return v < u; + } + + template<typename LocalDescriptor> + inline bool + operator>=(const global_descriptor<LocalDescriptor>& u, + const global_descriptor<LocalDescriptor>& v) + { + return v <= u; + } + + // DPG TBD: Add <, <=, >=, > for global descriptors + + /** + * A Readable Property Map that extracts a global descriptor pair + * from a global_descriptor. + */ + template<typename LocalDescriptor> + struct global_descriptor_property_map + { + typedef std::pair<processor_id_type, LocalDescriptor> value_type; + typedef value_type reference; + typedef global_descriptor<LocalDescriptor> key_type; + typedef readable_property_map_tag category; + }; + + template<typename LocalDescriptor> + inline std::pair<processor_id_type, LocalDescriptor> + get(global_descriptor_property_map<LocalDescriptor>, + global_descriptor<LocalDescriptor> x) + { + return std::pair<processor_id_type, LocalDescriptor>(x.owner, x.local); + } + + /** + * A Readable Property Map that extracts the owner of a global + * descriptor. + */ + template<typename LocalDescriptor> + struct owner_property_map + { + typedef processor_id_type value_type; + typedef value_type reference; + typedef global_descriptor<LocalDescriptor> key_type; + typedef readable_property_map_tag category; + }; + + template<typename LocalDescriptor> + inline processor_id_type + get(owner_property_map<LocalDescriptor>, + global_descriptor<LocalDescriptor> x) + { + return x.owner; + } + + /** + * A Readable Property Map that extracts the local descriptor from + * a global descriptor. + */ + template<typename LocalDescriptor> + struct local_descriptor_property_map + { + typedef LocalDescriptor value_type; + typedef value_type reference; + typedef global_descriptor<LocalDescriptor> key_type; + typedef readable_property_map_tag category; + }; + + template<typename LocalDescriptor> + inline LocalDescriptor + get(local_descriptor_property_map<LocalDescriptor>, + global_descriptor<LocalDescriptor> x) + { + return x.local; + } + + /** + * Stores an incoming edge for a bidirectional distributed + * adjacency list. The user does not see this type directly, + * because it is just an implementation detail. + */ + template<typename Edge> + struct stored_in_edge + { + stored_in_edge(processor_id_type sp, Edge e) + : source_processor(sp), e(e) {} + + processor_id_type source_processor; + Edge e; + }; + + /** + * A distributed edge descriptor. These descriptors contain the + * underlying edge descriptor, the processor IDs for both the + * source and the target of the edge, and a boolean flag that + * indicates which of the processors actually owns the edge. + */ + template<typename Edge> + struct edge_descriptor + { + edge_descriptor(processor_id_type sp = processor_id_type(), + processor_id_type tp = processor_id_type(), + bool owns = false, Edge ld = Edge()) + : source_processor(sp), target_processor(tp), + source_owns_edge(owns), local(ld) {} + + processor_id_type owner() const + { + return source_owns_edge? source_processor : target_processor; + } + + /// The processor that the source vertex resides on + processor_id_type source_processor; + + /// The processor that the target vertex resides on + processor_id_type target_processor; + + /// True when the source processor owns the edge, false when the + /// target processor owns the edge. + bool source_owns_edge; + + /// The local edge descriptor. + Edge local; + + /** + * Function object that generates edge descriptors for the + * out_edge_iterator of the given distributed adjacency list + * from the edge descriptors of the underlying adjacency list. + */ + template<typename Graph> + class out_generator + { + typedef typename Graph::directed_selector directed_selector; + + public: + typedef edge_descriptor<Edge> result_type; + typedef Edge argument_type; + + out_generator() : g(0) {} + explicit out_generator(const Graph& g) : g(&g) {} + + result_type operator()(argument_type e) const + { return map(e, directed_selector()); } + + private: + result_type map(argument_type e, directedS) const + { + return result_type(g->processor(), + get(edge_target_processor_id, g->base(), e), + true, e); + } + + result_type map(argument_type e, bidirectionalS) const + { + return result_type(g->processor(), + get(edge_target_processor_id, g->base(), e), + true, e); + } + + result_type map(argument_type e, undirectedS) const + { + return result_type(g->processor(), + get(edge_target_processor_id, g->base(), e), + get(edge_locally_owned, g->base(), e), + e); + } + + const Graph* g; + }; + + /** + * Function object that generates edge descriptors for the + * in_edge_iterator of the given distributed adjacency list + * from the edge descriptors of the underlying adjacency list. + */ + template<typename Graph> + class in_generator + { + typedef typename Graph::directed_selector DirectedS; + + public: + typedef typename boost::mpl::if_<is_same<DirectedS, bidirectionalS>, + stored_in_edge<Edge>, + Edge>::type argument_type; + typedef edge_descriptor<Edge> result_type; + + in_generator() : g(0) {} + explicit in_generator(const Graph& g) : g(&g) {} + + result_type operator()(argument_type e) const + { return map(e, DirectedS()); } + + private: + /** + * For a bidirectional graph, we just generate the appropriate + * edge. No tricks. + */ + result_type map(argument_type e, bidirectionalS) const + { + return result_type(e.source_processor, + g->processor(), + true, + e.e); + } + + /** + * For an undirected graph, we generate descriptors for the + * incoming edges by swapping the source/target of the + * underlying edge descriptor (a hack). The target processor + * ID on the edge is actually the source processor for this + * edge, and our processor is the target processor. If the + * edge is locally owned, then it is owned by the target (us); + * otherwise it is owned by the source. + */ + result_type map(argument_type e, undirectedS) const + { + typename Graph::local_edge_descriptor local_edge(e); + // TBD: This is a very, VERY lame hack that takes advantage + // of our knowledge of the internals of the BGL + // adjacency_list. There should be a cleaner way to handle + // this... + using std::swap; + swap(local_edge.m_source, local_edge.m_target); + return result_type(get(edge_target_processor_id, g->base(), e), + g->processor(), + !get(edge_locally_owned, g->base(), e), + local_edge); + } + + const Graph* g; + }; + + private: + friend class boost::serialization::access; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar + & source_processor + & target_processor + & source_owns_edge + & local; + } + }; + + /// Determine the process that owns this edge + template<typename Edge> + inline processor_id_type + owner(const edge_descriptor<Edge>& e) + { return e.source_owns_edge? e.source_processor : e.target_processor; } + + /// Determine the local descriptor for this edge. + template<typename Edge> + inline Edge + local(const edge_descriptor<Edge>& e) + { return e.local; } + + /** + * A Readable Property Map that extracts the owner and local + * descriptor of an edge descriptor. + */ + template<typename Edge> + struct edge_global_property_map + { + typedef std::pair<processor_id_type, Edge> value_type; + typedef value_type reference; + typedef edge_descriptor<Edge> key_type; + typedef readable_property_map_tag category; + }; + + template<typename Edge> + inline std::pair<processor_id_type, Edge> + get(edge_global_property_map<Edge>, const edge_descriptor<Edge>& e) + { + typedef std::pair<processor_id_type, Edge> result_type; + return result_type(e.source_owns_edge? e.source_processor + /* target owns edge*/: e.target_processor, + e.local); + } + + /** + * A Readable Property Map that extracts the owner of an edge + * descriptor. + */ + template<typename Edge> + struct edge_owner_property_map + { + typedef processor_id_type value_type; + typedef value_type reference; + typedef edge_descriptor<Edge> key_type; + typedef readable_property_map_tag category; + }; + + template<typename Edge> + inline processor_id_type + get(edge_owner_property_map<Edge>, const edge_descriptor<Edge>& e) + { + return e.source_owns_edge? e.source_processor : e.target_processor; + } + + /** + * A Readable Property Map that extracts the local descriptor from + * an edge descriptor. + */ + template<typename Edge> + struct edge_local_property_map + { + typedef Edge value_type; + typedef value_type reference; + typedef edge_descriptor<Edge> key_type; + typedef readable_property_map_tag category; + }; + + template<typename Edge> + inline Edge + get(edge_local_property_map<Edge>, + const edge_descriptor<Edge>& e) + { + return e.local; + } + + /** Compare distributed edge descriptors for equality. + * + * \todo need edge_descriptor to know if it is undirected so we + * can compare both ways. + */ + template<typename Edge> + inline bool + operator==(const edge_descriptor<Edge>& e1, + const edge_descriptor<Edge>& e2) + { + return (e1.source_processor == e2.source_processor + && e1.target_processor == e2.target_processor + && e1.local == e2.local); + } + + /// Compare distributed edge descriptors for inequality. + template<typename Edge> + inline bool + operator!=(const edge_descriptor<Edge>& e1, + const edge_descriptor<Edge>& e2) + { return !(e1 == e2); } + + /** + * Configuration for the distributed adjacency list. We use this + * parameter to store all of the configuration details for the + * implementation of the distributed adjacency list, which allows us to + * get at the distribution type in the maybe_named_graph. + */ + template<typename OutEdgeListS, typename ProcessGroup, + typename InVertexListS, typename InDistribution, + typename DirectedS, typename VertexProperty, + typename EdgeProperty, typename GraphProperty, + typename EdgeListS> + struct adjacency_list_config + { + typedef typename mpl::if_<is_same<InVertexListS, defaultS>, + vecS, InVertexListS>::type + VertexListS; + + /// Introduce the target processor ID property for each edge + typedef property<edge_target_processor_id_t, processor_id_type, + EdgeProperty> edge_property_with_id; + + /// For undirected graphs, introduce the locally-owned property for edges + typedef typename boost::mpl::if_<is_same<DirectedS, undirectedS>, + property<edge_locally_owned_t, bool, + edge_property_with_id>, + edge_property_with_id>::type + base_edge_property_type; + + /// The edge descriptor type for the local subgraph + typedef typename adjacency_list_traits<OutEdgeListS, + VertexListS, + directedS>::edge_descriptor + local_edge_descriptor; + + /// For bidirectional graphs, the type of an incoming stored edge + typedef stored_in_edge<local_edge_descriptor> bidir_stored_edge; + + /// The container type that will store incoming edges for a + /// bidirectional graph. + typedef typename container_gen<EdgeListS, bidir_stored_edge>::type + in_edge_list_type; + + // Bidirectional graphs have an extra vertex property to store + // the incoming edges. + typedef typename boost::mpl::if_<is_same<DirectedS, bidirectionalS>, + property<vertex_in_edges_t, in_edge_list_type, + VertexProperty>, + VertexProperty>::type + base_vertex_property_type; + + // The type of the distributed adjacency list + typedef adjacency_list<OutEdgeListS, + distributedS<ProcessGroup, + VertexListS, + InDistribution>, + DirectedS, VertexProperty, EdgeProperty, + GraphProperty, EdgeListS> + graph_type; + + // The type of the underlying adjacency list implementation + typedef adjacency_list<OutEdgeListS, VertexListS, directedS, + base_vertex_property_type, + base_edge_property_type, + GraphProperty, + EdgeListS> + inherited; + + typedef InDistribution in_distribution_type; + typedef typename inherited::vertices_size_type vertices_size_type; + + typedef typename ::boost::graph::distributed::select_distribution< + in_distribution_type, VertexProperty, vertices_size_type, + ProcessGroup>::type + base_distribution_type; + + typedef ::boost::graph::distributed::shuffled_distribution< + base_distribution_type> distribution_type; + + typedef VertexProperty vertex_property_type; + typedef EdgeProperty edge_property_type; + typedef ProcessGroup process_group_type; + + typedef VertexListS vertex_list_selector; + typedef OutEdgeListS out_edge_list_selector; + typedef DirectedS directed_selector; + typedef GraphProperty graph_property_type; + typedef EdgeListS edge_list_selector; + }; + + // Maybe initialize the indices of each vertex + template<typename IteratorPair, typename VertexIndexMap> + void + maybe_initialize_vertex_indices(IteratorPair p, VertexIndexMap to_index, + read_write_property_map_tag) + { + typedef typename property_traits<VertexIndexMap>::value_type index_t; + index_t next_index = 0; + while (p.first != p.second) + put(to_index, *p.first++, next_index++); + } + + template<typename IteratorPair, typename VertexIndexMap> + inline void + maybe_initialize_vertex_indices(IteratorPair p, VertexIndexMap to_index, + readable_property_map_tag) + { + // Do nothing + } + + template<typename IteratorPair, typename VertexIndexMap> + inline void + maybe_initialize_vertex_indices(IteratorPair p, VertexIndexMap to_index) + { + typedef typename property_traits<VertexIndexMap>::category category; + maybe_initialize_vertex_indices(p, to_index, category()); + } + + template<typename IteratorPair> + inline void + maybe_initialize_vertex_indices(IteratorPair p, + ::boost::detail::error_property_not_found) + { } + + /*********************************************************************** + * Message Payloads * + ***********************************************************************/ + + /** + * Data stored with a msg_add_edge message, which requests the + * remote addition of an edge. + */ + template<typename Vertex, typename LocalVertex> + struct msg_add_edge_data + { + msg_add_edge_data() { } + + msg_add_edge_data(Vertex source, Vertex target) + : source(source.local), target(target) { } + + /// The source of the edge; the processor will be the + /// receiving processor. + LocalVertex source; + + /// The target of the edge. + Vertex target; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & unsafe_serialize(source) & target; + } + }; + + /** + * Like @c msg_add_edge_data, but also includes a user-specified + * property value to be attached to the edge. + */ + template<typename Vertex, typename LocalVertex, typename EdgeProperty> + struct msg_add_edge_with_property_data + : msg_add_edge_data<Vertex, LocalVertex>, + maybe_store_property<EdgeProperty> + { + private: + typedef msg_add_edge_data<Vertex, LocalVertex> inherited_data; + typedef maybe_store_property<EdgeProperty> inherited_property; + + public: + msg_add_edge_with_property_data() { } + + msg_add_edge_with_property_data(Vertex source, + Vertex target, + const EdgeProperty& property) + : inherited_data(source, target), + inherited_property(property) { } + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & boost::serialization::base_object<inherited_data>(*this) + & boost::serialization::base_object<inherited_property>(*this); + } + }; + + //------------------------------------------------------------------------ + // Distributed adjacency list property map details + /** + * Metafunction that extracts the given property from the given + * distributed adjacency list type. This could be implemented much + * more cleanly, but even newer versions of GCC (e.g., 3.2.3) + * cannot properly handle partial specializations involving + * enumerator types. + */ + template<typename Property> + struct get_adj_list_pmap + { + template<typename Graph> + struct apply + { + typedef Graph graph_type; + typedef typename graph_type::process_group_type process_group_type; + typedef typename graph_type::inherited base_graph_type; + typedef typename property_map<base_graph_type, Property>::type + local_pmap; + typedef typename property_map<base_graph_type, Property>::const_type + local_const_pmap; + + typedef graph_traits<graph_type> traits; + typedef typename graph_type::local_vertex_descriptor local_vertex; + typedef typename property_traits<local_pmap>::key_type local_key_type; + + typedef typename property_traits<local_pmap>::value_type value_type; + + typedef typename property_map<Graph, vertex_global_t>::const_type + vertex_global_map; + typedef typename property_map<Graph, edge_global_t>::const_type + edge_global_map; + + typedef typename mpl::if_c<(is_same<local_key_type, + local_vertex>::value), + vertex_global_map, edge_global_map>::type + global_map; + + public: + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_pmap> type; + + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_const_pmap> const_type; + }; + }; + + /** + * The local vertex index property map is actually a mapping from + * the local vertex descriptors to vertex indices. + */ + template<> + struct get_adj_list_pmap<vertex_local_index_t> + { + template<typename Graph> + struct apply + : ::boost::property_map<typename Graph::inherited, vertex_index_t> + { }; + }; + + /** + * The vertex index property map maps from global descriptors + * (e.g., the vertex descriptor of a distributed adjacency list) + * to the underlying local index. It is not valid to use this + * property map with nonlocal descriptors. + */ + template<> + struct get_adj_list_pmap<vertex_index_t> + { + template<typename Graph> + struct apply + { + private: + typedef typename property_map<Graph, vertex_global_t>::const_type + global_map; + + typedef property_map<typename Graph::inherited, vertex_index_t> local; + + public: + typedef local_property_map<typename Graph::process_group_type, + global_map, + typename local::type> type; + typedef local_property_map<typename Graph::process_group_type, + global_map, + typename local::const_type> const_type; + }; + }; + + /** + * The vertex owner property map maps from vertex descriptors to + * the processor that owns the vertex. + */ + template<> + struct get_adj_list_pmap<vertex_global_t> + { + template<typename Graph> + struct apply + { + private: + typedef typename Graph::local_vertex_descriptor + local_vertex_descriptor; + public: + typedef global_descriptor_property_map<local_vertex_descriptor> type; + typedef type const_type; + }; + }; + + /** + * The vertex owner property map maps from vertex descriptors to + * the processor that owns the vertex. + */ + template<> + struct get_adj_list_pmap<vertex_owner_t> + { + template<typename Graph> + struct apply + { + private: + typedef typename Graph::local_vertex_descriptor + local_vertex_descriptor; + public: + typedef owner_property_map<local_vertex_descriptor> type; + typedef type const_type; + }; + }; + + /** + * The vertex local property map maps from vertex descriptors to + * the local descriptor for that vertex. + */ + template<> + struct get_adj_list_pmap<vertex_local_t> + { + template<typename Graph> + struct apply + { + private: + typedef typename Graph::local_vertex_descriptor + local_vertex_descriptor; + public: + typedef local_descriptor_property_map<local_vertex_descriptor> type; + typedef type const_type; + }; + }; + + /** + * The edge global property map maps from edge descriptors to + * a pair of the owning processor and local descriptor. + */ + template<> + struct get_adj_list_pmap<edge_global_t> + { + template<typename Graph> + struct apply + { + private: + typedef typename Graph::local_edge_descriptor + local_edge_descriptor; + public: + typedef edge_global_property_map<local_edge_descriptor> type; + typedef type const_type; + }; + }; + + /** + * The edge owner property map maps from edge descriptors to + * the processor that owns the edge. + */ + template<> + struct get_adj_list_pmap<edge_owner_t> + { + template<typename Graph> + struct apply + { + private: + typedef typename Graph::local_edge_descriptor + local_edge_descriptor; + public: + typedef edge_owner_property_map<local_edge_descriptor> type; + typedef type const_type; + }; + }; + + /** + * The edge local property map maps from edge descriptors to + * the local descriptor for that edge. + */ + template<> + struct get_adj_list_pmap<edge_local_t> + { + template<typename Graph> + struct apply + { + private: + typedef typename Graph::local_edge_descriptor + local_edge_descriptor; + public: + typedef edge_local_property_map<local_edge_descriptor> type; + typedef type const_type; + }; + }; + //------------------------------------------------------------------------ + + // Directed graphs do not have in edges, so this is a no-op + template<typename Graph> + inline void + remove_in_edge(typename Graph::edge_descriptor, Graph&, directedS) + { } + + // Bidirectional graphs have in edges stored in the + // vertex_in_edges property. + template<typename Graph> + inline void + remove_in_edge(typename Graph::edge_descriptor e, Graph& g, bidirectionalS) + { + typedef typename Graph::in_edge_list_type in_edge_list_type; + in_edge_list_type& in_edges = + get(vertex_in_edges, g.base())[target(e, g).local]; + typename in_edge_list_type::iterator i = in_edges.begin(); + while (i != in_edges.end() + && !(i->source_processor == source(e, g).owner) + && i->e == e.local) + ++i; + + assert(i != in_edges.end()); + in_edges.erase(i); + } + + // Undirected graphs have in edges stored as normal edges. + template<typename Graph> + inline void + remove_in_edge(typename Graph::edge_descriptor e, Graph& g, undirectedS) + { + typedef typename Graph::inherited base_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + // TBD: can we make this more efficient? + // Removing edge (v, u). v is local + base_type& bg = g.base(); + vertex_descriptor u = source(e, g); + vertex_descriptor v = target(e, g); + if (v.owner != process_id(g.process_group())) { + using std::swap; + swap(u, v); + } + + typename graph_traits<base_type>::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(v.local, bg); ei != ei_end; ++ei) + { + if (target(*ei, g.base()) == u.local + // TBD: deal with parallel edges properly && *ei == e + && get(edge_target_processor_id, bg, *ei) == u.owner) { + remove_edge(ei, bg); + return; + } + } + + if (v.owner == process_id(g.process_group())) { + + } + } + + //------------------------------------------------------------------------ + // Lazy addition of edges + + // Work around the fact that an adjacency_list with vecS vertex + // storage automatically adds edges when the descriptor is + // out-of-range. + template <class Graph, class Config, class Base> + inline std::pair<typename Config::edge_descriptor, bool> + add_local_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + vec_adj_list_impl<Graph, Config, Base>& g_) + { + adj_list_helper<Config, Base>& g = g_; + return add_edge(u, v, p, g); + } + + template <class Graph, class Config, class Base> + inline std::pair<typename Config::edge_descriptor, bool> + add_local_edge(typename Config::vertex_descriptor u, + typename Config::vertex_descriptor v, + const typename Config::edge_property_type& p, + boost::adj_list_impl<Graph, Config, Base>& g) + { + return add_edge(u, v, p, g); + } + + template <class EdgeProperty,class EdgeDescriptor> + struct msg_nonlocal_edge_data + : public detail::parallel::maybe_store_property<EdgeProperty> + { + typedef EdgeProperty edge_property_type; + typedef EdgeDescriptor local_edge_descriptor; + typedef detail::parallel::maybe_store_property<edge_property_type> + inherited; + + msg_nonlocal_edge_data() {} + msg_nonlocal_edge_data(local_edge_descriptor e, + const edge_property_type& p) + : inherited(p), e(e) { } + + local_edge_descriptor e; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & boost::serialization::base_object<inherited>(*this) & e; + } + }; + + template <class EdgeDescriptor> + struct msg_remove_edge_data + { + typedef EdgeDescriptor edge_descriptor; + msg_remove_edge_data() {} + explicit msg_remove_edge_data(edge_descriptor e) : e(e) {} + + edge_descriptor e; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & e; + } + }; + + } } // end namespace detail::parallel + + /** + * Adjacency list traits for a distributed adjacency list. Contains + * the vertex and edge descriptors, the directed-ness, and the + * parallel edges typedefs. + */ + template<typename OutEdgeListS, typename ProcessGroup, + typename InVertexListS, typename InDistribution, typename DirectedS> + struct adjacency_list_traits<OutEdgeListS, + distributedS<ProcessGroup, + InVertexListS, + InDistribution>, + DirectedS> + { + private: + typedef typename mpl::if_<is_same<InVertexListS, defaultS>, + vecS, + InVertexListS>::type VertexListS; + + typedef adjacency_list_traits<OutEdgeListS, VertexListS, directedS> + base_type; + + public: + typedef typename base_type::vertex_descriptor local_vertex_descriptor; + typedef typename base_type::edge_descriptor local_edge_descriptor; + + typedef typename boost::mpl::if_<typename DirectedS::is_bidir_t, + bidirectional_tag, + typename boost::mpl::if_<typename DirectedS::is_directed_t, + directed_tag, undirected_tag + >::type + >::type directed_category; + + typedef typename parallel_edge_traits<OutEdgeListS>::type + edge_parallel_category; + + typedef detail::parallel::global_descriptor<local_vertex_descriptor> + vertex_descriptor; + + typedef detail::parallel::edge_descriptor<local_edge_descriptor> + edge_descriptor; + }; + +#define PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS \ + typename OutEdgeListS, typename ProcessGroup, typename InVertexListS, \ + typename InDistribution, typename DirectedS, typename VertexProperty, \ + typename EdgeProperty, typename GraphProperty, typename EdgeListS + +#define PBGL_DISTRIB_ADJLIST_TYPE \ + adjacency_list<OutEdgeListS, \ + distributedS<ProcessGroup, InVertexListS, InDistribution>, \ + DirectedS, VertexProperty, EdgeProperty, GraphProperty, \ + EdgeListS> + +#define PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG \ + typename OutEdgeListS, typename ProcessGroup, typename InVertexListS, \ + typename InDistribution, typename VertexProperty, \ + typename EdgeProperty, typename GraphProperty, typename EdgeListS + +#define PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directed) \ + adjacency_list<OutEdgeListS, \ + distributedS<ProcessGroup, InVertexListS, InDistribution>, \ + directed, VertexProperty, EdgeProperty, GraphProperty, \ + EdgeListS> + + /** A distributed adjacency list. + * + * This class template partial specialization defines a distributed + * (or "partitioned") adjacency list graph. The distributed + * adjacency list is similar to the standard Boost Graph Library + * adjacency list, which stores a list of vertices and for each + * verted the list of edges outgoing from the vertex (and, in some + * cases, also the edges incoming to the vertex). The distributed + * adjacency list differs in that it partitions the graph into + * several subgraphs that are then divided among different + * processors (or nodes within a cluster). The distributed adjacency + * list attempts to maintain a high degree of compatibility with the + * standard, non-distributed adjacency list. + * + * The graph is partitioned by vertex, with each processor storing + * all of the required information for a particular subset of the + * vertices, including vertex properties, outgoing edges, and (for + * bidirectional graphs) incoming edges. This information is + * accessible only on the processor that owns the vertex: for + * instance, if processor 0 owns vertex @c v, no other processor can + * directly access the properties of @c v or enumerate its outgoing + * edges. + * + * Edges in a graph may be entirely local (connecting two local + * vertices), but more often it is the case that edges are + * non-local, meaning that the two vertices they connect reside in + * different processes. Edge properties are stored with the + * originating vertex for directed and bidirectional graphs, and are + * therefore only accessible from the processor that owns the + * originating vertex. Other processors may query the source and + * target of the edge, but cannot access its properties. This is + * particularly interesting when accessing the incoming edges of a + * bidirectional graph, which are not guaranteed to be stored on the + * processor that is able to perform the iteration. For undirected + * graphs the situation is more complicated, since no vertex clearly + * owns the edges: the list of edges incident to a vertex may + * contain a mix of local and non-local edges. + * + * The distributed adjacency list is able to model several of the + * existing Graph concepts. It models the Graph concept because it + * exposes vertex and edge descriptors in the normal way; these + * descriptors model the GlobalDescriptor concept (because they have + * an owner and a local descriptor), and as such the distributed + * adjacency list models the DistributedGraph concept. The adjacency + * list also models the IncidenceGraph and AdjacencyGraph concepts, + * although this is only true so long as the domain of the valid + * expression arguments are restricted to vertices and edges stored + * locally. Likewise, bidirectional and undirected distributed + * adjacency lists model the BidirectionalGraph concept (vertex and + * edge domains must be respectived) and the distributed adjacency + * list models the MutableGraph concept (vertices and edges can only + * be added or removed locally). T he distributed adjacency list + * does not, however, model the VertexListGraph or EdgeListGraph + * concepts, because we can not efficiently enumerate all vertices + * or edges in the graph. Instead, the local subsets of vertices and + * edges can be enumerated (with the same syntax): the distributed + * adjacency list therefore models the DistributedVertexListGraph + * and DistributedEdgeListGraph concepts, because concurrent + * iteration over all of the vertices or edges stored on each + * processor will visit each vertex or edge. + * + * The distributed adjacency list is distinguished from the + * non-distributed version by the vertex list descriptor, which will + * be @c distributedS<ProcessGroup,VertexListS>. Here, + * the VertexListS type plays the same role as the VertexListS type + * in the non-distributed adjacency list: it allows one to select + * the data structure that will be used to store the local + * vertices. The ProcessGroup type, on the other hand, is unique to + * distributed data structures: it is the type that abstracts a + * group of cooperating processes, and it used for process + * identification, communication, and synchronization, among other + * things. Different process group types represent different + * communication mediums (e.g., MPI, PVM, TCP) or different models + * of communication (LogP, CGM, BSP, synchronous, etc.). This + * distributed adjacency list assumes a model based on non-blocking + * sends. + * + * Distribution of vertices across different processors is + * accomplished in two different ways. When initially constructing + * the graph, the user may provide a distribution object (that + * models the Distribution concept), which will determine the + * distribution of vertices to each process. Additionally, the @c + * add_vertex and @c add_edge operations add vertices or edges + * stored on the local processor. For @c add_edge, this is + * accomplished by requiring that the source vertex of the new edge + * be local to the process executing @c add_edge. + * + * Internal properties of a distributed adjacency list are + * accessible in the same manner as internal properties for a + * non-distributed adjacency list for local vertices or + * edges. Access to properties for remote vertices or edges occurs + * with the same syntax, but involve communication with the owner of + * the information: for more information, refer to class template + * @ref distributed_property_map, which manages distributed + * property maps. Note that the distributed property maps created + * for internal properties determine their reduction operation via + * the metafunction @ref property_reduce, which for the vast + * majority of uses is correct behavior. + * + * Communication among the processes coordinating on a particular + * distributed graph relies on non-blocking message passing along + * with synchronization. Local portions of the distributed graph may + * be modified concurrently, including the introduction of non-local + * edges, but prior to accessing the graph it is recommended that + * the @c synchronize free function be invoked on the graph to clear + * up any pending interprocess communication and modifications. All + * processes will then be released from the synchronization barrier + * concurrently. + * + * \todo Determine precisely what we should do with nonlocal edges + * in undirected graphs. Our parallelization of certain algorithms + * relies on the ability to access edge property maps immediately + * (e.g., edge_weight_t), so it may be necessary to duplicate the + * edge properties in both processes (but then we need some form of + * coherence protocol). + * + * \todo What does the user do if @c property_reduce doesn't do the + * right thing? + */ + template<typename OutEdgeListS, typename ProcessGroup, + typename InVertexListS, typename InDistribution, typename DirectedS, + typename VertexProperty, typename EdgeProperty, + typename GraphProperty, typename EdgeListS> + class adjacency_list<OutEdgeListS, + distributedS<ProcessGroup, + InVertexListS, + InDistribution>, + DirectedS, VertexProperty, + EdgeProperty, GraphProperty, EdgeListS> + : // Support for named vertices + public graph::distributed::maybe_named_graph< + adjacency_list<OutEdgeListS, + distributedS<ProcessGroup, + InVertexListS, + InDistribution>, + DirectedS, VertexProperty, + EdgeProperty, GraphProperty, EdgeListS>, + typename adjacency_list_traits<OutEdgeListS, + distributedS<ProcessGroup, + InVertexListS, + InDistribution>, + DirectedS>::vertex_descriptor, + typename adjacency_list_traits<OutEdgeListS, + distributedS<ProcessGroup, + InVertexListS, + InDistribution>, + DirectedS>::edge_descriptor, + detail::parallel::adjacency_list_config<OutEdgeListS, ProcessGroup, + InVertexListS, InDistribution, + DirectedS, VertexProperty, + EdgeProperty, GraphProperty, + EdgeListS> > + { + typedef detail::parallel::adjacency_list_config<OutEdgeListS, ProcessGroup, + InVertexListS, InDistribution, + DirectedS, VertexProperty, + EdgeProperty, GraphProperty, + EdgeListS> + config_type; + + typedef adjacency_list_traits<OutEdgeListS, + distributedS<ProcessGroup, + InVertexListS, + InDistribution>, + DirectedS> + traits_type; + + typedef typename DirectedS::is_directed_t is_directed; + + typedef EdgeListS edge_list_selector; + + public: + /// The container type that will store incoming edges for a + /// bidirectional graph. + typedef typename config_type::in_edge_list_type in_edge_list_type; +// typedef typename inherited::edge_descriptor edge_descriptor; + + /// The type of the underlying adjacency list implementation + typedef typename config_type::inherited inherited; + + /// The type of properties stored in the local subgraph + /// Bidirectional graphs have an extra vertex property to store + /// the incoming edges. + typedef typename inherited::vertex_property_type + base_vertex_property_type; + + /// The type of the distributed adjacency list (this type) + typedef typename config_type::graph_type graph_type; + + /// Expose graph components and graph category + typedef typename traits_type::local_vertex_descriptor + local_vertex_descriptor; + typedef typename traits_type::local_edge_descriptor + local_edge_descriptor; + typedef typename traits_type::vertex_descriptor vertex_descriptor; + typedef typename traits_type::edge_descriptor edge_descriptor; + + typedef typename traits_type::directed_category directed_category; + typedef typename inherited::edge_parallel_category + edge_parallel_category; + typedef typename inherited::graph_tag graph_tag; + + // Current implementation requires the ability to have parallel + // edges in the underlying adjacency_list. Which processor each + // edge refers to is attached as an internal property. TBD: + // remove this restriction, which may require some rewriting. + BOOST_STATIC_ASSERT((is_same<edge_parallel_category, + allow_parallel_edge_tag>::value)); + + /** Determine the graph traversal category. + * + * A directed distributed adjacency list models the Distributed + * Graph, Incidence Graph, and Adjacency Graph + * concepts. Bidirectional and undirected graphs also model the + * Bidirectional Graph concept. Note that when modeling these + * concepts the domains of certain operations (e.g., in_edges) + * are restricted; see the distributed adjacency_list + * documentation. + */ + typedef typename boost::mpl::if_< + is_same<DirectedS, directedS>, + directed_distributed_adj_list_tag, + typename boost::mpl::if_<is_same<DirectedS, bidirectionalS>, + bidirectional_distributed_adj_list_tag, + undirected_distributed_adj_list_tag>::type> + ::type traversal_category; + + typedef typename inherited::degree_size_type degree_size_type; + typedef typename inherited::vertices_size_type vertices_size_type; + typedef typename inherited::edges_size_type edges_size_type; + typedef VertexProperty vertex_property_type; + typedef EdgeProperty edge_property_type; + typedef typename inherited::graph_property_type graph_property_type; + typedef typename inherited::vertex_bundled vertex_bundled; + typedef typename inherited::edge_bundled edge_bundled; + + typedef typename container_gen<edge_list_selector, edge_descriptor>::type + local_edge_list_type; + + private: + typedef typename boost::mpl::if_<is_same<DirectedS, bidirectionalS>, + typename in_edge_list_type::const_iterator, + typename inherited::out_edge_iterator>::type + base_in_edge_iterator; + + typedef typename inherited::out_edge_iterator base_out_edge_iterator; + typedef typename graph_traits<inherited>::edge_iterator + base_edge_iterator; + typedef typename inherited::edge_property_type base_edge_property_type; + + typedef typename local_edge_list_type::const_iterator + undirected_edge_iterator; + + typedef InDistribution in_distribution_type; + + typedef parallel::trigger_receive_context trigger_receive_context; + + public: + /// Iterator over the (local) vertices of the graph + typedef transform_iterator<typename vertex_descriptor::generator, + typename inherited::vertex_iterator> + vertex_iterator; + + /// Helper for out_edge_iterator + typedef typename edge_descriptor::template out_generator<adjacency_list> + out_edge_generator; + + /// Iterator over the outgoing edges of a vertex + typedef transform_iterator<out_edge_generator, + typename inherited::out_edge_iterator> + out_edge_iterator; + + /// Helper for in_edge_iterator + typedef typename edge_descriptor::template in_generator<adjacency_list> + in_edge_generator; + + /// Iterator over the incoming edges of a vertex + typedef transform_iterator<in_edge_generator, base_in_edge_iterator> + in_edge_iterator; + + /// Iterator over the neighbors of a vertex + typedef boost::adjacency_iterator< + adjacency_list, vertex_descriptor, out_edge_iterator, + typename detail::iterator_traits<base_out_edge_iterator> + ::difference_type> + adjacency_iterator; + + /// Iterator over the (local) edges in a graph + typedef typename boost::mpl::if_<is_same<DirectedS, undirectedS>, + undirected_edge_iterator, + transform_iterator<out_edge_generator, + base_edge_iterator> + >::type + edge_iterator; + + public: + /// The type of the mixin for named vertices + typedef graph::distributed::maybe_named_graph<graph_type, + vertex_descriptor, + edge_descriptor, + config_type> + named_graph_mixin; + + /// Process group used for communication + typedef ProcessGroup process_group_type; + + /// How to refer to a process + typedef typename process_group_type::process_id_type process_id_type; + + /// Whether this graph is directed, undirected, or bidirectional + typedef DirectedS directed_selector; + + // Structure used for the lazy addition of vertices + struct lazy_add_vertex_with_property; + friend struct lazy_add_vertex_with_property; + + // Structure used for the lazy addition of edges + struct lazy_add_edge; + friend struct lazy_add_edge; + + // Structure used for the lazy addition of edges with properties + struct lazy_add_edge_with_property; + friend struct lazy_add_edge_with_property; + + /// default_distribution_type is the type of the distribution used if the + /// user didn't specify an explicit one + typedef typename graph::distributed::select_distribution< + InDistribution, VertexProperty, vertices_size_type, + ProcessGroup>::default_type + default_distribution_type; + + /// distribution_type is the type of the distribution instance stored in + /// the maybe_named_graph base class + typedef typename graph::distributed::select_distribution< + InDistribution, VertexProperty, vertices_size_type, + ProcessGroup>::type + base_distribution_type; + + typedef graph::distributed::shuffled_distribution< + base_distribution_type> distribution_type; + + private: + // FIXME: the original adjacency_list contained this comment: + // Default copy constructor and copy assignment operators OK??? TBD + // but the adj_list_impl contained these declarations: + adjacency_list(const adjacency_list& other); + adjacency_list& operator=(const adjacency_list& other); + + public: + adjacency_list(const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, 0)), + m_local_graph(GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + } + + adjacency_list(const ProcessGroup& pg, + const base_distribution_type& distribution) + : named_graph_mixin(pg, distribution), + m_local_graph(GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + } + + adjacency_list(const GraphProperty& g, + const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, 0)), + m_local_graph(g), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + } + + adjacency_list(vertices_size_type n, + const GraphProperty& p, + const ProcessGroup& pg, + const base_distribution_type& distribution) + : named_graph_mixin(pg, distribution), + m_local_graph(distribution.block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + adjacency_list(vertices_size_type n, + const ProcessGroup& pg, + const base_distribution_type& distribution) + : named_graph_mixin(pg, distribution), + m_local_graph(distribution.block_size(process_id(pg), n), GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + adjacency_list(vertices_size_type n, + const GraphProperty& p, + const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + adjacency_list(vertices_size_type n, + const ProcessGroup& pg = ProcessGroup()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), + GraphProperty()), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + } + + /* + * We assume that every processor sees the same list of edges, so + * they skip over any that don't originate from themselves. This + * means that programs switching between a local and a distributed + * graph will keep the same semantics. + */ + template <class EdgeIterator> + adjacency_list(EdgeIterator first, EdgeIterator last, + vertices_size_type n, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, n, this->distribution(), vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + template <class EdgeIterator, class EdgePropertyIterator> + adjacency_list(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, default_distribution_type(pg, n)), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, ep_iter, n, this->distribution(), + vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + template <class EdgeIterator> + adjacency_list(EdgeIterator first, EdgeIterator last, + vertices_size_type n, + const ProcessGroup& pg, + const base_distribution_type& distribution, + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, distribution), + m_local_graph(distribution.block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, n, this->distribution(), vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + template <class EdgeIterator, class EdgePropertyIterator> + adjacency_list(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, + const ProcessGroup& pg, + const base_distribution_type& distribution, + const GraphProperty& p = GraphProperty()) + : named_graph_mixin(pg, distribution), + m_local_graph(this->distribution().block_size(process_id(pg), n), p), + process_group_(pg, graph::parallel::attach_distributed_object()) + { + setup_triggers(); + + typedef typename config_type::VertexListS vertex_list_selector; + initialize(first, last, ep_iter, n, distribution, + vertex_list_selector()); + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); + + } + + ~adjacency_list() + { + synchronize(process_group_); + } + + void clear() + { + base().clear(); + local_edges_.clear(); + named_graph_mixin::clearing_graph(); + } + + void swap(adjacency_list& other) + { + using std::swap; + + base().swap(other); + swap(process_group_, other.process_group_); + } + + static vertex_descriptor null_vertex() + { + return vertex_descriptor(processor_id_type(0), + inherited::null_vertex()); + } + + inherited& base() { return m_local_graph; } + const inherited& base() const { return m_local_graph; } + + processor_id_type processor() const { return process_id(process_group_); } + process_group_type process_group() const { return process_group_.base(); } + + local_edge_list_type& local_edges() { return local_edges_; } + const local_edge_list_type& local_edges() const { return local_edges_; } + + // Redistribute the vertices of the graph by placing each vertex + // v on the processor get(vertex_to_processor, v). + template<typename VertexProcessorMap> + void redistribute(VertexProcessorMap vertex_to_processor); + + // Directly access a vertex or edge bundle + vertex_bundled& operator[](vertex_descriptor v) + { + assert(v.owner == processor()); + return base()[v.local]; + } + + const vertex_bundled& operator[](vertex_descriptor v) const + { + assert(v.owner == processor()); + return base()[v.local]; + } + + edge_bundled& operator[](edge_descriptor e) + { + assert(e.owner() == processor()); + return base()[e.local]; + } + + const edge_bundled& operator[](edge_descriptor e) const + { + assert(e.owner() == processor()); + return base()[e.local]; + } + + template<typename OStreamConstructibleArchive> + void save(std::string const& filename) const; + + template<typename IStreamConstructibleArchive> + void load(std::string const& filename); + + // Callback that will be invoked whenever a new vertex is added locally + boost::function<void(vertex_descriptor, adjacency_list&)> on_add_vertex; + + // Callback that will be invoked whenever a new edge is added locally + boost::function<void(edge_descriptor, adjacency_list&)> on_add_edge; + + private: + // Request vertex->processor mapping for neighbors <does nothing> + template<typename VertexProcessorMap> + void + request_in_neighbors(vertex_descriptor, + VertexProcessorMap, + directedS) { } + + // Request vertex->processor mapping for neighbors <does nothing> + template<typename VertexProcessorMap> + void + request_in_neighbors(vertex_descriptor, + VertexProcessorMap, + undirectedS) { } + + // Request vertex->processor mapping for neighbors + template<typename VertexProcessorMap> + void + request_in_neighbors(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS); + + // Clear the list of in-edges, but don't tell the remote processor + void clear_in_edges_local(vertex_descriptor v, directedS) {} + void clear_in_edges_local(vertex_descriptor v, undirectedS) {} + + void clear_in_edges_local(vertex_descriptor v, bidirectionalS) + { get(vertex_in_edges, base())[v.local].clear(); } + + // Remove in-edges that have migrated <does nothing> + template<typename VertexProcessorMap> + void + remove_migrated_in_edges(vertex_descriptor, + VertexProcessorMap, + directedS) { } + + // Remove in-edges that have migrated <does nothing> + template<typename VertexProcessorMap> + void + remove_migrated_in_edges(vertex_descriptor, + VertexProcessorMap, + undirectedS) { } + + // Remove in-edges that have migrated + template<typename VertexProcessorMap> + void + remove_migrated_in_edges(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS); + + // Initialize the graph with the given edge list and vertex + // distribution. This variation works only when + // VertexListS=vecS, and we know how to create remote vertex + // descriptors based solely on the distribution. + template<typename EdgeIterator> + void + initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type, const base_distribution_type& distribution, + vecS); + + // Initialize the graph with the given edge list, edge + // properties, and vertex distribution. This variation works + // only when VertexListS=vecS, and we know how to create remote + // vertex descriptors based solely on the distribution. + template<typename EdgeIterator, typename EdgePropertyIterator> + void + initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type, const base_distribution_type& distribution, + vecS); + + // Initialize the graph with the given edge list, edge + // properties, and vertex distribution. + template<typename EdgeIterator, typename EdgePropertyIterator, + typename VertexListS> + void + initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, + const base_distribution_type& distribution, + VertexListS); + + // Initialize the graph with the given edge list and vertex + // distribution. This is nearly identical to the one below it, + // for which I should be flogged. However, this version does use + // slightly less memory than the version that accepts an edge + // property iterator. + template<typename EdgeIterator, typename VertexListS> + void + initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type n, + const base_distribution_type& distribution, + VertexListS); + + public: + //--------------------------------------------------------------------- + // Build a vertex property instance for the underlying adjacency + // list from the given property instance of the type exposed to + // the user. + base_vertex_property_type + build_vertex_property(const vertex_property_type& p) + { return build_vertex_property(p, directed_selector()); } + + base_vertex_property_type + build_vertex_property(const vertex_property_type& p, directedS) + { + return base_vertex_property_type(p); + } + + base_vertex_property_type + build_vertex_property(const vertex_property_type& p, bidirectionalS) + { + return base_vertex_property_type(in_edge_list_type(), p); + } + + base_vertex_property_type + build_vertex_property(const vertex_property_type& p, undirectedS) + { + return base_vertex_property_type(p); + } + //--------------------------------------------------------------------- + + //--------------------------------------------------------------------- + // Build an edge property instance for the underlying adjacency + // list from the given property instance of the type exposed to + // the user. + base_edge_property_type build_edge_property(const edge_property_type& p) + { return build_edge_property(p, directed_selector()); } + + base_edge_property_type + build_edge_property(const edge_property_type& p, directedS) + { + return base_edge_property_type(0, p); + } + + base_edge_property_type + build_edge_property(const edge_property_type& p, bidirectionalS) + { + return base_edge_property_type(0, p); + } + + base_edge_property_type + build_edge_property(const edge_property_type& p, undirectedS) + { + typedef typename base_edge_property_type::next_type + edge_property_with_id; + return base_edge_property_type(true, edge_property_with_id(0, p)); + } + //--------------------------------------------------------------------- + + /** The set of messages that can be transmitted and received by + * a distributed adjacency list. This list will eventually be + * exhaustive, but is currently quite limited. + */ + enum { + /** + * Request to add or find a vertex with the given vertex + * property. The data will be a vertex_property_type + * structure. + */ + msg_add_vertex_with_property = 0, + + /** + * Request to add or find a vertex with the given vertex + * property, and request that the remote processor return the + * descriptor for the added/found edge. The data will be a + * vertex_property_type structure. + */ + msg_add_vertex_with_property_and_reply, + + /** + * Reply to a msg_add_vertex_* message, containing the local + * vertex descriptor that was added or found. + */ + msg_add_vertex_reply, + + /** + * Request to add an edge remotely. The data will be a + * msg_add_edge_data structure. + */ + msg_add_edge, + + /** + * Request to add an edge remotely. The data will be a + * msg_add_edge_with_property_data structure. + */ + msg_add_edge_with_property, + + /** + * Request to add an edge remotely and reply back with the + * edge descriptor. The data will be a + * msg_add_edge_data structure. + */ + msg_add_edge_with_reply, + + /** + * Request to add an edge remotely and reply back with the + * edge descriptor. The data will be a + * msg_add_edge_with_property_data structure. + */ + msg_add_edge_with_property_and_reply, + + /** + * Reply message responding to an @c msg_add_edge_with_reply + * or @c msg_add_edge_with_property_and_reply messages. The + * data will be a std::pair<edge_descriptor, bool>. + */ + msg_add_edge_reply, + + /** + * Indicates that a nonlocal edge has been created that should + * be added locally. Only valid for bidirectional and + * undirected graphs. The message carries a + * msg_nonlocal_edge_data structure. + */ + msg_nonlocal_edge, + + /** + * Indicates that a remote edge should be removed. This + * message does not exist for directedS graphs but may refer + * to either in-edges or out-edges for undirectedS graphs. + */ + msg_remove_edge, + + /** + * Indicates the number of vertices and edges that will be + * relocated from the source processor to the target + * processor. The data will be a pair<vertices_size_type, + * edges_size_type>. + */ + msg_num_relocated + }; + + typedef detail::parallel::msg_add_edge_data<vertex_descriptor, + local_vertex_descriptor> + msg_add_edge_data; + + typedef detail::parallel::msg_add_edge_with_property_data + <vertex_descriptor, local_vertex_descriptor, + edge_property_type> msg_add_edge_with_property_data; + + typedef boost::detail::parallel::msg_nonlocal_edge_data< + edge_property_type,local_edge_descriptor> msg_nonlocal_edge_data; + + typedef boost::detail::parallel::msg_remove_edge_data<edge_descriptor> + msg_remove_edge_data; + + void send_remove_edge_request(edge_descriptor e) + { + process_id_type dest = e.target_processor; + if (e.target_processor == process_id(process_group_)) + dest = e.source_processor; + send(process_group_, dest, msg_remove_edge, msg_remove_edge_data(e)); + } + + /// Process incoming messages. + void setup_triggers(); + + void + handle_add_vertex_with_property(int source, int tag, + const vertex_property_type&, + trigger_receive_context); + + local_vertex_descriptor + handle_add_vertex_with_property_and_reply(int source, int tag, + const vertex_property_type&, + trigger_receive_context); + + void + handle_add_edge(int source, int tag, const msg_add_edge_data& data, + trigger_receive_context); + + boost::parallel::detail::untracked_pair<edge_descriptor, bool> + handle_add_edge_with_reply(int source, int tag, + const msg_add_edge_data& data, + trigger_receive_context); + + void + handle_add_edge_with_property(int source, int tag, + const msg_add_edge_with_property_data&, + trigger_receive_context); + + boost::parallel::detail::untracked_pair<edge_descriptor, bool> + handle_add_edge_with_property_and_reply + (int source, int tag, const msg_add_edge_with_property_data&, + trigger_receive_context); + + void + handle_nonlocal_edge(int source, int tag, + const msg_nonlocal_edge_data& data, + trigger_receive_context); + + void + handle_remove_edge(int source, int tag, + const msg_remove_edge_data& data, + trigger_receive_context); + + protected: + /** Add an edge (locally) that was received from another + * processor. This operation is a no-op for directed graphs, + * because all edges reside on the local processor. For + * bidirectional graphs, this routine places the edge onto the + * list of incoming edges for the target vertex. For undirected + * graphs, the edge is placed along with all of the other edges + * for the target vertex, but it is marked as a non-local edge + * descriptor. + * + * \todo There is a potential problem here, where we could + * unintentionally allow duplicate edges in undirected graphs + * because the same edge is added on two different processors + * simultaneously. It's not an issue now, because we require + * that the graph allow parallel edges. Once we do support + * containers such as setS or hash_setS that disallow parallel + * edges we will need to deal with this. + */ + void + add_remote_edge(const msg_nonlocal_edge_data&, + processor_id_type, directedS) + { } + + + /** + * \overload + */ + void + add_remote_edge(const msg_nonlocal_edge_data& data, + processor_id_type other_proc, bidirectionalS) + { + typedef detail::parallel::stored_in_edge<local_edge_descriptor> stored_edge; + + stored_edge edge(other_proc, data.e); + local_vertex_descriptor v = target(data.e, base()); + boost::graph_detail::push(get(vertex_in_edges, base())[v], edge); + } + + /** + * \overload + */ + void + add_remote_edge(const msg_nonlocal_edge_data& data, + processor_id_type other_proc, undirectedS) + { + std::pair<local_edge_descriptor, bool> edge = + detail::parallel::add_local_edge(target(data.e, base()), + source(data.e, base()), + build_edge_property(data.get_property()), base()); + assert(edge.second); + put(edge_target_processor_id, base(), edge.first, other_proc); + + if (edge.second && on_add_edge) + on_add_edge(edge_descriptor(processor(), other_proc, false, + edge.first), + *this); + } + + void + remove_local_edge(const msg_remove_edge_data&, processor_id_type, + directedS) + { } + + void + remove_local_edge(const msg_remove_edge_data& data, + processor_id_type other_proc, bidirectionalS) + { + /* When the source is local, we first check if the edge still + * exists (it may have been deleted locally) and, if so, + * remove it locally. + */ + vertex_descriptor src = source(data.e, *this); + vertex_descriptor tgt = target(data.e, *this); + + if (src.owner == process_id(process_group_)) { + base_out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(src.local, base()); + ei != ei_end; ++ei) { + // TBD: can't check the descriptor here, because it could + // have changed if we're allowing the removal of + // edges. Egads! + if (tgt.local == target(*ei, base()) + && get(edge_target_processor_id, base(), *ei) == other_proc) + break; + } + + if (ei != ei_end) boost::remove_edge(ei, base()); + + remove_local_edge_from_list(src, tgt, undirectedS()); + } else { + assert(tgt.owner == process_id(process_group_)); + in_edge_list_type& in_edges = + get(vertex_in_edges, base())[tgt.local]; + typename in_edge_list_type::iterator ei; + for (ei = in_edges.begin(); ei != in_edges.end(); ++ei) { + if (src.local == source(ei->e, base()) + && src.owner == ei->source_processor) + break; + } + + if (ei != in_edges.end()) in_edges.erase(ei); + } + } + + void + remove_local_edge(const msg_remove_edge_data& data, + processor_id_type other_proc, undirectedS) + { + vertex_descriptor local_vertex = source(data.e, *this); + vertex_descriptor remote_vertex = target(data.e, *this); + if (remote_vertex.owner == process_id(process_group_)) { + using std::swap; + swap(local_vertex, remote_vertex); + } + + // Remove the edge from the out-edge list, if it is there + { + base_out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(local_vertex.local, base()); + ei != ei_end; ++ei) { + // TBD: can't check the descriptor here, because it could + // have changed if we're allowing the removal of + // edges. Egads! + if (remote_vertex.local == target(*ei, base()) + && get(edge_target_processor_id, base(), *ei) == other_proc) + break; + } + + if (ei != ei_end) boost::remove_edge(ei, base()); + } + + remove_local_edge_from_list(local_vertex, remote_vertex, undirectedS()); + } + + public: + void + remove_local_edge_from_list(vertex_descriptor, vertex_descriptor, + directedS) + { + } + + void + remove_local_edge_from_list(vertex_descriptor, vertex_descriptor, + bidirectionalS) + { + } + + void + remove_local_edge_from_list(vertex_descriptor src, vertex_descriptor tgt, + undirectedS) + { + // TBD: At some point we'll be able to improve the speed here + // because we'll know when the edge can't be in the local + // list. + { + typename local_edge_list_type::iterator ei; + for (ei = local_edges_.begin(); ei != local_edges_.end(); ++ei) { + if ((source(*ei, *this) == src + && target(*ei, *this) == tgt) + || (source(*ei, *this) == tgt + && target(*ei, *this) == src)) + break; + } + + if (ei != local_edges_.end()) local_edges_.erase(ei); + } + + } + + private: + /// The local subgraph + inherited m_local_graph; + + /// The process group through which this distributed graph + /// communicates. + process_group_type process_group_; + + // TBD: should only be available for undirected graphs, but for + // now it'll just be empty for directed and bidirectional + // graphs. + local_edge_list_type local_edges_; + }; + + //------------------------------------------------------------------------ + // Lazy addition of vertices + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + struct PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property + { + /// Construct a lazy request to add a vertex + lazy_add_vertex_with_property(adjacency_list& self, + const vertex_property_type& property) + : self(self), property(property), committed(false) { } + + /// Copying a lazy_add_vertex_with_property transfers the + /// responsibility for adding the vertex to the newly-constructed + /// object. + lazy_add_vertex_with_property(const lazy_add_vertex_with_property& other) + : self(other.self), property(other.property), + committed(other.committed) + { + other.committed = true; + } + + /// If the vertex has not yet been added, add the vertex but don't + /// wait for a reply. + ~lazy_add_vertex_with_property(); + + /// Returns commit(). + operator vertex_descriptor() const { return commit(); } + + // Add the vertex. This operation will block if the vertex is + // being added remotely. + vertex_descriptor commit() const; + + protected: + adjacency_list& self; + vertex_property_type property; + mutable bool committed; + + private: + // No copy-assignment semantics + void operator=(lazy_add_vertex_with_property&); + }; + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property:: + ~lazy_add_vertex_with_property() + { + /// If this vertex has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the vertex now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + process_id_type owner + = static_cast<graph_type&>(self).owner_by_property(property); + if (owner == self.processor()) { + /// Add the vertex locally. + vertex_descriptor v(owner, + add_vertex(self.build_vertex_property(property), + self.base())); + if (self.on_add_vertex) + self.on_add_vertex(v, self); + } + else + /// Ask the owner of this new vertex to add the vertex. We + /// don't need a reply. + send(self.process_group_, owner, msg_add_vertex_with_property, + property); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property:: + commit() const + { + assert(!this->committed); + this->committed = true; + + process_id_type owner + = static_cast<graph_type&>(self).owner_by_property(property); + local_vertex_descriptor local_v; + if (owner == self.processor()) + /// Add the vertex locally. + local_v = add_vertex(self.build_vertex_property(property), + self.base()); + else { + // Request that the remote process add the vertex immediately + send_oob_with_reply(self.process_group_, owner, + msg_add_vertex_with_property_and_reply, property, + local_v); + } + + vertex_descriptor v(owner, local_v); + if (self.on_add_vertex) + self.on_add_vertex(v, self); + + // Build the full vertex descriptor to return + return v; + } + + + /** + * Data structure returned from add_edge that will "lazily" add + * the edge, either when it is converted to a + * @c pair<edge_descriptor, bool> or when the most recent copy has + * been destroyed. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + struct PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge + { + /// Construct a lazy request to add an edge + lazy_add_edge(adjacency_list& self, + vertex_descriptor source, vertex_descriptor target) + : self(self), source(source), target(target), committed(false) { } + + /// Copying a lazy_add_edge transfers the responsibility for + /// adding the edge to the newly-constructed object. + lazy_add_edge(const lazy_add_edge& other) + : self(other.self), source(other.source), target(other.target), + committed(other.committed) + { + other.committed = true; + } + + /// If the edge has not yet been added, add the edge but don't + /// wait for a reply. + ~lazy_add_edge(); + + /// Returns commit(). + operator std::pair<edge_descriptor, bool>() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair<edge_descriptor, bool> commit() const; + + protected: + std::pair<edge_descriptor, bool> + add_local_edge(const edge_property_type& property, directedS) const; + + std::pair<edge_descriptor, bool> + add_local_edge(const edge_property_type& property, bidirectionalS) const; + + std::pair<edge_descriptor, bool> + add_local_edge(const edge_property_type& property, undirectedS) const; + + adjacency_list& self; + vertex_descriptor source; + vertex_descriptor target; + mutable bool committed; + + private: + // No copy-assignment semantics + void operator=(lazy_add_edge&); + }; + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge::~lazy_add_edge() + { + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + if (source.owner == self.processor()) + this->add_local_edge(edge_property_type(), DirectedS()); + else + // Request that the remote processor add an edge and, but + // don't wait for a reply. + send(self.process_group_, source.owner, msg_add_edge, + msg_add_edge_data(source, target)); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge::commit() const + { + assert(!committed); + committed = true; + + if (source.owner == self.processor()) + return this->add_local_edge(edge_property_type(), DirectedS()); + else { + // Request that the remote processor add an edge + boost::parallel::detail::untracked_pair<edge_descriptor, bool> result; + send_oob_with_reply(self.process_group_, source.owner, + msg_add_edge_with_reply, + msg_add_edge_data(source, target), result); + return result; + } + } + + // Add a local edge into a directed graph + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge:: + add_local_edge(const edge_property_type& property, directedS) const + { + // Add the edge to the local part of the graph + std::pair<local_edge_descriptor, bool> inserted = + detail::parallel::add_local_edge(source.local, target.local, + self.build_edge_property(property), + self.base()); + + if (inserted.second) + // Keep track of the owner of the target + put(edge_target_processor_id, self.base(), inserted.first, + target.owner); + + // Compose the edge descriptor and return the result + edge_descriptor e(source.owner, target.owner, true, inserted.first); + + // Trigger the on_add_edge event + if (inserted.second && self.on_add_edge) + self.on_add_edge(e, self); + + return std::pair<edge_descriptor, bool>(e, inserted.second); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge:: + add_local_edge(const edge_property_type& property, bidirectionalS) const + { + // Add the directed edge. + std::pair<edge_descriptor, bool> result + = this->add_local_edge(property, directedS()); + + if (result.second) { + if (target.owner == self.processor()) { + // Edge is local, so add the stored edge to the in_edges list + typedef detail::parallel::stored_in_edge<local_edge_descriptor> + stored_edge; + + stored_edge e(self.processor(), result.first.local); + boost::graph_detail::push(get(vertex_in_edges, + self.base())[target.local], e); + } + else { + // Edge is remote, so notify the target's owner that an edge + // has been added. + if (self.process_group_.trigger_context() == graph::parallel::trc_out_of_band) + send_oob(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + else + send(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + } + } + + return result; + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge:: + add_local_edge(const edge_property_type& property, undirectedS) const + { + // Add the directed edge + std::pair<edge_descriptor, bool> result + = this->add_local_edge(property, directedS()); + + typedef detail::parallel::stored_in_edge<local_edge_descriptor> + stored_edge; + + if (result.second) { + if (target.owner == self.processor()) { + // Edge is local, so add the new edge to the list + + // TODO: This is not what we want to do for an undirected + // edge, because we haven't linked the source and target's + // representations of those edges. + local_edge_descriptor return_edge = + detail::parallel::add_local_edge(target.local, source.local, + self.build_edge_property(property), + self.base()).first; + + put(edge_target_processor_id, self.base(), return_edge, + source.owner); + } + else { + // Edge is remote, so notify the target's owner that an edge + // has been added. + if (self.process_group_.trigger_context() == graph::parallel::trc_out_of_band) + send_oob(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + else + send(self.process_group_, target.owner, msg_nonlocal_edge, + msg_nonlocal_edge_data(result.first.local, property)); + + } + + // Add this edge to the list of local edges + graph_detail::push(self.local_edges(), result.first); + } + + return result; + } + + + /** + * Data structure returned from add_edge that will "lazily" add + * the edge with its property, either when it is converted to a + * pair<edge_descriptor, bool> or when the most recent copy has + * been destroyed. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + struct PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge_with_property + : lazy_add_edge + { + /// Construct a lazy request to add an edge + lazy_add_edge_with_property(adjacency_list& self, + vertex_descriptor source, + vertex_descriptor target, + const edge_property_type& property) + : lazy_add_edge(self, source, target), property(property) { } + + /// Copying a lazy_add_edge transfers the responsibility for + /// adding the edge to the newly-constructed object. + lazy_add_edge_with_property(const lazy_add_edge& other) + : lazy_add_edge(other), property(other.property) { } + + /// If the edge has not yet been added, add the edge but don't + /// wait for a reply. + ~lazy_add_edge_with_property(); + + /// Returns commit(). + operator std::pair<edge_descriptor, bool>() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair<edge_descriptor, bool> commit() const; + + private: + // No copy-assignment semantics + void operator=(lazy_add_edge_with_property&); + + edge_property_type property; + }; + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge_with_property:: + ~lazy_add_edge_with_property() + { + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (this->committed || std::uncaught_exception()) + return; + + this->committed = true; + + if (this->source.owner == this->self.processor()) + // Add a local edge + this->add_local_edge(property, DirectedS()); + else + // Request that the remote processor add an edge and, but + // don't wait for a reply. + send(this->self.process_group_, this->source.owner, + msg_add_edge_with_property, + msg_add_edge_with_property_data(this->source, this->target, + property)); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> + PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge_with_property:: + commit() const + { + assert(!this->committed); + this->committed = true; + + if (this->source.owner == this->self.processor()) + // Add a local edge + return this->add_local_edge(property, DirectedS()); + else { + // Request that the remote processor add an edge + boost::parallel::detail::untracked_pair<edge_descriptor, bool> result; + send_oob_with_reply(this->self.process_group_, this->source.owner, + msg_add_edge_with_property_and_reply, + msg_add_edge_with_property_data(this->source, + this->target, + property), + result); + return result; + } + } + + + /** + * Returns the set of vertices local to this processor. Note that + * although this routine matches a valid expression of a + * VertexListGraph, it does not meet the semantic requirements of + * VertexListGraph because it returns only local vertices (not all + * vertices). + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_iterator> + vertices(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor Vertex; + + typedef typename Vertex::generator generator; + + return std::make_pair(make_transform_iterator(vertices(g.base()).first, + generator(g.processor())), + make_transform_iterator(vertices(g.base()).second, + generator(g.processor()))); + } + + /** + * Returns the number of vertices local to this processor. Note that + * although this routine matches a valid expression of a + * VertexListGraph, it does not meet the semantic requirements of + * VertexListGraph because it returns only a count of local vertices + * (not all vertices). + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertices_size_type + num_vertices(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return num_vertices(g.base()); + } + + /*************************************************************************** + * Implementation of Incidence Graph concept + ***************************************************************************/ + /** + * Returns the source of edge @param e in @param g. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename Edge> + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + source(const detail::parallel::edge_descriptor<Edge>& e, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor Vertex; + return Vertex(e.source_processor, source(e.local, g.base())); + } + + /** + * Returns the target of edge @param e in @param g. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename Edge> + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + target(const detail::parallel::edge_descriptor<Edge>& e, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor Vertex; + return Vertex(e.target_processor, target(e.local, g.base())); + } + + /** + * Return the set of edges outgoing from a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::out_edge_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE::out_edge_iterator> + out_edges(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + assert(v.owner == g.processor()); + + typedef PBGL_DISTRIB_ADJLIST_TYPE impl; + typedef typename impl::out_edge_generator generator; + + return std::make_pair( + make_transform_iterator(out_edges(v.local, g.base()).first, + generator(g)), + make_transform_iterator(out_edges(v.local, g.base()).second, + generator(g))); + } + + /** + * Return the number of edges outgoing from a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE::degree_size_type + out_degree(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + assert(v.owner == g.processor()); + + return out_degree(v.local, g.base()); + } + + /*************************************************************************** + * Implementation of Bidirectional Graph concept + ***************************************************************************/ + /** + * Returns the set of edges incoming to a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::in_edge_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::in_edge_iterator> + in_edges(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + assert(v.owner == g.processor()); + + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) impl; + typedef typename impl::inherited base_graph_type; + typedef typename impl::in_edge_generator generator; + + + typename property_map<base_graph_type, vertex_in_edges_t>::const_type + in_edges = get(vertex_in_edges, g.base()); + + return std::make_pair(make_transform_iterator(in_edges[v.local].begin(), + generator(g)), + make_transform_iterator(in_edges[v.local].end(), + generator(g))); + } + + /** + * \overload + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::in_edge_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::in_edge_iterator> + in_edges(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + assert(v.owner == g.processor()); + + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) impl; + typedef typename impl::in_edge_generator generator; + + return std::make_pair( + make_transform_iterator(out_edges(v.local, g.base()).first, + generator(g)), + make_transform_iterator(out_edges(v.local, g.base()).second, + generator(g))); + } + + /** + * Returns the number of edges incoming to a particular vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)::degree_size_type + in_degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + assert(v.owner == g.processor()); + + return get(vertex_in_edges, g.base())[v.local].size(); + } + + /** + * \overload + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::degree_size_type + in_degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + assert(v.owner == g.processor()); + + return out_degree(v.local, g.base()); + } + + /** + * Returns the number of edges incident on the given vertex. The + * vertex @param v must be local to the processor executing this + * routine. + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::degree_size_type + degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + assert(v.owner == g.processor()); + return out_degree(v.local, g.base()); + } + + /** + * \overload + */ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::degree_size_type + degree(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + assert(v.owner == g.processor()); + return out_degree(v, g) + in_degree(v, g); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE::edges_size_type + num_edges(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return num_edges(g.base()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::edges_size_type + num_edges(const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + return g.local_edges().size(); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_iterator> + edges(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE impl; + typedef typename impl::out_edge_generator generator; + + return std::make_pair(make_transform_iterator(edges(g.base()).first, + generator(g)), + make_transform_iterator(edges(g.base()).second, + generator(g))); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::edge_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)::edge_iterator> + edges(const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + return std::make_pair(g.local_edges().begin(), g.local_edges().end()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + inline + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + vertex(typename PBGL_DISTRIB_ADJLIST_TYPE::vertices_size_type n, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + vertex_descriptor; + + return vertex_descriptor(g.distribution()(n), g.distribution().local(n)); + } + + /*************************************************************************** + * Access to particular edges + ***************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::edge_descriptor, + bool + > + edge(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) + ::edge_descriptor edge_descriptor; + + // For directed graphs, u must be local + assert(u.owner == process_id(g.process_group())); + + typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) + ::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + if (target(*ei, g) == v) return std::make_pair(*ei, true); + } + return std::make_pair(edge_descriptor(), false); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair< + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, + bool + > + edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::edge_descriptor edge_descriptor; + + // For bidirectional and undirected graphs, u must be local or v + // must be local + if (u.owner == process_id(g.process_group())) { + typename PBGL_DISTRIB_ADJLIST_TYPE::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(u, g); ei != ei_end; ++ei) { + if (target(*ei, g) == v) return std::make_pair(*ei, true); + } + return std::make_pair(edge_descriptor(), false); + } else if (v.owner == process_id(g.process_group())) { + typename PBGL_DISTRIB_ADJLIST_TYPE::in_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = in_edges(v, g); ei != ei_end; ++ei) { + if (source(*ei, g) == u) return std::make_pair(*ei, true); + } + return std::make_pair(edge_descriptor(), false); + } else { + assert(false); + exit(1); + } + } + +#if 0 + // TBD: not yet supported + std::pair<out_edge_iterator, out_edge_iterator> + edge_range(vertex_descriptor u, vertex_descriptor v, + const adjacency_list& g); +#endif + + /*************************************************************************** + * Implementation of Adjacency Graph concept + ***************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::adjacency_iterator, + typename PBGL_DISTRIB_ADJLIST_TYPE::adjacency_iterator> + adjacent_vertices(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::adjacency_iterator iter; + return std::make_pair(iter(out_edges(v, g).first, &g), + iter(out_edges(v, g).second, &g)); + } + + /*************************************************************************** + * Implementation of Mutable Graph concept + ***************************************************************************/ + + /************************************************************************ + * add_edge + ************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge + add_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_edge lazy_add_edge; + + return lazy_add_edge(g, u, v); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE + ::lazy_add_edge_with_property + add_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + typename PBGL_DISTRIB_ADJLIST_TYPE::edge_property_type const& p, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::lazy_add_edge_with_property lazy_add_edge_with_property; + return lazy_add_edge_with_property(g, u, v, p); + } + + /************************************************************************ + * + * remove_edge + * + ************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor e, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + assert(source(e, g).owner == g.processor() + || target(e, g).owner == g.processor()); + + if (target(e, g).owner == g.processor()) + detail::parallel::remove_in_edge(e, g, DirectedS()); + if (source(e, g).owner == g.processor()) + remove_edge(e.local, g.base()); + + g.remove_local_edge_from_list(source(e, g), target(e, g), DirectedS()); + + if (source(e, g).owner != g.processor() + || (target(e, g).owner != g.processor() + && !(is_same<DirectedS, directedS>::value))) { + g.send_remove_edge_request(e); + } + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::vertex_descriptor vertex_descriptor; + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::edge_descriptor edge_descriptor; + std::pair<edge_descriptor, bool> the_edge = edge(u, v, g); + if (the_edge.second) remove_edge(the_edge.first, g); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + inline void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE::out_edge_iterator ei, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + remove_edge(*ei, g); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + inline void + remove_edge(typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) + ::out_edge_iterator ei, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + assert(source(*ei, g).owner == g.processor()); + remove_edge(ei->local, g.base()); + } + + /************************************************************************ + * + * remove_out_edge_if + * + ************************************************************************/ + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if an out-edge should be removed. If so, either + * removes the incoming edge (if it is stored locally) or sends a + * message to the owner of the target requesting that it remove + * the edge. + */ + template<typename Graph, typename Predicate> + struct remove_out_edge_predicate + { + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename Graph::local_edge_descriptor argument_type; + typedef typename Graph::directed_selector directed_selector; + typedef bool result_type; + + remove_out_edge_predicate(Graph& g, Predicate& predicate) + : g(g), predicate(predicate) { } + + bool operator()(const argument_type& le) + { + typedef typename edge_descriptor::template out_generator<Graph> + generator; + + edge_descriptor e = generator(g)(le); + + if (predicate(e)) { + if (source(e, g).owner != target(e, g).owner + && !(is_same<directed_selector, directedS>::value)) + g.send_remove_edge_request(e); + else + ::boost::detail::parallel::remove_in_edge(e, g, + directed_selector()); + + g.remove_local_edge_from_list(source(e, g), target(e, g), + directed_selector()); + return true; + } else return false; + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename Predicate> + inline void + remove_out_edge_if + (typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef parallel::detail::remove_out_edge_predicate<Graph, Predicate> + Pred; + + assert(u.owner == g.processor()); + remove_out_edge_if(u.local, Pred(g, predicate), g.base()); + } + + /************************************************************************ + * + * remove_in_edge_if + * + ************************************************************************/ + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if an in-edge should be removed. If so, either + * removes the outgoing edge (if it is stored locally) or sends a + * message to the owner of the target requesting that it remove + * the edge. Only required for bidirectional graphs. + */ + template<typename Graph, typename Predicate> + struct remove_in_edge_predicate + { + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef bool result_type; + + remove_in_edge_predicate(Graph& g, const Predicate& predicate) + : g(g), predicate(predicate) { } + + template<typename StoredEdge> + bool operator()(const StoredEdge& le) + { + typedef typename edge_descriptor::template in_generator<Graph> + generator; + + edge_descriptor e = generator(g)(le); + + if (predicate(e)) { + if (source(e, g).owner != target(e, g).owner) + g.send_remove_edge_request(e); + else + remove_edge(source(e, g).local, target(e, g).local, g.base()); + return true; + } else return false; + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG, typename Predicate> + inline void + remove_in_edge_if + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) Graph; + typedef parallel::detail::remove_in_edge_predicate<Graph, Predicate> + Pred; + + assert(u.owner == g.processor()); + graph_detail::erase_if(get(vertex_in_edges, g.base())[u.local], + Pred(g, predicate)); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG, typename Predicate> + inline void + remove_in_edge_if + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor u, + Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + remove_out_edge_if(u, predicate, g); + } + + /************************************************************************ + * + * remove_edge_if + * + ************************************************************************/ + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if a directed edge can be removed. This only applies + * to directed graphs. + */ + template<typename Graph, typename Predicate> + struct remove_directed_edge_predicate + { + typedef typename Graph::local_edge_descriptor argument_type; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef bool result_type; + + remove_directed_edge_predicate(Graph& g, const Predicate& predicate) + : g(g), predicate(predicate) { } + + bool operator()(const argument_type& le) + { + typedef typename edge_descriptor::template out_generator<Graph> + generator; + + edge_descriptor e = generator(g)(le); + return predicate(e); + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG, typename Predicate> + inline void + remove_edge_if(Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS) Graph; + typedef parallel::detail::remove_directed_edge_predicate<Graph, + Predicate> Pred; + remove_edge_if(Pred(g, predicate), g.base()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG, typename Predicate> + inline void + remove_edge_if(Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) Graph; + typedef parallel::detail::remove_out_edge_predicate<Graph, + Predicate> Pred; + remove_edge_if(Pred(g, predicate), g.base()); + } + + namespace parallel { namespace detail { + /** + * Function object that applies the underlying predicate to + * determine if an undirected edge should be removed. If so, + * removes the local edges associated with the edge and + * (potentially) sends a message to the remote processor that also + * is removing this edge. + */ + template<typename Graph, typename Predicate> + struct remove_undirected_edge_predicate + { + typedef typename graph_traits<Graph>::edge_descriptor argument_type; + typedef bool result_type; + + remove_undirected_edge_predicate(Graph& g, Predicate& predicate) + : g(g), predicate(predicate) { } + + bool operator()(const argument_type& e) + { + if (predicate(e)) { + if (source(e, g).owner != target(e, g).owner) + g.send_remove_edge_request(e); + if (target(e, g).owner == g.processor()) + ::boost::detail::parallel::remove_in_edge(e, g, undirectedS()); + if (source(e, g).owner == g.processor()) + remove_edge(e.local, g.base()); + return true; + } else return false; + } + + private: + Graph& g; + Predicate predicate; + }; + } } // end namespace parallel::detail + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG, typename Predicate> + inline void + remove_edge_if(Predicate predicate, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) Graph; + typedef parallel::detail::remove_undirected_edge_predicate<Graph, + Predicate> Pred; + graph_detail::erase_if(g.local_edges(), Pred(g, predicate)); + } + + /************************************************************************ + * + * clear_vertex + * + ************************************************************************/ + namespace parallel { namespace detail { + struct always_true + { + typedef bool result_type; + + template<typename T> bool operator()(const T&) const { return true; } + }; + } } // end namespace parallel::detail + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + void + clear_vertex + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + clear_out_edges(u, g); + clear_in_edges(u, g); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + void + clear_vertex + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(undirectedS)& g) + { + remove_out_edge_if(u, parallel::detail::always_true(), g); + } + + /************************************************************************ + * + * clear_out_edges + * + ************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + void + clear_out_edges + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(directedS)& g) + { + assert(u.owner == g.processor()); + clear_out_edges(u.local, g.base()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + void + clear_out_edges + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + remove_out_edge_if(u, parallel::detail::always_true(), g); + } + + /************************************************************************ + * + * clear_in_edges + * + ************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS_CONFIG> + void + clear_in_edges + (typename PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS) + ::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE_CONFIG(bidirectionalS)& g) + { + remove_in_edge_if(u, parallel::detail::always_true(), g); + } + + /************************************************************************ + * + * add_vertex + * + ************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor + add_vertex(PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + typename graph_type::vertex_property_type p; + return add_vertex(p, g); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename PBGL_DISTRIB_ADJLIST_TYPE::lazy_add_vertex_with_property + add_vertex(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_property_type const& p, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE + ::lazy_add_vertex_with_property lazy_add_vertex; + return lazy_add_vertex(g, p); + } + + /************************************************************************ + * + * remove_vertex + * + ************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + void + remove_vertex(typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor u, + PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename PBGL_DISTRIB_ADJLIST_TYPE::graph_type graph_type; + typedef typename graph_type::named_graph_mixin named_graph_mixin; + assert(u.owner == g.processor()); + static_cast<named_graph_mixin&>(static_cast<graph_type&>(g)) + .removing_vertex(u); + g.distribution().clear(); + remove_vertex(u.local, g.base()); + } + + /*************************************************************************** + * Implementation of Property Graph concept + ***************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename Property> + struct property_map<PBGL_DISTRIB_ADJLIST_TYPE, Property> + : detail::parallel::get_adj_list_pmap<Property> + ::template apply<PBGL_DISTRIB_ADJLIST_TYPE> + { }; + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename Property> + struct property_map<PBGL_DISTRIB_ADJLIST_TYPE const, Property> + : boost::detail::parallel::get_adj_list_pmap<Property> +// FIXME: in the original code the following was not const + ::template apply<PBGL_DISTRIB_ADJLIST_TYPE const> + { }; + + template<typename Property, PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, Property>::type + get(Property p, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map<Graph, Property>::type result_type; + typedef typename property_traits<result_type>::value_type value_type; + typedef typename property_reduce<Property>::template apply<value_type> + reduce; + + typedef typename property_traits<result_type>::key_type descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_<is_same<descriptor, vertex_descriptor>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + template<typename Property, PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, Property>::const_type + get(Property p, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map<Graph, Property>::const_type result_type; + typedef typename property_traits<result_type>::value_type value_type; + typedef typename property_reduce<Property>::template apply<value_type> + reduce; + + typedef typename property_traits<result_type>::key_type descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_<is_same<descriptor, vertex_descriptor>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_local_index_t>::type + get(vertex_local_index_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return get(vertex_local_index, g.base()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, + vertex_local_index_t>::const_type + get(vertex_local_index_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + return get(vertex_local_index, g.base()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_global_t>::const_type + get(vertex_global_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_global_t>::const_type result_type; + return result_type(); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_global_t>::const_type + get(vertex_global_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_global_t>::const_type result_type; + return result_type(); + } + + /// Retrieve a property map mapping from a vertex descriptor to its + /// owner. + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_owner_t>::type + get(vertex_owner_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_owner_t>::type result_type; + return result_type(); + } + + /// Retrieve a property map mapping from a vertex descriptor to its + /// owner. + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_owner_t>::const_type + get(vertex_owner_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_owner_t>::const_type result_type; + return result_type(); + } + + /// Retrieve the owner of a vertex + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + inline processor_id_type + get(vertex_owner_t, PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.owner; + } + + /// Retrieve the owner of a vertex + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + inline processor_id_type + get(vertex_owner_t, const PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.owner; + } + + /// Retrieve a property map that maps from a vertex descriptor to + /// its local descriptor. + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_local_t>::type + get(vertex_local_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_local_t>::type result_type; + return result_type(); + } + + /// Retrieve a property map that maps from a vertex descriptor to + /// its local descriptor. + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_local_t>::const_type + get(vertex_local_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + vertex_local_t>::const_type result_type; + return result_type(); + } + + /// Retrieve the local descriptor of a vertex + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + inline typename PBGL_DISTRIB_ADJLIST_TYPE::local_vertex_descriptor + get(vertex_local_t, PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.local; + } + + /// Retrieve the local descriptor of a vertex + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + inline typename PBGL_DISTRIB_ADJLIST_TYPE::local_vertex_descriptor + get(vertex_local_t, const PBGL_DISTRIB_ADJLIST_TYPE&, + typename PBGL_DISTRIB_ADJLIST_TYPE::vertex_descriptor v) + { + return v.local; + } + + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, edge_global_t>::const_type + get(edge_global_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_global_t>::const_type result_type; + return result_type(); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, edge_global_t>::const_type + get(edge_global_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_global_t>::const_type result_type; + return result_type(); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, edge_owner_t>::type + get(edge_owner_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_owner_t>::type result_type; + return result_type(); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, edge_owner_t>::const_type + get(edge_owner_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_owner_t>::const_type result_type; + return result_type(); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, edge_local_t>::type + get(edge_local_t, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_local_t>::type result_type; + return result_type(); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, edge_local_t>::const_type + get(edge_local_t, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, + edge_local_t>::const_type result_type; + return result_type(); + } + + template<typename Property, PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, + typename Key> + inline + typename property_traits<typename property_map< + PBGL_DISTRIB_ADJLIST_TYPE, Property>::const_type + >::value_type + get(Property p, const PBGL_DISTRIB_ADJLIST_TYPE& g, const Key& key) + { + if (owner(key) == process_id(g.process_group())) + return get(p, g.base(), local(key)); + else + assert(false); + } + + template<typename Property, PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, + typename Key, typename Value> + void + put(Property p, PBGL_DISTRIB_ADJLIST_TYPE& g, const Key& key, const Value& v) + { + if (owner(key) == process_id(g.process_group())) + put(p, g.base(), local(key), v); + else + assert(false); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_index_t>::type + get(vertex_index_t vi, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + typedef typename property_map<graph_type, vertex_index_t>::type + result_type; + return result_type(g.process_group(), get(vertex_global, g), + get(vi, g.base())); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, vertex_index_t>::const_type + get(vertex_index_t vi, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + typedef typename property_map<graph_type, vertex_index_t>::const_type + result_type; + return result_type(g.process_group(), get(vertex_global, g), + get(vi, g.base())); + } + + /*************************************************************************** + * Implementation of bundled properties + ***************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename T, typename Bundle> + struct property_map<PBGL_DISTRIB_ADJLIST_TYPE, T Bundle::*> + : detail::parallel::get_adj_list_pmap<T Bundle::*> + ::template apply<PBGL_DISTRIB_ADJLIST_TYPE> + { }; + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename T, typename Bundle> + struct property_map<PBGL_DISTRIB_ADJLIST_TYPE const, T Bundle::*> + : detail::parallel::get_adj_list_pmap<T Bundle::*> + ::template apply<PBGL_DISTRIB_ADJLIST_TYPE const> + { }; + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename T, typename Bundle> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, T Bundle::*>::type + get(T Bundle::* p, PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map<Graph, T Bundle::*>::type result_type; + typedef typename property_traits<result_type>::value_type value_type; + typedef typename property_reduce<T Bundle::*>::template apply<value_type> + reduce; + + typedef typename property_traits<result_type>::key_type descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_<is_same<descriptor, vertex_descriptor>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS, typename T, typename Bundle> + typename property_map<PBGL_DISTRIB_ADJLIST_TYPE, T Bundle::*>::const_type + get(T Bundle::* p, const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE Graph; + typedef typename property_map<Graph, T Bundle::*>::const_type result_type; + typedef typename property_traits<result_type>::value_type value_type; + typedef typename property_reduce<T Bundle::*>::template apply<value_type> + reduce; + + typedef typename property_traits<result_type>::key_type descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_<is_same<descriptor, vertex_descriptor>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + get(p, g.base()), reduce()); + } + + /*************************************************************************** + * Implementation of DistributedGraph concept + ***************************************************************************/ + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + void synchronize(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { + typedef PBGL_DISTRIB_ADJLIST_TYPE graph_type; + synchronize(g.process_group()); + } + + template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> + ProcessGroup + process_group(const PBGL_DISTRIB_ADJLIST_TYPE& g) + { return g.process_group(); } + + /*************************************************************************** + * Specializations of is_mpi_datatype for Serializable entities + ***************************************************************************/ + namespace mpi { + template<typename Directed, typename Vertex> + struct is_mpi_datatype<boost::detail::edge_base<Directed, Vertex> > + : is_mpi_datatype<Vertex> { }; + + template<typename Directed, typename Vertex> + struct is_mpi_datatype<boost::detail::edge_desc_impl<Directed, Vertex> > + : is_mpi_datatype<boost::detail::edge_base<Directed, Vertex> > { }; + + template<typename LocalDescriptor> + struct is_mpi_datatype<boost::detail::parallel::global_descriptor<LocalDescriptor> > + : is_mpi_datatype<LocalDescriptor> { }; + + template<typename Edge> + struct is_mpi_datatype<boost::detail::parallel::edge_descriptor<Edge> > + : is_mpi_datatype<Edge> { }; + + template<typename Vertex, typename LocalVertex> + struct is_mpi_datatype<boost::detail::parallel:: + msg_add_edge_data<Vertex, LocalVertex> > + : is_mpi_datatype<Vertex> { }; + + template<typename Vertex, typename LocalVertex, typename EdgeProperty> + struct is_mpi_datatype<boost::detail::parallel:: + msg_add_edge_with_property_data<Vertex, + LocalVertex, + EdgeProperty> > + : mpl::and_<is_mpi_datatype<Vertex>, is_mpi_datatype<EdgeProperty> > { }; + + + template<typename EdgeProperty, typename EdgeDescriptor> + struct is_mpi_datatype<boost::detail::parallel::msg_nonlocal_edge_data< + EdgeProperty,EdgeDescriptor> > + : mpl::and_< + is_mpi_datatype<boost::detail::parallel::maybe_store_property< + EdgeProperty> >, + is_mpi_datatype<EdgeDescriptor> > + {}; + + template<typename EdgeDescriptor> + struct is_mpi_datatype< + boost::detail::parallel::msg_remove_edge_data<EdgeDescriptor> > + : is_mpi_datatype<EdgeDescriptor> {}; + } + + /*************************************************************************** + * Specializations of is_bitwise_serializable for Serializable entities + ***************************************************************************/ + namespace serialization { + template<typename Directed, typename Vertex> + struct is_bitwise_serializable<boost::detail::edge_base<Directed, Vertex> > + : is_bitwise_serializable<Vertex> { }; + + template<typename Directed, typename Vertex> + struct is_bitwise_serializable<boost::detail::edge_desc_impl<Directed, Vertex> > + : is_bitwise_serializable<boost::detail::edge_base<Directed, Vertex> > { }; + + template<typename LocalDescriptor> + struct is_bitwise_serializable<boost::detail::parallel::global_descriptor<LocalDescriptor> > + : is_bitwise_serializable<LocalDescriptor> { }; + + template<typename Edge> + struct is_bitwise_serializable<boost::detail::parallel::edge_descriptor<Edge> > + : is_bitwise_serializable<Edge> { }; + + template<typename Vertex, typename LocalVertex> + struct is_bitwise_serializable<boost::detail::parallel:: + msg_add_edge_data<Vertex, LocalVertex> > + : is_bitwise_serializable<Vertex> { }; + + template<typename Vertex, typename LocalVertex, typename EdgeProperty> + struct is_bitwise_serializable<boost::detail::parallel:: + msg_add_edge_with_property_data<Vertex, + LocalVertex, + EdgeProperty> > + : mpl::and_<is_bitwise_serializable<Vertex>, + is_bitwise_serializable<EdgeProperty> > { }; + + template<typename EdgeProperty, typename EdgeDescriptor> + struct is_bitwise_serializable<boost::detail::parallel::msg_nonlocal_edge_data< + EdgeProperty,EdgeDescriptor> > + : mpl::and_< + is_bitwise_serializable< + boost::detail::parallel::maybe_store_property<EdgeProperty> >, + is_bitwise_serializable<EdgeDescriptor> > + {}; + + template<typename EdgeDescriptor> + struct is_bitwise_serializable< + boost::detail::parallel::msg_remove_edge_data<EdgeDescriptor> > + : is_bitwise_serializable<EdgeDescriptor> {}; + + template<typename Directed, typename Vertex> + struct implementation_level<boost::detail::edge_base<Directed, Vertex> > + : mpl::int_<object_serializable> {}; + + template<typename Directed, typename Vertex> + struct implementation_level<boost::detail::edge_desc_impl<Directed, Vertex> > + : mpl::int_<object_serializable> {}; + + template<typename LocalDescriptor> + struct implementation_level<boost::detail::parallel::global_descriptor<LocalDescriptor> > + : mpl::int_<object_serializable> {}; + + template<typename Edge> + struct implementation_level<boost::detail::parallel::edge_descriptor<Edge> > + : mpl::int_<object_serializable> {}; + + template<typename Vertex, typename LocalVertex> + struct implementation_level<boost::detail::parallel:: + msg_add_edge_data<Vertex, LocalVertex> > + : mpl::int_<object_serializable> {}; + + template<typename Vertex, typename LocalVertex, typename EdgeProperty> + struct implementation_level<boost::detail::parallel:: + msg_add_edge_with_property_data<Vertex, + LocalVertex, + EdgeProperty> > + : mpl::int_<object_serializable> {}; + + template<typename EdgeProperty, typename EdgeDescriptor> + struct implementation_level<boost::detail::parallel::msg_nonlocal_edge_data< + EdgeProperty,EdgeDescriptor> > + : mpl::int_<object_serializable> {}; + + template<typename EdgeDescriptor> + struct implementation_level< + boost::detail::parallel::msg_remove_edge_data<EdgeDescriptor> > + : mpl::int_<object_serializable> {}; + + template<typename Directed, typename Vertex> + struct tracking_level<boost::detail::edge_base<Directed, Vertex> > + : mpl::int_<track_never> {}; + + template<typename Directed, typename Vertex> + struct tracking_level<boost::detail::edge_desc_impl<Directed, Vertex> > + : mpl::int_<track_never> {}; + + template<typename LocalDescriptor> + struct tracking_level<boost::detail::parallel::global_descriptor<LocalDescriptor> > + : mpl::int_<track_never> {}; + + template<typename Edge> + struct tracking_level<boost::detail::parallel::edge_descriptor<Edge> > + : mpl::int_<track_never> {}; + + template<typename Vertex, typename LocalVertex> + struct tracking_level<boost::detail::parallel:: + msg_add_edge_data<Vertex, LocalVertex> > + : mpl::int_<track_never> {}; + + template<typename Vertex, typename LocalVertex, typename EdgeProperty> + struct tracking_level<boost::detail::parallel:: + msg_add_edge_with_property_data<Vertex, + LocalVertex, + EdgeProperty> > + : mpl::int_<track_never> {}; + + template<typename EdgeProperty, typename EdgeDescriptor> + struct tracking_level<boost::detail::parallel::msg_nonlocal_edge_data< + EdgeProperty,EdgeDescriptor> > + : mpl::int_<track_never> {}; + + template<typename EdgeDescriptor> + struct tracking_level< + boost::detail::parallel::msg_remove_edge_data<EdgeDescriptor> > + : mpl::int_<track_never> {}; + } + + // Hash function for global descriptors + template<typename LocalDescriptor> + struct hash<detail::parallel::global_descriptor<LocalDescriptor> > + { + typedef detail::parallel::global_descriptor<LocalDescriptor> argument_type; + std::size_t operator()(argument_type const& x) const + { + std::size_t hash = hash_value(x.owner); + hash_combine(hash, x.local); + return hash; + } + }; + + // Hash function for parallel edge descriptors + template<typename Edge> + struct hash<detail::parallel::edge_descriptor<Edge> > + { + typedef detail::parallel::edge_descriptor<Edge> argument_type; + + std::size_t operator()(argument_type const& x) const + { + std::size_t hash = hash_value(x.owner()); + hash_combine(hash, x.local); + return hash; + } + }; + +} // end namespace boost + +#include <boost/graph/distributed/adjlist/handlers.hpp> +#include <boost/graph/distributed/adjlist/initialize.hpp> +#include <boost/graph/distributed/adjlist/redistribute.hpp> +#include <boost/graph/distributed/adjlist/serialization.hpp> + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJACENCY_LIST_HPP diff --git a/Utilities/BGL/boost/graph/distributed/adjlist/handlers.hpp b/Utilities/BGL/boost/graph/distributed/adjlist/handlers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7c1e431e433e7dc0f55e153292a82d36ef4cebb1 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/adjlist/handlers.hpp @@ -0,0 +1,148 @@ +// Copyright (C) 2007 Douglas Gregor + +// 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) + +// This file contains code for the distributed adjacency list's +// message handlers. It should not be included directly by users. + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/parallel/simple_trigger.hpp> +#include <boost/graph/parallel/detail/untracked_pair.hpp> + +namespace boost { + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(process_group_, msg_add_vertex_with_property, this, + &adjacency_list::handle_add_vertex_with_property); + simple_trigger(process_group_, msg_add_vertex_with_property_and_reply, this, + &adjacency_list::handle_add_vertex_with_property_and_reply); + simple_trigger(process_group_, msg_add_edge, this, + &adjacency_list::handle_add_edge); + simple_trigger(process_group_, msg_add_edge_with_reply, this, + &adjacency_list::handle_add_edge_with_reply); + simple_trigger(process_group_, msg_add_edge_with_property, this, + &adjacency_list::handle_add_edge_with_property); + simple_trigger(process_group_, msg_add_edge_with_property_and_reply, this, + &adjacency_list::handle_add_edge_with_property_and_reply); + simple_trigger(process_group_, msg_nonlocal_edge, this, + &adjacency_list::handle_nonlocal_edge); + simple_trigger(process_group_, msg_remove_edge, this, + &adjacency_list::handle_remove_edge); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_vertex_with_property(int source, int tag, + const vertex_property_type& data, + trigger_receive_context) +{ + vertex_descriptor v(this->processor(), + add_vertex(this->build_vertex_property(data), + this->base())); + if (on_add_vertex) + on_add_vertex(v, *this); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +typename PBGL_DISTRIB_ADJLIST_TYPE::local_vertex_descriptor +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_vertex_with_property_and_reply(int source, int tag, + const vertex_property_type& data, + trigger_receive_context) +{ + // Try to find a vertex with this name + local_vertex_descriptor local_v + = add_vertex(this->build_vertex_property(data), this->base()); + + vertex_descriptor v(processor(), local_v); + if (on_add_vertex) + on_add_vertex(v, *this); + + return local_v; +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge(int source, int tag, const msg_add_edge_data& data, + trigger_receive_context) +{ + add_edge(vertex_descriptor(processor(), data.source), + data.target, *this); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +boost::parallel::detail::untracked_pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge_with_reply(int source, int tag, const msg_add_edge_data& data, + trigger_receive_context) +{ + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> p = + add_edge(vertex_descriptor(processor(), data.source),data.target, *this); + return p; +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge_with_property(int source, int tag, + const msg_add_edge_with_property_data& data, + trigger_receive_context) +{ + add_edge(vertex_descriptor(processor(), data.source), + data.target, data.get_property(), *this); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +boost::parallel::detail::untracked_pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_add_edge_with_property_and_reply + (int source, int tag, + const msg_add_edge_with_property_data& data, + trigger_receive_context) +{ + std::pair<typename PBGL_DISTRIB_ADJLIST_TYPE::edge_descriptor, bool> p = + add_edge(vertex_descriptor(processor(), data.source), + data.target, data.get_property(), *this); + return p; +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_nonlocal_edge(int source, int tag, + const msg_nonlocal_edge_data& data, + trigger_receive_context) +{ + add_remote_edge(data, source, directed_selector()); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +handle_remove_edge(int source, int tag, + const msg_remove_edge_data& data, + trigger_receive_context) +{ + remove_local_edge(data, source, directed_selector()); +} + +} + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_HANDLERS_HPP + diff --git a/Utilities/BGL/boost/graph/distributed/adjlist/initialize.hpp b/Utilities/BGL/boost/graph/distributed/adjlist/initialize.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4bb85d4ef5c0920eb6b8c5dedac88184173b281d --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/adjlist/initialize.hpp @@ -0,0 +1,319 @@ +// Copyright (C) 2007 Douglas Gregor + +// 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) + +// This file contains code for the distributed adjacency list's +// initializations. It should not be included directly by users. + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_INITIALIZE_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJLIST_INITIALIZE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +namespace boost { + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template<typename EdgeIterator> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type, const base_distribution_type& distribution, + vecS) +{ + process_id_type id = process_id(process_group_); + while (first != last) { + if ((process_id_type)distribution(first->first) == id) { + vertex_descriptor source(id, distribution.local(first->first)); + vertex_descriptor target(distribution(first->second), + distribution.local(first->second)); + add_edge(source, target, *this); + } + ++first; + } + + synchronize(process_group_); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template<typename EdgeIterator, typename EdgePropertyIterator> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type, const base_distribution_type& distribution, + vecS) +{ + process_id_type id = process_id(process_group_); + while (first != last) { + if (static_cast<process_id_type>(distribution(first->first)) == id) { + vertex_descriptor source(id, distribution.local(first->first)); + vertex_descriptor target(distribution(first->second), + distribution.local(first->second)); + add_edge(source, target, *ep_iter, *this); + } + ++first; + ++ep_iter; + } + + synchronize(process_group_); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template<typename EdgeIterator, typename EdgePropertyIterator, + typename VertexListS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + EdgePropertyIterator ep_iter, + vertices_size_type n, const base_distribution_type& distribution, + VertexListS) +{ + using boost::parallel::inplace_all_to_all; + + typedef vertices_size_type vertex_number_t; + typedef typename std::iterator_traits<EdgePropertyIterator>::value_type + edge_property_init_t; + + typedef std::pair<vertex_descriptor, vertex_number_t> + st_pair; + typedef std::pair<st_pair, edge_property_init_t> delayed_edge_t; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + // Vertex indices + std::vector<local_vertex_descriptor> index_to_vertex; + index_to_vertex.reserve(num_vertices(*this)); + BGL_FORALL_VERTICES_T(v, base(), inherited) + index_to_vertex.push_back(v); + + // The list of edges we can't add immediately. + std::vector<delayed_edge_t> delayed_edges; + + std::vector<std::vector<vertex_number_t> > descriptor_requests; + descriptor_requests.resize(num_processes(pg)); + + // Add all of the edges we can, up to the point where we run + // into a descriptor we don't know. + while (first != last) { + if (distribution(first->first) == id) { + if (distribution(first->second) != id) break; + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + vertex_descriptor target + (distribution(first->second), + index_to_vertex[distribution.local(first->second)]); + add_edge(source, target, *ep_iter, *this); + } + ++first; + ++ep_iter; + } + + // Queue all of the remaining edges and determine the set of + // descriptors we need to know about. + while (first != last) { + if (distribution(first->first) == id) { + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + process_id_type dest = distribution(first->second); + if (dest != id) { + descriptor_requests[dest] + .push_back(distribution.local(first->second)); + // Compact request list if we need to + if (descriptor_requests[dest].size() > + distribution.block_size(dest, n)) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + } + + // Save the edge for later + delayed_edges.push_back + (delayed_edge_t(st_pair(source, first->second), *ep_iter)); + } + ++first; + ++ep_iter; + } + + // Compact descriptor requests + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + + // Send out all of the descriptor requests + std::vector<std::vector<vertex_number_t> > in_descriptor_requests; + in_descriptor_requests.resize(num_processes(pg)); + inplace_all_to_all(pg, descriptor_requests, in_descriptor_requests); + + // Reply to all of the descriptor requests + std::vector<std::vector<local_vertex_descriptor> > + descriptor_responses; + descriptor_responses.resize(num_processes(pg)); + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + for (std::size_t i = 0; i < in_descriptor_requests[dest].size(); ++i) { + local_vertex_descriptor v = + index_to_vertex[in_descriptor_requests[dest][i]]; + descriptor_responses[dest].push_back(v); + } + in_descriptor_requests[dest].clear(); + } + in_descriptor_requests.clear(); + inplace_all_to_all(pg, descriptor_responses); + + // Add the queued edges + for(typename std::vector<delayed_edge_t>::iterator i + = delayed_edges.begin(); i != delayed_edges.end(); ++i) { + process_id_type dest = distribution(i->first.second); + local_vertex_descriptor tgt_local; + if (dest == id) { + tgt_local = index_to_vertex[distribution.local(i->first.second)]; + } else { + std::vector<vertex_number_t>& requests = descriptor_requests[dest]; + typename std::vector<vertex_number_t>::iterator pos = + std::lower_bound(requests.begin(), requests.end(), + distribution.local(i->first.second)); + tgt_local = descriptor_responses[dest][pos - requests.begin()]; + } + add_edge(i->first.first, vertex_descriptor(dest, tgt_local), + i->second, *this); + } + synchronize(process_group_); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template<typename EdgeIterator, typename VertexListS> +void +PBGL_DISTRIB_ADJLIST_TYPE:: +initialize(EdgeIterator first, EdgeIterator last, + vertices_size_type n, const base_distribution_type& distribution, + VertexListS) +{ + using boost::parallel::inplace_all_to_all; + + typedef vertices_size_type vertex_number_t; + + typedef std::pair<vertex_descriptor, vertex_number_t> delayed_edge_t; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + // Vertex indices + std::vector<local_vertex_descriptor> index_to_vertex; + index_to_vertex.reserve(num_vertices(*this)); + BGL_FORALL_VERTICES_T(v, base(), inherited) + index_to_vertex.push_back(v); + + // The list of edges we can't add immediately. + std::vector<delayed_edge_t> delayed_edges; + + std::vector<std::vector<vertex_number_t> > descriptor_requests; + descriptor_requests.resize(num_processes(pg)); + + // Add all of the edges we can, up to the point where we run + // into a descriptor we don't know. + while (first != last) { + if (distribution(first->first) == id) { + if (distribution(first->second) != id) break; + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + vertex_descriptor target + (distribution(first->second), + index_to_vertex[distribution.local(first->second)]); + add_edge(source, target, *this); + } + ++first; + } + + // Queue all of the remaining edges and determine the set of + // descriptors we need to know about. + while (first != last) { + if (distribution(first->first) == id) { + vertex_descriptor source + (id, index_to_vertex[distribution.local(first->first)]); + process_id_type dest = distribution(first->second); + if (dest != id) { + descriptor_requests[dest] + .push_back(distribution.local(first->second)); + // Compact request list if we need to + if (descriptor_requests[dest].size() > + distribution.block_size(dest, n)) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + } + + // Save the edge for later + delayed_edges.push_back(delayed_edge_t(source, first->second)); + } + ++first; + } + + // Compact descriptor requests + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + std::sort(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()); + descriptor_requests[dest].erase( + std::unique(descriptor_requests[dest].begin(), + descriptor_requests[dest].end()), + descriptor_requests[dest].end()); + } + + // Send out all of the descriptor requests + std::vector<std::vector<vertex_number_t> > in_descriptor_requests; + in_descriptor_requests.resize(num_processes(pg)); + inplace_all_to_all(pg, descriptor_requests, in_descriptor_requests); + + // Reply to all of the descriptor requests + std::vector<std::vector<local_vertex_descriptor> > + descriptor_responses; + descriptor_responses.resize(num_processes(pg)); + for (process_id_type dest = 0; dest < num_processes(pg); ++dest) { + for (std::size_t i = 0; i < in_descriptor_requests[dest].size(); ++i) { + local_vertex_descriptor v = + index_to_vertex[in_descriptor_requests[dest][i]]; + descriptor_responses[dest].push_back(v); + } + in_descriptor_requests[dest].clear(); + } + in_descriptor_requests.clear(); + inplace_all_to_all(pg, descriptor_responses); + + // Add the queued edges + for(typename std::vector<delayed_edge_t>::iterator i + = delayed_edges.begin(); i != delayed_edges.end(); ++i) { + process_id_type dest = distribution(i->second); + local_vertex_descriptor tgt_local; + if (dest == id) { + tgt_local = index_to_vertex[distribution.local(i->second)]; + } else { + std::vector<vertex_number_t>& requests = descriptor_requests[dest]; + typename std::vector<vertex_number_t>::iterator pos = + std::lower_bound(requests.begin(), requests.end(), + distribution.local(i->second)); + tgt_local = descriptor_responses[dest][pos - requests.begin()]; + } + add_edge(i->first, vertex_descriptor(dest, tgt_local), *this); + } + synchronize(process_group_); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_INITIALIZE_HPP diff --git a/Utilities/BGL/boost/graph/distributed/adjlist/redistribute.hpp b/Utilities/BGL/boost/graph/distributed/adjlist/redistribute.hpp new file mode 100644 index 0000000000000000000000000000000000000000..62e79bf4672dc4c2b07f72ae7f4d95a5b89fb335 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/adjlist/redistribute.hpp @@ -0,0 +1,393 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +// +// Implements redistribution of vertices for a distributed adjacency +// list. This file should not be included by users. It will be +// included by the distributed adjacency list header. +// + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/pending/container_traits.hpp> + +namespace boost { namespace detail { namespace parallel { + +/* This structure contains a (vertex or edge) descriptor that is being + moved from one processor to another. It contains the properties for + that descriptor (if any). + */ +template<typename Descriptor, typename DescriptorProperty> +struct redistributed_descriptor : maybe_store_property<DescriptorProperty> +{ + typedef maybe_store_property<DescriptorProperty> inherited; + + redistributed_descriptor() { } + + redistributed_descriptor(const Descriptor& v, const DescriptorProperty& p) + : inherited(p), descriptor(v) { } + + Descriptor descriptor; + +private: + friend class boost::serialization::access; + + template<typename Archiver> + void serialize(Archiver& ar, unsigned int /*version*/) + { + ar & boost::serialization::base_object<inherited>(*this) + & unsafe_serialize(descriptor); + } +}; + +/* Predicate that returns true if the target has migrated. */ +template<typename VertexProcessorMap, typename Graph> +struct target_migrated_t +{ + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + target_migrated_t(VertexProcessorMap vertex_to_processor, const Graph& g) + : vertex_to_processor(vertex_to_processor), g(g) { } + + bool operator()(Edge e) const + { + typedef global_descriptor<Vertex> DVertex; + processor_id_type owner = get(edge_target_processor_id, g, e); + return get(vertex_to_processor, DVertex(owner, target(e, g))) != owner; + } + +private: + VertexProcessorMap vertex_to_processor; + const Graph& g; +}; + +template<typename VertexProcessorMap, typename Graph> +inline target_migrated_t<VertexProcessorMap, Graph> +target_migrated(VertexProcessorMap vertex_to_processor, const Graph& g) +{ return target_migrated_t<VertexProcessorMap, Graph>(vertex_to_processor, g); } + +/* Predicate that returns true if the source of an in-edge has migrated. */ +template<typename VertexProcessorMap, typename Graph> +struct source_migrated_t +{ + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + source_migrated_t(VertexProcessorMap vertex_to_processor, const Graph& g) + : vertex_to_processor(vertex_to_processor), g(g) { } + + bool operator()(stored_in_edge<Edge> e) const + { + return get(vertex_to_processor, DVertex(e.source_processor, source(e.e, g))) + != e.source_processor; + } + +private: + VertexProcessorMap vertex_to_processor; + const Graph& g; +}; + +template<typename VertexProcessorMap, typename Graph> +inline source_migrated_t<VertexProcessorMap, Graph> +source_migrated(VertexProcessorMap vertex_to_processor, const Graph& g) +{ return source_migrated_t<VertexProcessorMap, Graph>(vertex_to_processor, g); } + +/* Predicate that returns true if the target has migrated. */ +template<typename VertexProcessorMap, typename Graph> +struct source_or_target_migrated_t +{ + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + source_or_target_migrated_t(VertexProcessorMap vertex_to_processor, + const Graph& g) + : vertex_to_processor(vertex_to_processor), g(g) { } + + bool operator()(Edge e) const + { + return get(vertex_to_processor, source(e, g)) != source(e, g).owner + || get(vertex_to_processor, target(e, g)) != target(e, g).owner; + } + +private: + VertexProcessorMap vertex_to_processor; + const Graph& g; +}; + +template<typename VertexProcessorMap, typename Graph> +inline source_or_target_migrated_t<VertexProcessorMap, Graph> +source_or_target_migrated(VertexProcessorMap vertex_to_processor, +const Graph& g) +{ + typedef source_or_target_migrated_t<VertexProcessorMap, Graph> result_type; + return result_type(vertex_to_processor, g); +} + +} } // end of namespace detail::parallel + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template<typename VertexProcessorMap> +void +PBGL_DISTRIB_ADJLIST_TYPE +::request_in_neighbors(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS) +{ + BGL_FORALL_INEDGES_T(v, e, *this, graph_type) + request(vertex_to_processor, source(e, *this)); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template<typename VertexProcessorMap> +void +PBGL_DISTRIB_ADJLIST_TYPE +::remove_migrated_in_edges(vertex_descriptor v, + VertexProcessorMap vertex_to_processor, + bidirectionalS) +{ + graph_detail::erase_if(get(vertex_in_edges, base())[v.local], + source_migrated(vertex_to_processor, base())); +} + +template<PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template<typename VertexProcessorMap> +void +PBGL_DISTRIB_ADJLIST_TYPE +::redistribute(VertexProcessorMap vertex_to_processor) +{ + using boost::parallel::inplace_all_to_all; + + // When we have stable descriptors, we only move those descriptors + // that actually need to be moved. Otherwise, we essentially have to + // regenerate the entire graph. + const bool has_stable_descriptors = + is_same<typename config_type::vertex_list_selector, listS>::value + || is_same<typename config_type::vertex_list_selector, setS>::value + || is_same<typename config_type::vertex_list_selector, multisetS>::value; + + typedef detail::parallel::redistributed_descriptor<vertex_descriptor, + vertex_property_type> + redistributed_vertex; + typedef detail::parallel::redistributed_descriptor<edge_descriptor, + edge_property_type> + redistributed_edge; + typedef std::pair<vertices_size_type, edges_size_type> num_relocated_pair; + + vertex_iterator vi, vi_end; + edge_iterator ei, ei_end; + + process_group_type pg = process_group(); + + // Initial synchronization makes sure that we have all of our ducks + // in a row. We don't want any outstanding add/remove messages + // coming in mid-redistribution! + synchronize(process_group_); + + // We cannot cope with eviction of ghost cells + vertex_to_processor.set_max_ghost_cells(0); + + process_id_type p = num_processes(pg); + + // Send vertices and edges to the processor where they will + // actually reside. This requires O(|V| + |E|) communication + std::vector<std::vector<redistributed_vertex> > redistributed_vertices(p); + std::vector<std::vector<redistributed_edge> > redistributed_edges(p); + + // Build the sets of relocated vertices for each process and then do + // an all-to-all transfer. + for (tie(vi, vi_end) = vertices(*this); vi != vi_end; ++vi) { + if (!has_stable_descriptors + || get(vertex_to_processor, *vi) != vi->owner) { + redistributed_vertices[get(vertex_to_processor, *vi)] + .push_back(redistributed_vertex(*vi, get(vertex_all_t(), base(), + vi->local))); + } + + // When our descriptors are stable, we need to determine which + // adjacent descriptors are stable to determine which edges will + // be removed. + if (has_stable_descriptors) { + BGL_FORALL_OUTEDGES_T(*vi, e, *this, graph_type) + request(vertex_to_processor, target(e, *this)); + request_in_neighbors(*vi, vertex_to_processor, directed_selector()); + } + } + + inplace_all_to_all(pg, redistributed_vertices); + + // If we have stable descriptors, we need to know where our neighbor + // vertices are moving. + if (has_stable_descriptors) + synchronize(vertex_to_processor); + + // Build the sets of relocated edges for each process and then do + // an all-to-all transfer. + for (tie(ei, ei_end) = edges(*this); ei != ei_end; ++ei) { + vertex_descriptor src = source(*ei, *this); + vertex_descriptor tgt = target(*ei, *this); + if (!has_stable_descriptors + || get(vertex_to_processor, src) != src.owner + || get(vertex_to_processor, tgt) != tgt.owner) + redistributed_edges[get(vertex_to_processor, source(*ei, *this))] + .push_back(redistributed_edge(*ei, get(edge_all_t(), base(), + ei->local))); + } + inplace_all_to_all(pg, redistributed_edges); + + // A mapping from old vertex descriptors to new vertex + // descriptors. This is an STL map partly because I'm too lazy to + // build a real property map (which is hard in the general case) but + // also because it won't try to look in the graph itself, because + // the keys are all vertex descriptors that have been invalidated. + std::map<vertex_descriptor, vertex_descriptor> old_to_new_vertex_map; + + if (has_stable_descriptors) { + // Clear out all vertices and edges that will have moved. There + // are several stages to this. + + // First, eliminate all outgoing edges from the (local) vertices + // that have been moved or whose targets have been moved. + BGL_FORALL_VERTICES_T(v, *this, graph_type) { + if (get(vertex_to_processor, v) != v.owner) { + clear_out_edges(v.local, base()); + clear_in_edges_local(v, directed_selector()); + } else { + remove_out_edge_if(v.local, + target_migrated(vertex_to_processor, base()), + base()); + remove_migrated_in_edges(v, vertex_to_processor, directed_selector()); + } + } + + // Next, eliminate locally-stored edges that have migrated (for + // undirected graphs). + graph_detail::erase_if(local_edges_, + source_or_target_migrated(vertex_to_processor, *this)); + + // Eliminate vertices that have migrated + for (tie(vi, vi_end) = vertices(*this); vi != vi_end; /* in loop */) { + if (get(vertex_to_processor, *vi) != vi->owner) + remove_vertex((*vi++).local, base()); + else { + // Add the identity relation for vertices that have not migrated + old_to_new_vertex_map[*vi] = *vi; + ++vi; + } + } + } else { + // Clear out the local graph: the entire graph is in transit + clear(); + } + + // Add the new vertices to the graph. When we do so, update the old + // -> new vertex mapping both locally and for the owner of the "old" + // vertex. + { + typedef std::pair<vertex_descriptor, vertex_descriptor> mapping_pair; + std::vector<std::vector<mapping_pair> > mappings(p); + + for (process_id_type src = 0; src < p; ++src) { + for (typename std::vector<redistributed_vertex>::iterator vi = + redistributed_vertices[src].begin(); + vi != redistributed_vertices[src].end(); ++vi) { + vertex_descriptor new_vertex = + add_vertex(vi->get_property(), *this); + old_to_new_vertex_map[vi->descriptor] = new_vertex; + mappings[vi->descriptor.owner].push_back(mapping_pair(vi->descriptor, + new_vertex)); + } + + redistributed_vertices[src].clear(); + } + + inplace_all_to_all(pg, mappings); + + // Add the mappings we were sent into the old->new map. + for (process_id_type src = 0; src < p; ++src) + old_to_new_vertex_map.insert(mappings[src].begin(), mappings[src].end()); + } + + // Get old->new vertex mappings for all of the vertices we need to + // know about. + + // TBD: An optimization here might involve sending the + // request-response pairs without an explicit request step (for + // bidirectional and undirected graphs). However, it may not matter + // all that much given the cost of redistribution. + { + std::vector<std::vector<vertex_descriptor> > vertex_map_requests(p); + std::vector<std::vector<vertex_descriptor> > vertex_map_responses(p); + + // We need to know about all of the vertices incident on edges + // that have been relocated to this processor. Tell each processor + // what each other processor needs to know. + for (process_id_type src = 0; src < p; ++src) + for (typename std::vector<redistributed_edge>::iterator ei = + redistributed_edges[src].begin(); + ei != redistributed_edges[src].end(); ++ei) { + vertex_descriptor need_vertex = target(ei->descriptor, *this); + if (old_to_new_vertex_map.find(need_vertex) + == old_to_new_vertex_map.end()) + { + old_to_new_vertex_map[need_vertex] = need_vertex; + vertex_map_requests[need_vertex.owner].push_back(need_vertex); + } + } + inplace_all_to_all(pg, + vertex_map_requests, + vertex_map_responses); + + // Process the requests made for vertices we own. Then perform yet + // another all-to-all swap. This one matches the requests we've + // made to the responses we were given. + for (process_id_type src = 0; src < p; ++src) + for (typename std::vector<vertex_descriptor>::iterator vi = + vertex_map_responses[src].begin(); + vi != vertex_map_responses[src].end(); ++vi) + *vi = old_to_new_vertex_map[*vi]; + inplace_all_to_all(pg, vertex_map_responses); + + // Matching the requests to the responses, update the old->new + // vertex map for all of the vertices we will need to know. + for (process_id_type src = 0; src < p; ++src) { + typedef typename std::vector<vertex_descriptor>::size_type size_type; + for (size_type i = 0; i < vertex_map_requests[src].size(); ++i) { + old_to_new_vertex_map[vertex_map_requests[src][i]] = + vertex_map_responses[src][i]; + } + } + } + + // Add edges to the graph by mapping the source and target. + for (process_id_type src = 0; src < p; ++src) { + for (typename std::vector<redistributed_edge>::iterator ei = + redistributed_edges[src].begin(); + ei != redistributed_edges[src].end(); ++ei) { + add_edge(old_to_new_vertex_map[source(ei->descriptor, *this)], + old_to_new_vertex_map[target(ei->descriptor, *this)], + ei->get_property(), + *this); + } + + redistributed_edges[src].clear(); + } + + // Be sure that edge-addition messages are received now, completing + // the graph. + synchronize(process_group_); + + this->distribution().clear(); + + detail::parallel::maybe_initialize_vertex_indices(vertices(base()), + get(vertex_index, base())); +} + +} // end namespace boost diff --git a/Utilities/BGL/boost/graph/distributed/adjlist/serialization.hpp b/Utilities/BGL/boost/graph/distributed/adjlist/serialization.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b1685b5172f1559a72cf46b9aa2670ac24212488 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/adjlist/serialization.hpp @@ -0,0 +1,1007 @@ +// Copyright Daniel Wallin 2007. 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) + +#ifndef BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP +#define BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +# include <boost/lexical_cast.hpp> +# include <boost/foreach.hpp> +# include <boost/filesystem/path.hpp> +# include <boost/filesystem/operations.hpp> +# include <cctype> +# include <fstream> + +namespace boost { + +namespace detail { namespace parallel +{ + + // Wraps a local descriptor, making it serializable. + template <class Local> + struct serializable_local_descriptor + { + serializable_local_descriptor() + {} + + serializable_local_descriptor(Local local) + : local(local) + {} + + operator Local const&() const + { + return local; + } + + bool operator==(serializable_local_descriptor const& other) const + { + return local == other.local; + } + + bool operator<(serializable_local_descriptor const& other) const + { + return local < other.local; + } + + template <class Archive> + void serialize(Archive& ar, const unsigned int /*version*/) + { + ar & unsafe_serialize(local); + } + + Local local; + }; + + template <class Vertex, class Properties> + struct pending_edge + { + pending_edge( + Vertex source, Vertex target + , Properties properties, void* property_ptr + ) + : source(source) + , target(target) + , properties(properties) + , property_ptr(property_ptr) + {} + + Vertex source; + Vertex target; + Properties properties; + void* property_ptr; + }; + + inline bool is_digit(char c) + { + return std::isdigit(c); + } + + inline std::vector<int> + available_process_files(std::string const& filename) + { + if (!filesystem::exists(filename)) + return std::vector<int>(); + + std::vector<int> result; + + for (filesystem::directory_iterator i(filename), end; i != end; ++i) + { + if (!filesystem::is_regular(*i)) + boost::throw_exception(std::runtime_error("directory contains non-regular entries")); + +#if BOOST_VERSION >= 103600 + std::string process_name = i->path().filename(); +#else + std::string process_name = i->leaf(); +#endif + for (std::string::size_type i = 0; i < process_name.size(); ++i) + if (!is_digit(process_name[i])) + boost::throw_exception(std::runtime_error("directory contains files with invalid names")); + + result.push_back(boost::lexical_cast<int>(process_name)); + } + + return result; + } + + template <class Archive, class Tag, class T, class Base> + void maybe_load_properties( + Archive& ar, char const* name, property<Tag, T, Base>& properties) + { + ar >> serialization::make_nvp(name, get_property_value(properties, Tag())); + maybe_load_properties(ar, name, static_cast<Base&>(properties)); + } + + template <class Archive> + void maybe_load_properties( + Archive&, char const*, no_property&) + {} + + template <class Archive, typename Bundle> + void maybe_load_properties( + Archive& ar, char const* name, Bundle& bundle) + { + ar >> serialization::make_nvp(name, bundle); + no_property prop; + maybe_load_properties(ar, name, prop); + } + + + + + + + template <class Graph, class Archive, class VertexListS> + struct graph_loader + { + typedef typename Graph::vertex_descriptor vertex_descriptor; + typedef typename Graph::local_vertex_descriptor local_vertex_descriptor; + typedef typename Graph::vertex_property_type vertex_property_type; + typedef typename Graph::edge_descriptor edge_descriptor; + typedef typename Graph::local_edge_descriptor local_edge_descriptor; + typedef typename Graph::edge_property_type edge_property_type; + typedef typename Graph::process_group_type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename Graph::directed_selector directed_selector; + typedef typename mpl::if_< + is_same<VertexListS, defaultS>, vecS, VertexListS + >::type vertex_list_selector; + typedef pending_edge<vertex_descriptor, edge_property_type> + pending_edge_type; + typedef serializable_local_descriptor<local_vertex_descriptor> + serializable_vertex_descriptor; + + graph_loader(Graph& g, Archive& ar) + : m_g(g) + , m_ar(ar) + , m_pg(g.process_group()) + , m_requested_vertices(num_processes(m_pg)) + , m_remote_vertices(num_processes(m_pg)) + , m_property_ptrs(num_processes(m_pg)) + { + g.clear(); + load_prefix(); + load_vertices(); + load_edges(); + ar >> make_nvp("distribution", m_g.distribution()); + } + + private: + struct pending_in_edge + { + pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr + ) + : u(u) + , v(v) + , property_ptr(property_ptr) + {} + + vertex_descriptor u; + vertex_descriptor v; + void* property_ptr; + }; + + bool is_root() const + { + return process_id(m_pg) == 0; + } + + template <class T> + serialization::nvp<T> const make_nvp(char const* name, T& value) const + { + return serialization::nvp<T>(name, value); + } + + void load_prefix(); + void load_vertices(); + + template <class Anything> + void maybe_load_and_store_local_vertex(Anything); + void maybe_load_and_store_local_vertex(vecS); + + void load_edges(); + void load_in_edges(bidirectionalS); + void load_in_edges(directedS); + void add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, vecS); + template <class Anything> + void add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, Anything); + template <class Anything> + void add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, Anything); + void add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, vecS); + void add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, directedS); + void add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, bidirectionalS); + void add_in_edge( + edge_descriptor const&, void*, directedS); + void add_in_edge( + edge_descriptor const& edge, void* old_property_ptr, bidirectionalS); + + void resolve_remote_vertices(directedS); + void resolve_remote_vertices(bidirectionalS); + vertex_descriptor resolve_remote_vertex(vertex_descriptor u) const; + vertex_descriptor resolve_remote_vertex(vertex_descriptor u, vecS) const; + template <class Anything> + vertex_descriptor resolve_remote_vertex(vertex_descriptor u, Anything) const; + + void resolve_property_ptrs(); + + void commit_pending_edges(vecS); + template <class Anything> + void commit_pending_edges(Anything); + void commit_pending_in_edges(directedS); + void commit_pending_in_edges(bidirectionalS); + + void* maybe_load_property_ptr(directedS) { return 0; } + void* maybe_load_property_ptr(bidirectionalS); + + Graph& m_g; + Archive& m_ar; + process_group_type m_pg; + + std::vector<process_id_type> m_id_mapping; + + // Maps local vertices as loaded from the archive to + // the ones actually added to the graph. Only used + // when !vecS. + std::map<local_vertex_descriptor, local_vertex_descriptor> m_local_vertices; + + // This is the list of remote vertex descriptors that we + // are going to receive from other processes. This is + // kept sorted so that we can determine the position of + // the matching vertex descriptor in m_remote_vertices. + std::vector<std::vector<serializable_vertex_descriptor> > m_requested_vertices; + + // This is the list of remote vertex descriptors that + // we send and receive from other processes. + std::vector<std::vector<serializable_vertex_descriptor> > m_remote_vertices; + + // ... + std::vector<pending_edge_type> m_pending_edges; + + // The pending in-edges that will be added in the commit step, after + // the remote vertex descriptors has been resolved. Only used + // when bidirectionalS and !vecS. + std::vector<pending_in_edge> m_pending_in_edges; + + std::vector<std::vector<unsafe_pair<void*,void*> > > m_property_ptrs; + }; + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::load_prefix() + { + typename process_group_type::process_size_type num_processes_; + m_ar >> make_nvp("num_processes", num_processes_); + + if (num_processes_ != num_processes(m_pg)) + boost::throw_exception(std::runtime_error("number of processes mismatch")); + + process_id_type old_id; + m_ar >> make_nvp("id", old_id); + + std::vector<typename Graph::distribution_type::size_type> mapping; + m_ar >> make_nvp("mapping", mapping); + + // Fetch all the old id's from the other processes. + std::vector<process_id_type> old_ids; + all_gather(m_pg, &old_id, &old_id+1, old_ids); + + m_id_mapping.resize(num_processes(m_pg), -1); + + for (process_id_type i = 0; i < num_processes(m_pg); ++i) + { +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << i << " used to be " << old_ids[i] << "\n"; +# endif + assert(m_id_mapping[old_ids[i]] == -1); + m_id_mapping[old_ids[i]] = i; + } + + std::vector<typename Graph::distribution_type::size_type> new_mapping( + mapping.size()); + + for (int i = 0; i < num_processes(m_pg); ++i) + { + new_mapping[mapping[old_ids[i]]] = i; + } + + m_g.distribution().assign_mapping( + new_mapping.begin(), new_mapping.end()); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::load_vertices() + { + int V; + m_ar >> BOOST_SERIALIZATION_NVP(V); + +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Loading vertices\n"; +# endif + + for (int i = 0; i < V; ++i) + { + maybe_load_and_store_local_vertex(vertex_list_selector()); + } + } + + template <class Graph, class Archive, class VertexListS> + template <class Anything> + void graph_loader<Graph, Archive, VertexListS>::maybe_load_and_store_local_vertex(Anything) + { + // Load the original vertex descriptor + local_vertex_descriptor local; + m_ar >> make_nvp("local", unsafe_serialize(local)); + + // Load the properties + vertex_property_type property; + detail::parallel::maybe_load_properties(m_ar, "vertex_property", + property); + + // Add the vertex + vertex_descriptor v(process_id(m_pg), add_vertex(property, m_g.base())); + + if (m_g.on_add_vertex) + m_g.on_add_vertex(v, m_g); + + // Create the mapping from the "old" local descriptor to the new + // local descriptor. + m_local_vertices[local] = v.local; + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::maybe_load_and_store_local_vertex(vecS) + { + // Load the properties + vertex_property_type property; + detail::parallel::maybe_load_properties(m_ar, "vertex_property", + property); + + // Add the vertex + vertex_descriptor v(process_id(m_pg), + add_vertex(m_g.build_vertex_property(property), + m_g.base())); + + if (m_g.on_add_vertex) + m_g.on_add_vertex(v, m_g); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::load_edges() + { + int E; + m_ar >> BOOST_SERIALIZATION_NVP(E); + +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Loading edges\n"; +# endif + + for (int i = 0; i < E; ++i) + { + local_vertex_descriptor local_src; + process_id_type target_owner; + local_vertex_descriptor local_tgt; + + m_ar >> make_nvp("source", unsafe_serialize(local_src)); + m_ar >> make_nvp("target_owner", target_owner); + m_ar >> make_nvp("target", unsafe_serialize(local_tgt)); + + process_id_type new_src_owner = process_id(m_pg); + process_id_type new_tgt_owner = m_id_mapping[target_owner]; + + vertex_descriptor source(new_src_owner, local_src); + vertex_descriptor target(new_tgt_owner, local_tgt); + + edge_property_type properties; + detail::parallel::maybe_load_properties(m_ar, "edge_property", properties); + + void* property_ptr = maybe_load_property_ptr(directed_selector()); + add_edge(source, target, properties, property_ptr, vertex_list_selector()); + } + + load_in_edges(directed_selector()); + commit_pending_edges(vertex_list_selector()); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::load_in_edges(bidirectionalS) + { + std::size_t I; + m_ar >> BOOST_SERIALIZATION_NVP(I); + +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Loading in-edges\n"; +# endif + + for (int i = 0; i < I; ++i) + { + process_id_type src_owner; + local_vertex_descriptor local_src; + local_vertex_descriptor local_target; + void* property_ptr; + + m_ar >> make_nvp("src_owner", src_owner); + m_ar >> make_nvp("source", unsafe_serialize(local_src)); + m_ar >> make_nvp("target", unsafe_serialize(local_target)); + m_ar >> make_nvp("property_ptr", unsafe_serialize(property_ptr)); + + src_owner = m_id_mapping[src_owner]; + + vertex_descriptor u(src_owner, local_src); + vertex_descriptor v(process_id(m_pg), local_target); + + add_pending_in_edge(u, v, property_ptr, vertex_list_selector()); + } + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::load_in_edges(directedS) + {} + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, vecS) + { + m_pending_in_edges.push_back(pending_in_edge(u,v,property_ptr)); + } + + template <class Graph, class Archive, class VertexListS> + template <class Anything> + void graph_loader<Graph, Archive, VertexListS>::add_pending_in_edge( + vertex_descriptor u, vertex_descriptor v, void* property_ptr, Anything) + { + // u and v represent the out-edge here, meaning v is local + // to us, and u is always remote. + m_pending_in_edges.push_back(pending_in_edge(u,v,property_ptr)); + add_remote_vertex_request(v, u, bidirectionalS()); + } + + template <class Graph, class Archive, class VertexListS> + template <class Anything> + void graph_loader<Graph, Archive, VertexListS>::add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, Anything) + { + m_pending_edges.push_back(pending_edge_type(u, v, property, property_ptr)); + add_remote_vertex_request(u, v, directed_selector()); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, directedS) + { + // We have to request the remote vertex. + m_requested_vertices[owner(v)].push_back(local(v)); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::add_remote_vertex_request( + vertex_descriptor u, vertex_descriptor v, bidirectionalS) + { + // If the edge spans to another process, we know + // that that process has a matching in-edge, so + // we can just send our vertex. No requests + // necessary. + if (owner(v) != m_g.processor()) + { + m_remote_vertices[owner(v)].push_back(local(u)); + m_requested_vertices[owner(v)].push_back(local(v)); + } + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::add_edge( + vertex_descriptor u, vertex_descriptor v + , edge_property_type const& property, void* property_ptr, vecS) + { + std::pair<local_edge_descriptor, bool> inserted = + detail::parallel::add_local_edge( + local(u), local(v) + , m_g.build_edge_property(property), m_g.base()); + assert(inserted.second); + put(edge_target_processor_id, m_g.base(), inserted.first, owner(v)); + + edge_descriptor e(owner(u), owner(v), true, inserted.first); + + if (inserted.second && m_g.on_add_edge) + m_g.on_add_edge(e, m_g); + + add_in_edge(e, property_ptr, directed_selector()); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::add_in_edge( + edge_descriptor const&, void*, directedS) + {} + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::add_in_edge( + edge_descriptor const& edge, void* old_property_ptr, bidirectionalS) + { + if (owner(target(edge, m_g)) == m_g.processor()) + { + detail::parallel::stored_in_edge<local_edge_descriptor> + e(m_g.processor(), local(edge)); + boost::graph_detail::push(get( + vertex_in_edges, m_g.base())[local(target(edge, m_g))], e); + } + else + { + // We send the (old,new) property pointer pair to + // the remote process. This could be optimized to + // only send the new one -- the ordering can be + // made implicit because the old pointer value is + // stored on the remote process. + // + // Doing that is a little bit more complicated, but + // in case it turns out it's important we can do it. + void* property_ptr = local(edge).get_property(); + m_property_ptrs[owner(target(edge, m_g))].push_back( + unsafe_pair<void*,void*>(old_property_ptr, property_ptr)); + } + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::resolve_property_ptrs() + { +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Resolving property pointers\n"; +# endif + + for (int i = 0; i < num_processes(m_pg); ++i) + { + std::sort( + m_property_ptrs[i].begin(), m_property_ptrs[i].end()); + } + + boost::parallel::inplace_all_to_all(m_pg, m_property_ptrs); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertices(directedS) + { + for (int i = 0; i < num_processes(m_pg); ++i) + { + std::sort(m_requested_vertices[i].begin(), m_requested_vertices[i].end()); + } + + boost::parallel::inplace_all_to_all( + m_pg, m_requested_vertices, m_remote_vertices); + + for (int i = 0; i < num_processes(m_pg); ++i) + { + BOOST_FOREACH(serializable_vertex_descriptor& u, m_remote_vertices[i]) + { + u = m_local_vertices[u]; + } + } + + boost::parallel::inplace_all_to_all(m_pg, m_remote_vertices); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertices(bidirectionalS) + { +# ifdef PBGL_SERIALIZE_DEBUG + if (is_root()) + std::cout << "Resolving remote vertices\n"; +# endif + + for (int i = 0; i < num_processes(m_pg); ++i) + { + std::sort(m_requested_vertices[i].begin(), m_requested_vertices[i].end()); + std::sort(m_remote_vertices[i].begin(), m_remote_vertices[i].end()); + + BOOST_FOREACH(serializable_vertex_descriptor& u, m_remote_vertices[i]) + { + u = m_local_vertices[u]; + } + } + + boost::parallel::inplace_all_to_all(m_pg, m_remote_vertices); + + for (int i = 0; i < num_processes(m_pg); ++i) + assert(m_remote_vertices[i].size() == m_requested_vertices[i].size()); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::commit_pending_edges(vecS) + { + commit_pending_in_edges(directed_selector()); + } + + template <class Graph, class Archive, class VertexListS> + template <class Anything> + void graph_loader<Graph, Archive, VertexListS>::commit_pending_edges(Anything) + { + resolve_remote_vertices(directed_selector()); + + BOOST_FOREACH(pending_edge_type const& e, m_pending_edges) + { + vertex_descriptor u = resolve_remote_vertex(e.source); + vertex_descriptor v = resolve_remote_vertex(e.target); + add_edge(u, v, e.properties, e.property_ptr, vecS()); + } + + commit_pending_in_edges(directed_selector()); + } + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::commit_pending_in_edges(directedS) + {} + + template <class Graph, class Archive, class VertexListS> + void graph_loader<Graph, Archive, VertexListS>::commit_pending_in_edges(bidirectionalS) + { + resolve_property_ptrs(); + + BOOST_FOREACH(pending_in_edge const& e, m_pending_in_edges) + { + vertex_descriptor u = resolve_remote_vertex(e.u, vertex_list_selector()); + vertex_descriptor v = resolve_remote_vertex(e.v, vertex_list_selector()); + + typedef detail::parallel::stored_in_edge<local_edge_descriptor> stored_edge; + + std::vector<unsafe_pair<void*,void*> >::iterator i = std::lower_bound( + m_property_ptrs[owner(u)].begin() + , m_property_ptrs[owner(u)].end() + , unsafe_pair<void*,void*>(e.property_ptr, 0) + ); + + if (i == m_property_ptrs[owner(u)].end() + || i->first != e.property_ptr) + { + assert(false); + } + + local_edge_descriptor local_edge(local(u), local(v), i->second); + stored_edge edge(owner(u), local_edge); + boost::graph_detail::push( + get(vertex_in_edges, m_g.base())[local(v)], edge); + } + } + + template <class Graph, class Archive, class VertexListS> + typename graph_loader<Graph, Archive, VertexListS>::vertex_descriptor + graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertex( + vertex_descriptor u) const + { + if (owner(u) == process_id(m_pg)) + { + return vertex_descriptor( + process_id(m_pg), m_local_vertices.find(local(u))->second); + } + + typename std::vector<serializable_vertex_descriptor>::const_iterator + i = std::lower_bound( + m_requested_vertices[owner(u)].begin() + , m_requested_vertices[owner(u)].end() + , serializable_vertex_descriptor(local(u)) + ); + + if (i == m_requested_vertices[owner(u)].end() + || *i != local(u)) + { + assert(false); + } + + local_vertex_descriptor local = + m_remote_vertices[owner(u)][m_requested_vertices[owner(u)].end() - i]; + return vertex_descriptor(owner(u), local); + } + + template <class Graph, class Archive, class VertexListS> + typename graph_loader<Graph, Archive, VertexListS>::vertex_descriptor + graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertex( + vertex_descriptor u, vecS) const + { + return u; + } + + template <class Graph, class Archive, class VertexListS> + template <class Anything> + typename graph_loader<Graph, Archive, VertexListS>::vertex_descriptor + graph_loader<Graph, Archive, VertexListS>::resolve_remote_vertex( + vertex_descriptor u, Anything) const + { + return resolve_remote_vertex(u); + } + + template <class Graph, class Archive, class VertexListS> + void* + graph_loader<Graph, Archive, VertexListS>::maybe_load_property_ptr(bidirectionalS) + { + void* ptr; + m_ar >> make_nvp("property_ptr", unsafe_serialize(ptr)); + return ptr; + } + +template <class Archive, class D> +void maybe_save_local_descriptor(Archive& ar, D const&, vecS) +{} + +template <class Archive, class D, class NotVecS> +void maybe_save_local_descriptor(Archive& ar, D const& d, NotVecS) +{ + ar << serialization::make_nvp( + "local", unsafe_serialize(const_cast<D&>(d))); +} + +template <class Archive> +void maybe_save_properties( + Archive&, char const*, no_property const&) +{} + +template <class Archive, class Tag, class T, class Base> +void maybe_save_properties( + Archive& ar, char const* name, property<Tag, T, Base> const& properties) +{ + ar & serialization::make_nvp(name, get_property_value(properties, Tag())); + maybe_save_properties(ar, name, static_cast<Base const&>(properties)); +} + +template <class Archive, class Graph> +void save_in_edges(Archive& ar, Graph const& g, directedS) +{} + +// We need to save the edges in the base edge +// list, and the in_edges that are stored in the +// vertex_in_edges vertex property. +template <class Archive, class Graph> +void save_in_edges(Archive& ar, Graph const& g, bidirectionalS) +{ + typedef typename Graph::process_group_type + process_group_type; + typedef typename process_group_type::process_id_type + process_id_type; + typedef typename graph_traits< + Graph>::vertex_descriptor vertex_descriptor; + typedef typename vertex_descriptor::local_descriptor_type + local_vertex_descriptor; + typedef typename graph_traits< + Graph>::edge_descriptor edge_descriptor; + + process_id_type id = g.processor(); + + typedef std::pair<local_vertex_descriptor, vertex_descriptor> in_edge; + std::vector<edge_descriptor> saved_in_edges; + + BGL_FORALL_VERTICES_T(v, g, Graph) + { + BOOST_FOREACH(edge_descriptor const& e, in_edges(v, g)) + { + // Only save the in_edges that isn't owned by this process. + if (owner(e) == id) + continue; + + saved_in_edges.push_back(e); + } + } + + std::size_t I = saved_in_edges.size(); + ar << BOOST_SERIALIZATION_NVP(I); + + BOOST_FOREACH(edge_descriptor const& e, saved_in_edges) + { + process_id_type src_owner = owner(source(e,g)); + local_vertex_descriptor local_src = local(source(e,g)); + local_vertex_descriptor local_target = local(target(e,g)); + void* property_ptr = local(e).get_property(); + + using serialization::make_nvp; + + ar << make_nvp("src_owner", src_owner); + ar << make_nvp("source", unsafe_serialize(local_src)); + ar << make_nvp("target", unsafe_serialize(local_target)); + ar << make_nvp("property_ptr", unsafe_serialize(property_ptr)); + } +} + +template <class Archive, class Edge> +void maybe_save_property_ptr(Archive&, Edge const&, directedS) +{} + +template <class Archive, class Edge> +void maybe_save_property_ptr(Archive& ar, Edge const& e, bidirectionalS) +{ + void* ptr = local(e).get_property(); + ar << serialization::make_nvp("property_ptr", unsafe_serialize(ptr)); +} + +template <class Archive, class Graph, class DirectedS> +void save_edges(Archive& ar, Graph const& g, DirectedS) +{ + typedef typename Graph::process_group_type + process_group_type; + typedef typename process_group_type::process_id_type + process_id_type; + typedef typename graph_traits< + Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits< + Graph>::edge_descriptor edge_descriptor; + + // We retag the property list here so that bundled properties are + // properly placed into property<edge_bundle_t, Bundle>. + typedef typename boost::detail::retag_property_list< + edge_bundle_t, + typename Graph::edge_property_type>::type + edge_property_type; + + int E = num_edges(g); + ar << BOOST_SERIALIZATION_NVP(E); + + // For *directed* graphs, we can just save + // the edge list and be done. + // + // For *bidirectional* graphs, we need to also + // save the "vertex_in_edges" property map, + // because it might contain in-edges that + // are not locally owned. + BGL_FORALL_EDGES_T(e, g, Graph) + { + vertex_descriptor src(source(e, g)); + vertex_descriptor tgt(target(e, g)); + + typename vertex_descriptor::local_descriptor_type + local_u(local(src)); + typename vertex_descriptor::local_descriptor_type + local_v(local(tgt)); + + process_id_type target_owner = owner(tgt); + + using serialization::make_nvp; + + ar << make_nvp("source", unsafe_serialize(local_u)); + ar << make_nvp("target_owner", target_owner); + ar << make_nvp("target", unsafe_serialize(local_v)); + + maybe_save_properties( + ar, "edge_property" + , static_cast<edge_property_type const&>(get(edge_all_t(), g, e)) + ); + + maybe_save_property_ptr(ar, e, DirectedS()); + } + + save_in_edges(ar, g, DirectedS()); +} + +}} // namespace detail::parallel + +template <PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template <class IStreamConstructibleArchive> +void PBGL_DISTRIB_ADJLIST_TYPE::load(std::string const& filename) +{ + typedef typename config_type::VertexListS vertex_list_selector; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + synchronize(pg); + + std::vector<int> disk_files = detail::parallel::available_process_files(filename); + std::sort(disk_files.begin(), disk_files.end()); + + // Negotiate which process gets which file. Serialized. + std::vector<int> consumed_files; + int picked_file = -1; + + if (id > 0) + receive_oob(pg, id-1, 0, consumed_files); + + std::sort(consumed_files.begin(), consumed_files.end()); + std::vector<int> available_files; + std::set_difference( + disk_files.begin(), disk_files.end() + , consumed_files.begin(), consumed_files.end() + , std::back_inserter(available_files) + ); + + if (available_files.empty()) + boost::throw_exception(std::runtime_error("no file available")); + + // back() used for debug purposes. Making sure the + // ranks are shuffled. + picked_file = available_files.back(); + +# ifdef PBGL_SERIALIZE_DEBUG + std::cout << id << " picked " << picked_file << "\n"; +# endif + + consumed_files.push_back(picked_file); + + if (id < num_processes(pg) - 1) + send_oob(pg, id+1, 0, consumed_files); + + std::string local_filename = filename + "/" + + lexical_cast<std::string>(picked_file); + + std::ifstream in(local_filename.c_str(), std::ios_base::binary); + IStreamConstructibleArchive ar(in); + + detail::parallel::graph_loader< + graph_type, IStreamConstructibleArchive, InVertexListS + > loader(*this, ar); + +# ifdef PBGL_SERIALIZE_DEBUG + std::cout << "Process " << id << " done loading.\n"; +# endif + + synchronize(pg); +} + +template <PBGL_DISTRIB_ADJLIST_TEMPLATE_PARMS> +template <class OStreamConstructibleArchive> +void PBGL_DISTRIB_ADJLIST_TYPE::save(std::string const& filename) const +{ + // We retag the property list here so that bundled properties are + // properly placed into property<vertex_bundle_t, Bundle>. + typedef typename boost::detail::retag_property_list< + vertex_bundle_t, vertex_property_type + >::type vertex_property_type; + + typedef typename config_type::VertexListS vertex_list_selector; + + process_group_type pg = process_group(); + process_id_type id = process_id(pg); + + if (filesystem::exists(filename) && !filesystem::is_directory(filename)) + boost::throw_exception(std::runtime_error("entry exists, but is not a directory")); + + filesystem::remove_all(filename); + filesystem::create_directory(filename); + + synchronize(pg); + + std::string local_filename = filename + "/" + + lexical_cast<std::string>(id); + + std::ofstream out(local_filename.c_str(), std::ios_base::binary); + OStreamConstructibleArchive ar(out); + + using serialization::make_nvp; + + typename process_group_type::process_size_type num_processes_ = num_processes(pg); + ar << make_nvp("num_processes", num_processes_); + ar << BOOST_SERIALIZATION_NVP(id); + ar << make_nvp("mapping", this->distribution().mapping()); + + int V = num_vertices(*this); + ar << BOOST_SERIALIZATION_NVP(V); + + BGL_FORALL_VERTICES_T(v, *this, graph_type) + { + local_vertex_descriptor local_descriptor(local(v)); + detail::parallel::maybe_save_local_descriptor( + ar, local_descriptor, vertex_list_selector()); + detail::parallel::maybe_save_properties( + ar, "vertex_property" + , static_cast<vertex_property_type const&>(get(vertex_all_t(), *this, v)) + ); + } + + detail::parallel::save_edges(ar, *this, directed_selector()); + + ar << make_nvp("distribution", this->distribution()); +} + +} // namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_ADJLIST_SERIALIZATION_070925_HPP + diff --git a/Utilities/BGL/boost/graph/distributed/betweenness_centrality.hpp b/Utilities/BGL/boost/graph/distributed/betweenness_centrality.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3f23d7640f0b9083b1faca2a39fb185a922ce4d8 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/betweenness_centrality.hpp @@ -0,0 +1,1724 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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) + +// Authors: Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_BRANDES_BETWEENNESS_CENTRALITY_HPP +#define BOOST_GRAPH_PARALLEL_BRANDES_BETWEENNESS_CENTRALITY_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +// #define COMPUTE_PATH_COUNTS_INLINE + +#include <boost/graph/betweenness_centrality.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/config.hpp> + +// For additive_reducer +#include <boost/graph/distributed/distributed_graph_utility.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/named_function_params.hpp> + +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/graph/distributed/detail/dijkstra_shortest_paths.hpp> +#include <boost/tuple/tuple.hpp> + +// NGE - Needed for minstd_rand at L807, should pass vertex list +// or generator instead +#include <boost/random/linear_congruential.hpp> + +#include <algorithm> +#include <stack> +#include <vector> + +// Appending reducer +template <typename T> +struct append_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename K> + T operator()(const K&) const { return T(); } + + template<typename K> + T operator()(const K&, const T& x, const T& y) const + { + T z(x.begin(), x.end()); + for (typename T::const_iterator iter = y.begin(); iter != y.end(); ++iter) + if (std::find(z.begin(), z.end(), *iter) == z.end()) + z.push_back(*iter); + + return z; + } +}; + +namespace boost { + + namespace serialization { + + // TODO(nge): Write generalized serialization for tuples + template<typename Archive, typename T1, typename T2, typename T3, + typename T4> + void serialize(Archive & ar, + boost::tuple<T1,T2,T3, T4>& t, + const unsigned int) + { + ar & boost::tuples::get<0>(t); + ar & boost::tuples::get<1>(t); + ar & boost::tuples::get<2>(t); + ar & boost::tuples::get<3>(t); + } + + } // serialization + + template <typename OwnerMap, typename Tuple> + class get_owner_of_first_tuple_element { + + public: + typedef typename property_traits<OwnerMap>::value_type owner_type; + + get_owner_of_first_tuple_element(OwnerMap owner) : owner(owner) { } + + owner_type get_owner(Tuple t) { return get(owner, boost::tuples::get<0>(t)); } + + private: + OwnerMap owner; + }; + + template <typename OwnerMap, typename Tuple> + typename get_owner_of_first_tuple_element<OwnerMap, Tuple>::owner_type + get(get_owner_of_first_tuple_element<OwnerMap, Tuple> o, Tuple t) + { return o.get_owner(t); } + + template <typename OwnerMap> + class get_owner_of_first_pair_element { + + public: + typedef typename property_traits<OwnerMap>::value_type owner_type; + + get_owner_of_first_pair_element(OwnerMap owner) : owner(owner) { } + + template <typename Vertex, typename T> + owner_type get_owner(std::pair<Vertex, T> p) { return get(owner, p.first); } + + private: + OwnerMap owner; + }; + + template <typename OwnerMap, typename Vertex, typename T> + typename get_owner_of_first_pair_element<OwnerMap>::owner_type + get(get_owner_of_first_pair_element<OwnerMap> o, std::pair<Vertex, T> p) + { return o.get_owner(p); } + + namespace graph { namespace parallel { namespace detail { + + template<typename DistanceMap, typename IncomingMap> + class betweenness_centrality_msg_value + { + typedef typename property_traits<DistanceMap>::value_type distance_type; + typedef typename property_traits<IncomingMap>::value_type incoming_type; + typedef typename incoming_type::value_type incoming_value_type; + + public: + typedef std::pair<distance_type, incoming_value_type> type; + + static type create(distance_type dist, incoming_value_type source) + { return std::make_pair(dist, source); } + }; + + + /************************************************************************/ + /* Delta-stepping Betweenness Centrality */ + /************************************************************************/ + + template<typename Graph, typename DistanceMap, typename IncomingMap, + typename EdgeWeightMap, typename PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , typename IsSettledMap, typename VertexIndexMap +#endif + > + class betweenness_centrality_delta_stepping_impl { + // Could inherit from delta_stepping_impl to get run() method + // but for the time being it's just reproduced here + + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::degree_size_type Degree; + typedef typename property_traits<EdgeWeightMap>::value_type Dist; + typedef typename property_traits<IncomingMap>::value_type IncomingType; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + ProcessGroup; + + typedef std::list<Vertex> Bucket; + typedef typename Bucket::iterator BucketIterator; + typedef typename std::vector<Bucket*>::size_type BucketIndex; + + typedef betweenness_centrality_msg_value<DistanceMap, IncomingMap> + MessageValue; + + enum { + // Relax a remote vertex. The message contains a pair<Vertex, + // MessageValue>, the first part of which is the vertex whose + // tentative distance is being relaxed and the second part + // contains either the new distance (if there is no predecessor + // map) or a pair with the distance and predecessor. + msg_relax + }; + + public: + + // Must supply delta, ctor that guesses delta removed + betweenness_centrality_delta_stepping_impl(const Graph& g, + DistanceMap distance, + IncomingMap incoming, + EdgeWeightMap weight, + PathCountMap path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled, + VertexIndexMap vertex_index, +#endif + Dist delta); + + void run(Vertex s); + + private: + // Relax the edge (u, v), creating a new best path of distance x. + void relax(Vertex u, Vertex v, Dist x); + + // Synchronize all of the processes, by receiving all messages that + // have not yet been received. + void synchronize() + { + using boost::graph::parallel::synchronize; + synchronize(pg); + } + + // Setup triggers for msg_relax messages + void setup_triggers() + { + using boost::graph::parallel::simple_trigger; + simple_trigger(pg, msg_relax, this, + &betweenness_centrality_delta_stepping_impl::handle_msg_relax); + } + + void handle_msg_relax(int /*source*/, int /*tag*/, + const std::pair<Vertex, typename MessageValue::type>& data, + trigger_receive_context) + { relax(data.second.second, data.first, data.second.first); } + + const Graph& g; + IncomingMap incoming; + DistanceMap distance; + EdgeWeightMap weight; + PathCountMap path_count; +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled; + VertexIndexMap vertex_index; +#endif + Dist delta; + ProcessGroup pg; + typename property_map<Graph, vertex_owner_t>::const_type owner; + typename property_map<Graph, vertex_local_t>::const_type local; + + // A "property map" that contains the position of each vertex in + // whatever bucket it resides in. + std::vector<BucketIterator> position_in_bucket; + + // Bucket data structure. The ith bucket contains all local vertices + // with (tentative) distance in the range [i*delta, + // (i+1)*delta). + std::vector<Bucket*> buckets; + + // This "dummy" list is used only so that we can initialize the + // position_in_bucket property map with non-singular iterators. This + // won't matter for most implementations of the C++ Standard + // Library, but it avoids undefined behavior and allows us to run + // with library "debug modes". + std::list<Vertex> dummy_list; + + // A "property map" that states which vertices have been deleted + // from the bucket in this iteration. + std::vector<bool> vertex_was_deleted; + }; + + template<typename Graph, typename DistanceMap, typename IncomingMap, + typename EdgeWeightMap, typename PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , typename IsSettledMap, typename VertexIndexMap +#endif + > + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, EdgeWeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + >:: + betweenness_centrality_delta_stepping_impl(const Graph& g, + DistanceMap distance, + IncomingMap incoming, + EdgeWeightMap weight, + PathCountMap path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled, + VertexIndexMap vertex_index, +#endif + Dist delta) + : g(g), + incoming(incoming), + distance(distance), + weight(weight), + path_count(path_count), +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled(is_settled), + vertex_index(vertex_index), +#endif + delta(delta), + pg(boost::graph::parallel::process_group_adl(g), attach_distributed_object()), + owner(get(vertex_owner, g)), + local(get(vertex_local, g)) + + { setup_triggers(); } + + template<typename Graph, typename DistanceMap, typename IncomingMap, + typename EdgeWeightMap, typename PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , typename IsSettledMap, typename VertexIndexMap +#endif + > + void + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, EdgeWeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + >:: + run(Vertex s) + { + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + typename process_group_type::process_id_type id = process_id(pg); + + Dist inf = (std::numeric_limits<Dist>::max)(); + + // None of the vertices are stored in the bucket. + position_in_bucket.clear(); + position_in_bucket.resize(num_vertices(g), dummy_list.end()); + + // None of the vertices have been deleted + vertex_was_deleted.clear(); + vertex_was_deleted.resize(num_vertices(g), false); + + // No path from s to any other vertex, yet + BGL_FORALL_VERTICES_T(v, g, Graph) + put(distance, v, inf); + + // The distance to the starting node is zero + if (get(owner, s) == id) + // Put "s" into its bucket (bucket 0) + relax(s, s, 0); + else + // Note that we know the distance to s is zero + cache(distance, s, 0); + +#ifdef COMPUTE_PATH_COUNTS_INLINE + // Synchronize here to deliver initial relaxation since we don't + // synchronize at the beginning of the inner loop any more + synchronize(); + + // Incoming edge count map is an implementation detail and should + // be freed as soon as possible so build it here + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + std::vector<edges_size_type> incoming_edge_countS(num_vertices(g)); + iterator_property_map<typename std::vector<edges_size_type>::iterator, VertexIndexMap> + incoming_edge_count(incoming_edge_countS.begin(), vertex_index); +#endif + + BucketIndex max_bucket = (std::numeric_limits<BucketIndex>::max)(); + BucketIndex current_bucket = 0; + do { +#ifdef COMPUTE_PATH_COUNTS_INLINE + // We need to clear the outgoing map after every bucket so just build it here + std::vector<IncomingType> outgoingS(num_vertices(g)); + IncomingMap outgoing(outgoingS.begin(), vertex_index); + + outgoing.set_reduce(append_reducer<IncomingType>()); +#else + // Synchronize with all of the other processes. + synchronize(); +#endif + + // Find the next bucket that has something in it. + while (current_bucket < buckets.size() + && (!buckets[current_bucket] || buckets[current_bucket]->empty())) + ++current_bucket; + if (current_bucket >= buckets.size()) + current_bucket = max_bucket; + + // Find the smallest bucket (over all processes) that has vertices + // that need to be processed. + using boost::parallel::all_reduce; + using boost::parallel::minimum; + current_bucket = all_reduce(pg, current_bucket, minimum<BucketIndex>()); + + if (current_bucket == max_bucket) + // There are no non-empty buckets in any process; exit. + break; + + // Contains the set of vertices that have been deleted in the + // relaxation of "light" edges. Note that we keep track of which + // vertices were deleted with the property map + // "vertex_was_deleted". + std::vector<Vertex> deleted_vertices; + + // Repeatedly relax light edges + bool nonempty_bucket; + do { + // Someone has work to do in this bucket. + + if (current_bucket < buckets.size() && buckets[current_bucket]) { + Bucket& bucket = *buckets[current_bucket]; + // For each element in the bucket + while (!bucket.empty()) { + Vertex u = bucket.front(); + + // Remove u from the front of the bucket + bucket.pop_front(); + + // Insert u into the set of deleted vertices, if it hasn't + // been done already. + if (!vertex_was_deleted[get(local, u)]) { + vertex_was_deleted[get(local, u)] = true; + deleted_vertices.push_back(u); + } + + // Relax each light edge. + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) <= delta) // light edge + relax(u, target(e, g), u_dist + get(weight, e)); + } + } + + // Synchronize with all of the other processes. + synchronize(); + + // Is the bucket empty now? + nonempty_bucket = (current_bucket < buckets.size() + && buckets[current_bucket] + && !buckets[current_bucket]->empty()); + } while (all_reduce(pg, nonempty_bucket, std::logical_or<bool>())); + + // Relax heavy edges for each of the vertices that we previously + // deleted. + for (typename std::vector<Vertex>::iterator iter = deleted_vertices.begin(); + iter != deleted_vertices.end(); ++iter) { + // Relax each heavy edge. + Vertex u = *iter; + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) > delta) // heavy edge + relax(u, target(e, g), u_dist + get(weight, e)); + +#ifdef COMPUTE_PATH_COUNTS_INLINE + // Set outgoing paths + IncomingType in = get(incoming, u); + for (typename IncomingType::iterator pred = in.begin(); pred != in.end(); ++pred) + if (get(owner, *pred) == id) { + IncomingType x = get(outgoing, *pred); + if (std::find(x.begin(), x.end(), u) == x.end()) + x.push_back(u); + put(outgoing, *pred, x); + } else { + IncomingType in; + in.push_back(u); + put(outgoing, *pred, in); + } + + // Set incoming edge counts + put(incoming_edge_count, u, in.size()); +#endif + } + +#ifdef COMPUTE_PATH_COUNTS_INLINE + synchronize(); // Deliver heavy edge relaxations and outgoing paths + + // Build Queue + typedef typename property_traits<PathCountMap>::value_type PathCountType; + typedef std::pair<Vertex, PathCountType> queue_value_type; + typedef typename property_map<Graph, vertex_owner_t>::const_type OwnerMap; + typedef typename get_owner_of_first_pair_element<OwnerMap> IndirectOwnerMap; + + typedef boost::queue<queue_value_type> local_queue_type; + typedef boost::graph::distributed::distributed_queue<process_group_type, + IndirectOwnerMap, + local_queue_type> dist_queue_type; + + IndirectOwnerMap indirect_owner(owner); + dist_queue_type Q(pg, indirect_owner); + + // Find sources to initialize queue + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(is_settled, v) && !(get(outgoing, v).empty())) { + put(incoming_edge_count, v, 1); + Q.push(std::make_pair(v, 0)); // Push this vertex with no additional path count + } + } + + // Set path counts for vertices in this bucket + while (!Q.empty()) { + queue_value_type t = Q.top(); Q.pop(); + Vertex v = t.first; + PathCountType p = t.second; + + put(path_count, v, get(path_count, v) + p); + put(incoming_edge_count, v, get(incoming_edge_count, v) - 1); + + if (get(incoming_edge_count, v) == 0) { + IncomingType out = get(outgoing, v); + for (typename IncomingType::iterator iter = out.begin(); iter != out.end(); ++iter) + Q.push(std::make_pair(*iter, get(path_count, v))); + } + } + + // Mark the vertices in this bucket settled + for (typename std::vector<Vertex>::iterator iter = deleted_vertices.begin(); + iter != deleted_vertices.end(); ++iter) + put(is_settled, *iter, true); + + // No need to clear path count map as it is never read/written remotely + // No need to clear outgoing map as it is re-alloced every bucket +#endif + + // Go to the next bucket: the current bucket must already be empty. + ++current_bucket; + } while (true); + + // Delete all of the buckets. + for (typename std::vector<Bucket*>::iterator iter = buckets.begin(); + iter != buckets.end(); ++iter) { + if (*iter) { + delete *iter; + *iter = 0; + } + } + } + + template<typename Graph, typename DistanceMap, typename IncomingMap, + typename EdgeWeightMap, typename PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , typename IsSettledMap, typename VertexIndexMap +#endif + > + void + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, EdgeWeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + >:: + relax(Vertex u, Vertex v, Dist x) + { + + if (x <= get(distance, v)) { + + // We're relaxing the edge to vertex v. + if (get(owner, v) == process_id(pg)) { + if (x < get(distance, v)) { + // Compute the new bucket index for v + BucketIndex new_index = static_cast<BucketIndex>(x / delta); + + // Make sure there is enough room in the buckets data structure. + if (new_index >= buckets.size()) buckets.resize(new_index + 1, 0); + + // Make sure that we have allocated the bucket itself. + if (!buckets[new_index]) buckets[new_index] = new Bucket; + + if (get(distance, v) != (std::numeric_limits<Dist>::max)() + && !vertex_was_deleted[get(local, v)]) { + // We're moving v from an old bucket into a new one. Compute + // the old index, then splice it in. + BucketIndex old_index + = static_cast<BucketIndex>(get(distance, v) / delta); + buckets[new_index]->splice(buckets[new_index]->end(), + *buckets[old_index], + position_in_bucket[get(local, v)]); + } else { + // We're inserting v into a bucket for the first time. Put it + // at the end. + buckets[new_index]->push_back(v); + } + + // v is now at the last position in the new bucket + position_in_bucket[get(local, v)] = buckets[new_index]->end(); + --position_in_bucket[get(local, v)]; + + // Update tentative distance information and incoming, path_count + if (u != v) put(incoming, v, IncomingType(1, u)); + put(distance, v, x); + } // u != v covers initial source relaxation and self-loops + else if (x == get(distance, v) && u != v) { + + // Add incoming edge if it's not already in the list + IncomingType in = get(incoming, v); + if (std::find(in.begin(), in.end(), u) == in.end()) { + in.push_back(u); + put(incoming, v, in); + } + } + } else { + // The vertex is remote: send a request to the vertex's owner + send(pg, get(owner, v), msg_relax, + std::make_pair(v, MessageValue::create(x, u))); + + // Cache tentative distance information + cache(distance, v, x); + } + } + } + + /************************************************************************/ + /* Shortest Paths function object for betweenness centrality */ + /************************************************************************/ + + template<typename WeightMap> + struct brandes_shortest_paths { + typedef typename property_traits<WeightMap>::value_type weight_type; + + brandes_shortest_paths() + : weight(1), delta(0) { } + brandes_shortest_paths(weight_type delta) + : weight(1), delta(delta) { } + brandes_shortest_paths(WeightMap w) + : weight(w), delta(0) { } + brandes_shortest_paths(WeightMap w, weight_type delta) + : weight(w), delta(delta) { } + + template<typename Graph, typename IncomingMap, typename DistanceMap, + typename PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , typename IsSettledMap, typename VertexIndexMap +#endif + + > + void + operator()(Graph& g, + typename graph_traits<Graph>::vertex_descriptor s, + IncomingMap incoming, + DistanceMap distance, + PathCountMap path_count +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap is_settled, + VertexIndexMap vertex_index +#endif + ) + { + typedef typename property_traits<DistanceMap>::value_type + distance_type; + + typedef std::plus<distance_type> Combine; + typedef std::less<distance_type> Compare; + + // The "distance" map needs to act like one, retrieving the default + // value of infinity. + set_property_map_role(vertex_distance, distance); + + // Only calculate delta the first time operator() is called + // This presumes g is the same every time, but so does the fact + // that we're reusing the weight map + if (delta == 0) + set_delta(g); + + // TODO (NGE): Restructure the code so we don't have to construct + // impl every time? + betweenness_centrality_delta_stepping_impl< + Graph, DistanceMap, IncomingMap, WeightMap, PathCountMap +#ifdef COMPUTE_PATH_COUNTS_INLINE + , IsSettledMap, VertexIndexMap +#endif + > + impl(g, distance, incoming, weight, path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled, vertex_index, +#endif + delta); + + impl.run(s); + } + + private: + + template <typename Graph> + void + set_delta(const Graph& g) + { + using boost::parallel::all_reduce; + using boost::parallel::maximum; + using std::max; + + typedef typename graph_traits<Graph>::degree_size_type Degree; + typedef weight_type Dist; + + // Compute the maximum edge weight and degree + Dist max_edge_weight = 0; + Degree max_degree = 0; + BGL_FORALL_VERTICES_T(u, g, Graph) { + max_degree = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_degree, out_degree(u, g)); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + max_edge_weight = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_edge_weight, get(weight, e)); + } + + max_edge_weight = all_reduce(process_group(g), max_edge_weight, maximum<Dist>()); + max_degree = all_reduce(process_group(g), max_degree, maximum<Degree>()); + + // Take a guess at delta, based on what works well for random + // graphs. + delta = max_edge_weight / max_degree; + if (delta == 0) + delta = 1; + } + + WeightMap weight; + weight_type delta; + }; + + // Perform a single SSSP from the specified vertex and update the centrality map(s) + template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename IncomingMap, typename DistanceMap, typename DependencyMap, + typename PathCountMap, +#ifdef COMPUTE_PATH_COUNTS_INLINE + typename IsSettledMap, +#endif + typename VertexIndexMap, typename ShortestPaths> + void + do_brandes_sssp(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + IsSettledMap is_settled, +#endif + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + typename graph_traits<Graph>::vertex_descriptor s) + { + using boost::detail::graph::update_centrality; + using boost::graph::parallel::process_group; + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + typedef typename property_traits<IncomingMap>::value_type incoming_type; + typedef typename property_traits<DistanceMap>::value_type distance_type; + typedef typename property_traits<DependencyMap>::value_type dependency_type; + typedef typename property_traits<PathCountMap>::value_type path_count_type; + + typedef typename incoming_type::iterator incoming_iterator; + + typedef typename property_map<Graph, vertex_owner_t>::const_type OwnerMap; + OwnerMap owner = get(vertex_owner, g); + + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + process_group_type pg = process_group(g); + typename process_group_type::process_id_type id = process_id(pg); + + // TODO: Is it faster not to clear some of these maps? + // Initialize for this iteration + distance.clear(); + incoming.clear(); + path_count.clear(); + dependency.clear(); + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(path_count, v, 0); + put(dependency, v, 0); + } + + if (get(owner, s) == id) { + put(incoming, s, incoming_type()); +#ifdef COMPUTE_PATH_COUNTS_INLINE + put(path_count, s, 1); + put(is_settled, s, true); +#endif + } + + // Execute the shortest paths algorithm. This will be either + // a weighted or unweighted customized breadth-first search, + shortest_paths(g, s, incoming, distance, path_count +#ifdef COMPUTE_PATH_COUNTS_INLINE + , is_settled, vertex_index +#endif + ); + +#ifndef COMPUTE_PATH_COUNTS_INLINE + + // + // TODO: Optimize case where source has no out-edges + // + + // Count of incoming edges to tell when all incoming edges have been relaxed in + // the induced shortest paths DAG + std::vector<edges_size_type> incoming_edge_countS(num_vertices(g)); + iterator_property_map<typename std::vector<edges_size_type>::iterator, VertexIndexMap> + incoming_edge_count(incoming_edge_countS.begin(), vertex_index); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(incoming_edge_count, v, get(incoming, v).size()); + } + + if (get(owner, s) == id) { + put(incoming_edge_count, s, 1); + put(incoming, s, incoming_type()); + } + + std::vector<incoming_type> outgoingS(num_vertices(g)); + iterator_property_map<typename std::vector<incoming_type>::iterator, VertexIndexMap> + outgoing(outgoingS.begin(), vertex_index); + + outgoing.set_reduce(append_reducer<incoming_type>()); + + // Mark forward adjacencies in DAG of shortest paths + + // TODO: It's possible to do this using edge flags but it's not currently done this way + // because during traversal of the DAG we would have to examine all out edges + // which would lead to more memory accesses and a larger cache footprint. + // + // In the bidirectional graph case edge flags would be an excellent way of marking + // edges in the DAG of shortest paths + BGL_FORALL_VERTICES_T(v, g, Graph) { + incoming_type i = get(incoming, v); + for (typename incoming_type::iterator iter = i.begin(); iter != i.end(); ++iter) { + if (get(owner, *iter) == id) { + incoming_type x = get(outgoing, *iter); + if (std::find(x.begin(), x.end(), v) == x.end()) + x.push_back(v); + put(outgoing, *iter, x); + } else { + incoming_type in; + in.push_back(v); + put(outgoing, *iter, in); + } + } + } + + synchronize(pg); + + // Traverse DAG induced by forward edges in dependency order and compute path counts + { + typedef std::pair<vertex_descriptor, path_count_type> queue_value_type; + typedef get_owner_of_first_pair_element<OwnerMap> IndirectOwnerMap; + + typedef boost::queue<queue_value_type> local_queue_type; + typedef boost::graph::distributed::distributed_queue<process_group_type, + IndirectOwnerMap, + local_queue_type> dist_queue_type; + + IndirectOwnerMap indirect_owner(owner); + dist_queue_type Q(pg, indirect_owner); + + if (get(owner, s) == id) + Q.push(std::make_pair(s, 1)); + + while (!Q.empty()) { + queue_value_type t = Q.top(); Q.pop(); + vertex_descriptor v = t.first; + path_count_type p = t.second; + + put(path_count, v, get(path_count, v) + p); + put(incoming_edge_count, v, get(incoming_edge_count, v) - 1); + + if (get(incoming_edge_count, v) == 0) { + incoming_type out = get(outgoing, v); + for (typename incoming_type::iterator iter = out.begin(); iter != out.end(); ++iter) + Q.push(std::make_pair(*iter, get(path_count, v))); + } + } + } + +#endif // COMPUTE_PATH_COUNTS_INLINE + + // + // Compute dependencies + // + + + // Build the distributed_queue + // Value type consists of 1) target of update 2) source of update + // 3) dependency of source 4) path count of source + typedef boost::tuple<vertex_descriptor, vertex_descriptor, dependency_type, path_count_type> + queue_value_type; + typedef get_owner_of_first_tuple_element<OwnerMap, queue_value_type> IndirectOwnerMap; + + typedef boost::queue<queue_value_type> local_queue_type; + typedef boost::graph::distributed::distributed_queue<process_group_type, + IndirectOwnerMap, + local_queue_type> dist_queue_type; + + IndirectOwnerMap indirect_owner(owner); + dist_queue_type Q(pg, indirect_owner); + + // Calculate number of vertices each vertex depends on, when a vertex has been pushed + // that number of times then we will update it + // AND Request path counts of sources of incoming edges + std::vector<dependency_type> dependency_countS(num_vertices(g), 0); + iterator_property_map<typename std::vector<dependency_type>::iterator, VertexIndexMap> + dependency_count(dependency_countS.begin(), vertex_index); + + dependency_count.set_reduce(boost::graph::distributed::additive_reducer<dependency_type>()); + + path_count.set_max_ghost_cells(0); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(distance, v) < (std::numeric_limits<distance_type>::max)()) { + incoming_type el = get(incoming, v); + for (incoming_iterator vw = el.begin(); vw != el.end(); ++vw) { + if (get(owner, *vw) == id) + put(dependency_count, *vw, get(dependency_count, *vw) + 1); + else { + put(dependency_count, *vw, 1); + + // Request path counts + get(path_count, *vw); + } + + // request() doesn't work here, perhaps because we don't have a copy of this + // ghost cell already? + } + } + } + + synchronize(pg); + + // Push vertices with non-zero distance/path count and zero dependency count + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(distance, v) < (std::numeric_limits<distance_type>::max)() + && get(dependency_count, v) == 0) + Q.push(boost::make_tuple(v, v, get(dependency, v), get(path_count, v))); + } + + dependency.set_max_ghost_cells(0); + while(!Q.empty()) { + + queue_value_type x = Q.top(); Q.pop(); + vertex_descriptor w = boost::tuples::get<0>(x); + vertex_descriptor source = boost::tuples::get<1>(x); + dependency_type dep = boost::tuples::get<2>(x); + path_count_type pc = boost::tuples::get<3>(x); + + cache(dependency, source, dep); + cache(path_count, source, pc); + + if (get(dependency_count, w) != 0) + put(dependency_count, w, get(dependency_count, w) - 1); + + if (get(dependency_count, w) == 0) { + + // Update dependency and centrality of sources of incoming edges + incoming_type el = get(incoming, w); + for (incoming_iterator vw = el.begin(); vw != el.end(); ++vw) { + vertex_descriptor v = *vw; + + assert(get(path_count, w) != 0); + + dependency_type factor = dependency_type(get(path_count, v)) + / dependency_type(get(path_count, w)); + factor *= (dependency_type(1) + get(dependency, w)); + + if (get(owner, v) == id) + put(dependency, v, get(dependency, v) + factor); + else + put(dependency, v, factor); + + update_centrality(edge_centrality_map, v, factor); + } + + if (w != s) + update_centrality(centrality, w, get(dependency, w)); + + // Push sources of edges in incoming edge list + for (incoming_iterator vw = el.begin(); vw != el.end(); ++vw) + Q.push(boost::make_tuple(*vw, w, get(dependency, w), get(path_count, w))); + } + } + } + + template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename IncomingMap, typename DistanceMap, typename DependencyMap, + typename PathCountMap, typename VertexIndexMap, typename ShortestPaths, + typename Buffer> + void + brandes_betweenness_centrality_impl(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + Buffer sources) + { + using boost::detail::graph::init_centrality_map; + using boost::detail::graph::divide_centrality_by_two; + using boost::graph::parallel::process_group; + + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::edge_iterator edge_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + + typedef typename property_traits<DistanceMap>::value_type distance_type; + typedef typename property_traits<DependencyMap>::value_type dependency_type; + + // Initialize centrality + init_centrality_map(vertices(g), centrality); + init_centrality_map(edges(g), edge_centrality_map); + + // Set the reduction operation on the dependency map to be addition + dependency.set_reduce(boost::graph::distributed::additive_reducer<dependency_type>()); + distance.set_reduce(boost::graph::distributed::choose_min_reducer<distance_type>()); + + // Don't allow remote procs to write incoming or path_count maps + // updating them is handled inside the betweenness_centrality_queue + incoming.set_consistency_model(0); + path_count.set_consistency_model(0); + + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + process_group_type pg = process_group(g); + +#ifdef COMPUTE_PATH_COUNTS_INLINE + // Build is_settled maps + std::vector<bool> is_settledS(num_vertices(g)); + typedef iterator_property_map<std::vector<bool>::iterator, VertexIndexMap> + IsSettledMap; + + IsSettledMap is_settled(is_settledS.begin(), vertex_index); +#endif + + if (!sources.empty()) { + // DO SSSPs + while (!sources.empty()) { + do_brandes_sssp(g, centrality, edge_centrality_map, incoming, distance, + dependency, path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled, +#endif + vertex_index, shortest_paths, sources.top()); + sources.pop(); + } + } else { // Exact Betweenness Centrality + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + vertices_size_type n = num_vertices(g); + n = boost::parallel::all_reduce(pg, n, std::plus<vertices_size_type>()); + + for (vertices_size_type i = 0; i < n; ++i) { + vertex_descriptor v = vertex(i, g); + + do_brandes_sssp(g, centrality, edge_centrality_map, incoming, distance, + dependency, path_count, +#ifdef COMPUTE_PATH_COUNTS_INLINE + is_settled, +#endif + vertex_index, shortest_paths, v); + } + } + + typedef typename graph_traits<Graph>::directed_category directed_category; + const bool is_undirected = + is_convertible<directed_category*, undirected_tag*>::value; + if (is_undirected) { + divide_centrality_by_two(vertices(g), centrality); + divide_centrality_by_two(edges(g), edge_centrality_map); + } + } + + template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename IncomingMap, typename DistanceMap, typename DependencyMap, + typename PathCountMap, typename VertexIndexMap, typename ShortestPaths, + typename Stack> + void + do_sequential_brandes_sssp(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + Stack& ordered_vertices, + typename graph_traits<Graph>::vertex_descriptor v) + { + using boost::detail::graph::update_centrality; + + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + typedef typename property_traits<IncomingMap>::value_type incoming_type; + + // Initialize for this iteration + BGL_FORALL_VERTICES_T(w, g, Graph) { + // put(path_count, w, 0); + incoming[w].clear(); + put(dependency, w, 0); + } + + put(path_count, v, 1); + incoming[v].clear(); + + // Execute the shortest paths algorithm. This will be either + // Dijkstra's algorithm or a customized breadth-first search, + // depending on whether the graph is weighted or unweighted. + shortest_paths(g, v, ordered_vertices, incoming, distance, + path_count, vertex_index); + + while (!ordered_vertices.empty()) { + vertex_descriptor w = ordered_vertices.top(); + ordered_vertices.pop(); + + typedef typename property_traits<IncomingMap>::value_type + incoming_type; + typedef typename incoming_type::iterator incoming_iterator; + typedef typename property_traits<DependencyMap>::value_type + dependency_type; + + for (incoming_iterator vw = incoming[w].begin(); + vw != incoming[w].end(); ++vw) { + vertex_descriptor v = source(*vw, g); + dependency_type factor = dependency_type(get(path_count, v)) + / dependency_type(get(path_count, w)); + factor *= (dependency_type(1) + get(dependency, w)); + put(dependency, v, get(dependency, v) + factor); + update_centrality(edge_centrality_map, *vw, factor); + } + + if (w != v) { + update_centrality(centrality, w, get(dependency, w)); + } + } + } + + // Betweenness Centrality variant that duplicates graph across processors + // and parallizes SSSPs + // This function expects a non-distributed graph and property-maps + template<typename ProcessGroup, typename Graph, + typename CentralityMap, typename EdgeCentralityMap, + typename IncomingMap, typename DistanceMap, + typename DependencyMap, typename PathCountMap, + typename VertexIndexMap, typename ShortestPaths, + typename Buffer> + void + non_distributed_brandes_betweenness_centrality_impl(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, // P + DistanceMap distance, // d + DependencyMap dependency, // delta + PathCountMap path_count, // sigma + VertexIndexMap vertex_index, + ShortestPaths shortest_paths, + Buffer sources) + { + using boost::detail::graph::init_centrality_map; + using boost::detail::graph::divide_centrality_by_two; + using boost::graph::parallel::process_group; + + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::edge_iterator edge_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + + typedef typename property_traits<DistanceMap>::value_type distance_type; + + typedef ProcessGroup process_group_type; + + typename process_group_type::process_id_type id = process_id(pg); + typename process_group_type::process_size_type p = num_processes(pg); + + // Initialize centrality + init_centrality_map(vertices(g), centrality); + init_centrality_map(edges(g), edge_centrality_map); + + std::stack<vertex_descriptor> ordered_vertices; + + if (!sources.empty()) { + std::vector<vertex_descriptor> local_sources; + + for (int i = 0; i < id; ++i) if (!sources.empty()) sources.pop(); + while (!sources.empty()) { + local_sources.push_back(sources.top()); + + for (int i = 0; i < p; ++i) if (!sources.empty()) sources.pop(); + } + + // DO SSSPs + for(size_t i = 0; i < local_sources.size(); ++i) + do_sequential_brandes_sssp(g, centrality, edge_centrality_map, incoming, + distance, dependency, path_count, vertex_index, + shortest_paths, ordered_vertices, local_sources[i]); + + } else { // Exact Betweenness Centrality + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + vertices_size_type n = num_vertices(g); + + for (vertices_size_type i = id; i < n; i += p) { + vertex_descriptor v = vertex(i, g); + + do_sequential_brandes_sssp(g, centrality, edge_centrality_map, incoming, + distance, dependency, path_count, vertex_index, + shortest_paths, ordered_vertices, v); + } + } + + typedef typename graph_traits<Graph>::directed_category directed_category; + const bool is_undirected = + is_convertible<directed_category*, undirected_tag*>::value; + if (is_undirected) { + divide_centrality_by_two(vertices(g), centrality); + divide_centrality_by_two(edges(g), edge_centrality_map); + } + + // Merge the centrality maps by summing the values at each vertex) + // TODO(nge): this copy-out, reduce, copy-in is lame + typedef typename property_traits<CentralityMap>::value_type centrality_type; + typedef typename property_traits<EdgeCentralityMap>::value_type edge_centrality_type; + + std::vector<centrality_type> centrality_v(num_vertices(g)); + std::vector<edge_centrality_type> edge_centrality_v; + edge_centrality_v.reserve(num_edges(g)); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + centrality_v[get(vertex_index, v)] = get(centrality, v); + } + + // Skip when EdgeCentralityMap is a dummy_property_map + if (!is_same<EdgeCentralityMap, dummy_property_map>::value) { + BGL_FORALL_EDGES_T(e, g, Graph) { + edge_centrality_v.push_back(get(edge_centrality_map, e)); + } + // NGE: If we trust that the order of elements in the vector isn't changed in the + // all_reduce below then this method avoids the need for an edge index map + } + + using boost::parallel::all_reduce; + + all_reduce(pg, ¢rality_v[0], ¢rality_v[centrality_v.size()], + ¢rality_v[0], std::plus<centrality_type>()); + + if (edge_centrality_v.size()) + all_reduce(pg, &edge_centrality_v[0], &edge_centrality_v[edge_centrality_v.size()], + &edge_centrality_v[0], std::plus<edge_centrality_type>()); + + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(centrality, v, centrality_v[get(vertex_index, v)]); + } + + // Skip when EdgeCentralityMap is a dummy_property_map + if (!is_same<EdgeCentralityMap, dummy_property_map>::value) { + int i = 0; + BGL_FORALL_EDGES_T(e, g, Graph) { + put(edge_centrality_map, e, edge_centrality_v[i]); + ++i; + } + } + } + +} } } // end namespace graph::parallel::detail + +template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename IncomingMap, typename DistanceMap, typename DependencyMap, + typename PathCountMap, typename VertexIndexMap, typename Buffer> +void +brandes_betweenness_centrality(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + Buffer sources, + typename property_traits<DistanceMap>::value_type delta + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef typename property_traits<DistanceMap>::value_type distance_type; + typedef static_property_map<distance_type> WeightMap; + + graph::parallel::detail::brandes_shortest_paths<WeightMap> + shortest_paths(delta); + + graph::parallel::detail::brandes_betweenness_centrality_impl(g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename IncomingMap, typename DistanceMap, typename DependencyMap, + typename PathCountMap, typename VertexIndexMap, typename WeightMap, + typename Buffer> +void +brandes_betweenness_centrality(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + Buffer sources, + typename property_traits<WeightMap>::value_type delta, + WeightMap weight_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + graph::parallel::detail::brandes_shortest_paths<WeightMap> shortest_paths(weight_map, delta); + + graph::parallel::detail::brandes_betweenness_centrality_impl(g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +namespace graph { namespace parallel { namespace detail { + template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename WeightMap, typename VertexIndexMap, typename Buffer> + void + brandes_betweenness_centrality_dispatch2(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + WeightMap weight_map, + VertexIndexMap vertex_index, + Buffer sources, + typename property_traits<WeightMap>::value_type delta) + { + typedef typename graph_traits<Graph>::degree_size_type degree_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_c<(is_same<CentralityMap, + dummy_property_map>::value), + EdgeCentralityMap, + CentralityMap>::type a_centrality_map; + typedef typename property_traits<a_centrality_map>::value_type + centrality_type; + + typename graph_traits<Graph>::vertices_size_type V = num_vertices(g); + + std::vector<std::vector<vertex_descriptor> > incoming(V); + std::vector<centrality_type> distance(V); + std::vector<centrality_type> dependency(V); + std::vector<degree_size_type> path_count(V); + + brandes_betweenness_centrality( + g, centrality, edge_centrality_map, + make_iterator_property_map(incoming.begin(), vertex_index), + make_iterator_property_map(distance.begin(), vertex_index), + make_iterator_property_map(dependency.begin(), vertex_index), + make_iterator_property_map(path_count.begin(), vertex_index), + vertex_index, unwrap_ref(sources), delta, + weight_map); + } + + // TODO: Should the type of the distance and dependency map depend on the + // value type of the centrality map? + template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename VertexIndexMap, typename Buffer> + void + brandes_betweenness_centrality_dispatch2(const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, + Buffer sources, + typename graph_traits<Graph>::edges_size_type delta) + { + typedef typename graph_traits<Graph>::degree_size_type degree_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_c<(is_same<CentralityMap, + dummy_property_map>::value), + EdgeCentralityMap, + CentralityMap>::type a_centrality_map; + + typename graph_traits<Graph>::vertices_size_type V = num_vertices(g); + + std::vector<std::vector<vertex_descriptor> > incoming(V); + std::vector<edges_size_type> distance(V); + std::vector<edges_size_type> dependency(V); + std::vector<degree_size_type> path_count(V); + + brandes_betweenness_centrality( + g, centrality, edge_centrality_map, + make_iterator_property_map(incoming.begin(), vertex_index), + make_iterator_property_map(distance.begin(), vertex_index), + make_iterator_property_map(dependency.begin(), vertex_index), + make_iterator_property_map(path_count.begin(), vertex_index), + vertex_index, unwrap_ref(sources), delta); + } + + template<typename WeightMap> + struct brandes_betweenness_centrality_dispatch1 + { + template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename VertexIndexMap, typename Buffer> + static void + run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, Buffer sources, + typename property_traits<WeightMap>::value_type delta, WeightMap weight_map) + { + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, edge_centrality_map, weight_map, vertex_index, sources, delta); + } + }; + + template<> + struct brandes_betweenness_centrality_dispatch1<boost::detail::error_property_not_found> + { + template<typename Graph, typename CentralityMap, typename EdgeCentralityMap, + typename VertexIndexMap, typename Buffer> + static void + run(const Graph& g, CentralityMap centrality, EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, Buffer sources, + typename graph_traits<Graph>::edges_size_type delta, + boost::detail::error_property_not_found) + { + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, edge_centrality_map, vertex_index, sources, delta); + } + }; + +} } } // end namespace graph::parallel::detail + +template<typename Graph, typename Param, typename Tag, typename Rest> +void +brandes_betweenness_centrality(const Graph& g, + const bgl_named_params<Param,Tag,Rest>& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef bgl_named_params<Param,Tag,Rest> named_params; + + typedef queue<typename graph_traits<Graph>::vertex_descriptor> queue_t; + queue_t q; + + typedef typename property_value<named_params, edge_weight_t>::type ew; + graph::parallel::detail::brandes_betweenness_centrality_dispatch1<ew>::run( + g, + choose_param(get_param(params, vertex_centrality), + dummy_property_map()), + choose_param(get_param(params, edge_centrality), + dummy_property_map()), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + choose_param(get_param(params, buffer_param_t()), boost::ref(q)), + choose_param(get_param(params, lookahead_t()), 0), + get_param(params, edge_weight)); +} + +template<typename Graph, typename CentralityMap> +void +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef queue<typename graph_traits<Graph>::vertex_descriptor> queue_t; + queue_t q; + + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, dummy_property_map(), get(vertex_index, g), boost::ref(q), 0); +} + +template<typename Graph, typename CentralityMap, typename EdgeCentralityMap> +void +brandes_betweenness_centrality(const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef queue<int> queue_t; + queue_t q; + + boost::graph::parallel::detail::brandes_betweenness_centrality_dispatch2( + g, centrality, edge_centrality_map, get(vertex_index, g), boost::ref(q), 0); +} + +template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename EdgeCentralityMap, typename IncomingMap, typename DistanceMap, + typename DependencyMap, typename PathCountMap, typename VertexIndexMap, + typename Buffer> +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + Buffer sources) +{ + typedef typename property_traits<DistanceMap>::value_type distance_type; + typedef static_property_map<distance_type> WeightMap; + + detail::graph::brandes_unweighted_shortest_paths shortest_paths; + + graph::parallel::detail::non_distributed_brandes_betweenness_centrality_impl(pg, g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename EdgeCentralityMap, typename IncomingMap, typename DistanceMap, + typename DependencyMap, typename PathCountMap, typename VertexIndexMap, + typename WeightMap, typename Buffer> +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + IncomingMap incoming, + DistanceMap distance, + DependencyMap dependency, + PathCountMap path_count, + VertexIndexMap vertex_index, + WeightMap weight_map, + Buffer sources) +{ + detail::graph::brandes_dijkstra_shortest_paths<WeightMap> shortest_paths(weight_map); + + graph::parallel::detail::non_distributed_brandes_betweenness_centrality_impl(pg, g, centrality, + edge_centrality_map, + incoming, distance, + dependency, path_count, + vertex_index, + shortest_paths, + sources); +} + +namespace detail { namespace graph { + template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename EdgeCentralityMap, typename WeightMap, typename VertexIndexMap, + typename Buffer> + void + non_distributed_brandes_betweenness_centrality_dispatch2(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + WeightMap weight_map, + VertexIndexMap vertex_index, + Buffer sources) + { + typedef typename graph_traits<Graph>::degree_size_type degree_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename mpl::if_c<(is_same<CentralityMap, + dummy_property_map>::value), + EdgeCentralityMap, + CentralityMap>::type a_centrality_map; + typedef typename property_traits<a_centrality_map>::value_type + centrality_type; + + typename graph_traits<Graph>::vertices_size_type V = num_vertices(g); + + std::vector<std::vector<edge_descriptor> > incoming(V); + std::vector<centrality_type> distance(V); + std::vector<centrality_type> dependency(V); + std::vector<degree_size_type> path_count(V); + + non_distributed_brandes_betweenness_centrality( + pg, g, centrality, edge_centrality_map, + make_iterator_property_map(incoming.begin(), vertex_index), + make_iterator_property_map(distance.begin(), vertex_index), + make_iterator_property_map(dependency.begin(), vertex_index), + make_iterator_property_map(path_count.begin(), vertex_index), + vertex_index, weight_map, unwrap_ref(sources)); + } + + + template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename EdgeCentralityMap, typename VertexIndexMap, typename Buffer> + void + non_distributed_brandes_betweenness_centrality_dispatch2(const ProcessGroup& pg, + const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + VertexIndexMap vertex_index, + Buffer sources) + { + typedef typename graph_traits<Graph>::degree_size_type degree_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename mpl::if_c<(is_same<CentralityMap, + dummy_property_map>::value), + EdgeCentralityMap, + CentralityMap>::type a_centrality_map; + typedef typename property_traits<a_centrality_map>::value_type + centrality_type; + + typename graph_traits<Graph>::vertices_size_type V = num_vertices(g); + + std::vector<std::vector<edge_descriptor> > incoming(V); + std::vector<centrality_type> distance(V); + std::vector<centrality_type> dependency(V); + std::vector<degree_size_type> path_count(V); + + non_distributed_brandes_betweenness_centrality( + pg, g, centrality, edge_centrality_map, + make_iterator_property_map(incoming.begin(), vertex_index), + make_iterator_property_map(distance.begin(), vertex_index), + make_iterator_property_map(dependency.begin(), vertex_index), + make_iterator_property_map(path_count.begin(), vertex_index), + vertex_index, unwrap_ref(sources)); + } + + template<typename WeightMap> + struct non_distributed_brandes_betweenness_centrality_dispatch1 + { + template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename EdgeCentralityMap, typename VertexIndexMap, typename Buffer> + static void + run(const ProcessGroup& pg, const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, + Buffer sources, WeightMap weight_map) + { + non_distributed_brandes_betweenness_centrality_dispatch2(pg, g, centrality, edge_centrality_map, + weight_map, vertex_index, sources); + } + }; + + template<> + struct non_distributed_brandes_betweenness_centrality_dispatch1<detail::error_property_not_found> + { + template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename EdgeCentralityMap, typename VertexIndexMap, typename Buffer> + static void + run(const ProcessGroup& pg, const Graph& g, CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, + Buffer sources, detail::error_property_not_found) + { + non_distributed_brandes_betweenness_centrality_dispatch2(pg, g, centrality, edge_centrality_map, + vertex_index, sources); + } + }; + +} } // end namespace detail::graph + +template<typename ProcessGroup, typename Graph, typename Param, typename Tag, typename Rest> +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + const bgl_named_params<Param,Tag,Rest>& params) +{ + typedef bgl_named_params<Param,Tag,Rest> named_params; + + typedef queue<int> queue_t; + queue_t q; + + typedef typename property_value<named_params, edge_weight_t>::type ew; + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch1<ew>::run( + pg, g, + choose_param(get_param(params, vertex_centrality), + dummy_property_map()), + choose_param(get_param(params, edge_centrality), + dummy_property_map()), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + choose_param(get_param(params, buffer_param_t()), boost::ref(q)), + get_param(params, edge_weight)); +} + +template<typename ProcessGroup, typename Graph, typename CentralityMap> +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + CentralityMap centrality) +{ + typedef queue<int> queue_t; + queue_t q; + + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch2( + pg, g, centrality, dummy_property_map(), get(vertex_index, g), boost::ref(q)); +} + +template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename Buffer> +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + CentralityMap centrality, Buffer sources) +{ + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch2( + pg, g, centrality, dummy_property_map(), get(vertex_index, g), sources); +} + +template<typename ProcessGroup, typename Graph, typename CentralityMap, + typename EdgeCentralityMap, typename Buffer> +void +non_distributed_brandes_betweenness_centrality(const ProcessGroup& pg, const Graph& g, + CentralityMap centrality, + EdgeCentralityMap edge_centrality_map, + Buffer sources) +{ + detail::graph::non_distributed_brandes_betweenness_centrality_dispatch2( + pg, g, centrality, edge_centrality_map, get(vertex_index, g), sources); +} + +// Compute the central point dominance of a graph. +// TODO: Make sure central point dominance works in parallel case +template<typename Graph, typename CentralityMap> +typename property_traits<CentralityMap>::value_type +central_point_dominance(const Graph& g, CentralityMap centrality + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + using std::max; + + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename property_traits<CentralityMap>::value_type centrality_type; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + process_group_type pg = boost::graph::parallel::process_group(g); + + vertices_size_type n = num_vertices(g); + + using boost::parallel::all_reduce; + n = all_reduce(pg, n, std::plus<vertices_size_type>()); + + // Find max centrality + centrality_type max_centrality(0); + vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + max_centrality = (max)(max_centrality, get(centrality, *v)); + } + + // All reduce to get global max centrality + max_centrality = all_reduce(pg, max_centrality, boost::parallel::maximum<centrality_type>()); + + // Compute central point dominance + centrality_type sum(0); + for (tie(v, v_end) = vertices(g); v != v_end; ++v) { + sum += (max_centrality - get(centrality, *v)); + } + + sum = all_reduce(pg, sum, std::plus<centrality_type>()); + + return sum/(n-1); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_BRANDES_BETWEENNESS_CENTRALITY_HPP diff --git a/Utilities/BGL/boost/graph/distributed/boman_et_al_graph_coloring.hpp b/Utilities/BGL/boost/graph/distributed/boman_et_al_graph_coloring.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c65f80fa619fef0c55fb85d0a9cc09ddda5db822 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/boman_et_al_graph_coloring.hpp @@ -0,0 +1,372 @@ +// Copyright (C) 2005-2008 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_BOMAN_ET_AL_GRAPH_COLORING_HPP +#define BOOST_GRAPH_DISTRIBUTED_BOMAN_ET_AL_GRAPH_COLORING_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <functional> +#include <vector> +#include <utility> +#include <boost/graph/iteration_macros.hpp> +#include <boost/optional.hpp> +#include <cassert> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/graph/properties.hpp> + +#ifdef PBGL_ACCOUNTING +# include <boost/graph/accounting.hpp> +#endif // PBGL_ACCOUNTING + +namespace boost { namespace graph { namespace distributed { + +/************************************************************************** + * This source file implements the distributed graph coloring algorithm * + * by Boman et al in: * + * * + * Erik G. Boman, Doruk Bozdag, Umit Catalyurek, Assefaw H. Gebremedhin,* + * and Fredrik Manne. A Scalable Parallel Graph Coloring Algorithm for * + * Distributed Memory Computers. [unpublished preprint?] * + * * + **************************************************************************/ + +#ifdef PBGL_ACCOUNTING +struct boman_et_al_graph_coloring_stats_t +{ + /* The size of the blocks to step through (i.e., the parameter s). */ + std::size_t block_size; + + /* Total wall-clock time used by the algorithm.*/ + accounting::time_type execution_time; + + /* The number of conflicts that occurred during execution. */ + std::size_t conflicts; + + /* The number of supersteps. */ + std::size_t supersteps; + + /* The number of colors used. */ + std::size_t num_colors; + + template<typename OutputStream> + void print(OutputStream& out) + { + out << "Problem = \"Coloring\"\n" + << "Algorithm = \"Boman et al\"\n" + << "Function = boman_et_al_graph_coloring\n" + << "(P) Block size = " << block_size << "\n" + << "Wall clock time = " << accounting::print_time(execution_time) + << "\nConflicts = " << conflicts << "\n" + << "Supersteps = " << supersteps << "\n" + << "(R) Colors = " << num_colors << "\n"; + } +}; + +static boman_et_al_graph_coloring_stats_t boman_et_al_graph_coloring_stats; +#endif + +namespace detail { + template<typename T> + struct graph_coloring_reduce + { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename Key> + T operator()(const Key&) const { return (std::numeric_limits<T>::max)(); } + + template<typename Key> T operator()(const Key&, T, T y) const { return y; } + }; +} + +template<typename Color> +struct first_fit_color +{ + template<typename T> + Color operator()(const std::vector<T>& marked, T marked_true) + { + Color k = 0; + while (k < (Color)marked.size() && marked[k] == marked_true) + ++k; + return k; + } +}; + +template<typename DistributedGraph, typename ColorMap, typename ChooseColor, + typename VertexOrdering, typename VertexIndexMap> +typename property_traits<ColorMap>::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, + ColorMap color, + typename graph_traits<DistributedGraph>::vertices_size_type s, + ChooseColor choose_color, + VertexOrdering ordering, VertexIndexMap vertex_index) +{ + using namespace boost::graph::parallel; + using boost::parallel::all_reduce; + + typename property_map<DistributedGraph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + typedef typename process_group_type<DistributedGraph>::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename graph_traits<DistributedGraph>::vertex_descriptor Vertex; + typedef typename graph_traits<DistributedGraph>::edge_descriptor Edge; + typedef typename graph_traits<DistributedGraph>::vertices_size_type + vertices_size_type; + typedef typename property_traits<ColorMap>::value_type color_type; + typedef unsigned long long iterations_type; + typedef typename std::vector<Vertex>::iterator vertex_set_iterator; + typedef std::pair<Vertex, color_type> message_type; + +#ifdef PBGL_ACCOUNTING + boman_et_al_graph_coloring_stats.block_size = s; + boman_et_al_graph_coloring_stats.execution_time = accounting::get_time(); + boman_et_al_graph_coloring_stats.conflicts = 0; + boman_et_al_graph_coloring_stats.supersteps = 0; +#endif + + // Initialize color map + color_type no_color = (std::numeric_limits<color_type>::max)(); + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) + put(color, v, no_color); + color.set_reduce(detail::graph_coloring_reduce<color_type>()); + + // Determine if we'll be using synchronous or asynchronous communication. + typedef typename process_group_type::communication_category + communication_category; + static const bool asynchronous = + is_convertible<communication_category, immediate_process_group_tag>::value; + process_group_type pg = process_group(g); + + // U_i <- V_i + std::vector<Vertex> vertices_to_color(vertices(g).first, vertices(g).second); + + iterations_type iter_num = 1, outer_iter_num = 1; + std::vector<iterations_type> marked; + std::vector<iterations_type> marked_conflicting(num_vertices(g), 0); + std::vector<bool> sent_to_processors; + + std::size_t rounds = vertices_to_color.size() / s + + (vertices_to_color.size() % s == 0? 0 : 1); + rounds = all_reduce(pg, rounds, boost::parallel::maximum<std::size_t>()); + +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Number of rounds = " << rounds << std::endl; +#endif + + while (rounds > 0) { + if (!vertices_to_color.empty()) { + // Set of conflicting vertices + std::vector<Vertex> conflicting_vertices; + + vertex_set_iterator first = vertices_to_color.begin(); + while (first != vertices_to_color.end()) { + // For each subset of size s (or smaller for the last subset) + vertex_set_iterator start = first; + for (vertices_size_type counter = s; + first != vertices_to_color.end() && counter > 0; + ++first, --counter) { + // This vertex hasn't been sent to anyone yet + sent_to_processors.assign(num_processes(pg), false); + sent_to_processors[process_id(pg)] = true; + + // Mark all of the colors that we see + BGL_FORALL_OUTEDGES_T(*first, e, g, DistributedGraph) { + color_type k = get(color, target(e, g)); + if (k != no_color) { + if (k >= (color_type)marked.size()) marked.resize(k + 1, 0); + marked[k] = iter_num; + } + } + + // Find a color for this vertex + put(color, *first, choose_color(marked, iter_num)); + +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Chose color " << get(color, *first) << " for vertex " + << *first << std::endl; +#endif + + // Send this vertex's color to the owner of the edge target. + BGL_FORALL_OUTEDGES_T(*first, e, g, DistributedGraph) { + if (!sent_to_processors[get(owner, target(e, g))]) { + send(pg, get(owner, target(e, g)), 17, + message_type(source(e, g), get(color, source(e, g)))); + sent_to_processors[get(owner, target(e, g))] = true; + } + } + + ++iter_num; + } + + // Synchronize for non-immediate process groups. + if (!asynchronous) { + --rounds; + synchronize(pg); + } + + // Receive boundary colors from other processors + while (optional<std::pair<process_id_type, int> > stp = probe(pg)) { + assert(stp->second == 17); + message_type msg; + receive(pg, stp->first, stp->second, msg); + cache(color, msg.first, msg.second); +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Cached color " << msg.second << " for vertex " + << msg.first << std::endl; +#endif + } + + // Compute the set of conflicting vertices + // [start, first) contains all vertices in this subset + for (vertex_set_iterator vi = start; vi != first; ++vi) { + Vertex v = *vi; + BGL_FORALL_OUTEDGES_T(v, e, g, DistributedGraph) { + Vertex w = target(e, g); + if (get(owner, w) != process_id(pg) // boundary vertex + && marked_conflicting[get(vertex_index, v)] != outer_iter_num + && get(color, v) == get(color, w) + && ordering(v, w)) { + conflicting_vertices.push_back(v); + marked_conflicting[get(vertex_index, v)] = outer_iter_num; + put(color, v, no_color); +#ifdef PBGL_GRAPH_COLORING_DEBUG + std::cerr << "Vertex " << v << " has a conflict with vertex " + << w << std::endl; +#endif + break; + } + } + } + +#ifdef PBGL_ACCOUNTING + boman_et_al_graph_coloring_stats.conflicts += + conflicting_vertices.size(); +#endif + } + + if (asynchronous) synchronize(pg); + else { + while (rounds > 0) { + synchronize(pg); + --rounds; + } + } + conflicting_vertices.swap(vertices_to_color); + ++outer_iter_num; + } else { + if (asynchronous) synchronize(pg); + else { + while (rounds > 0) { + synchronize(pg); + --rounds; + } + } + } + + // Receive boundary colors from other processors + while (optional<std::pair<process_id_type, int> > stp = probe(pg)) { + assert(stp->second == 17); + message_type msg; + receive(pg, stp->first, stp->second, msg); + cache(color, msg.first, msg.second); + } + + rounds = vertices_to_color.size() / s + + (vertices_to_color.size() % s == 0? 0 : 1); + rounds = all_reduce(pg, rounds, boost::parallel::maximum<std::size_t>()); + +#ifdef PBGL_ACCOUNTING + ++boman_et_al_graph_coloring_stats.supersteps; +#endif + } + + // Determine the number of colors used. + color_type num_colors = 0; + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + color_type k = get(color, v); + assert(k != no_color); + if (k != no_color) { + if (k >= (color_type)marked.size()) marked.resize(k + 1, 0); // TBD: perf? + if (marked[k] != iter_num) { + marked[k] = iter_num; + ++num_colors; + } + } + } + + num_colors = + all_reduce(pg, num_colors, boost::parallel::maximum<color_type>()); + + +#ifdef PBGL_ACCOUNTING + boman_et_al_graph_coloring_stats.execution_time = + accounting::get_time() - boman_et_al_graph_coloring_stats.execution_time; + + boman_et_al_graph_coloring_stats.conflicts = + all_reduce(pg, boman_et_al_graph_coloring_stats.conflicts, + std::plus<color_type>()); + boman_et_al_graph_coloring_stats.num_colors = num_colors; +#endif + + return num_colors; +} + + +template<typename DistributedGraph, typename ColorMap, typename ChooseColor, + typename VertexOrdering> +inline typename property_traits<ColorMap>::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, ColorMap color, + typename graph_traits<DistributedGraph>::vertices_size_type s, + ChooseColor choose_color, VertexOrdering ordering) +{ + return boman_et_al_graph_coloring(g, color, s, choose_color, ordering, + get(vertex_index, g)); +} + +template<typename DistributedGraph, typename ColorMap, typename ChooseColor> +inline typename property_traits<ColorMap>::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, + ColorMap color, + typename graph_traits<DistributedGraph>::vertices_size_type s, + ChooseColor choose_color) +{ + typedef typename graph_traits<DistributedGraph>::vertex_descriptor + vertex_descriptor; + return boman_et_al_graph_coloring(g, color, s, choose_color, + std::less<vertex_descriptor>()); +} + +template<typename DistributedGraph, typename ColorMap> +inline typename property_traits<ColorMap>::value_type +boman_et_al_graph_coloring + (const DistributedGraph& g, + ColorMap color, + typename graph_traits<DistributedGraph>::vertices_size_type s = 100) +{ + typedef typename property_traits<ColorMap>::value_type Color; + return boman_et_al_graph_coloring(g, color, s, first_fit_color<Color>()); +} + +} } } // end namespace boost::graph::distributed + +namespace boost { namespace graph { +using distributed::boman_et_al_graph_coloring; +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_DISTRIBUTED_BOMAN_ET_AL_GRAPH_COLORING_HPP diff --git a/Utilities/BGL/boost/graph/distributed/breadth_first_search.hpp b/Utilities/BGL/boost/graph/distributed/breadth_first_search.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c987585f5fd79c182ffc2e1bb9717a473ce58034 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/breadth_first_search.hpp @@ -0,0 +1,164 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_BFS_HPP +#define BOOST_GRAPH_PARALLEL_BFS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/breadth_first_search.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/graph/distributed/detail/filtered_queue.hpp> +#include <boost/graph/distributed/queue.hpp> +#include <boost/dynamic_bitset.hpp> +#include <boost/pending/queue.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/parallel/container_traits.hpp> + +namespace boost { + namespace detail { + /** @brief A unary predicate that decides when to push into a + * breadth-first search queue. + * + * This predicate stores a color map that is used to determine + * when to push. If it is provided with a key for which the color + * is white, it darkens the color to gray and returns true (so + * that the value will be pushed appropriately); if the color is + * not white, it returns false so that the vertex will be + * ignored. + */ + template<typename ColorMap> + struct darken_and_push + { + typedef typename property_traits<ColorMap>::key_type argument_type; + typedef bool result_type; + + explicit darken_and_push(const ColorMap& color) : color(color) { } + + bool operator()(const argument_type& value) const + { + typedef color_traits<typename property_traits<ColorMap>::value_type> + Color; + if (get(color, value) == Color::white()) { + put(color, value, Color::gray()); + return true; + } else { + return false; + } + } + + ColorMap color; + }; + + template<typename IndexMap> + struct has_not_been_seen + { + typedef bool result_type; + + has_not_been_seen() { } + + has_not_been_seen(std::size_t n, IndexMap index_map) + : seen(n), index_map(index_map) {} + + template<typename Key> + result_type operator()(Key key) + { + bool result = seen[get(index_map, key)]; + seen[get(index_map, key)] = true; + return !result; + } + + void swap(has_not_been_seen& other) + { + using std::swap; + swap(seen, other.seen); + swap(index_map, other.index_map); + } + + private: + dynamic_bitset<> seen; + IndexMap index_map; + }; + + template<typename IndexMap> + inline void + swap(has_not_been_seen<IndexMap>& x, has_not_been_seen<IndexMap>& y) + { + x.swap(y); + } + + template <class DistributedGraph, class ColorMap, class BFSVisitor, + class BufferRef, class VertexIndexMap> + inline void + parallel_bfs_helper + (DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + BufferRef Q, + VertexIndexMap) + { + set_property_map_role(vertex_color, color); + color.set_consistency_model(0); + breadth_first_search(g, s, Q.ref, vis, color); + } + + template <class DistributedGraph, class ColorMap, class BFSVisitor, + class VertexIndexMap> + void parallel_bfs_helper + (DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + ColorMap color, + BFSVisitor vis, + error_property_not_found, + VertexIndexMap vertex_index) + { + using boost::graph::parallel::process_group; + + typedef graph_traits<DistributedGraph> Traits; + typedef typename Traits::vertex_descriptor Vertex; + typedef typename boost::graph::parallel::process_group_type<DistributedGraph>::type + process_group_type; + + set_property_map_role(vertex_color, color); + color.set_consistency_model(0); + + // Buffer default + typedef typename property_map<DistributedGraph, vertex_owner_t> + ::const_type vertex_owner_map; + typedef boost::graph::distributed::distributed_queue< + process_group_type, vertex_owner_map, queue<Vertex>, + detail::darken_and_push<ColorMap> > queue_t; + queue_t Q(process_group(g), + get(vertex_owner, g), + detail::darken_and_push<ColorMap>(color)); + breadth_first_search(g, s, Q, vis, color); + } + + 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_GRAPH_ENABLE_IF_MODELS(DistributedGraph, distributed_graph_tag, + void)*) + { + parallel_bfs_helper + (g, s, color, vis, get_param(params, buffer_param_t()), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index)); + } + } +} + +#endif // BOOST_GRAPH_PARALLEL_BFS_HPP diff --git a/Utilities/BGL/boost/graph/distributed/compressed_sparse_row_graph.hpp b/Utilities/BGL/boost/graph/distributed/compressed_sparse_row_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..49654d6da57e2b0379e9b0ce81e4d5b55826233d --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/compressed_sparse_row_graph.hpp @@ -0,0 +1,2064 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// 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 +// Jeremiah Willcock +// Andrew Lumsdaine + +// Distributed compressed sparse row graph type + +#ifndef BOOST_GRAPH_DISTRIBUTED_CSR_HPP +#define BOOST_GRAPH_DISTRIBUTED_CSR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/compressed_sparse_row_graph.hpp> +#include <boost/graph/distributed/selector.hpp> +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/parallel/distribution.hpp> +#include <boost/property_map/parallel/local_property_map.hpp> +#include <boost/property_map/parallel/distributed_property_map.hpp> + +namespace boost { + +// Distributed and sequential inplace ctors have the same signature so +// we need a separate tag for distributed inplace ctors +enum distributed_construct_inplace_from_sources_and_targets_t + {distributed_construct_inplace_from_sources_and_targets}; + +// The number of bits we reserve for the processor ID. +// DPG TBD: This is a hack. It will eventually be a run-time quantity. +static const int processor_bits = 8; + +// Tag class for a distributed CSR graph +struct distributed_csr_tag + : public virtual distributed_graph_tag, + public virtual distributed_vertex_list_graph_tag, + public virtual distributed_edge_list_graph_tag, + public virtual incidence_graph_tag, + public virtual adjacency_graph_tag {}; + +template<typename VertexProperty, typename EdgeProperty, + typename GraphProperty, typename ProcessGroup, typename InVertex, + typename InDistribution, typename InEdgeIndex> +class compressed_sparse_row_graph< + directedS, VertexProperty, EdgeProperty, GraphProperty, + distributedS<ProcessGroup, InVertex, InDistribution>, + InEdgeIndex> +{ + typedef compressed_sparse_row_graph self_type; + + private: + /** + * Determine the type used to represent vertices in the graph. If + * the user has overridden the default, use the user's + * parameter. Otherwise, fall back to std::size_t. + */ + typedef typename mpl::if_<is_same<InVertex, defaultS>, + std::size_t, + InVertex>::type Vertex; + + /** + * Determine the type used to represent edges in the graph. If + * the user has overridden the default (which is to be the same as + * the distributed vertex selector type), use the user's + * parameter. Otherwise, fall back to the value of @c Vertex. + */ + typedef typename mpl::if_<is_same<InEdgeIndex, + distributedS<ProcessGroup, InVertex, + InDistribution> >, + Vertex, + InEdgeIndex>::type EdgeIndex; + + public: + /** + * The type of the CSR graph that will be stored locally. + */ + typedef compressed_sparse_row_graph<directedS, VertexProperty, EdgeProperty, + GraphProperty, Vertex, EdgeIndex> + base_type; + + // ----------------------------------------------------------------- + // Graph concept requirements + typedef Vertex vertex_descriptor; + typedef typename graph_traits<base_type>::edge_descriptor edge_descriptor; + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; + typedef distributed_csr_tag traversal_category; + static vertex_descriptor null_vertex(); + + // ----------------------------------------------------------------- + // Distributed Vertex List Graph concept requirements + typedef Vertex vertices_size_type; + class vertex_iterator; + + // ----------------------------------------------------------------- + // Distributed Edge List Graph concept requirements + typedef EdgeIndex edges_size_type; + class edge_iterator; + + // ----------------------------------------------------------------- + // Incidence Graph concept requirements + typedef typename graph_traits<base_type>::out_edge_iterator + out_edge_iterator; + typedef typename graph_traits<base_type>::degree_size_type + degree_size_type; + + // ----------------------------------------------------------------- + // Adjacency Graph concept requirements + typedef typename graph_traits<base_type>::adjacency_iterator + adjacency_iterator; + + // Note: This graph type does not model Bidirectional Graph. + // However, this typedef is required to satisfy graph_traits. + typedef void in_edge_iterator; + + // ----------------------------------------------------------------- + // Distributed Container concept requirements + typedef ProcessGroup process_group_type; + typedef boost::parallel::variant_distribution<process_group_type, Vertex> + distribution_type; + + // ----------------------------------------------------------------- + // Workarounds + typedef no_property vertex_property_type; + typedef no_property edge_property_type; + typedef typename mpl::if_<is_void<VertexProperty>, + void****, + VertexProperty>::type vertex_bundled; + typedef typename mpl::if_<is_void<EdgeProperty>, + void****, + EdgeProperty>::type edge_bundled; + + // ----------------------------------------------------------------- + // Useful types + typedef typename ProcessGroup::process_id_type process_id_type; + + // ----------------------------------------------------------------- + // Graph constructors + compressed_sparse_row_graph(const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)) {} + + compressed_sparse_row_graph(const GraphProperty& prop, + const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)) {} + + compressed_sparse_row_graph(vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)), + m_base(numverts) + {} + + compressed_sparse_row_graph(vertices_size_type numverts, + const GraphProperty& prop, + const ProcessGroup& pg = ProcessGroup()) + : m_process_group(pg), m_distribution(parallel::block(pg, 0)), + m_base(numverts) + {} + + template <typename Distribution> + compressed_sparse_row_graph(vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist) + : m_process_group(pg), m_distribution(dist), m_base(numverts) {} + + template <typename Distribution> + compressed_sparse_row_graph(vertices_size_type numverts, + const GraphProperty& prop, + const ProcessGroup& pg, + const Distribution& dist) + : m_process_group(pg), m_distribution(dist), m_base(numverts) {} + + template <typename InputIterator> + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename InputIterator, typename Distribution> + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template <typename InputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename InputIterator, typename EdgePropertyIterator, + typename Distribution> + compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template <typename InputIterator> + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges = 0, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename InputIterator, typename Distribution> + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template <typename InputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + edges_size_type numedges = 0, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename InputIterator, typename EdgePropertyIterator, + typename Distribution> + compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template <typename MultiPassInputIterator> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename MultiPassInputIterator, typename Distribution> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template <typename MultiPassInputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename MultiPassInputIterator, typename EdgePropertyIterator, + typename Distribution> + compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template <typename Source> + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename Distribution, typename Source> + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template <typename Source> + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + std::vector<edge_bundled>& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template <typename Distribution, typename Source> + compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + std::vector<edge_bundled>& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template<typename InputIterator> + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template<typename InputIterator, typename EdgePropertyIterator> + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg = ProcessGroup(), + const GraphProperty& prop = GraphProperty()); + + template<typename InputIterator, typename Distribution> + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + template<typename InputIterator, typename EdgePropertyIterator, + typename Distribution> + compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop = GraphProperty()); + + base_type& base() { return m_base; } + const base_type& base() const { return m_base; } + + process_group_type process_group() const { return m_process_group.base(); } + + distribution_type& distribution() { return m_distribution; } + const distribution_type& distribution() const { return m_distribution; } + + // Directly access a vertex or edge bundle + vertex_bundled& operator[](vertex_descriptor v) + { + std::pair<process_id_type, vertex_descriptor> locator + = get(vertex_global, *this, v); + assert(locator.first == process_id(m_process_group)); + return base().m_vertex_properties[locator.second]; + } + + const vertex_bundled& operator[](vertex_descriptor v) const + { + std::pair<process_id_type, vertex_descriptor> locator + = get(vertex_global, *this, v); + assert(locator.first == process_id(m_process_group)); + return base().m_process_group[locator.second]; + } + + edge_bundled& operator[](edge_descriptor e) + { + assert(get(vertex_owner, *this, e.src) == process_id(m_process_group)); + return base().m_edge_properties[e.idx]; + } + + const edge_bundled& operator[](edge_descriptor e) const + { + assert(get(vertex_owner, *this, e.src) == process_id(m_process_group)); + return base().m_edge_properties[e.idx]; + } + + // Create a vertex descriptor from a process ID and a local index. + vertex_descriptor + make_vertex_descriptor(process_id_type p, vertex_descriptor v) const + { + vertex_descriptor vertex_local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + return v | ((vertex_descriptor)p << vertex_local_index_bits); + } + + // Convert a local vertex descriptor into a global vertex descriptor + vertex_descriptor local_to_global_vertex(vertex_descriptor v) const + { + return make_vertex_descriptor(process_id(m_process_group), v); + } + + // Structural modification + vertex_descriptor add_vertex() + { + typename graph_traits<base_type>::vertex_descriptor v + = boost::add_vertex(m_base); + + return make_vertex_descriptor(process_id(m_process_group), v); + } + + vertex_descriptor add_vertex(const vertex_bundled& p) + { + typename graph_traits<base_type>::vertex_descriptor v + = boost::add_vertex(m_base, p); + + return make_vertex_descriptor(process_id(m_process_group), v); + } + + vertex_descriptor add_vertices(vertices_size_type count) + { + typename graph_traits<base_type>::vertex_descriptor v + = boost::add_vertices(count, m_base); + + return make_vertex_descriptor(process_id(m_process_group), v); + } + + template <typename InputIterator> + void + add_edges(InputIterator first, InputIterator last) + { boost::add_edges_global(first, last, get(vertex_local, *this), m_base); } + + template <typename InputIterator, typename EdgePropertyIterator> + void + add_edges(InputIterator first, InputIterator last, + EdgePropertyIterator ep_iter, + EdgePropertyIterator ep_iter_end) + { boost::add_edges_global(first, last, ep_iter, ep_iter_end, + get(vertex_local, *this), m_base); } + + template <typename InputIterator> + void + add_edges_sorted(InputIterator first, InputIterator last) + { boost::add_edges_sorted_global(first, last, + get(vertex_local, *this), m_base); } + + template <typename InputIterator, typename EdgePropertyIterator> + void + add_edges_sorted(InputIterator first_sorted, InputIterator last_sorted, + EdgePropertyIterator ep_iter_sorted) + { boost::add_edges_sorted_global(first_sorted, last_sorted, ep_iter_sorted, + get(vertex_local, *this), m_base); } + + protected: + ProcessGroup m_process_group; + distribution_type m_distribution; + base_type m_base; +}; + +/** @brief Helper macro containing the template parameters for the + * distributed CSR graph. + * + * This macro contains all of the template parameters needed for the + * distributed compressed_sparse_row graph type. It is used to reduce + * the amount of typing required to declare free functions for this + * graph type. + */ +#define BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS \ + typename VertexProperty, typename EdgeProperty, \ + typename GraphProperty, typename ProcessGroup, typename InVertex, \ + typename InDistribution, typename InEdgeIndex + +/** @brief Helper macro containing the typical instantiation of the + * distributed CSR graph. + * + * This macro contains an instantiation of the distributed CSR graph + * type using the typical template parameters names (e.g., those + * provided by the macro @c + * BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS). It is used to reduce + * the amount of typing required to declare free functions for this + * graph type. + */ +#define BOOST_DISTRIB_CSR_GRAPH_TYPE \ + compressed_sparse_row_graph< \ + directedS, VertexProperty, EdgeProperty, GraphProperty, \ + distributedS<ProcessGroup, InVertex, InDistribution>, \ + InEdgeIndex> + +// ----------------------------------------------------------------- +// Graph concept operations +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +BOOST_DISTRIB_CSR_GRAPH_TYPE::null_vertex() +{ + return graph_traits<base_type>::null_vertex(); +} + +// ----------------------------------------------------------------- +// Incidence Graph concept operations +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +source(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_DISTRIB_CSR_GRAPH_TYPE&) +{ return e.src; } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +target(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor e, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return target(e, g.base()); } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator> +out_edges(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor u, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type + edges_size_type; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor ed; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator it; + edges_size_type u_local = get(vertex_local, g, u); + edges_size_type u_row_start = g.base().m_forward.m_rowstart[u_local]; + edges_size_type next_row_start = g.base().m_forward.m_rowstart[u_local + 1]; + return std::make_pair(it(ed(u, u_row_start)), + it(ed(u, (std::max)(u_row_start, next_row_start)))); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::degree_size_type +out_degree(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor u, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return out_degree(get(vertex_local, g, u), g.base()); +} + +// ----------------------------------------------------------------- +// DistributedGraph concept requirements +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +void synchronize(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE graph_type; + synchronize(g.process_group()); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +ProcessGroup +process_group(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.process_group(); } + + +// ----------------------------------------------------------------- +// Adjacency Graph concept requirements +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_DISTRIB_CSR_GRAPH_TYPE::adjacency_iterator, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::adjacency_iterator> +adjacent_vertices(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor u, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return adjacent_vertices(get(vertex_local, g, u), g.base()); +} + +// ----------------------------------------------------------------- +// Distributed Vertex List Graph concept operations +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_iterator + : public iterator_adaptor<vertex_iterator, + counting_iterator<Vertex>, + Vertex, + random_access_traversal_tag, + Vertex> +{ + typedef iterator_adaptor<vertex_iterator, + counting_iterator<Vertex>, + Vertex, + random_access_traversal_tag, + Vertex> inherited; + public: + vertex_iterator() {} + + explicit vertex_iterator(Vertex v, const self_type* graph) + : inherited(counting_iterator<Vertex>(v)), graph(graph) { } + + Vertex dereference() const + { + return graph->local_to_global_vertex(*(this->base_reference())); + } + + friend class iterator_core_access; + + private: + const self_type* graph; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::degree_size_type +num_vertices(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return num_vertices(g.base()); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_iterator, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_iterator> +vertices(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_iterator + vertex_iterator; + return std::make_pair(vertex_iterator(0, &g), + vertex_iterator(num_vertices(g), &g)); +} + +// ----------------------------------------------------------------- +// Distributed Edge List Graph concept operations +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_iterator +{ + public: + typedef std::forward_iterator_tag iterator_category; + typedef edge_descriptor value_type; + + typedef const edge_descriptor* pointer; + + typedef edge_descriptor reference; + typedef typename int_t<CHAR_BIT * sizeof(EdgeIndex)>::fast difference_type; + + edge_iterator() : graph(0), current_edge(), end_of_this_vertex(0) {} + + edge_iterator(const compressed_sparse_row_graph& graph, + edge_descriptor current_edge, + EdgeIndex end_of_this_vertex) + : graph(&graph), local_src(current_edge.src), current_edge(current_edge), + end_of_this_vertex(end_of_this_vertex) + { + // The edge that comes in has a local source vertex. Make it global. + current_edge.src = graph.local_to_global_vertex(current_edge.src); + } + + // From InputIterator + reference operator*() const { return current_edge; } + pointer operator->() const { return ¤t_edge; } + + bool operator==(const edge_iterator& o) const { + return current_edge == o.current_edge; + } + bool operator!=(const edge_iterator& o) const { + return current_edge != o.current_edge; + } + + edge_iterator& operator++() + { + ++current_edge.idx; + while (current_edge.idx == end_of_this_vertex && local_src < num_vertices(*graph)-1) { + ++local_src; + current_edge.src = graph->local_to_global_vertex(local_src); + end_of_this_vertex = graph->base().m_forward.m_rowstart[local_src + 1]; + } + return *this; + } + + edge_iterator operator++(int) { + edge_iterator temp = *this; + ++*this; + return temp; + } + + private: + const compressed_sparse_row_graph* graph; + EdgeIndex local_src; + edge_descriptor current_edge; + EdgeIndex end_of_this_vertex; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type +num_edges(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return g.base().m_forward.m_column.size(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +std::pair<typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_iterator, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_iterator> +edges(const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor Vertex; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_iterator ei; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor edgedesc; + if (g.base().m_forward.m_rowstart.size() == 1 || + g.base().m_forward.m_column.empty()) { + return std::make_pair(ei(), ei()); + } else { + // Find the first vertex that has outgoing edges + Vertex src = 0; + while (g.base().m_forward.m_rowstart[src + 1] == 0) ++src; + return std::make_pair(ei(g, edgedesc(src, 0), g.base().m_forward.m_rowstart[src + 1]), + ei(g, edgedesc(num_vertices(g), g.base().m_forward.m_column.size()), 0)); + } +} + +// ----------------------------------------------------------------- +// Graph constructors + +// Returns true if a vertex belongs to a process according to a distribution +template <typename OwnerMap, typename ProcessId> +struct local_vertex { + + local_vertex(OwnerMap owner, ProcessId id) + : owner(owner), id(id) {} + + template <typename Vertex> + bool operator()(Vertex x) + { return get(owner, x) == id; } + + template <typename Vertex> + bool operator()(Vertex x) const + { return get(owner, x) == id; } + +private: + OwnerMap owner; + ProcessId id; +}; + +// Returns true if a vertex belongs to a process according to a distribution +template <typename OwnerMap, typename ProcessId> +struct local_edge { + + local_edge(OwnerMap owner, ProcessId id) + : owner(owner), id(id) {} + + template <typename Vertex> + bool operator()(std::pair<Vertex, Vertex>& x) + { return get(owner, x.first) == id; } + + template <typename Vertex> + bool operator()(const std::pair<Vertex, Vertex>& x) const + { return get(owner, x.first) == id; } + +private: + OwnerMap owner; + ProcessId id; +}; + +// Turns an index iterator into a vertex iterator +template<typename IndexIterator, typename Graph> +class index_to_vertex_iterator { + +public: + typedef std::input_iterator_tag iterator_category; + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef std::pair<Vertex, Vertex> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + index_to_vertex_iterator(IndexIterator index, + const Graph& g) + : index(index), g(g), current(to_edge(*index)) {} + + reference operator*() { current = to_edge(*index); return current; } + pointer operator->() { current = to_edge(*index); return ¤t; } + + index_to_vertex_iterator& operator++() + { + ++index; + return *this; + } + + index_to_vertex_iterator operator++(int) + { + index_to_vertex_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const index_to_vertex_iterator& other) const + { return index == other.index; } + + bool operator!=(const index_to_vertex_iterator& other) const + { return !(*this == other); } + +private: + value_type to_edge(const typename std::iterator_traits<IndexIterator>::value_type& x) + { return std::make_pair(vertex(x.first, g), vertex(x.second, g)); } + + IndexIterator index; + const Graph& g; + value_type current; +}; + +template <typename Distribution, typename Graph> +struct index_to_vertex_func { + + typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename boost::graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef std::pair<vertex_descriptor, vertex_descriptor> result_type; + typedef std::pair<vertices_size_type, vertices_size_type> base_iterator_type; + + index_to_vertex_func(const Distribution& dist, const Graph& g) + : dist(dist), g(g) {} + + + result_type operator()(const base_iterator_type& p) const + { + return std::make_pair(vertex(p.first, g), vertex(p.second, g)); + } + +private: + const Distribution& dist; + const Graph& g; +}; + +// NGE: This method only works with iterators that have a difference_type, +// the index_to_vertex_iterator class above is retained for compatibility +// with BGL generators which have no difference_type +template <typename IndexIterator, typename Distribution, typename Graph> +boost::transform_iterator<index_to_vertex_func<Distribution, Graph>, IndexIterator> +make_index_to_vertex_iterator(IndexIterator it, const Distribution& dist, + const Graph& g) { + return boost::make_transform_iterator( + it, index_to_vertex_func<Distribution, Graph>(dist, g)); +} + +// Forward declaration of csr_vertex_owner_map +template<typename ProcessID, typename Key> class csr_vertex_owner_map; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template <typename InputIterator, typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator, typename EdgePropertyIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template <typename InputIterator, typename EdgePropertyIterator, + typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + edges_size_type numedges, // This is not used as there is no appropriate BGL ctor + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_sorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template <typename InputIterator, typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_sorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator, typename EdgePropertyIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + edges_size_type numedges, // This is not used as there is no appropriate BGL ctor + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_sorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + ep_iter, + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator, typename EdgePropertyIterator, + typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_sorted_t, + InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_sorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + ep_iter, + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + m_distribution.block_size(process_id(m_process_group), numverts), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename MultiPassInputIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template <typename MultiPassInputIterator, typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename MultiPassInputIterator, typename EdgePropertyIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template <typename MultiPassInputIterator, typename EdgePropertyIterator, + typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(edges_are_unsorted_multi_pass_t, + MultiPassInputIterator edge_begin, + MultiPassInputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_multi_pass_global, + make_index_to_vertex_iterator(edge_begin, parallel::block(m_process_group, numverts), *this), + make_index_to_vertex_iterator(edge_end, parallel::block(m_process_group, numverts), *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename Source> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template <typename Distribution, typename Source> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename Source> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + std::vector<edge_bundled>& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, edge_props, + m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template <typename Distribution, typename Source> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(distributed_construct_inplace_from_sources_and_targets_t, + std::vector<Source>& sources, + std::vector<vertex_descriptor>& targets, + std::vector<edge_bundled>& edge_props, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(m_distribution.block_size(process_id(m_process_group), numverts)) +{ + // Convert linear indices to global indices + for (edges_size_type i = 0; i < sources.size(); ++i) { + sources[i] = m_distribution.local(sources[i]); + targets[i] = make_vertex_descriptor(m_distribution(targets[i]), + m_distribution.local(targets[i])); + } + + m_base.assign_sources_and_targets_global( + sources, targets, edge_props, + m_distribution.block_size(process_id(m_process_group), numverts), + identity_property_map()); + + // TODO: set property on m_base? +} + +// +// Old (untagged) ctors, these default to the unsorted sequential ctors +// +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) + +{ +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator, typename EdgePropertyIterator> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const GraphProperty& prop) + : m_process_group(pg), + + m_distribution(parallel::block(m_process_group, numverts)), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + ep_iter, + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator, typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +template<typename InputIterator, typename EdgePropertyIterator, + typename Distribution> +BOOST_DISTRIB_CSR_GRAPH_TYPE:: +compressed_sparse_row_graph(InputIterator edge_begin, InputIterator edge_end, + EdgePropertyIterator ep_iter, + vertices_size_type numverts, + const ProcessGroup& pg, + const Distribution& dist, + const GraphProperty& prop) + : m_process_group(pg), + m_distribution(dist), + m_base(edges_are_unsorted_global, + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_begin, *this), + index_to_vertex_iterator<InputIterator, BOOST_DISTRIB_CSR_GRAPH_TYPE>(edge_end, *this), + m_distribution.block_size(process_id(m_process_group), numverts), + get(vertex_local, *this), + local_vertex<csr_vertex_owner_map<process_id_type, vertex_descriptor>, + process_id_type> (get(vertex_owner, *this), process_id(pg)), + prop) +{ +} + +// ----------------------------------------------------------------- +// Vertex Global Property Map +template<typename ProcessID, typename Key> +class csr_vertex_global_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef std::pair<ProcessID, Key> value_type; + typedef value_type reference; + typedef Key key_type; + typedef readable_property_map_tag category; +}; + +template<typename ProcessID, typename Key> +inline std::pair<ProcessID, Key> +get(csr_vertex_global_map<ProcessID, Key>, + typename csr_vertex_global_map<ProcessID, Key>::key_type k) +{ + const int local_index_bits = sizeof(Key) * CHAR_BIT - processor_bits; + const Key local_index_mask = Key(-1) >> processor_bits; + + return std::pair<ProcessID, Key>(k >> local_index_bits, + k & local_index_mask); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_global_t> +{ + public: + typedef csr_vertex_global_map< + typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> type; + typedef type const_type; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_global_t>::type +get(vertex_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_global_t> + ::type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +std::pair<typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> +get(vertex_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_global, + const_cast<const BOOST_DISTRIB_CSR_GRAPH_TYPE&>(g), + k); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_global_t>::const_type +get(vertex_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_global_t> + ::const_type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +std::pair<typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> +get(vertex_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + typedef std::pair<typename ProcessGroup::process_id_type, vertex_descriptor> + result_type; + const int local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + const vertex_descriptor local_index_mask = + vertex_descriptor(-1) >> processor_bits; + + return result_type(k >> local_index_bits, k & local_index_mask); +} + +// ----------------------------------------------------------------- +// Extra, common functions +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +vertex(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type i, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return g.make_vertex_descriptor(g.distribution()(i), + g.distribution().local(i)); +} + +// Unlike for an adjacency_matrix, edge_range and edge take lg(out_degree(i)) +// time +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator> +edge_range(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor i, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor j, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor Vertex; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type EdgeIndex; + typedef typename std::vector<Vertex>::const_iterator adj_iter; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor edge_desc; + std::pair<adj_iter, adj_iter> raw_adjacencies = adjacent_vertices(i, g); + std::pair<adj_iter, adj_iter> adjacencies = + std::equal_range(raw_adjacencies.first, raw_adjacencies.second, j); + EdgeIndex idx_begin = adjacencies.first - g.base().m_forward.m_column.begin(); + EdgeIndex idx_end = adjacencies.second - g.base().m_forward.m_column.begin(); + return std::make_pair(out_edge_iter(edge_desc(i, idx_begin)), + out_edge_iter(edge_desc(i, idx_end))); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline std::pair<typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor, bool> +edge(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor i, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor j, + const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::out_edge_iterator out_edge_iter; + std::pair<out_edge_iter, out_edge_iter> range = edge_range(i, j, g); + if (range.first == range.second) + return std::make_pair(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor(), + false); + else + return std::make_pair(*range.first, true); +} + +// A helper that turns requests for property maps for const graphs +// into property maps for non-const graphs. +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename Property> +class property_map<const BOOST_DISTRIB_CSR_GRAPH_TYPE, Property> +{ + public: + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, Property> + ::const_type type; + typedef type const_type; +}; + +// ----------------------------------------------------------------- +// Structural modifiers + +#if 0 +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +add_vertex(BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_vertex(); } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +add_vertex(const typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_bundled& p, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_vertex(p); } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +add_vertices(typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type count, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_vertices(count); } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename InputIterator> +void +add_edges(InputIterator first, InputIterator last, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ g.add_edges(first, last); } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename InputIterator, + typename EdgePropertyIterator> +void +add_edges(InputIterator first, InputIterator last, + EdgePropertyIterator ep_iter, + EdgePropertyIterator ep_iter_end, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_edges(first, last, ep_iter, ep_iter_end); } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename InputIterator> +void +add_edges_sorted(InputIterator first, InputIterator last, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ return g.add_edges_sorted(first, last); } + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename InputIterator, + typename EdgePropertyIterator> +void +add_edges_sorted(InputIterator first_sorted, InputIterator last_sorted, + EdgePropertyIterator ep_iter_sorted, + BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ g.add_edges_sorted(first_sorted, last_sorted, ep_iter_sorted); } +#endif + +// ----------------------------------------------------------------- +// Vertex Owner Property Map +template<typename ProcessID, typename Key> +class csr_vertex_owner_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef ProcessID value_type; + typedef value_type reference; + typedef Key key_type; + typedef readable_property_map_tag category; +}; + +template<typename ProcessID, typename Key> +inline ProcessID +get(csr_vertex_owner_map<ProcessID, Key> pm, + typename csr_vertex_owner_map<ProcessID, Key>::key_type k) +{ + const int local_index_bits = sizeof(Key) * CHAR_BIT - processor_bits; + return k >> local_index_bits; +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_owner_t> +{ + public: + typedef csr_vertex_owner_map< + typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> type; + typedef type const_type; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_owner_t>::type +get(vertex_owner_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_owner_t> + ::type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename ProcessGroup::process_id_type +get(vertex_owner_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_owner, + const_cast<const BOOST_DISTRIB_CSR_GRAPH_TYPE&>(g), + k); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_owner_t>::const_type +get(vertex_owner_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_owner_t> + ::const_type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename ProcessGroup::process_id_type +get(vertex_owner_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + const int local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + return k >> local_index_bits; +} + +// ----------------------------------------------------------------- +// Vertex Local Property Map +template<typename Key> +class csr_vertex_local_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef Key value_type; + typedef value_type reference; + typedef Key key_type; + typedef readable_property_map_tag category; +}; + +template<typename Key> +inline Key +get(csr_vertex_local_map<Key> pm, + typename csr_vertex_local_map<Key>::key_type k) +{ + const Key local_index_mask = Key(-1) >> processor_bits; + return k & local_index_mask; +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_t> +{ + public: + typedef csr_vertex_local_map< + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor> type; + typedef type const_type; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_t>::type +get(vertex_local_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_t> + ::type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +get(vertex_local_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, + const_cast<const BOOST_DISTRIB_CSR_GRAPH_TYPE&>(g), + k); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_t>::const_type +get(vertex_local_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_t> + ::const_type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor +get(vertex_local_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + const vertex_descriptor local_index_mask = + vertex_descriptor(-1) >> processor_bits; + return k & local_index_mask; +} + +// ----------------------------------------------------------------- +// Vertex Index Property Map +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_index_t> +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, + vertex_global_t>::const_type + global_map; + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::process_group_type + process_group_type; + + typedef property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_t> local; + +public: + typedef local_property_map<process_group_type, + global_map, + typename local::type> type; + typedef local_property_map<process_group_type, + global_map, + typename local::const_type> const_type; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_index_t>::type +get(vertex_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_index_t> + ::type result_type; + + return result_type(g.process_group(), get(vertex_global, g), + get(vertex_local, g)); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_index_t>::const_type +get(vertex_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_index_t> + ::const_type result_type; + return result_type(g.process_group(), get(vertex_global, g), + get(vertex_local, g)); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +// ----------------------------------------------------------------- +// Vertex Local Index Property Map +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_index_t> + : public property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_t> { }; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_index_t>::type +get(vertex_local_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return get(vertex_local, g); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_local_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, vertex_local_index_t>::const_type +get(vertex_local_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + return get(vertex_local, g); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertices_size_type +get(vertex_local_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor k) +{ + return get(vertex_local, g, k); +} + +// ----------------------------------------------------------------- +// Edge Global Property Map +template<typename ProcessID, typename Vertex, typename EdgeIndex> +class csr_edge_global_map +{ + public: + // ----------------------------------------------------------------- + // Readable Property Map concept requirements + typedef std::pair<ProcessID, EdgeIndex> value_type; + typedef value_type reference; + typedef detail::csr_edge_descriptor<Vertex, EdgeIndex> key_type; + typedef readable_property_map_tag category; +}; + +template<typename ProcessID, typename Vertex, typename EdgeIndex> +inline std::pair<ProcessID, EdgeIndex> +get(csr_edge_global_map<ProcessID, Vertex, EdgeIndex> pm, + typename csr_edge_global_map<ProcessID, Vertex, EdgeIndex>::key_type k) +{ + const int local_index_bits = sizeof(Vertex) * CHAR_BIT - processor_bits; + return std::pair<ProcessID, EdgeIndex>(k.src >> local_index_bits, k.idx); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_global_t> +{ + public: + typedef csr_edge_global_map< + typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type> type; + typedef type const_type; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_global_t>::type +get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_global_t> + ::type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +std::pair<typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type> +get(edge_global_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + return get(edge_global, + const_cast<const BOOST_DISTRIB_CSR_GRAPH_TYPE&>(g), + k); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_global_t>::const_type +get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_global_t> + ::const_type result_type; + return result_type(); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +std::pair<typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type> +get(edge_global_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + typedef typename BOOST_DISTRIB_CSR_GRAPH_TYPE::vertex_descriptor + vertex_descriptor; + + const int local_index_bits = + sizeof(vertex_descriptor) * CHAR_BIT - processor_bits; + + typedef std::pair<typename ProcessGroup::process_id_type, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type> + result_type; + + return result_type(k.src >> local_index_bits, k.idx); +} + +// ----------------------------------------------------------------- +// Edge Index Property Map +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_index_t> +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_global_t> + ::type global_map; + + public: + typedef local_property_map< + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::process_group_type, + global_map, + identity_property_map> type; + typedef type const_type; +}; + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_index_t>::type +get(edge_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_index_t> + ::type result_type; + return result_type(g.process_group(), get(edge_global, g), + identity_property_map()); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type +get(edge_index_t, BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + return k.idx; +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_index_t>::const_type +get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, edge_index_t> + ::const_type result_type; + return result_type(g.process_group(), get(edge_global, g), + identity_property_map()); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS> +inline typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edges_size_type +get(edge_index_t, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g, + typename BOOST_DISTRIB_CSR_GRAPH_TYPE::edge_descriptor k) +{ + return k.idx; +} + +// ----------------------------------------------------------------- +// Bundled Properties +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename T, typename Bundle> +class property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, T Bundle::*> +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename Graph::process_group_type process_group_type; + + // Determine which locator map to use (vertex or edge) + typedef typename mpl::if_<detail::is_vertex_bundle<VertexProperty, + EdgeProperty, + Bundle>, + vertex_global_t, edge_global_t>::type global_t; + + // Extract the global property map for our key type. + typedef typename property_map<Graph, global_t>::const_type global_map; + typedef typename property_traits<global_map>::value_type locator; + + // Determine which bundle type we are using + typedef typename mpl::if_<detail::is_vertex_bundle<VertexProperty, + EdgeProperty, + Bundle>, + VertexProperty, EdgeProperty>::type bundle_t; + +public: + // Build the local property map + typedef bundle_property_map<std::vector<bundle_t>, + typename locator::second_type, + bundle_t, + T> local_pmap; + + // Build the local const property map + typedef bundle_property_map<const std::vector<bundle_t>, + typename locator::second_type, + bundle_t, + const T> local_const_pmap; + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_pmap> type; + + typedef ::boost::parallel::distributed_property_map< + process_group_type, global_map, local_const_pmap> const_type; +}; + +namespace detail { + // Retrieve the local bundle_property_map corresponding to a + // non-const vertex property. + template<typename Graph, typename T, typename Bundle> + inline bundle_property_map<std::vector<typename Graph::vertex_bundled>, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, T> + get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::true_) + { + typedef bundle_property_map<std::vector<typename Graph::vertex_bundled>, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, T> result_type; + return result_type(&g.base().vertex_properties().m_vertex_properties, p); + } + + // Retrieve the local bundle_property_map corresponding to a + // const vertex property. + template<typename Graph, typename T, typename Bundle> + inline bundle_property_map<const std::vector<typename Graph::vertex_bundled>, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, const T> + get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::true_) + { + typedef bundle_property_map< + const std::vector<typename Graph::vertex_bundled>, + typename Graph::vertex_descriptor, + typename Graph::vertex_bundled, const T> result_type; + return result_type(&g.base().vertex_properties().m_vertex_properties, p); + } + + // Retrieve the local bundle_property_map corresponding to a + // non-const edge property. + template<typename Graph, typename T, typename Bundle> + inline bundle_property_map<std::vector<typename Graph::edge_bundled>, + typename Graph::edges_size_type, + typename Graph::edge_bundled, T> + get_distrib_csr_bundle(T Bundle::* p, Graph& g, mpl::false_) + { + typedef bundle_property_map<std::vector<typename Graph::edge_bundled>, + typename Graph::edges_size_type, + typename Graph::edge_bundled, T> result_type; + return result_type(&g.base().edge_properties().m_edge_properties, p); + } + + // Retrieve the local bundle_property_map corresponding to a + // const edge property. + template<typename Graph, typename T, typename Bundle> + inline bundle_property_map<const std::vector<typename Graph::edge_bundled>, + typename Graph::edges_size_type, + typename Graph::edge_bundled, const T> + get_distrib_csr_bundle(T Bundle::* p, const Graph& g, mpl::false_) + { + typedef bundle_property_map< + const std::vector<typename Graph::edge_bundled>, + typename Graph::edges_size_type, + typename Graph::edge_bundled, const T> result_type; + return result_type(&g.base().edge_properties().m_edge_properties, p); + } +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename T, typename Bundle> +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, T Bundle::*>::type +get(T Bundle::* p, BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename property_map<Graph, T Bundle::*>::type result_type; + typedef typename property_map<Graph, T Bundle::*>::local_pmap local_pmap; + + // Resolver + typedef typename property_traits<result_type>::value_type value_type; + typedef typename property_reduce<T Bundle::*>::template apply<value_type> + reduce; + + typedef typename property_traits<result_type>::key_type descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_<is_same<descriptor, vertex_descriptor>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + detail::get_distrib_csr_bundle + (p, g, mpl::bool_<is_same<descriptor, + vertex_descriptor>::value>()), + reduce()); +} + +template<BOOST_DISTRIB_CSR_GRAPH_TEMPLATE_PARMS, typename T, typename Bundle> +typename property_map<BOOST_DISTRIB_CSR_GRAPH_TYPE, T Bundle::*>::const_type +get(T Bundle::* p, const BOOST_DISTRIB_CSR_GRAPH_TYPE& g) +{ + typedef BOOST_DISTRIB_CSR_GRAPH_TYPE Graph; + typedef typename property_map<Graph, T Bundle::*>::const_type result_type; + typedef typename property_map<Graph, T Bundle::*>::local_const_pmap + local_pmap; + + // Resolver + typedef typename property_traits<result_type>::value_type value_type; + typedef typename property_reduce<T Bundle::*>::template apply<value_type> + reduce; + + typedef typename property_traits<result_type>::key_type descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename mpl::if_<is_same<descriptor, vertex_descriptor>, + vertex_global_t, edge_global_t>::type + global_map_t; + + return result_type(g.process_group(), get(global_map_t(), g), + detail::get_distrib_csr_bundle + (p, g, mpl::bool_<is_same<descriptor, + vertex_descriptor>::value>()), + reduce()); +} + +namespace mpi { + template<typename Vertex, typename EdgeIndex> + struct is_mpi_datatype<boost::detail::csr_edge_descriptor<Vertex, EdgeIndex> > + : mpl::true_ { }; +} + +namespace serialization { + template<typename Vertex, typename EdgeIndex> + struct is_bitwise_serializable<boost::detail::csr_edge_descriptor<Vertex, EdgeIndex> > + : mpl::true_ { }; + + template<typename Vertex, typename EdgeIndex> + struct implementation_level<boost::detail::csr_edge_descriptor<Vertex, EdgeIndex> > + : mpl::int_<object_serializable> {} ; + + template<typename Vertex, typename EdgeIndex> + struct tracking_level<boost::detail::csr_edge_descriptor<Vertex, EdgeIndex> > + : mpl::int_<track_never> {} ; + +} + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_CSR_HPP diff --git a/Utilities/BGL/boost/graph/distributed/concepts.hpp b/Utilities/BGL/boost/graph/distributed/concepts.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ae1a6951c8d14396bec8346d2cbad523c8da15db --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/concepts.hpp @@ -0,0 +1,216 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +// +// Distributed graph concepts and helpers +// + +#ifndef BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP +#define BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/version.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_concepts.hpp> + +#if BOOST_VERSION >= 103500 +# include <boost/concept/detail/concept_def.hpp> +#endif + +namespace boost { + +class distributed_graph_tag { }; +class distributed_vertex_list_graph_tag { }; +class distributed_edge_list_graph_tag { }; + +#if BOOST_VERSION >= 103500 + namespace concepts { +#endif + +#if BOOST_VERSION < 103500 + +template <class G> +struct DistributedVertexListGraphConcept +{ + typedef typename graph_traits<G>::vertex_iterator vertex_iterator; + typedef typename graph_traits<G>::vertices_size_type vertices_size_type; + typedef typename graph_traits<G>::traversal_category + traversal_category; + void constraints() { + function_requires< GraphConcept<G> >(); + function_requires< MultiPassInputIteratorConcept<vertex_iterator> >(); + function_requires< ConvertibleConcept<traversal_category, + distributed_vertex_list_graph_tag> >(); + +#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + p = vertices(g); + v = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { +#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + + p = vertices(cg); + v = *p.first; + V = num_vertices(cg); + } + std::pair<vertex_iterator,vertex_iterator> p; + typename graph_traits<G>::vertex_descriptor v; + G g; + vertices_size_type V; +}; + +template <class G> +struct DistributedEdgeListGraphConcept +{ + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + typedef typename graph_traits<G>::edge_iterator edge_iterator; + typedef typename graph_traits<G>::edges_size_type edges_size_type; + typedef typename graph_traits<G>::traversal_category + traversal_category; + void constraints() { + function_requires< GraphConcept<G> >(); + function_requires< MultiPassInputIteratorConcept<edge_iterator> >(); + function_requires< DefaultConstructibleConcept<edge_descriptor> >(); + function_requires< EqualityComparableConcept<edge_descriptor> >(); + function_requires< AssignableConcept<edge_descriptor> >(); + function_requires< ConvertibleConcept<traversal_category, + distributed_edge_list_graph_tag> >(); + + p = edges(g); + e = *p.first; + u = source(e, g); + v = target(e, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = edges(cg); + E = num_edges(cg); + e = *p.first; + u = source(e, cg); + v = target(e, cg); + } + std::pair<edge_iterator,edge_iterator> p; + typename graph_traits<G>::vertex_descriptor u, v; + typename graph_traits<G>::edge_descriptor e; + edges_size_type E; + G g; +}; +#else + BOOST_concept(DistributedVertexListGraph,(G)) + : Graph<G> + { + typedef typename graph_traits<G>::vertex_iterator vertex_iterator; + typedef typename graph_traits<G>::vertices_size_type vertices_size_type; + typedef typename graph_traits<G>::traversal_category + traversal_category; + ~DistributedVertexListGraph() { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator<vertex_iterator>)); + BOOST_CONCEPT_ASSERT((Convertible<traversal_category, + distributed_vertex_list_graph_tag>)); + +#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + p = vertices(g); + v = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { +#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + + p = vertices(cg); + v = *p.first; + V = num_vertices(cg); + } + std::pair<vertex_iterator,vertex_iterator> p; + typename graph_traits<G>::vertex_descriptor v; + G g; + vertices_size_type V; + }; + + BOOST_concept(DistributedEdgeListGraph,(G)) + : Graph<G> + { + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + typedef typename graph_traits<G>::edge_iterator edge_iterator; + typedef typename graph_traits<G>::edges_size_type edges_size_type; + typedef typename graph_traits<G>::traversal_category + traversal_category; + ~DistributedEdgeListGraph() { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator<edge_iterator>)); + BOOST_CONCEPT_ASSERT((DefaultConstructible<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((EqualityComparable<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((Assignable<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((Convertible<traversal_category, + distributed_edge_list_graph_tag>)); + + p = edges(g); + e = *p.first; + u = source(e, g); + v = target(e, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = edges(cg); + E = num_edges(cg); + e = *p.first; + u = source(e, cg); + v = target(e, cg); + } + std::pair<edge_iterator,edge_iterator> p; + typename graph_traits<G>::vertex_descriptor u, v; + typename graph_traits<G>::edge_descriptor e; + edges_size_type E; + G g; + }; +#endif + +#if BOOST_VERSION >= 103500 + } // end namespace concepts + + using concepts::DistributedVertexListGraphConcept; + using concepts::DistributedEdgeListGraphConcept; +#endif +} // end namespace boost + +#if BOOST_VERSION >= 103500 +# include <boost/concept/detail/concept_undef.hpp> +#endif + +#endif // BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP diff --git a/Utilities/BGL/boost/graph/distributed/connected_components.hpp b/Utilities/BGL/boost/graph/distributed/connected_components.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f62e29a26ff73834ae9b95b6383a5510c40a33de --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/connected_components.hpp @@ -0,0 +1,766 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_CC_HPP +#define BOOST_GRAPH_PARALLEL_CC_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/property_map/property_map.hpp> +#include <boost/property_map/parallel/caching_property_map.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/pending/indirect_cmp.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/distributed/local_subgraph.hpp> +#include <boost/graph/connected_components.hpp> +#include <boost/graph/named_function_params.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/optional.hpp> +#include <algorithm> +#include <vector> +#include <list> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/graph/iteration_macros.hpp> + +#define PBGL_IN_PLACE_MERGE /* In place merge instead of sorting */ +//#define PBGL_SORT_ASSERT /* Assert sorted for in place merge */ + +/* Explicit sychronization in pointer doubling step? */ +#define PBGL_EXPLICIT_SYNCH +//#define PBGL_CONSTRUCT_METAGRAPH +#ifdef PBGL_CONSTRUCT_METAGRAPH +# define MAX_VERTICES_IN_METAGRAPH 10000 +#endif + +namespace boost { namespace graph { namespace distributed { + namespace cc_detail { + enum connected_components_message { + edges_msg, req_parents_msg, parents_msg, root_adj_msg + }; + + template <typename Vertex> + struct metaVertex { + metaVertex() {} + metaVertex(const Vertex& v) : name(v) {} + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & name; + } + + Vertex name; + }; + +#ifdef PBGL_CONSTRUCT_METAGRAPH + // Build meta-graph on result of local connected components + template <typename Graph, typename ParentMap, typename RootIterator, + typename AdjacencyMap> + void + build_local_metagraph(const Graph& g, ParentMap p, RootIterator r, + RootIterator r_end, AdjacencyMap& adj) + { + // TODO: Static assert that AdjacencyMap::value_type is std::vector<vertex_descriptor> + + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + BOOST_STATIC_ASSERT((is_same<typename AdjacencyMap::mapped_type, + std::vector<vertex_descriptor> >::value)); + + using boost::graph::parallel::process_group; + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + if (id != 0) { + + // Send component roots and their associated edges to P0 + for ( ; r != r_end; ++r ) { + std::vector<vertex_descriptor> adjs(1, *r); // Root + adjs.reserve(adjs.size() + adj[*r].size()); + for (typename std::vector<vertex_descriptor>::iterator iter = adj[*r].begin(); + iter != adj[*r].end(); ++iter) + adjs.push_back(get(p, *iter)); // Adjacencies + + send(pg, 0, root_adj_msg, adjs); + } + } + + synchronize(pg); + + if (id == 0) { + typedef metaVertex<vertex_descriptor> VertexProperties; + + typedef boost::adjacency_list<vecS, vecS, undirectedS, + VertexProperties> metaGraph; + typedef typename graph_traits<metaGraph>::vertex_descriptor + meta_vertex_descriptor; + + std::map<vertex_descriptor, meta_vertex_descriptor> vertex_map; + std::vector<std::pair<vertex_descriptor, vertex_descriptor> > edges; + + // Receive remote roots and edges + while (optional<std::pair<process_id_type, int> > m = probe(pg)) { + assert(m->second == root_adj_msg); + + std::vector<vertex_descriptor> adjs; + receive(pg, m->first, m->second, adjs); + + vertex_map[adjs[0]] = graph_traits<metaGraph>::null_vertex(); + for (typename std::vector<vertex_descriptor>::iterator iter + = ++adjs.begin(); iter != adjs.end(); ++iter) + edges.push_back(std::make_pair(adjs[0], *iter)); + } + + // Add local roots and edges + for ( ; r != r_end; ++r ) { + vertex_map[*r] = graph_traits<metaGraph>::null_vertex(); + edges.reserve(edges.size() + adj[*r].size()); + for (typename std::vector<vertex_descriptor>::iterator iter = adj[*r].begin(); + iter != adj[*r].end(); ++iter) + edges.push_back(std::make_pair(*r, get(p, *iter))); + } + + // Build local meta-graph + metaGraph mg; + + // Add vertices with property to map back to distributed graph vertex + for (typename std::map<vertex_descriptor, meta_vertex_descriptor>::iterator + iter = vertex_map.begin(); iter != vertex_map.end(); ++iter) + vertex_map[iter->first] + = add_vertex(metaVertex<vertex_descriptor>(iter->first), mg); + + // Build meta-vertex map + typename property_map<metaGraph, vertex_descriptor VertexProperties::*>::type + metaVertexMap = get(&VertexProperties::name, mg); + + typename std::vector<std::pair<vertex_descriptor, vertex_descriptor> > + ::iterator edge_iter = edges.begin(); + for ( ; edge_iter != edges.end(); ++edge_iter) + add_edge(vertex_map[edge_iter->first], vertex_map[edge_iter->second], mg); + + edges.clear(); + + // Call connected_components on it + typedef typename property_map<metaGraph, vertex_index_t>::type + meta_index_map_type; + meta_index_map_type meta_index = get(vertex_index, mg); + + std::vector<std::size_t> mg_component_vec(num_vertices(mg)); + typedef iterator_property_map<std::vector<std::size_t>::iterator, + meta_index_map_type> + meta_components_map_type; + meta_components_map_type mg_component(mg_component_vec.begin(), + meta_index); + std::size_t num_comp = connected_components(mg, mg_component); + + // Update Parent pointers + std::vector<meta_vertex_descriptor> roots(num_comp, graph_traits<metaGraph>::null_vertex()); + + BGL_FORALL_VERTICES_T(v, mg, metaGraph) { + size_t component = get(mg_component, v); + if (roots[component] == graph_traits<metaGraph>::null_vertex() || + get(meta_index, v) < get(meta_index, roots[component])) + roots[component] = v; + } + + // Set all the local parent pointers + BGL_FORALL_VERTICES_T(v, mg, metaGraph) { + // Problem in value being put (3rd parameter) + put(p, get(metaVertexMap, v), get(metaVertexMap, roots[get(mg_component, v)])); + } + } + + synchronize(p); + } +#endif + + /* Function object used to remove internal vertices and vertices > + the current vertex from the adjacent vertex lists at each + root */ + template <typename Vertex, typename ParentMap> + class cull_adjacency_list + { + public: + cull_adjacency_list(const Vertex v, const ParentMap p) : v(v), p(p) {} + bool operator() (const Vertex x) { return (get(p, x) == v || x == v); } + + private: + const Vertex v; + const ParentMap p; + }; + + /* Comparison operator used to choose targets for hooking s.t. vertices + that are hooked to are evenly distributed across processors */ + template <typename OwnerMap, typename LocalMap> + class hashed_vertex_compare + { + public: + hashed_vertex_compare (const OwnerMap& o, const LocalMap& l) + : owner(o), local(l) { } + + template <typename Vertex> + bool operator() (const Vertex x, const Vertex y) + { + if (get(local, x) < get(local, y)) + return true; + else if (get(local, x) == get(local, y)) + return (get(owner, x) < get(owner, y)); + return false; + } + + private: + OwnerMap owner; + LocalMap local; + }; + +#ifdef PBGL_EXPLICIT_SYNCH + template <typename Graph, typename ParentMap, typename VertexList> + void + request_parent_map_entries(const Graph& g, ParentMap p, + std::vector<VertexList>& parent_requests) + { + typedef typename boost::graph::parallel::process_group_type<Graph> + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor; + + process_group_type pg = process_group(g); + + /* + This should probably be send_oob_with_reply, especially when Dave + finishes prefetch-batching + */ + + // Send root requests + for (process_id_type i = 0; i < num_processes(pg); ++i) { + if (!parent_requests[i].empty()) { + std::vector<vertex_descriptor> reqs(parent_requests[i].begin(), + parent_requests[i].end()); + send(pg, i, req_parents_msg, reqs); + } + } + + synchronize(pg); + + // Receive root requests and reply to them + while (optional<std::pair<process_id_type, int> > m = probe(pg)) { + std::vector<vertex_descriptor> requests; + receive(pg, m->first, m->second, requests); + for (std::size_t i = 0; i < requests.size(); ++i) + requests[i] = get(p, requests[i]); + send(pg, m->first, parents_msg, requests); + } + + synchronize(pg); + + // Receive requested parents + std::vector<vertex_descriptor> responses; + for (process_id_type i = 0; i < num_processes(pg); ++i) { + if (!parent_requests[i].empty()) { + receive(pg, i, parents_msg, responses); + std::size_t parent_idx = 0; + for (typename VertexList::iterator v = parent_requests[i].begin(); + v != parent_requests[i].end(); ++v, ++parent_idx) + put(p, *v, responses[parent_idx]); + } + } + } +#endif + + template<typename DistributedGraph, typename ParentMap> + void + parallel_connected_components(DistributedGraph& g, ParentMap p) + { + using boost::connected_components; + + typedef typename graph_traits<DistributedGraph>::adjacency_iterator + adjacency_iterator; + typedef typename graph_traits<DistributedGraph>::out_edge_iterator + out_edge_iterator; + typedef typename graph_traits<DistributedGraph>::edge_iterator + edge_iterator; + typedef typename graph_traits<DistributedGraph>::vertex_descriptor + vertex_descriptor; + typedef typename graph_traits<DistributedGraph>::edge_descriptor + edge_descriptor; + + typedef typename boost::graph::parallel::process_group_type<DistributedGraph> + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + using boost::graph::parallel::process_group; + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + // TODO (NGE): Should old_roots, roots, and completed_roots be std::list + adjacency_iterator av1, av2; + std::vector<vertex_descriptor> old_roots; + typename std::vector<vertex_descriptor>::iterator liter; + typename std::vector<vertex_descriptor>::iterator aliter; + typename std::map<vertex_descriptor, + std::vector<vertex_descriptor> > adj; + + typedef typename property_map<DistributedGraph, vertex_owner_t>::const_type + OwnerMap; + OwnerMap owner = get(vertex_owner, g); + typedef typename property_map<DistributedGraph, vertex_local_t>::const_type + LocalMap; + LocalMap local = get(vertex_local, g); + + // We need to hold on to all of the parent pointers + p.set_max_ghost_cells(0); + + // + // STAGE 1 : Compute local components + // + local_subgraph<const DistributedGraph> ls(g); + typedef typename property_map<local_subgraph<const DistributedGraph>, + vertex_index_t>::type local_index_map_type; + local_index_map_type local_index = get(vertex_index, ls); + + // Compute local connected components + std::vector<std::size_t> ls_components_vec(num_vertices(ls)); + typedef iterator_property_map<std::vector<std::size_t>::iterator, + local_index_map_type> + ls_components_map_type; + ls_components_map_type ls_component(ls_components_vec.begin(), + local_index); + std::size_t num_comp = connected_components(ls, ls_component); + + std::vector<vertex_descriptor> + roots(num_comp, graph_traits<DistributedGraph>::null_vertex()); + + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + size_t component = get(ls_component, v); + if (roots[component] == graph_traits<DistributedGraph>::null_vertex() || + get(local_index, v) < get(local_index, roots[component])) + roots[component] = v; + } + + // Set all the local parent pointers + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + put(p, v, roots[get(ls_component, v)]); + } + + if (num_processes(pg) == 1) return; + + // Build adjacency list for all roots + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + std::vector<vertex_descriptor>& my_adj = adj[get(p, v)]; + for (tie(av1, av2) = adjacent_vertices(v, g); + av1 != av2; ++av1) { + if (get(owner, *av1) != id) my_adj.push_back(*av1); + } + } + + // For all vertices adjacent to a local vertex get p(v) + for ( liter = roots.begin(); liter != roots.end(); ++liter ) { + std::vector<vertex_descriptor>& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + request(p, *aliter); + } + synchronize(p); + + // Update adjacency list at root to make sure all adjacent + // vertices are roots of remote components + for ( liter = roots.begin(); liter != roots.end(); ++liter ) + { + std::vector<vertex_descriptor>& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + *aliter = get(p, *aliter); + + my_adj.erase + (remove_if(my_adj.begin(), my_adj.end(), + cull_adjacency_list<vertex_descriptor, + ParentMap>(*liter, p) ), + my_adj.end()); + // This sort needs to be here to make sure the initial + // adjacency list is sorted + sort(my_adj.begin(), my_adj.end(), std::less<vertex_descriptor>()); + my_adj.erase(unique(my_adj.begin(), my_adj.end()), my_adj.end()); + } + + // Get p(v) for the new adjacent roots + p.clear(); + for ( liter = roots.begin(); liter != roots.end(); ++liter ) { + std::vector<vertex_descriptor>& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + request(p, *aliter); + } +#ifdef PBGL_EXPLICIT_SYNCH + synchronize(p); +#endif + + // Lastly, remove roots with no adjacent vertices, this is + // unnecessary but will speed up sparse graphs + for ( liter = roots.begin(); liter != roots.end(); /*in loop*/) + { + if ( adj[*liter].empty() ) + liter = roots.erase(liter); + else + ++liter; + } + +#ifdef PBGL_CONSTRUCT_METAGRAPH + /* TODO: If the number of roots is sufficiently small, we can + use a 'problem folding' approach like we do in MST + to gather all the roots and their adjacencies on one proc + and solve for the connected components of the meta-graph */ + using boost::parallel::all_reduce; + std::size_t num_roots = all_reduce(pg, roots.size(), std::plus<std::size_t>()); + if (num_roots < MAX_VERTICES_IN_METAGRAPH) { + build_local_metagraph(g, p, roots.begin(), roots.end(), adj); + + // For each vertex in g, p(v) = p(p(v)), assign parent of leaf + // vertices from first step to final parent + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + put(p, v, get(p, get(p, v))); + } + + synchronize(p); + + return; + } +#endif + + // + // Parallel Phase + // + + std::vector<vertex_descriptor> completed_roots; + hashed_vertex_compare<OwnerMap, LocalMap> v_compare(owner, local); + bool any_hooked; + vertex_descriptor new_root; + + std::size_t steps = 0; + + do { + ++steps; + + // Pull in new parents for hooking phase + synchronize(p); + + // + // Hooking + // + bool hooked = false; + completed_roots.clear(); + for ( liter = roots.begin(); liter != roots.end(); ) + { + new_root = graph_traits<DistributedGraph>::null_vertex(); + std::vector<vertex_descriptor>& my_adj = adj[*liter]; + for ( aliter = my_adj.begin(); aliter != my_adj.end(); ++aliter ) + // try to hook to better adjacent vertex + if ( v_compare( get(p, *aliter), *liter ) ) + new_root = get(p, *aliter); + + if ( new_root != graph_traits<DistributedGraph>::null_vertex() ) + { + hooked = true; + put(p, *liter, new_root); + old_roots.push_back(*liter); + completed_roots.push_back(*liter); + liter = roots.erase(liter); + } + else + ++liter; + } + + // + // Pointer jumping, perform until new roots determined + // + + // TODO: Implement cycle reduction rules to reduce this from + // O(n) to O(log n) [n = cycle length] + bool all_done; + std::size_t parent_root_count; + + std::size_t double_steps = 0; + + do { + ++double_steps; +#ifndef PBGL_EXPLICIT_SYNCH + // Get p(p(v)) for all old roots, and p(v) for all current roots + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + request(p, get(p, *liter)); + + synchronize(p); +#else + // Build root requests + typedef std::set<vertex_descriptor> VertexSet; + std::vector<VertexSet> parent_requests(num_processes(pg)); + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + { + vertex_descriptor p1 = *liter; + if (get(owner, p1) != id) parent_requests[get(owner, p1)].insert(p1); + vertex_descriptor p2 = get(p, p1); + if (get(owner, p2) != id) parent_requests[get(owner, p2)].insert(p2); + } + + request_parent_map_entries(g, p, parent_requests); +#endif + // Perform a pointer jumping step on all old roots + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + put(p, *liter, get(p, get(p, *liter))); + + // make sure the parent of all old roots is itself a root + parent_root_count = 0; + for ( liter = old_roots.begin(); liter != old_roots.end(); ++liter ) + if ( get(p, *liter) == get(p, get(p, *liter)) ) + parent_root_count++; + + bool done = parent_root_count == old_roots.size(); + + all_reduce(pg, &done, &done+1, &all_done, + std::logical_and<bool>()); + } while ( !all_done ); +#ifdef PARALLEL_BGL_DEBUG + if (id == 0) std::cerr << double_steps << " doubling steps.\n"; +#endif + // + // Add adjacent vertices of just completed roots to adjacent + // vertex list at new parent + // + typename std::vector<vertex_descriptor> outgoing_edges; + for ( liter = completed_roots.begin(); liter != completed_roots.end(); + ++liter ) + { + vertex_descriptor new_parent = get(p, *liter); + + if ( get(owner, new_parent) == id ) + { + std::vector<vertex_descriptor>& my_adj = adj[new_parent]; + my_adj.reserve(my_adj.size() + adj[*liter].size()); + my_adj.insert( my_adj.end(), + adj[*liter].begin(), adj[*liter].end() ); +#ifdef PBGL_IN_PLACE_MERGE +#ifdef PBGL_SORT_ASSERT + assert(__gnu_cxx::is_sorted(my_adj.begin(), + my_adj.end() - adj[*liter].size(), + std::less<vertex_descriptor>())); + assert(__gnu_cxx::is_sorted(my_adj.end() - adj[*liter].size(), + my_adj.end(), + std::less<vertex_descriptor>())); +#endif + std::inplace_merge(my_adj.begin(), + my_adj.end() - adj[*liter].size(), + my_adj.end(), + std::less<vertex_descriptor>()); +#endif + + + } + else if ( adj[*liter].begin() != adj[*liter].end() ) + { + outgoing_edges.clear(); + outgoing_edges.reserve(adj[*liter].size() + 1); + // First element is the destination of the adjacency list + outgoing_edges.push_back(new_parent); + outgoing_edges.insert(outgoing_edges.end(), + adj[*liter].begin(), adj[*liter].end() ); + send(pg, get(owner, new_parent), edges_msg, outgoing_edges); + adj[*liter].clear(); + } + } + synchronize(pg); + + // Receive edges sent by remote nodes and add them to the + // indicated vertex's adjacency list + while (optional<std::pair<process_id_type, int> > m + = probe(pg)) + { + std::vector<vertex_descriptor> incoming_edges; + receive(pg, m->first, edges_msg, incoming_edges); + typename std::vector<vertex_descriptor>::iterator aviter + = incoming_edges.begin(); + ++aviter; + + std::vector<vertex_descriptor>& my_adj = adj[incoming_edges[0]]; + + my_adj.reserve(my_adj.size() + incoming_edges.size() - 1); + my_adj.insert( my_adj.end(), aviter, incoming_edges.end() ); + +#ifdef PBGL_IN_PLACE_MERGE + std::size_t num_incoming_edges = incoming_edges.size(); +#ifdef PBGL_SORT_ASSERT + assert(__gnu_cxx::is_sorted(my_adj.begin(), + my_adj.end() - (num_incoming_edges-1), + std::less<vertex_descriptor>())); + assert(__gnu_cxx::is_sorted(my_adj.end() - (num_incoming_edges-1), + my_adj.end(), + std::less<vertex_descriptor>())); +#endif + std::inplace_merge(my_adj.begin(), + my_adj.end() - (num_incoming_edges - 1), + my_adj.end(), + std::less<vertex_descriptor>()); +#endif + + } + + + // Remove any adjacent vertices that are in the same component + // as a root from that root's list + for ( liter = roots.begin(); liter != roots.end(); ++liter ) + { + // We can probably get away without sorting and removing + // duplicates Though sorting *may* cause root + // determination to occur faster by choosing the root with + // the most potential to hook to at each step + std::vector<vertex_descriptor>& my_adj = adj[*liter]; + my_adj.erase + (remove_if(my_adj.begin(), my_adj.end(), + cull_adjacency_list<vertex_descriptor, + ParentMap>(*liter, p) ), + my_adj.end()); +#ifndef PBGL_IN_PLACE_MERGE + sort(my_adj.begin(), my_adj.end(), + std::less<vertex_descriptor>() ); +#endif + my_adj.erase(unique(my_adj.begin(), my_adj.end()), my_adj.end()); + } + + // Reduce result of empty root list test + all_reduce(pg, &hooked, &hooked+1, &any_hooked, + std::logical_or<bool>()); + } while ( any_hooked ); +#ifdef PARALLEL_BGL_DEBUG + if (id == 0) std::cerr << steps << " iterations.\n"; +#endif + // + // Finalize + // + + // For each vertex in g, p(v) = p(p(v)), assign parent of leaf + // vertices from first step to final parent + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) { + put(p, v, get(p, get(p, v))); + } + + synchronize(p); + } + + } // end namespace cc_detail + + template<typename Graph, typename ParentMap, typename ComponentMap> + typename property_traits<ComponentMap>::value_type + number_components_from_parents(const Graph& g, ParentMap p, ComponentMap c) + { + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + typedef typename property_traits<ComponentMap>::value_type + ComponentMapType; + + process_group_type pg = process_group(g); + + /* Build list of roots */ + std::vector<vertex_descriptor> my_roots, all_roots; + + BGL_FORALL_VERTICES_T(v, g, Graph) { + if( find( my_roots.begin(), my_roots.end(), get(p, v) ) + == my_roots.end() ) + my_roots.push_back( get(p, v) ); + } + + all_gather(pg, my_roots.begin(), my_roots.end(), all_roots); + + /* Number components */ + std::map<vertex_descriptor, ComponentMapType> comp_numbers; + ComponentMapType c_num = 0; + + // Compute component numbers + for (std::size_t i = 0; i < all_roots.size(); i++ ) + if ( comp_numbers.count(all_roots[i]) == 0 ) + comp_numbers[all_roots[i]] = c_num++; + + // Broadcast component numbers + BGL_FORALL_VERTICES_T(v, g, Graph) { + put( c, v, comp_numbers[get(p, v)] ); + } + + // Broadcast number of components + if (process_id(pg) == 0) { + typedef typename process_group_type::process_size_type + process_size_type; + for (process_size_type dest = 1, n = num_processes(pg); + dest != n; ++dest) + send(pg, dest, 0, c_num); + } + synchronize(pg); + + if (process_id(pg) != 0) receive(pg, 0, 0, c_num); + + synchronize(c); + + return c_num; + } + + template<typename Graph, typename ParentMap> + int + number_components_from_parents(const Graph& g, ParentMap p, + dummy_property_map) + { + using boost::parallel::all_reduce; + + // Count local roots. + int num_roots = 0; + BGL_FORALL_VERTICES_T(v, g, Graph) + if (get(p, v) == v) ++num_roots; + return all_reduce(g.process_group(), num_roots, std::plus<int>()); + } + + template<typename Graph, typename ComponentMap, typename ParentMap> + typename property_traits<ComponentMap>::value_type + connected_components + (const Graph& g, ComponentMap c, ParentMap p + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) + { + cc_detail::parallel_connected_components(g, p); + return number_components_from_parents(g, p, c); + } + + /* Construct ParentMap by default */ + template<typename Graph, typename ComponentMap> + typename property_traits<ComponentMap>::value_type + connected_components + ( const Graph& g, ComponentMap c + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag) ) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + std::vector<vertex_descriptor> x(num_vertices(g)); + + return connected_components + (g, c, + make_iterator_property_map(x.begin(), get(vertex_index, g))); + } +} // end namespace distributed + +using distributed::connected_components; +} // end namespace graph + +using graph::distributed::connected_components; +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_CC_HPP diff --git a/Utilities/BGL/boost/graph/distributed/connected_components_parallel_search.hpp b/Utilities/BGL/boost/graph/distributed/connected_components_parallel_search.hpp new file mode 100644 index 0000000000000000000000000000000000000000..815e3a3221948028983a6021152b97df9cec750c --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/connected_components_parallel_search.hpp @@ -0,0 +1,408 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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: Brian Barrett +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_CC_PS_HPP +#define BOOST_GRAPH_PARALLEL_CC_PS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/property_map/property_map.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/pending/indirect_cmp.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/optional.hpp> +#include <algorithm> +#include <vector> +#include <queue> +#include <limits> +#include <map> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/graph/iteration_macros.hpp> + + +// Connected components algorithm based on a parallel search. +// +// Every N nodes starts a parallel search from the first vertex in +// their local vertex list during the first superstep (the other nodes +// remain idle during the first superstep to reduce the number of +// conflicts in numbering the components). At each superstep, all new +// component mappings from remote nodes are handled. If there is no +// work from remote updates, a new vertex is removed from the local +// list and added to the work queue. +// +// Components are allocated from the component_value_allocator object, +// which ensures that a given component number is unique in the +// system, currently by using the rank and number of processes to +// stride allocations. +// +// When two components are discovered to actually be the same +// component, a mapping is created in the collisions object. The +// lower component number is prefered in the resolution, so component +// numbering resolution is consistent. After the search has exhausted +// all vertices in the graph, the mapping is shared with all +// processes, and they independently resolve the comonent mapping (so +// O((N * NP) + (V * NP)) work, in O(N + V) time, where N is the +// number of mappings and V is the number of local vertices). This +// phase can likely be significantly sped up if a clever algorithm for +// the reduction can be found. +namespace boost { namespace graph { namespace distributed { + namespace cc_ps_detail { + // Local object for allocating component numbers. There are two + // places this happens in the code, and I was getting sick of them + // getting out of sync. Components are not tightly packed in + // numbering, but are numbered to ensure each rank has its own + // independent sets of numberings. + template<typename component_value_type> + class component_value_allocator { + public: + component_value_allocator(int num, int size) : + last(0), num(num), size(size) + { + } + + component_value_type allocate(void) + { + component_value_type ret = num + (last * size); + last++; + return ret; + } + + private: + component_value_type last; + int num; + int size; + }; + + + // Map of the "collisions" between component names in the global + // component mapping. TO make cleanup easier, component numbers + // are added, pointing to themselves, when a new component is + // found. In order to make the results deterministic, the lower + // component number is always taken. The resolver will drill + // through the map until it finds a component entry that points to + // itself as the next value, allowing some cleanup to happen at + // update() time. Attempts are also made to update the mapping + // when new entries are created. + // + // Note that there's an assumption that the entire mapping is + // shared during the end of the algorithm, but before component + // name resolution. + template<typename component_value_type> + class collision_map { + public: + collision_map() : num_unique(0) + { + } + + // add new component mapping first time component is used. Own + // function only so that we can sanity check there isn't already + // a mapping for that component number (which would be bad) + void add(const component_value_type &a) + { + assert(collisions.count(a) == 0); + collisions[a] = a; + } + + // add a mapping between component values saying they're the + // same component + void add(const component_value_type &a, const component_value_type &b) + { + component_value_type high, low, tmp; + if (a > b) { + high = a; + low = b; + } else { + high = b; + low = a; + } + + if (collisions.count(high) != 0 && collisions[high] != low) { + tmp = collisions[high]; + if (tmp > low) { + collisions[tmp] = low; + collisions[high] = low; + } else { + collisions[low] = tmp; + collisions[high] = tmp; + } + } else { + collisions[high] = low; + } + + } + + // get the "real" component number for the given component. + // Used to resolve mapping at end of run. + component_value_type update(component_value_type a) + { + assert(num_unique > 0); + assert(collisions.count(a) != 0); + return collisions[a]; + } + + // collapse the collisions tree, so that update is a one lookup + // operation. Count unique components at the same time. + void uniqify(void) + { + typename std::map<component_value_type, component_value_type>::iterator i, end; + + end = collisions.end(); + for (i = collisions.begin() ; i != end ; ++i) { + if (i->first == i->second) { + num_unique++; + } else { + i->second = collisions[i->second]; + } + } + } + + // get the number of component entries that have an associated + // component number of themselves, which are the real components + // used in the final mapping. This is the number of unique + // components in the graph. + int unique(void) + { + assert(num_unique > 0); + return num_unique; + } + + // "serialize" into a vector for communication. + std::vector<component_value_type> serialize(void) + { + std::vector<component_value_type> ret; + typename std::map<component_value_type, component_value_type>::iterator i, end; + + end = collisions.end(); + for (i = collisions.begin() ; i != end ; ++i) { + ret.push_back(i->first); + ret.push_back(i->second); + } + + return ret; + } + + private: + std::map<component_value_type, component_value_type> collisions; + int num_unique; + }; + + + // resolver to handle remote updates. The resolver will add + // entries into the collisions map if required, and if it is the + // first time the vertex has been touched, it will add the vertex + // to the remote queue. Note that local updates are handled + // differently, in the main loop (below). + + // BWB - FIX ME - don't need graph anymore - can pull from key value of Component Map. + template<typename ComponentMap, typename work_queue> + struct update_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = false); + + typedef typename property_traits<ComponentMap>::value_type component_value_type; + typedef typename property_traits<ComponentMap>::key_type vertex_descriptor; + + update_reducer(work_queue *q, + cc_ps_detail::collision_map<component_value_type> *collisions, + processor_id_type pg_id) : + q(q), collisions(collisions), pg_id(pg_id) + { + } + + // ghost cell initialization routine. This should never be + // called in this imlementation. + template<typename K> + component_value_type operator()(const K&) const + { + return component_value_type(0); + } + + // resolver for remote updates. I'm not entirely sure why, but + // I decided to not change the value of the vertex if it's + // already non-infinite. It doesn't matter in the end, as we'll + // touch every vertex in the cleanup phase anyway. If the + // component is currently infinite, set to the new component + // number and add the vertex to the work queue. If it's not + // infinite, we've touched it already so don't add it to the + // work queue. Do add a collision entry so that we know the two + // components are the same. + component_value_type operator()(const vertex_descriptor &v, + const component_value_type& current, + const component_value_type& update) const + { + const component_value_type max = (std::numeric_limits<component_value_type>::max)(); + component_value_type ret = current; + + if (max == current) { + q->push(v); + ret = update; + } else if (current != update) { + collisions->add(current, update); + } + + return ret; + } + + // So for whatever reason, the property map can in theory call + // the resolver with a local descriptor in addition to the + // standard global descriptor. As far as I can tell, this code + // path is never taken in this implementation, but I need to + // have this code here to make it compile. We just make a + // global descriptor and call the "real" operator(). + template<typename K> + component_value_type operator()(const K& v, + const component_value_type& current, + const component_value_type& update) const + { + return (*this)(vertex_descriptor(pg_id, v), current, update); + } + + private: + work_queue *q; + collision_map<component_value_type> *collisions; + boost::processor_id_type pg_id; + }; + + } // namespace cc_ps_detail + + + template<typename Graph, typename ComponentMap> + typename property_traits<ComponentMap>::value_type + connected_components_ps(const Graph& g, ComponentMap c) + { + using boost::graph::parallel::process_group; + + typedef typename property_traits<ComponentMap>::value_type component_value_type; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename boost::graph::parallel::process_group_type<Graph> + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename property_map<Graph, vertex_owner_t> + ::const_type vertex_owner_map; + typedef std::queue<vertex_descriptor> work_queue; + + static const component_value_type max_component = + (std::numeric_limits<component_value_type>::max)(); + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + // standard who am i? stuff + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + // Initialize every vertex to have infinite component number + BGL_FORALL_VERTICES_T(v, g, Graph) put(c, v, max_component); + + vertex_iterator current, end; + tie(current, end) = vertices(g); + + cc_ps_detail::component_value_allocator<component_value_type> cva(process_id(pg), num_processes(pg)); + cc_ps_detail::collision_map<component_value_type> collisions; + work_queue q; // this is intentionally a local data structure + c.set_reduce(cc_ps_detail::update_reducer<ComponentMap, work_queue>(&q, &collisions, id)); + + // add starting work + while (true) { + bool useful_found = false; + component_value_type val = cva.allocate(); + put(c, *current, val); + collisions.add(val); + q.push(*current); + if (0 != out_degree(*current, g)) useful_found = true; + ++current; + if (useful_found) break; + } + + // Run the loop until everyone in the system is done + bool global_done = false; + while (!global_done) { + + // drain queue of work for this superstep + while (!q.empty()) { + vertex_descriptor v = q.front(); + q.pop(); + // iterate through outedges of the vertex currently being + // examined, setting their component to our component. There + // is no way to end up in the queue without having a component + // number already. + + BGL_FORALL_ADJ_T(v, peer, g, Graph) { + component_value_type my_component = get(c, v); + + // update other vertex with our component information. + // Resolver will handle remote collisions as well as whether + // to put the vertex on the work queue or not. We have to + // handle local collisions and work queue management + if (id == get(owner, peer)) { + if (max_component == get(c, peer)) { + put(c, peer, my_component); + q.push(peer); + } else if (my_component != get(c, peer)) { + collisions.add(my_component, get(c, peer)); + } + } else { + put(c, peer, my_component); + } + } + } + + // synchronize / start a new superstep. + synchronize(pg); + global_done = all_reduce(pg, (q.empty() && (current == end)), boost::parallel::minimum<bool>()); + + // If the queue is currently empty, add something to do to start + // the current superstep (supersteps start at the sync, not at + // the top of the while loop as one might expect). Down at the + // bottom of the while loop so that not everyone starts the + // algorithm with something to do, to try to reduce component + // name conflicts + if (q.empty()) { + bool useful_found = false; + for ( ; current != end && !useful_found ; ++current) { + if (max_component == get(c, *current)) { + component_value_type val = cva.allocate(); + put(c, *current, val); + collisions.add(val); + q.push(*current); + if (0 != out_degree(*current, g)) useful_found = true; + } + } + } + } + + // share component mappings + std::vector<component_value_type> global; + std::vector<component_value_type> mine = collisions.serialize(); + all_gather(pg, mine.begin(), mine.end(), global); + for (size_t i = 0 ; i < global.size() ; i += 2) { + collisions.add(global[i], global[i + 1]); + } + collisions.uniqify(); + + // update the component mappings + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(c, v, collisions.update(get(c, v))); + } + + return collisions.unique(); + } + +} // end namespace distributed + +} // end namespace graph + +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_CC_HPP diff --git a/Utilities/BGL/boost/graph/distributed/crauser_et_al_shortest_paths.hpp b/Utilities/BGL/boost/graph/distributed/crauser_et_al_shortest_paths.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c52ffd8f32abee7b6878f703f0898918167dbbd2 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/crauser_et_al_shortest_paths.hpp @@ -0,0 +1,664 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +/************************************************************************** + * This source file implements the variation on Dijkstra's algorithm * + * presented by Crauser et al. in: * + * * + * Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter * + * Sanders. A Parallelization of Dijkstra's Shortest Path * + * Algorithm. In Lubos Brim, Jozef Gruska, and Jiri Zlatuska, * + * editors, Mathematical Foundations of Computer Science (MFCS), * + * volume 1450 of Lecture Notes in Computer Science, pages * + * 722--731, 1998. Springer. * + * * + * This implementation is, however, restricted to the distributed-memory * + * case, where the work is distributed by virtue of the vertices being * + * distributed. In a shared-memory (single address space) context, we * + * would want to add an explicit balancing step. * + **************************************************************************/ +#ifndef BOOST_GRAPH_CRAUSER_ET_AL_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_CRAUSER_ET_AL_SHORTEST_PATHS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/distributed/detail/dijkstra_shortest_paths.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <functional> +#include <boost/graph/iteration_macros.hpp> +#include <boost/property_map/property_map_iterator.hpp> +#include <boost/type_traits/is_same.hpp> +#include <algorithm> +#include <boost/property_map/parallel/caching_property_map.hpp> +#include <boost/pending/indirect_cmp.hpp> +#include <boost/graph/distributed/detail/remote_update_set.hpp> +#include <vector> +#include <boost/graph/breadth_first_search.hpp> +#include <boost/graph/dijkstra_shortest_paths.hpp> +#include <boost/graph/parallel/container_traits.hpp> + +#ifdef PBGL_ACCOUNTING +# include <boost/graph/accounting.hpp> +# include <numeric> +#endif // PBGL_ACCOUNTING + +#ifdef MUTABLE_QUEUE +# include <boost/pending/mutable_queue.hpp> +#endif + +namespace boost { namespace graph { namespace distributed { + +#ifdef PBGL_ACCOUNTING +struct crauser_et_al_shortest_paths_stats_t +{ + /* Total wall-clock time used by the algorithm.*/ + accounting::time_type execution_time; + + /* The number of vertices deleted in each superstep. */ + std::vector<std::size_t> deleted_vertices; + + template<typename OutputStream> + void print(OutputStream& out) + { + double avg_deletions = std::accumulate(deleted_vertices.begin(), + deleted_vertices.end(), + 0.0); + avg_deletions /= deleted_vertices.size(); + + out << "Problem = \"Single-Source Shortest Paths\"\n" + << "Algorithm = \"Crauser et al\"\n" + << "Function = crauser_et_al_shortest_paths\n" + << "Wall clock time = " << accounting::print_time(execution_time) + << "\nSupersteps = " << deleted_vertices.size() << "\n" + << "Avg. deletions per superstep = " << avg_deletions << "\n"; + } +}; + +static crauser_et_al_shortest_paths_stats_t crauser_et_al_shortest_paths_stats; +#endif + +namespace detail { + + /************************************************************************ + * Function objects that perform distance comparisons modified by the * + * minimum or maximum edge weights. * + ************************************************************************/ + template<typename Vertex, typename DistanceMap, typename MinInWeightMap, + typename Combine, typename Compare> + struct min_in_distance_compare + : std::binary_function<Vertex, Vertex, bool> + { + min_in_distance_compare(DistanceMap d, MinInWeightMap m, + Combine combine, Compare compare) + : distance_map(d), min_in_weight(m), combine(combine), + compare(compare) + { + } + + bool operator()(const Vertex& x, const Vertex& y) const + { + return compare(combine(get(distance_map, x), -get(min_in_weight, x)), + combine(get(distance_map, y), -get(min_in_weight, y))); + } + + private: + DistanceMap distance_map; + MinInWeightMap min_in_weight; + Combine combine; + Compare compare; + }; + + template<typename Vertex, typename DistanceMap, typename MinOutWeightMap, + typename Combine, typename Compare> + struct min_out_distance_compare + : std::binary_function<Vertex, Vertex, bool> + { + min_out_distance_compare(DistanceMap d, MinOutWeightMap m, + Combine combine, Compare compare) + : distance_map(d), min_out_weight(m), combine(combine), + compare(compare) + { + } + + bool operator()(const Vertex& x, const Vertex& y) const + { + return compare(combine(get(distance_map, x), get(min_out_weight, x)), + combine(get(distance_map, y), get(min_out_weight, y))); + } + + private: + DistanceMap distance_map; + MinOutWeightMap min_out_weight; + Combine combine; + Compare compare; + }; + /************************************************************************/ + + /************************************************************************ + * Dijkstra queue that implements Crauser et al.'s criteria. This queue * + * actually stores three separate priority queues, to help expose all * + * vertices that can be processed in a single phase. * + ************************************************************************/ + template<typename Graph, typename Combine, + typename Compare, typename VertexIndexMap, typename DistanceMap, + typename PredecessorMap, typename MinOutWeightMap, + typename MinInWeightMap> + class crauser_et_al_dijkstra_queue + : public graph::detail::remote_update_set< + crauser_et_al_dijkstra_queue< + Graph, Combine, Compare, VertexIndexMap, DistanceMap, + PredecessorMap, MinOutWeightMap, MinInWeightMap>, + typename boost::graph::parallel::process_group_type<Graph>::type, + typename dijkstra_msg_value<DistanceMap, PredecessorMap>::type, + typename property_map<Graph, vertex_owner_t>::const_type> + { + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor; + typedef crauser_et_al_dijkstra_queue self_type; + typedef dijkstra_msg_value<DistanceMap, PredecessorMap> msg_value_creator; + typedef typename msg_value_creator::type msg_value_type; + typedef typename graph_traits<Graph>::vertices_size_type + vertices_size_type; + typedef typename property_map<Graph, vertex_owner_t>::const_type + OwnerPropertyMap; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + typedef graph::detail::remote_update_set<self_type, process_group_type, + msg_value_type, OwnerPropertyMap> + inherited; + + // Priority queue for tentative distances + typedef indirect_cmp<DistanceMap, Compare> dist_queue_compare_type; + + typedef typename property_traits<DistanceMap>::value_type distance_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue<vertex_descriptor, std::vector<vertex_descriptor>, + dist_queue_compare_type, VertexIndexMap> dist_queue_type; + +#else + typedef relaxed_heap<vertex_descriptor, dist_queue_compare_type, + VertexIndexMap> dist_queue_type; +#endif // MUTABLE_QUEUE + + // Priority queue for OUT criteria + typedef min_out_distance_compare<vertex_descriptor, DistanceMap, + MinOutWeightMap, Combine, Compare> + out_queue_compare_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue<vertex_descriptor, std::vector<vertex_descriptor>, + out_queue_compare_type, VertexIndexMap> out_queue_type; + +#else + typedef relaxed_heap<vertex_descriptor, out_queue_compare_type, + VertexIndexMap> out_queue_type; +#endif // MUTABLE_QUEUE + + // Priority queue for IN criteria + typedef min_in_distance_compare<vertex_descriptor, DistanceMap, + MinInWeightMap, Combine, Compare> + in_queue_compare_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue<vertex_descriptor, std::vector<vertex_descriptor>, + in_queue_compare_type, VertexIndexMap> in_queue_type; + +#else + typedef relaxed_heap<vertex_descriptor, in_queue_compare_type, + VertexIndexMap> in_queue_type; +#endif // MUTABLE_QUEUE + + typedef typename process_group_type::process_id_type process_id_type; + + public: + typedef typename dist_queue_type::size_type size_type; + typedef typename dist_queue_type::value_type value_type; + + crauser_et_al_dijkstra_queue(const Graph& g, + const Combine& combine, + const Compare& compare, + const VertexIndexMap& id, + const DistanceMap& distance_map, + const PredecessorMap& predecessor_map, + const MinOutWeightMap& min_out_weight, + const MinInWeightMap& min_in_weight) + : inherited(boost::graph::parallel::process_group(g), get(vertex_owner, g)), + dist_queue(num_vertices(g), + dist_queue_compare_type(distance_map, compare), + id), + out_queue(num_vertices(g), + out_queue_compare_type(distance_map, min_out_weight, + combine, compare), + id), + in_queue(num_vertices(g), + in_queue_compare_type(distance_map, min_in_weight, + combine, compare), + id), + g(g), + distance_map(distance_map), + predecessor_map(predecessor_map), + min_out_weight(min_out_weight), + min_in_weight(min_in_weight), + min_distance(0), + min_out_distance(0) +#ifdef PBGL_ACCOUNTING + , local_deletions(0) +#endif + { } + + void push(const value_type& x) + { + msg_value_type msg_value = + msg_value_creator::create(get(distance_map, x), + predecessor_value(get(predecessor_map, x))); + inherited::update(x, msg_value); + } + + void update(const value_type& x) { push(x); } + + void pop() + { + // Remove from distance queue + dist_queue.remove(top_vertex); + + // Remove from OUT queue + out_queue.remove(top_vertex); + + // Remove from IN queue + in_queue.remove(top_vertex); + +#ifdef PBGL_ACCOUNTING + ++local_deletions; +#endif + } + + vertex_descriptor& top() { return top_vertex; } + const vertex_descriptor& top() const { return top_vertex; } + + bool empty() + { + inherited::collect(); + + // If there are no suitable messages, wait until we get something + while (!has_suitable_vertex()) { + if (do_synchronize()) return true; + } + // Return true only if nobody has any messages; false if we + // have suitable messages + return false; + } + + bool do_synchronize() + { + using boost::parallel::all_reduce; + using boost::parallel::minimum; + + inherited::synchronize(); + + // TBD: could use combine here, but then we need to stop using + // minimum<distance_type>() as the function object. + distance_type local_distances[2]; + local_distances[0] = + dist_queue.empty()? (std::numeric_limits<distance_type>::max)() + : get(distance_map, dist_queue.top()); + + local_distances[1] = + out_queue.empty()? (std::numeric_limits<distance_type>::max)() + : (get(distance_map, out_queue.top()) + + get(min_out_weight, out_queue.top())); + + distance_type distances[2]; + all_reduce(this->process_group, local_distances, local_distances + 2, + distances, minimum<distance_type>()); + min_distance = distances[0]; + min_out_distance = distances[1]; + +#ifdef PBGL_ACCOUNTING + std::size_t deletions = 0; + all_reduce(this->process_group, &local_deletions, &local_deletions + 1, + &deletions, std::plus<std::size_t>()); + if (process_id(this->process_group) == 0) { + crauser_et_al_shortest_paths_stats.deleted_vertices.push_back(deletions); + } + local_deletions = 0; + assert(deletions > 0); +#endif + + return min_distance == (std::numeric_limits<distance_type>::max)(); + } + + private: + vertex_descriptor predecessor_value(vertex_descriptor v) const + { return v; } + + vertex_descriptor + predecessor_value(property_traits<dummy_property_map>::reference) const + { return graph_traits<Graph>::null_vertex(); } + + bool has_suitable_vertex() const + { + if (!dist_queue.empty()) { + top_vertex = dist_queue.top(); + if (get(distance_map, dist_queue.top()) <= min_out_distance) + return true; + } + + if (!in_queue.empty()) { + top_vertex = in_queue.top(); + return (get(distance_map, top_vertex) + - get(min_in_weight, top_vertex)) <= min_distance; + } + return false; + } + + public: + void + receive_update(process_id_type source, vertex_descriptor vertex, + distance_type distance) + { + // Update the queue if the received distance is better than + // the distance we know locally + if (distance < get(distance_map, vertex) + || (distance == get(distance_map, vertex) + && source == process_id(this->process_group))) { + // Update the local distance map + put(distance_map, vertex, distance); + + bool is_in_queue = dist_queue.contains(vertex); + + if (!is_in_queue) { + dist_queue.push(vertex); + out_queue.push(vertex); + in_queue.push(vertex); + } + else { + dist_queue.update(vertex); + out_queue.update(vertex); + in_queue.update(vertex); + } + } + } + + void + receive_update(process_id_type source, vertex_descriptor vertex, + std::pair<distance_type, vertex_descriptor> p) + { + if (p.first <= get(distance_map, vertex)) { + put(predecessor_map, vertex, p.second); + receive_update(source, vertex, p.first); + } + } + + private: + dist_queue_type dist_queue; + out_queue_type out_queue; + in_queue_type in_queue; + mutable value_type top_vertex; + const Graph& g; + DistanceMap distance_map; + PredecessorMap predecessor_map; + MinOutWeightMap min_out_weight; + MinInWeightMap min_in_weight; + distance_type min_distance; + distance_type min_out_distance; +#ifdef PBGL_ACCOUNTING + std::size_t local_deletions; +#endif + }; + /************************************************************************/ + + /************************************************************************ + * Initialize the property map that contains the minimum incoming edge * + * weight for each vertex. There are separate implementations for * + * directed, bidirectional, and undirected graph. * + ************************************************************************/ + template<typename Graph, typename MinInWeightMap, typename WeightMap, + typename Inf, typename Compare> + void + initialize_min_in_weights(const Graph& g, MinInWeightMap min_in_weight, + WeightMap weight, Inf inf, Compare compare, + directed_tag, incidence_graph_tag) + { + // Send minimum weights off to the owners + set_property_map_role(vertex_distance, min_in_weight); + BGL_FORALL_VERTICES_T(v, g, Graph) { + BGL_FORALL_OUTEDGES_T(v, e, g, Graph) { + if (get(weight, e) < get(min_in_weight, target(e, g))) + put(min_in_weight, target(e, g), get(weight, e)); + } + } + + using boost::graph::parallel::process_group; + synchronize(process_group(g)); + + // Replace any infinities with zeros + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (get(min_in_weight, v) == inf) put(min_in_weight, v, 0); + } + } + + template<typename Graph, typename MinInWeightMap, typename WeightMap, + typename Inf, typename Compare> + void + initialize_min_in_weights(const Graph& g, MinInWeightMap min_in_weight, + WeightMap weight, Inf inf, Compare compare, + directed_tag, bidirectional_graph_tag) + { +#if 0 + typename property_map<Graph, vertex_local_t>::const_type + local = get(vertex_local, g); + + // This code assumes that the properties of the in-edges are + // available locally. This is not necessarily the case, so don't + // do this yet. + set_property_map_role(vertex_distance, min_in_weight); + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (in_edges(v, g).first != in_edges(v, g).second) { + std::cerr << "weights(" << g.distribution().global(get(local, v)) + << ") = "; + BGL_FORALL_INEDGES_T(v, e, g, Graph) { + std::cerr << get(weight, e) << ' '; + } + std::cerr << std::endl; + put(min_in_weight, v, + *std::min_element + (make_property_map_iterator(weight, in_edges(v, g).first), + make_property_map_iterator(weight, in_edges(v, g).second), + compare)); + } else { + put(min_in_weight, v, 0); + } + std::cerr << "miw(" << g.distribution().global(get(local, v)) << ") = " + << get(min_in_weight, v) << std::endl; + } +#else + initialize_min_in_weights(g, min_in_weight, weight, inf, compare, + directed_tag(), incidence_graph_tag()); +#endif + } + + template<typename Graph, typename MinInWeightMap, typename WeightMap, + typename Inf, typename Compare> + inline void + initialize_min_in_weights(const Graph&, MinInWeightMap, WeightMap, Inf, + Compare, undirected_tag, bidirectional_graph_tag) + { + // In weights are the same as out weights, so do nothing + } + /************************************************************************/ + + + /************************************************************************ + * Initialize the property map that contains the minimum outgoing edge * + * weight for each vertex. * + ************************************************************************/ + template<typename Graph, typename MinOutWeightMap, typename WeightMap, + typename Compare> + void + initialize_min_out_weights(const Graph& g, MinOutWeightMap min_out_weight, + WeightMap weight, Compare compare) + { + typedef typename property_traits<WeightMap>::value_type weight_type; + + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (out_edges(v, g).first != out_edges(v, g).second) { + put(min_out_weight, v, + *std::min_element + (make_property_map_iterator(weight, out_edges(v, g).first), + make_property_map_iterator(weight, out_edges(v, g).second), + compare)); + if (get(min_out_weight, v) < weight_type(0)) + boost::throw_exception(negative_edge()); + } + } + } + + /************************************************************************/ + +} // end namespace detail + +template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, typename WeightMap, + typename IndexMap, typename ColorMap, typename Compare, + typename Combine, typename DistInf, typename DistZero> +void +crauser_et_al_shortest_paths + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) +{ + typedef typename boost::graph::parallel::process_group_type<DistributedGraph>::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename graph_traits<DistributedGraph>::vertex_descriptor + Vertex; + typedef typename graph_traits<DistributedGraph>::vertices_size_type + vertices_size_type; + +#ifdef PBGL_ACCOUNTING + crauser_et_al_shortest_paths_stats.deleted_vertices.clear(); + crauser_et_al_shortest_paths_stats.execution_time = accounting::get_time(); +#endif + + // Property map that stores the lowest edge weight outgoing from + // each vertex. If a vertex has no out-edges, the stored weight + // is zero. + typedef typename property_traits<WeightMap>::value_type weight_type; + typedef iterator_property_map<weight_type*, IndexMap> MinOutWeightMap; + std::vector<weight_type> min_out_weights_vec(num_vertices(g), inf); + MinOutWeightMap min_out_weight(&min_out_weights_vec.front(), index_map); + detail::initialize_min_out_weights(g, min_out_weight, weight, compare); + + // Property map that stores the lowest edge weight incoming to + // each vertex. For undirected graphs, this will just be a + // shallow copy of the version for outgoing edges. + typedef typename graph_traits<DistributedGraph>::directed_category + directed_category; + const bool is_undirected = + is_same<directed_category, undirected_tag>::value; + typedef MinOutWeightMap MinInWeightMap; + std::vector<weight_type> + min_in_weights_vec(is_undirected? 1 : num_vertices(g), inf); + MinInWeightMap min_in_weight(&min_in_weights_vec.front(), index_map); + typedef typename graph_traits<DistributedGraph>::traversal_category + category; + detail::initialize_min_in_weights(g, min_in_weight, weight, inf, compare, + directed_category(), category()); + + // Initialize local portion of property maps + typename graph_traits<DistributedGraph>::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(distance, *ui, inf); + put(predecessor, *ui, *ui); + } + put(distance, s, zero); + + // Dijkstra Queue + typedef detail::crauser_et_al_dijkstra_queue + <DistributedGraph, Combine, Compare, IndexMap, DistanceMap, + PredecessorMap, MinOutWeightMap, MinInWeightMap> + Queue; + + Queue Q(g, combine, compare, index_map, distance, predecessor, + min_out_weight, is_undirected? min_out_weight : min_in_weight); + + // Parallel Dijkstra visitor + ::boost::detail::dijkstra_bfs_visitor< + DijkstraVisitor, Queue, WeightMap, + boost::parallel::caching_property_map<PredecessorMap>, + boost::parallel::caching_property_map<DistanceMap>, Combine, Compare + > bfs_vis(vis, Q, weight, + boost::parallel::make_caching_property_map(predecessor), + boost::parallel::make_caching_property_map(distance), + combine, compare, zero); + + set_property_map_role(vertex_color, color_map); + set_property_map_role(vertex_distance, distance); + + breadth_first_search(g, s, Q, bfs_vis, color_map); + +#ifdef PBGL_ACCOUNTING + crauser_et_al_shortest_paths_stats.execution_time = + accounting::get_time() - crauser_et_al_shortest_paths_stats.execution_time; +#endif +} + +template<typename DistributedGraph, typename PredecessorMap, + typename DistanceMap, typename WeightMap> +void +crauser_et_al_shortest_paths + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight) +{ + typedef typename property_traits<DistanceMap>::value_type distance_type; + + std::vector<default_color_type> colors(num_vertices(g), white_color); + + crauser_et_al_shortest_paths(g, s, predecessor, distance, weight, + get(vertex_index, g), + make_iterator_property_map(&colors[0], + get(vertex_index, g)), + std::less<distance_type>(), + closed_plus<distance_type>(), + (std::numeric_limits<distance_type>::max)(), + distance_type(), + dijkstra_visitor<>()); +} + +template<typename DistributedGraph, typename PredecessorMap, + typename DistanceMap> +void +crauser_et_al_shortest_paths + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance) +{ + crauser_et_al_shortest_paths(g, s, predecessor, distance, + get(edge_weight, g)); +} + +} // end namespace distributed + +#ifdef PBGL_ACCOUNTING +using distributed::crauser_et_al_shortest_paths_stats; +#endif + +using distributed::crauser_et_al_shortest_paths; + + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_CRAUSER_ET_AL_SHORTEST_PATHS_HPP diff --git a/Utilities/BGL/boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp b/Utilities/BGL/boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3fcccf0790eececf14c10770ca28854b4062f44f --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/dehne_gotz_min_spanning_tree.hpp @@ -0,0 +1,938 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +/** + * This header implements four distributed algorithms to compute + * the minimum spanning tree (actually, minimum spanning forest) of a + * graph. All of the algorithms were implemented as specified in the + * paper by Dehne and Gotz: + * + * Frank Dehne and Silvia Gotz. Practical Parallel Algorithms for Minimum + * Spanning Trees. In Symposium on Reliable Distributed Systems, + * pages 366--371, 1998. + * + * There are four algorithm variants implemented. + */ + +#ifndef BOOST_DEHNE_GOTZ_MIN_SPANNING_TREE_HPP +#define BOOST_DEHNE_GOTZ_MIN_SPANNING_TREE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/graph_traits.hpp> +#include <boost/property_map/property_map.hpp> +#include <vector> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/limits.hpp> +#include <utility> +#include <boost/pending/disjoint_sets.hpp> +#include <boost/pending/indirect_cmp.hpp> +#include <boost/property_map/parallel/caching_property_map.hpp> +#include <boost/graph/vertex_and_edge_range.hpp> +#include <boost/graph/kruskal_min_spanning_tree.hpp> +#include <boost/iterator/counting_iterator.hpp> +#include <boost/iterator/transform_iterator.hpp> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/graph/parallel/detail/untracked_pair.hpp> +#include <cmath> + +namespace boost { namespace graph { namespace distributed { + +namespace detail { + /** + * Binary function object type that selects the (edge, weight) pair + * with the minimum weight. Used within a Boruvka merge step to select + * the candidate edges incident to each supervertex. + */ + struct smaller_weighted_edge + { + template<typename Edge, typename Weight> + std::pair<Edge, Weight> + operator()(const std::pair<Edge, Weight>& x, + const std::pair<Edge, Weight>& y) const + { return x.second < y.second? x : y; } + }; + + /** + * Unary predicate that determines if the source and target vertices + * of the given edge have the same representative within a disjoint + * sets data structure. Used to indicate when an edge is now a + * self-loop because of supervertex merging in Boruvka's algorithm. + */ + template<typename DisjointSets, typename Graph> + class do_has_same_supervertex + { + public: + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + do_has_same_supervertex(DisjointSets& dset, const Graph& g) + : dset(dset), g(g) { } + + bool operator()(edge_descriptor e) + { return dset.find_set(source(e, g)) == dset.find_set(target(e, g)); } + + private: + DisjointSets& dset; + const Graph& g; + }; + + /** + * Build a @ref do_has_same_supervertex object. + */ + template<typename DisjointSets, typename Graph> + inline do_has_same_supervertex<DisjointSets, Graph> + has_same_supervertex(DisjointSets& dset, const Graph& g) + { return do_has_same_supervertex<DisjointSets, Graph>(dset, g); } + + /** \brief A single distributed Boruvka merge step. + * + * A distributed Boruvka merge step involves computing (globally) + * the minimum weight edges incident on each supervertex and then + * merging supervertices along these edges. Once supervertices are + * merged, self-loops are eliminated. + * + * The set of parameters passed to this algorithm is large, and + * considering this algorithm in isolation there are several + * redundancies. However, the more asymptotically efficient + * distributed MSF algorithms require mixing Boruvka steps with the + * merging of local MSFs (implemented in + * merge_local_minimum_spanning_trees_step): the interaction of the + * two algorithms mandates the addition of these parameters. + * + * \param pg The process group over which communication should be + * performed. Within the distributed Boruvka algorithm, this will be + * equivalent to \code process_group(g); however, in the context of + * the mixed MSF algorithms, the process group @p pg will be a + * (non-strict) process subgroup of \code process_group(g). + * + * \param g The underlying graph on which the MSF is being + * computed. The type of @p g must model DistributedGraph, but there + * are no other requirements because the edge and (super)vertex + * lists are passed separately. + * + * \param weight_map Property map containing the weights of each + * edge. The type of this property map must model + * ReadablePropertyMap and must support caching. + * + * \param out An output iterator that will be written with the set + * of edges selected to build the MSF. Every process within the + * process group @p pg will receive all edges in the MSF. + * + * \param dset Disjoint sets data structure mapping from vertices in + * the graph @p g to their representative supervertex. + * + * \param supervertex_map Mapping from supervertex descriptors to + * indices. + * + * \param supervertices A vector containing all of the + * supervertices. Will be modified to include only the remaining + * supervertices after merging occurs. + * + * \param edge_list The list of edges that remain in the graph. This + * list will be pruned to remove self-loops once MSF edges have been + * found. + */ + template<typename ProcessGroup, typename Graph, typename WeightMap, + typename OutputIterator, typename RankMap, typename ParentMap, + typename SupervertexMap, typename Vertex, typename EdgeList> + OutputIterator + boruvka_merge_step(ProcessGroup pg, const Graph& g, WeightMap weight_map, + OutputIterator out, + disjoint_sets<RankMap, ParentMap>& dset, + SupervertexMap supervertex_map, + std::vector<Vertex>& supervertices, + EdgeList& edge_list) + { + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type + vertices_size_type; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename EdgeList::iterator edge_iterator; + typedef typename property_traits<WeightMap>::value_type + weight_type; + typedef boost::parallel::detail::untracked_pair<edge_descriptor, + weight_type> w_edge; + typedef typename property_traits<SupervertexMap>::value_type + supervertex_index; + + smaller_weighted_edge min_edge; + weight_type inf = (std::numeric_limits<weight_type>::max)(); + + // Renumber the supervertices + for (std::size_t i = 0; i < supervertices.size(); ++i) + put(supervertex_map, supervertices[i], i); + + // BSP-B1: Find local minimum-weight edges for each supervertex + std::vector<w_edge> candidate_edges(supervertices.size(), + w_edge(edge_descriptor(), inf)); + for (edge_iterator ei = edge_list.begin(); ei != edge_list.end(); ++ei) { + weight_type w = get(weight_map, *ei); + supervertex_index u = + get(supervertex_map, dset.find_set(source(*ei, g))); + supervertex_index v = + get(supervertex_map, dset.find_set(target(*ei, g))); + + if (u != v) { + candidate_edges[u] = min_edge(candidate_edges[u], w_edge(*ei, w)); + candidate_edges[v] = min_edge(candidate_edges[v], w_edge(*ei, w)); + } + } + + // BSP-B2 (a): Compute global minimum edges for each supervertex + all_reduce(pg, + &candidate_edges[0], + &candidate_edges[0] + candidate_edges.size(), + &candidate_edges[0], min_edge); + + // BSP-B2 (b): Use the edges to compute sequentially the new + // connected components and emit the edges. + for (vertices_size_type i = 0; i < candidate_edges.size(); ++i) { + if (candidate_edges[i].second != inf) { + edge_descriptor e = candidate_edges[i].first; + vertex_descriptor u = dset.find_set(source(e, g)); + vertex_descriptor v = dset.find_set(target(e, g)); + if (u != v) { + // Emit the edge, but cache the weight so everyone knows it + cache(weight_map, e, candidate_edges[i].second); + *out++ = e; + + // Link the two supervertices + dset.link(u, v); + + // Whichever vertex was reparented will be removed from the + // list of supervertices. + vertex_descriptor victim = u; + if (dset.find_set(u) == u) victim = v; + supervertices[get(supervertex_map, victim)] = + graph_traits<Graph>::null_vertex(); + } + } + } + + // BSP-B3: Eliminate self-loops + edge_list.erase(std::remove_if(edge_list.begin(), edge_list.end(), + has_same_supervertex(dset, g)), + edge_list.end()); + + // TBD: might also eliminate multiple edges between supervertices + // when the edges do not have the best weight, but this is not + // strictly necessary. + + // Eliminate supervertices that have been absorbed + supervertices.erase(std::remove(supervertices.begin(), + supervertices.end(), + graph_traits<Graph>::null_vertex()), + supervertices.end()); + + return out; + } + + /** + * An edge descriptor adaptor that reroutes the source and target + * edges to different vertices, but retains the original edge + * descriptor for, e.g., property maps. This is used when we want to + * turn a set of edges in the overall graph into a set of edges + * between supervertices. + */ + template<typename Graph> + struct supervertex_edge_descriptor + { + typedef supervertex_edge_descriptor self_type; + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + Vertex source; + Vertex target; + Edge e; + + operator Edge() const { return e; } + + friend inline bool operator==(const self_type& x, const self_type& y) + { return x.e == y.e; } + + friend inline bool operator!=(const self_type& x, const self_type& y) + { return x.e != y.e; } + }; + + template<typename Graph> + inline typename supervertex_edge_descriptor<Graph>::Vertex + source(supervertex_edge_descriptor<Graph> se, const Graph&) + { return se.source; } + + template<typename Graph> + inline typename supervertex_edge_descriptor<Graph>::Vertex + target(supervertex_edge_descriptor<Graph> se, const Graph&) + { return se.target; } + + /** + * Build a supervertex edge descriptor from a normal edge descriptor + * using the given disjoint sets data structure to identify + * supervertex representatives. + */ + template<typename Graph, typename DisjointSets> + struct build_supervertex_edge_descriptor + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + typedef Edge argument_type; + typedef supervertex_edge_descriptor<Graph> result_type; + + build_supervertex_edge_descriptor() : g(0), dsets(0) { } + + build_supervertex_edge_descriptor(const Graph& g, DisjointSets& dsets) + : g(&g), dsets(&dsets) { } + + result_type operator()(argument_type e) const + { + result_type result; + result.source = dsets->find_set(source(e, *g)); + result.target = dsets->find_set(target(e, *g)); + result.e = e; + return result; + } + + private: + const Graph* g; + DisjointSets* dsets; + }; + + template<typename Graph, typename DisjointSets> + inline build_supervertex_edge_descriptor<Graph, DisjointSets> + make_supervertex_edge_descriptor(const Graph& g, DisjointSets& dsets) + { return build_supervertex_edge_descriptor<Graph, DisjointSets>(g, dsets); } + + template<typename T> + struct identity_function + { + typedef T argument_type; + typedef T result_type; + + result_type operator()(argument_type x) const { return x; } + }; + + template<typename Graph, typename DisjointSets, typename EdgeMapper> + class is_not_msf_edge + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + public: + is_not_msf_edge(const Graph& g, DisjointSets dset, EdgeMapper edge_mapper) + : g(g), dset(dset), edge_mapper(edge_mapper) { } + + bool operator()(Edge e) + { + Vertex u = dset.find_set(source(edge_mapper(e), g)); + Vertex v = dset.find_set(target(edge_mapper(e), g)); + if (u == v) return true; + else { + dset.link(u, v); + return false; + } + } + + private: + const Graph& g; + DisjointSets dset; + EdgeMapper edge_mapper; + }; + + template<typename Graph, typename ForwardIterator, typename EdgeList, + typename EdgeMapper, typename RankMap, typename ParentMap> + void + sorted_mutating_kruskal(const Graph& g, + ForwardIterator first_vertex, + ForwardIterator last_vertex, + EdgeList& edge_list, EdgeMapper edge_mapper, + RankMap rank_map, ParentMap parent_map) + { + typedef disjoint_sets<RankMap, ParentMap> DisjointSets; + + // Build and initialize disjoint-sets data structure + DisjointSets dset(rank_map, parent_map); + for (ForwardIterator v = first_vertex; v != last_vertex; ++v) + dset.make_set(*v); + + is_not_msf_edge<Graph, DisjointSets, EdgeMapper> + remove_non_msf_edges(g, dset, edge_mapper); + edge_list.erase(std::remove_if(edge_list.begin(), edge_list.end(), + remove_non_msf_edges), + edge_list.end()); + } + + /** + * Merge local minimum spanning forests from p processes into + * minimum spanning forests on p/D processes (where D is the tree + * factor, currently fixed at 3), eliminating unnecessary edges in + * the process. + * + * As with @ref boruvka_merge_step, this routine has many + * parameters, not all of which make sense within the limited + * context of this routine. The parameters are required for the + * Boruvka and local MSF merging steps to interoperate. + * + * \param pg The process group on which local minimum spanning + * forests should be merged. The top (D-1)p/D processes will be + * eliminated, and a new process subgroup containing p/D processors + * will be returned. The value D is a constant factor that is + * currently fixed to 3. + * + * \param g The underlying graph whose MSF is being computed. It must model + * the DistributedGraph concept. + * + * \param first_vertex Iterator to the first vertex in the graph + * that should be considered. While the local MSF merging algorithm + * typically operates on the entire vertex set, within the hybrid + * distributed MSF algorithms this will refer to the first + * supervertex. + * + * \param last_vertex The past-the-end iterator for the vertex list. + * + * \param edge_list The list of local edges that will be + * considered. For the p/D processes that remain, this list will + * contain edges in the MSF known to the vertex after other + * processes' edge lists have been merged. The edge list must be + * sorted in order of increasing weight. + * + * \param weight Property map containing the weights of each + * edge. The type of this property map must model + * ReadablePropertyMap and must support caching. + * + * \param global_index Mapping from vertex descriptors to a global + * index. The type must model ReadablePropertyMap. + * + * \param edge_mapper A function object that can remap edge descriptors + * in the edge list to any alternative edge descriptor. This + * function object will be the identity function when a pure merging + * of local MSFs is required, but may be a mapping to a supervertex + * edge when the local MSF merging occurs on a supervertex + * graph. This function object saves us the trouble of having to + * build a supervertex graph adaptor. + * + * \param already_local_msf True when the edge list already + * constitutes a local MSF. If false, Kruskal's algorithm will first + * be applied to the local edge list to select MSF edges. + * + * \returns The process subgroup containing the remaining p/D + * processes. If the size of this process group is greater than one, + * the MSF edges contained in the edge list do not constitute an MSF + * for the entire graph. + */ + template<typename ProcessGroup, typename Graph, typename ForwardIterator, + typename EdgeList, typename WeightMap, typename GlobalIndexMap, + typename EdgeMapper> + ProcessGroup + merge_local_minimum_spanning_trees_step(ProcessGroup pg, + const Graph& g, + ForwardIterator first_vertex, + ForwardIterator last_vertex, + EdgeList& edge_list, + WeightMap weight, + GlobalIndexMap global_index, + EdgeMapper edge_mapper, + bool already_local_msf) + { + typedef typename ProcessGroup::process_id_type process_id_type; + typedef typename EdgeList::value_type edge_descriptor; + typedef typename property_traits<WeightMap>::value_type weight_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + // The tree factor, often called "D" + process_id_type const tree_factor = 3; + process_id_type num_procs = num_processes(pg); + process_id_type id = process_id(pg); + process_id_type procs_left = (num_procs + tree_factor - 1) / tree_factor; + std::size_t n = std::size_t(last_vertex - first_vertex); + + if (!already_local_msf) { + // Compute local minimum spanning forest. We only care about the + // edges in the MSF, because only edges in the local MSF can be in + // the global MSF. + std::vector<std::size_t> ranks(n); + std::vector<vertex_descriptor> parents(n); + detail::sorted_mutating_kruskal + (g, first_vertex, last_vertex, + edge_list, edge_mapper, + make_iterator_property_map(ranks.begin(), global_index), + make_iterator_property_map(parents.begin(), global_index)); + } + + typedef std::pair<edge_descriptor, weight_type> w_edge; + + // Order edges based on their weights. + indirect_cmp<WeightMap, std::less<weight_type> > cmp_edge_weight(weight); + + if (id < procs_left) { + // The p/D processes that remain will receive local MSF edges from + // D-1 other processes. + synchronize(pg); + for (process_id_type from_id = procs_left + id; from_id < num_procs; + from_id += procs_left) { + std::size_t num_incoming_edges; + receive(pg, from_id, 0, num_incoming_edges); + if (num_incoming_edges > 0) { + std::vector<w_edge> incoming_edges(num_incoming_edges); + receive(pg, from_id, 1, &incoming_edges[0], num_incoming_edges); + + edge_list.reserve(edge_list.size() + num_incoming_edges); + for (std::size_t i = 0; i < num_incoming_edges; ++i) { + cache(weight, incoming_edges[i].first, incoming_edges[i].second); + edge_list.push_back(incoming_edges[i].first); + } + std::inplace_merge(edge_list.begin(), + edge_list.end() - num_incoming_edges, + edge_list.end(), + cmp_edge_weight); + } + } + + // Compute the local MSF from union of the edges in the MSFs of + // all children. + std::vector<std::size_t> ranks(n); + std::vector<vertex_descriptor> parents(n); + detail::sorted_mutating_kruskal + (g, first_vertex, last_vertex, + edge_list, edge_mapper, + make_iterator_property_map(ranks.begin(), global_index), + make_iterator_property_map(parents.begin(), global_index)); + } else { + // The (D-1)p/D processes that are dropping out of further + // computations merely send their MSF edges to their parent + // process in the process tree. + send(pg, id % procs_left, 0, edge_list.size()); + if (edge_list.size() > 0) { + std::vector<w_edge> outgoing_edges; + outgoing_edges.reserve(edge_list.size()); + for (std::size_t i = 0; i < edge_list.size(); ++i) { + outgoing_edges.push_back(std::make_pair(edge_list[i], + get(weight, edge_list[i]))); + } + send(pg, id % procs_left, 1, &outgoing_edges[0], + outgoing_edges.size()); + } + synchronize(pg); + } + + // Return a process subgroup containing the p/D parent processes + return process_subgroup(pg, + make_counting_iterator(process_id_type(0)), + make_counting_iterator(procs_left)); + } +} // end namespace detail + +// --------------------------------------------------------------------- +// Dense Boruvka MSF algorithm +// --------------------------------------------------------------------- +template<typename Graph, typename WeightMap, typename OutputIterator, + typename VertexIndexMap, typename RankMap, typename ParentMap, + typename SupervertexMap> +OutputIterator +dense_boruvka_minimum_spanning_tree(const Graph& g, WeightMap weight_map, + OutputIterator out, + VertexIndexMap index_map, + RankMap rank_map, ParentMap parent_map, + SupervertexMap supervertex_map) +{ + using boost::graph::parallel::process_group; + + typedef typename graph_traits<Graph>::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible<traversal_category*, + vertex_list_graph_tag*>::value)); + + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight_map.set_max_ghost_cells(0); + + // Initialize the disjoint sets structures + disjoint_sets<RankMap, ParentMap> dset(rank_map, parent_map); + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + dset.make_set(*vi); + + std::vector<vertex_descriptor> supervertices; + supervertices.assign(vertices(g).first, vertices(g).second); + + // Use Kruskal's algorithm to find the minimum spanning forest + // considering only the local edges. The resulting edges are not + // necessarily going to be in the final minimum spanning + // forest. However, any edge not part of the local MSF cannot be a + // part of the global MSF, so we should have eliminated some edges + // from consideration. + std::vector<edge_descriptor> edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight_map). + vertex_index_map(index_map)); + + // While the number of supervertices is decreasing, keep executing + // Boruvka steps to identify additional MSF edges. This loop will + // execute log |V| times. + vertices_size_type old_num_supervertices; + do { + old_num_supervertices = supervertices.size(); + out = detail::boruvka_merge_step(process_group(g), g, + weight_map, out, + dset, supervertex_map, supervertices, + edge_list); + } while (supervertices.size() < old_num_supervertices); + + return out; +} + +template<typename Graph, typename WeightMap, typename OutputIterator, + typename VertexIndex> +OutputIterator +dense_boruvka_minimum_spanning_tree(const Graph& g, WeightMap weight_map, + OutputIterator out, VertexIndex i_map) +{ + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + std::vector<std::size_t> ranks(num_vertices(g)); + std::vector<vertex_descriptor> parents(num_vertices(g)); + std::vector<std::size_t> supervertices(num_vertices(g)); + + return dense_boruvka_minimum_spanning_tree + (g, weight_map, out, i_map, + make_iterator_property_map(ranks.begin(), i_map), + make_iterator_property_map(parents.begin(), i_map), + make_iterator_property_map(supervertices.begin(), i_map)); +} + +template<typename Graph, typename WeightMap, typename OutputIterator> +OutputIterator +dense_boruvka_minimum_spanning_tree(const Graph& g, WeightMap weight_map, + OutputIterator out) +{ + return dense_boruvka_minimum_spanning_tree(g, weight_map, out, + get(vertex_index, g)); +} + +// --------------------------------------------------------------------- +// Merge local MSFs MSF algorithm +// --------------------------------------------------------------------- +template<typename Graph, typename WeightMap, typename OutputIterator, + typename GlobalIndexMap> +OutputIterator +merge_local_minimum_spanning_trees(const Graph& g, WeightMap weight, + OutputIterator out, + GlobalIndexMap global_index) +{ + using boost::graph::parallel::process_group_type; + using boost::graph::parallel::process_group; + + typedef typename graph_traits<Graph>::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible<traversal_category*, + vertex_list_graph_tag*>::value)); + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight.set_max_ghost_cells(0); + + // Compute the initial local minimum spanning forests + std::vector<edge_descriptor> edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight).vertex_index_map(global_index)); + + // Merge the local MSFs from p processes into p/D processes, + // reducing the number of processes in each step. Continue looping + // until either (a) the current process drops out or (b) only one + // process remains in the group. This loop will execute log_D p + // times. + typename process_group_type<Graph>::type pg = process_group(g); + while (pg && num_processes(pg) > 1) { + pg = detail::merge_local_minimum_spanning_trees_step + (pg, g, vertices(g).first, vertices(g).second, + edge_list, weight, global_index, + detail::identity_function<edge_descriptor>(), true); + } + + // Only process 0 has the entire edge list, so emit it to the output + // iterator. + if (pg && process_id(pg) == 0) { + out = std::copy(edge_list.begin(), edge_list.end(), out); + } + + synchronize(process_group(g)); + return out; +} + +template<typename Graph, typename WeightMap, typename OutputIterator> +inline OutputIterator +merge_local_minimum_spanning_trees(const Graph& g, WeightMap weight, + OutputIterator out) +{ + return merge_local_minimum_spanning_trees(g, weight, out, + get(vertex_index, g)); +} + +// --------------------------------------------------------------------- +// Boruvka-then-merge MSF algorithm +// --------------------------------------------------------------------- +template<typename Graph, typename WeightMap, typename OutputIterator, + typename GlobalIndexMap, typename RankMap, typename ParentMap, + typename SupervertexMap> +OutputIterator +boruvka_then_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index, RankMap rank_map, + ParentMap parent_map, SupervertexMap supervertex_map) +{ + using std::log; + using boost::graph::parallel::process_group_type; + using boost::graph::parallel::process_group; + + typedef typename graph_traits<Graph>::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible<traversal_category*, + vertex_list_graph_tag*>::value)); + + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight.set_max_ghost_cells(0); + + // Compute the initial local minimum spanning forests + std::vector<edge_descriptor> edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight). + vertex_index_map(index)); + + // Initialize the disjoint sets structures for Boruvka steps + disjoint_sets<RankMap, ParentMap> dset(rank_map, parent_map); + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + dset.make_set(*vi); + + // Construct the initial set of supervertices (all vertices) + std::vector<vertex_descriptor> supervertices; + supervertices.assign(vertices(g).first, vertices(g).second); + + // Continue performing Boruvka merge steps until the number of + // supervertices reaches |V| / (log_D p)^2. + const std::size_t tree_factor = 3; // TBD: same as above! should be param + double log_d_p = log((double)num_processes(process_group(g))) + / log((double)tree_factor); + vertices_size_type target_supervertices = + vertices_size_type(num_vertices(g) / (log_d_p * log_d_p)); + vertices_size_type old_num_supervertices; + while (supervertices.size() > target_supervertices) { + old_num_supervertices = supervertices.size(); + out = detail::boruvka_merge_step(process_group(g), g, + weight, out, dset, + supervertex_map, supervertices, + edge_list); + if (supervertices.size() == old_num_supervertices) + return out; + } + + // Renumber the supervertices + for (std::size_t i = 0; i < supervertices.size(); ++i) + put(supervertex_map, supervertices[i], i); + + // Merge local MSFs on the supervertices. (D-1)p/D processors drop + // out each iteration, so this loop executes log_D p times. + typename process_group_type<Graph>::type pg = process_group(g); + bool have_msf = false; + while (pg && num_processes(pg) > 1) { + pg = detail::merge_local_minimum_spanning_trees_step + (pg, g, supervertices.begin(), supervertices.end(), + edge_list, weight, supervertex_map, + detail::make_supervertex_edge_descriptor(g, dset), + have_msf); + have_msf = true; + } + + // Only process 0 has the complete list of _supervertex_ MST edges, + // so emit those to the output iterator. This is not the complete + // list of edges in the MSF, however: the Boruvka steps in the + // beginning of the algorithm emitted any edges used to merge + // supervertices. + if (pg && process_id(pg) == 0) + out = std::copy(edge_list.begin(), edge_list.end(), out); + + synchronize(process_group(g)); + return out; +} + +template<typename Graph, typename WeightMap, typename OutputIterator, + typename GlobalIndexMap> +inline OutputIterator +boruvka_then_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index) +{ + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + std::vector<vertices_size_type> ranks(num_vertices(g)); + std::vector<vertex_descriptor> parents(num_vertices(g)); + std::vector<vertices_size_type> supervertex_indices(num_vertices(g)); + + return boruvka_then_merge + (g, weight, out, index, + make_iterator_property_map(ranks.begin(), index), + make_iterator_property_map(parents.begin(), index), + make_iterator_property_map(supervertex_indices.begin(), index)); +} + +template<typename Graph, typename WeightMap, typename OutputIterator> +inline OutputIterator +boruvka_then_merge(const Graph& g, WeightMap weight, OutputIterator out) +{ return boruvka_then_merge(g, weight, out, get(vertex_index, g)); } + +// --------------------------------------------------------------------- +// Boruvka-mixed-merge MSF algorithm +// --------------------------------------------------------------------- +template<typename Graph, typename WeightMap, typename OutputIterator, + typename GlobalIndexMap, typename RankMap, typename ParentMap, + typename SupervertexMap> +OutputIterator +boruvka_mixed_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index, RankMap rank_map, + ParentMap parent_map, SupervertexMap supervertex_map) +{ + using boost::graph::parallel::process_group_type; + using boost::graph::parallel::process_group; + + typedef typename graph_traits<Graph>::traversal_category traversal_category; + + BOOST_STATIC_ASSERT((is_convertible<traversal_category*, + vertex_list_graph_tag*>::value)); + + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + // Don't throw away cached edge weights + weight.set_max_ghost_cells(0); + + // Initialize the disjoint sets structures for Boruvka steps + disjoint_sets<RankMap, ParentMap> dset(rank_map, parent_map); + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + dset.make_set(*vi); + + // Construct the initial set of supervertices (all vertices) + std::vector<vertex_descriptor> supervertices; + supervertices.assign(vertices(g).first, vertices(g).second); + + // Compute the initial local minimum spanning forests + std::vector<edge_descriptor> edge_list; + kruskal_minimum_spanning_tree + (make_vertex_and_edge_range(g, vertices(g).first, vertices(g).second, + edges(g).first, edges(g).second), + std::back_inserter(edge_list), + boost::weight_map(weight). + vertex_index_map(index)); + + if (num_processes(process_group(g)) == 1) { + return std::copy(edge_list.begin(), edge_list.end(), out); + } + + // Like the merging local MSFs algorithm and the Boruvka-then-merge + // algorithm, each iteration of this loop reduces the number of + // processes by a constant factor D, and therefore we require log_D + // p iterations. Note also that the number of edges in the edge list + // decreases geometrically, giving us an efficient distributed MSF + // algorithm. + typename process_group_type<Graph>::type pg = process_group(g); + vertices_size_type old_num_supervertices; + while (pg && num_processes(pg) > 1) { + // A single Boruvka step. If this doesn't change anything, we're done + old_num_supervertices = supervertices.size(); + out = detail::boruvka_merge_step(pg, g, weight, out, dset, + supervertex_map, supervertices, + edge_list); + if (old_num_supervertices == supervertices.size()) { + edge_list.clear(); + break; + } + + // Renumber the supervertices + for (std::size_t i = 0; i < supervertices.size(); ++i) + put(supervertex_map, supervertices[i], i); + + // A single merging of local MSTs, which reduces the number of + // processes we're using by a constant factor D. + pg = detail::merge_local_minimum_spanning_trees_step + (pg, g, supervertices.begin(), supervertices.end(), + edge_list, weight, supervertex_map, + detail::make_supervertex_edge_descriptor(g, dset), + true); + + } + + // Only process 0 has the complete edge list, so emit it for the + // user. Note that list edge list only contains the MSF edges in the + // final supervertex graph: all of the other edges were used to + // merge supervertices and have been emitted by the Boruvka steps, + // although only process 0 has received the complete set. + if (pg && process_id(pg) == 0) + out = std::copy(edge_list.begin(), edge_list.end(), out); + + synchronize(process_group(g)); + return out; +} + +template<typename Graph, typename WeightMap, typename OutputIterator, + typename GlobalIndexMap> +inline OutputIterator +boruvka_mixed_merge(const Graph& g, WeightMap weight, OutputIterator out, + GlobalIndexMap index) +{ + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + std::vector<vertices_size_type> ranks(num_vertices(g)); + std::vector<vertex_descriptor> parents(num_vertices(g)); + std::vector<vertices_size_type> supervertex_indices(num_vertices(g)); + + return boruvka_mixed_merge + (g, weight, out, index, + make_iterator_property_map(ranks.begin(), index), + make_iterator_property_map(parents.begin(), index), + make_iterator_property_map(supervertex_indices.begin(), index)); +} + +template<typename Graph, typename WeightMap, typename OutputIterator> +inline OutputIterator +boruvka_mixed_merge(const Graph& g, WeightMap weight, OutputIterator out) +{ return boruvka_mixed_merge(g, weight, out, get(vertex_index, g)); } + +} // end namespace distributed + +using distributed::dense_boruvka_minimum_spanning_tree; +using distributed::merge_local_minimum_spanning_trees; +using distributed::boruvka_then_merge; +using distributed::boruvka_mixed_merge; + +} } // end namespace boost::graph + + +#endif // BOOST_DEHNE_GOTZ_MIN_SPANNING_TREE_HPP diff --git a/Utilities/BGL/boost/graph/distributed/delta_stepping_shortest_paths.hpp b/Utilities/BGL/boost/graph/distributed/delta_stepping_shortest_paths.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ab1655b47418c3fee1acf20b069fdcfd03c0428c --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/delta_stepping_shortest_paths.hpp @@ -0,0 +1,513 @@ +// Copyright (C) 2007 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +/************************************************************************** + * This source file implements the Delta-stepping algorithm: * + * * + * Ulrich Meyer and Peter Sanders. Parallel Shortest Path for Arbitrary * + * Graphs. In Proceedings from the 6th International Euro-Par * + * Conference on Parallel Processing, pages 461--470, 2000. * + * * + * Ulrich Meyer, Peter Sanders: [Delta]-stepping: A Parallelizable * + * Shortest Path Algorithm. J. Algorithms 49(1): 114-152, 2003. * + * * + * There are several potential optimizations we could still perform for * + * this algorithm implementation: * + * * + * - Implement "shortcuts", which bound the number of reinsertions * + * in a single bucket (to one). The computation of shortcuts looks * + * expensive in a distributed-memory setting, but it could be * + * ammortized over many queries. * + * * + * - The size of the "buckets" data structure can be bounded to * + * max_edge_weight/delta buckets, if we treat the buckets as a * + * circular array. * + * * + * - If we partition light/heavy edges ahead of time, we could improve * + * relaxation performance by only iterating over the right portion * + * of the out-edge list each time. * + * * + * - Implement a more sophisticated algorithm for guessing "delta", * + * based on the shortcut-finding algorithm. * + **************************************************************************/ +#ifndef BOOST_GRAPH_DELTA_STEPPING_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_DELTA_STEPPING_SHORTEST_PATHS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/config.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <limits> +#include <list> +#include <vector> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/distributed/detail/dijkstra_shortest_paths.hpp> +#include <utility> // for std::pair +#include <functional> // for std::logical_or +#include <boost/graph/parallel/algorithm.hpp> // for all_reduce +#include <cassert> +#include <algorithm> // for std::min, std::max +#include <boost/graph/parallel/simple_trigger.hpp> + +#ifdef PBGL_DELTA_STEPPING_DEBUG +# include <iostream> // for std::cerr +#endif + +namespace boost { namespace graph { namespace distributed { + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +class delta_stepping_impl { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::degree_size_type Degree; + typedef typename property_traits<EdgeWeightMap>::value_type Dist; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + ProcessGroup; + + typedef std::list<Vertex> Bucket; + typedef typename Bucket::iterator BucketIterator; + typedef typename std::vector<Bucket*>::size_type BucketIndex; + + typedef detail::dijkstra_msg_value<DistanceMap, PredecessorMap> MessageValue; + + enum { + // Relax a remote vertex. The message contains a pair<Vertex, + // MessageValue>, the first part of which is the vertex whose + // tentative distance is being relaxed and the second part + // contains either the new distance (if there is no predecessor + // map) or a pair with the distance and predecessor. + msg_relax + }; + +public: + delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight, + Dist delta); + + delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight); + + void run(Vertex s); + +private: + // Relax the edge (u, v), creating a new best path of distance x. + void relax(Vertex u, Vertex v, Dist x); + + // Synchronize all of the processes, by receiving all messages that + // have not yet been received. + void synchronize(); + + // Handle a relax message that contains only the target and + // distance. This kind of message will be received when the + // predecessor map is a dummy_property_map. + void handle_relax_message(Vertex v, Dist x) { relax(v, v, x); } + + // Handle a relax message that contains the source (predecessor), + // target, and distance. This kind of message will be received when + // the predecessor map is not a dummy_property_map. + void handle_relax_message(Vertex v, const std::pair<Dist, Vertex>& p) + { relax(p.second, v, p.first); } + + // Setup triggers for msg_relax messages + void setup_triggers(); + + void handle_msg_relax(int /*source*/, int /*tag*/, + const std::pair<Vertex, typename MessageValue::type>& data, + trigger_receive_context) + { handle_relax_message(data.first, data.second); } + + const Graph& g; + PredecessorMap predecessor; + DistanceMap distance; + EdgeWeightMap weight; + Dist delta; + ProcessGroup pg; + typename property_map<Graph, vertex_owner_t>::const_type owner; + typename property_map<Graph, vertex_local_t>::const_type local; + + // A "property map" that contains the position of each vertex in + // whatever bucket it resides in. + std::vector<BucketIterator> position_in_bucket; + + // Bucket data structure. The ith bucket contains all local vertices + // with (tentative) distance in the range [i*delta, + // (i+1)*delta). + std::vector<Bucket*> buckets; + + // This "dummy" list is used only so that we can initialize the + // position_in_bucket property map with non-singular iterators. This + // won't matter for most implementations of the C++ Standard + // Library, but it avoids undefined behavior and allows us to run + // with library "debug modes". + std::list<Vertex> dummy_list; + + // A "property map" that states which vertices have been deleted + // from the bucket in this iteration. + std::vector<bool> vertex_was_deleted; +}; + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap>:: +delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight, + Dist delta) + : g(g), + predecessor(predecessor), + distance(distance), + weight(weight), + delta(delta), + pg(boost::graph::parallel::process_group_adl(g), attach_distributed_object()), + owner(get(vertex_owner, g)), + local(get(vertex_local, g)) +{ + setup_triggers(); +} + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap>:: +delta_stepping_impl(const Graph& g, + PredecessorMap predecessor, + DistanceMap distance, + EdgeWeightMap weight) + : g(g), + predecessor(predecessor), + distance(distance), + weight(weight), + pg(boost::graph::parallel::process_group_adl(g), attach_distributed_object()), + owner(get(vertex_owner, g)), + local(get(vertex_local, g)) +{ + using boost::parallel::all_reduce; + using boost::parallel::maximum; + using std::max; + + // Compute the maximum edge weight and degree + Dist max_edge_weight = 0; + Degree max_degree = 0; + BGL_FORALL_VERTICES_T(u, g, Graph) { + max_degree = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_degree, out_degree(u, g)); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + max_edge_weight = max BOOST_PREVENT_MACRO_SUBSTITUTION (max_edge_weight, get(weight, e)); + } + + max_edge_weight = all_reduce(pg, max_edge_weight, maximum<Dist>()); + max_degree = all_reduce(pg, max_degree, maximum<Degree>()); + + // Take a guess at delta, based on what works well for random + // graphs. + delta = max_edge_weight / max_degree; + if (delta == 0) + delta = 1; + + setup_triggers(); +} + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +void +delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap>:: +run(Vertex s) +{ + Dist inf = (std::numeric_limits<Dist>::max)(); + + // None of the vertices are stored in the bucket. + position_in_bucket.clear(); + position_in_bucket.resize(num_vertices(g), dummy_list.end()); + + // None of the vertices have been deleted + vertex_was_deleted.clear(); + vertex_was_deleted.resize(num_vertices(g), false); + + // No path from s to any other vertex, yet + BGL_FORALL_VERTICES_T(v, g, Graph) + put(distance, v, inf); + + // The distance to the starting node is zero + if (get(owner, s) == process_id(pg)) + // Put "s" into its bucket (bucket 0) + relax(s, s, 0); + else + // Note that we know the distance to s is zero + cache(distance, s, 0); + + BucketIndex max_bucket = (std::numeric_limits<BucketIndex>::max)(); + BucketIndex current_bucket = 0; + do { + // Synchronize with all of the other processes. + synchronize(); + + // Find the next bucket that has something in it. + while (current_bucket < buckets.size() + && (!buckets[current_bucket] || buckets[current_bucket]->empty())) + ++current_bucket; + if (current_bucket >= buckets.size()) + current_bucket = max_bucket; + +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": lowest bucket is #" + << current_bucket << std::endl; +#endif + // Find the smallest bucket (over all processes) that has vertices + // that need to be processed. + using boost::parallel::all_reduce; + using boost::parallel::minimum; + current_bucket = all_reduce(pg, current_bucket, minimum<BucketIndex>()); + + if (current_bucket == max_bucket) + // There are no non-empty buckets in any process; exit. + break; + +#ifdef PBGL_DELTA_STEPPING_DEBUG + if (process_id(pg) == 0) + std::cerr << "Processing bucket #" << current_bucket << std::endl; +#endif + + // Contains the set of vertices that have been deleted in the + // relaxation of "light" edges. Note that we keep track of which + // vertices were deleted with the property map + // "vertex_was_deleted". + std::vector<Vertex> deleted_vertices; + + // Repeatedly relax light edges + bool nonempty_bucket; + do { + // Someone has work to do in this bucket. + + if (current_bucket < buckets.size() && buckets[current_bucket]) { + Bucket& bucket = *buckets[current_bucket]; + // For each element in the bucket + while (!bucket.empty()) { + Vertex u = bucket.front(); + +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": processing vertex " + << get(vertex_global, g, u).second << "@" + << get(vertex_global, g, u).first + << std::endl; +#endif + + // Remove u from the front of the bucket + bucket.pop_front(); + + // Insert u into the set of deleted vertices, if it hasn't + // been done already. + if (!vertex_was_deleted[get(local, u)]) { + vertex_was_deleted[get(local, u)] = true; + deleted_vertices.push_back(u); + } + + // Relax each light edge. + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) <= delta) // light edge + relax(u, target(e, g), u_dist + get(weight, e)); + } + } + + // Synchronize with all of the other processes. + synchronize(); + + // Is the bucket empty now? + nonempty_bucket = (current_bucket < buckets.size() + && buckets[current_bucket] + && !buckets[current_bucket]->empty()); + } while (all_reduce(pg, nonempty_bucket, std::logical_or<bool>())); + + // Relax heavy edges for each of the vertices that we previously + // deleted. + for (typename std::vector<Vertex>::iterator iter = deleted_vertices.begin(); + iter != deleted_vertices.end(); ++iter) { + // Relax each heavy edge. + Vertex u = *iter; + Dist u_dist = get(distance, u); + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + if (get(weight, e) > delta) // heavy edge + relax(u, target(e, g), u_dist + get(weight, e)); + } + + // Go to the next bucket: the current bucket must already be empty. + ++current_bucket; + } while (true); + + // Delete all of the buckets. + for (typename std::vector<Bucket*>::iterator iter = buckets.begin(); + iter != buckets.end(); ++iter) { + if (*iter) { + delete *iter; + *iter = 0; + } + } +} + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +void +delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap>:: +relax(Vertex u, Vertex v, Dist x) +{ +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": relax(" + << get(vertex_global, g, u).second << "@" + << get(vertex_global, g, u).first << ", " + << get(vertex_global, g, v).second << "@" + << get(vertex_global, g, v).first << ", " + << x << ")" << std::endl; +#endif + + if (x < get(distance, v)) { + // We're relaxing the edge to vertex v. + if (get(owner, v) == process_id(pg)) { + // Compute the new bucket index for v + BucketIndex new_index = static_cast<BucketIndex>(x / delta); + + // Make sure there is enough room in the buckets data structure. + if (new_index >= buckets.size()) buckets.resize(new_index + 1, 0); + + // Make sure that we have allocated the bucket itself. + if (!buckets[new_index]) buckets[new_index] = new Bucket; + + if (get(distance, v) != (std::numeric_limits<Dist>::max)() + && !vertex_was_deleted[get(local, v)]) { + // We're moving v from an old bucket into a new one. Compute + // the old index, then splice it in. + BucketIndex old_index + = static_cast<BucketIndex>(get(distance, v) / delta); + buckets[new_index]->splice(buckets[new_index]->end(), + *buckets[old_index], + position_in_bucket[get(local, v)]); + } else { + // We're inserting v into a bucket for the first time. Put it + // at the end. + buckets[new_index]->push_back(v); + } + + // v is now at the last position in the new bucket + position_in_bucket[get(local, v)] = buckets[new_index]->end(); + --position_in_bucket[get(local, v)]; + + // Update predecessor and tentative distance information + put(predecessor, v, u); + put(distance, v, x); + } else { +#ifdef PBGL_DELTA_STEPPING_DEBUG + std::cerr << "#" << process_id(pg) << ": sending relax(" + << get(vertex_global, g, u).second << "@" + << get(vertex_global, g, u).first << ", " + << get(vertex_global, g, v).second << "@" + << get(vertex_global, g, v).first << ", " + << x << ") to " << get(owner, v) << std::endl; + +#endif + // The vertex is remote: send a request to the vertex's owner + send(pg, get(owner, v), msg_relax, + std::make_pair(v, MessageValue::create(x, u))); + + // Cache tentative distance information + cache(distance, v, x); + } + } +} + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +void +delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap>:: +synchronize() +{ + using boost::graph::parallel::synchronize; + + // Synchronize at the process group level. + synchronize(pg); + + // Receive any relaxation request messages. +// typedef typename ProcessGroup::process_id_type process_id_type; +// while (optional<std::pair<process_id_type, int> > stp = probe(pg)) { +// // Receive the relaxation message +// assert(stp->second == msg_relax); +// std::pair<Vertex, typename MessageValue::type> data; +// receive(pg, stp->first, stp->second, data); + +// // Turn it into a "relax" call +// handle_relax_message(data.first, data.second); +// } +} + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +void +delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap>:: +setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(pg, msg_relax, this, + &delta_stepping_impl::handle_msg_relax); +} + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +void +delta_stepping_shortest_paths + (const Graph& g, + typename graph_traits<Graph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, EdgeWeightMap weight, + typename property_traits<EdgeWeightMap>::value_type delta) +{ + // The "distance" map needs to act like one, retrieving the default + // value of infinity. + set_property_map_role(vertex_distance, distance); + + // Construct the implementation object, which will perform all of + // the actual work. + delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap> + impl(g, predecessor, distance, weight, delta); + + // Run the delta-stepping algorithm. The results will show up in + // "predecessor" and "weight". + impl.run(s); +} + +template<typename Graph, typename PredecessorMap, typename DistanceMap, + typename EdgeWeightMap> +void +delta_stepping_shortest_paths + (const Graph& g, + typename graph_traits<Graph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, EdgeWeightMap weight) +{ + // The "distance" map needs to act like one, retrieving the default + // value of infinity. + set_property_map_role(vertex_distance, distance); + + // Construct the implementation object, which will perform all of + // the actual work. + delta_stepping_impl<Graph, PredecessorMap, DistanceMap, EdgeWeightMap> + impl(g, predecessor, distance, weight); + + // Run the delta-stepping algorithm. The results will show up in + // "predecessor" and "weight". + impl.run(s); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DELTA_STEPPING_SHORTEST_PATHS_HPP diff --git a/Utilities/BGL/boost/graph/distributed/depth_first_search.hpp b/Utilities/BGL/boost/graph/distributed/depth_first_search.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b6d49c5e961ab503469cb70e01016b9427bc2bfd --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/depth_first_search.hpp @@ -0,0 +1,306 @@ +// Copyright (C) 2004-2008 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_DFS_HPP +#define BOOST_GRAPH_DISTRIBUTED_DFS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/graph_traits.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/properties.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/static_assert.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/graph/parallel/container_traits.hpp> + +namespace boost { + namespace graph { namespace distributed { namespace detail { + template<typename DistributedGraph, typename ColorMap, typename ParentMap, + typename ExploreMap, typename VertexIndexMap, typename DFSVisitor> + class parallel_dfs + { + typedef typename graph_traits<DistributedGraph>::vertex_iterator + vertex_iterator; + typedef typename graph_traits<DistributedGraph>::vertex_descriptor + vertex_descriptor; + typedef typename graph_traits<DistributedGraph>::out_edge_iterator + out_edge_iterator; + + typedef typename boost::graph::parallel::process_group_type<DistributedGraph> + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + /** + * The first vertex in the pair is the local node (i) and the + * second vertex in the pair is the (possibly remote) node (j). + */ + typedef boost::parallel::detail::untracked_pair<vertex_descriptor, vertex_descriptor> vertex_pair; + + typedef typename property_traits<ColorMap>::value_type color_type; + typedef color_traits<color_type> Color; + + // Message types + enum { discover_msg = 10, return_msg = 50, visited_msg = 100 , done_msg = 150}; + + + public: + parallel_dfs(const DistributedGraph& g, ColorMap color, + ParentMap parent, ExploreMap explore, + VertexIndexMap index_map, DFSVisitor vis) + : g(g), color(color), parent(parent), explore(explore), + index_map(index_map), vis(vis), pg(process_group(g)), + owner(get(vertex_owner, g)), next_out_edge(num_vertices(g)) + { } + + void run(vertex_descriptor s) + { + vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { + put(color, *vi, Color::white()); + put(parent, *vi, *vi); + put(explore, *vi, *vi); + next_out_edge[get(index_map, *vi)] = out_edges(*vi, g).first; + vis.initialize_vertex(*vi, g); + } + + vis.start_vertex(s, g); + + if (get(owner, s) == process_id(pg)) { + send_oob(pg, get(owner, s), discover_msg, vertex_pair(s, s)); + } + + bool done = false; + while (!done) { + std::pair<process_id_type, int> msg = *pg.poll(true); + + switch (msg.second) { + case discover_msg: + { + vertex_pair p; + receive_oob(pg, msg.first, msg.second, p); + + if (p.first != p.second) { + // delete j from nomessage(j) + if (get(color, p.second) != Color::black()) + local_put(color, p.second, Color::gray()); + + if (recover(p)) break; + } + + if (get(color, p.first) == Color::white()) { + put(color, p.first, Color::gray()); + put(parent, p.first, p.second); + + vis.discover_vertex(p.first, g); + + if (shift_center_of_activity(p.first)) break; + + out_edge_iterator ei, ei_end; + for (tie(ei,ei_end) = out_edges(p.first, g); ei != ei_end; ++ei) + { + // Notify everyone who may not know that the source + // vertex has been visited. They can then mark the + // corresponding color map entry gray. + if (get(parent, p.first) != target(*ei, g) + && get(explore, p.first) != target(*ei, g)) { + vertex_pair visit(target(*ei, g), p.first); + + send_oob(pg, get(owner, target(*ei, g)), visited_msg, visit); + } + } + } + } + break; + + case visited_msg: + { + vertex_pair p; + receive_oob(pg, msg.first, msg.second, p); + + // delete j from nomessage(j) + if (get(color, p.second) != Color::black()) + local_put(color, p.second, Color::gray()); + + recover(p); + } + break; + + case return_msg: + { + vertex_pair p; + receive_oob(pg, msg.first, msg.second, p); + + // delete j from nomessage(i) + local_put(color, p.second, Color::black()); + + shift_center_of_activity(p.first); + } + break; + + case done_msg: + { + receive_oob(pg, msg.first, msg.second, done); + + // Propagate done message downward in tree + done = true; + process_id_type id = process_id(pg); + process_id_type left = 2*id + 1; + process_id_type right = left + 1; + if (left < num_processes(pg)) + send_oob(pg, left, done_msg, done); + if (right < num_processes(pg)) + send_oob(pg, right, done_msg, done); + } + break; + + default: + assert(false); + } + } + } + + private: + bool recover(const vertex_pair& p) + { + if (get(explore, p.first) == p.second) { + return shift_center_of_activity(p.first); + } + else + return false; + } + + bool shift_center_of_activity(vertex_descriptor i) + { + for (out_edge_iterator ei = next_out_edge[get(index_map, i)], + ei_end = out_edges(i, g).second; + ei != ei_end; ++ei) { + vis.examine_edge(*ei, g); + + vertex_descriptor k = target(*ei, g); + color_type target_color = get(color, k); + if (target_color == Color::black()) vis.forward_or_cross_edge(*ei, g); + else if (target_color == Color::gray()) vis.back_edge(*ei, g); + else { + put(explore, i, k); + vis.tree_edge(*ei, g); + vertex_pair p(k, i); + send_oob(pg, get(owner, k), discover_msg, p); + next_out_edge[get(index_map, i)] = ++ei; + return false; + } + } + + next_out_edge[get(index_map, i)] = out_edges(i, g).second; + put(explore, i, i); + put(color, i, Color::black()); + vis.finish_vertex(i, g); + + if (get(parent, i) == i) { + send_oob(pg, 0, done_msg, true); + return true; + } + else { + vertex_pair ret(get(parent, i), i); + send_oob(pg, get(owner, ret.first), return_msg, ret); + } + return false; + } + + const DistributedGraph& g; + ColorMap color; + ParentMap parent; + ExploreMap explore; + VertexIndexMap index_map; + DFSVisitor vis; + process_group_type pg; + typename property_map<DistributedGraph, vertex_owner_t>::const_type owner; + std::vector<out_edge_iterator> next_out_edge; + }; + } // end namespace detail + + template<typename DistributedGraph, typename ColorMap, typename ParentMap, + typename ExploreMap, typename VertexIndexMap, typename DFSVisitor> + void + tsin_depth_first_visit + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + DFSVisitor vis, ColorMap color, ParentMap parent, ExploreMap explore, + VertexIndexMap index_map) + { + typedef typename graph_traits<DistributedGraph>::directed_category + directed_category; + BOOST_STATIC_ASSERT( + (is_convertible<directed_category, undirected_tag>::value)); + + set_property_map_role(vertex_color, color); + graph::distributed::detail::parallel_dfs + <DistributedGraph, ColorMap, ParentMap, ExploreMap, VertexIndexMap, + DFSVisitor> do_dfs(g, color, parent, explore, index_map, vis); + do_dfs.run(s); + + using boost::graph::parallel::process_group; + synchronize(process_group(g)); + } + + template<typename DistributedGraph, typename DFSVisitor, + typename VertexIndexMap> + void + tsin_depth_first_visit + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + DFSVisitor vis, + VertexIndexMap index_map) + { + typedef typename graph_traits<DistributedGraph>::vertex_descriptor + vertex_descriptor; + + std::vector<default_color_type> colors(num_vertices(g)); + std::vector<vertex_descriptor> parent(num_vertices(g)); + std::vector<vertex_descriptor> explore(num_vertices(g)); + tsin_depth_first_visit + (g, s, + vis, + make_iterator_property_map(colors.begin(), index_map), + make_iterator_property_map(parent.begin(), index_map), + make_iterator_property_map(explore.begin(), index_map), + index_map); + } + + template<typename DistributedGraph, typename DFSVisitor, + typename VertexIndexMap> + void + tsin_depth_first_visit + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + DFSVisitor vis) + { + tsin_depth_first_visit(g, s, vis, get(vertex_index, g)); + } +} // end namespace distributed + +using distributed::tsin_depth_first_visit; + +} // end namespace graph + +template<typename DistributedGraph, typename DFSVisitor> +void +depth_first_visit + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + DFSVisitor vis) +{ + graph::tsin_depth_first_visit(g, s, vis, get(vertex_index, g)); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_DFS_HPP diff --git a/Utilities/BGL/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp b/Utilities/BGL/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0597689167ff69903da3616ab978d7596688e018 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/detail/dijkstra_shortest_paths.hpp @@ -0,0 +1,50 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP +#define BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/property_map/property_map.hpp> + +namespace boost { namespace graph { namespace distributed { namespace detail { + +/********************************************************************** + * Dijkstra queue message data * + **********************************************************************/ +template<typename DistanceMap, typename PredecessorMap> +class dijkstra_msg_value +{ + typedef typename property_traits<DistanceMap>::value_type distance_type; + typedef typename property_traits<PredecessorMap>::value_type + predecessor_type; + +public: + typedef std::pair<distance_type, predecessor_type> type; + + static type create(distance_type dist, predecessor_type pred) + { return std::make_pair(dist, pred); } +}; + +template<typename DistanceMap> +class dijkstra_msg_value<DistanceMap, dummy_property_map> +{ + typedef typename property_traits<DistanceMap>::key_type vertex_descriptor; +public: + typedef typename property_traits<DistanceMap>::value_type type; + + static type create(type dist, vertex_descriptor) { return dist; } +}; +/**********************************************************************/ + +} } } } // end namespace boost::graph::distributed::detail + +#endif // BOOST_GRAPH_PARALLEL_DIJKSTRA_DETAIL_HPP diff --git a/Utilities/BGL/boost/graph/distributed/detail/filtered_queue.hpp b/Utilities/BGL/boost/graph/distributed/detail/filtered_queue.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9871b70daf937c126bac0229a24756de6c7a1624 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/detail/filtered_queue.hpp @@ -0,0 +1,108 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_FILTERED_QUEUE_HPP +#define BOOST_FILTERED_QUEUE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <algorithm> + +namespace boost { + +/** Queue adaptor that filters elements pushed into the queue + * according to some predicate. + */ +template<typename Buffer, typename Predicate> +class filtered_queue +{ + public: + typedef Buffer buffer_type; + typedef Predicate predicate_type; + typedef typename Buffer::value_type value_type; + typedef typename Buffer::size_type size_type; + + /** + * Constructs a new filtered queue with an initial buffer and a + * predicate. + * + * @param buffer the initial buffer + * @param pred the predicate + */ + explicit + filtered_queue(const buffer_type& buffer = buffer_type(), + const predicate_type& pred = predicate_type()) + : buffer(buffer), pred(pred) {} + + /** Push a value into the queue. + * + * If the predicate returns @c true for @p x, pushes @p x into the + * buffer. + */ + void push(const value_type& x) { if (pred(x)) buffer.push(x); } + + /** Pop the front element off the buffer. + * + * @pre @c !empty() + */ + void pop() { buffer.pop(); } + + /** Retrieve the front (top) element in the buffer. + * + * @pre @c !empty() + */ + value_type& top() { return buffer.top(); } + + /** + * \overload + */ + const value_type& top() const { return buffer.top(); } + + /** Determine the number of elements in the buffer. */ + size_type size() const { return buffer.size(); } + + /** Determine if the buffer is empty. */ + bool empty() const { return buffer.empty(); } + + /** Get a reference to the underlying buffer. */ + buffer_type& base() { return buffer; } + const buffer_type& base() const { return buffer; } + + /** Swap the contents of this with @p other. */ + void swap(filtered_queue& other) + { + using std::swap; + swap(buffer, other.buffer); + swap(pred, other.pred); + } + + private: + buffer_type buffer; + predicate_type pred; +}; + +/** Create a filtered queue. */ +template<typename Buffer, typename Predicate> +inline filtered_queue<Buffer, Predicate> +make_filtered_queue(const Buffer& buffer, const Predicate& pred) +{ return filtered_queue<Buffer, Predicate>(buffer, pred); } + +/** Swap a filtered_queue. */ +template<typename Buffer, typename Predicate> +inline void +swap(filtered_queue<Buffer, Predicate>& x, + filtered_queue<Buffer, Predicate>& y) +{ + x.swap(y); +} + +} // end namespace boost + +#endif // BOOST_FILTERED_QUEUE_HPP diff --git a/Utilities/BGL/boost/graph/distributed/detail/mpi_process_group.ipp b/Utilities/BGL/boost/graph/distributed/detail/mpi_process_group.ipp new file mode 100644 index 0000000000000000000000000000000000000000..ef4923288493e1d1fd52f5b4858c75ba0bbdcb40 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/detail/mpi_process_group.ipp @@ -0,0 +1,1007 @@ +// -*- C++ -*- + +// Copyright (C) 2004-2008 The Trustees of Indiana University. +// Copyright (C) 2007 Douglas Gregor <doug.gregor@gmail.com> +// Copyright (C) 2007 Matthias Troyer <troyer@boost-consulting.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 +// Andrew Lumsdaine +// Matthias Troyer + +//#define PBGL_PROCESS_GROUP_DEBUG + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <cassert> +#include <algorithm> +#include <boost/graph/parallel/detail/untracked_pair.hpp> +#include <numeric> +#include <iterator> +#include <functional> +#include <vector> +#include <queue> +#include <stack> +#include <boost/graph/distributed/detail/tag_allocator.hpp> +#include <stdio.h> + +// #define PBGL_PROCESS_GROUP_DEBUG + +#ifdef PBGL_PROCESS_GROUP_DEBUG +# include <iostream> +#endif + +namespace boost { namespace graph { namespace distributed { + +struct mpi_process_group::impl +{ + + typedef mpi_process_group::message_header message_header; + typedef mpi_process_group::outgoing_messages outgoing_messages; + + /** + * Stores the incoming messages from a particular processor. + * + * @todo Evaluate whether we should use a deque instance, which + * would reduce could reduce the cost of "receiving" messages and + allow us to deallocate memory earlier, but increases the time + spent in the synchronization step. + */ + struct incoming_messages { + incoming_messages(); + ~incoming_messages() {} + + std::vector<message_header> headers; + buffer_type buffer; + std::vector<std::vector<message_header>::iterator> next_header; + }; + + struct batch_request { + MPI_Request request; + buffer_type buffer; + }; + + // send once we have a certain number of messages or bytes in the buffer + // these numbers need to be tuned, we keep them small at first for testing + std::size_t batch_header_number; + std::size_t batch_buffer_size; + std::size_t batch_message_size; + + /** + * The actual MPI communicator used to transmit data. + */ + boost::mpi::communicator comm; + + /** + * The MPI communicator used to transmit out-of-band replies. + */ + boost::mpi::communicator oob_reply_comm; + + /// Outgoing message information, indexed by destination processor. + std::vector<outgoing_messages> outgoing; + + /// Incoming message information, indexed by source processor. + std::vector<incoming_messages> incoming; + + /// The numbers of processors that have entered a synchronization stage + std::vector<int> processors_synchronizing_stage; + + /// The synchronization stage of a processor + std::vector<int> synchronizing_stage; + + /// Number of processors still sending messages + std::vector<int> synchronizing_unfinished; + + /// Number of batches sent since last synchronization stage + std::vector<int> number_sent_batches; + + /// Number of batches received minus number of expected batches + std::vector<int> number_received_batches; + + + /// The context of the currently-executing trigger, or @c trc_none + /// if no trigger is executing. + trigger_receive_context trigger_context; + + /// Non-zero indicates that we're processing batches + /// Increment this when processing patches, + /// decrement it when you're done. + int processing_batches; + + /** + * Contains all of the active blocks corresponding to attached + * distributed data structures. + */ + blocks_type blocks; + + /// Whether we are currently synchronizing + bool synchronizing; + + /// The MPI requests for posted sends of oob messages + std::vector<MPI_Request> requests; + + /// The MPI buffers for posted irecvs of oob messages + std::map<int,buffer_type> buffers; + + /// Queue for message batches received while already processing messages + std::queue<std::pair<int,outgoing_messages> > new_batches; + /// Maximum encountered size of the new_batches queue + std::size_t max_received; + + /// The MPI requests and buffers for batchess being sent + std::list<batch_request> sent_batches; + /// Maximum encountered size of the sent_batches list + std::size_t max_sent; + + /// Pre-allocated requests in a pool + std::vector<batch_request> batch_pool; + /// A stack controlling which batches are available + std::stack<std::size_t> free_batches; + + void free_sent_batches(); + + // Tag allocator + detail::tag_allocator allocated_tags; + + impl(std::size_t num_headers, std::size_t buffers_size, + communicator_type parent_comm); + ~impl(); + +private: + void set_batch_size(std::size_t header_num, std::size_t buffer_sz); +}; + +inline trigger_receive_context mpi_process_group::trigger_context() const +{ + return impl_->trigger_context; +} + +template<typename T> +void +mpi_process_group::send_impl(int dest, int tag, const T& value, + mpl::true_ /*is_mpi_datatype*/) const +{ + assert(tag < msg_reserved_first || tag > msg_reserved_last); + + impl::outgoing_messages& outgoing = impl_->outgoing[dest]; + + // Start constructing the message header + impl::message_header header; + header.source = process_id(*this); + header.tag = tag; + header.offset = outgoing.buffer.size(); + + boost::mpi::packed_oarchive oa(impl_->comm, outgoing.buffer); + oa << value; + +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "SEND: " << process_id(*this) << " -> " << dest << ", tag = " + << tag << ", bytes = " << packed_size << std::endl; +#endif + + // Store the header + header.bytes = outgoing.buffer.size() - header.offset; + outgoing.headers.push_back(header); + + maybe_send_batch(dest); +} + + +template<typename T> +void +mpi_process_group::send_impl(int dest, int tag, const T& value, + mpl::false_ /*is_mpi_datatype*/) const +{ + assert(tag < msg_reserved_first || tag > msg_reserved_last); + + impl::outgoing_messages& outgoing = impl_->outgoing[dest]; + + // Start constructing the message header + impl::message_header header; + header.source = process_id(*this); + header.tag = tag; + header.offset = outgoing.buffer.size(); + + // Serialize into the buffer + boost::mpi::packed_oarchive out(impl_->comm, outgoing.buffer); + out << value; + + // Store the header + header.bytes = outgoing.buffer.size() - header.offset; + outgoing.headers.push_back(header); + maybe_send_batch(dest); + +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "SEND: " << process_id(*this) << " -> " << dest << ", tag = " + << tag << ", bytes = " << header.bytes << std::endl; +#endif +} + +template<typename T> +inline void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value) +{ + pg.send_impl(dest, pg.encode_tag(pg.my_block_number(), tag), value, + boost::mpi::is_mpi_datatype<T>()); +} + +template<typename T> +typename enable_if<boost::mpi::is_mpi_datatype<T>, void>::type +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T values[], std::size_t n) +{ + pg.send_impl(dest, pg.encode_tag(pg.my_block_number(), tag), + boost::serialization::make_array(values,n), + boost::mpl::true_()); +} + +template<typename T> +typename disable_if<boost::mpi::is_mpi_datatype<T>, void>::type +mpi_process_group:: +array_send_impl(int dest, int tag, const T values[], std::size_t n) const +{ + assert(tag < msg_reserved_first || tag > msg_reserved_last); + + impl::outgoing_messages& outgoing = impl_->outgoing[dest]; + + // Start constructing the message header + impl::message_header header; + header.source = process_id(*this); + header.tag = tag; + header.offset = outgoing.buffer.size(); + + // Serialize into the buffer + boost::mpi::packed_oarchive out(impl_->comm, outgoing.buffer); + out << n; + + for (std::size_t i = 0; i < n; ++i) + out << values[i]; + + // Store the header + header.bytes = outgoing.buffer.size() - header.offset; + outgoing.headers.push_back(header); + maybe_send_batch(dest); + +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "SEND: " << process_id(*this) << " -> " << dest << ", tag = " + << tag << ", bytes = " << header.bytes << std::endl; +#endif +} + +template<typename T> +typename disable_if<boost::mpi::is_mpi_datatype<T>, void>::type +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T values[], std::size_t n) +{ + pg.array_send_impl(dest, pg.encode_tag(pg.my_block_number(), tag), + values, n); +} + +template<typename InputIterator> +void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, InputIterator first, InputIterator last) +{ + typedef typename std::iterator_traits<InputIterator>::value_type value_type; + std::vector<value_type> values(first, last); + if (values.empty()) send(pg, dest, tag, static_cast<value_type*>(0), 0); + else send(pg, dest, tag, &values[0], values.size()); +} + +template<typename T> +bool +mpi_process_group::receive_impl(int source, int tag, T& value, + mpl::true_ /*is_mpi_datatype*/) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << "RECV: " << process_id(*this) << " <- " << source << ", tag = " + << tag << std::endl; +#endif + + impl::incoming_messages& incoming = impl_->incoming[source]; + + // Find the next header with the right tag + std::vector<impl::message_header>::iterator header = + incoming.next_header[my_block_number()]; + while (header != incoming.headers.end() && header->tag != tag) ++header; + + // If no header is found, notify the caller + if (header == incoming.headers.end()) return false; + + // Unpack the data + if (header->bytes > 0) { + boost::mpi::packed_iarchive ia(impl_->comm, incoming.buffer, + archive::no_header, header->offset); + ia >> value; + } + + // Mark this message as received + header->tag = -1; + + // Move the "next header" indicator to the next unreceived message + while (incoming.next_header[my_block_number()] != incoming.headers.end() + && incoming.next_header[my_block_number()]->tag == -1) + ++incoming.next_header[my_block_number()]; + + if (incoming.next_header[my_block_number()] == incoming.headers.end()) { + bool finished = true; + for (std::size_t i = 0; i < incoming.next_header.size() && finished; ++i) { + if (incoming.next_header[i] != incoming.headers.end()) finished = false; + } + + if (finished) { + std::vector<impl::message_header> no_headers; + incoming.headers.swap(no_headers); + buffer_type empty_buffer; + incoming.buffer.swap(empty_buffer); + for (std::size_t i = 0; i < incoming.next_header.size(); ++i) + incoming.next_header[i] = incoming.headers.end(); + } + } + + return true; +} + +template<typename T> +bool +mpi_process_group::receive_impl(int source, int tag, T& value, + mpl::false_ /*is_mpi_datatype*/) const +{ + impl::incoming_messages& incoming = impl_->incoming[source]; + + // Find the next header with the right tag + std::vector<impl::message_header>::iterator header = + incoming.next_header[my_block_number()]; + while (header != incoming.headers.end() && header->tag != tag) ++header; + + // If no header is found, notify the caller + if (header == incoming.headers.end()) return false; + + // Deserialize the data + boost::mpi::packed_iarchive in(impl_->comm, incoming.buffer, + archive::no_header, header->offset); + in >> value; + + // Mark this message as received + header->tag = -1; + + // Move the "next header" indicator to the next unreceived message + while (incoming.next_header[my_block_number()] != incoming.headers.end() + && incoming.next_header[my_block_number()]->tag == -1) + ++incoming.next_header[my_block_number()]; + + if (incoming.next_header[my_block_number()] == incoming.headers.end()) { + bool finished = true; + for (std::size_t i = 0; i < incoming.next_header.size() && finished; ++i) { + if (incoming.next_header[i] != incoming.headers.end()) finished = false; + } + + if (finished) { + std::vector<impl::message_header> no_headers; + incoming.headers.swap(no_headers); + buffer_type empty_buffer; + incoming.buffer.swap(empty_buffer); + for (std::size_t i = 0; i < incoming.next_header.size(); ++i) + incoming.next_header[i] = incoming.headers.end(); + } + } + + return true; +} + +template<typename T> +typename disable_if<boost::mpi::is_mpi_datatype<T>, bool>::type +mpi_process_group:: +array_receive_impl(int source, int tag, T* values, std::size_t& n) const +{ + impl::incoming_messages& incoming = impl_->incoming[source]; + + // Find the next header with the right tag + std::vector<impl::message_header>::iterator header = + incoming.next_header[my_block_number()]; + while (header != incoming.headers.end() && header->tag != tag) ++header; + + // If no header is found, notify the caller + if (header == incoming.headers.end()) return false; + + // Deserialize the data + boost::mpi::packed_iarchive in(impl_->comm, incoming.buffer, + archive::no_header, header->offset); + std::size_t num_sent; + in >> num_sent; + if (num_sent > n) + std::cerr << "ERROR: Have " << num_sent << " items but only space for " + << n << " items\n"; + + for (std::size_t i = 0; i < num_sent; ++i) + in >> values[i]; + n = num_sent; + + // Mark this message as received + header->tag = -1; + + // Move the "next header" indicator to the next unreceived message + while (incoming.next_header[my_block_number()] != incoming.headers.end() + && incoming.next_header[my_block_number()]->tag == -1) + ++incoming.next_header[my_block_number()]; + + if (incoming.next_header[my_block_number()] == incoming.headers.end()) { + bool finished = true; + for (std::size_t i = 0; i < incoming.next_header.size() && finished; ++i) { + if (incoming.next_header[i] != incoming.headers.end()) finished = false; + } + + if (finished) { + std::vector<impl::message_header> no_headers; + incoming.headers.swap(no_headers); + buffer_type empty_buffer; + incoming.buffer.swap(empty_buffer); + for (std::size_t i = 0; i < incoming.next_header.size(); ++i) + incoming.next_header[i] = incoming.headers.end(); + } + } + + return true; +} + +// Construct triggers +template<typename Type, typename Handler> +void mpi_process_group::trigger(int tag, const Handler& handler) +{ + assert(block_num); + install_trigger(tag,my_block_number(),shared_ptr<trigger_base>( + new trigger_launcher<Type, Handler>(*this, tag, handler))); +} + +template<typename Type, typename Handler> +void mpi_process_group::trigger_with_reply(int tag, const Handler& handler) +{ + assert(block_num); + install_trigger(tag,my_block_number(),shared_ptr<trigger_base>( + new reply_trigger_launcher<Type, Handler>(*this, tag, handler))); +} + +template<typename Type, typename Handler> +void mpi_process_group::global_trigger(int tag, const Handler& handler, + std::size_t sz) +{ + if (sz==0) // normal trigger + install_trigger(tag,0,shared_ptr<trigger_base>( + new global_trigger_launcher<Type, Handler>(*this, tag, handler))); + else // trigger with irecv + install_trigger(tag,0,shared_ptr<trigger_base>( + new global_irecv_trigger_launcher<Type, Handler>(*this, tag, handler,sz))); + +} + +namespace detail { + +template<typename Type> +void do_oob_receive(mpi_process_group const& self, + int source, int tag, Type& data, mpl::true_ /*is_mpi_datatype*/) +{ + using boost::mpi::get_mpi_datatype; + + //self.impl_->comm.recv(source,tag,data); + MPI_Recv(&data, 1, get_mpi_datatype<Type>(data), source, tag, self.impl_->comm, + MPI_STATUS_IGNORE); +} + +template<typename Type> +void do_oob_receive(mpi_process_group const& self, + int source, int tag, Type& data, mpl::false_ /*is_mpi_datatype*/) +{ + // self.impl_->comm.recv(source,tag,data); + // Receive the size of the data packet + boost::mpi::status status; + status = self.impl_->comm.probe(source, tag); + +#if BOOST_VERSION >= 103600 + int size = status.count<boost::mpi::packed>().get(); +#else + int size; + MPI_Status& mpi_status = status; + MPI_Get_count(&mpi_status, MPI_PACKED, &size); +#endif + + // Receive the data packed itself + boost::mpi::packed_iarchive in(self.impl_->comm); + in.resize(size); + MPI_Recv(in.address(), size, MPI_PACKED, source, tag, self.impl_->comm, + MPI_STATUS_IGNORE); + + // Deserialize the data + in >> data; +} + +template<typename Type> +void do_oob_receive(mpi_process_group const& self, int source, int tag, Type& data) +{ + do_oob_receive(self, source, tag, data, + boost::mpi::is_mpi_datatype<Type>()); +} + + +} // namespace detail + + +template<typename Type, typename Handler> +void +mpi_process_group::trigger_launcher<Type, Handler>:: +receive(mpi_process_group const&, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB trigger" : "Trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + + Type data; + + if (context == trc_out_of_band) { + // Receive the message directly off the wire + int realtag = self.encode_tag( + block == -1 ? self.my_block_number() : block, tag); + detail::do_oob_receive(self,source,realtag,data); + } + else + // Receive the message out of the local buffer + boost::graph::distributed::receive(self, source, tag, data); + + // Pass the message off to the handler + handler(source, tag, data, context); +} + +template<typename Type, typename Handler> +void +mpi_process_group::reply_trigger_launcher<Type, Handler>:: +receive(mpi_process_group const&, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB reply trigger" : "Reply trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + assert(context == trc_out_of_band); + + boost::parallel::detail::untracked_pair<int, Type> data; + + // Receive the message directly off the wire + int realtag = self.encode_tag(block == -1 ? self.my_block_number() : block, + tag); + detail::do_oob_receive(self, source, realtag, data); + + // Pass the message off to the handler and send the result back to + // the source. + send_oob(self, source, data.first, + handler(source, tag, data.second, context), -2); +} + +template<typename Type, typename Handler> +void +mpi_process_group::global_trigger_launcher<Type, Handler>:: +receive(mpi_process_group const& self, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB trigger" : "Trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + + Type data; + + if (context == trc_out_of_band) { + // Receive the message directly off the wire + int realtag = self.encode_tag( + block == -1 ? self.my_block_number() : block, tag); + detail::do_oob_receive(self,source,realtag,data); + } + else + // Receive the message out of the local buffer + boost::graph::distributed::receive(self, source, tag, data); + + // Pass the message off to the handler + handler(self, source, tag, data, context); +} + + +template<typename Type, typename Handler> +void +mpi_process_group::global_irecv_trigger_launcher<Type, Handler>:: +receive(mpi_process_group const& self, int source, int tag, + trigger_receive_context context, int block) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << (out_of_band? "OOB trigger" : "Trigger") + << " receive from source " << source << " and tag " << tag + << " in block " << (block == -1 ? self.my_block_number() : block) << std::endl; +#endif + + Type data; + + if (context == trc_out_of_band) { + return; + } + assert (context == trc_irecv_out_of_band); + + // force posting of new MPI_Irecv, even though buffer is already allocated + boost::mpi::packed_iarchive ia(self.impl_->comm,self.impl_->buffers[tag]); + ia >> data; + // Start a new receive + prepare_receive(self,tag,true); + // Pass the message off to the handler + handler(self, source, tag, data, context); +} + + +template<typename Type, typename Handler> +void +mpi_process_group::global_irecv_trigger_launcher<Type, Handler>:: +prepare_receive(mpi_process_group const& self, int tag, bool force) const +{ +#ifdef PBGL_PROCESS_GROUP_DEBUG + std::cerr << ("Posting Irecv for trigger") + << " receive with tag " << tag << std::endl; +#endif + if (self.impl_->buffers.find(tag) == self.impl_->buffers.end()) { + self.impl_->buffers[tag].resize(buffer_size); + force = true; + } + assert(static_cast<int>(self.impl_->buffers[tag].size()) >= buffer_size); + + //BOOST_MPL_ASSERT(mpl::not_<is_mpi_datatype<Type> >); + if (force) { + self.impl_->requests.push_back(MPI_Request()); + MPI_Request* request = &self.impl_->requests.back(); + MPI_Irecv(&self.impl_->buffers[tag].front(),buffer_size, + MPI_PACKED,MPI_ANY_SOURCE,tag,self.impl_->comm,request); + } +} + + +template<typename T> +inline mpi_process_group::process_id_type +receive(const mpi_process_group& pg, int tag, T& value) +{ + for (std::size_t source = 0; source < pg.impl_->incoming.size(); ++source) { + if (pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + value, boost::mpi::is_mpi_datatype<T>())) + return source; + } + assert (false); +} + +template<typename T> +typename + enable_if<boost::mpi::is_mpi_datatype<T>, + std::pair<mpi_process_group::process_id_type, std::size_t> >::type +receive(const mpi_process_group& pg, int tag, T values[], std::size_t n) +{ + for (std::size_t source = 0; source < pg.impl_->incoming.size(); ++source) { + bool result = + pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + boost::serialization::make_array(values,n), + boost::mpl::true_()); + if (result) + return std::make_pair(source, n); + } + assert(false); +} + +template<typename T> +typename + disable_if<boost::mpi::is_mpi_datatype<T>, + std::pair<mpi_process_group::process_id_type, std::size_t> >::type +receive(const mpi_process_group& pg, int tag, T values[], std::size_t n) +{ + for (std::size_t source = 0; source < pg.impl_->incoming.size(); ++source) { + if (pg.array_receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + values, n)) + return std::make_pair(source, n); + } + assert(false); +} + +template<typename T> +mpi_process_group::process_id_type +receive(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value) +{ + if (pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + value, boost::mpi::is_mpi_datatype<T>())) + return source; + else { + fprintf(stderr, + "Process %d failed to receive a message from process %d with tag %d in block %d.\n", + process_id(pg), source, tag, pg.my_block_number()); + + assert(false); + exit(1); + } +} + +template<typename T> +typename + enable_if<boost::mpi::is_mpi_datatype<T>, + std::pair<mpi_process_group::process_id_type, std::size_t> >::type +receive(const mpi_process_group& pg, int source, int tag, T values[], + std::size_t n) +{ + if (pg.receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + boost::serialization::make_array(values,n), + boost::mpl::true_())) + return std::make_pair(source,n); + else { + fprintf(stderr, + "Process %d failed to receive a message from process %d with tag %d in block %d.\n", + process_id(pg), source, tag, pg.my_block_number()); + + assert(false); + exit(1); + } +} + +template<typename T> +typename + disable_if<boost::mpi::is_mpi_datatype<T>, + std::pair<mpi_process_group::process_id_type, std::size_t> >::type +receive(const mpi_process_group& pg, int source, int tag, T values[], + std::size_t n) +{ + pg.array_receive_impl(source, pg.encode_tag(pg.my_block_number(), tag), + values, n); + + return std::make_pair(source, n); +} + +template<typename T, typename BinaryOperation> +T* +all_reduce(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op) +{ + synchronize(pg); + + bool inplace = first == out; + + if (inplace) out = new T [last-first]; + + boost::mpi::all_reduce(boost::mpi::communicator(communicator(pg), + boost::mpi::comm_attach), + first, last-first, out, bin_op); + + if (inplace) { + std::copy(out, out + (last-first), first); + delete [] out; + return last; + } + + return out; +} + +template<typename T> +void +broadcast(const mpi_process_group& pg, T& val, + mpi_process_group::process_id_type root) +{ + // broadcast the seed + boost::mpi::communicator comm(communicator(pg),boost::mpi::comm_attach); + boost::mpi::broadcast(comm,val,root); +} + + +template<typename T, typename BinaryOperation> +T* +scan(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op) +{ + synchronize(pg); + + bool inplace = first == out; + + if (inplace) out = new T [last-first]; + + boost::mpi::scan(communicator(pg), first, last-first, out, bin_op); + + if (inplace) { + std::copy(out, out + (last-first), first); + delete [] out; + return last; + } + + return out; +} + + +template<typename InputIterator, typename T> +void +all_gather(const mpi_process_group& pg, InputIterator first, + InputIterator last, std::vector<T>& out) +{ + synchronize(pg); + + // Stick a copy of the local values into a vector, so we can broadcast it + std::vector<T> local_values(first, last); + + // Collect the number of vertices stored in each process + int size = local_values.size(); + std::vector<int> sizes(num_processes(pg)); + int result = MPI_Allgather(&size, 1, MPI_INT, + &sizes[0], 1, MPI_INT, + communicator(pg)); + assert(result == MPI_SUCCESS); + + // Adjust sizes based on the number of bytes + std::transform(sizes.begin(), sizes.end(), sizes.begin(), + std::bind2nd(std::multiplies<int>(), sizeof(T))); + + // Compute displacements + std::vector<int> displacements; + displacements.reserve(sizes.size() + 1); + displacements.push_back(0); + std::partial_sum(sizes.begin(), sizes.end(), + std::back_inserter(displacements)); + + // Gather all of the values + out.resize(displacements.back() / sizeof(T)); + if (!out.empty()) { + result = MPI_Allgatherv(local_values.empty()? (void*)&local_values + /* local results */: (void*)&local_values[0], + local_values.size() * sizeof(T), + MPI_BYTE, + &out[0], &sizes[0], &displacements[0], MPI_BYTE, + communicator(pg)); + } + assert(result == MPI_SUCCESS); +} + +template<typename InputIterator> +mpi_process_group +process_subgroup(const mpi_process_group& pg, + InputIterator first, InputIterator last) +{ +/* + boost::mpi::group current_group = communicator(pg).group(); + boost::mpi::group new_group = current_group.include(first,last); + boost::mpi::communicator new_comm(communicator(pg),new_group); + return mpi_process_group(new_comm); +*/ + std::vector<int> ranks(first, last); + + MPI_Group current_group; + int result = MPI_Comm_group(communicator(pg), ¤t_group); + assert(result == MPI_SUCCESS); + + MPI_Group new_group; + result = MPI_Group_incl(current_group, ranks.size(), &ranks[0], &new_group); + assert(result == MPI_SUCCESS); + + MPI_Comm new_comm; + result = MPI_Comm_create(communicator(pg), new_group, &new_comm); + assert(result == MPI_SUCCESS); + + result = MPI_Group_free(&new_group); + assert(result == MPI_SUCCESS); + result = MPI_Group_free(¤t_group); + assert(result == MPI_SUCCESS); + + if (new_comm != MPI_COMM_NULL) { + mpi_process_group result_pg(boost::mpi::communicator(new_comm,boost::mpi::comm_attach)); + result = MPI_Comm_free(&new_comm); + assert(result == 0); + return result_pg; + } else { + return mpi_process_group(mpi_process_group::create_empty()); + } + +} + + +template<typename Receiver> +Receiver* mpi_process_group::get_receiver() +{ + return impl_->blocks[my_block_number()]->on_receive + .template target<Receiver>(); +} + +template<typename T> +typename enable_if<boost::mpi::is_mpi_datatype<T> >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block) +{ + using boost::mpi::get_mpi_datatype; + + // Determine the actual message we expect to receive, and which + // communicator it will come by. + std::pair<boost::mpi::communicator, int> actual + = pg.actual_communicator_and_tag(tag, block); + + // Post a non-blocking receive that waits until we complete this request. + MPI_Request request; + MPI_Irecv(&value, 1, get_mpi_datatype<T>(value), + source, actual.second, actual.first, &request); + + int done = 0; + do { + MPI_Test(&request, &done, MPI_STATUS_IGNORE); + if (!done) + pg.poll(/*wait=*/false, block); + } while (!done); +} + +template<typename T> +typename disable_if<boost::mpi::is_mpi_datatype<T> >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block) +{ + // Determine the actual message we expect to receive, and which + // communicator it will come by. + std::pair<boost::mpi::communicator, int> actual + = pg.actual_communicator_and_tag(tag, block); + + boost::optional<boost::mpi::status> status; + do { + status = actual.first.iprobe(source, actual.second); + if (!status) + pg.poll(); + } while (!status); + + //actual.first.recv(status->source(), status->tag(),value); + + // Allocate the receive buffer + boost::mpi::packed_iarchive in(actual.first); + +#if BOOST_VERSION >= 103600 + in.resize(status->count<boost::mpi::packed>().get()); +#else + int size; + MPI_Status mpi_status = *status; + MPI_Get_count(&mpi_status, MPI_PACKED, &size); + in.resize(size); +#endif + + // Receive the message data + MPI_Recv(in.address(), in.size(), MPI_PACKED, + status->source(), status->tag(), actual.first, MPI_STATUS_IGNORE); + + // Unpack the message data + in >> value; +} + + +template<typename SendT, typename ReplyT> +typename enable_if<boost::mpi::is_mpi_datatype<ReplyT> >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block) +{ + detail::tag_allocator::token reply_tag = pg.impl_->allocated_tags.get_tag(); + send_oob(pg, dest, tag, boost::parallel::detail::make_untracked_pair( + (int)reply_tag, send_value), block); + receive_oob(pg, dest, reply_tag, reply_value); +} + +template<typename SendT, typename ReplyT> +typename disable_if<boost::mpi::is_mpi_datatype<ReplyT> >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block) +{ + detail::tag_allocator::token reply_tag = pg.impl_->allocated_tags.get_tag(); + send_oob(pg, dest, tag, + boost::parallel::detail::make_untracked_pair((int)reply_tag, + send_value), block); + receive_oob(pg, dest, reply_tag, reply_value); +} + +} } } // end namespace boost::graph::distributed diff --git a/Utilities/BGL/boost/graph/distributed/detail/queue.ipp b/Utilities/BGL/boost/graph/distributed/detail/queue.ipp new file mode 100644 index 0000000000000000000000000000000000000000..f37ff25f2f71fa8dfd81e857732b4fdc59d9a744 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/detail/queue.ipp @@ -0,0 +1,177 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#include <boost/optional.hpp> +#include <cassert> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <functional> +#include <algorithm> +#include <boost/graph/parallel/simple_trigger.hpp> + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +namespace boost { namespace graph { namespace distributed { + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +BOOST_DISTRIBUTED_QUEUE_TYPE:: +distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const Buffer& buffer, bool polling) + : process_group(process_group, attach_distributed_object()), + owner(owner), + buffer(buffer), + polling(polling) +{ + if (!polling) + outgoing_buffers.reset( + new outgoing_buffers_t(num_processes(process_group))); + + setup_triggers(); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +BOOST_DISTRIBUTED_QUEUE_TYPE:: +distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const Buffer& buffer, const UnaryPredicate& pred, + bool polling) + : process_group(process_group, attach_distributed_object()), + owner(owner), + buffer(buffer), + pred(pred), + polling(polling) +{ + if (!polling) + outgoing_buffers.reset( + new outgoing_buffers_t(num_processes(process_group))); + + setup_triggers(); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +BOOST_DISTRIBUTED_QUEUE_TYPE:: +distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const UnaryPredicate& pred, bool polling) + : process_group(process_group, attach_distributed_object()), + owner(owner), + pred(pred), + polling(polling) +{ + if (!polling) + outgoing_buffers.reset( + new outgoing_buffers_t(num_processes(process_group))); + + setup_triggers(); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +void +BOOST_DISTRIBUTED_QUEUE_TYPE::push(const value_type& x) +{ + typename ProcessGroup::process_id_type dest = get(owner, x); + if (outgoing_buffers) + outgoing_buffers->at(dest).push_back(x); + else if (dest == process_id(process_group)) + buffer.push(x); + else + send(process_group, get(owner, x), msg_push, x); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +bool +BOOST_DISTRIBUTED_QUEUE_TYPE::empty() const +{ + /* Processes will stay here until the buffer is nonempty or + synchronization with the other processes indicates that all local + buffers are empty (and no messages are in transit). + */ + while (buffer.empty() && !do_synchronize()) ; + + return buffer.empty(); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +typename BOOST_DISTRIBUTED_QUEUE_TYPE::size_type +BOOST_DISTRIBUTED_QUEUE_TYPE::size() const +{ + empty(); + return buffer.size(); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +void BOOST_DISTRIBUTED_QUEUE_TYPE::setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(process_group, msg_push, this, + &distributed_queue::handle_push); + simple_trigger(process_group, msg_multipush, this, + &distributed_queue::handle_multipush); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +void +BOOST_DISTRIBUTED_QUEUE_TYPE:: +handle_push(int /*source*/, int /*tag*/, const value_type& value, + trigger_receive_context) +{ + if (pred(value)) buffer.push(value); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +void +BOOST_DISTRIBUTED_QUEUE_TYPE:: +handle_multipush(int /*source*/, int /*tag*/, + const std::vector<value_type>& values, + trigger_receive_context) +{ + for (std::size_t i = 0; i < values.size(); ++i) + if (pred(values[i])) buffer.push(values[i]); +} + +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +bool +BOOST_DISTRIBUTED_QUEUE_TYPE::do_synchronize() const +{ +#ifdef PBGL_ACCOUNTING + ++num_synchronizations; +#endif + + using boost::parallel::all_reduce; + using std::swap; + + typedef typename ProcessGroup::process_id_type process_id_type; + + if (outgoing_buffers) { + // Transfer all of the push requests + process_id_type id = process_id(process_group); + process_id_type np = num_processes(process_group); + for (process_id_type dest = 0; dest < np; ++dest) { + outgoing_buffer_t& outgoing = outgoing_buffers->at(dest); + std::size_t size = outgoing.size(); + if (size != 0) { + if (dest != id) { + send(process_group, dest, msg_multipush, outgoing); + } else { + for (std::size_t i = 0; i < size; ++i) + buffer.push(outgoing[i]); + } + outgoing.clear(); + } + } + } + synchronize(process_group); + + unsigned local_size = buffer.size(); + unsigned global_size = + all_reduce(process_group, local_size, std::plus<unsigned>()); + return global_size == 0; +} + +} } } // end namespace boost::graph::distributed diff --git a/Utilities/BGL/boost/graph/distributed/detail/remote_update_set.hpp b/Utilities/BGL/boost/graph/distributed/detail/remote_update_set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..08f4316ad6ef35840ac81e68073e71a3782ea194 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/detail/remote_update_set.hpp @@ -0,0 +1,259 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP +#define BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/parallel/process_group.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <vector> +#include <cassert> +#include <boost/optional.hpp> +#include <queue> + +namespace boost { namespace graph { namespace detail { + +template<typename ProcessGroup> +void do_synchronize(ProcessGroup& pg) +{ + using boost::parallel::synchronize; + synchronize(pg); +} + +struct remote_set_queued {}; +struct remote_set_immediate {}; + +template<typename ProcessGroup> +class remote_set_semantics +{ + BOOST_STATIC_CONSTANT + (bool, + queued = (is_convertible< + typename ProcessGroup::communication_category, + parallel::bsp_process_group_tag>::value)); + + public: + typedef typename mpl::if_c<queued, + remote_set_queued, + remote_set_immediate>::type type; +}; + + +template<typename Derived, typename ProcessGroup, typename Value, + typename OwnerMap, + typename Semantics = typename remote_set_semantics<ProcessGroup>::type> +class remote_update_set; + +/********************************************************************** + * Remote updating set that queues messages until synchronization * + **********************************************************************/ +template<typename Derived, typename ProcessGroup, typename Value, + typename OwnerMap> +class remote_update_set<Derived, ProcessGroup, Value, OwnerMap, + remote_set_queued> +{ + typedef typename property_traits<OwnerMap>::key_type Key; + typedef std::vector<std::pair<Key, Value> > Updates; + typedef typename Updates::size_type updates_size_type; + typedef typename Updates::value_type updates_pair_type; + +public: + +private: + typedef typename ProcessGroup::process_id_type process_id_type; + + enum message_kind { + /** Message containing the number of updates that will be sent in + * a msg_updates message that will immediately follow. This + * message will contain a single value of type + * updates_size_type. + */ + msg_num_updates, + + /** Contains (key, value) pairs with all of the updates from a + * particular source. The number of updates is variable, but will + * be provided in a msg_num_updates message that immediately + * preceeds this message. + * + */ + msg_updates + }; + + struct handle_messages + { + explicit + handle_messages(remote_update_set* self, const ProcessGroup& pg) + : self(self), update_sizes(num_processes(pg), 0) { } + + void operator()(process_id_type source, int tag) + { + switch(tag) { + case msg_num_updates: + { + // Receive the # of updates + updates_size_type num_updates; + receive(self->process_group, source, tag, num_updates); + + update_sizes[source] = num_updates; + } + break; + + case msg_updates: + { + updates_size_type num_updates = update_sizes[source]; + assert(num_updates); + + // Receive the actual updates + std::vector<updates_pair_type> updates(num_updates); + receive(self->process_group, source, msg_updates, &updates[0], + num_updates); + + // Send updates to derived "receive_update" member + Derived* derived = static_cast<Derived*>(self); + for (updates_size_type u = 0; u < num_updates; ++u) + derived->receive_update(source, updates[u].first, updates[u].second); + + update_sizes[source] = 0; + } + break; + }; + } + + private: + remote_update_set* self; + std::vector<updates_size_type> update_sizes; + }; + friend struct handle_messages; + + protected: + remote_update_set(const ProcessGroup& pg, const OwnerMap& owner) + : process_group(pg, handle_messages(this, pg)), + updates(num_processes(pg)), owner(owner) { + } + + + void update(const Key& key, const Value& value) + { + if (get(owner, key) == process_id(process_group)) { + Derived* derived = static_cast<Derived*>(this); + derived->receive_update(get(owner, key), key, value); + } + else { + updates[get(owner, key)].push_back(std::make_pair(key, value)); + } + } + + void collect() { } + + void synchronize() + { + // Emit all updates and then remove them + process_id_type num_processes = updates.size(); + for (process_id_type p = 0; p < num_processes; ++p) { + if (!updates[p].empty()) { + send(process_group, p, msg_num_updates, updates[p].size()); + send(process_group, p, msg_updates, + &updates[p].front(), updates[p].size()); + updates[p].clear(); + } + } + + do_synchronize(process_group); + } + + ProcessGroup process_group; + + private: + std::vector<Updates> updates; + OwnerMap owner; +}; + +/********************************************************************** + * Remote updating set that sends messages immediately * + **********************************************************************/ +template<typename Derived, typename ProcessGroup, typename Value, + typename OwnerMap> +class remote_update_set<Derived, ProcessGroup, Value, OwnerMap, + remote_set_immediate> +{ + typedef typename property_traits<OwnerMap>::key_type Key; + typedef std::pair<Key, Value> update_pair_type; + typedef typename std::vector<update_pair_type>::size_type updates_size_type; + +public: + typedef typename ProcessGroup::process_id_type process_id_type; + +private: + enum message_kind { + /** Contains a (key, value) pair that will be updated. */ + msg_update + }; + + struct handle_messages + { + explicit handle_messages(remote_update_set* self, const ProcessGroup& pg) + : self(self) + { update_sizes.resize(num_processes(pg), 0); } + + void operator()(process_id_type source, int tag) + { + // Receive the # of updates + assert(tag == msg_update); + update_pair_type update; + receive(self->process_group, source, tag, update); + + // Send update to derived "receive_update" member + Derived* derived = static_cast<Derived*>(self); + derived->receive_update(source, update.first, update.second); + } + + private: + std::vector<updates_size_type> update_sizes; + remote_update_set* self; + }; + friend struct handle_messages; + + protected: + remote_update_set(const ProcessGroup& pg, const OwnerMap& owner) + : process_group(pg, handle_messages(this, pg)), owner(owner) { } + + void update(const Key& key, const Value& value) + { + if (get(owner, key) == process_id(process_group)) { + Derived* derived = static_cast<Derived*>(this); + derived->receive_update(get(owner, key), key, value); + } + else + send(process_group, get(owner, key), msg_update, + update_pair_type(key, value)); + } + + void collect() + { + typedef std::pair<process_id_type, int> probe_type; + handle_messages handler(this, process_group); + while (optional<probe_type> stp = probe(process_group)) + if (stp->second == msg_update) handler(stp->first, stp->second); + } + + void synchronize() + { + do_synchronize(process_group); + } + + ProcessGroup process_group; + OwnerMap owner; +}; + +} } } // end namespace boost::graph::detail + +#endif // BOOST_GRAPH_DETAIL_REMOTE_UPDATE_SET_HPP diff --git a/Utilities/BGL/boost/graph/distributed/detail/tag_allocator.hpp b/Utilities/BGL/boost/graph/distributed/detail/tag_allocator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..27340392702ccaec9a5d13e2c14cd2c57d8fa118 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/detail/tag_allocator.hpp @@ -0,0 +1,84 @@ +// -*- C++ -*- + +// Copyright (C) 2007 Douglas Gregor <doug.gregor@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) +#ifndef BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP +#define BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <vector> + +namespace boost { namespace graph { namespace distributed { namespace detail { + +/** + * \brief The tag allocator allows clients to request unique tags that + * can be used for one-time communications. + * + * The tag allocator hands out tag values from a predefined maximum + * (given in the constructor) moving downward. Tags are provided one + * at a time via a @c token. When the @c token goes out of scope, the + * tag is returned and may be reallocated. These tags should be used, + * for example, for one-time communication of values. + */ +class tag_allocator { +public: + class token; + friend class token; + + /** + * Construct a new tag allocator that provides unique tags starting + * with the value @p top_tag and moving lower, as necessary. + */ + explicit tag_allocator(int top_tag) : bottom(top_tag) { } + + /** + * Retrieve a new tag. The token itself holds onto the tag, which + * will be released when the token is destroyed. + */ + token get_tag(); + +private: + int bottom; + std::vector<int> freed; +}; + +/** + * A token used to represent an allocated tag. + */ +class tag_allocator::token { +public: + /// Transfer ownership of the tag from @p other. + token(const token& other); + + /// De-allocate the tag, if this token still owns it. + ~token(); + + /// Retrieve the tag allocated for this task. + operator int() const { return tag_; } + +private: + /// Create a token with a specific tag from the given tag_allocator + token(tag_allocator* allocator, int tag) + : allocator(allocator), tag_(tag) { } + + /// Undefined: tokens are not copy-assignable + token& operator=(const token&); + + /// The allocator from which this tag was allocated. + tag_allocator* allocator; + + /// The stored tag flag. If -1, this token does not own the tag. + mutable int tag_; + + friend class tag_allocator; +}; + +} } } } // end namespace boost::graph::distributed::detail + +#endif // BOOST_GRAPH_DISTRIBUTED_TAG_ALLOCATOR_HPP diff --git a/Utilities/BGL/boost/graph/distributed/dijkstra_shortest_paths.hpp b/Utilities/BGL/boost/graph/distributed/dijkstra_shortest_paths.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f72fa11a50bd09569defed0146f73741474183f7 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/dijkstra_shortest_paths.hpp @@ -0,0 +1,205 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_DIJKSTRA_HPP +#define BOOST_GRAPH_PARALLEL_DIJKSTRA_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/dijkstra_shortest_paths.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/distributed/crauser_et_al_shortest_paths.hpp> +#include <boost/graph/distributed/eager_dijkstra_shortest_paths.hpp> + +namespace boost { + + namespace graph { namespace detail { + + + template<typename Lookahead> + struct parallel_dijkstra_impl2 + { + template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename WeightMap, typename IndexMap, typename ColorMap, + typename Compare, typename Combine, typename DistInf, + typename DistZero> + static void + run(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits<DistanceMap>::value_type lookahead, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + eager_dijkstra_shortest_paths(g, s, predecessor, distance, lookahead, + weight, index_map, color_map, compare, + combine, inf, zero, vis); + } + }; + + template<> + struct parallel_dijkstra_impl2< ::boost::detail::error_property_not_found > + { + template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename WeightMap, typename IndexMap, typename ColorMap, + typename Compare, typename Combine, typename DistInf, + typename DistZero> + static void + run(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + ::boost::detail::error_property_not_found, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + crauser_et_al_shortest_paths(g, s, predecessor, distance, weight, + index_map, color_map, compare, combine, + inf, zero, vis); + } + }; + + template<typename ColorMap> + struct parallel_dijkstra_impl + { + template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename Lookahead, typename WeightMap, typename IndexMap, + typename Compare, typename Combine, + typename DistInf, typename DistZero> + static void + run(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + Lookahead lookahead, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + graph::detail::parallel_dijkstra_impl2<Lookahead> + ::run(g, s, predecessor, distance, lookahead, weight, index_map, + color_map, compare, combine, inf, zero, vis); + } + }; + + template<> + struct parallel_dijkstra_impl< ::boost::detail::error_property_not_found > + { + private: + template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename Lookahead, typename WeightMap, typename IndexMap, + typename ColorMap, typename Compare, typename Combine, + typename DistInf, typename DistZero> + static void + run_impl(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + Lookahead lookahead, WeightMap weight, IndexMap index_map, + ColorMap color_map, Compare compare, Combine combine, + DistInf inf, DistZero zero, DijkstraVisitor vis) + { + BGL_FORALL_VERTICES_T(u, g, DistributedGraph) + BGL_FORALL_OUTEDGES_T(u, e, g, DistributedGraph) + local_put(color_map, target(e, g), white_color); + + graph::detail::parallel_dijkstra_impl2<Lookahead> + ::run(g, s, predecessor, distance, lookahead, weight, index_map, + color_map, compare, combine, inf, zero, vis); + } + + public: + template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename Lookahead, typename WeightMap, typename IndexMap, + typename Compare, typename Combine, + typename DistInf, typename DistZero> + static void + run(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + Lookahead lookahead, WeightMap weight, IndexMap index_map, + ::boost::detail::error_property_not_found, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) + { + typedef typename graph_traits<DistributedGraph>::vertices_size_type + vertices_size_type; + + vertices_size_type n = num_vertices(g); + std::vector<default_color_type> colors(n, white_color); + + run_impl(g, s, predecessor, distance, lookahead, weight, index_map, + make_iterator_property_map(colors.begin(), index_map), + compare, combine, inf, zero, vis); + } + }; + } } // end namespace graph::detail + + + /** Dijkstra's single-source shortest paths algorithm for distributed + * graphs. + * + * Also implements the heuristics of: + * + * Andreas Crauser, Kurt Mehlhorn, Ulrich Meyer, and Peter + * Sanders. A Parallelization of Dijkstra's Shortest Path + * Algorithm. In Lubos Brim, Jozef Gruska, and Jiri Zlatuska, + * editors, Mathematical Foundations of Computer Science (MFCS), + * volume 1450 of Lecture Notes in Computer Science, pages + * 722--731, 1998. Springer. + */ + template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, + typename WeightMap, typename IndexMap, typename Compare, + typename Combine, typename DistInf, typename DistZero, + typename T, typename Tag, typename Base> + inline + void + dijkstra_shortest_paths + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, WeightMap weight, + IndexMap index_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis, + const bgl_named_params<T, Tag, Base>& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(DistributedGraph,distributed_graph_tag)) + { + typedef typename graph_traits<DistributedGraph>::vertices_size_type + vertices_size_type; + + // Build a distributed property map for vertex colors, if we need it + bool use_default_color_map + = is_default_param(get_param(params, vertex_color)); + vertices_size_type n = use_default_color_map? num_vertices(g) : 1; + std::vector<default_color_type> color(n, white_color); + typedef iterator_property_map<std::vector<default_color_type>::iterator, + IndexMap> DefColorMap; + DefColorMap color_map(color.begin(), index_map); + + typedef typename property_value< bgl_named_params<T, Tag, Base>, + vertex_color_t>::type color_map_type; + + graph::detail::parallel_dijkstra_impl<color_map_type> + ::run(g, s, predecessor, distance, + get_param(params, lookahead_t()), + weight, index_map, + get_param(params, vertex_color), + compare, combine, inf, zero, vis); + } +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_DIJKSTRA_HPP diff --git a/Utilities/BGL/boost/graph/distributed/distributed_graph_utility.hpp b/Utilities/BGL/boost/graph/distributed/distributed_graph_utility.hpp new file mode 100644 index 0000000000000000000000000000000000000000..058b9887d8c594f46c155325ecc357ded7d53524 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/distributed_graph_utility.hpp @@ -0,0 +1,154 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. +// 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: Peter Gottschling +// Douglas Gregor +// Andrew Lumsdaine + +#include <boost/graph/iteration_macros.hpp> +#include <boost/property_map/parallel/global_index_map.hpp> + +#ifndef BOOST_GRAPH_DISTRIBUTED_GRAPH_UTILITY_INCLUDE +#define BOOST_GRAPH_DISTRIBUTED_GRAPH_UTILITY_INCLUDE + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +namespace boost { namespace graph { + + template <class Property, class Graph> + void property_on_inedges(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_INEDGES_T(u, e, g, Graph) + request(p, e); + synchronize(p); + } + + // For reverse graphs + template <class Property, class Graph> + void property_on_outedges(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + request(p, e); + synchronize(p); + } + + template <class Property, class Graph> + void property_on_successors(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + request(p, target(e, g)); + synchronize(p); + } + + template <class Property, class Graph> + void property_on_predecessors(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_INEDGES_T(u, e, g, Graph) + request(p, source(e, g)); + synchronize(p); + } + + // Like successors and predecessors but saves one synchronize (and a call) + template <class Property, class Graph> + void property_on_adjacents(Property p, const Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) { + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) + request(p, target(e, g)); + BGL_FORALL_INEDGES_T(u, e, g, Graph) + request(p, source(e, g)); + } + synchronize(p); + } + + template <class PropertyIn, class PropertyOut, class Graph> + void copy_vertex_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + put(p_out, u, get(p_in, g)); + } + + template <class PropertyIn, class PropertyOut, class Graph> + void copy_edge_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_EDGES_T(e, g, Graph) + put(p_out, e, get(p_in, g)); + } + + + namespace distributed { + + // Define global_index<Graph> global(graph); + // Then global(v) returns global index of v + template <typename Graph> + struct global_index + { + typedef typename property_map<Graph, vertex_index_t>::const_type + VertexIndexMap; + typedef typename property_map<Graph, vertex_global_t>::const_type + VertexGlobalMap; + + explicit global_index(Graph const& g) + : global_index_map(process_group(g), num_vertices(g), get(vertex_index, g), + get(vertex_global, g)) {} + + int operator() (typename graph_traits<Graph>::vertex_descriptor v) + { return get(global_index_map, v); } + + protected: + boost::parallel::global_index_map<VertexIndexMap, VertexGlobalMap> + global_index_map; + }; + + template<typename T> + struct additive_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename K> + T operator()(const K&) const { return T(0); } + + template<typename K> + T operator()(const K&, const T& local, const T& remote) const { return local + remote; } + }; + + template <typename T> + struct choose_min_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename K> + T operator()(const K&) const { return (std::numeric_limits<T>::max)(); } + + template<typename K> + T operator()(const K&, const T& x, const T& y) const + { return x < y ? x : y; } + }; + + // To use a property map syntactically like a function + template <typename PropertyMap> + struct property_map_reader + { + explicit property_map_reader(PropertyMap pm) : pm(pm) {} + + template <typename T> + typename PropertyMap::value_type + operator() (const T& v) + { + return get(pm, v); + } + private: + PropertyMap pm; + }; + + } // namespace distributed + +}} // namespace boost::graph + +#endif // BOOST_GRAPH_DISTRIBUTED_GRAPH_UTILITY_INCLUDE diff --git a/Utilities/BGL/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp b/Utilities/BGL/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8cee034fbe2cfd5574c232f0c3bdea352322e83f --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp @@ -0,0 +1,446 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +/************************************************************************** + * This source file implements a variation on distributed Dijkstra's * + * algorithm that can expose additional parallelism by permitting * + * vertices within a certain distance from the minimum to be processed, * + * even though they may not be at their final distance. This can * + * introduce looping, but the algorithm will still terminate so long as * + * there are no negative loops. * + **************************************************************************/ +#ifndef BOOST_GRAPH_EAGER_DIJKSTRA_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_EAGER_DIJKSTRA_SHORTEST_PATHS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/distributed/detail/dijkstra_shortest_paths.hpp> +#include <boost/property_map/parallel/caching_property_map.hpp> +#include <boost/pending/indirect_cmp.hpp> +#include <boost/graph/distributed/detail/remote_update_set.hpp> +#include <vector> +#include <boost/graph/breadth_first_search.hpp> +#include <boost/graph/dijkstra_shortest_paths.hpp> +#include <boost/graph/parallel/container_traits.hpp> + +#ifdef PBGL_ACCOUNTING +# include <boost/graph/accounting.hpp> +# include <numeric> +#endif // PBGL_ACCOUNTING + +#ifdef MUTABLE_QUEUE +# include <boost/pending/mutable_queue.hpp> +#endif + +namespace boost { namespace graph { namespace distributed { + +#ifdef PBGL_ACCOUNTING +struct eager_dijkstra_shortest_paths_stats_t +{ + /* The value of the lookahead parameter. */ + double lookahead; + + /* Total wall-clock time used by the algorithm.*/ + accounting::time_type execution_time; + + /* The number of vertices deleted in each superstep. */ + std::vector<std::size_t> deleted_vertices; + + template<typename OutputStream> + void print(OutputStream& out) + { + double avg_deletions = std::accumulate(deleted_vertices.begin(), + deleted_vertices.end(), + 0.0); + avg_deletions /= deleted_vertices.size(); + + out << "Problem = \"Single-Source Shortest Paths\"\n" + << "Algorithm = \"Eager Dijkstra\"\n" + << "Function = eager_dijkstra_shortest_paths\n" + << "(P) Lookahead = " << lookahead << "\n" + << "Wall clock time = " << accounting::print_time(execution_time) + << "\nSupersteps = " << deleted_vertices.size() << "\n" + << "Avg. deletions per superstep = " << avg_deletions << "\n"; + } +}; + +static eager_dijkstra_shortest_paths_stats_t eager_dijkstra_shortest_paths_stats; +#endif + +namespace detail { + +// Borrowed from BGL's dijkstra_shortest_paths +template <class UniformCostVisitor, class Queue, + class WeightMap, class PredecessorMap, class DistanceMap, + class BinaryFunction, class BinaryPredicate> + struct parallel_dijkstra_bfs_visitor : bfs_visitor<> +{ + typedef typename property_traits<DistanceMap>::value_type distance_type; + + parallel_dijkstra_bfs_visitor(UniformCostVisitor vis, Queue& Q, + WeightMap w, PredecessorMap p, DistanceMap d, + BinaryFunction combine, BinaryPredicate compare, + distance_type zero) + : m_vis(vis), m_Q(Q), m_weight(w), m_predecessor(p), m_distance(d), + m_combine(combine), m_compare(compare), m_zero(zero) { } + + template <class Vertex, class Graph> + void initialize_vertex(Vertex u, Graph& g) + { m_vis.initialize_vertex(u, g); } + template <class Vertex, class Graph> + void discover_vertex(Vertex u, Graph& g) { m_vis.discover_vertex(u, g); } + template <class Vertex, class Graph> + void examine_vertex(Vertex u, Graph& g) { m_vis.examine_vertex(u, g); } + + /* Since the eager formulation of Parallel Dijkstra's algorithm can + loop, we may relax on *any* edge, not just those associated with + white and gray targets. */ + template <class Edge, class Graph> + void examine_edge(Edge e, Graph& g) { + if (m_compare(get(m_weight, e), m_zero)) + boost::throw_exception(negative_edge()); + + m_vis.examine_edge(e, g); + + boost::parallel::caching_property_map<PredecessorMap> c_pred(m_predecessor); + boost::parallel::caching_property_map<DistanceMap> c_dist(m_distance); + + distance_type old_distance = get(c_dist, target(e, g)); + + bool m_decreased = relax(e, g, m_weight, c_pred, c_dist, + m_combine, m_compare); + + /* On x86 Linux with optimization, we sometimes get into a + horrible case where m_decreased is true but the distance hasn't + actually changed. This occurs when the comparison inside + relax() occurs with the 80-bit precision of the x87 floating + point unit, but the difference is lost when the resulting + values are written back to lower-precision memory (e.g., a + double). With the eager Dijkstra's implementation, this results + in looping. */ + if (m_decreased && old_distance != get(c_dist, target(e, g))) { + m_Q.update(target(e, g)); + m_vis.edge_relaxed(e, g); + } else + m_vis.edge_not_relaxed(e, g); + } + template <class Vertex, class Graph> + void finish_vertex(Vertex u, Graph& g) { m_vis.finish_vertex(u, g); } + + UniformCostVisitor m_vis; + Queue& m_Q; + WeightMap m_weight; + PredecessorMap m_predecessor; + DistanceMap m_distance; + BinaryFunction m_combine; + BinaryPredicate m_compare; + distance_type m_zero; +}; + + /********************************************************************** + * Dijkstra queue that implements arbitrary "lookahead" * + **********************************************************************/ + template<typename Graph, typename Combine, typename Compare, + typename VertexIndexMap, typename DistanceMap, + typename PredecessorMap> + class lookahead_dijkstra_queue + : public graph::detail::remote_update_set< + lookahead_dijkstra_queue< + Graph, Combine, Compare, VertexIndexMap, DistanceMap, + PredecessorMap>, + typename boost::graph::parallel::process_group_type<Graph>::type, + typename dijkstra_msg_value<DistanceMap, PredecessorMap>::type, + typename property_map<Graph, vertex_owner_t>::const_type> + { + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor; + typedef lookahead_dijkstra_queue self_type; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + typedef dijkstra_msg_value<DistanceMap, PredecessorMap> msg_value_creator; + typedef typename msg_value_creator::type msg_value_type; + typedef typename property_map<Graph, vertex_owner_t>::const_type + OwnerPropertyMap; + + typedef graph::detail::remote_update_set<self_type, process_group_type, + msg_value_type, OwnerPropertyMap> + inherited; + + // Priority queue for tentative distances + typedef indirect_cmp<DistanceMap, Compare> queue_compare_type; + + typedef typename property_traits<DistanceMap>::value_type distance_type; + +#ifdef MUTABLE_QUEUE + typedef mutable_queue<vertex_descriptor, std::vector<vertex_descriptor>, + queue_compare_type, VertexIndexMap> queue_type; + +#else + typedef relaxed_heap<vertex_descriptor, queue_compare_type, + VertexIndexMap> queue_type; +#endif // MUTABLE_QUEUE + + typedef typename process_group_type::process_id_type process_id_type; + + public: + typedef vertex_descriptor value_type; + + lookahead_dijkstra_queue(const Graph& g, + const Combine& combine, + const Compare& compare, + const VertexIndexMap& id, + const DistanceMap& distance_map, + const PredecessorMap& predecessor_map, + distance_type lookahead) + : inherited(boost::graph::parallel::process_group(g), get(vertex_owner, g)), + queue(num_vertices(g), queue_compare_type(distance_map, compare), id), + distance_map(distance_map), + predecessor_map(predecessor_map), + min_distance(0), + lookahead(lookahead) +#ifdef PBGL_ACCOUNTING + , local_deletions(0) +#endif + { } + + void push(const value_type& x) + { + msg_value_type msg_value = + msg_value_creator::create(get(distance_map, x), + predecessor_value(get(predecessor_map, x))); + inherited::update(x, msg_value); + } + + void update(const value_type& x) { push(x); } + + void pop() + { + queue.pop(); +#ifdef PBGL_ACCOUNTING + ++local_deletions; +#endif + } + + value_type& top() { return queue.top(); } + const value_type& top() const { return queue.top(); } + + bool empty() + { + inherited::collect(); + + // If there are no suitable messages, wait until we get something + while (!has_suitable_vertex()) { + if (do_synchronize()) return true; + } + + // Return true only if nobody has any messages; false if we + // have suitable messages + return false; + } + + private: + vertex_descriptor predecessor_value(vertex_descriptor v) const + { return v; } + + vertex_descriptor + predecessor_value(property_traits<dummy_property_map>::reference) const + { return graph_traits<Graph>::null_vertex(); } + + bool has_suitable_vertex() const + { + return (!queue.empty() + && get(distance_map, queue.top()) <= min_distance + lookahead); + } + + bool do_synchronize() + { + using boost::parallel::all_reduce; + using boost::parallel::minimum; + + inherited::synchronize(); + + // TBD: could use combine here, but then we need to stop using + // minimum<distance_type>() as the function object. + distance_type local_distance = + queue.empty()? (std::numeric_limits<distance_type>::max)() + : get(distance_map, queue.top()); + + all_reduce(this->process_group, &local_distance, &local_distance + 1, + &min_distance, minimum<distance_type>()); + +#ifdef PBGL_ACCOUNTING + std::size_t deletions = 0; + all_reduce(this->process_group, &local_deletions, &local_deletions + 1, + &deletions, std::plus<std::size_t>()); + if (process_id(this->process_group) == 0) + eager_dijkstra_shortest_paths_stats.deleted_vertices + .push_back(deletions); + local_deletions = 0; + assert(deletions > 0); +#endif + + return min_distance == (std::numeric_limits<distance_type>::max)(); + } + + public: + void + receive_update(process_id_type source, vertex_descriptor vertex, + distance_type distance) + { + // Update the queue if the received distance is better than + // the distance we know locally + if (distance <= get(distance_map, vertex)) { + + // Update the local distance map + put(distance_map, vertex, distance); + + bool is_in_queue = queue.contains(vertex); + + if (!is_in_queue) + queue.push(vertex); + else + queue.update(vertex); + } + } + + void + receive_update(process_id_type source, vertex_descriptor vertex, + std::pair<distance_type, vertex_descriptor> p) + { + if (p.first <= get(distance_map, vertex)) { + put(predecessor_map, vertex, p.second); + receive_update(source, vertex, p.first); + } + } + + private: + queue_type queue; + DistanceMap distance_map; + PredecessorMap predecessor_map; + distance_type min_distance; + distance_type lookahead; +#ifdef PBGL_ACCOUNTING + std::size_t local_deletions; +#endif + }; + /**********************************************************************/ +} // end namespace detail + +template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, typename WeightMap, + typename IndexMap, typename ColorMap, typename Compare, + typename Combine, typename DistInf, typename DistZero> +void +eager_dijkstra_shortest_paths + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits<DistanceMap>::value_type lookahead, + WeightMap weight, IndexMap index_map, ColorMap color_map, + Compare compare, Combine combine, DistInf inf, DistZero zero, + DijkstraVisitor vis) +{ + typedef typename boost::graph::parallel::process_group_type<DistributedGraph>::type + process_group_type; + typedef typename graph_traits<DistributedGraph>::vertex_descriptor + Vertex; + typedef typename graph_traits<DistributedGraph>::vertices_size_type + vertices_size_type; + +#ifdef PBGL_ACCOUNTING + eager_dijkstra_shortest_paths_stats.deleted_vertices.clear(); + eager_dijkstra_shortest_paths_stats.lookahead = lookahead; + eager_dijkstra_shortest_paths_stats.execution_time = accounting::get_time(); +#endif + + // Initialize local portion of property maps + typename graph_traits<DistributedGraph>::vertex_iterator ui, ui_end; + for (tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) { + put(distance, *ui, inf); + put(predecessor, *ui, *ui); + } + put(distance, s, zero); + + // Dijkstra Queue + typedef detail::lookahead_dijkstra_queue + <DistributedGraph, Combine, Compare, IndexMap, DistanceMap, + PredecessorMap> Queue; + + Queue Q(g, combine, compare, index_map, distance, + predecessor, lookahead); + + // Parallel Dijkstra visitor + detail::parallel_dijkstra_bfs_visitor + <DijkstraVisitor, Queue, WeightMap, PredecessorMap, DistanceMap, Combine, + Compare> bfs_vis(vis, Q, weight, predecessor, distance, combine, compare, + zero); + + set_property_map_role(vertex_color, color_map); + set_property_map_role(vertex_distance, distance); + + breadth_first_search(g, s, Q, bfs_vis, color_map); + +#ifdef PBGL_ACCOUNTING + eager_dijkstra_shortest_paths_stats.execution_time = + accounting::get_time() + - eager_dijkstra_shortest_paths_stats.execution_time; +#endif +} + +template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap, typename WeightMap> +void +eager_dijkstra_shortest_paths + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits<DistanceMap>::value_type lookahead, + WeightMap weight) +{ + typedef typename property_traits<DistanceMap>::value_type distance_type; + + std::vector<default_color_type> colors(num_vertices(g), white_color); + + eager_dijkstra_shortest_paths(g, s, predecessor, distance, lookahead, weight, + get(vertex_index, g), + make_iterator_property_map(&colors[0], + get(vertex_index, + g)), + std::less<distance_type>(), + closed_plus<distance_type>(), + distance_type(), + (std::numeric_limits<distance_type>::max)(), + dijkstra_visitor<>()); +} + +template<typename DistributedGraph, typename DijkstraVisitor, + typename PredecessorMap, typename DistanceMap> +void +eager_dijkstra_shortest_paths + (const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + PredecessorMap predecessor, DistanceMap distance, + typename property_traits<DistanceMap>::value_type lookahead) +{ + eager_dijkstra_shortest_paths(g, s, predecessor, distance, lookahead, + get(edge_weight, g)); +} +} // end namespace distributed + +#ifdef PBGL_ACCOUNTING +using distributed::eager_dijkstra_shortest_paths_stats; +#endif + +using distributed::eager_dijkstra_shortest_paths; + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_EAGER_DIJKSTRA_SHORTEST_PATHS_HPP diff --git a/Utilities/BGL/boost/graph/distributed/filtered_graph.hpp b/Utilities/BGL/boost/graph/distributed/filtered_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9677e4dd10fa34cbf02e39a48e9a8938d02f628d --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/filtered_graph.hpp @@ -0,0 +1,51 @@ +// Copyright (C) 2004-2008 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP +#define BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/parallel/process_group.hpp> +#include <boost/graph/filtered_graph.hpp> + +namespace boost { + namespace graph { + namespace parallel { + /// Retrieve the process group from a filtered graph + template<typename Graph, typename EdgePredicate, typename VertexPredicate> + struct process_group_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> > + : process_group_type<Graph> { }; + + template<typename Graph, typename EdgePredicate, typename VertexPredicate> + struct process_group_type<const filtered_graph<Graph, EdgePredicate, VertexPredicate> > + : process_group_type<Graph> { }; + } + + } + + /// Retrieve the process group from a filtered graph + template<typename Graph, typename EdgePredicate, typename VertexPredicate> + inline typename graph::parallel::process_group_type<Graph>::type + process_group(filtered_graph<Graph, EdgePredicate, VertexPredicate> const& g) { + return process_group(g.m_g); + } + + /// Forward vertex() to vertex() of the base graph + template <typename Graph, typename EdgePredicate, typename VertexPredicate> + typename graph_traits<Graph>::vertex_descriptor + vertex(typename graph_traits<Graph>::vertices_size_type i, + filtered_graph<Graph, EdgePredicate, VertexPredicate> const& g) + { return vertex(i, g.m_g); } + +} + +#endif // BOOST_DISTRIBUTED_FILTERED_GRAPH_HPP diff --git a/Utilities/BGL/boost/graph/distributed/fruchterman_reingold.hpp b/Utilities/BGL/boost/graph/distributed/fruchterman_reingold.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a89aea3dd15ca3328f3102a7dc1172d113db5d3b --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/fruchterman_reingold.hpp @@ -0,0 +1,384 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_FRUCHTERMAN_REINGOLD_HPP +#define BOOST_GRAPH_DISTRIBUTED_FRUCHTERMAN_REINGOLD_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/fruchterman_reingold.hpp> + +namespace boost { namespace graph { namespace distributed { + +class simple_tiling +{ + public: + simple_tiling(int columns, int rows, bool flip = true) + : columns(columns), rows(rows), flip(flip) + { + } + + // Convert from a position (x, y) in the tiled display into a + // processor ID number + int operator()(int x, int y) const + { + return flip? (rows - y - 1) * columns + x : y * columns + x; + } + + // Convert from a process ID to a position (x, y) in the tiled + // display + std::pair<int, int> operator()(int id) + { + int my_col = id % columns; + int my_row = flip? rows - (id / columns) - 1 : id / columns; + return std::make_pair(my_col, my_row); + } + + int columns, rows; + + private: + bool flip; +}; + +// Force pairs function object that does nothing +struct no_force_pairs +{ + template<typename Graph, typename ApplyForce> + void operator()(const Graph&, const ApplyForce&) + { + } +}; + +// Computes force pairs in the distributed case. +template<typename PositionMap, typename DisplacementMap, typename LocalForces, + typename NonLocalForces = no_force_pairs> +class distributed_force_pairs_proxy +{ + public: + distributed_force_pairs_proxy(const PositionMap& position, + const DisplacementMap& displacement, + const LocalForces& local_forces, + const NonLocalForces& nonlocal_forces = NonLocalForces()) + : position(position), displacement(displacement), + local_forces(local_forces), nonlocal_forces(nonlocal_forces) + { + } + + template<typename Graph, typename ApplyForce> + void operator()(const Graph& g, ApplyForce apply_force) + { + // Flush remote displacements + displacement.flush(); + + // Receive updated positions for all of our neighbors + synchronize(position); + + // Reset remote displacements + displacement.reset(); + + // Compute local repulsive forces + local_forces(g, apply_force); + + // Compute neighbor repulsive forces + nonlocal_forces(g, apply_force); + } + + protected: + PositionMap position; + DisplacementMap displacement; + LocalForces local_forces; + NonLocalForces nonlocal_forces; +}; + +template<typename PositionMap, typename DisplacementMap, typename LocalForces> +inline +distributed_force_pairs_proxy<PositionMap, DisplacementMap, LocalForces> +make_distributed_force_pairs(const PositionMap& position, + const DisplacementMap& displacement, + const LocalForces& local_forces) +{ + typedef + distributed_force_pairs_proxy<PositionMap, DisplacementMap, LocalForces> + result_type; + return result_type(position, displacement, local_forces); +} + +template<typename PositionMap, typename DisplacementMap, typename LocalForces, + typename NonLocalForces> +inline +distributed_force_pairs_proxy<PositionMap, DisplacementMap, LocalForces, + NonLocalForces> +make_distributed_force_pairs(const PositionMap& position, + const DisplacementMap& displacement, + const LocalForces& local_forces, + const NonLocalForces& nonlocal_forces) +{ + typedef + distributed_force_pairs_proxy<PositionMap, DisplacementMap, LocalForces, + NonLocalForces> + result_type; + return result_type(position, displacement, local_forces, nonlocal_forces); +} + +// Compute nonlocal force pairs based on the shared borders with +// adjacent tiles. +template<typename PositionMap> +class neighboring_tiles_force_pairs +{ + public: + typedef typename property_traits<PositionMap>::value_type Point; + typedef typename point_traits<Point>::component_type Dim; + + enum bucket_position { left, top, right, bottom, end_position }; + + neighboring_tiles_force_pairs(PositionMap position, Point origin, + Point extent, simple_tiling tiling) + : position(position), origin(origin), extent(extent), tiling(tiling) + { + } + + template<typename Graph, typename ApplyForce> + void operator()(const Graph& g, ApplyForce apply_force) + { + // TBD: Do this some smarter way + if (tiling.columns == 1 && tiling.rows == 1) + return; + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; +#ifndef BOOST_NO_STDC_NAMESPACE + using std::sqrt; +#endif // BOOST_NO_STDC_NAMESPACE + + // TBD: num_vertices(g) should be the global number of vertices? + Dim two_k = Dim(2) * sqrt(extent[0] * extent[1] / num_vertices(g)); + + std::vector<vertex_descriptor> my_vertices[4]; + std::vector<vertex_descriptor> neighbor_vertices[4]; + + // Compute cutoff positions + Dim cutoffs[4]; + cutoffs[left] = origin[0] + two_k; + cutoffs[top] = origin[1] + two_k; + cutoffs[right] = origin[0] + extent[0] - two_k; + cutoffs[bottom] = origin[1] + extent[1] - two_k; + + // Compute neighbors + typename PositionMap::process_group_type pg = position.process_group(); + std::pair<int, int> my_tile = tiling(process_id(pg)); + int neighbors[4] = { -1, -1, -1, -1 } ; + if (my_tile.first > 0) + neighbors[left] = tiling(my_tile.first - 1, my_tile.second); + if (my_tile.second > 0) + neighbors[top] = tiling(my_tile.first, my_tile.second - 1); + if (my_tile.first < tiling.columns - 1) + neighbors[right] = tiling(my_tile.first + 1, my_tile.second); + if (my_tile.second < tiling.rows - 1) + neighbors[bottom] = tiling(my_tile.first, my_tile.second + 1); + + // Sort vertices along the edges into buckets + BGL_FORALL_VERTICES_T(v, g, Graph) { + if (position[v][0] <= cutoffs[left]) my_vertices[left].push_back(v); + if (position[v][1] <= cutoffs[top]) my_vertices[top].push_back(v); + if (position[v][0] >= cutoffs[right]) my_vertices[right].push_back(v); + if (position[v][1] >= cutoffs[bottom]) my_vertices[bottom].push_back(v); + } + + // Send vertices to neighbors, and gather our neighbors' vertices + bucket_position pos; + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) { + if (neighbors[pos] != -1) { + send(pg, neighbors[pos], 0, my_vertices[pos].size()); + if (!my_vertices[pos].empty()) + send(pg, neighbors[pos], 1, + &my_vertices[pos].front(), my_vertices[pos].size()); + } + } + + // Pass messages around + synchronize(pg); + + // Receive neighboring vertices + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) { + if (neighbors[pos] != -1) { + std::size_t incoming_vertices; + receive(pg, neighbors[pos], 0, incoming_vertices); + + if (incoming_vertices) { + neighbor_vertices[pos].resize(incoming_vertices); + receive(pg, neighbors[pos], 1, &neighbor_vertices[pos].front(), + incoming_vertices); + } + } + } + + // For each neighboring vertex, we need to get its current position + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) + for (typename std::vector<vertex_descriptor>::iterator i = + neighbor_vertices[pos].begin(); + i != neighbor_vertices[pos].end(); + ++i) + request(position, *i); + synchronize(position); + + // Apply forces in adjacent bins. This is O(n^2) in the worst + // case. Oh well. + for (pos = left; pos < end_position; pos = bucket_position(pos + 1)) { + for (typename std::vector<vertex_descriptor>::iterator i = + my_vertices[pos].begin(); + i != my_vertices[pos].end(); + ++i) + for (typename std::vector<vertex_descriptor>::iterator j = + neighbor_vertices[pos].begin(); + j != neighbor_vertices[pos].end(); + ++j) + apply_force(*i, *j); + } + } + + protected: + PositionMap position; + Point origin; + Point extent; + simple_tiling tiling; +}; + +template<typename PositionMap> +inline neighboring_tiles_force_pairs<PositionMap> +make_neighboring_tiles_force_pairs + (PositionMap position, + typename property_traits<PositionMap>::value_type origin, + typename property_traits<PositionMap>::value_type extent, + simple_tiling tiling) +{ + return neighboring_tiles_force_pairs<PositionMap>(position, origin, extent, + tiling); +} + +template<typename DisplacementMap, typename Cooling> +class distributed_cooling_proxy +{ + public: + typedef typename Cooling::result_type result_type; + + distributed_cooling_proxy(const DisplacementMap& displacement, + const Cooling& cooling) + : displacement(displacement), cooling(cooling) + { + } + + result_type operator()() + { + // Accumulate displacements computed on each processor + synchronize(displacement.data->process_group); + + // Allow the underlying cooling to occur + return cooling(); + } + + protected: + DisplacementMap displacement; + Cooling cooling; +}; + +template<typename DisplacementMap, typename Cooling> +inline distributed_cooling_proxy<DisplacementMap, Cooling> +make_distributed_cooling(const DisplacementMap& displacement, + const Cooling& cooling) +{ + typedef distributed_cooling_proxy<DisplacementMap, Cooling> result_type; + return result_type(displacement, cooling); +} + +template<typename Point> +struct point_accumulating_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename K> + Point operator()(const K&) const { return Point(); } + + template<typename K> + Point operator()(const K&, const Point& p1, const Point& p2) const + { return Point(p1[0] + p2[0], p1[1] + p2[1]); } +}; + +template<typename Graph, typename PositionMap, + typename AttractiveForce, typename RepulsiveForce, + typename ForcePairs, typename Cooling, typename DisplacementMap> +void +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + typename property_traits<PositionMap>::value_type const& origin, + typename property_traits<PositionMap>::value_type const& extent, + AttractiveForce attractive_force, + RepulsiveForce repulsive_force, + ForcePairs force_pairs, + Cooling cool, + DisplacementMap displacement) +{ + typedef typename property_traits<PositionMap>::value_type Point; + + // Reduction in the displacement map involves summing the forces + displacement.set_reduce(point_accumulating_reducer<Point>()); + + // We need to track the positions of all of our neighbors + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_ADJ_T(u, v, g, Graph) + request(position, v); + + // Invoke the "sequential" Fruchterman-Reingold implementation + boost::fruchterman_reingold_force_directed_layout + (g, position, origin, extent, + attractive_force, repulsive_force, + make_distributed_force_pairs(position, displacement, force_pairs), + make_distributed_cooling(displacement, cool), + displacement); +} + +template<typename Graph, typename PositionMap, + typename AttractiveForce, typename RepulsiveForce, + typename ForcePairs, typename Cooling, typename DisplacementMap> +void +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + typename property_traits<PositionMap>::value_type const& origin, + typename property_traits<PositionMap>::value_type const& extent, + AttractiveForce attractive_force, + RepulsiveForce repulsive_force, + ForcePairs force_pairs, + Cooling cool, + DisplacementMap displacement, + simple_tiling tiling) +{ + typedef typename property_traits<PositionMap>::value_type Point; + + // Reduction in the displacement map involves summing the forces + displacement.set_reduce(point_accumulating_reducer<Point>()); + + // We need to track the positions of all of our neighbors + BGL_FORALL_VERTICES_T(u, g, Graph) + BGL_FORALL_ADJ_T(u, v, g, Graph) + request(position, v); + + // Invoke the "sequential" Fruchterman-Reingold implementation + boost::fruchterman_reingold_force_directed_layout + (g, position, origin, extent, + attractive_force, repulsive_force, + make_distributed_force_pairs + (position, displacement, force_pairs, + make_neighboring_tiles_force_pairs(position, origin, extent, tiling)), + make_distributed_cooling(displacement, cool), + displacement); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_FRUCHTERMAN_REINGOLD_HPP diff --git a/Utilities/BGL/boost/graph/distributed/graphviz.hpp b/Utilities/BGL/boost/graph/distributed/graphviz.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1ca4082023e08ff5497198e905895bdcb28d5a36 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/graphviz.hpp @@ -0,0 +1,294 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_GRAPHVIZ_HPP +#define BOOST_GRAPH_PARALLEL_GRAPHVIZ_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/graphviz.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_same.hpp> +#include <fstream> +#include <sstream> +#include <iostream> +#include <string> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/property_map/parallel/global_index_map.hpp> + +namespace boost { + +template<typename Graph> +struct graph_id_writer +{ + explicit graph_id_writer(const Graph& g) : g(g) { } + + void operator()(std::ostream& out) + { + out << " label=\"p" << process_id(g.process_group()) << "\";\n"; + } + + private: + const Graph& g; +}; + +template<typename NumberMap> +struct paint_by_number_writer +{ + explicit paint_by_number_writer(NumberMap number) : number(number) { } + + template<typename Descriptor> + void operator()(std::ostream& out, Descriptor k) + { + static const char* color_names[] = { + "blue", + "brown", + "cyan", + "darkgreen", + "darkorchid", + "darksalmon", + "darkviolet", + "deeppink", + "gold3", + "green", + "magenta", + "navy", + "red", + "yellow", + "palegreen", + "gray65", + "gray21", + "bisque2", + "greenyellow", + "indianred4", + "lightblue2", + "mediumspringgreen", + "orangered", + "orange" + }; + const int colors = sizeof(color_names) / sizeof(color_names[0]); + if (get(number, k) < colors) { + out << " [ style=\"filled\", fillcolor=\"" << color_names[get(number, k)] + << "\" ]"; + } else { + out << " [ label=\"(" << get(number, k) << ")\" ]"; + } + } + + private: + NumberMap number; +}; + +template<typename NumberMap> +inline paint_by_number_writer<NumberMap> +paint_by_number(NumberMap number) +{ return paint_by_number_writer<NumberMap>(number); } + +template<typename Graph, typename VertexPropertiesWriter, + typename EdgePropertiesWriter, typename GraphPropertiesWriter> +void +write_graphviz(std::ostream& out, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef typename property_map<Graph, vertex_index_t>::const_type + VertexIndexMap; + typedef typename property_map<Graph, vertex_global_t>::const_type + VertexGlobalMap; + + static const bool is_undirected + = (is_base_and_derived<undirected_tag, directed_category>::value + || is_same<undirected_tag, directed_category>::value); + static const char* graph_kind = is_undirected? "graph" : "digraph"; + static const char* edge_kind = is_undirected? "--" : "->"; + + using boost::graph::parallel::process_group; + process_group_type pg = process_group(g); + + parallel::global_index_map<VertexIndexMap, VertexGlobalMap> + global_index(pg, num_vertices(g), get(vertex_index, g), + get(vertex_global, g)); + + std::ostringstream local_graph_out; + + local_graph_out << " subgraph cluster_" << process_id(pg) << " {\n"; + gpw(local_graph_out); + + typename graph_traits<Graph>::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { + + int global_idx = get(global_index, *vi); + local_graph_out << " n" << global_idx; + vpw(local_graph_out, *vi); + local_graph_out << ";\n"; + } + local_graph_out << " }\n\n"; + + + typename graph_traits<Graph>::edge_iterator ei, ei_end; + for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { + int source_idx = get(global_index, source(*ei, g)); + int target_idx = get(global_index, target(*ei, g)); + local_graph_out << " n" << source_idx << " " << edge_kind << " n" + << target_idx; + epw(local_graph_out, *ei); + local_graph_out << ";\n"; + } + + if (process_id(pg) == 0) { + out << graph_kind << " g {\n"; + out << local_graph_out.str(); + + synchronize(pg); + for (int i = 1; i < num_processes(pg); ++i) { + int len; + receive(pg, i, 0, len); + char* data = new char [len+1]; + data[len] = 0; + receive(pg, i, 1, data, len); + out << std::endl << data; + delete [] data; + } + out << "}\n"; + } else { + std::string result_str = local_graph_out.str(); + const char* data = result_str.c_str(); + + int len = result_str.length(); + send(pg, 0, 0, len); + send(pg, 0, 1, data, len); + synchronize(pg); + } + synchronize(pg); + synchronize(pg); + synchronize(pg); +} + +template<typename Graph, typename VertexPropertiesWriter, + typename EdgePropertiesWriter> +inline void +write_graphviz(std::ostream& out, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz(out, g, vpw, epw, graph_id_writer<Graph>(g)); +} + +template<typename Graph, typename VertexPropertiesWriter> +inline void +write_graphviz(std::ostream& out, + const Graph& g, + VertexPropertiesWriter vpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz(out, g, vpw, default_writer()); +} + +template<typename Graph> +inline void +write_graphviz(std::ostream& out, const Graph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz(out, g, default_writer()); +} + +template<typename Graph, typename VertexPropertiesWriter, + typename EdgePropertiesWriter, typename GraphPropertiesWriter> +void +write_graphviz(const std::string& filename, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g, vpw, epw, gpw); + } else { + write_graphviz(std::cout, g, vpw, epw, gpw); + } +} + +template<typename Graph, typename VertexPropertiesWriter, + typename EdgePropertiesWriter> +void +write_graphviz(const std::string& filename, + const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g, vpw, epw); + } else { + write_graphviz(std::cout, g, vpw, epw); + } +} + +template<typename Graph, typename VertexPropertiesWriter> +void +write_graphviz(const std::string& filename, + const Graph& g, + VertexPropertiesWriter vpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g, vpw); + } else { + write_graphviz(std::cout, g, vpw); + } +} + +template<typename Graph> +void +write_graphviz(const std::string& filename, const Graph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + if (process_id(g.process_group()) == 0) { + std::ofstream out(filename.c_str()); + write_graphviz(out, g); + } else { + write_graphviz(std::cout, g); + } +} + +template<typename Graph> +void +write_graphviz(std::ostream& out, const Graph& g, + const dynamic_properties& dp, + const std::string& node_id = "node_id" + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,distributed_graph_tag)) +{ + write_graphviz + (out, g, + /*vertex_writer=*/dynamic_vertex_properties_writer(dp, node_id), + /*edge_writer=*/dynamic_properties_writer(dp)); +} + +} // end namespace boost + +#endif // BOOST_GRAPH_PARALLEL_GRAPHVIZ_HPP diff --git a/Utilities/BGL/boost/graph/distributed/hohberg_biconnected_components.hpp b/Utilities/BGL/boost/graph/distributed/hohberg_biconnected_components.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8c3c16a4466c7f40d0d44442f079863b6e577f99 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/hohberg_biconnected_components.hpp @@ -0,0 +1,1129 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +// An implementation of Walter Hohberg's distributed biconnected +// components algorithm, from: +// +// Walter Hohberg. How to Find Biconnected Components in Distributed +// Networks. J. Parallel Distrib. Comput., 9(4):374-386, 1990. +// +#ifndef BOOST_GRAPH_DISTRIBUTED_HOHBERG_BICONNECTED_COMPONENTS_HPP +#define BOOST_GRAPH_DISTRIBUTED_HOHBERG_BICONNECTED_COMPONENTS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +/* You can define PBGL_HOHBERG_DEBUG to an integer value (1, 2, or 3) + * to enable debugging information. 1 includes only the phases of the + * algorithm and messages as their are received. 2 and 3 add + * additional levels of detail about internal data structures related + * to the algorithm itself. + * + * #define PBGL_HOHBERG_DEBUG 1 +*/ + +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/static_assert.hpp> +#include <boost/mpi/operations.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/graph/graph_concepts.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/optional.hpp> +#include <utility> // for std::pair +#include <cassert> +#include <algorithm> // for std::find, std::mismatch +#include <vector> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/graph/distributed/connected_components.hpp> + +namespace boost { namespace graph { namespace distributed { + +namespace hohberg_detail { + enum message_kind { + /* A header for the PATH message, stating which edge the message + is coming on and how many vertices will be following. The data + structure communicated will be a path_header. */ + msg_path_header, + /* A message containing the vertices that make up a path. It will + always follow a msg_path_header and will contain vertex + descriptors, only. */ + msg_path_vertices, + /* A header for the TREE message, stating the value of gamma and + the number of vertices to come in the following + msg_tree_vertices. */ + msg_tree_header, + /* A message containing the vertices that make up the set of + vertices in the same bicomponent as the sender. It will always + follow a msg_tree_header and will contain vertex descriptors, + only. */ + msg_tree_vertices, + /* Provides a name for the biconnected component of the edge. */ + msg_name + }; + + // Payload for a msg_path_header message. + template<typename EdgeDescriptor> + struct path_header + { + // The edge over which the path is being communicated + EdgeDescriptor edge; + + // The length of the path, i.e., the number of vertex descriptors + // that will be coming in the next msg_path_vertices message. + std::size_t path_length; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & edge & path_length; + } + }; + + // Payload for a msg_tree_header message. + template<typename Vertex, typename Edge> + struct tree_header + { + // The edge over which the tree is being communicated + Edge edge; + + // Gamma, which is the eta of the sender. + Vertex gamma; + + // The length of the list of vertices in the bicomponent, i.e., + // the number of vertex descriptors that will be coming in the + // next msg_tree_vertices message. + std::size_t bicomp_length; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & edge & gamma & bicomp_length; + } + }; + + // Payload for the msg_name message. + template<typename EdgeDescriptor> + struct name_header + { + // The edge being communicated and named. + EdgeDescriptor edge; + + // The 0-based name of the component + std::size_t name; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & edge & name; + } + }; + + /* Computes the branch point between two paths. The branch point is + the last position at which both paths are equivalent, beyond + which the paths diverge. Both paths must have length > 0 and the + initial elements of the paths must be equal. This is guaranteed + in Hohberg's algorithm because all paths start at the + leader. Returns the value at the branch point. */ + template<typename T> + T branch_point(const std::vector<T>& p1, const std::vector<T>& p2) + { + assert(!p1.empty()); + assert(!p2.empty()); + assert(p1.front() == p2.front()); + + typedef typename std::vector<T>::const_iterator iterator; + + iterator mismatch_pos; + if (p1.size() <= p2.size()) + mismatch_pos = std::mismatch(p1.begin(), p1.end(), p2.begin()).first; + else + mismatch_pos = std::mismatch(p2.begin(), p2.end(), p1.begin()).first; + --mismatch_pos; + return *mismatch_pos; + } + + /* Computes the infimum of vertices a and b in the given path. The + infimum is the largest element that is on the paths from a to the + root and from b to the root. */ + template<typename T> + T infimum(const std::vector<T>& parent_path, T a, T b) + { + using std::swap; + + typedef typename std::vector<T>::const_iterator iterator; + iterator first = parent_path.begin(), last = parent_path.end(); + +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << "infimum("; + for (iterator i = first; i != last; ++i) { + if (i != first) std::cerr << ' '; + std::cerr << local(*i) << '@' << owner(*i); + } + std::cerr << ", " << local(a) << '@' << owner(a) << ", " + << local(b) << '@' << owner(b) << ") = "; +#endif + + if (a == b) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(a) << '@' << owner(a) << std::endl; +#endif + return a; + } + + // Try to find a or b, whichever is closest to the end + --last; + while (*last != a) { + // If we match b, swap the two so we'll be looking for b later. + if (*last == b) { swap(a,b); break; } + + if (last == first) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(*first) << '@' << owner(*first) << std::endl; +#endif + return *first; + } + else --last; + } + + // Try to find b (which may originally have been a) + while (*last != b) { + if (last == first) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(*first) << '@' << owner(*first) << std::endl; +#endif + return *first; + } + else --last; + } + +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << local(*last) << '@' << owner(*last) << std::endl; +#endif + // We've found b; it's the infimum. + return *last; + } +} // end namespace hohberg_detail + +/* A message that will be stored for each edge by Hohberg's algorithm. */ +template<typename Graph> +struct hohberg_message +{ + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + // Assign from a path message + void assign(const std::vector<Vertex>& path) + { + gamma = graph_traits<Graph>::null_vertex(); + path_or_bicomp = path; + } + + // Assign from a tree message + void assign(Vertex gamma, const std::vector<Vertex>& in_same_bicomponent) + { + this->gamma = gamma; + path_or_bicomp = in_same_bicomponent; + } + + bool is_path() const { return gamma == graph_traits<Graph>::null_vertex(); } + bool is_tree() const { return gamma != graph_traits<Graph>::null_vertex(); } + + /// The "gamma" of a tree message, or null_vertex() for a path message + Vertex gamma; + + // Either the path for a path message or the in_same_bicomponent + std::vector<Vertex> path_or_bicomp; +}; + + +/* An abstraction of a vertex processor in Hohberg's algorithm. The + hohberg_vertex_processor class is responsible for processing + messages transmitted to it via its edges. */ +template<typename Graph> +class hohberg_vertex_processor +{ + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + typedef typename graph_traits<Graph>::degree_size_type degree_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + ProcessGroup; + typedef std::vector<Vertex> path_t; + typedef typename path_t::iterator path_iterator; + + public: + hohberg_vertex_processor() + : phase(1), + parent(graph_traits<Graph>::null_vertex()), + eta(graph_traits<Graph>::null_vertex()) + { + } + + // Called to initialize a leader in the algorithm, which involves + // sending out the initial path messages and being ready to receive + // them. + void initialize_leader(Vertex alpha, const Graph& g); + + /// Handle a path message on edge e. The path will be destroyed by + /// this operation. + void + operator()(Edge e, path_t& path, const Graph& g); + + /// Handle a tree message on edge e. in_same_bicomponent will be + /// destroyed by this operation. + void + operator()(Edge e, Vertex gamma, path_t& in_same_bicomponent, + const Graph& g); + + // Handle a name message. + void operator()(Edge e, edges_size_type name, const Graph& g); + + // Retrieve the phase + unsigned char get_phase() const { return phase; } + + // Start the naming phase. The current phase must be 3 (echo), and + // the offset contains the offset at which this processor should + // begin when labelling its bicomponents. The offset is just a + // parallel prefix sum of the number of bicomponents in each + // processor that precedes it (globally). + void + start_naming_phase(Vertex alpha, const Graph& g, edges_size_type offset); + + /* Determine the number of bicomponents that we will be naming + * ourselves. + */ + edges_size_type num_starting_bicomponents(Vertex alpha, const Graph& g); + + // Fill in the edge component map with biconnected component + // numbers. + template<typename ComponentMap> + void fill_edge_map(Vertex alpha, const Graph& g, ComponentMap& component); + + protected: + /* Start the echo phase (phase 3) where we propagate information up + the tree. */ + void echo_phase(Vertex alpha, const Graph& g); + + /* Retrieve the index of edge in the out-edges list of target(e, g). */ + std::size_t get_edge_index(Edge e, const Graph& g); + + /* Retrieve the index of the edge incidence on v in the out-edges + list of vertex u. */ + std::size_t get_incident_edge_index(Vertex u, Vertex v, const Graph& g); + + /* Keeps track of which phase of the algorithm we are in. There are + * four phases plus the "finished" phase: + * + * 1) Building the spanning tree + * 2) Discovering cycles + * 3) Echoing back up the spanning tree + * 4) Labelling biconnected components + * 5) Finished + */ + unsigned char phase; + + /* The parent of this vertex in the spanning tree. This value will + be graph_traits<Graph>::null_vertex() for the leader. */ + Vertex parent; + + /* The farthest ancestor up the tree that resides in the same + biconnected component as we do. This information is approximate: + we might not know about the actual farthest ancestor, but this is + the farthest one we've seen so far. */ + Vertex eta; + + /* The number of edges that have not yet transmitted any messages to + us. This starts at the degree of the vertex and decreases as we + receive messages. When this counter hits zero, we're done with + the second phase of the algorithm. In Hohberg's paper, the actual + remaining edge set E is stored with termination when all edges + have been removed from E, but we only need to detect termination + so the set E need not be explicitly represented. */ + degree_size_type num_edges_not_transmitted; + + /* The path from the root of the spanning tree to this vertex. This + vector will always store only the parts of the path leading up to + this vertex, and not the vertex itself. Thus, it will be empty + for the leader. */ + std::vector<Vertex> path_from_root; + + /* Structure containing all of the extra data we need to keep around + PER EDGE. This information can not be contained within a property + map, because it can't be shared among vertices without breaking + the algorithm. Decreasing the size of this structure will drastically */ + struct per_edge_data + { + hohberg_message<Graph> msg; + std::vector<Vertex> M; + bool is_tree_edge; + degree_size_type partition; + }; + + /* Data for each edge in the graph. This structure will be indexed + by the position of the edge in the out_edges() list. */ + std::vector<per_edge_data> edge_data; + + /* The mapping from local partition numbers (0..n-1) to global + partition numbers. */ + std::vector<edges_size_type> local_to_global_partitions; + + friend class boost::serialization::access; + + // We cannot actually serialize a vertex processor, nor would we + // want to. However, the fact that we're putting instances into a + // distributed_property_map means that we need to have a serialize() + // function available. + template<typename Archiver> + void serialize(Archiver&, const unsigned int /*version*/) + { + assert(false); + } +}; + +template<typename Graph> +void +hohberg_vertex_processor<Graph>::initialize_leader(Vertex alpha, + const Graph& g) +{ + using namespace hohberg_detail; + + ProcessGroup pg = process_group(g); + + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + path_header<Edge> header; + header.path_length = 1; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + header.edge = e; + send(pg, get(owner, target(e, g)), msg_path_header, header); + send(pg, get(owner, target(e, g)), msg_path_vertices, alpha); + } + + num_edges_not_transmitted = degree(alpha, g); + edge_data.resize(num_edges_not_transmitted); + phase = 2; +} + +template<typename Graph> +void +hohberg_vertex_processor<Graph>::operator()(Edge e, path_t& path, + const Graph& g) +{ + using namespace hohberg_detail; + + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + +#ifdef PBGL_HOHBERG_DEBUG +// std::cerr << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " +// << local(target(e, g)) << '@' << owner(target(e, g)) << ": path("; +// for (std::size_t i = 0; i < path.size(); ++i) { +// if (i > 0) std::cerr << ' '; +// std::cerr << local(path[i]) << '@' << owner(path[i]); +// } + std::cerr << "), phase = " << (int)phase << std::endl; +#endif + + // Get access to edge-specific data + if (edge_data.empty()) + edge_data.resize(degree(target(e, g), g)); + per_edge_data& edata = edge_data[get_edge_index(e, g)]; + + // Record the message. We'll need it in phase 3. + edata.msg.assign(path); + + // Note: "alpha" refers to the vertex "processor" receiving the + // message. + Vertex alpha = target(e, g); + + switch (phase) { + case 1: + { + num_edges_not_transmitted = degree(alpha, g) - 1; + edata.is_tree_edge = true; + parent = path.back(); + eta = parent; + edata.M.clear(); edata.M.push_back(parent); + + // Broadcast the path from the root to our potential children in + // the spanning tree. + path.push_back(alpha); + path_header<Edge> header; + header.path_length = path.size(); + ProcessGroup pg = process_group(g); + BGL_FORALL_OUTEDGES_T(alpha, oe, g, Graph) { + // Skip the tree edge we just received + if (target(oe, g) != source(e, g)) { + header.edge = oe; + send(pg, get(owner, target(oe, g)), msg_path_header, header); + send(pg, get(owner, target(oe, g)), msg_path_vertices, &path[0], + header.path_length); + } + } + path.pop_back(); + + // Swap the old path in, to save some extra copying. Nobody + path_from_root.swap(path); + + // Once we have received our place in the spanning tree, move on + // to phase 2. + phase = 2; + + // If we only had only edge, skip to phase 3. + if (num_edges_not_transmitted == 0) + echo_phase(alpha, g); + return; + } + + case 2: + { + --num_edges_not_transmitted; + edata.is_tree_edge = false; + + // Determine if alpha (our vertex) is in the path + path_iterator pos = std::find(path.begin(), path.end(), alpha); + if (pos != path.end()) { + // Case A: There is a cycle alpha beta ... gamma alpha + // M(e) <- {beta, gammar} + edata.M.clear(); + ++pos; + // If pos == path.end(), we have a self-loop + if (pos != path.end()) { + // Add beta + edata.M.push_back(*pos); + ++pos; + } + // If pos == path.end(), we have a self-loop or beta == gamma + // (parallel edge). Otherwise, add gamma. + if (pos != path.end()) edata.M.push_back(path.back()); + } else { + // Case B: There is a cycle but we haven't seen alpha yet. + // M(e) = {parent, path.back()} + edata.M.clear(); + edata.M.push_back(path.back()); + if (parent != path.back()) edata.M.push_back(parent); + + // eta = inf(eta, bra(pi_t, pi)) + eta = infimum(path_from_root, eta, branch_point(path_from_root, path)); + } + if (num_edges_not_transmitted == 0) + echo_phase(alpha, g); + break; + } + + default: +// std::cerr << "Phase is " << int(phase) << "\n"; + assert(false); + } +} + +template<typename Graph> +void +hohberg_vertex_processor<Graph>::operator()(Edge e, Vertex gamma, + path_t& in_same_bicomponent, + const Graph& g) +{ + using namespace hohberg_detail; + +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " + << local(target(e, g)) << '@' << owner(target(e, g)) << ": tree(" + << local(gamma) << '@' << owner(gamma) << ", "; + for (std::size_t i = 0; i < in_same_bicomponent.size(); ++i) { + if (i > 0) std::cerr << ' '; + std::cerr << local(in_same_bicomponent[i]) << '@' + << owner(in_same_bicomponent[i]); + } + std::cerr << ", " << local(source(e, g)) << '@' << owner(source(e, g)) + << "), phase = " << (int)phase << std::endl; +#endif + + // Get access to edge-specific data + per_edge_data& edata = edge_data[get_edge_index(e, g)]; + + // Record the message. We'll need it in phase 3. + edata.msg.assign(gamma, in_same_bicomponent); + + // Note: "alpha" refers to the vertex "processor" receiving the + // message. + Vertex alpha = target(e, g); + Vertex beta = source(e, g); + + switch (phase) { + case 2: + --num_edges_not_transmitted; + edata.is_tree_edge = true; + + if (gamma == alpha) { + // Case C + edata.M.swap(in_same_bicomponent); + } else { + // Case D + edata.M.clear(); + edata.M.push_back(parent); + if (beta != parent) edata.M.push_back(beta); + eta = infimum(path_from_root, eta, gamma); + } + if (num_edges_not_transmitted == 0) + echo_phase(alpha, g); + break; + + default: + assert(false); + } +} + +template<typename Graph> +void +hohberg_vertex_processor<Graph>::operator()(Edge e, edges_size_type name, + const Graph& g) +{ + using namespace hohberg_detail; + +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " + << local(target(e, g)) << '@' << owner(target(e, g)) << ": name(" + << name << "), phase = " << (int)phase << std::endl; +#endif + + assert(phase == 4); + + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + // Send name messages along the spanning tree edges that are in the + // same bicomponent as the edge to our parent. + ProcessGroup pg = process_group(g); + + Vertex alpha = target(e, g); + + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + if (edata.is_tree_edge + && find(edata.M.begin(), edata.M.end(), parent) != edata.M.end() + && target(e, g) != parent) { + // Notify our children in the spanning tree of this name + name_header<Edge> header; + header.edge = e; + header.name = name; + send(pg, get(owner, target(e, g)), msg_name, header); + } else if (target(e, g) == parent) { + // Map from local partition numbers to global bicomponent numbers + local_to_global_partitions[edata.partition] = name; + } + } + + // Final stage + phase = 5; +} + +template<typename Graph> +typename hohberg_vertex_processor<Graph>::edges_size_type +hohberg_vertex_processor<Graph>:: +num_starting_bicomponents(Vertex alpha, const Graph& g) +{ + edges_size_type not_mapped = (std::numeric_limits<edges_size_type>::max)(); + + edges_size_type result = 0; + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + if (edata.is_tree_edge + && find(edata.M.begin(), edata.M.end(), parent) == edata.M.end()) { + // Map from local partition numbers to global bicomponent numbers + if (local_to_global_partitions[edata.partition] == not_mapped) + local_to_global_partitions[edata.partition] = result++; + } + } + +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << local(alpha) << '@' << owner(alpha) << " has " << result + << " bicomponents originating at it." << std::endl; +#endif + + return result; +} + +template<typename Graph> +template<typename ComponentMap> +void +hohberg_vertex_processor<Graph>:: +fill_edge_map(Vertex alpha, const Graph& g, ComponentMap& component) +{ + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + local_put(component, e, local_to_global_partitions[edata.partition]); + +#if defined(PBGL_HOHBERG_DEBUG) && PBGL_HOHBERG_DEBUG > 2 + std::cerr << "component(" + << local(source(e, g)) << '@' << owner(source(e, g)) << " -> " + << local(target(e, g)) << '@' << owner(target(e, g)) << ") = " + << local_to_global_partitions[edata.partition] + << " (partition = " << edata.partition << " of " + << local_to_global_partitions.size() << ")" << std::endl; +#endif + } +} + +template<typename Graph> +void +hohberg_vertex_processor<Graph>:: +start_naming_phase(Vertex alpha, const Graph& g, edges_size_type offset) +{ + using namespace hohberg_detail; + + assert(phase == 4); + + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + // Send name messages along the spanning tree edges of the + // components that we get to number. + ProcessGroup pg = process_group(g); + + bool has_more_children_to_name = false; + + // Map from local partition numbers to global bicomponent numbers + edges_size_type not_mapped = (std::numeric_limits<edges_size_type>::max)(); + for (std::size_t i = 0; i < local_to_global_partitions.size(); ++i) { + if (local_to_global_partitions[i] != not_mapped) + local_to_global_partitions[i] += offset; + } + + std::size_t idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + if (edata.is_tree_edge + && find(edata.M.begin(), edata.M.end(), parent) == edata.M.end()) { + // Notify our children in the spanning tree of this new name + name_header<Edge> header; + header.edge = e; + header.name = local_to_global_partitions[edata.partition]; + send(pg, get(owner, target(e, g)), msg_name, header); + } else if (edata.is_tree_edge) { + has_more_children_to_name = true; + } +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 2 + std::cerr << "M[" << local(source(e, g)) << '@' << owner(source(e, g)) + << " -> " << local(target(e, g)) << '@' << owner(target(e, g)) + << "] = "; + for (std::size_t i = 0; i < edata.M.size(); ++i) { + std::cerr << local(edata.M[i]) << '@' << owner(edata.M[i]) << ' '; + } + std::cerr << std::endl; +#endif + } + + // See if we're done. + if (!has_more_children_to_name) + // Final stage + phase = 5; +} + +template<typename Graph> +void +hohberg_vertex_processor<Graph>::echo_phase(Vertex alpha, const Graph& g) +{ + using namespace hohberg_detail; + + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + /* We're entering the echo phase. */ + phase = 3; + + if (parent != graph_traits<Graph>::null_vertex()) { + Edge edge_to_parent; + +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(alpha) << '@' << owner(alpha) << " echo: parent = " + << local(parent) << '@' << owner(parent) << ", eta = " + << local(eta) << '@' << owner(eta) << ", Gamma = "; +#endif + + std::vector<Vertex> bicomp; + std::size_t e_index = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + if (target(e, g) == parent && parent == eta) { + edge_to_parent = e; + if (find(bicomp.begin(), bicomp.end(), alpha) == bicomp.end()) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(alpha) << '@' << owner(alpha) << ' '; +#endif + bicomp.push_back(alpha); + } + } else { + if (target(e, g) == parent) edge_to_parent = e; + + per_edge_data& edata = edge_data[e_index]; + + if (edata.msg.is_path()) { + path_iterator pos = std::find(edata.msg.path_or_bicomp.begin(), + edata.msg.path_or_bicomp.end(), + eta); + if (pos != edata.msg.path_or_bicomp.end()) { + ++pos; + if (pos != edata.msg.path_or_bicomp.end() + && find(bicomp.begin(), bicomp.end(), *pos) == bicomp.end()) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(*pos) << '@' << owner(*pos) << ' '; +#endif + bicomp.push_back(*pos); + } + } + } else if (edata.msg.is_tree() && edata.msg.gamma == eta) { + for (path_iterator i = edata.msg.path_or_bicomp.begin(); + i != edata.msg.path_or_bicomp.end(); ++i) { + if (find(bicomp.begin(), bicomp.end(), *i) == bicomp.end()) { +#if defined(PBGL_HOHBERG_DEBUG) and PBGL_HOHBERG_DEBUG > 1 + std::cerr << local(*i) << '@' << owner(*i) << ' '; +#endif + bicomp.push_back(*i); + } + } + } + } + ++e_index; + } +#ifdef PBGL_HOHBERG_DEBUG + std::cerr << std::endl; +#endif + + // Send tree(eta, bicomp) to parent + tree_header<Vertex, Edge> header; + header.edge = edge_to_parent; + header.gamma = eta; + header.bicomp_length = bicomp.size(); + ProcessGroup pg = process_group(g); + send(pg, get(owner, parent), msg_tree_header, header); + send(pg, get(owner, parent), msg_tree_vertices, &bicomp[0], + header.bicomp_length); + } + + // Compute the partition of edges such that iff two edges e1 and e2 + // are in different subsets then M(e1) is disjoint from M(e2). + + // Start by putting each edge in a different partition + std::vector<degree_size_type> parent_vec(edge_data.size()); + degree_size_type idx = 0; + for (idx = 0; idx < edge_data.size(); ++idx) + parent_vec[idx] = idx; + + // Go through each edge e, performing a union() on the edges + // incident on all vertices in M[e]. + idx = 0; + BGL_FORALL_OUTEDGES_T(alpha, e, g, Graph) { + per_edge_data& edata = edge_data[idx++]; + + // Compute union of vertices in M + if (!edata.M.empty()) { + degree_size_type e1 = get_incident_edge_index(alpha, edata.M.front(), g); + while (parent_vec[e1] != e1) e1 = parent_vec[e1]; + + for (std::size_t i = 1; i < edata.M.size(); ++i) { + degree_size_type e2 = get_incident_edge_index(alpha, edata.M[i], g); + while (parent_vec[e2] != e2) e2 = parent_vec[e2]; + parent_vec[e2] = e1; + } + } + } + + edges_size_type not_mapped = (std::numeric_limits<edges_size_type>::max)(); + + // Determine the number of partitions + for (idx = 0; idx < parent_vec.size(); ++idx) { + if (parent_vec[idx] == idx) { + edge_data[idx].partition = local_to_global_partitions.size(); + local_to_global_partitions.push_back(not_mapped); + } + } + + // Assign partition numbers to each edge + for (idx = 0; idx < parent_vec.size(); ++idx) { + degree_size_type rep = parent_vec[idx]; + while (rep != parent_vec[rep]) rep = parent_vec[rep]; + edge_data[idx].partition = edge_data[rep].partition; + } + + // Enter the naming phase (but don't send anything yet). + phase = 4; +} + +template<typename Graph> +std::size_t +hohberg_vertex_processor<Graph>::get_edge_index(Edge e, const Graph& g) +{ + std::size_t result = 0; + BGL_FORALL_OUTEDGES_T(target(e, g), oe, g, Graph) { + if (source(e, g) == target(oe, g)) return result; + ++result; + } + assert(false); +} + +template<typename Graph> +std::size_t +hohberg_vertex_processor<Graph>::get_incident_edge_index(Vertex u, Vertex v, + const Graph& g) +{ + std::size_t result = 0; + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) { + if (target(e, g) == v) return result; + ++result; + } + assert(false); +} + +template<typename Graph, typename InputIterator, typename ComponentMap, + typename VertexProcessorMap> +typename graph_traits<Graph>::edges_size_type +hohberg_biconnected_components + (const Graph& g, + ComponentMap component, + InputIterator first, InputIterator last, + VertexProcessorMap vertex_processor) +{ + using namespace boost::graph::parallel; + using namespace hohberg_detail; + using boost::parallel::all_reduce; + + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + // The graph must be undirected + BOOST_STATIC_ASSERT( + (is_convertible<typename graph_traits<Graph>::directed_category, + undirected_tag>::value)); + + // The graph must model Incidence Graph + function_requires< IncidenceGraphConcept<Graph> >(); + + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + typedef typename graph_traits<Graph>::degree_size_type degree_size_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + // Retrieve the process group we will use for communication + typedef typename process_group_type<Graph>::type process_group_type; + process_group_type pg = process_group(g); + + // Keeps track of the edges that we know to be tree edges. + std::vector<edge_descriptor> tree_edges; + + // The leaders send out a path message to initiate the algorithm + while (first != last) { + vertex_descriptor leader = *first; + if (process_id(pg) == get(owner, leader)) + vertex_processor[leader].initialize_leader(leader, g); + ++first; + } + synchronize(pg); + + // Will hold the number of bicomponents in the graph. + edges_size_type num_bicomponents = 0; + + // Keep track of the path length that we should expect, based on the + // level in the breadth-first search tree. At present, this is only + // used as a sanity check. TBD: This could be used to decrease the + // amount of communication required per-edge (by about 4 bytes). + std::size_t path_length = 1; + + typedef std::vector<vertex_descriptor> path_t; + typedef typename path_t::iterator path_iterator; + + unsigned char minimum_phase = 5; + do { + while (optional<std::pair<int, int> > msg = probe(pg)) { + switch (msg->second) { + case msg_path_header: + { + // Receive the path header + path_header<edge_descriptor> header; + receive(pg, msg->first, msg->second, header); + assert(path_length == header.path_length); + + // Receive the path itself + path_t path(path_length); + receive(pg, msg->first, msg_path_vertices, &path[0], path_length); + + edge_descriptor e = header.edge; + vertex_processor[target(e, g)](e, path, g); + } + break; + + case msg_path_vertices: + // Should be handled in msg_path_header case, unless we're going + // stateless. + assert(false); + break; + + case msg_tree_header: + { + // Receive the tree header + tree_header<vertex_descriptor, edge_descriptor> header; + receive(pg, msg->first, msg->second, header); + + // Receive the tree itself + path_t in_same_bicomponent(header.bicomp_length); + receive(pg, msg->first, msg_tree_vertices, &in_same_bicomponent[0], + header.bicomp_length); + + edge_descriptor e = header.edge; + vertex_processor[target(e, g)](e, header.gamma, in_same_bicomponent, + g); + } + break; + + case msg_tree_vertices: + // Should be handled in msg_tree_header case, unless we're + // going stateless. + assert(false); + break; + + case msg_name: + { + name_header<edge_descriptor> header; + receive(pg, msg->first, msg->second, header); + edge_descriptor e = header.edge; + vertex_processor[target(e, g)](e, header.name, g); + } + break; + + default: + assert(false); + } + } + ++path_length; + + // Compute minimum phase locally + minimum_phase = 5; + unsigned char maximum_phase = 1; + BGL_FORALL_VERTICES_T(v, g, Graph) { + minimum_phase = (std::min)(minimum_phase, vertex_processor[v].get_phase()); + maximum_phase = (std::max)(maximum_phase, vertex_processor[v].get_phase()); + } + +#ifdef PBGL_HOHBERG_DEBUG + if (process_id(pg) == 0) + std::cerr << "<---------End of stage------------->" << std::endl; +#endif + // Compute minimum phase globally + minimum_phase = all_reduce(pg, minimum_phase, boost::mpi::minimum<char>()); + +#ifdef PBGL_HOHBERG_DEBUG + if (process_id(pg) == 0) + std::cerr << "Minimum phase = " << (int)minimum_phase << std::endl; +#endif + + if (minimum_phase == 4 + && all_reduce(pg, maximum_phase, boost::mpi::maximum<char>()) == 4) { + +#ifdef PBGL_HOHBERG_DEBUG + if (process_id(pg) == 0) + std::cerr << "<---------Naming phase------------->" << std::endl; +#endif + // Compute the biconnected component number offsets for each + // vertex. + std::vector<edges_size_type> local_offsets; + local_offsets.reserve(num_vertices(g)); + edges_size_type num_local_bicomponents = 0; + BGL_FORALL_VERTICES_T(v, g, Graph) { + local_offsets.push_back(num_local_bicomponents); + num_local_bicomponents += + vertex_processor[v].num_starting_bicomponents(v, g); + } + + synchronize(pg); + + // Find our the number of bicomponent names that will originate + // from each process. This tells us how many bicomponents are in + // the entire graph and what our global offset is for computing + // our own biconnected component names. + std::vector<edges_size_type> all_bicomponents(num_processes(pg)); + all_gather(pg, &num_local_bicomponents, &num_local_bicomponents + 1, + all_bicomponents); + num_bicomponents = 0; + edges_size_type my_global_offset = 0; + for (std::size_t i = 0; i < all_bicomponents.size(); ++i) { + if (i == (std::size_t)process_id(pg)) + my_global_offset = num_bicomponents; + num_bicomponents += all_bicomponents[i]; + } + + std::size_t index = 0; + BGL_FORALL_VERTICES_T(v, g, Graph) { + edges_size_type offset = my_global_offset + local_offsets[index++]; + vertex_processor[v].start_naming_phase(v, g, offset); + } + } + + synchronize(pg); + } while (minimum_phase < 5); + + // Number the edges appropriately. + BGL_FORALL_VERTICES_T(v, g, Graph) + vertex_processor[v].fill_edge_map(v, g, component); + + return num_bicomponents; +} + +template<typename Graph, typename ComponentMap, typename InputIterator> +typename graph_traits<Graph>::edges_size_type +hohberg_biconnected_components + (const Graph& g, ComponentMap component, + InputIterator first, InputIterator last) + +{ + std::vector<hohberg_vertex_processor<Graph> > + vertex_processors(num_vertices(g)); + return hohberg_biconnected_components + (g, component, first, last, + make_iterator_property_map(vertex_processors.begin(), + get(vertex_index, g))); +} + +template<typename Graph, typename ComponentMap, typename ParentMap> +typename graph_traits<Graph>::edges_size_type +hohberg_biconnected_components(const Graph& g, ComponentMap component, + ParentMap parent) +{ + // We need the connected components of the graph, but we don't care + // about component numbers. + connected_components(g, dummy_property_map(), parent); + + // Each root in the parent map is a leader + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + std::vector<vertex_descriptor> leaders; + BGL_FORALL_VERTICES_T(v, g, Graph) + if (get(parent, v) == v) leaders.push_back(v); + + return hohberg_biconnected_components(g, component, + leaders.begin(), leaders.end()); +} + +template<typename Graph, typename ComponentMap> +typename graph_traits<Graph>::edges_size_type +hohberg_biconnected_components(const Graph& g, ComponentMap component) +{ + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + std::vector<vertex_descriptor> parents(num_vertices(g)); + return hohberg_biconnected_components + (g, component, make_iterator_property_map(parents.begin(), + get(vertex_index, g))); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_HOHBERG_BICONNECTED_COMPONENTS_HPP diff --git a/Utilities/BGL/boost/graph/distributed/local_subgraph.hpp b/Utilities/BGL/boost/graph/distributed/local_subgraph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..00296231752fd1dc0097c105944e87396f2e4c4b --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/local_subgraph.hpp @@ -0,0 +1,175 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_LOCAL_SUBGRAPH_HPP +#define BOOST_GRAPH_LOCAL_SUBGRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/filtered_graph.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/graph/parallel/container_traits.hpp> + +namespace boost { + +namespace graph { namespace detail { + // Optionally, virtually derive from a base class + template<bool Derive, typename Base> struct derive_from_if; + template<typename Base> struct derive_from_if<true, Base> : virtual Base {}; + template<typename Base> struct derive_from_if<false, Base> {}; + + template<typename NewBase, typename Tag, typename OldBase = NewBase> + struct derive_from_if_tag_is : + derive_from_if<(is_base_and_derived<OldBase, Tag>::value + || is_same<OldBase, Tag>::value), + NewBase> + { + }; +} } // end namespace graph::detail + +template<typename DistributedGraph> +class is_local_edge +{ +public: + typedef bool result_type; + typedef typename graph_traits<DistributedGraph>::edge_descriptor + argument_type; + + is_local_edge() : g(0) {} + is_local_edge(DistributedGraph& g) : g(&g), owner(get(vertex_owner, g)) {} + + // Since either the source or target vertex must be local, the + // equivalence of their owners indicates a local edge. + result_type operator()(const argument_type& e) const + { return get(owner, source(e, *g)) == get(owner, target(e, *g)); } + +private: + DistributedGraph* g; + typename property_map<DistributedGraph, vertex_owner_t>::const_type owner; +}; + +template<typename DistributedGraph> +class is_local_vertex +{ +public: + typedef bool result_type; + typedef typename graph_traits<DistributedGraph>::vertex_descriptor + argument_type; + + is_local_vertex() : g(0) {} + is_local_vertex(DistributedGraph& g) : g(&g), owner(get(vertex_owner, g)) { } + + // Since either the source or target vertex must be local, the + // equivalence of their owners indicates a local edge. + result_type operator()(const argument_type& v) const + { + return get(owner, v) == process_id(process_group(*g)); + } + +private: + DistributedGraph* g; + typename property_map<DistributedGraph, vertex_owner_t>::const_type owner; +}; + +template<typename DistributedGraph> +class local_subgraph + : public filtered_graph<DistributedGraph, + is_local_edge<DistributedGraph>, + is_local_vertex<DistributedGraph> > +{ + typedef filtered_graph<DistributedGraph, + is_local_edge<DistributedGraph>, + is_local_vertex<DistributedGraph> > + inherited; + typedef typename graph_traits<DistributedGraph>::traversal_category + inherited_category; + +public: + struct traversal_category : + graph::detail::derive_from_if_tag_is<incidence_graph_tag, + inherited_category>, + graph::detail::derive_from_if_tag_is<adjacency_graph_tag, + inherited_category>, + graph::detail::derive_from_if_tag_is<vertex_list_graph_tag, + inherited_category>, + graph::detail::derive_from_if_tag_is<edge_list_graph_tag, + inherited_category>, + graph::detail::derive_from_if_tag_is<vertex_list_graph_tag, + inherited_category, + distributed_vertex_list_graph_tag>, + graph::detail::derive_from_if_tag_is<edge_list_graph_tag, + inherited_category, + distributed_edge_list_graph_tag> + { }; + + local_subgraph(DistributedGraph& g) + : inherited(g, + is_local_edge<DistributedGraph>(g), + is_local_vertex<DistributedGraph>(g)), + g(g) + { + } + + // Distributed Container + typedef typename boost::graph::parallel::process_group_type<DistributedGraph>::type + process_group_type; + + process_group_type& process_group() + { + using boost::graph::parallel::process_group; + return process_group(g); + } + const process_group_type& process_group() const + { + using boost::graph::parallel::process_group; + return boost::graph::parallel::process_group(g); + } + + DistributedGraph& base() { return g; } + const DistributedGraph& base() const { return g; } + +private: + DistributedGraph& g; +}; + +template<typename DistributedGraph, typename PropertyTag> +class property_map<local_subgraph<DistributedGraph>, PropertyTag> + : public property_map<DistributedGraph, PropertyTag> { }; + +template<typename DistributedGraph, typename PropertyTag> +class property_map<local_subgraph<const DistributedGraph>, PropertyTag> +{ + public: + typedef typename property_map<DistributedGraph, PropertyTag>::const_type + type; + typedef type const_type; +}; + +template<typename PropertyTag, typename DistributedGraph> +inline typename property_map<local_subgraph<DistributedGraph>, PropertyTag>::type +get(PropertyTag p, local_subgraph<DistributedGraph>& g) +{ return get(p, g.base()); } + +template<typename PropertyTag, typename DistributedGraph> +inline typename property_map<local_subgraph<DistributedGraph>, PropertyTag> + ::const_type +get(PropertyTag p, const local_subgraph<DistributedGraph>& g) +{ return get(p, g.base()); } + +template<typename DistributedGraph> +inline local_subgraph<DistributedGraph> +make_local_subgraph(DistributedGraph& g) +{ return local_subgraph<DistributedGraph>(g); } + +} // end namespace boost + +#endif // BOOST_GRAPH_LOCAL_SUBGRAPH_HPP diff --git a/Utilities/BGL/boost/graph/distributed/mpi_process_group.hpp b/Utilities/BGL/boost/graph/distributed/mpi_process_group.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e0ee5790298794f3c71301dc3513ca8c8e1697d2 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/mpi_process_group.hpp @@ -0,0 +1,809 @@ +// Copyright (C) 2004-2008 The Trustees of Indiana University. +// Copyright (C) 2007 Douglas Gregor +// Copyright (C) 2007 Matthias Troyer <troyer@boost-consulting.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 +// Matthias Troyer +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_MPI_PROCESS_GROUP +#define BOOST_GRAPH_DISTRIBUTED_MPI_PROCESS_GROUP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +//#define NO_SPLIT_BATCHES +#define SEND_OOB_BSEND + +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> +#include <utility> +#include <memory> +#include <boost/function/function1.hpp> +#include <boost/function/function2.hpp> +#include <boost/function/function0.hpp> +#include <boost/mpi.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/utility/enable_if.hpp> + +namespace boost { namespace graph { namespace distributed { + +// Process group tags +struct mpi_process_group_tag : virtual parallel::linear_process_group_tag { }; + +class mpi_process_group +{ + struct impl; + + public: + /// Number of tags available to each data structure. + static const int max_tags = 256; + + /** + * The type of a "receive" handler, that will be provided with + * (source, tag) pairs when a message is received. Users can provide a + * receive handler for a distributed data structure, for example, to + * automatically pick up and respond to messages as needed. + */ + typedef function<void(int source, int tag)> receiver_type; + + /** + * The type of a handler for the on-synchronize event, which will be + * executed at the beginning of synchronize(). + */ + typedef function0<void> on_synchronize_event_type; + + /// Used as a tag to help create an "empty" process group. + struct create_empty {}; + + /// The type used to buffer message data + typedef boost::mpi::packed_oprimitive::buffer_type buffer_type; + + /// The type used to identify a process + typedef int process_id_type; + + /// The type used to count the number of processes + typedef int process_size_type; + + /// The type of communicator used to transmit data via MPI + typedef boost::mpi::communicator communicator_type; + + /// Classification of the capabilities of this process group + struct communication_category + : virtual parallel::bsp_process_group_tag, + virtual mpi_process_group_tag { }; + + // TBD: We can eliminate the "source" field and possibly the + // "offset" field. + struct message_header { + /// The process that sent the message + process_id_type source; + + /// The message tag + int tag; + + /// The offset of the message into the buffer + std::size_t offset; + + /// The length of the message in the buffer, in bytes + std::size_t bytes; + + template <class Archive> + void serialize(Archive& ar, int) + { + ar & source & tag & offset & bytes; + } + }; + + /** + * Stores the outgoing messages for a particular processor. + * + * @todo Evaluate whether we should use a deque instance, which + * would reduce could reduce the cost of "sending" messages but + * increases the time spent in the synchronization step. + */ + struct outgoing_messages { + outgoing_messages() {} + ~outgoing_messages() {} + + std::vector<message_header> headers; + buffer_type buffer; + + template <class Archive> + void serialize(Archive& ar, int) + { + ar & headers & buffer; + } + + void swap(outgoing_messages& x) + { + headers.swap(x.headers); + buffer.swap(x.buffer); + } + }; + +private: + /** + * Virtual base from which every trigger will be launched. See @c + * trigger_launcher for more information. + */ + class trigger_base : boost::noncopyable + { + public: + explicit trigger_base(int tag) : tag_(tag) { } + + /// Retrieve the tag associated with this trigger + int tag() const { return tag_; } + + virtual ~trigger_base() { } + + /** + * Invoked to receive a message that matches a particular trigger. + * + * @param source the source of the message + * @param tag the (local) tag of the message + * @param context the context under which the trigger is being + * invoked + */ + virtual void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const = 0; + + protected: + // The message tag associated with this trigger + int tag_; + }; + + /** + * Launches a specific handler in response to a trigger. This + * function object wraps up the handler function object and a buffer + * for incoming data. + */ + template<typename Type, typename Handler> + class trigger_launcher : public trigger_base + { + public: + explicit trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler) + : trigger_base(tag), self(self), handler(handler) + {} + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + mpi_process_group& self; + mutable Handler handler; + }; + + /** + * Launches a specific handler with a message reply in response to a + * trigger. This function object wraps up the handler function + * object and a buffer for incoming data. + */ + template<typename Type, typename Handler> + class reply_trigger_launcher : public trigger_base + { + public: + explicit reply_trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler) + : trigger_base(tag), self(self), handler(handler) + {} + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + mpi_process_group& self; + mutable Handler handler; + }; + + template<typename Type, typename Handler> + class global_trigger_launcher : public trigger_base + { + public: + explicit global_trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler) + : trigger_base(tag), handler(handler) + { + } + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + mutable Handler handler; + // TBD: do not forget to cancel any outstanding Irecv when deleted, + // if we decide to use Irecv + }; + + template<typename Type, typename Handler> + class global_irecv_trigger_launcher : public trigger_base + { + public: + explicit global_irecv_trigger_launcher(mpi_process_group& self, int tag, + const Handler& handler, int sz) + : trigger_base(tag), handler(handler), buffer_size(sz) + { + prepare_receive(self,tag); + } + + void + receive(mpi_process_group const& pg, int source, int tag, + trigger_receive_context context, int block=-1) const; + + private: + void prepare_receive(mpi_process_group const& pg, int tag, bool force=false) const; + Handler handler; + int buffer_size; + // TBD: do not forget to cancel any outstanding Irecv when deleted, + // if we decide to use Irecv + }; + +public: + /** + * Construct a new BSP process group from an MPI communicator. The + * MPI communicator will be duplicated to create a new communicator + * for this process group to use. + */ + mpi_process_group(communicator_type parent_comm = communicator_type()); + + /** + * Construct a new BSP process group from an MPI communicator. The + * MPI communicator will be duplicated to create a new communicator + * for this process group to use. This constructor allows to tune the + * size of message batches. + * + * @param num_headers The maximum number of headers in a message batch + * + * @param buffer_size The maximum size of the message buffer in a batch. + * + */ + mpi_process_group( std::size_t num_headers, std::size_t buffer_size, + communicator_type parent_comm = communicator_type()); + + /** + * Construct a copy of the BSP process group for a new distributed + * data structure. This data structure will synchronize with all + * other members of the process group's equivalence class (including + * @p other), but will have its own set of tags. + * + * @param other The process group that this new process group will + * be based on, using a different set of tags within the same + * communication and synchronization space. + * + * @param handler A message handler that will be passed (source, + * tag) pairs for each message received by this data + * structure. The handler is expected to receive the messages + * immediately. The handler can be changed after-the-fact by + * calling @c replace_handler. + * + * @param out_of_band_receive An anachronism. TODO: remove this. + */ + mpi_process_group(const mpi_process_group& other, + const receiver_type& handler, + bool out_of_band_receive = false); + + /** + * Construct a copy of the BSP process group for a new distributed + * data structure. This data structure will synchronize with all + * other members of the process group's equivalence class (including + * @p other), but will have its own set of tags. + */ + mpi_process_group(const mpi_process_group& other, + attach_distributed_object, + bool out_of_band_receive = false); + + /** + * Create an "empty" process group, with no information. This is an + * internal routine that users should never need. + */ + explicit mpi_process_group(create_empty) {} + + /** + * Destroys this copy of the process group. + */ + ~mpi_process_group(); + + /** + * Replace the current message handler with a new message handler. + * + * @param handle The new message handler. + * @param out_of_band_receive An anachronism: remove this + */ + void replace_handler(const receiver_type& handler, + bool out_of_band_receive = false); + + /** + * Turns this process group into the process group for a new + * distributed data structure or object, allocating its own tag + * block. + */ + void make_distributed_object(); + + /** + * Replace the handler to be invoked at the beginning of synchronize. + */ + void + replace_on_synchronize_handler(const on_synchronize_event_type& handler = 0); + + /** + * Return the block number of the current data structure. A value of + * 0 indicates that this particular instance of the process group is + * not associated with any distributed data structure. + */ + int my_block_number() const { return block_num? *block_num : 0; } + + /** + * Encode a block number/tag pair into a single encoded tag for + * transmission. + */ + int encode_tag(int block_num, int tag) const + { return block_num * max_tags + tag; } + + /** + * Decode an encoded tag into a block number/tag pair. + */ + std::pair<int, int> decode_tag(int encoded_tag) const + { return std::make_pair(encoded_tag / max_tags, encoded_tag % max_tags); } + + // @todo Actually write up the friend declarations so these could be + // private. + + // private: + + /** Allocate a block of tags for this instance. The block should not + * have been allocated already, e.g., my_block_number() == + * 0. Returns the newly-allocated block number. + */ + int allocate_block(bool out_of_band_receive = false); + + /** Potentially emit a receive event out of band. Returns true if an event + * was actually sent, false otherwise. + */ + bool maybe_emit_receive(int process, int encoded_tag) const; + + /** Emit a receive event. Returns true if an event was actually + * sent, false otherwise. + */ + bool emit_receive(int process, int encoded_tag) const; + + /** Emit an on-synchronize event to all block handlers. */ + void emit_on_synchronize() const; + + /** Retrieve a reference to the stored receiver in this block. */ + template<typename Receiver> + Receiver* get_receiver(); + + template<typename T> + void + send_impl(int dest, int tag, const T& value, + mpl::true_ /*is_mpi_datatype*/) const; + + template<typename T> + void + send_impl(int dest, int tag, const T& value, + mpl::false_ /*is_mpi_datatype*/) const; + + template<typename T> + typename disable_if<boost::mpi::is_mpi_datatype<T>, void>::type + array_send_impl(int dest, int tag, const T values[], std::size_t n) const; + + template<typename T> + bool + receive_impl(int source, int tag, T& value, + mpl::true_ /*is_mpi_datatype*/) const; + + template<typename T> + bool + receive_impl(int source, int tag, T& value, + mpl::false_ /*is_mpi_datatype*/) const; + + // Receive an array of values + template<typename T> + typename disable_if<boost::mpi::is_mpi_datatype<T>, bool>::type + array_receive_impl(int source, int tag, T* values, std::size_t& n) const; + + optional<std::pair<mpi_process_group::process_id_type, int> > probe() const; + + void synchronize() const; + + operator bool() { return impl_; } + + mpi_process_group base() const; + + /** + * Create a new trigger for a specific message tag. Triggers handle + * out-of-band messaging, and the handler itself will be called + * whenever a message is available. The handler itself accepts four + * arguments: the source of the message, the message tag (which will + * be the same as @p tag), the message data (of type @c Type), and a + * boolean flag that states whether the message was received + * out-of-band. The last will be @c true for out-of-band receives, + * or @c false for receives at the end of a synchronization step. + */ + template<typename Type, typename Handler> + void trigger(int tag, const Handler& handler); + + /** + * Create a new trigger for a specific message tag, along with a way + * to send a reply with data back to the sender. Triggers handle + * out-of-band messaging, and the handler itself will be called + * whenever a message is available. The handler itself accepts four + * arguments: the source of the message, the message tag (which will + * be the same as @p tag), the message data (of type @c Type), and a + * boolean flag that states whether the message was received + * out-of-band. The last will be @c true for out-of-band receives, + * or @c false for receives at the end of a synchronization + * step. The handler also returns a value, which will be routed back + * to the sender. + */ + template<typename Type, typename Handler> + void trigger_with_reply(int tag, const Handler& handler); + + template<typename Type, typename Handler> + void global_trigger(int tag, const Handler& handler, std::size_t buffer_size=0); + + + + /** + * Poll for any out-of-band messages. This routine will check if any + * out-of-band messages are available. Those that are available will + * be handled immediately, if possible. + * + * @returns if an out-of-band message has been received, but we are + * unable to actually receive the message, a (source, tag) pair will + * be returned. Otherwise, returns an empty optional. + * + * @param wait When true, we should block until a message comes in. + * + * @param synchronizing whether we are currently synchronizing the + * process group + */ + optional<std::pair<int, int> > + poll(bool wait = false, int block = -1, bool synchronizing = false) const; + + /** + * Determines the context of the trigger currently executing. If + * multiple triggers are executing (recursively), then the context + * for the most deeply nested trigger will be returned. If no + * triggers are executing, returns @c trc_none. This might be used, + * for example, to determine whether a reply to a message should + * itself be sent out-of-band or whether it can go via the normal, + * slower communication route. + */ + trigger_receive_context trigger_context() const; + + /// INTERNAL ONLY + void receive_batch(process_id_type source, outgoing_messages& batch) const; + + /// INTERNAL ONLY + /// + /// Determine the actual communicator and tag will be used for a + /// transmission with the given tag. + std::pair<boost::mpi::communicator, int> + actual_communicator_and_tag(int tag, int block) const; + + /// set the size of the message buffer used for buffered oob sends + + static void set_message_buffer_size(std::size_t s); + + /// get the size of the message buffer used for buffered oob sends + + static std::size_t message_buffer_size(); + static int old_buffer_size; + static void* old_buffer; +private: + + void install_trigger(int tag, int block, + shared_ptr<trigger_base> const& launcher); + + void poll_requests(int block=-1) const; + + + // send a batch if the buffer is full now or would get full + void maybe_send_batch(process_id_type dest) const; + + // actually send a batch + void send_batch(process_id_type dest, outgoing_messages& batch) const; + void send_batch(process_id_type dest) const; + + void pack_headers() const; + + /** + * Process a batch of incoming messages immediately. + * + * @param source the source of these messages + */ + void process_batch(process_id_type source) const; + void receive_batch(boost::mpi::status& status) const; + + //void free_finished_sends() const; + + /// Status messages used internally by the process group + enum status_messages { + /// the first of the reserved message tags + msg_reserved_first = 126, + /// Sent from a processor when sending batched messages + msg_batch = 126, + /// Sent from a processor when sending large batched messages, larger than + /// the maximum buffer size for messages to be received by MPI_Irecv + msg_large_batch = 127, + /// Sent from a source processor to everyone else when that + /// processor has entered the synchronize() function. + msg_synchronizing = 128, + /// the last of the reserved message tags + msg_reserved_last = 128 + }; + + /** + * Description of a block of tags associated to a particular + * distributed data structure. This structure will live as long as + * the distributed data structure is around, and will be used to + * help send messages to the data structure. + */ + struct block_type + { + block_type() { } + + /// Handler for receive events + receiver_type on_receive; + + /// Handler executed at the start of synchronization + on_synchronize_event_type on_synchronize; + + /// Individual message triggers. Note: at present, this vector is + /// indexed by the (local) tag of the trigger. Any tags that + /// don't have triggers will have NULL pointers in that spot. + std::vector<shared_ptr<trigger_base> > triggers; + }; + + /** + * Data structure containing all of the blocks for the distributed + * data structures attached to a process group. + */ + typedef std::vector<block_type*> blocks_type; + + /// Iterator into @c blocks_type. + typedef blocks_type::iterator block_iterator; + + /** + * Deleter used to deallocate a block when its distributed data + * structure is destroyed. This type will be used as the deleter for + * @c block_num. + */ + struct deallocate_block; + + static std::vector<char> message_buffer; + +public: + /** + * Data associated with the process group and all of its attached + * distributed data structures. + */ + shared_ptr<impl> impl_; + + /** + * When non-null, indicates that this copy of the process group is + * associated with a particular distributed data structure. The + * integer value contains the block number (a value > 0) associated + * with that data structure. The deleter for this @c shared_ptr is a + * @c deallocate_block object that will deallocate the associated + * block in @c impl_->blocks. + */ + shared_ptr<int> block_num; + + /** + * Rank of this process, to avoid having to call rank() repeatedly. + */ + int rank; + + /** + * Number of processes in this process group, to avoid having to + * call communicator::size() repeatedly. + */ + int size; +}; + + + +inline mpi_process_group::process_id_type +process_id(const mpi_process_group& pg) +{ return pg.rank; } + +inline mpi_process_group::process_size_type +num_processes(const mpi_process_group& pg) +{ return pg.size; } + +mpi_process_group::communicator_type communicator(const mpi_process_group& pg); + +template<typename T> +void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value); + +template<typename InputIterator> +void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, InputIterator first, InputIterator last); + +template<typename T> +inline void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, T* first, T* last) +{ send(pg, dest, tag, first, last - first); } + +template<typename T> +inline void +send(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T* first, const T* last) +{ send(pg, dest, tag, first, last - first); } + +template<typename T> +mpi_process_group::process_id_type +receive(const mpi_process_group& pg, int tag, T& value); + +template<typename T> +mpi_process_group::process_id_type +receive(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value); + +optional<std::pair<mpi_process_group::process_id_type, int> > +probe(const mpi_process_group& pg); + +void synchronize(const mpi_process_group& pg); + +template<typename T, typename BinaryOperation> +T* +all_reduce(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op); + +template<typename T, typename BinaryOperation> +T* +scan(const mpi_process_group& pg, T* first, T* last, T* out, + BinaryOperation bin_op); + +template<typename InputIterator, typename T> +void +all_gather(const mpi_process_group& pg, + InputIterator first, InputIterator last, std::vector<T>& out); + +template<typename InputIterator> +mpi_process_group +process_subgroup(const mpi_process_group& pg, + InputIterator first, InputIterator last); + +template<typename T> +void +broadcast(const mpi_process_group& pg, T& val, + mpi_process_group::process_id_type root); + + +/******************************************************************* + * Out-of-band communication * + *******************************************************************/ + +template<typename T> +typename enable_if<boost::mpi::is_mpi_datatype<T> >::type +send_oob(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value, int block=-1) +{ + using boost::mpi::get_mpi_datatype; + + // Determine the actual message tag we will use for the send, and which + // communicator we will use. + std::pair<boost::mpi::communicator, int> actual + = pg.actual_communicator_and_tag(tag, block); + +#ifdef SEND_OOB_BSEND + if (mpi_process_group::message_buffer_size()) { + MPI_Bsend(const_cast<T*>(&value), 1, get_mpi_datatype<T>(value), dest, + actual.second, actual.first); + return; + } +#endif + MPI_Request request; + MPI_Isend(const_cast<T*>(&value), 1, get_mpi_datatype<T>(value), dest, + actual.second, actual.first, &request); + + int done=0; + do { + pg.poll(); + MPI_Test(&request,&done,MPI_STATUS_IGNORE); + } while (!done); +} + +template<typename T> +typename disable_if<boost::mpi::is_mpi_datatype<T> >::type +send_oob(const mpi_process_group& pg, mpi_process_group::process_id_type dest, + int tag, const T& value, int block=-1) +{ + using boost::mpi::packed_oarchive; + + // Determine the actual message tag we will use for the send, and which + // communicator we will use. + std::pair<boost::mpi::communicator, int> actual + = pg.actual_communicator_and_tag(tag, block); + + // Serialize the data into a buffer + packed_oarchive out(actual.first); + out << value; + std::size_t size = out.size(); + + // Send the actual message data +#ifdef SEND_OOB_BSEND + if (mpi_process_group::message_buffer_size()) { + MPI_Bsend(const_cast<void*>(out.address()), size, MPI_PACKED, + dest, actual.second, actual.first); + return; + } +#endif + MPI_Request request; + MPI_Isend(const_cast<void*>(out.address()), size, MPI_PACKED, + dest, actual.second, actual.first, &request); + + int done=0; + do { + pg.poll(); + MPI_Test(&request,&done,MPI_STATUS_IGNORE); + } while (!done); +} + +template<typename T> +typename enable_if<boost::mpi::is_mpi_datatype<T> >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block=-1); + +template<typename T> +typename disable_if<boost::mpi::is_mpi_datatype<T> >::type +receive_oob(const mpi_process_group& pg, + mpi_process_group::process_id_type source, int tag, T& value, int block=-1); + +template<typename SendT, typename ReplyT> +typename enable_if<boost::mpi::is_mpi_datatype<ReplyT> >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block = -1); + +template<typename SendT, typename ReplyT> +typename disable_if<boost::mpi::is_mpi_datatype<ReplyT> >::type +send_oob_with_reply(const mpi_process_group& pg, + mpi_process_group::process_id_type dest, + int tag, const SendT& send_value, ReplyT& reply_value, + int block = -1); + +} } } // end namespace boost::graph::distributed + +BOOST_IS_BITWISE_SERIALIZABLE(boost::graph::distributed::mpi_process_group::message_header) +namespace boost { namespace mpi { + template<> + struct is_mpi_datatype<boost::graph::distributed::mpi_process_group::message_header> : mpl::true_ { }; +} } // end namespace boost::mpi + +namespace std { +/// optimized swap for outgoing messages +inline void +swap(boost::graph::distributed::mpi_process_group::outgoing_messages& x, + boost::graph::distributed::mpi_process_group::outgoing_messages& y) +{ + x.swap(y); +} + + +} + +BOOST_CLASS_IMPLEMENTATION(boost::graph::distributed::mpi_process_group::outgoing_messages,object_serializable) +BOOST_CLASS_TRACKING(boost::graph::distributed::mpi_process_group::outgoing_messages,track_never) + +#include <boost/graph/distributed/detail/mpi_process_group.ipp> + +#endif // BOOST_PARALLEL_MPI_MPI_PROCESS_GROUP_HPP diff --git a/Utilities/BGL/boost/graph/distributed/named_graph.hpp b/Utilities/BGL/boost/graph/distributed/named_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..83b00613b65ddd81aaec34e1a93c0c0657025133 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/named_graph.hpp @@ -0,0 +1,1239 @@ +// Copyright (C) 2007 Douglas Gregor +// Copyright (C) 2007 Hartmut Kaiser + +// 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) + +// TODO: +// - Cache (some) remote vertex names? +#ifndef BOOST_GRAPH_DISTRIBUTED_NAMED_GRAPH_HPP +#define BOOST_GRAPH_DISTRIBUTED_NAMED_GRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/named_graph.hpp> +#include <boost/functional/hash.hpp> +#include <boost/variant.hpp> +#include <boost/graph/parallel/simple_trigger.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/graph/parallel/detail/property_holders.hpp> + +namespace boost { namespace graph { namespace distributed { + +using boost::parallel::trigger_receive_context; +using boost::detail::parallel::pair_with_property; + +/******************************************************************* + * Hashed distribution of named entities * + *******************************************************************/ + +template<typename T> +struct hashed_distribution +{ + template<typename ProcessGroup> + hashed_distribution(const ProcessGroup& pg, std::size_t /*num_vertices*/ = 0) + : n(num_processes(pg)) { } + + int operator()(const T& value) const + { + return hasher(value) % n; + } + + std::size_t n; + hash<T> hasher; +}; + +/// Specialization for named graphs +template <typename InDistribution, typename VertexProperty, typename VertexSize, + typename ProcessGroup, + typename ExtractName + = typename internal_vertex_name<VertexProperty>::type> +struct select_distribution +{ +private: + /// The type used to name vertices in the graph + typedef typename remove_cv< + typename remove_reference< + typename ExtractName::result_type>::type>::type + vertex_name_type; + +public: + /** + * The @c type field provides a distribution object that maps + * vertex names to processors. The distribution object will be + * constructed with the process group over which communication will + * occur. The distribution object shall also be a function + * object mapping from the type of the name to a processor number + * in @c [0, @c p) (for @c p processors). By default, the mapping + * function uses the @c boost::hash value of the name, modulo @c p. + */ + typedef typename mpl::if_<is_same<InDistribution, defaultS>, + hashed_distribution<vertex_name_type>, + InDistribution>::type + type; + + /// for named graphs the default type is the same as the stored distribution + /// type + typedef type default_type; +}; + +/// Specialization for non-named graphs +template <typename InDistribution, typename VertexProperty, typename VertexSize, + typename ProcessGroup> +struct select_distribution<InDistribution, VertexProperty, VertexSize, + ProcessGroup, void> +{ + /// the distribution type stored in the graph for non-named graphs should be + /// the variant_distribution type + typedef typename mpl::if_<is_same<InDistribution, defaultS>, + boost::parallel::variant_distribution<ProcessGroup, + VertexSize>, + InDistribution>::type type; + + /// default_type is used as the distribution functor for the + /// adjacency_list, it should be parallel::block by default + typedef typename mpl::if_<is_same<InDistribution, defaultS>, + boost::parallel::block, type>::type + default_type; +}; + + +/******************************************************************* + * Named graph mixin * + *******************************************************************/ + +/** + * named_graph is a mixin that provides names for the vertices of a + * graph, including a mapping from names to vertices. Graph types that + * may or may not be have vertex names (depending on the properties + * supplied by the user) should use maybe_named_graph. + * + * Template parameters: + * + * Graph: the graph type that derives from named_graph + * + * Vertex: the type of a vertex descriptor in Graph. Note: we cannot + * use graph_traits here, because the Graph is not yet defined. + * + * VertexProperty: the type of the property stored along with the + * vertex. + * + * ProcessGroup: the process group over which the distributed name + * graph mixin will communicate. + */ +template<typename Graph, typename Vertex, typename Edge, typename Config> +class named_graph +{ +public: + /// Messages passed within the distributed named graph + enum message_kind { + /** + * Requests the addition of a vertex on a remote processor. The + * message data is a @c vertex_name_type. + */ + msg_add_vertex_name, + + /** + * Requests the addition of a vertex on a remote processor. The + * message data is a @c vertex_name_type. The remote processor + * will send back a @c msg_add_vertex_name_reply message + * containing the vertex descriptor. + */ + msg_add_vertex_name_with_reply, + + /** + * Requests the vertex descriptor corresponding to the given + * vertex name. The remote process will reply with a + * @c msg_find_vertex_reply message containing the answer. + */ + msg_find_vertex, + + /** + * Requests the addition of an edge on a remote processor. The + * data stored in these messages is a @c pair<source, target>@, + * where @c source and @c target may be either names (of type @c + * vertex_name_type) or vertex descriptors, depending on what + * information we have locally. + */ + msg_add_edge_name_name, + msg_add_edge_vertex_name, + msg_add_edge_name_vertex, + + /** + * These messages are identical to msg_add_edge_*_*, except that + * the process actually adding the edge will send back a @c + * pair<edge_descriptor,bool> + */ + msg_add_edge_name_name_with_reply, + msg_add_edge_vertex_name_with_reply, + msg_add_edge_name_vertex_with_reply, + + /** + * Requests the addition of an edge with a property on a remote + * processor. The data stored in these messages is a @c + * pair<vertex_property_type, pair<source, target>>@, where @c + * source and @c target may be either names (of type @c + * vertex_name_type) or vertex descriptors, depending on what + * information we have locally. + */ + msg_add_edge_name_name_with_property, + msg_add_edge_vertex_name_with_property, + msg_add_edge_name_vertex_with_property, + + /** + * These messages are identical to msg_add_edge_*_*_with_property, + * except that the process actually adding the edge will send back + * a @c pair<edge_descriptor,bool>. + */ + msg_add_edge_name_name_with_reply_and_property, + msg_add_edge_vertex_name_with_reply_and_property, + msg_add_edge_name_vertex_with_reply_and_property + }; + + /// The vertex descriptor type + typedef Vertex vertex_descriptor; + + /// The edge descriptor type + typedef Edge edge_descriptor; + + /// The vertex property type + typedef typename Config::vertex_property_type vertex_property_type; + + /// The vertex property type + typedef typename Config::edge_property_type edge_property_type; + + /// The type used to extract names from the property structure + typedef typename internal_vertex_name<vertex_property_type>::type + extract_name_type; + + /// The type used to name vertices in the graph + typedef typename remove_cv< + typename remove_reference< + typename extract_name_type::result_type>::type>::type + vertex_name_type; + + /// The type used to distribute named vertices in the graph + typedef typename Config::distribution_type distribution_type; + typedef typename Config::base_distribution_type base_distribution_type; + + /// The type used for communication in the distributed structure + typedef typename Config::process_group_type process_group_type; + + /// Type used to identify processes + typedef typename process_group_type::process_id_type process_id_type; + + /// a reference to this class, which is used for disambiguation of the + // add_vertex function + typedef named_graph named_graph_type; + + /// Structure returned when adding a vertex by vertex name + struct lazy_add_vertex; + friend struct lazy_add_vertex; + + /// Structure returned when adding an edge by vertex name + struct lazy_add_edge; + friend struct lazy_add_edge; + + /// Structure returned when adding an edge by vertex name with a property + struct lazy_add_edge_with_property; + friend struct lazy_add_edge_with_property; + + explicit named_graph(const process_group_type& pg); + + named_graph(const process_group_type& pg, const base_distribution_type& distribution); + + /// Set up triggers, but only for the BSP process group + void setup_triggers(); + + /// Retrieve the derived instance + Graph& derived() { return static_cast<Graph&>(*this); } + const Graph& derived() const { return static_cast<const Graph&>(*this); } + + /// Retrieve the process group + process_group_type& process_group() { return process_group_; } + const process_group_type& process_group() const { return process_group_; } + + // Retrieve the named distribution + distribution_type& named_distribution() { return distribution_; } + const distribution_type& named_distribution() const { return distribution_; } + + /// Notify the named_graph that we have added the given vertex. This + /// is a no-op. + void added_vertex(Vertex) { } + + /// Notify the named_graph that we are removing the given + /// vertex. This is a no-op. + void removing_vertex(Vertex) { } + + /// Notify the named_graph that we are clearing the graph + void clearing_graph() { } + + /// Retrieve the owner of a given vertex based on the properties + /// associated with that vertex. This operation just returns the + /// number of the local processor, adding all vertices locally. + process_id_type owner_by_property(const vertex_property_type&); + +protected: + void + handle_add_vertex_name(int source, int tag, const vertex_name_type& msg, + trigger_receive_context); + + vertex_descriptor + handle_add_vertex_name_with_reply(int source, int tag, + const vertex_name_type& msg, + trigger_receive_context); + + boost::parallel::detail::untracked_pair<vertex_descriptor, bool> + handle_find_vertex(int source, int tag, const vertex_name_type& msg, + trigger_receive_context); + + template<typename U, typename V> + void handle_add_edge(int source, int tag, const boost::parallel::detail::untracked_pair<U, V>& msg, + trigger_receive_context); + + template<typename U, typename V> + boost::parallel::detail::untracked_pair<edge_descriptor, bool> + handle_add_edge_with_reply(int source, int tag, const boost::parallel::detail::untracked_pair<U, V>& msg, + trigger_receive_context); + + template<typename U, typename V> + void + handle_add_edge_with_property + (int source, int tag, + const pair_with_property<U, V, edge_property_type>& msg, + trigger_receive_context); + + template<typename U, typename V> + boost::parallel::detail::untracked_pair<edge_descriptor, bool> + handle_add_edge_with_reply_and_property + (int source, int tag, + const pair_with_property<U, V, edge_property_type>& msg, + trigger_receive_context); + + /// The process group for this distributed data structure + process_group_type process_group_; + + /// The distribution we will use to map names to processors + distribution_type distribution_; +}; + +/// Helper macro containing the template parameters of named_graph +#define BGL_NAMED_GRAPH_PARAMS \ + typename Graph, typename Vertex, typename Edge, typename Config +/// Helper macro containing the named_graph<...> instantiation +#define BGL_NAMED_GRAPH \ + named_graph<Graph, Vertex, Edge, Config> + +/** + * Data structure returned from add_vertex that will "lazily" add the + * vertex, either when it is converted to a @c vertex_descriptor or + * when the most recent copy has been destroyed. + */ +template<BGL_NAMED_GRAPH_PARAMS> +struct BGL_NAMED_GRAPH::lazy_add_vertex +{ + /// Construct a new lazyily-added vertex + lazy_add_vertex(named_graph& self, const vertex_name_type& name) + : self(self), name(name), committed(false) { } + + /// Transfer responsibility for adding the vertex from the source of + /// the copy to the newly-constructed opbject. + lazy_add_vertex(const lazy_add_vertex& other) + : self(self), name(other.name), committed(other.committed) + { + other.committed = true; + } + + /// If the vertex has not been added yet, add it + ~lazy_add_vertex(); + + /// Add the vertex and return its descriptor. This conversion can + /// only occur once, and only when this object is responsible for + /// creating the vertex. + operator vertex_descriptor() const { return commit(); } + + /// Add the vertex and return its descriptor. This can only be + /// called once, and only when this object is responsible for + /// creating the vertex. + vertex_descriptor commit() const; + +protected: + named_graph& self; + vertex_name_type name; + mutable bool committed; +}; + +template<BGL_NAMED_GRAPH_PARAMS> +BGL_NAMED_GRAPH::lazy_add_vertex::~lazy_add_vertex() +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + /// If this vertex has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the vertex now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + process_id_type owner = self.named_distribution()(name); + if (owner == process_id(self.process_group())) + /// Add the vertex locally + add_vertex(self.derived().base().vertex_constructor(name), self.derived()); + else + /// Ask the owner of the vertex to add a vertex with this name + send(self.process_group(), owner, msg_add_vertex_name, name); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::vertex_descriptor +BGL_NAMED_GRAPH::lazy_add_vertex::commit() const +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + assert (!committed); + committed = true; + + process_id_type owner = self.named_distribution()(name); + if (owner == process_id(self.process_group())) + /// Add the vertex locally + return add_vertex(self.derived().base().vertex_constructor(name), + self.derived()); + else { + /// Ask the owner of the vertex to add a vertex with this name + vertex_descriptor result; + send_oob_with_reply(self.process_group(), owner, + msg_add_vertex_name_with_reply, name, result); + return result; + } +} + +/** + * Data structure returned from add_edge that will "lazily" add the + * edge, either when it is converted to a @c + * pair<edge_descriptor,bool> or when the most recent copy has been + * destroyed. + */ +template<BGL_NAMED_GRAPH_PARAMS> +struct BGL_NAMED_GRAPH::lazy_add_edge +{ + /// The graph's edge descriptor + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + /// Add an edge for the edge (u, v) based on vertex names + lazy_add_edge(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + const vertex_name_type& v_name) + : self(self), u(u_name), v(v_name), committed(false) { } + + /// Add an edge for the edge (u, v) based on a vertex descriptor and name + lazy_add_edge(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + const vertex_name_type& v_name) + : self(self), u(u), v(v_name), committed(false) { } + + /// Add an edge for the edge (u, v) based on a vertex name and descriptor + lazy_add_edge(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + vertex_descriptor v) + : self(self), u(u_name), v(v), committed(false) { } + + /// Add an edge for the edge (u, v) based on vertex descriptors + lazy_add_edge(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + vertex_descriptor v) + : self(self), u(u), v(v), committed(false) { } + + /// Copy a lazy_add_edge structure, which transfers responsibility + /// for adding the edge to the newly-constructed object. + lazy_add_edge(const lazy_add_edge& other) + : self(other.self), u(other.u), v(other.v), committed(other.committed) + { + other.committed = true; + } + + /// If the edge has not yet been added, add the edge but don't wait + /// for a reply. + ~lazy_add_edge(); + + /// Returns commit(). + operator std::pair<edge_descriptor, bool>() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair<edge_descriptor, bool> commit() const; + +protected: + BGL_NAMED_GRAPH& self; + mutable variant<vertex_descriptor, vertex_name_type> u; + mutable variant<vertex_descriptor, vertex_name_type> v; + mutable bool committed; + +private: + // No copy-assignment semantics + void operator=(lazy_add_edge&); +}; + +template<BGL_NAMED_GRAPH_PARAMS> +BGL_NAMED_GRAPH::lazy_add_edge::~lazy_add_edge() +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + using boost::parallel::detail::make_untracked_pair; + + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + if (vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) { + // We haven't resolved the target vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the target + // of the edge. If the owner of the target does not happen to own + // the source, it will resolve the target to a vertex descriptor + // and pass the message along to the owner of the source. + if (vertex_name_type* u_name = boost::get<vertex_name_type>(&u)) + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_name_name, + make_untracked_pair(*u_name, *v_name)); + else + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_vertex_name, + make_untracked_pair(boost::get<vertex_descriptor>(u), *v_name)); + } else { + if (vertex_name_type* u_name = boost::get<vertex_name_type>(&u)) + // We haven't resolved the source vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the + // source vertex requesting the edge addition. + send(self.process_group(), self.distribution_(*u_name), + BGL_NAMED_GRAPH::msg_add_edge_name_vertex, + make_untracked_pair(*u_name, boost::get<vertex_descriptor>(v))); + else + // We have descriptors for both of the vertices, either of which + // may be remote or local. Tell the owner of the source vertex + // to add the edge (it may be us!). + add_edge(boost::get<vertex_descriptor>(u), + boost::get<vertex_descriptor>(v), + self.derived()); + } +} + +template<BGL_NAMED_GRAPH_PARAMS> +std::pair<typename graph_traits<Graph>::edge_descriptor, bool> +BGL_NAMED_GRAPH::lazy_add_edge::commit() const +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + using boost::parallel::detail::make_untracked_pair; + + assert(!committed); + committed = true; + + /// The result we will return, if we are sending a message to + /// request that someone else add the edge. + boost::parallel::detail::untracked_pair<edge_descriptor, bool> result; + + /// The owner of the vertex "u" + process_id_type u_owner; + + process_id_type rank = process_id(self.process_group()); + if (const vertex_name_type* u_name = boost::get<vertex_name_type>(&u)) { + /// We haven't resolved the source vertex to a descriptor yet, so + /// it must not be local. + u_owner = self.named_distribution()(*u_name); + + /// Send a message to the remote vertex requesting that it add the + /// edge. The message differs depending on whether we have a + /// vertex name or a vertex descriptor for the target. + if (const vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) + send_oob_with_reply(self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_name_with_reply, + make_untracked_pair(*u_name, *v_name), result); + else + send_oob_with_reply(self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_vertex_with_reply, + make_untracked_pair(*u_name, + boost::get<vertex_descriptor>(v)), + result); + } else { + /// We have resolved the source vertex to a descriptor, which may + /// either be local or remote. + u_owner + = get(vertex_owner, self.derived(), + boost::get<vertex_descriptor>(u)); + if (u_owner == rank) { + /// The source is local. If we need to, resolve the target vertex. + if (const vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) + v = add_vertex(*v_name, self.derived()); + + /// Add the edge using vertex descriptors + return add_edge(boost::get<vertex_descriptor>(u), + boost::get<vertex_descriptor>(v), + self.derived()); + } else { + /// The source is remote. Just send a message to its owner + /// requesting that the owner add the new edge, either directly + /// or via the derived class's add_edge function. + if (const vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_vertex_name_with_reply, + make_untracked_pair(boost::get<vertex_descriptor>(u), *v_name), + result); + else + return add_edge(boost::get<vertex_descriptor>(u), + boost::get<vertex_descriptor>(v), + self.derived()); + } + } + + // If we get here, the edge has been added remotely and "result" + // contains the result of that edge addition. + return result; +} + +/** + * Data structure returned from add_edge that will "lazily" add the + * edge with a property, either when it is converted to a @c + * pair<edge_descriptor,bool> or when the most recent copy has been + * destroyed. + */ +template<BGL_NAMED_GRAPH_PARAMS> +struct BGL_NAMED_GRAPH::lazy_add_edge_with_property +{ + /// The graph's edge descriptor + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + + /// The Edge property type for our graph + typedef typename Config::edge_property_type edge_property_type; + + /// Add an edge for the edge (u, v) based on vertex names + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + const vertex_name_type& v_name, + const edge_property_type& property) + : self(self), u(u_name), v(v_name), property(property), committed(false) + { + } + + /// Add an edge for the edge (u, v) based on a vertex descriptor and name + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + const vertex_name_type& v_name, + const edge_property_type& property) + : self(self), u(u), v(v_name), property(property), committed(false) { } + + /// Add an edge for the edge (u, v) based on a vertex name and descriptor + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + const vertex_name_type& u_name, + vertex_descriptor v, + const edge_property_type& property) + : self(self), u(u_name), v(v), property(property), committed(false) { } + + /// Add an edge for the edge (u, v) based on vertex descriptors + lazy_add_edge_with_property(BGL_NAMED_GRAPH& self, + vertex_descriptor u, + vertex_descriptor v, + const edge_property_type& property) + : self(self), u(u), v(v), property(property), committed(false) { } + + /// Copy a lazy_add_edge_with_property structure, which transfers + /// responsibility for adding the edge to the newly-constructed + /// object. + lazy_add_edge_with_property(const lazy_add_edge_with_property& other) + : self(other.self), u(other.u), v(other.v), property(other.property), + committed(other.committed) + { + other.committed = true; + } + + /// If the edge has not yet been added, add the edge but don't wait + /// for a reply. + ~lazy_add_edge_with_property(); + + /// Returns commit(). + operator std::pair<edge_descriptor, bool>() const { return commit(); } + + // Add the edge. This operation will block if a remote edge is + // being added. + std::pair<edge_descriptor, bool> commit() const; + +protected: + BGL_NAMED_GRAPH& self; + mutable variant<vertex_descriptor, vertex_name_type> u; + mutable variant<vertex_descriptor, vertex_name_type> v; + edge_property_type property; + mutable bool committed; + +private: + // No copy-assignment semantics + void operator=(lazy_add_edge_with_property&); +}; + +template<BGL_NAMED_GRAPH_PARAMS> +BGL_NAMED_GRAPH::lazy_add_edge_with_property::~lazy_add_edge_with_property() +{ + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + using boost::detail::parallel::make_pair_with_property; + + /// If this edge has already been created or will be created by + /// someone else, or if someone threw an exception, we will not + /// create the edge now. + if (committed || std::uncaught_exception()) + return; + + committed = true; + + if (vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) { + // We haven't resolved the target vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the target + // of the edge. If the owner of the target does not happen to own + // the source, it will resolve the target to a vertex descriptor + // and pass the message along to the owner of the source. + if (vertex_name_type* u_name = boost::get<vertex_name_type>(&u)) + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_name_name_with_property, + make_pair_with_property(*u_name, *v_name, property)); + else + send(self.process_group(), self.distribution_(*v_name), + BGL_NAMED_GRAPH::msg_add_edge_vertex_name_with_property, + make_pair_with_property(boost::get<vertex_descriptor>(u), *v_name, + property)); + } else { + if (vertex_name_type* u_name = boost::get<vertex_name_type>(&u)) + // We haven't resolved the source vertex to a descriptor yet, so + // it must not be local. Send a message to the owner of the + // source vertex requesting the edge addition. + send(self.process_group(), self.distribution_(*u_name), + BGL_NAMED_GRAPH::msg_add_edge_name_vertex_with_property, + make_pair_with_property(*u_name, boost::get<vertex_descriptor>(v), + property)); + else + // We have descriptors for both of the vertices, either of which + // may be remote or local. Tell the owner of the source vertex + // to add the edge (it may be us!). + add_edge(boost::get<vertex_descriptor>(u), + boost::get<vertex_descriptor>(v), + property, + self.derived()); + } +} + +template<BGL_NAMED_GRAPH_PARAMS> +std::pair<typename graph_traits<Graph>::edge_descriptor, bool> +BGL_NAMED_GRAPH::lazy_add_edge_with_property::commit() const +{ + using boost::detail::parallel::make_pair_with_property; + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + assert(!committed); + committed = true; + + /// The result we will return, if we are sending a message to + /// request that someone else add the edge. + boost::parallel::detail::untracked_pair<edge_descriptor, bool> result; + + /// The owner of the vertex "u" + process_id_type u_owner; + + process_id_type rank = process_id(self.process_group()); + if (const vertex_name_type* u_name = boost::get<vertex_name_type>(&u)) { + /// We haven't resolved the source vertex to a descriptor yet, so + /// it must not be local. + u_owner = self.named_distribution()(*u_name); + + /// Send a message to the remote vertex requesting that it add the + /// edge. The message differs depending on whether we have a + /// vertex name or a vertex descriptor for the target. + if (const vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_name_with_reply_and_property, + make_pair_with_property(*u_name, *v_name, property), + result); + else + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_name_vertex_with_reply_and_property, + make_pair_with_property(*u_name, + boost::get<vertex_descriptor>(v), + property), + result); + } else { + /// We have resolved the source vertex to a descriptor, which may + /// either be local or remote. + u_owner + = get(vertex_owner, self.derived(), + boost::get<vertex_descriptor>(u)); + if (u_owner == rank) { + /// The source is local. If we need to, resolve the target vertex. + if (const vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) + v = add_vertex(*v_name, self.derived()); + + /// Add the edge using vertex descriptors + return add_edge(boost::get<vertex_descriptor>(u), + boost::get<vertex_descriptor>(v), + property, + self.derived()); + } else { + /// The source is remote. Just send a message to its owner + /// requesting that the owner add the new edge, either directly + /// or via the derived class's add_edge function. + if (const vertex_name_type* v_name = boost::get<vertex_name_type>(&v)) + send_oob_with_reply + (self.process_group(), u_owner, + BGL_NAMED_GRAPH::msg_add_edge_vertex_name_with_reply_and_property, + make_pair_with_property(boost::get<vertex_descriptor>(u), *v_name, + property), + result); + else + return add_edge(boost::get<vertex_descriptor>(u), + boost::get<vertex_descriptor>(v), + property, + self.derived()); + } + } + + // If we get here, the edge has been added remotely and "result" + // contains the result of that edge addition. + return result; +} + +/// Construct the named_graph with a particular process group +template<BGL_NAMED_GRAPH_PARAMS> +BGL_NAMED_GRAPH::named_graph(const process_group_type& pg) + : process_group_(pg, parallel::attach_distributed_object()), + distribution_(pg) +{ + setup_triggers(); +} + +/// Construct the named_graph mixin with a particular process group +/// and distribution function +template<BGL_NAMED_GRAPH_PARAMS> +BGL_NAMED_GRAPH::named_graph(const process_group_type& pg, + const base_distribution_type& distribution) + : process_group_(pg, parallel::attach_distributed_object()), + distribution_(pg, distribution) +{ + setup_triggers(); +} + +template<BGL_NAMED_GRAPH_PARAMS> +void +BGL_NAMED_GRAPH::setup_triggers() +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(process_group_, msg_add_vertex_name, this, + &named_graph::handle_add_vertex_name); + simple_trigger(process_group_, msg_add_vertex_name_with_reply, this, + &named_graph::handle_add_vertex_name_with_reply); + simple_trigger(process_group_, msg_find_vertex, this, + &named_graph::handle_find_vertex); + simple_trigger(process_group_, msg_add_edge_name_name, this, + &named_graph::template handle_add_edge<vertex_name_type, + vertex_name_type>); + simple_trigger(process_group_, msg_add_edge_name_name_with_reply, this, + &named_graph::template handle_add_edge_with_reply + <vertex_name_type, vertex_name_type>); + simple_trigger(process_group_, msg_add_edge_name_vertex, this, + &named_graph::template handle_add_edge<vertex_name_type, + vertex_descriptor>); + simple_trigger(process_group_, msg_add_edge_name_vertex_with_reply, this, + &named_graph::template handle_add_edge_with_reply + <vertex_name_type, vertex_descriptor>); + simple_trigger(process_group_, msg_add_edge_vertex_name, this, + &named_graph::template handle_add_edge<vertex_descriptor, + vertex_name_type>); + simple_trigger(process_group_, msg_add_edge_vertex_name_with_reply, this, + &named_graph::template handle_add_edge_with_reply + <vertex_descriptor, vertex_name_type>); + simple_trigger(process_group_, msg_add_edge_name_name_with_property, this, + &named_graph:: + template handle_add_edge_with_property<vertex_name_type, + vertex_name_type>); + simple_trigger(process_group_, + msg_add_edge_name_name_with_reply_and_property, this, + &named_graph::template handle_add_edge_with_reply_and_property + <vertex_name_type, vertex_name_type>); + simple_trigger(process_group_, msg_add_edge_name_vertex_with_property, this, + &named_graph:: + template handle_add_edge_with_property<vertex_name_type, + vertex_descriptor>); + simple_trigger(process_group_, + msg_add_edge_name_vertex_with_reply_and_property, this, + &named_graph::template handle_add_edge_with_reply_and_property + <vertex_name_type, vertex_descriptor>); + simple_trigger(process_group_, msg_add_edge_vertex_name_with_property, this, + &named_graph:: + template handle_add_edge_with_property<vertex_descriptor, + vertex_name_type>); + simple_trigger(process_group_, + msg_add_edge_vertex_name_with_reply_and_property, this, + &named_graph::template handle_add_edge_with_reply_and_property + <vertex_descriptor, vertex_name_type>); +} + +/// Retrieve the vertex associated with the given name +template<BGL_NAMED_GRAPH_PARAMS> +optional<Vertex> +find_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, + const BGL_NAMED_GRAPH& g) +{ + typedef typename Graph::local_vertex_descriptor local_vertex_descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + // Determine the owner of this name + typename BGL_NAMED_GRAPH::process_id_type owner + = g.named_distribution()(name); + + if (owner == process_id(g.process_group())) { + // The vertex is local, so search for a mapping here + optional<local_vertex_descriptor> result + = find_vertex(name, g.derived().base()); + if (result) + return Vertex(owner, *result); + else + return optional<Vertex>(); + } + else { + // Ask the ownering process for the name of this vertex + boost::parallel::detail::untracked_pair<vertex_descriptor, bool> result; + send_oob_with_reply(g.process_group(), owner, + BGL_NAMED_GRAPH::msg_find_vertex, name, result); + if (result.second) + return result.first; + else + return optional<Vertex>(); + } +} + +/// meta-function helping in figuring out if the given VertextProerty belongs to +/// a named graph +template<typename VertexProperty> +struct not_is_named_graph + : is_same<typename internal_vertex_name<VertexProperty>::type, void> +{}; + +/// Retrieve the vertex associated with the given name +template<typename Graph> +typename Graph::named_graph_type::lazy_add_vertex +add_vertex(typename Graph::vertex_name_type const& name, + Graph& g, + typename disable_if< + not_is_named_graph<typename Graph::vertex_property_type>, + void*>::type = 0) +{ + return typename Graph::named_graph_type::lazy_add_vertex(g, name); +} + +/// Add an edge using vertex names to refer to the vertices +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::lazy_add_edge +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + BGL_NAMED_GRAPH& g) +{ + typedef typename BGL_NAMED_GRAPH::lazy_add_edge lazy_add_edge; + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + process_id_type rank = process_id(g.process_group()); + process_id_type u_owner = g.named_distribution()(u_name); + process_id_type v_owner = g.named_distribution()(v_name); + + // Resolve local vertex names before building the "lazy" edge + // addition structure. + if (u_owner == rank && v_owner == rank) + return lazy_add_edge(g, add_vertex(u_name, g), add_vertex(v_name, g)); + else if (u_owner == rank && v_owner != rank) + return lazy_add_edge(g, add_vertex(u_name, g), v_name); + else if (u_owner != rank && v_owner == rank) + return lazy_add_edge(g, u_name, add_vertex(v_name, g)); + else + return lazy_add_edge(g, u_name, v_name); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::lazy_add_edge +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_descriptor const& v, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge lazy_add_edge; + if (g.named_distribution()(u_name) == process_id(g.process_group())) + return lazy_add_edge(g, add_vertex(u_name, g), v); + else + return lazy_add_edge(g, u_name, v); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::lazy_add_edge +add_edge(typename BGL_NAMED_GRAPH::vertex_descriptor const& u, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge lazy_add_edge; + if (g.named_distribution()(v_name) == process_id(g.process_group())) + return lazy_add_edge(g, u, add_vertex(v_name, g)); + else + return lazy_add_edge(g, u, v_name); +} + +/// Add an edge using vertex names to refer to the vertices +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::lazy_add_edge_with_property +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + typename Graph::edge_property_type const& property, + BGL_NAMED_GRAPH& g) +{ + typedef typename BGL_NAMED_GRAPH::lazy_add_edge_with_property lazy_add_edge; + typedef typename BGL_NAMED_GRAPH::process_id_type process_id_type; + + process_id_type rank = process_id(g.process_group()); + process_id_type u_owner = g.named_distribution()(u_name); + process_id_type v_owner = g.named_distribution()(v_name); + + // Resolve local vertex names before building the "lazy" edge + // addition structure. + if (u_owner == rank && v_owner == rank) + return lazy_add_edge(g, add_vertex(u_name, g), add_vertex(v_name, g), + property); + else if (u_owner == rank && v_owner != rank) + return lazy_add_edge(g, add_vertex(u_name, g), v_name, property); + else if (u_owner != rank && v_owner == rank) + return lazy_add_edge(g, u_name, add_vertex(v_name, g), property); + else + return lazy_add_edge(g, u_name, v_name, property); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::lazy_add_edge_with_property +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_descriptor const& v, + typename Graph::edge_property_type const& property, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge_with_property lazy_add_edge; + if (g.named_distribution()(u_name) == process_id(g.process_group())) + return lazy_add_edge(g, add_vertex(u_name, g), v, property); + else + return lazy_add_edge(g, u_name, v, property); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::lazy_add_edge_with_property +add_edge(typename BGL_NAMED_GRAPH::vertex_descriptor const& u, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + typename Graph::edge_property_type const& property, + BGL_NAMED_GRAPH& g) +{ + // Resolve local vertex names before building the "lazy" edge + // addition structure. + typedef typename BGL_NAMED_GRAPH::lazy_add_edge_with_property lazy_add_edge; + if (g.named_distribution()(v_name) == process_id(g.process_group())) + return lazy_add_edge(g, u, add_vertex(v_name, g), property); + else + return lazy_add_edge(g, u, v_name, property); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::process_id_type +BGL_NAMED_GRAPH::owner_by_property(const vertex_property_type& property) +{ + return distribution_(derived().base().extract_name(property)); +} + + +/******************************************************************* + * Message handlers * + *******************************************************************/ + +template<BGL_NAMED_GRAPH_PARAMS> +void +BGL_NAMED_GRAPH:: +handle_add_vertex_name(int /*source*/, int /*tag*/, + const vertex_name_type& msg, trigger_receive_context) +{ + add_vertex(msg, derived()); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::vertex_descriptor +BGL_NAMED_GRAPH:: +handle_add_vertex_name_with_reply(int source, int /*tag*/, + const vertex_name_type& msg, + trigger_receive_context) +{ + return add_vertex(msg, derived()); +} + +template<BGL_NAMED_GRAPH_PARAMS> +boost::parallel::detail::untracked_pair<typename BGL_NAMED_GRAPH::vertex_descriptor, bool> +BGL_NAMED_GRAPH:: +handle_find_vertex(int source, int /*tag*/, const vertex_name_type& msg, + trigger_receive_context) +{ + using boost::parallel::detail::make_untracked_pair; + + optional<vertex_descriptor> v = find_vertex(msg, derived()); + if (v) + return make_untracked_pair(*v, true); + else + return make_untracked_pair(graph_traits<Graph>::null_vertex(), false); +} + +template<BGL_NAMED_GRAPH_PARAMS> +template<typename U, typename V> +void +BGL_NAMED_GRAPH:: +handle_add_edge(int source, int /*tag*/, const boost::parallel::detail::untracked_pair<U, V>& msg, + trigger_receive_context) +{ + add_edge(msg.first, msg.second, derived()); +} + +template<BGL_NAMED_GRAPH_PARAMS> +template<typename U, typename V> +boost::parallel::detail::untracked_pair<typename BGL_NAMED_GRAPH::edge_descriptor, bool> +BGL_NAMED_GRAPH:: +handle_add_edge_with_reply(int source, int /*tag*/, const boost::parallel::detail::untracked_pair<U, V>& msg, + trigger_receive_context) +{ + std::pair<typename BGL_NAMED_GRAPH::edge_descriptor, bool> p = + add_edge(msg.first, msg.second, derived()); + return p; +} + +template<BGL_NAMED_GRAPH_PARAMS> +template<typename U, typename V> +void +BGL_NAMED_GRAPH:: +handle_add_edge_with_property + (int source, int tag, + const pair_with_property<U, V, edge_property_type>& msg, + trigger_receive_context) +{ + add_edge(msg.first, msg.second, msg.get_property(), derived()); +} + +template<BGL_NAMED_GRAPH_PARAMS> +template<typename U, typename V> +boost::parallel::detail::untracked_pair<typename BGL_NAMED_GRAPH::edge_descriptor, bool> +BGL_NAMED_GRAPH:: +handle_add_edge_with_reply_and_property + (int source, int tag, + const pair_with_property<U, V, edge_property_type>& msg, + trigger_receive_context) +{ + std:: pair<typename BGL_NAMED_GRAPH::edge_descriptor, bool> p = + add_edge(msg.first, msg.second, msg.get_property(), derived()); + return p; +} + +#undef BGL_NAMED_GRAPH +#undef BGL_NAMED_GRAPH_PARAMS + +/******************************************************************* + * Maybe named graph mixin * + *******************************************************************/ + +/** + * A graph mixin that can provide a mapping from names to vertices, + * and use that mapping to simplify creation and manipulation of + * graphs. + */ +template<typename Graph, typename Vertex, typename Edge, typename Config, + typename ExtractName + = typename internal_vertex_name<typename Config::vertex_property_type>::type> +struct maybe_named_graph + : public named_graph<Graph, Vertex, Edge, Config> +{ +private: + typedef named_graph<Graph, Vertex, Edge, Config> inherited; + typedef typename Config::process_group_type process_group_type; + +public: + /// The type used to distribute named vertices in the graph + typedef typename Config::distribution_type distribution_type; + typedef typename Config::base_distribution_type base_distribution_type; + + explicit maybe_named_graph(const process_group_type& pg) : inherited(pg) { } + + maybe_named_graph(const process_group_type& pg, + const base_distribution_type& distribution) + : inherited(pg, distribution) { } + + distribution_type& distribution() { return this->distribution_; } + const distribution_type& distribution() const { return this->distribution_; } +}; + +/** + * A graph mixin that can provide a mapping from names to vertices, + * and use that mapping to simplify creation and manipulation of + * graphs. This partial specialization turns off this functionality + * when the @c VertexProperty does not have an internal vertex name. + */ +template<typename Graph, typename Vertex, typename Edge, typename Config> +struct maybe_named_graph<Graph, Vertex, Edge, Config, void> +{ +private: + typedef typename Config::process_group_type process_group_type; + typedef typename Config::vertex_property_type vertex_property_type; + +public: + typedef typename process_group_type::process_id_type process_id_type; + + /// The type used to distribute named vertices in the graph + typedef typename Config::distribution_type distribution_type; + typedef typename Config::base_distribution_type base_distribution_type; + + explicit maybe_named_graph(const process_group_type&) { } + + maybe_named_graph(const process_group_type& pg, + const base_distribution_type& distribution) + : distribution_(pg, distribution) { } + + /// Notify the named_graph that we have added the given vertex. This + /// is a no-op. + void added_vertex(Vertex) { } + + /// Notify the named_graph that we are removing the given + /// vertex. This is a no-op. + void removing_vertex(Vertex) { } + + /// Notify the named_graph that we are clearing the graph + void clearing_graph() { } + + /// Retrieve the owner of a given vertex based on the properties + /// associated with that vertex. This operation just returns the + /// number of the local processor, adding all vertices locally. + process_id_type owner_by_property(const vertex_property_type&) + { + return process_id(pg); + } + + distribution_type& distribution() { return distribution_; } + const distribution_type& distribution() const { return distribution_; } + +protected: + /// The process group of the graph + process_group_type pg; + + /// The distribution used for the graph + distribution_type distribution_; +}; + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_NAMED_GRAPH_HPP diff --git a/Utilities/BGL/boost/graph/distributed/page_rank.hpp b/Utilities/BGL/boost/graph/distributed/page_rank.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9807dffdfe7da344c2890b6f18a390b6f63c65fc --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/page_rank.hpp @@ -0,0 +1,225 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. +// Copyright (C) 2002 Brad King and Douglas Gregor + +// 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 +// Andrew Lumsdaine +// Brian Barrett +#ifndef BOOST_PARALLEL_GRAPH_PAGE_RANK_HPP +#define BOOST_PARALLEL_GRAPH_PAGE_RANK_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/overloading.hpp> +#include <boost/graph/page_rank.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/property_map/parallel/caching_property_map.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/graph/parallel/container_traits.hpp> + +// #define WANT_MPI_ONESIDED 1 + +namespace boost { namespace graph { namespace distributed { + +namespace detail { +#ifdef WANT_MPI_ONESIDED + template<typename Graph, typename RankMap, typename owner_map_t> + void page_rank_step(const Graph& g, RankMap from_rank, MPI_Win to_win, + typename property_traits<RankMap>::value_type damping, + owner_map_t owner) + { + typedef typename property_traits<RankMap>::value_type rank_type; + int me, ret; + MPI_Comm_rank(MPI_COMM_WORLD, &me); + + // MPI_Accumulate is not required to store the value of the data + // being sent, only the address. The value of the memory location + // must not change until the end of the access epoch, meaning the + // call to MPI_Fence. We therefore store the updated value back + // into the from_rank map before the accumulate rather than using + // a temporary. We're going to reset the values in the from_rank + // before the end of page_rank_step() anyway, so this isn't a huge + // deal. But MPI-2 One-sided is an abomination. + BGL_FORALL_VERTICES_T(u, g, Graph) { + put(from_rank, u, (damping * get(from_rank, u) / out_degree(u, g))); + BGL_FORALL_ADJ_T(u, v, g, Graph) { + ret = MPI_Accumulate(&(from_rank[u]), + 1, MPI_DOUBLE, + get(owner, v), local(v), + 1, MPI_DOUBLE, MPI_SUM, to_win); + assert(MPI_SUCCESS == ret); + } + } + MPI_Win_fence(0, to_win); + + // Set new rank maps for the other map. Do this now to get around + // the stupid synchronization rules of MPI-2 One-sided + BGL_FORALL_VERTICES_T(v, g, Graph) put(from_rank, v, rank_type(1 - damping)); + } +#endif + + template<typename T> + struct rank_accumulate_reducer { + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename K> + T operator()(const K&) const { return T(0); } + + template<typename K> + T operator()(const K&, const T& x, const T& y) const { return x + y; } + }; +} // end namespace detail + +template<typename Graph, typename RankMap, typename Done, typename RankMap2> +void +page_rank_impl(const Graph& g, RankMap rank_map, Done done, + typename property_traits<RankMap>::value_type damping, + typename graph_traits<Graph>::vertices_size_type n, + RankMap2 rank_map2) +{ + typedef typename property_traits<RankMap>::value_type rank_type; + + int me; + MPI_Comm_rank(MPI_COMM_WORLD, &me); + + typedef typename property_map<Graph, vertex_owner_t> + ::const_type vertex_owner_map; + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + typedef typename boost::graph::parallel::process_group_type<Graph> + ::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + assert(me == id); + + rank_type initial_rank = rank_type(rank_type(1) / n); + BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map, v, initial_rank); + +#ifdef WANT_MPI_ONESIDED + + assert(sizeof(rank_type) == sizeof(double)); + + bool to_map_2 = true; + MPI_Win win, win2; + + MPI_Win_create(&(rank_map[*(vertices(g).first)]), + sizeof(double) * num_vertices(g), + sizeof(double), + MPI_INFO_NULL, MPI_COMM_WORLD, &win); + MPI_Win_set_name(win, "rank_map_win"); + MPI_Win_create(&(rank_map2[*(vertices(g).first)]), + sizeof(double) * num_vertices(g), + sizeof(double), + MPI_INFO_NULL, MPI_COMM_WORLD, &win2); + MPI_Win_set_name(win, "rank_map2_win"); + + // set initial rank maps for the first iteration... + BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map2, v, rank_type(1 - damping)); + + MPI_Win_fence(0, win); + MPI_Win_fence(0, win2); + + while ((to_map_2 && !done(rank_map, g)) || + (!to_map_2 && !done(rank_map2, g))) { + if (to_map_2) { + graph::distributed::detail::page_rank_step(g, rank_map, win2, damping, owner); + to_map_2 = false; + } else { + graph::distributed::detail::page_rank_step(g, rank_map2, win, damping, owner); + to_map_2 = true; + } + } + synchronize(boost::graph::parallel::process_group(g)); + + MPI_Win_free(&win); + MPI_Win_free(&win2); + +#else + // The ranks accumulate after each step. + rank_map.set_reduce(detail::rank_accumulate_reducer<rank_type>()); + rank_map2.set_reduce(detail::rank_accumulate_reducer<rank_type>()); + rank_map.set_consistency_model(boost::parallel::cm_flush | boost::parallel::cm_reset); + rank_map2.set_consistency_model(boost::parallel::cm_flush | boost::parallel::cm_reset); + + bool to_map_2 = true; + while ((to_map_2 && !done(rank_map, g)) || + (!to_map_2 && !done(rank_map2, g))) { + /** + * PageRank can implemented slightly more efficiently on a + * bidirectional graph than on an incidence graph. However, + * distributed PageRank requires that we have the rank of the + * source vertex available locally, so we force the incidence + * graph implementation, which pushes rank from source to + * target. + */ + typedef incidence_graph_tag category; + if (to_map_2) { + graph::detail::page_rank_step(g, rank_map, rank_map2, damping, + category()); + to_map_2 = false; + } else { + graph::detail::page_rank_step(g, rank_map2, rank_map, damping, + category()); + to_map_2 = true; + } + using boost::graph::parallel::process_group; + synchronize(process_group(g)); + } + + rank_map.reset(); +#endif + + if (!to_map_2) + BGL_FORALL_VERTICES_T(v, g, Graph) put(rank_map, v, get(rank_map2, v)); +} + +template<typename Graph, typename RankMap, typename Done, typename RankMap2> +void +page_rank(const Graph& g, RankMap rank_map, Done done, + typename property_traits<RankMap>::value_type damping, + typename graph_traits<Graph>::vertices_size_type n, + RankMap2 rank_map2 + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) +{ + (page_rank_impl)(g, rank_map, done, damping, n, rank_map2); +} + +template<typename MutableGraph> +void +remove_dangling_links(MutableGraph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(MutableGraph, + distributed_graph_tag)) +{ + typename graph_traits<MutableGraph>::vertices_size_type old_n; + do { + old_n = num_vertices(g); + + typename graph_traits<MutableGraph>::vertex_iterator vi, vi_end; + for (tie(vi, vi_end) = vertices(g); vi != vi_end; /* in loop */) { + typename graph_traits<MutableGraph>::vertex_descriptor v = *vi++; + if (out_degree(v, g) == 0) { + clear_vertex(v, g); + remove_vertex(v, g); + } + } + } while (num_vertices(g) < old_n); +} + +} // end namespace distributed + +using distributed::page_rank; +using distributed::remove_dangling_links; + +} } // end namespace boost::graph + +#endif // BOOST_PARALLEL_GRAPH_PAGE_RANK_HPP diff --git a/Utilities/BGL/boost/graph/distributed/queue.hpp b/Utilities/BGL/boost/graph/distributed/queue.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7e84272ab13e453fa40a4679c7a9429733e09ea4 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/queue.hpp @@ -0,0 +1,278 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP +#define BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/parallel/process_group.hpp> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <vector> + +namespace boost { namespace graph { namespace distributed { + +/// A unary predicate that always returns "true". +struct always_push +{ + template<typename T> bool operator()(const T&) const { return true; } +}; + + + +/** A distributed queue adaptor. + * + * Class template @c distributed_queue implements a distributed queue + * across a process group. The distributed queue is an adaptor over an + * existing (local) queue, which must model the @ref Buffer + * concept. Each process stores a distinct copy of the local queue, + * from which it draws or removes elements via the @ref pop and @ref + * top members. + * + * The value type of the local queue must be a model of the @ref + * GlobalDescriptor concept. The @ref push operation of the + * distributed queue passes (via a message) the value to its owning + * processor. Thus, the elements within a particular local queue are + * guaranteed to have the process owning that local queue as an owner. + * + * Synchronization of distributed queues occurs in the @ref empty and + * @ref size functions, which will only return "empty" values (true or + * 0, respectively) when the entire distributed queue is empty. If the + * local queue is empty but the distributed queue is not, the + * operation will block until either condition changes. When the @ref + * size function of a nonempty queue returns, it returns the size of + * the local queue. These semantics were selected so that sequential + * code that processes elements in the queue via the following idiom + * can be parallelized via introduction of a distributed queue: + * + * distributed_queue<...> Q; + * Q.push(x); + * while (!Q.empty()) { + * // do something, that may push a value onto Q + * } + * + * In the parallel version, the initial @ref push operation will place + * the value @c x onto its owner's queue. All processes will + * synchronize at the call to empty, and only the process owning @c x + * will be allowed to execute the loop (@ref Q.empty() returns + * false). This iteration may in turn push values onto other remote + * queues, so when that process finishes execution of the loop body + * and all processes synchronize again in @ref empty, more processes + * may have nonempty local queues to execute. Once all local queues + * are empty, @ref Q.empty() returns @c false for all processes. + * + * The distributed queue can receive messages at two different times: + * during synchronization and when polling @ref empty. Messages are + * always received during synchronization, to ensure that accurate + * local queue sizes can be determines. However, whether @ref empty + * should poll for messages is specified as an option to the + * constructor. Polling may be desired when the order in which + * elements in the queue are processed is not important, because it + * permits fewer synchronization steps and less communication + * overhead. However, when more strict ordering guarantees are + * required, polling may be semantically incorrect. By disabling + * polling, one ensures that parallel execution using the idiom above + * will not process an element at a later "level" before an earlier + * "level". + * + * The distributed queue nearly models the @ref Buffer + * concept. However, the @ref push routine does not necessarily + * increase the result of @c size() by one (although the size of the + * global queue does increase by one). + */ +template<typename ProcessGroup, typename OwnerMap, typename Buffer, + typename UnaryPredicate = always_push> +class distributed_queue +{ + typedef distributed_queue self_type; + + enum { + /** Message indicating a remote push. The message contains a + * single value x of type value_type that is to be pushed on the + * receiver's queue. + */ + msg_push, + /** Push many elements at once. */ + msg_multipush + }; + + public: + typedef ProcessGroup process_group_type; + typedef Buffer buffer_type; + typedef typename buffer_type::value_type value_type; + typedef typename buffer_type::size_type size_type; + + /** Construct a new distributed queue. + * + * Build a new distributed queue that communicates over the given @p + * process_group, whose local queue is initialized via @p buffer and + * which may or may not poll for messages. + */ + explicit + distributed_queue(const ProcessGroup& process_group, + const OwnerMap& owner, + const Buffer& buffer, + bool polling = false); + + /** Construct a new distributed queue. + * + * Build a new distributed queue that communicates over the given @p + * process_group, whose local queue is initialized via @p buffer and + * which may or may not poll for messages. + */ + explicit + distributed_queue(const ProcessGroup& process_group = ProcessGroup(), + const OwnerMap& owner = OwnerMap(), + const Buffer& buffer = Buffer(), + const UnaryPredicate& pred = UnaryPredicate(), + bool polling = false); + + /** Construct a new distributed queue. + * + * Build a new distributed queue that communicates over the given @p + * process_group, whose local queue is default-initalized and which + * may or may not poll for messages. + */ + distributed_queue(const ProcessGroup& process_group, const OwnerMap& owner, + const UnaryPredicate& pred, bool polling = false); + + /** Virtual destructor required with virtual functions. + * + */ + virtual ~distributed_queue() {} + + /** Push an element onto the distributed queue. + * + * The element will be sent to its owner process to be added to that + * process's local queue. If polling is enabled for this queue and + * the owner process is the current process, the value will be + * immediately pushed onto the local queue. + * + * Complexity: O(1) messages of size O(sizeof(value_type)) will be + * transmitted. + */ + void push(const value_type& x); + + /** Pop an element off the local queue. + * + * @p @c !empty() + */ + void pop() { buffer.pop(); } + + /** + * Return the element at the top of the local queue. + * + * @p @c !empty() + */ + value_type& top() { return buffer.top(); } + + /** + * \overload + */ + const value_type& top() const { return buffer.top(); } + + /** Determine if the queue is empty. + * + * When the local queue is nonempty, returns @c true. If the local + * queue is empty, synchronizes with all other processes in the + * process group until either (1) the local queue is nonempty + * (returns @c true) (2) the entire distributed queue is empty + * (returns @c false). + */ + bool empty() const; + + /** Determine the size of the local queue. + * + * The behavior of this routine is equivalent to the behavior of + * @ref empty, except that when @ref empty returns true this + * function returns the size of the local queue and when @ref empty + * returns false this function returns zero. + */ + size_type size() const; + + // private: + /** Synchronize the distributed queue and determine if all queues + * are empty. + * + * \returns \c true when all local queues are empty, or false if at least + * one of the local queues is nonempty. + * Defined as virtual for derived classes like depth_limited_distributed_queue. + */ + virtual bool do_synchronize() const; + + private: + // Setup triggers + void setup_triggers(); + + // Message handlers + void + handle_push(int source, int tag, const value_type& value, + trigger_receive_context); + + void + handle_multipush(int source, int tag, const std::vector<value_type>& values, + trigger_receive_context); + + mutable ProcessGroup process_group; + OwnerMap owner; + mutable Buffer buffer; + UnaryPredicate pred; + bool polling; + + typedef std::vector<value_type> outgoing_buffer_t; + typedef std::vector<outgoing_buffer_t> outgoing_buffers_t; + shared_ptr<outgoing_buffers_t> outgoing_buffers; +}; + +/// Helper macro containing the normal names for the template +/// parameters to distributed_queue. +#define BOOST_DISTRIBUTED_QUEUE_PARMS \ + typename ProcessGroup, typename OwnerMap, typename Buffer, \ + typename UnaryPredicate + +/// Helper macro containing the normal template-id for +/// distributed_queue. +#define BOOST_DISTRIBUTED_QUEUE_TYPE \ + distributed_queue<ProcessGroup, OwnerMap, Buffer, UnaryPredicate> + +/** Synchronize all processes involved with the given distributed queue. + * + * This function will synchronize all of the local queues for a given + * distributed queue, by ensuring that no additional messages are in + * transit. It is rarely required by the user, because most + * synchronization of distributed queues occurs via the @c empty or @c + * size methods. + */ +template<BOOST_DISTRIBUTED_QUEUE_PARMS> +inline void +synchronize(const BOOST_DISTRIBUTED_QUEUE_TYPE& Q) +{ Q.do_synchronize(); } + +/// Construct a new distributed queue. +template<typename ProcessGroup, typename OwnerMap, typename Buffer> +inline distributed_queue<ProcessGroup, OwnerMap, Buffer> +make_distributed_queue(const ProcessGroup& process_group, + const OwnerMap& owner, + const Buffer& buffer, + bool polling = false) +{ + typedef distributed_queue<ProcessGroup, OwnerMap, Buffer> result_type; + return result_type(process_group, owner, buffer, polling); +} + +} } } // end namespace boost::graph::distributed + +#include <boost/graph/distributed/detail/queue.ipp> + +#undef BOOST_DISTRIBUTED_QUEUE_TYPE +#undef BOOST_DISTRIBUTED_QUEUE_PARMS + +#endif // BOOST_GRAPH_DISTRIBUTED_QUEUE_HPP diff --git a/Utilities/BGL/boost/graph/distributed/reverse_graph.hpp b/Utilities/BGL/boost/graph/distributed/reverse_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..615aab8b91ed1218f82267fdf5e8a9c598c006d5 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/reverse_graph.hpp @@ -0,0 +1,38 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP +#define BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/reverse_graph.hpp> +#include <boost/graph/parallel/container_traits.hpp> + +namespace boost { + namespace graph { + namespace parallel { + /// Retrieve the process group from a reverse graph + template<typename Graph, typename GraphRef> + struct process_group_type<reverse_graph<Graph, GraphRef> > + : process_group_type<Graph> { }; + } + + } + + /// Retrieve the process group from a reverse graph + template<typename Graph, typename GraphRef> + inline typename graph::parallel::process_group_type<Graph>::type + process_group(reverse_graph<Graph, GraphRef> const& g) { + return process_group(g.m_g); + } +} // namespace boost + +#endif diff --git a/Utilities/BGL/boost/graph/distributed/rmat_graph_generator.hpp b/Utilities/BGL/boost/graph/distributed/rmat_graph_generator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b033e9b9041ad41becbea7ddc26ed505d2781f20 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/rmat_graph_generator.hpp @@ -0,0 +1,162 @@ +// Copyright 2004, 2005 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP +#define BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/graph/parallel/process_group.hpp> + +namespace boost { + + // Memory-scalable (amount of memory required will scale down + // linearly as the number of processes increases) generator, which + // requires an MPI process group. Run-time is slightly worse than + // the unique rmat generator. Edge list generated is sorted and + // unique. + template<typename ProcessGroup, typename Distribution, + typename RandomGenerator, typename Graph> + class scalable_rmat_iterator + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + // No argument constructor, set to terminating condition + scalable_rmat_iterator() + : gen(), done(true) + { } + + // Initialize for edge generation + scalable_rmat_iterator(ProcessGroup pg, Distribution distrib, + RandomGenerator& gen, vertices_size_type n, + edges_size_type m, double a, double b, double c, + double d, bool permute_vertices = true) + : gen(), done(false) + { + assert(a + b + c + d == 1); + int id = process_id(pg); + + this->gen.reset(new uniform_01<RandomGenerator>(gen)); + + std::vector<vertices_size_type> vertexPermutation; + if (permute_vertices) + generate_permutation_vector(gen, vertexPermutation, n); + + int SCALE = int(floor(log2(n))); + boost::uniform_01<RandomGenerator> prob(gen); + + std::map<value_type, bool> edge_map; + + edges_size_type generated = 0, local_edges = 0; + do { + edges_size_type tossed = 0; + do { + vertices_size_type u, v; + tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); + + if (permute_vertices) { + u = vertexPermutation[u]; + v = vertexPermutation[v]; + } + + // Lowest vertex number always comes first (this + // means we don't have to worry about i->j and j->i + // being in the edge list) + if (u > v && is_same<directed_category, undirected_tag>::value) + std::swap(u, v); + + if (distrib(u) == id || distrib(v) == id) { + if (edge_map.find(std::make_pair(u, v)) == edge_map.end()) { + edge_map[std::make_pair(u, v)] = true; + local_edges++; + } else { + tossed++; + + // special case - if both u and v are on same + // proc, ++ twice, since we divide by two (to + // cover the two process case) + if (distrib(u) == id && distrib(v) == id) + tossed++; + } + } + generated++; + + } while (generated < m); + tossed = all_reduce(pg, tossed, boost::parallel::sum<vertices_size_type>()); + generated -= (tossed / 2); + } while (generated < m); + // NGE - Asking for more than n^2 edges will result in an infinite loop here + // Asking for a value too close to n^2 edges may as well + + values.reserve(local_edges); + typename std::map<value_type, bool>::reverse_iterator em_end = edge_map.rend(); + for (typename std::map<value_type, bool>::reverse_iterator em_i = edge_map.rbegin(); + em_i != em_end ; + ++em_i) { + values.push_back(em_i->first); + } + + current = values.back(); + values.pop_back(); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + scalable_rmat_iterator& operator++() + { + if (!values.empty()) { + current = values.back(); + values.pop_back(); + } else + done = true; + + return *this; + } + + scalable_rmat_iterator operator++(int) + { + scalable_rmat_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const scalable_rmat_iterator& other) const + { + return values.empty() && other.values.empty() && done && other.done; + } + + bool operator!=(const scalable_rmat_iterator& other) const + { return !(*this == other); } + + private: + + // Parameters + shared_ptr<uniform_01<RandomGenerator> > gen; + + // Internal data structures + std::vector<value_type> values; + value_type current; + bool done; + }; + +} // end namespace boost + +#endif // BOOST_GRAPH_DISTRIBUTED_RMAT_GENERATOR_HPP diff --git a/Utilities/BGL/boost/graph/distributed/selector.hpp b/Utilities/BGL/boost/graph/distributed/selector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2e26c1690136b5a5206ad540420102c6e149d284 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/selector.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP +#define BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +namespace boost { + + /* The default local selector for a distributedS selector. */ + struct defaultS {}; + + /** + * Selector that specifies that the graph should be distributed + * among different processes organized based on the given process + * group. + */ + template<typename ProcessGroup, typename LocalS = defaultS, + typename DistributionS = defaultS> + struct distributedS + { + typedef ProcessGroup process_group_type; + typedef LocalS local_selector; + typedef DistributionS distribution; + }; +} + +#endif // BOOST_GRAPH_DISTRIBUTED_SELECTOR_HPP diff --git a/Utilities/BGL/boost/graph/distributed/shuffled_distribution.hpp b/Utilities/BGL/boost/graph/distributed/shuffled_distribution.hpp new file mode 100644 index 0000000000000000000000000000000000000000..92bc0397f216dc4a832497b1d3af9af128c06f5f --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/shuffled_distribution.hpp @@ -0,0 +1,113 @@ +// Copyright Daniel Wallin 2007. 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) + +#ifndef BOOST_SHUFFLED_DISTRIBUTION_070923_HPP +#define BOOST_SHUFFLED_DISTRIBUTION_070923_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +# include <boost/iterator/counting_iterator.hpp> +# include <vector> + +namespace boost { namespace graph { namespace distributed { + +template <class BaseDistribution> +struct shuffled_distribution : BaseDistribution +{ + typedef std::size_t size_type; + + template <class ProcessGroup> + shuffled_distribution(ProcessGroup const& pg, BaseDistribution const& base) + : BaseDistribution(base) + , n(num_processes(pg)) + , mapping_(make_counting_iterator(size_type(0)), make_counting_iterator(n)) + , reverse_mapping(mapping_) + {} + + std::vector<size_type> const& mapping() const + { + return mapping_; + } + + template <class InputIterator> + void assign_mapping(InputIterator first, InputIterator last) + { + mapping_.assign(first, last); + assert(mapping_.size() == n); + reverse_mapping.resize(mapping_.size()); + + for (std::vector<size_t>::iterator i(mapping_.begin()); + i != mapping_.end(); ++i) + { + reverse_mapping[*i] = i - mapping_.begin(); + } + } + + BaseDistribution& base() + { + return *this; + } + + BaseDistribution const& base() const + { + return *this; + } + + template <class ProcessID> + size_type block_size(ProcessID id, size_type n) const + { + return base().block_size(reverse_mapping[id], n); + } + + template <class T> + size_type operator()(T const& value) const + { + return mapping_[base()(value)]; + } + + template <class ProcessID> + size_type start(ProcessID id) const + { + return base().start(reverse_mapping[id]); + } + + size_type local(size_type i) const + { + return base().local(i); + } + + size_type global(size_type i) const + { + return base().global(i); + } + + template <class ProcessID> + size_type global(ProcessID id, size_type n) const + { + return base().global(reverse_mapping[id], n); + } + + template <class Archive> + void serialize(Archive& ar, unsigned long /*version*/) + { + ar & serialization::make_nvp("base", base()); + } + + void clear() + { + base().clear(); + } + +private: + size_type n; + std::vector<size_type> mapping_; + std::vector<size_type> reverse_mapping; +}; + +}}} // namespace boost::graph::distributed + +#endif // BOOST_SHUFFLED_DISTRIBUTION_070923_HPP + diff --git a/Utilities/BGL/boost/graph/distributed/st_connected.hpp b/Utilities/BGL/boost/graph/distributed/st_connected.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b007442615d71d87079f8c8351532081476e6988 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/st_connected.hpp @@ -0,0 +1,186 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP +#define BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/two_bit_color_map.hpp> +#include <boost/graph/distributed/queue.hpp> +#include <boost/pending/queue.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <utility> +#include <boost/optional.hpp> + +namespace boost { namespace graph { namespace distributed { + +namespace detail { + struct pair_and_or + { + std::pair<bool, bool> + operator()(std::pair<bool, bool> x, std::pair<bool, bool> y) const + { + return std::pair<bool, bool>(x.first && y.first, + x.second || y.second); + } + }; + +} // end namespace detail + +template<typename DistributedGraph, typename ColorMap, typename OwnerMap> +bool +st_connected(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + typename graph_traits<DistributedGraph>::vertex_descriptor t, + ColorMap color, OwnerMap owner) +{ + using boost::graph::parallel::process_group; + using boost::graph::parallel::process_group_type; + using boost::parallel::all_reduce; + + typedef typename property_traits<ColorMap>::value_type Color; + typedef color_traits<Color> ColorTraits; + typedef typename process_group_type<DistributedGraph>::type ProcessGroup; + typedef typename ProcessGroup::process_id_type ProcessID; + typedef typename graph_traits<DistributedGraph>::vertex_descriptor Vertex; + + // Set all vertices to white (unvisited) + BGL_FORALL_VERTICES_T(v, g, DistributedGraph) + put(color, v, ColorTraits::white()); + + // "color" plays the role of a color map, with no synchronization. + set_property_map_role(vertex_color, color); + color.set_consistency_model(0); + + // Vertices found from the source are grey + put(color, s, ColorTraits::gray()); + + // Vertices found from the target are green + put(color, t, ColorTraits::green()); + + ProcessGroup pg = process_group(g); + ProcessID rank = process_id(pg); + + // Build a local queue + queue<Vertex> Q; + if (get(owner, s) == rank) Q.push(s); + if (get(owner, t) == rank) Q.push(t); + + queue<Vertex> other_Q; + + while (true) { + bool found = false; + + // Process all vertices in the local queue + while (!found && !Q.empty()) { + Vertex u = Q.top(); Q.pop(); + Color u_color = get(color, u); + + BGL_FORALL_OUTEDGES_T(u, e, g, DistributedGraph) { + Vertex v = target(e, g); + Color v_color = get(color, v); + if (v_color == ColorTraits::white()) { + // We have not seen "v" before; mark it with the same color as u + Color u_color = get(color, u); + put(color, v, u_color); + + // Either push v into the local queue or send it off to its + // owner. + ProcessID v_owner = get(owner, v); + if (v_owner == rank) + other_Q.push(v); + else + send(pg, v_owner, 0, + std::make_pair(v, u_color == ColorTraits::gray())); + } else if (v_color != ColorTraits::black() && u_color != v_color) { + // Colors have collided. We're done! + found = true; + break; + } + } + + // u is done, so mark it black + put(color, u, ColorTraits::black()); + } + + // Ensure that all transmitted messages have been received. + synchronize(pg); + + // Move all of the send-to-self values into the local Q. + other_Q.swap(Q); + + if (!found) { + // Receive all messages + while (optional<std::pair<ProcessID, int> > msg = probe(pg)) { + std::pair<Vertex, bool> data; + receive(pg, msg->first, msg->second, data); + + // Determine the colors of u and v, the source and target + // vertices (v is local). + Vertex v = data.first; + Color v_color = get(color, v); + Color u_color = data.second? ColorTraits::gray() : ColorTraits::green(); + if (v_color == ColorTraits::white()) { + // v had no color before, so give it u's color and push it + // into the queue. + Q.push(v); + put(color, v, u_color); + } else if (v_color != ColorTraits::black() && u_color != v_color) { + // Colors have collided. We're done! + found = true; + break; + } + } + } + + // Check if either all queues are empty or + std::pair<bool, bool> results = all_reduce(pg, + boost::parallel::detail::make_untracked_pair(Q.empty(), found), + detail::pair_and_or()); + + // If someone found the answer, we're done! + if (results.second) + return true; + + // If all queues are empty, we're done. + if (results.first) + return false; + } +} + +template<typename DistributedGraph, typename ColorMap> +inline bool +st_connected(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + typename graph_traits<DistributedGraph>::vertex_descriptor t, + ColorMap color) +{ + return st_connected(g, s, t, color, get(vertex_owner, g)); +} + +template<typename DistributedGraph> +inline bool +st_connected(const DistributedGraph& g, + typename graph_traits<DistributedGraph>::vertex_descriptor s, + typename graph_traits<DistributedGraph>::vertex_descriptor t) +{ + return st_connected(g, s, t, + make_two_bit_color_map(num_vertices(g), + get(vertex_index, g))); +} + +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP diff --git a/Utilities/BGL/boost/graph/distributed/strong_components.hpp b/Utilities/BGL/boost/graph/distributed/strong_components.hpp new file mode 100644 index 0000000000000000000000000000000000000000..408cc64389df5d39dcc742f310a601d79b18a055 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/strong_components.hpp @@ -0,0 +1,985 @@ +// Copyright (C) 2004-2008 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_SCC_HPP +#define BOOST_GRAPH_DISTRIBUTED_SCC_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +// #define PBGL_SCC_DEBUG + +#include <boost/property_map/property_map.hpp> +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/property_map/parallel/caching_property_map.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/graph/distributed/queue.hpp> +#include <boost/graph/distributed/filtered_graph.hpp> +#include <boost/pending/indirect_cmp.hpp> +#include <boost/graph/breadth_first_search.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/distributed/concepts.hpp> +#include <boost/graph/distributed/local_subgraph.hpp> +#include <boost/graph/parallel/properties.hpp> +#include <boost/graph/named_function_params.hpp> +#include <boost/graph/random.hpp> +#include <boost/graph/distributed/reverse_graph.hpp> +#include <boost/optional.hpp> +#include <boost/graph/distributed/detail/filtered_queue.hpp> +#include <boost/graph/distributed/adjacency_list.hpp> +#ifdef PBGL_SCC_DEBUG + #include <iostream> + #include <cstdlib> + #include <iomanip> + #include <sys/time.h> + #include <boost/graph/distributed/graphviz.hpp> // for ostringstream +#endif +#include <vector> +#include <map> +#include <boost/graph/parallel/container_traits.hpp> + +#ifdef PBGL_SCC_DEBUG +# include <boost/graph/accounting.hpp> +#endif /* PBGL_SCC_DEBUG */ + +// If your graph is likely to have large numbers of small strongly connected +// components then running the sequential SCC algorithm on the local subgraph +// and filtering components with no remote edges may increase performance +// #define FILTER_LOCAL_COMPONENTS + +namespace boost { namespace graph { namespace distributed { namespace detail { + +template<typename vertex_descriptor> +struct v_sets{ + std::vector<vertex_descriptor> pred, succ, intersect, ps_union; +}; + +/* Serialize vertex set */ +template<typename Graph> +void +marshal_set( std::vector<std::vector<typename graph_traits<Graph>::vertex_descriptor> > in, + std::vector<typename graph_traits<Graph>::vertex_descriptor>& out ) +{ + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + for( std::size_t i = 0; i < in.size(); ++i ) { + out.insert( out.end(), graph_traits<Graph>::null_vertex() ); + out.insert( out.end(), in[i].begin(), in[i].end() ); + } +} + +/* Un-serialize vertex set */ +template<typename Graph> +void +unmarshal_set( std::vector<typename graph_traits<Graph>::vertex_descriptor> in, + std::vector<std::vector<typename graph_traits<Graph>::vertex_descriptor> >& out ) +{ + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + + while( !in.empty() ) { + typename std::vector<vertex_descriptor>::iterator end + = std::find( in.begin(), in.end(), graph_traits<Graph>::null_vertex() ); + + if( end == in.begin() ) + in.erase( in.begin() ); + else { + out.push_back(std::vector<vertex_descriptor>()); + out[out.size() - 1].insert( out[out.size() - 1].end(), in.begin(), end ); + in.erase( in.begin(), end ); + } + } +} + +/* Determine if vertex is in subset */ +template <typename Set> +struct in_subset { + in_subset() : m_s(0) { } + in_subset(const Set& s) : m_s(&s) { } + + template <typename Elt> + bool operator()(const Elt& x) const { + return ((*m_s).find(x) != (*m_s).end()); + } + +private: + const Set* m_s; +}; + +template<typename T> +struct vertex_identity_property_map + : public boost::put_get_helper<T, vertex_identity_property_map<T> > +{ + typedef T key_type; + typedef T value_type; + typedef T reference; + typedef boost::readable_property_map_tag category; + + inline value_type operator[](const key_type& v) const { return v; } + inline void clear() { } +}; + +template <typename T> +inline void synchronize( vertex_identity_property_map<T> & ) { } + +/* BFS visitor for SCC */ +template<typename Graph, typename SourceMap> +struct scc_discovery_visitor : bfs_visitor<> +{ + scc_discovery_visitor(SourceMap& sourceM) + : sourceM(sourceM) {} + + template<typename Edge> + void tree_edge(Edge e, const Graph& g) + { + put(sourceM, target(e,g), get(sourceM, source(e,g))); + } + + private: + SourceMap& sourceM; +}; + +} } } } /* End namespace boost::graph::distributed::detail */ + +namespace boost { namespace graph { namespace distributed { + enum fhp_message_tags { fhp_edges_size_msg, fhp_add_edges_msg, fhp_pred_size_msg, + fhp_pred_msg, fhp_succ_size_msg, fhp_succ_msg }; + + template<typename Graph, typename ReverseGraph, + typename VertexComponentMap, typename IsoMapFR, typename IsoMapRF, + typename VertexIndexMap> + void + fleischer_hendrickson_pinar_strong_components(const Graph& g, + VertexComponentMap c, + const ReverseGraph& gr, + IsoMapFR fr, IsoMapRF rf, + VertexIndexMap vertex_index_map) + { + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<ReverseGraph>::vertex_iterator rev_vertex_iterator; + typedef typename graph_traits<ReverseGraph>::vertex_descriptor rev_vertex_descriptor; + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef iterator_property_map<typename std::vector<vertex_descriptor>::iterator, + VertexIndexMap> ParentMap; + typedef iterator_property_map<typename std::vector<default_color_type>::iterator, + VertexIndexMap> ColorMap; + typedef iterator_property_map<typename std::vector<vertex_descriptor>::iterator, + VertexIndexMap> Rev_ParentMap; + typedef std::vector<std::pair<vertex_descriptor, vertex_descriptor> > VertexPairVec; + + typedef typename property_map<Graph, vertex_owner_t>::const_type + OwnerMap; + + OwnerMap owner = get(vertex_owner, g); + + using boost::graph::parallel::process_group; + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + int num_procs = num_processes(pg); + int n = 0; + + int my_n = num_vertices(g); + all_reduce(pg, &my_n, &my_n+1, &n, std::plus<int>()); + + // + // Initialization + // + +#ifdef PBGL_SCC_DEBUG + accounting::time_type start = accounting::get_time(); +#endif + + vertex_iterator vstart, vend; + rev_vertex_iterator rev_vstart, rev_vend; + std::vector<std::vector<vertex_descriptor> > vertex_sets, new_vertex_sets; + + vertex_sets.push_back(std::vector<vertex_descriptor>()); + + // Remove vertices that do not have at least one in edge and one out edge + new_vertex_sets.push_back(std::vector<vertex_descriptor>()); + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + if( out_degree( get(fr, *vstart), gr) > 0 && out_degree(*vstart, g) > 0 ) + new_vertex_sets[0].push_back( *vstart ); + + // Perform sequential SCC on local subgraph, filter all components with external + // edges, mark remaining components and remove them from vertex_sets +#ifdef FILTER_LOCAL_COMPONENTS + // This doesn't actually speed up SCC in connected graphs it seems, but it does work + // and may help in the case where there are lots of small strong components. + { + local_subgraph<const Graph> ls(g); + typedef typename property_map<local_subgraph<const Graph>, vertex_index_t>::type + local_index_map_type; + local_index_map_type local_index = get(vertex_index, ls); + + std::vector<int> ls_components_vec(num_vertices(ls)); + typedef iterator_property_map<std::vector<int>::iterator, local_index_map_type> + ls_components_map_type; + ls_components_map_type ls_component(ls_components_vec.begin(), local_index); + int num_comp = boost::strong_components(ls, ls_component); + + // Create map of components + std::map<int, std::vector<vertex_descriptor> > local_comp_map; + typedef typename graph_traits<local_subgraph<const Graph> >::vertex_iterator ls_vertex_iterator; + ls_vertex_iterator vstart, vend; + for( tie(vstart,vend) = vertices(ls); vstart != vend; vstart++ ) + local_comp_map[get(ls_component, *vstart)].push_back( *vstart ); + + // Filter components that have no non-local edges + typedef typename graph_traits<Graph>::adjacency_iterator adjacency_iterator; + typedef typename graph_traits<ReverseGraph>::adjacency_iterator rev_adjacency_iterator; + adjacency_iterator abegin, aend; + rev_adjacency_iterator rev_abegin, rev_aend; + for( std::size_t i = 0; i < num_comp; ++i ) { + bool local = true; + for( std::size_t j = 0; j < local_comp_map[i].size(); j++ ) { + for( tie(abegin,aend) = adjacent_vertices(local_comp_map[i][j], g); + abegin != aend; abegin++ ) + if( get(owner, *abegin) != id ) { + local = false; + break; + } + + if( local ) + for( tie(rev_abegin,rev_aend) = adjacent_vertices(get(fr, local_comp_map[i][j]), gr); + rev_abegin != rev_aend; rev_abegin++ ) + if( get(owner, *rev_abegin) != id ) { + local = false; + break; + } + + if( !local ) break; + } + + if( local ) // Mark and remove from new_vertex_sets + for( std::size_t j = 0; j < local_comp_map[i].size(); j++ ) { + put( c, local_comp_map[i][j], local_comp_map[i][0] ); + typename std::vector<vertex_descriptor>::iterator pos = + std::find(new_vertex_sets[0].begin(), new_vertex_sets[0].end(), local_comp_map[i][j]); + if( pos != new_vertex_sets[0].end() ) + new_vertex_sets[0].erase(pos); + } + } + } +#endif // FILTER_LOCAL_COMPONENTS + + all_gather( pg, new_vertex_sets[0].begin(), new_vertex_sets[0].end(), vertex_sets[0] ); + new_vertex_sets.clear(); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type end = accounting::get_time(); + if(id == 0) + std::cerr << "Trim local SCCs time = " << accounting::print_time(end - start) << " seconds.\n"; +#endif + + if( vertex_sets[0].empty() ) return; + + // + // Recursively determine SCCs + // + +#ifdef PBGL_SCC_DEBUG + int iterations = 0; +#endif + + // Only need to be able to map starting vertices for BFS from now on + fr.clear(); + + do { + +#ifdef PBGL_SCC_DEBUG + if(id == 0) { + printf("\n\nIteration %d:\n\n", iterations++); + + if( iterations > 1 ) { + end = accounting::get_time(); + std::cerr << "Running main loop destructors time = " << accounting::print_time(end - start) << " seconds.\n"; + } + + start = accounting::get_time(); + } +#endif + + // Get forward->reverse mappings for BFS start vertices + for (std::size_t i = 0; i < vertex_sets.size(); ++i) + get(fr, vertex_sets[i][0]); + synchronize(fr); + + // Determine local vertices to start BFS from + std::vector<vertex_descriptor> local_start; + for( std::size_t i = id; i < vertex_sets.size(); i += num_procs ) + local_start.push_back(vertex_sets[i][0]); + + if( local_start.empty() ) + local_start.push_back(vertex_sets[0][0]); + + + // Make filtered graphs + typedef std::set<vertex_descriptor> VertexSet; + typedef std::set<rev_vertex_descriptor> Rev_VertexSet; + + VertexSet filter_set_g; + Rev_VertexSet filter_set_gr; + typename VertexSet::iterator fs; + + int active_vertices = 0; + for (std::size_t i = 0; i < vertex_sets.size(); i++) + active_vertices += vertex_sets[i].size(); + + // This is a completely random bound + if ( active_vertices < 0.05*n ) { + // TODO: This set insertion is ridiculously inefficient, make it an in-place-merge? + for (std::size_t i = 0; i < vertex_sets.size(); i++) + filter_set_g.insert(vertex_sets[i].begin(), vertex_sets[i].end()); + + for (fs = filter_set_g.begin(); fs != filter_set_g.end(); ++fs ) + filter_set_gr.insert(get(fr, *fs)); + } + + filtered_graph<const Graph, keep_all, detail::in_subset<VertexSet> > + fg(g, keep_all(), detail::in_subset<VertexSet>(filter_set_g)); + + filtered_graph<const ReverseGraph, keep_all, detail::in_subset<VertexSet> > + fgr(gr, keep_all(), detail::in_subset<VertexSet>(filter_set_gr)); + + // Add additional starting vertices to BFS queue + typedef filtered_queue<queue<vertex_descriptor>, boost::detail::has_not_been_seen<VertexIndexMap> > + local_queue_type; + typedef boost::graph::distributed::distributed_queue<process_group_type, OwnerMap, local_queue_type> + queue_t; + + typedef typename property_map<ReverseGraph, vertex_owner_t>::const_type + RevOwnerMap; + + typedef filtered_queue<queue<rev_vertex_descriptor>, boost::detail::has_not_been_seen<VertexIndexMap> > + rev_local_queue_type; + typedef boost::graph::distributed::distributed_queue<process_group_type, RevOwnerMap, rev_local_queue_type> + rev_queue_t; + + queue_t Q(process_group(g), + owner, + make_filtered_queue(queue<vertex_descriptor>(), + boost::detail::has_not_been_seen<VertexIndexMap> + (num_vertices(g), vertex_index_map)), + false); + + rev_queue_t Qr(process_group(gr), + get(vertex_owner, gr), + make_filtered_queue(queue<rev_vertex_descriptor>(), + boost::detail::has_not_been_seen<VertexIndexMap> + (num_vertices(gr), vertex_index_map)), + false); + + for( std::size_t i = 1; i < local_start.size(); ++i ) { + Q.push(local_start[i]); + Qr.push(get(fr, local_start[i])); + } + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Initialize BFS time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + +#ifdef PBGL_SCC_DEBUG + accounting::time_type start2 = accounting::get_time(); +#endif + + // Forward BFS + std::vector<default_color_type> color_map_s(num_vertices(g)); + ColorMap color_map(color_map_s.begin(), vertex_index_map); + std::vector<vertex_descriptor> succ_map_s(num_vertices(g), graph_traits<Graph>::null_vertex()); + ParentMap succ_map(succ_map_s.begin(), vertex_index_map); + + for( std::size_t i = 0; i < vertex_sets.size(); ++i ) + put(succ_map, vertex_sets[i][0], vertex_sets[i][0]); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type end2 = accounting::get_time(); + if(id == 0) + std::cerr << " Initialize forward BFS time = " << accounting::print_time(end2 - start2) << " seconds.\n"; +#endif + + if (active_vertices < 0.05*n) + breadth_first_search(fg, local_start[0], Q, + detail::scc_discovery_visitor<filtered_graph<const Graph, keep_all, + detail::in_subset<VertexSet> >, ParentMap> + (succ_map), + color_map); + else + breadth_first_search(g, local_start[0], Q, + detail::scc_discovery_visitor<const Graph, ParentMap>(succ_map), + color_map); + +#ifdef PBGL_SCC_DEBUG + start2 = accounting::get_time(); +#endif + + // Reverse BFS + color_map.clear(); // reuse color map since g and gr have same vertex index + std::vector<vertex_descriptor> pred_map_s(num_vertices(gr), graph_traits<Graph>::null_vertex()); + Rev_ParentMap pred_map(pred_map_s.begin(), vertex_index_map); + + for( std::size_t i = 0; i < vertex_sets.size(); ++i ) + put(pred_map, get(fr, vertex_sets[i][0]), vertex_sets[i][0]); + +#ifdef PBGL_SCC_DEBUG + end2 = accounting::get_time(); + if(id == 0) + std::cerr << " Initialize reverse BFS time = " << accounting::print_time(end2 - start2) << " seconds.\n"; +#endif + + if (active_vertices < 0.05*n) + breadth_first_search(fgr, get(fr, local_start[0]), + Qr, + detail::scc_discovery_visitor<filtered_graph<const ReverseGraph, keep_all, + detail::in_subset<Rev_VertexSet> >, Rev_ParentMap> + (pred_map), + color_map); + else + breadth_first_search(gr, get(fr, local_start[0]), + Qr, + detail::scc_discovery_visitor<const ReverseGraph, Rev_ParentMap>(pred_map), + color_map); + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Perform forward and reverse BFS time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + + // Send predecessors and successors discovered by this proc to the proc responsible for + // this BFS tree + typedef struct detail::v_sets<vertex_descriptor> Vsets; + std::map<vertex_descriptor, Vsets> set_map; + + std::map<vertex_descriptor, int> dest_map; + + std::vector<VertexPairVec> successors(num_procs); + std::vector<VertexPairVec> predecessors(num_procs); + + // Calculate destinations for messages + for (std::size_t i = 0; i < vertex_sets.size(); ++i) + dest_map[vertex_sets[i][0]] = i % num_procs; + + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) { + vertex_descriptor v = get(succ_map, *vstart); + if( v != graph_traits<Graph>::null_vertex() ) + if (dest_map[v] == id) + set_map[v].succ.push_back(*vstart); + else + successors[dest_map[v]].push_back( std::make_pair(v, *vstart) ); + } + + for( tie(rev_vstart, rev_vend) = vertices(gr); rev_vstart != rev_vend; rev_vstart++ ) { + vertex_descriptor v = get(pred_map, *rev_vstart); + if( v != graph_traits<Graph>::null_vertex() ) + if (dest_map[v] == id) + set_map[v].pred.push_back(get(rf, *rev_vstart)); + else + predecessors[dest_map[v]].push_back( std::make_pair(v, get(rf, *rev_vstart)) ); + } + + // Send predecessor and successor messages + for (process_id_type i = 0; i < num_procs; ++i) { + if (!successors[i].empty()) { + send(pg, i, fhp_succ_size_msg, successors[i].size()); + send(pg, i, fhp_succ_msg, &successors[i][0], successors[i].size()); + } + if (!predecessors[i].empty()) { + send(pg, i, fhp_pred_size_msg, predecessors[i].size()); + send(pg, i, fhp_pred_msg, &predecessors[i][0], predecessors[i].size()); + } + } + synchronize(pg); + + // Receive predecessor and successor messages and handle them + while (optional<std::pair<process_id_type, int> > m = probe(pg)) { + assert(m->second == fhp_succ_size_msg || m->second == fhp_pred_size_msg); + std::size_t num_requests; + receive(pg, m->first, m->second, num_requests); + VertexPairVec requests(num_requests); + if (m->second == fhp_succ_size_msg) { + receive(pg, m->first, fhp_succ_msg, &requests[0], + num_requests); + + std::map<vertex_descriptor, int> added; + for (std::size_t i = 0; i < requests.size(); ++i) { + set_map[requests[i].first].succ.push_back(requests[i].second); + added[requests[i].first]++; + } + + // If order of vertex traversal in vertices() is std::less<vertex_descriptor>, + // then the successor sets will be in order + for (std::size_t i = 0; i < local_start.size(); ++i) + if (added[local_start[i]] > 0) + std::inplace_merge(set_map[local_start[i]].succ.begin(), + set_map[local_start[i]].succ.end() - added[local_start[i]], + set_map[local_start[i]].succ.end(), + std::less<vertex_descriptor>()); + + } else { + receive(pg, m->first, fhp_pred_msg, &requests[0], + num_requests); + + std::map<vertex_descriptor, int> added; + for (std::size_t i = 0; i < requests.size(); ++i) { + set_map[requests[i].first].pred.push_back(requests[i].second); + added[requests[i].first]++; + } + + if (boost::is_same<detail::vertex_identity_property_map<vertex_descriptor>, IsoMapRF>::value) + for (std::size_t i = 0; i < local_start.size(); ++i) + if (added[local_start[i]] > 0) + std::inplace_merge(set_map[local_start[i]].pred.begin(), + set_map[local_start[i]].pred.end() - added[local_start[i]], + set_map[local_start[i]].pred.end(), + std::less<vertex_descriptor>()); + } + } + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " All gather successors and predecessors time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + + // + // Filter predecessor and successor sets and perform set arithmetic + // + new_vertex_sets.clear(); + + if( std::size_t(id) < vertex_sets.size() ) { //If this proc has one or more unique starting points + + for( std::size_t i = 0; i < local_start.size(); ++i ) { + + vertex_descriptor v = local_start[i]; + + // Replace this sort with an in-place merges during receive step if possible + if (!boost::is_same<detail::vertex_identity_property_map<vertex_descriptor>, IsoMapRF>::value) + std::sort(set_map[v].pred.begin(), set_map[v].pred.end(), std::less<vertex_descriptor>()); + + // Limit predecessor and successor sets to members of the original set + std::vector<vertex_descriptor> temp; + + std::set_intersection( vertex_sets[id + i*num_procs].begin(), vertex_sets[id + i*num_procs].end(), + set_map[v].pred.begin(), set_map[v].pred.end(), + back_inserter(temp), + std::less<vertex_descriptor>()); + set_map[v].pred.clear(); + std::swap(set_map[v].pred, temp); + + std::set_intersection( vertex_sets[id + i*num_procs].begin(), vertex_sets[id + i*num_procs].end(), + set_map[v].succ.begin(), set_map[v].succ.end(), + back_inserter(temp), + std::less<vertex_descriptor>()); + set_map[v].succ.clear(); + std::swap(set_map[v].succ, temp); + + // Intersection(pred, succ) + std::set_intersection(set_map[v].pred.begin(), set_map[v].pred.end(), + set_map[v].succ.begin(), set_map[v].succ.end(), + back_inserter(set_map[v].intersect), + std::less<vertex_descriptor>()); + + // Union(pred, succ) + std::set_union(set_map[v].pred.begin(), set_map[v].pred.end(), + set_map[v].succ.begin(), set_map[v].succ.end(), + back_inserter(set_map[v].ps_union), + std::less<vertex_descriptor>()); + + new_vertex_sets.push_back(std::vector<vertex_descriptor>()); + // Original set - Union(pred, succ) + std::set_difference(vertex_sets[id + i*num_procs].begin(), vertex_sets[id + i*num_procs].end(), + set_map[v].ps_union.begin(), set_map[v].ps_union.end(), + back_inserter(new_vertex_sets[new_vertex_sets.size() - 1]), + std::less<vertex_descriptor>()); + + set_map[v].ps_union.clear(); + + new_vertex_sets.push_back(std::vector<vertex_descriptor>()); + // Pred - Intersect(pred, succ) + std::set_difference(set_map[v].pred.begin(), set_map[v].pred.end(), + set_map[v].intersect.begin(), set_map[v].intersect.end(), + back_inserter(new_vertex_sets[new_vertex_sets.size() - 1]), + std::less<vertex_descriptor>()); + + set_map[v].pred.clear(); + + new_vertex_sets.push_back(std::vector<vertex_descriptor>()); + // Succ - Intersect(pred, succ) + std::set_difference(set_map[v].succ.begin(), set_map[v].succ.end(), + set_map[v].intersect.begin(), set_map[v].intersect.end(), + back_inserter(new_vertex_sets[new_vertex_sets.size() - 1]), + std::less<vertex_descriptor>()); + + set_map[v].succ.clear(); + + // Label SCC just identified with the 'first' vertex in that SCC + for( std::size_t j = 0; j < set_map[v].intersect.size(); j++ ) + put(c, set_map[v].intersect[j], set_map[v].intersect[0]); + + set_map[v].intersect.clear(); + } + } + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Perform set arithemetic time = " << accounting::print_time(end - start) << " seconds.\n"; + start = accounting::get_time(); +#endif + + // Remove sets of size 1 from new_vertex_sets + typename std::vector<std::vector<vertex_descriptor> >::iterator vviter; + for( vviter = new_vertex_sets.begin(); vviter != new_vertex_sets.end(); /*in loop*/ ) + if( (*vviter).size() < 2 ) + vviter = new_vertex_sets.erase( vviter ); + else + vviter++; + + // All gather new sets and recur (gotta marshal and unmarshal sets first) + vertex_sets.clear(); + std::vector<vertex_descriptor> serial_sets, all_serial_sets; + detail::marshal_set<Graph>( new_vertex_sets, serial_sets ); + all_gather( pg, serial_sets.begin(), serial_sets.end(), all_serial_sets ); + detail::unmarshal_set<Graph>( all_serial_sets, vertex_sets ); + +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) { + std::cerr << " Serialize and gather new vertex sets time = " << accounting::print_time(end - start) << " seconds.\n\n\n"; + + printf("Vertex sets: %d\n", (int)vertex_sets.size() ); + for( std::size_t i = 0; i < vertex_sets.size(); ++i ) + printf(" %d: %d\n", i, (int)vertex_sets[i].size() ); + } + start = accounting::get_time(); +#endif + + // HACK!?! -- This would be more properly implemented as a topological sort + // Remove vertices without an edge to another vertex in the set and an edge from another + // vertex in the set + typedef typename graph_traits<Graph>::out_edge_iterator out_edge_iterator; + out_edge_iterator estart, eend; + typedef typename graph_traits<ReverseGraph>::out_edge_iterator r_out_edge_iterator; + r_out_edge_iterator restart, reend; + for (std::size_t i = 0; i < vertex_sets.size(); ++i) { + std::vector<vertex_descriptor> new_set; + for (std::size_t j = 0; j < vertex_sets[i].size(); ++j) { + vertex_descriptor v = vertex_sets[i][j]; + if (get(owner, v) == id) { + tie(estart, eend) = out_edges(v, g); + while (estart != eend && find(vertex_sets[i].begin(), vertex_sets[i].end(), + target(*estart,g)) == vertex_sets[i].end()) estart++; + if (estart != eend) { + tie(restart, reend) = out_edges(get(fr, v), gr); + while (restart != reend && find(vertex_sets[i].begin(), vertex_sets[i].end(), + get(rf, target(*restart,g))) == vertex_sets[i].end()) restart++; + if (restart != reend) + new_set.push_back(v); + } + } + } + vertex_sets[i].clear(); + all_gather(pg, new_set.begin(), new_set.end(), vertex_sets[i]); + std::sort(vertex_sets[i].begin(), vertex_sets[i].end(), std::less<vertex_descriptor>()); + } +#ifdef PBGL_SCC_DEBUG + end = accounting::get_time(); + if(id == 0) + std::cerr << " Trim vertex sets time = " << accounting::print_time(end - start) << " seconds.\n\n\n"; + start = accounting::get_time(); +#endif + + } while ( !vertex_sets.empty() ); + + + // Label vertices not in a SCC as their own SCC + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + if( get(c, *vstart) == graph_traits<Graph>::null_vertex() ) + put(c, *vstart, *vstart); + + synchronize(c); + } + + template<typename Graph, typename ReverseGraph, typename IsoMap> + void + build_reverse_graph( const Graph& g, ReverseGraph& gr, IsoMap& fr, IsoMap& rf ) + { + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::out_edge_iterator out_edge_iterator; + typedef typename boost::graph::parallel::process_group_type<Graph>::type process_group_type; + typedef typename process_group_type::process_id_type process_id_type; + typedef std::vector<std::pair<vertex_descriptor, vertex_descriptor> > VertexPairVec; + + typedef typename graph_traits<Graph>::directed_category directed_category; + + typename property_map<Graph, vertex_owner_t>::const_type + owner = get(vertex_owner, g); + + process_group_type pg = process_group(g); + process_id_type id = process_id(pg); + + int n; + vertex_iterator vstart, vend; + int num_procs = num_processes(pg); + + vertex_descriptor v; + out_edge_iterator oestart, oeend; + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + { + v = add_vertex(gr); + put(fr, *vstart, v); + put(rf, v, *vstart); + } + + gr.distribution() = g.distribution(); + + int my_n = num_vertices(g); + all_reduce(pg, &my_n, &my_n+1, &n, std::plus<int>()); + + for (int i = 0; i < n; ++i) + get(fr, vertex(i,g)); + synchronize(fr); + + // Add edges to gr + std::vector<std::pair<vertex_descriptor, vertex_descriptor> > new_edges; + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + for( tie(oestart, oeend) = out_edges(*vstart, g); oestart != oeend; oestart++ ) + new_edges.push_back( std::make_pair(get(fr, target(*oestart,g)), get(fr, source(*oestart, g))) ); + + std::vector<VertexPairVec> edge_requests(num_procs); + + typename std::vector<std::pair<vertex_descriptor, vertex_descriptor> >::iterator iter; + for( iter = new_edges.begin(); iter != new_edges.end(); iter++ ) { + std::pair<vertex_descriptor, vertex_descriptor> p1 = *iter; + if( get(owner, p1.first ) == id ) + add_edge( p1.first, p1.second, gr ); + else + edge_requests[get(owner, p1.first)].push_back(p1); + } + new_edges.clear(); + + // Send edge addition requests + for (process_id_type p = 0; p < num_procs; ++p) { + if (!edge_requests[p].empty()) { + VertexPairVec reqs(edge_requests[p].begin(), edge_requests[p].end()); + send(pg, p, fhp_edges_size_msg, reqs.size()); + send(pg, p, fhp_add_edges_msg, &reqs[0], reqs.size()); + } + } + synchronize(pg); + + // Receive edge addition requests and handle them + while (optional<std::pair<process_id_type, int> > m = probe(pg)) { + assert(m->second == fhp_edges_size_msg); + std::size_t num_requests; + receive(pg, m->first, m->second, num_requests); + VertexPairVec requests(num_requests); + receive(pg, m->first, fhp_add_edges_msg, &requests[0], + num_requests); + for( std::size_t i = 0; i < requests.size(); ++i ) + add_edge( requests[i].first, requests[i].second, gr ); + } + synchronize(gr); + } + + template<typename Graph, typename VertexComponentMap, typename ComponentMap> + typename property_traits<ComponentMap>::value_type + number_components(const Graph& g, VertexComponentMap r, ComponentMap c) + { + typedef typename boost::graph::parallel::process_group_type<Graph>::type process_group_type; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename property_traits<ComponentMap>::value_type ComponentMapType; + std::vector<vertex_descriptor> my_roots, all_roots; + vertex_iterator vstart, vend; + + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + if( find( my_roots.begin(), my_roots.end(), get(r, *vstart) ) == my_roots.end() ) + my_roots.push_back( get(r, *vstart) ); + + all_gather( process_group(g), my_roots.begin(), my_roots.end(), all_roots ); + + /* Number components */ + std::map<vertex_descriptor, ComponentMapType> comp_numbers; + ComponentMapType c_num = 0; + + // Compute component numbers + for (std::size_t i = 0; i < all_roots.size(); ++i ) + if ( comp_numbers.count(all_roots[i]) == 0 ) + comp_numbers[all_roots[i]] = c_num++; + + // Broadcast component numbers + for( tie(vstart, vend) = vertices(g); vstart != vend; vstart++ ) + put( c, *vstart, comp_numbers[get(r,*vstart)] ); + + // Broadcast number of components + if (process_id(process_group(g)) == 0) { + typedef typename process_group_type::process_size_type + process_size_type; + for (process_size_type dest = 1, n = num_processes(process_group(g)); + dest != n; ++dest) + send(process_group(g), dest, 0, c_num); + } + + synchronize(process_group(g)); + + if (process_id(process_group(g)) != 0) receive(process_group(g), 0, 0, c_num); + + synchronize(c); + return c_num; + } + + + template<typename Graph, typename ComponentMap, typename VertexComponentMap, + typename VertexIndexMap> + typename property_traits<ComponentMap>::value_type + fleischer_hendrickson_pinar_strong_components_impl + (const Graph& g, + ComponentMap c, + VertexComponentMap r, + VertexIndexMap vertex_index_map, + incidence_graph_tag) + { + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef iterator_property_map<typename std::vector<vertex_descriptor>::iterator, + VertexIndexMap> IsoMap; + typename boost::graph::parallel::process_group_type<Graph>::type pg = process_group(g); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type start = accounting::get_time(); +#endif + + typedef adjacency_list<listS, + distributedS<typename boost::graph::parallel::process_group_type<Graph>::type, vecS>, + directedS > ReverseGraph; + + ReverseGraph gr(0, pg); + std::vector<vertex_descriptor> fr_s(num_vertices(g)); + std::vector<vertex_descriptor> rf_s(num_vertices(g)); + IsoMap fr(fr_s.begin(), vertex_index_map); // fr = forward->reverse + IsoMap rf(rf_s.begin(), vertex_index_map); // rf = reverse->forward + + build_reverse_graph(g, gr, fr, rf); + +#ifdef PBGL_SCC_DEBUG + accounting::time_type end = accounting::get_time(); + if(process_id(process_group(g)) == 0) + std::cerr << "Reverse graph initialization time = " << accounting::print_time(end - start) << " seconds.\n"; +#endif + + fleischer_hendrickson_pinar_strong_components(g, r, gr, fr, rf, + vertex_index_map); + + typename property_traits<ComponentMap>::value_type c_num = number_components(g, r, c); + + return c_num; + } + + template<typename Graph, typename ComponentMap, typename VertexComponentMap, + typename VertexIndexMap> + typename property_traits<ComponentMap>::value_type + fleischer_hendrickson_pinar_strong_components_impl + (const Graph& g, + ComponentMap c, + VertexComponentMap r, + VertexIndexMap vertex_index_map, + bidirectional_graph_tag) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + reverse_graph<Graph> gr(g); + detail::vertex_identity_property_map<vertex_descriptor> fr, rf; + + fleischer_hendrickson_pinar_strong_components(g, r, gr, fr, rf, + vertex_index_map); + + typename property_traits<ComponentMap>::value_type c_num + = number_components(g, r, c); + + return c_num; + } + + template<typename Graph, typename ComponentMap, typename VertexIndexMap> + inline typename property_traits<ComponentMap>::value_type + fleischer_hendrickson_pinar_strong_components + (const Graph& g, + ComponentMap c, + VertexIndexMap vertex_index_map) + { + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor; + typedef iterator_property_map<typename std::vector<vertex_descriptor>::iterator, + VertexIndexMap> VertexComponentMap; + typename boost::graph::parallel::process_group_type<Graph>::type pg + = process_group(g); + + if (num_processes(pg) == 1) { + local_subgraph<const Graph> ls(g); + return boost::strong_components(ls, c); + } + + // Create a VertexComponentMap for intermediate labeling of SCCs + std::vector<vertex_descriptor> r_s(num_vertices(g), graph_traits<Graph>::null_vertex()); + VertexComponentMap r(r_s.begin(), vertex_index_map); + + return fleischer_hendrickson_pinar_strong_components_impl + (g, c, r, vertex_index_map, + typename graph_traits<Graph>::traversal_category()); + } + + template<typename Graph, typename ComponentMap> + inline typename property_traits<ComponentMap>::value_type + fleischer_hendrickson_pinar_strong_components(const Graph& g, + ComponentMap c) + { + return fleischer_hendrickson_pinar_strong_components(g, c, get(vertex_index, g)); + } + +} // end namespace distributed + +using distributed::fleischer_hendrickson_pinar_strong_components; + +} // end namespace graph + +template<class Graph, class ComponentMap, class P, class T, class R> +inline typename property_traits<ComponentMap>::value_type +strong_components + (const Graph& g, ComponentMap comp, + const bgl_named_params<P, T, R>& + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) +{ + return graph::fleischer_hendrickson_pinar_strong_components(g, comp); +} + +template<class Graph, class ComponentMap> +inline typename property_traits<ComponentMap>::value_type +strong_components + (const Graph& g, ComponentMap comp + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, distributed_graph_tag)) +{ + return graph::fleischer_hendrickson_pinar_strong_components(g, comp); +} + +} /* end namespace boost */ + +#endif // BOOST_GRAPH_DISTRIBUTED_SCC_HPP diff --git a/Utilities/BGL/boost/graph/distributed/two_bit_color_map.hpp b/Utilities/BGL/boost/graph/distributed/two_bit_color_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eb8e29e3eac46bc3d47f14c597da336e7a05f2c5 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/two_bit_color_map.hpp @@ -0,0 +1,116 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// 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 +// Jeremiah Willcock +// Andrew Lumsdaine + +// Distributed version of the two-bit color map +#ifndef BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP +#define BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/two_bit_color_map.hpp> +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/property_map/parallel/local_property_map.hpp> + +namespace boost { + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +class two_bit_color_map<local_property_map<ProcessGroup,GlobalMap,StorageMap> > + : public parallel::distributed_property_map<ProcessGroup, GlobalMap, + two_bit_color_map<StorageMap> > +{ + typedef two_bit_color_map<StorageMap> local_map; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + local_map > + inherited; + + typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> + index_map_type; + +public: + two_bit_color_map(std::size_t inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_map(inital_size, index.base())) { } + + inherited& base() { return *this; } + const inherited& base() const { return *this; } +}; + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline two_bit_color_type +get(two_bit_color_map<local_property_map<ProcessGroup,GlobalMap,StorageMap> > + const& pm, + typename two_bit_color_map<GlobalMap>::key_type key) +{ + return get(pm.base(), key); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline void +put(two_bit_color_map<local_property_map<ProcessGroup,GlobalMap,StorageMap> > + const& pm, + typename two_bit_color_map<GlobalMap>::key_type key, + two_bit_color_type value) +{ + put(pm.base(), key, value); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +class two_bit_color_map<parallel::distributed_property_map< + ProcessGroup, GlobalMap, StorageMap> > + : public parallel::distributed_property_map< + ProcessGroup, GlobalMap, two_bit_color_map<StorageMap> > +{ + typedef two_bit_color_map<StorageMap> local_map; + + typedef parallel::distributed_property_map<ProcessGroup,GlobalMap,local_map> + inherited; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + StorageMap> + index_map_type; + +public: + two_bit_color_map(std::size_t inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_map(inital_size, index.base())) { } + + inherited& base() { return *this; } + const inherited& base() const { return *this; } +}; + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline two_bit_color_type +get(two_bit_color_map< + parallel::distributed_property_map< + ProcessGroup, GlobalMap, two_bit_color_map<StorageMap> > > const& pm, + typename two_bit_color_map<GlobalMap>::key_type key) +{ + return get(pm.base(), key); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline void +put(two_bit_color_map< + parallel::distributed_property_map< + ProcessGroup, GlobalMap, two_bit_color_map<StorageMap> > > const& pm, + typename two_bit_color_map<GlobalMap>::key_type key, + two_bit_color_type value) +{ + put(pm.base(), key, value); +} + +} // end namespace boost + +#endif // BOOST_DISTRIBUTED_TWO_BIT_COLOR_MAP_HPP diff --git a/Utilities/BGL/boost/graph/distributed/unsafe_serialize.hpp b/Utilities/BGL/boost/graph/distributed/unsafe_serialize.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1dccef84a120fdda2b6697e1a6ac1d32ef633f79 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/unsafe_serialize.hpp @@ -0,0 +1,75 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +// This file contains the "unsafe_serialize" routine, which transforms +// types they may not be serializable (such as void*) into +// serializable equivalents. +#ifndef PBGL_UNSAFE_SERIALIZE_HPP +#define PBGL_UNSAFE_SERIALIZE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/mpi/datatype.hpp> +#include <boost/serialization/is_bitwise_serializable.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/if.hpp> +#include <utility> + +BOOST_IS_BITWISE_SERIALIZABLE(void*) +namespace boost { namespace mpi { + template<> struct is_mpi_datatype<void*> : mpl::true_ { }; +} } // end namespace boost::mpi + +namespace boost { + typedef mpl::if_c<(sizeof(int) == sizeof(void*)), + int, + mpl::if_c<(sizeof(long) == sizeof(void*)), long, void>::type + >::type ptr_serialize_type; + + template<typename T> inline T& unsafe_serialize(T& x) { return x; } + + inline ptr_serialize_type& unsafe_serialize(void*& x) + { return reinterpret_cast<ptr_serialize_type&>(x); } + + // Force Boost.MPI to serialize a void* like a ptr_serialize_type + namespace mpi { + template<> inline MPI_Datatype get_mpi_datatype<void*>(void* const& x) + { + return get_mpi_datatype<ptr_serialize_type>(); + } + } + + template<typename T, typename U> + struct unsafe_pair + { + unsafe_pair() { } + unsafe_pair(const T& t, const U& u) : first(t), second(u) { } + unsafe_pair(const std::pair<T, U>& p) : first(p.first), second(p.second) { } + T first; + U second; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned /*version*/) + { + ar & unsafe_serialize(first) & unsafe_serialize(second); + } + }; + + template<typename T, typename U> + bool operator<(unsafe_pair<T,U> const& x, unsafe_pair<T,U> const& y) + { + return std::make_pair(x.first, x.second) < + std::make_pair(y.first, y.second); + } + +} // end namespace boost + +#endif // PBGL_UNSAFE_SERIALIZE_HPP diff --git a/Utilities/BGL/boost/graph/distributed/vertex_list_adaptor.hpp b/Utilities/BGL/boost/graph/distributed/vertex_list_adaptor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8928479a7a79eeef3ab874c438b7370656ee7000 --- /dev/null +++ b/Utilities/BGL/boost/graph/distributed/vertex_list_adaptor.hpp @@ -0,0 +1,403 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +#ifndef BOOST_VERTEX_LIST_ADAPTOR_HPP +#define BOOST_VERTEX_LIST_ADAPTOR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/graph_traits.hpp> +#include <vector> +#include <boost/shared_ptr.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/parallel/algorithm.hpp> +#include <boost/graph/parallel/container_traits.hpp> +#include <boost/property_map/vector_property_map.hpp> + +namespace boost { namespace graph { + +// -------------------------------------------------------------------------- +// Global index map built from a distribution +// -------------------------------------------------------------------------- +template<typename Distribution, typename OwnerPropertyMap, + typename LocalPropertyMap> +class distribution_global_index_map +{ + public: + typedef std::size_t value_type; + typedef value_type reference; + typedef typename property_traits<OwnerPropertyMap>::key_type key_type; + typedef readable_property_map_tag category; + + distribution_global_index_map(const Distribution& distribution, + const OwnerPropertyMap& owner, + const LocalPropertyMap& local) + : distribution_(distribution), owner(owner), local(local) { } + + Distribution distribution_; + OwnerPropertyMap owner; + LocalPropertyMap local; +}; + +template<typename Distribution, typename OwnerPropertyMap, + typename LocalPropertyMap> +inline +typename distribution_global_index_map<Distribution, OwnerPropertyMap, + LocalPropertyMap>::value_type +get(const distribution_global_index_map<Distribution, OwnerPropertyMap, + LocalPropertyMap>& p, + typename distribution_global_index_map<Distribution, OwnerPropertyMap, + LocalPropertyMap>::key_type x) +{ + using boost::get; + return p.distribution_.global(get(p.owner, x), get(p.local, x)); +} + +template<typename Graph, typename Distribution> +inline +distribution_global_index_map< + Distribution, + typename property_map<Graph, vertex_owner_t>::const_type, + typename property_map<Graph, vertex_local_t>::const_type> +make_distribution_global_index_map(const Graph& g, const Distribution& d) +{ + typedef distribution_global_index_map< + Distribution, + typename property_map<Graph, vertex_owner_t>::const_type, + typename property_map<Graph, vertex_local_t>::const_type> + result_type; + return result_type(d, get(vertex_owner, g), get(vertex_local, g)); +} + +// -------------------------------------------------------------------------- +// Global index map built from a distributed index map and list of vertices +// -------------------------------------------------------------------------- +template<typename IndexMap> +class stored_global_index_map : public IndexMap +{ + public: + typedef readable_property_map_tag category; + + stored_global_index_map(const IndexMap& index_map) : IndexMap(index_map) { + // When we have a global index, we need to always have the indices + // of every key we've seen + this->set_max_ghost_cells(0); + } +}; + +// -------------------------------------------------------------------------- +// Global index map support code +// -------------------------------------------------------------------------- +namespace detail { + template<typename PropertyMap, typename ForwardIterator> + inline void + initialize_global_index_map(const PropertyMap&, + ForwardIterator, ForwardIterator) + { } + + template<typename IndexMap, typename ForwardIterator> + void + initialize_global_index_map(stored_global_index_map<IndexMap>& p, + ForwardIterator first, ForwardIterator last) + { + using std::distance; + + typedef typename property_traits<IndexMap>::value_type size_t; + + size_t n = distance(first, last); + for (size_t i = 0; i < n; ++i, ++first) local_put(p, *first, i); + } +} + +// -------------------------------------------------------------------------- +// Adapts a Distributed Vertex List Graph to a Vertex List Graph +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +class vertex_list_adaptor : public graph_traits<Graph> +{ + typedef graph_traits<Graph> inherited; + + typedef typename inherited::traversal_category base_traversal_category; + + public: + typedef typename inherited::vertex_descriptor vertex_descriptor; + typedef typename std::vector<vertex_descriptor>::iterator vertex_iterator; + typedef typename std::vector<vertex_descriptor>::size_type + vertices_size_type; + + struct traversal_category + : public virtual base_traversal_category, + public virtual vertex_list_graph_tag {}; + + vertex_list_adaptor(const Graph& g, + const GlobalIndexMap& index_map = GlobalIndexMap()) + : g(&g), index_map(index_map) + { + using boost::vertices; + + all_vertices_.reset(new std::vector<vertex_descriptor>()); + all_gather(process_group(), vertices(g).first, vertices(g).second, + *all_vertices_); + detail::initialize_global_index_map(this->index_map, + all_vertices_->begin(), + all_vertices_->end()); + } + + const Graph& base() const { return *g; } + + // -------------------------------------------------------------------------- + // Distributed Container + // -------------------------------------------------------------------------- + typedef typename boost::graph::parallel::process_group_type<Graph>::type + process_group_type; + + process_group_type process_group() const + { + using boost::graph::parallel::process_group; + return process_group(*g); + } + + std::pair<vertex_iterator, vertex_iterator> vertices() const + { return std::make_pair(all_vertices_->begin(), all_vertices_->end()); } + + vertices_size_type num_vertices() const { return all_vertices_->size(); } + + GlobalIndexMap get_index_map() const { return index_map; } + + private: + const Graph* g; + GlobalIndexMap index_map; + shared_ptr<std::vector<vertex_descriptor> > all_vertices_; +}; + +template<typename Graph, typename GlobalIndexMap> +inline vertex_list_adaptor<Graph, GlobalIndexMap> +make_vertex_list_adaptor(const Graph& g, const GlobalIndexMap& index_map) +{ return vertex_list_adaptor<Graph, GlobalIndexMap>(g, index_map); } + +namespace detail { + template<typename Graph> + class default_global_index_map + { + typedef typename graph_traits<Graph>::vertices_size_type value_type; + typedef typename property_map<Graph, vertex_index_t>::const_type local_map; + + public: + typedef vector_property_map<value_type, local_map> distributed_map; + typedef stored_global_index_map<distributed_map> type; + }; +} + +template<typename Graph> +inline +vertex_list_adaptor<Graph, + typename detail::default_global_index_map<Graph>::type> +make_vertex_list_adaptor(const Graph& g) +{ + typedef typename detail::default_global_index_map<Graph>::type + GlobalIndexMap; + typedef typename detail::default_global_index_map<Graph>::distributed_map + DistributedMap; + typedef vertex_list_adaptor<Graph, GlobalIndexMap> result_type; + return result_type(g, + GlobalIndexMap(DistributedMap(num_vertices(g), + get(vertex_index, g)))); +} + +// -------------------------------------------------------------------------- +// Incidence Graph +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +inline typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor +source(typename vertex_list_adaptor<Graph, GlobalIndexMap>::edge_descriptor e, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return source(e, g.base()); } + +template<typename Graph, typename GlobalIndexMap> +inline typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor +target(typename vertex_list_adaptor<Graph, GlobalIndexMap>::edge_descriptor e, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return target(e, g.base()); } + +template<typename Graph, typename GlobalIndexMap> +inline +std::pair<typename vertex_list_adaptor<Graph, GlobalIndexMap>::out_edge_iterator, + typename vertex_list_adaptor<Graph, GlobalIndexMap>::out_edge_iterator> +out_edges(typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor v, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return out_edges(v, g.base()); } + +template<typename Graph, typename GlobalIndexMap> +inline typename vertex_list_adaptor<Graph, GlobalIndexMap>::degree_size_type +out_degree(typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor v, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return out_degree(v, g.base()); } + +// -------------------------------------------------------------------------- +// Bidirectional Graph +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +inline +std::pair<typename vertex_list_adaptor<Graph, GlobalIndexMap>::in_edge_iterator, + typename vertex_list_adaptor<Graph, GlobalIndexMap>::in_edge_iterator> +in_edges(typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor v, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return in_edges(v, g.base()); } + +template<typename Graph, typename GlobalIndexMap> +inline typename vertex_list_adaptor<Graph, GlobalIndexMap>::degree_size_type +in_degree(typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor v, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return in_degree(v, g.base()); } + +template<typename Graph, typename GlobalIndexMap> +inline typename vertex_list_adaptor<Graph, GlobalIndexMap>::degree_size_type +degree(typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor v, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return degree(v, g.base()); } + +// -------------------------------------------------------------------------- +// Adjacency Graph +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +inline +std::pair<typename vertex_list_adaptor<Graph, GlobalIndexMap>::adjacency_iterator, + typename vertex_list_adaptor<Graph, GlobalIndexMap>::adjacency_iterator> +adjacent_vertices(typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor v, + const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return adjacent_vertices(v, g.base()); } + + +// -------------------------------------------------------------------------- +// Vertex List Graph +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +inline +std::pair<typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_iterator, + typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_iterator> +vertices(const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return g.vertices(); } + +template<typename Graph, typename GlobalIndexMap> +inline +typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertices_size_type +num_vertices(const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return g.num_vertices(); } + +// -------------------------------------------------------------------------- +// Edge List Graph +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +inline +std::pair<typename vertex_list_adaptor<Graph, GlobalIndexMap>::edge_iterator, + typename vertex_list_adaptor<Graph, GlobalIndexMap>::edge_iterator> +edges(const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return edges(g.base()); } + +template<typename Graph, typename GlobalIndexMap> +inline +typename vertex_list_adaptor<Graph, GlobalIndexMap>::edges_size_type +num_edges(const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return num_edges(g.base()); } + +// -------------------------------------------------------------------------- +// Property Graph +// -------------------------------------------------------------------------- +template<typename PropertyTag, typename Graph, typename GlobalIndexMap> +inline typename property_map<Graph, PropertyTag>::type +get(PropertyTag p, vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return get(p, g.base()); } + +template<typename PropertyTag, typename Graph, typename GlobalIndexMap> +inline typename property_map<Graph, PropertyTag>::const_type +get(PropertyTag p, const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return get(p, g.base()); } + +template<typename PropertyTag, typename Graph, typename GlobalIndexMap> +inline typename property_traits< + typename property_map<Graph, PropertyTag>::type + >::value_type +get(PropertyTag p, const vertex_list_adaptor<Graph, GlobalIndexMap>& g, + typename property_traits< + typename property_map<Graph, PropertyTag>::type + >::key_type const& x) +{ return get(p, g.base(), x); } + +template<typename PropertyTag, typename Graph, typename GlobalIndexMap> +inline void +put(PropertyTag p, vertex_list_adaptor<Graph, GlobalIndexMap>& g, + typename property_traits< + typename property_map<Graph, PropertyTag>::type + >::key_type const& x, + typename property_traits< + typename property_map<Graph, PropertyTag>::type + >::value_type const& v) +{ return put(p, g.base(), x, v); } + +// -------------------------------------------------------------------------- +// Property Graph: vertex_index property +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +inline GlobalIndexMap +get(vertex_index_t, const vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return g.get_index_map(); } + +template<typename Graph, typename GlobalIndexMap> +inline typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertices_size_type +get(vertex_index_t, const vertex_list_adaptor<Graph, GlobalIndexMap>& g, + typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor x) +{ return get(g.get_index_map(), x); } + +// -------------------------------------------------------------------------- +// Adjacency Matrix Graph +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +std::pair<typename vertex_list_adaptor<Graph, GlobalIndexMap>::edge_descriptor, + bool> +edge(typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor u, + typename vertex_list_adaptor<Graph, GlobalIndexMap>::vertex_descriptor v, + vertex_list_adaptor<Graph, GlobalIndexMap>& g) +{ return edge(u, v, g.base()); } + +} } // end namespace boost::graph + +namespace boost { + +// -------------------------------------------------------------------------- +// Property Graph: vertex_index property +// -------------------------------------------------------------------------- +template<typename Graph, typename GlobalIndexMap> +class property_map<vertex_index_t, + graph::vertex_list_adaptor<Graph, GlobalIndexMap> > +{ +public: + typedef GlobalIndexMap type; + typedef type const_type; +}; + +template<typename Graph, typename GlobalIndexMap> +class property_map<vertex_index_t, + const graph::vertex_list_adaptor<Graph, GlobalIndexMap> > +{ +public: + typedef GlobalIndexMap type; + typedef type const_type; +}; + +using graph::distribution_global_index_map; +using graph::make_distribution_global_index_map; +using graph::stored_global_index_map; +using graph::make_vertex_list_adaptor; +using graph::vertex_list_adaptor; + +} // end namespace boost + +#endif // BOOST_VERTEX_LIST_ADAPTOR_HPP diff --git a/Utilities/BGL/boost/graph/dll_import_export.hpp b/Utilities/BGL/boost/graph/dll_import_export.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cc369d1d1242c6d15bc078c6f46e4360aad51fad --- /dev/null +++ b/Utilities/BGL/boost/graph/dll_import_export.hpp @@ -0,0 +1,30 @@ +//======================================================================= +// Copyright 2001 University of Notre Dame. +// Copyright 2003 Jeremy Siek +// Authors: Lie-Quan Lee, Jeremy Siek, and Douglas Gregor +// +// 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_DLL_IMPORT_EXPORT_HPP +#define BOOST_GRAPH_DLL_IMPORT_EXPORT_HPP + +#include <boost/config.hpp> + +#ifdef BOOST_HAS_DECLSPEC +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_GRAPH_DYN_LINK) +# ifdef BOOST_GRAPH_SOURCE +# define BOOST_GRAPH_DECL __declspec(dllexport) +# else +# define BOOST_GRAPH_DECL __declspec(dllimport) +# endif // BOOST_GRAPH_SOURCE +# endif // DYN_LINK +#endif // BOOST_HAS_DECLSPEC + +#ifndef BOOST_GRAPH_DECL +# define BOOST_GRAPH_DECL +#endif + +#endif // BOOST_GRAPH_DLL_IMPORT_EXPORT_HPP diff --git a/Utilities/BGL/boost/graph/dominator_tree.hpp b/Utilities/BGL/boost/graph/dominator_tree.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c19a4076f7dda4239997b2174446044f909c103 --- /dev/null +++ b/Utilities/BGL/boost/graph/dominator_tree.hpp @@ -0,0 +1,491 @@ +//======================================================================= +// Copyright (C) 2005-2009 Jongsoo Park <jongsoo.park -at- 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) +//======================================================================= + +#ifndef BOOST_GRAPH_DOMINATOR_HPP +#define BOOST_GRAPH_DOMINATOR_HPP + +#include <boost/config.hpp> +#include <deque> +#include <set> +#include <boost/graph/depth_first_search.hpp> + +// Dominator tree computation + +namespace boost { + namespace detail { + /** + * An extended time_stamper which also records vertices for each dfs number + */ + template<class TimeMap, class VertexVector, class TimeT, class Tag> + class time_stamper_with_vertex_vector + : public base_visitor< + time_stamper_with_vertex_vector<TimeMap, VertexVector, TimeT, Tag> > + { + public : + typedef Tag event_filter; + time_stamper_with_vertex_vector(TimeMap timeMap, VertexVector& v, + TimeT& t) + : timeStamper_(timeMap, t), v_(v) { } + + template<class Graph> + void + operator()(const typename property_traits<TimeMap>::key_type& v, + const Graph& g) + { + timeStamper_(v, g); + v_[timeStamper_.m_time] = v; + } + + private : + time_stamper<TimeMap, TimeT, Tag> timeStamper_; + VertexVector& v_; + }; + + /** + * A convenient way to create a time_stamper_with_vertex_vector + */ + template<class TimeMap, class VertexVector, class TimeT, class Tag> + time_stamper_with_vertex_vector<TimeMap, VertexVector, TimeT, Tag> + stamp_times_with_vertex_vector(TimeMap timeMap, VertexVector& v, TimeT& t, + Tag) + { + return time_stamper_with_vertex_vector<TimeMap, VertexVector, TimeT, + Tag>(timeMap, v, t); + } + + template<class Graph, class IndexMap, class TimeMap, class PredMap, + class DomTreePredMap> + class dominator_visitor + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertices_size_type VerticesSizeType; + + public : + /** + * @param g [in] the target graph of the dominator tree + * @param entry [in] the entry node of g + * @param domTreePredMap [out] the immediate dominator map + * (parent map in dominator tree) + */ + dominator_visitor(const Graph& g, const Vertex& entry, + DomTreePredMap domTreePredMap) + : semi_(num_vertices(g)), + ancestor_(num_vertices(g), graph_traits<Graph>::null_vertex()), + samedom_(ancestor_), + best_(semi_), + semiMap_(make_iterator_property_map(semi_.begin(), + get(vertex_index, g))), + ancestorMap_(make_iterator_property_map(ancestor_.begin(), + get(vertex_index, g))), + bestMap_(make_iterator_property_map(best_.begin(), + get(vertex_index, g))), + buckets_(num_vertices(g)), + bucketMap_(make_iterator_property_map(buckets_.begin(), + get(vertex_index, g))), + entry_(entry), + domTreePredMap_(domTreePredMap), + numOfVertices_(num_vertices(g)), + samedomMap(make_iterator_property_map(samedom_.begin(), + get(vertex_index, g))) + { + } + + void + operator()(const Vertex& n, const TimeMap& dfnumMap, + const PredMap& parentMap, const Graph& g) + { + if (n == entry_) return; + + const Vertex p(get(parentMap, n)); + Vertex s(p); + + // 1. Calculate the semidominator of n, + // based on the semidominator thm. + // * Semidominator thm. : To find the semidominator of a node n, + // consider all predecessors v of n in the CFG (Control Flow Graph). + // - If v is a proper ancestor of n in the spanning tree + // (so dfnum(v) < dfnum(n)), then v is a candidate for semi(n) + // - If v is a non-ancestor of n (so dfnum(v) > dfnum(n)) + // then for each u that is an ancestor of v (or u = v), + // Let semi(u) be a candidate for semi(n) + // of all these candidates, the one with lowest dfnum is + // the semidominator of n. + + // For each predecessor of n + typename graph_traits<Graph>::in_edge_iterator inItr, inEnd; + for (tie(inItr, inEnd) = in_edges(n, g); inItr != inEnd; ++inItr) + { + const Vertex v = source(*inItr, g); + // To deal with unreachable nodes + if (get(dfnumMap, v) < 0 || get(dfnumMap, v) >= numOfVertices_) + continue; + + Vertex s2; + if (get(dfnumMap, v) <= get(dfnumMap, n)) + s2 = v; + else + s2 = get(semiMap_, ancestor_with_lowest_semi_(v, dfnumMap)); + + if (get(dfnumMap, s2) < get(dfnumMap, s)) + s = s2; + } + put(semiMap_, n, s); + + // 2. Calculation of n's dominator is deferred until + // the path from s to n has been linked into the forest + get(bucketMap_, s).push_back(n); + get(ancestorMap_, n) = p; + get(bestMap_, n) = n; + + // 3. Now that the path from p to v has been linked into + // the spanning forest, these lines calculate the dominator of v, + // based on the dominator thm., or else defer the calculation + // until y's dominator is known + // * Dominator thm. : On the spanning-tree path below semi(n) and + // above or including n, let y be the node + // with the smallest-numbered semidominator. Then, + // + // idom(n) = semi(n) if semi(y)=semi(n) or + // idom(y) if semi(y) != semi(n) + typename std::deque<Vertex>::iterator buckItr; + for (buckItr = get(bucketMap_, p).begin(); + buckItr != get(bucketMap_, p).end(); + ++buckItr) + { + const Vertex v(*buckItr); + const Vertex y(ancestor_with_lowest_semi_(v, dfnumMap)); + if (get(semiMap_, y) == get(semiMap_, v)) + put(domTreePredMap_, v, p); + else + put(samedomMap, v, y); + } + + get(bucketMap_, p).clear(); + } + + protected : + + /** + * Evaluate function in Tarjan's path compression + */ + const Vertex + ancestor_with_lowest_semi_(const Vertex& v, const TimeMap& dfnumMap) + { + const Vertex a(get(ancestorMap_, v)); + + if (get(ancestorMap_, a) != graph_traits<Graph>::null_vertex()) + { + const Vertex b(ancestor_with_lowest_semi_(a, dfnumMap)); + + put(ancestorMap_, v, get(ancestorMap_, a)); + + if (get(dfnumMap, get(semiMap_, b)) < + get(dfnumMap, get(semiMap_, get(bestMap_, v)))) + put(bestMap_, v, b); + } + + return get(bestMap_, v); + } + + std::vector<Vertex> semi_, ancestor_, samedom_, best_; + PredMap semiMap_, ancestorMap_, bestMap_; + std::vector< std::deque<Vertex> > buckets_; + + iterator_property_map<typename std::vector<std::deque<Vertex> >::iterator, + IndexMap> bucketMap_; + + const Vertex& entry_; + DomTreePredMap domTreePredMap_; + const VerticesSizeType numOfVertices_; + + public : + + PredMap samedomMap; + }; + + } // namespace detail + + /** + * @brief Build dominator tree using Lengauer-Tarjan algorithm. + * It takes O((V+E)log(V+E)) time. + * + * @pre dfnumMap, parentMap and verticesByDFNum have dfs results corresponding + * indexMap. + * If dfs has already run before, + * this function would be good for saving computations. + * @pre Unreachable nodes must be masked as + * graph_traits<Graph>::null_vertex in parentMap. + * @pre Unreachable nodes must be masked as + * (std::numeric_limits<VerticesSizeType>::max)() in dfnumMap. + * + * @param domTreePredMap [out] : immediate dominator map (parent map + * in dom. tree) + * + * @note reference Appel. p. 452~453. algorithm 19.9, 19.10. + * + * @todo : Optimization in Finding Dominators in Practice, Loukas Georgiadis + */ + template<class Graph, class IndexMap, class TimeMap, class PredMap, + class VertexVector, class DomTreePredMap> + void + lengauer_tarjan_dominator_tree_without_dfs + (const Graph& g, + const typename graph_traits<Graph>::vertex_descriptor& entry, + const IndexMap& /*indexMap*/, + TimeMap dfnumMap, PredMap parentMap, VertexVector& verticesByDFNum, + DomTreePredMap domTreePredMap) + { + // Typedefs and concept check + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertices_size_type VerticesSizeType; + + function_requires< BidirectionalGraphConcept<Graph> >(); + + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + // 1. Visit each vertex in reverse post order and calculate sdom. + detail::dominator_visitor<Graph, IndexMap, TimeMap, PredMap, DomTreePredMap> + visitor(g, entry, domTreePredMap); + + VerticesSizeType i; + for (i = 0; i < numOfVertices; ++i) + { + const Vertex u(verticesByDFNum[numOfVertices - 1 - i]); + if (u != graph_traits<Graph>::null_vertex()) + visitor(u, dfnumMap, parentMap, g); + } + + // 2. Now all the deferred dominator calculations, + // based on the second clause of the dominator thm., are performed + for (i = 0; i < numOfVertices; ++i) + { + const Vertex n(verticesByDFNum[i]); + + if (n == entry || n == graph_traits<Graph>::null_vertex()) + continue; + + Vertex u = get(visitor.samedomMap, n); + if (u != graph_traits<Graph>::null_vertex()) + { + put(domTreePredMap, n, get(domTreePredMap, u)); + } + } + } + + /** + * Unlike lengauer_tarjan_dominator_tree_without_dfs, + * dfs is run in this function and + * the result is written to dfnumMap, parentMap, vertices. + * + * If the result of dfs required after this algorithm, + * this function can eliminate the need of rerunning dfs. + */ + template<class Graph, class IndexMap, class TimeMap, class PredMap, + class VertexVector, class DomTreePredMap> + void + lengauer_tarjan_dominator_tree + (const Graph& g, + const typename graph_traits<Graph>::vertex_descriptor& entry, + const IndexMap& indexMap, + TimeMap dfnumMap, PredMap parentMap, VertexVector& verticesByDFNum, + DomTreePredMap domTreePredMap) + { + // Typedefs and concept check + typedef typename graph_traits<Graph>::vertices_size_type VerticesSizeType; + + function_requires< BidirectionalGraphConcept<Graph> >(); + + // 1. Depth first visit + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + VerticesSizeType time = + (std::numeric_limits<VerticesSizeType>::max)(); + std::vector<default_color_type> + colors(numOfVertices, color_traits<default_color_type>::white()); + depth_first_visit + (g, entry, + make_dfs_visitor + (make_pair(record_predecessors(parentMap, on_tree_edge()), + detail::stamp_times_with_vertex_vector + (dfnumMap, verticesByDFNum, time, on_discover_vertex()))), + make_iterator_property_map(colors.begin(), indexMap)); + + // 2. Run main algorithm. + lengauer_tarjan_dominator_tree_without_dfs(g, entry, indexMap, dfnumMap, + parentMap, verticesByDFNum, + domTreePredMap); + } + + /** + * Use vertex_index as IndexMap and make dfnumMap, parentMap, verticesByDFNum + * internally. + * If we don't need the result of dfs (dfnumMap, parentMap, verticesByDFNum), + * this function would be more convenient one. + */ + template<class Graph, class DomTreePredMap> + void + lengauer_tarjan_dominator_tree + (const Graph& g, + const typename graph_traits<Graph>::vertex_descriptor& entry, + DomTreePredMap domTreePredMap) + { + // typedefs + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertices_size_type VerticesSizeType; + typedef typename property_map<Graph, vertex_index_t>::const_type IndexMap; + typedef + iterator_property_map<typename std::vector<VerticesSizeType>::iterator, + IndexMap> TimeMap; + typedef + iterator_property_map<typename std::vector<Vertex>::iterator, IndexMap> + PredMap; + + // Make property maps + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + const IndexMap indexMap = get(vertex_index, g); + + std::vector<VerticesSizeType> dfnum(numOfVertices, 0); + TimeMap dfnumMap(make_iterator_property_map(dfnum.begin(), indexMap)); + + std::vector<Vertex> parent(numOfVertices, + graph_traits<Graph>::null_vertex()); + PredMap parentMap(make_iterator_property_map(parent.begin(), indexMap)); + + std::vector<Vertex> verticesByDFNum(parent); + + // Run main algorithm + lengauer_tarjan_dominator_tree(g, entry, + indexMap, dfnumMap, parentMap, + verticesByDFNum, domTreePredMap); + } + + /** + * Muchnick. p. 182, 184 + * + * using iterative bit vector analysis + */ + template<class Graph, class IndexMap, class DomTreePredMap> + void + iterative_bit_vector_dominator_tree + (const Graph& g, + const typename graph_traits<Graph>::vertex_descriptor& entry, + const IndexMap& indexMap, + DomTreePredMap domTreePredMap) + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator vertexItr; + typedef typename graph_traits<Graph>::vertices_size_type VerticesSizeType; + typedef + iterator_property_map<typename std::vector< std::set<Vertex> >::iterator, + IndexMap> vertexSetMap; + + function_requires<BidirectionalGraphConcept<Graph> >(); + + // 1. Finding dominator + // 1.1. Initialize + const VerticesSizeType numOfVertices = num_vertices(g); + if (numOfVertices == 0) return; + + vertexItr vi, viend; + tie(vi, viend) = vertices(g); + const std::set<Vertex> N(vi, viend); + + bool change = true; + + std::vector< std::set<Vertex> > dom(numOfVertices, N); + vertexSetMap domMap(make_iterator_property_map(dom.begin(), indexMap)); + get(domMap, entry).clear(); + get(domMap, entry).insert(entry); + + while (change) + { + change = false; + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + { + if (*vi == entry) continue; + + std::set<Vertex> T(N); + + typename graph_traits<Graph>::in_edge_iterator inItr, inEnd; + for (tie(inItr, inEnd) = in_edges(*vi, g); inItr != inEnd; ++inItr) + { + const Vertex p = source(*inItr, g); + + std::set<Vertex> tempSet; + std::set_intersection(T.begin(), T.end(), + get(domMap, p).begin(), + get(domMap, p).end(), + std::inserter(tempSet, tempSet.begin())); + T.swap(tempSet); + } + + T.insert(*vi); + if (T != get(domMap, *vi)) + { + change = true; + get(domMap, *vi).swap(T); + } + } // end of for (tie(vi, viend) = vertices(g) + } // end of while(change) + + // 2. Build dominator tree + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + get(domMap, *vi).erase(*vi); + + Graph domTree(numOfVertices); + + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + { + if (*vi == entry) continue; + + // We have to iterate through copied dominator set + const std::set<Vertex> tempSet(get(domMap, *vi)); + typename std::set<Vertex>::const_iterator s; + for (s = tempSet.begin(); s != tempSet.end(); ++s) + { + typename std::set<Vertex>::iterator t; + for (t = get(domMap, *vi).begin(); t != get(domMap, *vi).end(); ) + { + typename std::set<Vertex>::iterator old_t = t; + ++t; // Done early because t may become invalid + if (*old_t == *s) continue; + if (get(domMap, *s).find(*old_t) != get(domMap, *s).end()) + get(domMap, *vi).erase(old_t); + } + } + } + + for (tie(vi, viend) = vertices(g); vi != viend; ++vi) + { + if (*vi != entry && get(domMap, *vi).size() == 1) + { + Vertex temp = *get(domMap, *vi).begin(); + put(domTreePredMap, *vi, temp); + } + } + } + + template<class Graph, class DomTreePredMap> + void + iterative_bit_vector_dominator_tree + (const Graph& g, + const typename graph_traits<Graph>::vertex_descriptor& entry, + DomTreePredMap domTreePredMap) + { + typename property_map<Graph, vertex_index_t>::const_type + indexMap = get(vertex_index, g); + + iterative_bit_vector_dominator_tree(g, entry, indexMap, domTreePredMap); + } +} // namespace boost + +#endif // BOOST_GRAPH_DOMINATOR_HPP diff --git a/Utilities/BGL/boost/graph/eccentricity.hpp b/Utilities/BGL/boost/graph/eccentricity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4d4ddbc4d3154341f4c67c691b74fa760827e105 --- /dev/null +++ b/Utilities/BGL/boost/graph/eccentricity.hpp @@ -0,0 +1,111 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_ECCENTRICITY_HPP +#define BOOST_GRAPH_ECCENTRICITY_HPP + +#include <boost/utility.hpp> +#include <boost/config.hpp> +#include <boost/graph/detail/geodesic.hpp> + +namespace boost +{ +template <typename Graph, + typename DistanceMap, + typename Combinator> +inline typename property_traits<DistanceMap>::value_type +eccentricity(const Graph& g, DistanceMap dist, Combinator combine) +{ + function_requires< GraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >(); + typedef typename property_traits<DistanceMap>::value_type Distance; + + return detail::combine_distances(g, dist, combine, Distance(0)); +} + +template <typename Graph, typename DistanceMap> +inline typename property_traits<DistanceMap>::value_type +eccentricity(const Graph& g, DistanceMap dist) +{ + function_requires< GraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<DistanceMap,Vertex> >(); + typedef typename property_traits<DistanceMap>::value_type Distance; + + return eccentricity(g, dist, detail::maximize<Distance>()); +} + +template <typename Graph, typename DistanceMatrix, typename EccentricityMap> +inline std::pair<typename property_traits<EccentricityMap>::value_type, + typename property_traits<EccentricityMap>::value_type> +all_eccentricities(const Graph& g, const DistanceMatrix& dist, EccentricityMap ecc) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept<DistanceMatrix,Vertex> >(); + typedef typename property_traits<DistanceMatrix>::value_type DistanceMap; + function_requires< WritablePropertyMapConcept<EccentricityMap,Vertex> >(); + typedef typename property_traits<EccentricityMap>::value_type Eccentricity; + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + + Eccentricity + r = numeric_values<Eccentricity>::infinity(), + d = numeric_values<Eccentricity>::zero(); + VertexIterator i, end; + tie(i, end) = vertices(g); + for(tie(i, end) = vertices(g); i != end; ++i) { + DistanceMap dm = get(dist, *i); + Eccentricity e = eccentricity(g, dm); + put(ecc, *i, e); + + // track the radius and diameter at the same time + r = min BOOST_PREVENT_MACRO_SUBSTITUTION (r, e); + d = max BOOST_PREVENT_MACRO_SUBSTITUTION (d, e); + } + return make_pair(r, d); +} + +template <typename Graph, typename EccentricityMap> +inline std::pair<typename property_traits<EccentricityMap>::value_type, + typename property_traits<EccentricityMap>::value_type> +radius_and_diameter(const Graph& g, EccentricityMap ecc) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept<EccentricityMap, Vertex> >(); + typedef typename property_traits<EccentricityMap>::value_type Eccentricity; + + VertexIterator i, end; + tie(i, end) = vertices(g); + Eccentricity radius = get(ecc, *i); + Eccentricity diameter = get(ecc, *i); + for(i = boost::next(i); i != end; ++i) { + Eccentricity cur = get(ecc, *i); + radius = min BOOST_PREVENT_MACRO_SUBSTITUTION (radius, cur); + diameter = max BOOST_PREVENT_MACRO_SUBSTITUTION (diameter, cur); + } + return std::make_pair(radius, diameter); +} + + +template <typename Graph, typename EccentricityMap> +inline typename property_traits<EccentricityMap>::value_type +radius(const Graph& g, EccentricityMap ecc) +{ return radius_and_diameter(g, ecc).first; } + + +template <typename Graph, typename EccentricityMap> +inline typename property_traits<EccentricityMap>::value_type +diameter(const Graph& g, EccentricityMap ecc) +{ return radius_and_diameter(g, ecc).second; } + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/edge_connectivity.hpp b/Utilities/BGL/boost/graph/edge_connectivity.hpp index d78e3ee41a322edfd4c9a2c1aa0e3f97effaf802..383ad6351e31d5593c394ae26a9795c8aa73dd59 100644 --- a/Utilities/BGL/boost/graph/edge_connectivity.hpp +++ b/Utilities/BGL/boost/graph/edge_connectivity.hpp @@ -16,7 +16,7 @@ #include <vector> #include <set> #include <algorithm> -#include <boost/graph/edmunds_karp_max_flow.hpp> +#include <boost/graph/edmonds_karp_max_flow.hpp> namespace boost { @@ -132,14 +132,15 @@ namespace boost { detail::neighbors(g, S.begin(), S.end(), std::inserter(neighbor_S, neighbor_S.begin())); - std::set_difference(vertices(g).first, vertices(g).second, + tie(vi, vi_end) = vertices(g); + std::set_difference(vi, vi_end, neighbor_S.begin(), neighbor_S.end(), std::back_inserter(non_neighbor_S)); while (!non_neighbor_S.empty()) { // at most n - 1 times k = non_neighbor_S.front(); - alpha_S_k = edmunds_karp_max_flow + alpha_S_k = edmonds_karp_max_flow (flow_g, p, k, cap, res_cap, rev_edge, &color[0], &pred[0]); if (alpha_S_k < alpha_star) { @@ -153,7 +154,8 @@ namespace boost { neighbor_S.insert(k); detail::neighbors(g, k, std::inserter(neighbor_S, neighbor_S.begin())); non_neighbor_S.clear(); - std::set_difference(vertices(g).first, vertices(g).second, + tie(vi, vi_end) = vertices(g); + std::set_difference(vi, vi_end, neighbor_S.begin(), neighbor_S.end(), std::back_inserter(non_neighbor_S)); } diff --git a/Utilities/BGL/boost/graph/edge_list.hpp b/Utilities/BGL/boost/graph/edge_list.hpp index 46fdde69eeddd2d3ecf0b746283f92b83fcfee04..32c5c25964e03b252eadf2e4580803ec380705de 100644 --- a/Utilities/BGL/boost/graph/edge_list.hpp +++ b/Utilities/BGL/boost/graph/edge_list.hpp @@ -13,7 +13,8 @@ #include <iterator> #include <boost/config.hpp> -#include <boost/pending/ct_if.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/bool.hpp> #include <boost/pending/integer_range.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/properties.hpp> @@ -241,11 +242,11 @@ namespace boost { template <class Cat> struct is_random { enum { RET = false }; - typedef false_type type; + typedef mpl::false_ type; }; template <> struct is_random<std::random_access_iterator_tag> { - enum { RET = true }; typedef true_type type; + enum { RET = true }; typedef mpl::true_ type; }; // The edge_list class conditionally inherits from one of the @@ -262,7 +263,7 @@ namespace boost { class Cat> #endif class edge_list - : public ct_if_t< typename is_random<Cat>::type, + : public mpl::if_< typename is_random<Cat>::type, edge_list_impl_ra< edge_list<EdgeIter,T,D,Cat>, EdgeIter,T,D>, edge_list_impl< edge_list<EdgeIter,T,D,Cat>, EdgeIter,T,D> >::type diff --git a/Utilities/BGL/boost/graph/edmonds_karp_max_flow.hpp b/Utilities/BGL/boost/graph/edmonds_karp_max_flow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fed4d69fbefd2671ad43ef951be29b647d996a5b --- /dev/null +++ b/Utilities/BGL/boost/graph/edmonds_karp_max_flow.hpp @@ -0,0 +1,250 @@ +//======================================================================= +// Copyright 2000 University of Notre Dame. +// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee +// +// 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 EDMONDS_KARP_MAX_FLOW_HPP +#define EDMONDS_KARP_MAX_FLOW_HPP + +#include <boost/config.hpp> +#include <vector> +#include <algorithm> // for std::min and std::max +#include <boost/config.hpp> +#include <boost/pending/queue.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/properties.hpp> +#include <boost/graph/filtered_graph.hpp> +#include <boost/graph/breadth_first_search.hpp> + +namespace boost { + + // The "labeling" algorithm from "Network Flows" by Ahuja, Magnanti, + // Orlin. I think this is the same as or very similar to the original + // Edmonds-Karp algorithm. This solves the maximum flow problem. + + namespace detail { + + template <class Graph, class ResCapMap> + filtered_graph<Graph, is_residual_edge<ResCapMap> > + residual_graph(Graph& g, ResCapMap residual_capacity) { + return filtered_graph<Graph, is_residual_edge<ResCapMap> > + (g, is_residual_edge<ResCapMap>(residual_capacity)); + } + + template <class Graph, class PredEdgeMap, class ResCapMap, + class RevEdgeMap> + inline void + augment(Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + PredEdgeMap p, + ResCapMap residual_capacity, + RevEdgeMap reverse_edge) + { + typename graph_traits<Graph>::edge_descriptor e; + typename graph_traits<Graph>::vertex_descriptor u; + typedef typename property_traits<ResCapMap>::value_type FlowValue; + + // find minimum residual capacity along the augmenting path + FlowValue delta = (std::numeric_limits<FlowValue>::max)(); + e = p[sink]; + do { + BOOST_USING_STD_MIN(); + delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[e]); + u = source(e, g); + e = p[u]; + } while (u != src); + + // push delta units of flow along the augmenting path + e = p[sink]; + do { + residual_capacity[e] -= delta; + residual_capacity[reverse_edge[e]] += delta; + u = source(e, g); + e = p[u]; + } while (u != src); + } + + } // namespace detail + + template <class Graph, + class CapacityEdgeMap, class ResidualCapacityEdgeMap, + class ReverseEdgeMap, class ColorMap, class PredEdgeMap> + typename property_traits<CapacityEdgeMap>::value_type + edmonds_karp_max_flow + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res, + ReverseEdgeMap rev, + ColorMap color, + PredEdgeMap pred) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename property_traits<ColorMap>::value_type ColorValue; + typedef color_traits<ColorValue> Color; + + typename graph_traits<Graph>::vertex_iterator u_iter, u_end; + typename graph_traits<Graph>::out_edge_iterator ei, e_end; + for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) + for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) + res[*ei] = cap[*ei]; + + color[sink] = Color::gray(); + while (color[sink] != Color::white()) { + boost::queue<vertex_t> Q; + breadth_first_search + (detail::residual_graph(g, res), src, Q, + make_bfs_visitor(record_edge_predecessors(pred, on_tree_edge())), + color); + if (color[sink] != Color::white()) + detail::augment(g, src, sink, pred, res, rev); + } // while + + typename property_traits<CapacityEdgeMap>::value_type flow = 0; + for (tie(ei, e_end) = out_edges(src, g); ei != e_end; ++ei) + flow += (cap[*ei] - res[*ei]); + return flow; + } // edmonds_karp_max_flow() + + namespace detail { + //------------------------------------------------------------------------- + // Handle default for color property map + + // use of class here is a VC++ workaround + template <class ColorMap> + struct edmonds_karp_dispatch2 { + template <class Graph, class PredMap, class P, class T, class R> + static typename edge_capacity_value<Graph, P, T, R>::type + apply + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + PredMap pred, + const bgl_named_params<P, T, R>& params, + ColorMap color) + { + return edmonds_karp_max_flow + (g, src, sink, + choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), + choose_pmap(get_param(params, edge_residual_capacity), + g, edge_residual_capacity), + choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), + color, pred); + } + }; + template<> + struct edmonds_karp_dispatch2<detail::error_property_not_found> { + template <class Graph, class PredMap, class P, class T, class R> + static typename edge_capacity_value<Graph, P, T, R>::type + apply + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + PredMap pred, + const bgl_named_params<P, T, R>& params, + detail::error_property_not_found) + { + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type size_type; + size_type n = is_default_param(get_param(params, vertex_color)) ? + num_vertices(g) : 1; + std::vector<default_color_type> color_vec(n); + return edmonds_karp_max_flow + (g, src, sink, + choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), + choose_pmap(get_param(params, edge_residual_capacity), + g, edge_residual_capacity), + choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), + make_iterator_property_map(color_vec.begin(), choose_const_pmap + (get_param(params, vertex_index), + g, vertex_index), color_vec[0]), + pred); + } + }; + + //------------------------------------------------------------------------- + // Handle default for predecessor property map + + // use of class here is a VC++ workaround + template <class PredMap> + struct edmonds_karp_dispatch1 { + template <class Graph, class P, class T, class R> + static typename edge_capacity_value<Graph, P, T, R>::type + apply(Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + const bgl_named_params<P, T, R>& params, + PredMap pred) + { + typedef typename property_value< bgl_named_params<P,T,R>, vertex_color_t>::type C; + return edmonds_karp_dispatch2<C>::apply + (g, src, sink, pred, params, get_param(params, vertex_color)); + } + }; + template<> + struct edmonds_karp_dispatch1<detail::error_property_not_found> { + + template <class Graph, class P, class T, class R> + static typename edge_capacity_value<Graph, P, T, R>::type + apply + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + const bgl_named_params<P, T, R>& params, + detail::error_property_not_found) + { + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type size_type; + size_type n = is_default_param(get_param(params, vertex_predecessor)) ? + num_vertices(g) : 1; + std::vector<edge_descriptor> pred_vec(n); + + typedef typename property_value< bgl_named_params<P,T,R>, vertex_color_t>::type C; + return edmonds_karp_dispatch2<C>::apply + (g, src, sink, + make_iterator_property_map(pred_vec.begin(), choose_const_pmap + (get_param(params, vertex_index), + g, vertex_index), pred_vec[0]), + params, + get_param(params, vertex_color)); + } + }; + + } // namespace detail + + template <class Graph, class P, class T, class R> + typename detail::edge_capacity_value<Graph, P, T, R>::type + edmonds_karp_max_flow + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + const bgl_named_params<P, T, R>& params) + { + typedef typename property_value< bgl_named_params<P,T,R>, vertex_predecessor_t>::type Pred; + return detail::edmonds_karp_dispatch1<Pred>::apply + (g, src, sink, params, get_param(params, vertex_predecessor)); + } + + template <class Graph> + typename property_traits< + typename property_map<Graph, edge_capacity_t>::const_type + >::value_type + edmonds_karp_max_flow + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink) + { + bgl_named_params<int, buffer_param_t> params(0); + return edmonds_karp_max_flow(g, src, sink, params); + } + +} // namespace boost + +#endif // EDMONDS_KARP_MAX_FLOW_HPP diff --git a/Utilities/BGL/boost/graph/edmunds_karp_max_flow.hpp b/Utilities/BGL/boost/graph/edmunds_karp_max_flow.hpp index ddb49dc6d6680189a8d4b4934b0a4e5fa0baae5b..3697db20801391f40896b24ccc47fd681b7536d5 100644 --- a/Utilities/BGL/boost/graph/edmunds_karp_max_flow.hpp +++ b/Utilities/BGL/boost/graph/edmunds_karp_max_flow.hpp @@ -1,250 +1,19 @@ //======================================================================= -// Copyright 2000 University of Notre Dame. -// Authors: Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at +// (c) Copyright Juergen Hunold 2008 +// 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) //======================================================================= -#ifndef EDMUNDS_KARP_MAX_FLOW_HPP -#define EDMUNDS_KARP_MAX_FLOW_HPP +#ifndef BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP +#define BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP -#include <boost/config.hpp> -#include <vector> -#include <algorithm> // for std::min and std::max -#include <boost/config.hpp> -#include <boost/pending/queue.hpp> -#include <boost/property_map.hpp> -#include <boost/graph/graph_traits.hpp> -#include <boost/graph/properties.hpp> -#include <boost/graph/filtered_graph.hpp> -#include <boost/graph/breadth_first_search.hpp> +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/graph/edmonds_karp_max_flow.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/graph/edmonds_karp_max_flow.hpp" +#endif -namespace boost { +#include <boost/graph/edmonds_karp_max_flow.hpp> - // The "labeling" algorithm from "Network Flows" by Ahuja, Magnanti, - // Orlin. I think this is the same as or very similar to the original - // Edmunds-Karp algorithm. This solves the maximum flow problem. - - namespace detail { - - template <class Graph, class ResCapMap> - filtered_graph<Graph, is_residual_edge<ResCapMap> > - residual_graph(Graph& g, ResCapMap residual_capacity) { - return filtered_graph<Graph, is_residual_edge<ResCapMap> > - (g, is_residual_edge<ResCapMap>(residual_capacity)); - } - - template <class Graph, class PredEdgeMap, class ResCapMap, - class RevEdgeMap> - inline void - augment(Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink, - PredEdgeMap p, - ResCapMap residual_capacity, - RevEdgeMap reverse_edge) - { - typename graph_traits<Graph>::edge_descriptor e; - typename graph_traits<Graph>::vertex_descriptor u; - typedef typename property_traits<ResCapMap>::value_type FlowValue; - - // find minimum residual capacity along the augmenting path - FlowValue delta = (std::numeric_limits<FlowValue>::max)(); - e = p[sink]; - do { - BOOST_USING_STD_MIN(); - delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[e]); - u = source(e, g); - e = p[u]; - } while (u != src); - - // push delta units of flow along the augmenting path - e = p[sink]; - do { - residual_capacity[e] -= delta; - residual_capacity[reverse_edge[e]] += delta; - u = source(e, g); - e = p[u]; - } while (u != src); - } - - } // namespace detail - - template <class Graph, - class CapacityEdgeMap, class ResidualCapacityEdgeMap, - class ReverseEdgeMap, class ColorMap, class PredEdgeMap> - typename property_traits<CapacityEdgeMap>::value_type - edmunds_karp_max_flow - (Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink, - CapacityEdgeMap cap, - ResidualCapacityEdgeMap res, - ReverseEdgeMap rev, - ColorMap color, - PredEdgeMap pred) - { - typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; - typedef typename property_traits<ColorMap>::value_type ColorValue; - typedef color_traits<ColorValue> Color; - - typename graph_traits<Graph>::vertex_iterator u_iter, u_end; - typename graph_traits<Graph>::out_edge_iterator ei, e_end; - for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) - for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei) - res[*ei] = cap[*ei]; - - color[sink] = Color::gray(); - while (color[sink] != Color::white()) { - boost::queue<vertex_t> Q; - breadth_first_search - (detail::residual_graph(g, res), src, Q, - make_bfs_visitor(record_edge_predecessors(pred, on_tree_edge())), - color); - if (color[sink] != Color::white()) - detail::augment(g, src, sink, pred, res, rev); - } // while - - typename property_traits<CapacityEdgeMap>::value_type flow = 0; - for (tie(ei, e_end) = out_edges(src, g); ei != e_end; ++ei) - flow += (cap[*ei] - res[*ei]); - return flow; - } // edmunds_karp_max_flow() - - namespace detail { - //------------------------------------------------------------------------- - // Handle default for color property map - - // use of class here is a VC++ workaround - template <class ColorMap> - struct edmunds_karp_dispatch2 { - template <class Graph, class PredMap, class P, class T, class R> - static typename edge_capacity_value<Graph, P, T, R>::type - apply - (Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink, - PredMap pred, - const bgl_named_params<P, T, R>& params, - ColorMap color) - { - return edmunds_karp_max_flow - (g, src, sink, - choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), - choose_pmap(get_param(params, edge_residual_capacity), - g, edge_residual_capacity), - choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), - color, pred); - } - }; - template<> - struct edmunds_karp_dispatch2<detail::error_property_not_found> { - template <class Graph, class PredMap, class P, class T, class R> - static typename edge_capacity_value<Graph, P, T, R>::type - apply - (Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink, - PredMap pred, - const bgl_named_params<P, T, R>& params, - detail::error_property_not_found) - { - typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; - typedef typename graph_traits<Graph>::vertices_size_type size_type; - size_type n = is_default_param(get_param(params, vertex_color)) ? - num_vertices(g) : 1; - std::vector<default_color_type> color_vec(n); - return edmunds_karp_max_flow - (g, src, sink, - choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), - choose_pmap(get_param(params, edge_residual_capacity), - g, edge_residual_capacity), - choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), - make_iterator_property_map(color_vec.begin(), choose_const_pmap - (get_param(params, vertex_index), - g, vertex_index), color_vec[0]), - pred); - } - }; - - //------------------------------------------------------------------------- - // Handle default for predecessor property map - - // use of class here is a VC++ workaround - template <class PredMap> - struct edmunds_karp_dispatch1 { - template <class Graph, class P, class T, class R> - static typename edge_capacity_value<Graph, P, T, R>::type - apply(Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink, - const bgl_named_params<P, T, R>& params, - PredMap pred) - { - typedef typename property_value< bgl_named_params<P,T,R>, vertex_color_t>::type C; - return edmunds_karp_dispatch2<C>::apply - (g, src, sink, pred, params, get_param(params, vertex_color)); - } - }; - template<> - struct edmunds_karp_dispatch1<detail::error_property_not_found> { - - template <class Graph, class P, class T, class R> - static typename edge_capacity_value<Graph, P, T, R>::type - apply - (Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink, - const bgl_named_params<P, T, R>& params, - detail::error_property_not_found) - { - typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; - typedef typename graph_traits<Graph>::vertices_size_type size_type; - size_type n = is_default_param(get_param(params, vertex_predecessor)) ? - num_vertices(g) : 1; - std::vector<edge_descriptor> pred_vec(n); - - typedef typename property_value< bgl_named_params<P,T,R>, vertex_color_t>::type C; - return edmunds_karp_dispatch2<C>::apply - (g, src, sink, - make_iterator_property_map(pred_vec.begin(), choose_const_pmap - (get_param(params, vertex_index), - g, vertex_index), pred_vec[0]), - params, - get_param(params, vertex_color)); - } - }; - - } // namespace detail - - template <class Graph, class P, class T, class R> - typename detail::edge_capacity_value<Graph, P, T, R>::type - edmunds_karp_max_flow - (Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink, - const bgl_named_params<P, T, R>& params) - { - typedef typename property_value< bgl_named_params<P,T,R>, vertex_predecessor_t>::type Pred; - return detail::edmunds_karp_dispatch1<Pred>::apply - (g, src, sink, params, get_param(params, vertex_predecessor)); - } - - template <class Graph> - typename property_traits< - typename property_map<Graph, edge_capacity_t>::const_type - >::value_type - edmunds_karp_max_flow - (Graph& g, - typename graph_traits<Graph>::vertex_descriptor src, - typename graph_traits<Graph>::vertex_descriptor sink) - { - bgl_named_params<int, buffer_param_t> params(0); - return edmunds_karp_max_flow(g, src, sink, params); - } - -} // namespace boost - -#endif // EDMUNDS_KARP_MAX_FLOW_HPP +#endif // BOOST_DEPRECATED_INCLUDE_EDMONDS_KARP_MAX_FLOW_HPP diff --git a/Utilities/BGL/boost/graph/erdos_renyi_generator.hpp b/Utilities/BGL/boost/graph/erdos_renyi_generator.hpp index 7d2250705f7992aed5e0a512f0dad6661b8aab44..a459441683b265af066b0ced0b2d1888a9fda671 100644 --- a/Utilities/BGL/boost/graph/erdos_renyi_generator.hpp +++ b/Utilities/BGL/boost/graph/erdos_renyi_generator.hpp @@ -1,25 +1,39 @@ -// Copyright 2004 The Trustees of Indiana University. +// Copyright 2004, 2005 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) -// Authors: Douglas Gregor +// Authors: Jeremiah Willcock +// Douglas Gregor // Andrew Lumsdaine #ifndef BOOST_GRAPH_ERDOS_RENYI_GENERATOR_HPP #define BOOST_GRAPH_ERDOS_RENYI_GENERATOR_HPP +#include <cassert> #include <iterator> #include <utility> +#include <boost/shared_ptr.hpp> #include <boost/random/uniform_int.hpp> #include <boost/graph/graph_traits.hpp> -#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/random/geometric_distribution.hpp> +#include <boost/type_traits/is_base_of.hpp> #include <boost/type_traits/is_same.hpp> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/iterator/iterator_facade.hpp> namespace boost { template<typename RandomGenerator, typename Graph> class erdos_renyi_iterator + : public iterator_facade< + erdos_renyi_iterator<RandomGenerator, Graph>, + std::pair<typename graph_traits<Graph>::vertices_size_type, + typename graph_traits<Graph>::vertices_size_type>, + std::input_iterator_tag, + const + std::pair<typename graph_traits<Graph>::vertices_size_type, + typename graph_traits<Graph>::vertices_size_type>&> { typedef typename graph_traits<Graph>::directed_category directed_category; typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; @@ -27,50 +41,38 @@ namespace boost { BOOST_STATIC_CONSTANT (bool, - is_undirected = (is_base_and_derived<undirected_tag, - directed_category>::value - || is_same<undirected_tag, directed_category>::value)); + is_undirected = (is_base_of<undirected_tag, directed_category>::value)); public: - typedef std::input_iterator_tag iterator_category; - typedef std::pair<vertices_size_type, vertices_size_type> value_type; - typedef const value_type& reference; - typedef const value_type* pointer; - typedef void difference_type; - - erdos_renyi_iterator() : gen(0), n(0), edges(0), allow_self_loops(false) {} - erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, - double prob = 0.0, bool allow_self_loops = false) - : gen(&gen), n(n), edges(edges_size_type(prob * n * n)), + erdos_renyi_iterator() : gen(), n(0), edges(0), allow_self_loops(false) {} + erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, + double fraction = 0.0, bool allow_self_loops = false) + : gen(&gen), n(n), edges(edges_size_type(fraction * n * n)), allow_self_loops(allow_self_loops) - { + { if (is_undirected) edges = edges / 2; - next(); + next(); } - reference operator*() const { return current; } - pointer operator->() const { return ¤t; } - - erdos_renyi_iterator& operator++() - { - --edges; + erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, + edges_size_type m, bool allow_self_loops = false) + : gen(&gen), n(n), edges(m), + allow_self_loops(allow_self_loops) + { next(); - return *this; } - erdos_renyi_iterator operator++(int) - { - erdos_renyi_iterator temp(*this); - ++(*this); - return temp; + const std::pair<vertices_size_type, vertices_size_type>& + dereference() const { return current; } + + void increment() { + --edges; + next(); } - bool operator==(const erdos_renyi_iterator& other) const + bool equal(const erdos_renyi_iterator& other) const { return edges == other.edges; } - bool operator!=(const erdos_renyi_iterator& other) const - { return !(*this == other); } - private: void next() { @@ -85,7 +87,107 @@ namespace boost { vertices_size_type n; edges_size_type edges; bool allow_self_loops; - value_type current; + std::pair<vertices_size_type, vertices_size_type> current; + }; + + template<typename RandomGenerator, typename Graph> + class sorted_erdos_renyi_iterator + : public iterator_facade< + sorted_erdos_renyi_iterator<RandomGenerator, Graph>, + std::pair<typename graph_traits<Graph>::vertices_size_type, + typename graph_traits<Graph>::vertices_size_type>, + std::input_iterator_tag, + const + std::pair<typename graph_traits<Graph>::vertices_size_type, + typename graph_traits<Graph>::vertices_size_type>&> + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + BOOST_STATIC_CONSTANT + (bool, + is_undirected = (is_base_of<undirected_tag, directed_category>::value)); + + public: + sorted_erdos_renyi_iterator() + : gen(), rand_vertex(0.5), n(0), allow_self_loops(false) + , src((std::numeric_limits<vertices_size_type>::max)()), + tgt_index(vertices_size_type(-1)), prob(.5) + { } + + // NOTE: The default probability has been changed to be the same as that + // used by the geometic distribution. It was previously 0.0, which would + // cause an assertion. + sorted_erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, + double prob = 0.5, + bool loops = false) + : gen(), rand_vertex(1. - prob), n(n), allow_self_loops(loops), src(0) + , tgt_index(vertices_size_type(-1)), prob(prob) + { + this->gen.reset(new uniform_01<RandomGenerator*>(&gen)); + + if (prob == 0.0) {src = (std::numeric_limits<vertices_size_type>::max)(); return;} + next(); + } + + const std::pair<vertices_size_type, vertices_size_type>& + dereference() const { + return current; + } + + bool equal(const sorted_erdos_renyi_iterator& o) const { + return src == o.src && tgt_index == o.tgt_index; + } + + void increment() { + next(); + } + + private: + void next() + { + // In order to get the edges from the generator in sorted order, one + // effective (but slow) procedure would be to use a + // bernoulli_distribution for each legal (src, tgt_index) pair. Because of + // the O(|V|^2) cost of that, a geometric distribution is used. The + // geometric distribution tells how many times the + // bernoulli_distribution would need to be run until it returns true. + // Thus, this distribution can be used to step through the edges + // which are actually present. + assert (src != (std::numeric_limits<vertices_size_type>::max)() && + src != n); + while (src != n) { + vertices_size_type increment = rand_vertex(*gen); + size_t tgt_index_limit = + (is_undirected ? src + 1 : n) + + (allow_self_loops ? 0 : -1); + if (tgt_index + increment >= tgt_index_limit) { + // Overflowed this source; go to the next one and try again. + ++src; + // This bias is because the geometric distribution always returns + // values >=1, and we want to allow 0 as a valid target. + tgt_index = vertices_size_type(-1); + continue; + } else { + tgt_index += increment; + current.first = src; + current.second = + tgt_index + + (!allow_self_loops && !is_undirected && tgt_index >= src ? 1 : 0); + break; + } + } + if (src == n) src = (std::numeric_limits<vertices_size_type>::max)(); + } + + shared_ptr<uniform_01<RandomGenerator*> > gen; + geometric_distribution<vertices_size_type> rand_vertex; + vertices_size_type n; + bool allow_self_loops; + vertices_size_type src, tgt_index; + std::pair<vertices_size_type, vertices_size_type> current; + double prob; }; } // end namespace boost diff --git a/Utilities/BGL/boost/graph/exception.hpp b/Utilities/BGL/boost/graph/exception.hpp index 09c82edc3c8890822bc471735b9e25fba494dbec..382d671928eb6f804462163f1c768c7a9d349900 100644 --- a/Utilities/BGL/boost/graph/exception.hpp +++ b/Utilities/BGL/boost/graph/exception.hpp @@ -15,29 +15,40 @@ namespace boost { - struct bad_graph : public std::invalid_argument { - bad_graph(const std::string& what_arg) - : std::invalid_argument(what_arg) { } - }; - - struct not_a_dag : public bad_graph { - not_a_dag() - : bad_graph("The graph must be a DAG.") { } - }; - - struct negative_edge : public bad_graph { - negative_edge() - : bad_graph("The graph may not contain an edge with negative weight."){ } - }; - - struct negative_cycle : public bad_graph { - negative_cycle() - : bad_graph("The graph may not contain negative cycles.") { } - }; - struct not_connected : public bad_graph { - not_connected() - : bad_graph("The graph must be connected.") { } - }; + struct bad_graph : public std::invalid_argument { + bad_graph(const std::string& what_arg) + : std::invalid_argument(what_arg) { } + }; + + struct not_a_dag : public bad_graph { + not_a_dag() + : bad_graph("The graph must be a DAG.") + { } + }; + + struct negative_edge : public bad_graph { + negative_edge() + : bad_graph("The graph may not contain an edge with negative weight.") + { } + }; + + struct negative_cycle : public bad_graph { + negative_cycle() + : bad_graph("The graph may not contain negative cycles.") + { } + }; + + struct not_connected : public bad_graph { + not_connected() + : bad_graph("The graph must be connected.") + { } + }; + + struct not_complete : public bad_graph { + not_complete() + : bad_graph("The graph must be complete.") + { } + }; } // namespace boost diff --git a/Utilities/BGL/boost/graph/exterior_property.hpp b/Utilities/BGL/boost/graph/exterior_property.hpp new file mode 100644 index 0000000000000000000000000000000000000000..af6df8180bfab09847a556135c9b3b4a8132fe75 --- /dev/null +++ b/Utilities/BGL/boost/graph/exterior_property.hpp @@ -0,0 +1,117 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_EXTERIOR_PROPERTY_HPP +#define BOOST_GRAPH_EXTERIOR_PROPERTY_HPP + +#include <vector> +#include <boost/graph/property_maps/container_property_map.hpp> +#include <boost/graph/property_maps/matrix_property_map.hpp> + +namespace boost { +namespace detail { + // The vector matrix provides a little abstraction over vector + // types that makes matrices easier to work with. Note that it's + // non-copyable, meaning you should be passing it by value. + template <typename Value> + struct vector_matrix + { + typedef std::vector<Value> container_type; + typedef std::vector<container_type> matrix_type; + + typedef container_type value_type; + typedef container_type& reference; + typedef const container_type const_reference; + typedef container_type* pointer; + typedef typename matrix_type::size_type size_type; + + // Instantiate the matrix over n elements (creates an nxn matrix). + // The graph has to be passed in order to ensure the index maps + // are constructed correctly when returning indexible elements. + inline vector_matrix(size_type n) + : m_matrix(n, container_type(n)) + { } + + inline reference operator [](size_type n) + { return m_matrix[n]; } + + inline const_reference operator [](size_type n) const + { return m_matrix[n]; } + + matrix_type m_matrix; + }; +} /* namespace detail */ + +/** + * The exterior_property metafunction defines an appropriate set of types for + * creating an exterior property. An exterior property is comprised of a both + * a container and a property map that acts as its abstraction. An extension + * of this metafunction will select an appropriate "matrix" property that + * records values for pairs of vertices. + * + * @todo This does not currently support the ability to define exterior + * properties for graph types that do not model the IndexGraph concepts. A + * solution should not be especially difficult, but will require an extension + * of type traits to affect the type selection. + */ +template <typename Graph, typename Key, typename Value> +struct exterior_property +{ + typedef Key key_type; + typedef Value value_type; + + typedef std::vector<Value> container_type; + typedef container_property_map<Graph, Key, container_type> map_type; + + typedef detail::vector_matrix<Value> matrix_type; + typedef matrix_property_map<Graph, Key, matrix_type> matrix_map_type; + +private: + exterior_property() { } + exterior_property(const exterior_property&) { } +}; + +/** + * Define a the container and property map types requried to create an exterior + * vertex property for the given value type. The Graph parameter is required to + * model the VertexIndexGraph concept. + */ +template <typename Graph, typename Value> +struct exterior_vertex_property +{ + typedef exterior_property< + Graph, typename graph_traits<Graph>::vertex_descriptor, Value + > property_type; + typedef typename property_type::key_type key_type; + typedef typename property_type::value_type value_type; + typedef typename property_type::container_type container_type; + typedef typename property_type::map_type map_type; + typedef typename property_type::matrix_type matrix_type; + typedef typename property_type::matrix_map_type matrix_map_type; +}; + +/** + * Define a the container and property map types requried to create an exterior + * edge property for the given value type. The Graph parameter is required to + * model the EdgeIndexGraph concept. + */ +template <typename Graph, typename Value> +struct exterior_edge_property +{ + typedef exterior_property< + Graph, typename graph_traits<Graph>::edge_descriptor, Value + > property_type; + typedef typename property_type::key_type key_type; + typedef typename property_type::value_type value_type; + typedef typename property_type::container_type container_type; + typedef typename property_type::map_type map_type; + typedef typename property_type::matrix_type matrix_type; + typedef typename property_type::matrix_map_type matrix_map_type; +}; + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/filtered_graph.hpp b/Utilities/BGL/boost/graph/filtered_graph.hpp index 389ea21e2ef927d9fbbd7c6f6d5049dfe0265c71..4c5f1783f7a2a2a31fbacd3300d39253e8c8ba5d 100644 --- a/Utilities/BGL/boost/graph/filtered_graph.hpp +++ b/Utilities/BGL/boost/graph/filtered_graph.hpp @@ -192,8 +192,6 @@ namespace boost { > edge_iterator; typedef typename Traits::edges_size_type edges_size_type; - typedef typename ::boost::edge_property_type<Graph>::type edge_property_type; - typedef typename ::boost::vertex_property_type<Graph>::type vertex_property_type; typedef filtered_graph_tag graph_tag; #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES @@ -209,11 +207,32 @@ namespace boost { { return this->m_g[x]; } #endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES + static vertex_descriptor null_vertex() + { + return Graph::null_vertex(); + } + //private: EdgePredicate m_edge_pred; VertexPredicate m_vertex_pred; }; + // Do not instantiate these unless needed + template <typename Graph, + typename EdgePredicate, + typename VertexPredicate> + struct vertex_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> > { + typedef typename vertex_property_type<Graph>::type type; + }; + + template <typename Graph, + typename EdgePredicate, + typename VertexPredicate> + struct edge_property_type<filtered_graph<Graph, EdgePredicate, VertexPredicate> > { + typedef typename edge_property_type<Graph>::type type; + }; + + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template<typename Graph, typename EdgePredicate, typename VertexPredicate> struct vertex_bundle_type<filtered_graph<Graph, EdgePredicate, @@ -241,6 +260,17 @@ namespace boost { return filtered_graph<Graph, EdgePredicate, VertexPredicate>(g, ep, vp); } + template <typename Graph, typename EdgePredicate> + inline filtered_graph<const Graph, EdgePredicate> + make_filtered_graph(const Graph& g, EdgePredicate ep) { + return filtered_graph<const Graph, EdgePredicate>(g, ep); + } + template <typename Graph, typename EdgePredicate, typename VertexPredicate> + inline filtered_graph<const Graph, EdgePredicate, VertexPredicate> + make_filtered_graph(const Graph& g, EdgePredicate ep, VertexPredicate vp) { + return filtered_graph<const Graph, EdgePredicate, VertexPredicate>(g, ep, vp); + } + template <typename G, typename EP, typename VP> std::pair<typename filtered_graph<G, EP, VP>::vertex_iterator, typename filtered_graph<G, EP, VP>::vertex_iterator> @@ -484,6 +514,23 @@ namespace boost { return Filter(g, keep_all(), p); } + // Filter that uses a property map whose value_type is a boolean + template <typename PropertyMap> + struct property_map_filter { + + property_map_filter() { } + + property_map_filter(const PropertyMap& property_map) : + m_property_map(property_map) { } + + template <typename Key> + bool operator()(const Key& key) const { + return (get(m_property_map, key)); + } + + private : + PropertyMap m_property_map; + }; } // namespace boost diff --git a/Utilities/BGL/boost/graph/floyd_warshall_shortest.hpp b/Utilities/BGL/boost/graph/floyd_warshall_shortest.hpp index a45aed90d83ad547d115d155b4a920130e56d95f..87c3453bf4719266123a852b3cb2cbdf2503823c 100644 --- a/Utilities/BGL/boost/graph/floyd_warshall_shortest.hpp +++ b/Utilities/BGL/boost/graph/floyd_warshall_shortest.hpp @@ -1,7 +1,7 @@ // Copyright 2002 Rensselaer Polytechnic Institute -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Lauren Foutz @@ -29,16 +29,22 @@ #ifndef BOOST_GRAPH_FLOYD_WARSHALL_HPP #define BOOST_GRAPH_FLOYD_WARSHALL_HPP -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/named_function_params.hpp> #include <boost/graph/graph_concepts.hpp> #include <boost/graph/relax.hpp> -#include <algorithm> // for std::min and std::max namespace boost { namespace detail { + template<typename T, typename BinaryPredicate> + T min_with_compare(const T& x, const T& y, const BinaryPredicate& compare) + { + if (compare(x, y)) return x; + else return y; + } + template<typename VertexListGraph, typename DistanceMatrix, typename BinaryPredicate, typename BinaryFunction, typename Infinity, typename Zero> @@ -47,21 +53,21 @@ namespace boost const BinaryFunction &combine, const Infinity& inf, const Zero& zero) { - BOOST_USING_STD_MIN(); - typename graph_traits<VertexListGraph>::vertex_iterator i, lasti, j, lastj, k, lastk; for (tie(k, lastk) = vertices(g); k != lastk; k++) for (tie(i, lasti) = vertices(g); i != lasti; i++) - for (tie(j, lastj) = vertices(g); j != lastj; j++) - { - d[*i][*j] = min BOOST_PREVENT_MACRO_SUBSTITUTION - (d[*i][*j], combine(d[*i][*k], d[*k][*j])); - } + if(d[*i][*k] != inf) + for (tie(j, lastj) = vertices(g); j != lastj; j++) + if(d[*k][*j] != inf) + d[*i][*j] = + detail::min_with_compare(d[*i][*j], + combine(d[*i][*k], d[*k][*j]), + compare); + - for (tie(i, lasti) = vertices(g); i != lasti; i++) if (compare(d[*i][*i], zero)) return false; @@ -95,8 +101,6 @@ namespace boost const BinaryPredicate& compare, const BinaryFunction& combine, const Infinity& inf, const Zero& zero) { - BOOST_USING_STD_MIN(); - function_requires<VertexListGraphConcept<VertexAndEdgeListGraph> >(); function_requires<EdgeListGraphConcept<VertexAndEdgeListGraph> >(); function_requires<IncidenceGraphConcept<VertexAndEdgeListGraph> >(); @@ -112,16 +116,18 @@ namespace boost for(tie(firstv, lastv) = vertices(g); firstv != lastv; firstv++) - d[*firstv][*firstv] = 0; + d[*firstv][*firstv] = zero; for(tie(first, last) = edges(g); first != last; first++) { - if (d[source(*first, g)][target(*first, g)] != inf) + if (d[source(*first, g)][target(*first, g)] != inf) { d[source(*first, g)][target(*first, g)] = - min BOOST_PREVENT_MACRO_SUBSTITUTION(get(w, *first), - d[source(*first, g)][target(*first, g)]); - else + detail::min_with_compare( + get(w, *first), + d[source(*first, g)][target(*first, g)], + compare); + } else d[source(*first, g)][target(*first, g)] = get(w, *first); } @@ -134,8 +140,10 @@ namespace boost { if (d[target(*first, g)][source(*first, g)] != inf) d[target(*first, g)][source(*first, g)] = - min BOOST_PREVENT_MACRO_SUBSTITUTION(get(w, *first), - d[target(*first, g)][source(*first, g)]); + detail::min_with_compare( + get(w, *first), + d[target(*first, g)][source(*first, g)], + compare); else d[target(*first, g)][source(*first, g)] = get(w, *first); } @@ -151,7 +159,7 @@ namespace boost template <class VertexListGraph, class DistanceMatrix, class WeightMap, class P, class T, class R> bool floyd_warshall_init_dispatch(const VertexListGraph& g, - DistanceMatrix& d, WeightMap w, + DistanceMatrix& d, WeightMap /*w*/, const bgl_named_params<P, T, R>& params) { typedef typename property_traits<WeightMap>::value_type WM; diff --git a/Utilities/BGL/boost/graph/fruchterman_reingold.hpp b/Utilities/BGL/boost/graph/fruchterman_reingold.hpp index df0208928d2d940db084a454865f2419e8e5a49c..0da35167c3d51ed5fc4e4b8994c0b60606ec6b15 100644 --- a/Utilities/BGL/boost/graph/fruchterman_reingold.hpp +++ b/Utilities/BGL/boost/graph/fruchterman_reingold.hpp @@ -1,7 +1,7 @@ -// Copyright 2004 The Trustees of Indiana University. +// Copyright 2004, 2005 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -9,13 +9,17 @@ #ifndef BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP #define BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP -#include <cmath> +#include <boost/config/no_tr1/cmath.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/named_function_params.hpp> -#include <boost/graph/simple_point.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/graph/topology.hpp> // For topology concepts #include <vector> #include <list> #include <algorithm> // for std::min and std::max +#include <numeric> // for std::accumulate +#include <cmath> // for std::sqrt and std::fabs +#include <functional> namespace boost { @@ -84,18 +88,20 @@ struct all_force_pairs } }; -template<typename Dim, typename PositionMap> +template<typename Topology, typename PositionMap> struct grid_force_pairs { + typedef typename property_traits<PositionMap>::value_type Point; + BOOST_STATIC_ASSERT (Point::dimensions == 2); + typedef typename Topology::point_difference_type point_difference_type; + template<typename Graph> explicit - grid_force_pairs(Dim width, Dim height, PositionMap position, const Graph& g) - : width(width), height(height), position(position) + grid_force_pairs(const Topology& topology, + PositionMap position, const Graph& g) + : topology(topology), position(position) { -#ifndef BOOST_NO_STDC_NAMESPACE - using std::sqrt; -#endif // BOOST_NO_STDC_NAMESPACE - two_k = Dim(2) * sqrt(width*height / num_vertices(g)); + two_k = 2. * this->topology.volume(this->topology.extent()) / std::sqrt((double)num_vertices(g)); } template<typename Graph, typename ApplyForce > @@ -106,13 +112,15 @@ struct grid_force_pairs typedef std::list<vertex_descriptor> bucket_t; typedef std::vector<bucket_t> buckets_t; - std::size_t columns = std::size_t(width / two_k + Dim(1)); - std::size_t rows = std::size_t(height / two_k + Dim(1)); + std::size_t columns = std::size_t(topology.extent()[0] / two_k + 1.); + std::size_t rows = std::size_t(topology.extent()[1] / two_k + 1.); buckets_t buckets(rows * columns); vertex_iterator v, v_end; for (tie(v, v_end) = vertices(g); v != v_end; ++v) { - std::size_t column = std::size_t((position[*v].x + width / 2) / two_k); - std::size_t row = std::size_t((position[*v].y + height / 2) / two_k); + std::size_t column = + std::size_t((get(position, *v)[0] + topology.extent()[0] / 2) / two_k); + std::size_t row = + std::size_t((get(position, *v)[1] + topology.extent()[1] / 2) / two_k); if (column >= columns) column = columns - 1; if (row >= rows) row = rows - 1; @@ -137,146 +145,162 @@ struct grid_force_pairs std::size_t adj_end_column = column == columns - 1? column : column + 1; for (std::size_t other_row = adj_start_row; other_row <= adj_end_row; ++other_row) - for (std::size_t other_column = adj_start_column; + for (std::size_t other_column = adj_start_column; other_column <= adj_end_column; ++other_column) if (other_row != row || other_column != column) { // Repulse vertices in this bucket - bucket_t& other_bucket + bucket_t& other_bucket = buckets[other_row * columns + other_column]; - for (v = other_bucket.begin(); v != other_bucket.end(); ++v) - apply_force(*u, *v); + for (v = other_bucket.begin(); v != other_bucket.end(); ++v) { + double dist = + topology.distance(get(position, *u), get(position, *v)); + if (dist < two_k) apply_force(*u, *v); + } } } } } private: - Dim width; - Dim height; + const Topology& topology; PositionMap position; - Dim two_k; + double two_k; }; -template<typename Dim, typename PositionMap, typename Graph> -inline grid_force_pairs<Dim, PositionMap> -make_grid_force_pairs(Dim width, Dim height, const PositionMap& position, - const Graph& g) -{ return grid_force_pairs<Dim, PositionMap>(width, height, position, g); } +template<typename PositionMap, typename Topology, typename Graph> +inline grid_force_pairs<Topology, PositionMap> +make_grid_force_pairs + (const Topology& topology, + const PositionMap& position, const Graph& g) +{ return grid_force_pairs<Topology, PositionMap>(topology, position, g); } -template<typename Graph, typename PositionMap, typename Dim> +template<typename Graph, typename PositionMap, typename Topology> void -scale_graph(const Graph& g, PositionMap position, - Dim left, Dim top, Dim right, Dim bottom) +scale_graph(const Graph& g, PositionMap position, const Topology& topology, + typename Topology::point_type upper_left, typename Topology::point_type lower_right) { if (num_vertices(g) == 0) return; - if (bottom > top) { - using std::swap; - swap(bottom, top); - } - - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + typedef typename Topology::point_type Point; + typedef typename Topology::point_difference_type point_difference_type; // Find min/max ranges - Dim minX = position[*vertices(g).first].x, maxX = minX; - Dim minY = position[*vertices(g).first].y, maxY = minY; - vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - minX = min BOOST_PREVENT_MACRO_SUBSTITUTION (minX, position[*vi].x); - maxX = max BOOST_PREVENT_MACRO_SUBSTITUTION (maxX, position[*vi].x); - minY = min BOOST_PREVENT_MACRO_SUBSTITUTION (minY, position[*vi].y); - maxY = max BOOST_PREVENT_MACRO_SUBSTITUTION (maxY, position[*vi].y); + Point min_point = get(position, *vertices(g).first), max_point = min_point; + BGL_FORALL_VERTICES_T(v, g, Graph) { + min_point = topology.pointwise_min(min_point, get(position, v)); + max_point = topology.pointwise_max(max_point, get(position, v)); } + Point old_origin = topology.move_position_toward(min_point, 0.5, max_point); + Point new_origin = topology.move_position_toward(upper_left, 0.5, lower_right); + point_difference_type old_size = topology.difference(max_point, min_point); + point_difference_type new_size = topology.difference(lower_right, upper_left); + // Scale to bounding box provided - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - position[*vi].x = ((position[*vi].x - minX) / (maxX - minX)) - * (right - left) + left; - position[*vi].y = ((position[*vi].y - minY) / (maxY - minY)) - * (top - bottom) + bottom; + BGL_FORALL_VERTICES_T(v, g, Graph) { + point_difference_type relative_loc = topology.difference(get(position, v), old_origin); + relative_loc = (relative_loc / old_size) * new_size; + put(position, v, topology.adjust(new_origin, relative_loc)); } } namespace detail { - template<typename PositionMap, typename DisplacementMap, - typename RepulsiveForce, typename Dim, typename Graph> + template<typename Topology, typename PropMap, typename Vertex> + void + maybe_jitter_point(const Topology& topology, + const PropMap& pm, Vertex v, + const typename Topology::point_type& p2) + { + double too_close = topology.norm(topology.extent()) / 10000.; + if (topology.distance(get(pm, v), p2) < too_close) { + put(pm, v, + topology.move_position_toward(get(pm, v), 1./200, + topology.random_point())); + } + } + + template<typename Topology, typename PositionMap, typename DisplacementMap, + typename RepulsiveForce, typename Graph> struct fr_apply_force { typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename Topology::point_type Point; + typedef typename Topology::point_difference_type PointDiff; - fr_apply_force(const PositionMap& position, + fr_apply_force(const Topology& topology, + const PositionMap& position, const DisplacementMap& displacement, - RepulsiveForce repulsive_force, Dim k, const Graph& g) - : position(position), displacement(displacement), + RepulsiveForce repulsive_force, double k, const Graph& g) + : topology(topology), position(position), displacement(displacement), repulsive_force(repulsive_force), k(k), g(g) { } void operator()(vertex_descriptor u, vertex_descriptor v) { -#ifndef BOOST_NO_STDC_NAMESPACE - using std::sqrt; -#endif // BOOST_NO_STDC_NAMESPACE if (u != v) { - Dim delta_x = position[v].x - position[u].x; - Dim delta_y = position[v].y - position[u].y; - Dim dist = sqrt(delta_x * delta_x + delta_y * delta_y); - Dim fr = repulsive_force(u, v, k, dist, g); - displacement[v].x += delta_x / dist * fr; - displacement[v].y += delta_y / dist * fr; + // When the vertices land on top of each other, move the + // first vertex away from the boundaries. + maybe_jitter_point(topology, position, u, get(position, v)); + + double dist = topology.distance(get(position, u), get(position, v)); + typename Topology::point_difference_type dispv = get(displacement, v); + if (dist == 0.) { + for (std::size_t i = 0; i < Point::dimensions; ++i) { + dispv[i] += 0.01; + } + } else { + double fr = repulsive_force(u, v, k, dist, g); + dispv += (fr / dist) * + topology.difference(get(position, v), get(position, u)); + } + put(displacement, v, dispv); } } private: + const Topology& topology; PositionMap position; DisplacementMap displacement; RepulsiveForce repulsive_force; - Dim k; + double k; const Graph& g; }; } // end namespace detail -template<typename Graph, typename PositionMap, typename Dim, +template<typename Topology, typename Graph, typename PositionMap, typename AttractiveForce, typename RepulsiveForce, typename ForcePairs, typename Cooling, typename DisplacementMap> void fruchterman_reingold_force_directed_layout (const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, AttractiveForce attractive_force, RepulsiveForce repulsive_force, ForcePairs force_pairs, Cooling cool, DisplacementMap displacement) { + typedef typename Topology::point_type Point; typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; typedef typename graph_traits<Graph>::edge_iterator edge_iterator; -#ifndef BOOST_NO_STDC_NAMESPACE - using std::sqrt; -#endif // BOOST_NO_STDC_NAMESPACE + double volume = topology.volume(topology.extent()); - Dim area = width * height; // assume positions are initialized randomly - Dim k = sqrt(area / num_vertices(g)); + double k = pow(volume / num_vertices(g), 1. / (double)(Topology::point_difference_type::dimensions)); - detail::fr_apply_force<PositionMap, DisplacementMap, - RepulsiveForce, Dim, Graph> - apply_force(position, displacement, repulsive_force, k, g); + detail::fr_apply_force<Topology, PositionMap, DisplacementMap, + RepulsiveForce, Graph> + apply_force(topology, position, displacement, repulsive_force, k, g); - Dim temp = cool(); - if (temp) do { + do { // Calculate repulsive forces vertex_iterator v, v_end; - for (tie(v, v_end) = vertices(g); v != v_end; ++v) { - displacement[*v].x = 0; - displacement[*v].y = 0; - } + for (tie(v, v_end) = vertices(g); v != v_end; ++v) + put(displacement, *v, typename Topology::point_difference_type()); force_pairs(g, apply_force); // Calculate attractive forces @@ -284,52 +308,47 @@ fruchterman_reingold_force_directed_layout for (tie(e, e_end) = edges(g); e != e_end; ++e) { vertex_descriptor v = source(*e, g); vertex_descriptor u = target(*e, g); - Dim delta_x = position[v].x - position[u].x; - Dim delta_y = position[v].y - position[u].y; - Dim dist = sqrt(delta_x * delta_x + delta_y * delta_y); - Dim fa = attractive_force(*e, k, dist, g); - - displacement[v].x -= delta_x / dist * fa; - displacement[v].y -= delta_y / dist * fa; - displacement[u].x += delta_x / dist * fa; - displacement[u].y += delta_y / dist * fa; + + // When the vertices land on top of each other, move the + // first vertex away from the boundaries. + ::boost::detail::maybe_jitter_point(topology, position, u, get(position, v)); + + typename Topology::point_difference_type delta = + topology.difference(get(position, v), get(position, u)); + double dist = topology.distance(get(position, u), get(position, v)); + double fa = attractive_force(*e, k, dist, g); + + put(displacement, v, get(displacement, v) - (fa / dist) * delta); + put(displacement, u, get(displacement, u) + (fa / dist) * delta); } - // Update positions - for (tie(v, v_end) = vertices(g); v != v_end; ++v) { - BOOST_USING_STD_MIN(); - BOOST_USING_STD_MAX(); - Dim disp_size = sqrt(displacement[*v].x * displacement[*v].x - + displacement[*v].y * displacement[*v].y); - position[*v].x += displacement[*v].x / disp_size - * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp); - position[*v].y += displacement[*v].y / disp_size - * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp); - position[*v].x = min BOOST_PREVENT_MACRO_SUBSTITUTION - (width / 2, - max BOOST_PREVENT_MACRO_SUBSTITUTION(-width / 2, - position[*v].x)); - position[*v].y = min BOOST_PREVENT_MACRO_SUBSTITUTION - (height / 2, - max BOOST_PREVENT_MACRO_SUBSTITUTION(-height / 2, - position[*v].y)); + if (double temp = cool()) { + // Update positions + BGL_FORALL_VERTICES_T (v, g, Graph) { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + double disp_size = topology.norm(get(displacement, v)); + put(position, v, topology.adjust(get(position, v), get(displacement, v) * (min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp) / disp_size))); + put(position, v, topology.bound(get(position, v))); + } + } else { + break; } - } while (temp = cool()); + } while (true); } namespace detail { template<typename DisplacementMap> struct fr_force_directed_layout { - template<typename Graph, typename PositionMap, typename Dim, + template<typename Topology, typename Graph, typename PositionMap, typename AttractiveForce, typename RepulsiveForce, typename ForcePairs, typename Cooling, typename Param, typename Tag, typename Rest> static void run(const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, AttractiveForce attractive_force, RepulsiveForce repulsive_force, ForcePairs force_pairs, @@ -338,7 +357,7 @@ namespace detail { const bgl_named_params<Param, Tag, Rest>&) { fruchterman_reingold_force_directed_layout - (g, position, width, height, attractive_force, repulsive_force, + (g, position, topology, attractive_force, repulsive_force, force_pairs, cool, displacement); } }; @@ -346,15 +365,14 @@ namespace detail { template<> struct fr_force_directed_layout<error_property_not_found> { - template<typename Graph, typename PositionMap, typename Dim, + template<typename Topology, typename Graph, typename PositionMap, typename AttractiveForce, typename RepulsiveForce, typename ForcePairs, typename Cooling, typename Param, typename Tag, typename Rest> static void run(const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, AttractiveForce attractive_force, RepulsiveForce repulsive_force, ForcePairs force_pairs, @@ -362,59 +380,63 @@ namespace detail { error_property_not_found, const bgl_named_params<Param, Tag, Rest>& params) { - std::vector<simple_point<double> > displacements(num_vertices(g)); + typedef typename Topology::point_difference_type PointDiff; + std::vector<PointDiff> displacements(num_vertices(g)); fruchterman_reingold_force_directed_layout - (g, position, width, height, attractive_force, repulsive_force, + (g, position, topology, attractive_force, repulsive_force, force_pairs, cool, make_iterator_property_map (displacements.begin(), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), - simple_point<double>())); + PointDiff())); } }; } // end namespace detail -template<typename Graph, typename PositionMap, typename Dim, typename Param, +template<typename Topology, typename Graph, typename PositionMap, typename Param, typename Tag, typename Rest> void fruchterman_reingold_force_directed_layout (const Graph& g, PositionMap position, - Dim width, - Dim height, + const Topology& topology, const bgl_named_params<Param, Tag, Rest>& params) { typedef typename property_value<bgl_named_params<Param,Tag,Rest>, vertex_displacement_t>::type D; detail::fr_force_directed_layout<D>::run - (g, position, width, height, + (g, position, topology, choose_param(get_param(params, attractive_force_t()), square_distance_attractive_force()), choose_param(get_param(params, repulsive_force_t()), square_distance_repulsive_force()), choose_param(get_param(params, force_pairs_t()), - make_grid_force_pairs(width, height, position, g)), + make_grid_force_pairs(topology, position, g)), choose_param(get_param(params, cooling_t()), linear_cooling<double>(100)), get_param(params, vertex_displacement_t()), params); } -template<typename Graph, typename PositionMap, typename Dim> +template<typename Topology, typename Graph, typename PositionMap> void -fruchterman_reingold_force_directed_layout(const Graph& g, - PositionMap position, - Dim width, - Dim height) +fruchterman_reingold_force_directed_layout + (const Graph& g, + PositionMap position, + const Topology& topology) { fruchterman_reingold_force_directed_layout - (g, position, width, height, + (g, position, topology, attractive_force(square_distance_attractive_force())); } } // end namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/fruchterman_reingold.hpp> +#endif + #endif // BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP diff --git a/Utilities/BGL/boost/graph/geodesic_distance.hpp b/Utilities/BGL/boost/graph/geodesic_distance.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a4d702749e4ac1853905814d3dfde46c3da7b184 --- /dev/null +++ b/Utilities/BGL/boost/graph/geodesic_distance.hpp @@ -0,0 +1,210 @@ +// (C) Copyright Andrew Sutton 2007 +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_GEODESIC_DISTANCE_HPP +#define BOOST_GRAPH_GEODESIC_DISTANCE_HPP + +#include <boost/graph/detail/geodesic.hpp> +#include <boost/graph/exterior_property.hpp> + +namespace boost +{ +template <typename Graph, + typename DistanceType, + typename ResultType, + typename Divides = std::divides<ResultType> > +struct mean_geodesic_measure + : public geodesic_measure<Graph, DistanceType, ResultType> +{ + typedef geodesic_measure<Graph, DistanceType, ResultType> base_type; + typedef typename base_type::distance_type distance_type; + typedef typename base_type::result_type result_type; + + result_type operator ()(distance_type d, const Graph& g) + { + function_requires< VertexListGraphConcept<Graph> >(); + function_requires< NumericValueConcept<DistanceType> >(); + function_requires< NumericValueConcept<ResultType> >(); + function_requires< AdaptableBinaryFunctionConcept<Divides,ResultType,ResultType,ResultType> >(); + + return (d == base_type::infinite_distance()) + ? base_type::infinite_result() + : div(result_type(d), result_type(num_vertices(g) - 1)); + } + Divides div; +}; + +template <typename Graph, typename DistanceMap> +inline mean_geodesic_measure<Graph, typename property_traits<DistanceMap>::value_type, double> +measure_mean_geodesic(const Graph&, DistanceMap) +{ + return mean_geodesic_measure<Graph, typename property_traits<DistanceMap>::value_type, double>(); +} + +template <typename T, typename Graph, typename DistanceMap> +inline mean_geodesic_measure<Graph, typename property_traits<DistanceMap>::value_type, T> +measure_mean_geodesic(const Graph&, DistanceMap) +{ + return mean_geodesic_measure<Graph, typename property_traits<DistanceMap>::value_type, T>(); +} + +// This is a little different because it's expected that the result type +// should (must?) be the same as the distance type. There's a type of +// transitivity in this thinking... If the average of distances has type +// X then the average of x's should also be type X. Is there a case where this +// is not true? +// +// This type is a little under-genericized... It needs generic parameters +// for addition and division. +template <typename Graph, typename DistanceType> +struct mean_graph_distance_measure + : public geodesic_measure<Graph, DistanceType, DistanceType> +{ + typedef geodesic_measure<Graph, DistanceType, DistanceType> base_type; + typedef typename base_type::distance_type distance_type; + typedef typename base_type::result_type result_type; + + inline result_type operator ()(distance_type d, const Graph& g) + { + function_requires< VertexListGraphConcept<Graph> >(); + function_requires< NumericValueConcept<DistanceType> >(); + + if(d == base_type::infinite_distance()) { + return base_type::infinite_result(); + } + else { + return d / result_type(num_vertices(g)); + } + } +}; + +template <typename Graph, typename DistanceMap> +inline mean_graph_distance_measure<Graph, typename property_traits<DistanceMap>::value_type> +measure_graph_mean_geodesic(const Graph&, DistanceMap) +{ + typedef typename property_traits<DistanceMap>::value_type T; + return mean_graph_distance_measure<Graph, T>(); +} + +template <typename Graph, + typename DistanceMap, + typename Measure, + typename Combinator> +inline typename Measure::result_type +mean_geodesic(const Graph& g, + DistanceMap dist, + Measure measure, + Combinator combine) +{ + function_requires< DistanceMeasureConcept<Measure,Graph> >(); + typedef typename Measure::distance_type Distance; + + Distance n = detail::combine_distances(g, dist, combine, Distance(0)); + return measure(n, g); +} + +template <typename Graph, + typename DistanceMap, + typename Measure> +inline typename Measure::result_type +mean_geodesic(const Graph& g, DistanceMap dist, Measure measure) +{ + function_requires< DistanceMeasureConcept<Measure,Graph> >(); + typedef typename Measure::distance_type Distance; + + return mean_geodesic(g, dist, measure, std::plus<Distance>()); +} + +template <typename Graph, typename DistanceMap> +inline double +mean_geodesic(const Graph& g, DistanceMap dist) +{ return mean_geodesic(g, dist, measure_mean_geodesic(g, dist)); } + +template <typename T, typename Graph, typename DistanceMap> +inline T +mean_geodesic(const Graph& g, DistanceMap dist) +{ return mean_geodesic(g, dist, measure_mean_geodesic<T>(g, dist)); } + + +template <typename Graph, + typename DistanceMatrixMap, + typename GeodesicMap, + typename Measure> +inline typename property_traits<GeodesicMap>::value_type +all_mean_geodesics(const Graph& g, + DistanceMatrixMap dist, + GeodesicMap geo, + Measure measure) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >(); + typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap; + function_requires< DistanceMeasureConcept<Measure,Graph> >(); + typedef typename Measure::result_type Result; + function_requires< WritablePropertyMapConcept<GeodesicMap,Vertex> >(); + function_requires< NumericValueConcept<Result> >(); + + // NOTE: We could compute the mean geodesic here by performing additional + // computations (i.e., adding and dividing). However, I don't really feel + // like fully genericizing the entire operation yet so I'm not going to. + + Result inf = numeric_values<Result>::infinity(); + Result sum = numeric_values<Result>::zero(); + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + DistanceMap dm = get(dist, *i); + Result r = mean_geodesic(g, dm, measure); + put(geo, *i, r); + + // compute the sum along with geodesics + if(r == inf) { + sum = inf; + } + else if(sum != inf) { + sum += r; + } + } + + // return the average of averages. + return sum / Result(num_vertices(g)); +} + +template <typename Graph, typename DistanceMatrixMap, typename GeodesicMap> +inline typename property_traits<GeodesicMap>::value_type +all_mean_geodesics(const Graph& g, DistanceMatrixMap dist, GeodesicMap geo) +{ + function_requires< GraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<DistanceMatrixMap,Vertex> >(); + typedef typename property_traits<DistanceMatrixMap>::value_type DistanceMap; + function_requires< WritablePropertyMapConcept<GeodesicMap,Vertex> >(); + typedef typename property_traits<GeodesicMap>::value_type Result; + + return all_mean_geodesics(g, dist, geo, measure_mean_geodesic<Result>(g, DistanceMap())); +} + + +template <typename Graph, typename GeodesicMap, typename Measure> +inline typename Measure::result_type +small_world_distance(const Graph& g, GeodesicMap geo, Measure measure) +{ + function_requires< DistanceMeasureConcept<Measure,Graph> >(); + typedef typename Measure::result_type Result; + + Result sum = detail::combine_distances(g, geo, std::plus<Result>(), Result(0)); + return measure(sum, g); +} + +template <typename Graph, typename GeodesicMap> +inline typename property_traits<GeodesicMap>::value_type +small_world_distance(const Graph& g, GeodesicMap geo) +{ return small_world_distance(g, geo, measure_graph_mean_geodesic(g, geo)); } + +} + +#endif diff --git a/Utilities/BGL/boost/graph/graph_archetypes.hpp b/Utilities/BGL/boost/graph/graph_archetypes.hpp index ce4c85fd08fd6075f4ac098ac90b1596d82b5c0d..9b364bb814c4a29080fb7b20dc6e7212de223557 100644 --- a/Utilities/BGL/boost/graph/graph_archetypes.hpp +++ b/Utilities/BGL/boost/graph/graph_archetypes.hpp @@ -10,8 +10,10 @@ #ifndef BOOST_GRAPH_ARCHETYPES_HPP #define BOOST_GRAPH_ARCHETYPES_HPP -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/concept_archetype.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/properties.hpp> namespace boost { // should use a different namespace for this diff --git a/Utilities/BGL/boost/graph/graph_as_tree.hpp b/Utilities/BGL/boost/graph/graph_as_tree.hpp index 7619dfcc0a425b6cf29a4ec46da3c27da49c1f0f..3758c3f009ee3c5edef8188461f6bff9608718b1 100644 --- a/Utilities/BGL/boost/graph/graph_as_tree.hpp +++ b/Utilities/BGL/boost/graph/graph_as_tree.hpp @@ -13,7 +13,7 @@ #include <vector> #include <boost/config.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/tree_traits.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/breadth_first_search.hpp> diff --git a/Utilities/BGL/boost/graph/graph_concepts.hpp b/Utilities/BGL/boost/graph/graph_concepts.hpp index a4572650168cbf9c44f72be137ce76b42066616c..fe33133607ca63bf84fe870c928a2d30d989cc5f 100644 --- a/Utilities/BGL/boost/graph/graph_concepts.hpp +++ b/Utilities/BGL/boost/graph/graph_concepts.hpp @@ -3,6 +3,8 @@ // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek // +// Copyright 2009, Andrew Sutton +// // 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) @@ -12,131 +14,16 @@ #define BOOST_GRAPH_CONCEPTS_HPP #include <boost/config.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/graph_traits.hpp> -#include <boost/property_map.hpp> #include <boost/graph/properties.hpp> +#include <boost/graph/numeric_values.hpp> #include <boost/concept_check.hpp> #include <boost/detail/workaround.hpp> -namespace boost { - - template <class T> - struct MultiPassInputIteratorConcept { - void constraints() { - function_requires< InputIteratorConcept<T> >(); - } - }; - - template <class G> - struct GraphConcept - { - typedef typename graph_traits<G>::vertex_descriptor vertex_descriptor; - typedef typename graph_traits<G>::directed_category directed_category; - typedef typename graph_traits<G>::edge_parallel_category - edge_parallel_category; - typedef typename graph_traits<G>::traversal_category - traversal_category; - void constraints() { - function_requires< DefaultConstructibleConcept<vertex_descriptor> >(); - function_requires< EqualityComparableConcept<vertex_descriptor> >(); - function_requires< AssignableConcept<vertex_descriptor> >(); - } - G g; - }; - - template <class G> - struct IncidenceGraphConcept - { - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - typedef typename graph_traits<G>::out_edge_iterator - out_edge_iterator; - typedef typename graph_traits<G>::traversal_category - traversal_category; - void constraints() { - function_requires< GraphConcept<G> >(); - function_requires< MultiPassInputIteratorConcept<out_edge_iterator> >(); - function_requires< DefaultConstructibleConcept<edge_descriptor> >(); - function_requires< EqualityComparableConcept<edge_descriptor> >(); - function_requires< AssignableConcept<edge_descriptor> >(); - function_requires< ConvertibleConcept<traversal_category, - incidence_graph_tag> >(); - - p = out_edges(u, g); - n = out_degree(u, g); - e = *p.first; - u = source(e, g); - v = target(e, g); - const_constraints(g); - } - void const_constraints(const G& cg) { - p = out_edges(u, cg); - n = out_degree(u, cg); - e = *p.first; - u = source(e, cg); - v = target(e, cg); - } - std::pair<out_edge_iterator, out_edge_iterator> p; - typename graph_traits<G>::vertex_descriptor u, v; - typename graph_traits<G>::edge_descriptor e; - typename graph_traits<G>::degree_size_type n; - G g; - }; - - template <class G> - struct BidirectionalGraphConcept - { - typedef typename graph_traits<G>::in_edge_iterator - in_edge_iterator; - typedef typename graph_traits<G>::traversal_category - traversal_category; - void constraints() { - function_requires< IncidenceGraphConcept<G> >(); - function_requires< MultiPassInputIteratorConcept<in_edge_iterator> >(); - function_requires< ConvertibleConcept<traversal_category, - bidirectional_graph_tag> >(); - - p = in_edges(v, g); - n = in_degree(v, g); - e = *p.first; - const_constraints(g); - } - void const_constraints(const G& cg) { - p = in_edges(v, cg); - n = in_degree(v, cg); - e = *p.first; - } - std::pair<in_edge_iterator, in_edge_iterator> p; - typename graph_traits<G>::vertex_descriptor v; - typename graph_traits<G>::edge_descriptor e; - typename graph_traits<G>::degree_size_type n; - G g; - }; - - template <class G> - struct AdjacencyGraphConcept - { - typedef typename graph_traits<G>::adjacency_iterator - adjacency_iterator; - typedef typename graph_traits<G>::traversal_category - traversal_category; - void constraints() { - function_requires< GraphConcept<G> >(); - function_requires< MultiPassInputIteratorConcept<adjacency_iterator> >(); - function_requires< ConvertibleConcept<traversal_category, - adjacency_graph_tag> >(); - - p = adjacent_vertices(v, g); - v = *p.first; - const_constraints(g); - } - void const_constraints(const G& cg) { - p = adjacent_vertices(v, cg); - } - std::pair<adjacency_iterator,adjacency_iterator> p; - typename graph_traits<G>::vertex_descriptor v; - G g; - }; - +#include <boost/concept/detail/concept_def.hpp> +namespace boost +{ // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if // you want to use vector_as_graph, it is! I'm sure the graph // library leaves these out all over the place. Probably a @@ -149,344 +36,591 @@ namespace boost { && !BOOST_WORKAROUND(__GNUC__, <= 2) \ && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) # define BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK -#endif +#endif #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK template <class T> typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&); -#endif - - template <class G> - struct VertexListGraphConcept - { - typedef typename graph_traits<G>::vertex_iterator vertex_iterator; - typedef typename graph_traits<G>::vertices_size_type vertices_size_type; - typedef typename graph_traits<G>::traversal_category - traversal_category; - void constraints() { - function_requires< GraphConcept<G> >(); - function_requires< MultiPassInputIteratorConcept<vertex_iterator> >(); - function_requires< ConvertibleConcept<traversal_category, - vertex_list_graph_tag> >(); +#endif + + namespace concepts { + BOOST_concept(MultiPassInputIterator,(T)) { + BOOST_CONCEPT_USAGE(MultiPassInputIterator) { + BOOST_CONCEPT_ASSERT((InputIterator<T>)); + } + }; + + BOOST_concept(Graph,(G)) + { + typedef typename graph_traits<G>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<G>::directed_category directed_category; + typedef typename graph_traits<G>::edge_parallel_category + edge_parallel_category; + + typedef typename graph_traits<G>::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(Graph) + { + BOOST_CONCEPT_ASSERT((DefaultConstructible<vertex_descriptor>)); + BOOST_CONCEPT_ASSERT((EqualityComparable<vertex_descriptor>)); + BOOST_CONCEPT_ASSERT((Assignable<vertex_descriptor>)); + } + G g; + }; + + BOOST_concept(IncidenceGraph,(G)) + : Graph<G> + { + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + typedef typename graph_traits<G>::out_edge_iterator + out_edge_iterator; + + typedef typename graph_traits<G>::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(IncidenceGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator<out_edge_iterator>)); + BOOST_CONCEPT_ASSERT((DefaultConstructible<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((EqualityComparable<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((Assignable<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((Convertible<traversal_category, + incidence_graph_tag>)); + + p = out_edges(u, g); + n = out_degree(u, g); + e = *p.first; + u = source(e, g); + v = target(e, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = out_edges(u, cg); + n = out_degree(u, cg); + e = *p.first; + u = source(e, cg); + v = target(e, cg); + } + std::pair<out_edge_iterator, out_edge_iterator> p; + typename graph_traits<G>::vertex_descriptor u, v; + typename graph_traits<G>::edge_descriptor e; + typename graph_traits<G>::degree_size_type n; + G g; + }; + + BOOST_concept(BidirectionalGraph,(G)) + : IncidenceGraph<G> + { + typedef typename graph_traits<G>::in_edge_iterator + in_edge_iterator; + typedef typename graph_traits<G>::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(BidirectionalGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator<in_edge_iterator>)); + BOOST_CONCEPT_ASSERT((Convertible<traversal_category, + bidirectional_graph_tag>)); + + p = in_edges(v, g); + n = in_degree(v, g); + e = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { + p = in_edges(v, cg); + n = in_degree(v, cg); + e = *p.first; + } + std::pair<in_edge_iterator, in_edge_iterator> p; + typename graph_traits<G>::vertex_descriptor v; + typename graph_traits<G>::edge_descriptor e; + typename graph_traits<G>::degree_size_type n; + G g; + }; + + BOOST_concept(AdjacencyGraph,(G)) + : Graph<G> + { + typedef typename graph_traits<G>::adjacency_iterator + adjacency_iterator; + typedef typename graph_traits<G>::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(AdjacencyGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator<adjacency_iterator>)); + BOOST_CONCEPT_ASSERT((Convertible<traversal_category, + adjacency_graph_tag>)); + + p = adjacent_vertices(v, g); + v = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { + p = adjacent_vertices(v, cg); + } + std::pair<adjacency_iterator,adjacency_iterator> p; + typename graph_traits<G>::vertex_descriptor v; + G g; + }; + + BOOST_concept(VertexListGraph,(G)) + : Graph<G> + { + typedef typename graph_traits<G>::vertex_iterator vertex_iterator; + typedef typename graph_traits<G>::vertices_size_type vertices_size_type; + typedef typename graph_traits<G>::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(VertexListGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator<vertex_iterator>)); + BOOST_CONCEPT_ASSERT((Convertible<traversal_category, + vertex_list_graph_tag>)); #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK - // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if - // you want to use vector_as_graph, it is! I'm sure the graph - // library leaves these out all over the place. Probably a - // redesign involving specializing a template with a static - // member function is in order :( - using boost::vertices; -#endif - p = vertices(g); - v = *p.first; - const_constraints(g); - } - void const_constraints(const G& cg) { + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + p = vertices(g); + v = *p.first; + const_constraints(g); + } + void const_constraints(const G& cg) { #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK - // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if - // you want to use vector_as_graph, it is! I'm sure the graph - // library leaves these out all over the place. Probably a - // redesign involving specializing a template with a static - // member function is in order :( - using boost::vertices; -#endif - - p = vertices(cg); - v = *p.first; - V = num_vertices(cg); - } - std::pair<vertex_iterator,vertex_iterator> p; - typename graph_traits<G>::vertex_descriptor v; - G g; - vertices_size_type V; - }; - - template <class G> - struct EdgeListGraphConcept - { - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - typedef typename graph_traits<G>::edge_iterator edge_iterator; - typedef typename graph_traits<G>::edges_size_type edges_size_type; - typedef typename graph_traits<G>::traversal_category - traversal_category; - void constraints() { - function_requires< GraphConcept<G> >(); - function_requires< MultiPassInputIteratorConcept<edge_iterator> >(); - function_requires< DefaultConstructibleConcept<edge_descriptor> >(); - function_requires< EqualityComparableConcept<edge_descriptor> >(); - function_requires< AssignableConcept<edge_descriptor> >(); - function_requires< ConvertibleConcept<traversal_category, - edge_list_graph_tag> >(); - - p = edges(g); - e = *p.first; - u = source(e, g); - v = target(e, g); - const_constraints(g); - } - void const_constraints(const G& cg) { - p = edges(cg); - E = num_edges(cg); - e = *p.first; - u = source(e, cg); - v = target(e, cg); - } - std::pair<edge_iterator,edge_iterator> p; - typename graph_traits<G>::vertex_descriptor u, v; - typename graph_traits<G>::edge_descriptor e; - edges_size_type E; - G g; - }; - - template <class G> - struct VertexAndEdgeListGraphConcept - { - void constraints() { - function_requires< VertexListGraphConcept<G> >(); - function_requires< EdgeListGraphConcept<G> >(); - } - }; - - // Where to put the requirement for this constructor? - // G g(n_vertices); - // Not in mutable graph, then LEDA graph's can't be models of - // MutableGraph. - - template <class G> - struct EdgeMutableGraphConcept - { - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - void constraints() { - p = add_edge(u, v, g); - remove_edge(u, v, g); - remove_edge(e, g); - clear_vertex(v, g); - } - G g; - edge_descriptor e; - std::pair<edge_descriptor, bool> p; - typename graph_traits<G>::vertex_descriptor u, v; - }; - - template <class G> - struct VertexMutableGraphConcept - { - void constraints() { - v = add_vertex(g); - remove_vertex(v, g); - } - G g; - typename graph_traits<G>::vertex_descriptor u, v; - }; - - template <class G> - struct MutableGraphConcept - { - void constraints() { - function_requires< EdgeMutableGraphConcept<G> >(); - function_requires< VertexMutableGraphConcept<G> >(); - } - }; - - template <class edge_descriptor> - struct dummy_edge_predicate { - bool operator()(const edge_descriptor&) const { - return false; - } - }; - - template <class G> - struct MutableIncidenceGraphConcept - { - void constraints() { - function_requires< MutableGraphConcept<G> >(); - remove_edge(iter, g); - remove_out_edge_if(u, p, g); - } - G g; - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - dummy_edge_predicate<edge_descriptor> p; - typename boost::graph_traits<G>::vertex_descriptor u; - typename boost::graph_traits<G>::out_edge_iterator iter; - }; - - template <class G> - struct MutableBidirectionalGraphConcept - { - void constraints() { - function_requires< MutableIncidenceGraphConcept<G> >(); - remove_in_edge_if(u, p, g); - } - G g; - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - dummy_edge_predicate<edge_descriptor> p; - typename boost::graph_traits<G>::vertex_descriptor u; - }; - - template <class G> - struct MutableEdgeListGraphConcept - { - void constraints() { - function_requires< EdgeMutableGraphConcept<G> >(); - remove_edge_if(p, g); - } - G g; - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - dummy_edge_predicate<edge_descriptor> p; - }; - - template <class G> - struct VertexMutablePropertyGraphConcept - { - void constraints() { - function_requires< VertexMutableGraphConcept<G> >(); - v = add_vertex(vp, g); - } - G g; - typename graph_traits<G>::vertex_descriptor v; - typename vertex_property<G>::type vp; - }; - - template <class G> - struct EdgeMutablePropertyGraphConcept - { - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - void constraints() { - function_requires< EdgeMutableGraphConcept<G> >(); - p = add_edge(u, v, ep, g); - } - G g; - std::pair<edge_descriptor, bool> p; - typename graph_traits<G>::vertex_descriptor u, v; - typename edge_property<G>::type ep; - }; - - template <class G> - struct AdjacencyMatrixConcept - { - typedef typename graph_traits<G>::edge_descriptor edge_descriptor; - void constraints() { - function_requires< GraphConcept<G> >(); - - p = edge(u, v, g); - const_constraints(g); - } - void const_constraints(const G& cg) { - p = edge(u, v, cg); - } - typename graph_traits<G>::vertex_descriptor u, v; - std::pair<edge_descriptor, bool> p; - G g; - }; - - template <class G, class X, class Property> - struct ReadablePropertyGraphConcept - { - typedef typename property_map<G, Property>::const_type const_Map; - void constraints() { - function_requires< GraphConcept<G> >(); - function_requires< ReadablePropertyMapConcept<const_Map, X> >(); - - const_constraints(g); - } - void const_constraints(const G& cg) { - const_Map pmap = get(Property(), cg); - pval = get(Property(), cg, x); - ignore_unused_variable_warning(pmap); - } - G g; - X x; - typename property_traits<const_Map>::value_type pval; - }; - - template <class G, class X, class Property> - struct PropertyGraphConcept - { - typedef typename property_map<G, Property>::type Map; - void constraints() { - function_requires< ReadablePropertyGraphConcept<G, X, Property> >(); - function_requires< ReadWritePropertyMapConcept<Map, X> >(); - - Map pmap = get(Property(), g); - pval = get(Property(), g, x); - put(Property(), g, x, pval); - ignore_unused_variable_warning(pmap); - } - G g; - X x; - typename property_traits<Map>::value_type pval; - }; - - template <class G, class X, class Property> - struct LvaluePropertyGraphConcept - { - typedef typename property_map<G, Property>::type Map; - typedef typename property_map<G, Property>::const_type const_Map; - void constraints() { - function_requires< ReadablePropertyGraphConcept<G, X, Property> >(); - function_requires< LvaluePropertyMapConcept<const_Map, X> >(); - - pval = get(Property(), g, x); - put(Property(), g, x, pval); - } - G g; - X x; - typename property_traits<Map>::value_type pval; - }; - - // This needs to move out of the graph library - template <class B> - struct BufferConcept - { - void constraints() { - b.push(t); - b.pop(); - typename B::value_type& v = b.top(); - const_constraints(b); - ignore_unused_variable_warning(v); - } - void const_constraints(const B& cb) { - const typename B::value_type& v = cb.top(); - n = cb.size(); - bool e = cb.empty(); - ignore_unused_variable_warning(v); - ignore_unused_variable_warning(e); - } - typename B::size_type n; - typename B::value_type t; - B b; - }; - - template <class C> - struct ColorValueConcept - { - void constraints() { - function_requires< EqualityComparableConcept<C> >(); - function_requires< DefaultConstructibleConcept<C> >(); - - c = color_traits<C>::white(); - c = color_traits<C>::gray(); - c = color_traits<C>::black(); - } - C c; - }; - - template <class M, class I, class V> - struct BasicMatrixConcept - { - void constraints() { - V& elt = A[i][j]; - const_constraints(A); - ignore_unused_variable_warning(elt); - } - void const_constraints(const M& cA) { - const V& elt = cA[i][j]; - ignore_unused_variable_warning(elt); - } - M A; - I i, j; - }; - -} // namespace boost + // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if + // you want to use vector_as_graph, it is! I'm sure the graph + // library leaves these out all over the place. Probably a + // redesign involving specializing a template with a static + // member function is in order :( + using boost::vertices; +#endif + + p = vertices(cg); + v = *p.first; + V = num_vertices(cg); + } + std::pair<vertex_iterator,vertex_iterator> p; + typename graph_traits<G>::vertex_descriptor v; + G g; + vertices_size_type V; + }; + + BOOST_concept(EdgeListGraph,(G)) + : Graph<G> + { + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + typedef typename graph_traits<G>::edge_iterator edge_iterator; + typedef typename graph_traits<G>::edges_size_type edges_size_type; + typedef typename graph_traits<G>::traversal_category + traversal_category; + + BOOST_CONCEPT_USAGE(EdgeListGraph) { + BOOST_CONCEPT_ASSERT((MultiPassInputIterator<edge_iterator>)); + BOOST_CONCEPT_ASSERT((DefaultConstructible<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((EqualityComparable<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((Assignable<edge_descriptor>)); + BOOST_CONCEPT_ASSERT((Convertible<traversal_category, + edge_list_graph_tag>)); + + p = edges(g); + e = *p.first; + u = source(e, g); + v = target(e, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = edges(cg); + E = num_edges(cg); + e = *p.first; + u = source(e, cg); + v = target(e, cg); + } + std::pair<edge_iterator,edge_iterator> p; + typename graph_traits<G>::vertex_descriptor u, v; + typename graph_traits<G>::edge_descriptor e; + edges_size_type E; + G g; + }; + + BOOST_concept(VertexAndEdgeListGraph,(G)) + : VertexListGraph<G> + , EdgeListGraph<G> + { + }; + + // Where to put the requirement for this constructor? + // G g(n_vertices); + // Not in mutable graph, then LEDA graph's can't be models of + // MutableGraph. + BOOST_concept(EdgeMutableGraph,(G)) + { + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + + BOOST_CONCEPT_USAGE(EdgeMutableGraph) { + p = add_edge(u, v, g); + remove_edge(u, v, g); + remove_edge(e, g); + clear_vertex(v, g); + } + G g; + edge_descriptor e; + std::pair<edge_descriptor, bool> p; + typename graph_traits<G>::vertex_descriptor u, v; + }; + + BOOST_concept(VertexMutableGraph,(G)) + { + + BOOST_CONCEPT_USAGE(VertexMutableGraph) { + v = add_vertex(g); + remove_vertex(v, g); + } + G g; + typename graph_traits<G>::vertex_descriptor u, v; + }; + + BOOST_concept(MutableGraph,(G)) + : EdgeMutableGraph<G> + , VertexMutableGraph<G> + { + }; + + template <class edge_descriptor> + struct dummy_edge_predicate { + bool operator()(const edge_descriptor&) const { + return false; + } + }; + + BOOST_concept(MutableIncidenceGraph,(G)) + : MutableGraph<G> + { + BOOST_CONCEPT_USAGE(MutableIncidenceGraph) { + remove_edge(iter, g); + remove_out_edge_if(u, p, g); + } + G g; + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + dummy_edge_predicate<edge_descriptor> p; + typename boost::graph_traits<G>::vertex_descriptor u; + typename boost::graph_traits<G>::out_edge_iterator iter; + }; + + BOOST_concept(MutableBidirectionalGraph,(G)) + : MutableIncidenceGraph<G> + { + BOOST_CONCEPT_USAGE(MutableBidirectionalGraph) + { + remove_in_edge_if(u, p, g); + } + G g; + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + dummy_edge_predicate<edge_descriptor> p; + typename boost::graph_traits<G>::vertex_descriptor u; + }; + + BOOST_concept(MutableEdgeListGraph,(G)) + : EdgeMutableGraph<G> + { + BOOST_CONCEPT_USAGE(MutableEdgeListGraph) { + remove_edge_if(p, g); + } + G g; + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + dummy_edge_predicate<edge_descriptor> p; + }; + + BOOST_concept(VertexMutablePropertyGraph,(G)) + : VertexMutableGraph<G> + { + BOOST_CONCEPT_USAGE(VertexMutablePropertyGraph) { + v = add_vertex(vp, g); + } + G g; + typename graph_traits<G>::vertex_descriptor v; + typename vertex_property<G>::type vp; + }; + + BOOST_concept(EdgeMutablePropertyGraph,(G)) + : EdgeMutableGraph<G> + { + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + + BOOST_CONCEPT_USAGE(EdgeMutablePropertyGraph) { + p = add_edge(u, v, ep, g); + } + G g; + std::pair<edge_descriptor, bool> p; + typename graph_traits<G>::vertex_descriptor u, v; + typename edge_property<G>::type ep; + }; + + BOOST_concept(AdjacencyMatrix,(G)) + : Graph<G> + { + typedef typename graph_traits<G>::edge_descriptor edge_descriptor; + + BOOST_CONCEPT_USAGE(AdjacencyMatrix) { + p = edge(u, v, g); + const_constraints(g); + } + void const_constraints(const G& cg) { + p = edge(u, v, cg); + } + typename graph_traits<G>::vertex_descriptor u, v; + std::pair<edge_descriptor, bool> p; + G g; + }; + + BOOST_concept(ReadablePropertyGraph,(G)(X)(Property)) + : Graph<G> + { + typedef typename property_map<G, Property>::const_type const_Map; + + BOOST_CONCEPT_USAGE(ReadablePropertyGraph) + { + BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<const_Map, X>)); + + const_constraints(g); + } + void const_constraints(const G& cg) { + const_Map pmap = get(Property(), cg); + pval = get(Property(), cg, x); + ignore_unused_variable_warning(pmap); + } + G g; + X x; + typename property_traits<const_Map>::value_type pval; + }; + + BOOST_concept(PropertyGraph,(G)(X)(Property)) + : ReadablePropertyGraph<G, X, Property> + { + typedef typename property_map<G, Property>::type Map; + BOOST_CONCEPT_USAGE(PropertyGraph) { + BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<Map, X>)); + + Map pmap = get(Property(), g); + pval = get(Property(), g, x); + put(Property(), g, x, pval); + ignore_unused_variable_warning(pmap); + } + G g; + X x; + typename property_traits<Map>::value_type pval; + }; + + BOOST_concept(LvaluePropertyGraph,(G)(X)(Property)) + : ReadablePropertyGraph<G, X, Property> + { + typedef typename property_map<G, Property>::type Map; + typedef typename property_map<G, Property>::const_type const_Map; + + BOOST_CONCEPT_USAGE(LvaluePropertyGraph) { + BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<const_Map, X>)); + + pval = get(Property(), g, x); + put(Property(), g, x, pval); + } + G g; + X x; + typename property_traits<Map>::value_type pval; + }; + + // The *IndexGraph concepts are "semantic" graph concpepts. These can be + // applied to describe any graph that has an index map that can be accessed + // using the get(*_index, g) method. For example, adjacency lists with + // VertexSet == vecS are implicitly models of this concept. + // + // NOTE: We could require an associated type vertex_index_type, but that + // would mean propagating that type name into graph_traits and all of the + // other graph implementations. Much easier to simply call it unsigned. + + BOOST_concept(VertexIndexGraph,(Graph)) + { + BOOST_CONCEPT_USAGE(VertexIndexGraph) + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename property_map<Graph, vertex_index_t>::type Map; + typedef unsigned Index; // This could be Graph::vertex_index_type + Map m = get(vertex_index, g); + Index x = get(vertex_index, g, Vertex()); + ignore_unused_variable_warning(x); + + // This is relaxed + renumber_vertex_indices(g); + + const_constraints(g); + } + void const_constraints(const Graph& g) + { + typedef typename property_map<Graph, vertex_index_t>::const_type Map; + Map m = get(vertex_index, g); + ignore_unused_variable_warning(m); + } + private: + Graph g; + }; + + BOOST_concept(EdgeIndexGraph,(Graph)) + { + BOOST_CONCEPT_USAGE(EdgeIndexGraph) + { + typedef typename graph_traits<Graph>::edge_descriptor Edge; + typedef typename property_map<Graph, edge_index_t>::type Map; + typedef unsigned Index; // This could be Graph::vertex_index_type + Map m = get(edge_index, g); + Index x = get(edge_index, g, Edge()); + ignore_unused_variable_warning(x); + + // This is relaxed + renumber_edge_indices(g); + + const_constraints(g); + } + void const_constraints(const Graph& g) + { + typedef typename property_map<Graph, edge_index_t>::const_type Map; + Map m = get(edge_index, g); + ignore_unused_variable_warning(m); + } + private: + Graph g; + }; + + // This needs to move out of the graph library + BOOST_concept(Buffer,(B)) + { + BOOST_CONCEPT_USAGE(Buffer) { + b.push(t); + b.pop(); + typename B::value_type& v = b.top(); + const_constraints(b); + ignore_unused_variable_warning(v); + } + void const_constraints(const B& cb) { + const typename B::value_type& v = cb.top(); + n = cb.size(); + bool e = cb.empty(); + ignore_unused_variable_warning(v); + ignore_unused_variable_warning(e); + } + typename B::size_type n; + typename B::value_type t; + B b; + }; + + BOOST_concept(ColorValue,(C)) + : EqualityComparable<C> + , DefaultConstructible<C> + { + BOOST_CONCEPT_USAGE(ColorValue) { + c = color_traits<C>::white(); + c = color_traits<C>::gray(); + c = color_traits<C>::black(); + } + C c; + }; + + BOOST_concept(BasicMatrix,(M)(I)(V)) + { + BOOST_CONCEPT_USAGE(BasicMatrix) { + V& elt = A[i][j]; + const_constraints(A); + ignore_unused_variable_warning(elt); + } + void const_constraints(const M& cA) { + const V& elt = cA[i][j]; + ignore_unused_variable_warning(elt); + } + M A; + I i, j; + }; + + // The following concepts describe aspects of numberic values and measure + // functions. We're extending the notion of numeric values to include + // emulation for zero and infinity. + + BOOST_concept(NumericValue,(Numeric)) + { + BOOST_CONCEPT_USAGE(NumericValue) + { + function_requires< DefaultConstructible<Numeric> >(); + function_requires< CopyConstructible<Numeric> >(); + numeric_values<Numeric>::zero(); + numeric_values<Numeric>::infinity(); + } + }; + + BOOST_concept(DegreeMeasure,(Measure)(Graph)) + { + BOOST_CONCEPT_USAGE(DegreeMeasure) + { + typedef typename Measure::degree_type Degree; + typedef typename Measure::vertex_type Vertex; + + Degree d = m(Vertex(), g); + ignore_unused_variable_warning(d); + } + private: + Measure m; + Graph g; + }; + + BOOST_concept(DistanceMeasure,(Measure)(Graph)) + { + BOOST_CONCEPT_USAGE(DistanceMeasure) + { + typedef typename Measure::distance_type Distance; + typedef typename Measure::result_type Result; + Result r = m(Distance(), g); + ignore_unused_variable_warning(r); + } + private: + Measure m; + Graph g; + }; + +} /* namespace concepts */ + +using boost::concepts::MultiPassInputIteratorConcept; + +// Graph concepts +using boost::concepts::GraphConcept; +using boost::concepts::IncidenceGraphConcept; +using boost::concepts::BidirectionalGraphConcept; +using boost::concepts::AdjacencyGraphConcept; +using boost::concepts::VertexListGraphConcept; +using boost::concepts::EdgeListGraphConcept; +using boost::concepts::VertexAndEdgeListGraphConcept; +using boost::concepts::EdgeMutableGraphConcept; +using boost::concepts::VertexMutableGraphConcept; +using boost::concepts::MutableGraphConcept; +using boost::concepts::MutableIncidenceGraphConcept; +using boost::concepts::MutableBidirectionalGraphConcept; +using boost::concepts::MutableEdgeListGraphConcept; +using boost::concepts::VertexMutablePropertyGraphConcept; +using boost::concepts::EdgeMutablePropertyGraphConcept; +using boost::concepts::AdjacencyMatrixConcept; +using boost::concepts::ReadablePropertyGraphConcept; +using boost::concepts::PropertyGraphConcept; +using boost::concepts::LvaluePropertyGraphConcept; +using boost::concepts::VertexIndexGraphConcept; +using boost::concepts::EdgeIndexGraphConcept; + +// Utility concepts +using boost::concepts::BufferConcept; +using boost::concepts::ColorValueConcept; +using boost::concepts::BasicMatrixConcept; +using boost::concepts::NumericValueConcept; +using boost::concepts::DistanceMeasureConcept; +using boost::concepts::DegreeMeasureConcept; + + +} /* namespace boost */ +#include <boost/concept/detail/concept_undef.hpp> #endif /* BOOST_GRAPH_CONCEPTS_H */ diff --git a/Utilities/BGL/boost/graph/graph_mutability_traits.hpp b/Utilities/BGL/boost/graph/graph_mutability_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..726d8d1411e305623833c11fc6fc6e3303c03da3 --- /dev/null +++ b/Utilities/BGL/boost/graph/graph_mutability_traits.hpp @@ -0,0 +1,204 @@ +// Copyright (C) 2009 Andrew Sutton +// +// 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) + +#ifndef BOOST_GRAPH_MUTABILITY_TRAITS_HPP +#define BOOST_GRAPH_MUTABILITY_TRAITS_HPP + +#include <boost/config.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/type_traits/is_same.hpp> + +namespace boost { + +// The mutabiltiy categories classify graphs by their mutating operations +// on the edge and vertex sets. This is a substantially more refined +// categorization than the MutableGraph and MutablePropertyGraph denote. +// Currently, this framework is only used in the graph tests to help +// dispatch test to the correct places. However, there are probably some +// constructive or destructive algorithms (i.e., graph generators) that +// may use these to describe requirements on graph inputs. + +struct add_vertex_tag { }; +struct add_vertex_property_tag : virtual add_vertex_tag { }; +struct add_edge_tag { }; +struct add_edge_property_tag : virtual add_edge_tag { }; +struct remove_vertex_tag { }; +struct remove_edge_tag { }; + +struct mutable_vertex_graph_tag + : virtual add_vertex_tag, virtual remove_vertex_tag +{ }; +struct mutable_vertex_property_graph_tag + : virtual add_vertex_property_tag, virtual remove_vertex_tag +{ }; + +struct mutable_edge_graph_tag + : virtual add_edge_tag, virtual remove_edge_tag +{ }; +struct mutable_edge_property_graph_tag + : virtual add_edge_property_tag, virtual remove_edge_tag +{ }; + +struct mutable_graph_tag + : virtual mutable_vertex_graph_tag + , virtual mutable_edge_graph_tag +{ }; +struct mutable_property_graph_tag + : virtual mutable_vertex_property_graph_tag + , virtual mutable_edge_property_graph_tag +{ }; + +// Some graphs just don't like to be torn down. Note this only restricts +// teardown to the set of vertices, not the vertex set. +// TODO: Find a better name for this tag. +struct add_only_property_graph_tag + : virtual add_vertex_property_tag + , virtual mutable_edge_property_graph_tag +{ }; + +/** + * The graph_mutability_traits provide methods for determining the + * interfaces supported by graph classes for adding and removing vertices + * and edges. + */ +template <typename Graph> +struct graph_mutability_traits { + typedef typename Graph::mutability_category category; +}; + +template <typename Graph> +struct graph_has_add_vertex + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + add_vertex_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_add_vertex_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + add_vertex_property_tag + >::value + > +{ }; + + +template <typename Graph> +struct graph_has_remove_vertex + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + remove_vertex_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_add_edge + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + add_edge_tag + >::value + > +{ }; + +template <typename Graph> +struct graph_has_add_edge_with_property + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + add_edge_property_tag + >::value + > +{ }; + + +template <typename Graph> +struct graph_has_remove_edge + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + remove_edge_tag + >::value + > +{ }; + + +template <typename Graph> +struct is_mutable_vertex_graph + : mpl::and_< + graph_has_add_vertex<Graph>, + graph_has_remove_vertex<Graph> + > +{ }; + +template <typename Graph> +struct is_mutable_vertex_property_graph + : mpl::and_< + graph_has_add_vertex_with_property<Graph>, + graph_has_remove_vertex<Graph> + > +{ }; + + +template <typename Graph> +struct is_mutable_edge_graph + : mpl::and_< + graph_has_add_edge<Graph>, + graph_has_remove_edge<Graph> + > +{ }; + +template <typename Graph> +struct is_mutable_edge_property_graph + : mpl::and_< + graph_has_add_edge_with_property<Graph>, + graph_has_remove_edge<Graph> + > +{ }; + + +template <typename Graph> +struct is_mutable_graph + : mpl::and_< + is_mutable_vertex_graph<Graph>, + is_mutable_edge_graph<Graph> + > +{ }; + +template <typename Graph> +struct is_mutable_property_graph + : mpl::and_< + is_mutable_vertex_property_graph<Graph>, + is_mutable_edge_property_graph<Graph> + > +{ }; + +template <typename Graph> +struct is_add_only_property_graph + : mpl::bool_< + is_convertible< + typename graph_mutability_traits<Graph>::category, + add_only_property_graph_tag + >::value + > +{ }; + +/** @name Mutability Traits Specializations */ +//@{ + +//@} + +} // namespace boost + +#endif diff --git a/Utilities/BGL/boost/graph/graph_selectors.hpp b/Utilities/BGL/boost/graph/graph_selectors.hpp index a3223c9b197fea7bcdb1d92ad858c02d090481cf..777ebefc94e8efa5cf182158ff4015abbc2a56bf 100644 --- a/Utilities/BGL/boost/graph/graph_selectors.hpp +++ b/Utilities/BGL/boost/graph/graph_selectors.hpp @@ -10,6 +10,8 @@ #ifndef BOOST_GRAPH_SELECTORS_HPP #define BOOST_GRAPH_SELECTORS_HPP +#include <boost/mpl/bool.hpp> + namespace boost { //=========================================================================== @@ -17,18 +19,18 @@ namespace boost { // and adjacency_matrix. struct directedS { enum { is_directed = true, is_bidir = false }; - typedef true_type is_directed_t; - typedef false_type is_bidir_t; + typedef mpl::true_ is_directed_t; + typedef mpl::false_ is_bidir_t; }; struct undirectedS { enum { is_directed = false, is_bidir = false }; - typedef false_type is_directed_t; - typedef false_type is_bidir_t; + typedef mpl::false_ is_directed_t; + typedef mpl::false_ is_bidir_t; }; struct bidirectionalS { enum { is_directed = true, is_bidir = true }; - typedef true_type is_directed_t; - typedef true_type is_bidir_t; + typedef mpl::true_ is_directed_t; + typedef mpl::true_ is_bidir_t; }; } // namespace boost diff --git a/Utilities/BGL/boost/graph/graph_stats.hpp b/Utilities/BGL/boost/graph/graph_stats.hpp new file mode 100644 index 0000000000000000000000000000000000000000..47c0502524239f790cfbba8c9ad654010f76ff37 --- /dev/null +++ b/Utilities/BGL/boost/graph/graph_stats.hpp @@ -0,0 +1,136 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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: Alex Breuer +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_GRAPH_STATS_HPP +#define BOOST_GRAPH_GRAPH_STATS_HPP + +#include <map> +#include <list> +#include <boost/graph/iteration_macros.hpp> + +namespace boost { namespace graph { + +template<typename Graph> +struct sort_edge_by_origin { +public: + typedef typename graph_traits<Graph>::edge_descriptor edge_type; + + explicit sort_edge_by_origin( Graph& g ) : g(g) {} + + inline bool operator()( edge_type a, edge_type b ) { + return source( a, g ) == source( b, g ) ? target( a, g ) < target( b, g ) : + source( a, g ) < source( b, g ); + } + +private: + Graph& g; +}; + +template<typename Graph> +struct equal_edge { +public: + typedef typename graph_traits<Graph>::edge_descriptor edge_type; + + explicit equal_edge( Graph& g ) : g(g) {} + + inline bool operator()( edge_type a, edge_type b ) { + return source( a, g ) == source( b, g ) && + target( a, g ) == target( b, g ); + } + +private: + Graph& g; +}; + +template<typename Graph> +unsigned long num_dup_edges( Graph& g ) { + typedef typename graph_traits<Graph>::edge_iterator e_iterator_type; + typedef typename graph_traits<Graph>::edge_descriptor edge_type; + + std::list<edge_type> all_edges; + + BGL_FORALL_EDGES_T( e, g, Graph ) { + all_edges.push_back( e ); + } + + sort_edge_by_origin<Graph> cmp1( g ); + all_edges.sort( cmp1 ); + equal_edge<Graph> cmp2( g ); + all_edges.unique( cmp2 ); + + return num_edges( g ) - all_edges.size(); +} + + +template<typename Graph> +std::map<unsigned long, unsigned long> dup_edge_dist( Graph& g ) { + std::map<unsigned long, unsigned long> dist; + typedef typename graph_traits<Graph>::adjacency_iterator a_iterator_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_type; + + + BGL_FORALL_VERTICES_T( v, g, Graph ) { + std::list<vertex_type> front_neighbors; + a_iterator_type a_iter, a_end; + for( tie( a_iter, a_end ) = adjacent_vertices( v, g ); + a_iter != a_end; ++a_iter ) { + front_neighbors.push_back( *a_iter ); + } + + front_neighbors.sort(); + front_neighbors.unique(); + dist[out_degree( v, g ) - front_neighbors.size()] += 1; + } + return dist; +} + +template<typename Graph> +std::map<unsigned long, unsigned long> degree_dist( Graph& g ) { + std::map<unsigned long, unsigned long> dist; + typedef typename graph_traits<Graph>::adjacency_iterator a_iterator_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_type; + + BGL_FORALL_VERTICES_T( v, g, Graph ) { + dist[out_degree( v, g )] += 1; + } + + return dist; +} + +template<typename Graph> +std::map<unsigned long, double> weight_degree_dist( Graph& g ) { + std::map<unsigned long, double> dist, n; + typedef typename graph_traits<Graph>::adjacency_iterator a_iterator_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_type; + typedef typename property_map<Graph, edge_weight_t>::const_type edge_map_type; + typedef typename property_traits<edge_map_type>::value_type + edge_weight_type; + + typename property_map<Graph, edge_weight_t>::type em = get( edge_weight, g ); + + BGL_FORALL_VERTICES_T( v, g, Graph ) { + edge_weight_type tmp = 0; + BGL_FORALL_OUTEDGES_T( v, e, g, Graph ) { + tmp += em[e]; + } + n[out_degree( v, g )] += 1.; + dist[out_degree( v, g )] += tmp; + } + + for( std::map<unsigned long, double>::iterator iter = dist.begin(); + iter != dist.end(); ++iter ) { + assert( n[iter->first] != 0 ); + dist[iter->first] /= n[iter->first]; + } + + return dist; +} + +}} + +#endif diff --git a/Utilities/BGL/boost/graph/graph_test.hpp b/Utilities/BGL/boost/graph/graph_test.hpp index 37ded0c7336869a41c23fd69ef8d81ee07d8677e..554ddbad46aeb9f68ee634288901573dae8d1618 100644 --- a/Utilities/BGL/boost/graph/graph_test.hpp +++ b/Utilities/BGL/boost/graph/graph_test.hpp @@ -85,7 +85,7 @@ namespace boost { for (; p.first != p.second; ++p.first) { edge_t e = *p.first; BOOST_CHECK(source(e, g) == u); - BOOST_CHECK(contains(adj, target(e, g)) == true); + BOOST_CHECK(container_contains(adj, target(e, g)) == true); } } } @@ -114,7 +114,7 @@ namespace boost { for (; p.first != p.second; ++p.first) { edge_t e = *p.first; BOOST_CHECK(target(e, g) == v); - BOOST_CHECK(contains(inv_adj, source(e, g)) == true); + BOOST_CHECK(container_contains(inv_adj, source(e, g)) == true); } } } @@ -140,7 +140,7 @@ namespace boost { BOOST_CHECK(deg_size_t(std::distance(p.first, p.second)) == adj.size()); for (; p.first != p.second; ++p.first) { vertex_t v = *p.first; - BOOST_CHECK(contains(adj, v) == true); + BOOST_CHECK(container_contains(adj, v) == true); } } } @@ -155,7 +155,7 @@ namespace boost { BOOST_CHECK(n == num_vertices(g)); for (; p.first != p.second; ++p.first) { vertex_t v = *p.first; - BOOST_CHECK(contains(vertex_set, v) == true); + BOOST_CHECK(container_contains(vertex_set, v) == true); } } @@ -172,8 +172,8 @@ namespace boost { for (; p.first != p.second; ++p.first) { edge_t e = *p.first; BOOST_CHECK(any_if(edge_set, connects(source(e, g), target(e, g), g))); - BOOST_CHECK(contains(vertex_set, source(e, g)) == true); - BOOST_CHECK(contains(vertex_set, target(e, g)) == true); + BOOST_CHECK(container_contains(vertex_set, source(e, g)) == true); + BOOST_CHECK(container_contains(vertex_set, target(e, g)) == true); } } @@ -232,7 +232,7 @@ namespace boost { IsoMap iso_map(iso_vec.begin(), get(vertex_index, g)); copy_graph(g, cpy, orig_to_copy(iso_map)); - bool parallel_edge_exists = contains(adjacent_vertices(u, g), v); + bool parallel_edge_exists = container_contains(adjacent_vertices(u, g), v); std::pair<edge_t, bool> p = add_edge(u, v, g); edge_t e = p.first; @@ -249,7 +249,7 @@ namespace boost { if (p.second == true) { // edge added BOOST_CHECK(num_edges(g) == num_edges(cpy) + 1); - BOOST_CHECK(contains(out_edges(u, g), e) == true); + BOOST_CHECK(container_contains(out_edges(u, g), e) == true); BOOST_CHECK((verify_isomorphism (make_filtered_graph(g, ignore_edge(e)), cpy, iso_map))); diff --git a/Utilities/BGL/boost/graph/graph_traits.hpp b/Utilities/BGL/boost/graph/graph_traits.hpp index 1c5a26589b21f51da381cbbb8c913bdf512f4b0f..89687b5dd398dab2bbf086a29a6b1a1bac165f00 100644 --- a/Utilities/BGL/boost/graph/graph_traits.hpp +++ b/Utilities/BGL/boost/graph/graph_traits.hpp @@ -14,129 +14,290 @@ #include <iterator> #include <boost/tuple/tuple.hpp> #include <boost/mpl/if.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/not.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/iterator/iterator_categories.hpp> #include <boost/iterator/iterator_adaptor.hpp> +#include <boost/pending/property.hpp> #include <boost/detail/workaround.hpp> namespace boost { - template <typename G> - struct graph_traits { - typedef typename G::vertex_descriptor vertex_descriptor; - typedef typename G::edge_descriptor edge_descriptor; - typedef typename G::adjacency_iterator adjacency_iterator; - typedef typename G::out_edge_iterator out_edge_iterator; - typedef typename G::in_edge_iterator in_edge_iterator; - typedef typename G::vertex_iterator vertex_iterator; - typedef typename G::edge_iterator edge_iterator; - - typedef typename G::directed_category directed_category; - typedef typename G::edge_parallel_category edge_parallel_category; - typedef typename G::traversal_category traversal_category; - - typedef typename G::vertices_size_type vertices_size_type; - typedef typename G::edges_size_type edges_size_type; - typedef typename G::degree_size_type degree_size_type; - - static inline vertex_descriptor null_vertex(); - }; - - template <typename G> - inline typename graph_traits<G>::vertex_descriptor - graph_traits<G>::null_vertex() - { - return G::null_vertex(); - } - - // directed_category tags - struct directed_tag { }; - struct undirected_tag { }; - struct bidirectional_tag : public directed_tag { }; - - namespace detail { - inline bool is_directed(directed_tag) { return true; } - inline bool is_directed(undirected_tag) { return false; } - } - - template <typename Graph> - bool is_directed(const Graph&) { - typedef typename graph_traits<Graph>::directed_category Cat; - return detail::is_directed(Cat()); - } - template <typename Graph> - bool is_undirected(const Graph& g) { - return ! is_directed(g); - } - - // edge_parallel_category tags - struct allow_parallel_edge_tag {}; - struct disallow_parallel_edge_tag {}; - - namespace detail { - inline bool allows_parallel(allow_parallel_edge_tag) { return true; } - inline bool allows_parallel(disallow_parallel_edge_tag) { return false; } - } - - template <typename Graph> - bool allows_parallel_edges(const Graph&) { - typedef typename graph_traits<Graph>::edge_parallel_category Cat; - return detail::allows_parallel(Cat()); - } - - // traversal_category tags - struct incidence_graph_tag { }; - struct adjacency_graph_tag { }; - struct bidirectional_graph_tag : - public virtual incidence_graph_tag { }; - struct vertex_list_graph_tag { }; - struct edge_list_graph_tag { }; - struct adjacency_matrix_tag { }; - - //?? not the right place ?? Lee - typedef boost::forward_traversal_tag multi_pass_input_iterator_tag; - - template <typename G> - struct edge_property_type { - typedef typename G::edge_property_type type; - }; - template <typename G> - struct vertex_property_type { - typedef typename G::vertex_property_type type; - }; - template <typename G> - struct graph_property_type { - typedef typename G::graph_property_type type; - }; - - struct no_vertex_bundle {}; - struct no_edge_bundle {}; - - template<typename G> - struct vertex_bundle_type - { - typedef typename G::vertex_bundled type; - }; - - template<typename G> - struct edge_bundle_type - { - typedef typename G::edge_bundled type; - }; - - namespace graph { namespace detail { - template<typename Graph, typename Descriptor> - class bundled_result - { - typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - typedef typename mpl::if_c<(is_same<Descriptor, Vertex>::value), - vertex_bundle_type<Graph>, - edge_bundle_type<Graph> >::type bundler; - - public: - typedef typename bundler::type type; + template <typename G> + struct graph_traits { + typedef typename G::vertex_descriptor vertex_descriptor; + typedef typename G::edge_descriptor edge_descriptor; + typedef typename G::adjacency_iterator adjacency_iterator; + typedef typename G::out_edge_iterator out_edge_iterator; + typedef typename G::in_edge_iterator in_edge_iterator; + typedef typename G::vertex_iterator vertex_iterator; + typedef typename G::edge_iterator edge_iterator; + + typedef typename G::directed_category directed_category; + typedef typename G::edge_parallel_category edge_parallel_category; + typedef typename G::traversal_category traversal_category; + + typedef typename G::vertices_size_type vertices_size_type; + typedef typename G::edges_size_type edges_size_type; + typedef typename G::degree_size_type degree_size_type; + + static inline vertex_descriptor null_vertex(); + }; + + template <typename G> + inline typename graph_traits<G>::vertex_descriptor + graph_traits<G>::null_vertex() + { return G::null_vertex(); } + + // directed_category tags + struct directed_tag { }; + struct undirected_tag { }; + struct bidirectional_tag : public directed_tag { }; + + namespace detail { + inline bool is_directed(directed_tag) { return true; } + inline bool is_directed(undirected_tag) { return false; } + } + + /** Return true if the given graph is directed. */ + template <typename Graph> + bool is_directed(const Graph&) { + typedef typename graph_traits<Graph>::directed_category Cat; + return detail::is_directed(Cat()); + } + + /** Return false if the given graph is undirected. */ + template <typename Graph> + bool is_undirected(const Graph& g) { + return !is_directed(g); + } + + /** @name Directed/Undirected Graph Traits */ + //@{ + namespace graph_detail { + template <typename Tag> + struct is_directed_tag + : mpl::bool_<is_convertible<Tag, directed_tag>::value> + { }; + } // namespace graph_detail + + template <typename Graph> + struct is_directed_graph + : graph_detail::is_directed_tag< + typename graph_traits<Graph>::directed_category + > + { }; + + template <typename Graph> + struct is_undirected_graph + : mpl::not_< is_directed_graph<Graph> > + { }; + //@} + + // edge_parallel_category tags + struct allow_parallel_edge_tag { }; + struct disallow_parallel_edge_tag { }; + + namespace detail { + inline bool allows_parallel(allow_parallel_edge_tag) { return true; } + inline bool allows_parallel(disallow_parallel_edge_tag) { return false; } + } + + template <typename Graph> + bool allows_parallel_edges(const Graph&) { + typedef typename graph_traits<Graph>::edge_parallel_category Cat; + return detail::allows_parallel(Cat()); + } + + /** @name Parallel Edges Traits */ + //@{ + /** + * The is_multigraph metafunction returns true if the graph allows + * parallel edges. Technically, a multigraph is a simple graph that + * allows parallel edges, but since there are no traits for the allowance + * or disallowance of loops, this is a moot point. + */ + template <typename Graph> + struct is_multigraph + : mpl::bool_< + is_same< + typename graph_traits<Graph>::edge_parallel_category, + allow_parallel_edge_tag + >::value + > + { }; + //@} + + // traversal_category tags + struct incidence_graph_tag { }; + struct adjacency_graph_tag { }; + struct bidirectional_graph_tag : virtual incidence_graph_tag { }; + struct vertex_list_graph_tag { }; + struct edge_list_graph_tag { }; + struct adjacency_matrix_tag { }; + + /** @name Taversal Category Traits + * These traits classify graph types by their supported methods of + * vertex and edge traversal. + */ + //@{ + template <typename Graph> + struct is_incidence_graph + : mpl::bool_< + is_convertible< + typename graph_traits<Graph>::traversal_category, + incidence_graph_tag + >::value + > + { }; + + template <typename Graph> + struct is_bidirectional_graph + : mpl::bool_< + is_convertible< + typename graph_traits<Graph>::traversal_category, + bidirectional_graph_tag + >::value + > + { }; + + template <typename Graph> + struct is_vertex_list_graph + : mpl::bool_< + is_convertible< + typename graph_traits<Graph>::traversal_category, + vertex_list_graph_tag + >::value + > + { }; + + template <typename Graph> + struct is_edge_list_graph + : mpl::bool_< + is_convertible< + typename graph_traits<Graph>::traversal_category, + edge_list_graph_tag + >::value + > + { }; + + template <typename Graph> + struct is_adjacency_matrix + : mpl::bool_< + is_convertible< + typename graph_traits<Graph>::traversal_category, + adjacency_matrix_tag + >::value + > + { }; + //@} + + /** @name Directed Graph Traits + * These metafunctions are used to fully classify directed vs. undirected + * graphs. Recall that an undirected graph is also bidirectional, but it + * cannot be both undirected and directed at the same time. + */ + //@{ + template <typename Graph> + struct is_directed_unidirectional_graph + : mpl::and_< + is_directed_graph<Graph>, mpl::not_< is_bidirectional_graph<Graph> > + > + { }; + + template <typename Graph> + struct is_directed_bidirectional_graph + : mpl::and_< + is_directed_graph<Graph>, is_bidirectional_graph<Graph> + > + { }; + //@} + + //?? not the right place ?? Lee + typedef boost::forward_traversal_tag multi_pass_input_iterator_tag; + + template <typename G> + struct edge_property_type { + typedef typename G::edge_property_type type; + }; + template <typename G> + struct vertex_property_type { + typedef typename G::vertex_property_type type; }; - } } // end namespace graph::detail + template <typename G> + struct graph_property_type { + typedef typename G::graph_property_type type; + }; + + struct no_bundle { }; + struct no_vertex_bundle : no_bundle { }; + struct no_edge_bundle : no_bundle { }; + + template<typename G> + struct vertex_bundle_type { + typedef typename G::vertex_bundled type; + }; + + template<typename G> + struct edge_bundle_type { + typedef typename G::edge_bundled type; + }; + + namespace graph { namespace detail { + template<typename Graph, typename Descriptor> + class bundled_result { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename mpl::if_c<(is_same<Descriptor, Vertex>::value), + vertex_bundle_type<Graph>, + edge_bundle_type<Graph> >::type bundler; + public: + typedef typename bundler::type type; + }; + + } } // namespace graph::detail + + namespace graph_detail { + // A helper metafunction for determining whether or not a type is + // bundled. + template <typename T> + struct is_no_bundle + : mpl::bool_<is_convertible<T, no_bundle>::value> + { }; + } // namespace graph_detail + + /** @name Graph Property Traits + * These metafunctions (along with those above), can be used to access the + * vertex and edge properties (bundled or otherwise) of vertices and + * edges. + */ + //@{ + template <typename Graph> + struct has_vertex_property + : mpl::not_< + typename detail::is_no_property<typename vertex_property_type<Graph>::type> + >::type + { }; + template <typename Graph> + struct has_edge_property + : mpl::not_< + typename detail::is_no_property<typename edge_property_type<Graph>::type> + >::type + { }; + template <typename Graph> + struct has_bundled_vertex_property + : mpl::not_< + graph_detail::is_no_bundle<typename vertex_bundle_type<Graph>::type> + > + { }; + template <typename Graph> + struct has_bundled_edge_property + : mpl::not_< + graph_detail::is_no_bundle<typename edge_bundle_type<Graph>::type> + > + { }; + //@} + } // namespace boost // Since pair is in namespace std, Koenig lookup will find source and diff --git a/Utilities/BGL/boost/graph/graph_utility.hpp b/Utilities/BGL/boost/graph/graph_utility.hpp index 54fdda71cc5208a895d591180217bf07e0404e42..9976074c1aed4cab9e03c92a6830181ecf5fb541 100644 --- a/Utilities/BGL/boost/graph/graph_utility.hpp +++ b/Utilities/BGL/boost/graph/graph_utility.hpp @@ -17,9 +17,15 @@ #include <assert.h> #include <boost/config.hpp> #include <boost/tuple/tuple.hpp> -#ifndef BOOST_NO_SLIST -# include <slist> // shouldn't have to include this... -JGS + +#if !defined BOOST_NO_SLIST +# ifdef BOOST_SLIST_HEADER +# include BOOST_SLIST_HEADER +# else +# include <slist> +# endif #endif + #include <boost/graph/graph_traits.hpp> #include <boost/graph/properties.hpp> #include <boost/pending/container_traits.hpp> @@ -379,7 +385,7 @@ namespace boost { if (*ui != *vi) { for (tie(ci, ci_end) = vertices(g); ci != ci_end; ++ci) put(color, *ci, Color::white()); - if (! is_reachable(*ui, *vi, color)) + if (! is_reachable(*ui, *vi, g, color)) return false; } return true; @@ -414,6 +420,91 @@ namespace boost { make_list(const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) { return std::make_pair(t1, std::make_pair(t2, std::make_pair(t3, std::make_pair(t4, t5)))); } + namespace graph { + + // Functor for remove_parallel_edges: edge property of the removed edge is added to the remaining + template <typename EdgeProperty> + struct add_removed_edge_property + { + add_removed_edge_property(EdgeProperty ep) : ep(ep) {} + + template <typename Edge> + void operator() (Edge stay, Edge away) + { + put(ep, stay, get(ep, stay) + get(ep, away)); + } + EdgeProperty ep; + }; + + // Same as above: edge property is capacity here + template <typename Graph> + struct add_removed_edge_capacity + : add_removed_edge_property<typename property_map<Graph, edge_capacity_t>::type> + { + typedef add_removed_edge_property<typename property_map<Graph, edge_capacity_t>::type> base; + add_removed_edge_capacity(Graph& g) : base(get(edge_capacity, g)) {} + }; + + template <typename Graph> + bool has_no_vertices(const Graph& g) { + typedef typename boost::graph_traits<Graph>::vertex_iterator vi; + std::pair<vi, vi> p = vertices(g); + return (p.first == p.second); + } + + template <typename Graph> + bool has_no_edges(const Graph& g) { + typedef typename boost::graph_traits<Graph>::edge_iterator ei; + std::pair<ei, ei> p = edges(g); + return (p.first == p.second); + } + + template <typename Graph> + bool has_no_out_edges(const typename boost::graph_traits<Graph>::vertex_descriptor& v, const Graph& g) { + typedef typename boost::graph_traits<Graph>::out_edge_iterator ei; + std::pair<ei, ei> p = out_edges(v, g); + return (p.first == p.second); + } + + } // namespace graph + + #include <boost/graph/iteration_macros.hpp> + + template <class PropertyIn, class PropertyOut, class Graph> + void copy_vertex_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_VERTICES_T(u, g, Graph) + put(p_out, u, get(p_in, g)); + } + + template <class PropertyIn, class PropertyOut, class Graph> + void copy_edge_property(PropertyIn p_in, PropertyOut p_out, Graph& g) + { + BGL_FORALL_EDGES_T(e, g, Graph) + put(p_out, e, get(p_in, g)); + } + + // Return true if property_map1 and property_map2 differ + // for any of the vertices in graph. + template <typename PropertyMapFirst, + typename PropertyMapSecond, + typename Graph> + bool are_property_maps_different + (const PropertyMapFirst property_map1, + const PropertyMapSecond property_map2, + const Graph& graph) { + + BGL_FORALL_VERTICES_T(vertex, graph, Graph) { + if (get(property_map1, vertex) != + get(property_map2, vertex)) { + + return (true); + } + } + + return (false); + } + } /* namespace boost */ #endif /* BOOST_GRAPH_UTILITY_HPP*/ diff --git a/Utilities/BGL/boost/graph/graphml.hpp b/Utilities/BGL/boost/graph/graphml.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2193b4cecd4580544045a7c8b2b1edb62f46b511 --- /dev/null +++ b/Utilities/BGL/boost/graph/graphml.hpp @@ -0,0 +1,337 @@ +// Copyright (C) 2006 Tiago de Paula Peixoto <tiago@forked.de> +// Copyright (C) 2004 The Trustees of Indiana University. +// +// 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 +// Andrew Lumsdaine +// Tiago de Paula Peixoto + +#ifndef BOOST_GRAPH_GRAPHML_HPP +#define BOOST_GRAPH_GRAPHML_HPP + +#include <boost/config.hpp> +#include <boost/lexical_cast.hpp> +#include <boost/any.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/graph/dll_import_export.hpp> +#include <boost/graph/graphviz.hpp> // for exceptions +#include <typeinfo> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/mpl/find.hpp> +#include <boost/mpl/for_each.hpp> +#include <boost/property_tree/detail/xml_parser_utils.hpp> +#include <exception> +#include <sstream> + +namespace boost +{ + +///////////////////////////////////////////////////////////////////////////// +// Graph reader exceptions +///////////////////////////////////////////////////////////////////////////// +struct parse_error: public graph_exception +{ + parse_error(const std::string& err) {error = err; statement = "parse error: " + error;} + virtual ~parse_error() throw() {} + virtual const char* what() const throw() {return statement.c_str();} + std::string statement; + std::string error; +}; + + +class mutate_graph +{ +public: + virtual ~mutate_graph() {} + virtual bool is_directed() const = 0; + + virtual boost::any do_add_vertex() = 0; + virtual std::pair<boost::any,bool> do_add_edge(boost::any source, boost::any target) = 0; + + virtual void + set_graph_property(const std::string& name, const std::string& value, const std::string& value_type) = 0; + + virtual void + set_vertex_property(const std::string& name, boost::any vertex, const std::string& value, const std::string& value_type) = 0; + + virtual void + set_edge_property(const std::string& name, boost::any edge, const std::string& value, const std::string& value_type) = 0; +}; + +template<typename MutableGraph> +class mutate_graph_impl : public mutate_graph +{ + typedef typename graph_traits<MutableGraph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<MutableGraph>::edge_descriptor edge_descriptor; + + public: + mutate_graph_impl(MutableGraph& g, dynamic_properties& dp) + : m_g(g), m_dp(dp) { } + + bool is_directed() const + { + return is_convertible<typename graph_traits<MutableGraph>::directed_category, + directed_tag>::value; + } + + virtual any do_add_vertex() + { + return any(add_vertex(m_g)); + } + + virtual std::pair<any,bool> do_add_edge(any source, any target) + { + std::pair<edge_descriptor,bool> retval = add_edge(any_cast<vertex_descriptor>(source), + any_cast<vertex_descriptor>(target), m_g); + return std::make_pair(any(retval.first), retval.second); + } + + virtual void + set_graph_property(const std::string& name, const std::string& value, const std::string& value_type) + { + bool type_found = false; + try + { + mpl::for_each<value_types>(put_property<MutableGraph,value_types> + (name, m_dp, m_g, value, value_type, m_type_names, type_found)); + } + catch (bad_lexical_cast) + { + throw parse_error("invalid value \"" + value + "\" for key " + + name + " of type " + value_type); + } + if (!type_found) + throw parse_error("unrecognized type \"" + value_type + + "\" for key " + name); + + } + + virtual void + set_vertex_property(const std::string& name, any vertex, const std::string& value, const std::string& value_type) + { + bool type_found = false; + try + { + mpl::for_each<value_types>(put_property<vertex_descriptor,value_types> + (name, m_dp, any_cast<vertex_descriptor>(vertex), + value, value_type, m_type_names, type_found)); + } + catch (bad_lexical_cast) + { + throw parse_error("invalid value \"" + value + "\" for key " + + name + " of type " + value_type); + } + if (!type_found) + throw parse_error("unrecognized type \"" + value_type + + "\" for key " + name); + + } + + virtual void + set_edge_property(const std::string& name, any edge, const std::string& value, const std::string& value_type) + { + bool type_found = false; + try + { + mpl::for_each<value_types>(put_property<edge_descriptor,value_types> + (name, m_dp, any_cast<edge_descriptor>(edge), + value, value_type, m_type_names, type_found)); + } + catch (bad_lexical_cast) + { + throw parse_error("invalid value \"" + value + "\" for key " + + name + " of type " + value_type); + } + if (!type_found) + throw parse_error("unrecognized type \"" + value_type + + "\" for key " + name); + } + + template <typename Key, typename ValueVector> + class put_property + { + public: + put_property(const std::string& name, dynamic_properties& dp, const Key& key, + const std::string& value, const std::string& value_type, + const char** type_names, bool& type_found) + : m_name(name), m_dp(dp), m_key(key), m_value(value), + m_value_type(value_type), m_type_names(type_names), + m_type_found(type_found) {} + template <class Value> + void operator()(Value) + { + if (m_value_type == m_type_names[mpl::find<ValueVector,Value>::type::pos::value]) + { + put(m_name, m_dp, m_key, lexical_cast<Value>(m_value)); + m_type_found = true; + } + } + private: + const std::string& m_name; + dynamic_properties& m_dp; + const Key& m_key; + const std::string& m_value; + const std::string& m_value_type; + const char** m_type_names; + bool& m_type_found; + }; + +protected: + MutableGraph& m_g; + dynamic_properties& m_dp; + typedef mpl::vector<bool, int, long, float, double, std::string> value_types; + static const char* m_type_names[]; +}; + +template<typename MutableGraph> +const char* mutate_graph_impl<MutableGraph>::m_type_names[] = {"boolean", "int", "long", "float", "double", "string"}; + +void BOOST_GRAPH_DECL +read_graphml(std::istream& in, mutate_graph& g); + +template<typename MutableGraph> +void +read_graphml(std::istream& in, MutableGraph& g, dynamic_properties& dp) +{ + mutate_graph_impl<MutableGraph> mg(g,dp); + read_graphml(in, mg); +} + +template <typename Types> +class get_type_name +{ +public: + get_type_name(const std::type_info& type, const char** type_names, std::string& type_name) + : m_type(type), m_type_names(type_names), m_type_name(type_name) {} + template <typename Type> + void operator()(Type) + { + if (typeid(Type) == m_type) + m_type_name = m_type_names[mpl::find<Types,Type>::type::pos::value]; + } +private: + const std::type_info &m_type; + const char** m_type_names; + std::string &m_type_name; +}; + + +template <typename Graph, typename VertexIndexMap> +void +write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, + const dynamic_properties& dp, bool ordered_vertices=false) +{ + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + using boost::property_tree::xml_parser::encode_char_entities; + + BOOST_STATIC_CONSTANT(bool, + graph_is_directed = + (is_convertible<directed_category*, directed_tag*>::value)); + + out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + << "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n"; + + typedef mpl::vector<bool, short, unsigned short, int, unsigned int, long, unsigned long, long long, unsigned long long, float, double, long double, std::string> value_types; + const char* type_names[] = {"boolean", "int", "int", "int", "int", "long", "long", "long", "long", "float", "double", "double", "string"}; + std::map<std::string, std::string> graph_key_ids; + std::map<std::string, std::string> vertex_key_ids; + std::map<std::string, std::string> edge_key_ids; + int key_count = 0; + + // Output keys + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + std::string key_id = "key" + lexical_cast<std::string>(key_count++); + if (i->second->key() == typeid(Graph)) + vertex_key_ids[i->first] = key_id; + else if (i->second->key() == typeid(vertex_descriptor)) + vertex_key_ids[i->first] = key_id; + else if (i->second->key() == typeid(edge_descriptor)) + edge_key_ids[i->first] = key_id; + else + continue; + std::string type_name = "string"; + mpl::for_each<value_types>(get_type_name<value_types>(i->second->value(), type_names, type_name)); + out << " <key id=\"" << encode_char_entities(key_id) << "\" for=\"" + << (i->second->key() == typeid(Graph) ? "graph" : (i->second->key() == typeid(vertex_descriptor) ? "node" : "edge")) << "\"" + << " attr.name=\"" << i->first << "\"" + << " attr.type=\"" << type_name << "\"" + << " />\n"; + } + + out << " <graph id=\"G\" edgedefault=\"" + << (graph_is_directed ? "directed" : "undirected") << "\"" + << " parse.nodeids=\"" << (ordered_vertices ? "canonical" : "free") << "\"" + << " parse.edgeids=\"canonical\" parse.order=\"nodesfirst\">\n"; + + // Output graph data + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + if (i->second->key() == typeid(Graph)) + { + out << " <data key=\"" << graph_key_ids[i->first] << "\">" + << encode_char_entities(i->second->get_string(g)) << "</data>\n"; + } + } + + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; + vertex_iterator v, v_end; + for (tie(v, v_end) = vertices(g); v != v_end; ++v) + { + out << " <node id=\"n" << get(vertex_index, *v) << "\">\n"; + // Output data + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + if (i->second->key() == typeid(vertex_descriptor)) + { + out << " <data key=\"" << vertex_key_ids[i->first] << "\">" + << encode_char_entities(i->second->get_string(*v)) << "</data>\n"; + } + } + out << " </node>\n"; + } + + typedef typename graph_traits<Graph>::edge_iterator edge_iterator; + edge_iterator e, e_end; + typename graph_traits<Graph>::edges_size_type edge_count = 0; + for (tie(e, e_end) = edges(g); e != e_end; ++e) + { + out << " <edge id=\"e" << edge_count++ << "\" source=\"n" + << get(vertex_index, source(*e, g)) << "\" target=\"n" + << get(vertex_index, target(*e, g)) << "\">\n"; + + // Output data + for (dynamic_properties::const_iterator i = dp.begin(); i != dp.end(); ++i) + { + if (i->second->key() == typeid(edge_descriptor)) + { + out << " <data key=\"" << edge_key_ids[i->first] << "\">" + << encode_char_entities(i->second->get_string(*e)) << "</data>\n"; + } + } + out << " </edge>\n"; + } + + out << " </graph>\n" + << "</graphml>\n"; +} + + +template <typename Graph> +void +write_graphml(std::ostream& out, const Graph& g, const dynamic_properties& dp, + bool ordered_vertices=false) +{ + write_graphml(out, g, get(vertex_index, g), dp, ordered_vertices); +} + +} // boost namespace + +#endif // BOOST_GRAPH_GRAPHML_HPP diff --git a/Utilities/BGL/boost/graph/graphviz.hpp b/Utilities/BGL/boost/graph/graphviz.hpp index 71a304b205ace3d6800c2f23a76566b4db68c934..52f3468a2d6b7d55c582d143c188015f882fbce2 100644 --- a/Utilities/BGL/boost/graph/graphviz.hpp +++ b/Utilities/BGL/boost/graph/graphviz.hpp @@ -1,7 +1,7 @@ //======================================================================= // Copyright 2001 University of Notre Dame. // Copyright 2003 Jeremy Siek -// Authors: Lie-Quan Lee and Jeremy Siek +// Authors: Lie-Quan Lee, Jeremy Siek, and Douglas Gregor // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -16,13 +16,15 @@ #include <iostream> #include <fstream> #include <stdio.h> // for FILE -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/tuple/tuple.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/properties.hpp> #include <boost/graph/subgraph.hpp> #include <boost/graph/adjacency_list.hpp> -#include <boost/dynamic_property_map.hpp> +#include <boost/property_map/dynamic_property_map.hpp> +#include <boost/graph/overloading.hpp> +#include <boost/graph/dll_import_export.hpp> namespace boost { @@ -222,12 +224,17 @@ namespace boost { template <typename Graph, typename VertexPropertiesWriter, typename EdgePropertiesWriter, typename GraphPropertiesWriter, typename VertexID> - inline void write_graphviz(std::ostream& out, const Graph& g, - VertexPropertiesWriter vpw, - EdgePropertiesWriter epw, - GraphPropertiesWriter gpw, - VertexID vertex_id) + inline void + write_graphviz + (std::ostream& out, const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw, + VertexID vertex_id + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { + BOOST_CONCEPT_ASSERT((EdgeListGraphConcept<Graph>)); + typedef typename graph_traits<Graph>::directed_category cat_type; typedef graphviz_io_traits<cat_type> Traits; std::string name = "G"; @@ -253,17 +260,21 @@ namespace boost { template <typename Graph, typename VertexPropertiesWriter, typename EdgePropertiesWriter, typename GraphPropertiesWriter> - inline void write_graphviz(std::ostream& out, const Graph& g, - VertexPropertiesWriter vpw, - EdgePropertiesWriter epw, - GraphPropertiesWriter gpw) + inline void + write_graphviz(std::ostream& out, const Graph& g, + VertexPropertiesWriter vpw, + EdgePropertiesWriter epw, + GraphPropertiesWriter gpw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { write_graphviz(out, g, vpw, epw, gpw, get(vertex_index, g)); } #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // ambiguous overload problem with VC++ template <typename Graph> inline void - write_graphviz(std::ostream& out, const Graph& g) { + write_graphviz(std::ostream& out, const Graph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) + { default_writer dw; default_writer gw; write_graphviz(out, g, dw, dw, gw); @@ -272,7 +283,9 @@ namespace boost { template <typename Graph, typename VertexWriter> inline void - write_graphviz(std::ostream& out, const Graph& g, VertexWriter vw) { + write_graphviz(std::ostream& out, const Graph& g, VertexWriter vw + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) + { default_writer dw; default_writer gw; write_graphviz(out, g, vw, dw, gw); @@ -281,7 +294,9 @@ namespace boost { template <typename Graph, typename VertexWriter, typename EdgeWriter> inline void write_graphviz(std::ostream& out, const Graph& g, - VertexWriter vw, EdgeWriter ew) { + VertexWriter vw, EdgeWriter ew + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) + { default_writer gw; write_graphviz(out, g, vw, ew, gw); } @@ -390,7 +405,7 @@ namespace boost { detail::write_graphviz_subgraph(out, g, vertex_marker.begin(), - edge_marker.begin(), + edge_marker.begin(), get(vertex_index, g)); } @@ -408,20 +423,20 @@ namespace boost { template <typename Graph, typename VertexID> void write_graphviz(std::ostream& out, const subgraph<Graph>& g, - VertexID vertex_id) + VertexID vertex_id) { std::vector<bool> edge_marker(num_edges(g), true); std::vector<bool> vertex_marker(num_vertices(g), true); detail::write_graphviz_subgraph(out, g, vertex_marker.begin(), - edge_marker.begin(), + edge_marker.begin(), vertex_id); } template <typename Graph, typename VertexID> void write_graphviz(const std::string& filename, const subgraph<Graph>& g, - VertexID vertex_id) + VertexID vertex_id) { std::ofstream out(filename.c_str()); std::vector<bool> edge_marker(num_edges(g), true); @@ -465,11 +480,12 @@ namespace boost { // These four require linking the BGL-Graphviz library: libbgl-viz.a // from the /src directory. - extern void read_graphviz(const std::string& file, GraphvizDigraph& g); - extern void read_graphviz(FILE* file, GraphvizDigraph& g); - - extern void read_graphviz(const std::string& file, GraphvizGraph& g); - extern void read_graphviz(FILE* file, GraphvizGraph& g); + // Library has not existed for a while + // extern void read_graphviz(const std::string& file, GraphvizDigraph& g); + // extern void read_graphviz(FILE* file, GraphvizDigraph& g); + // + // extern void read_graphviz(const std::string& file, GraphvizGraph& g); + // extern void read_graphviz(FILE* file, GraphvizGraph& g); class dynamic_properties_writer { @@ -480,7 +496,7 @@ namespace boost { void operator()(std::ostream& out, Descriptor key) const { bool first = true; - for (dynamic_properties::const_iterator i = dp->begin(); + for (dynamic_properties::const_iterator i = dp->begin(); i != dp->end(); ++i) { if (typeid(key) == i->second->key()) { if (first) out << " ["; @@ -502,14 +518,14 @@ namespace boost { { public: dynamic_vertex_properties_writer(const dynamic_properties& dp, - const std::string& node_id) + const std::string& node_id) : dp(&dp), node_id(&node_id) { } template<typename Descriptor> void operator()(std::ostream& out, Descriptor key) const { bool first = true; - for (dynamic_properties::const_iterator i = dp->begin(); + for (dynamic_properties::const_iterator i = dp->begin(); i != dp->end(); ++i) { if (typeid(key) == i->second->key() && i->first != *node_id) { @@ -550,8 +566,8 @@ namespace boost { }; template<typename Vertex> - inline std::string - get(node_id_property_map<Vertex> pm, + inline std::string + get(node_id_property_map<Vertex> pm, typename node_id_property_map<Vertex>::key_type v) { return get(*pm.node_id, *pm.dp, v); } @@ -560,8 +576,9 @@ namespace boost { template<typename Graph> inline void write_graphviz(std::ostream& out, const Graph& g, - const dynamic_properties& dp, - const std::string& node_id = "node_id") + const dynamic_properties& dp, + const std::string& node_id = "node_id" + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { typedef typename graph_traits<Graph>::vertex_descriptor Vertex; write_graphviz(out, g, dp, node_id, @@ -572,7 +589,8 @@ namespace boost { void write_graphviz(std::ostream& out, const Graph& g, const dynamic_properties& dp, const std::string& node_id, - VertexID id) + VertexID id + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) { write_graphviz (out, g, @@ -626,6 +644,14 @@ struct undirected_graph_error : public graph_exception { } }; +struct bad_graphviz_syntax: public graph_exception { + std::string errmsg; + bad_graphviz_syntax(const std::string& errmsg) + : errmsg(errmsg) {} + const char* what() const throw () {return errmsg.c_str();} + ~bad_graphviz_syntax() throw () {}; +}; + namespace detail { namespace graph { typedef std::string id_t; @@ -640,7 +666,7 @@ public: static int idx = 0; return edge_t(idx++); }; - + bool operator==(const edge_t& rhs) const { return idx_ == rhs.idx_; } @@ -656,15 +682,18 @@ class mutate_graph virtual bool is_directed() const = 0; virtual void do_add_vertex(const node_t& node) = 0; - virtual void + virtual void do_add_edge(const edge_t& edge, const node_t& source, const node_t& target) = 0; - virtual void + virtual void set_node_property(const id_t& key, const node_t& node, const id_t& value) = 0; - virtual void + virtual void set_edge_property(const id_t& key, const edge_t& edge, const id_t& value) = 0; + + virtual void // RG: need new second parameter to support BGL subgraphs + set_graph_property(const id_t& key, const id_t& value) = 0; }; template<typename MutableGraph> @@ -682,7 +711,7 @@ class mutate_graph_impl : public mutate_graph bool is_directed() const { - return + return boost::is_convertible< typename boost::graph_traits<MutableGraph>::directed_category, boost::directed_tag>::value; @@ -695,20 +724,20 @@ class mutate_graph_impl : public mutate_graph // Set up a mapping from name to BGL vertex. bgl_nodes.insert(std::make_pair(node, v)); - + // node_id_prop_ allows the caller to see the real id names for nodes. put(node_id_prop_, dp_, v, node); } - void + void do_add_edge(const edge_t& edge, const node_t& source, const node_t& target) { std::pair<bgl_edge_t, bool> result = add_edge(bgl_nodes[source], bgl_nodes[target], graph_); - + if(!result.second) { // In the case of no parallel edges allowed - throw bad_parallel_edge(source, target); + boost::throw_exception(bad_parallel_edge(source, target)); } else { bgl_edges.insert(std::make_pair(edge, result.first)); } @@ -726,6 +755,14 @@ class mutate_graph_impl : public mutate_graph put(key, dp_, bgl_edges[edge], value); } + void + set_graph_property(const id_t& key, const id_t& value) + { + /* RG: pointer to graph prevents copying */ + put(key, dp_, &graph_, value); + } + + protected: MutableGraph& graph_; dynamic_properties& dp_; @@ -734,6 +771,7 @@ class mutate_graph_impl : public mutate_graph std::map<edge_t, bgl_edge_t> bgl_edges; }; +BOOST_GRAPH_DECL bool read_graphviz(std::istream& in, mutate_graph& graph); } } // end namespace detail::graph @@ -742,16 +780,29 @@ bool read_graphviz(std::istream& in, mutate_graph& graph); template <typename MutableGraph> bool read_graphviz(std::istream& in, MutableGraph& graph, dynamic_properties& dp, - std::string const& node_id = "node_id") + std::string const& node_id = "node_id") { - detail::graph::mutate_graph_impl<MutableGraph> m_graph(graph, dp, node_id); - return detail::graph::read_graphviz(in, m_graph); + std::string data; + in >> std::noskipws; + std::copy(std::istream_iterator<char>(in), + std::istream_iterator<char>(), + std::back_inserter(data)); + return read_graphviz(data,graph,dp,node_id); } } // namespace boost -#ifdef BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +#ifdef BOOST_GRAPH_USE_SPIRIT_PARSER +# ifndef BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +# define BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +# endif # include <boost/graph/detail/read_graphviz_spirit.hpp> -#endif // BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS +#else // New default parser +# include <boost/graph/detail/read_graphviz_new.hpp> +#endif // BOOST_GRAPH_USE_SPIRIT_PARSER + +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/graphviz.hpp> +#endif #endif // BOOST_GRAPHVIZ_HPP diff --git a/Utilities/BGL/boost/graph/grid_graph.hpp b/Utilities/BGL/boost/graph/grid_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bda68d5161e83d8c137aaaab7b451887603eb9da --- /dev/null +++ b/Utilities/BGL/boost/graph/grid_graph.hpp @@ -0,0 +1,991 @@ +//======================================================================= +// Copyright 2009 Trustees of Indiana University. +// Authors: Michael Hansen, Andrew Lumsdaine +// +// 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_GRID_GRAPH_HPP +#define BOOST_GRAPH_GRID_GRAPH_HPP + +#include <cmath> +#include <functional> +#include <numeric> + +#include <boost/array.hpp> +#include <boost/bind.hpp> +#include <boost/limits.hpp> +#include <boost/make_shared.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/properties.hpp> +#include <boost/iterator/counting_iterator.hpp> +#include <boost/iterator/transform_iterator.hpp> +#include <boost/property_map/property_map.hpp> + +#define BOOST_GRID_GRAPH_TEMPLATE_PARAMS \ + std::size_t DimensionsT, typename VertexIndexT, \ + typename EdgeIndexT + +#define BOOST_GRID_GRAPH_TYPE \ + grid_graph<DimensionsT, VertexIndexT, EdgeIndexT> + +#define BOOST_GRID_GRAPH_TYPE_MEM typename BOOST_GRID_GRAPH_TYPE:: + +#define BOOST_GRID_GRAPH_TYPE_TD(mem) \ + typedef typename BOOST_GRID_GRAPH_TYPE::mem mem + +#define BOOST_GRID_GRAPH_TRAITS_T \ + typename graph_traits<BOOST_GRID_GRAPH_TYPE > + +namespace boost { + + // Class prototype for grid_graph + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + class grid_graph; + + //=================== + // Index Property Map + //=================== + + template <typename Graph, + typename Descriptor, + typename Index> + struct grid_graph_index_map { + public: + typedef Index value_type; + typedef Index reference_type; + typedef reference_type reference; + typedef Descriptor key_type; + typedef readable_property_map_tag category; + + grid_graph_index_map() { } + + grid_graph_index_map(const Graph& graph) : + m_graph(make_shared<Graph>(graph)) { } + + value_type operator[](key_type key) const { + return (m_graph->index_of(key)); + } + + protected: + shared_ptr<Graph> m_graph; + }; + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + struct property_map<BOOST_GRID_GRAPH_TYPE, vertex_index_t> { + typedef grid_graph_index_map<BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TRAITS_T::vertex_descriptor, + BOOST_GRID_GRAPH_TRAITS_T::vertices_size_type> type; + typedef type const_type; + }; + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + struct property_map<BOOST_GRID_GRAPH_TYPE, edge_index_t> { + typedef grid_graph_index_map<BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TRAITS_T::edge_descriptor, + BOOST_GRID_GRAPH_TRAITS_T::edges_size_type> type; + typedef type const_type; + }; + + //================= + // Function Objects + //================= + + namespace detail { + + // vertex_at + template <typename Graph> + struct grid_graph_vertex_at { + + typedef typename graph_traits<Graph>::vertex_descriptor result_type; + + grid_graph_vertex_at(const Graph* graph) : + m_graph(graph) { } + + result_type + operator() + (typename graph_traits<Graph>::vertices_size_type vertex_index) const { + return (vertex(vertex_index, *m_graph)); + } + + private: + const Graph* m_graph; + }; + + // out_edge_at + template <typename Graph> + struct grid_graph_out_edge_at { + + private: + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + public: + typedef typename graph_traits<Graph>::edge_descriptor result_type; + + grid_graph_out_edge_at(vertex_descriptor source_vertex, + const Graph* graph) : + m_vertex(source_vertex), + m_graph(graph) { } + + result_type + operator() + (typename graph_traits<Graph>::degree_size_type out_edge_index) const { + return (out_edge_at(m_vertex, out_edge_index, *m_graph)); + } + + private: + vertex_descriptor m_vertex; + const Graph* m_graph; + }; + + // in_edge_at + template <typename Graph> + struct grid_graph_in_edge_at { + + private: + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + + public: + typedef typename graph_traits<Graph>::edge_descriptor result_type; + + grid_graph_in_edge_at(vertex_descriptor target_vertex, + const Graph* graph) : + m_vertex(target_vertex), + m_graph(graph) { } + + result_type + operator() + (typename graph_traits<Graph>::degree_size_type in_edge_index) const { + return (in_edge_at(m_vertex, in_edge_index, *m_graph)); + } + + private: + vertex_descriptor m_vertex; + const Graph* m_graph; + }; + + // edge_at + template <typename Graph> + struct grid_graph_edge_at { + + typedef typename graph_traits<Graph>::edge_descriptor result_type; + + grid_graph_edge_at(const Graph* graph) : + m_graph(graph) { } + + result_type + operator() + (typename graph_traits<Graph>::edges_size_type edge_index) const { + return (edge_at(edge_index, *m_graph)); + } + + private: + const Graph* m_graph; + }; + + // adjacent_vertex_at + template <typename Graph> + struct grid_graph_adjacent_vertex_at { + + public: + typedef typename graph_traits<Graph>::vertex_descriptor result_type; + + grid_graph_adjacent_vertex_at(result_type source_vertex, + const Graph* graph) : + m_vertex(source_vertex), + m_graph(graph) { } + + result_type + operator() + (typename graph_traits<Graph>::degree_size_type adjacent_index) const { + return (target(out_edge_at(m_vertex, adjacent_index, *m_graph), *m_graph)); + } + + private: + result_type m_vertex; + const Graph* m_graph; + }; + + } // namespace detail + + //=========== + // Grid Graph + //=========== + + template <std::size_t Dimensions, + typename VertexIndex = std::size_t, + typename EdgeIndex = VertexIndex> + class grid_graph { + + private: + typedef boost::array<bool, Dimensions> WrapDimensionArray; + grid_graph() { }; + + public: + + typedef grid_graph<Dimensions, VertexIndex, EdgeIndex> type; + + // sizes + typedef VertexIndex vertices_size_type; + typedef EdgeIndex edges_size_type; + typedef EdgeIndex degree_size_type; + + // descriptors + typedef boost::array<VertexIndex, Dimensions> vertex_descriptor; + typedef std::pair<vertex_descriptor, vertex_descriptor> edge_descriptor; + + // vertex_iterator + typedef counting_iterator<vertices_size_type> vertex_index_iterator; + typedef detail::grid_graph_vertex_at<type> vertex_function; + typedef transform_iterator<vertex_function, vertex_index_iterator> vertex_iterator; + + // edge_iterator + typedef counting_iterator<edges_size_type> edge_index_iterator; + typedef detail::grid_graph_edge_at<type> edge_function; + typedef transform_iterator<edge_function, edge_index_iterator> edge_iterator; + + // out_edge_iterator + typedef counting_iterator<degree_size_type> degree_iterator; + typedef detail::grid_graph_out_edge_at<type> out_edge_function; + typedef transform_iterator<out_edge_function, degree_iterator> out_edge_iterator; + + // in_edge_iterator + typedef detail::grid_graph_in_edge_at<type> in_edge_function; + typedef transform_iterator<in_edge_function, degree_iterator> in_edge_iterator; + + // adjacency_iterator + typedef detail::grid_graph_adjacent_vertex_at<type> adjacent_vertex_function; + typedef transform_iterator<adjacent_vertex_function, degree_iterator> adjacency_iterator; + + // categories + typedef undirected_tag directed_category; + typedef disallow_parallel_edge_tag edge_parallel_category; + struct traversal_category : virtual public incidence_graph_tag, + virtual public adjacency_graph_tag, + virtual public vertex_list_graph_tag, + virtual public edge_list_graph_tag, + virtual public bidirectional_graph_tag, + virtual public adjacency_matrix_tag { }; + + static inline vertex_descriptor null_vertex() + { + vertex_descriptor maxed_out_vertex; + std::fill(maxed_out_vertex.begin(), maxed_out_vertex.end(), + (std::numeric_limits<vertices_size_type>::max)()); + + return (maxed_out_vertex); + } + + // Constructor that defaults to no wrapping for all dimensions. + grid_graph(vertex_descriptor dimension_lengths) : + m_dimension_lengths(dimension_lengths) { + + std::fill(m_wrap_dimension.begin(), + m_wrap_dimension.end(), false); + + precalculate(); + } + + // Constructor that allows for wrapping to be specified for all + // dimensions at once. + grid_graph(vertex_descriptor dimension_lengths, + bool wrap_all_dimensions) : + m_dimension_lengths(dimension_lengths) { + + std::fill(m_wrap_dimension.begin(), + m_wrap_dimension.end(), + wrap_all_dimensions); + + precalculate(); + } + + // Constructor that allows for individual dimension wrapping to be + // specified. + grid_graph(vertex_descriptor dimension_lengths, + WrapDimensionArray wrap_dimension) : + m_dimension_lengths(dimension_lengths), + m_wrap_dimension(wrap_dimension) { + + precalculate(); + } + + // Returns the number of dimensions in the graph + inline std::size_t dimensions() const { + return (Dimensions); + } + + // Returns the length of dimension [dimension_index] + inline vertices_size_type length(std::size_t dimension) const { + return (m_dimension_lengths[dimension]); + } + + // Returns a value indicating if dimension [dimension_index] wraps + inline bool wrapped(std::size_t dimension) const { + return (m_wrap_dimension[dimension]); + } + + // Gets the vertex that is [distance] units ahead of [vertex] in + // dimension [dimension_index]. + vertex_descriptor next + (vertex_descriptor vertex, + std::size_t dimension_index, + vertices_size_type distance = 1) const { + + vertices_size_type new_position = + vertex[dimension_index] + distance; + + if (wrapped(dimension_index)) { + new_position %= length(dimension_index); + } + else { + // Stop at the end of this dimension if necessary. + new_position = + (std::min)(new_position, + length(dimension_index) - 1); + } + + vertex[dimension_index] = new_position; + + return (vertex); + } + + // Gets the vertex that is [distance] units behind [vertex] in + // dimension [dimension_index]. + vertex_descriptor previous + (vertex_descriptor vertex, + std::size_t dimension_index, + vertices_size_type distance = 1) const { + + // We're assuming that vertices_size_type is unsigned, so we + // need to be careful about the math. + vertex[dimension_index] = + (distance > vertex[dimension_index]) ? + (wrapped(dimension_index) ? + (length(dimension_index) - (distance % length(dimension_index))) : 0) : + vertex[dimension_index] - distance; + + return (vertex); + } + + protected: + + // Returns the number of vertices in the graph + inline vertices_size_type num_vertices() const { + return (m_num_vertices); + } + + // Returns the number of edges in the graph + inline edges_size_type num_edges() const { + return (m_num_edges); + } + + // Returns the number of edges in dimension [dimension_index] + inline edges_size_type num_edges + (std::size_t dimension_index) const { + return (m_edge_count[dimension_index]); + } + + // Returns the index of [vertex] (See also vertex_at) + vertices_size_type index_of(vertex_descriptor vertex) const { + + vertices_size_type vertex_index = 0; + vertices_size_type index_multiplier = 1; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + vertex_index += (vertex[dimension_index] * index_multiplier); + index_multiplier *= length(dimension_index); + } + + return (vertex_index); + } + + // Returns the vertex whose index is [vertex_index] (See also + // index_of(vertex_descriptor)) + vertex_descriptor vertex_at + (vertices_size_type vertex_index) const { + + array<vertices_size_type, Dimensions> vertex; + vertices_size_type index_divider = 1; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + vertex[dimension_index] = (vertex_index / index_divider) % + length(dimension_index); + + index_divider *= length(dimension_index); + } + + return (vertex); + } + + // Returns the edge whose index is [edge_index] (See also + // index_of(edge_descriptor)). NOTE: The index mapping is + // dependent upon dimension wrapping. + edge_descriptor edge_at(edges_size_type edge_index) const { + + // Edge indices are sorted into bins by dimension + std::size_t dimension_index = 0; + edges_size_type dimension_edges = num_edges(0); + + while (edge_index >= dimension_edges) { + edge_index -= dimension_edges; + ++dimension_index; + dimension_edges = num_edges(dimension_index); + } + + vertex_descriptor vertex_source, vertex_target; + bool is_forward = ((edge_index / (num_edges(dimension_index) / 2)) == 0); + + if (wrapped(dimension_index)) { + vertex_source = vertex_at(edge_index % num_vertices()); + vertex_target = is_forward ? + next(vertex_source, dimension_index) : + previous(vertex_source, dimension_index); + } + else { + + // Dimensions can wrap arbitrarily, so an index needs to be + // computed in a more complex manner. This is done by + // grouping the edges for each dimension together into "bins" + // and considering [edge_index] as an offset into the bin. + // Each bin consists of two parts: the "forward" looking edges + // and the "backward" looking edges for the dimension. + + edges_size_type vertex_offset = edge_index % num_edges(dimension_index); + + // Consider vertex_offset an index into the graph's vertex + // space but with the dimension [dimension_index] reduced in + // size by one. + vertices_size_type index_divider = 1; + + for (std::size_t dimension_index_iter = 0; + dimension_index_iter < Dimensions; + ++dimension_index_iter) { + + std::size_t dimension_length = (dimension_index_iter == dimension_index) ? + length(dimension_index_iter) - 1 : + length(dimension_index_iter); + + vertex_source[dimension_index_iter] = (vertex_offset / index_divider) % + dimension_length; + + index_divider *= dimension_length; + } + + if (is_forward) { + vertex_target = next(vertex_source, dimension_index); + } + else { + // Shift forward one more unit in the dimension for backward + // edges since the algorithm above will leave us one behind. + vertex_target = vertex_source; + ++vertex_source[dimension_index]; + } + + } // if (wrapped(dimension_index)) + + return (std::make_pair(vertex_source, vertex_target)); + } + + // Returns the index for [edge] (See also edge_at) + edges_size_type index_of(edge_descriptor edge) const { + vertex_descriptor source_vertex = source(edge, *this); + vertex_descriptor target_vertex = target(edge, *this); + + // Determine the dimension where the source and target vertices + // differ (should only be one if this is a valid edge). + std::size_t different_dimension_index = 0; + + while (source_vertex[different_dimension_index] == + target_vertex[different_dimension_index]) { + + ++different_dimension_index; + } + + edges_size_type edge_index = 0; + + // Offset the edge index into the appropriate "bin" (see edge_at + // for a more in-depth description). + for (std::size_t dimension_index = 0; + dimension_index < different_dimension_index; + ++dimension_index) { + + edge_index += num_edges(dimension_index); + } + + // Get the position of both vertices in the differing dimension. + vertices_size_type source_position = source_vertex[different_dimension_index]; + vertices_size_type target_position = target_vertex[different_dimension_index]; + + // Determine if edge is forward or backward + bool is_forward = true; + + if (wrapped(different_dimension_index)) { + + // If the dimension is wrapped, an edge is going backward if + // either A: its target precedes the source in the differing + // dimension and the vertices are adjacent or B: its source + // precedes the target and they're not adjacent. + if (((target_position < source_position) && + ((source_position - target_position) == 1)) || + ((source_position < target_position) && + ((target_position - source_position) > 1))) { + + is_forward = false; + } + } + else if (target_position < source_position) { + is_forward = false; + } + + // "Backward" edges are in the second half of the bin. + if (!is_forward) { + edge_index += (num_edges(different_dimension_index) / 2); + } + + // Finally, apply the vertex offset + if (wrapped(different_dimension_index)) { + edge_index += index_of(source_vertex); + } + else { + vertices_size_type index_multiplier = 1; + + if (!is_forward) { + --source_vertex[different_dimension_index]; + } + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + edge_index += (source_vertex[dimension_index] * index_multiplier); + index_multiplier *= (dimension_index == different_dimension_index) ? + length(dimension_index) - 1 : + length(dimension_index); + } + } + + return (edge_index); + } + + // Returns the number of out-edges for [vertex] + degree_size_type out_degree(vertex_descriptor vertex) const { + + degree_size_type out_edge_count = 0; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + // If the vertex is on the edge of this dimension, then its + // number of out edges is dependent upon whether the dimension + // wraps or not. + if ((vertex[dimension_index] == 0) || + (vertex[dimension_index] == (length(dimension_index) - 1))) { + out_edge_count += (wrapped(dimension_index) ? 2 : 1); + } + else { + // Next and previous edges, regardless or wrapping + out_edge_count += 2; + } + } + + return (out_edge_count); + } + + // Returns an out-edge for [vertex] by index. Indices are in the + // range [0, out_degree(vertex)). + edge_descriptor out_edge_at + (vertex_descriptor vertex, + degree_size_type out_edge_index) const { + + edges_size_type edges_left = out_edge_index + 1; + std::size_t dimension_index = 0; + bool is_forward = false; + + // Walks the out edges of [vertex] and accommodates for dimension + // wrapping. + while (edges_left > 0) { + + if (!wrapped(dimension_index)) { + if (!is_forward && (vertex[dimension_index] == 0)) { + is_forward = true; + continue; + } + else if (is_forward && + (vertex[dimension_index] == (length(dimension_index) - 1))) { + is_forward = false; + ++dimension_index; + continue; + } + } + + --edges_left; + + if (edges_left > 0) { + is_forward = !is_forward; + + if (!is_forward) { + ++dimension_index; + } + } + } + + return (std::make_pair(vertex, is_forward ? + next(vertex, dimension_index) : + previous(vertex, dimension_index))); + } + + // Returns the number of in-edges for [vertex] + inline degree_size_type in_degree(vertex_descriptor vertex) const { + return (out_degree(vertex)); + } + + // Returns an in-edge for [vertex] by index. Indices are in the + // range [0, in_degree(vertex)). + edge_descriptor in_edge_at + (vertex_descriptor vertex, + edges_size_type in_edge_index) const { + + edge_descriptor out_edge = out_edge_at(vertex, in_edge_index); + return (std::make_pair(target(out_edge, *this), source(out_edge, *this))); + + } + + // Pre-computes the number of vertices and edges + void precalculate() { + m_num_vertices = + std::accumulate(m_dimension_lengths.begin(), + m_dimension_lengths.end(), 1, + std::multiplies<vertices_size_type>()); + + // Calculate number of edges in each dimension + m_num_edges = 0; + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + if (wrapped(dimension_index)) { + m_edge_count[dimension_index] = num_vertices() * 2; + } + else { + m_edge_count[dimension_index] = + (num_vertices() - (num_vertices() / length(dimension_index))) * 2; + } + + m_num_edges += num_edges(dimension_index); + } + } + + const vertex_descriptor m_dimension_lengths; + WrapDimensionArray m_wrap_dimension; + vertices_size_type m_num_vertices; + + boost::array<edges_size_type, Dimensions> m_edge_count; + edges_size_type m_num_edges; + + public: + + //================ + // VertexListGraph + //================ + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM vertex_iterator, + BOOST_GRID_GRAPH_TYPE_MEM vertex_iterator> + vertices(const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(vertex_iterator); + BOOST_GRID_GRAPH_TYPE_TD(vertex_function); + BOOST_GRID_GRAPH_TYPE_TD(vertex_index_iterator); + + return (std::make_pair + (vertex_iterator(vertex_index_iterator(0), + vertex_function(&graph)), + vertex_iterator(vertex_index_iterator(graph.num_vertices()), + vertex_function(&graph)))); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + num_vertices(const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.num_vertices()); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor + vertex(BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type vertex_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + + return (graph.vertex_at(vertex_index)); + } + + //=============== + // IncidenceGraph + //=============== + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM out_edge_iterator, + BOOST_GRID_GRAPH_TYPE_MEM out_edge_iterator> + out_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); + BOOST_GRID_GRAPH_TYPE_TD(out_edge_function); + BOOST_GRID_GRAPH_TYPE_TD(out_edge_iterator); + + return (std::make_pair + (out_edge_iterator(degree_iterator(0), + out_edge_function(vertex, &graph)), + out_edge_iterator(degree_iterator(graph.out_degree(vertex)), + out_edge_function(vertex, &graph)))); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + out_degree + (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.out_degree(vertex)); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor + out_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + BOOST_GRID_GRAPH_TYPE_MEM degree_size_type out_edge_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.out_edge_at(vertex, out_edge_index)); + } + + //=============== + // AdjacencyGraph + //=============== + + template <BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend typename std::pair<BOOST_GRID_GRAPH_TYPE_MEM adjacency_iterator, + BOOST_GRID_GRAPH_TYPE_MEM adjacency_iterator> + adjacent_vertices (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); + BOOST_GRID_GRAPH_TYPE_TD(adjacent_vertex_function); + BOOST_GRID_GRAPH_TYPE_TD(adjacency_iterator); + + return (std::make_pair + (adjacency_iterator(degree_iterator(0), + adjacent_vertex_function(vertex, &graph)), + adjacency_iterator(degree_iterator(graph.out_degree(vertex)), + adjacent_vertex_function(vertex, &graph)))); + } + + //============== + // EdgeListGraph + //============== + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type + num_edges(const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.num_edges()); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor + edge_at(BOOST_GRID_GRAPH_TYPE_MEM edges_size_type edge_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.edge_at(edge_index)); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM edge_iterator, + BOOST_GRID_GRAPH_TYPE_MEM edge_iterator> + edges(const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(edge_index_iterator); + BOOST_GRID_GRAPH_TYPE_TD(edge_function); + BOOST_GRID_GRAPH_TYPE_TD(edge_iterator); + + return (std::make_pair + (edge_iterator(edge_index_iterator(0), + edge_function(&graph)), + edge_iterator(edge_index_iterator(graph.num_edges()), + edge_function(&graph)))); + } + + //=================== + // BiDirectionalGraph + //=================== + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline std::pair<BOOST_GRID_GRAPH_TYPE_MEM in_edge_iterator, + BOOST_GRID_GRAPH_TYPE_MEM in_edge_iterator> + in_edges(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + BOOST_GRID_GRAPH_TYPE_TD(in_edge_function); + BOOST_GRID_GRAPH_TYPE_TD(degree_iterator); + BOOST_GRID_GRAPH_TYPE_TD(in_edge_iterator); + + return (std::make_pair + (in_edge_iterator(degree_iterator(0), + in_edge_function(vertex, &graph)), + in_edge_iterator(degree_iterator(graph.in_degree(vertex)), + in_edge_function(vertex, &graph)))); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + in_degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.in_degree(vertex)); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM degree_size_type + degree (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.out_degree(vertex) * 2); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor + in_edge_at(BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex, + BOOST_GRID_GRAPH_TYPE_MEM degree_size_type in_edge_index, + const BOOST_GRID_GRAPH_TYPE& graph) { + return (graph.in_edge_at(vertex, in_edge_index)); + } + + + //================== + // Adjacency Matrix + //================== + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend std::pair<BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, bool> + edge (BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor source_vertex, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor destination_vertex, + const BOOST_GRID_GRAPH_TYPE& graph) { + + std::pair<BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, bool> edge_exists = + std::make_pair(std::make_pair(source_vertex, destination_vertex), false); + + for (std::size_t dimension_index = 0; + dimension_index < Dimensions; + ++dimension_index) { + + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type dim_difference = 0; + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + source_dim = source_vertex[dimension_index], + dest_dim = destination_vertex[dimension_index]; + + dim_difference = (source_dim > dest_dim) ? + (source_dim - dest_dim) : (dest_dim - source_dim); + + if (dim_difference > 0) { + + // If we've already found a valid edge, this would mean that + // the vertices are really diagonal across dimensions and + // therefore not connected. + if (edge_exists.second) { + edge_exists.second = false; + break; + } + + // If the difference is one, the vertices are right next to + // each other and the edge is valid. The edge is still + // valid, though, if the dimension wraps and the vertices + // are on opposite ends. + if ((dim_difference == 1) || + (graph.wrapped(dimension_index) && + (((source_dim == 0) && (dest_dim == (graph.length(dimension_index) - 1))) || + ((dest_dim == 0) && (source_dim == (graph.length(dimension_index) - 1)))))) { + + edge_exists.second = true; + // Stay in the loop to check for diagonal vertices. + } + else { + + // Stop checking - the vertices are too far apart. + edge_exists.second = false; + break; + } + } + + } // for dimension_index + + return (edge_exists); + } + + + //============================= + // Index Property Map Functions + //============================= + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type + get(vertex_index_t, + const BOOST_GRID_GRAPH_TYPE& graph, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor vertex) { + return (graph.index_of(vertex)); + } + + template<BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline BOOST_GRID_GRAPH_TYPE_MEM edges_size_type + get(edge_index_t, + const BOOST_GRID_GRAPH_TYPE& graph, + BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor edge) { + return (graph.index_of(edge)); + } + + template <BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type> + get(vertex_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + return (grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM vertex_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM vertices_size_type>(graph)); + } + + template <BOOST_GRID_GRAPH_TEMPLATE_PARAMS> + friend inline grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM edges_size_type> + get(edge_index_t, const BOOST_GRID_GRAPH_TYPE& graph) { + return (grid_graph_index_map< + BOOST_GRID_GRAPH_TYPE, + BOOST_GRID_GRAPH_TYPE_MEM edge_descriptor, + BOOST_GRID_GRAPH_TYPE_MEM edges_size_type>(graph)); + } + + template<typename Graph, + typename Descriptor, + typename Index> + friend inline Index + get(const grid_graph_index_map<Graph, Descriptor, Index>& index_map, + const typename grid_graph_index_map<Graph, Descriptor, Index>::key_type& key) + { + return (index_map[key]); + } + + template<typename Graph, + typename Descriptor, + typename Index> + friend struct grid_graph_index_map; + + }; // grid_graph + +} // namespace boost + +#undef BOOST_GRID_GRAPH_TYPE +#undef BOOST_GRID_GRAPH_TYPE_TD +#undef BOOST_GRID_GRAPH_TYPE_MEM +#undef BOOST_GRID_GRAPH_TEMPLATE_PARAMS +#undef BOOST_GRID_GRAPH_TRAITS_T + +#endif // BOOST_GRAPH_GRID_GRAPH_HPP diff --git a/Utilities/BGL/boost/graph/gursoy_atun_layout.hpp b/Utilities/BGL/boost/graph/gursoy_atun_layout.hpp index fb82cb720c3d08e5240536a107a9a5de0ac6d242..ed5e0509e3854df2e724e27e02e62a18eb4722f9 100644 --- a/Utilities/BGL/boost/graph/gursoy_atun_layout.hpp +++ b/Utilities/BGL/boost/graph/gursoy_atun_layout.hpp @@ -1,7 +1,7 @@ // Copyright 2004 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Jeremiah Willcock @@ -15,7 +15,7 @@ // in EuroPar 2000, p. 234 of LNCS 1900 // http://springerlink.metapress.com/link.asp?id=pcu07ew5rhexp9yt -#include <cmath> +#include <boost/config/no_tr1/cmath.hpp> #include <vector> #include <exception> #include <algorithm> @@ -28,6 +28,7 @@ #include <boost/graph/breadth_first_search.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/named_function_params.hpp> +#include <boost/graph/topology.hpp> namespace boost { @@ -351,281 +352,6 @@ gursoy_atun_layout(const VertexListAndIncidenceGraph& graph, dummy_property_map())); } -/*********************************************************** - * Topologies * - ***********************************************************/ -template<std::size_t Dims> -class convex_topology -{ - struct point - { - point() { } - double& operator[](std::size_t i) {return values[i];} - const double& operator[](std::size_t i) const {return values[i];} - - private: - double values[Dims]; - }; - - public: - typedef point point_type; - - double distance(point a, point b) const - { - double dist = 0; - for (std::size_t i = 0; i < Dims; ++i) { - double diff = b[i] - a[i]; - dist += diff * diff; - } - // Exact properties of the distance are not important, as long as - // < on what this returns matches real distances - return dist; - } - - point move_position_toward(point a, double fraction, point b) const - { - point result; - for (std::size_t i = 0; i < Dims; ++i) - result[i] = a[i] + (b[i] - a[i]) * fraction; - return result; - } -}; - -template<std::size_t Dims, - typename RandomNumberGenerator = minstd_rand> -class hypercube_topology : public convex_topology<Dims> -{ - typedef uniform_01<RandomNumberGenerator, double> rand_t; - - public: - typedef typename convex_topology<Dims>::point_type point_type; - - explicit hypercube_topology(double scaling = 1.0) - : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)), - scaling(scaling) - { } - - hypercube_topology(RandomNumberGenerator& gen, double scaling = 1.0) - : gen_ptr(), rand(new rand_t(gen)), scaling(scaling) { } - - point_type random_point() const - { - point_type p; - for (std::size_t i = 0; i < Dims; ++i) - p[i] = (*rand)() * scaling; - return p; - } - - private: - shared_ptr<RandomNumberGenerator> gen_ptr; - shared_ptr<rand_t> rand; - double scaling; -}; - -template<typename RandomNumberGenerator = minstd_rand> -class square_topology : public hypercube_topology<2, RandomNumberGenerator> -{ - typedef hypercube_topology<2, RandomNumberGenerator> inherited; - - public: - explicit square_topology(double scaling = 1.0) : inherited(scaling) { } - - square_topology(RandomNumberGenerator& gen, double scaling = 1.0) - : inherited(gen, scaling) { } -}; - -template<typename RandomNumberGenerator = minstd_rand> -class cube_topology : public hypercube_topology<3, RandomNumberGenerator> -{ - typedef hypercube_topology<3, RandomNumberGenerator> inherited; - - public: - explicit cube_topology(double scaling = 1.0) : inherited(scaling) { } - - cube_topology(RandomNumberGenerator& gen, double scaling = 1.0) - : inherited(gen, scaling) { } -}; - -template<std::size_t Dims, - typename RandomNumberGenerator = minstd_rand> -class ball_topology : public convex_topology<Dims> -{ - typedef uniform_01<RandomNumberGenerator, double> rand_t; - - public: - typedef typename convex_topology<Dims>::point_type point_type; - - explicit ball_topology(double radius = 1.0) - : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)), - radius(radius) - { } - - ball_topology(RandomNumberGenerator& gen, double radius = 1.0) - : gen_ptr(), rand(new rand_t(gen)), radius(radius) { } - - point_type random_point() const - { - point_type p; - double dist_sum; - do { - dist_sum = 0.0; - for (std::size_t i = 0; i < Dims; ++i) { - double x = (*rand)() * 2*radius - radius; - p[i] = x; - dist_sum += x * x; - } - } while (dist_sum > radius*radius); - return p; - } - - private: - shared_ptr<RandomNumberGenerator> gen_ptr; - shared_ptr<rand_t> rand; - double radius; -}; - -template<typename RandomNumberGenerator = minstd_rand> -class circle_topology : public ball_topology<2, RandomNumberGenerator> -{ - typedef ball_topology<2, RandomNumberGenerator> inherited; - - public: - explicit circle_topology(double radius = 1.0) : inherited(radius) { } - - circle_topology(RandomNumberGenerator& gen, double radius = 1.0) - : inherited(gen, radius) { } -}; - -template<typename RandomNumberGenerator = minstd_rand> -class sphere_topology : public ball_topology<3, RandomNumberGenerator> -{ - typedef ball_topology<3, RandomNumberGenerator> inherited; - - public: - explicit sphere_topology(double radius = 1.0) : inherited(radius) { } - - sphere_topology(RandomNumberGenerator& gen, double radius = 1.0) - : inherited(gen, radius) { } -}; - -template<typename RandomNumberGenerator = minstd_rand> -class heart_topology -{ - // Heart is defined as the union of three shapes: - // Square w/ corners (+-1000, -1000), (0, 0), (0, -2000) - // Circle centered at (-500, -500) radius 500*sqrt(2) - // Circle centered at (500, -500) radius 500*sqrt(2) - // Bounding box (-1000, -2000) - (1000, 500*(sqrt(2) - 1)) - - struct point - { - point() { values[0] = 0.0; values[1] = 0.0; } - point(double x, double y) { values[0] = x; values[1] = y; } - - double& operator[](std::size_t i) { return values[i]; } - double operator[](std::size_t i) const { return values[i]; } - - private: - double values[2]; - }; - - bool in_heart(point p) const - { -#ifndef BOOST_NO_STDC_NAMESPACE - using std::abs; - using std::pow; -#endif - - if (p[1] < abs(p[0]) - 2000) return false; // Bottom - if (p[1] <= -1000) return true; // Diagonal of square - if (pow(p[0] - -500, 2) + pow(p[1] - -500, 2) <= 500000) - return true; // Left circle - if (pow(p[0] - 500, 2) + pow(p[1] - -500, 2) <= 500000) - return true; // Right circle - return false; - } - - bool segment_within_heart(point p1, point p2) const - { - // Assumes that p1 and p2 are within the heart - if ((p1[0] < 0) == (p2[0] < 0)) return true; // Same side of symmetry line - if (p1[0] == p2[0]) return true; // Vertical - double slope = (p2[1] - p1[1]) / (p2[0] - p1[0]); - double intercept = p1[1] - p1[0] * slope; - if (intercept > 0) return false; // Crosses between circles - return true; - } - - typedef uniform_01<RandomNumberGenerator, double> rand_t; - - public: - typedef point point_type; - - heart_topology() - : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)) { } - - heart_topology(RandomNumberGenerator& gen) - : gen_ptr(), rand(new rand_t(gen)) { } - - point random_point() const - { -#ifndef BOOST_NO_STDC_NAMESPACE - using std::sqrt; -#endif - - point result; - double sqrt2 = sqrt(2.); - do { - result[0] = (*rand)() * (1000 + 1000 * sqrt2) - (500 + 500 * sqrt2); - result[1] = (*rand)() * (2000 + 500 * (sqrt2 - 1)) - 2000; - } while (!in_heart(result)); - return result; - } - - double distance(point a, point b) const - { -#ifndef BOOST_NO_STDC_NAMESPACE - using std::sqrt; -#endif - if (segment_within_heart(a, b)) { - // Straight line - return sqrt((b[0] - a[0]) * (b[0] - a[0]) + (b[1] - a[1]) * (b[1] - a[1])); - } else { - // Straight line bending around (0, 0) - return sqrt(a[0] * a[0] + a[1] * a[1]) + sqrt(b[0] * b[0] + b[1] * b[1]); - } - } - - point move_position_toward(point a, double fraction, point b) const - { -#ifndef BOOST_NO_STDC_NAMESPACE - using std::sqrt; -#endif - - if (segment_within_heart(a, b)) { - // Straight line - return point(a[0] + (b[0] - a[0]) * fraction, - a[1] + (b[1] - a[1]) * fraction); - } else { - double distance_to_point_a = sqrt(a[0] * a[0] + a[1] * a[1]); - double distance_to_point_b = sqrt(b[0] * b[0] + b[1] * b[1]); - double location_of_point = distance_to_point_a / - (distance_to_point_a + distance_to_point_b); - if (fraction < location_of_point) - return point(a[0] * (1 - fraction / location_of_point), - a[1] * (1 - fraction / location_of_point)); - else - return point( - b[0] * ((fraction - location_of_point) / (1 - location_of_point)), - b[1] * ((fraction - location_of_point) / (1 - location_of_point))); - } - } - - private: - shared_ptr<RandomNumberGenerator> gen_ptr; - shared_ptr<rand_t> rand; -}; - } // namespace boost #endif // BOOST_GRAPH_GURSOY_ATUN_LAYOUT_HPP diff --git a/Utilities/BGL/boost/graph/howard_cycle_ratio.hpp b/Utilities/BGL/boost/graph/howard_cycle_ratio.hpp new file mode 100644 index 0000000000000000000000000000000000000000..119499a3845cd96b80635a2bac41263835815a0d --- /dev/null +++ b/Utilities/BGL/boost/graph/howard_cycle_ratio.hpp @@ -0,0 +1,634 @@ +// Copyright (C) 2006-2009 Dmitry Bufistov and Andrey Parfenov + +// 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) + +#ifndef BOOST_GRAPH_CYCLE_RATIO_HOWARD_HPP +#define BOOST_GRAPH_CYCLE_RATIO_HOWARD_HPP + +#include <vector> +#include <list> +#include <algorithm> +#include <limits> + +#include <boost/bind.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/concept_check.hpp> +#include <boost/pending/queue.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_concepts.hpp> + +/** @file howard_cycle_ratio.hpp + * @brief The implementation of the maximum/minimum cycle ratio/mean algorithm. + * @author Dmitry Bufistov + * @author Andrey Parfenov + */ + +namespace boost { + + /** + * The mcr_float is like numeric_limits, but only for floating point types + * and only defines infinity() and epsilon(). This class is primarily used + * to encapsulate a less-precise epsilon than natively supported by the + * floating point type. + */ + template <typename Float = double> struct mcr_float { + typedef Float value_type; + + static Float infinity() + { return std::numeric_limits<value_type>::infinity(); } + + static Float epsilon() + { return Float(-0.005); } + }; + + namespace detail { + + template <typename FloatTraits> struct + min_comparator_props { + typedef std::greater<typename FloatTraits::value_type> comparator; + static const int multiplier = 1; + }; + + template <typename FloatTraits> struct + max_comparator_props { + typedef std::less<typename FloatTraits::value_type> comparator; + static const int multiplier = -1; + }; + + template <typename FloatTraits, typename ComparatorProps> + struct float_wrapper { + typedef typename FloatTraits::value_type value_type; + typedef ComparatorProps comparator_props_t; + typedef typename ComparatorProps::comparator comparator; + + static value_type infinity() + { return FloatTraits::infinity() * ComparatorProps::multiplier; } + + static value_type epsilon() + { return FloatTraits::epsilon() * ComparatorProps::multiplier; } + + }; + + /*! @class mcr_howard + * @brief Calculates optimum (maximum/minimum) cycle ratio of a directed graph. + * Uses Howard's iteration policy algorithm. </br>(It is described in the paper + * "Experimental Analysis of the Fastest Optimum Cycle Ratio and Mean Algorithm" + * by Ali Dasdan). + */ + template <typename FloatTraits, + typename Graph, typename VertexIndexMap, + typename EdgeWeight1, typename EdgeWeight2> + class mcr_howard + { + public: + typedef typename FloatTraits::value_type float_t; + typedef typename FloatTraits::comparator_props_t cmp_props_t; + typedef typename FloatTraits::comparator comparator_t; + typedef enum{ my_white = 0, my_black } my_color_type; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::vertices_size_type vn_t; + typedef std::vector<float_t> vp_t; + typedef typename boost::iterator_property_map< + typename vp_t::iterator, VertexIndexMap + > distance_map_t; //V -> float_t + + typedef typename std::vector<edge_t> ve_t; + typedef std::vector<my_color_type> vcol_t; + typedef typename ::boost::iterator_property_map< + typename ve_t::iterator, VertexIndexMap + > policy_t; //Vertex -> Edge + typedef typename ::boost::iterator_property_map< + typename vcol_t::iterator, VertexIndexMap + > color_map_t; + + typedef typename std::list<vertex_t> pinel_t;// The in_edges list of the policy graph + typedef typename std::vector<pinel_t> inedges1_t; + typedef typename ::boost::iterator_property_map< + typename inedges1_t::iterator, VertexIndexMap + > inedges_t; + typedef typename std::vector<edge_t> critical_cycle_t; + + //Bad vertex flag. If true, then the vertex is "bad". + // Vertex is "bad" if its out_degree is equal to zero. + typedef typename boost::iterator_property_map< + std::vector<int>::iterator, VertexIndexMap + > badv_t; + + /*! + * Constructor + * \param g = (V, E) - a directed multigraph. + * \param vim Vertex Index Map. Read property Map: V -> [0, num_vertices(g)). + * \param ewm edge weight map. Read property map: E -> R + * \param ew2m edge weight map. Read property map: E -> R+ + * \param infty A big enough value to guaranty that there exist a cycle with + * better ratio. + * \param cmp The compare operator for float_ts. + */ + mcr_howard(const Graph &g, VertexIndexMap vim, + EdgeWeight1 ewm, EdgeWeight2 ew2m) : + m_g(g), m_vim(vim), m_ew1m(ewm), m_ew2m(ew2m), + m_bound(mcr_bound()), + m_cr(m_bound), + m_V(num_vertices(m_g)), + m_dis(m_V, 0), m_dm(m_dis.begin(), m_vim), + m_policyc(m_V), m_policy(m_policyc.begin(), m_vim), + m_inelc(m_V), m_inel(m_inelc.begin(), m_vim), + m_badvc(m_V, false), m_badv(m_badvc.begin(), m_vim), + m_colcv(m_V), + m_col_bfs(m_V) + { } + + /*! + * \return maximum/minimum_{for all cycles C} + * [sum_{e in C} w1(e)] / [sum_{e in C} w2(e)], + * or FloatTraits::infinity() if graph has no cycles. + */ + float_t ocr_howard() + { + construct_policy_graph(); + int k = 0; + float_t mcr = 0; + do + { + mcr = policy_mcr(); + ++k; + } + while (try_improve_policy(mcr) && k < 100); //To avoid infinite loop + + const float_t eps_ = -0.00000001 * cmp_props_t::multiplier; + if (m_cmp(mcr, m_bound + eps_)) + { + return FloatTraits::infinity(); + } + else + { + return mcr; + } + } + virtual ~mcr_howard() {} + + protected: + virtual void store_critical_edge(edge_t, critical_cycle_t &) {} + virtual void store_critical_cycle(critical_cycle_t &) {} + + private: + /*! + * \return lower/upper bound for the maximal/minimal cycle ratio + */ + float_t mcr_bound() + { + typename graph_traits<Graph>::vertex_iterator vi, vie; + typename graph_traits<Graph>::out_edge_iterator oei, oeie; + float_t cz = (std::numeric_limits<float_t>::max)(); //Closest to zero value + float_t s = 0; + const float_t eps_ = std::numeric_limits<float_t>::epsilon(); + for (tie(vi, vie) = vertices(m_g); vi != vie; ++vi) + { + for (tie(oei, oeie) = out_edges(*vi, m_g); oei != oeie; ++oei) + { + s += std::abs(m_ew1m[*oei]); + float_t a = std::abs(m_ew2m[*oei]); + if ( a > eps_ && a < cz) + { + cz = a; + } + } + } + return cmp_props_t::multiplier * (s / cz); + } + + + /*! + * Constructs an arbitrary policy graph. + */ + void construct_policy_graph() + { + m_sink = graph_traits<Graph>().null_vertex(); + typename graph_traits<Graph>::vertex_iterator vi, vie; + typename graph_traits<Graph>::out_edge_iterator oei, oeie; + for ( tie(vi, vie) = vertices(m_g); vi != vie; ++vi ) + { + tie(oei, oeie) = out_edges(*vi, m_g); + typename graph_traits<Graph>::out_edge_iterator mei = + std::max_element(oei, oeie, + boost::bind(m_cmp, + boost::bind(&EdgeWeight1::operator[], m_ew1m, _1), + boost::bind(&EdgeWeight1::operator[], m_ew1m, _2) + ) + ); + if (mei == oeie) + { + if (m_sink == graph_traits<Graph>().null_vertex()) + { + m_sink = *vi; + } + m_badv[*vi] = true; + m_inel[m_sink].push_back(*vi); + } + else + { + m_inel[target(*mei, m_g)].push_back(*vi); + m_policy[*vi] = *mei; + } + } + } + /*! Sets the distance value for all vertices "v" such that there is + * a path from "v" to "sv". It does "inverse" breadth first visit of the policy + * graph, starting from the vertex "sv". + */ + void mcr_bfv(vertex_t sv, float_t cr, color_map_t c) + { + boost::queue<vertex_t> Q; + c[sv] = my_black; + Q.push(sv); + while (!Q.empty()) + { + vertex_t v = Q.top(); Q.pop(); + for (typename pinel_t::const_iterator itr = m_inel[v].begin(); + itr != m_inel[v].end(); ++itr) + //For all in_edges of the policy graph + { + if (*itr != sv) + { + if (m_badv[*itr]) + { + m_dm[*itr] = m_dm[v] + m_bound - cr; + } + else + { + m_dm[*itr] = m_dm[v] + m_ew1m[m_policy[*itr]] - + m_ew2m[m_policy[*itr]] * cr; + } + c[*itr] = my_black; + Q.push(*itr); + } + } + } + } + + /*! + * \param sv an arbitrary (undiscovered) vertex of the policy graph. + * \return a vertex in the policy graph that belongs to a cycle. + * Performs a depth first visit until a cycle edge is found. + */ + vertex_t find_cycle_vertex(vertex_t sv) + { + vertex_t gv = sv; + std::fill(m_colcv.begin(), m_colcv.end(), my_white); + color_map_t cm(m_colcv.begin(), m_vim); + do + { + cm[gv] = my_black; + if (! m_badv[gv]) + { + gv = target(m_policy[gv], m_g); + } + else + { + gv = m_sink; + } + } + while (cm[gv] != my_black); + return gv; + } + + /*! + * \param sv - vertex that belongs to a cycle in the policy graph. + */ + float_t cycle_ratio(vertex_t sv) + { + if (sv == m_sink) return m_bound; + std::pair<float_t, float_t> sums_(float_t(0), float_t(0)); + vertex_t v = sv; + critical_cycle_t cc; + do + { + store_critical_edge(m_policy[v], cc); + sums_.first += m_ew1m[m_policy[v]]; + sums_.second += m_ew2m[m_policy[v]]; + v = target(m_policy[v], m_g); + } + while (v != sv); + float_t cr = sums_.first / sums_.second; + if ( m_cmp(m_cr, cr) ) + { + m_cr = cr; + store_critical_cycle(cc); + } + return cr; + } + + /*! + * Finds the optimal cycle ratio of the policy graph + */ + float_t policy_mcr() + { + std::fill(m_col_bfs.begin(), m_col_bfs.end(), my_white); + color_map_t vcm_ = color_map_t(m_col_bfs.begin(), m_vim); + typename graph_traits<Graph>::vertex_iterator uv_itr, vie; + tie(uv_itr, vie) = vertices(m_g); + float_t mcr = m_bound; + while ( (uv_itr = std::find_if(uv_itr, vie, + boost::bind(std::equal_to<my_color_type>(), + my_white, + boost::bind(&color_map_t::operator[], vcm_, _1) + ) + ) + ) != vie ) + ///While there are undiscovered vertices + { + vertex_t gv = find_cycle_vertex(*uv_itr); + float_t cr = cycle_ratio(gv) ; + mcr_bfv(gv, cr, vcm_); + if ( m_cmp(mcr, cr) ) mcr = cr; + ++uv_itr; + } + return mcr; + } + + /*! + * Changes the edge m_policy[s] to the new_edge. + */ + void improve_policy(vertex_t s, edge_t new_edge) + { + vertex_t t = target(m_policy[s], m_g); + typename property_traits<VertexIndexMap>::value_type ti = m_vim[t]; + m_inelc[ti].erase( std::find(m_inelc[ti].begin(), m_inelc[ti].end(), s)); + m_policy[s] = new_edge; + t = target(new_edge, m_g); + m_inel[t].push_back(s); ///Maintain in_edge list + } + + /*! + * A negative cycle detector. + */ + bool try_improve_policy(float_t cr) + { + bool improved = false; + typename graph_traits<Graph>::vertex_iterator vi, vie; + typename graph_traits<Graph>::out_edge_iterator oei, oeie; + const float_t eps_ = FloatTraits::epsilon(); + for (tie(vi, vie) = vertices(m_g); vi != vie; ++vi) + { + if (!m_badv[*vi]) + { + for (tie(oei, oeie) = out_edges(*vi, m_g); oei != oeie; ++oei) + { + vertex_t t = target(*oei, m_g); + //Current distance from *vi to some vertex + float_t dis_ = m_ew1m[*oei] - m_ew2m[*oei] * cr + m_dm[t]; + if ( m_cmp(m_dm[*vi] + eps_, dis_) ) + { + improve_policy(*vi, *oei); + m_dm[*vi] = dis_; + improved = true; + } + } + } + else + { + float_t dis_ = m_bound - cr + m_dm[m_sink]; + if ( m_cmp(m_dm[*vi] + eps_, dis_) ) + { + m_dm[*vi] = dis_; + } + } + } + return improved; + } + private: + const Graph &m_g; + VertexIndexMap m_vim; + EdgeWeight1 m_ew1m; + EdgeWeight2 m_ew2m; + comparator_t m_cmp; + float_t m_bound; //> The lower/upper bound to the maximal/minimal cycle ratio + float_t m_cr; //>The best cycle ratio that has been found so far + + vn_t m_V; //>The number of the vertices in the graph + vp_t m_dis; //>Container for the distance map + distance_map_t m_dm; //>Distance map + + ve_t m_policyc; //>Container for the policy graph + policy_t m_policy; //>The interface for the policy graph + + inedges1_t m_inelc; //>Container fot in edges list + inedges_t m_inel; //>Policy graph, input edges list + + std::vector<int> m_badvc; + badv_t m_badv; //Marks "bad" vertices + + vcol_t m_colcv, m_col_bfs; //Color maps + vertex_t m_sink; //To convert any graph to "good" + }; + + /*! \class mcr_howard1 + * \brief Finds optimum cycle raio and a critical cycle + */ + template <typename FloatTraits, + typename Graph, typename VertexIndexMap, + typename EdgeWeight1, typename EdgeWeight2> + class mcr_howard1 : public + mcr_howard<FloatTraits, Graph, VertexIndexMap, + EdgeWeight1, EdgeWeight2> + { + public: + typedef mcr_howard<FloatTraits, Graph, VertexIndexMap, + EdgeWeight1, EdgeWeight2> inhr_t; + mcr_howard1(const Graph &g, VertexIndexMap vim, + EdgeWeight1 ewm, EdgeWeight2 ew2m) : + inhr_t(g, vim, ewm, ew2m) + { } + + void get_critical_cycle(typename inhr_t::critical_cycle_t &cc) + { return cc.swap(m_cc); } + + protected: + void store_critical_edge(typename inhr_t::edge_t ed, + typename inhr_t::critical_cycle_t &cc) + { cc.push_back(ed); } + + void store_critical_cycle(typename inhr_t::critical_cycle_t &cc) + { m_cc.swap(cc); } + + private: + typename inhr_t::critical_cycle_t m_cc; //Critical cycle + }; + + /*! + * \param g a directed multigraph. + * \param vim Vertex Index Map. A map V->[0, num_vertices(g)) + * \param ewm Edge weight1 map. + * \param ew2m Edge weight2 map. + * \param pcc pointer to the critical edges list. + * \return Optimum cycle ratio of g or FloatTraits::infinity() if g has no cycles. + */ + template <typename FT, + typename TG, typename TVIM, + typename TEW1, typename TEW2, + typename EV> + typename FT::value_type + optimum_cycle_ratio(const TG &g, TVIM vim, TEW1 ewm, TEW2 ew2m, EV* pcc) + { + typedef typename graph_traits<TG>::directed_category DirCat; + BOOST_STATIC_ASSERT((is_convertible<DirCat*, directed_tag*>::value == true)); + function_requires< IncidenceGraphConcept<TG> >(); + function_requires< VertexListGraphConcept<TG> >(); + typedef typename graph_traits<TG>::vertex_descriptor Vertex; + function_requires< ReadablePropertyMapConcept<TVIM, Vertex> >(); + typedef typename graph_traits<TG>::edge_descriptor Edge; + function_requires< ReadablePropertyMapConcept<TEW1, Edge> >(); + function_requires< ReadablePropertyMapConcept<TEW2, Edge> >(); + + if(pcc == 0) { + return detail::mcr_howard<FT,TG, TVIM, TEW1, TEW2>( + g, vim, ewm, ew2m + ).ocr_howard(); + } + + detail::mcr_howard1<FT, TG, TVIM, TEW1, TEW2> obj(g, vim, ewm, ew2m); + double ocr = obj.ocr_howard(); + obj.get_critical_cycle(*pcc); + return ocr; + } + } // namespace detail + +// Algorithms +// Maximum Cycle Ratio + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +inline typename FloatTraits::value_type +maximum_cycle_ratio(const Graph &g, VertexIndexMap vim, EdgeWeight1Map ew1m, + EdgeWeight2Map ew2m, + std::vector<typename graph_traits<Graph>::edge_descriptor>* pcc = 0, + FloatTraits = FloatTraits()) +{ + typedef detail::float_wrapper< + FloatTraits, detail::max_comparator_props<FloatTraits> + > Traits; + return detail::optimum_cycle_ratio<Traits>(g, vim, ew1m, ew2m, pcc); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +inline double +maximum_cycle_ratio(const Graph &g, VertexIndexMap vim, + EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, + std::vector<typename graph_traits<Graph>::edge_descriptor>* pcc = 0) +{ return maximum_cycle_ratio(g, vim, ew1m, ew2m, pcc, mcr_float<>()); } + +// Minimum Cycle Ratio + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +typename FloatTraits::value_type +minimum_cycle_ratio(const Graph &g, VertexIndexMap vim, + EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, + std::vector<typename graph_traits<Graph>::edge_descriptor> *pcc = 0, + FloatTraits = FloatTraits()) +{ + typedef detail::float_wrapper< + FloatTraits, detail::min_comparator_props<FloatTraits> + > Traits; + return detail::optimum_cycle_ratio<Traits>(g, vim, ew1m, ew2m, pcc); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeight1Map, + typename EdgeWeight2Map> +inline double +minimum_cycle_ratio(const Graph &g, VertexIndexMap vim, + EdgeWeight1Map ew1m, EdgeWeight2Map ew2m, + std::vector<typename graph_traits<Graph>::edge_descriptor>* pcc = 0) +{ return minimum_cycle_ratio(g, vim, ew1m, ew2m, pcc, mcr_float<>()); } + +// Maximum Cycle Mean + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline typename FloatTraits::value_type +maximum_cycle_mean(const Graph &g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector<typename graph_traits<Graph>::edge_descriptor>* pcc = 0, + FloatTraits ft = FloatTraits()) +{ + typedef typename remove_const< + typename property_traits<EdgeWeightMap>::value_type + >::type Weight; + typename std::vector<Weight> ed_w2(boost::num_edges(g), 1); + return maximum_cycle_ratio(g, vim, ewm, + make_iterator_property_map(ed_w2.begin(), eim), + pcc, ft); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline double +maximum_cycle_mean(const Graph& g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector<typename graph_traits<Graph>::edge_descriptor>* pcc = 0) +{ return maximum_cycle_mean(g, vim, ewm, eim, pcc, mcr_float<>()); } + +// Minimum Cycle Mean + +template < + typename FloatTraits, + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline typename FloatTraits::value_type +minimum_cycle_mean(const Graph &g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector<typename graph_traits<Graph>::edge_descriptor>* pcc = 0, + FloatTraits ft = FloatTraits()) +{ + typedef typename remove_const< + typename property_traits<EdgeWeightMap>::value_type + >::type Weight; + typename std::vector<Weight> ed_w2(boost::num_edges(g), 1); + return minimum_cycle_ratio(g, vim, ewm, + make_iterator_property_map(ed_w2.begin(), eim), + pcc, ft); +} + +template < + typename Graph, + typename VertexIndexMap, + typename EdgeWeightMap, + typename EdgeIndexMap> +inline double +minimum_cycle_mean(const Graph &g, VertexIndexMap vim, + EdgeWeightMap ewm, EdgeIndexMap eim, + std::vector<typename graph_traits<Graph>::edge_descriptor>* pcc = 0) +{ return minimum_cycle_mean(g, vim, ewm, eim, pcc, mcr_float<>()); } + +} //namespace boost + +#endif diff --git a/Utilities/BGL/boost/graph/incremental_components.hpp b/Utilities/BGL/boost/graph/incremental_components.hpp index 4cb571bb0b1910abc34abdb470f83864379c3378..43cc2a86f2797a76d1c8977f103442167c3719bb 100644 --- a/Utilities/BGL/boost/graph/incremental_components.hpp +++ b/Utilities/BGL/boost/graph/incremental_components.hpp @@ -1,7 +1,8 @@ // //======================================================================= // Copyright 1997-2001 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// Copyright 2009 Trustees of Indiana University. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Michael Hansen // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -14,6 +15,9 @@ #include <boost/detail/iterator.hpp> #include <boost/graph/detail/incremental_components.hpp> +#include <boost/iterator/counting_iterator.hpp> +#include <boost/make_shared.hpp> +#include <boost/pending/disjoint_sets.hpp> namespace boost { @@ -42,11 +46,6 @@ namespace boost { // similar to the algorithm described in Ch. 22 of "Intro to // Algorithms" by Cormen, et. all. // - // RankContainer is a random accessable container (operator[] is - // defined) with a value type that can represent an integer part of - // a binary log of the value type of the corresponding - // ParentContainer (char is always enough) its size_type is no less - // than the size_type of the corresponding ParentContainer // An implementation of disjoint sets can be found in // boost/pending/disjoint_sets.hpp @@ -101,70 +100,131 @@ namespace boost { return ds.find_set(u) == ds.find_set(v); } - // considering changing the so that it initializes with a pair of - // vertex iterators and a parent PA. - - template <class IndexT> - class component_index - { - public://protected: (avoid friends for now) - typedef std::vector<IndexT> MyIndexContainer; - MyIndexContainer header; - MyIndexContainer index; - typedef typename MyIndexContainer::size_type SizeT; - typedef typename MyIndexContainer::const_iterator IndexIter; + // Class that builds a quick-access indexed linked list that allows + // for fast iterating through a parent component's children. + template <typename IndexType> + class component_index { + + private: + typedef std::vector<IndexType> IndexContainer; + public: - typedef detail::component_iterator<IndexIter, IndexT, SizeT> + typedef counting_iterator<IndexType> iterator; + typedef iterator const_iterator; + typedef IndexType value_type; + typedef IndexType size_type; + + typedef detail::component_index_iterator<typename IndexContainer::iterator> component_iterator; - class component { - friend class component_index; - protected: - IndexT number; - const component_index<IndexT>* comp_ind_ptr; - component(IndexT i, const component_index<IndexT>* p) - : number(i), comp_ind_ptr(p) {} - public: - typedef component_iterator iterator; - typedef component_iterator const_iterator; - typedef IndexT value_type; - iterator begin() const { - return iterator( comp_ind_ptr->index.begin(), - (comp_ind_ptr->header)[number] ); - } - iterator end() const { - return iterator( comp_ind_ptr->index.begin(), - comp_ind_ptr->index.size() ); - } - }; - typedef SizeT size_type; - typedef component value_type; - -#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) - template <class Iterator> - component_index(Iterator first, Iterator last) - : index(std::distance(first, last)) - { - std::copy(first, last, index.begin()); - detail::construct_component_index(index, header); + + public: + template <typename ParentIterator, + typename ElementIndexMap> + component_index(ParentIterator parent_start, + ParentIterator parent_end, + const ElementIndexMap& index_map) : + m_num_elements(std::distance(parent_start, parent_end)), + m_components(make_shared<IndexContainer>()), + m_index_list(make_shared<IndexContainer>(m_num_elements)) { + + build_index_lists(parent_start, index_map); + + } // component_index + + template <typename ParentIterator> + component_index(ParentIterator parent_start, + ParentIterator parent_end) : + m_num_elements(std::distance(parent_start, parent_end)), + m_components(make_shared<IndexContainer>()), + m_index_list(make_shared<IndexContainer>(m_num_elements)) { + + build_index_lists(parent_start, boost::identity_property_map()); + + } // component_index + + // Returns the number of components + inline std::size_t size() const { + return (m_components->size()); } -#else - template <class Iterator> - component_index(Iterator first, Iterator last) - : index(first, last) - { - detail::construct_component_index(index, header); + + // Beginning iterator for component indices + iterator begin() const { + return (iterator(0)); } -#endif - component operator[](IndexT i) const { - return component(i, this); + // End iterator for component indices + iterator end() const { + return (iterator(this->size())); } - SizeT size() const { - return header.size(); + + // Returns a pair of begin and end iterators for the child + // elements of component [component_index]. + std::pair<component_iterator, component_iterator> + operator[](IndexType component_index) const { + + IndexType first_index = (*m_components)[component_index]; + + return (std::make_pair + (component_iterator(m_index_list->begin(), first_index), + component_iterator(m_num_elements))); } - - }; + private: + template <typename ParentIterator, + typename ElementIndexMap> + void build_index_lists(ParentIterator parent_start, + const ElementIndexMap& index_map) { + + typedef typename ParentIterator::value_type Element; + typename IndexContainer::iterator index_list = + m_index_list->begin(); + + // First pass - find root elements, construct index list + for (IndexType element_index = 0; element_index < m_num_elements; + ++element_index) { + + Element parent_element = parent_start[element_index]; + IndexType parent_index = get(index_map, parent_element); + + if (element_index != parent_index) { + index_list[element_index] = parent_index; + } + else { + m_components->push_back(element_index); + + // m_num_elements is the linked list terminator + index_list[element_index] = m_num_elements; + } + } + + // Second pass - build linked list + for (IndexType element_index = 0; element_index < m_num_elements; + ++element_index) { + + Element parent_element = parent_start[element_index]; + IndexType parent_index = get(index_map, parent_element); + + if (element_index != parent_index) { + + // Follow list until a component parent is found + while (index_list[parent_index] != m_num_elements) { + parent_index = index_list[parent_index]; + } + + // Push element to the front of the linked list + index_list[element_index] = index_list[parent_index]; + index_list[parent_index] = element_index; + } + } + + } // build_index_lists + + protected: + IndexType m_num_elements; + shared_ptr<IndexContainer> m_components, m_index_list; + + }; // class component_index + } // namespace boost #endif // BOOST_INCREMENTAL_COMPONENTS_HPP diff --git a/Utilities/BGL/boost/graph/index.html b/Utilities/BGL/boost/graph/index.html deleted file mode 100644 index dff3b20f790cb4307dce3aa586371bf938cf3122..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/index.html +++ /dev/null @@ -1,9 +0,0 @@ -<html> -<head> -<meta http-equiv="refresh" content="0; URL=doc/index.html"> -</head> -<body> -Automatic redirection failed, please go to -<a href="doc/index.html">doc/index.html</a>. -</body> -</html> \ No newline at end of file diff --git a/Utilities/BGL/boost/graph/is_kuratowski_subgraph.hpp b/Utilities/BGL/boost/graph/is_kuratowski_subgraph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fab0b0246f79d123c39799fecd7f9a3c73f94e9e --- /dev/null +++ b/Utilities/BGL/boost/graph/is_kuratowski_subgraph.hpp @@ -0,0 +1,332 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __IS_KURATOWSKI_SUBGRAPH_HPP__ +#define __IS_KURATOWSKI_SUBGRAPH_HPP__ + +#include <boost/config.hpp> +#include <boost/utility.hpp> //for next/prior +#include <boost/tuple/tuple.hpp> //for tie +#include <boost/property_map/property_map.hpp> +#include <boost/graph/properties.hpp> +#include <boost/graph/isomorphism.hpp> +#include <boost/graph/adjacency_list.hpp> + +#include <algorithm> +#include <vector> +#include <set> + + + +namespace boost +{ + + namespace detail + { + + template <typename Graph> + Graph make_K_5() + { + typename graph_traits<Graph>::vertex_iterator vi, vi_end, inner_vi; + Graph K_5(5); + for(tie(vi,vi_end) = vertices(K_5); vi != vi_end; ++vi) + for(inner_vi = next(vi); inner_vi != vi_end; ++inner_vi) + add_edge(*vi, *inner_vi, K_5); + return K_5; + } + + + template <typename Graph> + Graph make_K_3_3() + { + typename graph_traits<Graph>::vertex_iterator + vi, vi_end, bipartition_start, inner_vi; + Graph K_3_3(6); + bipartition_start = next(next(next(vertices(K_3_3).first))); + for(tie(vi, vi_end) = vertices(K_3_3); vi != bipartition_start; ++vi) + for(inner_vi= bipartition_start; inner_vi != vi_end; ++inner_vi) + add_edge(*vi, *inner_vi, K_3_3); + return K_3_3; + } + + + template <typename AdjacencyList, typename Vertex> + void contract_edge(AdjacencyList& neighbors, Vertex u, Vertex v) + { + // Remove u from v's neighbor list + neighbors[v].erase(std::remove(neighbors[v].begin(), + neighbors[v].end(), u + ), + neighbors[v].end() + ); + + // Replace any references to u with references to v + typedef typename AdjacencyList::value_type::iterator + adjacency_iterator_t; + + adjacency_iterator_t u_neighbor_end = neighbors[u].end(); + for(adjacency_iterator_t u_neighbor_itr = neighbors[u].begin(); + u_neighbor_itr != u_neighbor_end; ++u_neighbor_itr + ) + { + Vertex u_neighbor(*u_neighbor_itr); + std::replace(neighbors[u_neighbor].begin(), + neighbors[u_neighbor].end(), u, v + ); + } + + // Remove v from u's neighbor list + neighbors[u].erase(std::remove(neighbors[u].begin(), + neighbors[u].end(), v + ), + neighbors[u].end() + ); + + // Add everything in u's neighbor list to v's neighbor list + std::copy(neighbors[u].begin(), + neighbors[u].end(), + std::back_inserter(neighbors[v]) + ); + + // Clear u's neighbor list + neighbors[u].clear(); + + } + + enum target_graph_t { tg_k_3_3, tg_k_5}; + + } // namespace detail + + + + + template <typename Graph, typename ForwardIterator, typename VertexIndexMap> + bool is_kuratowski_subgraph(const Graph& g, + ForwardIterator begin, + ForwardIterator end, + VertexIndexMap vm + ) + { + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::edges_size_type e_size_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + typedef typename std::vector<vertex_t> v_list_t; + typedef typename v_list_t::iterator v_list_iterator_t; + typedef iterator_property_map + <typename std::vector<v_list_t>::iterator, VertexIndexMap> + vertex_to_v_list_map_t; + + typedef adjacency_list<vecS, vecS, undirectedS> small_graph_t; + + detail::target_graph_t target_graph = detail::tg_k_3_3; //unless we decide otherwise later + + static small_graph_t K_5(detail::make_K_5<small_graph_t>()); + + static small_graph_t K_3_3(detail::make_K_3_3<small_graph_t>()); + + v_size_t n_vertices(num_vertices(g)); + v_size_t max_num_edges(3*n_vertices - 5); + + std::vector<v_list_t> neighbors_vector(n_vertices); + vertex_to_v_list_map_t neighbors(neighbors_vector.begin(), vm); + + e_size_t count = 0; + for(ForwardIterator itr = begin; itr != end; ++itr) + { + + if (count++ > max_num_edges) + return false; + + edge_t e(*itr); + vertex_t u(source(e,g)); + vertex_t v(target(e,g)); + + neighbors[u].push_back(v); + neighbors[v].push_back(u); + + } + + + for(v_size_t max_size = 2; max_size < 5; ++max_size) + { + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + + //a hack to make sure we don't contract the middle edge of a path + //of four degree-3 vertices + if (max_size == 4 && neighbors[v].size() == 3) + { + if (neighbors[neighbors[v][0]].size() + + neighbors[neighbors[v][1]].size() + + neighbors[neighbors[v][2]].size() + < 11 // so, it has two degree-3 neighbors + ) + continue; + } + + while (neighbors[v].size() > 0 && neighbors[v].size() < max_size) + { + // Find one of v's neighbors u such that that v and u + // have no neighbors in common. We'll look for such a + // neighbor with a naive cubic-time algorithm since the + // max size of any of the neighbor sets we'll consider + // merging is 3 + + bool neighbor_sets_intersect = false; + + vertex_t min_u = graph_traits<Graph>::null_vertex(); + vertex_t u; + v_list_iterator_t v_neighbor_end = neighbors[v].end(); + for(v_list_iterator_t v_neighbor_itr = neighbors[v].begin(); + v_neighbor_itr != v_neighbor_end; + ++v_neighbor_itr + ) + { + neighbor_sets_intersect = false; + u = *v_neighbor_itr; + v_list_iterator_t u_neighbor_end = neighbors[u].end(); + for(v_list_iterator_t u_neighbor_itr = + neighbors[u].begin(); + u_neighbor_itr != u_neighbor_end && + !neighbor_sets_intersect; + ++u_neighbor_itr + ) + { + for(v_list_iterator_t inner_v_neighbor_itr = + neighbors[v].begin(); + inner_v_neighbor_itr != v_neighbor_end; + ++inner_v_neighbor_itr + ) + { + if (*u_neighbor_itr == *inner_v_neighbor_itr) + { + neighbor_sets_intersect = true; + break; + } + } + + } + if (!neighbor_sets_intersect && + (min_u == graph_traits<Graph>::null_vertex() || + neighbors[u].size() < neighbors[min_u].size()) + ) + { + min_u = u; + } + + } + + if (min_u == graph_traits<Graph>::null_vertex()) + // Exited the loop without finding an appropriate neighbor of + // v, so v must be a lost cause. Move on to other vertices. + break; + else + u = min_u; + + detail::contract_edge(neighbors, u, v); + + }//end iteration over v's neighbors + + }//end iteration through vertices v + + if (max_size == 3) + { + // check to see whether we should go on to find a K_5 + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + if (neighbors[*vi].size() == 4) + { + target_graph = detail::tg_k_5; + break; + } + + if (target_graph == detail::tg_k_3_3) + break; + } + + }//end iteration through max degree 2,3, and 4 + + + //Now, there should only be 5 or 6 vertices with any neighbors. Find them. + + v_list_t main_vertices; + vertex_iterator_t vi, vi_end; + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + if (!neighbors[*vi].empty()) + main_vertices.push_back(*vi); + } + + // create a graph isomorphic to the contracted graph to test + // against K_5 and K_3_3 + small_graph_t contracted_graph(main_vertices.size()); + std::map<vertex_t,typename graph_traits<small_graph_t>::vertex_descriptor> + contracted_vertex_map; + + typename v_list_t::iterator itr, itr_end; + itr_end = main_vertices.end(); + typename graph_traits<small_graph_t>::vertex_iterator + si = vertices(contracted_graph).first; + + for(itr = main_vertices.begin(); itr != itr_end; ++itr, ++si) + { + contracted_vertex_map[*itr] = *si; + } + + typename v_list_t::iterator jtr, jtr_end; + for(itr = main_vertices.begin(); itr != itr_end; ++itr) + { + jtr_end = neighbors[*itr].end(); + for(jtr = neighbors[*itr].begin(); jtr != jtr_end; ++jtr) + { + if (get(vm,*itr) < get(vm,*jtr)) + { + add_edge(contracted_vertex_map[*itr], + contracted_vertex_map[*jtr], + contracted_graph + ); + } + } + } + + if (target_graph == detail::tg_k_5) + { + return isomorphism(K_5,contracted_graph); + } + else //target_graph == tg_k_3_3 + { + return isomorphism(K_3_3,contracted_graph); + } + + + } + + + + + + template <typename Graph, typename ForwardIterator> + bool is_kuratowski_subgraph(const Graph& g, + ForwardIterator begin, + ForwardIterator end + ) + { + return is_kuratowski_subgraph(g, begin, end, get(vertex_index,g)); + } + + + + +} + +#endif //__IS_KURATOWSKI_SUBGRAPH_HPP__ diff --git a/Utilities/BGL/boost/graph/is_straight_line_drawing.hpp b/Utilities/BGL/boost/graph/is_straight_line_drawing.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6b7c3905485171cdc837e70564561c3ccb2d975d --- /dev/null +++ b/Utilities/BGL/boost/graph/is_straight_line_drawing.hpp @@ -0,0 +1,252 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __IS_STRAIGHT_LINE_DRAWING_HPP__ +#define __IS_STRAIGHT_LINE_DRAWING_HPP__ + +#include <boost/config.hpp> +#include <boost/utility.hpp> //for next and prior +#include <boost/tuple/tuple.hpp> +#include <boost/tuple/tuple_comparison.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/properties.hpp> +#include <boost/graph/planar_detail/bucket_sort.hpp> + +#include <algorithm> +#include <vector> +#include <set> + + + +namespace boost +{ + + // Return true exactly when the line segments s1 = ((x1,y1), (x2,y2)) and + // s2 = ((a1,b1), (a2,b2)) intersect in a point other than the endpoints of + // the line segments. The one exception to this rule is when s1 = s2, in + // which case false is returned - this is to accomodate multiple edges + // between the same pair of vertices, which shouldn't invalidate the straight + // line embedding. A tolerance variable epsilon can also be used, which + // defines how far away from the endpoints of s1 and s2 we want to consider + // an intersection. + + bool intersects(double x1, double y1, + double x2, double y2, + double a1, double b1, + double a2, double b2, + double epsilon = 0.000001 + ) + { + + if (x1 - x2 == 0) + { + std::swap(x1,a1); + std::swap(y1,b1); + std::swap(x2,a2); + std::swap(y2,b2); + } + + if (x1 - x2 == 0) + { + BOOST_USING_STD_MAX(); + BOOST_USING_STD_MIN(); + + //two vertical line segments + double min_y = min BOOST_PREVENT_MACRO_SUBSTITUTION(y1,y2); + double max_y = max BOOST_PREVENT_MACRO_SUBSTITUTION(y1,y2); + double min_b = min BOOST_PREVENT_MACRO_SUBSTITUTION(b1,b2); + double max_b = max BOOST_PREVENT_MACRO_SUBSTITUTION(b1,b2); + if ((max_y > max_b && max_b > min_y) || + (max_b > max_y && max_y > min_b) + ) + return true; + else + return false; + } + + double x_diff = x1 - x2; + double y_diff = y1 - y2; + double a_diff = a2 - a1; + double b_diff = b2 - b1; + + double beta_denominator = b_diff - (y_diff/((double)x_diff)) * a_diff; + + if (beta_denominator == 0) + { + //parallel lines + return false; + } + + double beta = (b2 - y2 - (y_diff/((double)x_diff)) * (a2 - x2)) / + beta_denominator; + double alpha = (a2 - x2 - beta*(a_diff))/x_diff; + + double upper_bound = 1 - epsilon; + double lower_bound = 0 + epsilon; + + return (beta < upper_bound && beta > lower_bound && + alpha < upper_bound && alpha > lower_bound); + + } + + + template <typename Graph, + typename GridPositionMap, + typename VertexIndexMap + > + bool is_straight_line_drawing(const Graph& g, + GridPositionMap drawing, + VertexIndexMap + ) + { + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::edge_iterator edge_iterator_t; + typedef typename graph_traits<Graph>::edges_size_type e_size_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + + typedef std::size_t x_coord_t; + typedef std::size_t y_coord_t; + typedef boost::tuple<edge_t, x_coord_t, y_coord_t> edge_event_t; + typedef typename std::vector< edge_event_t > edge_event_queue_t; + + typedef tuple<y_coord_t, y_coord_t, x_coord_t, x_coord_t> active_map_key_t; + typedef edge_t active_map_value_t; + typedef std::map< active_map_key_t, active_map_value_t > active_map_t; + typedef typename active_map_t::iterator active_map_iterator_t; + + + edge_event_queue_t edge_event_queue; + active_map_t active_edges; + + edge_iterator_t ei, ei_end; + for(tie(ei,ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + vertex_t s(source(e,g)); + vertex_t t(target(e,g)); + edge_event_queue.push_back + (make_tuple(e, + static_cast<std::size_t>(drawing[s].x), + static_cast<std::size_t>(drawing[s].y) + ) + ); + edge_event_queue.push_back + (make_tuple(e, + static_cast<std::size_t>(drawing[t].x), + static_cast<std::size_t>(drawing[t].y) + ) + ); + } + + // Order by edge_event_queue by first, then second coordinate + // (bucket_sort is a stable sort.) + bucket_sort(edge_event_queue.begin(), edge_event_queue.end(), + property_map_tuple_adaptor<edge_event_t, 2>() + ); + + bucket_sort(edge_event_queue.begin(), edge_event_queue.end(), + property_map_tuple_adaptor<edge_event_t, 1>() + ); + + typedef typename edge_event_queue_t::iterator event_queue_iterator_t; + event_queue_iterator_t itr_end = edge_event_queue.end(); + for(event_queue_iterator_t itr = edge_event_queue.begin(); + itr != itr_end; ++itr + ) + { + edge_t e(get<0>(*itr)); + vertex_t source_v(source(e,g)); + vertex_t target_v(target(e,g)); + if (drawing[source_v].y > drawing[target_v].y) + std::swap(source_v, target_v); + + active_map_key_t key(get(drawing, source_v).y, + get(drawing, target_v).y, + get(drawing, source_v).x, + get(drawing, target_v).x + ); + + active_map_iterator_t a_itr = active_edges.find(key); + if (a_itr == active_edges.end()) + { + active_edges[key] = e; + } + else + { + active_map_iterator_t before, after; + if (a_itr == active_edges.begin()) + before = active_edges.end(); + else + before = prior(a_itr); + after = boost::next(a_itr); + + if (before != active_edges.end()) + { + + edge_t f = before->second; + vertex_t e_source(source(e,g)); + vertex_t e_target(target(e,g)); + vertex_t f_source(source(f,g)); + vertex_t f_target(target(f,g)); + + if (intersects(drawing[e_source].x, + drawing[e_source].y, + drawing[e_target].x, + drawing[e_target].y, + drawing[f_source].x, + drawing[f_source].y, + drawing[f_target].x, + drawing[f_target].y + ) + ) + return false; + } + + if (after != active_edges.end()) + { + + edge_t f = after->second; + vertex_t e_source(source(e,g)); + vertex_t e_target(target(e,g)); + vertex_t f_source(source(f,g)); + vertex_t f_target(target(f,g)); + + if (intersects(drawing[e_source].x, + drawing[e_source].y, + drawing[e_target].x, + drawing[e_target].y, + drawing[f_source].x, + drawing[f_source].y, + drawing[f_target].x, + drawing[f_target].y + ) + ) + return false; + } + + active_edges.erase(a_itr); + + } + } + + return true; + + } + + + template <typename Graph, typename GridPositionMap> + bool is_straight_line_drawing(const Graph& g, GridPositionMap drawing) + { + return is_straight_line_drawing(g, drawing, get(vertex_index,g)); + } + +} + +#endif // __IS_STRAIGHT_LINE_DRAWING_HPP__ diff --git a/Utilities/BGL/boost/graph/isomorphism.hpp b/Utilities/BGL/boost/graph/isomorphism.hpp index 50582a49a629a95f5851ac84be12dde78b797484..9461dc31e50c5a2b8b5a16e9e99a903d784cd37c 100644 --- a/Utilities/BGL/boost/graph/isomorphism.hpp +++ b/Utilities/BGL/boost/graph/isomorphism.hpp @@ -1,13 +1,8 @@ // Copyright (C) 2001 Jeremy Siek, Douglas Gregor, Brian Osman // -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// Permission to modify the code and to distribute modified code is granted -// provided this copyright notice appears in all copies, and a notice -// that the code was modified is included with the copyright notice. -// -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. +// 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_ISOMORPHISM_HPP #define BOOST_GRAPH_ISOMORPHISM_HPP @@ -95,7 +90,7 @@ namespace boost { void discover_vertex(vertex1_t v, const Graph1&) const { vertices.push_back(v); } - void examine_edge(edge1_t e, const Graph1& G1) const { + void examine_edge(edge1_t e, const Graph1&) const { edges.push_back(e); } std::vector<vertex1_t>& vertices; @@ -242,7 +237,7 @@ namespace boost { num_edges_on_k = 1; BOOST_USING_STD_MAX(); int next_k = max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num_k, max BOOST_PREVENT_MACRO_SUBSTITUTION(dfs_num[i], dfs_num[j])); - if (match(next(iter), next_k)) + if (match(boost::next(iter), next_k)) return true; in_S[v] = false; } @@ -250,9 +245,9 @@ namespace boost { } else { - if (contains(adjacent_vertices(f[i], G2), f[j])) { + if (container_contains(adjacent_vertices(f[i], G2), f[j])) { ++num_edges_on_k; - if (match(next(iter), dfs_num_k)) + if (match(boost::next(iter), dfs_num_k)) return true; } @@ -444,13 +439,11 @@ namespace boost { return false; #endif - for (typename graph_traits<Graph1>::edge_iterator e1 = edges(g1).first; - e1 != edges(g1).second; ++e1) { + BGL_FORALL_EDGES_T(e1, g1, Graph1) { bool found_edge = false; - for (typename graph_traits<Graph2>::edge_iterator e2 = edges(g2).first; - e2 != edges(g2).second && !found_edge; ++e2) { - if (source(*e2, g2) == get(iso_map, source(*e1, g1)) && - target(*e2, g2) == get(iso_map, target(*e1, g1))) { + BGL_FORALL_EDGES_T(e2, g2, Graph2) { + if (source(e2, g2) == get(iso_map, source(e1, g1)) && + target(e2, g2) == get(iso_map, target(e1, g1))) { found_edge = true; } } diff --git a/Utilities/BGL/boost/graph/iteration_macros.hpp b/Utilities/BGL/boost/graph/iteration_macros.hpp index 850e887518f1208a20adde41ca7ad742aff4b7ce..2bf40f958080fa4acbcb3890d60abe87ea96fbe9 100644 --- a/Utilities/BGL/boost/graph/iteration_macros.hpp +++ b/Utilities/BGL/boost/graph/iteration_macros.hpp @@ -10,9 +10,12 @@ #ifndef BOOST_GRAPH_ITERATION_MACROS_HPP #define BOOST_GRAPH_ITERATION_MACROS_HPP +#include <utility> + #define BGL_CAT(x,y) x ## y -#define BGL_FIRST(linenum) BGL_CAT(bgl_first_,linenum) -#define BGL_LAST(linenum) BGL_CAT(bgl_last_,linenum) +#define BGL_RANGE(linenum) BGL_CAT(bgl_range_,linenum) +#define BGL_FIRST(linenum) (BGL_RANGE(linenum).first) +#define BGL_LAST(linenum) (BGL_RANGE(linenum).second) /* BGL_FORALL_VERTICES_T(v, g, graph_t) // This is on line 9 @@ -22,7 +25,7 @@ bgl_first_9 = vertices(g).first, bgl_last_9 = vertices(g).second; bgl_first_9 != bgl_last_9; bgl_first_9 = bgl_last_9) for (typename boost::graph_traits<graph_t>::vertex_descriptor v; - bgl_first_9 != bgl_last ? (v = *bgl_first_9, true) : false; + bgl_first_9 != bgl_last_9 ? (v = *bgl_first_9, true) : false; ++bgl_first_9) The purpose of having two for-loops is just to provide a place to @@ -37,90 +40,98 @@ Use the _T versions when the graph type is a template parameter or dependent on a template parameter. Otherwise use the non _T versions. + ----------------------- + 6/9/09 THK + + The above contains two calls to the vertices function. I modified these + macros to expand to + + for (std::pair<typename boost::graph_traits<graph_t>::vertex_iterator, + typename boost::graph_traits<graph_t>::vertex_iterator> bgl_range_9 = vertices(g); + bgl_range_9.first != bgl_range_9.second; + bgl_range_9.first = bgl_range_9.second) + for (typename boost::graph_traits<graph_t>::vertex_descriptor v; + bgl_range_9.first != bgl_range_9.second ? (v = *bgl_range_9.first, true) : false; + ++bgl_range_9.first) + */ #define BGL_FORALL_VERTICES_T(VNAME, GNAME, GraphType) \ -for (typename boost::graph_traits<GraphType>::vertex_iterator \ - BGL_FIRST(__LINE__) = vertices(GNAME).first, BGL_LAST(__LINE__) = vertices(GNAME).second; \ +for (std::pair<typename boost::graph_traits<GraphType>::vertex_iterator, \ + typename boost::graph_traits<GraphType>::vertex_iterator> BGL_RANGE(__LINE__) = vertices(GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (typename boost::graph_traits<GraphType>::vertex_descriptor VNAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true):false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_VERTICES(VNAME, GNAME, GraphType) \ -for (boost::graph_traits<GraphType>::vertex_iterator \ - BGL_FIRST(__LINE__) = vertices(GNAME).first, BGL_LAST(__LINE__) = vertices(GNAME).second; \ +for (std::pair<boost::graph_traits<GraphType>::vertex_iterator, \ + boost::graph_traits<GraphType>::vertex_iterator> BGL_RANGE(__LINE__) = vertices(GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (boost::graph_traits<GraphType>::vertex_descriptor VNAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true):false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_EDGES_T(ENAME, GNAME, GraphType) \ -for (typename boost::graph_traits<GraphType>::edge_iterator \ - BGL_FIRST(__LINE__) = edges(GNAME).first, BGL_LAST(__LINE__) = edges(GNAME).second; \ +for (std::pair<typename boost::graph_traits<GraphType>::edge_iterator, \ + typename boost::graph_traits<GraphType>::edge_iterator> BGL_RANGE(__LINE__) = edges(GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (typename boost::graph_traits<GraphType>::edge_descriptor ENAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true):false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_EDGES(ENAME, GNAME, GraphType) \ -for (boost::graph_traits<GraphType>::edge_iterator \ - BGL_FIRST(__LINE__) = edges(GNAME).first, BGL_LAST(__LINE__) = edges(GNAME).second; \ +for (std::pair<boost::graph_traits<GraphType>::edge_iterator, \ + boost::graph_traits<GraphType>::edge_iterator> BGL_RANGE(__LINE__) = edges(GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (boost::graph_traits<GraphType>::edge_descriptor ENAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true):false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_ADJ_T(UNAME, VNAME, GNAME, GraphType) \ -for (typename boost::graph_traits<GraphType>::adjacency_iterator \ - BGL_FIRST(__LINE__) = adjacent_vertices(UNAME, GNAME).first,\ - BGL_LAST(__LINE__) = adjacent_vertices(UNAME, GNAME).second; \ +for (std::pair<typename boost::graph_traits<GraphType>::adjacency_iterator, \ + typename boost::graph_traits<GraphType>::adjacency_iterator> BGL_RANGE(__LINE__) = adjacent_vertices(UNAME, GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (typename boost::graph_traits<GraphType>::vertex_descriptor VNAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true) : false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_ADJ(UNAME, VNAME, GNAME, GraphType) \ -for (boost::graph_traits<GraphType>::adjacency_iterator \ - BGL_FIRST(__LINE__) = adjacent_vertices(UNAME, GNAME).first,\ - BGL_LAST(__LINE__) = adjacent_vertices(UNAME, GNAME).second; \ +for (std::pair<boost::graph_traits<GraphType>::adjacency_iterator, \ + boost::graph_traits<GraphType>::adjacency_iterator> BGL_RANGE(__LINE__) = adjacent_vertices(UNAME, GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (boost::graph_traits<GraphType>::vertex_descriptor VNAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (VNAME = *BGL_FIRST(__LINE__), true) : false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_OUTEDGES_T(UNAME, ENAME, GNAME, GraphType) \ -for (typename boost::graph_traits<GraphType>::out_edge_iterator \ - BGL_FIRST(__LINE__) = out_edges(UNAME, GNAME).first,\ - BGL_LAST(__LINE__) = out_edges(UNAME, GNAME).second; \ +for (std::pair<typename boost::graph_traits<GraphType>::out_edge_iterator, \ + typename boost::graph_traits<GraphType>::out_edge_iterator> BGL_RANGE(__LINE__) = out_edges(UNAME, GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (typename boost::graph_traits<GraphType>::edge_descriptor ENAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_OUTEDGES(UNAME, ENAME, GNAME, GraphType) \ -for (boost::graph_traits<GraphType>::out_edge_iterator \ - BGL_FIRST(__LINE__) = out_edges(UNAME, GNAME).first,\ - BGL_LAST(__LINE__) = out_edges(UNAME, GNAME).second; \ +for (std::pair<boost::graph_traits<GraphType>::out_edge_iterator, \ + boost::graph_traits<GraphType>::out_edge_iterator> BGL_RANGE(__LINE__) = out_edges(UNAME, GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (boost::graph_traits<GraphType>::edge_descriptor ENAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_INEDGES_T(UNAME, ENAME, GNAME, GraphType) \ -for (typename boost::graph_traits<GraphType>::in_edge_iterator \ - BGL_FIRST(__LINE__) = in_edges(UNAME, GNAME).first,\ - BGL_LAST(__LINE__) = in_edges(UNAME, GNAME).second; \ +for (std::pair<typename boost::graph_traits<GraphType>::in_edge_iterator, \ + typename boost::graph_traits<GraphType>::in_edge_iterator> BGL_RANGE(__LINE__) = in_edges(UNAME, GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (typename boost::graph_traits<GraphType>::edge_descriptor ENAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ ++BGL_FIRST(__LINE__)) #define BGL_FORALL_INEDGES(UNAME, ENAME, GNAME, GraphType) \ -for (boost::graph_traits<GraphType>::in_edge_iterator \ - BGL_FIRST(__LINE__) = in_edges(UNAME, GNAME).first,\ - BGL_LAST(__LINE__) = in_edges(UNAME, GNAME).second; \ +for (std::pair<boost::graph_traits<GraphType>::in_edge_iterator, \ + boost::graph_traits<GraphType>::in_edge_iterator> BGL_RANGE(__LINE__) = in_edges(UNAME, GNAME); \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__); BGL_FIRST(__LINE__) = BGL_LAST(__LINE__)) \ for (boost::graph_traits<GraphType>::edge_descriptor ENAME; \ BGL_FIRST(__LINE__) != BGL_LAST(__LINE__) ? (ENAME = *BGL_FIRST(__LINE__), true) : false; \ diff --git a/Utilities/BGL/boost/graph/johnson_all_pairs_shortest.hpp b/Utilities/BGL/boost/graph/johnson_all_pairs_shortest.hpp index ff6344bdcf83b03c3e6867e4fb746dec24399f9f..0720411c5a82694d24d19a9c2f2f0d25ce2fc9d5 100644 --- a/Utilities/BGL/boost/graph/johnson_all_pairs_shortest.hpp +++ b/Utilities/BGL/boost/graph/johnson_all_pairs_shortest.hpp @@ -23,21 +23,24 @@ #define BOOST_GRAPH_JOHNSON_HPP #include <boost/graph/graph_traits.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/property_map/shared_array_property_map.hpp> #include <boost/graph/bellman_ford_shortest_paths.hpp> #include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/adjacency_list.hpp> -#include <boost/pending/ct_if.hpp> #include <boost/type_traits/same_traits.hpp> namespace boost { template <class VertexAndEdgeListGraph, class DistanceMatrix, - class VertexID, class Weight, class DistanceZero> + class VertexID, class Weight, typename BinaryPredicate, + typename BinaryFunction, typename Infinity, class DistanceZero> bool johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1, DistanceMatrix& D, - VertexID id1, Weight w1, DistanceZero zero) + VertexID id1, Weight w1, const BinaryPredicate& compare, + const BinaryFunction& combine, const Infinity& inf, + DistanceZero zero) { typedef graph_traits<VertexAndEdgeListGraph> Traits1; typedef typename property_traits<Weight>::value_type DT; @@ -92,19 +95,15 @@ namespace boost { } typename Traits2::vertex_iterator v, v_end, u, u_end; typename Traits2::edge_iterator e, e_end; - std::vector<DT> h_vec(num_vertices(g2)); - typedef typename std::vector<DT>::iterator iter_t; - iterator_property_map<iter_t,VertexID2,DT,DT&> h(h_vec.begin(), id2); + shared_array_property_map<DT,VertexID2> h(num_vertices(g2), id2); - DT inf = (std::numeric_limits<DT>::max)(); for (tie(v, v_end) = vertices(g2); v != v_end; ++v) - d[*v] = inf; + put(d, *v, inf); put(d, s, zero); // Using the non-named parameter versions of bellman_ford and // dijkstra for portability reasons. - dummy_property_map pred; closed_plus<DT> combine; - std::less<DT> compare; bellman_visitor<> bvis; + dummy_property_map pred; bellman_visitor<> bvis; if (bellman_ford_shortest_paths (g2, num_vertices(g2), w, pred, d, combine, compare, bvis)) { for (tie(v, v_end) = vertices(g2); v != v_end; ++v) @@ -113,7 +112,7 @@ namespace boost { for (tie(e, e_end) = edges(g2); e != e_end; ++e) { typename Traits2::vertex_descriptor a = source(*e, g2), b = target(*e, g2); - put(w_hat, *e, get(w, *e) + get(h, a) - get(h, b)); + put(w_hat, *e, combine(get(w, *e), (get(h, a) - get(h, b)))); } for (tie(u, u_end) = vertices(g2); u != u_end; ++u) { dijkstra_visitor<> dvis; @@ -122,8 +121,8 @@ namespace boost { for (tie(v, v_end) = vertices(g2); v != v_end; ++v) { if (*u != s && *v != s) { typename Traits1::vertex_descriptor u1, v1; - u1 = verts1[id2[*u]]; v1 = verts1[id2[*v]]; - D[id2[*u]-1][id2[*v]-1] = get(d, *v) + get(h, *v) - get(h, *u); + u1 = verts1[get(id2, *u)]; v1 = verts1[get(id2, *v)]; + D[get(id2, *u)-1][get(id2, *v)-1] = combine(get(d, *v), (get(h, *v) - get(h, *u))); } } } @@ -132,6 +131,21 @@ namespace boost { return false; } + template <class VertexAndEdgeListGraph, class DistanceMatrix, + class VertexID, class Weight, class DistanceZero> + bool + johnson_all_pairs_shortest_paths(VertexAndEdgeListGraph& g1, + DistanceMatrix& D, + VertexID id1, Weight w1, DistanceZero zero) + { + typedef typename property_traits<Weight>::value_type WT; + return johnson_all_pairs_shortest_paths(g1, D, id1, w1, + std::less<WT>(), + closed_plus<WT>(), + (std::numeric_limits<WT>::max)(), + zero); + } + namespace detail { template <class VertexAndEdgeListGraph, class DistanceMatrix, @@ -147,6 +161,12 @@ namespace boost { return johnson_all_pairs_shortest_paths (g, D, id, w, + choose_param(get_param(params, distance_compare_t()), + std::less<WT>()), + choose_param(get_param(params, distance_combine_t()), + closed_plus<WT>()), + choose_param(get_param(params, distance_inf_t()), + std::numeric_limits<WT>::max BOOST_PREVENT_MACRO_SUBSTITUTION()), choose_param(get_param(params, distance_zero_t()), WT()) ); } diff --git a/Utilities/BGL/boost/graph/kamada_kawai_spring_layout.hpp b/Utilities/BGL/boost/graph/kamada_kawai_spring_layout.hpp index 884cb0369f845ed4a3b2f8199f027a3b9f2dfe9c..0262e1fc28caed5d3677bdf3714a23addc58a838 100644 --- a/Utilities/BGL/boost/graph/kamada_kawai_spring_layout.hpp +++ b/Utilities/BGL/boost/graph/kamada_kawai_spring_layout.hpp @@ -1,7 +1,7 @@ // Copyright 2004 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -10,13 +10,15 @@ #define BOOST_GRAPH_KAMADA_KAWAI_SPRING_LAYOUT_HPP #include <boost/graph/graph_traits.hpp> +#include <boost/graph/topology.hpp> +#include <boost/graph/iteration_macros.hpp> #include <boost/graph/johnson_all_pairs_shortest.hpp> #include <boost/type_traits/is_convertible.hpp> #include <utility> #include <iterator> #include <vector> #include <boost/limits.hpp> -#include <cmath> +#include <boost/config/no_tr1/cmath.hpp> namespace boost { namespace detail { namespace graph { @@ -67,22 +69,82 @@ namespace boost { return length.value / result; } + /** + * Dense linear solver for fixed-size matrices. + */ + template <std::size_t Size> + struct linear_solver { + // Indices in mat are (row, column) + // template <typename Vec> + // static Vec solve(double mat[Size][Size], Vec rhs); + }; + + template <> + struct linear_solver<1> { + template <typename Vec> + static Vec solve(double mat[1][1], Vec rhs) { + return rhs / mat[0][0]; + } + }; + + // These are from http://en.wikipedia.org/wiki/Cramer%27s_rule + template <> + struct linear_solver<2> { + template <typename Vec> + static Vec solve(double mat[2][2], Vec rhs) { + double denom = mat[0][0] * mat[1][1] - mat[1][0] * mat[0][1]; + double x_num = rhs[0] * mat[1][1] - rhs[1] * mat[0][1]; + double y_num = mat[0][0] * rhs[1] - mat[1][0] * rhs[0] ; + Vec result; + result[0] = x_num / denom; + result[1] = y_num / denom; + return result; + } + }; + + template <> + struct linear_solver<3> { + template <typename Vec> + static Vec solve(double mat[2][2], Vec rhs) { + double denom = mat[0][0] * (mat[1][1] * mat[2][2] - mat[2][1] * mat[1][2]) + - mat[1][0] * (mat[0][1] * mat[2][2] - mat[2][1] * mat[0][2]) + + mat[2][0] * (mat[0][1] * mat[1][2] - mat[1][1] * mat[0][2]); + double x_num = rhs[0] * (mat[1][1] * mat[2][2] - mat[2][1] * mat[1][2]) + - rhs[1] * (mat[0][1] * mat[2][2] - mat[2][1] * mat[0][2]) + + rhs[2] * (mat[0][1] * mat[1][2] - mat[1][1] * mat[0][2]); + double y_num = mat[0][0] * (rhs[1] * mat[2][2] - rhs[2] * mat[1][2]) + - mat[1][0] * (rhs[0] * mat[2][2] - rhs[2] * mat[0][2]) + + mat[2][0] * (rhs[0] * mat[1][2] - rhs[1] * mat[0][2]); + double z_num = mat[0][0] * (mat[1][1] * rhs[2] - mat[2][1] * rhs[1] ) + - mat[1][0] * (mat[0][1] * rhs[2] - mat[2][1] * rhs[0] ) + + mat[2][0] * (mat[0][1] * rhs[1] - mat[1][1] * rhs[0] ); + Vec result; + result[0] = x_num / denom; + result[1] = y_num / denom; + result[2] = z_num / denom; + return result; + } + }; + /** * Implementation of the Kamada-Kawai spring layout algorithm. */ - template<typename Graph, typename PositionMap, typename WeightMap, + template<typename Topology, typename Graph, typename PositionMap, typename WeightMap, typename EdgeOrSideLength, typename Done, typename VertexIndexMap, typename DistanceMatrix, typename SpringStrengthMatrix, typename PartialDerivativeMap> struct kamada_kawai_spring_layout_impl { typedef typename property_traits<WeightMap>::value_type weight_type; - typedef std::pair<weight_type, weight_type> deriv_type; + typedef typename Topology::point_type Point; + typedef typename Topology::point_difference_type point_difference_type; + typedef point_difference_type deriv_type; typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; kamada_kawai_spring_layout_impl( + const Topology& topology, const Graph& g, PositionMap position, WeightMap weight, @@ -93,7 +155,7 @@ namespace boost { DistanceMatrix distance, SpringStrengthMatrix spring_strength, PartialDerivativeMap partial_derivatives) - : g(g), position(position), weight(weight), + : topology(topology), g(g), position(position), weight(weight), edge_or_side_length(edge_or_side_length), done(done), spring_constant(spring_constant), index(index), distance(distance), spring_strength(spring_strength), @@ -108,15 +170,12 @@ namespace boost { using std::sqrt; #endif // BOOST_NO_STDC_NAMESPACE - deriv_type result(0, 0); + deriv_type result; if (i != m) { - weight_type x_diff = position[m].x - position[i].x; - weight_type y_diff = position[m].y - position[i].y; - weight_type dist = sqrt(x_diff * x_diff + y_diff * y_diff); - result.first = spring_strength[get(index, m)][get(index, i)] - * (x_diff - distance[get(index, m)][get(index, i)]*x_diff/dist); - result.second = spring_strength[get(index, m)][get(index, i)] - * (y_diff - distance[get(index, m)][get(index, i)]*y_diff/dist); + point_difference_type diff = topology.difference(position[m], position[i]); + weight_type dist = topology.norm(diff); + result = spring_strength[get(index, m)][get(index, i)] + * (diff - distance[get(index, m)][get(index, i)]/dist*diff); } return result; @@ -130,15 +189,12 @@ namespace boost { using std::sqrt; #endif // BOOST_NO_STDC_NAMESPACE - deriv_type result(0, 0); + deriv_type result; // TBD: looks like an accumulate to me - std::pair<vertex_iterator, vertex_iterator> verts = vertices(g); - for (/* no init */; verts.first != verts.second; ++verts.first) { - vertex_descriptor i = *verts.first; + BGL_FORALL_VERTICES_T(i, g, Graph) { deriv_type deriv = compute_partial_derivative(m, i); - result.first += deriv.first; - result.second += deriv.second; + result += deriv; } return result; @@ -185,8 +241,7 @@ namespace boost { deriv_type deriv = compute_partial_derivatives(*ui); put(partial_derivatives, *ui, deriv); - weight_type delta = - sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + weight_type delta = topology.norm(deriv); if (delta > delta_p) { p = *ui; @@ -206,47 +261,48 @@ namespace boost { } do { - // Compute the 4 elements of the Jacobian - weight_type dE_dx_dx = 0, dE_dx_dy = 0, dE_dy_dx = 0, dE_dy_dy = 0; + // Compute the elements of the Jacobian + // From + // http://www.cs.panam.edu/~rfowler/papers/1994_kumar_fowler_A_Spring_UTPACSTR.pdf + // with the bugs fixed in the off-diagonal case + weight_type dE_d_d[Point::dimensions][Point::dimensions]; + for (std::size_t i = 0; i < Point::dimensions; ++i) + for (std::size_t j = 0; j < Point::dimensions; ++j) + dE_d_d[i][j] = 0.; for (ui = vertices(g).first; ui != end; ++ui) { vertex_descriptor i = *ui; if (i != p) { - weight_type x_diff = position[p].x - position[i].x; - weight_type y_diff = position[p].y - position[i].y; - weight_type dist = sqrt(x_diff * x_diff + y_diff * y_diff); - weight_type dist_cubed = dist * dist * dist; + point_difference_type diff = topology.difference(position[p], position[i]); + weight_type dist = topology.norm(diff); + weight_type dist_squared = dist * dist; + weight_type inv_dist_cubed = 1. / (dist_squared * dist); weight_type k_mi = spring_strength[get(index,p)][get(index,i)]; weight_type l_mi = distance[get(index, p)][get(index, i)]; - dE_dx_dx += k_mi * (1 - (l_mi * y_diff * y_diff)/dist_cubed); - dE_dx_dy += k_mi * l_mi * x_diff * y_diff / dist_cubed; - dE_dy_dx += k_mi * l_mi * x_diff * y_diff / dist_cubed; - dE_dy_dy += k_mi * (1 - (l_mi * x_diff * x_diff)/dist_cubed); + for (std::size_t i = 0; i < Point::dimensions; ++i) { + for (std::size_t j = 0; j < Point::dimensions; ++j) { + if (i == j) { + dE_d_d[i][i] += k_mi * (1 + (l_mi * (diff[i] * diff[i] - dist_squared) * inv_dist_cubed)); + } else { + dE_d_d[i][j] += k_mi * l_mi * diff[i] * diff[j] * inv_dist_cubed; + } + } + } } } - // Solve for delta_x and delta_y - weight_type dE_dx = get(partial_derivatives, p).first; - weight_type dE_dy = get(partial_derivatives, p).second; - - weight_type delta_x = - (dE_dx_dy * dE_dy - dE_dy_dy * dE_dx) - / (dE_dx_dx * dE_dy_dy - dE_dx_dy * dE_dy_dx); + deriv_type dE_d = get(partial_derivatives, p); - weight_type delta_y = - (dE_dx_dx * dE_dy - dE_dy_dx * dE_dx) - / (dE_dy_dx * dE_dx_dy - dE_dx_dx * dE_dy_dy); + // Solve dE_d_d * delta = dE_d to get delta + point_difference_type delta = -linear_solver<Point::dimensions>::solve(dE_d_d, dE_d); - - // Move p by (delta_x, delta_y) - position[p].x += delta_x; - position[p].y += delta_y; + // Move p by delta + position[p] = topology.adjust(position[p], delta); // Recompute partial derivatives and delta_p deriv_type deriv = compute_partial_derivatives(p); put(partial_derivatives, p, deriv); - delta_p = - sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + delta_p = topology.norm(deriv); } while (!done(delta_p, p, g, false)); // Select new p by updating each partial derivative and delta @@ -257,12 +313,10 @@ namespace boost { compute_partial_derivative(*ui, old_p); deriv_type deriv = get(partial_derivatives, *ui); - deriv.first += old_p_partial.first - old_deriv_p.first; - deriv.second += old_p_partial.second - old_deriv_p.second; + deriv += old_p_partial - old_deriv_p; put(partial_derivatives, *ui, deriv); - weight_type delta = - sqrt(deriv.first*deriv.first + deriv.second*deriv.second); + weight_type delta = topology.norm(deriv); if (delta > delta_p) { p = *ui; @@ -274,6 +328,7 @@ namespace boost { return true; } + const Topology& topology; const Graph& g; PositionMap position; WeightMap weight; @@ -373,6 +428,9 @@ namespace boost { * \param weight (IN) must be a model of Readable Property Map, * which provides the weight of each edge in the graph @p g. * + * \param topology (IN) must be a topology object (see topology.hpp), + * which provides operations on points and differences between them. + * * \param edge_or_side_length (IN) provides either the unit length * @c e of an edge in the layout or the length of a side @c s of the * display area, and must be either @c boost::edge_length(e) or @c @@ -417,7 +475,7 @@ namespace boost { * \returns @c true if layout was successful or @c false if a * negative weight cycle was detected. */ - template<typename Graph, typename PositionMap, typename WeightMap, + template<typename Topology, typename Graph, typename PositionMap, typename WeightMap, typename T, bool EdgeOrSideLength, typename Done, typename VertexIndexMap, typename DistanceMatrix, typename SpringStrengthMatrix, typename PartialDerivativeMap> @@ -426,6 +484,7 @@ namespace boost { const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, detail::graph::edge_or_side<EdgeOrSideLength, T> edge_or_side_length, Done done, typename property_traits<WeightMap>::value_type spring_constant, @@ -440,10 +499,10 @@ namespace boost { >::value)); detail::graph::kamada_kawai_spring_layout_impl< - Graph, PositionMap, WeightMap, + Topology, Graph, PositionMap, WeightMap, detail::graph::edge_or_side<EdgeOrSideLength, T>, Done, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap> - alg(g, position, weight, edge_or_side_length, done, spring_constant, + alg(topology, g, position, weight, edge_or_side_length, done, spring_constant, index, distance, spring_strength, partial_derivatives); return alg.run(); } @@ -451,7 +510,7 @@ namespace boost { /** * \overload */ - template<typename Graph, typename PositionMap, typename WeightMap, + template<typename Topology, typename Graph, typename PositionMap, typename WeightMap, typename T, bool EdgeOrSideLength, typename Done, typename VertexIndexMap> bool @@ -459,6 +518,7 @@ namespace boost { const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, detail::graph::edge_or_side<EdgeOrSideLength, T> edge_or_side_length, Done done, typename property_traits<WeightMap>::value_type spring_constant, @@ -471,32 +531,33 @@ namespace boost { std::vector<weight_vec> distance(n, weight_vec(n)); std::vector<weight_vec> spring_strength(n, weight_vec(n)); - std::vector<std::pair<weight_type, weight_type> > partial_derivatives(n); + std::vector<typename Topology::point_difference_type> partial_derivatives(n); return kamada_kawai_spring_layout( - g, position, weight, edge_or_side_length, done, spring_constant, index, + g, position, weight, topology, edge_or_side_length, done, spring_constant, index, distance.begin(), spring_strength.begin(), make_iterator_property_map(partial_derivatives.begin(), index, - std::pair<weight_type, weight_type>())); + typename Topology::point_difference_type())); } /** * \overload */ - template<typename Graph, typename PositionMap, typename WeightMap, + template<typename Topology, typename Graph, typename PositionMap, typename WeightMap, typename T, bool EdgeOrSideLength, typename Done> bool kamada_kawai_spring_layout( const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, detail::graph::edge_or_side<EdgeOrSideLength, T> edge_or_side_length, Done done, typename property_traits<WeightMap>::value_type spring_constant) { - return kamada_kawai_spring_layout(g, position, weight, edge_or_side_length, + return kamada_kawai_spring_layout(g, position, weight, topology, edge_or_side_length, done, spring_constant, get(vertex_index, g)); } @@ -504,35 +565,37 @@ namespace boost { /** * \overload */ - template<typename Graph, typename PositionMap, typename WeightMap, + template<typename Topology, typename Graph, typename PositionMap, typename WeightMap, typename T, bool EdgeOrSideLength, typename Done> bool kamada_kawai_spring_layout( const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, detail::graph::edge_or_side<EdgeOrSideLength, T> edge_or_side_length, Done done) { typedef typename property_traits<WeightMap>::value_type weight_type; - return kamada_kawai_spring_layout(g, position, weight, edge_or_side_length, + return kamada_kawai_spring_layout(g, position, weight, topology, edge_or_side_length, done, weight_type(1)); } /** * \overload */ - template<typename Graph, typename PositionMap, typename WeightMap, + template<typename Topology, typename Graph, typename PositionMap, typename WeightMap, typename T, bool EdgeOrSideLength> bool kamada_kawai_spring_layout( const Graph& g, PositionMap position, WeightMap weight, + const Topology& topology, detail::graph::edge_or_side<EdgeOrSideLength, T> edge_or_side_length) { typedef typename property_traits<WeightMap>::value_type weight_type; - return kamada_kawai_spring_layout(g, position, weight, edge_or_side_length, + return kamada_kawai_spring_layout(g, position, weight, topology, edge_or_side_length, layout_tolerance<weight_type>(), weight_type(1.0), get(vertex_index, g)); diff --git a/Utilities/BGL/boost/graph/king_ordering.hpp b/Utilities/BGL/boost/graph/king_ordering.hpp index df14056d7abab2583ae6d7a89b7e8577f533a62a..774972732a795e15ba2ac391814c0300ec88dcf2 100644 --- a/Utilities/BGL/boost/graph/king_ordering.hpp +++ b/Utilities/BGL/boost/graph/king_ordering.hpp @@ -1,35 +1,19 @@ -// //======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// Copyright 2004, 2005 Trustees of Indiana University +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, // Doug Gregor, D. Kevin McGrath // -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. -//======================================================================= -// +// 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_KING_HPP #define BOOST_GRAPH_KING_HPP #include <boost/config.hpp> #include <boost/graph/detail/sparse_ordering.hpp> +#include <boost/graph/graph_utility.hpp> /* King Algorithm for matrix reordering @@ -63,7 +47,7 @@ namespace boost { //heap the vertices already there std::make_heap(rbegin, rend, boost::bind<bool>(comp, _2, _1)); - int i = 0; + unsigned i = 0; for(i = index_begin; i != Qptr->size(); ++i){ colors[get(vertex_map, (*Qptr)[i])] = 1; @@ -165,7 +149,7 @@ namespace boost { int child_location = Qlocation[vertex]; int heap_child_location = Qptr->size() - child_location; int heap_parent_location = (int)(heap_child_location/2); - int parent_location = Qptr->size() - heap_parent_location; + unsigned parent_location = Qptr->size() - heap_parent_location; bool valid = (heap_parent_location != 0 && child_location > index_begin + offset && parent_location < Qptr->size()); @@ -210,18 +194,18 @@ namespace boost { ColorMap color, DegreeMap degree, VertexIndexMap index_map) { - typedef typename property_traits<DegreeMap>::value_type DS; + typedef typename property_traits<DegreeMap>::value_type ds_type; typedef typename property_traits<ColorMap>::value_type ColorValue; typedef color_traits<ColorValue> Color; typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - typedef iterator_property_map<typename std::vector<DS>::iterator, VertexIndexMap, DS, DS&> PseudoDegreeMap; - typedef indirect_cmp<PseudoDegreeMap, std::less<DS> > Compare; + typedef iterator_property_map<typename std::vector<ds_type>::iterator, VertexIndexMap, ds_type, ds_type&> PseudoDegreeMap; + typedef indirect_cmp<PseudoDegreeMap, std::less<ds_type> > Compare; typedef typename boost::sparse::sparse_ordering_queue<Vertex> queue; typedef typename detail::bfs_king_visitor<OutputIterator, queue, Compare, PseudoDegreeMap, std::vector<int>, VertexIndexMap > Visitor; typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; - std::vector<DS> pseudo_degree_vec(num_vertices(g)); + std::vector<ds_type> pseudo_degree_vec(num_vertices(g)); PseudoDegreeMap pseudo_degree(pseudo_degree_vec.begin(), index_map); typename graph_traits<Graph>::vertex_iterator ui, ui_end; @@ -279,7 +263,7 @@ namespace boost { king_ordering(const Graph& G, OutputIterator permutation, ColorMap color, DegreeMap degree, VertexIndexMap index_map) { - if (vertices(G).first == vertices(G).second) + if (has_no_vertices(G)) return permutation; typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex; @@ -315,7 +299,7 @@ namespace boost { king_ordering(const Graph& G, OutputIterator permutation, VertexIndexMap index_map) { - if (vertices(G).first == vertices(G).second) + if (has_no_vertices(G)) return permutation; typedef out_degree_property_map<Graph> DegreeMap; diff --git a/Utilities/BGL/boost/graph/kolmogorov_max_flow.hpp b/Utilities/BGL/boost/graph/kolmogorov_max_flow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f98a5721a206b95f24cbd164b74eac8adc9d94ca --- /dev/null +++ b/Utilities/BGL/boost/graph/kolmogorov_max_flow.hpp @@ -0,0 +1,808 @@ +// Copyright (c) 2006, Stephan Diederich +// +// This code may be used under either of the following two licences: +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. OF SUCH DAMAGE. +// +// Or: +// +// 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_KOLMOGOROV_MAX_FLOW_HPP +#define BOOST_KOLMOGOROV_MAX_FLOW_HPP + +#include <boost/config.hpp> +#include <cassert> +#include <vector> +#include <list> +#include <utility> +#include <iosfwd> +#include <algorithm> // for std::min and std::max + +#include <boost/pending/queue.hpp> +#include <boost/limits.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/none_t.hpp> +#include <boost/graph/graph_concepts.hpp> +#include <boost/graph/named_function_params.hpp> +#include <boost/graph/lookup_edge.hpp> + +namespace boost { + namespace detail { + + template <class Graph, + class EdgeCapacityMap, + class ResidualCapacityEdgeMap, + class ReverseEdgeMap, + class PredecessorMap, + class ColorMap, + class DistanceMap, + class IndexMap> + class kolmogorov{ + typedef typename property_traits<EdgeCapacityMap>::value_type tEdgeVal; + typedef graph_traits<Graph> tGraphTraits; + typedef typename tGraphTraits::vertex_iterator vertex_iterator; + typedef typename tGraphTraits::vertex_descriptor vertex_descriptor; + typedef typename tGraphTraits::edge_descriptor edge_descriptor; + typedef typename tGraphTraits::edge_iterator edge_iterator; + typedef typename tGraphTraits::out_edge_iterator out_edge_iterator; + typedef boost::queue<vertex_descriptor> tQueue; //queue of vertices, used in adoption-stage + typedef typename property_traits<ColorMap>::value_type tColorValue; + typedef color_traits<tColorValue> tColorTraits; + typedef typename property_traits<DistanceMap>::value_type tDistanceVal; + + public: + kolmogorov(Graph& g, + EdgeCapacityMap cap, + ResidualCapacityEdgeMap res, + ReverseEdgeMap rev, + PredecessorMap pre, + ColorMap color, + DistanceMap dist, + IndexMap idx, + vertex_descriptor src, + vertex_descriptor sink): + m_g(g), + m_index_map(idx), + m_cap_map(cap), + m_res_cap_map(res), + m_rev_edge_map(rev), + m_pre_map(pre), + m_tree_map(color), + m_dist_map(dist), + m_source(src), + m_sink(sink), + m_active_nodes(), + m_in_active_list_vec(num_vertices(g), false), + m_in_active_list_map(make_iterator_property_map(m_in_active_list_vec.begin(), m_index_map)), + m_has_parent_vec(num_vertices(g), false), + m_has_parent_map(make_iterator_property_map(m_has_parent_vec.begin(), m_index_map)), + m_time_vec(num_vertices(g), 0), + m_time_map(make_iterator_property_map(m_time_vec.begin(), m_index_map)), + m_flow(0), + m_time(1), + m_last_grow_vertex(graph_traits<Graph>::null_vertex()){ + // initialize the color-map with gray-values + vertex_iterator vi, v_end; + for(tie(vi, v_end) = vertices(m_g); vi != v_end; ++vi){ + set_tree(*vi, tColorTraits::gray()); + } + // Initialize flow to zero which means initializing + // the residual capacity equal to the capacity + edge_iterator ei, e_end; + for(tie(ei, e_end) = edges(m_g); ei != e_end; ++ei) { + m_res_cap_map[*ei] = m_cap_map[*ei]; + assert(m_rev_edge_map[m_rev_edge_map[*ei]] == *ei); //check if the reverse edge map is build up properly + } + //init the search trees with the two terminals + set_tree(m_source, tColorTraits::black()); + set_tree(m_sink, tColorTraits::white()); + m_time_map[m_source] = 1; + m_time_map[m_sink] = 1; + } + + ~kolmogorov(){} + + tEdgeVal max_flow(){ + //augment direct paths from SOURCE->SINK and SOURCE->VERTEX->SINK + augment_direct_paths(); + //start the main-loop + while(true){ + bool path_found; + edge_descriptor connecting_edge; + tie(connecting_edge, path_found) = grow(); //find a path from source to sink + if(!path_found){ + //we're finished, no more paths were found + break; + } + ++m_time; + augment(connecting_edge); //augment that path + adopt(); //rebuild search tree structure + } + return m_flow; + } + + //the complete class is protected, as we want access to members in derived test-class (see $(BOOST_ROOT)/libs/graph/test/kolmogorov_max_flow_test.cpp) + protected: + void augment_direct_paths(){ + //in a first step, we augment all direct paths from source->NODE->sink + //and additionally paths from source->sink + //this improves especially graphcuts for segmentation, as most of the nodes have source/sink connects + //but shouldn't have an impact on other maxflow problems (this is done in grow() anyway) + out_edge_iterator ei, e_end; + for(tie(ei, e_end) = out_edges(m_source, m_g); ei != e_end; ++ei){ + edge_descriptor from_source = *ei; + vertex_descriptor current_node = target(from_source, m_g); + if(current_node == m_sink){ + tEdgeVal cap = m_res_cap_map[from_source]; + m_res_cap_map[from_source] = 0; + m_flow += cap; + continue; + } + edge_descriptor to_sink; + bool is_there; + tie(to_sink, is_there) = lookup_edge(current_node, m_sink, m_g); + if(is_there){ + tEdgeVal cap_from_source = m_res_cap_map[from_source]; + tEdgeVal cap_to_sink = m_res_cap_map[to_sink]; + if(cap_from_source > cap_to_sink){ + set_tree(current_node, tColorTraits::black()); + add_active_node(current_node); + set_edge_to_parent(current_node, from_source); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + //add stuff to flow and update residuals + //we dont need to update reverse_edges, as incoming/outgoing edges to/from source/sink don't count for max-flow + m_res_cap_map[from_source] -= cap_to_sink; + m_res_cap_map[to_sink] = 0; + m_flow += cap_to_sink; + } else if(cap_to_sink > 0){ + set_tree(current_node, tColorTraits::white()); + add_active_node(current_node); + set_edge_to_parent(current_node, to_sink); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + //add stuff to flow and update residuals + //we dont need to update reverse_edges, as incoming/outgoing edges to/from source/sink don't count for max-flow + m_res_cap_map[to_sink] -= cap_from_source; + m_res_cap_map[from_source] = 0; + m_flow += cap_from_source; + } + } else if(m_res_cap_map[from_source]){ + //there is no sink connect, so we can't augment this path + //but to avoid adding m_source to the active nodes, we just activate this node and set the approciate things + set_tree(current_node, tColorTraits::black()); + set_edge_to_parent(current_node, from_source); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + add_active_node(current_node); + } + } + for(tie(ei, e_end) = out_edges(m_sink, m_g); ei != e_end; ++ei){ + edge_descriptor to_sink = m_rev_edge_map[*ei]; + vertex_descriptor current_node = source(to_sink, m_g); + if(m_res_cap_map[to_sink]){ + set_tree(current_node, tColorTraits::white()); + set_edge_to_parent(current_node, to_sink); + m_dist_map[current_node] = 1; + m_time_map[current_node] = 1; + add_active_node(current_node); + } + } + } + + /** + * returns a pair of an edge and a boolean. if the bool is true, the edge is a connection of a found path from s->t , read "the link" and + * source(returnVal, m_g) is the end of the path found in the source-tree + * target(returnVal, m_g) is the beginning of the path found in the sink-tree + */ + std::pair<edge_descriptor, bool> grow(){ + assert(m_orphans.empty()); + vertex_descriptor current_node; + while((current_node = get_next_active_node()) != graph_traits<Graph>::null_vertex()){ //if there is one + assert(get_tree(current_node) != tColorTraits::gray() && (has_parent(current_node) || current_node==m_source || current_node==m_sink)); + if(get_tree(current_node) == tColorTraits::black()){ + //source tree growing + out_edge_iterator ei, e_end; + if(current_node != m_last_grow_vertex){ + m_last_grow_vertex = current_node; + tie(m_last_grow_edge_it, m_last_grow_edge_end) = out_edges(current_node, m_g); + } + for(; m_last_grow_edge_it != m_last_grow_edge_end; ++m_last_grow_edge_it){ + edge_descriptor out_edge = *m_last_grow_edge_it; + if(m_res_cap_map[out_edge] > 0){ //check if we have capacity left on this edge + vertex_descriptor other_node = target(out_edge, m_g); + if(get_tree(other_node) == tColorTraits::gray()){ //it's a free node + set_tree(other_node, tColorTraits::black()); //aquire other node to our search tree + set_edge_to_parent(other_node, out_edge); //set us as parent + m_dist_map[other_node] = m_dist_map[current_node] + 1; //and update the distance-heuristic + m_time_map[other_node] = m_time_map[current_node]; + add_active_node(other_node); + } else if(get_tree(other_node) == tColorTraits::black()){ + if(is_closer_to_terminal(current_node, other_node)){ //we do this to get shorter paths. check if we are nearer to the source as its parent is + set_edge_to_parent(other_node, out_edge); + m_dist_map[other_node] = m_dist_map[current_node] + 1; + m_time_map[other_node] = m_time_map[current_node]; + } + } else{ + assert(get_tree(other_node)==tColorTraits::white()); + //kewl, found a path from one to the other search tree, return the connecting edge in src->sink dir + return std::make_pair(out_edge, true); + } + } + } //for all out-edges + } //source-tree-growing + else{ + assert(get_tree(current_node) == tColorTraits::white()); + out_edge_iterator ei, e_end; + if(current_node != m_last_grow_vertex){ + m_last_grow_vertex = current_node; + tie(m_last_grow_edge_it, m_last_grow_edge_end) = out_edges(current_node, m_g); + } + for(; m_last_grow_edge_it != m_last_grow_edge_end; ++m_last_grow_edge_it){ + edge_descriptor in_edge = m_rev_edge_map[*m_last_grow_edge_it]; + if(m_res_cap_map[in_edge] > 0){ //check if there is capacity left + vertex_descriptor other_node = source(in_edge, m_g); + if(get_tree(other_node) == tColorTraits::gray()){ //it's a free node + set_tree(other_node, tColorTraits::white()); //aquire that node to our search tree + set_edge_to_parent(other_node, in_edge); //set us as parent + add_active_node(other_node); //activate that node + m_dist_map[other_node] = m_dist_map[current_node] + 1; //set its distance + m_time_map[other_node] = m_time_map[current_node]; //and time + } else if(get_tree(other_node) == tColorTraits::white()){ + if(is_closer_to_terminal(current_node, other_node)){ + //we are closer to the sink than its parent is, so we "adopt" him + set_edge_to_parent(other_node, in_edge); + m_dist_map[other_node] = m_dist_map[current_node] + 1; + m_time_map[other_node] = m_time_map[current_node]; + } + } else{ + assert(get_tree(other_node)==tColorTraits::black()); + //kewl, found a path from one to the other search tree, return the connecting edge in src->sink dir + return std::make_pair(in_edge, true); + } + } + } //for all out-edges + } //sink-tree growing + //all edges of that node are processed, and no more paths were found. so remove if from the front of the active queue + finish_node(current_node); + } //while active_nodes not empty + return std::make_pair(edge_descriptor(), false); //no active nodes anymore and no path found, we're done + } + + /** + * augments path from s->t and updates residual graph + * source(e, m_g) is the end of the path found in the source-tree + * target(e, m_g) is the beginning of the path found in the sink-tree + * this phase generates orphans on satured edges, if the attached verts are from different search-trees + * orphans are ordered in distance to sink/source. first the farest from the source are front_inserted into the orphans list, + * and after that the sink-tree-orphans are front_inserted. when going to adoption stage the orphans are popped_front, and so we process the nearest + * verts to the terminals first + */ + void augment(edge_descriptor e){ + assert(get_tree(target(e, m_g)) == tColorTraits::white()); + assert(get_tree(source(e, m_g)) == tColorTraits::black()); + assert(m_orphans.empty()); + + const tEdgeVal bottleneck = find_bottleneck(e); + //now we push the found flow through the path + //for each edge we saturate we have to look for the verts that belong to that edge, one of them becomes an orphans + //now process the connecting edge + m_res_cap_map[e] -= bottleneck; + assert(m_res_cap_map[e] >= 0); + m_res_cap_map[m_rev_edge_map[e]] += bottleneck; + + //now we follow the path back to the source + vertex_descriptor current_node = source(e, m_g); + while(current_node != m_source){ + edge_descriptor pred = get_edge_to_parent(current_node); + m_res_cap_map[pred] -= bottleneck; + assert(m_res_cap_map[pred] >= 0); + m_res_cap_map[m_rev_edge_map[pred]] += bottleneck; + if(m_res_cap_map[pred] == 0){ + set_no_parent(current_node); + m_orphans.push_front(current_node); + } + current_node = source(pred, m_g); + } + //then go forward in the sink-tree + current_node = target(e, m_g); + while(current_node != m_sink){ + edge_descriptor pred = get_edge_to_parent(current_node); + m_res_cap_map[pred] -= bottleneck; + assert(m_res_cap_map[pred] >= 0); + m_res_cap_map[m_rev_edge_map[pred]] += bottleneck; + if(m_res_cap_map[pred] == 0){ + set_no_parent(current_node); + m_orphans.push_front(current_node); + } + current_node = target(pred, m_g); + } + //and add it to the max-flow + m_flow += bottleneck; + } + + /** + * returns the bottleneck of a s->t path (end_of_path is last vertex in source-tree, begin_of_path is first vertex in sink-tree) + */ + inline tEdgeVal find_bottleneck(edge_descriptor e){ + BOOST_USING_STD_MIN(); + tEdgeVal minimum_cap = m_res_cap_map[e]; + vertex_descriptor current_node = source(e, m_g); + //first go back in the source tree + while(current_node != m_source){ + edge_descriptor pred = get_edge_to_parent(current_node); + minimum_cap = min BOOST_PREVENT_MACRO_SUBSTITUTION(minimum_cap, m_res_cap_map[pred]); + current_node = source(pred, m_g); + } + //then go forward in the sink-tree + current_node = target(e, m_g); + while(current_node != m_sink){ + edge_descriptor pred = get_edge_to_parent(current_node); + minimum_cap = min BOOST_PREVENT_MACRO_SUBSTITUTION(minimum_cap, m_res_cap_map[pred]); + current_node = target(pred, m_g); + } + return minimum_cap; + } + + /** + * rebuild search trees + * empty the queue of orphans, and find new parents for them or just drop them from the search trees + */ + void adopt(){ + while(!m_orphans.empty() || !m_child_orphans.empty()){ + vertex_descriptor current_node; + if(m_child_orphans.empty()){ + //get the next orphan from the main-queue and remove it + current_node = m_orphans.front(); + m_orphans.pop_front(); + } else{ + current_node = m_child_orphans.front(); + m_child_orphans.pop(); + } + if(get_tree(current_node) == tColorTraits::black()){ + //we're in the source-tree + tDistanceVal min_distance = (std::numeric_limits<tDistanceVal>::max)(); + edge_descriptor new_parent_edge; + out_edge_iterator ei, e_end; + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + const edge_descriptor in_edge = m_rev_edge_map[*ei]; + assert(target(in_edge, m_g) == current_node); //we should be the target of this edge + if(m_res_cap_map[in_edge] > 0){ + vertex_descriptor other_node = source(in_edge, m_g); + if(get_tree(other_node) == tColorTraits::black() && has_source_connect(other_node)){ + if(m_dist_map[other_node] < min_distance){ + min_distance = m_dist_map[other_node]; + new_parent_edge = in_edge; + } + } + } + } + if(min_distance != (std::numeric_limits<tDistanceVal>::max)()){ + set_edge_to_parent(current_node, new_parent_edge); + m_dist_map[current_node] = min_distance + 1; + m_time_map[current_node] = m_time; + } else{ + m_time_map[current_node] = 0; + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + edge_descriptor in_edge = m_rev_edge_map[*ei]; + vertex_descriptor other_node = source(in_edge, m_g); + if(get_tree(other_node) == tColorTraits::black() && has_parent(other_node)){ + if(m_res_cap_map[in_edge] > 0){ + add_active_node(other_node); + } + if(source(get_edge_to_parent(other_node), m_g) == current_node){ + //we are the parent of that node + //it has to find a new parent, too + set_no_parent(other_node); + m_child_orphans.push(other_node); + } + } + } + set_tree(current_node, tColorTraits::gray()); + } //no parent found + } //source-tree-adoption + else{ + //now we should be in the sink-tree, check that... + assert(get_tree(current_node) == tColorTraits::white()); + out_edge_iterator ei, e_end; + edge_descriptor new_parent_edge; + tDistanceVal min_distance = (std::numeric_limits<tDistanceVal>::max)(); + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + const edge_descriptor out_edge = *ei; + if(m_res_cap_map[out_edge] > 0){ + const vertex_descriptor other_node = target(out_edge, m_g); + if(get_tree(other_node) == tColorTraits::white() && has_sink_connect(other_node)) + if(m_dist_map[other_node] < min_distance){ + min_distance = m_dist_map[other_node]; + new_parent_edge = out_edge; + } + } + } + if(min_distance != (std::numeric_limits<tDistanceVal>::max)()){ + set_edge_to_parent(current_node, new_parent_edge); + m_dist_map[current_node] = min_distance + 1; + m_time_map[current_node] = m_time; + } else{ + m_time_map[current_node] = 0; + for(tie(ei, e_end) = out_edges(current_node, m_g); ei != e_end; ++ei){ + const edge_descriptor out_edge = *ei; + const vertex_descriptor other_node = target(out_edge, m_g); + if(get_tree(other_node) == tColorTraits::white() && has_parent(other_node)){ + if(m_res_cap_map[out_edge] > 0){ + add_active_node(other_node); + } + if(target(get_edge_to_parent(other_node), m_g) == current_node){ + //we were it's parent, so it has to find a new one, too + set_no_parent(other_node); + m_child_orphans.push(other_node); + } + } + } + set_tree(current_node, tColorTraits::gray()); + } //no parent found + } //sink-tree adoption + } //while !orphans.empty() + } //adopt + + /** + * return next active vertex if there is one, otherwise a null_vertex + */ + inline vertex_descriptor get_next_active_node(){ + while(true){ + if(m_active_nodes.empty()) + return graph_traits<Graph>::null_vertex(); + vertex_descriptor v = m_active_nodes.front(); + + if(!has_parent(v) && v != m_source && v != m_sink){ //if it has no parent, this node can't be active(if its not source or sink) + m_active_nodes.pop(); + m_in_active_list_map[v] = false; + } else{ + assert(get_tree(v) == tColorTraits::black() || get_tree(v) == tColorTraits::white()); + return v; + } + } + } + + /** + * adds v as an active vertex, but only if its not in the list already + */ + inline void add_active_node(vertex_descriptor v){ + assert(get_tree(v) != tColorTraits::gray()); + if(m_in_active_list_map[v]){ + return; + } else{ + m_in_active_list_map[v] = true; + m_active_nodes.push(v); + } + } + + /** + * finish_node removes a node from the front of the active queue (its called in grow phase, if no more paths can be found using this node) + */ + inline void finish_node(vertex_descriptor v){ + assert(m_active_nodes.front() == v); + m_active_nodes.pop(); + m_in_active_list_map[v] = false; + m_last_grow_vertex = graph_traits<Graph>::null_vertex(); + } + + /** + * removes a vertex from the queue of active nodes (actually this does nothing, + * but checks if this node has no parent edge, as this is the criteria for beeing no more active) + */ + inline void remove_active_node(vertex_descriptor v){ + assert(!has_parent(v)); + } + + /** + * returns the search tree of v; tColorValue::black() for source tree, white() for sink tree, gray() for no tree + */ + inline tColorValue get_tree(vertex_descriptor v) const { + return m_tree_map[v]; + } + + /** + * sets search tree of v; tColorValue::black() for source tree, white() for sink tree, gray() for no tree + */ + inline void set_tree(vertex_descriptor v, tColorValue t){ + m_tree_map[v] = t; + } + + /** + * returns edge to parent vertex of v; + */ + inline edge_descriptor get_edge_to_parent(vertex_descriptor v) const{ + return m_pre_map[v]; + } + + /** + * returns true if the edge stored in m_pre_map[v] is a valid entry + */ + inline bool has_parent(vertex_descriptor v) const{ + return m_has_parent_map[v]; + } + + /** + * sets edge to parent vertex of v; + */ + inline void set_edge_to_parent(vertex_descriptor v, edge_descriptor f_edge_to_parent){ + assert(m_res_cap_map[f_edge_to_parent] > 0); + m_pre_map[v] = f_edge_to_parent; + m_has_parent_map[v] = true; + } + + /** + * removes the edge to parent of v (this is done by invalidating the entry an additional map) + */ + inline void set_no_parent(vertex_descriptor v){ + m_has_parent_map[v] = false; + } + + /** + * checks if vertex v has a connect to the sink-vertex (@var m_sink) + * @param v the vertex which is checked + * @return true if a path to the sink was found, false if not + */ + inline bool has_sink_connect(vertex_descriptor v){ + tDistanceVal current_distance = 0; + vertex_descriptor current_vertex = v; + while(true){ + if(m_time_map[current_vertex] == m_time){ + //we found a node which was already checked this round. use it for distance calculations + current_distance += m_dist_map[current_vertex]; + break; + } + if(current_vertex == m_sink){ + m_time_map[m_sink] = m_time; + break; + } + if(has_parent(current_vertex)){ + //it has a parent, so get it + current_vertex = target(get_edge_to_parent(current_vertex), m_g); + ++current_distance; + } else{ + //no path found + return false; + } + } + current_vertex=v; + while(m_time_map[current_vertex] != m_time){ + m_dist_map[current_vertex] = current_distance--; + m_time_map[current_vertex] = m_time; + current_vertex = target(get_edge_to_parent(current_vertex), m_g); + } + return true; + } + + /** + * checks if vertex v has a connect to the source-vertex (@var m_source) + * @param v the vertex which is checked + * @return true if a path to the source was found, false if not + */ + inline bool has_source_connect(vertex_descriptor v){ + tDistanceVal current_distance = 0; + vertex_descriptor current_vertex = v; + while(true){ + if(m_time_map[current_vertex] == m_time){ + //we found a node which was already checked this round. use it for distance calculations + current_distance += m_dist_map[current_vertex]; + break; + } + if(current_vertex == m_source){ + m_time_map[m_source] = m_time; + break; + } + if(has_parent(current_vertex)){ + //it has a parent, so get it + current_vertex = source(get_edge_to_parent(current_vertex), m_g); + ++current_distance; + } else{ + //no path found + return false; + } + } + current_vertex=v; + while(m_time_map[current_vertex] != m_time){ + m_dist_map[current_vertex] = current_distance-- ; + m_time_map[current_vertex] = m_time; + current_vertex = source(get_edge_to_parent(current_vertex), m_g); + } + return true; + } + + /** + * returns true, if p is closer to a terminal than q + */ + inline bool is_closer_to_terminal(vertex_descriptor p, vertex_descriptor q){ + //checks the timestamps first, to build no cycles, and after that the real distance + return (m_time_map[q] <= m_time_map[p] && m_dist_map[q] > m_dist_map[p]+1); + } + + //////// + // member vars + //////// + Graph& m_g; + IndexMap m_index_map; + EdgeCapacityMap m_cap_map; + ResidualCapacityEdgeMap m_res_cap_map; + ReverseEdgeMap m_rev_edge_map; + PredecessorMap m_pre_map; //stores paths found in the growth stage + ColorMap m_tree_map; //maps each vertex into one of the two search tree or none (gray()) + DistanceMap m_dist_map; //stores distance to source/sink nodes + vertex_descriptor m_source; + vertex_descriptor m_sink; + + tQueue m_active_nodes; + std::vector<bool> m_in_active_list_vec; + iterator_property_map<std::vector<bool>::iterator, IndexMap> m_in_active_list_map; + + std::list<vertex_descriptor> m_orphans; + tQueue m_child_orphans; // we use a second queuqe for child orphans, as they are FIFO processed + + std::vector<bool> m_has_parent_vec; + iterator_property_map<std::vector<bool>::iterator, IndexMap> m_has_parent_map; + + std::vector<long> m_time_vec; //timestamp of each node, used for sink/source-path calculations + iterator_property_map<std::vector<long>::iterator, IndexMap> m_time_map; + tEdgeVal m_flow; + long m_time; + vertex_descriptor m_last_grow_vertex; + out_edge_iterator m_last_grow_edge_it; + out_edge_iterator m_last_grow_edge_end; + }; + } //namespace detail + + /** + * non-named-parameter version, given everything + * this is the catch all version + */ + template <class Graph, class CapacityEdgeMap, class ResidualCapacityEdgeMap, class ReverseEdgeMap, + class PredecessorMap, class ColorMap, class DistanceMap, class IndexMap> + typename property_traits<CapacityEdgeMap>::value_type + kolmogorov_max_flow + (Graph& g, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res_cap, + ReverseEdgeMap rev_map, + PredecessorMap pre_map, + ColorMap color, + DistanceMap dist, + IndexMap idx, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink + ) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + //as this method is the last one before we instantiate the solver, we do the concept checks here + function_requires<VertexListGraphConcept<Graph> >(); //to have vertices(), num_vertices(), + function_requires<EdgeListGraphConcept<Graph> >(); //to have edges() + function_requires<IncidenceGraphConcept<Graph> >(); //to have source(), target() and out_edges() + function_requires<LvaluePropertyMapConcept<CapacityEdgeMap, edge_descriptor> >(); //read flow-values from edges + function_requires<Mutable_LvaluePropertyMapConcept<ResidualCapacityEdgeMap, edge_descriptor> >(); //write flow-values to residuals + function_requires<LvaluePropertyMapConcept<ReverseEdgeMap, edge_descriptor> >(); //read out reverse edges + function_requires<Mutable_LvaluePropertyMapConcept<PredecessorMap, vertex_descriptor> >(); //store predecessor there + function_requires<Mutable_LvaluePropertyMapConcept<ColorMap, vertex_descriptor> >(); //write corresponding tree + function_requires<Mutable_LvaluePropertyMapConcept<DistanceMap, vertex_descriptor> >(); //write distance to source/sink + function_requires<ReadablePropertyMapConcept<IndexMap, vertex_descriptor> >(); //get index 0...|V|-1 + assert(num_vertices(g) >= 2 && src != sink); + detail::kolmogorov<Graph, CapacityEdgeMap, ResidualCapacityEdgeMap, ReverseEdgeMap, PredecessorMap, ColorMap, DistanceMap, IndexMap> + algo(g, cap, res_cap, rev_map, pre_map, color, dist, idx, src, sink); + return algo.max_flow(); + } + + /** + * non-named-parameter version, given: capacity, residucal_capacity, reverse_edges, and an index map. + */ + template <class Graph, class CapacityEdgeMap, class ResidualCapacityEdgeMap, class ReverseEdgeMap, class IndexMap> + typename property_traits<CapacityEdgeMap>::value_type + kolmogorov_max_flow + (Graph& g, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res_cap, + ReverseEdgeMap rev, + IndexMap idx, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink) + { + typename graph_traits<Graph>::vertices_size_type n_verts = num_vertices(g); + std::vector<typename graph_traits<Graph>::edge_descriptor> predecessor_vec(n_verts); + std::vector<default_color_type> color_vec(n_verts); + std::vector<typename graph_traits<Graph>::vertices_size_type> distance_vec(n_verts); + return kolmogorov_max_flow + (g, cap, res_cap, rev, + make_iterator_property_map(predecessor_vec.begin(), idx), + make_iterator_property_map(color_vec.begin(), idx), + make_iterator_property_map(distance_vec.begin(), idx), + idx, src, sink); + } + + /** + * non-named-parameter version, some given: capacity, residual_capacity, reverse_edges, color_map and an index map. + * Use this if you are interested in the minimum cut, as the color map provides that info + */ + template <class Graph, class CapacityEdgeMap, class ResidualCapacityEdgeMap, class ReverseEdgeMap, class ColorMap, class IndexMap> + typename property_traits<CapacityEdgeMap>::value_type + kolmogorov_max_flow + (Graph& g, + CapacityEdgeMap cap, + ResidualCapacityEdgeMap res_cap, + ReverseEdgeMap rev, + ColorMap color, + IndexMap idx, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink) + { + typename graph_traits<Graph>::vertices_size_type n_verts = num_vertices(g); + std::vector<typename graph_traits<Graph>::edge_descriptor> predecessor_vec(n_verts); + std::vector<typename graph_traits<Graph>::vertices_size_type> distance_vec(n_verts); + + return kolmogorov_max_flow + (g, cap, res_cap, rev, + make_iterator_property_map(predecessor_vec.begin(), idx), + color, + make_iterator_property_map(distance_vec.begin(), idx), + idx, src, sink); + } + + /** + * named-parameter version, some given + */ + template <class Graph, class P, class T, class R> + typename property_traits<typename property_map<Graph, edge_capacity_t>::const_type>::value_type + kolmogorov_max_flow + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + const bgl_named_params<P, T, R>& params) + { + return kolmogorov_max_flow(g, + choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), + choose_pmap(get_param(params, edge_residual_capacity), g, edge_residual_capacity), + choose_const_pmap(get_param(params, edge_reverse), g, edge_reverse), + choose_pmap(get_param(params, vertex_predecessor), g, vertex_predecessor), + choose_pmap(get_param(params, vertex_color), g, vertex_color), + choose_pmap(get_param(params, vertex_distance), g, vertex_distance), + choose_const_pmap(get_param(params, vertex_index), g, vertex_index), + src, sink); + } + + /** + * named-parameter version, none given + */ + template <class Graph> + typename property_traits<typename property_map<Graph, edge_capacity_t>::const_type>::value_type + kolmogorov_max_flow + (Graph& g, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink) + { + bgl_named_params<int, buffer_param_t> params(0); // bogus empty param + return kolmogorov_max_flow(g, src, sink, params); + } +} // namespace boost + +#endif // BOOST_KOLMOGOROV_MAX_FLOW_HPP + diff --git a/Utilities/BGL/boost/graph/kruskal_min_spanning_tree.hpp b/Utilities/BGL/boost/graph/kruskal_min_spanning_tree.hpp index 77e3e2f1436184a58320a725d1fdf216b71dcb1c..a847e3f156a9eb0390727942572df94849cdecd4 100644 --- a/Utilities/BGL/boost/graph/kruskal_min_spanning_tree.hpp +++ b/Utilities/BGL/boost/graph/kruskal_min_spanning_tree.hpp @@ -23,7 +23,7 @@ #include <queue> #include <functional> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/graph_concepts.hpp> #include <boost/graph/named_function_params.hpp> #include <boost/pending/disjoint_sets.hpp> @@ -48,6 +48,7 @@ namespace boost { OutputIterator spanning_tree_edges, Rank rank, Parent parent, Weight weight) { + if (num_vertices(G) == 0) return; // Nothing to do in this case typedef typename graph_traits<Graph>::vertex_descriptor Vertex; typedef typename graph_traits<Graph>::edge_descriptor Edge; function_requires<VertexListGraphConcept<Graph> >(); @@ -101,6 +102,7 @@ namespace boost { typedef typename graph_traits<Graph>::vertices_size_type size_type; typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; typedef typename property_map<Graph, vertex_index_t>::type index_map_t; + if (num_vertices(g) == 0) return; // Nothing to do in this case typename graph_traits<Graph>::vertices_size_type n = num_vertices(g); std::vector<size_type> rank_map(n); @@ -121,6 +123,7 @@ namespace boost { { typedef typename graph_traits<Graph>::vertices_size_type size_type; typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + if (num_vertices(g) == 0) return; // Nothing to do in this case typename graph_traits<Graph>::vertices_size_type n; n = is_default_param(get_param(params, vertex_rank)) ? num_vertices(g) : 1; diff --git a/Utilities/BGL/boost/graph/labeled_graph.hpp b/Utilities/BGL/boost/graph/labeled_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d91c5983dfa30fd768d881fda14452b7d693ab94 --- /dev/null +++ b/Utilities/BGL/boost/graph/labeled_graph.hpp @@ -0,0 +1,810 @@ +// Copyright (C) 2009 Andrew Sutton + +// 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) + +#ifndef BOOST_GRAPH_LABELED_GRAPH_HPP +#define BOOST_GRAPH_LABELED_GRAPH_HPP + +#include <boost/config.hpp> +#include <vector> +#include <map> + +#include <boost/static_assert.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/unordered_map.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_unsigned.hpp> +#include <boost/pending/container_traits.hpp> +#include <boost/graph/graph_traits.hpp> + +// This file implements a utility for creating mappings from arbitrary +// identifers to the vertices of a graph. + +namespace boost { + +// A type selector that denotes the use of some default value. +struct defaultS { }; + +/** @internal */ +namespace graph_detail { + /** Returns true if the selector is the default selector. */ + template <typename Selector> + struct is_default + : mpl::bool_<is_same<Selector, defaultS>::value> + { }; + + /** + * Choose the default map instance. If Label is an unsigned integral type + * the we can use a vector to store the information. + */ + template <typename Label, typename Vertex> + struct choose_default_map { + typedef typename mpl::if_< + is_unsigned<Label>, + std::vector<Vertex>, + std::map<Label, Vertex> // TODO: Should use unordered_map? + >::type type; + }; + + /** + * @name Generate Label Map + * These type generators are responsible for instantiating an associative + * container for the the labeled graph. Note that the Selector must be + * select a pair associative container or a vecS, which is only valid if + * Label is an integral type. + */ + //@{ + template <typename Selector, typename Label, typename Vertex> + struct generate_label_map { }; + + template <typename Label, typename Vertex> + struct generate_label_map<vecS, Label, Vertex> + { typedef std::vector<Vertex> type; }; + + template <typename Label, typename Vertex> + struct generate_label_map<mapS, Label, Vertex> + { typedef std::map<Label, Vertex> type; }; + + template <typename Label, typename Vertex> + struct generate_label_map<multimapS, Label, Vertex> + { typedef std::multimap<Label, Vertex> type; }; + + template <typename Label, typename Vertex> + struct generate_label_map<hash_mapS, Label, Vertex> + { typedef boost::unordered_map<Label, Vertex> type; }; + + template <typename Label, typename Vertex> + struct generate_label_map<hash_multimapS, Label, Vertex> + { typedef boost::unordered_multimap<Label, Vertex> type; }; + + template <typename Selector, typename Label, typename Vertex> + struct choose_custom_map { + typedef typename generate_label_map<Selector, Label, Vertex>::type type; + }; + //@} + + /** + * Choose and instantiate an "associative" container. Note that this can + * also choose vector. + */ + template <typename Selector, typename Label, typename Vertex> + struct choose_map { + typedef typename mpl::eval_if< + is_default<Selector>, + choose_default_map<Label, Vertex>, + choose_custom_map<Selector, Label, Vertex> + >::type type; + }; + + /** @name Insert Labeled Vertex */ + //@{ + // Tag dispatch on random access containers (i.e., vectors). This function + // basically requires a) that Container is vector<Label> and that Label + // is an unsigned integral value. Note that this will resize the vector + // to accomodate indices. + template <typename Container, typename Graph, typename Label, typename Prop> + std::pair<typename graph_traits<Graph>::vertex_descriptor, bool> + insert_labeled_vertex(Container& c, Graph& g, Label const& l, Prop const& p, + random_access_container_tag) + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + + // If the label is out of bounds, resize the vector to accomodate. + // Resize by 2x the index so we don't cause quadratic insertions over + // time. + if(l >= c.size()) { + c.resize((l + 1) * 2); + } + Vertex v = add_vertex(p, g); + c[l] = v; + return std::make_pair(c[l], true); + } + + // Tag dispatch on multi associative containers (i.e. multimaps). + template <typename Container, typename Graph, typename Label, typename Prop> + std::pair<typename graph_traits<Graph>::vertex_descriptor, bool> + insert_labeled_vertex(Container& c, Graph& g, Label const& l, Prop const& p, + multiple_associative_container_tag const&) + { + // Note that insertion always succeeds so we can add the vertex first + // and then the mapping to the label. + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + Vertex v = add_vertex(g); + c.insert(std::make_pair(l, v)); + return std::make_pair(v, true); + } + + // Tag dispatch on unique associative containers (i.e. maps). + template <typename Container, typename Graph, typename Label, typename Prop> + std::pair<typename graph_traits<Graph>::vertex_descriptor, bool> + insert_labeled_vertex(Container& c, Graph& g, Label const& l, Prop const&, + unique_associative_container_tag) + { + // Here, we actually have to try the insertion first, and only add + // the vertex if we get a new element. + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename Container::iterator Iterator; + std::pair<Iterator, bool> x = c.insert(std::make_pair(l, Vertex())); + if(x.second) { + x.first->second = add_vertex(g); + } + return std::make_pair(x.first->second, x.second); + } + + // Dispatcher + template <typename Container, typename Graph, typename Label, typename Prop> + std::pair<typename graph_traits<Graph>::vertex_descriptor, bool> + insert_labeled_vertex(Container& c, Graph& g, Label const& l, Prop const& p) + { return insert_labeled_vertex(c, g, l, p, container_category(c)); } + //@} + + /** @name Find Labeled Vertex */ + //@{ + // Tag dispatch for sequential maps (i.e., vectors). + template <typename Container, typename Graph, typename Label> + typename graph_traits<Graph>::vertex_descriptor + find_labeled_vertex(Container const& c, Graph const&, Label const& l, + random_access_container_tag) + { return l < c.size() ? c[l] : graph_traits<Graph>::null_vertex(); } + + // Tag dispatch for pair associative maps (more or less). + template <typename Container, typename Graph, typename Label> + typename graph_traits<Graph>::vertex_descriptor + find_labeled_vertex(Container const& c, Graph const&, Label const& l, + associative_container_tag) + { + typename Container::const_iterator i = c.find(l); + return i != c.end() ? i->second : graph_traits<Graph>::null_vertex(); + } + + // Dispatcher + template <typename Container, typename Graph, typename Label> + typename graph_traits<Graph>::vertex_descriptor + find_labeled_vertex(Container const& c, Graph const& g, Label const& l) + { return find_labeled_vertex(c, g, l, container_category(c)); } + //@} + + /** @name Put Vertex Label */ + //@{ + // Tag dispatch on vectors. + template <typename Container, typename Label, typename Graph, typename Vertex> + bool put_vertex_label(Container& c, Graph const&, Label const& l, Vertex v, + random_access_container_tag) + { + // If the element is already occupied, then we probably don't want to + // overwrite it. + if(c[l] == Graph::null_vertex()) return false; + c[l] = v; + return true; + } + + // Attempt the insertion and return its result. + template <typename Container, typename Label, typename Graph, typename Vertex> + bool put_vertex_label(Container& c, Graph const&, Label const& l, Vertex v, + unique_associative_container_tag) + { return c.insert(std::make_pair(l, v)).second; } + + // Insert the pair and return true. + template <typename Container, typename Label, typename Graph, typename Vertex> + bool put_vertex_label(Container& c, Graph const&, Label const& l, Vertex v, + multiple_associative_container_tag) + { + c.insert(std::make_pair(l, v)); + return true; + } + + // Dispatcher + template <typename Container, typename Label, typename Graph, typename Vertex> + bool put_vertex_label(Container& c, Graph const& g, Label const& l, Vertex v) + { return put_vertex_label(c, g, l, v, container_category(c)); } + //@} + +} // namespace detail + +struct labeled_graph_class_tag { }; + +/** @internal + * This class is responsible for the deduction and declaration of type names + * for the labeled_graph class template. + */ +template <typename Graph, typename Label, typename Selector> +struct labeled_graph_types { + typedef Graph graph_type; + + // Label and maps + typedef Label label_type; + typedef typename graph_detail::choose_map< + Selector, Label, typename graph_traits<Graph>::vertex_descriptor + >::type map_type; +}; + +/** + * The labeled_graph class is a graph adaptor that maintains a mapping between + * vertex labels and vertex descriptors. + * + * @todo This class is somewhat redundant for adjacency_list<*, vecS> if + * the intended label is an unsigned int (and perhpahs some other cases), but + * it does avoid some weird ambiguities (i.e. adding a vertex with a label that + * does not match its target index). + * + * @todo This needs to be reconciled with the named_graph, but since there is + * no documentation or examples, its not going to happen. + */ +template <typename Graph, typename Label, typename Selector = defaultS> +class labeled_graph + : protected labeled_graph_types<Graph, Label, Selector> +{ + typedef labeled_graph_types<Graph, Label, Selector> Base; +public: + typedef labeled_graph_class_tag graph_tag; + + typedef typename Base::graph_type graph_type; + typedef typename graph_traits<graph_type>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<graph_type>::edge_descriptor edge_descriptor; + typedef typename graph_traits<graph_type>::directed_category directed_category; + typedef typename graph_traits<graph_type>::edge_parallel_category edge_parallel_category; + typedef typename graph_traits<graph_type>::traversal_category traversal_category; + + typedef typename graph_traits<graph_type>::out_edge_iterator out_edge_iterator; + typedef typename graph_traits<graph_type>::in_edge_iterator in_edge_iterator; + typedef typename graph_traits<graph_type>::adjacency_iterator adjacency_iterator; + typedef typename graph_traits<graph_type>::degree_size_type degree_size_type; + + typedef typename graph_traits<graph_type>::vertex_iterator vertex_iterator; + typedef typename graph_traits<graph_type>::vertices_size_type vertices_size_type; + typedef typename graph_traits<graph_type>::edge_iterator edge_iterator; + typedef typename graph_traits<graph_type>::edges_size_type edges_size_type; + + typedef typename graph_type::vertex_property_type vertex_property_type; + typedef typename graph_type::edge_property_type edge_property_type; + typedef typename graph_type::graph_property_type graph_property_type; + typedef typename graph_type::vertex_bundled vertex_bundled; + typedef typename graph_type::edge_bundled edge_bundled; + + typedef typename Base::label_type label_type; + typedef typename Base::map_type map_type; + +public: + labeled_graph(graph_property_type const& gp = graph_property_type()) + : _graph(gp), _map() + { } + + labeled_graph(labeled_graph const& x) + : _graph(x._graph), _map(x._map) + { } + + // This constructor can only be used if map_type supports positional + // range insertion (i.e. its a vector). This is the only case where we can + // try to guess the intended labels for graph. + labeled_graph(vertices_size_type n, + graph_property_type const& gp = graph_property_type()) + : _graph(n, gp), _map() + { + std::pair<vertex_iterator, vertex_iterator> rng = vertices(_graph); + _map.insert(_map.end(), rng.first, rng.second); + } + + // Construct a grpah over n vertices, each of which receives a label from + // the range [l, l + n). Note that the graph is not directly constructed + // over the n vertices, but added sequentially. This constructor is + // necessarily slower than the underlying counterpart. + template <typename LabelIter> + labeled_graph(vertices_size_type n, LabelIter l, + graph_property_type const& gp = graph_property_type()) + : _graph(gp) + { while(n-- >= 0) add_vertex(*l++); } + + // Construct the graph over n vertices each of which has a label in the + // range [l, l + n) and a property in the range [p, p + n). + template <typename LabelIter, typename PropIter> + labeled_graph(vertices_size_type n, LabelIter l, PropIter p, + graph_property_type const& gp = graph_property_type()) + { while(n-- >= 0) add_vertex(*l++, *p++); } + + labeled_graph& operator=(labeled_graph const& x) { + _graph = x._graph; + _map = x._map; + return *this; + } + + /** @name Graph Accessors */ + //@{ + graph_type& graph() { return _graph; } + graph_type const& graph() const { return _graph; } + //@} + + /** + * Create a new label for the given vertex, returning false, if the label + * cannot be created. + */ + bool label_vertex(vertex_descriptor v, Label const& l) + { return graph_detail::put_vertex_label(_map, _graph, l, v); } + + /** @name Add Vertex + * Add a vertex to the graph, returning the descriptor. If the vertices + * are uniquely labeled and the label already exists within the graph, + * then no vertex is added, and the returned descriptor refers to the + * existing vertex. A vertex property can be given as a parameter, if + * needed. + */ + //@{ + vertex_descriptor add_vertex(Label const& l) { + return graph_detail::insert_labeled_vertex( + _map, _graph, l, vertex_property_type() + ).first; + } + + vertex_descriptor add_vertex(Label const& l, vertex_property_type const& p) + { return graph_detail::insert_labeled_vertex(_map, _graph, l, p).first; } + //@} + + /** @name Insert Vertex + * Insert a vertex into the graph, returning a pair containing the + * descriptor of a vertex and a boolean value that describes whether or not + * a new vertex was inserted. If vertices are not uniquely labeled, then + * insertion will always succeed. + */ + //@{ + std::pair<vertex_descriptor, bool> insert_vertex(Label const& l) { + return graph_detail::insert_labeled_vertex( + _map, _graph, l, vertex_property_type() + ); + } + + std::pair<vertex_descriptor, bool> + insert_vertex(Label const& l, vertex_property_type const& p) + { return graph_detail::insert_labeled_vertex(_map, _graph, l, p); } + //@} + + /** Remove the vertex with the given label. */ + void remove_vertex(Label const& l) + { return boost::remove_vertex(vertex(l), _graph); } + + /** Return a descriptor for the given label. */ + vertex_descriptor vertex(Label const& l) const + { return graph_detail::find_labeled_vertex(_map, _graph, l); } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + /** @name Bundled Properties */ + //@{ + // Lookup the requested vertex and return the bundle. + vertex_bundled& operator[](Label const& l) + { return _graph[vertex(l)]; } + + vertex_bundled const& operator[](Label const& l) const + { return _graph[vertex(l)]; } + + // Delegate edge lookup to the underlying graph. + edge_bundled& operator[](edge_descriptor e) + { return _graph[e]; } + + edge_bundled const& operator[](edge_descriptor e) const + { return _graph[e]; } + //@} +#endif + + /** Return a null descriptor */ + static vertex_descriptor null_vertex() + { return graph_type::null_vertex(); } + +private: + graph_type _graph; + map_type _map; +}; + +/** + * The partial specialization over graph pointers allows the construction + * of temporary labeled graph objects. In this case, the labels are destructed + * when the wrapper goes out of scope. + */ +template <typename Graph, typename Label, typename Selector> +class labeled_graph<Graph*, Label, Selector> + : protected labeled_graph_types<Graph, Label, Selector> +{ + typedef labeled_graph_types<Graph, Label, Selector> Base; +public: + typedef labeled_graph_class_tag graph_tag; + + typedef typename Base::graph_type graph_type; + typedef typename graph_traits<graph_type>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<graph_type>::edge_descriptor edge_descriptor; + typedef typename graph_traits<graph_type>::directed_category directed_category; + typedef typename graph_traits<graph_type>::edge_parallel_category edge_parallel_category; + typedef typename graph_traits<graph_type>::traversal_category traversal_category; + + typedef typename graph_traits<graph_type>::out_edge_iterator out_edge_iterator; + typedef typename graph_traits<graph_type>::in_edge_iterator in_edge_iterator; + typedef typename graph_traits<graph_type>::adjacency_iterator adjacency_iterator; + typedef typename graph_traits<graph_type>::degree_size_type degree_size_type; + + typedef typename graph_traits<graph_type>::vertex_iterator vertex_iterator; + typedef typename graph_traits<graph_type>::vertices_size_type vertices_size_type; + typedef typename graph_traits<graph_type>::edge_iterator edge_iterator; + typedef typename graph_traits<graph_type>::edges_size_type edges_size_type; + + typedef typename graph_type::vertex_property_type vertex_property_type; + typedef typename graph_type::edge_property_type edge_property_type; + typedef typename graph_type::graph_property_type graph_property_type; + typedef typename graph_type::vertex_bundled vertex_bundled; + typedef typename graph_type::edge_bundled edge_bundled; + + typedef typename Base::label_type label_type; + typedef typename Base::map_type map_type; + + labeled_graph(graph_type* g) + : _graph(g) + { } + + /** @name Graph Access */ + //@{ + graph_type& graph() { return *_graph; } + graph_type const& graph() const { return *_graph; } + //@} + + /** + * Create a new label for the given vertex, returning false, if the label + * cannot be created. + */ + bool label_vertex(vertex_descriptor v, Label const& l) + { return graph_detail::put_vertex_label(_map, *_graph, l, v); } + + /** @name Add Vertex */ + //@{ + vertex_descriptor add_vertex(Label const& l) { + return graph_detail::insert_labeled_vertex( + _map, *_graph, l, vertex_property_type() + ).first; + } + + vertex_descriptor add_vertex(Label const& l, vertex_property_type const& p) + { return graph_detail::insert_labeled_vertex(_map, *_graph, l, p).first; } + + std::pair<vertex_descriptor, bool> insert_vertex(Label const& l) { + return graph_detail::insert_labeled_vertex( + _map, *_graph, l, vertex_property_type() + ); + } + //@} + + /** Try to insert a vertex with the given label. */ + std::pair<vertex_descriptor, bool> + insert_vertex(Label const& l, vertex_property_type const& p) + { return graph_detail::insert_labeled_vertex(_map, *_graph, l, p); } + + /** Remove the vertex with the given label. */ + void remove_vertex(Label const& l) + { return boost::remove_vertex(vertex(l), *_graph); } + + /** Return a descriptor for the given label. */ + vertex_descriptor vertex(Label const& l) const + { return graph_detail::find_labeled_vertex(_map, *_graph, l); } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + /** @name Bundled Properties */ + //@{ + // Lookup the requested vertex and return the bundle. + vertex_bundled& operator[](Label const& l) + { return (*_graph)[vertex(l)]; } + + vertex_bundled const& operator[](Label const& l) const + { return (*_graph)[vertex(l)]; } + + // Delegate edge lookup to the underlying graph. + edge_bundled& operator[](edge_descriptor e) + { return (*_graph)[e]; } + + edge_bundled const& operator[](edge_descriptor e) const + { return (*_graph)[e]; } + //@} +#endif + + static vertex_descriptor null_vertex() + { return graph_type::null_vertex(); } + +private: + graph_type* _graph; + map_type _map; +}; + +#define LABELED_GRAPH_PARAMS typename G, typename L, typename S +#define LABELED_GRAPH labeled_graph<G,L,S> + +/** @name Labeled Graph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline bool label_vertex(typename LABELED_GRAPH::vertex_descriptor v, + typename LABELED_GRAPH::label_type const l, + LABELED_GRAPH& g) +{ return g.label_vertex(v, l); } + +template <LABELED_GRAPH_PARAMS> +inline bool vertex_by_label(typename LABELED_GRAPH::label_type const l, + LABELED_GRAPH& g) +{ return g.vertex(l); } +//@} + +/** @name Graph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline std::pair<typename LABELED_GRAPH::edge_descriptor, bool> +edge(typename LABELED_GRAPH::vertex_descriptor const& u, + typename LABELED_GRAPH::vertex_descriptor const& v, + LABELED_GRAPH const& g) +{ return edge(u, v, g.graph()); } + +// Labeled Extensions +template <LABELED_GRAPH_PARAMS> +inline std::pair<typename LABELED_GRAPH::edge_descriptor, bool> +edge_by_label(typename LABELED_GRAPH::label_type const& u, + typename LABELED_GRAPH::label_type const& v, + LABELED_GRAPH const& g) +{ return edge(g.vertex(u), g.vertex(v), g); } +//@} + +/** @name Incidence Graph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline std::pair< + typename LABELED_GRAPH::out_edge_iterator, + typename LABELED_GRAPH::out_edge_iterator> +out_edges(typename LABELED_GRAPH::vertex_descriptor v, LABELED_GRAPH const& g) +{ return out_edges(v, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::degree_size_type +out_degree(typename LABELED_GRAPH::vertex_descriptor v, LABELED_GRAPH const& g) +{ return out_degree(v, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::vertex_descriptor +source(typename LABELED_GRAPH::edge_descriptor e, LABELED_GRAPH const& g) +{ return source(e, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::vertex_descriptor +target(typename LABELED_GRAPH::edge_descriptor e, LABELED_GRAPH const& g) +{ return target(e, g.graph()); } +//@} + +/** @name Bidirectional Graph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline std::pair< + typename LABELED_GRAPH::in_edge_iterator, + typename LABELED_GRAPH::in_edge_iterator> +in_edges(typename LABELED_GRAPH::vertex_descriptor v, LABELED_GRAPH const& g) +{ return in_edges(v, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::degree_size_type +in_degree(typename LABELED_GRAPH::vertex_descriptor v, LABELED_GRAPH const& g) +{ return in_degree(v, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::degree_size_type +degree(typename LABELED_GRAPH::vertex_descriptor v, LABELED_GRAPH const& g) +{ return degree(v, g.graph()); } +//@} + +/** @name Adjacency Graph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline std::pair< + typename LABELED_GRAPH::adjacency_iterator, + typename LABELED_GRAPH::adjacency_iterator> +adjacenct_vertices(typename LABELED_GRAPH::vertex_descriptor v, LABELED_GRAPH const& g) +{ return adjacent_vertices(v, g.graph()); } +//@} + +/** @name VertexListGraph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline std::pair< + typename LABELED_GRAPH::vertex_iterator, + typename LABELED_GRAPH::vertex_iterator> +vertices(LABELED_GRAPH const& g) +{ return vertices(g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::vertices_size_type +num_vertices(LABELED_GRAPH const& g) +{ return num_vertices(g.graph()); } +//@} + +/** @name EdgeListGraph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline std::pair< + typename LABELED_GRAPH::edge_iterator, + typename LABELED_GRAPH::edge_iterator> +edges(LABELED_GRAPH const& g) +{ return edges(g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::edges_size_type +num_edges(LABELED_GRAPH const& g) +{ return num_edges(g.graph()); } +//@} + +/** @internal @name Property Lookup */ +//@{ +namespace graph_detail { + struct labeled_graph_vertex_property_selector { + template <class LabeledGraph, class Property, class Tag> + struct bind_ { + typedef typename LabeledGraph::graph_type Graph; + typedef property_map<Graph, Tag> PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; + + struct labeled_graph_edge_property_selector { + template <class LabeledGraph, class Property, class Tag> + struct bind_ { + typedef typename LabeledGraph::graph_type Graph; + typedef property_map<Graph, Tag> PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; +} + +template <> +struct vertex_property_selector<labeled_graph_class_tag> { + typedef graph_detail::labeled_graph_vertex_property_selector type; +}; + +template <> +struct edge_property_selector<labeled_graph_class_tag> { + typedef graph_detail::labeled_graph_edge_property_selector type; +}; +//@} + +/** @name Property Graph */ +//@{ +template <LABELED_GRAPH_PARAMS, typename Prop> +inline typename property_map<LABELED_GRAPH, Prop>::type +get(Prop p, LABELED_GRAPH& g) +{ return get(p, g.graph()); } + +template <LABELED_GRAPH_PARAMS, typename Prop> +inline typename property_map<LABELED_GRAPH, Prop>::const_type +get(Prop p, LABELED_GRAPH const& g) +{ return get(p, g.impl()); } + +template <LABELED_GRAPH_PARAMS, typename Prop, typename Key> +inline typename property_traits< + typename property_map<typename LABELED_GRAPH::graph_type, Prop>::const_type +>::value_type +get(Prop p, LABELED_GRAPH const& g, const Key& k) +{ return get(p, g.impl(), k); } + +template <LABELED_GRAPH_PARAMS, typename Prop, typename Key, typename Value> +inline void +put(Prop p, LABELED_GRAPH& g, Key const& k, Value const& v) +{ put(p, g.impl(), k, v); } +//@} + +/** @name Mutable Graph */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline std::pair<typename LABELED_GRAPH::edge_descriptor, bool> +add_edge(typename LABELED_GRAPH::vertex_descriptor const& u, + typename LABELED_GRAPH::vertex_descriptor const& v, + LABELED_GRAPH& g) +{ return add_edge(u, v, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline std::pair<typename LABELED_GRAPH::edge_descriptor, bool> +add_edge(typename LABELED_GRAPH::vertex_descriptor const& u, + typename LABELED_GRAPH::vertex_descriptor const& v, + typename LABELED_GRAPH::edge_property_type const& p, + LABELED_GRAPH& g) +{ return add_edge(u, v, p, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline void +clear_vertex(typename LABELED_GRAPH::vertex_descriptor v, LABELED_GRAPH& g) +{ return clear_vertex(v, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline void +remove_edge(typename LABELED_GRAPH::edge_descriptor e, LABELED_GRAPH& g) +{ return remove_edge(e, g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline void +remove_edge(typename LABELED_GRAPH::vertex_descriptor u, + typename LABELED_GRAPH::vertex_descriptor v, + LABELED_GRAPH& g) +{ return remove_edge(u, v, g.graph()); } + +// Labeled extensions +template <LABELED_GRAPH_PARAMS> +inline std::pair<typename LABELED_GRAPH::edge_descriptor, bool> +add_edge_by_label(typename LABELED_GRAPH::label_type const& u, + typename LABELED_GRAPH::label_type const& v, + LABELED_GRAPH& g) +{ return add_edge(g.vertex(u), g.vertex(v), g); } + +template <LABELED_GRAPH_PARAMS> +inline std::pair<typename LABELED_GRAPH::edge_descriptor, bool> +add_edge_by_label(typename LABELED_GRAPH::label_type const& u, + typename LABELED_GRAPH::label_type const& v, + typename LABELED_GRAPH::edge_property_type const& p, + LABELED_GRAPH& g) +{ return add_edge(g.vertex(u), g.vertex(v), p, g); } + +template <LABELED_GRAPH_PARAMS> +inline void +clear_vertex_by_label(typename LABELED_GRAPH::label_type const& l, LABELED_GRAPH& g) +{ clear_vertex(g.vertex(l), g.graph()); } + +template <LABELED_GRAPH_PARAMS> +inline void +remove_edge_by_label(typename LABELED_GRAPH::label_type const& u, + typename LABELED_GRAPH::label_type const& v, + LABELED_GRAPH& g) +{ remove_edge(g.vertex(u), g.vertex(v), g.graph()); } +//@} + +/** @name Labeled Mutable Graph + * The labeled mutable graph hides the add_ and remove_ vertex functions from + * the mutable graph concept. Note that the remove_vertex is hidden because + * removing the vertex without its key could leave a dangling reference in + * the map. + */ +//@{ +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::vertex_descriptor +add_vertex(typename LABELED_GRAPH::label_type const& l, + LABELED_GRAPH& g) +{ return g.add_vertex(l); } + +// MutableLabeledPropertyGraph::add_vertex(l, vp, g) +template <LABELED_GRAPH_PARAMS> +inline typename LABELED_GRAPH::vertex_descriptor +add_vertex(typename LABELED_GRAPH::label_type const& l, + typename LABELED_GRAPH::vertex_property_type const& p, + LABELED_GRAPH& g) +{ return g.add_vertex(l, p); } + +template <LABELED_GRAPH_PARAMS> +inline void +remove_vertex(typename LABELED_GRAPH::label_type const& l, LABELED_GRAPH& g) +{ g.remove_vertex(l); } +//@} + +#undef LABELED_GRAPH_PARAMS +#undef LABELED_GRAPH + +} // namespace boost + +// Pull the labeled graph traits +#include <boost/graph/detail/labeled_graph_traits.hpp> + +#endif // BOOST_GRAPH_LABELED_GRAPH_HPP diff --git a/Utilities/BGL/boost/graph/leda_graph.hpp b/Utilities/BGL/boost/graph/leda_graph.hpp index 89c98ac26a266eda7e2eb4b849a48922e54ee23b..770874c5d870cab798ff3ef7523b16720517ca31 100644 --- a/Utilities/BGL/boost/graph/leda_graph.hpp +++ b/Utilities/BGL/boost/graph/leda_graph.hpp @@ -1,7 +1,9 @@ //======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. // Copyright 2004 The Trustees of Indiana University. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Douglas Gregor +// Copyright 2007 University of Karlsruhe +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Douglas Gregor, +// Jens Mueller // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,9 +25,6 @@ // treat a LEDA GRAPH object as a boost graph "as is". No // wrapper is needed for the GRAPH object. -// Remember to define LEDA_PREFIX so that LEDA types such as -// leda_edge show up as "leda_edge" and not just "edge". - // Warning: this implementation relies on partial specialization // for the graph_traits class (so it won't compile with Visual C++) @@ -41,95 +40,103 @@ namespace boost { template <class vtype, class etype> struct graph_traits< leda::GRAPH<vtype,etype> > { - typedef leda_node vertex_descriptor; - typedef leda_edge edge_descriptor; + typedef leda::node vertex_descriptor; + typedef leda::edge edge_descriptor; class adjacency_iterator : public iterator_facade<adjacency_iterator, - leda_node, + leda::node, bidirectional_traversal_tag, - leda_node, - const leda_node*> + leda::node, + const leda::node*> { public: - explicit adjacency_iterator(leda_edge edge = 0) : base(edge) {} - + adjacency_iterator(leda::node node = 0, + const leda::GRAPH<vtype, etype>* g = 0) + : base(node), g(g) {} private: - leda_node dereference() const { return leda::target(base); } + leda::node dereference() const { return leda::target(base); } bool equal(const adjacency_iterator& other) const { return base == other.base; } - void increment() { base = Succ_Adj_Edge(base, 0); } - void decrement() { base = Pred_Adj_Edge(base, 0); } + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } - leda_edge base; + leda::edge base; + const leda::GRAPH<vtype, etype>* g; friend class iterator_core_access; }; - + class out_edge_iterator : public iterator_facade<out_edge_iterator, - leda_edge, + leda::edge, bidirectional_traversal_tag, - const leda_edge&, - const leda_edge*> + const leda::edge&, + const leda::edge*> { public: - explicit out_edge_iterator(leda_edge edge = 0) : base(edge) {} + out_edge_iterator(leda::node node = 0, + const leda::GRAPH<vtype, etype>* g = 0) + : base(node), g(g) {} private: - const leda_edge& dereference() const { return base; } + const leda::edge& dereference() const { return base; } bool equal(const out_edge_iterator& other) const { return base == other.base; } - void increment() { base = Succ_Adj_Edge(base, 0); } - void decrement() { base = Pred_Adj_Edge(base, 0); } + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } - leda_edge base; + leda::edge base; + const leda::GRAPH<vtype, etype>* g; friend class iterator_core_access; }; - + class in_edge_iterator : public iterator_facade<in_edge_iterator, - leda_edge, + leda::edge, bidirectional_traversal_tag, - const leda_edge&, - const leda_edge*> + const leda::edge&, + const leda::edge*> { public: - explicit in_edge_iterator(leda_edge edge = 0) : base(edge) {} + in_edge_iterator(leda::node node = 0, + const leda::GRAPH<vtype, etype>* g = 0) + : base(node), g(g) {} private: - const leda_edge& dereference() const { return base; } + const leda::edge& dereference() const { return base; } bool equal(const in_edge_iterator& other) const { return base == other.base; } - void increment() { base = Succ_Adj_Edge(base, 1); } - void decrement() { base = Pred_Adj_Edge(base, 1); } + void increment() { base = g->in_succ(base); } + void decrement() { base = g->in_pred(base); } - leda_edge base; + leda::edge base; + const leda::GRAPH<vtype, etype>* g; friend class iterator_core_access; }; class vertex_iterator : public iterator_facade<vertex_iterator, - leda_node, + leda::node, bidirectional_traversal_tag, - const leda_node&, - const leda_node*> + const leda::node&, + const leda::node*> { public: - vertex_iterator(leda_node node = 0, + vertex_iterator(leda::node node = 0, const leda::GRAPH<vtype, etype>* g = 0) : base(node), g(g) {} private: - const leda_node& dereference() const { return base; } + const leda::node& dereference() const { return base; } bool equal(const vertex_iterator& other) const { return base == other.base; } @@ -137,7 +144,34 @@ namespace boost { void increment() { base = g->succ_node(base); } void decrement() { base = g->pred_node(base); } - leda_node base; + leda::node base; + const leda::GRAPH<vtype, etype>* g; + + friend class iterator_core_access; + }; + + class edge_iterator + : public iterator_facade<edge_iterator, + leda::edge, + bidirectional_traversal_tag, + const leda::edge&, + const leda::edge*> + { + public: + edge_iterator(leda::edge edge = 0, + const leda::GRAPH<vtype, etype>* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->succ_edge(base); } + void decrement() { base = g->pred_edge(base); } + + leda::node base; const leda::GRAPH<vtype, etype>* g; friend class iterator_core_access; @@ -151,14 +185,154 @@ namespace boost { typedef int degree_size_type; }; - template <class vtype, class etype> - struct vertex_property< leda::GRAPH<vtype,etype> > { - typedef vtype type; - }; - template <class vtype, class etype> - struct edge_property< leda::GRAPH<vtype,etype> > { - typedef etype type; + + template<> + struct graph_traits<leda::graph> { + typedef leda::node vertex_descriptor; + typedef leda::edge edge_descriptor; + + class adjacency_iterator + : public iterator_facade<adjacency_iterator, + leda::node, + bidirectional_traversal_tag, + leda::node, + const leda::node*> + { + public: + adjacency_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + leda::node dereference() const { return leda::target(base); } + + bool equal(const adjacency_iterator& other) const + { return base == other.base; } + + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class out_edge_iterator + : public iterator_facade<out_edge_iterator, + leda::edge, + bidirectional_traversal_tag, + const leda::edge&, + const leda::edge*> + { + public: + out_edge_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const out_edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->adj_succ(base); } + void decrement() { base = g->adj_pred(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class in_edge_iterator + : public iterator_facade<in_edge_iterator, + leda::edge, + bidirectional_traversal_tag, + const leda::edge&, + const leda::edge*> + { + public: + in_edge_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const in_edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->in_succ(base); } + void decrement() { base = g->in_pred(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class vertex_iterator + : public iterator_facade<vertex_iterator, + leda::node, + bidirectional_traversal_tag, + const leda::node&, + const leda::node*> + { + public: + vertex_iterator(leda::node node = 0, + const leda::graph* g = 0) + : base(node), g(g) {} + + private: + const leda::node& dereference() const { return base; } + + bool equal(const vertex_iterator& other) const + { return base == other.base; } + + void increment() { base = g->succ_node(base); } + void decrement() { base = g->pred_node(base); } + + leda::node base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + class edge_iterator + : public iterator_facade<edge_iterator, + leda::edge, + bidirectional_traversal_tag, + const leda::edge&, + const leda::edge*> + { + public: + edge_iterator(leda::edge edge = 0, + const leda::graph* g = 0) + : base(edge), g(g) {} + + private: + const leda::edge& dereference() const { return base; } + + bool equal(const edge_iterator& other) const + { return base == other.base; } + + void increment() { base = g->succ_edge(base); } + void decrement() { base = g->pred_edge(base); } + + leda::edge base; + const leda::graph* g; + + friend class iterator_core_access; + }; + + typedef directed_tag directed_category; + typedef allow_parallel_edge_tag edge_parallel_category; // not sure here + typedef leda_graph_traversal_category traversal_category; + typedef int vertices_size_type; + typedef int edges_size_type; + typedef int degree_size_type; }; } // namespace boost @@ -166,6 +340,9 @@ namespace boost { namespace boost { + //=========================================================================== + // functions for GRAPH<vtype,etype> + template <class vtype, class etype> typename graph_traits< leda::GRAPH<vtype,etype> >::vertex_descriptor source(typename graph_traits< leda::GRAPH<vtype,etype> >::edge_descriptor e, @@ -193,7 +370,16 @@ namespace boost { return std::make_pair( Iter(g.first_node(),&g), Iter(0,&g) ); } - // no edges(g) function + template <class vtype, class etype> + inline std::pair< + typename graph_traits< leda::GRAPH<vtype,etype> >::edge_iterator, + typename graph_traits< leda::GRAPH<vtype,etype> >::edge_iterator > + edges(const leda::GRAPH<vtype,etype>& g) + { + typedef typename graph_traits< leda::GRAPH<vtype,etype> >::edge_iterator + Iter; + return std::make_pair( Iter(g.first_edge(),&g), Iter(0,&g) ); + } template <class vtype, class etype> inline std::pair< @@ -205,7 +391,7 @@ namespace boost { { typedef typename graph_traits< leda::GRAPH<vtype,etype> > ::out_edge_iterator Iter; - return std::make_pair( Iter(First_Adj_Edge(u,0)), Iter(0) ); + return std::make_pair( Iter(g.first_adj_edge(u,0),&g), Iter(0,&g) ); } template <class vtype, class etype> @@ -218,7 +404,7 @@ namespace boost { { typedef typename graph_traits< leda::GRAPH<vtype,etype> > ::in_edge_iterator Iter; - return std::make_pair( Iter(First_Adj_Edge(u,1)), Iter(0) ); + return std::make_pair( Iter(g.first_adj_edge(u,1),&g), Iter(0,&g) ); } template <class vtype, class etype> @@ -231,7 +417,7 @@ namespace boost { { typedef typename graph_traits< leda::GRAPH<vtype,etype> > ::adjacency_iterator Iter; - return std::make_pair( Iter(First_Adj_Edge(u,0)), Iter(0) ); + return std::make_pair( Iter(g.first_adj_edge(u,0),&g), Iter(0,&g) ); } template <class vtype, class etype> @@ -252,29 +438,29 @@ namespace boost { typename graph_traits< leda::GRAPH<vtype,etype> >::degree_size_type out_degree( typename graph_traits< leda::GRAPH<vtype,etype> >::vertex_descriptor u, - const leda::GRAPH<vtype,etype>&) + const leda::GRAPH<vtype,etype>& g) { - return outdeg(u); + return g.outdeg(u); } template <class vtype, class etype> typename graph_traits< leda::GRAPH<vtype,etype> >::degree_size_type in_degree( typename graph_traits< leda::GRAPH<vtype,etype> >::vertex_descriptor u, - const leda::GRAPH<vtype,etype>&) + const leda::GRAPH<vtype,etype>& g) { - return indeg(u); + return g.indeg(u); } template <class vtype, class etype> typename graph_traits< leda::GRAPH<vtype,etype> >::degree_size_type degree( typename graph_traits< leda::GRAPH<vtype,etype> >::vertex_descriptor u, - const leda::GRAPH<vtype,etype>&) + const leda::GRAPH<vtype,etype>& g) { - return outdeg(u) + indeg(u); + return g.outdeg(u) + g.indeg(u); } - + template <class vtype, class etype> typename graph_traits< leda::GRAPH<vtype,etype> >::vertex_descriptor add_vertex(leda::GRAPH<vtype,etype>& g) @@ -289,14 +475,18 @@ namespace boost { return g.new_node(vp); } - // Hmm, LEDA doesn't have the equivalent of clear_vertex() -JGS - // need to write an implementation template <class vtype, class etype> void clear_vertex( typename graph_traits< leda::GRAPH<vtype,etype> >::vertex_descriptor u, leda::GRAPH<vtype,etype>& g) { - g.del_node(u); + typename graph_traits< leda::GRAPH<vtype,etype> >::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end)=out_edges(u,g); ei!=ei_end; ei++) + remove_edge(*ei); + + typename graph_traits< leda::GRAPH<vtype,etype> >::in_edge_iterator iei, iei_end; + for (tie(iei, iei_end)=in_edges(u,g); iei!=iei_end; iei++) + remove_edge(*iei); } template <class vtype, class etype> @@ -356,8 +546,174 @@ namespace boost { } //=========================================================================== - // property maps - + // functions for graph (non-templated version) + + graph_traits<leda::graph>::vertex_descriptor + source(graph_traits<leda::graph>::edge_descriptor e, + const leda::graph& g) + { + return source(e); + } + + graph_traits<leda::graph>::vertex_descriptor + target(graph_traits<leda::graph>::edge_descriptor e, + const leda::graph& g) + { + return target(e); + } + + inline std::pair< + graph_traits<leda::graph>::vertex_iterator, + graph_traits<leda::graph>::vertex_iterator > + vertices(const leda::graph& g) + { + typedef graph_traits<leda::graph>::vertex_iterator + Iter; + return std::make_pair( Iter(g.first_node(),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits<leda::graph>::edge_iterator, + graph_traits<leda::graph>::edge_iterator > + edges(const leda::graph& g) + { + typedef graph_traits<leda::graph>::edge_iterator + Iter; + return std::make_pair( Iter(g.first_edge(),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits<leda::graph>::out_edge_iterator, + graph_traits<leda::graph>::out_edge_iterator > + out_edges( + graph_traits<leda::graph>::vertex_descriptor u, const leda::graph& g) + { + typedef graph_traits<leda::graph>::out_edge_iterator Iter; + return std::make_pair( Iter(g.first_adj_edge(u),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits<leda::graph>::in_edge_iterator, + graph_traits<leda::graph>::in_edge_iterator > + in_edges( + graph_traits<leda::graph>::vertex_descriptor u, + const leda::graph& g) + { + typedef graph_traits<leda::graph> + ::in_edge_iterator Iter; + return std::make_pair( Iter(g.first_in_edge(u),&g), Iter(0,&g) ); + } + + inline std::pair< + graph_traits<leda::graph>::adjacency_iterator, + graph_traits<leda::graph>::adjacency_iterator > + adjacent_vertices( + graph_traits<leda::graph>::vertex_descriptor u, + const leda::graph& g) + { + typedef graph_traits<leda::graph> + ::adjacency_iterator Iter; + return std::make_pair( Iter(g.first_adj_edge(u),&g), Iter(0,&g) ); + } + + graph_traits<leda::graph>::vertices_size_type + num_vertices(const leda::graph& g) + { + return g.number_of_nodes(); + } + + graph_traits<leda::graph>::edges_size_type + num_edges(const leda::graph& g) + { + return g.number_of_edges(); + } + + graph_traits<leda::graph>::degree_size_type + out_degree( + graph_traits<leda::graph>::vertex_descriptor u, + const leda::graph& g) + { + return g.outdeg(u); + } + + graph_traits<leda::graph>::degree_size_type + in_degree( + graph_traits<leda::graph>::vertex_descriptor u, + const leda::graph& g) + { + return g.indeg(u); + } + + graph_traits<leda::graph>::degree_size_type + degree( + graph_traits<leda::graph>::vertex_descriptor u, + const leda::graph& g) + { + return g.outdeg(u) + g.indeg(u); + } + + graph_traits<leda::graph>::vertex_descriptor + add_vertex(leda::graph& g) + { + return g.new_node(); + } + + void + remove_edge( + graph_traits<leda::graph>::vertex_descriptor u, + graph_traits<leda::graph>::vertex_descriptor v, + leda::graph& g) + { + graph_traits<leda::graph>::out_edge_iterator + i,iend; + for (boost::tie(i,iend) = out_edges(u,g); i != iend; ++i) + if (target(*i,g) == v) + g.del_edge(*i); + } + + void + remove_edge( + graph_traits<leda::graph>::edge_descriptor e, + leda::graph& g) + { + g.del_edge(e); + } + + void clear_vertex( + graph_traits<leda::graph>::vertex_descriptor u, + leda::graph& g) + { + graph_traits<leda::graph>::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end)=out_edges(u,g); ei!=ei_end; ei++) + remove_edge(*ei, g); + + graph_traits<leda::graph>::in_edge_iterator iei, iei_end; + for (tie(iei, iei_end)=in_edges(u,g); iei!=iei_end; iei++) + remove_edge(*iei, g); + } + + void remove_vertex( + graph_traits<leda::graph>::vertex_descriptor u, + leda::graph& g) + { + g.del_node(u); + } + + std::pair< + graph_traits<leda::graph>::edge_descriptor, + bool> + add_edge( + graph_traits<leda::graph>::vertex_descriptor u, + graph_traits<leda::graph>::vertex_descriptor v, + leda::graph& g) + { + return std::make_pair(g.new_edge(u, v), true); + } + + + //=========================================================================== + // property maps for GRAPH<vtype,etype> + class leda_graph_id_map : public put_get_helper<int, leda_graph_id_map> { @@ -365,7 +721,7 @@ namespace boost { typedef readable_property_map_tag category; typedef int value_type; typedef int reference; - typedef leda_node key_type; + typedef leda::node key_type; leda_graph_id_map() { } template <class T> long operator[](T x) const { return x->id(); } @@ -476,42 +832,42 @@ namespace boost { public: typedef E value_type; typedef ERef reference; - typedef leda_node key_type; + typedef leda::node key_type; typedef lvalue_property_map_tag category; leda_node_property_map(NodeMapPtr a) : m_array(a) { } - ERef operator[](leda_node n) const { return (*m_array)[n]; } + ERef operator[](leda::node n) const { return (*m_array)[n]; } protected: NodeMapPtr m_array; }; template <class E> - leda_node_property_map<E, const E&, const leda_node_array<E>*> - make_leda_node_property_map(const leda_node_array<E>& a) + leda_node_property_map<E, const E&, const leda::node_array<E>*> + make_leda_node_property_map(const leda::node_array<E>& a) { - typedef leda_node_property_map<E, const E&, const leda_node_array<E>*> + typedef leda_node_property_map<E, const E&, const leda::node_array<E>*> pmap_type; return pmap_type(&a); } template <class E> - leda_node_property_map<E, E&, leda_node_array<E>*> - make_leda_node_property_map(leda_node_array<E>& a) + leda_node_property_map<E, E&, leda::node_array<E>*> + make_leda_node_property_map(leda::node_array<E>& a) { - typedef leda_node_property_map<E, E&, leda_node_array<E>*> pmap_type; + typedef leda_node_property_map<E, E&, leda::node_array<E>*> pmap_type; return pmap_type(&a); } template <class E> - leda_node_property_map<E, const E&, const leda_node_map<E>*> - make_leda_node_property_map(const leda_node_map<E>& a) + leda_node_property_map<E, const E&, const leda::node_map<E>*> + make_leda_node_property_map(const leda::node_map<E>& a) { - typedef leda_node_property_map<E,const E&,const leda_node_map<E>*> + typedef leda_node_property_map<E,const E&,const leda::node_map<E>*> pmap_type; return pmap_type(&a); } template <class E> - leda_node_property_map<E, E&, leda_node_map<E>*> - make_leda_node_property_map(leda_node_map<E>& a) + leda_node_property_map<E, E&, leda::node_map<E>*> + make_leda_node_property_map(leda::node_map<E>& a) { - typedef leda_node_property_map<E, E&, leda_node_map<E>*> pmap_type; + typedef leda_node_property_map<E, E&, leda::node_map<E>*> pmap_type; return pmap_type(&a); } @@ -528,11 +884,11 @@ namespace boost { inline typename boost::property_traits< typename boost::property_map<leda::GRAPH<vtype, etype>,PropertyTag>::const_type - >::value_type +::value_type get(PropertyTag p, const leda::GRAPH<vtype, etype>& g, const Key& key) { return get(get(p, g), key); } - + template <class vtype, class etype, class PropertyTag, class Key,class Value> inline void put(PropertyTag p, leda::GRAPH<vtype, etype>& g, @@ -543,7 +899,54 @@ namespace boost { put(pmap, key, value); } -} // namespace boost + // property map interface to the LEDA edge_array class + + template <class E, class ERef, class EdgeMapPtr> + class leda_edge_property_map + : public put_get_helper<ERef, leda_edge_property_map<E, ERef, EdgeMapPtr> > + { + public: + typedef E value_type; + typedef ERef reference; + typedef leda::edge key_type; + typedef lvalue_property_map_tag category; + leda_edge_property_map(EdgeMapPtr a) : m_array(a) { } + ERef operator[](leda::edge n) const { return (*m_array)[n]; } + protected: + EdgeMapPtr m_array; + }; + template <class E> + leda_edge_property_map<E, const E&, const leda::edge_array<E>*> + make_leda_node_property_map(const leda::node_array<E>& a) + { + typedef leda_edge_property_map<E, const E&, const leda::node_array<E>*> + pmap_type; + return pmap_type(&a); + } + template <class E> + leda_edge_property_map<E, E&, leda::edge_array<E>*> + make_leda_edge_property_map(leda::edge_array<E>& a) + { + typedef leda_edge_property_map<E, E&, leda::edge_array<E>*> pmap_type; + return pmap_type(&a); + } + + template <class E> + leda_edge_property_map<E, const E&, const leda::edge_map<E>*> + make_leda_edge_property_map(const leda::edge_map<E>& a) + { + typedef leda_edge_property_map<E,const E&,const leda::edge_map<E>*> + pmap_type; + return pmap_type(&a); + } + template <class E> + leda_edge_property_map<E, E&, leda::edge_map<E>*> + make_leda_edge_property_map(leda::edge_map<E>& a) + { + typedef leda_edge_property_map<E, E&, leda::edge_map<E>*> pmap_type; + return pmap_type(&a); + } +} // namespace boost #endif // BOOST_GRAPH_LEDA_HPP diff --git a/Utilities/BGL/boost/graph/lookup_edge.hpp b/Utilities/BGL/boost/graph/lookup_edge.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f8ea89e22ae48592f7f5c5b42ebfa01ff40d71aa --- /dev/null +++ b/Utilities/BGL/boost/graph/lookup_edge.hpp @@ -0,0 +1,50 @@ +//======================================================================= +// Copyright 2009 Trustees of Indiana University +// Author: Jeremiah Willcock +// +// 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_LOOKUP_EDGE_HPP +#define BOOST_GRAPH_LOOKUP_EDGE_HPP + +#include <utility> +#include <boost/config.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/graph/graph_traits.hpp> + +// lookup_edge: a function that acts like edge() but falls back to out_edges() +// and a search when edge() is not provided. + +namespace boost { + + template <typename Graph> + std::pair<typename boost::graph_traits<Graph>::edge_descriptor, bool> + lookup_edge(typename boost::graph_traits<Graph>::vertex_descriptor src, + typename boost::graph_traits<Graph>::vertex_descriptor tgt, + const Graph& g, + typename boost::enable_if<is_adjacency_matrix<Graph>, int>::type = 0) { + return edge(src, tgt, g); + } + + template <typename Graph> + std::pair<typename boost::graph_traits<Graph>::edge_descriptor, bool> + lookup_edge(typename boost::graph_traits<Graph>::vertex_descriptor src, + typename boost::graph_traits<Graph>::vertex_descriptor tgt, + const Graph& g, + typename boost::disable_if<is_adjacency_matrix<Graph>, int>::type = 0) { + typedef typename boost::graph_traits<Graph>::out_edge_iterator it; + typedef typename boost::graph_traits<Graph>::edge_descriptor edesc; + std::pair<it, it> oe = out_edges(src, g); + for (; oe.first != oe.second; ++oe.first) { + edesc e = *oe.first; + if (target(e, g) == tgt) return std::make_pair(e, true); + } + return std::make_pair(edesc(), false); + } + +} + +#endif // BOOST_GRAPH_LOOKUP_EDGE_HPP diff --git a/Utilities/BGL/boost/graph/make_biconnected_planar.hpp b/Utilities/BGL/boost/graph/make_biconnected_planar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..86a955a6e65a9ecb009722f0daed9d1162142938 --- /dev/null +++ b/Utilities/BGL/boost/graph/make_biconnected_planar.hpp @@ -0,0 +1,121 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __MAKE_BICONNECTED_PLANAR_HPP__ +#define __MAKE_BICONNECTED_PLANAR_HPP__ + +#include <boost/config.hpp> +#include <boost/tuple/tuple.hpp> //for tie +#include <boost/graph/biconnected_components.hpp> +#include <boost/property_map/property_map.hpp> +#include <vector> +#include <iterator> +#include <algorithm> + +#include <boost/graph/planar_detail/add_edge_visitors.hpp> + + +namespace boost +{ + + + + template <typename Graph, + typename PlanarEmbedding, + typename EdgeIndexMap, + typename AddEdgeVisitor + > + void make_biconnected_planar(Graph& g, + PlanarEmbedding embedding, + EdgeIndexMap em, + AddEdgeVisitor& vis + ) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::edges_size_type edge_size_t; + typedef typename + property_traits<PlanarEmbedding>::value_type embedding_value_t; + typedef typename embedding_value_t::const_iterator embedding_iterator_t; + typedef iterator_property_map + <std::vector<std::size_t>::iterator, EdgeIndexMap> component_map_t; + + edge_size_t n_edges(num_edges(g)); + std::vector<vertex_t> articulation_points; + std::vector<edge_size_t> component_vector(n_edges); + component_map_t component_map(component_vector.begin(), em); + + biconnected_components(g, component_map, + std::back_inserter(articulation_points)); + + typename std::vector<vertex_t>::iterator ap, ap_end; + ap_end = articulation_points.end(); + for(ap = articulation_points.begin(); ap != ap_end; ++ap) + { + vertex_t v(*ap); + embedding_iterator_t pi = embedding[v].begin(); + embedding_iterator_t pi_end = embedding[v].end(); + edge_size_t previous_component(n_edges + 1); + vertex_t previous_vertex = graph_traits<Graph>::null_vertex(); + + for(; pi != pi_end; ++pi) + { + edge_t e(*pi); + vertex_t e_source(source(e,g)); + vertex_t e_target(target(e,g)); + + //Skip self-loops and parallel edges + if (e_source == e_target || previous_vertex == e_target) + continue; + + vertex_t current_vertex = e_source == v ? e_target : e_source; + edge_size_t current_component = component_map[e]; + if (previous_vertex != graph_traits<Graph>::null_vertex() && + current_component != previous_component) + { + vis.visit_vertex_pair(current_vertex, previous_vertex, g); + } + previous_vertex = current_vertex; + previous_component = current_component; + } + } + + } + + + + + template <typename Graph, + typename PlanarEmbedding, + typename EdgeIndexMap + > + inline void make_biconnected_planar(Graph& g, + PlanarEmbedding embedding, + EdgeIndexMap em + ) + { + default_add_edge_visitor vis; + make_biconnected_planar(g, embedding, em, vis); + } + + + + + template <typename Graph, + typename PlanarEmbedding + > + inline void make_biconnected_planar(Graph& g, PlanarEmbedding embedding) + { + make_biconnected_planar(g, embedding, get(edge_index,g)); + } + + +} // namespace boost + + + +#endif //__MAKE_BICONNECTED_PLANAR_HPP__ diff --git a/Utilities/BGL/boost/graph/make_connected.hpp b/Utilities/BGL/boost/graph/make_connected.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e5e2f52c1c5763a6ddd9d87d79f314ac489c8177 --- /dev/null +++ b/Utilities/BGL/boost/graph/make_connected.hpp @@ -0,0 +1,99 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __MAKE_CONNECTED_HPP__ +#define __MAKE_CONNECTED_HPP__ + +#include <boost/config.hpp> +#include <boost/utility.hpp> //for next +#include <boost/tuple/tuple.hpp> //for tie +#include <boost/graph/connected_components.hpp> +#include <boost/property_map/property_map.hpp> +#include <vector> + +#include <boost/graph/planar_detail/add_edge_visitors.hpp> +#include <boost/graph/planar_detail/bucket_sort.hpp> + + +namespace boost +{ + + + template <typename Graph, + typename VertexIndexMap, + typename AddEdgeVisitor + > + void make_connected(Graph& g, VertexIndexMap vm, AddEdgeVisitor& vis) + { + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + typedef iterator_property_map< typename std::vector<v_size_t>::iterator, + VertexIndexMap + > vertex_to_v_size_map_t; + + std::vector<v_size_t> component_vector(num_vertices(g)); + vertex_to_v_size_map_t component(component_vector.begin(), vm); + std::vector<vertex_t> vertices_by_component(num_vertices(g)); + + v_size_t num_components = connected_components(g, component); + + if (num_components < 2) + return; + + vertex_iterator_t vi, vi_end; + tie(vi,vi_end) = vertices(g); + std::copy(vi, vi_end, vertices_by_component.begin()); + + bucket_sort(vertices_by_component.begin(), + vertices_by_component.end(), + component, + num_components + ); + + typedef typename std::vector<vertex_t>::iterator vec_of_vertices_itr_t; + + vec_of_vertices_itr_t ci_end = vertices_by_component.end(); + vec_of_vertices_itr_t ci_prev = vertices_by_component.begin(); + if (ci_prev == ci_end) + return; + + for(vec_of_vertices_itr_t ci = boost::next(ci_prev); + ci != ci_end; ci_prev = ci, ++ci + ) + { + if (component[*ci_prev] != component[*ci]) + vis.visit_vertex_pair(*ci_prev, *ci, g); + } + + } + + + + + template <typename Graph, typename VertexIndexMap> + inline void make_connected(Graph& g, VertexIndexMap vm) + { + default_add_edge_visitor vis; + make_connected(g, vm, vis); + } + + + + + template <typename Graph> + inline void make_connected(Graph& g) + { + make_connected(g, get(vertex_index,g)); + } + + + + +} // namespace boost + +#endif //__MAKE_CONNECTED_HPP__ diff --git a/Utilities/BGL/boost/graph/make_maximal_planar.hpp b/Utilities/BGL/boost/graph/make_maximal_planar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..70a1e08abae78544f1974e003e9808bcc6b94449 --- /dev/null +++ b/Utilities/BGL/boost/graph/make_maximal_planar.hpp @@ -0,0 +1,275 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __MAKE_MAXIMAL_PLANAR_HPP__ +#define __MAKE_MAXIMAL_PLANAR_HPP__ + +#include <boost/config.hpp> +#include <boost/tuple/tuple.hpp> //for tie +#include <boost/graph/biconnected_components.hpp> +#include <boost/property_map/property_map.hpp> +#include <vector> +#include <iterator> +#include <algorithm> + +#include <boost/graph/planar_face_traversal.hpp> +#include <boost/graph/planar_detail/add_edge_visitors.hpp> + + +namespace boost +{ + + + template <typename Graph, typename VertexIndexMap, typename AddEdgeVisitor> + struct triangulation_visitor : public planar_face_traversal_visitor + { + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + typedef typename graph_traits<Graph>::degree_size_type degree_size_t; + typedef typename graph_traits<Graph>::edge_iterator edge_iterator_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::adjacency_iterator + adjacency_iterator_t; + typedef typename std::vector<vertex_t> vertex_vector_t; + typedef typename std::vector<v_size_t> v_size_vector_t; + typedef typename std::vector<degree_size_t> degree_size_vector_t; + typedef iterator_property_map + < typename v_size_vector_t::iterator, VertexIndexMap > + vertex_to_v_size_map_t; + typedef iterator_property_map + < typename degree_size_vector_t::iterator, VertexIndexMap > + vertex_to_degree_size_map_t; + typedef typename vertex_vector_t::iterator face_iterator; + + + triangulation_visitor(Graph& arg_g, + VertexIndexMap arg_vm, + AddEdgeVisitor arg_add_edge_visitor + ) : + g(arg_g), + vm(arg_vm), + add_edge_visitor(arg_add_edge_visitor), + timestamp(0), + marked_vector(num_vertices(g), timestamp), + degree_vector(num_vertices(g), 0), + marked(marked_vector.begin(), vm), + degree(degree_vector.begin(), vm) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(degree, *vi, out_degree(*vi, g)); + } + + template <typename Vertex> + void next_vertex(Vertex v) + { + // Self-loops will appear as consecutive vertices in the list of + // vertices on a face. We want to skip these. + if (!vertices_on_face.empty() && + (vertices_on_face.back() == v || vertices_on_face.front() == v) + ) + return; + + vertices_on_face.push_back(v); + } + + void end_face() + { + ++timestamp; + + if (vertices_on_face.size() <= 3) + { + // At most three vertices on this face - don't need to triangulate + vertices_on_face.clear(); + return; + } + + // Find vertex on face of minimum degree + degree_size_t min_degree = num_vertices(g); + typename vertex_vector_t::iterator min_degree_vertex_itr; + face_iterator fi_end = vertices_on_face.end(); + for(face_iterator fi = vertices_on_face.begin(); fi != fi_end; ++fi) + { + degree_size_t deg = get(degree,*fi); + if (deg < min_degree) + { + min_degree_vertex_itr = fi; + min_degree = deg; + } + } + + // To simplify some of the manipulations, we'll re-arrange + // vertices_on_face so that it still contains the same + // (counter-clockwise) order of the vertices on this face, but now the + // min_degree_vertex is the first element in vertices_on_face. + vertex_vector_t temp_vector; + std::copy(min_degree_vertex_itr, vertices_on_face.end(), + std::back_inserter(temp_vector)); + std::copy(vertices_on_face.begin(), min_degree_vertex_itr, + std::back_inserter(temp_vector)); + vertices_on_face.swap(temp_vector); + + // Mark all of the min degree vertex's neighbors + adjacency_iterator_t ai, ai_end; + for(tie(ai,ai_end) = adjacent_vertices(vertices_on_face.front(),g); + ai != ai_end; ++ai + ) + { + put(marked, *ai, timestamp); + } + + typename vertex_vector_t::iterator marked_neighbor + = vertices_on_face.end(); + + // The iterator manipulations on the next two lines are safe because + // vertices_on_face.size() > 3 (from the first test in this function) + fi_end = prior(vertices_on_face.end()); + for(face_iterator fi = boost::next(boost::next(vertices_on_face.begin())); + fi != fi_end; ++fi + ) + { + if (get(marked, *fi) == timestamp) + { + marked_neighbor = fi; + break; + } + } + + if (marked_neighbor == vertices_on_face.end()) + { + add_edge_range( + vertices_on_face[0], + boost::next(boost::next(vertices_on_face.begin())), + prior(vertices_on_face.end()) + ); + } + else + { + add_edge_range( + vertices_on_face[1], + boost::next(marked_neighbor), + vertices_on_face.end() + ); + + add_edge_range( + *boost::next(marked_neighbor), + boost::next(boost::next(vertices_on_face.begin())), + marked_neighbor + ); + } + + //reset for the next face + vertices_on_face.clear(); + + } + + private: + + + void add_edge_range(vertex_t anchor, + face_iterator fi, + face_iterator fi_end + ) + { + for (; fi != fi_end; ++fi) + { + vertex_t v(*fi); + add_edge_visitor.visit_vertex_pair(anchor, v, g); + put(degree, anchor, get(degree, anchor) + 1); + put(degree, v, get(degree, v) + 1); + } + } + + + Graph& g; + VertexIndexMap vm; + AddEdgeVisitor add_edge_visitor; + v_size_t timestamp; + vertex_vector_t vertices_on_face; + v_size_vector_t marked_vector; + degree_size_vector_t degree_vector; + vertex_to_v_size_map_t marked; + vertex_to_degree_size_map_t degree; + + }; + + + + + template <typename Graph, + typename PlanarEmbedding, + typename VertexIndexMap, + typename EdgeIndexMap, + typename AddEdgeVisitor + > + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding, + VertexIndexMap vm, + EdgeIndexMap em, + AddEdgeVisitor& vis) + { + triangulation_visitor<Graph,VertexIndexMap,AddEdgeVisitor> + visitor(g, vm, vis); + planar_face_traversal(g, embedding, visitor, em); + } + + + + + template <typename Graph, + typename PlanarEmbedding, + typename VertexIndexMap, + typename EdgeIndexMap + > + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding, + VertexIndexMap vm, + EdgeIndexMap em + ) + { + default_add_edge_visitor vis; + make_maximal_planar(g, embedding, vm, em, vis); + } + + + + + template <typename Graph, + typename PlanarEmbedding, + typename VertexIndexMap + > + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding, + VertexIndexMap vm + ) + { + make_maximal_planar(g, embedding, vm, get(edge_index,g)); + } + + + + + template <typename Graph, + typename PlanarEmbedding + > + void make_maximal_planar(Graph& g, + PlanarEmbedding embedding + ) + { + make_maximal_planar(g, embedding, get(vertex_index,g)); + } + + + + +} // namespace boost + + + +#endif //__MAKE_MAXIMAL_PLANAR_HPP__ diff --git a/Utilities/BGL/boost/graph/max_cardinality_matching.hpp b/Utilities/BGL/boost/graph/max_cardinality_matching.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f0f6de20770e024a735b9624ebe8e1d3b128533 --- /dev/null +++ b/Utilities/BGL/boost/graph/max_cardinality_matching.hpp @@ -0,0 +1,883 @@ +//======================================================================= +// Copyright (c) 2005 Aaron Windsor +// +// 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_MAXIMUM_CARDINALITY_MATCHING_HPP +#define BOOST_GRAPH_MAXIMUM_CARDINALITY_MATCHING_HPP + +#include <vector> +#include <list> +#include <deque> +#include <algorithm> // for std::sort and std::stable_sort +#include <utility> // for std::pair +#include <boost/property_map/property_map.hpp> +#include <boost/utility.hpp> // for boost::tie +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/visitors.hpp> +#include <boost/graph/depth_first_search.hpp> +#include <boost/graph/filtered_graph.hpp> +#include <boost/pending/disjoint_sets.hpp> +#include <boost/assert.hpp> + + +namespace boost +{ + namespace graph { namespace detail { + enum { V_EVEN, V_ODD, V_UNREACHED }; + } } // end namespace graph::detail + + template <typename Graph, typename MateMap, typename VertexIndexMap> + typename graph_traits<Graph>::vertices_size_type + matching_size(const Graph& g, MateMap mate, VertexIndexMap vm) + { + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + + v_size_t size_of_matching = 0; + vertex_iterator_t vi, vi_end; + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_descriptor_t v = *vi; + if (get(mate,v) != graph_traits<Graph>::null_vertex() + && get(vm,v) < get(vm,get(mate,v))) + ++size_of_matching; + } + return size_of_matching; + } + + + + + template <typename Graph, typename MateMap> + inline typename graph_traits<Graph>::vertices_size_type + matching_size(const Graph& g, MateMap mate) + { + return matching_size(g, mate, get(vertex_index,g)); + } + + + + + template <typename Graph, typename MateMap, typename VertexIndexMap> + bool is_a_matching(const Graph& g, MateMap mate, VertexIndexMap) + { + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + + vertex_iterator_t vi, vi_end; + for( tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_descriptor_t v = *vi; + if (get(mate,v) != graph_traits<Graph>::null_vertex() + && v != get(mate,get(mate,v))) + return false; + } + return true; + } + + + + + template <typename Graph, typename MateMap> + inline bool is_a_matching(const Graph& g, MateMap mate) + { + return is_a_matching(g, mate, get(vertex_index,g)); + } + + + + + //*************************************************************************** + //*************************************************************************** + // Maximum Cardinality Matching Functors + //*************************************************************************** + //*************************************************************************** + + template <typename Graph, typename MateMap, + typename VertexIndexMap = dummy_property_map> + struct no_augmenting_path_finder + { + no_augmenting_path_finder(const Graph&, MateMap, VertexIndexMap) + { } + + inline bool augment_matching() { return false; } + + template <typename PropertyMap> + void get_current_matching(PropertyMap) {} + }; + + + + + template <typename Graph, typename MateMap, typename VertexIndexMap> + class edmonds_augmenting_path_finder + { + // This implementation of Edmonds' matching algorithm closely + // follows Tarjan's description of the algorithm in "Data + // Structures and Network Algorithms." + + public: + + //generates the type of an iterator property map from vertices to type X + template <typename X> + struct map_vertex_to_ + { + typedef boost::iterator_property_map<typename std::vector<X>::iterator, + VertexIndexMap> type; + }; + + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor_t; + typedef typename std::pair< vertex_descriptor_t, vertex_descriptor_t > + vertex_pair_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + typedef typename graph_traits<Graph>::edges_size_type e_size_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::out_edge_iterator + out_edge_iterator_t; + typedef typename std::deque<vertex_descriptor_t> vertex_list_t; + typedef typename std::vector<edge_descriptor_t> edge_list_t; + typedef typename map_vertex_to_<vertex_descriptor_t>::type + vertex_to_vertex_map_t; + typedef typename map_vertex_to_<int>::type vertex_to_int_map_t; + typedef typename map_vertex_to_<vertex_pair_t>::type + vertex_to_vertex_pair_map_t; + typedef typename map_vertex_to_<v_size_t>::type vertex_to_vsize_map_t; + typedef typename map_vertex_to_<e_size_t>::type vertex_to_esize_map_t; + + + + + edmonds_augmenting_path_finder(const Graph& arg_g, MateMap arg_mate, + VertexIndexMap arg_vm) : + g(arg_g), + vm(arg_vm), + n_vertices(num_vertices(arg_g)), + + mate_vector(n_vertices), + ancestor_of_v_vector(n_vertices), + ancestor_of_w_vector(n_vertices), + vertex_state_vector(n_vertices), + origin_vector(n_vertices), + pred_vector(n_vertices), + bridge_vector(n_vertices), + ds_parent_vector(n_vertices), + ds_rank_vector(n_vertices), + + mate(mate_vector.begin(), vm), + ancestor_of_v(ancestor_of_v_vector.begin(), vm), + ancestor_of_w(ancestor_of_w_vector.begin(), vm), + vertex_state(vertex_state_vector.begin(), vm), + origin(origin_vector.begin(), vm), + pred(pred_vector.begin(), vm), + bridge(bridge_vector.begin(), vm), + ds_parent_map(ds_parent_vector.begin(), vm), + ds_rank_map(ds_rank_vector.begin(), vm), + + ds(ds_rank_map, ds_parent_map) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + mate[*vi] = get(arg_mate, *vi); + } + + + + + bool augment_matching() + { + //As an optimization, some of these values can be saved from one + //iteration to the next instead of being re-initialized each + //iteration, allowing for "lazy blossom expansion." This is not + //currently implemented. + + e_size_t timestamp = 0; + even_edges.clear(); + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_descriptor_t u = *vi; + + origin[u] = u; + pred[u] = u; + ancestor_of_v[u] = 0; + ancestor_of_w[u] = 0; + ds.make_set(u); + + if (mate[u] == graph_traits<Graph>::null_vertex()) + { + vertex_state[u] = graph::detail::V_EVEN; + out_edge_iterator_t ei, ei_end; + for(tie(ei,ei_end) = out_edges(u,g); ei != ei_end; ++ei) + even_edges.push_back( *ei ); + } + else + vertex_state[u] = graph::detail::V_UNREACHED; + } + + //end initializations + + vertex_descriptor_t v,w,w_free_ancestor,v_free_ancestor; + w_free_ancestor = graph_traits<Graph>::null_vertex(); + v_free_ancestor = graph_traits<Graph>::null_vertex(); + bool found_alternating_path = false; + + while(!even_edges.empty() && !found_alternating_path) + { + // since we push even edges onto the back of the list as + // they're discovered, taking them off the back will search + // for augmenting paths depth-first. + edge_descriptor_t current_edge = even_edges.back(); + even_edges.pop_back(); + + v = source(current_edge,g); + w = target(current_edge,g); + + vertex_descriptor_t v_prime = origin[ds.find_set(v)]; + vertex_descriptor_t w_prime = origin[ds.find_set(w)]; + + // because of the way we put all of the edges on the queue, + // v_prime should be labeled V_EVEN; the following is a + // little paranoid but it could happen... + if (vertex_state[v_prime] != graph::detail::V_EVEN) + { + std::swap(v_prime,w_prime); + std::swap(v,w); + } + + if (vertex_state[w_prime] == graph::detail::V_UNREACHED) + { + vertex_state[w_prime] = graph::detail::V_ODD; + vertex_state[mate[w_prime]] = graph::detail::V_EVEN; + out_edge_iterator_t ei, ei_end; + for( tie(ei,ei_end) = out_edges(mate[w_prime], g); ei != ei_end; ++ei) + even_edges.push_back(*ei); + pred[w_prime] = v; + } + + //w_prime == v_prime can happen below if we get an edge that has been + //shrunk into a blossom + else if (vertex_state[w_prime] == graph::detail::V_EVEN && w_prime != v_prime) + { + vertex_descriptor_t w_up = w_prime; + vertex_descriptor_t v_up = v_prime; + vertex_descriptor_t nearest_common_ancestor + = graph_traits<Graph>::null_vertex(); + w_free_ancestor = graph_traits<Graph>::null_vertex(); + v_free_ancestor = graph_traits<Graph>::null_vertex(); + + // We now need to distinguish between the case that + // w_prime and v_prime share an ancestor under the + // "parent" relation, in which case we've found a + // blossom and should shrink it, or the case that + // w_prime and v_prime both have distinct ancestors that + // are free, in which case we've found an alternating + // path between those two ancestors. + + ++timestamp; + + while (nearest_common_ancestor == graph_traits<Graph>::null_vertex() && + (v_free_ancestor == graph_traits<Graph>::null_vertex() || + w_free_ancestor == graph_traits<Graph>::null_vertex() + ) + ) + { + ancestor_of_w[w_up] = timestamp; + ancestor_of_v[v_up] = timestamp; + + if (w_free_ancestor == graph_traits<Graph>::null_vertex()) + w_up = parent(w_up); + if (v_free_ancestor == graph_traits<Graph>::null_vertex()) + v_up = parent(v_up); + + if (mate[v_up] == graph_traits<Graph>::null_vertex()) + v_free_ancestor = v_up; + if (mate[w_up] == graph_traits<Graph>::null_vertex()) + w_free_ancestor = w_up; + + if (ancestor_of_w[v_up] == timestamp) + nearest_common_ancestor = v_up; + else if (ancestor_of_v[w_up] == timestamp) + nearest_common_ancestor = w_up; + else if (v_free_ancestor == w_free_ancestor && + v_free_ancestor != graph_traits<Graph>::null_vertex()) + nearest_common_ancestor = v_up; + } + + if (nearest_common_ancestor == graph_traits<Graph>::null_vertex()) + found_alternating_path = true; //to break out of the loop + else + { + //shrink the blossom + link_and_set_bridges(w_prime, nearest_common_ancestor, std::make_pair(w,v)); + link_and_set_bridges(v_prime, nearest_common_ancestor, std::make_pair(v,w)); + } + } + } + + if (!found_alternating_path) + return false; + + // retrieve the augmenting path and put it in aug_path + reversed_retrieve_augmenting_path(v, v_free_ancestor); + retrieve_augmenting_path(w, w_free_ancestor); + + // augment the matching along aug_path + vertex_descriptor_t a,b; + while (!aug_path.empty()) + { + a = aug_path.front(); + aug_path.pop_front(); + b = aug_path.front(); + aug_path.pop_front(); + mate[a] = b; + mate[b] = a; + } + + return true; + + } + + + + + template <typename PropertyMap> + void get_current_matching(PropertyMap pm) + { + vertex_iterator_t vi,vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(pm, *vi, mate[*vi]); + } + + + + + template <typename PropertyMap> + void get_vertex_state_map(PropertyMap pm) + { + vertex_iterator_t vi,vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(pm, *vi, vertex_state[origin[ds.find_set(*vi)]]); + } + + + + + private: + + vertex_descriptor_t parent(vertex_descriptor_t x) + { + if (vertex_state[x] == graph::detail::V_EVEN + && mate[x] != graph_traits<Graph>::null_vertex()) + return mate[x]; + else if (vertex_state[x] == graph::detail::V_ODD) + return origin[ds.find_set(pred[x])]; + else + return x; + } + + + + + void link_and_set_bridges(vertex_descriptor_t x, + vertex_descriptor_t stop_vertex, + vertex_pair_t the_bridge) + { + for(vertex_descriptor_t v = x; v != stop_vertex; v = parent(v)) + { + ds.union_set(v, stop_vertex); + origin[ds.find_set(stop_vertex)] = stop_vertex; + + if (vertex_state[v] == graph::detail::V_ODD) + { + bridge[v] = the_bridge; + out_edge_iterator_t oei, oei_end; + for(tie(oei, oei_end) = out_edges(v,g); oei != oei_end; ++oei) + even_edges.push_back(*oei); + } + } + } + + + // Since none of the STL containers support both constant-time + // concatenation and reversal, the process of expanding an + // augmenting path once we know one exists is a little more + // complicated than it has to be. If we know the path is from v to + // w, then the augmenting path is recursively defined as: + // + // path(v,w) = [v], if v = w + // = concat([v, mate[v]], path(pred[mate[v]], w), + // if v != w and vertex_state[v] == graph::detail::V_EVEN + // = concat([v], reverse(path(x,mate[v])), path(y,w)), + // if v != w, vertex_state[v] == graph::detail::V_ODD, and bridge[v] = (x,y) + // + // These next two mutually recursive functions implement this definition. + + void retrieve_augmenting_path(vertex_descriptor_t v, vertex_descriptor_t w) + { + if (v == w) + aug_path.push_back(v); + else if (vertex_state[v] == graph::detail::V_EVEN) + { + aug_path.push_back(v); + aug_path.push_back(mate[v]); + retrieve_augmenting_path(pred[mate[v]], w); + } + else //vertex_state[v] == graph::detail::V_ODD + { + aug_path.push_back(v); + reversed_retrieve_augmenting_path(bridge[v].first, mate[v]); + retrieve_augmenting_path(bridge[v].second, w); + } + } + + + void reversed_retrieve_augmenting_path(vertex_descriptor_t v, + vertex_descriptor_t w) + { + + if (v == w) + aug_path.push_back(v); + else if (vertex_state[v] == graph::detail::V_EVEN) + { + reversed_retrieve_augmenting_path(pred[mate[v]], w); + aug_path.push_back(mate[v]); + aug_path.push_back(v); + } + else //vertex_state[v] == graph::detail::V_ODD + { + reversed_retrieve_augmenting_path(bridge[v].second, w); + retrieve_augmenting_path(bridge[v].first, mate[v]); + aug_path.push_back(v); + } + } + + + + + //private data members + + const Graph& g; + VertexIndexMap vm; + v_size_t n_vertices; + + //storage for the property maps below + std::vector<vertex_descriptor_t> mate_vector; + std::vector<e_size_t> ancestor_of_v_vector; + std::vector<e_size_t> ancestor_of_w_vector; + std::vector<int> vertex_state_vector; + std::vector<vertex_descriptor_t> origin_vector; + std::vector<vertex_descriptor_t> pred_vector; + std::vector<vertex_pair_t> bridge_vector; + std::vector<vertex_descriptor_t> ds_parent_vector; + std::vector<v_size_t> ds_rank_vector; + + //iterator property maps + vertex_to_vertex_map_t mate; + vertex_to_esize_map_t ancestor_of_v; + vertex_to_esize_map_t ancestor_of_w; + vertex_to_int_map_t vertex_state; + vertex_to_vertex_map_t origin; + vertex_to_vertex_map_t pred; + vertex_to_vertex_pair_map_t bridge; + vertex_to_vertex_map_t ds_parent_map; + vertex_to_vsize_map_t ds_rank_map; + + vertex_list_t aug_path; + edge_list_t even_edges; + disjoint_sets< vertex_to_vsize_map_t, vertex_to_vertex_map_t > ds; + + }; + + + + + //*************************************************************************** + //*************************************************************************** + // Initial Matching Functors + //*************************************************************************** + //*************************************************************************** + + template <typename Graph, typename MateMap> + struct greedy_matching + { + typedef typename graph_traits< Graph >::vertex_descriptor vertex_descriptor_t; + typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator_t; + typedef typename graph_traits< Graph >::edge_descriptor edge_descriptor_t; + typedef typename graph_traits< Graph >::edge_iterator edge_iterator_t; + + static void find_matching(const Graph& g, MateMap mate) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(mate, *vi, graph_traits<Graph>::null_vertex()); + + edge_iterator_t ei, ei_end; + for( tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_descriptor_t e = *ei; + vertex_descriptor_t u = source(e,g); + vertex_descriptor_t v = target(e,g); + + if (get(mate,u) == get(mate,v)) + //only way equality can hold is if + // mate[u] == mate[v] == null_vertex + { + put(mate,u,v); + put(mate,v,u); + } + } + } + }; + + + + + template <typename Graph, typename MateMap> + struct extra_greedy_matching + { + // The "extra greedy matching" is formed by repeating the + // following procedure as many times as possible: Choose the + // unmatched vertex v of minimum non-zero degree. Choose the + // neighbor w of v which is unmatched and has minimum degree over + // all of v's neighbors. Add (u,v) to the matching. Ties for + // either choice are broken arbitrarily. This procedure takes time + // O(m log n), where m is the number of edges in the graph and n + // is the number of vertices. + + typedef typename graph_traits< Graph >::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator_t; + typedef typename graph_traits< Graph >::edge_descriptor edge_descriptor_t; + typedef typename graph_traits< Graph >::edge_iterator edge_iterator_t; + typedef std::pair<vertex_descriptor_t, vertex_descriptor_t> vertex_pair_t; + + struct select_first + { + inline static vertex_descriptor_t select_vertex(const vertex_pair_t p) + {return p.first;} + }; + + struct select_second + { + inline static vertex_descriptor_t select_vertex(const vertex_pair_t p) + {return p.second;} + }; + + template <class PairSelector> + class less_than_by_degree + { + public: + less_than_by_degree(const Graph& g): m_g(g) {} + bool operator() (const vertex_pair_t x, const vertex_pair_t y) + { + return + out_degree(PairSelector::select_vertex(x), m_g) + < out_degree(PairSelector::select_vertex(y), m_g); + } + private: + const Graph& m_g; + }; + + + static void find_matching(const Graph& g, MateMap mate) + { + typedef std::vector<std::pair<vertex_descriptor_t, vertex_descriptor_t> > + directed_edges_vector_t; + + directed_edges_vector_t edge_list; + vertex_iterator_t vi, vi_end; + for(tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) + put(mate, *vi, graph_traits<Graph>::null_vertex()); + + edge_iterator_t ei, ei_end; + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_descriptor_t e = *ei; + vertex_descriptor_t u = source(e,g); + vertex_descriptor_t v = target(e,g); + edge_list.push_back(std::make_pair(u,v)); + edge_list.push_back(std::make_pair(v,u)); + } + + //sort the edges by the degree of the target, then (using a + //stable sort) by degree of the source + std::sort(edge_list.begin(), edge_list.end(), + less_than_by_degree<select_second>(g)); + std::stable_sort(edge_list.begin(), edge_list.end(), + less_than_by_degree<select_first>(g)); + + //construct the extra greedy matching + for(typename directed_edges_vector_t::const_iterator itr = edge_list.begin(); itr != edge_list.end(); ++itr) + { + if (get(mate,itr->first) == get(mate,itr->second)) + //only way equality can hold is if mate[itr->first] == mate[itr->second] == null_vertex + { + put(mate, itr->first, itr->second); + put(mate, itr->second, itr->first); + } + } + } + }; + + + + + template <typename Graph, typename MateMap> + struct empty_matching + { + typedef typename graph_traits< Graph >::vertex_iterator vertex_iterator_t; + + static void find_matching(const Graph& g, MateMap mate) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + put(mate, *vi, graph_traits<Graph>::null_vertex()); + } + }; + + + + + //*************************************************************************** + //*************************************************************************** + // Matching Verifiers + //*************************************************************************** + //*************************************************************************** + + namespace detail + { + + template <typename SizeType> + class odd_components_counter : public dfs_visitor<> + // This depth-first search visitor will count the number of connected + // components with an odd number of vertices. It's used by + // maximum_matching_verifier. + { + public: + odd_components_counter(SizeType& c_count): + m_count(c_count) + { + m_count = 0; + } + + template <class Vertex, class Graph> + void start_vertex(Vertex, Graph&) + { + m_parity = false; + } + + template <class Vertex, class Graph> + void discover_vertex(Vertex, Graph&) + { + m_parity = !m_parity; + m_parity ? ++m_count : --m_count; + } + + protected: + SizeType& m_count; + + private: + bool m_parity; + + }; + + }//namespace detail + + + + + template <typename Graph, typename MateMap, + typename VertexIndexMap = dummy_property_map> + struct no_matching_verifier + { + inline static bool + verify_matching(const Graph&, MateMap, VertexIndexMap) + { return true;} + }; + + + + + template <typename Graph, typename MateMap, typename VertexIndexMap> + struct maximum_cardinality_matching_verifier + { + + template <typename X> + struct map_vertex_to_ + { + typedef boost::iterator_property_map<typename std::vector<X>::iterator, + VertexIndexMap> type; + }; + + typedef typename graph_traits<Graph>::vertex_descriptor + vertex_descriptor_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename map_vertex_to_<int>::type vertex_to_int_map_t; + typedef typename map_vertex_to_<vertex_descriptor_t>::type + vertex_to_vertex_map_t; + + + template <typename VertexStateMap> + struct non_odd_vertex { + //this predicate is used to create a filtered graph that + //excludes vertices labeled "graph::detail::V_ODD" + non_odd_vertex() : vertex_state(0) { } + + non_odd_vertex(VertexStateMap* arg_vertex_state) + : vertex_state(arg_vertex_state) { } + + template <typename Vertex> + bool operator()(const Vertex& v) const + { + BOOST_ASSERT(vertex_state); + return get(*vertex_state, v) != graph::detail::V_ODD; + } + + VertexStateMap* vertex_state; + }; + + + static bool verify_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + //For any graph G, let o(G) be the number of connected + //components in G of odd size. For a subset S of G's vertex set + //V(G), let (G - S) represent the subgraph of G induced by + //removing all vertices in S from G. Let M(G) be the size of the + //maximum cardinality matching in G. Then the Tutte-Berge + //formula guarantees that + // + // 2 * M(G) = min ( |V(G)| + |U| + o(G - U) ) + // + //where the minimum is taken over all subsets U of + //V(G). Edmonds' algorithm finds a set U that achieves the + //minimum in the above formula, namely the vertices labeled + //"ODD." This function runs one iteration of Edmonds' algorithm + //to find U, then verifies that the size of the matching given + //by mate satisfies the Tutte-Berge formula. + + //first, make sure it's a valid matching + if (!is_a_matching(g,mate,vm)) + return false; + + //We'll try to augment the matching once. This serves two + //purposes: first, if we find some augmenting path, the matching + //is obviously non-maximum. Second, running edmonds' algorithm + //on a graph with no augmenting path will create the + //Edmonds-Gallai decomposition that we need as a certificate of + //maximality - we can get it by looking at the vertex_state map + //that results. + edmonds_augmenting_path_finder<Graph,MateMap,VertexIndexMap> + augmentor(g,mate,vm); + if (augmentor.augment_matching()) + return false; + + std::vector<int> vertex_state_vector(num_vertices(g)); + vertex_to_int_map_t vertex_state(vertex_state_vector.begin(), vm); + augmentor.get_vertex_state_map(vertex_state); + + //count the number of graph::detail::V_ODD vertices + v_size_t num_odd_vertices = 0; + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + if (vertex_state[*vi] == graph::detail::V_ODD) + ++num_odd_vertices; + + //count the number of connected components with odd cardinality + //in the graph without graph::detail::V_ODD vertices + non_odd_vertex<vertex_to_int_map_t> filter(&vertex_state); + filtered_graph<Graph, keep_all, non_odd_vertex<vertex_to_int_map_t> > fg(g, keep_all(), filter); + + v_size_t num_odd_components; + detail::odd_components_counter<v_size_t> occ(num_odd_components); + depth_first_search(fg, visitor(occ).vertex_index_map(vm)); + + if (2 * matching_size(g,mate,vm) == num_vertices(g) + num_odd_vertices - num_odd_components) + return true; + else + return false; + } + }; + + + + + template <typename Graph, + typename MateMap, + typename VertexIndexMap, + template <typename, typename, typename> class AugmentingPathFinder, + template <typename, typename> class InitialMatchingFinder, + template <typename, typename, typename> class MatchingVerifier> + bool matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + + InitialMatchingFinder<Graph,MateMap>::find_matching(g,mate); + + AugmentingPathFinder<Graph,MateMap,VertexIndexMap> augmentor(g,mate,vm); + bool not_maximum_yet = true; + while(not_maximum_yet) + { + not_maximum_yet = augmentor.augment_matching(); + } + augmentor.get_current_matching(mate); + + return MatchingVerifier<Graph,MateMap,VertexIndexMap>::verify_matching(g,mate,vm); + + } + + + + + template <typename Graph, typename MateMap, typename VertexIndexMap> + inline bool checked_edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + return matching + < Graph, MateMap, VertexIndexMap, + edmonds_augmenting_path_finder, extra_greedy_matching, maximum_cardinality_matching_verifier> + (g, mate, vm); + } + + + + + template <typename Graph, typename MateMap> + inline bool checked_edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate) + { + return checked_edmonds_maximum_cardinality_matching(g, mate, get(vertex_index,g)); + } + + + + + template <typename Graph, typename MateMap, typename VertexIndexMap> + inline void edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate, VertexIndexMap vm) + { + matching < Graph, MateMap, VertexIndexMap, + edmonds_augmenting_path_finder, extra_greedy_matching, no_matching_verifier> + (g, mate, vm); + } + + + + + template <typename Graph, typename MateMap> + inline void edmonds_maximum_cardinality_matching(const Graph& g, MateMap mate) + { + edmonds_maximum_cardinality_matching(g, mate, get(vertex_index,g)); + } + +}//namespace boost + +#endif //BOOST_GRAPH_MAXIMUM_CARDINALITY_MATCHING_HPP diff --git a/Utilities/BGL/boost/graph/mcgregor_common_subgraphs.hpp b/Utilities/BGL/boost/graph/mcgregor_common_subgraphs.hpp new file mode 100644 index 0000000000000000000000000000000000000000..51eea889bacf876655c9c53d6ef5079b4724612e --- /dev/null +++ b/Utilities/BGL/boost/graph/mcgregor_common_subgraphs.hpp @@ -0,0 +1,1142 @@ +//======================================================================= +// Copyright 2009 Trustees of Indiana University. +// Authors: Michael Hansen, Andrew Lumsdaine +// +// 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_MCGREGOR_COMMON_SUBGRAPHS_HPP +#define BOOST_GRAPH_MCGREGOR_COMMON_SUBGRAPHS_HPP + +#include <algorithm> +#include <vector> +#include <stack> + +#include <boost/make_shared.hpp> +#include <boost/graph/adjacency_list.hpp> +#include <boost/graph/filtered_graph.hpp> +#include <boost/graph/graph_utility.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/graph/properties.hpp> +#include <boost/property_map/shared_array_property_map.hpp> + +namespace boost { + + namespace detail { + + // Traits associated with common subgraphs, used mainly to keep a + // consistent type for the correspondence maps. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond> + struct mcgregor_common_subgraph_traits { + typedef typename graph_traits<GraphFirst>::vertex_descriptor vertex_first_type; + typedef typename graph_traits<GraphSecond>::vertex_descriptor vertex_second_type; + + typedef shared_array_property_map<vertex_second_type, VertexIndexMapFirst> + correspondence_map_first_to_second_type; + + typedef shared_array_property_map<vertex_first_type, VertexIndexMapSecond> + correspondence_map_second_to_first_type; + }; + + } // namespace detail + + // ========================================================================== + + // Binary function object that returns true if the values for item1 + // in property_map1 and item2 in property_map2 are equivalent. + template <typename PropertyMapFirst, + typename PropertyMapSecond> + struct property_map_equivalent { + + property_map_equivalent(const PropertyMapFirst property_map1, + const PropertyMapSecond property_map2) : + m_property_map1(property_map1), + m_property_map2(property_map2) { } + + template <typename ItemFirst, + typename ItemSecond> + bool operator()(const ItemFirst item1, const ItemSecond item2) { + return (get(m_property_map1, item1) == get(m_property_map2, item2)); + } + + private: + const PropertyMapFirst m_property_map1; + const PropertyMapSecond m_property_map2; + }; + + // Returns a property_map_equivalent object that compares the values + // of property_map1 and property_map2. + template <typename PropertyMapFirst, + typename PropertyMapSecond> + property_map_equivalent<PropertyMapFirst, + PropertyMapSecond> + make_property_map_equivalent + (const PropertyMapFirst property_map1, + const PropertyMapSecond property_map2) { + + return (property_map_equivalent<PropertyMapFirst, PropertyMapSecond> + (property_map1, property_map2)); + } + + // Binary function object that always returns true. Used when + // vertices or edges are always equivalent (i.e. have no labels). + struct always_equivalent { + + template <typename ItemFirst, + typename ItemSecond> + bool operator()(const ItemFirst&, const ItemSecond&) { + return (true); + } + }; + + // ========================================================================== + + namespace detail { + + // Return true if new_vertex1 and new_vertex2 can extend the + // subgraph represented by correspondence_map_1_to_2 and + // correspondence_map_2_to_1. The vertices_equivalent and + // edges_equivalent predicates are used to test vertex and edge + // equivalency between the two graphs. + template <typename GraphFirst, + typename GraphSecond, + typename CorrespondenceMapFirstToSecond, + typename CorrespondenceMapSecondToFirst, + typename EdgeEquivalencePredicate, + typename VertexEquivalencePredicate> + bool can_extend_graph + (const GraphFirst& graph1, + const GraphSecond& graph2, + CorrespondenceMapFirstToSecond correspondence_map_1_to_2, + CorrespondenceMapSecondToFirst /*correspondence_map_2_to_1*/, + typename graph_traits<GraphFirst>::vertices_size_type subgraph_size, + typename graph_traits<GraphFirst>::vertex_descriptor new_vertex1, + typename graph_traits<GraphSecond>::vertex_descriptor new_vertex2, + EdgeEquivalencePredicate edges_equivalent, + VertexEquivalencePredicate vertices_equivalent, + bool only_connected_subgraphs) + { + typedef typename graph_traits<GraphFirst>::vertex_descriptor VertexFirst; + typedef typename graph_traits<GraphSecond>::vertex_descriptor VertexSecond; + + typedef typename graph_traits<GraphFirst>::edge_descriptor EdgeFirst; + typedef typename graph_traits<GraphSecond>::edge_descriptor EdgeSecond; + + // Check vertex equality + if (!vertices_equivalent(new_vertex1, new_vertex2)) { + return (false); + } + + // Vertices match and graph is empty, so we can extend the subgraph + if (subgraph_size == 0) { + return (true); + } + + bool has_one_edge = false; + + // Verify edges with existing sub-graph + BGL_FORALL_VERTICES_T(existing_vertex1, graph1, GraphFirst) { + + VertexSecond existing_vertex2 = get(correspondence_map_1_to_2, existing_vertex1); + + // Skip unassociated vertices + if (existing_vertex2 == graph_traits<GraphSecond>::null_vertex()) { + continue; + } + + // NOTE: This will not work with parallel edges, since the + // first matching edge is always chosen. + EdgeFirst edge_to_new1, edge_from_new1; + bool edge_to_new_exists1 = false, edge_from_new_exists1 = false; + + EdgeSecond edge_to_new2, edge_from_new2; + bool edge_to_new_exists2 = false, edge_from_new_exists2 = false; + + // Search for edge from existing to new vertex (graph1) + BGL_FORALL_OUTEDGES_T(existing_vertex1, edge1, graph1, GraphFirst) { + if (target(edge1, graph1) == new_vertex1) { + edge_to_new1 = edge1; + edge_to_new_exists1 = true; + break; + } + } + + // Search for edge from existing to new vertex (graph2) + BGL_FORALL_OUTEDGES_T(existing_vertex2, edge2, graph2, GraphSecond) { + if (target(edge2, graph2) == new_vertex2) { + edge_to_new2 = edge2; + edge_to_new_exists2 = true; + break; + } + } + + // Make sure edges from existing to new vertices are equivalent + if ((edge_to_new_exists1 != edge_to_new_exists2) || + ((edge_to_new_exists1 && edge_to_new_exists2) && + !edges_equivalent(edge_to_new1, edge_to_new2))) { + + return (false); + } + + bool is_undirected1 = is_undirected(graph1), + is_undirected2 = is_undirected(graph2); + + if (is_undirected1 && is_undirected2) { + + // Edge in both graphs exists and both graphs are undirected + if (edge_to_new_exists1 && edge_to_new_exists2) { + has_one_edge = true; + } + + continue; + } + else { + + if (!is_undirected1) { + + // Search for edge from new to existing vertex (graph1) + BGL_FORALL_OUTEDGES_T(new_vertex1, edge1, graph1, GraphFirst) { + if (target(edge1, graph1) == existing_vertex1) { + edge_from_new1 = edge1; + edge_from_new_exists1 = true; + break; + } + } + } + + if (!is_undirected2) { + + // Search for edge from new to existing vertex (graph2) + BGL_FORALL_OUTEDGES_T(new_vertex2, edge2, graph2, GraphSecond) { + if (target(edge2, graph2) == existing_vertex2) { + edge_from_new2 = edge2; + edge_from_new_exists2 = true; + break; + } + } + } + + // Make sure edges from new to existing vertices are equivalent + if ((edge_from_new_exists1 != edge_from_new_exists2) || + ((edge_from_new_exists1 && edge_from_new_exists2) && + !edges_equivalent(edge_from_new1, edge_from_new2))) { + + return (false); + } + + if ((edge_from_new_exists1 && edge_from_new_exists2) || + (edge_to_new_exists1 && edge_to_new_exists2)) { + has_one_edge = true; + } + + } // else + + } // BGL_FORALL_VERTICES_T + + // Make sure new vertices are connected to the existing subgraph + if (only_connected_subgraphs && !has_one_edge) { + return (false); + } + + return (true); + } + + // Recursive method that does a depth-first search in the space of + // potential subgraphs. At each level, every new vertex pair from + // both graphs is tested to see if it can extend the current + // subgraph. If so, the subgraph is output to subgraph_callback + // in the form of two correspondence maps (one for each graph). + // Returning false from subgraph_callback will terminate the + // search. Function returns true if the entire search space was + // explored. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename CorrespondenceMapFirstToSecond, + typename CorrespondenceMapSecondToFirst, + typename VertexStackFirst, + typename EdgeEquivalencePredicate, + typename VertexEquivalencePredicate, + typename SubGraphInternalCallback> + bool mcgregor_common_subgraphs_internal + (const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst& vindex_map1, + const VertexIndexMapSecond& vindex_map2, + CorrespondenceMapFirstToSecond correspondence_map_1_to_2, + CorrespondenceMapSecondToFirst correspondence_map_2_to_1, + VertexStackFirst& vertex_stack1, + EdgeEquivalencePredicate edges_equivalent, + VertexEquivalencePredicate vertices_equivalent, + bool only_connected_subgraphs, + SubGraphInternalCallback subgraph_callback) + { + typedef typename graph_traits<GraphFirst>::vertex_descriptor VertexFirst; + typedef typename graph_traits<GraphSecond>::vertex_descriptor VertexSecond; + typedef typename graph_traits<GraphFirst>::vertices_size_type VertexSizeFirst; + + // Get iterators for vertices from both graphs + typename graph_traits<GraphFirst>::vertex_iterator + vertex1_iter, vertex1_end; + + typename graph_traits<GraphSecond>::vertex_iterator + vertex2_begin, vertex2_end, vertex2_iter; + + tie(vertex1_iter, vertex1_end) = vertices(graph1); + tie(vertex2_begin, vertex2_end) = vertices(graph2); + vertex2_iter = vertex2_begin; + + // Iterate until all vertices have been visited + BGL_FORALL_VERTICES_T(new_vertex1, graph1, GraphFirst) { + + VertexSecond existing_vertex2 = get(correspondence_map_1_to_2, new_vertex1); + + // Skip already matched vertices in first graph + if (existing_vertex2 != graph_traits<GraphSecond>::null_vertex()) { + continue; + } + + BGL_FORALL_VERTICES_T(new_vertex2, graph2, GraphSecond) { + + VertexFirst existing_vertex1 = get(correspondence_map_2_to_1, new_vertex2); + + // Skip already matched vertices in second graph + if (existing_vertex1 != graph_traits<GraphFirst>::null_vertex()) { + continue; + } + + // Check if current sub-graph can be extended with the matched vertex pair + if (can_extend_graph(graph1, graph2, + correspondence_map_1_to_2, correspondence_map_2_to_1, + (VertexSizeFirst)vertex_stack1.size(), + new_vertex1, new_vertex2, + edges_equivalent, vertices_equivalent, + only_connected_subgraphs)) { + + // Keep track of old graph size for restoring later + VertexSizeFirst old_graph_size = (VertexSizeFirst)vertex_stack1.size(), + new_graph_size = old_graph_size + 1; + + // Extend subgraph + put(correspondence_map_1_to_2, new_vertex1, new_vertex2); + put(correspondence_map_2_to_1, new_vertex2, new_vertex1); + vertex_stack1.push(new_vertex1); + + // Only output sub-graphs larger than a single vertex + if (new_graph_size > 1) { + + // Returning false from the callback will cancel iteration + if (!subgraph_callback(correspondence_map_1_to_2, + correspondence_map_2_to_1, + new_graph_size)) { + return (false); + } + } + + // Depth-first search into the state space of possible sub-graphs + bool continue_iteration = + mcgregor_common_subgraphs_internal + (graph1, graph2, + vindex_map1, vindex_map2, + correspondence_map_1_to_2, correspondence_map_2_to_1, + vertex_stack1, + edges_equivalent, vertices_equivalent, + only_connected_subgraphs, subgraph_callback); + + if (!continue_iteration) { + return (false); + } + + // Restore previous state + if (vertex_stack1.size() > old_graph_size) { + + VertexFirst stack_vertex1 = vertex_stack1.top(); + VertexSecond stack_vertex2 = get(correspondence_map_1_to_2, + stack_vertex1); + + // Contract subgraph + put(correspondence_map_1_to_2, stack_vertex1, + graph_traits<GraphSecond>::null_vertex()); + + put(correspondence_map_2_to_1, stack_vertex2, + graph_traits<GraphFirst>::null_vertex()); + + vertex_stack1.pop(); + } + + } // if can_extend_graph + + } // BGL_FORALL_VERTICES_T (graph2) + + } // BGL_FORALL_VERTICES_T (graph1) + + return (true); + } + + // Internal method that initializes blank correspondence maps and + // a vertex stack for use in mcgregor_common_subgraphs_internal. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename EdgeEquivalencePredicate, + typename VertexEquivalencePredicate, + typename SubGraphInternalCallback> + inline void mcgregor_common_subgraphs_internal_init + (const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + EdgeEquivalencePredicate edges_equivalent, + VertexEquivalencePredicate vertices_equivalent, + bool only_connected_subgraphs, + SubGraphInternalCallback subgraph_callback) + { + typedef mcgregor_common_subgraph_traits<GraphFirst, + GraphSecond, VertexIndexMapFirst, + VertexIndexMapSecond> SubGraphTraits; + + typename SubGraphTraits::correspondence_map_first_to_second_type + correspondence_map_1_to_2(num_vertices(graph1), vindex_map1); + + BGL_FORALL_VERTICES_T(vertex1, graph1, GraphFirst) { + put(correspondence_map_1_to_2, vertex1, + graph_traits<GraphSecond>::null_vertex()); + } + + typename SubGraphTraits::correspondence_map_second_to_first_type + correspondence_map_2_to_1(num_vertices(graph2), vindex_map2); + + BGL_FORALL_VERTICES_T(vertex2, graph2, GraphSecond) { + put(correspondence_map_2_to_1, vertex2, + graph_traits<GraphFirst>::null_vertex()); + } + + typedef typename graph_traits<GraphFirst>::vertex_descriptor + VertexFirst; + + std::stack<VertexFirst> vertex_stack1; + + mcgregor_common_subgraphs_internal + (graph1, graph2, + vindex_map1, vindex_map2, + correspondence_map_1_to_2, correspondence_map_2_to_1, + vertex_stack1, + edges_equivalent, vertices_equivalent, + only_connected_subgraphs, + subgraph_callback); + } + + } // namespace detail + + // ========================================================================== + + // Enumerates all common subgraphs present in graph1 and graph2. + // Continues until the search space has been fully explored or false + // is returned from user_callback. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename EdgeEquivalencePredicate, + typename VertexEquivalencePredicate, + typename SubGraphCallback> + void mcgregor_common_subgraphs + (const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + EdgeEquivalencePredicate edges_equivalent, + VertexEquivalencePredicate vertices_equivalent, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + + detail::mcgregor_common_subgraphs_internal_init + (graph1, graph2, + vindex_map1, vindex_map2, + edges_equivalent, vertices_equivalent, + only_connected_subgraphs, + user_callback); + } + + // Variant of mcgregor_common_subgraphs with all default parameters + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback> + void mcgregor_common_subgraphs + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + + detail::mcgregor_common_subgraphs_internal_init + (graph1, graph2, + get(vertex_index, graph1), get(vertex_index, graph2), + always_equivalent(), always_equivalent(), + only_connected_subgraphs, user_callback); + } + + // Named parameter variant of mcgregor_common_subgraphs + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback, + typename Param, + typename Tag, + typename Rest> + void mcgregor_common_subgraphs + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback, + const bgl_named_params<Param, Tag, Rest>& params) + { + + detail::mcgregor_common_subgraphs_internal_init + (graph1, graph2, + choose_const_pmap(get_param(params, vertex_index1), + graph1, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph2, vertex_index), + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()), + only_connected_subgraphs, user_callback); + } + + // ========================================================================== + + namespace detail { + + // Binary function object that intercepts subgraphs from + // mcgregor_common_subgraphs_internal and maintains a cache of + // unique subgraphs. The user callback is invoked for each unique + // subgraph. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename SubGraphCallback> + struct unique_subgraph_interceptor { + + typedef typename graph_traits<GraphFirst>::vertices_size_type + VertexSizeFirst; + + typedef mcgregor_common_subgraph_traits<GraphFirst, GraphSecond, + VertexIndexMapFirst, VertexIndexMapSecond> SubGraphTraits; + + typedef typename SubGraphTraits::correspondence_map_first_to_second_type + CachedCorrespondenceMapFirstToSecond; + + typedef typename SubGraphTraits::correspondence_map_second_to_first_type + CachedCorrespondenceMapSecondToFirst; + + typedef std::pair<VertexSizeFirst, + std::pair<CachedCorrespondenceMapFirstToSecond, + CachedCorrespondenceMapSecondToFirst> > SubGraph; + + typedef std::vector<SubGraph> SubGraphList; + + unique_subgraph_interceptor(const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + SubGraphCallback user_callback) : + m_graph1(graph1), m_graph2(graph2), + m_vindex_map1(vindex_map1), m_vindex_map2(vindex_map2), + m_subgraphs(make_shared<SubGraphList>()), + m_user_callback(user_callback) { } + + template <typename CorrespondenceMapFirstToSecond, + typename CorrespondenceMapSecondToFirst> + bool operator()(CorrespondenceMapFirstToSecond correspondence_map_1_to_2, + CorrespondenceMapSecondToFirst correspondence_map_2_to_1, + VertexSizeFirst subgraph_size) { + + for (typename SubGraphList::const_iterator + subgraph_iter = m_subgraphs->begin(); + subgraph_iter != m_subgraphs->end(); + ++subgraph_iter) { + + SubGraph subgraph_cached = *subgraph_iter; + + // Compare subgraph sizes + if (subgraph_size != subgraph_cached.first) { + continue; + } + + if (!are_property_maps_different(correspondence_map_1_to_2, + subgraph_cached.second.first, + m_graph1)) { + + // New subgraph is a duplicate + return (true); + } + } + + // Subgraph is unique, so make a cached copy + CachedCorrespondenceMapFirstToSecond + new_subgraph_1_to_2 = CachedCorrespondenceMapFirstToSecond + (num_vertices(m_graph1), m_vindex_map1); + + CachedCorrespondenceMapSecondToFirst + new_subgraph_2_to_1 = CorrespondenceMapSecondToFirst + (num_vertices(m_graph2), m_vindex_map2); + + BGL_FORALL_VERTICES_T(vertex1, m_graph1, GraphFirst) { + put(new_subgraph_1_to_2, vertex1, get(correspondence_map_1_to_2, vertex1)); + } + + BGL_FORALL_VERTICES_T(vertex2, m_graph2, GraphFirst) { + put(new_subgraph_2_to_1, vertex2, get(correspondence_map_2_to_1, vertex2)); + } + + m_subgraphs->push_back(std::make_pair(subgraph_size, + std::make_pair(new_subgraph_1_to_2, + new_subgraph_2_to_1))); + + return (m_user_callback(correspondence_map_1_to_2, + correspondence_map_2_to_1, + subgraph_size)); + } + + private: + const GraphFirst& m_graph1; + const GraphFirst& m_graph2; + const VertexIndexMapFirst m_vindex_map1; + const VertexIndexMapSecond m_vindex_map2; + shared_ptr<SubGraphList> m_subgraphs; + SubGraphCallback m_user_callback; + }; + + } // namespace detail + + // Enumerates all unique common subgraphs between graph1 and graph2. + // The user callback is invoked for each unique subgraph as they are + // discovered. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename EdgeEquivalencePredicate, + typename VertexEquivalencePredicate, + typename SubGraphCallback> + void mcgregor_common_subgraphs_unique + (const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + EdgeEquivalencePredicate edges_equivalent, + VertexEquivalencePredicate vertices_equivalent, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + detail::unique_subgraph_interceptor<GraphFirst, GraphSecond, + VertexIndexMapFirst, VertexIndexMapSecond, + SubGraphCallback> unique_callback + (graph1, graph2, + vindex_map1, vindex_map2, + user_callback); + + detail::mcgregor_common_subgraphs_internal_init + (graph1, graph2, + vindex_map1, vindex_map2, + edges_equivalent, vertices_equivalent, + only_connected_subgraphs, unique_callback); + } + + // Variant of mcgregor_common_subgraphs_unique with all default + // parameters. + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback> + void mcgregor_common_subgraphs_unique + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + mcgregor_common_subgraphs_unique + (graph1, graph2, + get(vertex_index, graph1), get(vertex_index, graph2), + always_equivalent(), always_equivalent(), + only_connected_subgraphs, user_callback); + } + + // Named parameter variant of mcgregor_common_subgraphs_unique + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback, + typename Param, + typename Tag, + typename Rest> + void mcgregor_common_subgraphs_unique + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback, + const bgl_named_params<Param, Tag, Rest>& params) + { + mcgregor_common_subgraphs_unique + (graph1, graph2, + choose_const_pmap(get_param(params, vertex_index1), + graph1, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph2, vertex_index), + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()), + only_connected_subgraphs, user_callback); + } + + // ========================================================================== + + namespace detail { + + // Binary function object that intercepts subgraphs from + // mcgregor_common_subgraphs_internal and maintains a cache of the + // largest subgraphs. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename SubGraphCallback> + struct maximum_subgraph_interceptor { + + typedef typename graph_traits<GraphFirst>::vertices_size_type + VertexSizeFirst; + + typedef mcgregor_common_subgraph_traits<GraphFirst, GraphSecond, + VertexIndexMapFirst, VertexIndexMapSecond> SubGraphTraits; + + typedef typename SubGraphTraits::correspondence_map_first_to_second_type + CachedCorrespondenceMapFirstToSecond; + + typedef typename SubGraphTraits::correspondence_map_second_to_first_type + CachedCorrespondenceMapSecondToFirst; + + typedef std::pair<VertexSizeFirst, + std::pair<CachedCorrespondenceMapFirstToSecond, + CachedCorrespondenceMapSecondToFirst> > SubGraph; + + typedef std::vector<SubGraph> SubGraphList; + + maximum_subgraph_interceptor(const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + SubGraphCallback user_callback) : + m_graph1(graph1), m_graph2(graph2), + m_vindex_map1(vindex_map1), m_vindex_map2(vindex_map2), + m_subgraphs(make_shared<SubGraphList>()), + m_largest_size_so_far(make_shared<VertexSizeFirst>(0)), + m_user_callback(user_callback) { } + + template <typename CorrespondenceMapFirstToSecond, + typename CorrespondenceMapSecondToFirst> + bool operator()(CorrespondenceMapFirstToSecond correspondence_map_1_to_2, + CorrespondenceMapSecondToFirst correspondence_map_2_to_1, + VertexSizeFirst subgraph_size) { + + if (subgraph_size > *m_largest_size_so_far) { + m_subgraphs->clear(); + *m_largest_size_so_far = subgraph_size; + } + + if (subgraph_size == *m_largest_size_so_far) { + + // Make a cached copy + CachedCorrespondenceMapFirstToSecond + new_subgraph_1_to_2 = CachedCorrespondenceMapFirstToSecond + (num_vertices(m_graph1), m_vindex_map1); + + CachedCorrespondenceMapSecondToFirst + new_subgraph_2_to_1 = CachedCorrespondenceMapSecondToFirst + (num_vertices(m_graph2), m_vindex_map2); + + BGL_FORALL_VERTICES_T(vertex1, m_graph1, GraphFirst) { + put(new_subgraph_1_to_2, vertex1, get(correspondence_map_1_to_2, vertex1)); + } + + BGL_FORALL_VERTICES_T(vertex2, m_graph2, GraphFirst) { + put(new_subgraph_2_to_1, vertex2, get(correspondence_map_2_to_1, vertex2)); + } + + m_subgraphs->push_back(std::make_pair(subgraph_size, + std::make_pair(new_subgraph_1_to_2, + new_subgraph_2_to_1))); + } + + return (true); + } + + void output_subgraphs() { + for (typename SubGraphList::const_iterator + subgraph_iter = m_subgraphs->begin(); + subgraph_iter != m_subgraphs->end(); + ++subgraph_iter) { + + SubGraph subgraph_cached = *subgraph_iter; + m_user_callback(subgraph_cached.second.first, + subgraph_cached.second.second, + subgraph_cached.first); + } + } + + private: + const GraphFirst& m_graph1; + const GraphFirst& m_graph2; + const VertexIndexMapFirst m_vindex_map1; + const VertexIndexMapSecond m_vindex_map2; + shared_ptr<SubGraphList> m_subgraphs; + shared_ptr<VertexSizeFirst> m_largest_size_so_far; + SubGraphCallback m_user_callback; + }; + + } // namespace detail + + // Enumerates the largest common subgraphs found between graph1 + // and graph2. Note that the ENTIRE search space is explored before + // user_callback is actually invoked. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename EdgeEquivalencePredicate, + typename VertexEquivalencePredicate, + typename SubGraphCallback> + void mcgregor_common_subgraphs_maximum + (const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + EdgeEquivalencePredicate edges_equivalent, + VertexEquivalencePredicate vertices_equivalent, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + detail::maximum_subgraph_interceptor<GraphFirst, GraphSecond, + VertexIndexMapFirst, VertexIndexMapSecond, SubGraphCallback> + max_interceptor + (graph1, graph2, vindex_map1, vindex_map2, user_callback); + + detail::mcgregor_common_subgraphs_internal_init + (graph1, graph2, + vindex_map1, vindex_map2, + edges_equivalent, vertices_equivalent, + only_connected_subgraphs, max_interceptor); + + // Only output the largest subgraphs + max_interceptor.output_subgraphs(); + } + + // Variant of mcgregor_common_subgraphs_maximum with all default + // parameters. + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback> + void mcgregor_common_subgraphs_maximum + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + mcgregor_common_subgraphs_maximum + (graph1, graph2, + get(vertex_index, graph1), get(vertex_index, graph2), + always_equivalent(), always_equivalent(), + only_connected_subgraphs, user_callback); + } + + // Named parameter variant of mcgregor_common_subgraphs_maximum + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback, + typename Param, + typename Tag, + typename Rest> + void mcgregor_common_subgraphs_maximum + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback, + const bgl_named_params<Param, Tag, Rest>& params) + { + mcgregor_common_subgraphs_maximum + (graph1, graph2, + choose_const_pmap(get_param(params, vertex_index1), + graph1, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph2, vertex_index), + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()), + only_connected_subgraphs, user_callback); + } + + // ========================================================================== + + namespace detail { + + // Binary function object that intercepts subgraphs from + // mcgregor_common_subgraphs_internal and maintains a cache of the + // largest, unique subgraphs. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename SubGraphCallback> + struct unique_maximum_subgraph_interceptor { + + typedef typename graph_traits<GraphFirst>::vertices_size_type + VertexSizeFirst; + + typedef mcgregor_common_subgraph_traits<GraphFirst, GraphSecond, + VertexIndexMapFirst, VertexIndexMapSecond> SubGraphTraits; + + typedef typename SubGraphTraits::correspondence_map_first_to_second_type + CachedCorrespondenceMapFirstToSecond; + + typedef typename SubGraphTraits::correspondence_map_second_to_first_type + CachedCorrespondenceMapSecondToFirst; + + typedef std::pair<VertexSizeFirst, + std::pair<CachedCorrespondenceMapFirstToSecond, + CachedCorrespondenceMapSecondToFirst> > SubGraph; + + typedef std::vector<SubGraph> SubGraphList; + + unique_maximum_subgraph_interceptor(const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + SubGraphCallback user_callback) : + m_graph1(graph1), m_graph2(graph2), + m_vindex_map1(vindex_map1), m_vindex_map2(vindex_map2), + m_subgraphs(make_shared<SubGraphList>()), + m_largest_size_so_far(make_shared<VertexSizeFirst>(0)), + m_user_callback(user_callback) { } + + template <typename CorrespondenceMapFirstToSecond, + typename CorrespondenceMapSecondToFirst> + bool operator()(CorrespondenceMapFirstToSecond correspondence_map_1_to_2, + CorrespondenceMapSecondToFirst correspondence_map_2_to_1, + VertexSizeFirst subgraph_size) { + + if (subgraph_size > *m_largest_size_so_far) { + m_subgraphs->clear(); + *m_largest_size_so_far = subgraph_size; + } + + if (subgraph_size == *m_largest_size_so_far) { + + // Check if subgraph is unique + for (typename SubGraphList::const_iterator + subgraph_iter = m_subgraphs->begin(); + subgraph_iter != m_subgraphs->end(); + ++subgraph_iter) { + + SubGraph subgraph_cached = *subgraph_iter; + + if (!are_property_maps_different(correspondence_map_1_to_2, + subgraph_cached.second.first, + m_graph1)) { + + // New subgraph is a duplicate + return (true); + } + } + + // Subgraph is unique, so make a cached copy + CachedCorrespondenceMapFirstToSecond + new_subgraph_1_to_2 = CachedCorrespondenceMapFirstToSecond + (num_vertices(m_graph1), m_vindex_map1); + + CachedCorrespondenceMapSecondToFirst + new_subgraph_2_to_1 = CachedCorrespondenceMapSecondToFirst + (num_vertices(m_graph2), m_vindex_map2); + + BGL_FORALL_VERTICES_T(vertex1, m_graph1, GraphFirst) { + put(new_subgraph_1_to_2, vertex1, get(correspondence_map_1_to_2, vertex1)); + } + + BGL_FORALL_VERTICES_T(vertex2, m_graph2, GraphFirst) { + put(new_subgraph_2_to_1, vertex2, get(correspondence_map_2_to_1, vertex2)); + } + + m_subgraphs->push_back(std::make_pair(subgraph_size, + std::make_pair(new_subgraph_1_to_2, + new_subgraph_2_to_1))); + } + + return (true); + } + + void output_subgraphs() { + for (typename SubGraphList::const_iterator + subgraph_iter = m_subgraphs->begin(); + subgraph_iter != m_subgraphs->end(); + ++subgraph_iter) { + + SubGraph subgraph_cached = *subgraph_iter; + m_user_callback(subgraph_cached.second.first, + subgraph_cached.second.second, + subgraph_cached.first); + } + } + + private: + const GraphFirst& m_graph1; + const GraphFirst& m_graph2; + const VertexIndexMapFirst m_vindex_map1; + const VertexIndexMapSecond m_vindex_map2; + shared_ptr<SubGraphList> m_subgraphs; + shared_ptr<VertexSizeFirst> m_largest_size_so_far; + SubGraphCallback m_user_callback; + }; + + } // namespace detail + + // Enumerates the largest, unique common subgraphs found between + // graph1 and graph2. Note that the ENTIRE search space is explored + // before user_callback is actually invoked. + template <typename GraphFirst, + typename GraphSecond, + typename VertexIndexMapFirst, + typename VertexIndexMapSecond, + typename EdgeEquivalencePredicate, + typename VertexEquivalencePredicate, + typename SubGraphCallback> + void mcgregor_common_subgraphs_maximum_unique + (const GraphFirst& graph1, + const GraphSecond& graph2, + const VertexIndexMapFirst vindex_map1, + const VertexIndexMapSecond vindex_map2, + EdgeEquivalencePredicate edges_equivalent, + VertexEquivalencePredicate vertices_equivalent, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + detail::unique_maximum_subgraph_interceptor<GraphFirst, GraphSecond, + VertexIndexMapFirst, VertexIndexMapSecond, SubGraphCallback> + unique_max_interceptor + (graph1, graph2, vindex_map1, vindex_map2, user_callback); + + detail::mcgregor_common_subgraphs_internal_init + (graph1, graph2, + vindex_map1, vindex_map2, + edges_equivalent, vertices_equivalent, + only_connected_subgraphs, unique_max_interceptor); + + // Only output the largest, unique subgraphs + unique_max_interceptor.output_subgraphs(); + } + + // Variant of mcgregor_common_subgraphs_maximum_unique with all default parameters + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback> + void mcgregor_common_subgraphs_maximum_unique + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback) + { + + mcgregor_common_subgraphs_maximum_unique + (graph1, graph2, + get(vertex_index, graph1), get(vertex_index, graph2), + always_equivalent(), always_equivalent(), + only_connected_subgraphs, user_callback); + } + + // Named parameter variant of + // mcgregor_common_subgraphs_maximum_unique + template <typename GraphFirst, + typename GraphSecond, + typename SubGraphCallback, + typename Param, + typename Tag, + typename Rest> + void mcgregor_common_subgraphs_maximum_unique + (const GraphFirst& graph1, + const GraphSecond& graph2, + bool only_connected_subgraphs, + SubGraphCallback user_callback, + const bgl_named_params<Param, Tag, Rest>& params) + { + mcgregor_common_subgraphs_maximum_unique + (graph1, graph2, + choose_const_pmap(get_param(params, vertex_index1), + graph1, vertex_index), + choose_const_pmap(get_param(params, vertex_index2), + graph2, vertex_index), + choose_param(get_param(params, edges_equivalent_t()), + always_equivalent()), + choose_param(get_param(params, vertices_equivalent_t()), + always_equivalent()), + only_connected_subgraphs, user_callback); + } + + // ========================================================================== + + // Fills a membership map (vertex -> bool) using the information + // present in correspondence_map_1_to_2. Every vertex in a + // membership map will have a true value only if it is not + // associated with a null vertex in the correspondence map. + template <typename GraphSecond, + typename GraphFirst, + typename CorrespondenceMapFirstToSecond, + typename MembershipMapFirst> + void fill_membership_map + (const GraphFirst& graph1, + const CorrespondenceMapFirstToSecond correspondence_map_1_to_2, + MembershipMapFirst membership_map1) { + + BGL_FORALL_VERTICES_T(vertex1, graph1, GraphFirst) { + put(membership_map1, vertex1, + get(correspondence_map_1_to_2, vertex1) != graph_traits<GraphSecond>::null_vertex()); + } + + } + + // Traits associated with a membership map filtered graph. Provided + // for convenience to access graph and vertex filter types. + template <typename Graph, + typename MembershipMap> + struct membership_filtered_graph_traits { + typedef property_map_filter<MembershipMap> vertex_filter_type; + typedef filtered_graph<Graph, keep_all, vertex_filter_type> graph_type; + }; + + // Returns a filtered sub-graph of graph whose edge and vertex + // inclusion is dictated by membership_map. + template <typename Graph, + typename MembershipMap> + typename membership_filtered_graph_traits<Graph, MembershipMap>::graph_type + make_membership_filtered_graph + (const Graph& graph, + MembershipMap& membership_map) { + + typedef membership_filtered_graph_traits<Graph, MembershipMap> MFGTraits; + typedef typename MFGTraits::graph_type MembershipFilteredGraph; + + typename MFGTraits::vertex_filter_type v_filter(membership_map); + + return (MembershipFilteredGraph(graph, keep_all(), v_filter)); + + } + +} // namespace boost + +#endif // BOOST_GRAPH_MCGREGOR_COMMON_SUBGRAPHS_HPP diff --git a/Utilities/BGL/boost/graph/mesh_graph_generator.hpp b/Utilities/BGL/boost/graph/mesh_graph_generator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5bf1d47f3185dc20c504a31426ad3ca476b840b2 --- /dev/null +++ b/Utilities/BGL/boost/graph/mesh_graph_generator.hpp @@ -0,0 +1,158 @@ +// Copyright 2004, 2005 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_MESH_GENERATOR_HPP +#define BOOST_GRAPH_MESH_GENERATOR_HPP + +#include <iterator> +#include <utility> +#include <cassert> +#include <boost/graph/graph_traits.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_same.hpp> + +namespace boost { + + template<typename Graph> + class mesh_iterator + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type + vertices_size_type; + + BOOST_STATIC_CONSTANT + (bool, + is_undirected = (is_base_and_derived<undirected_tag, + directed_category>::value + || is_same<undirected_tag, directed_category>::value)); + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + mesh_iterator() + : x(0), y(0), done(true) { } + + // Vertices are numbered in row-major order + // Assumes directed + mesh_iterator(vertices_size_type x, vertices_size_type y, + bool toroidal = true) + : x(x), y(y), n(x*y), source(0), target(1), current(0,1), + toroidal(toroidal), done(false) + { assert(x > 1 && y > 1); } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + mesh_iterator& operator++() + { + if (is_undirected) { + if (!toroidal) { + if (target == source + 1) + if (source < x * (y - 1)) + target = source + x; + else { + source++; + target = (source % x) < x - 1 ? source + 1 : source + x; + if (target > n) + done = true; + } + else if (target == source + x) { + source++; + target = (source % x) < x - 1 ? source + 1 : source + x; + } + } else { + if (target == source + 1 || target == source - (source % x)) + target = (source + x) % n; + else if (target == (source + x) % n) { + if (source == n - 1) + done = true; + else { + source++; + target = (source % x) < (x - 1) ? source + 1 : source - (source % x); + } + } + } + } else { // Directed + if ( !toroidal ) { + if (target == source - x) + target = source % x > 0 ? source - 1 : source + 1; + else if (target == source - 1) + if ((source % x) < (x - 1)) + target = source + 1; + else if (source < x * (y - 1)) + target = source + x; + else { + done = true; + } + else if (target == source + 1) + if (source < x * (y - 1)) + target = source + x; + else { + source++; + target = source - x; + } + else if (target == source + x) { + source++; + target = (source >= x) ? source - x : source - 1; + } + } else { + if (source == n - 1 && target == (source + x) % n) + done = true; + else if (target == source - 1 || target == source + x - 1) + target = (source + x) % n; + else if (target == source + 1 || target == source - (source % x)) + target = (source - x + n) % n; + else if (target == (source - x + n) % n) + target = (source % x > 0) ? source - 1 : source + x - 1; + else if (target == (source + x) % n) { + source++; + target = (source % x) < (x - 1) ? source + 1 : source - (source % x); + } + } + } + + current.first = source; + current.second = target; + + return *this; + } + + mesh_iterator operator++(int) + { + mesh_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const mesh_iterator& other) const + { + return done == other.done; + } + + bool operator!=(const mesh_iterator& other) const + { return !(*this == other); } + + private: + + vertices_size_type x,y; + vertices_size_type n; + vertices_size_type source; + vertices_size_type target; + value_type current; + bool toroidal; + bool done; + }; + + +} // end namespace boost + +#endif // BOOST_GRAPH_MESH_GENERATOR_HPP diff --git a/Utilities/BGL/boost/graph/metis.hpp b/Utilities/BGL/boost/graph/metis.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f16cac2640adc8fab02061d54886f2c2fdfb637d --- /dev/null +++ b/Utilities/BGL/boost/graph/metis.hpp @@ -0,0 +1,339 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_METIS_HPP +#define BOOST_GRAPH_METIS_HPP + +#ifdef BOOST_GRAPH_METIS_NO_INLINE +# define BOOST_GRAPH_METIS_INLINE_KEYWORD +#else +# define BOOST_GRAPH_METIS_INLINE_KEYWORD inline +#endif + +#include <string> +#include <iostream> +#include <iterator> +#include <utility> +#include <sstream> +#include <exception> +#include <vector> +#include <algorithm> + +namespace boost { namespace graph { + +class metis_exception : public std::exception {}; +class metis_input_exception : public metis_exception {}; + +class metis_reader +{ + public: + typedef std::size_t vertices_size_type; + typedef std::size_t edges_size_type; + typedef double vertex_weight_type; + typedef double edge_weight_type; + + class edge_iterator + { + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef std::ptrdiff_t difference_type; + + private: + class postincrement_proxy + { + postincrement_proxy(const value_type& value) : value(value) { } + + public: + reference operator*() const { return value; } + + private: + value_type value; + friend class edge_iterator; + }; + + public: + edge_iterator& operator++(); + postincrement_proxy operator++(int); + + reference operator*() const { return self->edge; } + pointer operator->() const { return &self->edge; } + + // Default copy constructor and assignment operator are okay + + private: + edge_iterator(metis_reader* self); + void advance(bool skip_initial_read); + + metis_reader* self; + + friend class metis_reader; + friend bool operator==(edge_iterator, edge_iterator); + friend bool operator!=(edge_iterator, edge_iterator); + }; + friend class edge_iterator; + + class edge_weight_iterator + { + public: + typedef std::input_iterator_tag iterator_category; + typedef edge_weight_type value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + + // Default copy constructor and assignment operator are okay + + reference operator*() const { return self->edge_weight; } + pointer operator->() const { return &self->edge_weight; } + + edge_weight_iterator& operator++() { return *this; } + edge_weight_iterator operator++(int) { return *this; } + + private: + edge_weight_iterator(metis_reader* self) : self(self) { } + + metis_reader* self; + + friend class metis_reader; + }; + + metis_reader(std::istream& in) : in(in), edge_weight(1.0) { start(); } + + edge_iterator begin(); + edge_iterator end(); + edge_weight_iterator weight_begin(); + + vertices_size_type num_vertices() const { return n_vertices; } + edges_size_type num_edges() const { return n_edges; } + + std::size_t num_vertex_weights() const { return n_vertex_weights; } + + vertex_weight_type vertex_weight(vertices_size_type v, std::size_t n) + { return vertex_weights[v*num_vertex_weights() + n]; } + + bool has_edge_weights() const { return edge_weights; } + + private: + void start(); + + // Configuration information + std::istream& in; + + // Information about the current METIS file + vertices_size_type n_vertices; + edges_size_type n_edges; + std::size_t n_vertex_weights; + bool edge_weights; + + // Information about the current edge/vertex + std::istringstream line_in; + std::pair<vertices_size_type, vertices_size_type> edge; + std::vector<vertex_weight_type> vertex_weights; + edge_weight_type edge_weight; + + friend bool operator==(edge_iterator, edge_iterator); + friend bool operator!=(edge_iterator, edge_iterator); +}; + +class metis_distribution +{ + public: + typedef int process_id_type; + typedef std::size_t size_type; + typedef std::vector<process_id_type>::iterator iterator; + + metis_distribution(std::istream& in, process_id_type my_id); + + size_type block_size(process_id_type id, size_type) const; + process_id_type operator()(size_type n) const { return vertices[n]; } + size_type local(size_type n) const; + size_type global(size_type n) const { return global(my_id, n); } + size_type global(process_id_type id, size_type n) const; + + iterator begin() { return vertices.begin(); } + iterator end() { return vertices.end(); } + + private: + std::istream& in; + process_id_type my_id; + std::vector<process_id_type> vertices; +}; + +#if !defined(BOOST_GRAPH_METIS_NO_INLINE) || defined(BOOST_GRAPH_METIS_SOURCE) +BOOST_GRAPH_METIS_INLINE_KEYWORD +bool operator==(metis_reader::edge_iterator x, metis_reader::edge_iterator y) +{ + return (x.self == y.self + || (x.self && x.self->edge.first == x.self->num_vertices()) + || (y.self && y.self->edge.first == y.self->num_vertices())); +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +bool operator!=(metis_reader::edge_iterator x, metis_reader::edge_iterator y) +{ + return !(x == y); +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +metis_reader::edge_iterator::edge_iterator(metis_reader* self) + : self(self) +{ + if (self) advance(true); +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +metis_reader::edge_iterator& metis_reader::edge_iterator::operator++() +{ + advance(false); + return *this; +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +void metis_reader::edge_iterator::advance(bool skip_initial_read) +{ + do { + + if (!skip_initial_read) { + // Try to read the next edge + if (self->line_in >> std::ws >> self->edge.second) { + --self->edge.second; + if (self->has_edge_weights()) { + if (!(self->line_in >> self->edge_weight)) + boost::throw_exception(metis_input_exception()); + } + return; + } + + // Check if we're done + ++self->edge.first; + if (self->edge.first == self->num_vertices()) + return; + } + + // Find the next line + std::string line; + while (getline(self->in, line) && !line.empty() && line[0] == '%') { + /* Keep reading lines in the loop header... */ + } + if (!self->in) boost::throw_exception(metis_input_exception()); + self->line_in.str(line); + self->line_in.clear(); + + // Read the next line + std::size_t weights_left = self->n_vertex_weights; + vertex_weight_type weight; + while (weights_left > 0) { + if (self->line_in >> weight) self->vertex_weights.push_back(weight); + else boost::throw_exception(metis_input_exception()); + --weights_left; + } + + // Successive iterations will pick up edges for this vertex. + skip_initial_read = false; + } while (true); +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +metis_reader::edge_iterator::postincrement_proxy +metis_reader::edge_iterator::operator++(int) +{ + postincrement_proxy result(**this); + ++(*this); + return result; +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +metis_reader::edge_iterator metis_reader::begin() +{ + if (edge.first != 0) start(); + return edge_iterator(this); +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +metis_reader::edge_iterator metis_reader::end() +{ + return edge_iterator(0); +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +metis_reader::edge_weight_iterator metis_reader::weight_begin() +{ + return edge_weight_iterator(this); +} + +BOOST_GRAPH_METIS_INLINE_KEYWORD +void metis_reader::start() +{ + in.seekg(0, std::ios::beg); + std::string line; + while (getline(in, line) && !line.empty() && line[0] == '%') { + /* Keep getting lines in loop header. */ + } + + if (!in || line.empty()) boost::throw_exception(metis_input_exception()); + + // Determine number of vertices and edges in the graph + line_in.str(line); + if (!(line_in >> n_vertices >> n_edges)) boost::throw_exception(metis_input_exception()); + + // Determine whether vertex or edge weights are included in the graph + int fmt = 0; + line_in >> fmt; + n_vertex_weights = fmt / 10; + edge_weights = (fmt % 10 == 1); + + // Determine how many (if any!) vertex weights are included + if (n_vertex_weights) line_in >> n_vertex_weights; + + // Setup the iteration data structures + edge_weight = 1.0; + edge.first = 0; + edge.second = 0; + vertex_weights.reserve(n_vertex_weights * num_vertices()); +} + +metis_distribution::metis_distribution(std::istream& in, process_id_type my_id) + : in(in), my_id(my_id), + vertices(std::istream_iterator<process_id_type>(in), + std::istream_iterator<process_id_type>()) +{ +} + + +metis_distribution::size_type +metis_distribution::block_size(process_id_type id, size_type) const +{ + return std::count(vertices.begin(), vertices.end(), id); +} + +metis_distribution::size_type metis_distribution::local(size_type n) const +{ + return std::count(vertices.begin(), vertices.begin() + n, vertices[n]); +} + +metis_distribution::size_type +metis_distribution::global(process_id_type id, size_type n) const +{ + std::vector<process_id_type>::const_iterator i = vertices.begin(); + while (*i != id) ++i; + + while (n > 0) { + do { ++i; } while (*i != id); + --n; + } + + return i - vertices.begin(); +} + +#endif + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_METIS_HPP diff --git a/Utilities/BGL/boost/graph/metric_tsp_approx.hpp b/Utilities/BGL/boost/graph/metric_tsp_approx.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7c18b8e026081c60bf9910271d8d937d5a8b1b32 --- /dev/null +++ b/Utilities/BGL/boost/graph/metric_tsp_approx.hpp @@ -0,0 +1,314 @@ + +//======================================================================= +// Copyright 2008 +// Author: Matyas W Egyhazy +// +// 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_METRIC_TSP_APPROX_HPP +#define BOOST_GRAPH_METRIC_TSP_APPROX_HPP + +// metric_tsp_approx +// Generates an approximate tour solution for the traveling salesperson +// problem in polynomial time. The current algorithm guarantees a tour with a +// length at most as long as 2x optimal solution. The graph should have +// 'natural' (metric) weights such that the triangle inequality is maintained. +// Graphs must be fully interconnected. + +// TODO: +// There are a couple of improvements that could be made. +// 1) Change implementation to lower uppper bound Christofides heuristic +// 2) Implement a less restrictive TSP heuristic (one that does not rely on +// triangle inequality). +// 3) Determine if the algorithm can be implemented without creating a new +// graph. + +#include <vector> + +#include <boost/shared_ptr.hpp> +#include <boost/concept_check.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_as_tree.hpp> +#include <boost/graph/adjacency_list.hpp> +#include <boost/graph/prim_minimum_spanning_tree.hpp> +#include <boost/graph/lookup_edge.hpp> + + +namespace boost +{ + // Define a concept for the concept-checking library. + template <typename Visitor, typename Graph> + struct TSPVertexVisitorConcept + { + private: + Visitor vis_; + public: + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + + BOOST_CONCEPT_USAGE(TSPVertexVisitorConcept) + { + Visitor vis(vis_); // require copy construction + Graph g(1); + Vertex v(*vertices(g).first); + vis_.visit_vertex(v, g); // require visit_vertex + } + }; + + // Tree visitor that keeps track of a preorder traversal of a tree + // TODO: Consider migrating this to the graph_as_tree header. + // TODO: Parameterize the underlying stores o it doesn't have to be a vector. + template<typename Node, typename Tree> class PreorderTraverser + { + private: + std::vector<Node>& path_; + public: + typedef typename std::vector<Node>::const_iterator const_iterator; + + PreorderTraverser(std::vector<Node>& p) : path_(p) {} + + void preorder(Node n, const Tree&) + { path_.push_back(n); } + + void inorder(Node, const Tree&) const {} + void postorder(Node, const Tree&) const {} + + const_iterator begin() const { return path_.begin(); } + const_iterator end() const { return path_.end(); } + }; + + // Forward declarations + template <typename> class tsp_tour_visitor; + template <typename, typename, typename, typename> class tsp_tour_len_visitor; + + template<typename VertexListGraph, typename OutputIterator> + void metric_tsp_approx_tour(VertexListGraph& g, OutputIterator o) + { + metric_tsp_approx_from_vertex(g, *vertices(g).first, + get(edge_weight, g), get(vertex_index, g), + tsp_tour_visitor<OutputIterator>(o)); + } + + template<typename VertexListGraph, typename WeightMap, typename OutputIterator> + void metric_tsp_approx_tour(VertexListGraph& g, WeightMap w, OutputIterator o) + { + metric_tsp_approx_from_vertex(g, *vertices(g).first, + w, tsp_tour_visitor<OutputIterator>(o)); + } + + template<typename VertexListGraph, typename OutputIterator> + void metric_tsp_approx_tour_from_vertex(VertexListGraph& g, + typename graph_traits<VertexListGraph>::vertex_descriptor start, + OutputIterator o) + { + metric_tsp_approx_from_vertex(g, start, get(edge_weight, g), + get(vertex_index, g), tsp_tour_visitor<OutputIterator>(o)); + } + + template<typename VertexListGraph, typename WeightMap, + typename OutputIterator> + void metric_tsp_approx_tour_from_vertex(VertexListGraph& g, + typename graph_traits<VertexListGraph>::vertex_descriptor start, + WeightMap w, OutputIterator o) + { + metric_tsp_approx_from_vertex(g, start, w, get(vertex_index, g), + tsp_tour_visitor<OutputIterator>(o)); + } + + template<typename VertexListGraph, typename TSPVertexVisitor> + void metric_tsp_approx(VertexListGraph& g, TSPVertexVisitor vis) + { + metric_tsp_approx_from_vertex(g, *vertices(g).first, + get(edge_weight, g), get(vertex_index, g), vis); + } + + template<typename VertexListGraph, typename Weightmap, + typename VertexIndexMap, typename TSPVertexVisitor> + void metric_tsp_approx(VertexListGraph& g, Weightmap w, + TSPVertexVisitor vis) + { + metric_tsp_approx_from_vertex(g, *vertices(g).first, w, + get(vertex_index, g), vis); + } + + template<typename VertexListGraph, typename WeightMap, + typename VertexIndexMap, typename TSPVertexVisitor> + void metric_tsp_approx(VertexListGraph& g, WeightMap w, VertexIndexMap id, + TSPVertexVisitor vis) + { + metric_tsp_approx_from_vertex(g, *vertices(g).first, w, id, vis); + } + + template<typename VertexListGraph, typename WeightMap, + typename TSPVertexVisitor> + void metric_tsp_approx_from_vertex(VertexListGraph& g, + typename graph_traits<VertexListGraph>::vertex_descriptor start, + WeightMap w, TSPVertexVisitor vis) + { + metric_tsp_approx_from_vertex(g, start, w, get(vertex_index, g), vis); + } + + template < + typename VertexListGraph, + typename WeightMap, + typename VertexIndexMap, + typename TSPVertexVisitor> + void metric_tsp_approx_from_vertex(const VertexListGraph& g, + typename graph_traits<VertexListGraph>::vertex_descriptor start, + WeightMap weightmap, + VertexIndexMap indexmap, + TSPVertexVisitor vis) + { + using namespace boost; + using namespace std; + + BOOST_CONCEPT_ASSERT((VertexListGraphConcept<VertexListGraph>)); + BOOST_CONCEPT_ASSERT((TSPVertexVisitorConcept<TSPVertexVisitor, VertexListGraph>)); + + // Types related to the input graph (GVertex is a template parameter). + typedef typename graph_traits<VertexListGraph>::vertex_descriptor GVertex; + typedef typename graph_traits<VertexListGraph>::vertex_iterator GVItr; + + // We build a custom graph in this algorithm. + typedef adjacency_list <vecS, vecS, directedS, no_property, no_property > MSTImpl; + typedef graph_traits<MSTImpl>::edge_descriptor Edge; + typedef graph_traits<MSTImpl>::vertex_descriptor Vertex; + typedef graph_traits<MSTImpl>::vertex_iterator VItr; + + // And then re-cast it as a tree. + typedef iterator_property_map<vector<Vertex>::iterator, property_map<MSTImpl, vertex_index_t>::type> ParentMap; + typedef graph_as_tree<MSTImpl, ParentMap> Tree; + typedef tree_traits<Tree>::node_descriptor Node; + + // A predecessor map. + typedef vector<GVertex> PredMap; + typedef iterator_property_map<typename PredMap::iterator, VertexIndexMap> PredPMap; + + PredMap preds(num_vertices(g)); + PredPMap pred_pmap(preds.begin(), indexmap); + + // Compute a spanning tree over the in put g. + prim_minimum_spanning_tree(g, pred_pmap, + root_vertex(start) + .vertex_index_map(indexmap) + .weight_map(weightmap)); + + // Build a MST using the predecessor map from prim mst + MSTImpl mst(num_vertices(g)); + std::size_t cnt = 0; + pair<VItr, VItr> mst_verts(vertices(mst)); + for(typename PredMap::iterator vi(preds.begin()); vi != preds.end(); ++vi, ++cnt) + { + if(indexmap[*vi] != cnt) { + add_edge(*next(mst_verts.first, indexmap[*vi]), + *next(mst_verts.first, cnt), mst); + } + } + + // Build a tree abstraction over the MST. + vector<Vertex> parent(num_vertices(mst)); + Tree t(mst, *vertices(mst).first, + make_iterator_property_map(parent.begin(), + get(vertex_index, mst))); + + // Create tour using a preorder traversal of the mst + vector<Node> tour; + PreorderTraverser<Node, Tree> tvis(tour); + traverse_tree(0, t, tvis); + + pair<GVItr, GVItr> g_verts(vertices(g)); + for(PreorderTraverser<Node, Tree>::const_iterator curr(tvis.begin()); + curr != tvis.end(); ++curr) + { + // TODO: This is will be O(n^2) if vertex storage of g != vecS. + GVertex v = *next(g_verts.first, get(vertex_index, mst)[*curr]); + vis.visit_vertex(v, g); + } + + // Connect back to the start of the tour + vis.visit_vertex(*g_verts.first, g); + } + + // Default tsp tour visitor that puts the tour in an OutputIterator + template <typename OutItr> + class tsp_tour_visitor + { + OutItr itr_; + public: + tsp_tour_visitor(OutItr itr) + : itr_(itr) + { } + + template <typename Vertex, typename Graph> + void visit_vertex(Vertex v, const Graph&) + { + BOOST_CONCEPT_ASSERT((OutputIterator<OutItr, Vertex>)); + *itr_++ = v; + } + + }; + + // Tsp tour visitor that adds the total tour length. + template<typename Graph, typename WeightMap, typename OutIter, typename Length> + class tsp_tour_len_visitor + { + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + BOOST_CONCEPT_ASSERT((OutputIterator<OutIter, Vertex>)); + + OutIter iter_; + Length& tourlen_; + WeightMap& wmap_; + Vertex previous_; + + // Helper function for getting the null vertex. + Vertex null() + { return graph_traits<Graph>::null_vertex(); } + + public: + tsp_tour_len_visitor(Graph const&, OutIter iter, Length& l, WeightMap map) + : iter_(iter), tourlen_(l), wmap_(map), previous_(null()) + { } + + void visit_vertex(Vertex v, const Graph& g) + { + typedef typename graph_traits<Graph>::edge_descriptor Edge; + + // If it is not the start, then there is a + // previous vertex + if(previous_ != null()) + { + // NOTE: For non-adjacency matrix graphs g, this bit of code + // will be linear in the degree of previous_ or v. A better + // solution would be to visit edges of the graph, but that + // would require revisiting the core algorithm. + Edge e; + bool found; + tie(e, found) = lookup_edge(previous_, v, g); + if(!found) { + throw not_complete(); + } + + tourlen_ += wmap_[e]; + } + + previous_ = v; + *iter_++ = v; + } + }; + + // Object generator(s) + template <typename OutIter> + inline tsp_tour_visitor<OutIter> + make_tsp_tour_visitor(OutIter iter) + { return tsp_tour_visitor<OutIter>(iter); } + + template <typename Graph, typename WeightMap, typename OutIter, typename Length> + inline tsp_tour_len_visitor<Graph, WeightMap, OutIter, Length> + make_tsp_tour_len_visitor(Graph const& g, OutIter iter, Length& l, WeightMap map) + { return tsp_tour_len_visitor<Graph, WeightMap, OutIter, Length>(g, iter, l, map); } + +} //boost + +#endif // BOOST_GRAPH_METRIC_TSP_APPROX_HPP diff --git a/Utilities/BGL/boost/graph/minimum_degree_ordering.hpp b/Utilities/BGL/boost/graph/minimum_degree_ordering.hpp index 6aa242dcc58f9f7a1604f1001604c77b2707f60b..39c3dcfb53c9c92d69976c4a67b58c72053d8bb8 100644 --- a/Utilities/BGL/boost/graph/minimum_degree_ordering.hpp +++ b/Utilities/BGL/boost/graph/minimum_degree_ordering.hpp @@ -17,7 +17,7 @@ #include <boost/pending/bucket_sorter.hpp> #include <boost/detail/numeric_traits.hpp> // for integer_traits #include <boost/graph/graph_traits.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> namespace boost { diff --git a/Utilities/BGL/boost/graph/named_function_params.hpp b/Utilities/BGL/boost/graph/named_function_params.hpp index 2cb37c31f627edfe1620f7f5e33c0b168663aef8..42c5ef87d03ea297d0ca7441e17ed94154732e18 100644 --- a/Utilities/BGL/boost/graph/named_function_params.hpp +++ b/Utilities/BGL/boost/graph/named_function_params.hpp @@ -11,6 +11,15 @@ #define BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP #include <boost/graph/properties.hpp> +#include <boost/ref.hpp> +#include <boost/parameter/name.hpp> +#include <boost/parameter/binding.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/mpl/not.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/graph/named_function_params.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/property_map/shared_array_property_map.hpp> namespace boost { @@ -29,6 +38,9 @@ namespace boost { struct vertex_max_invariant_t { }; struct orig_to_copy_t { }; struct root_vertex_t { }; + struct polling_t { }; + struct lookahead_t { }; + struct in_parallel_t { }; struct attractive_force_t { }; struct repulsive_force_t { }; struct force_pairs_t { }; @@ -37,14 +49,56 @@ namespace boost { struct iterations_t { }; struct diameter_range_t { }; struct learning_constant_range_t { }; - - namespace detail { - template <class T> - struct wrap_ref { - wrap_ref(T& r) : ref(r) {} - T& ref; - }; - } + struct vertices_equivalent_t { }; + struct edges_equivalent_t { }; + +#define BOOST_BGL_DECLARE_NAMED_PARAMS \ + BOOST_BGL_ONE_PARAM_CREF(weight_map, edge_weight) \ + BOOST_BGL_ONE_PARAM_CREF(weight_map2, edge_weight2) \ + BOOST_BGL_ONE_PARAM_CREF(distance_map, vertex_distance) \ + BOOST_BGL_ONE_PARAM_CREF(predecessor_map, vertex_predecessor) \ + BOOST_BGL_ONE_PARAM_CREF(rank_map, vertex_rank) \ + BOOST_BGL_ONE_PARAM_CREF(root_map, vertex_root) \ + BOOST_BGL_ONE_PARAM_CREF(root_vertex, root_vertex) \ + BOOST_BGL_ONE_PARAM_CREF(edge_centrality_map, edge_centrality) \ + BOOST_BGL_ONE_PARAM_CREF(centrality_map, vertex_centrality) \ + BOOST_BGL_ONE_PARAM_CREF(color_map, vertex_color) \ + BOOST_BGL_ONE_PARAM_CREF(edge_color_map, edge_color) \ + BOOST_BGL_ONE_PARAM_CREF(capacity_map, edge_capacity) \ + BOOST_BGL_ONE_PARAM_CREF(residual_capacity_map, edge_residual_capacity) \ + BOOST_BGL_ONE_PARAM_CREF(reverse_edge_map, edge_reverse) \ + BOOST_BGL_ONE_PARAM_CREF(discover_time_map, vertex_discover_time) \ + BOOST_BGL_ONE_PARAM_CREF(lowpoint_map, vertex_lowpoint) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_index_map, vertex_index) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_index1_map, vertex_index1) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_index2_map, vertex_index2) \ + BOOST_BGL_ONE_PARAM_CREF(visitor, graph_visitor) \ + BOOST_BGL_ONE_PARAM_CREF(distance_compare, distance_compare) \ + BOOST_BGL_ONE_PARAM_CREF(distance_combine, distance_combine) \ + BOOST_BGL_ONE_PARAM_CREF(distance_inf, distance_inf) \ + BOOST_BGL_ONE_PARAM_CREF(distance_zero, distance_zero) \ + BOOST_BGL_ONE_PARAM_CREF(edge_copy, edge_copy) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_copy, vertex_copy) \ + BOOST_BGL_ONE_PARAM_REF(buffer, buffer_param) \ + BOOST_BGL_ONE_PARAM_CREF(orig_to_copy, orig_to_copy) \ + BOOST_BGL_ONE_PARAM_CREF(isomorphism_map, vertex_isomorphism) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_invariant, vertex_invariant) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_invariant1, vertex_invariant1) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_invariant2, vertex_invariant2) \ + BOOST_BGL_ONE_PARAM_CREF(vertex_max_invariant, vertex_max_invariant) \ + BOOST_BGL_ONE_PARAM_CREF(polling, polling) \ + BOOST_BGL_ONE_PARAM_CREF(lookahead, lookahead) \ + BOOST_BGL_ONE_PARAM_CREF(in_parallel, in_parallel) \ + BOOST_BGL_ONE_PARAM_CREF(displacement_map, vertex_displacement) \ + BOOST_BGL_ONE_PARAM_CREF(attractive_force, attractive_force) \ + BOOST_BGL_ONE_PARAM_CREF(repulsive_force, repulsive_force) \ + BOOST_BGL_ONE_PARAM_CREF(force_pairs, force_pairs) \ + BOOST_BGL_ONE_PARAM_CREF(cooling, cooling) \ + BOOST_BGL_ONE_PARAM_CREF(iterations, iterations) \ + BOOST_BGL_ONE_PARAM_CREF(diameter_range, diameter_range) \ + BOOST_BGL_ONE_PARAM_CREF(learning_constant_range, learning_constant_range) \ + BOOST_BGL_ONE_PARAM_CREF(vertices_equivalent, vertices_equivalent) \ + BOOST_BGL_ONE_PARAM_CREF(edges_equivalent, edges_equivalent) template <typename T, typename Tag, typename Base = no_property> struct bgl_named_params : public Base @@ -53,541 +107,67 @@ namespace boost { typedef Base next_type; typedef Tag tag_type; typedef T value_type; - bgl_named_params(T v) : m_value(v) { } + bgl_named_params(T v = T()) : m_value(v) { } bgl_named_params(T v, const Base& b) : Base(b), m_value(v) { } T m_value; - template <typename WeightMap> - bgl_named_params<WeightMap, edge_weight_t, self> - weight_map(const WeightMap& pmap) const { - typedef bgl_named_params<WeightMap, edge_weight_t, self> Params; - return Params(pmap, *this); - } - - template <typename WeightMap> - bgl_named_params<WeightMap, edge_weight2_t, self> - weight_map2(const WeightMap& pmap) const { - typedef bgl_named_params<WeightMap, edge_weight2_t, self> Params; - return Params(pmap, *this); - } - - template <typename DistanceMap> - bgl_named_params<DistanceMap, vertex_distance_t, self> - distance_map(const DistanceMap& pmap) const { - typedef bgl_named_params<DistanceMap, vertex_distance_t, self> Params; - return Params(pmap, *this); - } - - template <typename PredecessorMap> - bgl_named_params<PredecessorMap, vertex_predecessor_t, self> - predecessor_map(const PredecessorMap& pmap) const { - typedef bgl_named_params<PredecessorMap, vertex_predecessor_t, self> - Params; - return Params(pmap, *this); - } - - template <typename RankMap> - bgl_named_params<RankMap, vertex_rank_t, self> - rank_map(const RankMap& pmap) const { - typedef bgl_named_params<RankMap, vertex_rank_t, self> - Params; - return Params(pmap, *this); - } - - template <typename RootMap> - bgl_named_params<RootMap, vertex_root_t, self> - root_map(const RootMap& pmap) const { - typedef bgl_named_params<RootMap, vertex_root_t, self> - Params; - return Params(pmap, *this); - } - - template <typename Vertex> - bgl_named_params<Vertex, root_vertex_t, self> - root_vertex(const Vertex& r) const { - typedef bgl_named_params<Vertex, root_vertex_t, self> Params; - return Params(r, *this); - } - - template <typename EdgeCentralityMap> - bgl_named_params<EdgeCentralityMap, edge_centrality_t, self> - edge_centrality_map(const EdgeCentralityMap& r) const { - typedef bgl_named_params<EdgeCentralityMap, edge_centrality_t, self> Params; - return Params(r, *this); - } - - template <typename CentralityMap> - bgl_named_params<CentralityMap, vertex_centrality_t, self> - centrality_map(const CentralityMap& r) const { - typedef bgl_named_params<CentralityMap, vertex_centrality_t, self> Params; - return Params(r, *this); - } - - template <typename ColorMap> - bgl_named_params<ColorMap, vertex_color_t, self> - color_map(const ColorMap& pmap) const { - typedef bgl_named_params<ColorMap, vertex_color_t, self> Params; - return Params(pmap, *this); - } - - template <typename ColorMap> - bgl_named_params<ColorMap, vertex_color_t, self> - vertex_color_map(const ColorMap& pmap) const { - typedef bgl_named_params<ColorMap, vertex_color_t, self> Params; - return Params(pmap, *this); - } - - template <typename ColorMap> - bgl_named_params<ColorMap, edge_color_t, self> - edge_color_map(const ColorMap& pmap) const { - typedef bgl_named_params<ColorMap, edge_color_t, self> Params; - return Params(pmap, *this); - } - - template <typename CapacityMap> - bgl_named_params<CapacityMap, edge_capacity_t, self> - capacity_map(CapacityMap pmap) { - typedef bgl_named_params<CapacityMap, edge_capacity_t, self> Params; - return Params(pmap, *this); - } - - template <typename Residual_CapacityMap> - bgl_named_params<Residual_CapacityMap, edge_residual_capacity_t, self> - residual_capacity_map(Residual_CapacityMap pmap) { - typedef bgl_named_params<Residual_CapacityMap, - edge_residual_capacity_t, self> - Params; - return Params(pmap, *this); - } - - template <typename ReverseMap> - bgl_named_params<ReverseMap, edge_reverse_t, self> - reverse_edge_map(ReverseMap pmap) { - typedef bgl_named_params<ReverseMap, - edge_reverse_t, self> - Params; - return Params(pmap, *this); - } - - template <typename DiscoverTimeMap> - bgl_named_params<DiscoverTimeMap, vertex_discover_time_t, self> - discover_time_map(const DiscoverTimeMap& pmap) const { - typedef bgl_named_params<DiscoverTimeMap, vertex_discover_time_t, self> - Params; - return Params(pmap, *this); - } - - template <typename IndexMap> - bgl_named_params<IndexMap, vertex_index_t, self> - vertex_index_map(const IndexMap& pmap) const { - typedef bgl_named_params<IndexMap, vertex_index_t, self> Params; - return Params(pmap, *this); - } - - template <typename IndexMap> - bgl_named_params<IndexMap, vertex_index1_t, self> - vertex_index1_map(const IndexMap& pmap) const { - typedef bgl_named_params<IndexMap, vertex_index1_t, self> Params; - return Params(pmap, *this); - } - - template <typename IndexMap> - bgl_named_params<IndexMap, vertex_index2_t, self> - vertex_index2_map(const IndexMap& pmap) const { - typedef bgl_named_params<IndexMap, vertex_index2_t, self> Params; - return Params(pmap, *this); - } - - template <typename Visitor> - bgl_named_params<Visitor, graph_visitor_t, self> - visitor(const Visitor& vis) const { - typedef bgl_named_params<Visitor, graph_visitor_t, self> Params; - return Params(vis, *this); - } - - template <typename Compare> - bgl_named_params<Compare, distance_compare_t, self> - distance_compare(Compare cmp) const { - typedef bgl_named_params<Compare, distance_compare_t, self> Params; - return Params(cmp, *this); - } - - template <typename Combine> - bgl_named_params<Combine, distance_combine_t, self> - distance_combine(Combine cmb) const { - typedef bgl_named_params<Combine, distance_combine_t, self> Params; - return Params(cmb, *this); - } - - template <typename Init> - bgl_named_params<Init, distance_inf_t, self> - distance_inf(Init init) const { - typedef bgl_named_params<Init, distance_inf_t, self> Params; - return Params(init, *this); - } - - template <typename Init> - bgl_named_params<Init, distance_zero_t, self> - distance_zero(Init init) const { - typedef bgl_named_params<Init, distance_zero_t, self> Params; - return Params(init, *this); - } - - template <typename Buffer> - bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t, self> - buffer(Buffer& b) const { - typedef bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t, self> - Params; - return Params(detail::wrap_ref<Buffer>(b), *this); - } - - template <typename Copier> - bgl_named_params<Copier, edge_copy_t, self> - edge_copy(const Copier& c) const { - typedef bgl_named_params<Copier, edge_copy_t, self> Params; - return Params(c, *this); - } - - template <typename Copier> - bgl_named_params<Copier, vertex_copy_t, self> - vertex_copy(const Copier& c) const { - typedef bgl_named_params<Copier, vertex_copy_t, self> Params; - return Params(c, *this); - } - - template <typename Orig2CopyMap> - bgl_named_params<Orig2CopyMap, orig_to_copy_t, self> - orig_to_copy(const Orig2CopyMap& c) const { - typedef bgl_named_params<Orig2CopyMap, orig_to_copy_t, self> Params; - return Params(c, *this); - } - - template <typename IsoMap> - bgl_named_params<IsoMap, vertex_isomorphism_t, self> - isomorphism_map(const IsoMap& c) const { - typedef bgl_named_params<IsoMap, vertex_isomorphism_t, self> Params; - return Params(c, *this); - } - - template <typename VertexInvar> - bgl_named_params<VertexInvar, vertex_invariant_t, self> - vertex_invariant(const VertexInvar& c) const { - typedef bgl_named_params<VertexInvar, vertex_invariant_t, self> Params; - return Params(c, *this); - } - - template <typename VertexDisplacement> - bgl_named_params<VertexDisplacement, vertex_displacement_t, self> - displacement_map(const VertexDisplacement& c) const { - typedef bgl_named_params<VertexDisplacement, vertex_displacement_t, self> Params; - return Params(c, *this); - } - - template <typename AttractiveForce> - bgl_named_params<AttractiveForce, attractive_force_t, self> - attractive_force(const AttractiveForce& c) { - typedef bgl_named_params<AttractiveForce, attractive_force_t, self> Params; - return Params(c, *this); - } - - template <typename RepulsiveForce> - bgl_named_params<RepulsiveForce, repulsive_force_t, self> - repulsive_force(const RepulsiveForce& c) { - typedef bgl_named_params<RepulsiveForce, repulsive_force_t, self> Params; - return Params(c, *this); - } - - template <typename ForcePairs> - bgl_named_params<ForcePairs, force_pairs_t, self> - force_pairs(const ForcePairs& c) { - typedef bgl_named_params<ForcePairs, force_pairs_t, self> Params; - return Params(c, *this); - } - - template <typename Cooling> - bgl_named_params<Cooling, cooling_t, self> - cooling(const Cooling& c) { - typedef bgl_named_params<Cooling, cooling_t, self> Params; - return Params(c, *this); - } - - template <typename TP> - bgl_named_params<TP, iterations_t, self> - iterations(const TP& c) { - typedef bgl_named_params<TP, iterations_t, self> Params; - return Params(c, *this); - } - - template<typename TP> - bgl_named_params<std::pair<TP, TP>, diameter_range_t, self> - diameter_range(const std::pair<TP, TP>& c) { - typedef bgl_named_params<std::pair<TP, TP>, diameter_range_t, self> Params; - return Params(c, *this); - } - - template<typename TP> - bgl_named_params<std::pair<TP, TP>, learning_constant_range_t, self> - learning_constant_range(const std::pair<TP, TP>& c) { - typedef bgl_named_params<std::pair<TP, TP>, learning_constant_range_t, self> - Params; - return Params(c, *this); - } +#define BOOST_BGL_ONE_PARAM_REF(name, key) \ + template <typename PType> \ + bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t), self> \ + name(PType& p) const { \ + typedef bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t), self> Params; \ + return Params(boost::ref(p), *this); \ + } \ + +#define BOOST_BGL_ONE_PARAM_CREF(name, key) \ + template <typename PType> \ + bgl_named_params<PType, BOOST_PP_CAT(key, _t), self> \ + name(const PType& p) const { \ + typedef bgl_named_params<PType, BOOST_PP_CAT(key, _t), self> Params; \ + return Params(p, *this); \ + } \ + +BOOST_BGL_DECLARE_NAMED_PARAMS + +#undef BOOST_BGL_ONE_PARAM_REF +#undef BOOST_BGL_ONE_PARAM_CREF + + // Duplicate + template <typename PType> + bgl_named_params<PType, vertex_color_t, self> + vertex_color_map(const PType& p) const {return this->color_map(p);} }; - template <typename WeightMap> - bgl_named_params<WeightMap, edge_weight_t> - weight_map(WeightMap pmap) { - typedef bgl_named_params<WeightMap, edge_weight_t> Params; - return Params(pmap); - } - - template <typename WeightMap> - bgl_named_params<WeightMap, edge_weight2_t> - weight_map2(WeightMap pmap) { - typedef bgl_named_params<WeightMap, edge_weight2_t> Params; - return Params(pmap); - } - - template <typename DistanceMap> - bgl_named_params<DistanceMap, vertex_distance_t> - distance_map(DistanceMap pmap) { - typedef bgl_named_params<DistanceMap, vertex_distance_t> Params; - return Params(pmap); - } - - template <typename PredecessorMap> - bgl_named_params<PredecessorMap, vertex_predecessor_t> - predecessor_map(PredecessorMap pmap) { - typedef bgl_named_params<PredecessorMap, vertex_predecessor_t> Params; - return Params(pmap); - } - - template <typename RankMap> - bgl_named_params<RankMap, vertex_rank_t> - rank_map(RankMap pmap) { - typedef bgl_named_params<RankMap, vertex_rank_t> Params; - return Params(pmap); - } - - template <typename RootMap> - bgl_named_params<RootMap, vertex_root_t> - root_map(RootMap pmap) { - typedef bgl_named_params<RootMap, vertex_root_t> Params; - return Params(pmap); - } - - template <typename Vertex> - bgl_named_params<Vertex, root_vertex_t> - root_vertex(const Vertex& r) { - typedef bgl_named_params<Vertex, root_vertex_t> Params; - return Params(r); - } - - template <typename EdgeCentralityMap> - bgl_named_params<EdgeCentralityMap, edge_centrality_t> - edge_centrality_map(const EdgeCentralityMap& r) { - typedef bgl_named_params<EdgeCentralityMap, edge_centrality_t> Params; - return Params(r); - } - - template <typename CentralityMap> - bgl_named_params<CentralityMap, vertex_centrality_t> - centrality_map(const CentralityMap& r) { - typedef bgl_named_params<CentralityMap, vertex_centrality_t> Params; - return Params(r); - } - - template <typename ColorMap> - bgl_named_params<ColorMap, vertex_color_t> - color_map(ColorMap pmap) { - typedef bgl_named_params<ColorMap, vertex_color_t> Params; - return Params(pmap); - } - - template <typename CapacityMap> - bgl_named_params<CapacityMap, edge_capacity_t> - capacity_map(CapacityMap pmap) { - typedef bgl_named_params<CapacityMap, edge_capacity_t> Params; - return Params(pmap); - } - - template <typename Residual_CapacityMap> - bgl_named_params<Residual_CapacityMap, edge_residual_capacity_t> - residual_capacity_map(Residual_CapacityMap pmap) { - typedef bgl_named_params<Residual_CapacityMap, edge_residual_capacity_t> - Params; - return Params(pmap); - } - - template <typename ReverseMap> - bgl_named_params<ReverseMap, edge_reverse_t> - reverse_edge_map(ReverseMap pmap) { - typedef bgl_named_params<ReverseMap, edge_reverse_t> - Params; - return Params(pmap); - } - - template <typename DiscoverTimeMap> - bgl_named_params<DiscoverTimeMap, vertex_discover_time_t> - discover_time_map(DiscoverTimeMap pmap) { - typedef bgl_named_params<DiscoverTimeMap, vertex_discover_time_t> Params; - return Params(pmap); - } - - template <typename IndexMap> - bgl_named_params<IndexMap, vertex_index_t> - vertex_index_map(IndexMap pmap) { - typedef bgl_named_params<IndexMap, vertex_index_t> Params; - return Params(pmap); - } - - template <typename IndexMap> - bgl_named_params<IndexMap, vertex_index1_t> - vertex_index1_map(const IndexMap& pmap) { - typedef bgl_named_params<IndexMap, vertex_index1_t> Params; - return Params(pmap); - } - - template <typename IndexMap> - bgl_named_params<IndexMap, vertex_index2_t> - vertex_index2_map(const IndexMap& pmap) { - typedef bgl_named_params<IndexMap, vertex_index2_t> Params; - return Params(pmap); - } - - template <typename Visitor> - bgl_named_params<Visitor, graph_visitor_t> - visitor(const Visitor& vis) { - typedef bgl_named_params<Visitor, graph_visitor_t> Params; - return Params(vis); - } - - template <typename Compare> - bgl_named_params<Compare, distance_compare_t> - distance_compare(Compare cmp) { - typedef bgl_named_params<Compare, distance_compare_t> Params; - return Params(cmp); - } - - template <typename Combine> - bgl_named_params<Combine, distance_combine_t> - distance_combine(Combine cmb) { - typedef bgl_named_params<Combine, distance_combine_t> Params; - return Params(cmb); - } - - template <typename Init> - bgl_named_params<Init, distance_inf_t> - distance_inf(Init init) { - typedef bgl_named_params<Init, distance_inf_t> Params; - return Params(init); - } - - template <typename Init> - bgl_named_params<Init, distance_zero_t> - distance_zero(Init init) { - typedef bgl_named_params<Init, distance_zero_t> Params; - return Params(init); - } - - template <typename Buffer> - bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t> - buffer(Buffer& b) { - typedef bgl_named_params<detail::wrap_ref<Buffer>, buffer_param_t> Params; - return Params(detail::wrap_ref<Buffer>(b)); - } - - template <typename Copier> - bgl_named_params<Copier, edge_copy_t> - edge_copy(const Copier& c) { - typedef bgl_named_params<Copier, edge_copy_t> Params; - return Params(c); - } - - template <typename Copier> - bgl_named_params<Copier, vertex_copy_t> - vertex_copy(const Copier& c) { - typedef bgl_named_params<Copier, vertex_copy_t> Params; - return Params(c); - } - - template <typename Orig2CopyMap> - bgl_named_params<Orig2CopyMap, orig_to_copy_t> - orig_to_copy(const Orig2CopyMap& c) { - typedef bgl_named_params<Orig2CopyMap, orig_to_copy_t> Params; - return Params(c); - } - - template <typename IsoMap> - bgl_named_params<IsoMap, vertex_isomorphism_t> - isomorphism_map(const IsoMap& c) { - typedef bgl_named_params<IsoMap, vertex_isomorphism_t> Params; - return Params(c); - } - - template <typename VertexInvar> - bgl_named_params<VertexInvar, vertex_invariant_t> - vertex_invariant(const VertexInvar& c) { - typedef bgl_named_params<VertexInvar, vertex_invariant_t> Params; - return Params(c); - } - - template <typename VertexDisplacement> - bgl_named_params<VertexDisplacement, vertex_displacement_t> - displacement_map(const VertexDisplacement& c) { - typedef bgl_named_params<VertexDisplacement, vertex_displacement_t> Params; - return Params(c); - } +#define BOOST_BGL_ONE_PARAM_REF(name, key) \ + template <typename PType> \ + bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t)> \ + name(PType& p) { \ + typedef bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t)> Params; \ + return Params(boost::ref(p)); \ + } \ - template <typename AttractiveForce> - bgl_named_params<AttractiveForce, attractive_force_t> - attractive_force(const AttractiveForce& c) { - typedef bgl_named_params<AttractiveForce, attractive_force_t> Params; - return Params(c); - } +#define BOOST_BGL_ONE_PARAM_CREF(name, key) \ + template <typename PType> \ + bgl_named_params<PType, BOOST_PP_CAT(key, _t)> \ + name(const PType& p) { \ + typedef bgl_named_params<PType, BOOST_PP_CAT(key, _t)> Params; \ + return Params(p); \ + } \ - template <typename RepulsiveForce> - bgl_named_params<RepulsiveForce, repulsive_force_t> - repulsive_force(const RepulsiveForce& c) { - typedef bgl_named_params<RepulsiveForce, repulsive_force_t> Params; - return Params(c); - } +BOOST_BGL_DECLARE_NAMED_PARAMS - template <typename ForcePairs> - bgl_named_params<ForcePairs, force_pairs_t> - force_pairs(const ForcePairs& c) { - typedef bgl_named_params<ForcePairs, force_pairs_t> Params; - return Params(c); - } +#undef BOOST_BGL_ONE_PARAM_REF +#undef BOOST_BGL_ONE_PARAM_CREF - template <typename Cooling> - bgl_named_params<Cooling, cooling_t> - cooling(const Cooling& c) { - typedef bgl_named_params<Cooling, cooling_t> Params; - return Params(c); - } + // Duplicate + template <typename PType> + bgl_named_params<PType, vertex_color_t> + vertex_color_map(const PType& p) {return color_map(p);} - template <typename T> - bgl_named_params<T, iterations_t> - iterations(const T& c) { - typedef bgl_named_params<T, iterations_t> Params; - return Params(c); - } - - template<typename T> - bgl_named_params<std::pair<T, T>, diameter_range_t> - diameter_range(const std::pair<T, T>& c) { - typedef bgl_named_params<std::pair<T, T>, diameter_range_t> Params; - return Params(c); - } - - template<typename T> - bgl_named_params<std::pair<T, T>, learning_constant_range_t> - learning_constant_range(const std::pair<T, T>& c) { - typedef bgl_named_params<std::pair<T, T>, learning_constant_range_t> - Params; - return Params(c); + namespace detail { + struct unused_tag_type {}; } + typedef bgl_named_params<char, detail::unused_tag_type> no_named_parameters; //=========================================================================== // Functions for extracting parameters from bgl_named_params @@ -733,6 +313,194 @@ namespace boost { return Choice::apply(p, g, tag); } + // Declare all new tags + namespace graph { + namespace keywords { +#define BOOST_BGL_ONE_PARAM_REF(name, key) BOOST_PARAMETER_NAME(name) +#define BOOST_BGL_ONE_PARAM_CREF(name, key) BOOST_PARAMETER_NAME(name) + BOOST_BGL_DECLARE_NAMED_PARAMS +#undef BOOST_BGL_ONE_PARAM_REF +#undef BOOST_BGL_ONE_PARAM_CREF + } + } + + namespace detail { + template <typename Tag> struct convert_one_keyword {}; +#define BOOST_BGL_ONE_PARAM_REF(name, key) \ + template <> \ + struct convert_one_keyword<BOOST_PP_CAT(key, _t)> { \ + typedef boost::graph::keywords::tag::name type; \ + }; +#define BOOST_BGL_ONE_PARAM_CREF(name, key) BOOST_BGL_ONE_PARAM_REF(name, key) + BOOST_BGL_DECLARE_NAMED_PARAMS +#undef BOOST_BGL_ONE_PARAM_REF +#undef BOOST_BGL_ONE_PARAM_CREF + + template <typename T> + struct convert_bgl_params_to_boost_parameter { + typedef typename convert_one_keyword<typename T::tag_type>::type new_kw; + typedef boost::parameter::aux::tagged_argument<new_kw, const typename T::value_type> tagged_arg_type; + typedef convert_bgl_params_to_boost_parameter<typename T::next_type> rest_conv; + typedef boost::parameter::aux::arg_list<tagged_arg_type, typename rest_conv::type> type; + static type conv(const T& x) { + return type(tagged_arg_type(x.m_value), rest_conv::conv(x)); + } + }; + + template <typename P, typename R> + struct convert_bgl_params_to_boost_parameter<bgl_named_params<P, int, R> > { + typedef convert_bgl_params_to_boost_parameter<R> rest_conv; + typedef typename rest_conv::type type; + static type conv(const bgl_named_params<P, int, R>& x) { + return rest_conv::conv(x); + } + }; + + template <> + struct convert_bgl_params_to_boost_parameter<boost::no_property> { + typedef boost::parameter::aux::empty_arg_list type; + static type conv(const boost::no_property&) {return type();} + }; + + template <> + struct convert_bgl_params_to_boost_parameter<boost::no_named_parameters> { + typedef boost::parameter::aux::empty_arg_list type; + static type conv(const boost::no_property&) {return type();} + }; + + struct bgl_parameter_not_found_type {}; + + template <typename ArgPack, typename KeywordType> + struct parameter_exists : boost::mpl::not_<boost::is_same<typename boost::parameter::binding<ArgPack, KeywordType, bgl_parameter_not_found_type>::type, bgl_parameter_not_found_type> > {}; + } + +#define BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(old_type, old_var) \ + typedef typename boost::detail::convert_bgl_params_to_boost_parameter<old_type>::type arg_pack_type; \ + arg_pack_type arg_pack = boost::detail::convert_bgl_params_to_boost_parameter<old_type>::conv(old_var); + + namespace detail { + + template <typename ArgType, typename Prop, typename Graph, bool Exists> + struct override_const_property_t { + typedef ArgType result_type; + result_type operator()(const Graph&, const typename boost::add_reference<ArgType>::type a) const {return a;} + }; + + template <typename ArgType, typename Prop, typename Graph> + struct override_const_property_t<ArgType, Prop, Graph, false> { + typedef typename boost::property_map<Graph, Prop>::const_type result_type; + result_type operator()(const Graph& g, const ArgType&) const {return get(Prop(), g);} + }; + + template <typename ArgPack, typename Tag, typename Prop, typename Graph> + typename override_const_property_t< + typename boost::parameter::value_type<ArgPack, Tag, int>::type, + Prop, + Graph, + boost::detail::parameter_exists<ArgPack, Tag>::value + >::result_type + override_const_property(const ArgPack& ap, const boost::parameter::keyword<Tag>& t, const Graph& g, Prop) { + return override_const_property_t< + typename boost::parameter::value_type<ArgPack, Tag, int>::type, + Prop, + Graph, + boost::detail::parameter_exists<ArgPack, Tag>::value + >()(g, ap[t | 0]); + } + + template <typename ArgType, typename Prop, typename Graph, bool Exists> + struct override_property_t { + typedef ArgType result_type; + result_type operator()(const Graph& g, const typename boost::add_reference<ArgType>::type a) const {return a;} + }; + + template <typename ArgType, typename Prop, typename Graph> + struct override_property_t<ArgType, Prop, Graph, false> { + typedef typename boost::property_map<Graph, Prop>::type result_type; + result_type operator()(const Graph& g, const ArgType& a) const {return get(Prop(), g);} + }; + + template <typename ArgPack, typename Tag, typename Prop, typename Graph> + typename override_property_t< + typename boost::parameter::value_type<ArgPack, Tag, int>::type, + Prop, + Graph, + boost::detail::parameter_exists<ArgPack, Tag>::value + >::result_type + override_property(const ArgPack& ap, const boost::parameter::keyword<Tag>& t, const Graph& g, Prop prop) { + return override_property_t< + typename boost::parameter::value_type<ArgPack, Tag, int>::type, + Prop, + Graph, + boost::detail::parameter_exists<ArgPack, Tag>::value + >()(g, ap[t | 0]); + } + + } + + namespace detail { + + template <bool Exists, typename Graph, typename ArgPack, typename Value, typename PM> + struct color_map_maker_helper { + typedef PM map_type; + static PM make_map(const Graph&, Value, const PM& pm, const ArgPack&) { + return pm; + } + }; + + template <typename Graph, typename ArgPack, typename Value, typename PM> + struct color_map_maker_helper<false, Graph, ArgPack, Value, PM> { + typedef typename boost::remove_const< + typename override_const_property_t< + typename boost::parameter::value_type< + ArgPack, boost::graph::keywords::tag::vertex_index_map, int>::type, + boost::vertex_index_t, + Graph, + boost::detail::parameter_exists< + ArgPack, boost::graph::keywords::tag::vertex_index_map>::value + >::result_type>::type vi_map_type; + typedef + boost::shared_array_property_map<Value, vi_map_type> + map_type; + static map_type make_map(const Graph& g, + Value v, + const PM&, + const ArgPack& ap) { + return make_shared_array_property_map( + num_vertices(g), + v, + override_const_property( + ap, + boost::graph::keywords::_vertex_index_map, + g, vertex_index)); + } + }; + + template <typename Graph, typename ArgPack> + struct color_map_maker { + BOOST_STATIC_CONSTANT( + bool, + has_color_map = + (parameter_exists<ArgPack, boost::graph::keywords::tag::color_map> + ::value)); + typedef color_map_maker_helper<has_color_map, Graph, ArgPack, default_color_type, + typename boost::remove_const< + typename boost::parameter::value_type< + ArgPack, + boost::graph::keywords::tag::color_map, + int + >::type + >::type> helper; + typedef typename helper::map_type map_type; + static map_type make_map(const Graph& g, const ArgPack& ap) { + return helper::make_map(g, white_color, ap[boost::graph::keywords::_color_map | 0], ap); + } + }; + + } + } // namespace boost +#undef BOOST_BGL_DECLARE_NAMED_PARAMS + #endif // BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP diff --git a/Utilities/BGL/boost/graph/named_graph.hpp b/Utilities/BGL/boost/graph/named_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dda608d78fc617d62ade2c99f1ee5b3ab29950db --- /dev/null +++ b/Utilities/BGL/boost/graph/named_graph.hpp @@ -0,0 +1,537 @@ +// Copyright (C) 2007 Douglas Gregor + +// 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) + +// Provides support for named vertices in graphs, allowing one to more +// easily associate unique external names (URLs, city names, employee +// ID numbers, etc.) with the vertices of a graph. +#ifndef BOOST_GRAPH_NAMED_GRAPH_HPP +#define BOOST_GRAPH_NAMED_GRAPH_HPP + +#include <boost/config.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/multi_index_container.hpp> +#include <boost/multi_index/hashed_index.hpp> +#include <boost/multi_index/member.hpp> +#include <boost/optional.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> // for std::runtime_error + +namespace boost { namespace graph { + +/******************************************************************* + * User-customized traits * + *******************************************************************/ + +/** + * @brief Trait used to extract the internal vertex name from a vertex + * property. + * + * To enable the use of internal vertex names in a graph type, + * specialize the @c internal_vertex_name trait for your graph + * property (e.g., @c a City class, which stores information about the + * vertices in a road map). + */ +template<typename VertexProperty> +struct internal_vertex_name +{ + /** + * The @c type field provides a function object that extracts a key + * from the @c VertexProperty. The function object type must have a + * nested @c result_type that provides the type of the key. For + * more information, see the @c KeyExtractor concept in the + * Boost.MultiIndex documentation: @c type must either be @c void + * (if @c VertexProperty does not have an internal vertex name) or + * a model of @c KeyExtractor. + */ + typedef void type; +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +/** + * Extract the internal vertex name from a @c property structure by + * looking at its base. + */ +template<typename Tag, typename T, typename Base> +struct internal_vertex_name<property<Tag, T, Base> > + : internal_vertex_name<Base> { }; +#endif + +/** + * Construct an instance of @c VertexProperty directly from its + * name. This function object should be used within the @c + * internal_vertex_constructor trait. + */ +template<typename VertexProperty> +struct vertex_from_name +{ +private: + typedef typename internal_vertex_name<VertexProperty>::type extract_name_type; + + typedef typename remove_cv< + typename remove_reference< + typename extract_name_type::result_type>::type>::type + vertex_name_type; + +public: + typedef vertex_name_type argument_type; + typedef VertexProperty result_type; + + VertexProperty operator()(const vertex_name_type& name) + { + return VertexProperty(name); + } +}; + +/** + * Throw an exception whenever one tries to construct a @c + * VertexProperty instance from its name. + */ +template<typename VertexProperty> +struct cannot_add_vertex +{ +private: + typedef typename internal_vertex_name<VertexProperty>::type extract_name_type; + + typedef typename remove_cv< + typename remove_reference< + typename extract_name_type::result_type>::type>::type + vertex_name_type; + +public: + typedef vertex_name_type argument_type; + typedef VertexProperty result_type; + + VertexProperty operator()(const vertex_name_type& name) + { + boost::throw_exception(std::runtime_error("add_vertex: " + "unable to create a vertex from its name")); + } +}; + +/** + * @brief Trait used to construct an instance of a @c VertexProperty, + * which is a class type that stores the properties associated with a + * vertex in a graph, from just the name of that vertex property. This + * operation is used when an operation is required to map from a + * vertex name to a vertex descriptor (e.g., to add an edge outgoing + * from that vertex), but no vertex by the name exists. The function + * object provided by this trait will be used to add new vertices + * based only on their names. Since this cannot be done for arbitrary + * types, the default behavior is to throw an exception when this + * routine is called, which requires that all named vertices be added + * before adding any edges by name. + */ +template<typename VertexProperty> +struct internal_vertex_constructor +{ + /** + * The @c type field provides a function object that constructs a + * new instance of @c VertexProperty from the name of the vertex (as + * determined by @c internal_vertex_name). The function object shall + * accept a vertex name and return a @c VertexProperty. Predefined + * options include: + * + * @c vertex_from_name<VertexProperty>: construct an instance of + * @c VertexProperty directly from the name. + * + * @c cannot_add_vertex<VertexProperty>: the default value, which + * throws an @c std::runtime_error if one attempts to add a vertex + * given just the name. + */ + typedef cannot_add_vertex<VertexProperty> type; +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +/** + * Extract the internal vertex constructor from a @c property structure by + * looking at its base. + */ +template<typename Tag, typename T, typename Base> +struct internal_vertex_constructor<property<Tag, T, Base> > + : internal_vertex_constructor<Base> { }; +#endif + +/******************************************************************* + * Named graph-specific metafunctions * + *******************************************************************/ +namespace detail { + /** @internal + * Extracts the type of a bundled vertex property from a vertex + * property. The primary template matches when we have hit the end + * of the @c property<> list. + */ + template<typename VertexProperty> + struct extract_bundled_vertex + { + typedef VertexProperty type; + }; + + /** @internal + * Recursively extract the bundled vertex property from a vertex + * property. + */ + template<typename Tag, typename T, typename Base> + struct extract_bundled_vertex<property<Tag, T, Base> > + : extract_bundled_vertex<Base> + { }; + + /** + * We have found the bundled vertex property type, marked with + * vertex_bundle_t. + */ + template<typename T, typename Base> + struct extract_bundled_vertex<property<vertex_bundle_t, T, Base> > + { + typedef T type; + }; + + /** + * Translate @c no_property into @c error_property_not_found when we + * have failed to extract a bundled vertex property type. + */ + template<> + struct extract_bundled_vertex<no_property> + { + typedef boost::detail::error_property_not_found type; + }; +} + +/******************************************************************* + * Named graph mixin * + *******************************************************************/ + +/** + * named_graph is a mixin that provides names for the vertices of a + * graph, including a mapping from names to vertices. Graph types that + * may or may not be have vertex names (depending on the properties + * supplied by the user) should use maybe_named_graph. + * + * Template parameters: + * + * Graph: the graph type that derives from named_graph + * + * Vertex: the type of a vertex descriptor in Graph. Note: we cannot + * use graph_traits here, because the Graph is not yet defined. + * + * VertexProperty: the type stored with each vertex in the Graph. + */ +template<typename Graph, typename Vertex, typename VertexProperty> +class named_graph +{ +public: + /// The type of the function object that extracts names from vertex + /// properties. + typedef typename internal_vertex_name<VertexProperty>::type extract_name_type; + /// The type of the "bundled" property, from which the name can be + /// extracted. + typedef typename detail::extract_bundled_vertex<VertexProperty>::type + bundled_vertex_property_type; + + /// The type of the function object that generates vertex properties + /// from names, for the implicit addition of vertices. + typedef typename internal_vertex_constructor<VertexProperty>::type + vertex_constructor_type; + + /// The type used to name vertices in the graph + typedef typename remove_cv< + typename remove_reference< + typename extract_name_type::result_type>::type>::type + vertex_name_type; + + /// The type of vertex descriptors in the graph + typedef Vertex vertex_descriptor; + +private: + /// Key extractor for use with the multi_index_container + struct extract_name_from_vertex + { + typedef vertex_name_type result_type; + + extract_name_from_vertex(Graph& graph, const extract_name_type& extract) + : graph(graph), extract(extract) { } + + const result_type& operator()(Vertex vertex) const + { + return extract(graph[vertex]); + } + + Graph& graph; + extract_name_type extract; + }; + +public: + /// The type that maps names to vertices + typedef multi_index::multi_index_container< + Vertex, + multi_index::indexed_by< + multi_index::hashed_unique<multi_index::tag<vertex_name_t>, + extract_name_from_vertex> > + > named_vertices_type; + + /// The set of vertices, indexed by name + typedef typename named_vertices_type::template index<vertex_name_t>::type + vertices_by_name_type; + + /// Construct an instance of the named graph mixin, using the given + /// function object to extract a name from the bundled property + /// associated with a vertex. + named_graph(const extract_name_type& extract = extract_name_type(), + const vertex_constructor_type& vertex_constructor + = vertex_constructor_type()); + + /// Notify the named_graph that we have added the given vertex. The + /// name of the vertex will be added to the mapping. + void added_vertex(Vertex vertex); + + /// Notify the named_graph that we are removing the given + /// vertex. The name of the vertex will be removed from the mapping. + void removing_vertex(Vertex vertex); + + /// Notify the named_graph that we are clearing the graph. + /// This will clear out all of the name->vertex mappings + void clearing_graph(); + + /// Retrieve the derived instance + Graph& derived() { return static_cast<Graph&>(*this); } + const Graph& derived() const { return static_cast<const Graph&>(*this); } + + /// Extract the name from a vertex property instance + typename extract_name_type::result_type + extract_name(const bundled_vertex_property_type& property); + + /// Search for a vertex that has the given property (based on its + /// name) + optional<vertex_descriptor> + vertex_by_property(const bundled_vertex_property_type& property); + + /// Mapping from names to vertices + named_vertices_type named_vertices; + + /// Constructs a vertex from the name of that vertex + vertex_constructor_type vertex_constructor; +}; + +/// Helper macro containing the template parameters of named_graph +#define BGL_NAMED_GRAPH_PARAMS \ + typename Graph, typename Vertex, typename VertexProperty +/// Helper macro containing the named_graph<...> instantiation +#define BGL_NAMED_GRAPH \ + named_graph<Graph, Vertex, VertexProperty> + +template<BGL_NAMED_GRAPH_PARAMS> +BGL_NAMED_GRAPH::named_graph(const extract_name_type& extract, + const vertex_constructor_type& vertex_constructor) + : named_vertices( + typename named_vertices_type::ctor_args_list( + boost::make_tuple( + boost::make_tuple( + 0, // initial number of buckets + extract_name_from_vertex(derived(), extract), + boost::hash<vertex_name_type>(), + std::equal_to<vertex_name_type>())))), + vertex_constructor(vertex_constructor) +{ +} + +template<BGL_NAMED_GRAPH_PARAMS> +inline void BGL_NAMED_GRAPH::added_vertex(Vertex vertex) +{ + named_vertices.insert(vertex); +} + +template<BGL_NAMED_GRAPH_PARAMS> +inline void BGL_NAMED_GRAPH::removing_vertex(Vertex vertex) +{ + named_vertices.erase(vertex); +} + +template<BGL_NAMED_GRAPH_PARAMS> +inline void BGL_NAMED_GRAPH::clearing_graph() +{ + named_vertices.clear(); +} + +template<BGL_NAMED_GRAPH_PARAMS> +typename BGL_NAMED_GRAPH::extract_name_type::result_type +BGL_NAMED_GRAPH::extract_name(const bundled_vertex_property_type& property) +{ + return named_vertices.key_extractor().extract(property); +} + +template<BGL_NAMED_GRAPH_PARAMS> +optional<typename BGL_NAMED_GRAPH::vertex_descriptor> +BGL_NAMED_GRAPH:: +vertex_by_property(const bundled_vertex_property_type& property) +{ + return find_vertex(extract_name(property), *this); +} + +/// Retrieve the vertex associated with the given name +template<BGL_NAMED_GRAPH_PARAMS> +optional<Vertex> +find_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, + const BGL_NAMED_GRAPH& g) +{ + typedef typename BGL_NAMED_GRAPH::vertices_by_name_type + vertices_by_name_type; + + // Retrieve the set of vertices indexed by name + vertices_by_name_type const& vertices_by_name + = g.named_vertices.template get<vertex_name_t>(); + + /// Look for a vertex with the given name + typename vertices_by_name_type::const_iterator iter + = vertices_by_name.find(name); + + if (iter == vertices_by_name.end()) + return optional<Vertex>(); // vertex not found + else + return *iter; +} + +/// Retrieve the vertex associated with the given name, or add a new +/// vertex with that name if no such vertex is available. +template<BGL_NAMED_GRAPH_PARAMS> +Vertex +add_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, + BGL_NAMED_GRAPH& g) +{ + if (optional<Vertex> vertex = find_vertex(name, g)) + /// We found the vertex, so return it + return *vertex; + else + /// There is no vertex with the given name, so create one + return add_vertex(g.vertex_constructor(name), g.derived()); +} + +/// Add an edge using vertex names to refer to the vertices +template<BGL_NAMED_GRAPH_PARAMS> +std::pair<typename graph_traits<Graph>::edge_descriptor, bool> +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + BGL_NAMED_GRAPH& g) +{ + return add_edge(add_vertex(u_name, g.derived()), + add_vertex(v_name, g.derived()), + g.derived()); +} + +/// Add an edge using vertex descriptors or names to refer to the vertices +template<BGL_NAMED_GRAPH_PARAMS> +std::pair<typename graph_traits<Graph>::edge_descriptor, bool> +add_edge(typename BGL_NAMED_GRAPH::vertex_descriptor const& u, + typename BGL_NAMED_GRAPH::vertex_name_type const& v_name, + BGL_NAMED_GRAPH& g) +{ + return add_edge(u, + add_vertex(v_name, g.derived()), + g.derived()); +} + +/// Add an edge using vertex descriptors or names to refer to the vertices +template<BGL_NAMED_GRAPH_PARAMS> +std::pair<typename graph_traits<Graph>::edge_descriptor, bool> +add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name, + typename BGL_NAMED_GRAPH::vertex_descriptor const& v, + BGL_NAMED_GRAPH& g) +{ + return add_edge(add_vertex(u_name, g.derived()), + v, + g.derived()); +} + +#undef BGL_NAMED_GRAPH +#undef BGL_NAMED_GRAPH_PARAMS + +/******************************************************************* + * Maybe named graph mixin * + *******************************************************************/ + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +/** + * A graph mixin that can provide a mapping from names to vertices, + * and use that mapping to simplify creation and manipulation of + * graphs. + */ +template<typename Graph, typename Vertex, typename VertexProperty, + typename ExtractName + = typename internal_vertex_name<VertexProperty>::type> +struct maybe_named_graph : public named_graph<Graph, Vertex, VertexProperty> +{ +}; + +/** + * A graph mixin that can provide a mapping from names to vertices, + * and use that mapping to simplify creation and manipulation of + * graphs. This partial specialization turns off this functionality + * when the @c VertexProperty does not have an internal vertex name. + */ +template<typename Graph, typename Vertex, typename VertexProperty> +struct maybe_named_graph<Graph, Vertex, VertexProperty, void> +{ + /// The type of the "bundled" property, from which the name can be + /// extracted. + typedef typename detail::extract_bundled_vertex<VertexProperty>::type + bundled_vertex_property_type; + + /// Notify the named_graph that we have added the given vertex. This + /// is a no-op. + void added_vertex(Vertex) { } + + /// Notify the named_graph that we are removing the given + /// vertex. This is a no-op. + void removing_vertex(Vertex) { } + + /// Notify the named_graph that we are clearing the graph. This is a + /// no-op. + void clearing_graph() { } + + /// Search for a vertex that has the given property (based on its + /// name). This always returns an empty optional<> + optional<Vertex> + vertex_by_property(const bundled_vertex_property_type&) + { + return optional<Vertex>(); + } +}; +#else +template<typename Graph, typename Vertex, typename VertexProperty, + typename ExtractName + = typename internal_vertex_name<VertexProperty>::type> +struct maybe_named_graph +{ + /// The type of the "bundled" property, from which the name can be + /// extracted. + typedef typename detail::extract_bundled_vertex<VertexProperty>::type + bundled_vertex_property_type; + + /// Notify the named_graph that we have added the given vertex. This + /// is a no-op. + void added_vertex(Vertex) { } + + /// Notify the named_graph that we are removing the given + /// vertex. This is a no-op. + void removing_vertex(Vertex) { } + + /// Notify the named_graph that we are clearing the graph. This is a + /// no-op. + void clearing_graph() { } + + /// Search for a vertex that has the given property (based on its + /// name). This always returns an empty optional<> + template<typename Property> + optional<Vertex> + vertex_by_property(const bundled_vertex_property_type&) + { + return optional<Vertex>(); + } +}; +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_NAMED_GRAPH_HPP diff --git a/Utilities/BGL/boost/graph/neighbor_bfs.hpp b/Utilities/BGL/boost/graph/neighbor_bfs.hpp index 1c7b9782ac56ff816fef992a281f97f92110fc0e..01cfe49b7c8db318292373046e7f1e8d843f6207 100644 --- a/Utilities/BGL/boost/graph/neighbor_bfs.hpp +++ b/Utilities/BGL/boost/graph/neighbor_bfs.hpp @@ -17,6 +17,7 @@ (for directed graphs only. use normal BFS for undirected graphs) */ #include <boost/config.hpp> +#include <boost/ref.hpp> #include <vector> #include <boost/pending/queue.hpp> #include <boost/graph/graph_traits.hpp> @@ -211,7 +212,6 @@ namespace boost { typedef typename Traits::vertex_descriptor Vertex; typedef boost::queue<Vertex> queue_t; queue_t Q; - detail::wrap_ref<queue_t> Qref(Q); // Initialization typedef typename property_traits<ColorMap>::value_type ColorValue; typedef color_traits<ColorValue> Color; @@ -222,7 +222,7 @@ namespace boost { } neighbor_bfs_impl (g, s, - choose_param(get_param(params, buffer_param_t()), Qref).ref, + choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(), vis, color); } @@ -306,11 +306,10 @@ namespace boost { // Buffer default typedef boost::queue<typename Traits::vertex_descriptor> queue_t; queue_t Q; - detail::wrap_ref<queue_t> Qref(Q); detail::neighbor_bfs_impl (g, s, - choose_param(get_param(params, buffer_param_t()), Qref).ref, + choose_param(get_param(params, buffer_param_t()), boost::ref(Q)).get(), choose_param(get_param(params, graph_visitor), make_neighbor_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), g, vertex_color) diff --git a/Utilities/BGL/boost/graph/numeric_values.hpp b/Utilities/BGL/boost/graph/numeric_values.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ad01837270a5b828d28cf4d8c0cb5cdbd4713444 --- /dev/null +++ b/Utilities/BGL/boost/graph/numeric_values.hpp @@ -0,0 +1,52 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_NUMERIC_VALUES_HPP +#define BOOST_GRAPH_NUMERIC_VALUES_HPP + +#include <limits> + +namespace boost +{ + +#define BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(type) \ + template <> struct numeric_values<type> { \ + typedef type value_type; \ + static type zero() { return 0.0; } \ + static type infinity() { return std::numeric_limits<type>::infinity(); } \ + }; + + /** + * This generic type reports various numeric values for some type. In the + * general case, numeric values simply treat their maximum value as infinity + * and the default-constructed value as 0. + * + * Specializations of this template can redefine the notions of zero and + * infinity for various types. For example, the class is specialized for + * floating point types to use the built in notion of infinity. + */ + template <typename T> + struct numeric_values + { + typedef T value_type; + + static T zero() + { return T(); } + + static T infinity() + { return (std::numeric_limits<T>::max)(); } + }; + + // Specializations for floating point types refer to 0.0 and their infinity + // value defined by numeric_limits. + BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(float) + BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(double) + BOOST_GRAPH_SPECIALIZE_NUMERIC_FLOAT(long double) + +#undef BOOST_GRAPH_SPECIALIZE_NUMERIC_VALUE +} + +#endif diff --git a/Utilities/BGL/boost/graph/overloading.hpp b/Utilities/BGL/boost/graph/overloading.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a952e22fa86a809b82f4c4339b2bf0fbefbb897f --- /dev/null +++ b/Utilities/BGL/boost/graph/overloading.hpp @@ -0,0 +1,46 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +// +// This file contains helps that enable concept-based overloading +// within the Boost Graph Library. +// +#ifndef BOOST_GRAPH_OVERLOADING_HPP +#define BOOST_GRAPH_OVERLOADING_HPP + +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/utility/enable_if.hpp> + +namespace boost { namespace graph { namespace detail { + +struct no_parameter {}; + +} } } // end namespace boost::graph::detail + +#ifndef BOOST_NO_SFINAE + +#define BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, Type) \ + typename enable_if_c<(is_base_and_derived< \ + Tag, \ + typename graph_traits<Graph>::traversal_category>::value), \ + Type>::type + +#define BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, Tag) \ + , BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, \ + ::boost::graph::detail::no_parameter) \ + = ::boost::graph::detail::no_parameter() + +#else + +#define BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, Type) Type +#define BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, Tag) + +#endif // no SFINAE support + +#endif // BOOST_GRAPH_OVERLOADING_HPP diff --git a/Utilities/BGL/boost/graph/page_rank.hpp b/Utilities/BGL/boost/graph/page_rank.hpp index 78ae766d283761df34ab85fcff497116d379d81a..9532260f0b828eea7b2a710749610aad6915abc3 100644 --- a/Utilities/BGL/boost/graph/page_rank.hpp +++ b/Utilities/BGL/boost/graph/page_rank.hpp @@ -1,8 +1,8 @@ // Copyright 2004-5 The Trustees of Indiana University. // Copyright 2002 Brad King and Douglas Gregor -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -11,10 +11,11 @@ #ifndef BOOST_GRAPH_PAGE_RANK_HPP #define BOOST_GRAPH_PAGE_RANK_HPP -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/properties.hpp> #include <boost/graph/iteration_macros.hpp> +#include <boost/graph/overloading.hpp> #include <vector> namespace boost { namespace graph { @@ -72,7 +73,8 @@ void page_rank(const Graph& g, RankMap rank_map, Done done, typename property_traits<RankMap>::value_type damping, typename graph_traits<Graph>::vertices_size_type n, - RankMap2 rank_map2) + RankMap2 rank_map2 + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag)) { typedef typename property_traits<RankMap>::value_type rank_type; @@ -131,7 +133,9 @@ page_rank(const Graph& g, RankMap rank_map) // applies when we have a bidirectional graph. template<typename MutableGraph> void -remove_dangling_links(MutableGraph& g) +remove_dangling_links(MutableGraph& g + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(MutableGraph, + vertex_list_graph_tag)) { typename graph_traits<MutableGraph>::vertices_size_type old_n; do { @@ -150,4 +154,8 @@ remove_dangling_links(MutableGraph& g) } } // end namespace boost::graph +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/page_rank.hpp> +#endif + #endif // BOOST_GRAPH_PAGE_RANK_HPP diff --git a/Utilities/BGL/boost/graph/parallel/algorithm.hpp b/Utilities/BGL/boost/graph/parallel/algorithm.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eed9bf8769a07b1f23e42a0f135fb69b0be862f6 --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/algorithm.hpp @@ -0,0 +1,84 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_PARALLEL_ALGORITHM_HPP +#define BOOST_PARALLEL_ALGORITHM_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/optional.hpp> +#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT +#include <vector> +#include <functional> + +namespace boost { namespace parallel { + template<typename BinaryOp> + struct is_commutative + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + + template<typename T> + struct minimum : std::binary_function<T, T, T> + { + const T& operator()(const T& x, const T& y) const { return x < y? x : y; } + }; + + template<typename T> + struct maximum : std::binary_function<T, T, T> + { + const T& operator()(const T& x, const T& y) const { return x < y? y : x; } + }; + + template<typename T> + struct sum : std::binary_function<T, T, T> + { + const T operator()(const T& x, const T& y) const { return x + y; } + }; + + template<typename ProcessGroup, typename InputIterator, + typename OutputIterator, typename BinaryOperation> + OutputIterator + reduce(ProcessGroup pg, typename ProcessGroup::process_id_type root, + InputIterator first, InputIterator last, OutputIterator out, + BinaryOperation bin_op); + + template<typename ProcessGroup, typename T, typename BinaryOperation> + inline T + all_reduce(ProcessGroup pg, const T& value, BinaryOperation bin_op) + { + T result; + all_reduce(pg, + const_cast<T*>(&value), const_cast<T*>(&value+1), + &result, bin_op); + return result; + } + + template<typename ProcessGroup, typename T, typename BinaryOperation> + inline T + scan(ProcessGroup pg, const T& value, BinaryOperation bin_op) + { + T result; + scan(pg, + const_cast<T*>(&value), const_cast<T*>(&value+1), + &result, bin_op); + return result; + } + + + template<typename ProcessGroup, typename InputIterator, typename T> + void + all_gather(ProcessGroup pg, InputIterator first, InputIterator last, + std::vector<T>& out); +} } // end namespace boost::parallel + +#include <boost/graph/parallel/detail/inplace_all_to_all.hpp> + +#endif // BOOST_PARALLEL_ALGORITHM_HPP diff --git a/Utilities/BGL/boost/graph/parallel/basic_reduce.hpp b/Utilities/BGL/boost/graph/parallel/basic_reduce.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ee23b3a9403d1b4ec7cfc7f763ab163b45b0ed1d --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/basic_reduce.hpp @@ -0,0 +1,42 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +#ifndef BOOST_PARALLEL_BASIC_REDUCE_HPP +#define BOOST_PARALLEL_BASIC_REDUCE_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +namespace boost { namespace parallel { + +/** Reduction operation used to reconcile differences between local + * and remote values for a particular key in a property map. The + * type @c T is typically the @c value_type of the property + * map. This basic reduction returns a default-constructed @c T as + * the default value and always resolves to the remote value. + */ +template<typename T> +struct basic_reduce +{ + BOOST_STATIC_CONSTANT(bool, non_default_resolver = false); + + /// Returns a default-constructed T object + template<typename Key> + T operator()(const Key&) const { return T(); } + + /// Returns the remote value + template<typename Key> + const T& operator()(const Key&, const T&, const T& remote) const + { return remote; } +}; + +} } // end namespace boost::parallel + +#endif // BOOST_PARALLEL_BASIC_REDUCE_HPP diff --git a/Utilities/BGL/boost/graph/parallel/container_traits.hpp b/Utilities/BGL/boost/graph/parallel/container_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4dd0e9f8911b03e1e8a27e84b09531542faf6e3 --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/container_traits.hpp @@ -0,0 +1,45 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +// +// This file contains traits that describe +// +#ifndef BOOST_GRAPH_PARALLEL_CONTAINER_TRAITS_HPP +#define BOOST_GRAPH_PARALLEL_CONTAINER_TRAITS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +namespace boost { namespace graph { namespace parallel { + +template<typename T> +struct process_group_type +{ + typedef typename T::process_group_type type; +}; + +template<typename T> +inline typename process_group_type<T>::type +process_group(const T& x) +{ return x.process_group(); } + +// Helper function that algorithms should use to get the process group +// out of a container. +template<typename Container> +inline typename process_group_type<Container>::type +process_group_adl(const Container& container) +{ + return process_group(container); +} + + +} } } // end namespace boost::graph::parallel + +#endif // BOOST_GRAPH_PARALLEL_CONTAINER_TRAITS_HPP diff --git a/Utilities/BGL/boost/graph/parallel/detail/inplace_all_to_all.hpp b/Utilities/BGL/boost/graph/parallel/detail/inplace_all_to_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a403ad77391d5c9651ce1423c2ce2f7ed934c78a --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/detail/inplace_all_to_all.hpp @@ -0,0 +1,78 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_PARALLEL_INPLACE_ALL_TO_ALL_HPP +#define BOOST_GRAPH_PARALLEL_INPLACE_ALL_TO_ALL_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +// +// Implements the inplace all-to-all communication algorithm. +// +#include <vector> +#include <iterator> + +namespace boost { namespace parallel { + +template<typename ProcessGroup, typename T> +// where {LinearProcessGroup<ProcessGroup>, MessagingProcessGroup<ProcessGroup>} +void +inplace_all_to_all(ProcessGroup pg, + const std::vector<std::vector<T> >& outgoing, + std::vector<std::vector<T> >& incoming) +{ + typedef typename std::vector<T>::size_type size_type; + + typedef typename ProcessGroup::process_size_type process_size_type; + typedef typename ProcessGroup::process_id_type process_id_type; + + process_size_type p = num_processes(pg); + + // Make sure there are no straggling messages + synchronize(pg); + + // Send along the count (always) and the data (if count > 0) + for (process_id_type dest = 0; dest < p; ++dest) { + if (dest != process_id(pg)) { + send(pg, dest, 0, outgoing[dest].size()); + if (!outgoing[dest].empty()) + send(pg, dest, 1, &outgoing[dest].front(), outgoing[dest].size()); + } + } + + // Make sure all of the data gets transferred + synchronize(pg); + + // Receive the sizes and data + for (process_id_type source = 0; source < p; ++source) { + if (source != process_id(pg)) { + size_type size; + receive(pg, source, 0, size); + incoming[source].resize(size); + if (size > 0) + receive(pg, source, 1, &incoming[source].front(), size); + } else if (&incoming != &outgoing) { + incoming[source] = outgoing[source]; + } + } +} + +template<typename ProcessGroup, typename T> +// where {LinearProcessGroup<ProcessGroup>, MessagingProcessGroup<ProcessGroup>} +void +inplace_all_to_all(ProcessGroup pg, std::vector<std::vector<T> >& data) +{ + inplace_all_to_all(pg, data, data); +} + +} } // end namespace boost::parallel + +#endif // BOOST_GRAPH_PARALLEL_INPLACE_ALL_TO_ALL_HPP diff --git a/Utilities/BGL/boost/graph/parallel/detail/property_holders.hpp b/Utilities/BGL/boost/graph/parallel/detail/property_holders.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bbdbeba6c9cdc164a0af7ca79a66ca4e368b53ca --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/detail/property_holders.hpp @@ -0,0 +1,152 @@ +// Copyright (C) 2007 Douglas Gregor and Matthias Troyer +// +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// +// This file contains helper data structures for use in transmitting +// properties. The basic idea is to optimize away any storage for the +// properties when no properties are specified. +#ifndef BOOST_PARALLEL_DETAIL_PROPERTY_HOLDERS_HPP +#define BOOST_PARALLEL_DETAIL_PROPERTY_HOLDERS_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/mpi/datatype.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/serialization/base_object.hpp> +#include <boost/mpl/and.hpp> +#include <boost/graph/parallel/detail/untracked_pair.hpp> + +namespace boost { namespace detail { namespace parallel { + +/** + * This structure contains an instance of @c Property, unless @c + * Property is a placeholder for "no property". Always access the + * property through @c get_property. Typically used as a base class. + */ +template<typename Property> +struct maybe_store_property +{ + maybe_store_property() {} + maybe_store_property(const Property& p) : p(p) {} + + Property& get_property() { return p; } + const Property& get_property() const { return p; } + +private: + Property p; + + friend class boost::serialization::access; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & p; + } +}; + +template<> +struct maybe_store_property<no_property> +{ + maybe_store_property() {} + maybe_store_property(no_property) {} + + no_property get_property() const { return no_property(); } + +private: + friend class boost::serialization::access; + + template<typename Archiver> + void serialize(Archiver&, const unsigned int /*version*/) { } +}; + +/** + * This structure is a simple pair that also contains a property. + */ +template<typename T, typename U, typename Property> +class pair_with_property + : public boost::parallel::detail::untracked_pair<T, U> + , public maybe_store_property<Property> +{ +public: + typedef boost::parallel::detail::untracked_pair<T, U> pair_base; + typedef maybe_store_property<Property> property_base; + + pair_with_property() { } + + pair_with_property(const T& t, const U& u, const Property& property) + : pair_base(t, u), property_base(property) { } + +private: + friend class boost::serialization::access; + + template<typename Archiver> + void serialize(Archiver& ar, const unsigned int /*version*/) + { + ar & boost::serialization::base_object<pair_base>(*this) + & boost::serialization::base_object<property_base>(*this); + } +}; + +template<typename T, typename U, typename Property> +inline pair_with_property<T, U, Property> +make_pair_with_property(const T& t, const U& u, const Property& property) +{ + return pair_with_property<T, U, Property>(t, u, property); +} + +} } } // end namespace boost::parallel::detail + +namespace boost { namespace mpi { + +template<> +struct is_mpi_datatype<boost::detail::parallel::maybe_store_property<no_property> > : mpl::true_ { }; + +template<typename Property> +struct is_mpi_datatype<boost::detail::parallel::maybe_store_property<Property> > + : is_mpi_datatype<Property> { }; + +template<typename T, typename U, typename Property> +struct is_mpi_datatype<boost::detail::parallel::pair_with_property<T, U, Property> > + : boost::mpl::and_<is_mpi_datatype<boost::parallel::detail::untracked_pair<T, U> >, + is_mpi_datatype<Property> > { }; + +} } // end namespace boost::mpi + +BOOST_IS_BITWISE_SERIALIZABLE(boost::detail::parallel::maybe_store_property<no_property>) + +namespace boost { namespace serialization { + +template<typename Property> +struct is_bitwise_serializable<boost::detail::parallel::maybe_store_property<Property> > + : is_bitwise_serializable<Property> { }; + +template<typename Property> +struct implementation_level<boost::detail::parallel::maybe_store_property<Property> > + : mpl::int_<object_serializable> {} ; + +template<typename Property> +struct tracking_level<boost::detail::parallel::maybe_store_property<Property> > + : mpl::int_<track_never> {} ; + +template<typename T, typename U, typename Property> +struct is_bitwise_serializable< + boost::detail::parallel::pair_with_property<T, U, Property> > + : boost::mpl::and_<is_bitwise_serializable<boost::parallel::detail::untracked_pair<T, U> >, + is_bitwise_serializable<Property> > { }; + +template<typename T, typename U, typename Property> +struct implementation_level< + boost::detail::parallel::pair_with_property<T, U, Property> > + : mpl::int_<object_serializable> {} ; + +template<typename T, typename U, typename Property> +struct tracking_level< + boost::detail::parallel::pair_with_property<T, U, Property> > + : mpl::int_<track_never> {} ; + +} } // end namespace boost::serialization + +#endif // BOOST_PARALLEL_DETAIL_PROPERTY_HOLDERS_HPP diff --git a/Utilities/BGL/boost/graph/parallel/detail/untracked_pair.hpp b/Utilities/BGL/boost/graph/parallel/detail/untracked_pair.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3554910f07266265338a27a4849e2342b4b80acf --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/detail/untracked_pair.hpp @@ -0,0 +1,85 @@ +// Copyright (C) 2007 Matthias Troyer +// +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// +// This file contains helper data structures for use in transmitting +// properties. The basic idea is to optimize away any storage for the +// properties when no properties are specified. +#ifndef BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP +#define BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/mpi/datatype.hpp> +#include <utility> // for std::pair +#include <boost/serialization/utility.hpp> + +namespace boost { namespace parallel { namespace detail { + +/** + * This structure is like std::pair, with the only difference + * that tracking in the serialization library is turned off. + */ + +template<typename T, typename U> +struct untracked_pair : public std::pair<T,U> +{ + untracked_pair() {} + + untracked_pair(const T& t, const U& u) + : std::pair<T,U>(t,u) {} + + template<class T1, class U1> + untracked_pair(std::pair<T1,U1> const& p) + : std::pair<T,U>(p) {} +}; + +template<typename T, typename U> +inline untracked_pair<T, U> +make_untracked_pair(const T& t, const U& u) +{ + return untracked_pair<T,U>(t,u); +} + +} } } // end namespace boost::parallel::detail + +namespace boost { namespace mpi { + +template<typename T, typename U> +struct is_mpi_datatype<boost::parallel::detail::untracked_pair<T, U> > + : is_mpi_datatype<std::pair<T,U> > {}; + +} } // end namespace boost::mpi + +namespace boost { namespace serialization { + +// pair +template<class Archive, class F, class S> +inline void serialize( + Archive & ar, + boost::parallel::detail::untracked_pair<F, S> & p, + const unsigned int /* file_version */ +){ + ar & boost::serialization::make_nvp("first", p.first); + ar & boost::serialization::make_nvp("second", p.second); +} + +template<typename T, typename U> +struct is_bitwise_serializable< + boost::parallel::detail::untracked_pair<T, U> > + : is_bitwise_serializable<std::pair<T, U> > {}; + +template<typename T, typename U> +struct implementation_level<boost::parallel::detail::untracked_pair<T, U> > + : mpl::int_<object_serializable> {} ; + +template<typename T, typename U> +struct tracking_level<boost::parallel::detail::untracked_pair<T, U> > + : mpl::int_<track_never> {} ; + +} } // end namespace boost::serialization + +#endif // BOOST_PARALLEL_DETAIL_UNTRACKED_PAIR_HPP diff --git a/Utilities/BGL/boost/graph/parallel/distribution.hpp b/Utilities/BGL/boost/graph/parallel/distribution.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d717a1f822ab5e26e84e15b2f5bac820bd762994 --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/distribution.hpp @@ -0,0 +1,614 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Peter Gottschling +// Andrew Lumsdaine +#ifndef BOOST_PARALLEL_DISTRIBUTION_HPP +#define BOOST_PARALLEL_DISTRIBUTION_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <cstddef> +#include <vector> +#include <algorithm> +#include <numeric> +#include <boost/iterator/counting_iterator.hpp> +#include <boost/random/uniform_int.hpp> +#include <boost/shared_ptr.hpp> +#include <typeinfo> + +namespace boost { namespace parallel { + +template<typename ProcessGroup, typename SizeType = std::size_t> +class variant_distribution +{ +public: + typedef typename ProcessGroup::process_id_type process_id_type; + typedef typename ProcessGroup::process_size_type process_size_type; + typedef SizeType size_type; + +private: + struct basic_distribution + { + virtual ~basic_distribution() {} + virtual size_type block_size(process_id_type, size_type) const = 0; + virtual process_id_type in_process(size_type) const = 0; + virtual size_type local(size_type) const = 0; + virtual size_type global(size_type) const = 0; + virtual size_type global(process_id_type, size_type) const = 0; + virtual void* address() = 0; + virtual const void* address() const = 0; + virtual const std::type_info& type() const = 0; + }; + + template<typename Distribution> + struct poly_distribution : public basic_distribution + { + explicit poly_distribution(const Distribution& distribution) + : distribution_(distribution) { } + + virtual size_type block_size(process_id_type id, size_type n) const + { return distribution_.block_size(id, n); } + + virtual process_id_type in_process(size_type i) const + { return distribution_(i); } + + virtual size_type local(size_type i) const + { return distribution_.local(i); } + + virtual size_type global(size_type n) const + { return distribution_.global(n); } + + virtual size_type global(process_id_type id, size_type n) const + { return distribution_.global(id, n); } + + virtual void* address() { return &distribution_; } + virtual const void* address() const { return &distribution_; } + virtual const std::type_info& type() const { return typeid(Distribution); } + + private: + Distribution distribution_; + }; + +public: + variant_distribution() { } + + template<typename Distribution> + variant_distribution(const Distribution& distribution) + : distribution_(new poly_distribution<Distribution>(distribution)) { } + + size_type block_size(process_id_type id, size_type n) const + { return distribution_->block_size(id, n); } + + process_id_type operator()(size_type i) const + { return distribution_->in_process(i); } + + size_type local(size_type i) const + { return distribution_->local(i); } + + size_type global(size_type n) const + { return distribution_->global(n); } + + size_type global(process_id_type id, size_type n) const + { return distribution_->global(id, n); } + + operator bool() const { return distribution_; } + + void clear() { distribution_.reset(); } + + template<typename T> + T* as() + { + if (distribution_->type() == typeid(T)) + return static_cast<T*>(distribution_->address()); + else + return 0; + } + + template<typename T> + const T* as() const + { + if (distribution_->type() == typeid(T)) + return static_cast<T*>(distribution_->address()); + else + return 0; + } + +private: + shared_ptr<basic_distribution> distribution_; +}; + +struct block +{ + template<typename LinearProcessGroup> + explicit block(const LinearProcessGroup& pg, std::size_t n) + : id(process_id(pg)), p(num_processes(pg)), n(n) { } + + // If there are n elements in the distributed data structure, returns the number of elements stored locally. + template<typename SizeType> + SizeType block_size(SizeType n) const + { return (n / p) + ((std::size_t)(n % p) > id? 1 : 0); } + + // If there are n elements in the distributed data structure, returns the number of elements stored on processor ID + template<typename SizeType, typename ProcessID> + SizeType block_size(ProcessID id, SizeType n) const + { return (n / p) + ((ProcessID)(n % p) > id? 1 : 0); } + + // Returns the processor on which element with global index i is stored + template<typename SizeType> + SizeType operator()(SizeType i) const + { + SizeType cutoff_processor = n % p; + SizeType cutoff = cutoff_processor * (n / p + 1); + + if (i < cutoff) return i / (n / p + 1); + else return cutoff_processor + (i - cutoff) / (n / p); + } + + // Find the starting index for processor with the given id + template<typename ID> + std::size_t start(ID id) const + { + std::size_t estimate = id * (n / p + 1); + ID cutoff_processor = n % p; + if (id < cutoff_processor) return estimate; + else return estimate - (id - cutoff_processor); + } + + // Find the local index for the ith global element + template<typename SizeType> + SizeType local(SizeType i) const + { + SizeType owner = (*this)(i); + return i - start(owner); + } + + // Returns the global index of local element i + template<typename SizeType> + SizeType global(SizeType i) const + { return global(id, i); } + + // Returns the global index of the ith local element on processor id + template<typename ProcessID, typename SizeType> + SizeType global(ProcessID id, SizeType i) const + { return i + start(id); } + + private: + std::size_t id; //< The ID number of this processor + std::size_t p; //< The number of processors + std::size_t n; //< The size of the problem space +}; + +// Block distribution with arbitrary block sizes +struct uneven_block +{ + typedef std::vector<std::size_t> size_vector; + + template<typename LinearProcessGroup> + explicit uneven_block(const LinearProcessGroup& pg, const std::vector<std::size_t>& local_sizes) + : id(process_id(pg)), p(num_processes(pg)), local_sizes(local_sizes) + { + assert(local_sizes.size() == p); + local_starts.resize(p + 1); + local_starts[0] = 0; + std::partial_sum(local_sizes.begin(), local_sizes.end(), &local_starts[1]); + n = local_starts[p]; + } + + // To do maybe: enter local size in each process and gather in constructor (much handier) + // template<typename LinearProcessGroup> + // explicit uneven_block(const LinearProcessGroup& pg, std::size_t my_local_size) + + // If there are n elements in the distributed data structure, returns the number of elements stored locally. + template<typename SizeType> + SizeType block_size(SizeType) const + { return local_sizes[id]; } + + // If there are n elements in the distributed data structure, returns the number of elements stored on processor ID + template<typename SizeType, typename ProcessID> + SizeType block_size(ProcessID id, SizeType) const + { return local_sizes[id]; } + + // Returns the processor on which element with global index i is stored + template<typename SizeType> + SizeType operator()(SizeType i) const + { + assert (i >= (SizeType) 0 && i < (SizeType) n); // check for valid range + size_vector::const_iterator lb = std::lower_bound(local_starts.begin(), local_starts.end(), (std::size_t) i); + return ((SizeType)(*lb) == i ? lb : --lb) - local_starts.begin(); + } + + // Find the starting index for processor with the given id + template<typename ID> + std::size_t start(ID id) const + { + return local_starts[id]; + } + + // Find the local index for the ith global element + template<typename SizeType> + SizeType local(SizeType i) const + { + SizeType owner = (*this)(i); + return i - start(owner); + } + + // Returns the global index of local element i + template<typename SizeType> + SizeType global(SizeType i) const + { return global(id, i); } + + // Returns the global index of the ith local element on processor id + template<typename ProcessID, typename SizeType> + SizeType global(ProcessID id, SizeType i) const + { return i + start(id); } + + private: + std::size_t id; //< The ID number of this processor + std::size_t p; //< The number of processors + std::size_t n; //< The size of the problem space + std::vector<std::size_t> local_sizes; //< The sizes of all blocks + std::vector<std::size_t> local_starts; //< Lowest global index of each block +}; + + +struct oned_block_cyclic +{ + template<typename LinearProcessGroup> + explicit oned_block_cyclic(const LinearProcessGroup& pg, std::size_t size) + : id(process_id(pg)), p(num_processes(pg)), size(size) { } + + template<typename SizeType> + SizeType block_size(SizeType n) const + { + return block_size(id, n); + } + + template<typename SizeType, typename ProcessID> + SizeType block_size(ProcessID id, SizeType n) const + { + SizeType all_blocks = n / size; + SizeType extra_elements = n % size; + SizeType everyone_gets = all_blocks / p; + SizeType extra_blocks = all_blocks % p; + SizeType my_blocks = everyone_gets + (p < extra_blocks? 1 : 0); + SizeType my_elements = my_blocks * size + + (p == extra_blocks? extra_elements : 0); + return my_elements; + } + + template<typename SizeType> + SizeType operator()(SizeType i) const + { + return (i / size) % p; + } + + template<typename SizeType> + SizeType local(SizeType i) const + { + return ((i / size) / p) * size + i % size; + } + + template<typename SizeType> + SizeType global(SizeType i) const + { return global(id, i); } + + template<typename ProcessID, typename SizeType> + SizeType global(ProcessID id, SizeType i) const + { + return ((i / size) * p + id) * size + i % size; + } + + private: + std::size_t id; //< The ID number of this processor + std::size_t p; //< The number of processors + std::size_t size; //< Block size +}; + +struct twod_block_cyclic +{ + template<typename LinearProcessGroup> + explicit twod_block_cyclic(const LinearProcessGroup& pg, + std::size_t block_rows, std::size_t block_columns, + std::size_t data_columns_per_row) + : id(process_id(pg)), p(num_processes(pg)), + block_rows(block_rows), block_columns(block_columns), + data_columns_per_row(data_columns_per_row) + { } + + template<typename SizeType> + SizeType block_size(SizeType n) const + { + return block_size(id, n); + } + + template<typename SizeType, typename ProcessID> + SizeType block_size(ProcessID id, SizeType n) const + { + // TBD: This is really lame :) + int result = -1; + while (n > 0) { + --n; + if ((*this)(n) == id && (int)local(n) > result) result = local(n); + } + ++result; + + // std::cerr << "Block size of id " << id << " is " << result << std::endl; + return result; + } + + template<typename SizeType> + SizeType operator()(SizeType i) const + { + SizeType result = get_block_num(i) % p; + // std::cerr << "Item " << i << " goes on processor " << result << std::endl; + return result; + } + + template<typename SizeType> + SizeType local(SizeType i) const + { + // Compute the start of the block + std::size_t block_num = get_block_num(i); + // std::cerr << "Item " << i << " is in block #" << block_num << std::endl; + + std::size_t local_block_num = block_num / p; + std::size_t block_start = local_block_num * block_rows * block_columns; + + // Compute the offset into the block + std::size_t data_row = i / data_columns_per_row; + std::size_t data_col = i % data_columns_per_row; + std::size_t block_offset = (data_row % block_rows) * block_columns + + (data_col % block_columns); + + // std::cerr << "Item " << i << " maps to local index " << block_start+block_offset << std::endl; + return block_start + block_offset; + } + + template<typename SizeType> + SizeType global(SizeType i) const + { + // Compute the (global) block in which this element resides + SizeType local_block_num = i / (block_rows * block_columns); + SizeType block_offset = i % (block_rows * block_columns); + SizeType block_num = local_block_num * p + id; + + // Compute the position of the start of the block (globally) + SizeType block_start = block_num * block_rows * block_columns; + + std::cerr << "Block " << block_num << " starts at index " << block_start + << std::endl; + + // Compute the row and column of this block + SizeType block_row = block_num / (data_columns_per_row / block_columns); + SizeType block_col = block_num % (data_columns_per_row / block_columns); + + SizeType row_in_block = block_offset / block_columns; + SizeType col_in_block = block_offset % block_columns; + + std::cerr << "Local index " << i << " is in block at row " << block_row + << ", column " << block_col << ", in-block row " << row_in_block + << ", in-block col " << col_in_block << std::endl; + + SizeType result = block_row * block_rows + block_col * block_columns + + row_in_block * block_rows + col_in_block; + + + std::cerr << "global(" << i << "@" << id << ") = " << result + << " =? " << local(result) << std::endl; + assert(i == local(result)); + return result; + } + + private: + template<typename SizeType> + std::size_t get_block_num(SizeType i) const + { + std::size_t data_row = i / data_columns_per_row; + std::size_t data_col = i % data_columns_per_row; + std::size_t block_row = data_row / block_rows; + std::size_t block_col = data_col / block_columns; + std::size_t blocks_in_row = data_columns_per_row / block_columns; + std::size_t block_num = block_col * blocks_in_row + block_row; + return block_num; + } + + std::size_t id; //< The ID number of this processor + std::size_t p; //< The number of processors + std::size_t block_rows; //< The # of rows in each block + std::size_t block_columns; //< The # of columns in each block + std::size_t data_columns_per_row; //< The # of columns per row of data +}; + +class twod_random +{ + template<typename RandomNumberGen> + struct random_int + { + explicit random_int(RandomNumberGen& gen) : gen(gen) { } + + template<typename T> + T operator()(T n) const + { + uniform_int<T> distrib(0, n-1); + return distrib(gen); + } + + private: + RandomNumberGen& gen; + }; + + public: + template<typename LinearProcessGroup, typename RandomNumberGen> + explicit twod_random(const LinearProcessGroup& pg, + std::size_t block_rows, std::size_t block_columns, + std::size_t data_columns_per_row, + std::size_t n, + RandomNumberGen& gen) + : id(process_id(pg)), p(num_processes(pg)), + block_rows(block_rows), block_columns(block_columns), + data_columns_per_row(data_columns_per_row), + global_to_local(n / (block_rows * block_columns)) + { + std::copy(make_counting_iterator(std::size_t(0)), + make_counting_iterator(global_to_local.size()), + global_to_local.begin()); + + random_int<RandomNumberGen> rand(gen); + std::random_shuffle(global_to_local.begin(), global_to_local.end(), rand); + } + + template<typename SizeType> + SizeType block_size(SizeType n) const + { + return block_size(id, n); + } + + template<typename SizeType, typename ProcessID> + SizeType block_size(ProcessID id, SizeType n) const + { + // TBD: This is really lame :) + int result = -1; + while (n > 0) { + --n; + if ((*this)(n) == id && (int)local(n) > result) result = local(n); + } + ++result; + + // std::cerr << "Block size of id " << id << " is " << result << std::endl; + return result; + } + + template<typename SizeType> + SizeType operator()(SizeType i) const + { + SizeType result = get_block_num(i) % p; + // std::cerr << "Item " << i << " goes on processor " << result << std::endl; + return result; + } + + template<typename SizeType> + SizeType local(SizeType i) const + { + // Compute the start of the block + std::size_t block_num = get_block_num(i); + // std::cerr << "Item " << i << " is in block #" << block_num << std::endl; + + std::size_t local_block_num = block_num / p; + std::size_t block_start = local_block_num * block_rows * block_columns; + + // Compute the offset into the block + std::size_t data_row = i / data_columns_per_row; + std::size_t data_col = i % data_columns_per_row; + std::size_t block_offset = (data_row % block_rows) * block_columns + + (data_col % block_columns); + + // std::cerr << "Item " << i << " maps to local index " << block_start+block_offset << std::endl; + return block_start + block_offset; + } + + private: + template<typename SizeType> + std::size_t get_block_num(SizeType i) const + { + std::size_t data_row = i / data_columns_per_row; + std::size_t data_col = i % data_columns_per_row; + std::size_t block_row = data_row / block_rows; + std::size_t block_col = data_col / block_columns; + std::size_t blocks_in_row = data_columns_per_row / block_columns; + std::size_t block_num = block_col * blocks_in_row + block_row; + return global_to_local[block_num]; + } + + std::size_t id; //< The ID number of this processor + std::size_t p; //< The number of processors + std::size_t block_rows; //< The # of rows in each block + std::size_t block_columns; //< The # of columns in each block + std::size_t data_columns_per_row; //< The # of columns per row of data + std::vector<std::size_t> global_to_local; +}; + +class random_distribution +{ + template<typename RandomNumberGen> + struct random_int + { + explicit random_int(RandomNumberGen& gen) : gen(gen) { } + + template<typename T> + T operator()(T n) const + { + uniform_int<T> distrib(0, n-1); + return distrib(gen); + } + + private: + RandomNumberGen& gen; + }; + + public: + template<typename LinearProcessGroup, typename RandomNumberGen> + random_distribution(const LinearProcessGroup& pg, RandomNumberGen& gen, + std::size_t n) + : base(pg, n), local_to_global(n), global_to_local(n) + { + std::copy(make_counting_iterator(std::size_t(0)), + make_counting_iterator(n), + local_to_global.begin()); + + random_int<RandomNumberGen> rand(gen); + std::random_shuffle(local_to_global.begin(), local_to_global.end(), rand); + + + for (std::vector<std::size_t>::size_type i = 0; i < n; ++i) + global_to_local[local_to_global[i]] = i; + } + + template<typename SizeType> + SizeType block_size(SizeType n) const + { return base.block_size(n); } + + template<typename SizeType, typename ProcessID> + SizeType block_size(ProcessID id, SizeType n) const + { return base.block_size(id, n); } + + template<typename SizeType> + SizeType operator()(SizeType i) const + { + return base(global_to_local[i]); + } + + template<typename SizeType> + SizeType local(SizeType i) const + { + return base.local(global_to_local[i]); + } + + template<typename ProcessID, typename SizeType> + SizeType global(ProcessID p, SizeType i) const + { + return local_to_global[base.global(p, i)]; + } + + template<typename SizeType> + SizeType global(SizeType i) const + { + return local_to_global[base.global(i)]; + } + + private: + block base; + std::vector<std::size_t> local_to_global; + std::vector<std::size_t> global_to_local; +}; + +} } // end namespace boost::parallel + +#endif // BOOST_PARALLEL_DISTRIBUTION_HPP + diff --git a/Utilities/BGL/boost/graph/parallel/process_group.hpp b/Utilities/BGL/boost/graph/parallel/process_group.hpp new file mode 100644 index 0000000000000000000000000000000000000000..280ee4db54935d52077b108e860cdbf22fc3f456 --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/process_group.hpp @@ -0,0 +1,101 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_PARALLEL_PROCESS_GROUP_HPP +#define BOOST_GRAPH_PARALLEL_PROCESS_GROUP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <cstdlib> +#include <utility> + +namespace boost { namespace graph { namespace parallel { + +/** + * A special type used as a flag to a process group constructor that + * indicates that the copy of a process group will represent a new + * distributed data structure. + */ +struct attach_distributed_object { }; + +/** + * Describes the context in which a trigger is being invoked to + * receive a message. + */ +enum trigger_receive_context { + /// No trigger is active at this time. + trc_none, + /// The trigger is being invoked during synchronization, at the end + /// of a superstep. + trc_in_synchronization, + /// The trigger is being invoked as an "early" receive of a message + /// that was sent through the normal "send" operations to be + /// received by the end of the superstep, but the process group sent + /// the message earlier to clear its buffers. + trc_early_receive, + /// The trigger is being invoked for an out-of-band message, which + /// must be handled immediately. + trc_out_of_band, + /// The trigger is being invoked for an out-of-band message, which + /// must be handled immediately and has alredy been received by + /// an MPI_IRecv call. + trc_irecv_out_of_band +}; + +// Process group tags +struct process_group_tag {}; +struct linear_process_group_tag : virtual process_group_tag {}; +struct messaging_process_group_tag : virtual process_group_tag {}; +struct immediate_process_group_tag : virtual messaging_process_group_tag {}; +struct bsp_process_group_tag : virtual messaging_process_group_tag {}; +struct batch_process_group_tag : virtual messaging_process_group_tag {}; +struct locking_process_group_tag : virtual process_group_tag {}; +struct spawning_process_group_tag : virtual process_group_tag {}; + +struct process_group_archetype +{ + typedef int process_id_type; +}; + +void wait(process_group_archetype&); +void synchronize(process_group_archetype&); +int process_id(const process_group_archetype&); +int num_processes(const process_group_archetype&); + +template<typename T> void send(process_group_archetype&, int, int, const T&); + +template<typename T> +process_group_archetype::process_id_type +receive(const process_group_archetype& pg, + process_group_archetype::process_id_type source, int tag, T& value); + +template<typename T> +std::pair<process_group_archetype::process_id_type, std::size_t> +receive(const process_group_archetype& pg, int tag, T values[], std::size_t n); + +template<typename T> +std::pair<process_group_archetype::process_id_type, std::size_t> +receive(const process_group_archetype& pg, + process_group_archetype::process_id_type source, int tag, T values[], + std::size_t n); + +} } } // end namespace boost::graph::parallel + +namespace boost { namespace graph { namespace distributed { + using parallel::trigger_receive_context; + using parallel::trc_early_receive; + using parallel::trc_out_of_band; + using parallel::trc_irecv_out_of_band; + using parallel::trc_in_synchronization; + using parallel::trc_none; + using parallel::attach_distributed_object; +} } } // end namespace boost::graph::distributed + +#endif // BOOST_GRAPH_PARALLEL_PROCESS_GROUP_HPP diff --git a/Utilities/BGL/boost/graph/parallel/properties.hpp b/Utilities/BGL/boost/graph/parallel/properties.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c6bb0bb05cc86a7f304300197e17137cf65eb8bd --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/properties.hpp @@ -0,0 +1,111 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_PARALLEL_PROPERTIES_HPP +#define BOOST_GRAPH_PARALLEL_PROPERTIES_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/properties.hpp> +#include <boost/property_map/parallel/distributed_property_map.hpp> + +namespace boost { + /*************************************************************************** + * Property map reduction operations + ***************************************************************************/ + /** + * Metafunction that produces a reduction operation for the given + * property. The default behavior merely forwards to @ref + * basic_reduce, but it is expected that this class template will be + * specified for important properties. + */ + template<typename Property> + struct property_reduce + { + template<typename Value> + class apply : public parallel::basic_reduce<Value> {}; + }; + + /** + * Reduction of vertex colors can only darken, not lighten, the + * color. Black cannot turn black, grey can only turn black, and + * white can be changed to either color. The default color is white. + */ + template<> + struct property_reduce<vertex_color_t> + { + template<typename Color> + class apply + { + typedef color_traits<Color> traits; + + public: + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename Key> + Color operator()(const Key&) const { return traits::white(); } + + template<typename Key> + Color operator()(const Key&, Color local, Color remote) const { + if (local == traits::white()) return remote; + else if (remote == traits::black()) return remote; + else return local; + } + }; + }; + + /** + * Reduction of a distance always takes the shorter distance. The + * default distance value is the maximum value for the data type. + */ + template<> + struct property_reduce<vertex_distance_t> + { + template<typename T> + class apply + { + public: + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + template<typename Key> + T operator()(const Key&) const { return (std::numeric_limits<T>::max)(); } + + template<typename Key> + T operator()(const Key&, T x, T y) const { return x < y? x : y; } + }; + }; + + template<> + struct property_reduce<vertex_predecessor_t> + { + template<typename T> + class apply + { + public: + BOOST_STATIC_CONSTANT(bool, non_default_resolver = true); + + T operator()(T key) const { return key; } + T operator()(T key, T, T y) const { return y; } + }; + }; + + template<typename Property, typename PropertyMap> + inline void set_property_map_role(Property p, PropertyMap pm) + { + typedef typename property_traits<PropertyMap>::value_type value_type; + typedef property_reduce<Property> property_red; + typedef typename property_red::template apply<value_type> reduce; + + pm.set_reduce(reduce()); + } + +} // end namespace boost +#endif // BOOST_GRAPH_PARALLEL_PROPERTIES_HPP diff --git a/Utilities/BGL/boost/graph/parallel/simple_trigger.hpp b/Utilities/BGL/boost/graph/parallel/simple_trigger.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b1639bf21dfced05a03ecfa0847bf9e03f171ee2 --- /dev/null +++ b/Utilities/BGL/boost/graph/parallel/simple_trigger.hpp @@ -0,0 +1,108 @@ +// Copyright (C) 2007 Douglas Gregor + +// 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) + +// This file contains a simplification of the "trigger" method for +// process groups. The simple trigger handles the common case where +// the handler associated with a trigger is a member function bound to +// a particular pointer. + +#ifndef BOOST_GRAPH_PARALLEL_SIMPLE_TRIGGER_HPP +#define BOOST_GRAPH_PARALLEL_SIMPLE_TRIGGER_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/graph/parallel/process_group.hpp> + +namespace boost { namespace graph { namespace parallel { + +namespace detail { + +/** + * INTERNAL ONLY + * + * The actual function object that bridges from the normal trigger + * interface to the simplified interface. This is the equivalent of + * bind(pmf, self, _1, _2, _3, _4), but without the compile-time + * overhead of bind. + */ +template<typename Class, typename T, typename Result> +class simple_trigger_t +{ +public: + simple_trigger_t(Class* self, + Result (Class::*pmf)(int, int, const T&, + trigger_receive_context)) + : self(self), pmf(pmf) { } + + Result + operator()(int source, int tag, const T& data, + trigger_receive_context context) const + { + return (self->*pmf)(source, tag, data, context); + } + +private: + Class* self; + Result (Class::*pmf)(int, int, const T&, trigger_receive_context); +}; + +} // end namespace detail + +/** + * Simplified trigger interface that reduces the amount of code + * required to connect a process group trigger to a handler that is + * just a bound member function. + * + * INTERNAL ONLY + */ +template<typename ProcessGroup, typename Class, typename T> +inline void +simple_trigger(ProcessGroup& pg, int tag, Class* self, + void (Class::*pmf)(int source, int tag, const T& data, + trigger_receive_context context), int) +{ + pg.template trigger<T>(tag, + detail::simple_trigger_t<Class, T, void>(self, pmf)); +} + +/** + * Simplified trigger interface that reduces the amount of code + * required to connect a process group trigger with a reply to a + * handler that is just a bound member function. + * + * INTERNAL ONLY + */ +template<typename ProcessGroup, typename Class, typename T, typename Result> +inline void +simple_trigger(ProcessGroup& pg, int tag, Class* self, + Result (Class::*pmf)(int source, int tag, const T& data, + trigger_receive_context context), long) +{ + pg.template trigger_with_reply<T> + (tag, detail::simple_trigger_t<Class, T, Result>(self, pmf)); +} + +/** + * Simplified trigger interface that reduces the amount of code + * required to connect a process group trigger to a handler that is + * just a bound member function. + */ +template<typename ProcessGroup, typename Class, typename T, typename Result> +inline void +simple_trigger(ProcessGroup& pg, int tag, Class* self, + Result (Class::*pmf)(int source, int tag, const T& data, + trigger_receive_context context)) +{ + // We pass 0 (an int) to help VC++ disambiguate calls to simple_trigger + // with Result=void. + simple_trigger(pg, tag, self, pmf, 0); +} + +} } } // end namespace boost::graph::parallel + +#endif // BOOST_GRAPH_PARALLEL_SIMPLE_TRIGGER_HPP diff --git a/Utilities/BGL/boost/graph/planar_canonical_ordering.hpp b/Utilities/BGL/boost/graph/planar_canonical_ordering.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d43ea4785ec058bb5e92b0e766a9edd69bdcf859 --- /dev/null +++ b/Utilities/BGL/boost/graph/planar_canonical_ordering.hpp @@ -0,0 +1,214 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __PLANAR_CANONICAL_ORDERING_HPP__ +#define __PLANAR_CANONICAL_ORDERING_HPP__ + +#include <vector> +#include <list> +#include <boost/config.hpp> +#include <boost/utility.hpp> //for next and prior +#include <boost/graph/graph_traits.hpp> +#include <boost/property_map/property_map.hpp> + + +namespace boost +{ + + + namespace detail { + enum planar_canonical_ordering_state + {PCO_PROCESSED, + PCO_UNPROCESSED, + PCO_ONE_NEIGHBOR_PROCESSED, + PCO_READY_TO_BE_PROCESSED}; + } + + template<typename Graph, + typename PlanarEmbedding, + typename OutputIterator, + typename VertexIndexMap> + void planar_canonical_ordering(const Graph& g, + PlanarEmbedding embedding, + OutputIterator ordering, + VertexIndexMap vm) + { + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::adjacency_iterator + adjacency_iterator_t; + typedef typename std::pair<vertex_t, vertex_t> vertex_pair_t; + typedef typename property_traits<PlanarEmbedding>::value_type + embedding_value_t; + typedef typename embedding_value_t::const_iterator embedding_iterator_t; + typedef iterator_property_map + <typename std::vector<vertex_t>::iterator, VertexIndexMap> + vertex_to_vertex_map_t; + typedef iterator_property_map + <typename std::vector<std::size_t>::iterator, VertexIndexMap> + vertex_to_size_t_map_t; + + std::vector<vertex_t> processed_neighbor_vector(num_vertices(g)); + vertex_to_vertex_map_t processed_neighbor + (processed_neighbor_vector.begin(), vm); + + std::vector<std::size_t> status_vector(num_vertices(g), detail::PCO_UNPROCESSED); + vertex_to_size_t_map_t status(status_vector.begin(), vm); + + std::list<vertex_t> ready_to_be_processed; + + vertex_t first_vertex = *vertices(g).first; + vertex_t second_vertex; + adjacency_iterator_t ai, ai_end; + for(tie(ai,ai_end) = adjacent_vertices(first_vertex,g); ai != ai_end; ++ai) + { + if (*ai == first_vertex) + continue; + second_vertex = *ai; + break; + } + + ready_to_be_processed.push_back(first_vertex); + status[first_vertex] = detail::PCO_READY_TO_BE_PROCESSED; + ready_to_be_processed.push_back(second_vertex); + status[second_vertex] = detail::PCO_READY_TO_BE_PROCESSED; + + while(!ready_to_be_processed.empty()) + { + vertex_t u = ready_to_be_processed.front(); + ready_to_be_processed.pop_front(); + + if (status[u] != detail::PCO_READY_TO_BE_PROCESSED && u != second_vertex) + continue; + + embedding_iterator_t ei, ei_start, ei_end; + embedding_iterator_t next_edge_itr, prior_edge_itr; + + ei_start = embedding[u].begin(); + ei_end = embedding[u].end(); + prior_edge_itr = prior(ei_end); + while(source(*prior_edge_itr, g) == target(*prior_edge_itr,g)) + prior_edge_itr = prior(prior_edge_itr); + + for(ei = ei_start; ei != ei_end; ++ei) + { + + edge_t e(*ei); // e = (u,v) + next_edge_itr = boost::next(ei) == ei_end ? ei_start : boost::next(ei); + vertex_t v = source(e,g) == u ? target(e,g) : source(e,g); + + vertex_t prior_vertex = source(*prior_edge_itr, g) == u ? + target(*prior_edge_itr, g) : source(*prior_edge_itr, g); + vertex_t next_vertex = source(*next_edge_itr, g) == u ? + target(*next_edge_itr, g) : source(*next_edge_itr, g); + + // Need prior_vertex, u, v, and next_vertex to all be + // distinct. This is possible, since the input graph is + // triangulated. It'll be true all the time in a simple + // graph, but loops and parallel edges cause some complications. + if (prior_vertex == v || prior_vertex == u) + { + prior_edge_itr = ei; + continue; + } + + //Skip any self-loops + if (u == v) + continue; + + // Move next_edge_itr (and next_vertex) forwards + // past any loops or parallel edges + while (next_vertex == v || next_vertex == u) + { + next_edge_itr = boost::next(next_edge_itr) == ei_end ? + ei_start : boost::next(next_edge_itr); + next_vertex = source(*next_edge_itr, g) == u ? + target(*next_edge_itr, g) : source(*next_edge_itr, g); + } + + + if (status[v] == detail::PCO_UNPROCESSED) + { + status[v] = detail::PCO_ONE_NEIGHBOR_PROCESSED; + processed_neighbor[v] = u; + } + else if (status[v] == detail::PCO_ONE_NEIGHBOR_PROCESSED) + { + vertex_t x = processed_neighbor[v]; + //are edges (v,u) and (v,x) adjacent in the planar + //embedding? if so, set status[v] = 1. otherwise, set + //status[v] = 2. + + if ((next_vertex == x && + !(first_vertex == u && second_vertex == x) + ) + || + (prior_vertex == x && + !(first_vertex == x && second_vertex == u) + ) + ) + { + status[v] = detail::PCO_READY_TO_BE_PROCESSED; + } + else + { + status[v] = detail::PCO_READY_TO_BE_PROCESSED + 1; + } + } + else if (status[v] > detail::PCO_ONE_NEIGHBOR_PROCESSED) + { + //check the two edges before and after (v,u) in the planar + //embedding, and update status[v] accordingly + + bool processed_before = false; + if (status[prior_vertex] == detail::PCO_PROCESSED) + processed_before = true; + + bool processed_after = false; + if (status[next_vertex] == detail::PCO_PROCESSED) + processed_after = true; + + if (!processed_before && !processed_after) + ++status[v]; + + else if (processed_before && processed_after) + --status[v]; + + } + + if (status[v] == detail::PCO_READY_TO_BE_PROCESSED) + ready_to_be_processed.push_back(v); + + prior_edge_itr = ei; + + } + + status[u] = detail::PCO_PROCESSED; + *ordering = u; + ++ordering; + + } + + } + + + template<typename Graph, typename PlanarEmbedding, typename OutputIterator> + void planar_canonical_ordering(const Graph& g, + PlanarEmbedding embedding, + OutputIterator ordering + ) + { + planar_canonical_ordering(g, embedding, ordering, get(vertex_index,g)); + } + + +} //namespace boost + +#endif //__PLANAR_CANONICAL_ORDERING_HPP__ diff --git a/Utilities/BGL/boost/graph/planar_detail/add_edge_visitors.hpp b/Utilities/BGL/boost/graph/planar_detail/add_edge_visitors.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9635376990e9ec52aec349fee048bbbe9abc306b --- /dev/null +++ b/Utilities/BGL/boost/graph/planar_detail/add_edge_visitors.hpp @@ -0,0 +1,59 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __ADD_EDGE_VISITORS_HPP__ +#define __ADD_EDGE_VISITORS_HPP__ + +#include <boost/property_map/property_map.hpp> + +namespace boost +{ + + struct default_add_edge_visitor + { + + template <typename Graph, typename Vertex> + void visit_vertex_pair(Vertex u, Vertex v, Graph& g) + { + add_edge(u,v,g); + } + + }; + + template<typename EdgeIndexMap> + struct edge_index_update_visitor + { + + typedef typename + property_traits<EdgeIndexMap>::value_type edge_index_value_t; + + edge_index_update_visitor(EdgeIndexMap em, + edge_index_value_t next_index_available + ) : + m_em(em), + m_next_index(next_index_available) + {} + + template <typename Graph, typename Vertex> + void visit_vertex_pair(Vertex u, Vertex v, Graph& g) + { + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + std::pair<edge_t, bool> return_value = add_edge(u,v,g); + if (return_value.second) + put( m_em, return_value.first, m_next_index++); + } + + private: + + EdgeIndexMap m_em; + edge_index_value_t m_next_index; + + }; + +} // namespace boost + +#endif //__ADD_EDGE_VISITORS_HPP__ diff --git a/Utilities/BGL/boost/graph/planar_detail/boyer_myrvold_impl.hpp b/Utilities/BGL/boost/graph/planar_detail/boyer_myrvold_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ee31c85ec9ee2c39a2f0eabf3e192561d8d52be2 --- /dev/null +++ b/Utilities/BGL/boost/graph/planar_detail/boyer_myrvold_impl.hpp @@ -0,0 +1,2012 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __BOYER_MYRVOLD_IMPL_HPP__ +#define __BOYER_MYRVOLD_IMPL_HPP__ + +#include <vector> +#include <list> +#include <boost/utility.hpp> //for boost::next +#include <boost/config.hpp> //for std::min macros +#include <boost/shared_ptr.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/depth_first_search.hpp> +#include <boost/graph/planar_detail/face_handles.hpp> +#include <boost/graph/planar_detail/face_iterators.hpp> +#include <boost/graph/planar_detail/bucket_sort.hpp> + + + +namespace boost +{ + namespace detail { + enum bm_case_t{BM_NO_CASE_CHOSEN, BM_CASE_A, BM_CASE_B, BM_CASE_C, BM_CASE_D, BM_CASE_E}; + } + + template<typename LowPointMap, typename DFSParentMap, + typename DFSNumberMap, typename LeastAncestorMap, + typename DFSParentEdgeMap, typename SizeType> + struct planar_dfs_visitor : public dfs_visitor<> + { + planar_dfs_visitor(LowPointMap lpm, DFSParentMap dfs_p, + DFSNumberMap dfs_n, LeastAncestorMap lam, + DFSParentEdgeMap dfs_edge) + : low(lpm), + parent(dfs_p), + df_number(dfs_n), + least_ancestor(lam), + df_edge(dfs_edge), + count(0) + {} + + + template <typename Vertex, typename Graph> + void start_vertex(const Vertex& u, Graph&) + { + put(parent, u, u); + put(least_ancestor, u, count); + } + + + template <typename Vertex, typename Graph> + void discover_vertex(const Vertex& u, Graph&) + { + put(low, u, count); + put(df_number, u, count); + ++count; + } + + template <typename Edge, typename Graph> + void tree_edge(const Edge& e, Graph& g) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + vertex_t s(source(e,g)); + vertex_t t(target(e,g)); + + put(parent, t, s); + put(df_edge, t, e); + put(least_ancestor, t, get(df_number, s)); + } + + template <typename Edge, typename Graph> + void back_edge(const Edge& e, Graph& g) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + + vertex_t s(source(e,g)); + vertex_t t(target(e,g)); + BOOST_USING_STD_MIN(); + + if ( t != get(parent, s) ) { + v_size_t s_low_df_number = get(low, s); + v_size_t t_df_number = get(df_number, t); + v_size_t s_least_ancestor_df_number = get(least_ancestor, s); + + put(low, s, + min BOOST_PREVENT_MACRO_SUBSTITUTION(s_low_df_number, + t_df_number) + ); + + put(least_ancestor, s, + min BOOST_PREVENT_MACRO_SUBSTITUTION(s_least_ancestor_df_number, + t_df_number + ) + ); + + } + } + + template <typename Vertex, typename Graph> + void finish_vertex(const Vertex& u, Graph&) + { + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + + Vertex u_parent = get(parent, u); + v_size_t u_parent_lowpoint = get(low, u_parent); + v_size_t u_lowpoint = get(low, u); + BOOST_USING_STD_MIN(); + + if (u_parent != u) + { + put(low, u_parent, + min BOOST_PREVENT_MACRO_SUBSTITUTION(u_lowpoint, + u_parent_lowpoint + ) + ); + } + } + + LowPointMap low; + DFSParentMap parent; + DFSNumberMap df_number; + LeastAncestorMap least_ancestor; + DFSParentEdgeMap df_edge; + SizeType count; + + }; + + + + + + + template <typename Graph, + typename VertexIndexMap, + typename StoreOldHandlesPolicy = graph::detail::store_old_handles, + typename StoreEmbeddingPolicy = graph::detail::recursive_lazy_list + > + class boyer_myrvold_impl + { + + typedef typename graph_traits<Graph>::vertices_size_type v_size_t; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::edge_iterator edge_iterator_t; + typedef typename graph_traits<Graph>::out_edge_iterator + out_edge_iterator_t; + typedef graph::detail::face_handle + <Graph, StoreOldHandlesPolicy, StoreEmbeddingPolicy> face_handle_t; + typedef std::vector<vertex_t> vertex_vector_t; + typedef std::vector<edge_t> edge_vector_t; + typedef std::list<vertex_t> vertex_list_t; + typedef std::list< face_handle_t > face_handle_list_t; + typedef boost::shared_ptr< face_handle_list_t > face_handle_list_ptr_t; + typedef boost::shared_ptr< vertex_list_t > vertex_list_ptr_t; + typedef boost::tuple<vertex_t, bool, bool> merge_stack_frame_t; + typedef std::vector<merge_stack_frame_t> merge_stack_t; + + template <typename T> + struct map_vertex_to_ + { + typedef iterator_property_map + <typename std::vector<T>::iterator, VertexIndexMap> type; + }; + + typedef typename map_vertex_to_<v_size_t>::type vertex_to_v_size_map_t; + typedef typename map_vertex_to_<vertex_t>::type vertex_to_vertex_map_t; + typedef typename map_vertex_to_<edge_t>::type vertex_to_edge_map_t; + typedef typename map_vertex_to_<vertex_list_ptr_t>::type + vertex_to_vertex_list_ptr_map_t; + typedef typename map_vertex_to_< edge_vector_t >::type + vertex_to_edge_vector_map_t; + typedef typename map_vertex_to_<bool>::type vertex_to_bool_map_t; + typedef typename map_vertex_to_<face_handle_t>::type + vertex_to_face_handle_map_t; + typedef typename map_vertex_to_<face_handle_list_ptr_t>::type + vertex_to_face_handle_list_ptr_map_t; + typedef typename map_vertex_to_<typename vertex_list_t::iterator>::type + vertex_to_separated_node_map_t; + + template <typename BicompSideToTraverse = single_side, + typename VisitorType = lead_visitor, + typename Time = current_iteration> + struct face_vertex_iterator + { + typedef face_iterator<Graph, + vertex_to_face_handle_map_t, + vertex_t, + BicompSideToTraverse, + VisitorType, + Time> + type; + }; + + template <typename BicompSideToTraverse = single_side, + typename Time = current_iteration> + struct face_edge_iterator + { + typedef face_iterator<Graph, + vertex_to_face_handle_map_t, + edge_t, + BicompSideToTraverse, + lead_visitor, + Time> + type; + }; + + + + public: + + + + boyer_myrvold_impl(const Graph& arg_g, VertexIndexMap arg_vm): + g(arg_g), + vm(arg_vm), + + low_point_vector(num_vertices(g)), + dfs_parent_vector(num_vertices(g)), + dfs_number_vector(num_vertices(g)), + least_ancestor_vector(num_vertices(g)), + pertinent_roots_vector(num_vertices(g)), + backedge_flag_vector(num_vertices(g), num_vertices(g) + 1), + visited_vector(num_vertices(g), num_vertices(g) + 1), + face_handles_vector(num_vertices(g)), + dfs_child_handles_vector(num_vertices(g)), + separated_dfs_child_list_vector(num_vertices(g)), + separated_node_in_parent_list_vector(num_vertices(g)), + canonical_dfs_child_vector(num_vertices(g)), + flipped_vector(num_vertices(g), false), + backedges_vector(num_vertices(g)), + dfs_parent_edge_vector(num_vertices(g)), + + vertices_by_dfs_num(num_vertices(g)), + + low_point(low_point_vector.begin(), vm), + dfs_parent(dfs_parent_vector.begin(), vm), + dfs_number(dfs_number_vector.begin(), vm), + least_ancestor(least_ancestor_vector.begin(), vm), + pertinent_roots(pertinent_roots_vector.begin(), vm), + backedge_flag(backedge_flag_vector.begin(), vm), + visited(visited_vector.begin(), vm), + face_handles(face_handles_vector.begin(), vm), + dfs_child_handles(dfs_child_handles_vector.begin(), vm), + separated_dfs_child_list(separated_dfs_child_list_vector.begin(), vm), + separated_node_in_parent_list + (separated_node_in_parent_list_vector.begin(), vm), + canonical_dfs_child(canonical_dfs_child_vector.begin(), vm), + flipped(flipped_vector.begin(), vm), + backedges(backedges_vector.begin(), vm), + dfs_parent_edge(dfs_parent_edge_vector.begin(), vm) + + { + + planar_dfs_visitor + <vertex_to_v_size_map_t, vertex_to_vertex_map_t, + vertex_to_v_size_map_t, vertex_to_v_size_map_t, + vertex_to_edge_map_t, v_size_t> vis + (low_point, dfs_parent, dfs_number, least_ancestor, dfs_parent_edge); + + // Perform a depth-first search to find each vertex's low point, least + // ancestor, and dfs tree information + depth_first_search(g, visitor(vis).vertex_index_map(vm)); + + // Sort vertices by their lowpoint - need this later in the constructor + vertex_vector_t vertices_by_lowpoint(num_vertices(g)); + std::copy( vertices(g).first, vertices(g).second, + vertices_by_lowpoint.begin() + ); + bucket_sort(vertices_by_lowpoint.begin(), + vertices_by_lowpoint.end(), + low_point, + num_vertices(g) + ); + + // Sort vertices by their dfs number - need this to iterate by reverse + // DFS number in the main loop. + std::copy( vertices(g).first, vertices(g).second, + vertices_by_dfs_num.begin() + ); + bucket_sort(vertices_by_dfs_num.begin(), + vertices_by_dfs_num.end(), + dfs_number, + num_vertices(g) + ); + + // Initialize face handles. A face handle is an abstraction that serves + // two uses in our implementation - it allows us to efficiently move + // along the outer face of embedded bicomps in a partially embedded + // graph, and it provides storage for the planar embedding. Face + // handles are implemented by a sequence of edges and are associated + // with a particular vertex - the sequence of edges represents the + // current embedding of edges around that vertex, and the first and + // last edges in the sequence represent the pair of edges on the outer + // face that are adjacent to the associated vertex. This lets us embed + // edges in the graph by just pushing them on the front or back of the + // sequence of edges held by the face handles. + // + // Our algorithm starts with a DFS tree of edges (where every vertex is + // an articulation point and every edge is a singleton bicomp) and + // repeatedly merges bicomps by embedding additional edges. Note that + // any bicomp at any point in the algorithm can be associated with a + // unique edge connecting the vertex of that bicomp with the lowest DFS + // number (which we refer to as the "root" of the bicomp) with its DFS + // child in the bicomp: the existence of two such edges would contradict + // the properties of a DFS tree. We refer to the DFS child of the root + // of a bicomp as the "canonical DFS child" of the bicomp. Note that a + // vertex can be the root of more than one bicomp. + // + // We move around the external faces of a bicomp using a few property + // maps, which we'll initialize presently: + // + // - face_handles: maps a vertex to a face handle that can be used to + // move "up" a bicomp. For a vertex that isn't an articulation point, + // this holds the face handles that can be used to move around that + // vertex's unique bicomp. For a vertex that is an articulation point, + // this holds the face handles associated with the unique bicomp that + // the vertex is NOT the root of. These handles can therefore be used + // to move from any point on the outer face of the tree of bicomps + // around the current outer face towards the root of the DFS tree. + // + // - dfs_child_handles: these are used to hold face handles for + // vertices that are articulation points - dfs_child_handles[v] holds + // the face handles corresponding to vertex u in the bicomp with root + // u and canonical DFS child v. + // + // - canonical_dfs_child: this property map allows one to determine the + // canonical DFS child of a bicomp while traversing the outer face. + // This property map is only valid when applied to one of the two + // vertices adjacent to the root of the bicomp on the outer face. To + // be more precise, if v is the canonical DFS child of a bicomp, + // canonical_dfs_child[dfs_child_handles[v].first_vertex()] == v and + // canonical_dfs_child[dfs_child_handles[v].second_vertex()] == v. + // + // - pertinent_roots: given a vertex v, pertinent_roots[v] contains a + // list of face handles pointing to the top of bicomps that need to + // be visited by the current walkdown traversal (since they lead to + // backedges that need to be embedded). These lists are populated by + // the walkup and consumed by the walkdown. + + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + vertex_t parent = dfs_parent[v]; + + if (parent != v) + { + edge_t parent_edge = dfs_parent_edge[v]; + add_to_embedded_edges(parent_edge, StoreOldHandlesPolicy()); + face_handles[v] = face_handle_t(v, parent_edge, g); + dfs_child_handles[v] = face_handle_t(parent, parent_edge, g); + } + else + { + face_handles[v] = face_handle_t(v); + dfs_child_handles[v] = face_handle_t(parent); + } + + canonical_dfs_child[v] = v; + pertinent_roots[v] = face_handle_list_ptr_t(new face_handle_list_t); + separated_dfs_child_list[v] = vertex_list_ptr_t(new vertex_list_t); + + } + + // We need to create a list of not-yet-merged depth-first children for + // each vertex that will be updated as bicomps get merged. We sort each + // list by ascending lowpoint, which allows the externally_active + // function to run in constant time, and we keep a pointer to each + // vertex's representation in its parent's list, which allows merging + //in constant time. + + for(typename vertex_vector_t::iterator itr = + vertices_by_lowpoint.begin(); + itr != vertices_by_lowpoint.end(); ++itr) + { + vertex_t v(*itr); + vertex_t parent(dfs_parent[v]); + if (v != parent) + { + separated_node_in_parent_list[v] = + separated_dfs_child_list[parent]->insert + (separated_dfs_child_list[parent]->end(), v); + } + } + + // The merge stack holds path information during a walkdown iteration + merge_stack.reserve(num_vertices(g)); + + } + + + + + + + bool is_planar() + { + + // This is the main algorithm: starting with a DFS tree of embedded + // edges (which, since it's a tree, is planar), iterate through all + // vertices by reverse DFS number, attempting to embed all backedges + // connecting the current vertex to vertices with higher DFS numbers. + // + // The walkup is a procedure that examines all such backedges and sets + // up the required data structures so that they can be searched by the + // walkdown in linear time. The walkdown does the actual work of + // embedding edges and flipping bicomps, and can identify when it has + // come across a kuratowski subgraph. + // + // store_old_face_handles caches face handles from the previous + // iteration - this is used only for the kuratowski subgraph isolation, + // and is therefore dispatched based on the StoreOldHandlesPolicy. + // + // clean_up_embedding does some clean-up and fills in values that have + // to be computed lazily during the actual execution of the algorithm + // (for instance, whether or not a bicomp is flipped in the final + // embedding). It's dispatched on the the StoreEmbeddingPolicy, since + // it's not needed if an embedding isn't desired. + + typename vertex_vector_t::reverse_iterator vi, vi_end; + + vi_end = vertices_by_dfs_num.rend(); + for(vi = vertices_by_dfs_num.rbegin(); vi != vi_end; ++vi) + { + + store_old_face_handles(StoreOldHandlesPolicy()); + + vertex_t v(*vi); + + walkup(v); + + if (!walkdown(v)) + return false; + + } + + clean_up_embedding(StoreEmbeddingPolicy()); + + return true; + + } + + + + + + + private: + + + + + + void walkup(vertex_t v) + { + + // The point of the walkup is to follow all backedges from v to + // vertices with higher DFS numbers, and update pertinent_roots + // for the bicomp roots on the path from backedge endpoints up + // to v. This will set the stage for the walkdown to efficiently + // traverse the graph of bicomps down from v. + + typedef typename face_vertex_iterator<both_sides>::type walkup_iterator_t; + + out_edge_iterator_t oi, oi_end; + for(tie(oi,oi_end) = out_edges(v,g); oi != oi_end; ++oi) + { + edge_t e(*oi); + vertex_t e_source(source(e,g)); + vertex_t e_target(target(e,g)); + + if (e_source == e_target) + { + self_loops.push_back(e); + continue; + } + + vertex_t w(e_source == v ? e_target : e_source); + + //continue if not a back edge or already embedded + if (dfs_number[w] < dfs_number[v] || e == dfs_parent_edge[w]) + continue; + + backedges[w].push_back(e); + + v_size_t timestamp = dfs_number[v]; + backedge_flag[w] = timestamp; + + walkup_iterator_t walkup_itr(w, face_handles); + walkup_iterator_t walkup_end; + vertex_t lead_vertex = w; + + while (true) + { + + // Move to the root of the current bicomp or the first visited + // vertex on the bicomp by going up each side in parallel + + while(walkup_itr != walkup_end && + visited[*walkup_itr] != timestamp + ) + { + lead_vertex = *walkup_itr; + visited[lead_vertex] = timestamp; + ++walkup_itr; + } + + // If we've found the root of a bicomp through a path we haven't + // seen before, update pertinent_roots with a handle to the + // current bicomp. Otherwise, we've just seen a path we've been + // up before, so break out of the main while loop. + + if (walkup_itr == walkup_end) + { + vertex_t dfs_child = canonical_dfs_child[lead_vertex]; + vertex_t parent = dfs_parent[dfs_child]; + + visited[dfs_child_handles[dfs_child].first_vertex()] + = timestamp; + visited[dfs_child_handles[dfs_child].second_vertex()] + = timestamp; + + if (low_point[dfs_child] < dfs_number[v] || + least_ancestor[dfs_child] < dfs_number[v] + ) + { + pertinent_roots[parent]->push_back + (dfs_child_handles[dfs_child]); + } + else + { + pertinent_roots[parent]->push_front + (dfs_child_handles[dfs_child]); + } + + if (parent != v && visited[parent] != timestamp) + { + walkup_itr = walkup_iterator_t(parent, face_handles); + lead_vertex = parent; + } + else + break; + } + else + break; + } + + } + + } + + + + + + + + bool walkdown(vertex_t v) + { + // This procedure is where all of the action is - pertinent_roots + // has already been set up by the walkup, so we just need to move + // down bicomps from v until we find vertices that have been + // labeled as backedge endpoints. Once we find such a vertex, we + // embed the corresponding edge and glue together the bicomps on + // the path connecting the two vertices in the edge. This may + // involve flipping bicomps along the way. + + vertex_t w; //the other endpoint of the edge we're embedding + + while (!pertinent_roots[v]->empty()) + { + + face_handle_t root_face_handle = pertinent_roots[v]->front(); + face_handle_t curr_face_handle = root_face_handle; + pertinent_roots[v]->pop_front(); + + merge_stack.clear(); + + while(true) + { + + typename face_vertex_iterator<>::type + first_face_itr, second_face_itr, face_end; + vertex_t first_side_vertex + = graph_traits<Graph>::null_vertex(); + vertex_t second_side_vertex; + vertex_t first_tail, second_tail; + + first_tail = second_tail = curr_face_handle.get_anchor(); + first_face_itr = typename face_vertex_iterator<>::type + (curr_face_handle, face_handles, first_side()); + second_face_itr = typename face_vertex_iterator<>::type + (curr_face_handle, face_handles, second_side()); + + for(; first_face_itr != face_end; ++first_face_itr) + { + vertex_t face_vertex(*first_face_itr); + if (pertinent(face_vertex, v) || + externally_active(face_vertex, v) + ) + { + first_side_vertex = face_vertex; + second_side_vertex = face_vertex; + break; + } + first_tail = face_vertex; + } + + if (first_side_vertex == graph_traits<Graph>::null_vertex() || + first_side_vertex == curr_face_handle.get_anchor() + ) + break; + + for(;second_face_itr != face_end; ++second_face_itr) + { + vertex_t face_vertex(*second_face_itr); + if (pertinent(face_vertex, v) || + externally_active(face_vertex, v) + ) + { + second_side_vertex = face_vertex; + break; + } + second_tail = face_vertex; + } + + vertex_t chosen; + bool chose_first_upper_path; + if (internally_active(first_side_vertex, v)) + { + chosen = first_side_vertex; + chose_first_upper_path = true; + } + else if (internally_active(second_side_vertex, v)) + { + chosen = second_side_vertex; + chose_first_upper_path = false; + } + else if (pertinent(first_side_vertex, v)) + { + chosen = first_side_vertex; + chose_first_upper_path = true; + } + else if (pertinent(second_side_vertex, v)) + { + chosen = second_side_vertex; + chose_first_upper_path = false; + } + else + { + + // If there's a pertinent vertex on the lower face + // between the first_face_itr and the second_face_itr, + // this graph isn't planar. + for(; + *first_face_itr != second_side_vertex; + ++first_face_itr + ) + { + vertex_t p(*first_face_itr); + if (pertinent(p,v)) + { + //Found a Kuratowski subgraph + kuratowski_v = v; + kuratowski_x = first_side_vertex; + kuratowski_y = second_side_vertex; + return false; + } + } + + // Otherwise, the fact that we didn't find a pertinent + // vertex on this face is fine - we should set the + // short-circuit edges and break out of this loop to + // start looking at a different pertinent root. + + if (first_side_vertex == second_side_vertex) + { + if (first_tail != v) + { + vertex_t first + = face_handles[first_tail].first_vertex(); + vertex_t second + = face_handles[first_tail].second_vertex(); + tie(first_side_vertex, first_tail) + = make_tuple(first_tail, + first == first_side_vertex ? + second : first + ); + } + else if (second_tail != v) + { + vertex_t first + = face_handles[second_tail].first_vertex(); + vertex_t second + = face_handles[second_tail].second_vertex(); + tie(second_side_vertex, second_tail) + = make_tuple(second_tail, + first == second_side_vertex ? + second : first); + } + else + break; + } + + canonical_dfs_child[first_side_vertex] + = canonical_dfs_child[root_face_handle.first_vertex()]; + canonical_dfs_child[second_side_vertex] + = canonical_dfs_child[root_face_handle.second_vertex()]; + root_face_handle.set_first_vertex(first_side_vertex); + root_face_handle.set_second_vertex(second_side_vertex); + + if (face_handles[first_side_vertex].first_vertex() == + first_tail + ) + face_handles[first_side_vertex].set_first_vertex(v); + else + face_handles[first_side_vertex].set_second_vertex(v); + + if (face_handles[second_side_vertex].first_vertex() == + second_tail + ) + face_handles[second_side_vertex].set_first_vertex(v); + else + face_handles[second_side_vertex].set_second_vertex(v); + + break; + + } + + + // When we unwind the stack, we need to know which direction + // we came down from on the top face handle + + bool chose_first_lower_path = + (chose_first_upper_path && + face_handles[chosen].first_vertex() == first_tail) + || + (!chose_first_upper_path && + face_handles[chosen].first_vertex() == second_tail); + + //If there's a backedge at the chosen vertex, embed it now + if (backedge_flag[chosen] == dfs_number[v]) + { + w = chosen; + + backedge_flag[chosen] = num_vertices(g) + 1; + add_to_merge_points(chosen, StoreOldHandlesPolicy()); + + typename edge_vector_t::iterator ei, ei_end; + ei_end = backedges[chosen].end(); + for(ei = backedges[chosen].begin(); ei != ei_end; ++ei) + { + edge_t e(*ei); + add_to_embedded_edges(e, StoreOldHandlesPolicy()); + + if (chose_first_lower_path) + face_handles[chosen].push_first(e, g); + else + face_handles[chosen].push_second(e, g); + } + + } + else + { + merge_stack.push_back(make_tuple + (chosen, chose_first_upper_path, chose_first_lower_path) + ); + curr_face_handle = *pertinent_roots[chosen]->begin(); + continue; + } + + //Unwind the merge stack to the root, merging all bicomps + + bool bottom_path_follows_first; + bool top_path_follows_first; + bool next_bottom_follows_first = chose_first_upper_path; + face_handle_t top_handle, bottom_handle; + + vertex_t merge_point = chosen; + + while(!merge_stack.empty()) + { + + bottom_path_follows_first = next_bottom_follows_first; + tie(merge_point, + next_bottom_follows_first, + top_path_follows_first + ) = merge_stack.back(); + merge_stack.pop_back(); + + face_handle_t top_handle(face_handles[merge_point]); + face_handle_t bottom_handle + (*pertinent_roots[merge_point]->begin()); + + vertex_t bottom_dfs_child = canonical_dfs_child + [pertinent_roots[merge_point]->begin()->first_vertex()]; + + remove_vertex_from_separated_dfs_child_list( + canonical_dfs_child + [pertinent_roots[merge_point]->begin()->first_vertex()] + ); + + pertinent_roots[merge_point]->pop_front(); + + add_to_merge_points(top_handle.get_anchor(), + StoreOldHandlesPolicy() + ); + + if (top_path_follows_first && bottom_path_follows_first) + { + bottom_handle.flip(); + top_handle.glue_first_to_second(bottom_handle); + } + else if (!top_path_follows_first && + bottom_path_follows_first + ) + { + flipped[bottom_dfs_child] = true; + top_handle.glue_second_to_first(bottom_handle); + } + else if (top_path_follows_first && + !bottom_path_follows_first + ) + { + flipped[bottom_dfs_child] = true; + top_handle.glue_first_to_second(bottom_handle); + } + else //!top_path_follows_first && !bottom_path_follows_first + { + bottom_handle.flip(); + top_handle.glue_second_to_first(bottom_handle); + } + + } + + //Finally, embed all edges (v,w) at their upper end points + canonical_dfs_child[w] + = canonical_dfs_child[root_face_handle.first_vertex()]; + + add_to_merge_points(root_face_handle.get_anchor(), + StoreOldHandlesPolicy() + ); + + typename edge_vector_t::iterator ei, ei_end; + ei_end = backedges[chosen].end(); + for(ei = backedges[chosen].begin(); ei != ei_end; ++ei) + { + if (next_bottom_follows_first) + root_face_handle.push_first(*ei, g); + else + root_face_handle.push_second(*ei, g); + } + + backedges[chosen].clear(); + curr_face_handle = root_face_handle; + + }//while(true) + + }//while(!pertinent_roots[v]->empty()) + + return true; + + } + + + + + + + void store_old_face_handles(graph::detail::no_old_handles) {} + + void store_old_face_handles(graph::detail::store_old_handles) + { + for(typename std::vector<vertex_t>::iterator mp_itr + = current_merge_points.begin(); + mp_itr != current_merge_points.end(); ++mp_itr) + { + face_handles[*mp_itr].store_old_face_handles(); + } + current_merge_points.clear(); + } + + + void add_to_merge_points(vertex_t, graph::detail::no_old_handles) {} + + void add_to_merge_points(vertex_t v, graph::detail::store_old_handles) + { + current_merge_points.push_back(v); + } + + + void add_to_embedded_edges(edge_t, graph::detail::no_old_handles) {} + + void add_to_embedded_edges(edge_t e, graph::detail::store_old_handles) + { + embedded_edges.push_back(e); + } + + + + + void clean_up_embedding(graph::detail::no_embedding) {} + + void clean_up_embedding(graph::detail::store_embedding) + { + + // If the graph isn't biconnected, we'll still have entries + // in the separated_dfs_child_list for some vertices. Since + // these represent articulation points, we can obtain a + // planar embedding no matter what order we embed them in. + + vertex_iterator_t xi, xi_end; + for(tie(xi,xi_end) = vertices(g); xi != xi_end; ++xi) + { + if (!separated_dfs_child_list[*xi]->empty()) + { + typename vertex_list_t::iterator yi, yi_end; + yi_end = separated_dfs_child_list[*xi]->end(); + for(yi = separated_dfs_child_list[*xi]->begin(); + yi != yi_end; ++yi + ) + { + dfs_child_handles[*yi].flip(); + face_handles[*xi].glue_first_to_second + (dfs_child_handles[*yi]); + } + } + } + + // Up until this point, we've flipped bicomps lazily by setting + // flipped[v] to true if the bicomp rooted at v was flipped (the + // lazy aspect of this flip is that all descendents of that vertex + // need to have their orientations reversed as well). Now, we + // traverse the DFS tree by DFS number and perform the actual + // flipping as needed + + typedef typename vertex_vector_t::iterator vertex_vector_itr_t; + vertex_vector_itr_t vi_end = vertices_by_dfs_num.end(); + for(vertex_vector_itr_t vi = vertices_by_dfs_num.begin(); + vi != vi_end; ++vi + ) + { + vertex_t v(*vi); + bool v_flipped = flipped[v]; + bool p_flipped = flipped[dfs_parent[v]]; + if (v_flipped && !p_flipped) + { + face_handles[v].flip(); + } + else if (p_flipped && !v_flipped) + { + face_handles[v].flip(); + flipped[v] = true; + } + else + { + flipped[v] = false; + } + } + + // If there are any self-loops in the graph, they were flagged + // during the walkup, and we should add them to the embedding now. + // Adding a self loop anywhere in the embedding could never + // invalidate the embedding, but they would complicate the traversal + // if they were added during the walkup/walkdown. + + typename edge_vector_t::iterator ei, ei_end; + ei_end = self_loops.end(); + for(ei = self_loops.begin(); ei != ei_end; ++ei) + { + edge_t e(*ei); + face_handles[source(e,g)].push_second(e,g); + } + + } + + + + + + bool pertinent(vertex_t w, vertex_t v) + { + // w is pertinent with respect to v if there is a backedge (v,w) or if + // w is the root of a bicomp that contains a pertinent vertex. + + return backedge_flag[w] == dfs_number[v] || !pertinent_roots[w]->empty(); + } + + + + bool externally_active(vertex_t w, vertex_t v) + { + // Let a be any proper depth-first search ancestor of v. w is externally + // active with respect to v if there exists a backedge (a,w) or a + // backedge (a,w_0) for some w_0 in a descendent bicomp of w. + + v_size_t dfs_number_of_v = dfs_number[v]; + return (least_ancestor[w] < dfs_number_of_v) || + (!separated_dfs_child_list[w]->empty() && + low_point[separated_dfs_child_list[w]->front()] < dfs_number_of_v); + } + + + + bool internally_active(vertex_t w, vertex_t v) + { + return pertinent(w,v) && !externally_active(w,v); + } + + + + + void remove_vertex_from_separated_dfs_child_list(vertex_t v) + { + typename vertex_list_t::iterator to_delete + = separated_node_in_parent_list[v]; + garbage.splice(garbage.end(), + *separated_dfs_child_list[dfs_parent[v]], + to_delete, + boost::next(to_delete) + ); + } + + + + + + // End of the implementation of the basic Boyer-Myrvold Algorithm. The rest + // of the code below implements the isolation of a Kuratowski subgraph in + // the case that the input graph is not planar. This is by far the most + // complicated part of the implementation. + + + + + public: + + + + + template <typename EdgeToBoolPropertyMap, typename EdgeContainer> + vertex_t kuratowski_walkup(vertex_t v, + EdgeToBoolPropertyMap forbidden_edge, + EdgeToBoolPropertyMap goal_edge, + EdgeToBoolPropertyMap is_embedded, + EdgeContainer& path_edges + ) + { + vertex_t current_endpoint; + bool seen_goal_edge = false; + out_edge_iterator_t oi, oi_end; + + for(tie(oi,oi_end) = out_edges(v,g); oi != oi_end; ++oi) + forbidden_edge[*oi] = true; + + for(tie(oi,oi_end) = out_edges(v,g); oi != oi_end; ++oi) + { + path_edges.clear(); + + edge_t e(*oi); + current_endpoint = target(*oi,g) == v ? + source(*oi,g) : target(*oi,g); + + if (dfs_number[current_endpoint] < dfs_number[v] || + is_embedded[e] || + v == current_endpoint //self-loop + ) + { + //Not a backedge + continue; + } + + path_edges.push_back(e); + if (goal_edge[e]) + { + return current_endpoint; + } + + typedef typename face_edge_iterator<>::type walkup_itr_t; + + walkup_itr_t + walkup_itr(current_endpoint, face_handles, first_side()); + walkup_itr_t walkup_end; + + seen_goal_edge = false; + + while (true) + { + + if (walkup_itr != walkup_end && forbidden_edge[*walkup_itr]) + break; + + while(walkup_itr != walkup_end && + !goal_edge[*walkup_itr] && + !forbidden_edge[*walkup_itr] + ) + { + edge_t f(*walkup_itr); + forbidden_edge[f] = true; + path_edges.push_back(f); + current_endpoint = + source(f, g) == current_endpoint ? + target(f, g) : + source(f,g); + ++walkup_itr; + } + + if (walkup_itr != walkup_end && goal_edge[*walkup_itr]) + { + path_edges.push_back(*walkup_itr); + seen_goal_edge = true; + break; + } + + walkup_itr + = walkup_itr_t(current_endpoint, face_handles, first_side()); + + } + + if (seen_goal_edge) + break; + + } + + if (seen_goal_edge) + return current_endpoint; + else + return graph_traits<Graph>::null_vertex(); + + } + + + + + + + + + template <typename OutputIterator, typename EdgeIndexMap> + void extract_kuratowski_subgraph(OutputIterator o_itr, EdgeIndexMap em) + { + + // If the main algorithm has failed to embed one of the back-edges from + // a vertex v, we can use the current state of the algorithm to isolate + // a Kuratowksi subgraph. The isolation process breaks down into five + // cases, A - E. The general configuration of all five cases is shown in + // figure 1. There is a vertex v from which the planar + // v embedding process could not proceed. This means that + // | there exists some bicomp containing three vertices + // ----- x,y, and z as shown such that x and y are externally + // | | active with respect to v (which means that there are + // x y two vertices x_0 and y_0 such that (1) both x_0 and + // | | y_0 are proper depth-first search ancestors of v and + // --z-- (2) there are two disjoint paths, one connecting x + // and x_0 and one connecting y and y_0, both consisting + // fig. 1 entirely of unembedded edges). Furthermore, there + // exists a vertex z_0 such that z is a depth-first + // search ancestor of z_0 and (v,z_0) is an unembedded back-edge from v. + // x,y and z all exist on the same bicomp, which consists entirely of + // embedded edges. The five subcases break down as follows, and are + // handled by the algorithm logically in the order A-E: First, if v is + // not on the same bicomp as x,y, and z, a K_3_3 can be isolated - this + // is case A. So, we'll assume that v is on the same bicomp as x,y, and + // z. If z_0 is on a different bicomp than x,y, and z, a K_3_3 can also + // be isolated - this is a case B - so we'll assume from now on that v + // is on the same bicomp as x, y, and z=z_0. In this case, one can use + // properties of the Boyer-Myrvold algorithm to show the existence of an + // "x-y path" connecting some vertex on the "left side" of the x,y,z + // bicomp with some vertex on the "right side" of the bicomp (where the + // left and right are split by a line drawn through v and z.If either of + // the endpoints of the x-y path is above x or y on the bicomp, a K_3_3 + // can be isolated - this is a case C. Otherwise, both endpoints are at + // or below x and y on the bicomp. If there is a vertex alpha on the x-y + // path such that alpha is not x or y and there's a path from alpha to v + // that's disjoint from any of the edges on the bicomp and the x-y path, + // a K_3_3 can be isolated - this is a case D. Otherwise, properties of + // the Boyer-Myrvold algorithm can be used to show that another vertex + // w exists on the lower half of the bicomp such that w is externally + // active with respect to v. w can then be used to isolate a K_5 - this + // is the configuration of case E. + + vertex_iterator_t vi, vi_end; + edge_iterator_t ei, ei_end; + out_edge_iterator_t oei, oei_end; + typename std::vector<edge_t>::iterator xi, xi_end; + + // Clear the short-circuit edges - these are needed for the planar + // testing/embedding algorithm to run in linear time, but they'll + // complicate the kuratowski subgraph isolation + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + face_handles[*vi].reset_vertex_cache(); + dfs_child_handles[*vi].reset_vertex_cache(); + } + + vertex_t v = kuratowski_v; + vertex_t x = kuratowski_x; + vertex_t y = kuratowski_y; + + typedef iterator_property_map + <typename std::vector<bool>::iterator, EdgeIndexMap> + edge_to_bool_map_t; + + std::vector<bool> is_in_subgraph_vector(num_edges(g), false); + edge_to_bool_map_t is_in_subgraph(is_in_subgraph_vector.begin(), em); + + std::vector<bool> is_embedded_vector(num_edges(g), false); + edge_to_bool_map_t is_embedded(is_embedded_vector.begin(), em); + + typename std::vector<edge_t>::iterator embedded_itr, embedded_end; + embedded_end = embedded_edges.end(); + for(embedded_itr = embedded_edges.begin(); + embedded_itr != embedded_end; ++embedded_itr + ) + is_embedded[*embedded_itr] = true; + + // upper_face_vertex is true for x,y, and all vertices above x and y in + // the bicomp + std::vector<bool> upper_face_vertex_vector(num_vertices(g), false); + vertex_to_bool_map_t upper_face_vertex + (upper_face_vertex_vector.begin(), vm); + + std::vector<bool> lower_face_vertex_vector(num_vertices(g), false); + vertex_to_bool_map_t lower_face_vertex + (lower_face_vertex_vector.begin(), vm); + + // These next few variable declarations are all things that we need + // to find. + vertex_t z; + vertex_t bicomp_root; + vertex_t w = graph_traits<Graph>::null_vertex(); + face_handle_t w_handle; + face_handle_t v_dfchild_handle; + vertex_t first_x_y_path_endpoint = graph_traits<Graph>::null_vertex(); + vertex_t second_x_y_path_endpoint = graph_traits<Graph>::null_vertex(); + vertex_t w_ancestor = v; + + detail::bm_case_t chosen_case = detail::BM_NO_CASE_CHOSEN; + + std::vector<edge_t> x_external_path; + std::vector<edge_t> y_external_path; + std::vector<edge_t> case_d_edges; + + std::vector<edge_t> z_v_path; + std::vector<edge_t> w_path; + + //first, use a walkup to find a path from V that starts with a + //backedge from V, then goes up until it hits either X or Y + //(but doesn't find X or Y as the root of a bicomp) + + typename face_vertex_iterator<>::type + x_upper_itr(x, face_handles, first_side()); + typename face_vertex_iterator<>::type + x_lower_itr(x, face_handles, second_side()); + typename face_vertex_iterator<>::type face_itr, face_end; + + // Don't know which path from x is the upper or lower path - + // we'll find out here + for(face_itr = x_upper_itr; face_itr != face_end; ++face_itr) + { + if (*face_itr == y) + { + std::swap(x_upper_itr, x_lower_itr); + break; + } + } + + upper_face_vertex[x] = true; + + vertex_t current_vertex = x; + vertex_t previous_vertex; + for(face_itr = x_upper_itr; face_itr != face_end; ++face_itr) + { + previous_vertex = current_vertex; + current_vertex = *face_itr; + upper_face_vertex[current_vertex] = true; + } + + v_dfchild_handle + = dfs_child_handles[canonical_dfs_child[previous_vertex]]; + + for(face_itr = x_lower_itr; *face_itr != y; ++face_itr) + { + vertex_t current_vertex(*face_itr); + lower_face_vertex[current_vertex] = true; + + typename face_handle_list_t::iterator roots_itr, roots_end; + + if (w == graph_traits<Graph>::null_vertex()) //haven't found a w yet + { + roots_end = pertinent_roots[current_vertex]->end(); + for(roots_itr = pertinent_roots[current_vertex]->begin(); + roots_itr != roots_end; ++roots_itr + ) + { + if (low_point[canonical_dfs_child[roots_itr->first_vertex()]] + < dfs_number[v] + ) + { + w = current_vertex; + w_handle = *roots_itr; + break; + } + } + } + + } + + for(; face_itr != face_end; ++face_itr) + { + vertex_t current_vertex(*face_itr); + upper_face_vertex[current_vertex] = true; + bicomp_root = current_vertex; + } + + typedef typename face_edge_iterator<>::type walkup_itr_t; + + std::vector<bool> outer_face_edge_vector(num_edges(g), false); + edge_to_bool_map_t outer_face_edge(outer_face_edge_vector.begin(), em); + + walkup_itr_t walkup_end; + for(walkup_itr_t walkup_itr(x, face_handles, first_side()); + walkup_itr != walkup_end; ++walkup_itr + ) + { + outer_face_edge[*walkup_itr] = true; + is_in_subgraph[*walkup_itr] = true; + } + + for(walkup_itr_t walkup_itr(x, face_handles, second_side()); + walkup_itr != walkup_end; ++walkup_itr + ) + { + outer_face_edge[*walkup_itr] = true; + is_in_subgraph[*walkup_itr] = true; + } + + std::vector<bool> forbidden_edge_vector(num_edges(g), false); + edge_to_bool_map_t forbidden_edge(forbidden_edge_vector.begin(), em); + + std::vector<bool> goal_edge_vector(num_edges(g), false); + edge_to_bool_map_t goal_edge(goal_edge_vector.begin(), em); + + + //Find external path to x and to y + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] + = !outer_face_edge[e] && (source(e,g) == x || target(e,g) == x); + forbidden_edge[*ei] = outer_face_edge[*ei]; + } + + vertex_t x_ancestor = v; + vertex_t x_endpoint = graph_traits<Graph>::null_vertex(); + + while(x_endpoint == graph_traits<Graph>::null_vertex()) + { + x_ancestor = dfs_parent[x_ancestor]; + x_endpoint = kuratowski_walkup(x_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + x_external_path + ); + + } + + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] + = !outer_face_edge[e] && (source(e,g) == y || target(e,g) == y); + forbidden_edge[*ei] = outer_face_edge[*ei]; + } + + vertex_t y_ancestor = v; + vertex_t y_endpoint = graph_traits<Graph>::null_vertex(); + + while(y_endpoint == graph_traits<Graph>::null_vertex()) + { + y_ancestor = dfs_parent[y_ancestor]; + y_endpoint = kuratowski_walkup(y_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + y_external_path + ); + + } + + + vertex_t parent, child; + + //If v isn't on the same bicomp as x and y, it's a case A + if (bicomp_root != v) + { + chosen_case = detail::BM_CASE_A; + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + if (lower_face_vertex[*vi]) + for(tie(oei,oei_end) = out_edges(*vi,g); oei != oei_end; ++oei) + if(!outer_face_edge[*oei]) + goal_edge[*oei] = true; + + for(tie(ei,ei_end) = edges(g); ei != ei_end; ++ei) + forbidden_edge[*ei] = outer_face_edge[*ei]; + + z = kuratowski_walkup + (v, forbidden_edge, goal_edge, is_embedded, z_v_path); + + } + else if (w != graph_traits<Graph>::null_vertex()) + { + chosen_case = detail::BM_CASE_B; + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] = false; + forbidden_edge[e] = outer_face_edge[e]; + } + + goal_edge[w_handle.first_edge()] = true; + goal_edge[w_handle.second_edge()] = true; + + z = kuratowski_walkup(v, + forbidden_edge, + goal_edge, + is_embedded, + z_v_path + ); + + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + forbidden_edge[*ei] = outer_face_edge[*ei]; + } + + typename std::vector<edge_t>::iterator pi, pi_end; + pi_end = z_v_path.end(); + for(pi = z_v_path.begin(); pi != pi_end; ++pi) + { + goal_edge[*pi] = true; + } + + w_ancestor = v; + vertex_t w_endpoint = graph_traits<Graph>::null_vertex(); + + while(w_endpoint == graph_traits<Graph>::null_vertex()) + { + w_ancestor = dfs_parent[w_ancestor]; + w_endpoint = kuratowski_walkup(w_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + w_path + ); + + } + + // We really want both the w walkup and the z walkup to finish on + // exactly the same edge, but for convenience (since we don't have + // control over which side of a bicomp a walkup moves up) we've + // defined the walkup to either end at w_handle.first_edge() or + // w_handle.second_edge(). If both walkups ended at different edges, + // we'll do a little surgery on the w walkup path to make it follow + // the other side of the final bicomp. + + if ((w_path.back() == w_handle.first_edge() && + z_v_path.back() == w_handle.second_edge()) + || + (w_path.back() == w_handle.second_edge() && + z_v_path.back() == w_handle.first_edge()) + ) + { + walkup_itr_t wi, wi_end; + edge_t final_edge = w_path.back(); + vertex_t anchor + = source(final_edge, g) == w_handle.get_anchor() ? + target(final_edge, g) : source(final_edge, g); + if (face_handles[anchor].first_edge() == final_edge) + wi = walkup_itr_t(anchor, face_handles, second_side()); + else + wi = walkup_itr_t(anchor, face_handles, first_side()); + + w_path.pop_back(); + + for(; wi != wi_end; ++wi) + { + edge_t e(*wi); + if (w_path.back() == e) + w_path.pop_back(); + else + w_path.push_back(e); + } + } + + + } + else + { + + //We need to find a valid z, since the x-y path re-defines the lower + //face, and the z we found earlier may now be on the upper face. + + chosen_case = detail::BM_CASE_E; + + + // The z we've used so far is just an externally active vertex on the + // lower face path, but may not be the z we need for a case C, D, or + // E subgraph. the z we need now is any externally active vertex on + // the lower face path with both old_face_handles edges on the outer + // face. Since we know an x-y path exists, such a z must also exist. + + //TODO: find this z in the first place. + + //find the new z + + for(face_itr = x_lower_itr; *face_itr != y; ++face_itr) + { + vertex_t possible_z(*face_itr); + if (pertinent(possible_z,v) && + outer_face_edge[face_handles[possible_z].old_first_edge()] && + outer_face_edge[face_handles[possible_z].old_second_edge()] + ) + { + z = possible_z; + break; + } + } + + //find x-y path, and a w if one exists. + + if (externally_active(z,v)) + w = z; + + + typedef typename face_edge_iterator + <single_side, previous_iteration>::type old_face_iterator_t; + + old_face_iterator_t + first_old_face_itr(z, face_handles, first_side()); + old_face_iterator_t + second_old_face_itr(z, face_handles, second_side()); + old_face_iterator_t old_face_itr, old_face_end; + + std::vector<old_face_iterator_t> old_face_iterators; + old_face_iterators.push_back(first_old_face_itr); + old_face_iterators.push_back(second_old_face_itr); + + std::vector<bool> x_y_path_vertex_vector(num_vertices(g), false); + vertex_to_bool_map_t x_y_path_vertex + (x_y_path_vertex_vector.begin(), vm); + + typename std::vector<old_face_iterator_t>::iterator + of_itr, of_itr_end; + of_itr_end = old_face_iterators.end(); + for(of_itr = old_face_iterators.begin(); + of_itr != of_itr_end; ++of_itr + ) + { + + old_face_itr = *of_itr; + + vertex_t previous_vertex; + bool seen_x_or_y = false; + vertex_t current_vertex = z; + for(; old_face_itr != old_face_end; ++old_face_itr) + { + edge_t e(*old_face_itr); + previous_vertex = current_vertex; + current_vertex = source(e,g) == current_vertex ? + target(e,g) : source(e,g); + + if (current_vertex == x || current_vertex == y) + seen_x_or_y = true; + + if (w == graph_traits<Graph>::null_vertex() && + externally_active(current_vertex,v) && + outer_face_edge[e] && + outer_face_edge[*boost::next(old_face_itr)] && + !seen_x_or_y + ) + { + w = current_vertex; + } + + if (!outer_face_edge[e]) + { + if (!upper_face_vertex[current_vertex] && + !lower_face_vertex[current_vertex] + ) + { + x_y_path_vertex[current_vertex] = true; + } + + is_in_subgraph[e] = true; + if (upper_face_vertex[source(e,g)] || + lower_face_vertex[source(e,g)] + ) + { + if (first_x_y_path_endpoint == + graph_traits<Graph>::null_vertex() + ) + first_x_y_path_endpoint = source(e,g); + else + second_x_y_path_endpoint = source(e,g); + } + if (upper_face_vertex[target(e,g)] || + lower_face_vertex[target(e,g)] + ) + { + if (first_x_y_path_endpoint == + graph_traits<Graph>::null_vertex() + ) + first_x_y_path_endpoint = target(e,g); + else + second_x_y_path_endpoint = target(e,g); + } + + + } + else if (previous_vertex == x || previous_vertex == y) + { + chosen_case = detail::BM_CASE_C; + } + + } + + } + + // Look for a case D - one of v's embedded edges will connect to the + // x-y path along an inner face path. + + //First, get a list of all of v's embedded child edges + + out_edge_iterator_t v_edge_itr, v_edge_end; + for(tie(v_edge_itr,v_edge_end) = out_edges(v,g); + v_edge_itr != v_edge_end; ++v_edge_itr + ) + { + edge_t embedded_edge(*v_edge_itr); + + if (!is_embedded[embedded_edge] || + embedded_edge == dfs_parent_edge[v] + ) + continue; + + case_d_edges.push_back(embedded_edge); + + vertex_t current_vertex + = source(embedded_edge,g) == v ? + target(embedded_edge,g) : source(embedded_edge,g); + + typename face_edge_iterator<>::type + internal_face_itr, internal_face_end; + if (face_handles[current_vertex].first_vertex() == v) + { + internal_face_itr = typename face_edge_iterator<>::type + (current_vertex, face_handles, second_side()); + } + else + { + internal_face_itr = typename face_edge_iterator<>::type + (current_vertex, face_handles, first_side()); + } + + while(internal_face_itr != internal_face_end && + !outer_face_edge[*internal_face_itr] && + !x_y_path_vertex[current_vertex] + ) + { + edge_t e(*internal_face_itr); + case_d_edges.push_back(e); + current_vertex = + source(e,g) == current_vertex ? target(e,g) : source(e,g); + ++internal_face_itr; + } + + if (x_y_path_vertex[current_vertex]) + { + chosen_case = detail::BM_CASE_D; + break; + } + else + { + case_d_edges.clear(); + } + + } + + + } + + + + + if (chosen_case != detail::BM_CASE_B && chosen_case != detail::BM_CASE_A) + { + + //Finding z and w. + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + edge_t e(*ei); + goal_edge[e] = !outer_face_edge[e] && + (source(e,g) == z || target(e,g) == z); + forbidden_edge[e] = outer_face_edge[e]; + } + + kuratowski_walkup(v, + forbidden_edge, + goal_edge, + is_embedded, + z_v_path + ); + + if (chosen_case == detail::BM_CASE_E) + { + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + { + forbidden_edge[*ei] = outer_face_edge[*ei]; + goal_edge[*ei] = !outer_face_edge[*ei] && + (source(*ei,g) == w || target(*ei,g) == w); + } + + for(tie(oei, oei_end) = out_edges(w,g); oei != oei_end; ++oei) + { + if (!outer_face_edge[*oei]) + goal_edge[*oei] = true; + } + + typename std::vector<edge_t>::iterator pi, pi_end; + pi_end = z_v_path.end(); + for(pi = z_v_path.begin(); pi != pi_end; ++pi) + { + goal_edge[*pi] = true; + } + + w_ancestor = v; + vertex_t w_endpoint = graph_traits<Graph>::null_vertex(); + + while(w_endpoint == graph_traits<Graph>::null_vertex()) + { + w_ancestor = dfs_parent[w_ancestor]; + w_endpoint = kuratowski_walkup(w_ancestor, + forbidden_edge, + goal_edge, + is_embedded, + w_path + ); + + } + + } + + + } + + + //We're done isolating the Kuratowski subgraph at this point - + //but there's still some cleaning up to do. + + //Update is_in_subgraph with the paths we just found + + xi_end = x_external_path.end(); + for(xi = x_external_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = y_external_path.end(); + for(xi = y_external_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = z_v_path.end(); + for(xi = z_v_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = case_d_edges.end(); + for(xi = case_d_edges.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + xi_end = w_path.end(); + for(xi = w_path.begin(); xi != xi_end; ++xi) + is_in_subgraph[*xi] = true; + + child = bicomp_root; + parent = dfs_parent[child]; + while(child != parent) + { + is_in_subgraph[dfs_parent_edge[child]] = true; + tie(parent, child) = std::make_pair( dfs_parent[parent], parent ); + } + + + + + // At this point, we've already isolated the Kuratowski subgraph and + // collected all of the edges that compose it in the is_in_subgraph + // property map. But we want the verification of such a subgraph to be + // a deterministic process, and we can simplify the function + // is_kuratowski_subgraph by cleaning up some edges here. + + if (chosen_case == detail::BM_CASE_B) + { + is_in_subgraph[dfs_parent_edge[v]] = false; + } + else if (chosen_case == detail::BM_CASE_C) + { + // In a case C subgraph, at least one of the x-y path endpoints + // (call it alpha) is above either x or y on the outer face. The + // other endpoint may be attached at x or y OR above OR below. In + // any of these three cases, we can form a K_3_3 by removing the + // edge attached to v on the outer face that is NOT on the path to + // alpha. + + typename face_vertex_iterator<single_side, follow_visitor>::type + face_itr, face_end; + if (face_handles[v_dfchild_handle.first_vertex()].first_edge() == + v_dfchild_handle.first_edge() + ) + { + face_itr = typename face_vertex_iterator + <single_side, follow_visitor>::type + (v_dfchild_handle.first_vertex(), face_handles, second_side()); + } + else + { + face_itr = typename face_vertex_iterator + <single_side, follow_visitor>::type + (v_dfchild_handle.first_vertex(), face_handles, first_side()); + } + + for(; true; ++face_itr) + { + vertex_t current_vertex(*face_itr); + if (current_vertex == x || current_vertex == y) + { + is_in_subgraph[v_dfchild_handle.first_edge()] = false; + break; + } + else if (current_vertex == first_x_y_path_endpoint || + current_vertex == second_x_y_path_endpoint) + { + is_in_subgraph[v_dfchild_handle.second_edge()] = false; + break; + } + } + + } + else if (chosen_case == detail::BM_CASE_D) + { + // Need to remove both of the edges adjacent to v on the outer face. + // remove the connecting edges from v to bicomp, then + // is_kuratowski_subgraph will shrink vertices of degree 1 + // automatically... + + is_in_subgraph[v_dfchild_handle.first_edge()] = false; + is_in_subgraph[v_dfchild_handle.second_edge()] = false; + + } + else if (chosen_case == detail::BM_CASE_E) + { + // Similarly to case C, if the endpoints of the x-y path are both + // below x and y, we should remove an edge to allow the subgraph to + // contract to a K_3_3. + + + if ((first_x_y_path_endpoint != x && first_x_y_path_endpoint != y) || + (second_x_y_path_endpoint != x && second_x_y_path_endpoint != y) + ) + { + is_in_subgraph[dfs_parent_edge[v]] = false; + + vertex_t deletion_endpoint, other_endpoint; + if (lower_face_vertex[first_x_y_path_endpoint]) + { + deletion_endpoint = second_x_y_path_endpoint; + other_endpoint = first_x_y_path_endpoint; + } + else + { + deletion_endpoint = first_x_y_path_endpoint; + other_endpoint = second_x_y_path_endpoint; + } + + typename face_edge_iterator<>::type face_itr, face_end; + + bool found_other_endpoint = false; + for(face_itr = typename face_edge_iterator<>::type + (deletion_endpoint, face_handles, first_side()); + face_itr != face_end; ++face_itr + ) + { + edge_t e(*face_itr); + if (source(e,g) == other_endpoint || + target(e,g) == other_endpoint + ) + { + found_other_endpoint = true; + break; + } + } + + if (found_other_endpoint) + { + is_in_subgraph[face_handles[deletion_endpoint].first_edge()] + = false; + } + else + { + is_in_subgraph[face_handles[deletion_endpoint].second_edge()] + = false; + } + } + + } + + + for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) + if (is_in_subgraph[*ei]) + *o_itr = *ei; + + } + + + + template<typename EdgePermutation> + void make_edge_permutation(EdgePermutation perm) + { + vertex_iterator_t vi, vi_end; + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + perm[v].clear(); + face_handles[v].get_list(std::back_inserter(perm[v])); + } + } + + + private: + + const Graph& g; + VertexIndexMap vm; + + vertex_t kuratowski_v; + vertex_t kuratowski_x; + vertex_t kuratowski_y; + + vertex_list_t garbage; // we delete items from linked lists by + // splicing them into garbage + + //only need these two for kuratowski subgraph isolation + std::vector<vertex_t> current_merge_points; + std::vector<edge_t> embedded_edges; + + //property map storage + std::vector<v_size_t> low_point_vector; + std::vector<vertex_t> dfs_parent_vector; + std::vector<v_size_t> dfs_number_vector; + std::vector<v_size_t> least_ancestor_vector; + std::vector<face_handle_list_ptr_t> pertinent_roots_vector; + std::vector<v_size_t> backedge_flag_vector; + std::vector<v_size_t> visited_vector; + std::vector< face_handle_t > face_handles_vector; + std::vector< face_handle_t > dfs_child_handles_vector; + std::vector< vertex_list_ptr_t > separated_dfs_child_list_vector; + std::vector< typename vertex_list_t::iterator > + separated_node_in_parent_list_vector; + std::vector<vertex_t> canonical_dfs_child_vector; + std::vector<bool> flipped_vector; + std::vector<edge_vector_t> backedges_vector; + edge_vector_t self_loops; + std::vector<edge_t> dfs_parent_edge_vector; + vertex_vector_t vertices_by_dfs_num; + + //property maps + vertex_to_v_size_map_t low_point; + vertex_to_vertex_map_t dfs_parent; + vertex_to_v_size_map_t dfs_number; + vertex_to_v_size_map_t least_ancestor; + vertex_to_face_handle_list_ptr_map_t pertinent_roots; + vertex_to_v_size_map_t backedge_flag; + vertex_to_v_size_map_t visited; + vertex_to_face_handle_map_t face_handles; + vertex_to_face_handle_map_t dfs_child_handles; + vertex_to_vertex_list_ptr_map_t separated_dfs_child_list; + vertex_to_separated_node_map_t separated_node_in_parent_list; + vertex_to_vertex_map_t canonical_dfs_child; + vertex_to_bool_map_t flipped; + vertex_to_edge_vector_map_t backedges; + vertex_to_edge_map_t dfs_parent_edge; //only need for kuratowski + + merge_stack_t merge_stack; + + }; + + +} //namespace boost + +#endif //__BOYER_MYRVOLD_IMPL_HPP__ diff --git a/Utilities/BGL/boost/graph/planar_detail/bucket_sort.hpp b/Utilities/BGL/boost/graph/planar_detail/bucket_sort.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4ec95d8e2887b78b4d42c15d9a226582523e1e48 --- /dev/null +++ b/Utilities/BGL/boost/graph/planar_detail/bucket_sort.hpp @@ -0,0 +1,144 @@ +//======================================================================= +// Copyright 2007 Aaron Windsor +// +// 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 __BUCKET_SORT_HPP__ +#define __BUCKET_SORT_HPP__ + +#include <vector> +#include <algorithm> +#include <boost/property_map/property_map.hpp> + + + +namespace boost +{ + + + template <typename ItemToRankMap> + struct rank_comparison + { + rank_comparison(ItemToRankMap arg_itrm) : itrm(arg_itrm) {} + + template <typename Item> + bool operator() (Item x, Item y) const + { + return get(itrm, x) < get(itrm, y); + } + + private: + ItemToRankMap itrm; + + }; + + + template <typename TupleType, + int N, + typename PropertyMapWrapper = identity_property_map> + struct property_map_tuple_adaptor : + public put_get_helper< typename PropertyMapWrapper::value_type, + property_map_tuple_adaptor + <TupleType, N, PropertyMapWrapper> + > + { + typedef typename PropertyMapWrapper::reference reference; + typedef typename PropertyMapWrapper::value_type value_type; + typedef TupleType key_type; + typedef readable_property_map_tag category; + + property_map_tuple_adaptor() {} + + property_map_tuple_adaptor(PropertyMapWrapper wrapper_map) : + m_wrapper_map(wrapper_map) + {} + + inline value_type operator[](const key_type& x) const + { + return get(m_wrapper_map, get<n>(x)); + } + + static const int n = N; + PropertyMapWrapper m_wrapper_map; + + }; + + + + + // This function sorts a sequence of n items by their ranks in linear time, + // given that all ranks are in the range [0, range). This sort is stable. + template <typename ForwardIterator, + typename ItemToRankMap, + typename SizeType> + void bucket_sort(ForwardIterator begin, + ForwardIterator end, + ItemToRankMap rank, + SizeType range = 0) + { +#ifdef BOOST_GRAPH_PREFER_STD_LIB + std::stable_sort(begin, end, rank_comparison<ItemToRankMap>(rank)); +#else + typedef std::vector + < typename boost::property_traits<ItemToRankMap>::key_type > + vector_of_values_t; + typedef std::vector< vector_of_values_t > vector_of_vectors_t; + + if (!range) + { + rank_comparison<ItemToRankMap> cmp(rank); + ForwardIterator max_by_rank = std::max_element(begin, end, cmp); + if (max_by_rank == end) + return; + range = get(rank, *max_by_rank) + 1; + } + + vector_of_vectors_t temp_values(range); + + for(ForwardIterator itr = begin; itr != end; ++itr) + { + temp_values[get(rank, *itr)].push_back(*itr); + } + + ForwardIterator orig_seq_itr = begin; + typename vector_of_vectors_t::iterator itr_end = temp_values.end(); + for(typename vector_of_vectors_t::iterator itr = temp_values.begin(); + itr != itr_end; ++itr + ) + { + typename vector_of_values_t::iterator jtr_end = itr->end(); + for(typename vector_of_values_t::iterator jtr = itr->begin(); + jtr != jtr_end; ++jtr + ) + { + *orig_seq_itr = *jtr; + ++orig_seq_itr; + } + } +#endif + } + + + template <typename ForwardIterator, typename ItemToRankMap> + void bucket_sort(ForwardIterator begin, + ForwardIterator end, + ItemToRankMap rank) + { + bucket_sort(begin, end, rank, 0); + } + + template <typename ForwardIterator> + void bucket_sort(ForwardIterator begin, + ForwardIterator end + ) + { + bucket_sort(begin, end, identity_property_map()); + } + + +} //namespace boost + + +#endif //__BUCKET_SORT_HPP__ diff --git a/Utilities/BGL/boost/graph/planar_detail/face_handles.hpp b/Utilities/BGL/boost/graph/planar_detail/face_handles.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4e28d4afcef571ed0d853491d6ee90a3b89dcd5d --- /dev/null +++ b/Utilities/BGL/boost/graph/planar_detail/face_handles.hpp @@ -0,0 +1,497 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __FACE_HANDLES_HPP__ +#define __FACE_HANDLES_HPP__ + + +#include <list> +#include <boost/graph/graph_traits.hpp> +#include <boost/shared_ptr.hpp> + + +// A "face handle" is an optimization meant to serve two purposes in +// the implementation of the Boyer-Myrvold planarity test: (1) it holds +// the partial planar embedding of a particular vertex as it's being +// constructed, and (2) it allows for efficient traversal around the +// outer face of the partial embedding at that particular vertex. A face +// handle is lightweight, just a shared pointer to the actual implementation, +// since it is passed around/copied liberally in the algorithm. It consists +// of an "anchor" (the actual vertex it's associated with) as well as a +// sequence of edges. The functions first_vertex/second_vertex and +// first_edge/second_edge allow fast access to the beginning and end of the +// stored sequence, which allows one to traverse the outer face of the partial +// planar embedding as it's being created. +// +// There are some policies below that define the contents of the face handles: +// in the case no embedding is needed (for example, if one just wants to use +// the Boyer-Myrvold algorithm as a true/false test for planarity, the +// no_embedding class can be passed as the StoreEmbedding policy. Otherwise, +// either std_list (which uses as std::list) or recursive_lazy_list can be +// passed as this policy. recursive_lazy_list has the best theoretical +// performance (O(n) for a sequence of interleaved concatenations and reversals +// of the underlying list), but I've noticed little difference between std_list +// and recursive_lazy_list in my tests, even though using std_list changes +// the worst-case complexity of the planarity test to O(n^2) +// +// Another policy is StoreOldHandlesPolicy, which specifies whether or not +// to keep a record of the previous first/second vertex/edge - this is needed +// if a Kuratowski subgraph needs to be isolated. + + +namespace boost { namespace graph { namespace detail { + + + //face handle policies + + //EmbeddingStorage policy + struct store_embedding {}; + struct recursive_lazy_list : public store_embedding {}; + struct std_list : public store_embedding {}; + struct no_embedding {}; + + //StoreOldHandlesPolicy + struct store_old_handles {}; + struct no_old_handles {}; + + + + + template<typename DataType> + struct lazy_list_node + { + typedef shared_ptr< lazy_list_node<DataType> > ptr_t; + + lazy_list_node(const DataType& data) : + m_reversed(false), + m_data(data), + m_has_data(true) + {} + + lazy_list_node(ptr_t left_child, ptr_t right_child) : + m_reversed(false), + m_has_data(false), + m_left_child(left_child), + m_right_child(right_child) + {} + + bool m_reversed; + DataType m_data; + bool m_has_data; + shared_ptr<lazy_list_node> m_left_child; + shared_ptr<lazy_list_node> m_right_child; + }; + + + + template <typename StoreOldHandlesPolicy, typename Vertex, typename Edge> + struct old_handles_storage; + + template <typename Vertex, typename Edge> + struct old_handles_storage<store_old_handles, Vertex, Edge> + { + Vertex first_vertex; + Vertex second_vertex; + Edge first_edge; + Edge second_edge; + }; + + template <typename Vertex, typename Edge> + struct old_handles_storage<no_old_handles, Vertex, Edge> + {}; + + + + + + + template <typename StoreEmbeddingPolicy, typename Edge> + struct edge_list_storage; + + + + + + template <typename Edge> + struct edge_list_storage<no_embedding, Edge> + { + typedef void type; + + void push_back(Edge) {} + void push_front(Edge) {} + void reverse() {} + void concat_front(edge_list_storage<no_embedding,Edge>) {} + void concat_back(edge_list_storage<no_embedding,Edge>) {} + template <typename OutputIterator> + void get_list(OutputIterator) {} + }; + + + + + + template <typename Edge> + struct edge_list_storage<recursive_lazy_list, Edge> + { + typedef lazy_list_node<Edge> node_type; + typedef shared_ptr< node_type > type; + type value; + + void push_back(Edge e) + { + type new_node(new node_type(e)); + value = type(new node_type(value, new_node)); + } + + void push_front(Edge e) + { + type new_node(new node_type(e)); + value = type(new node_type(new_node, value)); + } + + void reverse() + { + value->m_reversed = !value->m_reversed; + } + + void concat_front(edge_list_storage<recursive_lazy_list, Edge> other) + { + value = type(new node_type(other.value, value)); + } + + void concat_back(edge_list_storage<recursive_lazy_list, Edge> other) + { + value = type(new node_type(value, other.value)); + } + + template <typename OutputIterator> + void get_list(OutputIterator out) + { + get_list_helper(out, value); + } + + private: + + template <typename OutputIterator> + void get_list_helper(OutputIterator o_itr, + type root, + bool flipped = false + ) + { + if (!root) + return; + + if (root->m_has_data) + *o_itr = root->m_data; + + if ((flipped && !root->m_reversed) || + (!flipped && root->m_reversed) + ) + { + get_list_helper(o_itr, root->m_right_child, true); + get_list_helper(o_itr, root->m_left_child, true); + } + else + { + get_list_helper(o_itr, root->m_left_child, false); + get_list_helper(o_itr, root->m_right_child, false); + } + + } + + }; + + + + + + template <typename Edge> + struct edge_list_storage<std_list, Edge> + { + typedef std::list<Edge> type; + type value; + + void push_back(Edge e) + { + value.push_back(e); + } + + void push_front(Edge e) + { + value.push_front(e); + } + + void reverse() + { + value.reverse(); + } + + void concat_front(edge_list_storage<std_list,Edge> other) + { + value.splice(value.begin(), other.value); + } + + void concat_back(edge_list_storage<std_list, Edge> other) + { + value.splice(value.end(), other.value); + } + + template <typename OutputIterator> + void get_list(OutputIterator out) + { + std::copy(value.begin(), value.end(), out); + } + + }; + + + + + + + + template<typename Graph, + typename StoreOldHandlesPolicy, + typename StoreEmbeddingPolicy + > + struct face_handle_impl + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename edge_list_storage<StoreEmbeddingPolicy, edge_t>::type + edge_list_storage_t; + + + face_handle_impl() : + cached_first_vertex(graph_traits<Graph>::null_vertex()), + cached_second_vertex(graph_traits<Graph>::null_vertex()), + true_first_vertex(graph_traits<Graph>::null_vertex()), + true_second_vertex(graph_traits<Graph>::null_vertex()), + anchor(graph_traits<Graph>::null_vertex()) + { + initialize_old_vertices_dispatch(StoreOldHandlesPolicy()); + } + + void initialize_old_vertices_dispatch(store_old_handles) + { + old_handles.first_vertex = graph_traits<Graph>::null_vertex(); + old_handles.second_vertex = graph_traits<Graph>::null_vertex(); + } + + void initialize_old_vertices_dispatch(no_old_handles) {} + + vertex_t cached_first_vertex; + vertex_t cached_second_vertex; + vertex_t true_first_vertex; + vertex_t true_second_vertex; + vertex_t anchor; + edge_t cached_first_edge; + edge_t cached_second_edge; + + edge_list_storage<StoreEmbeddingPolicy, edge_t> edge_list; + old_handles_storage<StoreOldHandlesPolicy, vertex_t, edge_t> old_handles; + + }; + + + + + + + + + + + + template <typename Graph, + typename StoreOldHandlesPolicy = store_old_handles, + typename StoreEmbeddingPolicy = recursive_lazy_list + > + class face_handle + { + public: + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef face_handle_impl + <Graph, StoreOldHandlesPolicy, StoreEmbeddingPolicy> impl_t; + typedef face_handle + <Graph, StoreOldHandlesPolicy, StoreEmbeddingPolicy> self_t; + + face_handle(vertex_t anchor = graph_traits<Graph>::null_vertex()) : + pimpl(new impl_t()) + { + pimpl->anchor = anchor; + } + + face_handle(vertex_t anchor, edge_t initial_edge, const Graph& g) : + pimpl(new impl_t()) + { + vertex_t s(source(initial_edge,g)); + vertex_t t(target(initial_edge,g)); + vertex_t other_vertex = s == anchor ? t : s; + pimpl->anchor = anchor; + pimpl->cached_first_edge = initial_edge; + pimpl->cached_second_edge = initial_edge; + pimpl->cached_first_vertex = other_vertex; + pimpl->cached_second_vertex = other_vertex; + pimpl->true_first_vertex = other_vertex; + pimpl->true_second_vertex = other_vertex; + + pimpl->edge_list.push_back(initial_edge); + store_old_face_handles_dispatch(StoreOldHandlesPolicy()); + } + + //default copy construction, assignment okay. + + void push_first(edge_t e, const Graph& g) + { + pimpl->edge_list.push_front(e); + pimpl->cached_first_vertex = pimpl->true_first_vertex = + source(e, g) == pimpl->anchor ? target(e,g) : source(e,g); + pimpl->cached_first_edge = e; + } + + void push_second(edge_t e, const Graph& g) + { + pimpl->edge_list.push_back(e); + pimpl->cached_second_vertex = pimpl->true_second_vertex = + source(e, g) == pimpl->anchor ? target(e,g) : source(e,g); + pimpl->cached_second_edge = e; + } + + inline void store_old_face_handles() + { + store_old_face_handles_dispatch(StoreOldHandlesPolicy()); + } + + inline vertex_t first_vertex() const + { + return pimpl->cached_first_vertex; + } + + inline vertex_t second_vertex() const + { + return pimpl->cached_second_vertex; + } + + inline vertex_t true_first_vertex() const + { + return pimpl->true_first_vertex; + } + + inline vertex_t true_second_vertex() const + { + return pimpl->true_second_vertex; + } + + inline vertex_t old_first_vertex() const + { + return pimpl->old_handles.first_vertex; + } + + inline vertex_t old_second_vertex() const + { + return pimpl->old_handles.second_vertex; + } + + inline edge_t old_first_edge() const + { + return pimpl->old_handles.first_edge; + } + + inline edge_t old_second_edge() const + { + return pimpl->old_handles.second_edge; + } + + inline edge_t first_edge() const + { + return pimpl->cached_first_edge; + } + + inline edge_t second_edge() const + { + return pimpl->cached_second_edge; + } + + inline vertex_t get_anchor() const + { + return pimpl->anchor; + } + + void glue_first_to_second + (face_handle<Graph,StoreOldHandlesPolicy,StoreEmbeddingPolicy>& bottom) + { + pimpl->edge_list.concat_front(bottom.pimpl->edge_list); + pimpl->true_first_vertex = bottom.pimpl->true_first_vertex; + pimpl->cached_first_vertex = bottom.pimpl->cached_first_vertex; + pimpl->cached_first_edge = bottom.pimpl->cached_first_edge; + } + + void glue_second_to_first + (face_handle<Graph,StoreOldHandlesPolicy,StoreEmbeddingPolicy>& bottom) + { + pimpl->edge_list.concat_back(bottom.pimpl->edge_list); + pimpl->true_second_vertex = bottom.pimpl->true_second_vertex; + pimpl->cached_second_vertex = bottom.pimpl->cached_second_vertex; + pimpl->cached_second_edge = bottom.pimpl->cached_second_edge; + } + + void flip() + { + pimpl->edge_list.reverse(); + std::swap(pimpl->true_first_vertex, pimpl->true_second_vertex); + std::swap(pimpl->cached_first_vertex, pimpl->cached_second_vertex); + std::swap(pimpl->cached_first_edge, pimpl->cached_second_edge); + } + + template <typename OutputIterator> + void get_list(OutputIterator o_itr) + { + pimpl->edge_list.get_list(o_itr); + } + + void reset_vertex_cache() + { + pimpl->cached_first_vertex = pimpl->true_first_vertex; + pimpl->cached_second_vertex = pimpl->true_second_vertex; + } + + inline void set_first_vertex(vertex_t v) + { + pimpl->cached_first_vertex = v; + } + + inline void set_second_vertex(vertex_t v) + { + pimpl->cached_second_vertex = v; + } + + private: + + void store_old_face_handles_dispatch(store_old_handles) + { + pimpl->old_handles.first_vertex = pimpl->true_first_vertex; + pimpl->old_handles.second_vertex = pimpl->true_second_vertex; + pimpl->old_handles.first_edge = pimpl->cached_first_edge; + pimpl->old_handles.second_edge = pimpl->cached_second_edge; + } + + void store_old_face_handles_dispatch(no_old_handles) {} + + + + boost::shared_ptr<impl_t> pimpl; + + }; + + +} /* namespace detail */ } /* namespace graph */ } /* namespace boost */ + + +#endif //__FACE_HANDLES_HPP__ diff --git a/Utilities/BGL/boost/graph/planar_detail/face_iterators.hpp b/Utilities/BGL/boost/graph/planar_detail/face_iterators.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b5e7ab95b20e4331476bb3a7b234fa90b66eba2f --- /dev/null +++ b/Utilities/BGL/boost/graph/planar_detail/face_iterators.hpp @@ -0,0 +1,375 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __FACE_ITERATORS_HPP__ +#define __FACE_ITERATORS_HPP__ + +#include <boost/iterator/iterator_facade.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/graph/graph_traits.hpp> + +namespace boost +{ + + //tags for defining traversal properties + + //VisitorType + struct lead_visitor {}; + struct follow_visitor {}; + + //TraversalType + struct single_side {}; + struct both_sides {}; + + //TraversalSubType + struct first_side {}; //for single_side + struct second_side {}; //for single_side + struct alternating {}; //for both_sides + + //Time + struct current_iteration {}; + struct previous_iteration {}; + + // Why TraversalType AND TraversalSubType? TraversalSubType is a function + // template parameter passed in to the constructor of the face iterator, + // whereas TraversalType is a class template parameter. This lets us decide + // at runtime whether to move along the first or second side of a bicomp (by + // assigning a face_iterator that has been constructed with TraversalSubType + // = first_side or second_side to a face_iterator variable) without any of + // the virtual function overhead that comes with implementing this + // functionality as a more structured form of type erasure. It also allows + // a single face_iterator to be the end iterator of two iterators traversing + // both sides of a bicomp. + + //ValueType is either graph_traits<Graph>::vertex_descriptor + //or graph_traits<Graph>::edge_descriptor + + + //forward declaration (defining defaults) + template <typename Graph, + typename FaceHandlesMap, + typename ValueType, + typename BicompSideToTraverse = single_side, + typename VisitorType = lead_visitor, + typename Time = current_iteration + > + class face_iterator; + + + + template <typename Graph, bool StoreEdge> + struct edge_storage + {}; + + template <typename Graph> + struct edge_storage <Graph, true> + { + typename graph_traits<Graph>::edge_descriptor value; + }; + + + + + //specialization for TraversalType = traverse_vertices + template <typename Graph, + typename FaceHandlesMap, + typename ValueType, + typename TraversalType, + typename VisitorType, + typename Time + > + + class face_iterator + : public boost::iterator_facade < face_iterator<Graph, + FaceHandlesMap, + ValueType, + TraversalType, + VisitorType, + Time + >, + ValueType, + boost::forward_traversal_tag, + ValueType + > + { + public: + + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef face_iterator + <Graph,FaceHandlesMap,ValueType,TraversalType,VisitorType,Time> self; + typedef typename FaceHandlesMap::value_type face_handle_t; + + face_iterator() : + m_lead(graph_traits<Graph>::null_vertex()), + m_follow(graph_traits<Graph>::null_vertex()) + {} + + template <typename TraversalSubType> + face_iterator(face_handle_t anchor_handle, + FaceHandlesMap face_handles, + TraversalSubType traversal_type): + m_follow(anchor_handle.get_anchor()), + m_face_handles(face_handles) + { + set_lead_dispatch(anchor_handle, traversal_type); + } + + template <typename TraversalSubType> + face_iterator(vertex_t anchor, + FaceHandlesMap face_handles, + TraversalSubType traversal_type): + m_follow(anchor), + m_face_handles(face_handles) + { + set_lead_dispatch(m_face_handles[anchor], traversal_type); + } + + private: + + friend class boost::iterator_core_access; + + + + + inline vertex_t get_first_vertex(face_handle_t anchor_handle, + current_iteration + ) + { + return anchor_handle.first_vertex(); + } + + inline vertex_t get_second_vertex(face_handle_t anchor_handle, + current_iteration + ) + { + return anchor_handle.second_vertex(); + } + + inline vertex_t get_first_vertex(face_handle_t anchor_handle, + previous_iteration + ) + { + return anchor_handle.old_first_vertex(); + } + + inline vertex_t get_second_vertex(face_handle_t anchor_handle, + previous_iteration + ) + { + return anchor_handle.old_second_vertex(); + } + + + + + + inline void set_lead_dispatch(face_handle_t anchor_handle, first_side) + { + m_lead = get_first_vertex(anchor_handle, Time()); + set_edge_to_first_dispatch(anchor_handle, ValueType(), Time()); + } + + inline void set_lead_dispatch(face_handle_t anchor_handle, second_side) + { + m_lead = get_second_vertex(anchor_handle, Time()); + set_edge_to_second_dispatch(anchor_handle, ValueType(), Time()); + } + + + + + + inline void set_edge_to_first_dispatch(face_handle_t anchor_handle, + edge_t, + current_iteration + ) + { + m_edge.value = anchor_handle.first_edge(); + } + + inline void set_edge_to_second_dispatch(face_handle_t anchor_handle, + edge_t, + current_iteration + ) + { + m_edge.value = anchor_handle.second_edge(); + } + + inline void set_edge_to_first_dispatch(face_handle_t anchor_handle, + edge_t, + previous_iteration + ) + { + m_edge.value = anchor_handle.old_first_edge(); + } + + inline void set_edge_to_second_dispatch(face_handle_t anchor_handle, + edge_t, + previous_iteration + ) + { + m_edge.value = anchor_handle.old_second_edge(); + } + + template<typename T> + inline void set_edge_to_first_dispatch(face_handle_t, vertex_t, T) + {} + + template<typename T> + inline void set_edge_to_second_dispatch(face_handle_t, vertex_t, T) + {} + + void increment() + { + face_handle_t curr_face_handle(m_face_handles[m_lead]); + vertex_t first = get_first_vertex(curr_face_handle, Time()); + vertex_t second = get_second_vertex(curr_face_handle, Time()); + if (first == m_follow) + { + m_follow = m_lead; + set_edge_to_second_dispatch(curr_face_handle, ValueType(), Time()); + m_lead = second; + } + else if (second == m_follow) + { + m_follow = m_lead; + set_edge_to_first_dispatch(curr_face_handle, ValueType(), Time()); + m_lead = first; + } + else + m_lead = m_follow = graph_traits<Graph>::null_vertex(); + } + + bool equal(self const& other) const + { + return m_lead == other.m_lead && m_follow == other.m_follow; + } + + ValueType dereference() const + { + return dereference_dispatch(VisitorType(), ValueType()); + } + + inline ValueType dereference_dispatch(lead_visitor, vertex_t) const + { return m_lead; } + + inline ValueType dereference_dispatch(follow_visitor, vertex_t) const + { return m_follow; } + + inline ValueType dereference_dispatch(lead_visitor, edge_t) const + { return m_edge.value; } + + inline ValueType dereference_dispatch(follow_visitor, edge_t) const + { return m_edge.value; } + + vertex_t m_lead; + vertex_t m_follow; + edge_storage<Graph, boost::is_same<ValueType, edge_t>::value > m_edge; + FaceHandlesMap m_face_handles; + }; + + + + + + + + + + template <typename Graph, + typename FaceHandlesMap, + typename ValueType, + typename VisitorType, + typename Time + > + class face_iterator + <Graph, FaceHandlesMap, ValueType, both_sides, VisitorType, Time> + : public boost::iterator_facade< face_iterator<Graph, + FaceHandlesMap, + ValueType, + both_sides, + VisitorType, + Time>, + ValueType, + boost::forward_traversal_tag, + ValueType > + { + public: + + typedef face_iterator + <Graph,FaceHandlesMap,ValueType,both_sides,VisitorType,Time> self; + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename FaceHandlesMap::value_type face_handle_t; + + face_iterator() {} + + face_iterator(face_handle_t anchor_handle, FaceHandlesMap face_handles): + first_itr(anchor_handle, face_handles, first_side()), + second_itr(anchor_handle, face_handles, second_side()), + first_is_active(true), + first_increment(true) + {} + + face_iterator(vertex_t anchor, FaceHandlesMap face_handles): + first_itr(face_handles[anchor], face_handles, first_side()), + second_itr(face_handles[anchor], face_handles, second_side()), + first_is_active(true), + first_increment(true) + {} + + private: + + friend class boost::iterator_core_access; + + typedef face_iterator + <Graph, FaceHandlesMap, ValueType, single_side, follow_visitor, Time> + inner_itr_t; + + void increment() + { + if (first_increment) + { + ++first_itr; + ++second_itr; + first_increment = false; + } + else if (first_is_active) + ++first_itr; + else + ++second_itr; + first_is_active = !first_is_active; + } + + bool equal(self const& other) const + { + //Want this iterator to be equal to the "end" iterator when at least + //one of the iterators has reached the root of the current bicomp. + //This isn't ideal, but it works. + + return (first_itr == other.first_itr || second_itr == other.second_itr); + } + + ValueType dereference() const + { + return first_is_active ? *first_itr : *second_itr; + } + + inner_itr_t first_itr; + inner_itr_t second_itr; + inner_itr_t face_end; + bool first_is_active; + bool first_increment; + + }; + + +} /* namespace boost */ + + +#endif //__FACE_ITERATORS_HPP__ diff --git a/Utilities/BGL/boost/graph/planar_face_traversal.hpp b/Utilities/BGL/boost/graph/planar_face_traversal.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2f8a2ee33ae52e209f1fa89bbd575e24908caa8f --- /dev/null +++ b/Utilities/BGL/boost/graph/planar_face_traversal.hpp @@ -0,0 +1,210 @@ +//======================================================================= +// Copyright (c) Aaron Windsor 2007 +// +// 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 __PLANAR_FACE_TRAVERSAL_HPP__ +#define __PLANAR_FACE_TRAVERSAL_HPP__ + +#include <vector> +#include <boost/utility.hpp> //for next and prior +#include <boost/graph/graph_traits.hpp> + + +namespace boost +{ + + + + + struct planar_face_traversal_visitor + { + void begin_traversal() + {} + + void begin_face() + {} + + template <typename Edge> + void next_edge(Edge) + {} + + template <typename Vertex> + void next_vertex(Vertex) + {} + + void end_face() + {} + + void end_traversal() + {} + + }; + + + + + + template<typename Graph, + typename PlanarEmbedding, + typename Visitor, + typename EdgeIndexMap> + void planar_face_traversal(const Graph& g, + PlanarEmbedding embedding, + Visitor& visitor, EdgeIndexMap em + ) + { + typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; + typedef typename graph_traits<Graph>::edge_descriptor edge_t; + typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator_t; + typedef typename graph_traits<Graph>::edge_iterator edge_iterator_t; + typedef typename + property_traits<PlanarEmbedding>::value_type embedding_value_t; + typedef typename embedding_value_t::const_iterator embedding_iterator_t; + + typedef typename + std::vector< std::set<vertex_t> > distinguished_edge_storage_t; + typedef typename + std::vector< std::map<vertex_t, edge_t> > + distinguished_edge_to_edge_storage_t; + + typedef typename + boost::iterator_property_map + <typename distinguished_edge_storage_t::iterator, EdgeIndexMap> + distinguished_edge_map_t; + + typedef typename + boost::iterator_property_map + <typename distinguished_edge_to_edge_storage_t::iterator, EdgeIndexMap> + distinguished_edge_to_edge_map_t; + + distinguished_edge_storage_t visited_vector(num_edges(g)); + distinguished_edge_to_edge_storage_t next_edge_vector(num_edges(g)); + + distinguished_edge_map_t visited(visited_vector.begin(), em); + distinguished_edge_to_edge_map_t next_edge(next_edge_vector.begin(), em); + + vertex_iterator_t vi, vi_end; + typename std::vector<edge_t>::iterator ei, ei_end; + edge_iterator_t fi, fi_end; + embedding_iterator_t pi, pi_begin, pi_end; + + visitor.begin_traversal(); + + // Initialize the next_edge property map. This map is initialized from the + // PlanarEmbedding so that get(next_edge, e)[v] is the edge that comes + // after e in the clockwise embedding around vertex v. + + for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi) + { + vertex_t v(*vi); + pi_begin = embedding[v].begin(); + pi_end = embedding[v].end(); + for(pi = pi_begin; pi != pi_end; ++pi) + { + edge_t e(*pi); + std::map<vertex_t, edge_t> m = get(next_edge, e); + m[v] = boost::next(pi) == pi_end ? *pi_begin : *boost::next(pi); + put(next_edge, e, m); + } + } + + // Take a copy of the edges in the graph here, since we want to accomodate + // face traversals that add edges to the graph (for triangulation, in + // particular) and don't want to use invalidated edge iterators. + // Also, while iterating over all edges in the graph, we single out + // any self-loops, which need some special treatment in the face traversal. + + std::vector<edge_t> self_loops; + std::vector<edge_t> edges_cache; + std::vector<vertex_t> vertices_in_edge; + + for(tie(fi,fi_end) = edges(g); fi != fi_end; ++fi) + { + edge_t e(*fi); + edges_cache.push_back(e); + if (source(e,g) == target(e,g)) + self_loops.push_back(e); + } + + + // Iterate over all edges in the graph + ei_end = edges_cache.end(); + for(ei = edges_cache.begin(); ei != ei_end; ++ei) + { + + edge_t e(*ei); + vertices_in_edge.clear(); + vertices_in_edge.push_back(source(e,g)); + vertices_in_edge.push_back(target(e,g)); + + typename std::vector<vertex_t>::iterator vi, vi_end; + vi_end = vertices_in_edge.end(); + + //Iterate over both vertices in the current edge + for(vi = vertices_in_edge.begin(); vi != vi_end; ++vi) + { + + vertex_t v(*vi); + std::set<vertex_t> e_visited = get(visited, e); + typename std::set<vertex_t>::iterator e_visited_found + = e_visited.find(v); + + if (e_visited_found == e_visited.end()) + visitor.begin_face(); + + while (e_visited.find(v) == e_visited.end()) + { + visitor.next_vertex(v); + visitor.next_edge(e); + e_visited.insert(v); + put(visited, e, e_visited); + v = source(e,g) == v ? target(e,g) : source(e,g); + e = get(next_edge, e)[v]; + e_visited = get(visited, e); + } + + if (e_visited_found == e_visited.end()) + visitor.end_face(); + + } + + } + + // Iterate over all self-loops, visiting them once separately + // (they've already been visited once, this visitation is for + // the "inside" of the self-loop) + + ei_end = self_loops.end(); + for(ei = self_loops.begin(); ei != ei_end; ++ei) + { + visitor.begin_face(); + visitor.next_edge(*ei); + visitor.next_vertex(source(*ei,g)); + visitor.end_face(); + } + + visitor.end_traversal(); + + } + + + + template<typename Graph, typename PlanarEmbedding, typename Visitor> + inline void planar_face_traversal(const Graph& g, + PlanarEmbedding embedding, + Visitor& visitor + ) + { + planar_face_traversal(g, embedding, visitor, get(edge_index, g)); + } + + + + +} //namespace boost + +#endif //__PLANAR_FACE_TRAVERSAL_HPP__ diff --git a/Utilities/BGL/boost/graph/plod_generator.hpp b/Utilities/BGL/boost/graph/plod_generator.hpp index 324594a01de30d629a4966430dc33367cec9dec8..4e557cf070c9af0b1347bb9d042ddddc0ba2e969 100644 --- a/Utilities/BGL/boost/graph/plod_generator.hpp +++ b/Utilities/BGL/boost/graph/plod_generator.hpp @@ -1,7 +1,7 @@ -// Copyright 2004 The Trustees of Indiana University. +// Copyright 2004-2006 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -15,87 +15,158 @@ #include <boost/shared_ptr.hpp> #include <boost/graph/graph_traits.hpp> #include <vector> -#include <cmath> +#include <map> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/mpl/if.hpp> namespace boost { + template<typename RandomGenerator> + class out_directed_plod_iterator + { + public: + typedef std::forward_iterator_tag iterator_category; + typedef std::pair<std::size_t, std::size_t> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef std::ptrdiff_t difference_type; + + out_directed_plod_iterator() : gen(0), at_end(true) { } + + out_directed_plod_iterator(RandomGenerator& gen, std::size_t n, + double alpha, double beta, + bool allow_self_loops) + : gen(&gen), n(n), alpha(alpha), beta(beta), + allow_self_loops(allow_self_loops), at_end(false), degree(0), + current(0, 0) + { + using std::pow; - template<typename RandomGenerator, typename Graph> - class plod_iterator + uniform_int<std::size_t> x(0, n-1); + std::size_t xv = x(gen); + degree = (xv == 0? 0 : std::size_t(beta * pow(xv, -alpha))); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + out_directed_plod_iterator& operator++() + { + using std::pow; + + uniform_int<std::size_t> x(0, n-1); + + // Continue stepping through source nodes until the + // (out)degree is > 0 + while (degree == 0) { + // Step to the next source node. If we've gone past the + // number of nodes we're responsible for, we're done. + if (++current.first >= n) { + at_end = true; + return *this; + } + + std::size_t xv = x(*gen); + degree = (xv == 0? 0 : std::size_t(beta * pow(xv, -alpha))); + } + + do { + current.second = x(*gen); + } while (current.first == current.second && !allow_self_loops); + --degree; + + return *this; + } + + out_directed_plod_iterator operator++(int) + { + out_directed_plod_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const out_directed_plod_iterator& other) const + { + return at_end == other.at_end; + } + + bool operator!=(const out_directed_plod_iterator& other) const + { + return !(*this == other); + } + + private: + RandomGenerator* gen; + std::size_t n; + double alpha; + double beta; + bool allow_self_loops; + bool at_end; + std::size_t degree; + value_type current; + }; + + template<typename RandomGenerator> + class undirected_plod_iterator { typedef std::vector<std::pair<std::size_t, std::size_t> > out_degrees_t; - typedef typename graph_traits<Graph>::directed_category directed_category; public: - typedef std::input_iterator_tag iterator_category; - typedef std::pair<std::size_t, std::size_t> value_type; - typedef const value_type& reference; - typedef const value_type* pointer; - typedef void difference_type; + typedef std::input_iterator_tag iterator_category; + typedef std::pair<std::size_t, std::size_t> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef std::ptrdiff_t difference_type; - plod_iterator() + undirected_plod_iterator() : gen(0), out_degrees(), degrees_left(0), allow_self_loops(false) { } - plod_iterator(RandomGenerator& gen, std::size_t n, - double alpha, double beta, bool allow_self_loops = false) - : gen(&gen), n(n), out_degrees(new out_degrees_t(n)), + undirected_plod_iterator(RandomGenerator& gen, std::size_t n, + double alpha, double beta, + bool allow_self_loops = false) + : gen(&gen), n(n), out_degrees(new out_degrees_t), degrees_left(0), allow_self_loops(allow_self_loops) { using std::pow; uniform_int<std::size_t> x(0, n-1); - for (out_degrees_t::iterator i = out_degrees->begin(); - i != out_degrees->end(); ++i) { + for (std::size_t i = 0; i != n; ++i) { std::size_t xv = x(gen); - i->first = i - out_degrees->begin(); - i->second = (xv == 0? 0 : std::size_t(beta * pow(xv, -alpha))); - degrees_left += i->second; + std::size_t degree = (xv == 0? 0 : std::size_t(beta * pow(xv, -alpha))); + if (degree == 0) degree = 1; + else if (degree >= n) degree = n-1; + out_degrees->push_back(std::make_pair(i, degree)); + degrees_left += degree; } - next(directed_category()); + next(); } reference operator*() const { return current; } pointer operator->() const { return ¤t; } - - plod_iterator& operator++() + + undirected_plod_iterator& operator++() { - next(directed_category()); + next(); return *this; } - plod_iterator operator++(int) + undirected_plod_iterator operator++(int) { - plod_iterator temp(*this); + undirected_plod_iterator temp(*this); ++(*this); return temp; } - bool operator==(const plod_iterator& other) const + bool operator==(const undirected_plod_iterator& other) const { return degrees_left == other.degrees_left; } - bool operator!=(const plod_iterator& other) const + bool operator!=(const undirected_plod_iterator& other) const { return !(*this == other); } private: - void next(directed_tag) - { - uniform_int<std::size_t> x(0, out_degrees->size()-1); - std::size_t source; - do { - source = x(*gen); - } while ((*out_degrees)[source].second == 0); - current.first = (*out_degrees)[source].first; - current.second = x(*gen); - --degrees_left; - if (--(*out_degrees)[source].second == 0) { - (*out_degrees)[source] = out_degrees->back(); - out_degrees->pop_back(); - } - } - - void next(undirected_tag) + void next() { std::size_t source, target; while (true) { @@ -103,7 +174,7 @@ namespace boost { new edges, so we just add some random edge and set the degrees left = 0 to signal termination. */ if (out_degrees->size() < 2) { - uniform_int<std::size_t> x(0, n); + uniform_int<std::size_t> x(0, n-1); current.first = x(*gen); do { current.second = x(*gen); @@ -152,6 +223,31 @@ namespace boost { value_type current; }; + + template<typename RandomGenerator, typename Graph> + class plod_iterator + : public mpl::if_<is_convertible< + typename graph_traits<Graph>::directed_category, + directed_tag>, + out_directed_plod_iterator<RandomGenerator>, + undirected_plod_iterator<RandomGenerator> >::type + { + typedef typename mpl::if_< + is_convertible< + typename graph_traits<Graph>::directed_category, + directed_tag>, + out_directed_plod_iterator<RandomGenerator>, + undirected_plod_iterator<RandomGenerator> >::type + inherited; + + public: + plod_iterator() : inherited() { } + + plod_iterator(RandomGenerator& gen, std::size_t n, + double alpha, double beta, bool allow_self_loops = false) + : inherited(gen, n, alpha, beta, allow_self_loops) { } + }; + } // end namespace boost #endif // BOOST_GRAPH_PLOD_GENERATOR_HPP diff --git a/Utilities/BGL/boost/graph/point_traits.hpp b/Utilities/BGL/boost/graph/point_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..89da93953fbd42d10f8ddcea91c763b75c317b5f --- /dev/null +++ b/Utilities/BGL/boost/graph/point_traits.hpp @@ -0,0 +1,26 @@ +// Copyright 2004, 2005 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_POINT_TRAITS_HPP +#define BOOST_GRAPH_POINT_TRAITS_HPP + +namespace boost { namespace graph { + +template<typename Point> +struct point_traits +{ + // The type of each component of the point + typedef typename Point::component_type component_type; + + // The number of dimensions in the point + static std::size_t dimensions(const Point& point); +}; + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_POINT_TRAITS_HPP diff --git a/Utilities/BGL/boost/graph/profile.hpp b/Utilities/BGL/boost/graph/profile.hpp index 2ae7b8e7fe54a0e26d8cab4da048c76637036501..1ba2d2498db7ef6bb2cd3c8fd9f2d3077cee05b3 100644 --- a/Utilities/BGL/boost/graph/profile.hpp +++ b/Utilities/BGL/boost/graph/profile.hpp @@ -1,29 +1,12 @@ // //======================================================================= -// Copyright 2002 Marc Wintermantel (wintermantel@imes.mavt.ethz.ch) +// Copyright 2002 Marc Wintermantel (wintermantel@even-ag.ch) // ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st) // -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. +// 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_PROFILE_HPP #define BOOST_GRAPH_PROFILE_HPP diff --git a/Utilities/BGL/boost/graph/properties.hpp b/Utilities/BGL/boost/graph/properties.hpp index 2b30348a9af4a0625e2b91a73c68fd7a0425e186..3245962453cc9c6113c342d0fd6bfd5e0d834e68 100644 --- a/Utilities/BGL/boost/graph/properties.hpp +++ b/Utilities/BGL/boost/graph/properties.hpp @@ -6,15 +6,32 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= + #ifndef BOOST_GRAPH_PROPERTIES_HPP #define BOOST_GRAPH_PROPERTIES_HPP #include <boost/config.hpp> #include <cassert> #include <boost/pending/property.hpp> -#include <boost/property_map.hpp> +#include <boost/detail/workaround.hpp> + +// Include the property map library and extensions in the BGL. +#include <boost/property_map/property_map.hpp> +#include <boost/graph/property_maps/constant_property_map.hpp> +#include <boost/graph/property_maps/null_property_map.hpp> + #include <boost/graph/graph_traits.hpp> #include <boost/type_traits/is_convertible.hpp> +#include <boost/limits.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/if.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define Graph Graph_ +# define RandomAccessContainer RandomAccessContainer_ +#endif namespace boost { @@ -28,12 +45,12 @@ namespace boost { static default_color_type red() { return red_color; } static default_color_type black() { return black_color; } }; - + // These functions are now obsolete, replaced by color_traits. inline default_color_type white(default_color_type) { return white_color; } inline default_color_type gray(default_color_type) { return gray_color; } inline default_color_type green(default_color_type) { return green_color; } - inline default_color_type red(default_color_type) { return red_color; } + inline default_color_type red(default_color_type) { return red_color; } inline default_color_type black(default_color_type) { return black_color; } #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -83,27 +100,46 @@ namespace boost { BOOST_DEF_PROPERTY(vertex, name); BOOST_DEF_PROPERTY(graph, name); BOOST_DEF_PROPERTY(vertex, distance); + BOOST_DEF_PROPERTY(vertex, distance2); BOOST_DEF_PROPERTY(vertex, color); BOOST_DEF_PROPERTY(vertex, degree); BOOST_DEF_PROPERTY(vertex, in_degree); BOOST_DEF_PROPERTY(vertex, out_degree); BOOST_DEF_PROPERTY(vertex, current_degree); - BOOST_DEF_PROPERTY(vertex, priority); + BOOST_DEF_PROPERTY(vertex, priority); BOOST_DEF_PROPERTY(vertex, discover_time); BOOST_DEF_PROPERTY(vertex, finish_time); BOOST_DEF_PROPERTY(vertex, predecessor); BOOST_DEF_PROPERTY(vertex, rank); BOOST_DEF_PROPERTY(vertex, centrality); + BOOST_DEF_PROPERTY(vertex, lowpoint); + BOOST_DEF_PROPERTY(vertex, potential); + BOOST_DEF_PROPERTY(vertex, update); BOOST_DEF_PROPERTY(edge, reverse); BOOST_DEF_PROPERTY(edge, capacity); + BOOST_DEF_PROPERTY(edge, flow); BOOST_DEF_PROPERTY(edge, residual_capacity); BOOST_DEF_PROPERTY(edge, centrality); + BOOST_DEF_PROPERTY(edge, discover_time); + BOOST_DEF_PROPERTY(edge, update); + BOOST_DEF_PROPERTY(edge, finished); BOOST_DEF_PROPERTY(graph, visitor); // These tags are used for property bundles BOOST_DEF_PROPERTY(vertex, bundle); BOOST_DEF_PROPERTY(edge, bundle); + // These tags are used to denote the owners and local descriptors + // for the vertices and edges of a distributed graph. + BOOST_DEF_PROPERTY(vertex, global); + BOOST_DEF_PROPERTY(vertex, owner); + BOOST_DEF_PROPERTY(vertex, local); + BOOST_DEF_PROPERTY(edge, global); + BOOST_DEF_PROPERTY(edge, owner); + BOOST_DEF_PROPERTY(edge, local); + BOOST_DEF_PROPERTY(vertex, local_index); + BOOST_DEF_PROPERTY(edge, local_index); + #undef BOOST_DEF_PROPERTY namespace detail { @@ -139,10 +175,22 @@ namespace boost { namespace detail { + template <typename A> struct return_void {typedef void type;}; + + template <typename Graph, typename Enable = void> + struct graph_tag_or_void { + typedef void type; + }; + + template <typename Graph> + struct graph_tag_or_void<Graph, typename return_void<typename Graph::graph_tag>::type> { + typedef typename Graph::graph_tag type; + }; + template <class Graph, class PropertyTag> struct edge_property_map { - typedef typename Graph::edge_property_type Property; - typedef typename Graph::graph_tag graph_tag; + typedef typename edge_property_type<Graph>::type Property; + typedef typename graph_tag_or_void<Graph>::type graph_tag; typedef typename edge_property_selector<graph_tag>::type Selector; typedef typename Selector::template bind_<Graph,Property,PropertyTag> Bind; @@ -151,8 +199,8 @@ namespace boost { }; template <class Graph, class PropertyTag> class vertex_property_map { - typedef typename Graph::vertex_property_type Property; - typedef typename Graph::graph_tag graph_tag; + typedef typename vertex_property_type<Graph>::type Property; + typedef typename graph_tag_or_void<Graph>::type graph_tag; typedef typename vertex_property_selector<graph_tag>::type Selector; typedef typename Selector::template bind_<Graph,Property,PropertyTag> Bind; @@ -215,7 +263,7 @@ namespace boost { template <class Graph, class Property> class graph_property { public: - typedef typename property_value<typename Graph::graph_property_type, + typedef typename property_value<typename Graph::graph_property_type, Property>::type type; }; @@ -231,9 +279,9 @@ namespace boost { }; template <typename Graph> - class degree_property_map + class degree_property_map : public put_get_helper<typename graph_traits<Graph>::degree_size_type, - degree_property_map<Graph> > + degree_property_map<Graph> > { public: typedef typename graph_traits<Graph>::vertex_descriptor key_type; @@ -254,9 +302,9 @@ namespace boost { } //======================================================================== - // Iterator Property Map Generating Functions contributed by + // Iterator Property Map Generating Functions contributed by // Kevin Vanhorn. (see also the property map generating functions - // in boost/property_map.hpp) + // in boost/property_map/property_map.hpp) #if !defined(BOOST_NO_STD_ITERATOR_TRAITS) // A helper function for creating a vertex property map out of a @@ -273,8 +321,8 @@ namespace boost { make_iterator_vertex_map(RandomAccessIterator iter, const PropertyGraph& g) { return make_iterator_property_map(iter, get(vertex_index, g)); - } - + } + // Use this next function when vertex_descriptor is known to be an // integer type, with values ranging from 0 to num_vertices(g). // @@ -289,7 +337,7 @@ namespace boost { make_iterator_vertex_map(RandomAccessIterator iter) { return make_iterator_property_map(iter, identity_property_map()); - } + } #endif template <class PropertyGraph, class RandomAccessContainer> @@ -304,7 +352,7 @@ namespace boost { { assert(c.size() >= num_vertices(g)); return make_iterator_vertex_map(c.begin(), g); - } + } template <class RandomAccessContainer> inline iterator_property_map< @@ -322,16 +370,24 @@ namespace boost { # define BOOST_GRAPH_NO_BUNDLED_PROPERTIES #endif +#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) && !defined (BOOST_GRAPH_NO_BUNDLED_PROPERTIES) +// This compiler cannot define a partial specialization based on a +// pointer-to-member type, as seen in boost/graph/subgraph.hpp line 985 (as of +// trunk r53912) +# define BOOST_GRAPH_NO_BUNDLED_PROPERTIES +#endif + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template<typename Graph, typename Descriptor, typename Bundle, typename T> struct bundle_property_map : put_get_helper<T&, bundle_property_map<Graph, Descriptor, Bundle, T> > { typedef Descriptor key_type; - typedef T value_type; + typedef typename remove_const<T>::type value_type; typedef T& reference; typedef lvalue_property_map_tag category; + bundle_property_map() { } bundle_property_map(Graph* g_, T Bundle::* pm_) : g(g_), pm(pm_) {} reference operator[](key_type k) const { return (*g)[k].*pm; } @@ -342,27 +398,84 @@ namespace boost { namespace detail { template<typename VertexBundle, typename EdgeBundle, typename Bundle> - struct is_vertex_bundle : is_convertible<Bundle*, VertexBundle*> {}; + struct is_vertex_bundle + : mpl::and_<is_convertible<VertexBundle*, Bundle*>, + mpl::and_<mpl::not_<is_void<VertexBundle> >, + mpl::not_<is_same<VertexBundle, no_property> > > > + { }; } - + + // Specialize the property map template to generate bundled property maps. template <typename Graph, typename T, typename Bundle> - struct property_map<Graph, T Bundle::*> + struct property_map<Graph, T Bundle::*> { private: typedef graph_traits<Graph> traits; typedef typename Graph::vertex_bundled vertex_bundled; typedef typename Graph::edge_bundled edge_bundled; - typedef typename ct_if<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value), + typedef typename mpl::if_c<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value), typename traits::vertex_descriptor, typename traits::edge_descriptor>::type descriptor; - + typedef typename mpl::if_c<(detail::is_vertex_bundle<vertex_bundled, edge_bundled, Bundle>::value), + vertex_bundled, + edge_bundled>::type + actual_bundle; + public: - typedef bundle_property_map<Graph, descriptor, Bundle, T> type; - typedef bundle_property_map<const Graph, descriptor, Bundle, const T> const_type; + typedef bundle_property_map<Graph, descriptor, actual_bundle, T> type; + typedef bundle_property_map<const Graph, descriptor, actual_bundle, const T> + const_type; }; #endif +// These metafunctions help implement the process of determining the vertex +// and edge properties of a graph. +namespace graph_detail { + template <typename Retag> + struct retagged_property { + typedef typename Retag::type type; + }; + + template <typename Retag, typename With, typename Without> + struct retagged_bundle { + typedef typename mpl::if_< + is_same<typename Retag::retagged, no_property>, + Without, + With + >::type type; + }; + + template <typename Prop> + struct vertex_prop { + private: + typedef detail::retag_property_list<vertex_bundle_t, Prop> Retag; + public: + typedef typename retagged_property<Retag>::type type; + typedef typename retagged_bundle< + Retag, Prop, no_vertex_bundle + >::type bundle; + }; + + template <typename Prop> + struct edge_prop { +// private: + typedef detail::retag_property_list<edge_bundle_t, Prop> Retag; + public: + typedef typename Retag::retagged retagged; + typedef typename retagged_property<Retag>::type type; + typedef typename retagged_bundle< + Retag, Prop, no_edge_bundle + >::type bundle; + }; +} // namespace graph_detail + } // namespace boost +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# undef Graph +# undef RandomAccessIterator +#endif + #endif /* BOOST_GRAPH_PROPERTIES_HPPA */ diff --git a/Utilities/BGL/boost/graph/property_iter_range.hpp b/Utilities/BGL/boost/graph/property_iter_range.hpp index dfab03e30e9ca80a9857483518b9ebdb57d2745f..8485fed33963e1f6f92ef3f0d437aec2e3109199 100644 --- a/Utilities/BGL/boost/graph/property_iter_range.hpp +++ b/Utilities/BGL/boost/graph/property_iter_range.hpp @@ -1,10 +1,10 @@ -// (C) Copyright Fran�ois Faure, iMAGIS-GRAVIR / UJF, 2001. Permission -// to copy, use, modify, sell and distribute this software is granted -// provided this copyright notice appears in all copies. This software -// is provided "as is" without express or implied warranty, and with -// no claim as to its suitability for any purpose. - +// (C) Copyright Francois Faure, iMAGIS-GRAVIR / UJF, 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) +// // Revision History: // 03 May 2001 Jeremy Siek // Generalized the property map iterator and moved that @@ -12,15 +12,15 @@ // differentiate between const/mutable graphs and // added a workaround to avoid partial specialization. -// 02 May 2001 Fran�ois Faure +// 02 May 2001 Francois Faure // Initial version. #ifndef BOOST_GRAPH_PROPERTY_ITER_RANGE_HPP #define BOOST_GRAPH_PROPERTY_ITER_RANGE_HPP -#include <boost/property_map_iterator.hpp> +#include <boost/property_map/property_map_iterator.hpp> #include <boost/graph/properties.hpp> -#include <boost/pending/ct_if.hpp> +#include <boost/mpl/if.hpp> #include <boost/type_traits/same_traits.hpp> namespace boost { @@ -34,7 +34,7 @@ namespace boost { typedef typename property_map<Graph, PropertyTag>::const_type const_map_type; typedef typename property_kind<PropertyTag>::type Kind; - typedef typename ct_if<is_same<Kind, vertex_property_tag>::value, + typedef typename mpl::if_c<is_same<Kind, vertex_property_tag>::value, typename graph_traits<Graph>::vertex_iterator, typename graph_traits<Graph>::edge_iterator>::type iter; public: diff --git a/Utilities/BGL/boost/graph/property_maps/constant_property_map.hpp b/Utilities/BGL/boost/graph/property_maps/constant_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dd2461e7edea9cd3927997c4438ab8a63c4a198b --- /dev/null +++ b/Utilities/BGL/boost/graph/property_maps/constant_property_map.hpp @@ -0,0 +1,59 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CONSTANT_PROPERTY_HPP +#define BOOST_GRAPH_CONSTANT_PROPERTY_HPP + +#include <boost/property_map/property_map.hpp> + + +// TODO: This should really be part of the property maps library rather than +// the Boost.Graph library. + +namespace boost { + +/** + * A constant property is one, that regardless of the edge or vertex given, + * will always return a constant value. + */ +template <typename Key, typename Value> +struct constant_property_map + : public boost::put_get_helper< + const Value&, + constant_property_map<Key, Value> + > +{ + typedef Key key_type; + typedef Value value_type; + typedef const Value& reference; + typedef boost::readable_property_map_tag category; + + constant_property_map() + : m_value() + { } + + constant_property_map(const value_type &value) + : m_value(value) + { } + + constant_property_map(const constant_property_map& copy) + : m_value(copy.m_value) + { } + + inline reference operator [](const key_type&) const + { return m_value; } + + value_type m_value; +}; + +template <typename Key, typename Value> +inline constant_property_map<Key, Value> +make_constant_property(const Value& value) +{ return constant_property_map<Key, Value>(value); } + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/property_maps/container_property_map.hpp b/Utilities/BGL/boost/graph/property_maps/container_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e07cd3306532ff8cd5106786b80ab826219cf81a --- /dev/null +++ b/Utilities/BGL/boost/graph/property_maps/container_property_map.hpp @@ -0,0 +1,75 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CONTAINER_PROPERTY_MAP_HPP +#define BOOST_GRAPH_CONTAINER_PROPERTY_MAP_HPP + +#include <boost/graph/detail/index.hpp> +#include <boost/property_map/property_map.hpp> + +namespace boost +{ + // This is an adapter built over the iterator property map with + // more useful uniform construction semantics. Specifically, this + // requires the container rather than the iterator and the graph + // rather than the optional index map. + template <typename Graph, typename Key, typename Container> + struct container_property_map + : public boost::put_get_helper< + typename iterator_property_map< + typename Container::iterator, + typename property_map< + Graph, + typename detail::choose_indexer<Graph, Key>::index_type + >::type + >::reference, + container_property_map<Graph, Key, Container> + > + { + typedef typename detail::choose_indexer<Graph, Key>::indexer_type indexer_type; + typedef typename indexer_type::index_type index_type; + typedef iterator_property_map< + typename Container::iterator, + typename property_map<Graph, index_type>::type + > map_type; + typedef typename map_type::key_type key_type; + typedef typename map_type::value_type value_type; + typedef typename map_type::reference reference; + typedef typename map_type::category category; + + // The default constructor will *probably* crash if its actually + // used for referencing vertices since the underlying iterator + // map points past the end of an unknown container. + inline container_property_map() + : m_map() + { } + + // This is the preferred constructor. It is invoked over the container + // and the graph explicitly. This requires that the underlying iterator + // map use the indices of the vertices in g rather than the default + // identity map. + // + // Note the const-cast this ensures the reference type of the + // vertex index map is non-const, which happens to be an + // artifact of passing const graph references. + inline container_property_map(Container& c, const Graph& g) + : m_map(c.begin(), indexer_type::index_map(const_cast<Graph&>(g))) + { } + + // Typical copy constructor. + inline container_property_map(const container_property_map& x) + : m_map(x.m_map) + { } + + // The [] operator delegates to the underlying map/ + inline reference operator [](const key_type& k) const + { return m_map[k]; } + + map_type m_map; + }; +} + +#endif diff --git a/Utilities/BGL/boost/graph/property_maps/matrix_property_map.hpp b/Utilities/BGL/boost/graph/property_maps/matrix_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bf4f2c9c76b7603f4009d5fe74df564e95e007ea --- /dev/null +++ b/Utilities/BGL/boost/graph/property_maps/matrix_property_map.hpp @@ -0,0 +1,67 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_MATRIX_PROPERTY_MAP_HPP +#define BOOST_GRAPH_MATRIX_PROPERTY_MAP_HPP + +#include <boost/graph/property_maps/container_property_map.hpp> + +namespace boost +{ + // This property map is built specifically for property maps over + // matrices. Like the basic property map over a container, this builds + // the property abstraction over a matrix (usually a vector of vectors) + // and returns property maps over the nested containers. + template <typename Graph, typename Key, typename Matrix> + struct matrix_property_map + : boost::put_get_helper< + container_property_map<Graph, Key, typename Matrix::value_type>, + matrix_property_map<Graph, Key, Matrix> > + { + // abstract the indexing keys + typedef typename detail::choose_indexer<Graph, Key>::indexer_type indexer_type; + + // aliases for the nested container and its corresponding map + typedef typename Matrix::value_type container_type; + typedef container_property_map<Graph, Key, container_type> map_type; + + typedef Key key_type; + + // This property map doesn't really provide access to nested containers, + // but returns property maps over them. Since property maps are all + // copy-constructible (or should be anyways), we never return references. + // As such, this property is only readable, but not writable. Curiously, + // the inner property map is actually an lvalue pmap. + typedef map_type value_type; + typedef map_type reference; + typedef readable_property_map_tag category; + + matrix_property_map() + : m_matrix(0), m_graph(0) + { } + + matrix_property_map(Matrix& m, const Graph& g) + : m_matrix(&m), m_graph(const_cast<Graph*>(&g)) + { } + + matrix_property_map(const matrix_property_map& x) + : m_matrix(x.m_matrix), m_graph(x.m_graph) + { } + + inline reference operator [](key_type k) const + { + typedef typename indexer_type::value_type Index; + Index x = indexer_type::index(k, *m_graph); + return map_type((*m_matrix)[x], *m_graph); + } + + private: + mutable Matrix* m_matrix; + mutable Graph* m_graph; + }; +} + +#endif diff --git a/Utilities/BGL/boost/graph/property_maps/null_property_map.hpp b/Utilities/BGL/boost/graph/property_maps/null_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f6273481b0cbabf1f3b6ca9fbf39b04d04f15023 --- /dev/null +++ b/Utilities/BGL/boost/graph/property_maps/null_property_map.hpp @@ -0,0 +1,41 @@ +// (C) Copyright Andrew Sutton 2007 +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_NULL_PROPERTY_HPP +#define BOOST_GRAPH_NULL_PROPERTY_HPP + +#include <boost/property_map/property_map.hpp> + +// TODO: This should really be part of the property maps library rather than +// the Boost.Graph library. + +namespace boost +{ + // A null property is somewhat like the inverse of the constant + // property map except that instead of returning a single value, + // this eats any writes and cannot be read from. + + template <typename Key, typename Value> + struct null_property_map + { + typedef Key key_type; + typedef Value value_type; + typedef void reference; + typedef boost::writable_property_map_tag category; + }; + + // The null_property_map<K,V> only has a put() function. + template <typename K, typename V> + void put(null_property_map<K,V>& pm, const K& key, const V& value) + { } + + // A helper function for intantiating null property maps. + template <typename Key, typename Value> + inline null_property_map<Key, Value> make_null_property() + { return null_property_map<Key, Value>(); } +} + +#endif diff --git a/Utilities/BGL/boost/graph/push_relabel_max_flow.hpp b/Utilities/BGL/boost/graph/push_relabel_max_flow.hpp index 987b8cfe4c6b96786d78c5bf380767a6c9ba5702..2b65470979d3fa0a8ba4e6752f415bc8df260604 100644 --- a/Utilities/BGL/boost/graph/push_relabel_max_flow.hpp +++ b/Utilities/BGL/boost/graph/push_relabel_max_flow.hpp @@ -121,7 +121,7 @@ namespace boost { : g(g_), n(num_vertices(g_)), capacity(cap), src(src_), sink(sink_), index(idx), excess_flow(num_vertices(g_)), - current(num_vertices(g_), out_edges(*vertices(g_).first, g_).second), + current(num_vertices(g_), out_edges(*vertices(g_).first, g_)), distance(num_vertices(g_)), color(num_vertices(g_)), reverse_edge(rev), @@ -149,7 +149,7 @@ namespace boost { for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { vertex_descriptor u = *u_iter; excess_flow[u] = 0; - current[u] = out_edges(u, g).first; + current[u] = out_edges(u, g); } bool overflow_detected = false; @@ -240,7 +240,7 @@ namespace boost { && is_residual_edge(reverse_edge[a])) { distance[v] = d_v; color[v] = ColorTraits::gray(); - current[v] = out_edges(v, g).first; + current[v] = out_edges(v, g); max_distance = max BOOST_PREVENT_MACRO_SUBSTITUTION(d_v, max_distance); if (excess_flow[v] > 0) @@ -262,8 +262,7 @@ namespace boost { assert(excess_flow[u] > 0); while (1) { out_edge_iterator ai, ai_end; - for (ai = current[u], ai_end = out_edges(u, g).second; - ai != ai_end; ++ai) { + for (tie(ai, ai_end) = current[u]; ai != ai_end; ++ai) { edge_descriptor a = *ai; if (is_residual_edge(a)) { vertex_descriptor v = target(a, g); @@ -291,7 +290,7 @@ namespace boost { if (distance[u] == n) break; } else { // i is no longer active - current[u] = ai; + current[u].first = ai; add_to_inactive_list(u, layer); break; } @@ -350,7 +349,7 @@ namespace boost { ++min_distance; if (min_distance < n) { distance[u] = min_distance; // this is the main action - current[u] = min_edge_iter; + current[u].first = min_edge_iter; max_distance = max BOOST_PREVENT_MACRO_SUBSTITUTION(min_distance, max_distance); } return min_distance; @@ -444,7 +443,7 @@ namespace boost { u = *u_iter; color[u] = ColorTraits::white(); parent[u] = u; - current[u] = out_edges(u, g).first; + current[u] = out_edges(u, g); } // eliminate flow cycles and topologically order the vertices for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter) { @@ -455,8 +454,8 @@ namespace boost { r = u; color[r] = ColorTraits::gray(); while (1) { - for (; current[u] != out_edges(u, g).second; ++current[u]) { - edge_descriptor a = *current[u]; + for (; current[u].first != current[u].second; ++current[u].first) { + edge_descriptor a = *current[u].first; if (capacity[a] == 0 && is_residual_edge(a)) { vertex_descriptor v = target(a, g); if (color[v] == ColorTraits::white()) { @@ -469,16 +468,16 @@ namespace boost { FlowValue delta = residual_capacity[a]; while (1) { BOOST_USING_STD_MIN(); - delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[*current[v]]); + delta = min BOOST_PREVENT_MACRO_SUBSTITUTION(delta, residual_capacity[*current[v].first]); if (v == u) break; else - v = target(*current[v], g); + v = target(*current[v].first, g); } // remove delta flow units v = u; while (1) { - a = *current[v]; + a = *current[v].first; residual_capacity[a] -= delta; residual_capacity[reverse_edge[a]] += delta; v = target(a, g); @@ -488,25 +487,25 @@ namespace boost { // back-out of DFS to the first saturated edge restart = u; - for (v = target(*current[u], g); v != u; v = target(a, g)){ - a = *current[v]; + for (v = target(*current[u].first, g); v != u; v = target(a, g)){ + a = *current[v].first; if (color[v] == ColorTraits::white() || is_saturated(a)) { - color[target(*current[v], g)] = ColorTraits::white(); + color[target(*current[v].first, g)] = ColorTraits::white(); if (color[v] != ColorTraits::white()) restart = v; } } if (restart != u) { u = restart; - ++current[u]; + ++current[u].first; break; } } // else if (color[v] == ColorTraits::gray()) } // if (capacity[a] == 0 ... } // for out_edges(u, g) (though "u" changes during loop) - if (current[u] == out_edges(u, g).second) { + if ( current[u].first == current[u].second ) { // scan of i is complete color[u] = ColorTraits::black(); if (u != src) { @@ -521,7 +520,7 @@ namespace boost { } if (u != r) { u = parent[u]; - ++current[u]; + ++current[u].first; } else break; } @@ -533,8 +532,8 @@ namespace boost { // note that the sink is not on the stack if (! bos_null) { for (u = tos; u != bos; u = topo_next[u]) { - ai = out_edges(u, g).first; - while (excess_flow[u] > 0 && ai != out_edges(u, g).second) { + tie(ai, a_end) = out_edges(u, g); + while (excess_flow[u] > 0 && ai != a_end) { if (capacity[*ai] == 0 && is_residual_edge(*ai)) push_flow(*ai); ++ai; @@ -632,7 +631,7 @@ namespace boost { // will need to use random_access_property_map with these std::vector< FlowValue > excess_flow; - std::vector< out_edge_iterator > current; + std::vector< std::pair<out_edge_iterator, out_edge_iterator> > current; std::vector< distance_size_type > distance; std::vector< default_color_type > color; diff --git a/Utilities/BGL/boost/graph/r_c_shortest_paths.hpp b/Utilities/BGL/boost/graph/r_c_shortest_paths.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b1bd75742ca61023cae0d94e14d2cd7413973815 --- /dev/null +++ b/Utilities/BGL/boost/graph/r_c_shortest_paths.hpp @@ -0,0 +1,729 @@ +// r_c_shortest_paths.hpp header file + +// Copyright Michael Drexl 2005, 2006. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GRAPH_R_C_SHORTEST_PATHS_HPP +#define BOOST_GRAPH_R_C_SHORTEST_PATHS_HPP + +#include <map> +#include <queue> +#include <vector> + +#include <boost/graph/graph_traits.hpp> + +namespace boost { + +// r_c_shortest_paths_label struct +template<class Graph, class Resource_Container> +struct r_c_shortest_paths_label +{ + r_c_shortest_paths_label + ( const unsigned long n, + const Resource_Container& rc = Resource_Container(), + const r_c_shortest_paths_label* const pl = 0, + const typename graph_traits<Graph>::edge_descriptor& ed = + graph_traits<Graph>::edge_descriptor(), + const typename graph_traits<Graph>::vertex_descriptor& vd = + graph_traits<Graph>::vertex_descriptor() ) + : num( n ), + cumulated_resource_consumption( rc ), + p_pred_label( pl ), + pred_edge( ed ), + resident_vertex( vd ), + b_is_dominated( false ), + b_is_processed( false ) + {} + r_c_shortest_paths_label& operator=( const r_c_shortest_paths_label& other ) + { + if( this == &other ) + return *this; + this->~r_c_shortest_paths_label(); + new( this ) r_c_shortest_paths_label( other ); + return *this; + } + const unsigned long num; + Resource_Container cumulated_resource_consumption; + const r_c_shortest_paths_label* const p_pred_label; + const typename graph_traits<Graph>::edge_descriptor pred_edge; + const typename graph_traits<Graph>::vertex_descriptor resident_vertex; + bool b_is_dominated; + bool b_is_processed; +}; // r_c_shortest_paths_label + +template<class Graph, class Resource_Container> +inline bool operator== +( const r_c_shortest_paths_label<Graph, Resource_Container>& l1, + const r_c_shortest_paths_label<Graph, Resource_Container>& l2 ) +{ + return + l1.cumulated_resource_consumption == l2.cumulated_resource_consumption; +} + +template<class Graph, class Resource_Container> +inline bool operator!= +( const r_c_shortest_paths_label<Graph, Resource_Container>& l1, + const r_c_shortest_paths_label<Graph, Resource_Container>& l2 ) +{ + return + !( l1 == l2 ); +} + +template<class Graph, class Resource_Container> +inline bool operator< +( const r_c_shortest_paths_label<Graph, Resource_Container>& l1, + const r_c_shortest_paths_label<Graph, Resource_Container>& l2 ) +{ + return + l1.cumulated_resource_consumption < l2.cumulated_resource_consumption; +} + +template<class Graph, class Resource_Container> +inline bool operator> +( const r_c_shortest_paths_label<Graph, Resource_Container>& l1, + const r_c_shortest_paths_label<Graph, Resource_Container>& l2 ) +{ + return + l2.cumulated_resource_consumption < l1.cumulated_resource_consumption; +} + +template<class Graph, class Resource_Container> +inline bool operator<= +( const r_c_shortest_paths_label<Graph, Resource_Container>& l1, + const r_c_shortest_paths_label<Graph, Resource_Container>& l2 ) +{ + return + l1 < l2 || l1 == l2; +} + +template<class Graph, class Resource_Container> +inline bool operator>= +( const r_c_shortest_paths_label<Graph, Resource_Container>& l1, + const r_c_shortest_paths_label<Graph, Resource_Container>& l2 ) +{ + return l2 < l1 || l1 == l2; +} + +namespace detail { + +// ks_smart_pointer class +// from: +// Kuhlins, S.; Schader, M. (1999): +// Die C++-Standardbibliothek +// Springer, Berlin +// p. 333 f. +template<class T> +class ks_smart_pointer +{ +public: + ks_smart_pointer( T* ptt = 0 ) : pt( ptt ) {} + ks_smart_pointer( const ks_smart_pointer& other ) : pt( other.pt ) {} + ks_smart_pointer& operator=( const ks_smart_pointer& other ) + { pt = other.pt; return *this; } + ~ks_smart_pointer() {} + T& operator*() const { return *pt; } + T* operator->() const { return pt; } + T* get() const { return pt; } + operator T*() const { return pt; } + friend bool operator==( const ks_smart_pointer& t, + const ks_smart_pointer& u ) + { return *t.pt == *u.pt; } + friend bool operator!=( const ks_smart_pointer& t, + const ks_smart_pointer& u ) + { return *t.pt != *u.pt; } + friend bool operator<( const ks_smart_pointer& t, + const ks_smart_pointer& u ) + { return *t.pt < *u.pt; } + friend bool operator>( const ks_smart_pointer& t, + const ks_smart_pointer& u ) + { return *t.pt > *u.pt; } + friend bool operator<=( const ks_smart_pointer& t, + const ks_smart_pointer& u ) + { return *t.pt <= *u.pt; } + friend bool operator>=( const ks_smart_pointer& t, + const ks_smart_pointer& u ) + { return *t.pt >= *u.pt; } +private: + T* pt; +}; // ks_smart_pointer + + +// r_c_shortest_paths_dispatch function (body/implementation) +template<class Graph, + class VertexIndexMap, + class EdgeIndexMap, + class Resource_Container, + class Resource_Extension_Function, + class Dominance_Function, + class Label_Allocator, + class Visitor> +void r_c_shortest_paths_dispatch +( const Graph& g, + const VertexIndexMap& vertex_index_map, + const EdgeIndexMap& /*edge_index_map*/, + typename graph_traits<Graph>::vertex_descriptor s, + typename graph_traits<Graph>::vertex_descriptor t, + // each inner vector corresponds to a pareto-optimal path + std::vector + <std::vector + <typename graph_traits + <Graph>::edge_descriptor> >& pareto_optimal_solutions, + std::vector + <Resource_Container>& pareto_optimal_resource_containers, + bool b_all_pareto_optimal_solutions, + // to initialize the first label/resource container + // and to carry the type information + const Resource_Container& rc, + Resource_Extension_Function& ref, + Dominance_Function& dominance, + // to specify the memory management strategy for the labels + Label_Allocator /*la*/, + Visitor vis ) +{ + pareto_optimal_resource_containers.clear(); + pareto_optimal_solutions.clear(); + + unsigned long i_label_num = 0; + typedef + typename + Label_Allocator::template rebind + <r_c_shortest_paths_label + <Graph, Resource_Container> >::other LAlloc; + LAlloc l_alloc; + typedef + ks_smart_pointer + <r_c_shortest_paths_label<Graph, Resource_Container> > Splabel; + std::priority_queue<Splabel, std::vector<Splabel>, std::greater<Splabel> > + unprocessed_labels; + + bool b_feasible = true; + r_c_shortest_paths_label<Graph, Resource_Container>* first_label = + l_alloc.allocate( 1 ); + l_alloc.construct + ( first_label, + r_c_shortest_paths_label + <Graph, Resource_Container>( i_label_num++, + rc, + 0, + typename graph_traits<Graph>:: + edge_descriptor(), + s ) ); + + Splabel splabel_first_label = Splabel( first_label ); + unprocessed_labels.push( splabel_first_label ); + std::vector<std::list<Splabel> > vec_vertex_labels( num_vertices( g ) ); + vec_vertex_labels[vertex_index_map[s]].push_back( splabel_first_label ); + std::vector<typename std::list<Splabel>::iterator> + vec_last_valid_positions_for_dominance( num_vertices( g ) ); + for( int i = 0; i < static_cast<int>( num_vertices( g ) ); ++i ) + vec_last_valid_positions_for_dominance[i] = vec_vertex_labels[i].begin(); + std::vector<int> vec_last_valid_index_for_dominance( num_vertices( g ), 0 ); + std::vector<bool> + b_vec_vertex_already_checked_for_dominance( num_vertices( g ), false ); + while( unprocessed_labels.size() ) + { + Splabel cur_label = unprocessed_labels.top(); + unprocessed_labels.pop(); + vis.on_label_popped( *cur_label, g ); + // an Splabel object in unprocessed_labels and the respective Splabel + // object in the respective list<Splabel> of vec_vertex_labels share their + // embedded r_c_shortest_paths_label object + // to avoid memory leaks, dominated + // r_c_shortest_paths_label objects are marked and deleted when popped + // from unprocessed_labels, as they can no longer be deleted at the end of + // the function; only the Splabel object in unprocessed_labels still + // references the r_c_shortest_paths_label object + // this is also for efficiency, because the else branch is executed only + // if there is a chance that extending the + // label leads to new undominated labels, which in turn is possible only + // if the label to be extended is undominated + if( !cur_label->b_is_dominated ) + { + int i_cur_resident_vertex_num = cur_label->resident_vertex; + std::list<Splabel>& list_labels_cur_vertex = + vec_vertex_labels[i_cur_resident_vertex_num]; + if( static_cast<int>( list_labels_cur_vertex.size() ) >= 2 + && vec_last_valid_index_for_dominance[i_cur_resident_vertex_num] + < static_cast<int>( list_labels_cur_vertex.size() ) ) + { + typename std::list<Splabel>::iterator outer_iter = + list_labels_cur_vertex.begin(); + bool b_outer_iter_at_or_beyond_last_valid_pos_for_dominance = false; + while( outer_iter != list_labels_cur_vertex.end() ) + { + Splabel cur_outer_splabel = *outer_iter; + typename std::list<Splabel>::iterator inner_iter = outer_iter; + if( !b_outer_iter_at_or_beyond_last_valid_pos_for_dominance + && outer_iter == + vec_last_valid_positions_for_dominance + [i_cur_resident_vertex_num] ) + b_outer_iter_at_or_beyond_last_valid_pos_for_dominance = true; + if( !b_vec_vertex_already_checked_for_dominance + [i_cur_resident_vertex_num] + || b_outer_iter_at_or_beyond_last_valid_pos_for_dominance ) + { + ++inner_iter; + } + else + { + inner_iter = + vec_last_valid_positions_for_dominance + [i_cur_resident_vertex_num]; + ++inner_iter; + } + bool b_outer_iter_erased = false; + while( inner_iter != list_labels_cur_vertex.end() ) + { + Splabel cur_inner_splabel = *inner_iter; + if( dominance( cur_outer_splabel-> + cumulated_resource_consumption, + cur_inner_splabel-> + cumulated_resource_consumption ) ) + { + typename std::list<Splabel>::iterator buf = inner_iter; + ++inner_iter; + list_labels_cur_vertex.erase( buf ); + if( cur_inner_splabel->b_is_processed ) + { + l_alloc.destroy( cur_inner_splabel.get() ); + l_alloc.deallocate( cur_inner_splabel.get(), 1 ); + } + else + cur_inner_splabel->b_is_dominated = true; + continue; + } + else + ++inner_iter; + if( dominance( cur_inner_splabel-> + cumulated_resource_consumption, + cur_outer_splabel-> + cumulated_resource_consumption ) ) + { + typename std::list<Splabel>::iterator buf = outer_iter; + ++outer_iter; + list_labels_cur_vertex.erase( buf ); + b_outer_iter_erased = true; + if( cur_outer_splabel->b_is_processed ) + { + l_alloc.destroy( cur_outer_splabel.get() ); + l_alloc.deallocate( cur_outer_splabel.get(), 1 ); + } + else + cur_outer_splabel->b_is_dominated = true; + break; + } + } + if( !b_outer_iter_erased ) + ++outer_iter; + } + if( static_cast<int>( list_labels_cur_vertex.size() ) > 1 ) + vec_last_valid_positions_for_dominance[i_cur_resident_vertex_num] = + (--(list_labels_cur_vertex.end())); + else + vec_last_valid_positions_for_dominance[i_cur_resident_vertex_num] = + list_labels_cur_vertex.begin(); + b_vec_vertex_already_checked_for_dominance + [i_cur_resident_vertex_num] = true; + vec_last_valid_index_for_dominance[i_cur_resident_vertex_num] = + static_cast<int>( list_labels_cur_vertex.size() ) - 1; + } + } + if( !b_all_pareto_optimal_solutions && cur_label->resident_vertex == t ) + { + // the devil don't sleep + if( cur_label->b_is_dominated ) + { + l_alloc.destroy( cur_label.get() ); + l_alloc.deallocate( cur_label.get(), 1 ); + } + while( unprocessed_labels.size() ) + { + Splabel l = unprocessed_labels.top(); + unprocessed_labels.pop(); + // delete only dominated labels, because nondominated labels are + // deleted at the end of the function + if( l->b_is_dominated ) + { + l_alloc.destroy( l.get() ); + l_alloc.deallocate( l.get(), 1 ); + } + } + break; + } + if( !cur_label->b_is_dominated ) + { + cur_label->b_is_processed = true; + vis.on_label_not_dominated( *cur_label, g ); + typename graph_traits<Graph>::vertex_descriptor cur_vertex = + cur_label->resident_vertex; + typename graph_traits<Graph>::out_edge_iterator oei, oei_end; + for( tie( oei, oei_end ) = out_edges( cur_vertex, g ); + oei != oei_end; + ++oei ) + { + b_feasible = true; + r_c_shortest_paths_label<Graph, Resource_Container>* new_label = + l_alloc.allocate( 1 ); + l_alloc.construct( new_label, + r_c_shortest_paths_label + <Graph, Resource_Container> + ( i_label_num++, + cur_label->cumulated_resource_consumption, + cur_label.get(), + *oei, + target( *oei, g ) ) ); + b_feasible = + ref( g, + new_label->cumulated_resource_consumption, + new_label->p_pred_label->cumulated_resource_consumption, + new_label->pred_edge ); + + if( !b_feasible ) + { + vis.on_label_not_feasible( *new_label, g ); + l_alloc.destroy( new_label ); + l_alloc.deallocate( new_label, 1 ); + } + else + { + const r_c_shortest_paths_label<Graph, Resource_Container>& + ref_new_label = *new_label; + vis.on_label_feasible( ref_new_label, g ); + Splabel new_sp_label( new_label ); + vec_vertex_labels[vertex_index_map[new_sp_label->resident_vertex]]. + push_back( new_sp_label ); + unprocessed_labels.push( new_sp_label ); + } + } + } + else + { + vis.on_label_dominated( *cur_label, g ); + l_alloc.destroy( cur_label.get() ); + l_alloc.deallocate( cur_label.get(), 1 ); + } + } + std::list<Splabel> dsplabels = vec_vertex_labels[vertex_index_map[t]]; + typename std::list<Splabel>::const_iterator csi = dsplabels.begin(); + typename std::list<Splabel>::const_iterator csi_end = dsplabels.end(); + // if d could be reached from o + if( dsplabels.size() ) + { + for( ; csi != csi_end; ++csi ) + { + std::vector<typename graph_traits<Graph>::edge_descriptor> + cur_pareto_optimal_path; + const r_c_shortest_paths_label<Graph, Resource_Container>* p_cur_label = + (*csi).get(); + pareto_optimal_resource_containers. + push_back( p_cur_label->cumulated_resource_consumption ); + while( p_cur_label->num != 0 ) + { + cur_pareto_optimal_path.push_back( p_cur_label->pred_edge ); + p_cur_label = p_cur_label->p_pred_label; + } + pareto_optimal_solutions.push_back( cur_pareto_optimal_path ); + if( !b_all_pareto_optimal_solutions ) + break; + } + } + + int i_size = static_cast<int>( vec_vertex_labels.size() ); + for( int i = 0; i < i_size; ++i ) + { + const std::list<Splabel>& list_labels_cur_vertex = vec_vertex_labels[i]; + csi_end = list_labels_cur_vertex.end(); + for( csi = list_labels_cur_vertex.begin(); csi != csi_end; ++csi ) + { + l_alloc.destroy( (*csi).get() ); + l_alloc.deallocate( (*csi).get(), 1 ); + } + } +} // r_c_shortest_paths_dispatch + +} // detail + +// default_r_c_shortest_paths_visitor struct +struct default_r_c_shortest_paths_visitor +{ + template<class Label, class Graph> + void on_label_popped( const Label&, const Graph& ) {} + template<class Label, class Graph> + void on_label_feasible( const Label&, const Graph& ) {} + template<class Label, class Graph> + void on_label_not_feasible( const Label&, const Graph& ) {} + template<class Label, class Graph> + void on_label_dominated( const Label&, const Graph& ) {} + template<class Label, class Graph> + void on_label_not_dominated( const Label&, const Graph& ) {} +}; // default_r_c_shortest_paths_visitor + + +// default_r_c_shortest_paths_allocator +typedef + std::allocator<int> default_r_c_shortest_paths_allocator; +// default_r_c_shortest_paths_allocator + + +// r_c_shortest_paths functions (handle/interface) +// first overload: +// - return all pareto-optimal solutions +// - specify Label_Allocator and Visitor arguments +template<class Graph, + class VertexIndexMap, + class EdgeIndexMap, + class Resource_Container, + class Resource_Extension_Function, + class Dominance_Function, + class Label_Allocator, + class Visitor> +void r_c_shortest_paths +( const Graph& g, + const VertexIndexMap& vertex_index_map, + const EdgeIndexMap& edge_index_map, + typename graph_traits<Graph>::vertex_descriptor s, + typename graph_traits<Graph>::vertex_descriptor t, + // each inner vector corresponds to a pareto-optimal path + std::vector<std::vector<typename graph_traits<Graph>::edge_descriptor> >& + pareto_optimal_solutions, + std::vector<Resource_Container>& pareto_optimal_resource_containers, + // to initialize the first label/resource container + // and to carry the type information + const Resource_Container& rc, + const Resource_Extension_Function& ref, + const Dominance_Function& dominance, + // to specify the memory management strategy for the labels + Label_Allocator la, + Visitor vis ) +{ + r_c_shortest_paths_dispatch( g, + vertex_index_map, + edge_index_map, + s, + t, + pareto_optimal_solutions, + pareto_optimal_resource_containers, + true, + rc, + ref, + dominance, + la, + vis ); +} + +// second overload: +// - return only one pareto-optimal solution +// - specify Label_Allocator and Visitor arguments +template<class Graph, + class VertexIndexMap, + class EdgeIndexMap, + class Resource_Container, + class Resource_Extension_Function, + class Dominance_Function, + class Label_Allocator, + class Visitor> +void r_c_shortest_paths +( const Graph& g, + const VertexIndexMap& vertex_index_map, + const EdgeIndexMap& edge_index_map, + typename graph_traits<Graph>::vertex_descriptor s, + typename graph_traits<Graph>::vertex_descriptor t, + std::vector<typename graph_traits<Graph>::edge_descriptor>& + pareto_optimal_solution, + Resource_Container& pareto_optimal_resource_container, + // to initialize the first label/resource container + // and to carry the type information + const Resource_Container& rc, + const Resource_Extension_Function& ref, + const Dominance_Function& dominance, + // to specify the memory management strategy for the labels + Label_Allocator la, + Visitor vis ) +{ + // each inner vector corresponds to a pareto-optimal path + std::vector<std::vector<typename graph_traits<Graph>::edge_descriptor> > + pareto_optimal_solutions; + std::vector<Resource_Container> pareto_optimal_resource_containers; + r_c_shortest_paths_dispatch( g, + vertex_index_map, + edge_index_map, + s, + t, + pareto_optimal_solutions, + pareto_optimal_resource_containers, + false, + rc, + ref, + dominance, + la, + vis ); + pareto_optimal_solution = pareto_optimal_solutions[0]; + pareto_optimal_resource_container = pareto_optimal_resource_containers[0]; +} + +// third overload: +// - return all pareto-optimal solutions +// - use default Label_Allocator and Visitor +template<class Graph, + class VertexIndexMap, + class EdgeIndexMap, + class Resource_Container, + class Resource_Extension_Function, + class Dominance_Function> +void r_c_shortest_paths +( const Graph& g, + const VertexIndexMap& vertex_index_map, + const EdgeIndexMap& edge_index_map, + typename graph_traits<Graph>::vertex_descriptor s, + typename graph_traits<Graph>::vertex_descriptor t, + // each inner vector corresponds to a pareto-optimal path + std::vector<std::vector<typename graph_traits<Graph>::edge_descriptor> >& + pareto_optimal_solutions, + std::vector<Resource_Container>& pareto_optimal_resource_containers, + // to initialize the first label/resource container + // and to carry the type information + const Resource_Container& rc, + const Resource_Extension_Function& ref, + const Dominance_Function& dominance ) +{ + r_c_shortest_paths_dispatch( g, + vertex_index_map, + edge_index_map, + s, + t, + pareto_optimal_solutions, + pareto_optimal_resource_containers, + true, + rc, + ref, + dominance, + default_r_c_shortest_paths_allocator(), + default_r_c_shortest_paths_visitor() ); +} + +// fourth overload: +// - return only one pareto-optimal solution +// - use default Label_Allocator and Visitor +template<class Graph, + class VertexIndexMap, + class EdgeIndexMap, + class Resource_Container, + class Resource_Extension_Function, + class Dominance_Function> +void r_c_shortest_paths +( const Graph& g, + const VertexIndexMap& vertex_index_map, + const EdgeIndexMap& edge_index_map, + typename graph_traits<Graph>::vertex_descriptor s, + typename graph_traits<Graph>::vertex_descriptor t, + std::vector<typename graph_traits<Graph>::edge_descriptor>& + pareto_optimal_solution, + Resource_Container& pareto_optimal_resource_container, + // to initialize the first label/resource container + // and to carry the type information + const Resource_Container& rc, + const Resource_Extension_Function& ref, + const Dominance_Function& dominance ) +{ + // each inner vector corresponds to a pareto-optimal path + std::vector<std::vector<typename graph_traits<Graph>::edge_descriptor> > + pareto_optimal_solutions; + std::vector<Resource_Container> pareto_optimal_resource_containers; + r_c_shortest_paths_dispatch( g, + vertex_index_map, + edge_index_map, + s, + t, + pareto_optimal_solutions, + pareto_optimal_resource_containers, + false, + rc, + ref, + dominance, + default_r_c_shortest_paths_allocator(), + default_r_c_shortest_paths_visitor() ); + pareto_optimal_solution = pareto_optimal_solutions[0]; + pareto_optimal_resource_container = pareto_optimal_resource_containers[0]; +} +// r_c_shortest_paths + + +// check_r_c_path function +template<class Graph, + class Resource_Container, + class Resource_Extension_Function> +void check_r_c_path( const Graph& g, + const std::vector + <typename graph_traits + <Graph>::edge_descriptor>& ed_vec_path, + const Resource_Container& initial_resource_levels, + // if true, computed accumulated final resource levels must + // be equal to desired_final_resource_levels + // if false, computed accumulated final resource levels must + // be less than or equal to desired_final_resource_levels + bool b_result_must_be_equal_to_desired_final_resource_levels, + const Resource_Container& desired_final_resource_levels, + Resource_Container& actual_final_resource_levels, + const Resource_Extension_Function& ref, + bool& b_is_a_path_at_all, + bool& b_feasible, + bool& b_correctly_extended, + typename graph_traits<Graph>::edge_descriptor& + ed_last_extended_arc ) +{ + int i_size_ed_vec_path = static_cast<int>( ed_vec_path.size() ); + std::vector<typename graph_traits<Graph>::edge_descriptor> buf_path; + if( i_size_ed_vec_path == 0 ) + b_feasible = true; + else + { + if( i_size_ed_vec_path == 1 + || target( ed_vec_path[0], g ) == source( ed_vec_path[1], g ) ) + buf_path = ed_vec_path; + else + for( int i = i_size_ed_vec_path - 1; i >= 0; --i ) + buf_path.push_back( ed_vec_path[i] ); + for( int i = 0; i < i_size_ed_vec_path - 1; ++i ) + { + if( target( buf_path[i], g ) != source( buf_path[i + 1], g ) ) + { + b_is_a_path_at_all = false; + b_feasible = false; + b_correctly_extended = false; + return; + } + } + } + b_is_a_path_at_all = true; + b_feasible = true; + b_correctly_extended = false; + Resource_Container current_resource_levels = initial_resource_levels; + actual_final_resource_levels = current_resource_levels; + for( int i = 0; i < i_size_ed_vec_path; ++i ) + { + ed_last_extended_arc = buf_path[i]; + b_feasible = ref( g, + actual_final_resource_levels, + current_resource_levels, + buf_path[i] ); + current_resource_levels = actual_final_resource_levels; + if( !b_feasible ) + return; + } + if( b_result_must_be_equal_to_desired_final_resource_levels ) + b_correctly_extended = + actual_final_resource_levels == desired_final_resource_levels ? + true : false; + else + { + if( actual_final_resource_levels < desired_final_resource_levels + || actual_final_resource_levels == desired_final_resource_levels ) + b_correctly_extended = true; + } +} // check_path + +} // namespace + +#endif // BOOST_GRAPH_R_C_SHORTEST_PATHS_HPP diff --git a/Utilities/BGL/boost/graph/random.hpp b/Utilities/BGL/boost/graph/random.hpp index f25542d8655ccf084a2617aeb0c9f423f91bcc39..bc53b8f3aa077dac0bd49c851cb45d09ac8f0b45 100644 --- a/Utilities/BGL/boost/graph/random.hpp +++ b/Utilities/BGL/boost/graph/random.hpp @@ -16,6 +16,7 @@ #include <boost/pending/property.hpp> #include <boost/graph/properties.hpp> +#include <boost/next_prior.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/copy.hpp> @@ -32,13 +33,16 @@ namespace boost { random_vertex(Graph& g, RandomNumGen& gen) { if (num_vertices(g) > 1) { + #if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581)) + std::size_t n = std::random( num_vertices(g) ); + #else uniform_int<> distrib(0, num_vertices(g)-1); variate_generator<RandomNumGen&, uniform_int<> > rand_gen(gen, distrib); std::size_t n = rand_gen(); + #endif typename graph_traits<Graph>::vertex_iterator i = vertices(g).first; - while (n-- > 0) ++i; // std::advance not VC++ portable - return *i; + return *(boost::next(i, n)); } else return *vertices(g).first; } @@ -47,14 +51,18 @@ namespace boost { typename graph_traits<Graph>::edge_descriptor random_edge(Graph& g, RandomNumGen& gen) { if (num_edges(g) > 1) { + #if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581)) + typename graph_traits<Graph>::edges_size_type + n = std::random( num_edges(g) ); + #else uniform_int<> distrib(0, num_edges(g)-1); variate_generator<RandomNumGen&, uniform_int<> > rand_gen(gen, distrib); - typename graph_traits<Graph>::edges_size_type + typename graph_traits<Graph>::edges_size_type n = rand_gen(); + #endif typename graph_traits<Graph>::edge_iterator i = edges(g).first; - while (n-- > 0) ++i; // std::advance not VC++ portable - return *i; + return *(boost::next(i, n)); } else return *edges(g).first; } @@ -69,7 +77,7 @@ namespace boost { template <typename MutableGraph, class RandNumGen> void generate_random_graph1 - (MutableGraph& g, + (MutableGraph& g, typename graph_traits<MutableGraph>::vertices_size_type V, typename graph_traits<MutableGraph>::vertices_size_type E, RandNumGen& gen, @@ -87,7 +95,7 @@ namespace boost { // but that's task for later. if (!allow_parallel) { - typedef typename boost::graph_traits<MutableGraph>::directed_category dir; + typedef typename boost::graph_traits<MutableGraph>::directed_category dir; typedef typename mpl::if_<is_convertible<dir, directed_tag>, directedS, undirectedS>::type select; adjacency_list<setS, vecS, select> g2; @@ -100,7 +108,7 @@ namespace boost { for (v_size_t i = 0; i < V; ++i) add_vertex(g); - + for (e_size_t j = 0; j < E; ++j) { vertex_descriptor a = random_vertex(g, gen), b; do { @@ -113,7 +121,7 @@ namespace boost { template <typename MutableGraph, class RandNumGen> void generate_random_graph - (MutableGraph& g, + (MutableGraph& g, typename graph_traits<MutableGraph>::vertices_size_type V, typename graph_traits<MutableGraph>::vertices_size_type E, RandNumGen& gen, @@ -126,7 +134,7 @@ namespace boost { template <typename MutableGraph, typename RandNumGen, typename VertexOutputIterator, typename EdgeOutputIterator> void generate_random_graph - (MutableGraph& g, + (MutableGraph& g, typename graph_traits<MutableGraph>::vertices_size_type V, typename graph_traits<MutableGraph>::vertices_size_type E, RandNumGen& gen, @@ -158,7 +166,7 @@ namespace boost { namespace detail { template<class Property, class G, class RandomGenerator> - void randomize_property(G& g, RandomGenerator& rg, + void randomize_property(G& g, RandomGenerator& rg, Property, vertex_property_tag) { typename property_map<G, Property>::type pm = get(Property(), g); @@ -169,7 +177,7 @@ namespace boost { } template<class Property, class G, class RandomGenerator> - void randomize_property(G& g, RandomGenerator& rg, + void randomize_property(G& g, RandomGenerator& rg, Property, edge_property_tag) { typename property_map<G, Property>::type pm = get(Property(), g); diff --git a/Utilities/BGL/boost/graph/random_layout.hpp b/Utilities/BGL/boost/graph/random_layout.hpp index 7f2161221c0d0185ee3f10484772bdb7b9145845..4cd16f29adee97c389bf3edc486daa484a971659 100644 --- a/Utilities/BGL/boost/graph/random_layout.hpp +++ b/Utilities/BGL/boost/graph/random_layout.hpp @@ -1,7 +1,7 @@ // Copyright 2004 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -15,32 +15,19 @@ #include <boost/random/uniform_real.hpp> #include <boost/type_traits/is_integral.hpp> #include <boost/mpl/if.hpp> +#include <boost/graph/iteration_macros.hpp> namespace boost { -template<typename Graph, typename PositionMap, typename Dimension, - typename RandomNumberGenerator> +template<typename Topology, + typename Graph, typename PositionMap> void -random_graph_layout(const Graph& g, PositionMap position_map, - Dimension minX, Dimension maxX, - Dimension minY, Dimension maxY, - RandomNumberGenerator& gen) +random_graph_layout + (const Graph& g, PositionMap position_map, + const Topology& topology) { - typedef typename mpl::if_<is_integral<Dimension>, - uniform_int<Dimension>, - uniform_real<Dimension> >::type distrib_t; - typedef typename mpl::if_<is_integral<Dimension>, - RandomNumberGenerator&, - uniform_01<RandomNumberGenerator, Dimension> > - ::type gen_t; - - gen_t my_gen(gen); - distrib_t x(minX, maxX); - distrib_t y(minY, maxY); - typename graph_traits<Graph>::vertex_iterator vi, vi_end; - for(tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - position_map[*vi].x = x(my_gen); - position_map[*vi].y = y(my_gen); + BGL_FORALL_VERTICES_T(v, g, Graph) { + put(position_map, v, topology.random_point()); } } diff --git a/Utilities/BGL/boost/graph/read_dimacs.hpp b/Utilities/BGL/boost/graph/read_dimacs.hpp index 5f4cfe3ca1ca0b8fb8878c08008e16fa79bc6673..f31482a41bd5be4b56c0699fb9a59cb9255a5f18 100644 --- a/Utilities/BGL/boost/graph/read_dimacs.hpp +++ b/Utilities/BGL/boost/graph/read_dimacs.hpp @@ -9,25 +9,29 @@ /* Reads maximal flow problem in extended DIMACS format. - - Reads from stdin. - - This works, but could use some polishing. + This works, but could use some polishing. */ /* ----------------------------------------------------------------- */ #include <vector> -#include <stdio.h> +#include <iostream> +#include <string> +#include <cstdio> +#include <cstring> +#include <cstdlib> + +#include <boost/graph/graph_traits.hpp> namespace boost { template <class Graph, class CapacityMap, class ReverseEdgeMap> int read_dimacs_max_flow(Graph& g, - CapacityMap capacity, + CapacityMap capacity, ReverseEdgeMap reverse_edge, typename graph_traits<Graph>::vertex_descriptor& src, - typename graph_traits<Graph>::vertex_descriptor& sink) + typename graph_traits<Graph>::vertex_descriptor& sink, + std::istream& in = std::cin) { // const int MAXLINE = 100; /* max line length in the input file */ const int ARC_FIELDS = 3; /* no of fields in arc line */ @@ -38,7 +42,7 @@ int read_dimacs_max_flow(Graph& g, typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; - + std::vector<vertex_descriptor> verts; long m, n, /* number of edges and nodes */ @@ -49,11 +53,11 @@ int read_dimacs_max_flow(Graph& g, no_nslines=0, /* no of node-source-lines */ no_nklines=0, /* no of node-source-lines */ no_alines=0; /* no of arc-lines */ - + std::string in_line; /* for reading input line */ - char pr_type[3]; /* for reading type of the problem */ + char pr_type[4]; /* for reading type of the problem */ char nd; /* source (s) or sink (t) */ - + int k, /* temporary */ err_no; /* no of detected error */ @@ -79,9 +83,9 @@ int read_dimacs_max_flow(Graph& g, const int EN19 = 18; const int EN20 = 19; const int EN22 = 20; - - static char *err_message[] = - { + + static char *err_message[] = + { /* 0*/ "more than one problem line.", /* 1*/ "wrong number of parameters in the problem line.", /* 2*/ "it is not a Max Flow problem line.", @@ -114,7 +118,7 @@ int read_dimacs_max_flow(Graph& g, - does service functions */ - while (std::getline(std::cin, in_line)) { + while (std::getline(in, in_line)) { ++no_lines; switch (in_line[0]) { @@ -122,26 +126,26 @@ int read_dimacs_max_flow(Graph& g, case '\n': /* skip empty lines */ case '\0': /* skip empty lines at the end of file */ break; - + case 'p': /* problem description */ if ( no_plines > 0 ) /* more than one problem line */ { err_no = EN1 ; goto error; } - + no_plines = 1; - + if ( /* reading problem line: type of problem, no of nodes, no of arcs */ - sscanf ( in_line.c_str(), "%*c %3s %ld %ld", pr_type, &n, &m ) + std::sscanf ( in_line.c_str(), "%*c %3s %ld %ld", pr_type, &n, &m ) != P_FIELDS ) /*wrong number of parameters in the problem line*/ { err_no = EN2; goto error; } - - if ( strcmp ( pr_type, PROBLEM_TYPE ) ) + + if ( std::strcmp ( pr_type, PROBLEM_TYPE ) ) /*wrong problem type*/ { err_no = EN3; goto error; } - + if ( n <= 0 || m <= 0 ) /*wrong value of no of arcs or nodes*/ { err_no = EN4; goto error; } @@ -151,83 +155,83 @@ int read_dimacs_max_flow(Graph& g, verts.push_back(add_vertex(g)); } break; - + case 'n': /* source(s) description */ if ( no_plines == 0 ) /* there was not problem line above */ { err_no = EN8; goto error; } - + /* reading source or sink */ - k = sscanf ( in_line.c_str(),"%*c %ld %c", &i, &nd ); + k = std::sscanf ( in_line.c_str(),"%*c %ld %c", &i, &nd ); --i; // index from 0 if ( k < NODE_FIELDS ) /* node line is incorrect */ { err_no = EN11; goto error; } - + if ( i < 0 || i > n ) /* wrong value of node */ { err_no = EN12; goto error; } - + switch (nd) { case 's': /* source line */ - + if ( no_nslines != 0) - /* more than one source line */ + /* more than one source line */ { err_no = EN9; goto error; } - + no_nslines = 1; src = verts[i]; break; - + case 't': /* sink line */ - + if ( no_nklines != 0) /* more than one sink line */ { err_no = EN9; goto error; } - + no_nklines = 1; sink = verts[i]; break; - + default: /* wrong type of node-line */ - err_no = EN12; goto error; + err_no = EN12; goto error; } break; - + case 'a': /* arc description */ - if ( no_nslines == 0 || no_nklines == 0 ) + if ( no_nslines == 0 || no_nklines == 0 ) /* there was not source and sink description above */ { err_no = EN14; goto error; } - + if ( no_alines >= m ) /*too many arcs on input*/ { err_no = EN16; goto error; } - + if ( /* reading an arc description */ - sscanf ( in_line.c_str(),"%*c %ld %ld %ld", - &tail, &head, &cap ) + std::sscanf ( in_line.c_str(),"%*c %ld %ld %ld", + &tail, &head, &cap ) != ARC_FIELDS - ) + ) /* arc description is not correct */ { err_no = EN15; goto error; } --tail; // index from 0, not 1 --head; if ( tail < 0 || tail > n || - head < 0 || head > n + head < 0 || head > n ) /* wrong value of nodes */ { err_no = EN17; goto error; } - { - edge_descriptor e1, e2; + { + edge_descriptor e1, e2; bool in1, in2; tie(e1, in1) = add_edge(verts[tail], verts[head], g); tie(e2, in2) = add_edge(verts[head], verts[tail], g); if (!in1 || !in2) { - std::cerr << "unable to add edge (" << head << "," << tail << ")" + std::cerr << "unable to add edge (" << head << "," << tail << ")" << std::endl; return -1; } @@ -238,39 +242,39 @@ int read_dimacs_max_flow(Graph& g, } ++no_alines; break; - + default: /* unknown type of line */ err_no = EN18; goto error; - + } /* end of switch */ } /* end of input loop */ - - /* ----- all is red or error while reading ----- */ - - if ( feof (stdin) == 0 ) /* reading error */ - { err_no=EN21; goto error; } - + + /* ----- all is red or error while reading ----- */ + + if ( in.eof() == 0 ) /* reading error */ + { err_no=EN21; goto error; } + if ( no_lines == 0 ) /* empty input */ - { err_no = EN22; goto error; } - + { err_no = EN22; goto error; } + if ( no_alines < m ) /* not enough arcs */ - { err_no = EN19; goto error; } - - if ( out_degree(src, g) == 0 || out_degree(sink, g) == 0 ) + { err_no = EN19; goto error; } + + if ( out_degree(src, g) == 0 || out_degree(sink, g) == 0 ) /* no arc goes out of the source */ { err_no = EN20; goto error; } - + /* Thanks God! all is done */ return (0); - + /* ---------------------------------- */ error: /* error found reading input */ - - printf ( "\nline %ld of input - %s\n", - no_lines, err_message[err_no] ); - - exit (1); + + std::printf ( "\nline %ld of input - %s\n", + no_lines, err_message[err_no] ); + + std::exit (1); return (0); /* to avoid warning */ } /* -------------------- end of parser -------------------*/ diff --git a/Utilities/BGL/boost/graph/relax.hpp b/Utilities/BGL/boost/graph/relax.hpp index 74b3261e0056c455a52e51ab18b1717877ea1cef..1d2250a80da87bfce87e6fa0f397fe2c2d27789b 100644 --- a/Utilities/BGL/boost/graph/relax.hpp +++ b/Utilities/BGL/boost/graph/relax.hpp @@ -1,37 +1,18 @@ -// //======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, // -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. +// 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_RELAX_HPP #define BOOST_GRAPH_RELAX_HPP #include <functional> #include <boost/limits.hpp> // for numeric limits #include <boost/graph/graph_traits.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> namespace boost { @@ -41,16 +22,12 @@ namespace boost { template <class T> struct closed_plus { - // std::abs just isn't portable :( - template <class X> - inline X my_abs(const X& x) const { return x < 0 ? -x : x; } - T operator()(const T& a, const T& b) const { using namespace std; - T inf = (numeric_limits<T>::max)(); - if (b > 0 && my_abs(inf - a) < b) - return inf; - return a + b; + const T inf = (std::numeric_limits<T>::max)(); + if (a == inf) return inf; + if (b == inf) return inf; + return a + b; } }; @@ -71,14 +48,17 @@ namespace boost { D d_u = get(d, u), d_v = get(d, v); W w_e = get(w, e); + // The redundant gets in the return statements are to ensure that extra + // floating-point precision in x87 registers does not lead to relax() + // returning true when the distance did not actually change. if ( compare(combine(d_u, w_e), d_v) ) { put(d, v, combine(d_u, w_e)); put(p, v, u); - return true; + return compare(get(d, v), d_v); } else if (is_undirected && compare(combine(d_v, w_e), d_u)) { put(d, u, combine(d_v, w_e)); put(p, u, v); - return true; + return compare(get(d, u), d_u); } else return false; } diff --git a/Utilities/BGL/boost/graph/reverse_graph.hpp b/Utilities/BGL/boost/graph/reverse_graph.hpp index 06c135ffb6925e206a700eb740438603d12706b1..3a81c2940ed4b5c0a047521e1a412db8be7a712c 100644 --- a/Utilities/BGL/boost/graph/reverse_graph.hpp +++ b/Utilities/BGL/boost/graph/reverse_graph.hpp @@ -9,6 +9,13 @@ #include <boost/graph/adjacency_iterator.hpp> #include <boost/graph/properties.hpp> #include <boost/tuple/tuple.hpp> +#include <boost/type_traits.hpp> +#include <boost/mpl/if.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define BidirectionalGraph BidirectionalGraph_ +#endif namespace boost { @@ -70,11 +77,6 @@ class reverse_graph { typedef typename Traits::vertices_size_type vertices_size_type; typedef typename Traits::edges_size_type edges_size_type; - // More typedefs used by detail::edge_property_map, vertex_property_map - typedef typename BidirectionalGraph::edge_property_type - edge_property_type; - typedef typename BidirectionalGraph::vertex_property_type - vertex_property_type; typedef reverse_graph_tag graph_tag; #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES @@ -100,6 +102,18 @@ class reverse_graph { GraphRef m_g; }; + +// These are separate so they are not instantiated unless used (see bug 1021) +template <class BidirectionalGraph, class GraphRef> +struct vertex_property_type<reverse_graph<BidirectionalGraph, GraphRef> > { + typedef typename boost::vertex_property_type<BidirectionalGraph>::type type; +}; + +template <class BidirectionalGraph, class GraphRef> +struct edge_property_type<reverse_graph<BidirectionalGraph, GraphRef> > { + typedef typename boost::edge_property_type<BidirectionalGraph>::type type; +}; + #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES template<typename Graph, typename GraphRef> struct vertex_bundle_type<reverse_graph<Graph, GraphRef> > @@ -141,16 +155,16 @@ edges(const reverse_graph<BidirectionalGraph,GRef>& g) } template <class BidirectionalGraph, class GRef> -inline std::pair<typename BidirectionalGraph::in_edge_iterator, - typename BidirectionalGraph::in_edge_iterator> -out_edges(const typename BidirectionalGraph::vertex_descriptor u, +inline std::pair<typename graph_traits<BidirectionalGraph>::in_edge_iterator, + typename graph_traits<BidirectionalGraph>::in_edge_iterator> +out_edges(const typename graph_traits<BidirectionalGraph>::vertex_descriptor u, const reverse_graph<BidirectionalGraph,GRef>& g) { return in_edges(u, g.m_g); } template <class BidirectionalGraph, class GRef> -inline typename BidirectionalGraph::vertices_size_type +inline typename graph_traits<BidirectionalGraph>::vertices_size_type num_vertices(const reverse_graph<BidirectionalGraph,GRef>& g) { return num_vertices(g.m_g); @@ -164,26 +178,35 @@ num_edges(const reverse_graph<BidirectionalGraph,GRef>& g) } template <class BidirectionalGraph, class GRef> -inline typename BidirectionalGraph::degree_size_type -out_degree(const typename BidirectionalGraph::vertex_descriptor u, +inline typename graph_traits<BidirectionalGraph>::degree_size_type +out_degree(const typename graph_traits<BidirectionalGraph>::vertex_descriptor u, const reverse_graph<BidirectionalGraph,GRef>& g) { return in_degree(u, g.m_g); } template <class BidirectionalGraph, class GRef> -inline std::pair<typename BidirectionalGraph::edge_descriptor, bool> -edge(const typename BidirectionalGraph::vertex_descriptor u, - const typename BidirectionalGraph::vertex_descriptor v, +inline typename graph_traits<BidirectionalGraph>::vertex_descriptor +vertex(const typename graph_traits<BidirectionalGraph>::vertices_size_type v, + const reverse_graph<BidirectionalGraph,GRef>& g) +{ + return vertex(v, g.m_g); +} + +template <class BidirectionalGraph, class GRef> +inline std::pair<typename graph_traits<BidirectionalGraph>::edge_descriptor, + bool> +edge(const typename graph_traits<BidirectionalGraph>::vertex_descriptor u, + const typename graph_traits<BidirectionalGraph>::vertex_descriptor v, const reverse_graph<BidirectionalGraph,GRef>& g) { return edge(v, u, g.m_g); } template <class BidirectionalGraph, class GRef> -inline std::pair<typename BidirectionalGraph::out_edge_iterator, - typename BidirectionalGraph::out_edge_iterator> -in_edges(const typename BidirectionalGraph::vertex_descriptor u, +inline std::pair<typename graph_traits<BidirectionalGraph>::out_edge_iterator, + typename graph_traits<BidirectionalGraph>::out_edge_iterator> +in_edges(const typename graph_traits<BidirectionalGraph>::vertex_descriptor u, const reverse_graph<BidirectionalGraph,GRef>& g) { return out_edges(u, g.m_g); @@ -192,20 +215,20 @@ in_edges(const typename BidirectionalGraph::vertex_descriptor u, template <class BidirectionalGraph, class GRef> inline std::pair<typename reverse_graph<BidirectionalGraph,GRef>::adjacency_iterator, typename reverse_graph<BidirectionalGraph,GRef>::adjacency_iterator> -adjacent_vertices(const typename BidirectionalGraph::vertex_descriptor u, +adjacent_vertices(typename graph_traits<BidirectionalGraph>::vertex_descriptor u, const reverse_graph<BidirectionalGraph,GRef>& g) { typedef reverse_graph<BidirectionalGraph,GRef> Graph; - typename Graph::out_edge_iterator first, last; + typename graph_traits<Graph>::out_edge_iterator first, last; tie(first, last) = out_edges(u, g); - typedef typename Graph::adjacency_iterator adjacency_iterator; + typedef typename graph_traits<Graph>::adjacency_iterator adjacency_iterator; return std::make_pair(adjacency_iterator(first, const_cast<Graph*>(&g)), adjacency_iterator(last, const_cast<Graph*>(&g))); } template <class BidirectionalGraph, class GRef> -inline typename BidirectionalGraph::degree_size_type -in_degree(const typename BidirectionalGraph::vertex_descriptor u, +inline typename graph_traits<BidirectionalGraph>::degree_size_type +in_degree(const typename graph_traits<BidirectionalGraph>::vertex_descriptor u, const reverse_graph<BidirectionalGraph,GRef>& g) { return out_degree(u, g.m_g); @@ -261,14 +284,14 @@ struct edge_property_selector<reverse_graph_tag> { }; template <class BidirGraph, class GRef, class Property> -typename property_map<BidirGraph, Property>::type +typename property_map<reverse_graph<BidirGraph,GRef>, Property>::type get(Property p, reverse_graph<BidirGraph,GRef>& g) { return get(p, g.m_g); } template <class BidirGraph, class GRef, class Property> -typename property_map<BidirGraph, Property>::const_type +typename property_map<reverse_graph<BidirGraph,GRef>, Property>::const_type get(Property p, const reverse_graph<BidirGraph,GRef>& g) { const BidirGraph& gref = g.m_g; // in case GRef is non-const @@ -303,7 +326,10 @@ set_property(const reverse_graph<BidirectionalGraph,GRef>& g, Tag tag, template<typename BidirectionalGraph, typename GRef, typename Tag> inline -typename graph_property<BidirectionalGraph, Tag>::type +typename boost::mpl::if_< + boost::is_const<typename boost::remove_reference<GRef>::type>, + const typename graph_property<BidirectionalGraph, Tag>::type&, + typename graph_property<BidirectionalGraph, Tag>::type& >::type get_property(const reverse_graph<BidirectionalGraph,GRef>& g, Tag tag) { return get_property(g.m_g, tag); @@ -311,4 +337,9 @@ get_property(const reverse_graph<BidirectionalGraph,GRef>& g, Tag tag) } // namespace boost +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# undef BidirectionalGraph +#endif + #endif diff --git a/Utilities/BGL/boost/graph/rmat_graph_generator.hpp b/Utilities/BGL/boost/graph/rmat_graph_generator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8761b0c8e22f6bfcaf23ca0900032aa2ecba9068 --- /dev/null +++ b/Utilities/BGL/boost/graph/rmat_graph_generator.hpp @@ -0,0 +1,594 @@ +// Copyright 2004, 2005 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_RMAT_GENERATOR_HPP +#define BOOST_GRAPH_RMAT_GENERATOR_HPP + +#include <math.h> +#include <iterator> +#include <utility> +#include <vector> +#include <queue> +#include <map> +#include <boost/shared_ptr.hpp> +#include <boost/random/uniform_int.hpp> +#include <boost/random/uniform_01.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/test/floating_point_comparison.hpp> + +using boost::shared_ptr; +using boost::uniform_01; + +// Returns floor(log_2(n)), and -1 when n is 0 +template <typename IntegerType> +inline int int_log2(IntegerType n) { + int l = 0; + while (n > 0) {++l; n >>= 1;} + return l - 1; +} + +struct keep_all_edges { + template <typename T> + bool operator()(const T&, const T&) { return true; } +}; + +template <typename Distribution, typename ProcessId> +struct keep_local_edges { + + keep_local_edges(const Distribution& distrib, const ProcessId& id) + : distrib(distrib), id(id) + { } + + template <typename T> + bool operator()(const T& x, const T& y) + { return distrib(x) == id || distrib(y) == id; } + +private: + const Distribution& distrib; + const ProcessId& id; +}; + +template <typename RandomGenerator, typename T> +void +generate_permutation_vector(RandomGenerator& gen, std::vector<T>& vertexPermutation, T n) +{ + using boost::uniform_int; + + vertexPermutation.resize(n); + + // Generate permutation map of vertex numbers + uniform_int<T> rand_vertex(0, n-1); + for (T i = 0; i < n; ++i) + vertexPermutation[i] = i; + + // Can't use std::random_shuffle unless we create another (synchronized) PRNG + for (T i = 0; i < n; ++i) + std::swap(vertexPermutation[i], vertexPermutation[rand_vertex(gen)]); +} + +template <typename RandomGenerator, typename T> +std::pair<T,T> +generate_edge(shared_ptr<uniform_01<RandomGenerator> > prob, T n, + unsigned int SCALE, double a, double b, double c, double d) +{ + T u = 0, v = 0; + T step = n/2; + for (unsigned int j = 0; j < SCALE; ++j) { + double p = (*prob)(); + + if (p < a) + ; + else if (p >= a && p < a + b) + v += step; + else if (p >= a + b && p < a + b + c) + u += step; + else { // p > a + b + c && p < a + b + c + d + u += step; + v += step; + } + + step /= 2; + + // 0.2 and 0.9 are hardcoded in the reference SSCA implementation. + // The maximum change in any given value should be less than 10% + a *= 0.9 + 0.2 * (*prob)(); + b *= 0.9 + 0.2 * (*prob)(); + c *= 0.9 + 0.2 * (*prob)(); + d *= 0.9 + 0.2 * (*prob)(); + + double S = a + b + c + d; + + a /= S; b /= S; c /= S; + // d /= S; + // Ensure all values add up to 1, regardless of floating point errors + d = 1. - a - b - c; + } + + return std::make_pair(u, v); +} + +namespace boost { + + /* + Chakrabarti's R-MAT scale free generator. + + For all flavors of the R-MAT iterator a+b+c+d must equal 1 and for the + unique_rmat_iterator 'm' << 'n^2'. If 'm' is too close to 'n^2' the + generator may be unable to generate sufficient unique edges + + To get a true scale free distribution {a, b, c, d : a > b, a > c, a > d} + */ + + template<typename RandomGenerator, typename Graph> + class rmat_iterator + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + // No argument constructor, set to terminating condition + rmat_iterator() + : gen(), edge(0) { } + + // Initialize for edge generation + rmat_iterator(RandomGenerator& gen, vertices_size_type n, + edges_size_type m, double a, double b, double c, + double d, bool permute_vertices = true) + : gen(), n(n), a(a), b(b), c(c), d(d), edge(m), + permute_vertices(permute_vertices), + SCALE(int_log2(n)) + + { + this->gen.reset(new uniform_01<RandomGenerator>(gen)); + + assert(boost::test_tools::check_is_close(a + b + c + d, 1., boost::test_tools::fraction_tolerance(1.e-5))); + + if (permute_vertices) + generate_permutation_vector(gen, vertexPermutation, n); + + // TODO: Generate the entire adjacency matrix then "Clip and flip" if undirected graph + + // Generate the first edge + vertices_size_type u, v; + tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); + + if (permute_vertices) + current = std::make_pair(vertexPermutation[u], + vertexPermutation[v]); + else + current = std::make_pair(u, v); + + --edge; + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + rmat_iterator& operator++() + { + vertices_size_type u, v; + tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); + + if (permute_vertices) + current = std::make_pair(vertexPermutation[u], + vertexPermutation[v]); + else + current = std::make_pair(u, v); + + --edge; + + return *this; + } + + rmat_iterator operator++(int) + { + rmat_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const rmat_iterator& other) const + { + return edge == other.edge; + } + + bool operator!=(const rmat_iterator& other) const + { return !(*this == other); } + + private: + + // Parameters + shared_ptr<uniform_01<RandomGenerator> > gen; + vertices_size_type n; + double a, b, c, d; + int edge; + bool permute_vertices; + int SCALE; + + // Internal data structures + std::vector<vertices_size_type> vertexPermutation; + value_type current; + }; + + // Sorted version for CSR + template <typename T> + struct sort_pair { + bool operator() (const std::pair<T,T>& x, const std::pair<T,T>& y) + { + if (x.first == y.first) + return x.second > y.second; + else + return x.first > y.first; + } + }; + + template<typename RandomGenerator, typename Graph, + typename EdgePredicate = keep_all_edges> + class sorted_rmat_iterator + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + // No argument constructor, set to terminating condition + sorted_rmat_iterator() + : gen(), values(sort_pair<vertices_size_type>()), done(true) + { } + + // Initialize for edge generation + sorted_rmat_iterator(RandomGenerator& gen, vertices_size_type n, + edges_size_type m, double a, double b, double c, + double d, bool permute_vertices = true, + EdgePredicate ep = keep_all_edges()) + : gen(), permute_vertices(permute_vertices), + values(sort_pair<vertices_size_type>()), done(false) + + { + assert(boost::test_tools::check_is_close(a + b + c + d, 1., boost::test_tools::fraction_tolerance(1.e-5))); + + this->gen.reset(new uniform_01<RandomGenerator>(gen)); + + std::vector<vertices_size_type> vertexPermutation; + if (permute_vertices) + generate_permutation_vector(gen, vertexPermutation, n); + + // TODO: "Clip and flip" if undirected graph + int SCALE = int_log2(n); + + for (edges_size_type i = 0; i < m; ++i) { + + vertices_size_type u, v; + tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); + + if (permute_vertices) { + if (ep(vertexPermutation[u], vertexPermutation[v])) + values.push(std::make_pair(vertexPermutation[u], vertexPermutation[v])); + } else { + if (ep(u, v)) + values.push(std::make_pair(u, v)); + } + + } + + current = values.top(); + values.pop(); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + sorted_rmat_iterator& operator++() + { + if (!values.empty()) { + current = values.top(); + values.pop(); + } else + done = true; + + return *this; + } + + sorted_rmat_iterator operator++(int) + { + sorted_rmat_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const sorted_rmat_iterator& other) const + { + return values.empty() && other.values.empty() && done && other.done; + } + + bool operator!=(const sorted_rmat_iterator& other) const + { return !(*this == other); } + + private: + + // Parameters + shared_ptr<uniform_01<RandomGenerator> > gen; + bool permute_vertices; + + // Internal data structures + std::priority_queue<value_type, std::vector<value_type>, sort_pair<vertices_size_type> > values; + value_type current; + bool done; + }; + + + // This version is slow but guarantees unique edges + template<typename RandomGenerator, typename Graph, + typename EdgePredicate = keep_all_edges> + class unique_rmat_iterator + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + // No argument constructor, set to terminating condition + unique_rmat_iterator() + : gen(), done(true) + { } + + // Initialize for edge generation + unique_rmat_iterator(RandomGenerator& gen, vertices_size_type n, + edges_size_type m, double a, double b, double c, + double d, bool permute_vertices = true, + EdgePredicate ep = keep_all_edges()) + : gen(), done(false) + + { + assert(boost::test_tools::check_is_close(a + b + c + d, 1., boost::test_tools::fraction_tolerance(1.e-5))); + + this->gen.reset(new uniform_01<RandomGenerator>(gen)); + + std::vector<vertices_size_type> vertexPermutation; + if (permute_vertices) + generate_permutation_vector(gen, vertexPermutation, n); + + int SCALE = int_log2(n); + + std::map<value_type, bool> edge_map; + + edges_size_type edges = 0; + do { + vertices_size_type u, v; + tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); + + // Lowest vertex number always comes first + // (this means we don't have to worry about i->j and j->i being in the edge list) + if (u > v && is_same<directed_category, undirected_tag>::value) + std::swap(u, v); + + if (edge_map.find(std::make_pair(u, v)) == edge_map.end()) { + edge_map[std::make_pair(u, v)] = true; + + if (permute_vertices) { + if (ep(vertexPermutation[u], vertexPermutation[v])) + values.push_back(std::make_pair(vertexPermutation[u], vertexPermutation[v])); + } else { + if (ep(u, v)) + values.push_back(std::make_pair(u, v)); + } + + edges++; + } + } while (edges < m); + // NGE - Asking for more than n^2 edges will result in an infinite loop here + // Asking for a value too close to n^2 edges may as well + + current = values.back(); + values.pop_back(); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + unique_rmat_iterator& operator++() + { + if (!values.empty()) { + current = values.back(); + values.pop_back(); + } else + done = true; + + return *this; + } + + unique_rmat_iterator operator++(int) + { + unique_rmat_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const unique_rmat_iterator& other) const + { + return values.empty() && other.values.empty() && done && other.done; + } + + bool operator!=(const unique_rmat_iterator& other) const + { return !(*this == other); } + + private: + + // Parameters + shared_ptr<uniform_01<RandomGenerator> > gen; + + // Internal data structures + std::vector<value_type> values; + value_type current; + bool done; + }; + + // This version is slow but guarantees unique edges + template<typename RandomGenerator, typename Graph, + typename EdgePredicate = keep_all_edges> + class sorted_unique_rmat_iterator + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + // No argument constructor, set to terminating condition + sorted_unique_rmat_iterator() + : gen(), values(sort_pair<vertices_size_type>()), done(true) { } + + // Initialize for edge generation + sorted_unique_rmat_iterator(RandomGenerator& gen, vertices_size_type n, + edges_size_type m, double a, double b, double c, + double d, bool bidirectional = false, + bool permute_vertices = true, + EdgePredicate ep = keep_all_edges()) + : gen(), bidirectional(bidirectional), + values(sort_pair<vertices_size_type>()), done(false) + + { + assert(boost::test_tools::check_is_close(a + b + c + d, 1., boost::test_tools::fraction_tolerance(1.e-5))); + + this->gen.reset(new uniform_01<RandomGenerator>(gen)); + + std::vector<vertices_size_type> vertexPermutation; + if (permute_vertices) + generate_permutation_vector(gen, vertexPermutation, n); + + int SCALE = int_log2(n); + + std::map<value_type, bool> edge_map; + + edges_size_type edges = 0; + do { + + vertices_size_type u, v; + tie(u, v) = generate_edge(this->gen, n, SCALE, a, b, c, d); + + if (bidirectional) { + if (edge_map.find(std::make_pair(u, v)) == edge_map.end()) { + edge_map[std::make_pair(u, v)] = true; + edge_map[std::make_pair(v, u)] = true; + + if (ep(u, v)) { + if (permute_vertices) { + values.push(std::make_pair(vertexPermutation[u], vertexPermutation[v])); + values.push(std::make_pair(vertexPermutation[v], vertexPermutation[u])); + } else { + values.push(std::make_pair(u, v)); + values.push(std::make_pair(v, u)); + } + } + + ++edges; + } + } else { + // Lowest vertex number always comes first + // (this means we don't have to worry about i->j and j->i being in the edge list) + if (u > v && is_same<directed_category, undirected_tag>::value) + std::swap(u, v); + + if (edge_map.find(std::make_pair(u, v)) == edge_map.end()) { + edge_map[std::make_pair(u, v)] = true; + + if (permute_vertices) { + if (ep(vertexPermutation[u], vertexPermutation[v])) + values.push(std::make_pair(vertexPermutation[u], vertexPermutation[v])); + } else { + if (ep(u, v)) + values.push(std::make_pair(u, v)); + } + + ++edges; + } + } + + } while (edges < m); + // NGE - Asking for more than n^2 edges will result in an infinite loop here + // Asking for a value too close to n^2 edges may as well + + current = values.top(); + values.pop(); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + sorted_unique_rmat_iterator& operator++() + { + if (!values.empty()) { + current = values.top(); + values.pop(); + } else + done = true; + + return *this; + } + + sorted_unique_rmat_iterator operator++(int) + { + sorted_unique_rmat_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const sorted_unique_rmat_iterator& other) const + { + return values.empty() && other.values.empty() && done && other.done; + } + + bool operator!=(const sorted_unique_rmat_iterator& other) const + { return !(*this == other); } + + private: + + // Parameters + shared_ptr<uniform_01<RandomGenerator> > gen; + bool bidirectional; + + // Internal data structures + std::priority_queue<value_type, std::vector<value_type>, + sort_pair<vertices_size_type> > values; + value_type current; + bool done; + }; + +} // end namespace boost + +#ifdef BOOST_GRAPH_USE_MPI +#include <boost/graph/distributed/rmat_graph_generator.hpp> +#endif // BOOST_GRAPH_USE_MPI + +#endif // BOOST_GRAPH_RMAT_GENERATOR_HPP diff --git a/Utilities/BGL/boost/graph/sequential_vertex_coloring.hpp b/Utilities/BGL/boost/graph/sequential_vertex_coloring.hpp index 606f2e52d257ef6dcf4759d0eecc520b6bc6e515..f5362b3c4135f39ba1029c03f382df2f36c36b9c 100644 --- a/Utilities/BGL/boost/graph/sequential_vertex_coloring.hpp +++ b/Utilities/BGL/boost/graph/sequential_vertex_coloring.hpp @@ -13,7 +13,7 @@ #include <vector> #include <boost/graph/graph_traits.hpp> #include <boost/tuple/tuple.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/limits.hpp> #ifdef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS diff --git a/Utilities/BGL/boost/graph/simple_point.hpp b/Utilities/BGL/boost/graph/simple_point.hpp index 915f4f7ce94c4287811a2dee74becf9cc53a8e65..5f19c75f78a68f1fea3db995cfc2e6ca99f105bf 100644 --- a/Utilities/BGL/boost/graph/simple_point.hpp +++ b/Utilities/BGL/boost/graph/simple_point.hpp @@ -1,3 +1,11 @@ +//======================================================================= +// Copyright 2005 Trustees of Indiana University +// Authors: Andrew Lumsdaine, Douglas Gregor +// +// 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_SIMPLE_POINT_HPP #define BOOST_GRAPH_SIMPLE_POINT_HPP diff --git a/Utilities/BGL/boost/graph/sloan_ordering.hpp b/Utilities/BGL/boost/graph/sloan_ordering.hpp index 0ceac6cf132fb6c4844ef7ecd12c22820321a5e2..ff5748dd7f3c6da050d36d57086f94585eb0a3ac 100644 --- a/Utilities/BGL/boost/graph/sloan_ordering.hpp +++ b/Utilities/BGL/boost/graph/sloan_ordering.hpp @@ -1,27 +1,11 @@ // //======================================================================= -// Copyright 2002 Marc Wintermantel (wintermantel@imes.mavt.ethz.ch) +// Copyright 2002 Marc Wintermantel (wintermantel@even-ag.ch) // ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st) // -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. +// 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) //======================================================================= // @@ -30,19 +14,18 @@ #define WEIGHT1 1 //default weight for the distance in the Sloan algorithm #define WEIGHT2 2 //default weight for the degree in the Sloan algorithm -#define MAXINT 2147483647 //Maximum value for a 32bit integer #include <boost/config.hpp> #include <vector> #include <queue> +#include <algorithm> +#include <limits> #include <boost/pending/queue.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/breadth_first_search.hpp> #include <boost/graph/properties.hpp> #include <boost/pending/indirect_cmp.hpp> -#include <boost/property_map.hpp> -#include <algorithm> -#include <utility> +#include <boost/property_map/property_map.hpp> #include <boost/graph/visitors.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/cuthill_mckee_ordering.hpp> @@ -211,9 +194,9 @@ namespace boost { //end 3 & 4 - //step 5 - //Initializing w - w_e = MAXINT; + // step 5 + // Initializing w + w_e = (std::numeric_limits<unsigned>::max)(); //end 5 diff --git a/Utilities/BGL/boost/graph/small_world_generator.hpp b/Utilities/BGL/boost/graph/small_world_generator.hpp index 9cd62deb7ee3a4b588a111162810d3ac78e78727..4822e26ce7ad451be9daa6921185f5c564e21406 100644 --- a/Utilities/BGL/boost/graph/small_world_generator.hpp +++ b/Utilities/BGL/boost/graph/small_world_generator.hpp @@ -1,7 +1,7 @@ // Copyright 2004 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// 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) // Authors: Douglas Gregor @@ -20,7 +20,7 @@ namespace boost { template<typename RandomGenerator, typename Graph> class small_world_iterator { - typedef typename graph_traits<Graph>::vertices_size_type + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; public: @@ -31,20 +31,20 @@ namespace boost { typedef void difference_type; small_world_iterator() : gen(0) {} - small_world_iterator(RandomGenerator& gen, vertices_size_type n, - vertices_size_type k, double prob = 0.0, - bool allow_self_loops = false) - : gen(&gen), n(n), k(k), prob(prob), source(0), - target(allow_self_loops? 0 : 1), - allow_self_loops(allow_self_loops), + small_world_iterator(RandomGenerator& gen, vertices_size_type n, + vertices_size_type k, double prob = 0.0, + bool allow_self_loops = false) + : gen(&gen), n(n), k(k), prob(prob), source(0), + target(allow_self_loops? 0 : 1), + allow_self_loops(allow_self_loops), current(0, allow_self_loops? 0 : 1) { } reference operator*() const { return current; } pointer operator->() const { return ¤t; } - + small_world_iterator& operator++() - { + { target = (target + 1) % n; if (target == (source + k/2 + 1) % n) { ++source; @@ -62,8 +62,8 @@ namespace boost { vertices_size_type upper = (source + k/2) % n; do { current.second = rand_vertex_gen(*gen); - } while (current.second >= lower && current.second <= upper - || (upper < lower + } while ((current.second >= lower && current.second <= upper) + || (upper < lower && (current.second >= lower || current.second <= upper))); } else { current.second = target; diff --git a/Utilities/BGL/boost/graph/smallest_last_ordering.hpp b/Utilities/BGL/boost/graph/smallest_last_ordering.hpp index eea652d0461e84d650022685e0e13765ee745099..648efc61e883734c4731328b5fc4595a1c540bff 100644 --- a/Utilities/BGL/boost/graph/smallest_last_ordering.hpp +++ b/Utilities/BGL/boost/graph/smallest_last_ordering.hpp @@ -6,6 +6,14 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= + +// Revision History: +// 17 March 2006: Fixed a bug: when updating the degree a vertex +// could be moved to a wrong bucket. (Roman Dementiev) +// + + + #ifndef BOOST_SMALLEST_LAST_VERTEX_ORDERING_HPP #define BOOST_SMALLEST_LAST_VERTEX_ORDERING_HPP /* @@ -29,18 +37,18 @@ namespace boost { void smallest_last_vertex_ordering(const VertexListGraph& G, Order order, Degree degree, Marker marker) { - typedef typename graph_traits<VertexListGraph> GraphTraits; + typedef typename boost::graph_traits<VertexListGraph> GraphTraits; typedef typename GraphTraits::vertex_descriptor Vertex; //typedef typename GraphTraits::size_type size_type; typedef std::size_t size_type; const size_type num = num_vertices(G); - typedef typename vertex_property_map<VertexListGraph, vertex_index_t>::type ID; + typedef typename boost::detail::vertex_property_map<VertexListGraph, vertex_index_t>::type ID; typedef bucket_sorter<size_type, Vertex, Degree, ID> BucketSorter; BucketSorter degree_bucket_sorter(num, num, degree, - get_vertex_property(G, vertex_index)); + get(vertex_index,G)); smallest_last_vertex_ordering(G, order, degree, marker, degree_bucket_sorter); } @@ -51,7 +59,7 @@ namespace boost { smallest_last_vertex_ordering(const VertexListGraph& G, Order order, Degree degree, Marker marker, BucketSorter& degree_buckets) { - typedef typename graph_traits<VertexListGraph> GraphTraits; + typedef typename boost::graph_traits<VertexListGraph> GraphTraits; typedef typename GraphTraits::vertex_descriptor Vertex; //typedef typename GraphTraits::size_type size_type; typedef std::size_t size_type; @@ -65,7 +73,7 @@ namespace boost { degree_buckets.push(*v); } - size_type minimum_degree = 1; + size_type minimum_degree = 0; size_type current_order = num - 1; while ( 1 ) { @@ -88,15 +96,18 @@ namespace boost { if ( get(marker,*v) > current_order ) { //*v is unordered vertex put(marker, *v, current_order); //mark the columns adjacent to node - + + //delete *v from the bucket sorter + degree_buckets.remove(*v); + //It is possible minimum degree goes down //Here we keep tracking it. put(degree, *v, get(degree, *v) - 1); BOOST_USING_STD_MIN(); minimum_degree = min BOOST_PREVENT_MACRO_SUBSTITUTION(minimum_degree, get(degree, *v)); - //update the position of *v in the bucket sorter - degree_buckets.update(*v); + //reinsert *v in the bucket sorter with the new degree + degree_buckets.push(*v); } current_order--; diff --git a/Utilities/BGL/boost/graph/ssca_graph_generator.hpp b/Utilities/BGL/boost/graph/ssca_graph_generator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..18d4a23f1089f2e4756a3ba84062ffc3e144aeba --- /dev/null +++ b/Utilities/BGL/boost/graph/ssca_graph_generator.hpp @@ -0,0 +1,169 @@ +// Copyright 2004, 2005 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_SSCA_GENERATOR_HPP +#define BOOST_GRAPH_SSCA_GENERATOR_HPP + +#include <iterator> +#include <utility> +#include <vector> +#include <queue> +#include <boost/config.hpp> +#include <boost/random/uniform_int.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_same.hpp> + +enum Direction {FORWARD = 1, BACKWARD = 2, BOTH = FORWARD | BACKWARD}; + +namespace boost { + + // This generator generates graphs according to the method specified + // in SSCA 1.1. Current versions of SSCA use R-MAT graphs + + template<typename RandomGenerator, typename Graph> + class ssca_iterator + { + typedef typename graph_traits<Graph>::directed_category directed_category; + typedef typename graph_traits<Graph>::vertices_size_type + vertices_size_type; + + public: + typedef std::input_iterator_tag iterator_category; + typedef std::pair<vertices_size_type, vertices_size_type> value_type; + typedef const value_type& reference; + typedef const value_type* pointer; + typedef void difference_type; + + // No argument constructor, set to terminating condition + ssca_iterator() + : gen(), verticesRemaining(0) { } + + // Initialize for edge generation + ssca_iterator(RandomGenerator& gen, vertices_size_type totVertices, + vertices_size_type maxCliqueSize, double probUnidirectional, + int maxParallelEdges, double probIntercliqueEdges) + : gen(&gen), totVertices(totVertices), maxCliqueSize(maxCliqueSize), + probUnidirectional(probUnidirectional), maxParallelEdges(maxParallelEdges), + probIntercliqueEdges(probIntercliqueEdges), currentClique(0), + verticesRemaining(totVertices) + { + cliqueNum = std::vector<int>(totVertices, -1); + current = std::make_pair(0,0); + } + + reference operator*() const { return current; } + pointer operator->() const { return ¤t; } + + ssca_iterator& operator++() + { + BOOST_USING_STD_MIN(); + while (values.empty() && verticesRemaining > 0) { // If there are no values left, generate a new clique + uniform_int<vertices_size_type> clique_size(1, maxCliqueSize); + uniform_int<vertices_size_type> rand_vertex(0, totVertices-1); + uniform_int<int> num_parallel_edges(1, maxParallelEdges); + uniform_int<short> direction(0,1); + uniform_01<RandomGenerator> prob(*gen); + std::vector<vertices_size_type> cliqueVertices; + + cliqueVertices.clear(); + vertices_size_type size = min BOOST_PREVENT_MACRO_SUBSTITUTION (clique_size(*gen), verticesRemaining); + while (cliqueVertices.size() < size) { + vertices_size_type v = rand_vertex(*gen); + if (cliqueNum[v] == -1) { + cliqueNum[v] = currentClique; + cliqueVertices.push_back(v); + verticesRemaining--; + } + } // Nick: This is inefficient when only a few vertices remain... + // I should probably just select the remaining vertices + // in order when only a certain fraction remain. + + typename std::vector<vertices_size_type>::iterator first, second; + for (first = cliqueVertices.begin(); first != cliqueVertices.end(); ++first) + for (second = first+1; second != cliqueVertices.end(); ++second) { + Direction d; + int edges; + + d = prob() < probUnidirectional ? (direction(*gen) == 0 ? FORWARD : BACKWARD) : BOTH; + + if (d & FORWARD) { + edges = num_parallel_edges(*gen); + for (int i = 0; i < edges; ++i) + values.push(std::make_pair(*first, *second)); + } + + if (d & BACKWARD) { + edges = num_parallel_edges(*gen); + for (int i = 0; i < edges; ++i) + values.push(std::make_pair(*second, *first)); + } + } + + if (verticesRemaining == 0) { + // Generate interclique edges + for (vertices_size_type i = 0; i < totVertices; ++i) { + double p = probIntercliqueEdges; + for (vertices_size_type d = 2; d < totVertices/2; d *= 2, p/= 2) { + vertices_size_type j = (i+d) % totVertices; + if (cliqueNum[j] != cliqueNum[i] && prob() < p) { + int edges = num_parallel_edges(*gen); + for (int i = 0; i < edges; ++i) + values.push(std::make_pair(i, j)); + } + } + } + } + + currentClique++; + } + + if (!values.empty()) { // If we're not done return a value + current = values.front(); + values.pop(); + } + + return *this; + } + + ssca_iterator operator++(int) + { + ssca_iterator temp(*this); + ++(*this); + return temp; + } + + bool operator==(const ssca_iterator& other) const + { + return verticesRemaining == other.verticesRemaining && values.empty() && other.values.empty(); + } + + bool operator!=(const ssca_iterator& other) const + { return !(*this == other); } + + private: + + // Parameters + RandomGenerator* gen; + vertices_size_type totVertices; + vertices_size_type maxCliqueSize; + double probUnidirectional; + int maxParallelEdges; + double probIntercliqueEdges; + + // Internal data structures + std::vector<int> cliqueNum; + std::queue<value_type> values; + int currentClique; + vertices_size_type verticesRemaining; + value_type current; + }; + +} // end namespace boost + +#endif // BOOST_GRAPH_SSCA_GENERATOR_HPP diff --git a/Utilities/BGL/boost/graph/st_connected.hpp b/Utilities/BGL/boost/graph/st_connected.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9801a275b4d04aeb4342c98de2cbe645ad09f6b8 --- /dev/null +++ b/Utilities/BGL/boost/graph/st_connected.hpp @@ -0,0 +1,82 @@ +// Copyright (C) 2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP +#define BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP + +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/two_bit_color_map.hpp> +#include <boost/graph/iteration_macros.hpp> +#include <boost/pending/queue.hpp> + +namespace boost { namespace graph { + +template<typename Graph, typename ColorMap> +bool +st_connected(const Graph& g, + typename graph_traits<Graph>::vertex_descriptor s, + typename graph_traits<Graph>::vertex_descriptor t, + ColorMap color) +{ + typedef typename property_traits<ColorMap>::value_type Color; + typedef color_traits<Color> ColorTraits; + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + + // Set all vertices to white (unvisited) + BGL_FORALL_VERTICES_T(v, g, Graph) + put(color, v, ColorTraits::white()); + + // Vertices found from the source are grey + put(color, s, ColorTraits::gray()); + + // Vertices found from the target are greeen + put(color, t, ColorTraits::green()); + queue<Vertex> Q; + Q.push(s); + Q.push(t); + + while (!Q.empty()) { + Vertex u = Q.top(); Q.pop(); + Color u_color = get(color, u); + + BGL_FORALL_OUTEDGES_T(u, e, g, Graph) { + Vertex v = target(e, g); + Color v_color = get(color, v); + if (v_color == ColorTraits::white()) { + // We have not seen "v" before; mark it with the same color as u + Color u_color = get(color, u); + put(color, v, u_color); + + // Push it on the queue + Q.push(v); + } else if (v_color != ColorTraits::black() && u_color != v_color) { + // Colors have collided. We're done! + return true; + } + } + // u is done, so mark it black + put(color, u, ColorTraits::black()); + } + + return false; +} + +template<typename Graph> +inline bool +st_connected(const Graph& g, + typename graph_traits<Graph>::vertex_descriptor s, + typename graph_traits<Graph>::vertex_descriptor t) +{ + return st_connected(g, s, t, + make_two_bit_color_map(num_vertices(g), + get(vertex_index, g))); +} + +} } // end namespace boost::graph + +#endif // BOOST_GRAPH_DISTRIBUTED_ST_CONNECTED_HPP diff --git a/Utilities/BGL/boost/graph/stanford_graph.hpp b/Utilities/BGL/boost/graph/stanford_graph.hpp index c98bba1167c2f8a26693dd4e854fb69cc89ff405..0bb798c0f3ce63483ed46cea8de9f2e26aa2f047 100644 --- a/Utilities/BGL/boost/graph/stanford_graph.hpp +++ b/Utilities/BGL/boost/graph/stanford_graph.hpp @@ -12,7 +12,7 @@ #include <boost/config.hpp> #include <boost/iterator.hpp> #include <boost/operators.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/properties.hpp> diff --git a/Utilities/BGL/boost/graph/strong_components.hpp b/Utilities/BGL/boost/graph/strong_components.hpp index 0ed0b4a19b1b632d60b30980b6b0b59cf792c8f8..9469010a846cbf409cdf02ee2e4a72318292298d 100644 --- a/Utilities/BGL/boost/graph/strong_components.hpp +++ b/Utilities/BGL/boost/graph/strong_components.hpp @@ -17,6 +17,7 @@ #include <boost/graph/depth_first_search.hpp> #include <boost/type_traits/conversion_traits.hpp> #include <boost/static_assert.hpp> +#include <boost/graph/overloading.hpp> namespace boost { @@ -219,7 +220,8 @@ namespace boost { class P, class T, class R> inline typename property_traits<ComponentMap>::value_type strong_components(const Graph& g, ComponentMap comp, - const bgl_named_params<P, T, R>& params) + const bgl_named_params<P, T, R>& params + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag)) { typedef typename graph_traits<Graph>::directed_category DirCat; BOOST_STATIC_ASSERT((is_convertible<DirCat*, directed_tag*>::value == true)); @@ -229,7 +231,8 @@ namespace boost { template <class Graph, class ComponentMap> inline typename property_traits<ComponentMap>::value_type - strong_components(const Graph& g, ComponentMap comp) + strong_components(const Graph& g, ComponentMap comp + BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag)) { typedef typename graph_traits<Graph>::directed_category DirCat; BOOST_STATIC_ASSERT((is_convertible<DirCat*, directed_tag*>::value == true)); @@ -331,4 +334,8 @@ namespace boost { } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/strong_components.hpp> +#endif + #endif // BOOST_GRAPH_STRONG_COMPONENTS_HPP diff --git a/Utilities/BGL/boost/graph/subgraph.hpp b/Utilities/BGL/boost/graph/subgraph.hpp index 91d2e05fcfa9aec3e29520829beb117bfac2a96b..15cdace53b5172bccb403780770eeadddbed1025 100644 --- a/Utilities/BGL/boost/graph/subgraph.hpp +++ b/Utilities/BGL/boost/graph/subgraph.hpp @@ -18,6 +18,7 @@ #include <map> #include <cassert> #include <boost/graph/graph_traits.hpp> +#include <boost/graph/graph_mutability_traits.hpp> #include <boost/graph/properties.hpp> #include <boost/iterator/indirect_iterator.hpp> @@ -26,38 +27,63 @@ namespace boost { - struct subgraph_tag { }; - - // Invariants of an induced subgraph: - // - If vertex u is in subgraph g, then u must be in g.parent(). - // - If edge e is in subgraph g, then e must be in g.parent(). - // - If edge e=(u,v) is in the root graph, then edge e - // is also in any subgraph that contains both vertex u and v. - - // The Graph template parameter must have a vertex_index - // and edge_index internal property. It is assumed that - // the vertex indices are assigned automatically by the - // graph during a call to add_vertex(). It is not - // assumed that the edge vertices are assigned automatically, - // they are explicitly assigned here. - - template <typename Graph> - class subgraph { +struct subgraph_tag { }; + +/** @name Property Lookup + * The local_property and global_property functions are used to create + * structures that determine the lookup strategy for properties in subgraphs. + * Note that the nested kind member is used to help interoperate with actual + * Property types. + */ +//@{ +template <typename T> +struct local_property +{ + typedef T kind; + local_property(T x) : value(x) { } + T value; +}; + +template <typename T> +inline local_property<T> local(T x) +{ return local_property<T>(x); } + +template <typename T> +struct global_property +{ + typedef T kind; + global_property(T x) : value(x) { } + T value; +}; + +template <typename T> +inline global_property<T> global(T x) +{ return global_property<T>(x); } +//@} + +// Invariants of an induced subgraph: +// - If vertex u is in subgraph g, then u must be in g.parent(). +// - If edge e is in subgraph g, then e must be in g.parent(). +// - If edge e=(u,v) is in the root graph, then edge e +// is also in any subgraph that contains both vertex u and v. + +// The Graph template parameter must have a vertex_index and edge_index +// internal property. It is assumed that the vertex indices are assigned +// automatically by the graph during a call to add_vertex(). It is not +// assumed that the edge vertices are assigned automatically, they are +// explicitly assigned here. + +template <typename Graph> +class subgraph { typedef graph_traits<Graph> Traits; typedef std::list<subgraph<Graph>*> ChildrenList; - public: - // Graph requirements - typedef typename Traits::vertex_descriptor vertex_descriptor; - typedef typename Traits::edge_descriptor edge_descriptor; - typedef typename Traits::directed_category directed_category; - typedef typename Traits::edge_parallel_category edge_parallel_category; - typedef typename Traits::traversal_category traversal_category; - - static vertex_descriptor null_vertex() - { - return Traits::null_vertex(); - } - +public: +// Graph requirements +typedef typename Traits::vertex_descriptor vertex_descriptor; +typedef typename Traits::edge_descriptor edge_descriptor; +typedef typename Traits::directed_category directed_category; +typedef typename Traits::edge_parallel_category edge_parallel_category; +typedef typename Traits::traversal_category traversal_category; // IncidenceGraph requirements typedef typename Traits::out_edge_iterator out_edge_iterator; @@ -78,121 +104,117 @@ namespace boost { typedef typename Graph::edge_property_type edge_property_type; typedef typename Graph::vertex_property_type vertex_property_type; + typedef typename Graph::vertex_bundled vertex_bundled; + typedef typename Graph::edge_bundled edge_bundled; typedef subgraph_tag graph_tag; typedef Graph graph_type; typedef typename Graph::graph_property_type graph_property_type; - // Constructors - // Create the main graph, the root of the subgraph tree subgraph() - : m_parent(0), m_edge_counter(0) + : m_parent(0), m_edge_counter(0) { } + subgraph(const graph_property_type& p) - : m_graph(p), m_parent(0), m_edge_counter(0) + : m_graph(p), m_parent(0), m_edge_counter(0) { } - subgraph(vertices_size_type n, - const graph_property_type& p = graph_property_type()) - : m_graph(n, p), m_parent(0), m_edge_counter(0), m_global_vertex(n) + + subgraph(vertices_size_type n, const graph_property_type& p = graph_property_type()) + : m_graph(n, p), m_parent(0), m_edge_counter(0), m_global_vertex(n) { - typename Graph::vertex_iterator v, v_end; - vertices_size_type i = 0; - for (tie(v, v_end) = vertices(m_graph); v != v_end; ++v) - m_global_vertex[i++] = *v; + typename Graph::vertex_iterator v, v_end; + vertices_size_type i = 0; + for(tie(v, v_end) = vertices(m_graph); v != v_end; ++v) + m_global_vertex[i++] = *v; } // copy constructor subgraph(const subgraph& x) - : m_graph(x.m_graph), m_parent(x.m_parent), - m_edge_counter(x.m_edge_counter), - m_global_vertex(x.m_global_vertex), - m_global_edge(x.m_global_edge) + : m_graph(x.m_graph), m_parent(x.m_parent), m_edge_counter(x.m_edge_counter) + , m_global_vertex(x.m_global_vertex), m_global_edge(x.m_global_edge) { - // Do a deep copy - for (typename ChildrenList::const_iterator i = x.m_children.begin(); - i != x.m_children.end(); ++i) - m_children.push_back(new subgraph<Graph>( **i )); + // Do a deep copy (recursive). + for(typename ChildrenList::const_iterator i = x.m_children.begin(); + i != x.m_children.end(); ++i) + { + m_children.push_back(new subgraph<Graph>( **i )); + } } ~subgraph() { - for (typename ChildrenList::iterator i = m_children.begin(); - i != m_children.end(); ++i) - delete *i; + for(typename ChildrenList::iterator i = m_children.begin(); + i != m_children.end(); ++i) + { + delete *i; + } } + // Return a null vertex descriptor for the graph. + static vertex_descriptor null_vertex() + { return Traits::null_vertex(); } + // Create a subgraph subgraph<Graph>& create_subgraph() { - m_children.push_back(new subgraph<Graph>()); - m_children.back()->m_parent = this; - return *m_children.back(); + m_children.push_back(new subgraph<Graph>()); + m_children.back()->m_parent = this; + return *m_children.back(); } // Create a subgraph with the specified vertex set. template <typename VertexIterator> - subgraph<Graph>& create_subgraph(VertexIterator first, - VertexIterator last) - { - m_children.push_back(new subgraph<Graph>()); - m_children.back()->m_parent = this; - for (; first != last; ++first) - add_vertex(*first, *m_children.back()); - return *m_children.back(); + subgraph<Graph>& create_subgraph(VertexIterator first, VertexIterator last) { + m_children.push_back(new subgraph<Graph>()); + m_children.back()->m_parent = this; + for(; first != last; ++first) { + add_vertex(*first, *m_children.back()); + } + return *m_children.back(); } // local <-> global descriptor conversion functions vertex_descriptor local_to_global(vertex_descriptor u_local) const - { - return m_global_vertex[u_local]; - } - vertex_descriptor global_to_local(vertex_descriptor u_global) const - { - vertex_descriptor u_local; bool in_subgraph; - tie(u_local, in_subgraph) = this->find_vertex(u_global); - assert(in_subgraph == true); - return u_local; + { return is_root() ? u_local : m_global_vertex[u_local]; } + + vertex_descriptor global_to_local(vertex_descriptor u_global) const { + vertex_descriptor u_local; bool in_subgraph; + if (is_root()) return u_global; + tie(u_local, in_subgraph) = this->find_vertex(u_global); + assert(in_subgraph == true); + return u_local; } + edge_descriptor local_to_global(edge_descriptor e_local) const - { - return m_global_edge[get(get(edge_index, m_graph), e_local)]; - } + { return is_root() ? e_local : m_global_edge[get(get(edge_index, m_graph), e_local)]; } + edge_descriptor global_to_local(edge_descriptor e_global) const - { - return - (*m_local_edge.find(get(get(edge_index, root().m_graph), e_global))).second; - } + { return is_root() ? e_global : (*m_local_edge.find(get(get(edge_index, root().m_graph), e_global))).second; } // Is vertex u (of the root graph) contained in this subgraph? // If so, return the matching local vertex. std::pair<vertex_descriptor, bool> - find_vertex(vertex_descriptor u_global) const - { - typename std::map<vertex_descriptor, vertex_descriptor>::const_iterator - i = m_local_vertex.find(u_global); - bool valid = i != m_local_vertex.end(); - return std::make_pair((valid ? (*i).second : null_vertex()), valid); + find_vertex(vertex_descriptor u_global) const { + if (is_root()) return std::make_pair(u_global, true); + typename std::map<vertex_descriptor, vertex_descriptor>::const_iterator + i = m_local_vertex.find(u_global); + bool valid = i != m_local_vertex.end(); + return std::make_pair((valid ? (*i).second : null_vertex()), valid); } // Return the parent graph. subgraph& parent() { return *m_parent; } const subgraph& parent() const { return *m_parent; } + // Return true if this is the root subgraph bool is_root() const { return m_parent == 0; } // Return the root graph of the subgraph tree. - subgraph& root() { - if (this->is_root()) - return *this; - else - return m_parent->root(); - } - const subgraph& root() const { - if (this->is_root()) - return *this; - else - return m_parent->root(); - } + subgraph& root() + { return is_root() ? *this : m_parent->root(); } + + const subgraph& root() const + { return is_root() ? *this : m_parent->root(); } // Return the children subgraphs of this graph/subgraph. // Use a list of pointers because the VC++ std::list doesn't like @@ -211,16 +233,12 @@ namespace boost { > const_children_iterator; - std::pair<const_children_iterator, const_children_iterator> - children() const - { + std::pair<const_children_iterator, const_children_iterator> children() const { return std::make_pair(const_children_iterator(m_children.begin()), const_children_iterator(m_children.end())); } - std::pair<children_iterator, children_iterator> - children() - { + std::pair<children_iterator, children_iterator> children() { return std::make_pair(children_iterator(m_children.begin()), children_iterator(m_children.end())); } @@ -228,70 +246,105 @@ namespace boost { std::size_t num_children() const { return m_children.size(); } #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - // Bundled properties support - template<typename Descriptor> + // Defualt property access delegates the lookup to global properties. + template <typename Descriptor> typename graph::detail::bundled_result<Graph, Descriptor>::type& operator[](Descriptor x) - { - if (m_parent == 0) return m_graph[x]; - else return root().m_graph[local_to_global(x)]; - } + { return is_root() ? m_graph[x] : root().m_graph[local_to_global(x)]; } - template<typename Descriptor> + template <typename Descriptor> typename graph::detail::bundled_result<Graph, Descriptor>::type const& operator[](Descriptor x) const - { - if (m_parent == 0) return m_graph[x]; - else return root().m_graph[local_to_global(x)]; - } + { return is_root() ? m_graph[x] : root().m_graph[local_to_global(x)]; } + + // Local property access returns the local property of the given descripor. + template <typename Descriptor> + typename graph::detail::bundled_result<Graph, Descriptor>::type& + operator[](local_property<Descriptor> x) + { return m_graph[x.value]; } + + template <typename Descriptor> + typename graph::detail::bundled_result<Graph, Descriptor>::type const& + operator[](local_property<Descriptor> x) const + { return m_graph[x.value]; } + + // Global property access returns the global property associated with the + // given descriptor. This is an alias for the default bundled property + // access operations. + template <typename Descriptor> + typename graph::detail::bundled_result<Graph, Descriptor>::type& + operator[](global_property<Descriptor> x) + { return (*this)[x.value]; } + + template <typename Descriptor> + typename graph::detail::bundled_result<Graph, Descriptor>::type const& + operator[](global_property<Descriptor> x) const + { return (*this)[x.value]; } + #endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES // private: typedef typename property_map<Graph, edge_index_t>::type EdgeIndexMap; typedef typename property_traits<EdgeIndexMap>::value_type edge_index_type; - BOOST_STATIC_ASSERT((!is_same<edge_index_type, + BOOST_STATIC_ASSERT((!is_same<edge_index_type, boost::detail::error_property_not_found>::value)); +private: + typedef std::vector<vertex_descriptor> GlobalVertexList; + typedef std::vector<edge_descriptor> GlobalEdgeList; + typedef std::map<vertex_descriptor, vertex_descriptor> LocalVertexMap; + typedef std::map<edge_index_type, edge_descriptor> LocalEdgeMap; + // TODO: Should the LocalVertexMap be: map<index_type, descriptor>? + // TODO: Can we relax the indexing requirement if both descriptors are + // LessThanComparable? + // TODO: Should we really be using unorderd_map for improved lookup times? + +public: // Probably shouldn't be public.... Graph m_graph; subgraph<Graph>* m_parent; edge_index_type m_edge_counter; // for generating unique edge indices ChildrenList m_children; - std::vector<vertex_descriptor> m_global_vertex; // local -> global - std::map<vertex_descriptor, vertex_descriptor> m_local_vertex; // global -> local - std::vector<edge_descriptor> m_global_edge; // local -> global - std::map<edge_index_type, edge_descriptor> m_local_edge; // global -> local - - edge_descriptor - local_add_edge(vertex_descriptor u_local, vertex_descriptor v_local, - edge_descriptor e_global) + GlobalVertexList m_global_vertex; // local -> global + LocalVertexMap m_local_vertex; // global -> local + GlobalEdgeList m_global_edge; // local -> global + LocalEdgeMap m_local_edge; // global -> local + + edge_descriptor local_add_edge(vertex_descriptor u_local, + vertex_descriptor v_local, + edge_descriptor e_global) { - edge_descriptor e_local; - bool inserted; - tie(e_local, inserted) = add_edge(u_local, v_local, m_graph); - put(edge_index, m_graph, e_local, m_edge_counter++); - m_global_edge.push_back(e_global); - m_local_edge[get(get(edge_index, this->root()), e_global)] = e_local; - return e_local; + edge_descriptor e_local; + bool inserted; + tie(e_local, inserted) = add_edge(u_local, v_local, m_graph); + put(edge_index, m_graph, e_local, m_edge_counter++); + m_global_edge.push_back(e_global); + m_local_edge[get(get(edge_index, this->root()), e_global)] = e_local; + return e_local; } - - }; +}; #ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES - template<typename Graph> - struct vertex_bundle_type<subgraph<Graph> > : vertex_bundle_type<Graph> { }; - - template<typename Graph> - struct edge_bundle_type<subgraph<Graph> > : edge_bundle_type<Graph> { }; +// TODO: I don't think these are required since the default metafunction +// returns Graph::vertex_bundled. +template <typename Graph> +struct vertex_bundle_type<subgraph<Graph> > + : vertex_bundle_type<Graph> +{ }; + +template<typename Graph> +struct edge_bundle_type<subgraph<Graph> > + : edge_bundle_type<Graph> +{ }; #endif // BOOST_GRAPH_NO_BUNDLED_PROPERTIES - //=========================================================================== - // Functions special to the Subgraph Class +//=========================================================================== +// Functions special to the Subgraph Class - template <typename G> - typename subgraph<G>::vertex_descriptor - add_vertex(typename subgraph<G>::vertex_descriptor u_global, - subgraph<G>& g) - { +template <typename G> +typename subgraph<G>::vertex_descriptor +add_vertex(typename subgraph<G>::vertex_descriptor u_global, + subgraph<G>& g) +{ assert(!g.is_root()); typename subgraph<G>::vertex_descriptor u_local, v_global, uu_global; typename subgraph<G>::edge_descriptor e_global; @@ -304,167 +357,163 @@ namespace boost { // remember edge global and local maps { - typename subgraph<G>::out_edge_iterator ei, ei_end; - for (tie(ei, ei_end) = out_edges(u_global, r); - ei != ei_end; ++ei) { - e_global = *ei; - v_global = target(e_global, r); - if (g.find_vertex(v_global).second == true) - g.local_add_edge(u_local, g.global_to_local(v_global), e_global); - } + typename subgraph<G>::out_edge_iterator ei, ei_end; + for (tie(ei, ei_end) = out_edges(u_global, r); + ei != ei_end; ++ei) { + e_global = *ei; + v_global = target(e_global, r); + if (g.find_vertex(v_global).second == true) + g.local_add_edge(u_local, g.global_to_local(v_global), e_global); + } } if (is_directed(g)) { // not necessary for undirected graph - typename subgraph<G>::vertex_iterator vi, vi_end; - typename subgraph<G>::out_edge_iterator ei, ei_end; - for (tie(vi, vi_end) = vertices(r); vi != vi_end; ++vi) { - v_global = *vi; - if (g.find_vertex(v_global).second) - for (tie(ei, ei_end) = out_edges(*vi, r); ei != ei_end; ++ei) { - e_global = *ei; - uu_global = target(e_global, r); - if (uu_global == u_global && g.find_vertex(v_global).second) - g.local_add_edge(g.global_to_local(v_global), u_local, e_global); - } - } + typename subgraph<G>::vertex_iterator vi, vi_end; + typename subgraph<G>::out_edge_iterator ei, ei_end; + for(tie(vi, vi_end) = vertices(r); vi != vi_end; ++vi) { + v_global = *vi; + if(g.find_vertex(v_global).second) + for(tie(ei, ei_end) = out_edges(*vi, r); ei != ei_end; ++ei) { + e_global = *ei; + uu_global = target(e_global, r); + if(uu_global == u_global && g.find_vertex(v_global).second) { + g.local_add_edge(g.global_to_local(v_global), u_local, e_global); + } + } + } } return u_local; - } - - //=========================================================================== - // Functions required by the IncidenceGraph concept - - template <typename G> - std::pair<typename graph_traits<G>::out_edge_iterator, - typename graph_traits<G>::out_edge_iterator> - out_edges(typename graph_traits<G>::vertex_descriptor u_local, - const subgraph<G>& g) - { return out_edges(u_local, g.m_graph); } - - template <typename G> - typename graph_traits<G>::degree_size_type - out_degree(typename graph_traits<G>::vertex_descriptor u_local, - const subgraph<G>& g) - { return out_degree(u_local, g.m_graph); } - - template <typename G> - typename graph_traits<G>::vertex_descriptor - source(typename graph_traits<G>::edge_descriptor e_local, - const subgraph<G>& g) - { return source(e_local, g.m_graph); } - - template <typename G> - typename graph_traits<G>::vertex_descriptor - target(typename graph_traits<G>::edge_descriptor e_local, - const subgraph<G>& g) - { return target(e_local, g.m_graph); } - - //=========================================================================== - // Functions required by the BidirectionalGraph concept - - template <typename G> - std::pair<typename graph_traits<G>::in_edge_iterator, - typename graph_traits<G>::in_edge_iterator> - in_edges(typename graph_traits<G>::vertex_descriptor u_local, - const subgraph<G>& g) - { return in_edges(u_local, g.m_graph); } - - template <typename G> - typename graph_traits<G>::degree_size_type - in_degree(typename graph_traits<G>::vertex_descriptor u_local, - const subgraph<G>& g) - { return in_degree(u_local, g.m_graph); } - - template <typename G> - typename graph_traits<G>::degree_size_type - degree(typename graph_traits<G>::vertex_descriptor u_local, - const subgraph<G>& g) - { return degree(u_local, g.m_graph); } - - //=========================================================================== - // Functions required by the AdjacencyGraph concept - - template <typename G> - std::pair<typename subgraph<G>::adjacency_iterator, - typename subgraph<G>::adjacency_iterator> - adjacent_vertices(typename subgraph<G>::vertex_descriptor u_local, - const subgraph<G>& g) - { return adjacent_vertices(u_local, g.m_graph); } - - //=========================================================================== - // Functions required by the VertexListGraph concept - - template <typename G> - std::pair<typename subgraph<G>::vertex_iterator, - typename subgraph<G>::vertex_iterator> - vertices(const subgraph<G>& g) - { return vertices(g.m_graph); } - - template <typename G> - typename subgraph<G>::vertices_size_type - num_vertices(const subgraph<G>& g) - { return num_vertices(g.m_graph); } - - //=========================================================================== - // Functions required by the EdgeListGraph concept - - template <typename G> - std::pair<typename subgraph<G>::edge_iterator, - typename subgraph<G>::edge_iterator> - edges(const subgraph<G>& g) - { return edges(g.m_graph); } - - template <typename G> - typename subgraph<G>::edges_size_type - num_edges(const subgraph<G>& g) - { return num_edges(g.m_graph); } - - //=========================================================================== - // Functions required by the AdjacencyMatrix concept - - template <typename G> - std::pair<typename subgraph<G>::edge_descriptor, bool> - edge(typename subgraph<G>::vertex_descriptor u_local, - typename subgraph<G>::vertex_descriptor v_local, - const subgraph<G>& g) - { - return edge(u_local, v_local, g.m_graph); - } - - //=========================================================================== - // Functions required by the MutableGraph concept - - namespace detail { +} + +// NOTE: Descriptors are local unless otherwise noted. + +//=========================================================================== +// Functions required by the IncidenceGraph concept + +template <typename G> +std::pair<typename graph_traits<G>::out_edge_iterator, + typename graph_traits<G>::out_edge_iterator> +out_edges(typename graph_traits<G>::vertex_descriptor v, const subgraph<G>& g) +{ return out_edges(v, g.m_graph); } + +template <typename G> +typename graph_traits<G>::degree_size_type +out_degree(typename graph_traits<G>::vertex_descriptor v, const subgraph<G>& g) +{ return out_degree(v, g.m_graph); } + +template <typename G> +typename graph_traits<G>::vertex_descriptor +source(typename graph_traits<G>::edge_descriptor e, const subgraph<G>& g) +{ return source(e, g.m_graph); } + +template <typename G> +typename graph_traits<G>::vertex_descriptor +target(typename graph_traits<G>::edge_descriptor e, const subgraph<G>& g) +{ return target(e, g.m_graph); } + +//=========================================================================== +// Functions required by the BidirectionalGraph concept + +template <typename G> +std::pair<typename graph_traits<G>::in_edge_iterator, + typename graph_traits<G>::in_edge_iterator> +in_edges(typename graph_traits<G>::vertex_descriptor v, const subgraph<G>& g) +{ return in_edges(v, g.m_graph); } + +template <typename G> +typename graph_traits<G>::degree_size_type +in_degree(typename graph_traits<G>::vertex_descriptor v, const subgraph<G>& g) +{ return in_degree(v, g.m_graph); } + +template <typename G> +typename graph_traits<G>::degree_size_type +degree(typename graph_traits<G>::vertex_descriptor v, const subgraph<G>& g) +{ return degree(v, g.m_graph); } + +//=========================================================================== +// Functions required by the AdjacencyGraph concept + +template <typename G> +std::pair<typename subgraph<G>::adjacency_iterator, + typename subgraph<G>::adjacency_iterator> +adjacent_vertices(typename subgraph<G>::vertex_descriptor v, const subgraph<G>& g) +{ return adjacent_vertices(v, g.m_graph); } + +//=========================================================================== +// Functions required by the VertexListGraph concept + +template <typename G> +std::pair<typename subgraph<G>::vertex_iterator, + typename subgraph<G>::vertex_iterator> +vertices(const subgraph<G>& g) +{ return vertices(g.m_graph); } + +template <typename G> +typename subgraph<G>::vertices_size_type +num_vertices(const subgraph<G>& g) +{ return num_vertices(g.m_graph); } + +//=========================================================================== +// Functions required by the EdgeListGraph concept + +template <typename G> +std::pair<typename subgraph<G>::edge_iterator, + typename subgraph<G>::edge_iterator> +edges(const subgraph<G>& g) +{ return edges(g.m_graph); } + +template <typename G> +typename subgraph<G>::edges_size_type +num_edges(const subgraph<G>& g) +{ return num_edges(g.m_graph); } + +//=========================================================================== +// Functions required by the AdjacencyMatrix concept + +template <typename G> +std::pair<typename subgraph<G>::edge_descriptor, bool> +edge(typename subgraph<G>::vertex_descriptor u, + typename subgraph<G>::vertex_descriptor v, + const subgraph<G>& g) +{ return edge(u, v, g.m_graph); } + +//=========================================================================== +// Functions required by the MutableGraph concept + +namespace detail { template <typename Vertex, typename Edge, typename Graph> - void add_edge_recur_down - (Vertex u_global, Vertex v_global, Edge e_global, subgraph<Graph>& g); + void add_edge_recur_down(Vertex u_global, Vertex v_global, Edge e_global, + subgraph<Graph>& g); template <typename Vertex, typename Edge, typename Children, typename G> void children_add_edge(Vertex u_global, Vertex v_global, Edge e_global, Children& c, subgraph<G>* orig) { - for (typename Children::iterator i = c.begin(); i != c.end(); ++i) - if ((*i)->find_vertex(u_global).second - && (*i)->find_vertex(v_global).second) - add_edge_recur_down(u_global, v_global, e_global, **i, orig); + for(typename Children::iterator i = c.begin(); i != c.end(); ++i) { + if ((*i)->find_vertex(u_global).second && + (*i)->find_vertex(v_global).second) + { + add_edge_recur_down(u_global, v_global, e_global, **i, orig); + } + } } template <typename Vertex, typename Edge, typename Graph> - void add_edge_recur_down - (Vertex u_global, Vertex v_global, Edge e_global, subgraph<Graph>& g, - subgraph<Graph>* orig) + void add_edge_recur_down(Vertex u_global, Vertex v_global, Edge e_global, + subgraph<Graph>& g, subgraph<Graph>* orig) { - if (&g != orig ) { - // add local edge only if u_global and v_global are in subgraph g - Vertex u_local, v_local; - bool u_in_subgraph, v_in_subgraph; - tie(u_local, u_in_subgraph) = g.find_vertex(u_global); - tie(v_local, v_in_subgraph) = g.find_vertex(v_global); - if (u_in_subgraph && v_in_subgraph) - g.local_add_edge(u_local, v_local, e_global); - } - children_add_edge(u_global, v_global, e_global, g.m_children, orig); + if(&g != orig ) { + // add local edge only if u_global and v_global are in subgraph g + Vertex u_local, v_local; + bool u_in_subgraph, v_in_subgraph; + tie(u_local, u_in_subgraph) = g.find_vertex(u_global); + tie(v_local, v_in_subgraph) = g.find_vertex(v_global); + if(u_in_subgraph && v_in_subgraph) { + g.local_add_edge(u_local, v_local, e_global); + } + } + children_add_edge(u_global, v_global, e_global, g.m_children, orig); } template <typename Vertex, typename Graph> @@ -473,58 +522,57 @@ namespace boost { const typename Graph::edge_property_type& ep, subgraph<Graph>& g, subgraph<Graph>* orig) { - if (g.is_root()) { - typename subgraph<Graph>::edge_descriptor e_global; - bool inserted; - tie(e_global, inserted) = add_edge(u_global, v_global, ep, g.m_graph); - put(edge_index, g.m_graph, e_global, g.m_edge_counter++); - g.m_global_edge.push_back(e_global); - children_add_edge(u_global, v_global, e_global, g.m_children, orig); - return std::make_pair(e_global, inserted); - } else - return add_edge_recur_up(u_global, v_global, ep, *g.m_parent, orig); + if(g.is_root()) { + typename subgraph<Graph>::edge_descriptor e_global; + bool inserted; + tie(e_global, inserted) = add_edge(u_global, v_global, ep, g.m_graph); + put(edge_index, g.m_graph, e_global, g.m_edge_counter++); + g.m_global_edge.push_back(e_global); + children_add_edge(u_global, v_global, e_global, g.m_children, orig); + return std::make_pair(e_global, inserted); + } else { + return add_edge_recur_up(u_global, v_global, ep, *g.m_parent, orig); + } } - } // namespace detail +} // namespace detail - // Add an edge to the subgraph g, specified by the local vertex - // descriptors u and v. In addition, the edge will be added to any - // other subgraphs which contain vertex descriptors u and v. +// Add an edge to the subgraph g, specified by the local vertex descriptors u +// and v. In addition, the edge will be added to any (all) other subgraphs that +// contain vertex descriptors u and v. - template <typename G> - std::pair<typename subgraph<G>::edge_descriptor, bool> - add_edge(typename subgraph<G>::vertex_descriptor u_local, - typename subgraph<G>::vertex_descriptor v_local, - const typename G::edge_property_type& ep, - subgraph<G>& g) - { - if (g.is_root()) // u_local and v_local are really global - return detail::add_edge_recur_up(u_local, v_local, ep, g, &g); - else { - typename subgraph<G>::edge_descriptor e_local, e_global; - bool inserted; - tie(e_global, inserted) = detail::add_edge_recur_up - (g.local_to_global(u_local), g.local_to_global(v_local), ep, g, &g); - e_local = g.local_add_edge(u_local, v_local, e_global); - return std::make_pair(e_local, inserted); +template <typename G> +std::pair<typename subgraph<G>::edge_descriptor, bool> +add_edge(typename subgraph<G>::vertex_descriptor u, + typename subgraph<G>::vertex_descriptor v, + const typename G::edge_property_type& ep, + subgraph<G>& g) +{ + if (g.is_root()) { + // u and v are really global + return detail::add_edge_recur_up(u, v, ep, g, &g); + } else { + typename subgraph<G>::edge_descriptor e_local, e_global; + bool inserted; + tie(e_global, inserted) = + detail::add_edge_recur_up(g.local_to_global(u), + g.local_to_global(v), + ep, g, &g); + e_local = g.local_add_edge(u, v, e_global); + return std::make_pair(e_local, inserted); } - } - - template <typename G> - std::pair<typename subgraph<G>::edge_descriptor, bool> - add_edge(typename subgraph<G>::vertex_descriptor u, - typename subgraph<G>::vertex_descriptor v, - subgraph<G>& g) - { - typename G::edge_property_type ep; - return add_edge(u, v, ep, g); - } +} - namespace detail { +template <typename G> +std::pair<typename subgraph<G>::edge_descriptor, bool> +add_edge(typename subgraph<G>::vertex_descriptor u, + typename subgraph<G>::vertex_descriptor v, + subgraph<G>& g) +{ return add_edge(u, v, typename G::edge_property_type(), g); } +namespace detail { //------------------------------------------------------------------------- // implementation of remove_edge(u,v,g) - template <typename Vertex, typename Graph> void remove_edge_recur_down(Vertex u_global, Vertex v_global, subgraph<Graph>& g); @@ -533,339 +581,642 @@ namespace boost { void children_remove_edge(Vertex u_global, Vertex v_global, Children& c) { - for (typename Children::iterator i = c.begin(); i != c.end(); ++i) - if ((*i)->find_vertex(u_global).second - && (*i)->find_vertex(v_global).second) - remove_edge_recur_down(u_global, v_global, **i); + for(typename Children::iterator i = c.begin(); i != c.end(); ++i) { + if((*i)->find_vertex(u_global).second && + (*i)->find_vertex(v_global).second) + { + remove_edge_recur_down(u_global, v_global, **i); + } + } } template <typename Vertex, typename Graph> void remove_edge_recur_down(Vertex u_global, Vertex v_global, subgraph<Graph>& g) { - Vertex u_local, v_local; - u_local = g.m_local_vertex[u_global]; - v_local = g.m_local_vertex[v_global]; - remove_edge(u_local, v_local, g.m_graph); - children_remove_edge(u_global, v_global, g.m_children); + Vertex u_local, v_local; + u_local = g.m_local_vertex[u_global]; + v_local = g.m_local_vertex[v_global]; + remove_edge(u_local, v_local, g.m_graph); + children_remove_edge(u_global, v_global, g.m_children); } template <typename Vertex, typename Graph> void remove_edge_recur_up(Vertex u_global, Vertex v_global, subgraph<Graph>& g) { - if (g.is_root()) { - remove_edge(u_global, v_global, g.m_graph); - children_remove_edge(u_global, v_global, g.m_children); - } else - remove_edge_recur_up(u_global, v_global, *g.m_parent); + if(g.is_root()) { + remove_edge(u_global, v_global, g.m_graph); + children_remove_edge(u_global, v_global, g.m_children); + } else { + remove_edge_recur_up(u_global, v_global, *g.m_parent); + } } //------------------------------------------------------------------------- // implementation of remove_edge(e,g) - template <typename Edge, typename Graph> void remove_edge_recur_down(Edge e_global, subgraph<Graph>& g); template <typename Edge, typename Children> void children_remove_edge(Edge e_global, Children& c) { - for (typename Children::iterator i = c.begin(); i != c.end(); ++i) - if ((*i)->find_vertex(source(e_global, **i)).second - && (*i)->find_vertex(target(e_global, **i)).second) - remove_edge_recur_down(source(e_global, **i), - target(e_global, **i), **i); + for(typename Children::iterator i = c.begin(); i != c.end(); ++i) { + if((*i)->find_vertex(source(e_global, **i)).second && + (*i)->find_vertex(target(e_global, **i)).second) + { + remove_edge_recur_down(source(e_global, **i), + target(e_global, **i), + **i); + } + } } template <typename Edge, typename Graph> void remove_edge_recur_down(Edge e_global, subgraph<Graph>& g) { - remove_edge(g.global_to_local(e_global), g.m_graph); - children_remove_edge(e_global, g.m_children); + remove_edge(g.global_to_local(e_global), g.m_graph); + children_remove_edge(e_global, g.m_children); } template <typename Edge, typename Graph> void remove_edge_recur_up(Edge e_global, subgraph<Graph>& g) { - if (g.is_root()) { - remove_edge(e_global, g.m_graph); - children_remove_edge(e_global, g.m_children); - } else - remove_edge_recur_up(e_global, *g.m_parent); + if (g.is_root()) { + remove_edge(e_global, g.m_graph); + children_remove_edge(e_global, g.m_children); + } else { + remove_edge_recur_up(e_global, *g.m_parent); + } } - } // namespace detail +} // namespace detail - template <typename G> - void - remove_edge(typename subgraph<G>::vertex_descriptor u_local, - typename subgraph<G>::vertex_descriptor v_local, - subgraph<G>& g) - { - if (g.is_root()) - detail::remove_edge_recur_up(u_local, v_local, g); - else - detail::remove_edge_recur_up(g.local_to_global(u_local), - g.local_to_global(v_local), g); - } - - template <typename G> - void - remove_edge(typename subgraph<G>::edge_descriptor e_local, - subgraph<G>& g) - { - if (g.is_root()) - detail::remove_edge_recur_up(e_local, g); - else - detail::remove_edge_recur_up(g.local_to_global(e_local), g); - } - - template <typename Predicate, typename G> - void - remove_edge_if(Predicate p, subgraph<G>& g) - { - // This is wrong... - remove_edge_if(p, g.m_graph); - } - - template <typename G> - void - clear_vertex(typename subgraph<G>::vertex_descriptor v_local, - subgraph<G>& g) - { - // this is wrong... - clear_vertex(v_local, g.m_graph); - } - - namespace detail { +template <typename G> +void +remove_edge(typename subgraph<G>::vertex_descriptor u, + typename subgraph<G>::vertex_descriptor v, + subgraph<G>& g) +{ + if(g.is_root()) { + detail::remove_edge_recur_up(u, v, g); + } else { + detail::remove_edge_recur_up(g.local_to_global(u), + g.local_to_global(v), g); + } +} + +template <typename G> +void +remove_edge(typename subgraph<G>::edge_descriptor e, subgraph<G>& g) +{ + if(g.is_root()) { + detail::remove_edge_recur_up(e, g); + } else { + detail::remove_edge_recur_up(g.local_to_global(e), g); + } +} + +// TODO: This is wrong... +template <typename Predicate, typename G> +void +remove_edge_if(Predicate p, subgraph<G>& g) +{ remove_edge_if(p, g.m_graph); } +// TODO: Ths is wrong +template <typename G> +void +clear_vertex(typename subgraph<G>::vertex_descriptor v, subgraph<G>& g) +{ clear_vertex(v, g.m_graph); } + +namespace detail { template <typename G> typename subgraph<G>::vertex_descriptor add_vertex_recur_up(subgraph<G>& g) { - typename subgraph<G>::vertex_descriptor u_local, u_global; - if (g.is_root()) { + typename subgraph<G>::vertex_descriptor u_local, u_global; + if (g.is_root()) { + u_global = add_vertex(g.m_graph); + g.m_global_vertex.push_back(u_global); + } else { + u_global = add_vertex_recur_up(*g.m_parent); + u_local = add_vertex(g.m_graph); + g.m_global_vertex.push_back(u_global); + g.m_local_vertex[u_global] = u_local; + } + return u_global; + } +} // namespace detail + +template <typename G> +typename subgraph<G>::vertex_descriptor +add_vertex(subgraph<G>& g) +{ + typename subgraph<G>::vertex_descriptor u_local, u_global; + if(g.is_root()) { u_global = add_vertex(g.m_graph); g.m_global_vertex.push_back(u_global); - } else { - u_global = add_vertex_recur_up(*g.m_parent); + u_local = u_global; + } else { + u_global = detail::add_vertex_recur_up(g.parent()); u_local = add_vertex(g.m_graph); g.m_global_vertex.push_back(u_global); g.m_local_vertex[u_global] = u_local; - } - return u_global; - } - - } // namespace detail - - template <typename G> - typename subgraph<G>::vertex_descriptor - add_vertex(subgraph<G>& g) - { - typename subgraph<G>::vertex_descriptor u_local, u_global; - if (g.is_root()) { - u_global = add_vertex(g.m_graph); - g.m_global_vertex.push_back(u_global); - u_local = u_global; - } else { - u_global = detail::add_vertex_recur_up(g.parent()); - u_local = add_vertex(g.m_graph); - g.m_global_vertex.push_back(u_global); - g.m_local_vertex[u_global] = u_local; } return u_local; - } +} - template <typename G> - void remove_vertex(typename subgraph<G>::vertex_descriptor u, - subgraph<G>& g) - { - // UNDER CONSTRUCTION - assert(false); - } +// TODO: Under Construction +template <typename G> +void remove_vertex(typename subgraph<G>::vertex_descriptor u, subgraph<G>& g) +{ assert(false); } - //=========================================================================== - // Functions required by the PropertyGraph concept +//=========================================================================== +// Functions required by the PropertyGraph concept - template <typename GraphPtr, typename PropertyMap, typename Tag> - class subgraph_global_property_map +/** + * The global property map returns the global properties associated with local + * descriptors. + */ +template <typename GraphPtr, typename PropertyMap, typename Tag> +class subgraph_global_property_map : public put_get_helper< typename property_traits<PropertyMap>::reference, - subgraph_global_property_map<GraphPtr, PropertyMap, Tag> > - { + subgraph_global_property_map<GraphPtr, PropertyMap, Tag> + > +{ typedef property_traits<PropertyMap> Traits; - public: +public: typedef typename Traits::category category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; - subgraph_global_property_map() { } + subgraph_global_property_map() + { } subgraph_global_property_map(GraphPtr g) - : m_g(g) { } - - inline reference operator[](key_type e_local) const { - PropertyMap pmap = get(Tag(), m_g->root().m_graph); - if (m_g->m_parent == 0) - return pmap[e_local]; - else - return pmap[m_g->local_to_global(e_local)]; + : m_g(g) + { } + + reference operator[](key_type e) const { + PropertyMap pmap = get(Tag(), m_g->root().m_graph); + return m_g->is_root() + ? pmap[e] + : pmap[m_g->local_to_global(e)]; } - GraphPtr m_g; - }; - template <typename GraphPtr, typename PropertyMap, typename Tag> - class subgraph_local_property_map + GraphPtr m_g; +}; + +/** + * The local property map returns the local property associated with the local + * descriptors. + */ +template <typename GraphPtr, typename PropertyMap, typename Tag> +class subgraph_local_property_map : public put_get_helper< typename property_traits<PropertyMap>::reference, - subgraph_local_property_map<GraphPtr, PropertyMap, Tag> > - { + subgraph_local_property_map<GraphPtr, PropertyMap, Tag> + > +{ typedef property_traits<PropertyMap> Traits; - public: +public: typedef typename Traits::category category; typedef typename Traits::value_type value_type; typedef typename Traits::key_type key_type; typedef typename Traits::reference reference; - subgraph_local_property_map() { } + typedef Tag tag; + typedef PropertyMap pmap; + + subgraph_local_property_map() + { } subgraph_local_property_map(GraphPtr g) - : m_g(g) { } + : m_g(g) + { } - inline reference operator[](key_type e_local) const { - PropertyMap pmap = get(Tag(), *m_g); - return pmap[e_local]; + reference operator[](key_type e) const { + // Get property map on the underlying graph. + PropertyMap pmap = get(Tag(), m_g->m_graph); + return pmap[e]; } + GraphPtr m_g; - }; - - namespace detail { - - struct subgraph_any_pmap { - template <class Tag, class SubGraph, class Property> - class bind_ { - typedef typename SubGraph::graph_type Graph; - typedef SubGraph* SubGraphPtr; - typedef const SubGraph* const_SubGraphPtr; - typedef typename property_map<Graph, Tag>::type PMap; - typedef typename property_map<Graph, Tag>::const_type const_PMap; - public: - typedef subgraph_global_property_map<SubGraphPtr, PMap, Tag> type; - typedef subgraph_global_property_map<const_SubGraphPtr, const_PMap, Tag> - const_type; - }; +}; + +namespace detail { + // Extract the actual tags from local or global property maps so we don't + // try to find non-properties. + template <typename P> struct extract_lg_tag { typedef P type; }; + template <typename P> struct extract_lg_tag< local_property<P> > { + typedef P type; + }; + template <typename P> struct extract_lg_tag< global_property<P> > { + typedef P type; }; - struct subgraph_id_pmap { - template <class Tag, class SubGraph, class Property> - struct bind_ { - typedef typename SubGraph::graph_type Graph; - typedef SubGraph* SubGraphPtr; - typedef const SubGraph* const_SubGraphPtr; - typedef typename property_map<Graph, Tag>::type PMap; - typedef typename property_map<Graph, Tag>::const_type const_PMap; - public: - typedef subgraph_local_property_map<SubGraphPtr, PMap, Tag> type; - typedef subgraph_local_property_map<const_SubGraphPtr, const_PMap, Tag> - const_type; - }; + + // NOTE: Mysterious Property template parameter unused in both metafunction + // classes. + struct subgraph_global_pmap { + template <class Tag, class SubGraph, class Property> + struct bind_ { + typedef typename SubGraph::graph_type Graph; + typedef SubGraph* SubGraphPtr; + typedef const SubGraph* const_SubGraphPtr; + typedef typename extract_lg_tag<Tag>::type TagType; + typedef typename property_map<Graph, TagType>::type PMap; + typedef typename property_map<Graph, TagType>::const_type const_PMap; + public: + typedef subgraph_global_property_map<SubGraphPtr, PMap, TagType> type; + typedef subgraph_global_property_map<const_SubGraphPtr, const_PMap, TagType> + const_type; + }; + }; + + struct subgraph_local_pmap { + template <class Tag, class SubGraph, class Property> + struct bind_ { + typedef typename SubGraph::graph_type Graph; + typedef SubGraph* SubGraphPtr; + typedef const SubGraph* const_SubGraphPtr; + typedef typename extract_lg_tag<Tag>::type TagType; + typedef typename property_map<Graph, TagType>::type PMap; + typedef typename property_map<Graph, TagType>::const_type const_PMap; + public: + typedef subgraph_local_property_map<SubGraphPtr, PMap, TagType> type; + typedef subgraph_local_property_map<const_SubGraphPtr, const_PMap, TagType> + const_type; + }; }; + + // These metafunctions select the corresponding metafunctions above, and + // are used by the choose_pmap metafunction below to specialize the choice + // of local/global property map. By default, we defer to the global + // property. template <class Tag> struct subgraph_choose_pmap_helper { - typedef subgraph_any_pmap type; + typedef subgraph_global_pmap type; }; + template <class Tag> + struct subgraph_choose_pmap_helper< local_property<Tag> > { + typedef subgraph_local_pmap type; + }; + template <class Tag> + struct subgraph_choose_pmap_helper< global_property<Tag> > { + typedef subgraph_global_pmap type; + }; + + // As above, unless we're requesting vertex_index_t. Then it's always a + // local property map. This enables the correct translation of descriptors + // between local and global layers. template <> struct subgraph_choose_pmap_helper<vertex_index_t> { - typedef subgraph_id_pmap type; + typedef subgraph_local_pmap type; + }; + template <> + struct subgraph_choose_pmap_helper< local_property<vertex_index_t> > { + typedef subgraph_local_pmap type; }; + template <> + struct subgraph_choose_pmap_helper< global_property<vertex_index_t> > { + typedef subgraph_local_pmap type; + }; + + // Determine the kind of property. If SameType<Tag, vertex_index_t>, then + // the property lookup is always local. Otherwise, the lookup is global. + // NOTE: Property parameter is basically unused. template <class Tag, class Graph, class Property> struct subgraph_choose_pmap { - typedef typename subgraph_choose_pmap_helper<Tag>::type Helper; - typedef typename Helper::template bind_<Tag, Graph, Property> Bind; - typedef typename Bind::type type; - typedef typename Bind::const_type const_type; + typedef typename subgraph_choose_pmap_helper<Tag>::type Helper; + typedef typename Helper::template bind_<Tag, Graph, Property> Bind; + typedef typename Bind::type type; + typedef typename Bind::const_type const_type; }; + + // Used by the vertex/edge property selectors to determine the kind(s) of + // property maps used by the property_map type generator. struct subgraph_property_generator { - template <class SubGraph, class Property, class Tag> - struct bind_ { - typedef subgraph_choose_pmap<Tag, SubGraph, Property> Choice; - typedef typename Choice::type type; - typedef typename Choice::const_type const_type; - }; + template <class SubGraph, class Property, class Tag> + struct bind_ { + typedef subgraph_choose_pmap<Tag, SubGraph, Property> Choice; + typedef typename Choice::type type; + typedef typename Choice::const_type const_type; + }; }; } // namespace detail - template <> - struct vertex_property_selector<subgraph_tag> { +template <> +struct vertex_property_selector<subgraph_tag> { typedef detail::subgraph_property_generator type; - }; +}; - template <> - struct edge_property_selector<subgraph_tag> { +template <> +struct edge_property_selector<subgraph_tag> { typedef detail::subgraph_property_generator type; - }; +}; + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES +/** @internal + * This property map implements local or global bundled property access on + * an underlying graph. The LocalGlobal template template parameter must be + * one of the local_property or global_property templates. + */ +template < + typename Graph, typename Descriptor, typename Bundle, typename T, + template <typename> class LocalGlobal> +struct subgraph_lg_bundle_property_map + : put_get_helper< + T&, + subgraph_lg_bundle_property_map<Graph, Descriptor, Bundle, T, LocalGlobal> + > +{ +private: + typedef LocalGlobal<Descriptor> Wrap; +public: + typedef Descriptor key_type; + typedef typename remove_const<T>::type value_type; + typedef T& reference; + typedef lvalue_property_map_tag category; + + subgraph_lg_bundle_property_map() + { } - template <typename G, typename Property> - typename property_map< subgraph<G>, Property>::type - get(Property, subgraph<G>& g) - { + subgraph_lg_bundle_property_map(Graph* g, T Bundle::* p) + : m_g(g), m_prop(p) + { } + + reference operator[](key_type k) const + { return (*m_g)[Wrap(k)].*m_prop; } + +private: + Graph* m_g; + T Bundle::* m_prop; +}; + +// Specialize the property map template to generate bundled property maps. +// NOTE: I'm cheating (actually double-dipping) with the local/global subgraph +// property templates. I'm not using them store descriptors, just specialize +// the property map template for specific lookups. +namespace graph_detail { + // Help decoding some of the types required for property map definitions. + template <typename Graph, typename T, typename Bundle> + struct bundled_subgraph_pmap_helper { + typedef subgraph<Graph> Subgraph; + typedef graph_traits<Subgraph> Traits; + typedef typename Subgraph::vertex_bundled VertBundled; + typedef typename Subgraph::edge_bundled EdgeBundled; + + // Deduce the descriptor from the template params + typedef typename mpl::if_< + detail::is_vertex_bundle<VertBundled, EdgeBundled, Bundle>, + typename Traits::vertex_descriptor, typename Traits::edge_descriptor + >::type Desc; + + // Deduce the bundled property type + typedef typename mpl::if_< + detail::is_vertex_bundle<VertBundled, EdgeBundled, Bundle>, + VertBundled, EdgeBundled + >::type Prop; + }; +} // namespace graph_detail + +template <typename Graph, typename T, typename Bundle> +struct property_map<subgraph<Graph>, local_property<T Bundle::*> > + : graph_detail::bundled_subgraph_pmap_helper<Graph, T, Bundle> +{ +private: + typedef graph_detail::bundled_subgraph_pmap_helper<Graph, T, Bundle> Base; + typedef typename Base::Subgraph Subgraph; + typedef typename Base::Desc Desc; + typedef typename Base::Prop Prop; +public: + typedef subgraph_lg_bundle_property_map< + Subgraph, Desc, Prop, T, local_property + > type; + typedef subgraph_lg_bundle_property_map< + Subgraph const, Desc, Prop, T const, local_property + > const_type; +}; + +template <typename Graph, typename T, typename Bundle> +struct property_map<subgraph<Graph>, global_property<T Bundle::*> > + : graph_detail::bundled_subgraph_pmap_helper<Graph, T, Bundle> +{ +private: + typedef graph_detail::bundled_subgraph_pmap_helper<Graph, T, Bundle> Base; + typedef typename Base::Subgraph Subgraph; + typedef typename Base::Desc Desc; + typedef typename Base::Prop Prop; +public: + typedef subgraph_lg_bundle_property_map< + Subgraph, Desc, Prop, T, global_property + > type; + typedef subgraph_lg_bundle_property_map< + Subgraph const, Desc, Prop, T const, global_property + > const_type; +}; +#endif + +// ================================================== +// get(p, g), get(p, g, k), and put(p, g, k, v) +// ================================================== +template <typename G, typename Property> +typename property_map<subgraph<G>, Property>::type +get(Property, subgraph<G>& g) { typedef typename property_map< subgraph<G>, Property>::type PMap; return PMap(&g); - } +} - template <typename G, typename Property> - typename property_map< subgraph<G>, Property>::const_type - get(Property, const subgraph<G>& g) - { +template <typename G, typename Property> +typename property_map<subgraph<G>, Property>::const_type +get(Property, const subgraph<G>& g) { typedef typename property_map< subgraph<G>, Property>::const_type PMap; return PMap(&g); - } - - template <typename G, typename Property, typename Key> - typename property_traits< - typename property_map< subgraph<G>, Property>::const_type - >::value_type - get(Property, const subgraph<G>& g, const Key& k) - { +} + +template <typename G, typename Property, typename Key> +typename property_traits< + typename property_map<subgraph<G>, Property>::const_type +>::value_type +get(Property, const subgraph<G>& g, const Key& k) { typedef typename property_map< subgraph<G>, Property>::const_type PMap; PMap pmap(&g); return pmap[k]; - } +} - template <typename G, typename Property, typename Key, typename Value> - void - put(Property, subgraph<G>& g, const Key& k, const Value& val) - { +template <typename G, typename Property, typename Key, typename Value> +void put(Property, subgraph<G>& g, const Key& k, const Value& val) { typedef typename property_map< subgraph<G>, Property>::type PMap; PMap pmap(&g); pmap[k] = val; - } +} + +// ================================================== +// get(global(p), g) +// NOTE: get(global(p), g, k) and put(global(p), g, k, v) not supported +// ================================================== +template <typename G, typename Property> +typename property_map<subgraph<G>, global_property<Property> >::type +get(global_property<Property>, subgraph<G>& g) { + typedef typename property_map< + subgraph<G>, global_property<Property> + >::type Map; + return Map(&g); +} + +template <typename G, typename Property> +typename property_map<subgraph<G>, global_property<Property> >::const_type +get(global_property<Property>, const subgraph<G>& g) { + typedef typename property_map< + subgraph<G>, global_property<Property> + >::const_type Map; + return Map(&g); +} + +// ================================================== +// get(local(p), g) +// NOTE: get(local(p), g, k) and put(local(p), g, k, v) not supported +// ================================================== +template <typename G, typename Property> +typename property_map<subgraph<G>, local_property<Property> >::type +get(local_property<Property>, subgraph<G>& g) { + typedef typename property_map< + subgraph<G>, local_property<Property> + >::type Map; + return Map(&g); +} + +template <typename G, typename Property> +typename property_map<subgraph<G>, local_property<Property> >::const_type +get(local_property<Property>, const subgraph<G>& g) { + typedef typename property_map< + subgraph<G>, local_property<Property> + >::const_type Map; + return Map(&g); +} - template <typename G, typename Tag> - inline - typename graph_property<G, Tag>::type& - get_property(subgraph<G>& g, Tag tag) { +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES +// ================================================== +// get(bundle(p), g) +// ================================================== + +template<typename G, typename T, typename Bundle> +inline typename property_map<subgraph<G>, T Bundle::*>::type +get(T Bundle::* p, subgraph<G>& g) { + typedef typename property_map<subgraph<G>, T Bundle::*>::type Map; + return Map(&g, p); +} + +template<typename G, typename T, typename Bundle> +inline typename property_map<subgraph<G>, T Bundle::*>::const_type +get(T Bundle::* p, subgraph<G> const& g) { + typedef typename property_map<subgraph<G>, T Bundle::*>::const_type Map; + return Map(&g, p); +} + +template <typename Graph, typename Type, typename Bundle, typename Key> +inline Type get(Type Bundle::* p, subgraph<Graph> const& g, Key const& k) +{ return get(get(p, g), k); } + +template <typename Graph, typename Type, typename Bundle, typename Key, + typename Value> +inline void put(Type Bundle::* p, Graph& g, Key const& k, Value const& v) +{ put(get(p, g), k, v); } + +// ========================================================= +// Local bundled, get + +template<typename G, typename T, typename Bundle> +inline typename property_map< + subgraph<G>, local_property<T Bundle::*> +>::type +get(local_property<T Bundle::*> p, subgraph<G>& g) { + typedef typename property_map< + subgraph<G>, local_property<T Bundle::*> + >::type Map; + return Map(&g, p.value); +} + +template<typename G, typename T, typename Bundle> +inline typename property_map< + subgraph<G>, local_property<T Bundle::*> +>::const_type +get(local_property<T Bundle::*> p, subgraph<G> const& g) { + typedef typename property_map< + subgraph<G>, local_property<T Bundle::*> + >::const_type Map; + return Map(&g, p.value); +} + +template <typename Graph, typename Type, typename Bundle, typename Key> +inline Type get(local_property<Type Bundle::*> p, subgraph<Graph> const& g, + Key const& k) +{ return get(get(p, g), k); } + +// ========================================================= +// Global bundled, get + +template<typename G, typename T, typename Bundle> +inline typename property_map< + subgraph<G>, global_property<T Bundle::*> +>::type +get(global_property<T Bundle::*> p, subgraph<G>& g) { + typedef typename property_map< + subgraph<G>, global_property<T Bundle::*> + >::type Map; + return Map(&g, p.value); +} + +template<typename G, typename T, typename Bundle> +inline typename property_map< + subgraph<G>, global_property<T Bundle::*> +>::const_type +get(global_property<T Bundle::*> p, subgraph<G> const& g) { + typedef typename property_map< + subgraph<G>, global_property<T Bundle::*> + >::const_type Map; + return Map(&g, p.value); +} + +template <typename Graph, typename Type, typename Bundle, typename Key> +inline Type get(global_property<Type Bundle::*> p, subgraph<Graph> const& g, + Key const& k) +{ return get(get(p, g), k); } + +#endif + +template <typename G, typename Tag> +inline typename graph_property<G, Tag>::type& +get_property(subgraph<G>& g, Tag tag) { return get_property(g.m_graph, tag); - } +} - template <typename G, typename Tag> - inline - const typename graph_property<G, Tag>::type& - get_property(const subgraph<G>& g, Tag tag) { +template <typename G, typename Tag> +inline const typename graph_property<G, Tag>::type& +get_property(const subgraph<G>& g, Tag tag) { return get_property(g.m_graph, tag); - } - - //=========================================================================== - // Miscellaneous Functions - - template <typename G> - typename subgraph<G>::vertex_descriptor - vertex(typename subgraph<G>::vertices_size_type n, const subgraph<G>& g) - { - return vertex(n, g.m_graph); - } +} + +//=========================================================================== +// Miscellaneous Functions + +template <typename G> +typename subgraph<G>::vertex_descriptor +vertex(typename subgraph<G>::vertices_size_type n, const subgraph<G>& g) +{ return vertex(n, g.m_graph); } + +//=========================================================================== +// Mutability Traits +// Just pull the mutability traits form the underlying graph. Note that this +// will probably fail (badly) for labeled graphs. +template <typename G> +struct graph_mutability_traits< subgraph<G> > { + typedef typename graph_mutability_traits<G>::category category; +}; } // namespace boost diff --git a/Utilities/BGL/boost/graph/test/Jamfile b/Utilities/BGL/boost/graph/test/Jamfile deleted file mode 100644 index a6584760abdc82d166f5bf232fe740acacd2269f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/Jamfile +++ /dev/null @@ -1,104 +0,0 @@ -# Define SGB (stanford graph base top level directory) and -# LEDA (also top level directory) at the command line of jam using -s - - -subproject libs/graph/test ; - -import testing ; - -test-suite graph : - - [ run transitive_closure_test.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ compile adj_list_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - # adj_list_test needs some work -JGS - # unit-test adj_list_test : adj_list_test.cpp : <sysinclude>$(BOOST_ROOT) ; - [ compile adj_matrix_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ run bfs.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ compile bfs_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ run bellman-test.cpp : <sysinclude>$(BOOST_ROOT ] - - [ run betweenness_centrality_test.cpp ] - - [ run dag_longest_paths.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ run dfs.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ compile dfs_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ compile dijkstra_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ run dijkstra_heap_performance.cpp : 10000 : : <sysinclude>$(BOOST_ROOT) ] - - [ run relaxed_heap_test.cpp : 5000 15000 : : <sysinclude>$(BOOST_ROOT) ] - [ compile edge_list_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ compile filtered_graph_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ run graph.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ compile graph_concepts.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ run graphviz_test.cpp - <lib>../../test/build/boost_test_exec_monitor - <lib>../build/bgl-viz - : : : <sysinclude>$(BOOST_ROOT) ] - - [ run gursoy_atun_layout_test.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ run layout_test.cpp : : : <test-info>always_show_run_output ] - - [ compile reverse_graph_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ run sequential_vertex_coloring.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ run subgraph.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ run isomorphism.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ run adjacency_matrix_test.cpp : : : <sysinclude>$(BOOST_ROOT) ] - - [ compile vector_graph_cc.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ compile copy.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ compile property_iter.cpp : <sysinclude>$(BOOST_ROOT) ] - - [ run bundled_properties.cpp ] - - [ run floyd_warshall_test.cpp ] - - [ run astar_search_test.cpp ] - - [ run biconnected_components_test.cpp ] - - [ run cuthill_mckee_ordering.cpp ] - - [ run king_ordering.cpp ] - ; - -# Run SDB tests only when -sSDB= is set. -if $(SDB) != "" -{ - local SDB_DEPENDCIES = - <include>$(SGB) <library-file>$(SGB)/libgb.a ; - - compile stanford_graph_cc.cpp : <sysinclude>$(BOOST_ROOT) - $(SDB_DEPENDCIES) ; -} - -# Run LEDA tests only when -sLEDA= is set. -if $(LEDA) != "" -{ - local LEDA_DEPENDENCIES = - <include>$(LEDA)/incl - <library-file>$(LEDA)/libG.a - ; - - compile leda_graph_cc.cpp : <sysinclude>$(BOOST_ROOT) - $(LEDA_DEPENDENCIES) ; -} diff --git a/Utilities/BGL/boost/graph/test/Jamfile.v2 b/Utilities/BGL/boost/graph/test/Jamfile.v2 deleted file mode 100644 index 7e46a3937b9ed38c9ca159e8e2a602ea6f4d2220..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/Jamfile.v2 +++ /dev/null @@ -1,71 +0,0 @@ -# Define SGB (stanford graph base top level directory) and -# LEDA (also top level directory) at the command line of jam using -s - -import modules ; - -test-suite graph_test : - - [ run transitive_closure_test.cpp ] - - [ compile adj_list_cc.cpp ] - - # adj_list_test needs some work -JGS - # unit-test adj_list_test : adj_list_test.cpp ; - [ compile adj_matrix_cc.cpp ] - - [ run bfs.cpp ../../test/build//boost_test_exec_monitor ] - - [ compile bfs_cc.cpp ] - - [ run dfs.cpp ../../test/build//boost_test_exec_monitor ] - - [ compile dfs_cc.cpp ] - - [ compile dijkstra_cc.cpp ] - - [ compile edge_list_cc.cpp ] - - [ compile filtered_graph_cc.cpp ] - - [ run graph.cpp ] - - [ compile graph_concepts.cpp ] - - [ compile reverse_graph_cc.cpp ] - - [ run subgraph.cpp ../../test/build//boost_test_exec_monitor ] - - [ run isomorphism.cpp ../../test/build//boost_test_exec_monitor ] - - [ run adjacency_matrix_test.cpp ] - - [ compile vector_graph_cc.cpp ] - - [ compile copy.cpp ] - - [ compile property_iter.cpp ] - - [ run bundled_properties.cpp ] - ; - -# Run SDB tests only when -sSDB= is set. -if [ modules.peek : SDB ] != "" -{ - local SDB_DEPENDCIES = - <include>$(SGB) <library-file>$(SGB)/libgb.a ; - - compile stanford_graph_cc.cpp - $(SDB_DEPENDCIES) ; -} - -# Run LEDA tests only when -sLEDA= is set. -if [ modules.peek : LEDA ] != "" -{ - local LEDA_DEPENDENCIES = - <include>$(LEDA)/incl - <library-file>$(LEDA)/libG.a - ; - - compile leda_graph_cc.cpp - $(LEDA_DEPENDENCIES) ; -} diff --git a/Utilities/BGL/boost/graph/test/adj_list_cc.cpp b/Utilities/BGL/boost/graph/test/adj_list_cc.cpp deleted file mode 100644 index 8f22d5735f836fb4dd6a481e862e593c1af04b06..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/adj_list_cc.cpp +++ /dev/null @@ -1,260 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/adjacency_list.hpp> - -int main(int,char*[]) -{ - using namespace boost; - // Check adjacency_list with properties - { - typedef adjacency_list<vecS, vecS, directedS, - property<vertex_color_t, int>, - property<edge_weight_t, int> - > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableIncidenceGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - { - typedef adjacency_list<vecS, vecS, bidirectionalS, - property<vertex_color_t, int>, - property<edge_weight_t, int> - > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< BidirectionalGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - { - typedef adjacency_list< listS, listS, directedS, - property<vertex_color_t, int>, - property<edge_weight_t, int> - > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableIncidenceGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - { - typedef adjacency_list< listS, listS, undirectedS, - property<vertex_color_t, int>, - property<edge_weight_t, int> - > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - // Checking adjacency_list with EdgeList=setS - { - typedef adjacency_list<setS, vecS, bidirectionalS, - property<vertex_color_t, int>, - property<edge_weight_t, int> - > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< BidirectionalGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - { - typedef adjacency_list< setS, listS, directedS, - property<vertex_color_t, int>, - property<edge_weight_t, int> - > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableIncidenceGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - { - typedef adjacency_list< setS, listS, undirectedS, - property<vertex_color_t, int>, - property<edge_weight_t, int> - > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - // Check adjacency_list without any properties - { - typedef adjacency_list<vecS, vecS, directedS > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableIncidenceGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - } - { - typedef adjacency_list<vecS, vecS, bidirectionalS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< BidirectionalGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - } - { - typedef adjacency_list< listS, listS, directedS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableIncidenceGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - } - { - typedef adjacency_list< listS, listS, undirectedS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - } - // Checking EdgeList=setS with no properties - { - typedef adjacency_list<setS, vecS, bidirectionalS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< BidirectionalGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - function_requires< ReadablePropertyGraphConcept<Graph, - Vertex, vertex_index_t> >(); - } - { - typedef adjacency_list< setS, listS, directedS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< MutableIncidenceGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - } - { - typedef adjacency_list< setS, listS, undirectedS> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableBidirectionalGraphConcept<Graph> >(); - function_requires< MutableEdgeListGraphConcept<Graph> >(); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/adj_list_test.cpp b/Utilities/BGL/boost/graph/test/adj_list_test.cpp deleted file mode 100644 index 401e8a13a4e60d48a6696b616d108fd74a33eed5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/adj_list_test.cpp +++ /dev/null @@ -1,77 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <iostream> -#include <fstream> -#include <string> -#include <cstdlib> - -// This is meant to be executed from the current directory - -std::string container_types [] = { "vecS", "listS", "setS" }; -const int N = sizeof(container_types)/sizeof(std::string); - -std::string directed_types[] = { "bidirectionalS", "directedS", "undirectedS"}; -const int D = sizeof(directed_types)/sizeof(std::string); - -int -main() -{ - int i, j, k, ret = 0, rc, t = 0; - for (i = 0; i < N; ++i) - for (j = 0; j < N; ++j) - for (k = 0; k < D; ++k, ++t) { - - std::string file_name = "graph_type.hpp"; - system("rm -f graph_type.hpp"); - std::ofstream header(file_name.c_str()); - if (!header) { - std::cerr << "could not open file " << file_name << std::endl; - return -1; - } - - header << "#include <boost/graph/adjacency_list.hpp>" << std::endl - << "typedef boost::adjacency_list<boost::" << container_types[i] - << ", boost::" << container_types[j] - << ", boost::" << directed_types[k] - << ", boost::property<vertex_id_t, std::size_t>" - << ", boost::property<edge_id_t, std::size_t> > Graph;" - << std::endl - << "typedef boost::property<vertex_id_t, std::size_t> VertexId;" - << std::endl - << "typedef boost::property<edge_id_t, std::size_t> EdgeID;" - << std::endl; - system("rm -f graph.exe graph.o graph.obj"); - // the following system call should be replaced by a - // portable "compile" command. - //const char* compile = "g++ -I.. -O2 -Wall -Wno-long-long -ftemplate-depth-30 ../libs/graph/test/graph.cpp -o graph.exe"; - const char* compile = "g++ -I/u/jsiek/boost graph.cpp -o graph.exe"; - std::cout << compile << std::endl; - rc = system(compile); - if (rc != 0) { - std::cerr << "compile failed for " << container_types[i] << " " - << container_types[j] << " " << directed_types[k] - << std::endl; - ret = -1; - } else { - rc = system("./graph.exe"); - if (rc != 0) { - std::cerr << "run failed for " << container_types[i] << " " - << container_types[j] << " " << directed_types[k] - << std::endl; - ret = -1; - } else { - std::cout << (t+1) << " of " << (N*N*D) << " tests passed." - << std::endl; - } - } - } - - return ret; -} diff --git a/Utilities/BGL/boost/graph/test/adj_matrix_cc.cpp b/Utilities/BGL/boost/graph/test/adj_matrix_cc.cpp deleted file mode 100644 index 317a22f4a3e4c97603f47035204c5f9a48ba644f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/adj_matrix_cc.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/adjacency_matrix.hpp> - -int main(int,char*[]) -{ - using namespace boost; - // Check adjacency_matrix without properties - { - typedef adjacency_matrix<directedS> Graph; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableGraphConcept<Graph> >(); - function_requires< AdjacencyMatrixConcept<Graph> >(); - } - { - typedef adjacency_matrix<undirectedS> Graph; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< MutableGraphConcept<Graph> >(); - function_requires< AdjacencyMatrixConcept<Graph> >(); - } - // Check adjacency_matrix with properties - { - typedef adjacency_matrix<directedS, - property<vertex_color_t, int>, - property<edge_weight_t, float> > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< AdjacencyMatrixConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< ReadablePropertyGraphConcept<Graph, - Vertex, vertex_index_t> >(); - function_requires< PropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< PropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - { - typedef adjacency_matrix<undirectedS, - property<vertex_color_t, int>, - property<edge_weight_t, float> > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< EdgeListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< AdjacencyMatrixConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< ReadablePropertyGraphConcept<Graph, - Vertex, vertex_index_t> >(); - function_requires< PropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< PropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/adjacency_matrix_test.cpp b/Utilities/BGL/boost/graph/test/adjacency_matrix_test.cpp deleted file mode 100644 index f3796249f1fd6337e70c21c1d43541b5dc24558b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/adjacency_matrix_test.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* adjacency_matrix_test.cpp source file - * - * Copyright Cromwell D. Enage 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) - */ - -/* - * Defines the std::ios class and std::cout, its global output instance. - */ -#include <iostream> - -/* - * Defines the boost::property_map class template and the boost::get and - * boost::put function templates. - */ -#include <boost/property_map.hpp> - -/* - * Defines the boost::graph_traits class template. - */ -#include <boost/graph/graph_traits.hpp> - -/* - * Defines the vertex and edge property tags. - */ -#include <boost/graph/properties.hpp> - -/* - * Defines the boost::adjacency_list class template and its associated - * non-member function templates. - */ -#include <boost/graph/adjacency_list.hpp> - -/* - * Defines the boost::adjacency_matrix class template and its associated - * non-member function templates. - */ -#include <boost/graph/adjacency_matrix.hpp> - -#include <boost/test/minimal.hpp> - -int test_main(int, char*[]) -{ - // Use setS to keep out edges in order, so they match the adjacency_matrix. - typedef boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS> - Graph1; - typedef boost::adjacency_matrix<boost::undirectedS> - Graph2; - typedef boost::property_map<Graph1, boost::vertex_index_t>::type - IndexMap1; - typedef boost::property_map<Graph2, boost::vertex_index_t>::type - IndexMap2; - - Graph1 g1(24); - Graph2 g2(24); - - boost::add_edge(boost::vertex(0, g1), boost::vertex(7, g1), g1); - boost::add_edge(boost::vertex(0, g2), boost::vertex(7, g2), g2); - boost::add_edge(boost::vertex(1, g1), boost::vertex(2, g1), g1); - boost::add_edge(boost::vertex(1, g2), boost::vertex(2, g2), g2); - boost::add_edge(boost::vertex(2, g1), boost::vertex(10, g1), g1); - boost::add_edge(boost::vertex(2, g2), boost::vertex(10, g2), g2); - boost::add_edge(boost::vertex(2, g1), boost::vertex(5, g1), g1); - boost::add_edge(boost::vertex(2, g2), boost::vertex(5, g2), g2); - boost::add_edge(boost::vertex(3, g1), boost::vertex(10, g1), g1); - boost::add_edge(boost::vertex(3, g2), boost::vertex(10, g2), g2); - boost::add_edge(boost::vertex(3, g1), boost::vertex(0, g1), g1); - boost::add_edge(boost::vertex(3, g2), boost::vertex(0, g2), g2); - boost::add_edge(boost::vertex(4, g1), boost::vertex(5, g1), g1); - boost::add_edge(boost::vertex(4, g2), boost::vertex(5, g2), g2); - boost::add_edge(boost::vertex(4, g1), boost::vertex(0, g1), g1); - boost::add_edge(boost::vertex(4, g2), boost::vertex(0, g2), g2); - boost::add_edge(boost::vertex(5, g1), boost::vertex(14, g1), g1); - boost::add_edge(boost::vertex(5, g2), boost::vertex(14, g2), g2); - boost::add_edge(boost::vertex(6, g1), boost::vertex(3, g1), g1); - boost::add_edge(boost::vertex(6, g2), boost::vertex(3, g2), g2); - boost::add_edge(boost::vertex(7, g1), boost::vertex(17, g1), g1); - boost::add_edge(boost::vertex(7, g2), boost::vertex(17, g2), g2); - boost::add_edge(boost::vertex(7, g1), boost::vertex(11, g1), g1); - boost::add_edge(boost::vertex(7, g2), boost::vertex(11, g2), g2); - boost::add_edge(boost::vertex(8, g1), boost::vertex(17, g1), g1); - boost::add_edge(boost::vertex(8, g2), boost::vertex(17, g2), g2); - boost::add_edge(boost::vertex(8, g1), boost::vertex(1, g1), g1); - boost::add_edge(boost::vertex(8, g2), boost::vertex(1, g2), g2); - boost::add_edge(boost::vertex(9, g1), boost::vertex(11, g1), g1); - boost::add_edge(boost::vertex(9, g2), boost::vertex(11, g2), g2); - boost::add_edge(boost::vertex(9, g1), boost::vertex(1, g1), g1); - boost::add_edge(boost::vertex(9, g2), boost::vertex(1, g2), g2); - boost::add_edge(boost::vertex(10, g1), boost::vertex(19, g1), g1); - boost::add_edge(boost::vertex(10, g2), boost::vertex(19, g2), g2); - boost::add_edge(boost::vertex(10, g1), boost::vertex(15, g1), g1); - boost::add_edge(boost::vertex(10, g2), boost::vertex(15, g2), g2); - boost::add_edge(boost::vertex(10, g1), boost::vertex(8, g1), g1); - boost::add_edge(boost::vertex(10, g2), boost::vertex(8, g2), g2); - boost::add_edge(boost::vertex(11, g1), boost::vertex(19, g1), g1); - boost::add_edge(boost::vertex(11, g2), boost::vertex(19, g2), g2); - boost::add_edge(boost::vertex(11, g1), boost::vertex(15, g1), g1); - boost::add_edge(boost::vertex(11, g2), boost::vertex(15, g2), g2); - boost::add_edge(boost::vertex(11, g1), boost::vertex(4, g1), g1); - boost::add_edge(boost::vertex(11, g2), boost::vertex(4, g2), g2); - boost::add_edge(boost::vertex(12, g1), boost::vertex(19, g1), g1); - boost::add_edge(boost::vertex(12, g2), boost::vertex(19, g2), g2); - boost::add_edge(boost::vertex(12, g1), boost::vertex(8, g1), g1); - boost::add_edge(boost::vertex(12, g2), boost::vertex(8, g2), g2); - boost::add_edge(boost::vertex(12, g1), boost::vertex(4, g1), g1); - boost::add_edge(boost::vertex(12, g2), boost::vertex(4, g2), g2); - boost::add_edge(boost::vertex(13, g1), boost::vertex(15, g1), g1); - boost::add_edge(boost::vertex(13, g2), boost::vertex(15, g2), g2); - boost::add_edge(boost::vertex(13, g1), boost::vertex(8, g1), g1); - boost::add_edge(boost::vertex(13, g2), boost::vertex(8, g2), g2); - boost::add_edge(boost::vertex(13, g1), boost::vertex(4, g1), g1); - boost::add_edge(boost::vertex(13, g2), boost::vertex(4, g2), g2); - boost::add_edge(boost::vertex(14, g1), boost::vertex(22, g1), g1); - boost::add_edge(boost::vertex(14, g2), boost::vertex(22, g2), g2); - boost::add_edge(boost::vertex(14, g1), boost::vertex(12, g1), g1); - boost::add_edge(boost::vertex(14, g2), boost::vertex(12, g2), g2); - boost::add_edge(boost::vertex(15, g1), boost::vertex(22, g1), g1); - boost::add_edge(boost::vertex(15, g2), boost::vertex(22, g2), g2); - boost::add_edge(boost::vertex(15, g1), boost::vertex(6, g1), g1); - boost::add_edge(boost::vertex(15, g2), boost::vertex(6, g2), g2); - boost::add_edge(boost::vertex(16, g1), boost::vertex(12, g1), g1); - boost::add_edge(boost::vertex(16, g2), boost::vertex(12, g2), g2); - boost::add_edge(boost::vertex(16, g1), boost::vertex(6, g1), g1); - boost::add_edge(boost::vertex(16, g2), boost::vertex(6, g2), g2); - boost::add_edge(boost::vertex(17, g1), boost::vertex(20, g1), g1); - boost::add_edge(boost::vertex(17, g2), boost::vertex(20, g2), g2); - boost::add_edge(boost::vertex(18, g1), boost::vertex(9, g1), g1); - boost::add_edge(boost::vertex(18, g2), boost::vertex(9, g2), g2); - boost::add_edge(boost::vertex(19, g1), boost::vertex(23, g1), g1); - boost::add_edge(boost::vertex(19, g2), boost::vertex(23, g2), g2); - boost::add_edge(boost::vertex(19, g1), boost::vertex(18, g1), g1); - boost::add_edge(boost::vertex(19, g2), boost::vertex(18, g2), g2); - boost::add_edge(boost::vertex(20, g1), boost::vertex(23, g1), g1); - boost::add_edge(boost::vertex(20, g2), boost::vertex(23, g2), g2); - boost::add_edge(boost::vertex(20, g1), boost::vertex(13, g1), g1); - boost::add_edge(boost::vertex(20, g2), boost::vertex(13, g2), g2); - boost::add_edge(boost::vertex(21, g1), boost::vertex(18, g1), g1); - boost::add_edge(boost::vertex(21, g2), boost::vertex(18, g2), g2); - boost::add_edge(boost::vertex(21, g1), boost::vertex(13, g1), g1); - boost::add_edge(boost::vertex(21, g2), boost::vertex(13, g2), g2); - boost::add_edge(boost::vertex(22, g1), boost::vertex(21, g1), g1); - boost::add_edge(boost::vertex(22, g2), boost::vertex(21, g2), g2); - boost::add_edge(boost::vertex(23, g1), boost::vertex(16, g1), g1); - boost::add_edge(boost::vertex(23, g2), boost::vertex(16, g2), g2); - - IndexMap1 index_map1 = boost::get(boost::vertex_index_t(), g1); - IndexMap2 index_map2 = boost::get(boost::vertex_index_t(), g2); - boost::graph_traits<Graph1>::vertex_iterator vi1, vend1; - boost::graph_traits<Graph2>::vertex_iterator vi2, vend2; - - boost::graph_traits<Graph1>::adjacency_iterator ai1, aend1; - boost::graph_traits<Graph2>::adjacency_iterator ai2, aend2; - - for (boost::tie(vi1, vend1) = boost::vertices(g1), boost::tie(vi2, vend2) =boost::vertices(g2); vi1 != vend1; ++vi1, ++vi2) - { - BOOST_CHECK(boost::get(index_map1, *vi1) == boost::get(index_map2, *vi2)); - - for (boost::tie(ai1, aend1) = boost::adjacent_vertices(*vi1, g1), - boost::tie(ai2, aend2) = boost::adjacent_vertices(*vi2, g2); - ai1 != aend1; - ++ai1, ++ai2) - { - BOOST_CHECK(boost::get(index_map1, *ai1) == boost::get(index_map2, *ai2)); - } - } - - boost::graph_traits<Graph1>::out_edge_iterator ei1, eend1; - boost::graph_traits<Graph2>::out_edge_iterator ei2, eend2; - - for (boost::tie(vi1, vend1) = boost::vertices(g1), - boost::tie(vi2, vend2) = boost::vertices(g2); vi1 != vend1; ++vi1, ++vi2) - { - BOOST_CHECK(boost::get(index_map1, *vi1) == boost::get(index_map2, *vi2)); - - for (boost::tie(ei1, eend1) = boost::out_edges(*vi1, g1), - boost::tie(ei2, eend2) = boost::out_edges(*vi2, g2); - ei1 != eend1; - ++ei1, ++ei2) - { - BOOST_CHECK(boost::get(index_map1, boost::target(*ei1, g1)) == boost::get(index_map2, boost::target(*ei2, g2))); - } - } - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/test/astar_search_test.cpp b/Utilities/BGL/boost/graph/test/astar_search_test.cpp deleted file mode 100644 index 18dfeb585e4864c80cf7710955d517ec718f3854..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/astar_search_test.cpp +++ /dev/null @@ -1,213 +0,0 @@ - - -// -//======================================================================= -// Copyright (c) 2004 Kristopher Beevers -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -//======================================================================= -// - - -#include <boost/graph/astar_search.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/random.hpp> -#include <boost/random.hpp> -#include <vector> -#include <list> -#include <iostream> -#include <math.h> // for sqrt -#include <time.h> - -using namespace boost; -using namespace std; - - -// auxiliary types -struct location -{ - float y, x; // lat, long -}; -typedef float cost; - -template <class Name, class LocMap> -class city_writer { -public: - city_writer(Name n, LocMap l, float _minx, float _maxx, - float _miny, float _maxy, - unsigned int _ptx, unsigned int _pty) - : name(n), loc(l), minx(_minx), maxx(_maxx), miny(_miny), - maxy(_maxy), ptx(_ptx), pty(_pty) {} - template <class Vertex> - void operator()(ostream& out, const Vertex& v) const { - float px = 1 - (loc[v].x - minx) / (maxx - minx); - float py = (loc[v].y - miny) / (maxy - miny); - out << "[label=\"" << name[v] << "\", pos=\"" - << static_cast<unsigned int>(ptx * px) << "," - << static_cast<unsigned int>(pty * py) - << "\", fontsize=\"11\"]"; - } -private: - Name name; - LocMap loc; - float minx, maxx, miny, maxy; - unsigned int ptx, pty; -}; - -template <class WeightMap> -class time_writer { -public: - time_writer(WeightMap w) : wm(w) {} - template <class Edge> - void operator()(ostream &out, const Edge& e) const { - out << "[label=\"" << wm[e] << "\", fontsize=\"11\"]"; - } -private: - WeightMap wm; -}; - - -// euclidean distance heuristic -template <class Graph, class CostType, class LocMap> -class distance_heuristic : public astar_heuristic<Graph, CostType> -{ -public: - typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - distance_heuristic(LocMap l, Vertex goal) - : m_location(l), m_goal(goal) {} - CostType operator()(Vertex u) - { - CostType dx = m_location[m_goal].x - m_location[u].x; - CostType dy = m_location[m_goal].y - m_location[u].y; - return ::sqrt(dx * dx + dy * dy); - } -private: - LocMap m_location; - Vertex m_goal; -}; - - -struct found_goal {}; // exception for termination - -// visitor that terminates when we find the goal -template <class Vertex> -class astar_goal_visitor : public boost::default_astar_visitor -{ -public: - astar_goal_visitor(Vertex goal) : m_goal(goal) {} - template <class Graph> - void examine_vertex(Vertex u, Graph& g) { - if(u == m_goal) - throw found_goal(); - } -private: - Vertex m_goal; -}; - - -int main(int argc, char **argv) -{ - - // specify some types - typedef adjacency_list<listS, vecS, undirectedS, no_property, - property<edge_weight_t, cost> > mygraph_t; - typedef property_map<mygraph_t, edge_weight_t>::type WeightMap; - typedef mygraph_t::vertex_descriptor vertex; - typedef mygraph_t::edge_descriptor edge_descriptor; - typedef mygraph_t::vertex_iterator vertex_iterator; - typedef std::pair<int, int> edge; - - // specify data - enum nodes { - Troy, LakePlacid, Plattsburgh, Massena, Watertown, Utica, - Syracuse, Rochester, Buffalo, Ithaca, Binghamton, Woodstock, - NewYork, N - }; - const char *name[] = { - "Troy", "Lake Placid", "Plattsburgh", "Massena", - "Watertown", "Utica", "Syracuse", "Rochester", "Buffalo", - "Ithaca", "Binghamton", "Woodstock", "New York" - }; - location locations[] = { // lat/long - {42.73, 73.68}, {44.28, 73.99}, {44.70, 73.46}, - {44.93, 74.89}, {43.97, 75.91}, {43.10, 75.23}, - {43.04, 76.14}, {43.17, 77.61}, {42.89, 78.86}, - {42.44, 76.50}, {42.10, 75.91}, {42.04, 74.11}, - {40.67, 73.94} - }; - edge edge_array[] = { - edge(Troy,Utica), edge(Troy,LakePlacid), - edge(Troy,Plattsburgh), edge(LakePlacid,Plattsburgh), - edge(Plattsburgh,Massena), edge(LakePlacid,Massena), - edge(Massena,Watertown), edge(Watertown,Utica), - edge(Watertown,Syracuse), edge(Utica,Syracuse), - edge(Syracuse,Rochester), edge(Rochester,Buffalo), - edge(Syracuse,Ithaca), edge(Ithaca,Binghamton), - edge(Ithaca,Rochester), edge(Binghamton,Troy), - edge(Binghamton,Woodstock), edge(Binghamton,NewYork), - edge(Syracuse,Binghamton), edge(Woodstock,Troy), - edge(Woodstock,NewYork) - }; - unsigned int num_edges = sizeof(edge_array) / sizeof(edge); - cost weights[] = { // estimated travel time (mins) - 96, 134, 143, 65, 115, 133, 117, 116, 74, 56, - 84, 73, 69, 70, 116, 147, 173, 183, 74, 71, 124 - }; - - - // create graph - mygraph_t g(N); - WeightMap weightmap = get(edge_weight, g); - for(std::size_t j = 0; j < num_edges; ++j) { - edge_descriptor e; bool inserted; - tie(e, inserted) = add_edge(edge_array[j].first, - edge_array[j].second, g); - weightmap[e] = weights[j]; - } - - - // pick random start/goal - minstd_rand gen(time(0)); - vertex start = gen() % num_vertices(g); - vertex goal = gen() % num_vertices(g); - - - cout << "Start vertex: " << name[start] << endl; - cout << "Goal vertex: " << name[goal] << endl; - - vector<mygraph_t::vertex_descriptor> p(num_vertices(g)); - vector<cost> d(num_vertices(g)); - try { - // call astar named parameter interface - astar_search - (g, start, - distance_heuristic<mygraph_t, cost, location*> - (locations, goal), - predecessor_map(&p[0]).distance_map(&d[0]). - visitor(astar_goal_visitor<vertex>(goal))); - - - } catch(found_goal fg) { // found a path to the goal - list<vertex> shortest_path; - for(vertex v = goal;; v = p[v]) { - shortest_path.push_front(v); - if(p[v] == v) - break; - } - cout << "Shortest path from " << name[start] << " to " - << name[goal] << ": "; - list<vertex>::iterator spi = shortest_path.begin(); - cout << name[start]; - for(++spi; spi != shortest_path.end(); ++spi) - cout << " -> " << name[*spi]; - cout << endl << "Total travel time: " << d[goal] << endl; - return 0; - } - - cout << "Didn't find a path from " << name[start] << "to" - << name[goal] << "!" << endl; - return 0; - -} diff --git a/Utilities/BGL/boost/graph/test/bellman-test.cpp b/Utilities/BGL/boost/graph/test/bellman-test.cpp deleted file mode 100644 index 53bba704a37b3a6a57511c7c0ec0ec2b2509a6c2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/bellman-test.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// (C) Copyright Jeremy Siek 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) - -// From Louis Lavery <Louis@devilsChimney.co.uk> -/*Expected Output:- -A: 0 A -B: 11 A - -Actual Output:- -A: 0 A -B: 2147483647 B -*/ - -#include <iostream> -#include <iomanip> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/bellman_ford_shortest_paths.hpp> -#include <boost/cstdlib.hpp> -#include <boost/test/minimal.hpp> - -int test_main(int, char*[]) -{ - using namespace boost; - - enum { A, B, Z }; - char const name[] = "ABZ"; - int const numVertex = static_cast<int>(Z) + 1; - typedef std::pair<int,int> Edge; - Edge edge_array[] = {Edge(B,A)}; - int const numEdges = sizeof(edge_array) / sizeof(Edge); - int const weight[numEdges] = {11}; - - typedef adjacency_list<vecS,vecS,undirectedS, - no_property,property<edge_weight_t,int> > Graph; - - Graph g(edge_array, edge_array + numEdges, numVertex); - - Graph::edge_iterator ei, ei_end; - property_map<Graph,edge_weight_t>::type - weight_pmap = get(edge_weight, g); - - int i = 0; - for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei, ++i) - weight_pmap[*ei] = weight[i]; - - std::vector<int> parent(numVertex); - for(i = 0; i < numVertex; ++i) - parent[i] = i; - - int inf = (std::numeric_limits<int>::max)(); - std::vector<int> distance(numVertex, inf); - distance[A] = 0; // Set source distance to zero - - bool const r = bellman_ford_shortest_paths - (g, int (numVertex), - weight_pmap, - &parent[0], - &distance[0], - closed_plus<int>(), - std::less<int>(), - default_bellman_visitor()); - - if (r) { - for(int i = 0; i < numVertex; ++i) { - std::cout << name[i] << ": "; - if (distance[i] == inf) - std::cout << std::setw(3) << "inf"; - else - std::cout << std::setw(3) << distance[i]; - std::cout << " " << name[parent[i]] << std::endl; - } - } else { - std::cout << "negative cycle" << std::endl; - } - -#if !(defined(__INTEL_COMPILER) && __INTEL_COMPILER <= 700) && !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300) - graph_traits<Graph>::vertex_descriptor s = vertex(A, g); - std::vector<int> parent2(numVertex); - std::vector<int> distance2(numVertex, 17); - bool const r2 = bellman_ford_shortest_paths - (g, - weight_map(weight_pmap).distance_map(&distance2[0]). - predecessor_map(&parent2[0]).root_vertex(s)); - if (r2) { - for(int i = 0; i < numVertex; ++i) { - std::cout << name[i] << ": "; - if (distance2[i] == inf) - std::cout << std::setw(3) << "inf"; - else - std::cout << std::setw(3) << distance2[i]; - std::cout << " " << name[parent2[i]] << std::endl; - } - } else { - std::cout << "negative cycle" << std::endl; - } - - BOOST_CHECK(r == r2); - if (r && r2) { - BOOST_CHECK(parent == parent2); - BOOST_CHECK(distance == distance2); - } -#endif - - return boost::exit_success; -} diff --git a/Utilities/BGL/boost/graph/test/betweenness_centrality_test.cpp b/Utilities/BGL/boost/graph/test/betweenness_centrality_test.cpp deleted file mode 100644 index 5ec86354d7a93d5ea79f70234a8ae99d1c440ac4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/betweenness_centrality_test.cpp +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// 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 -// Andrew Lumsdaine -#include <boost/graph/betweenness_centrality.hpp> - -#include <boost/graph/adjacency_list.hpp> -#include <vector> -#include <stack> -#include <queue> -#include <boost/property_map.hpp> -#include <boost/test/minimal.hpp> -#include <boost/random/uniform_01.hpp> -#include <boost/random/linear_congruential.hpp> - -using namespace boost; - -const double error_tolerance = 0.001; - -typedef property<edge_weight_t, double, - property<edge_index_t, std::size_t> > EdgeProperties; - -struct weighted_edge -{ - int source, target; - double weight; -}; - -template<typename Graph> -void -run_weighted_test(Graph*, int V, weighted_edge edge_init[], int E, - double correct_centrality[]) -{ - Graph g(V); - typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - typedef typename graph_traits<Graph>::edge_descriptor Edge; - - std::vector<Vertex> vertices(V); - { - vertex_iterator v, v_end; - int index = 0; - for (tie(v, v_end) = boost::vertices(g); v != v_end; ++v, ++index) { - put(vertex_index, g, *v, index); - vertices[index] = *v; - } - } - - std::vector<Edge> edges(E); - for (int e = 0; e < E; ++e) { - edges[e] = add_edge(vertices[edge_init[e].source], - vertices[edge_init[e].target], - g).first; - put(edge_weight, g, edges[e], 1.0); - } - - std::vector<double> centrality(V); - brandes_betweenness_centrality( - g, - centrality_map( - make_iterator_property_map(centrality.begin(), get(vertex_index, g), - double())) - .vertex_index_map(get(vertex_index, g)).weight_map(get(edge_weight, g))); - - - for (int v = 0; v < V; ++v) { - BOOST_CHECK(centrality[v] == correct_centrality[v]); - } -} - -struct unweighted_edge -{ - int source, target; -}; - -template<typename Graph> -void -run_unweighted_test(Graph*, int V, unweighted_edge edge_init[], int E, - double correct_centrality[], - double* correct_edge_centrality = 0) -{ - Graph g(V); - typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - typedef typename graph_traits<Graph>::edge_descriptor Edge; - - std::vector<Vertex> vertices(V); - { - vertex_iterator v, v_end; - int index = 0; - for (tie(v, v_end) = boost::vertices(g); v != v_end; ++v, ++index) { - put(vertex_index, g, *v, index); - vertices[index] = *v; - } - } - - std::vector<Edge> edges(E); - for (int e = 0; e < E; ++e) { - edges[e] = add_edge(vertices[edge_init[e].source], - vertices[edge_init[e].target], - g).first; - put(edge_weight, g, edges[e], 1.0); - put(edge_index, g, edges[e], e); - } - - std::vector<double> centrality(V); - std::vector<double> edge_centrality1(E); - - brandes_betweenness_centrality( - g, - centrality_map( - make_iterator_property_map(centrality.begin(), get(vertex_index, g), - double())) - .edge_centrality_map( - make_iterator_property_map(edge_centrality1.begin(), - get(edge_index, g), double())) - .vertex_index_map(get(vertex_index, g))); - - std::vector<double> centrality2(V); - std::vector<double> edge_centrality2(E); - brandes_betweenness_centrality( - g, - vertex_index_map(get(vertex_index, g)).weight_map(get(edge_weight, g)) - .centrality_map( - make_iterator_property_map(centrality2.begin(), get(vertex_index, g), - double())) - .edge_centrality_map( - make_iterator_property_map(edge_centrality2.begin(), - get(edge_index, g), double()))); - - std::vector<double> edge_centrality3(E); - brandes_betweenness_centrality( - g, - edge_centrality_map( - make_iterator_property_map(edge_centrality3.begin(), - get(edge_index, g), double()))); - - for (int v = 0; v < V; ++v) { - BOOST_CHECK(centrality[v] == centrality2[v]); - - double relative_error = - correct_centrality[v] == 0.0? centrality[v] - : (centrality[v] - correct_centrality[v]) / correct_centrality[v]; - if (relative_error < 0) relative_error = -relative_error; - BOOST_CHECK(relative_error < error_tolerance); - } - - for (int e = 0; e < E; ++e) { - BOOST_CHECK(edge_centrality1[e] == edge_centrality2[e]); - BOOST_CHECK(edge_centrality1[e] == edge_centrality3[e]); - - if (correct_edge_centrality) { - double relative_error = - correct_edge_centrality[e] == 0.0? edge_centrality1[e] - : (edge_centrality1[e] - correct_edge_centrality[e]) - / correct_edge_centrality[e]; - if (relative_error < 0) relative_error = -relative_error; - BOOST_CHECK(relative_error < error_tolerance); - - if (relative_error >= error_tolerance) { - std::cerr << "Edge " << e << " has edge centrality " - << edge_centrality1[e] << ", should be " - << correct_edge_centrality[e] << std::endl; - } - } - } -} - -template<typename Graph> -void -run_wheel_test(Graph*, int V) -{ - typedef typename graph_traits<Graph>::vertex_descriptor Vertex; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - typedef typename graph_traits<Graph>::edge_descriptor Edge; - - Graph g(V); - Vertex center = *boost::vertices(g).first; - - std::vector<Vertex> vertices(V); - { - vertex_iterator v, v_end; - int index = 0; - for (tie(v, v_end) = boost::vertices(g); v != v_end; ++v, ++index) { - put(vertex_index, g, *v, index); - vertices[index] = *v; - if (*v != center) { - Edge e = add_edge(*v, center, g).first; - put(edge_weight, g, e, 1.0); - } - } - } - - std::vector<double> centrality(V); - brandes_betweenness_centrality( - g, - make_iterator_property_map(centrality.begin(), get(vertex_index, g), - double())); - - std::vector<double> centrality2(V); - brandes_betweenness_centrality( - g, - centrality_map( - make_iterator_property_map(centrality2.begin(), get(vertex_index, g), - double())) - .vertex_index_map(get(vertex_index, g)).weight_map(get(edge_weight, g))); - - relative_betweenness_centrality( - g, - make_iterator_property_map(centrality.begin(), get(vertex_index, g), - double())); - - relative_betweenness_centrality( - g, - make_iterator_property_map(centrality2.begin(), get(vertex_index, g), - double())); - - for (int v = 0; v < V; ++v) { - BOOST_CHECK(centrality[v] == centrality2[v]); - BOOST_CHECK((v == 0 && centrality[v] == 1) - || (v != 0 && centrality[v] == 0)); - } - - double dominance = - central_point_dominance( - g, - make_iterator_property_map(centrality2.begin(), get(vertex_index, g), - double())); - BOOST_CHECK(dominance == 1.0); -} - -template<typename MutableGraph> -void randomly_add_edges(MutableGraph& g, double edge_probability) -{ - typedef typename graph_traits<MutableGraph>::directed_category - directed_category; - const bool is_undirected = - is_same<directed_category, undirected_tag>::value; - - minstd_rand gen; - uniform_01<minstd_rand, double> rand_gen(gen); - - typedef typename graph_traits<MutableGraph>::vertex_descriptor vertex; - typename graph_traits<MutableGraph>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - vertex v = *vi; - typename graph_traits<MutableGraph>::vertex_iterator wi - = is_undirected? vi : vertices(g).first; - while (wi != vi_end) { - vertex w = *wi++; - if (v != w) { - if (rand_gen() < edge_probability) add_edge(v, w, g); - } - } - } -} - - -template<typename Graph, typename VertexIndexMap, typename CentralityMap> -void -simple_unweighted_betweenness_centrality(const Graph& g, VertexIndexMap index, - CentralityMap centrality) -{ - typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex; - typedef typename boost::graph_traits<Graph>::vertex_iterator vertex_iterator; - typedef typename boost::graph_traits<Graph>::adjacency_iterator adjacency_iterator; - typedef typename boost::graph_traits<Graph>::vertices_size_type vertices_size_type; - typedef typename boost::property_traits<CentralityMap>::value_type centrality_type; - - vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - put(centrality, *vi, 0); - - vertex_iterator si, si_end; - for (tie(si, si_end) = vertices(g); si != si_end; ++si) { - vertex s = *si; - - // S <-- empty stack - std::stack<vertex> S; - - // P[w] <-- empty list, w \in V - typedef std::vector<vertex> Predecessors; - std::vector<Predecessors> predecessors(num_vertices(g)); - - // sigma[t] <-- 0, t \in V - std::vector<vertices_size_type> sigma(num_vertices(g), 0); - - // sigma[s] <-- 1 - sigma[get(index, s)] = 1; - - // d[t] <-- -1, t \in V - std::vector<int> d(num_vertices(g), -1); - - // d[s] <-- 0 - d[get(index, s)] = 0; - - // Q <-- empty queue - std::queue<vertex> Q; - - // enqueue s --> Q - Q.push(s); - - while (!Q.empty()) { - // dequeue v <-- Q - vertex v = Q.front(); Q.pop(); - - // push v --> S - S.push(v); - - adjacency_iterator wi, wi_end; - for (tie(wi, wi_end) = adjacent_vertices(v, g); wi != wi_end; ++wi) { - vertex w = *wi; - - // w found for the first time? - if (d[get(index, w)] < 0) { - // enqueue w --> Q - Q.push(w); - - // d[w] <-- d[v] + 1 - d[get(index, w)] = d[get(index, v)] + 1; - } - - // shortest path to w via v? - if (d[get(index, w)] == d[get(index, v)] + 1) { - // sigma[w] = sigma[w] + sigma[v] - sigma[get(index, w)] += sigma[get(index, v)]; - - // append v --> P[w] - predecessors[get(index, w)].push_back(v); - } - } - } - - // delta[v] <-- 0, v \in V - std::vector<centrality_type> delta(num_vertices(g), 0); - - // S returns vertices in order of non-increasing distance from s - while (!S.empty()) { - // pop w <-- S - vertex w = S.top(); S.pop(); - - const Predecessors& w_preds = predecessors[get(index, w)]; - for (typename Predecessors::const_iterator vi = w_preds.begin(); - vi != w_preds.end(); ++vi) { - vertex v = *vi; - // delta[v] <-- delta[v] + (sigma[v]/sigma[w])*(1 + delta[w]) - delta[get(index, v)] += - ((centrality_type)sigma[get(index, v)]/sigma[get(index, w)]) - * (1 + delta[get(index, w)]); - } - - if (w != s) { - // C_B[w] <-- C_B[w] + delta[w] - centrality[w] += delta[get(index, w)]; - } - } - } - - typedef typename graph_traits<Graph>::directed_category directed_category; - const bool is_undirected = - is_same<directed_category, undirected_tag>::value; - if (is_undirected) { - vertex_iterator v, v_end; - for(tie(v, v_end) = vertices(g); v != v_end; ++v) { - put(centrality, *v, get(centrality, *v) / centrality_type(2)); - } - } -} - -template<typename Graph> -void random_unweighted_test(Graph*, int n) -{ - Graph g(n); - - { - typename graph_traits<Graph>::vertex_iterator v, v_end; - int index = 0; - for (tie(v, v_end) = boost::vertices(g); v != v_end; ++v, ++index) { - put(vertex_index, g, *v, index); - } - } - - randomly_add_edges(g, 0.20); - - std::cout << "Random graph with " << n << " vertices and " - << num_edges(g) << " edges.\n"; - - std::cout << " Direct translation of Brandes' algorithm..."; - std::vector<double> centrality(n); - simple_unweighted_betweenness_centrality(g, get(vertex_index, g), - make_iterator_property_map(centrality.begin(), get(vertex_index, g), - double())); - std::cout << "DONE.\n"; - - std::cout << " Real version, unweighted..."; - std::vector<double> centrality2(n); - brandes_betweenness_centrality(g, - make_iterator_property_map(centrality2.begin(), get(vertex_index, g), - double())); - std::cout << "DONE.\n"; - - if (!std::equal(centrality.begin(), centrality.end(), - centrality2.begin())) { - for (std::size_t v = 0; v < centrality.size(); ++v) { - double relative_error = - centrality[v] == 0.0? centrality2[v] - : (centrality2[v] - centrality[v]) / centrality[v]; - if (relative_error < 0) relative_error = -relative_error; - BOOST_CHECK(relative_error < error_tolerance); - } - } - - std::cout << " Real version, weighted..."; - std::vector<double> centrality3(n); - - for (typename graph_traits<Graph>::edge_iterator ei = edges(g).first; - ei != edges(g).second; ++ei) - put(edge_weight, g, *ei, 1); - - brandes_betweenness_centrality(g, - weight_map(get(edge_weight, g)) - .centrality_map( - make_iterator_property_map(centrality3.begin(), get(vertex_index, g), - double()))); - std::cout << "DONE.\n"; - - if (!std::equal(centrality.begin(), centrality.end(), - centrality3.begin())) { - for (std::size_t v = 0; v < centrality.size(); ++v) { - double relative_error = - centrality[v] == 0.0? centrality3[v] - : (centrality3[v] - centrality[v]) / centrality[v]; - if (relative_error < 0) relative_error = -relative_error; - BOOST_CHECK(relative_error < error_tolerance); - } - } -} - -int test_main(int, char*[]) -{ - typedef adjacency_list<listS, listS, undirectedS, - property<vertex_index_t, int>, EdgeProperties> - Graph; - typedef adjacency_list<listS, listS, directedS, - property<vertex_index_t, int>, EdgeProperties> - Digraph; - - struct unweighted_edge ud_edge_init1[5] = { - { 0, 1 }, - { 0, 3 }, - { 1, 2 }, - { 3, 2 }, - { 2, 4 } - }; - double ud_centrality1[5] = { 0.5, 1.0, 3.5, 1.0, 0.0 }; - run_unweighted_test((Graph*)0, 5, ud_edge_init1, 5, ud_centrality1); - - // Example borrowed from the JUNG test suite - struct unweighted_edge ud_edge_init2[10] = { - { 0, 1 }, - { 0, 6 }, - { 1, 2 }, - { 1, 3 }, - { 2, 4 }, - { 3, 4 }, - { 4, 5 }, - { 5, 8 }, - { 7, 8 }, - { 6, 7 }, - }; - double ud_centrality2[9] = { - 0.2142 * 28, - 0.2797 * 28, - 0.0892 * 28, - 0.0892 * 28, - 0.2797 * 28, - 0.2142 * 28, - 0.1666 * 28, - 0.1428 * 28, - 0.1666 * 28 - }; - double ud_edge_centrality2[10] = { - 10.66666, - 9.33333, - 6.5, - 6.5, - 6.5, - 6.5, - 10.66666, - 9.33333, - 8.0, - 8.0 - }; - - run_unweighted_test((Graph*)0, 9, ud_edge_init2, 10, ud_centrality2, - ud_edge_centrality2); - - weighted_edge dw_edge_init1[6] = { - { 0, 1, 1.0 }, - { 0, 3, 1.0 }, - { 1, 2, 0.5 }, - { 3, 1, 1.0 }, - { 3, 4, 1.0 }, - { 4, 2, 0.5 } - }; - double dw_centrality1[5] = { 0.0, 1.5, 0.0, 1.0, 0.5 }; - run_weighted_test((Digraph*)0, 5, dw_edge_init1, 6, dw_centrality1); - - run_wheel_test((Graph*)0, 15); - - random_unweighted_test((Graph*)0, 300); - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/test/bfs.cpp b/Utilities/BGL/boost/graph/test/bfs.cpp deleted file mode 100644 index 7e59ac9b374e75c3abd060a426626c9d9308adb8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/bfs.cpp +++ /dev/null @@ -1,179 +0,0 @@ -//======================================================================= -// Copyright 2001 University of Notre Dame. -// Author: Andrew Janiszewski, 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) -//======================================================================= - -#include <boost/test/minimal.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/random.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/breadth_first_search.hpp> - -#include <boost/random/mersenne_twister.hpp> - -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -using namespace boost; -#endif - -template <typename DistanceMap, typename ParentMap, - typename Graph, typename ColorMap> -class bfs_testing_visitor -{ - typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex; - typedef typename boost::graph_traits<Graph>::edge_descriptor Edge; - typedef typename boost::color_traits< - typename boost::property_traits<ColorMap>::value_type - > Color; -public: - - bfs_testing_visitor(Vertex s, DistanceMap d, ParentMap p, ColorMap c) - : current_distance(0), distance(d), parent(p), color(c), src(s) { } - - void initialize_vertex(const Vertex& u, const Graph& ) const { - BOOST_CHECK(get(color, u) == Color::white()); - } - void examine_vertex(const Vertex& u, const Graph& ) const { - current_vertex = u; - // Ensure that the distances monotonically increase. - BOOST_CHECK( distance[u] == current_distance - || distance[u] == current_distance + 1 ); - if (distance[u] == current_distance + 1) // new level - ++current_distance; - } - void discover_vertex(const Vertex& u, const Graph& ) const { - BOOST_CHECK( get(color, u) == Color::gray() ); - if (u == src) { - current_vertex = src; - } else { - BOOST_CHECK( parent[u] == current_vertex ); - BOOST_CHECK( distance[u] == current_distance + 1 ); - BOOST_CHECK( distance[u] == distance[parent[u]] + 1 ); - } - } - void examine_edge(const Edge& e, const Graph& g) const { - BOOST_CHECK( source(e, g) == current_vertex ); - } - void tree_edge(const Edge& e, const Graph& g) const { - BOOST_CHECK( get(color, target(e, g)) == Color::white() ); - Vertex u = source(e, g), v = target(e, g); - BOOST_CHECK( distance[u] == current_distance ); - parent[v] = u; - distance[v] = distance[u] + 1; - } - void non_tree_edge(const Edge& e, const Graph& g) const { - BOOST_CHECK( color[target(e, g)] != Color::white() ); - - if (boost::is_directed(g)) - // cross or back edge - BOOST_CHECK(distance[target(e, g)] <= distance[source(e, g)] + 1); - else { - // cross edge (or going backwards on a tree edge) - BOOST_CHECK(distance[target(e, g)] == distance[source(e, g)] - || distance[target(e, g)] == distance[source(e, g)] + 1 - || distance[target(e, g)] == distance[source(e, g)] - 1 - ); - } - } - - void gray_target(const Edge& e, const Graph& g) const { - BOOST_CHECK( color[target(e, g)] == Color::gray() ); - } - - void black_target(const Edge& e, const Graph& g) const { - BOOST_CHECK( color[target(e, g)] == Color::black() ); - - // All vertices adjacent to a black vertex must already be discovered - typename boost::graph_traits<Graph>::adjacency_iterator ai, ai_end; - for (boost::tie(ai, ai_end) = adjacent_vertices(target(e, g), g); - ai != ai_end; ++ai) - BOOST_CHECK( color[*ai] != Color::white() ); - } - void finish_vertex(const Vertex& u, const Graph& ) const { - BOOST_CHECK( color[u] == Color::black() ); - - } -private: - mutable Vertex current_vertex; - mutable typename boost::property_traits<DistanceMap>::value_type - current_distance; - DistanceMap distance; - ParentMap parent; - ColorMap color; - Vertex src; -}; - - -template <class Graph> -struct bfs_test -{ - typedef boost::graph_traits<Graph> Traits; - typedef typename Traits::vertices_size_type - vertices_size_type; - static void go(vertices_size_type max_V) { - typedef typename Traits::vertex_descriptor vertex_descriptor; - typedef boost::color_traits<boost::default_color_type> Color; - - vertices_size_type i; - typename Traits::edges_size_type j; - typename Traits::vertex_iterator ui, ui_end; - - boost::mt19937 gen; - - for (i = 0; i < max_V; ++i) - for (j = 0; j < i*i; ++j) { - Graph g; - boost::generate_random_graph(g, i, j, gen); - - // declare the "start" variable - vertex_descriptor start = boost::random_vertex(g, gen); - - // vertex properties - std::vector<int> distance(i, (std::numeric_limits<int>::max)()); - distance[start] = 0; - std::vector<vertex_descriptor> parent(i); - for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) - parent[*ui] = *ui; - std::vector<boost::default_color_type> color(i); - - // Create the testing visitor. - bfs_testing_visitor<int*,vertex_descriptor*,Graph, - boost::default_color_type*> - vis(start, &distance[0], &parent[0], &color[0]); - - boost::breadth_first_search(g, start, - visitor(vis). - color_map(&color[0])); - - // All white vertices should be unreachable from the source. - for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) - if (color[*ui] == Color::white()) { - std::vector<boost::default_color_type> color2(i, Color::white()); - BOOST_CHECK(!boost::is_reachable(start, *ui, g, &color2[0])); - } - - // The shortest path to a child should be one longer than - // shortest path to the parent. - for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) - if (parent[*ui] != *ui) // *ui not the root of the bfs tree - BOOST_CHECK(distance[*ui] == distance[parent[*ui]] + 1); - } - } -}; - - -int test_main(int argc, char* argv[]) -{ - using namespace boost; - int max_V = 7; - if (argc > 1) - max_V = atoi(argv[1]); - - bfs_test< adjacency_list<vecS, vecS, directedS> >::go(max_V); - bfs_test< adjacency_list<vecS, vecS, undirectedS> >::go(max_V); - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/bfs_cc.cpp b/Utilities/BGL/boost/graph/test/bfs_cc.cpp deleted file mode 100644 index 465dec30b14728746aa32dea2488afa16ca0034a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/bfs_cc.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <boost/concept_archetype.hpp> -#include <boost/graph/breadth_first_search.hpp> -#include <boost/graph/graph_archetypes.hpp> - -int main() -{ - using namespace boost; - typedef default_constructible_archetype< - sgi_assignable_archetype< - equality_comparable_archetype<> > > vertex_t; - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> graph_t; - graph_t& g = static_object<graph_t>::get(); - vertex_t s; - read_write_property_map_archetype<vertex_t, color_value_archetype> color; - breadth_first_search(g, s, color_map(color)); - } - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> graph_t; - graph_t& g = static_object<graph_t>::get(); - vertex_t s; - readable_property_map_archetype<vertex_t, std::size_t> v_index; - breadth_first_search(g, s, vertex_index_map(v_index)); - } - { - typedef incidence_graph_archetype<vertex_t, undirected_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, undirected_tag, - allow_parallel_edge_tag, IncidenceGraph> Graph; - typedef property_graph_archetype<Graph, vertex_index_t, std::size_t> - graph_t; - graph_t& g = static_object<graph_t>::get(); - vertex_t s; - bfs_visitor<> v; - buffer_archetype<vertex_t> b; - breadth_first_search(g, s, visitor(v).buffer(b)); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/biconnected_components_test.cpp b/Utilities/BGL/boost/graph/test/biconnected_components_test.cpp deleted file mode 100644 index d2a801e358ef9d15b48ba75646880e45a34d99c5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/biconnected_components_test.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// 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 -// Andrew Lumsdaine -#include <boost/graph/biconnected_components.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/test/minimal.hpp> -#include <boost/lexical_cast.hpp> -#include <vector> -#include <iterator> -#include <iostream> -#include <algorithm> -#include <boost/graph/connected_components.hpp> -#include <boost/graph/random.hpp> -#include <boost/random/linear_congruential.hpp> -#include <fstream> - -using namespace boost; - -struct EdgeProperty -{ - std::size_t component; -}; - -static bool any_errors = false; - -template<typename Graph, typename Vertex> -void -check_articulation_points(const Graph& g, std::vector<Vertex> art_points) -{ - std::vector<int> components(num_vertices(g)); - int basic_comps = - connected_components(g, - make_iterator_property_map(components.begin(), - get(vertex_index, g), - int())); - - std::vector<Vertex> art_points_check; - - typename graph_traits<Graph>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - Graph g_copy(g); - Vertex victim = vertex(get(vertex_index, g, *vi), g_copy); - clear_vertex(victim, g_copy); - remove_vertex(victim, g_copy); - - int copy_comps = - connected_components - (g_copy, - make_iterator_property_map(components.begin(), - get(vertex_index, g_copy), - int())); - - if (copy_comps > basic_comps) - art_points_check.push_back(*vi); - } - - std::sort(art_points.begin(), art_points.end()); - std::sort(art_points_check.begin(), art_points_check.end()); - - BOOST_CHECK(art_points == art_points_check); - if (art_points != art_points_check) { - std::cerr << "ERROR!" << std::endl; - std::cerr << "\tComputed: "; - std::size_t i; - for (i = 0; i < art_points.size(); ++i) - std::cout << art_points[i] << ' '; - std::cout << std::endl << "\tExpected: "; - for (i = 0; i < art_points_check.size(); ++i) - std::cout << art_points_check[i] << ' '; - std::cout << std::endl; - any_errors = true; - } else std::cout << "OK." << std::endl; -} - -int test_main(int argc, char* argv[]) -{ - std::size_t n = 100; - std::size_t m = 500; - std::size_t seed = 1; - - if (argc > 1) n = lexical_cast<std::size_t>(argv[1]); - if (argc > 2) m = lexical_cast<std::size_t>(argv[2]); - if (argc > 3) seed = lexical_cast<std::size_t>(argv[3]); - - typedef adjacency_list<listS, vecS, undirectedS, - no_property, EdgeProperty> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - - Graph g(n); - minstd_rand gen(seed); - generate_random_graph(g, n, m, gen); - std::vector<Vertex> art_points; - - std::cout << "Computing biconnected components & articulation points... "; - std::cout.flush(); - - std::size_t num_comps = - biconnected_components(g, - get(&EdgeProperty::component, g), - std::back_inserter(art_points)).first; - - std::cout << "done.\n\t" << num_comps << " biconnected components.\n" - << "\t" << art_points.size() << " articulation points.\n" - << "\tTesting articulation points..."; - std::cout.flush(); - - check_articulation_points(g, art_points); - - if (any_errors) { - std::ofstream out("biconnected_components_test_failed.dot"); - - out << "graph A {\n" << " node[shape=\"circle\"]\n"; - - for (std::size_t i = 0; i < art_points.size(); ++i) { - out << art_points[i] << " [ style=\"filled\" ];" << std::endl; - } - - graph_traits<Graph>::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - out << source(*ei, g) << " -- " << target(*ei, g) - << "[label=\"" << g[*ei].component << "\"]\n"; - out << "}\n"; - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/bidir_remove_edge.cpp b/Utilities/BGL/boost/graph/test/bidir_remove_edge.cpp deleted file mode 100644 index 3e8f8c85bd129c3fb94a50668671f87b368a5c01..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/bidir_remove_edge.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// (C) Copyright Jeremy Siek 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) - -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/cstdlib.hpp> -#include <boost/test/test_tools.hpp> - -struct edge_prop { - int weight; -}; - -int -main() -{ - { - typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, - boost::no_property, edge_prop> graph; - typedef boost::graph_traits<graph>::edge_descriptor edge; - - graph g(2); - - edge_prop p = { 42 }; - edge e; bool b; - tie(e, b) = add_edge(0, 1, p, g); - assert( num_edges(g) == 1 ); - assert( g[e].weight == 42 ); - remove_edge(e, g); - assert( num_edges(g) == 0 ); - } - { - typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS> graph; - typedef boost::graph_traits<graph>::edge_descriptor edge; - - graph g(2); - - edge e; bool b; - tie(e, b) = add_edge(0, 1, g); - assert( num_edges(g) == 1 ); - remove_edge(e, g); - assert( num_edges(g) == 0 ); - } - return boost::exit_success; -} diff --git a/Utilities/BGL/boost/graph/test/bidir_vec_remove_edge.cpp b/Utilities/BGL/boost/graph/test/bidir_vec_remove_edge.cpp deleted file mode 100644 index 3f48c38b9f66200739750c75042dff0d54b751ad..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/bidir_vec_remove_edge.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// (C) Copyright 2004 Douglas Gregor and Jeremy 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) - -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/test/minimal.hpp> - -struct edge_prop { - int weight; -}; - -int -test_main(int, char*[]) -{ - { - typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, - boost::no_property, edge_prop, boost::no_property, boost::vecS> graph; - typedef boost::graph_traits<graph>::edge_descriptor edge; - - graph g(2); - - edge_prop p1 = { 42 }; - edge_prop p2 = { 17 }; - add_edge(0, 1, p1, g); - add_edge(1, 0, p2, g); - - edge e1 = boost::edge(0, 1, g).first; - edge e2 = boost::edge(1, 0, g).first; - BOOST_TEST( num_edges(g) == 2 ); - BOOST_TEST( g[e1].weight == 42 ); - BOOST_TEST( g[e2].weight == 17 ); - remove_edge(e1, g); - BOOST_TEST( num_edges(g) == 1 ); - - // e2 has been invalidated, so grab it again - bool b2; - tie(e2, b2) = boost::edge(1, 0, g); - BOOST_TEST( b2 ); - BOOST_TEST( g[e2].weight == 17 ); - - /* Now remove the other edge. Here, the fact that - * stored_ra_edge_iterator keeps an index but does not update it - * when edges are removed. So, this will be incorrect but the - * error may not always show up (use an STL debug mode to see the - * error for sure.) - */ - remove_edge(e2, g); - - } - return boost::exit_success; -} diff --git a/Utilities/BGL/boost/graph/test/bundled_properties.cpp b/Utilities/BGL/boost/graph/test/bundled_properties.cpp deleted file mode 100644 index 7ebdbe228c241797425721a15bf6bd82d66d409a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/bundled_properties.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// Boost Graph library - -// Copyright Douglas Gregor 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) - -#include <boost/test/minimal.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/adjacency_matrix.hpp> -#include <boost/graph/filtered_graph.hpp> -#include <boost/graph/subgraph.hpp> -#include <string> -#include <vector> - -using namespace std; -using namespace boost; - -struct City -{ - City() {} - City(const std::string& name, int pop, int zipcode) : name(name), population(pop) - { - zipcodes.push_back(zipcode); - } - - string name; - int population; - vector<int> zipcodes; -}; - -struct Highway -{ - Highway() {} - Highway(const string& name, double miles, int speed_limit = 65, int lanes = 4, bool divided = true) - : name(name), miles(miles), speed_limit(speed_limit), lanes(lanes), divided(divided) {} - - string name; - double miles; - int speed_limit; - int lanes; - bool divided; -}; - -template<bool> struct truth {}; - -template<typename Map, typename VertexIterator, typename Bundle> -typename boost::graph_traits<Map>::vertex_descriptor -do_add_vertex(Map& map, VertexIterator, const Bundle& bundle, truth<true>) -{ - return add_vertex(bundle, map); -} - -template<typename Map, typename VertexIterator, typename Bundle> -typename boost::graph_traits<Map>::vertex_descriptor -do_add_vertex(Map& map, VertexIterator& vi, const Bundle& bundle, truth<false>) -{ - get(boost::vertex_bundle, map)[*vi] = bundle; - return *vi++; -} - - -template<typename Map, bool CanAddVertex> -void test_bundled_properties(Map*, truth<CanAddVertex> can_add_vertex) -{ - typedef typename boost::graph_traits<Map>::vertex_iterator vertex_iterator; - typedef typename boost::graph_traits<Map>::vertex_descriptor vertex_descriptor; - typedef typename boost::graph_traits<Map>::edge_descriptor edge_descriptor; - - Map map(3); - - vertex_iterator vi = vertices(map).first; - vertex_descriptor v = *vi; - map[v].name = "Troy"; - map[v].population = 49170; - map[v].zipcodes.push_back(12180); - - ++vi; - vertex_descriptor u = *vi++; - map[u].name = "Albany"; - map[u].population = 95658; - map[u].zipcodes.push_back(12201); - - // Try adding a vertex with a property value - vertex_descriptor bloomington = do_add_vertex(map, vi, City("Bloomington", 39000, 47401), - can_add_vertex); - BOOST_CHECK(get(boost::vertex_bundle, map)[bloomington].zipcodes[0] == 47401); - - edge_descriptor e = add_edge(v, u, map).first; - map[e].name = "I-87"; - map[e].miles = 10; - map[e].speed_limit = 65; - map[e].lanes = 4; - map[e].divided = true; - - edge_descriptor our_trip = add_edge(v, bloomington, Highway("Long haul", 1000), map).first; - BOOST_CHECK(get(boost::edge_bundle, map, our_trip).miles == 1000); - - BOOST_CHECK(get(get(&City::name, map), v) == "Troy"); - BOOST_CHECK(get(get(&Highway::name, map), e) == "I-87"); - BOOST_CHECK(get(&City::name, map, u) == "Albany"); - BOOST_CHECK(get(&Highway::name, map, e) == "I-87"); - put(&City::population, map, v, 49168); - BOOST_CHECK(get(&City::population, map)[v] == 49168); - - boost::filtered_graph<Map, boost::keep_all> fmap(map, boost::keep_all()); - BOOST_CHECK(get(boost::edge_bundle, map, our_trip).miles == 1000); - - BOOST_CHECK(get(get(&City::name, fmap), v) == "Troy"); - BOOST_CHECK(get(get(&Highway::name, fmap), e) == "I-87"); - BOOST_CHECK(get(&City::name, fmap, u) == "Albany"); - BOOST_CHECK(get(&Highway::name, fmap, e) == "I-87"); - put(&City::population, fmap, v, 49169); - BOOST_CHECK(get(&City::population, fmap)[v] == 49169); - -} - -void test_subgraph_bundled_properties() -{ - typedef boost::subgraph< - boost::adjacency_list<boost::vecS, boost::vecS, - boost::bidirectionalS, City, - boost::property<boost::edge_index_t, int, - Highway> > > SubMap; - typedef boost::graph_traits<SubMap>::vertex_descriptor Vertex; - typedef boost::graph_traits<SubMap>::vertex_iterator vertex_iterator; - - SubMap map(3); - vertex_iterator vi = vertices(map).first; - Vertex troy = *vi++; - map[troy].name = "Troy"; - map[*vi++].name = "Bloomington"; - map[*vi++].name = "Endicott"; - - SubMap& g1 = map.create_subgraph(); - Vertex troy1 = add_vertex(*vertices(map).first, g1); - BOOST_CHECK(map[troy1].name == g1[troy1].name); -} - -int test_main(int, char*[]) -{ - typedef boost::adjacency_list< - boost::listS, boost::vecS, boost::bidirectionalS, - City, Highway> Map1; - typedef boost::adjacency_matrix<boost::directedS, - City, Highway> Map2; - - test_bundled_properties(static_cast<Map1*>(0), truth<true>()); - test_bundled_properties(static_cast<Map2*>(0), truth<false>()); - test_subgraph_bundled_properties(); - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/copy.cpp b/Utilities/BGL/boost/graph/test/copy.cpp deleted file mode 100644 index a4ba54926c95774855acb355a01dbf5136b2f506..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/copy.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) Vladimir Prus 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/copy.hpp> - -using namespace boost; - -class copier { -public: - template<class V1, class V2> - void operator()(const V1&, const V2&) const {} -}; - -int main() -{ - adjacency_list<vecS, vecS, directedS, property<vertex_root_t, int> > g1, g2; - adjacency_list<vecS, setS, directedS, property<vertex_index_t, int> > g3; - - copy_graph(g1, g2); - copier c; - copy_graph(g3, g1, vertex_copy(c)); -} diff --git a/Utilities/BGL/boost/graph/test/cuthill_mckee_ordering.cpp b/Utilities/BGL/boost/graph/test/cuthill_mckee_ordering.cpp deleted file mode 100644 index 9812077fcf9bfde4b423ea0daa1823339c25da95..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/cuthill_mckee_ordering.cpp +++ /dev/null @@ -1,146 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// Doug Gregor, D. Kevin McGrath -// -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. -//======================================================================= - -#include <boost/config.hpp> -#include <vector> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/cuthill_mckee_ordering.hpp> -#include <boost/graph/properties.hpp> -#include <boost/graph/bandwidth.hpp> - -/* - Sample Output - original bandwidth: 8 - Reverse Cuthill-McKee ordering starting at: 6 - 8 3 0 9 2 5 1 4 7 6 - bandwidth: 4 - Reverse Cuthill-McKee ordering starting at: 0 - 9 1 4 6 7 2 8 5 3 0 - bandwidth: 4 - Reverse Cuthill-McKee ordering: - 0 8 5 7 3 6 4 2 1 9 - bandwidth: 4 - */ -int main(int , char* []) -{ - using namespace boost; - using namespace std; - typedef adjacency_list<vecS, vecS, undirectedS, - property<vertex_color_t, default_color_type, - property<vertex_degree_t,int> > > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::vertices_size_type size_type; - - typedef std::pair<std::size_t, std::size_t> Pair; - Pair edges[14] = { Pair(0,3), //a-d - Pair(0,5), //a-f - Pair(1,2), //b-c - Pair(1,4), //b-e - Pair(1,6), //b-g - Pair(1,9), //b-j - Pair(2,3), //c-d - Pair(2,4), //c-e - Pair(3,5), //d-f - Pair(3,8), //d-i - Pair(4,6), //e-g - Pair(5,6), //f-g - Pair(5,7), //f-h - Pair(6,7) }; //g-h - - Graph G(10); - for (int i = 0; i < 14; ++i) - add_edge(edges[i].first, edges[i].second, G); - - graph_traits<Graph>::vertex_iterator ui, ui_end; - - property_map<Graph,vertex_degree_t>::type deg = get(vertex_degree, G); - for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) - deg[*ui] = degree(*ui, G); - - property_map<Graph, vertex_index_t>::type - index_map = get(vertex_index, G); - - std::cout << "original bandwidth: " << bandwidth(G) << std::endl; - - std::vector<Vertex> inv_perm(num_vertices(G)); - std::vector<size_type> perm(num_vertices(G)); - { - Vertex s = vertex(6, G); - //reverse cuthill_mckee_ordering - cuthill_mckee_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G)); - cout << "Reverse Cuthill-McKee ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i = inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - { - Vertex s = vertex(0, G); - //reverse cuthill_mckee_ordering - cuthill_mckee_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G)); - cout << "Reverse Cuthill-McKee ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - - { - //reverse cuthill_mckee_ordering - cuthill_mckee_ordering(G, inv_perm.rbegin()); - - cout << "Reverse Cuthill-McKee ordering:" << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/dag_longest_paths.cpp b/Utilities/BGL/boost/graph/test/dag_longest_paths.cpp deleted file mode 100644 index b3d01ef75941aec224e35eb8c3c45c3f67ff8736..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/dag_longest_paths.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/dag_shortest_paths.hpp> -#include <boost/vector_property_map.hpp> -#include <boost/test/minimal.hpp> - -using namespace boost; - -#include <iostream> -using namespace std; - -int test_main(int, char*[]) -{ - typedef adjacency_list<vecS, vecS, directedS, no_property, - property<edge_weight_t, int> > Graph; - - Graph graph; - Graph::vertex_descriptor v1, v2, v3, v4; - - v1 = add_vertex(graph); - v2 = add_vertex(graph); - v3 = add_vertex(graph); - v4 = add_vertex(graph); - - Graph::edge_descriptor e; - - e = add_edge(0, 1, graph).first; - put(edge_weight, graph, e, 1); - - e = add_edge(1, 2, graph).first; - put(edge_weight, graph, e, 1); - - e = add_edge(3, 1, graph).first; - put(edge_weight, graph, e, 5); - - vector_property_map<int> distance; - - dag_shortest_paths(graph, 0, - distance_map(distance) - .distance_compare(std::greater<int>()) - .distance_inf((std::numeric_limits<int>::min)()) - .distance_zero(0)); - - cout << distance[2] << "\n"; - - BOOST_CHECK(distance[2] == 2); - - return 0; -} - - - diff --git a/Utilities/BGL/boost/graph/test/dfs.cpp b/Utilities/BGL/boost/graph/test/dfs.cpp deleted file mode 100644 index 4750b1afacdf4550e3f7a79879ac3a65a8c40655..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/dfs.cpp +++ /dev/null @@ -1,171 +0,0 @@ -//======================================================================= -// Copyright 2001 University of Notre Dame. -// Author: 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) -//======================================================================= - -#include <boost/config.hpp> -#include <boost/test/minimal.hpp> -#include <stdlib.h> - -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/random.hpp> - -#include <boost/random/mersenne_twister.hpp> - -template <typename ColorMap, typename ParentMap, - typename DiscoverTimeMap, typename FinishTimeMap> -class dfs_test_visitor { - typedef typename boost::property_traits<ColorMap>::value_type ColorValue; - typedef typename boost::color_traits<ColorValue> Color; -public: - dfs_test_visitor(ColorMap color, ParentMap p, DiscoverTimeMap d, - FinishTimeMap f) - : m_color(color), m_parent(p), - m_discover_time(d), m_finish_time(f), m_time(0) { } - - template <class Vertex, class Graph> - void initialize_vertex(Vertex u, Graph& g) { - BOOST_CHECK( boost::get(m_color, u) == Color::white() ); - } - template <class Vertex, class Graph> - void start_vertex(Vertex u, Graph& g) { - BOOST_CHECK( boost::get(m_color, u) == Color::white() ); - } - template <class Vertex, class Graph> - void discover_vertex(Vertex u, Graph& g) { - using namespace boost; - BOOST_CHECK( get(m_color, u) == Color::gray() ); - BOOST_CHECK( get(m_color, get(m_parent, u)) == Color::gray() ); - - put(m_discover_time, u, m_time++); - } - template <class Edge, class Graph> - void examine_edge(Edge e, Graph& g) { - using namespace boost; - BOOST_CHECK( get(m_color, source(e, g)) == Color::gray() ); - } - template <class Edge, class Graph> - void tree_edge(Edge e, Graph& g) { - using namespace boost; - BOOST_CHECK( get(m_color, target(e, g)) == Color::white() ); - - put(m_parent, target(e, g), source(e, g)); - } - template <class Edge, class Graph> - void back_edge(Edge e, Graph& g) { - using namespace boost; - BOOST_CHECK( get(m_color, target(e, g)) == Color::gray() ); - } - template <class Edge, class Graph> - void forward_or_cross_edge(Edge e, Graph& g) { - using namespace boost; - BOOST_CHECK( get(m_color, target(e, g)) == Color::black() ); - } - template <class Vertex, class Graph> - void finish_vertex(Vertex u, Graph& g) { - using namespace boost; - BOOST_CHECK( get(m_color, u) == Color::black() ); - - put(m_finish_time, u, m_time++); - } -private: - ColorMap m_color; - ParentMap m_parent; - DiscoverTimeMap m_discover_time; - FinishTimeMap m_finish_time; - typename boost::property_traits<DiscoverTimeMap>::value_type m_time; -}; - -template <typename Graph> -struct dfs_test -{ - typedef boost::graph_traits<Graph> Traits; - typedef typename Traits::vertices_size_type - vertices_size_type; - - static void go(vertices_size_type max_V) { - using namespace boost; - typedef typename Traits::vertex_descriptor vertex_descriptor; - typedef typename boost::property_map<Graph, - boost::vertex_color_t>::type ColorMap; - typedef typename boost::property_traits<ColorMap>::value_type ColorValue; - typedef typename boost::color_traits<ColorValue> Color; - - vertices_size_type i, k; - typename Traits::edges_size_type j; - typename Traits::vertex_iterator vi, vi_end, ui, ui_end; - - boost::mt19937 gen; - - for (i = 0; i < max_V; ++i) - for (j = 0; j < i*i; ++j) { - Graph g; - generate_random_graph(g, i, j, gen); - - ColorMap color = get(boost::vertex_color, g); - std::vector<vertex_descriptor> parent(num_vertices(g)); - for (k = 0; k < num_vertices(g); ++k) - parent[k] = k; - std::vector<int> discover_time(num_vertices(g)), - finish_time(num_vertices(g)); - - dfs_test_visitor<ColorMap, vertex_descriptor*, - int*, int*> vis(color, &parent[0], - &discover_time[0], &finish_time[0]); - - boost::depth_first_search(g, visitor(vis).color_map(color)); - - // all vertices should be black - for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - BOOST_CHECK(get(color, *vi) == Color::black()); - - // check parenthesis structure of discover/finish times - // See CLR p.480 - for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) - for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - vertex_descriptor u = *ui, v = *vi; - if (u != v) { - BOOST_CHECK( finish_time[u] < discover_time[v] - || finish_time[v] < discover_time[u] - || (discover_time[v] < discover_time[u] - && finish_time[u] < finish_time[v] - && boost::is_descendant(u, v, &parent[0])) - || (discover_time[u] < discover_time[v] - && finish_time[v] < finish_time[u] - && boost::is_descendant(v, u, &parent[0])) - ); - } - } - } - - } -}; - - -// usage: dfs.exe [max-vertices=15] - -int test_main(int argc, char* argv[]) -{ - int max_V = 7; - if (argc > 1) - max_V = atoi(argv[1]); - - // Test directed graphs. - dfs_test< boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, - boost::property<boost::vertex_color_t, boost::default_color_type> > - >::go(max_V); - // Test undirected graphs. - dfs_test< boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, - boost::property<boost::vertex_color_t, boost::default_color_type> > - >::go(max_V); - - return 0; -} - diff --git a/Utilities/BGL/boost/graph/test/dfs_cc.cpp b/Utilities/BGL/boost/graph/test/dfs_cc.cpp deleted file mode 100644 index b41f2f67ead4a4e2b85ef317171d8a42036fea1b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/dfs_cc.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <boost/concept_archetype.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/graph_archetypes.hpp> - -int main() -{ - using namespace boost; - typedef default_constructible_archetype< - sgi_assignable_archetype< - equality_comparable_archetype<> > > vertex_t; - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> graph_t; - graph_t& g = static_object<graph_t>::get(); - read_write_property_map_archetype<vertex_t, color_value_archetype> color; - depth_first_search(g, color_map(color)); - } - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> graph_t; - graph_t& g = static_object<graph_t>::get(); - readable_property_map_archetype<vertex_t, std::size_t> v_index; - depth_first_search(g, vertex_index_map(v_index)); - } - { - typedef incidence_graph_archetype<vertex_t, undirected_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, undirected_tag, - allow_parallel_edge_tag, IncidenceGraph> Graph; - typedef property_graph_archetype<Graph, vertex_index_t, std::size_t> - graph_t; - graph_t& g = static_object<graph_t>::get(); - dfs_visitor<> v; - depth_first_search(g, visitor(v)); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/dijkstra_cc.cpp b/Utilities/BGL/boost/graph/test/dijkstra_cc.cpp deleted file mode 100644 index 59638387dd2e8b7a42e4b48b944adea978d7a1fb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/dijkstra_cc.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <boost/config.hpp> -#include <boost/concept_archetype.hpp> -#include <boost/graph/dijkstra_shortest_paths.hpp> -#include <boost/graph/graph_archetypes.hpp> - -typedef boost::default_constructible_archetype< - boost::sgi_assignable_archetype<> > dist_value; - -// So generate_infinity works... -namespace std { - template <> - class numeric_limits<dist_value> { - public: - static dist_value max BOOST_PREVENT_MACRO_SUBSTITUTION () { - return boost::static_object<dist_value>::get(); - } - }; -} - -dist_value abs(const dist_value& x) { return x; } -std::size_t abs(std::size_t x) { return x; } - -int main() -{ - using namespace boost; - typedef default_constructible_archetype< - sgi_assignable_archetype< - equality_comparable_archetype<> > > vertex_t; - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> graph_t; - graph_t& g = static_object<graph_t>::get(); - vertex_t s; - typedef graph_traits<graph_t>::edge_descriptor edge_t; - readable_property_map_archetype<edge_t, std::size_t> weight; - readable_property_map_archetype<vertex_t, int> index; - read_write_property_map_archetype<vertex_t, std::size_t> distance; - dijkstra_shortest_paths(g, s, - vertex_index_map(index). - weight_map(weight). - distance_map(distance)); - } - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> Graph; - vertex_t s; - typedef graph_traits<Graph>::edge_descriptor edge_t; - readable_property_map_archetype<edge_t, std::size_t> weight; - typedef property_graph_archetype<Graph, vertex_index_t, std::size_t> - graph_t; - graph_t& g = static_object<graph_t>::get(); - read_write_property_map_archetype<vertex_t, vertex_t> pred; - dijkstra_shortest_paths(g, s, - predecessor_map(pred). - weight_map(weight)); - } - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> Graph; - vertex_t s; - typedef property_graph_archetype<Graph, edge_weight_t, std::size_t> - graph_t; - graph_t& g = static_object<graph_t>::get(); - read_write_property_map_archetype<vertex_t, vertex_t> pred; - readable_property_map_archetype<vertex_t, int> index; - dijkstra_shortest_paths(g, s, - predecessor_map(pred). - vertex_index_map(index)); - } - { - typedef incidence_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag> IncidenceGraph; - typedef vertex_list_graph_archetype<vertex_t, directed_tag, - allow_parallel_edge_tag, IncidenceGraph> graph_t; - graph_t& g = static_object<graph_t>::get(); - vertex_t s; - typedef graph_traits<graph_t>::edge_descriptor edge_t; - readable_property_map_archetype<edge_t, dist_value> weight; - readable_property_map_archetype<vertex_t, int> index; - read_write_property_map_archetype<vertex_t, color_value_archetype> color; - read_write_property_map_archetype<vertex_t, dist_value> distance; - typedef binary_function_archetype<dist_value, dist_value, dist_value> - Combine; - Combine combine = static_object<Combine>::get(); - typedef binary_predicate_archetype<dist_value, dist_value> - Compare; - Compare compare = static_object<Compare>::get(); - dijkstra_visitor<> vis; - - dijkstra_shortest_paths(g, s, color_map(color). - vertex_index_map(index). - weight_map(weight). - distance_map(distance). - distance_combine(combine). - distance_compare(compare). - visitor(vis)); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/dijkstra_heap_performance.cpp b/Utilities/BGL/boost/graph/test/dijkstra_heap_performance.cpp deleted file mode 100644 index 91e67b5f0c2eda436acbda855ca73c36e95719e1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/dijkstra_heap_performance.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// 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 -// Andrew Lumsdaine -#ifndef BOOST_GRAPH_DIJKSTRA_TESTING_DIETMAR -# define BOOST_GRAPH_DIJKSTRA_TESTING -#endif - -#include <boost/graph/dijkstra_shortest_paths.hpp> -#include <boost/test/minimal.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/random/linear_congruential.hpp> -#include <boost/lexical_cast.hpp> -#include <boost/random/uniform_real.hpp> -#include <boost/timer.hpp> -#include <vector> -#include <iostream> - -#include <iterator> -#include <utility> -#include <boost/random/uniform_int.hpp> -#include <boost/graph/graph_traits.hpp> -#include <boost/type_traits/is_base_and_derived.hpp> -#include <boost/type_traits/is_same.hpp> - -namespace boost { - - template<typename RandomGenerator, typename Graph> - class erdos_renyi_iterator - { - typedef typename graph_traits<Graph>::directed_category directed_category; - typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; - typedef typename graph_traits<Graph>::edges_size_type edges_size_type; - - BOOST_STATIC_CONSTANT - (bool, - is_undirected = (is_base_and_derived<undirected_tag, - directed_category>::value - || is_same<undirected_tag, directed_category>::value)); - - public: - typedef std::input_iterator_tag iterator_category; - typedef std::pair<vertices_size_type, vertices_size_type> value_type; - typedef const value_type& reference; - typedef const value_type* pointer; - typedef void difference_type; - - erdos_renyi_iterator() : gen(0), n(0), edges(0), allow_self_loops(false) {} - erdos_renyi_iterator(RandomGenerator& gen, vertices_size_type n, - double prob = 0.0, bool allow_self_loops = false) - : gen(&gen), n(n), edges(edges_size_type(prob * n * n)), - allow_self_loops(allow_self_loops) - { - if (is_undirected) edges = edges / 2; - next(); - } - - reference operator*() const { return current; } - pointer operator->() const { return ¤t; } - - erdos_renyi_iterator& operator++() - { - --edges; - next(); - return *this; - } - - erdos_renyi_iterator operator++(int) - { - erdos_renyi_iterator temp(*this); - ++(*this); - return temp; - } - - bool operator==(const erdos_renyi_iterator& other) const - { return edges == other.edges; } - - bool operator!=(const erdos_renyi_iterator& other) const - { return !(*this == other); } - - private: - void next() - { - uniform_int<vertices_size_type> rand_vertex(0, n-1); - current.first = rand_vertex(*gen); - do { - current.second = rand_vertex(*gen); - } while (current.first == current.second && !allow_self_loops); - } - - RandomGenerator* gen; - vertices_size_type n; - edges_size_type edges; - bool allow_self_loops; - value_type current; - }; - -} // end namespace boost - -using namespace boost; - -#ifdef BOOST_GRAPH_DIJKSTRA_TESTING_DIETMAR - -struct show_events_visitor : dijkstra_visitor<> -{ - template<typename Vertex, typename Graph> - void discover_vertex(Vertex v, const Graph&) - { - std::cerr << "on_discover_vertex(" << v << ")\n"; - } - - template<typename Vertex, typename Graph> - void examine_vertex(Vertex v, const Graph&) - { - std::cerr << "on_discover_vertex(" << v << ")\n"; - } -}; - - -template<typename Graph, typename Kind> -void run_test(const Graph& g, const char* name, Kind kind, - const std::vector<double>& correct_distances) -{ - std::vector<double> distances(num_vertices(g)); - - std::cout << "Running Dijkstra's with " << name << "..."; - std::cout.flush(); - timer t; - dijkstra_heap_kind = kind; - - dijkstra_shortest_paths(g, vertex(0, g), - distance_map(&distances[0]). - visitor(show_events_visitor())); - double run_time = t.elapsed(); - std::cout << run_time << " seconds.\n"; - - BOOST_TEST(distances == correct_distances); - - if (distances != correct_distances) - { - std::cout << "Expected: "; - std::copy(correct_distances.begin(), correct_distances.end(), - std::ostream_iterator<double>(std::cout, " ")); - std::cout << "\nReceived: "; - std::copy(distances.begin(), distances.end(), - std::ostream_iterator<double>(std::cout, " ")); - std::cout << std::endl; - } -} -#endif - -int test_main(int argc, char* argv[]) -{ - unsigned n = (argc > 1? lexical_cast<unsigned>(argv[1]) : 10000u); - unsigned m = (argc > 2? lexical_cast<unsigned>(argv[2]) : 10*n); - int seed = (argc > 3? lexical_cast<int>(argv[3]) : 1); - - // Build random graph - typedef adjacency_list<vecS, vecS, directedS, no_property, - property<edge_weight_t, double> > Graph; - std::cout << "Generating graph..."; - std::cout.flush(); - minstd_rand gen(seed); - double p = double(m)/(double(n)*double(n)); - Graph g(erdos_renyi_iterator<minstd_rand, Graph>(gen, n, p), - erdos_renyi_iterator<minstd_rand, Graph>(), - n); - std::cout << n << " vertices, " << num_edges(g) << " edges.\n"; - uniform_real<double> rand01(0.0, 1.0); - graph_traits<Graph>::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) - put(edge_weight, g, *ei, rand01(gen)); - - std::vector<double> binary_heap_distances(n); - std::vector<double> relaxed_heap_distances(n); - - // Run binary heap version - std::cout << "Running Dijkstra's with binary heap..."; - std::cout.flush(); - timer t; -#ifdef BOOST_GRAPH_DIJKSTRA_TESTING_DIETMAR - dijkstra_heap_kind = dijkstra_binary_heap; -#else - dijkstra_relaxed_heap = false; -#endif - dijkstra_shortest_paths(g, vertex(0, g), - distance_map(&binary_heap_distances[0])); - double binary_heap_time = t.elapsed(); - std::cout << binary_heap_time << " seconds.\n"; - - // Run relaxed heap version - std::cout << "Running Dijkstra's with relaxed heap..."; - std::cout.flush(); - t.restart(); -#ifdef BOOST_GRAPH_DIJKSTRA_TESTING_DIETMAR - dijkstra_heap_kind = dijkstra_relaxed_heap; -#else - dijkstra_relaxed_heap = true; -#endif - dijkstra_shortest_paths(g, vertex(0, g), - distance_map(&relaxed_heap_distances[0])); - double relaxed_heap_time = t.elapsed(); - std::cout << relaxed_heap_time << " seconds.\n" - << "Speedup = " << (binary_heap_time / relaxed_heap_time) << ".\n"; - - // Verify that the results are equivalent - BOOST_CHECK(binary_heap_distances == relaxed_heap_distances); - -#ifdef BOOST_GRAPH_DIJKSTRA_TESTING_DIETMAR - run_test(g, "d-ary heap (d=2)", dijkstra_d_heap_2, binary_heap_distances); - run_test(g, "d-ary heap (d=3)", dijkstra_d_heap_3, binary_heap_distances); - run_test(g, "Fibonacci heap", dijkstra_fibonacci_heap, binary_heap_distances); - run_test(g, "Lazy Fibonacci heap", dijkstra_lazy_fibonacci_heap, binary_heap_distances); - run_test(g, "Pairing heap", dijkstra_pairing_heap, binary_heap_distances); - run_test(g, "Splay heap", dijkstra_splay_heap, binary_heap_distances); -#endif - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/edge_list_cc.cpp b/Utilities/BGL/boost/graph/test/edge_list_cc.cpp deleted file mode 100644 index 0741cceac35b2b9458967f782cf68fb1d36ea628..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/edge_list_cc.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/edge_list.hpp> -#include <cstddef> -#include <iterator> - -int main(int,char*[]) -{ - // Check edge_list - { - using namespace boost; - - typedef std::pair<int,int> E; - - typedef edge_list<E*,E,std::ptrdiff_t,std::random_access_iterator_tag> EdgeList; - - typedef graph_traits<EdgeList>::edge_descriptor Edge; - - function_requires< EdgeListGraphConcept<EdgeList> >(); - - function_requires< ReadablePropertyGraphConcept<EdgeList, Edge, - edge_index_t> >(); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/filter_graph_vp_test.cpp b/Utilities/BGL/boost/graph/test/filter_graph_vp_test.cpp deleted file mode 100644 index 9b8535ba5c266cf8f5b91d08559e7e1c40da9abf..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/filter_graph_vp_test.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <boost/graph/filtered_graph.hpp> -#include <boost/graph/adjacency_list.hpp> -using namespace boost; - -// Check to make you can apply a vertex filter with the -// make_filtered_graph function, to fix bug #480175. - -struct NotMuchOfAFilter -{ - template<class Vertex> bool operator()(Vertex key) - const { return true; } -}; - -int main() -{ - adjacency_list<> graph; - make_filtered_graph(graph, keep_all(), NotMuchOfAFilter()); -} diff --git a/Utilities/BGL/boost/graph/test/filtered_graph_cc.cpp b/Utilities/BGL/boost/graph/test/filtered_graph_cc.cpp deleted file mode 100644 index 09feb4b004a044d93f66caad1f31a8728c1e44a9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/filtered_graph_cc.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/filtered_graph.hpp> - -int main(int,char*[]) -{ - using namespace boost; - // Check filtered_graph - { - typedef adjacency_list<vecS, vecS, directedS, - no_property, property<edge_residual_capacity_t, long> > Graph; - typedef property_map<Graph, edge_residual_capacity_t>::type ResCapMap; - typedef filtered_graph<Graph, is_residual_edge<ResCapMap> > ResGraph; - typedef graph_traits<ResGraph>::edge_descriptor Edge; - - function_requires< VertexListGraphConcept<ResGraph> >(); - function_requires< EdgeListGraphConcept<ResGraph> >(); - function_requires< IncidenceGraphConcept<ResGraph> >(); - function_requires< AdjacencyGraphConcept<ResGraph> >(); - function_requires< PropertyGraphConcept<ResGraph, Edge, - edge_residual_capacity_t> >(); - } - // Check filtered_graph with bidirectional adjacency_list - { - typedef adjacency_list<vecS, vecS, bidirectionalS, - no_property, property<edge_residual_capacity_t, long> > Graph; - typedef property_map<Graph, edge_residual_capacity_t>::type ResCapMap; - typedef filtered_graph<Graph, is_residual_edge<ResCapMap> > ResGraph; - function_requires< BidirectionalGraphConcept<ResGraph> >(); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/floyd_warshall_test.cpp b/Utilities/BGL/boost/graph/test/floyd_warshall_test.cpp deleted file mode 100644 index 14f96a759b2d1a07ddff67253ef4af68b40f72e3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/floyd_warshall_test.cpp +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright 2002 Rensselaer Polytechnic Institute - -// 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: Lauren Foutz -// Scott Hill -#include <boost/graph/floyd_warshall_shortest.hpp> -#include <map> -#include <algorithm> -#include <iostream> -#include <boost/random/linear_congruential.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/properties.hpp> -#include <boost/graph/bellman_ford_shortest_paths.hpp> -#include <boost/graph/random.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/adjacency_matrix.hpp> -#include <boost/test/minimal.hpp> -#include <algorithm> -using namespace boost; - -template <typename T> -struct inf_plus{ - T operator()(const T& a, const T& b) const { - T inf = std::numeric_limits<T>::max BOOST_PREVENT_MACRO_SUBSTITUTION(); - if (a == inf || b == inf){ - return inf; - } - return a + b; - } -}; - -template<typename T> -inline const T& my_min(const T& x, const T& y) -{ return x < y? x : y; } - -template<typename Graph> -bool acceptance_test(Graph& g, int vec, int e) -{ - boost::minstd_rand ran(vec); - - { - typename boost::property_map<Graph, boost::vertex_name_t>::type index = - boost::get(boost::vertex_name, g); - typename boost::graph_traits<Graph>::vertex_iterator firstv, lastv, - firstv2, lastv2; - int x = 0; - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - boost::put(index, *firstv, x); - x++; - } - - - for(int i = 0; i < e; i++){ - boost::add_edge(index[ran() % vec], index[ran() % vec], g); - } - - - typename boost::graph_traits<Graph>::edge_iterator first, last; - typename boost::property_map<Graph, boost::edge_weight_t>::type - local_edge_map = boost::get(boost::edge_weight, g); - for(boost::tie(first, last) = boost::edges(g); first != last; first++){ - if (ran() % vec != 0){ - boost::put(local_edge_map, *first, ran() % 100); - } else { - boost::put(local_edge_map, *first, 0 - (ran() % 100)); - } - } - - int int_inf = - std::numeric_limits<int>::max BOOST_PREVENT_MACRO_SUBSTITUTION(); - typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_des; - std::map<vertex_des,int> matrixRow; - std::map<vertex_des, std::map<vertex_des ,int> > matrix; - typedef typename boost::property_map<Graph, boost::vertex_distance_t>::type - distance_type; - distance_type distance_row = boost::get(boost::vertex_distance, g); - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - boost::put(distance_row, *firstv, int_inf); - matrixRow[*firstv] = int_inf; - } - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - matrix[*firstv] = matrixRow; - } - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - matrix[*firstv][*firstv] = 0; - } - std::map<vertex_des, std::map<vertex_des, int> > matrix3(matrix); - std::map<vertex_des, std::map<vertex_des, int> > matrix4(matrix); - for(boost::tie(first, last) = boost::edges(g); first != last; first++){ - if (matrix[boost::source(*first, g)][boost::target(*first, g)] != int_inf) - { - matrix[boost::source(*first, g)][boost::target(*first, g)] = - my_min - (boost::get(local_edge_map, *first), - matrix[boost::source(*first, g)][boost::target(*first, g)]); - } else { - matrix[boost::source(*first, g)][boost::target(*first, g)] = - boost::get(local_edge_map, *first); - } - } - bool is_undirected = - boost::is_same<typename boost::graph_traits<Graph>::directed_category, - boost::undirected_tag>::value; - if (is_undirected){ - for(boost::tie(first, last) = boost::edges(g); first != last; first++){ - if (matrix[boost::target(*first, g)][boost::source(*first, g)] != int_inf) - { - matrix[boost::target(*first, g)][boost::source(*first, g)] = - my_min - (boost::get(local_edge_map, *first), - matrix[boost::target(*first, g)][boost::source(*first, g)]); - } else { - matrix[boost::target(*first, g)][boost::source(*first, g)] = - boost::get(local_edge_map, *first); - } - } - } - - - bool bellman, floyd1, floyd2, floyd3; - std::less<int> compare; - inf_plus<int> combine; - floyd1 = - boost::floyd_warshall_initialized_all_pairs_shortest_paths - (g, - matrix, weight_map(boost::get(boost::edge_weight, g)). - distance_compare(compare). distance_combine(combine). - distance_inf(int_inf). distance_zero(0)); - - floyd2 = - boost::floyd_warshall_all_pairs_shortest_paths - (g, matrix3, - weight_map(local_edge_map). distance_compare(compare). - distance_combine(combine). - distance_inf(int_inf). distance_zero(0)); - - floyd3 = boost::floyd_warshall_all_pairs_shortest_paths(g, matrix4); - - - boost::dummy_property_map dummy_map; - std::map<vertex_des, std::map<vertex_des, int> > matrix2; - for(boost::tie(firstv, lastv) = vertices(g); firstv != lastv; firstv++){ - boost::put(distance_row, *firstv, 0); - bellman = - boost::bellman_ford_shortest_paths - (g, vec, - weight_map(boost::get(boost::edge_weight, g)). - distance_map(boost::get(boost::vertex_distance, g)). - predecessor_map(dummy_map).distance_compare(compare). - distance_combine(combine)); - distance_row = boost::get(boost::vertex_distance, g); - for(boost::tie(firstv2, lastv2) = vertices(g); firstv2 != lastv2; - firstv2++){ - matrix2[*firstv][*firstv2] = boost::get(distance_row, *firstv2); - boost::put(distance_row, *firstv2, int_inf); - } - if(bellman == false){ - break; - } - } - - - if (bellman != floyd1 || bellman != floyd2 || bellman != floyd3){ - std::cout << - "A negative cycle was detected in one algorithm but not the others. " - << std::endl; - return false; - } - else if (bellman == false && floyd1 == false && floyd2 == false && - floyd3 == false){ - return true; - } - else { - typename boost::graph_traits<Graph>::vertex_iterator first1, first2, - last1, last2; - for (boost::tie(first1, last1) = boost::vertices(g); first1 != last1; - first1++){ - for (boost::tie(first2, last2) = boost::vertices(g); first2 != last2; - first2++){ - if (matrix2[*first1][*first2] != matrix[*first1][*first2]){ - std::cout << "Algorithms do not match at matrix point " - << index[*first1] << " " << index[*first2] - << " Bellman results: " << matrix2[*first1][*first2] - << " floyd 1 results " << matrix[*first1][*first2] - << std::endl; - return false; - } - if (matrix2[*first1][*first2] != matrix3[*first1][*first2]){ - std::cout << "Algorithms do not match at matrix point " - << index[*first1] << " " << index[*first2] - << " Bellman results: " << matrix2[*first1][*first2] - << " floyd 2 results " << matrix3[*first1][*first2] - << std::endl; - return false; - } - if (matrix2[*first1][*first2] != matrix4[*first1][*first2]){ - std::cout << "Algorithms do not match at matrix point " - << index[*first1] << " " << index[*first2] - << " Bellman results: " << matrix2[*first1][*first2] - << " floyd 3 results " << matrix4[*first1][*first2] - << std::endl; - return false; - } - } - } - } - - } - return true; -} - -template<typename Graph> -bool acceptance_test2(Graph& g, int vec, int e) -{ - boost::minstd_rand ran(vec); - - { - - typename boost::property_map<Graph, boost::vertex_name_t>::type index = - boost::get(boost::vertex_name, g); - typename boost::graph_traits<Graph>::vertex_iterator firstv, lastv, - firstv2, lastv2; - int x = 0; - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - boost::put(index, *firstv, x); - x++; - } - - boost::generate_random_graph(g, vec, e, ran, true); - - typename boost::graph_traits<Graph>::edge_iterator first, last; - typename boost::property_map<Graph, boost::edge_weight_t>::type - local_edge_map = boost::get(boost::edge_weight, g); - for(boost::tie(first, last) = boost::edges(g); first != last; first++){ - if (ran() % vec != 0){ - boost::put(local_edge_map, *first, ran() % 100); - } else { - boost::put(local_edge_map, *first, 0 - (ran() % 100)); - } - } - - int int_inf = - std::numeric_limits<int>::max BOOST_PREVENT_MACRO_SUBSTITUTION(); - typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_des; - std::map<vertex_des,int> matrixRow; - std::map<vertex_des, std::map<vertex_des ,int> > matrix; - typedef typename boost::property_map<Graph, boost::vertex_distance_t>::type - distance_type; - distance_type distance_row = boost::get(boost::vertex_distance, g); - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - boost::put(distance_row, *firstv, int_inf); - matrixRow[*firstv] = int_inf; - } - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - matrix[*firstv] = matrixRow; - } - for(boost::tie(firstv, lastv) = boost::vertices(g); firstv != lastv; - firstv++){ - matrix[*firstv][*firstv] = 0; - } - std::map<vertex_des, std::map<vertex_des, int> > matrix3(matrix); - std::map<vertex_des, std::map<vertex_des, int> > matrix4(matrix); - for(boost::tie(first, last) = boost::edges(g); first != last; first++){ - if (matrix[boost::source(*first, g)][boost::target(*first, g)] != int_inf) - { - matrix[boost::source(*first, g)][boost::target(*first, g)] = - my_min - (boost::get(local_edge_map, *first), - matrix[boost::source(*first, g)][boost::target(*first, g)]); - } else { - matrix[boost::source(*first, g)][boost::target(*first, g)] = - boost::get(local_edge_map, *first); - } - } - bool is_undirected = - boost::is_same<typename boost::graph_traits<Graph>::directed_category, - boost::undirected_tag>::value; - if (is_undirected){ - for(boost::tie(first, last) = boost::edges(g); first != last; first++){ - if (matrix[boost::target(*first, g)][boost::source(*first, g)] - != int_inf){ - matrix[boost::target(*first, g)][boost::source(*first, g)] = - my_min - (boost::get(local_edge_map, *first), - matrix[boost::target(*first, g)][boost::source(*first, g)]); - } else { - matrix[boost::target(*first, g)][boost::source(*first, g)] = - boost::get(local_edge_map, *first); - } - } - } - - - bool bellman, floyd1, floyd2, floyd3; - std::less<int> compare; - inf_plus<int> combine; - floyd1 = - boost::floyd_warshall_initialized_all_pairs_shortest_paths - (g, - matrix, weight_map(boost::get(boost::edge_weight, g)). - distance_compare(compare). distance_combine(combine). - distance_inf(int_inf). distance_zero(0)); - - floyd2 = - boost::floyd_warshall_all_pairs_shortest_paths - (g, matrix3, - weight_map(local_edge_map). distance_compare(compare). - distance_combine(combine). - distance_inf(int_inf). distance_zero(0)); - - floyd3 = boost::floyd_warshall_all_pairs_shortest_paths(g, matrix4); - - - boost::dummy_property_map dummy_map; - std::map<vertex_des, std::map<vertex_des, int> > matrix2; - for(boost::tie(firstv, lastv) = vertices(g); firstv != lastv; firstv++){ - boost::put(distance_row, *firstv, 0); - bellman = - boost::bellman_ford_shortest_paths - (g, vec, - weight_map(boost::get(boost::edge_weight, g)). - distance_map(boost::get(boost::vertex_distance, g)). - predecessor_map(dummy_map).distance_compare(compare). - distance_combine(combine)); - distance_row = boost::get(boost::vertex_distance, g); - for(boost::tie(firstv2, lastv2) = vertices(g); firstv2 != lastv2; - firstv2++){ - matrix2[*firstv][*firstv2] = boost::get(distance_row, *firstv2); - boost::put(distance_row, *firstv2, int_inf); - } - if(bellman == false){ - break; - } - } - - - if (bellman != floyd1 || bellman != floyd2 || bellman != floyd3){ - std::cout << - "A negative cycle was detected in one algorithm but not the others. " - << std::endl; - return false; - } - else if (bellman == false && floyd1 == false && floyd2 == false && - floyd3 == false){ - return true; - } - else { - typename boost::graph_traits<Graph>::vertex_iterator first1, first2, - last1, last2; - for (boost::tie(first1, last1) = boost::vertices(g); first1 != last1; - first1++){ - for (boost::tie(first2, last2) = boost::vertices(g); first2 != last2; - first2++){ - if (matrix2[*first1][*first2] != matrix[*first1][*first2]){ - std::cout << "Algorithms do not match at matrix point " - << index[*first1] << " " << index[*first2] - << " Bellman results: " << matrix2[*first1][*first2] - << " floyd 1 results " << matrix[*first1][*first2] - << std::endl; - return false; - } - if (matrix2[*first1][*first2] != matrix3[*first1][*first2]){ - std::cout << "Algorithms do not match at matrix point " - << index[*first1] << " " << index[*first2] - << " Bellman results: " << matrix2[*first1][*first2] - << " floyd 2 results " << matrix3[*first1][*first2] - << std::endl; - return false; - } - if (matrix2[*first1][*first2] != matrix4[*first1][*first2]){ - std::cout << "Algorithms do not match at matrix point " - << index[*first1] << " " << index[*first2] - << " Bellman results: " << matrix2[*first1][*first2] - << " floyd 3 results " << matrix4[*first1][*first2] - << std::endl; - return false; - } - } - } - } - - } - return true; -} - -int test_main(int, char*[]) -{ - typedef boost::adjacency_list<boost::listS, boost::listS, boost::directedS, - boost::property<boost::vertex_distance_t, int, - boost::property<boost::vertex_name_t, int> > , - boost::property<boost::edge_weight_t, int> > Digraph; - Digraph adjlist_digraph; - BOOST_CHECK(acceptance_test2(adjlist_digraph, 100, 2000)); - - typedef boost::adjacency_matrix<boost::undirectedS, - boost::property<boost::vertex_distance_t, int, - boost::property<boost::vertex_name_t, int> > , - boost::property<boost::edge_weight_t, int> > Graph; - Graph matrix_graph(100); - BOOST_CHECK(acceptance_test(matrix_graph, 100, 2000)); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/graph.cpp b/Utilities/BGL/boost/graph/test/graph.cpp deleted file mode 100644 index e93956eef466608b5a06fffcffc103e422fe5f07..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/graph.cpp +++ /dev/null @@ -1,481 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <boost/config.hpp> - -#include <iostream> -#include <vector> -#include <set> -#include <utility> -#include <algorithm> - -#define VERBOSE 0 - -#include <boost/utility.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/random.hpp> -#include <boost/pending/indirect_cmp.hpp> - -#include <boost/random/mersenne_twister.hpp> - - -enum vertex_id_t { vertex_id = 500 }; -enum edge_id_t { edge_id = 501 }; -namespace boost { - BOOST_INSTALL_PROPERTY(vertex, id); - BOOST_INSTALL_PROPERTY(edge, id); -} - - -#include "graph_type.hpp" // this provides a typedef for Graph - -using namespace boost; - -/* - This program tests models of the MutableGraph concept. - */ - -using std::cout; -using std::endl; -using std::cerr; -using std::find; - - -template <class Graph, class Vertex, class ID> -bool check_vertex_cleared(Graph& g, Vertex v, ID id) -{ - typename graph_traits<Graph>::vertex_iterator vi, viend; - for (boost::tie(vi,viend) = vertices(g); vi != viend; ++vi) { - typename graph_traits<Graph>::adjacency_iterator ai, aiend, found; - boost::tie(ai, aiend) = adjacent_vertices(*vi, g); - boost::indirect_cmp<ID, std::equal_to<std::size_t> > cmp(id); - -#if (defined(BOOST_MSVC) && BOOST_MSVC <= 1300) && defined(__SGI_STL_PORT) - // seeing internal compiler errors when using std::find_if() - found = aiend; - for ( ; ai != aiend; ++ai) - if (cmp(*ai, v)) { - found = ai; - break; - } -#else - found = std::find_if(ai, aiend, std::bind1st(cmp,v)); -#endif - - if ( found != aiend ) { -#if VERBOSE - std::cerr << "should not have found vertex " << id[*found] << std::endl; -#endif - return false; - } - } - return true; -} - -template <class Graph, class Edge, class EdgeID> -bool check_edge_added(Graph& g, Edge e, - typename graph_traits<Graph>::vertex_descriptor a, - typename graph_traits<Graph>::vertex_descriptor b, - EdgeID edge_id, std::size_t correct_id, - bool inserted) -{ - if (! (source(e, g) == a)) { -#if VERBOSE - cerr << " Failed, vertex a not source of e."<< endl; -#endif - return false; - } else if (! (target(e, g) == b)) { -#if VERBOSE - cerr << " Failed, vertex b not source of e."<< endl; -#endif - return false; - } else if (! is_adjacent(g, a, b)) { -#if VERBOSE - cerr << " Failed, not adj."<< endl; -#endif - return false; - } else if (! in_edge_set(g,e)) { -#if VERBOSE - cerr << " Failed, not in edge set."<< endl; -#endif - return false; - } else if (inserted && edge_id[e] != correct_id) { -#if VERBOSE - cerr << " Failed, invalid edge property."<< endl; -#endif - return false; - } else if (!inserted && edge_id[e] != edge_id[edge(a, b, g).first]) { -#if VERBOSE - cerr << " Failed, invalid edge property."<< endl; -#endif - return false; - } else if (num_edges(g) != count_edges(g)) { -#if VERBOSE - cerr << " Failed, invalid number of edges."<< endl; -#endif - return false; - } - return true; -} - - -template <class Graph> -std::size_t count_edges(Graph& g) -{ - std::size_t e = 0; - typename boost::graph_traits<Graph>::edge_iterator ei,ei_end; - for (boost::tie(ei,ei_end) = edges(g); ei != ei_end; ++ei) - ++e; - return e; -} - - -int main(int, char* []) -{ - int ret = 0; - std::size_t N = 5, E = 0; - std::size_t old_N; - - Graph g; - typedef boost::graph_traits<Graph>::vertex_descriptor Vertex; - typedef boost::graph_traits<Graph>::edge_descriptor Edge; - - int i, j; - std::size_t current_vertex_id = 0; - std::size_t current_edge_id = 0; - - bool is_failed = false; - - property_map<Graph, vertex_id_t>::type vertex_id_map = get(vertex_id, g); - - property_map<Graph, edge_id_t>::type edge_id_map = get(edge_id, g); - - for (std::size_t k = 0; k < N; ++k) - add_vertex(current_vertex_id++, g); - - // also need to test EdgeIterator graph constructor -JGS - mt19937 gen; - - for (j=0; j < 10; ++j) { - - // add_edge -#if VERBOSE - cerr << "Testing add_edge ..." << endl; -#endif - for (i=0; i < 6; ++i) { - Vertex a, b; - a = random_vertex(g, gen); - do { - b = random_vertex(g, gen); - } while ( a == b ); // don't do self edges -#if VERBOSE - cerr << "add_edge(" << vertex_id_map[a] << "," << vertex_id_map[b] <<")" << endl; -#endif - Edge e; - bool inserted; - boost::tie(e, inserted) = add_edge(a, b, current_edge_id++, g); -#if VERBOSE - std::cout << "inserted: " << inserted << std::endl; - std::cout << "source(e,g)" << source(e,g) << endl; - std::cout << "target(e,g)" << target(e,g) << endl; - std::cout << "edge_id[e] = " << edge_id_map[e] << std::endl; - print_edges2(g, vertex_id_map, edge_id_map); - print_graph(g, vertex_id_map); - std::cout << "finished printing" << std::endl; - // print_in_edges(g, vertex_id_map); -#endif - if (! check_edge_added(g, e, a, b, edge_id_map, - current_edge_id - 1, inserted)) { - ret = -1; - break; - } - ++E; - } - - // remove_edge(u, v, g) -#if VERBOSE - cerr << "Testing remove_edge(u, v, g) ..." << endl; is_failed = false; -#endif - for (i = 0; i < 2; ++i) { -#if VERBOSE - print_edges(g, vertex_id_map); -#endif - Vertex a, b; - - Edge e = random_edge(g, gen); - boost::tie(a,b) = boost::incident(e, g); - --E; -#if VERBOSE - cerr << "remove_edge(" << vertex_id_map[a] << "," << vertex_id_map[b] << ")" << endl; -#endif - remove_edge(a, b, g); -#if VERBOSE - print_graph(g, vertex_id_map); - // print_in_edges(g, vertex_id_map); - print_edges(g, vertex_id_map); -#endif - is_failed = is_failed || is_adjacent(g, a, b) || in_edge_set(g, a, b) - || num_edges(g) != count_edges(g); - if (is_failed) - break; - } - if ( is_failed ) { - ret = -1; -#if VERBOSE - cerr << " Failed."<< endl; -#endif - } else { -#if VERBOSE - cerr << " Passed."<< endl; -#endif - } - - // remove_edge(e, g) -#if VERBOSE - cerr << "Testing remove_edge(e, g) ..." << endl; is_failed = false; -#endif - for (i = 0; i < 2; ++i) { -#if VERBOSE - print_edges(g, vertex_id_map); -#endif - Vertex a, b; - Edge e = random_edge(g, gen); - boost::tie(a,b) = boost::incident(e, g); - --E; -#if VERBOSE - cerr << "remove_edge(" << vertex_id_map[a] << "," << vertex_id_map[b] << ")" << endl; -#endif - graph_traits<Graph>::edges_size_type old_E = num_edges(g); - remove_edge(e, g); - -#if VERBOSE - print_graph(g, vertex_id_map); - // print_in_edges(g, vertex_id_map); - print_edges(g, vertex_id_map); -#endif - - is_failed = is_failed || old_E != num_edges(g) + 1 - || num_edges(g) != count_edges(g); - if (is_failed) - break; - } - if ( is_failed ) { - ret = -1; -#if VERBOSE - cerr << " Failed."<< endl; -#endif - } else { -#if VERBOSE - cerr << " Passed."<< endl; -#endif - } - - // add_vertex -#if VERBOSE - cerr << "Testing add_vertex ..." << endl; is_failed = false; -#endif - old_N = num_vertices(g); - graph_traits<Graph>::vertex_descriptor vid = add_vertex(g), - vidp1 = add_vertex(g); - vertex_id_map[vid] = current_vertex_id++; - vertex_id_map[vidp1] = current_vertex_id++; - -#if VERBOSE - print_vertices(g,vertex_id_map); - print_graph(g,vertex_id_map); - // print_in_edges(g,vertex_id_map); - print_edges(g,vertex_id_map); -#endif - // make sure the two added vertices are in the graph's vertex set - { - if (!in_vertex_set(g, vid)) { -#if VERBOSE - cerr << " Failed, " << vertex_id_map[vid] << " not in vertices(g)" << endl; -#endif - ret = -1; - break; - } - if (!in_vertex_set(g, vidp1)) { -#if VERBOSE - cerr << " Failed, " << vertex_id_map[vidp1] << " not in vertices(g)" << endl; -#endif - ret = -1; - break; - } - } - - // make sure the vertices do not have any out edges yet - { - graph_traits<Graph>::out_edge_iterator e, e_end; - boost::tie(e,e_end) = out_edges(vid,g); - if (e != e_end) { -#if VERBOSE - cerr << " Failed, " << vertex_id_map[vid] - << " should not have any out-edges yet" << endl; -#endif - ret = -1; - break; - } - boost::tie(e,e_end) = out_edges(vidp1,g); - if (e != e_end) { -#if VERBOSE - cerr << " Failed, " << vertex_id_map[vidp1] - << " should not have any out-edges yet" << endl; -#endif - ret = -1; - break; - } - } - - // make sure the vertices do not yet appear in any of the edges - { - graph_traits<Graph>::edge_iterator e, e_end; - for (boost::tie(e, e_end) = edges(g); e != e_end; ++e) { - if (source(*e,g) == vid || target(*e,g) == vid) { -#if VERBOSE - cerr << " Failed, " << vertex_id_map[vid] - << " should not have any edges" << endl; -#endif - ret = -1; - break; - } - if (source(*e,g) == vidp1 || target(*e,g) == vidp1) { -#if VERBOSE - cerr << " Failed, " << vertex_id_map[vidp1] - << " should not have any edges" << endl; -#endif - ret = -1; - break; - } - } - } - // Make sure num_vertices(g) has been updated - N = num_vertices(g); - if ( (N - 2) != old_N ) { - ret = -1; -#if VERBOSE - cerr << " Failed. N = " << N - << " but should be " << old_N + 2 << endl; -#endif - break; - } else { -#if VERBOSE - cerr << " Passed."<< endl; -#endif - } - // add_edge again -#if VERBOSE - cerr << "Testing add_edge after add_vertex ..." << endl; is_failed = false; -#endif - - for (i=0; i<2; ++i) { - Vertex a = random_vertex(g, gen), b = random_vertex(g, gen); - while ( a == vid ) a = random_vertex(g, gen); - while ( b == vidp1 ) b = random_vertex(g, gen); - Edge e; - bool inserted; -#if VERBOSE - cerr << "add_edge(" << vertex_id_map[vid] << "," << vertex_id_map[a] <<")" << endl; -#endif - boost::tie(e,inserted) = add_edge(vid, a, EdgeID(current_edge_id++), g); - - if (! check_edge_added(g, e, vid, a, edge_id_map, current_edge_id - 1, - inserted)) { - ret = -1; - break; - } - -#if VERBOSE - cerr << "add_edge(" << vertex_id_map[b] << "," << vertex_id_map[vidp1] <<")" << endl; -#endif - // add_edge without plugin - boost::tie(e,inserted) = add_edge(b, vidp1, g); - if (inserted) - edge_id_map[e] = current_edge_id; - ++current_edge_id; - - if (! check_edge_added(g, e, b, vidp1, edge_id_map, - current_edge_id - 1, inserted)) { - ret = -1; - break; - } - } - - // clear_vertex - Vertex c = random_vertex(g, gen); -#if VERBOSE - cerr << "Testing clear vertex ..." << endl; is_failed = false; - print_graph(g, vertex_id_map); - // print_in_edges(g, vertex_id_map); - cerr << "clearing vertex " << vertex_id_map[c] << endl; -#endif - clear_vertex(c, g); -#if VERBOSE - print_graph(g, vertex_id_map); - // print_in_edges(g, vertex_id_map); - print_edges(g, vertex_id_map); -#endif - if (check_vertex_cleared(g, c, vertex_id_map) && num_edges(g) == count_edges(g)) { -#if VERBOSE - cerr << " Passed."<< endl; -#endif - } else { -#if VERBOSE - cerr << "**** Failed" << endl; -#endif - ret = -1; - break; - } - -#if VERBOSE - cerr << "Testing remove vertex ..." << endl; is_failed = false; - cerr << "removing vertex " << vertex_id_map[c] << endl; -#endif - - old_N = num_vertices(g); - remove_vertex(c, g); -#if VERBOSE - print_graph(g,vertex_id_map); - // print_in_edges(g,vertex_id_map); - print_edges(g, vertex_id_map); -#endif - // can't check in_vertex_set here because the vertex_descriptor c - // is no longer valid, we'll just make sure the vertex set has - // one fewer vertex - { - graph_traits<Graph>::vertex_iterator v, v_end; - boost::tie(v, v_end) = vertices(g); - for (N = 0; v != v_end; ++v) ++N; // N = std::distance(v, v_end); - if (N != old_N - 1) { - ret = -1; -#if VERBOSE - cerr << " Failed. N = " << N - << " but should be " << old_N - 1 << endl; -#endif - } - } - - N = num_vertices(g); - if (N != old_N - 1) { - ret = -1; -#if VERBOSE - cerr << " Failed. N = " << N - << " but should be " << old_N - 1 << endl; -#endif - } else { -#if VERBOSE - cerr << " Passed."<< endl; -#endif - } - } - if (ret == 0) - std::cout << "tests passed" << std::endl; - - return ret; -} diff --git a/Utilities/BGL/boost/graph/test/graph_concepts.cpp b/Utilities/BGL/boost/graph/test/graph_concepts.cpp deleted file mode 100644 index cfab6b4dd2d47f6138b217439af48532642e7676..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/graph_concepts.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> - -int main(int,char*[]) -{ - using namespace boost; - - // Check graph concepts againt their archetypes - typedef default_constructible_archetype< - sgi_assignable_archetype< equality_comparable_archetype<> > > Vertex; - - typedef incidence_graph_archetype<Vertex, directed_tag, - allow_parallel_edge_tag> Graph1; - function_requires< IncidenceGraphConcept<Graph1> >(); - - typedef adjacency_graph_archetype<Vertex, directed_tag, - allow_parallel_edge_tag> Graph2; - function_requires< AdjacencyGraphConcept<Graph2> >(); - - typedef vertex_list_graph_archetype<Vertex, directed_tag, - allow_parallel_edge_tag> Graph3; - function_requires< VertexListGraphConcept<Graph3> >(); - - function_requires< ColorValueConcept<color_value_archetype> >(); - - typedef incidence_graph_archetype<Vertex, directed_tag, allow_parallel_edge_tag> G; - typedef property_graph_archetype<G, vertex_color_t, color_value_archetype> - Graph4; - function_requires< PropertyGraphConcept<Graph4, Vertex, vertex_color_t> >(); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/graph_type.hpp b/Utilities/BGL/boost/graph/test/graph_type.hpp deleted file mode 100644 index f987b80c450aa5ff2be20bb0b1b65ac8568b80a8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/graph_type.hpp +++ /dev/null @@ -1,13 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <boost/graph/adjacency_list.hpp> -typedef boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, boost::property<vertex_id_t, std::size_t>, boost::property<edge_id_t, std::size_t> > Graph; -typedef boost::property<vertex_id_t, std::size_t> VertexId; -typedef boost::property<edge_id_t, std::size_t> EdgeID; diff --git a/Utilities/BGL/boost/graph/test/graphviz_test.cpp b/Utilities/BGL/boost/graph/test/graphviz_test.cpp deleted file mode 100644 index a6f684e0ec821cd828207be26f2ffb586f40d60a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/graphviz_test.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright 2004-5 Trustees of Indiana University - -// 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) - -// -// graphviz_test.cpp - Test cases for the Boost.Spirit implementation of a -// Graphviz DOT Language reader. -// - -// Author: Ronald Garcia - -//#define BOOST_GRAPH_READ_GRAPHVIZ_ITERATORS -#define BOOST_GRAPHVIZ_USE_ISTREAM -#include <boost/graph/graphviz.hpp> -#include <boost/assign/std/map.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graph_traits.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/dynamic_property_map.hpp> -#include <boost/test/test_tools.hpp> -#include <boost/test/floating_point_comparison.hpp> -#include <algorithm> -#include <string> -#include <iostream> -#include <iterator> -#include <map> -#include <utility> - -using namespace std; -using namespace boost; - -#ifndef BOOST_GRAPHVIZ_USE_ISTREAM -using namespace boost::spirit; -#endif -using namespace boost::assign; - -typedef std::string node_t; -typedef std::pair<node_t,node_t> edge_t; - -typedef std::map<node_t,float> mass_map_t; -typedef std::map<edge_t,double> weight_map_t; - -template <typename Directedness, typename OutEdgeList> -bool test_graph(std::istream& dotfile, mass_map_t const& masses, - weight_map_t const& weights, - std::string const& node_id = "node_id") { - - typedef adjacency_list < OutEdgeList, vecS, Directedness, - property < vertex_name_t, std::string, - property < vertex_color_t, float > >, - property < edge_weight_t, double > > graph_t; - typedef typename graph_traits < graph_t >::edge_descriptor edge_t; - typedef typename graph_traits < graph_t >::vertex_descriptor vertex_t; - - // Construct a graph and set up the dynamic_property_maps. - graph_t graph(0); - dynamic_properties dp; - typename property_map<graph_t, vertex_name_t>::type name = - get(vertex_name, graph); - dp.property(node_id,name); - typename property_map<graph_t, vertex_color_t>::type mass = - get(vertex_color, graph); - dp.property("mass",mass); - typename property_map<graph_t, edge_weight_t>::type weight = - get(edge_weight, graph); - dp.property("weight",weight); - - // Read in space characters too! - dotfile >> noskipws; - - bool result = true; -#ifdef BOOST_GRAPHVIZ_USE_ISTREAM - if(read_graphviz(dotfile,graph,dp,node_id)) { -#else - std::string data; - std::copy(std::istream_iterator<char>(dotfile), - std::istream_iterator<char>(), - std::back_inserter(data)); - if(read_graphviz(data.begin(),data.end(),graph,dp,node_id)) { -#endif - // check masses - if(!masses.empty()) { - // assume that all the masses have been set - // for each vertex: - typename graph_traits<graph_t>::vertex_iterator i,j; - for(boost::tie(i,j) = vertices(graph); i != j; ++i) { - // - get its name - std::string node_name = get(name,*i); - // - get its mass - float node_mass = get(mass,*i); - float ref_mass = masses.find(node_name)->second; - // - compare the mass to the result in the table - - BOOST_CHECK_CLOSE(node_mass, ref_mass, 0.01f); - } - } - // check weights - if(!weights.empty()) { - // assume that all weights have been set - /// for each edge: - typename graph_traits<graph_t>::edge_iterator i,j; - for(boost::tie(i,j) = edges(graph); i != j; ++i) { - // - get its name - std::pair<std::string,std::string> - edge_name = make_pair(get(name, source(*i,graph)), - get(name, target(*i,graph))); - // - get its weight - double edge_weight = get(weight,*i); - double ref_weight = weights.find(edge_name)->second; - // - compare the weight to teh result in the table - BOOST_CHECK_CLOSE(edge_weight, ref_weight, 0.01); - } - } - - - } else { - std::cerr << "Parsing Failed!\n"; - result = false; - } - - return result; - } - -int test_main(int, char*[]) { - - typedef istringstream gs_t; - - // Basic directed graph tests - { - mass_map_t masses; - insert ( masses ) ("a",0.0f) ("c",7.7f) ("e", 6.66f); - gs_t gs("digraph { a node [mass = 7.7] c e [mass = 6.66] }"); - BOOST_CHECK((test_graph<directedS,vecS>(gs,masses,weight_map_t()))); - } - - { - weight_map_t weights; - insert( weights )(make_pair("a","b"),0.0) - (make_pair("c","d"),7.7)(make_pair("e","f"),6.66); - gs_t gs("digraph { a -> b edge [weight = 7.7] " - "c -> d e-> f [weight = 6.66] }"); - BOOST_CHECK((test_graph<directedS,vecS>(gs,mass_map_t(),weights))); - } - - // undirected graph with alternate node_id property name - { - mass_map_t masses; - insert ( masses ) ("a",0.0f) ("c",7.7f) ("e", 6.66f); - gs_t gs("graph { a node [mass = 7.7] c e [mass = 6.66] }"); - BOOST_CHECK((test_graph<undirectedS,vecS>(gs,masses,weight_map_t(), - "nodenames"))); - } - - // Basic undirected graph tests - { - mass_map_t masses; - insert ( masses ) ("a",0.0f) ("c",7.7f) ("e", 6.66f); - gs_t gs("graph { a node [mass = 7.7] c e [mass = 6.66] }"); - BOOST_CHECK((test_graph<undirectedS,vecS>(gs,masses,weight_map_t()))); - } - - { - weight_map_t weights; - insert( weights )(make_pair("a","b"),0.0) - (make_pair("c","d"),7.7)(make_pair("e","f"),6.66); - gs_t gs("graph { a -- b eDge [weight = 7.7] " - "c -- d e -- f [weight = 6.66] }"); - BOOST_CHECK((test_graph<undirectedS,vecS>(gs,mass_map_t(),weights))); - } - - // Mismatch directed graph test - { - mass_map_t masses; - insert ( masses ) ("a",0.0f) ("c",7.7f) ("e", 6.66f); - gs_t gs("graph { a nodE [mass = 7.7] c e [mass = 6.66] }"); - try { - test_graph<directedS,vecS>(gs,masses,weight_map_t()); - } catch (boost::undirected_graph_error&) {} - } - - // Mismatch undirected graph test - { - mass_map_t masses; - insert ( masses ) ("a",0.0f) ("c",7.7f) ("e", 6.66f); - gs_t gs("digraph { a node [mass = 7.7] c e [mass = 6.66] }"); - try { - test_graph<undirectedS,vecS>(gs,masses,weight_map_t()); - BOOST_ERROR("Failed to throw boost::directed_graph_error."); - } catch (boost::directed_graph_error&) {} - } - - // Complain about parallel edges - { - weight_map_t weights; - insert( weights )(make_pair("a","b"),7.7); - gs_t gs("diGraph { a -> b [weight = 7.7] a -> b [weight = 7.7] }"); - try { - test_graph<directedS,setS>(gs,mass_map_t(),weights); - BOOST_ERROR("Failed to throw boost::bad_parallel_edge."); - } catch (boost::bad_parallel_edge&) {} - } - - // Handle parallel edges gracefully - { - weight_map_t weights; - insert( weights )(make_pair("a","b"),7.7); - gs_t gs("digraph { a -> b [weight = 7.7] a -> b [weight = 7.7] }"); - BOOST_CHECK((test_graph<directedS,vecS>(gs,mass_map_t(),weights))); - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/gursoy_atun_layout_test.cpp b/Utilities/BGL/boost/graph/test/gursoy_atun_layout_test.cpp deleted file mode 100644 index acd829425778bbf6617d43504f0eb3bb0d47d063..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/gursoy_atun_layout_test.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// 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: Jeremiah Willcock -// Douglas Gregor -// Andrew Lumsdaine -#include <boost/graph/gursoy_atun_layout.hpp> -#include "boost/graph/adjacency_list.hpp" -#include "boost/graph/random.hpp" -#include "boost/graph/graphviz.hpp" -#include "boost/random/mersenne_twister.hpp" -#include "boost/random/linear_congruential.hpp" -#include "boost/random/uniform_01.hpp" -#include <iostream> -#include <fstream> -#include <sstream> - -#if 0 -#include <boost/graph/plod_generator.hpp> -#include <boost/graph/small_world_generator.hpp> -#endif -using namespace boost; - -template <class Property, class Vertex> -struct position_writer { - const Property& property; - - position_writer(const Property& property): property(property) {} - - void operator()(std::ostream& os, const Vertex& v) const { - os << "[pos=\"" << int(property[v][0]) << "," << int(property[v][1]) << "\"]"; - } -}; - -struct graph_writer { - void operator()(std::ostream& os) const { - os << "node [shape=point, width=\".01\", height=\".01\", fixedsize=\"true\"]" - << std::endl; - } -}; - -int main(int, char*[]) { - // Generate a graph structured like a grid, cylinder, or torus; lay it out in - // a square grid; and output it in dot format - - typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, - boost::no_property, - boost::property<boost::edge_weight_t, double> - > graph_type; - typedef boost::graph_traits<graph_type>::vertex_descriptor vertex_descriptor; - // boost::mt19937 rng; - // boost::generate_random_graph(graph, 100, 600, rng, false, false); - -#if 1 - graph_type graph; - - // Make grid, like Gursoy and Atun used - std::map<int, std::map<int, vertex_descriptor> > verts; - const int grid_size = 30; - boost::minstd_rand edge_weight_gen; - boost::uniform_01<boost::minstd_rand> random_edge_weight(edge_weight_gen); - for (int i = 0; i < grid_size; ++i) - for (int j = 0; j < grid_size; ++j) - verts[i][j] = add_vertex(graph); - for (int i = 0; i < grid_size; ++i) { - for (int j = 0; j < grid_size; ++j) { - if (i != 0) - add_edge(verts[i][j], verts[i-1][j], random_edge_weight(), graph); - if (j != 0) - add_edge(verts[i][j], verts[i][j-1], random_edge_weight(), graph); -#if 0 - // Uncomment parts of this to get a cylinder or torus - if (i == 0) - add_edge(verts[0][j], verts[grid_size-1][j], random_edge_weight(), - graph); - if (j == 0) - add_edge(verts[i][0], verts[i][grid_size-1], random_edge_weight(), - graph); -#endif - } - } -#else - using namespace boost; - -#if 0 - int n = 10000; - double alpha = 0.4; - double beta = 50; - minstd_rand gen; - graph_type graph(plod_iterator<minstd_rand, graph_type>(gen, n, alpha, beta), - plod_iterator<minstd_rand, graph_type>(), - n); -#else - int n = 100000; - int k = 6; - double p = 0.001; - minstd_rand gen; - graph_type graph(small_world_iterator<minstd_rand>(gen, n, k, p), - small_world_iterator<minstd_rand>(n, k), - n); -#endif -#endif - // boost::read_graphviz(stdin, graph); - - typedef boost::property_map<graph_type, boost::vertex_index_t>::type - VertexIndexMap; - VertexIndexMap vertex_index = get(boost::vertex_index_t(), graph); - - typedef boost::heart_topology<> topology; - topology space; - - typedef topology::point_type point; - std::vector<point> position_vector(num_vertices(graph)); - typedef boost::iterator_property_map<std::vector<point>::iterator, - VertexIndexMap, point, point&> Position; - Position position(position_vector.begin(), vertex_index); - - boost::gursoy_atun_layout(graph, space, position); - - std::cerr << "--------Unweighted layout--------\n"; - boost::write_graphviz(std::cout, graph, - position_writer<Position, vertex_descriptor>(position), - boost::default_writer(), - graph_writer()); - - boost::gursoy_atun_layout(graph, space, position, - weight_map(get(boost::edge_weight, graph))); - - std::cerr << "--------Weighted layout--------\n"; - boost::write_graphviz(std::cout, graph, - position_writer<Position, vertex_descriptor>(position), - boost::default_writer(), - graph_writer()); - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/isomorphism.cpp b/Utilities/BGL/boost/graph/test/isomorphism.cpp deleted file mode 100644 index ede2bba6433e980924f123db3cb91051b286c9d6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/isomorphism.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// Boost.Graph library isomorphism test - -// Copyright (C) 2001-20044 Douglas Gregor (dgregor at cs dot indiana dot edu) -// -// 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) - -// For more information, see http://www.boost.org -// -// Revision History: -// -// 29 Nov 2001 Jeremy Siek -// Changed to use Boost.Random. -// 29 Nov 2001 Doug Gregor -// Initial checkin. - -#include <iostream> -#include <fstream> -#include <map> -#include <algorithm> -#include <cstdlib> -#include <time.h> // clock used without std:: qualifier? -#include <boost/test/minimal.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/isomorphism.hpp> -#include <boost/property_map.hpp> -#include <boost/random/variate_generator.hpp> -#include <boost/random/uniform_real.hpp> -#include <boost/random/uniform_int.hpp> -#include <boost/random/mersenne_twister.hpp> -#include <boost/lexical_cast.hpp> - -using namespace boost; - -template <typename Generator> -struct random_functor { - random_functor(Generator& g) : g(g) { } - std::size_t operator()(std::size_t n) { - boost::uniform_int<std::size_t> distrib(0, n-1); - boost::variate_generator<boost::mt19937&, boost::uniform_int<std::size_t> > - x(g, distrib); - return x(); - } - Generator& g; -}; - -template<typename Graph1, typename Graph2> -void randomly_permute_graph(const Graph1& g1, Graph2& g2) -{ - // Need a clean graph to start with - assert(num_vertices(g2) == 0); - assert(num_edges(g2) == 0); - - typedef typename graph_traits<Graph1>::vertex_descriptor vertex1; - typedef typename graph_traits<Graph2>::vertex_descriptor vertex2; - typedef typename graph_traits<Graph1>::edge_iterator edge_iterator; - - boost::mt19937 gen; - random_functor<boost::mt19937> rand_fun(gen); - - // Decide new order - std::vector<vertex1> orig_vertices; - std::copy(vertices(g1).first, vertices(g1).second, std::back_inserter(orig_vertices)); - std::random_shuffle(orig_vertices.begin(), orig_vertices.end(), rand_fun); - std::map<vertex1, vertex2> vertex_map; - - for (std::size_t i = 0; i < num_vertices(g1); ++i) { - vertex_map[orig_vertices[i]] = add_vertex(g2); - } - - for (edge_iterator e = edges(g1).first; e != edges(g1).second; ++e) { - add_edge(vertex_map[source(*e, g1)], vertex_map[target(*e, g1)], g2); - } -} - -template<typename Graph> -void generate_random_digraph(Graph& g, double edge_probability) -{ - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - boost::mt19937 random_gen; - boost::uniform_real<double> distrib(0.0, 1.0); - boost::variate_generator<boost::mt19937&, boost::uniform_real<double> > - random_dist(random_gen, distrib); - - for (vertex_iterator u = vertices(g).first; u != vertices(g).second; ++u) { - vertex_iterator v = u; - ++v; - for (; v != vertices(g).second; ++v) { - if (random_dist() <= edge_probability) - add_edge(*u, *v, g); - } - } -} - -void test_isomorphism(int n, double edge_probability) -{ - typedef adjacency_list<vecS, vecS, bidirectionalS> graph1; - typedef adjacency_list<listS, listS, bidirectionalS, - property<vertex_index_t, int> > graph2; - - graph1 g1(n); - generate_random_digraph(g1, edge_probability); - graph2 g2; - randomly_permute_graph(g1, g2); - - int v_idx = 0; - for (graph2::vertex_iterator v = vertices(g2).first; - v != vertices(g2).second; ++v) { - put(vertex_index_t(), g2, *v, v_idx++); - } - - std::map<graph1::vertex_descriptor, graph2::vertex_descriptor> mapping; - - bool isomorphism_correct; - clock_t start = clock(); - BOOST_CHECK(isomorphism_correct = isomorphism - (g1, g2, isomorphism_map(make_assoc_property_map(mapping)))); - clock_t end = clock(); - - std::cout << "Elapsed time (clock cycles): " << (end - start) << std::endl; - - bool verify_correct; - BOOST_CHECK(verify_correct = - verify_isomorphism(g1, g2, make_assoc_property_map(mapping))); - - if (!isomorphism_correct || !verify_correct) { - // Output graph 1 - { - std::ofstream out("isomorphism_failure.bg1"); - out << num_vertices(g1) << std::endl; - for (graph1::edge_iterator e = edges(g1).first; - e != edges(g1).second; ++e) { - out << get(vertex_index_t(), g1, source(*e, g1)) << ' ' - << get(vertex_index_t(), g1, target(*e, g1)) << std::endl; - } - } - - // Output graph 2 - { - std::ofstream out("isomorphism_failure.bg2"); - out << num_vertices(g2) << std::endl; - for (graph2::edge_iterator e = edges(g2).first; - e != edges(g2).second; ++e) { - out << get(vertex_index_t(), g2, source(*e, g2)) << ' ' - << get(vertex_index_t(), g2, target(*e, g2)) << std::endl; - } - } - } -} - -int test_main(int argc, char* argv[]) -{ - if (argc < 3) { - test_isomorphism(30, 0.45); - return 0; - } - - int n = boost::lexical_cast<int>(argv[1]); - double edge_prob = boost::lexical_cast<double>(argv[2]); - test_isomorphism(n, edge_prob); - - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/johnson-test.cpp b/Utilities/BGL/boost/graph/test/johnson-test.cpp deleted file mode 100644 index c6a469a83580a5b37cb7b4b8c531e6f725f3106b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/johnson-test.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - - -/* Expected Output - 0 1 2 3 4 5 6 7 8 9 - 0 0 99 111 123 103 107 125 105 111 123 - 1 99 0 12 24 4 8 26 6 12 24 - 2 111 12 0 12 16 20 24 18 24 26 - 3 123 24 12 0 28 30 12 30 26 14 - 4 103 4 16 28 0 4 22 2 8 20 - 5 107 8 20 30 4 0 18 6 4 16 - 6 125 26 24 12 22 18 0 24 14 2 - 7 105 6 18 30 2 6 24 0 10 22 - 8 111 12 24 26 8 4 14 10 0 12 - 9 123 24 26 14 20 16 2 22 12 0 -*/ - -#include <boost/config.hpp> -#include <fstream> -#include <iostream> -#include <vector> -#include <iomanip> -#include <boost/property_map.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/graphviz.hpp> -#include <boost/graph/johnson_all_pairs_shortest.hpp> - -int main() -{ - using namespace boost; - typedef adjacency_list<vecS, vecS, undirectedS, no_property, - property< edge_weight_t, int, - property< edge_weight2_t, int > > > Graph; - const int V = 10; - typedef std::pair < int, int >Edge; - Edge edge_array[] = - { Edge(0,1), Edge(1,2), Edge(2,3), Edge(1,4), Edge(2,5), Edge(3,6), - Edge(4,5), Edge(5,6), Edge(4,7), Edge(5,8), Edge(6,9), Edge(7,8), - Edge(8,9) - }; - - const std::size_t E = sizeof(edge_array) / sizeof(Edge); - - Graph g(edge_array, edge_array + E, V); - - - property_map < Graph, edge_weight_t >::type w = get(edge_weight, g); - int weights[] = { 99, 12, 12, 4, 99, 12, 4, 99, 2, 4, 2, 99, 12 }; - int *wp = weights; - - graph_traits < Graph >::edge_iterator e, e_end; - for (boost::tie(e, e_end) = edges(g); e != e_end; ++e) - w[*e] = *wp++; - - std::vector < int >d(V, (std::numeric_limits < int >::max)()); - int D[V][V]; - johnson_all_pairs_shortest_paths(g, D, distance_map(&d[0])); - - std::cout << std::setw(5) <<" "; - for (int k = 0; k < 10; ++k) - std::cout << std::setw(5) << k ; - std::cout << std::endl; - for (int i = 0; i < 10; ++i) { - std::cout <<std::setw(5) << i ; - for (int j = 0; j < 10; ++j) { - std::cout << std::setw(5) << D[i][j] ; - } - std::cout << std::endl; - } - - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/king_ordering.cpp b/Utilities/BGL/boost/graph/test/king_ordering.cpp deleted file mode 100644 index 5683199084b6a24b5b1067363b50b8eabbe83034..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/king_ordering.cpp +++ /dev/null @@ -1,146 +0,0 @@ -//======================================================================= -// Copyright 1997, 1998, 1999, 2000 University of Notre Dame. -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek -// Doug Gregor, D. Kevin McGrath -// -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. -//======================================================================= - -#include <boost/config.hpp> -#include <vector> -#include <iostream> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/king_ordering.hpp> -#include <boost/graph/properties.hpp> -#include <boost/graph/bandwidth.hpp> - -/* - Sample Output - original bandwidth: 8 - Reverse Cuthill-McKee ordering starting at: 6 - 8 3 0 9 2 5 1 4 7 6 - bandwidth: 4 - Reverse Cuthill-McKee ordering starting at: 0 - 9 1 4 6 7 2 8 5 3 0 - bandwidth: 4 - Reverse Cuthill-McKee ordering: - 0 8 5 7 3 6 4 2 1 9 - bandwidth: 4 - */ -int main(int , char* []) -{ - using namespace boost; - using namespace std; - typedef adjacency_list<vecS, vecS, undirectedS, - property<vertex_color_t, default_color_type, - property<vertex_degree_t,int> > > Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::vertices_size_type size_type; - - typedef std::pair<std::size_t, std::size_t> Pair; - Pair edges[14] = { Pair(0,3), //a-d - Pair(0,5), //a-f - Pair(1,2), //b-c - Pair(1,4), //b-e - Pair(1,6), //b-g - Pair(1,9), //b-j - Pair(2,3), //c-d - Pair(2,4), //c-e - Pair(3,5), //d-f - Pair(3,8), //d-i - Pair(4,6), //e-g - Pair(5,6), //f-g - Pair(5,7), //f-h - Pair(6,7) }; //g-h - - Graph G(10); - for (int i = 0; i < 14; ++i) - add_edge(edges[i].first, edges[i].second, G); - - graph_traits<Graph>::vertex_iterator ui, ui_end; - - property_map<Graph,vertex_degree_t>::type deg = get(vertex_degree, G); - for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) - deg[*ui] = degree(*ui, G); - - property_map<Graph, vertex_index_t>::type - index_map = get(vertex_index, G); - - std::cout << "original bandwidth: " << bandwidth(G) << std::endl; - - std::vector<Vertex> inv_perm(num_vertices(G)); - std::vector<size_type> perm(num_vertices(G)); - { - Vertex s = vertex(6, G); - //king_ordering - king_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G), get(vertex_index, G)); - cout << "King ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i = inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - { - Vertex s = vertex(0, G); - //king_ordering - king_ordering(G, s, inv_perm.rbegin(), get(vertex_color, G), - get(vertex_degree, G), get(vertex_index, G)); - cout << "King ordering starting at: " << s << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - - { - //king_ordering - king_ordering(G, inv_perm.rbegin()); - - cout << "King ordering:" << endl; - cout << " "; - for (std::vector<Vertex>::const_iterator i=inv_perm.begin(); - i != inv_perm.end(); ++i) - cout << index_map[*i] << " "; - cout << endl; - - for (size_type c = 0; c != inv_perm.size(); ++c) - perm[index_map[inv_perm[c]]] = c; - std::cout << " bandwidth: " - << bandwidth(G, make_iterator_property_map(&perm[0], index_map, perm[0])) - << std::endl; - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/layout_test.cpp b/Utilities/BGL/boost/graph/test/layout_test.cpp deleted file mode 100644 index a659333bb8b9310256347b62d692c276fb461d79..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/layout_test.cpp +++ /dev/null @@ -1,362 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// 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 -// Andrew Lumsdaine -#include <boost/graph/fruchterman_reingold.hpp> -#include <boost/graph/random_layout.hpp> -#include <boost/graph/kamada_kawai_spring_layout.hpp> -#include <boost/graph/circle_layout.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/random/linear_congruential.hpp> -#include <boost/test/minimal.hpp> -#include <iostream> -#include <boost/limits.hpp> -#include <fstream> -#include <string> -using namespace boost; - -enum vertex_position_t { vertex_position }; -namespace boost { BOOST_INSTALL_PROPERTY(vertex, position); } - -struct point -{ - double x; - double y; -}; - -template<typename Graph, typename PositionMap> -void print_graph_layout(const Graph& g, PositionMap position) -{ - typename graph_traits<Graph>::vertex_iterator vi, vi_end; - int xmin = 0, xmax = 0, ymin = 0, ymax = 0; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - if ((int)position[*vi].x < xmin) xmin = (int)position[*vi].x; - if ((int)position[*vi].x > xmax) xmax = (int)position[*vi].x; - if ((int)position[*vi].y < ymin) ymin = (int)position[*vi].y; - if ((int)position[*vi].y > ymax) ymax = (int)position[*vi].y; - } - - for (int y = ymin; y <= ymax; ++y) { - for (int x = xmin; x <= xmax; ++x) { - // Find vertex at this position - typename graph_traits<Graph>::vertices_size_type index = 0; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi, ++index) { - if ((int)position[*vi].x == x && (int)position[*vi].y == y) - break; - } - - if (vi == vi_end) std::cout << ' '; - else std::cout << (char)(index + 'A'); - } - std::cout << std::endl; - } -} - -template<typename Graph, typename PositionMap> -void dump_graph_layout(std::string name, const Graph& g, PositionMap position) -{ - std::ofstream out((name + ".dot").c_str()); - out << "graph " << name << " {" << std::endl; - - typename graph_traits<Graph>::vertex_iterator vi, vi_end; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) { - out << " n" << get(vertex_index, g, *vi) << "[ pos=\"" - << (int)position[*vi].x + 25 << ", " << (int)position[*vi].y + 25 - << "\" ];\n"; - } - - typename graph_traits<Graph>::edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - out << " n" << get(vertex_index, g, source(*ei, g)) << " -- n" - << get(vertex_index, g, target(*ei, g)) << ";\n"; - } - out << "}\n"; -} - -template<typename Graph> -void -test_circle_layout(Graph*, typename graph_traits<Graph>::vertices_size_type n) -{ - typedef typename graph_traits<Graph>::vertex_descriptor vertex; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; - typedef typename graph_traits<Graph>::edges_size_type edges_size_type; - - Graph g(n); - - // Initialize vertex indices - vertex_iterator vi = vertices(g).first; - for (vertices_size_type i = 0; i < n; ++i, ++vi) - put(vertex_index, g, *vi, i); - - circle_graph_layout(g, get(vertex_position, g), 10.0); - - std::cout << "Regular polygon layout with " << n << " points.\n"; - print_graph_layout(g, get(vertex_position, g)); -} - -struct simple_edge -{ - int first, second; -}; - -struct kamada_kawai_done -{ - kamada_kawai_done() : last_delta() {} - - template<typename Graph> - bool operator()(double delta_p, - typename boost::graph_traits<Graph>::vertex_descriptor p, - const Graph& g, - bool global) - { - if (global) { - double diff = last_delta - delta_p; - if (diff < 0) diff = -diff; - last_delta = delta_p; - return diff < 0.01; - } else { - return delta_p < 0.01; - } - } - - double last_delta; -}; - -template<typename Graph> -void -test_triangle(Graph*) -{ - typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; - typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; - - Graph g; - - vertex_descriptor u = add_vertex(g); put(vertex_index, g, u, 0); - vertex_descriptor v = add_vertex(g); put(vertex_index, g, v, 1); - vertex_descriptor w = add_vertex(g); put(vertex_index, g, w, 2); - - edge_descriptor e1 = add_edge(u, v, g).first; put(edge_weight, g, e1, 1.0); - edge_descriptor e2 = add_edge(v, w, g).first; put(edge_weight, g, e2, 1.0); - edge_descriptor e3 = add_edge(w, u, g).first; put(edge_weight, g, e3, 1.0); - - circle_graph_layout(g, get(vertex_position, g), 25.0); - - bool ok = kamada_kawai_spring_layout(g, - get(vertex_position, g), - get(edge_weight, g), - side_length(50.0)); - BOOST_CHECK(ok); - - std::cout << "Triangle layout (Kamada-Kawai).\n"; - print_graph_layout(g, get(vertex_position, g)); -} - -template<typename Graph> -void -test_cube(Graph*) -{ - enum {A, B, C, D, E, F, G, H}; - simple_edge cube_edges[12] = { - {A, E}, {A, B}, {A, D}, {B, F}, {B, C}, {C, D}, {C, G}, {D, H}, - {E, H}, {E, F}, {F, G}, {G, H} - }; - - Graph g(&cube_edges[0], &cube_edges[12], 8); - - typedef typename graph_traits<Graph>::edge_iterator edge_iterator; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - - vertex_iterator vi, vi_end; - int i = 0; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - put(vertex_index, g, *vi, i++); - - edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - put(edge_weight, g, *ei, 1.0); - std::cerr << "(" << (char)(get(vertex_index, g, source(*ei, g)) + 'A') - << ", " << (char)(get(vertex_index, g, target(*ei, g)) + 'A') - << ") "; - } - std::cerr << std::endl; - - circle_graph_layout(g, get(vertex_position, g), 25.0); - - bool ok = kamada_kawai_spring_layout(g, - get(vertex_position, g), - get(edge_weight, g), - side_length(50.0), - kamada_kawai_done()); - BOOST_CHECK(ok); - - std::cout << "Cube layout (Kamada-Kawai).\n"; - print_graph_layout(g, get(vertex_position, g)); - - dump_graph_layout("cube", g, get(vertex_position, g)); - - minstd_rand gen; - random_graph_layout(g, get(vertex_position, g), -25.0, 25.0, -25.0, 25.0, - gen); - - std::vector<point> displacements(num_vertices(g)); - fruchterman_reingold_force_directed_layout - (g, - get(vertex_position, g), - 50.0, - 50.0, - square_distance_attractive_force(), - square_distance_repulsive_force(), - all_force_pairs(), - linear_cooling<double>(100), - make_iterator_property_map(displacements.begin(), - get(vertex_index, g), - point())); - - std::cout << "Cube layout (Fruchterman-Reingold).\n"; - print_graph_layout(g, get(vertex_position, g)); - - dump_graph_layout("cube-fr", g, get(vertex_position, g)); -} - -template<typename Graph> -void -test_triangular(Graph*) -{ - enum {A, B, C, D, E, F, G, H, I, J}; - simple_edge triangular_edges[18] = { - {A, B}, {A, C}, {B, C}, {B, D}, {B, E}, {C, E}, {C, F}, {D, E}, {D, G}, - {D, H}, {E, F}, {E, H}, {E, I}, {F, I}, {F, J}, {G, H}, {H, I}, {I, J} - }; - - Graph g(&triangular_edges[0], &triangular_edges[18], 10); - - typedef typename graph_traits<Graph>::edge_iterator edge_iterator; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - - vertex_iterator vi, vi_end; - int i = 0; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - put(vertex_index, g, *vi, i++); - - edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - put(edge_weight, g, *ei, 1.0); - std::cerr << "(" << (char)(get(vertex_index, g, source(*ei, g)) + 'A') - << ", " << (char)(get(vertex_index, g, target(*ei, g)) + 'A') - << ") "; - } - std::cerr << std::endl; - - circle_graph_layout(g, get(vertex_position, g), 25.0); - - bool ok = kamada_kawai_spring_layout(g, - get(vertex_position, g), - get(edge_weight, g), - side_length(50.0), - kamada_kawai_done()); - BOOST_CHECK(ok); - - std::cout << "Triangular layout (Kamada-Kawai).\n"; - print_graph_layout(g, get(vertex_position, g)); - - dump_graph_layout("triangular-kk", g, get(vertex_position, g)); - - minstd_rand gen; - random_graph_layout(g, get(vertex_position, g), -25.0, 25.0, -25.0, 25.0, - gen); - - dump_graph_layout("random", g, get(vertex_position, g)); - - std::vector<point> displacements(num_vertices(g)); - fruchterman_reingold_force_directed_layout - (g, - get(vertex_position, g), - 50.0, - 50.0, - attractive_force(square_distance_attractive_force()). - cooling(linear_cooling<double>(100))); - - std::cout << "Triangular layout (Fruchterman-Reingold).\n"; - print_graph_layout(g, get(vertex_position, g)); - - dump_graph_layout("triangular-fr", g, get(vertex_position, g)); -} - -template<typename Graph> -void -test_disconnected(Graph*) -{ - enum {A, B, C, D, E, F, G, H}; - simple_edge triangular_edges[13] = { - {A, B}, {B, C}, {C, A}, - {D, E}, {E, F}, {F, G}, {G, H}, {H, D}, - {D, F}, {F, H}, {H, E}, {E, G}, {G, D} - }; - - Graph g(&triangular_edges[0], &triangular_edges[13], 8); - - typedef typename graph_traits<Graph>::edge_iterator edge_iterator; - typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator; - - vertex_iterator vi, vi_end; - int i = 0; - for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) - put(vertex_index, g, *vi, i++); - - edge_iterator ei, ei_end; - for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { - put(edge_weight, g, *ei, 1.0); - std::cerr << "(" << (char)(get(vertex_index, g, source(*ei, g)) + 'A') - << ", " << (char)(get(vertex_index, g, target(*ei, g)) + 'A') - << ") "; - } - std::cerr << std::endl; - - circle_graph_layout(g, get(vertex_position, g), 25.0); - - bool ok = kamada_kawai_spring_layout(g, - get(vertex_position, g), - get(edge_weight, g), - side_length(50.0), - kamada_kawai_done()); - BOOST_CHECK(!ok); - - minstd_rand gen; - random_graph_layout(g, get(vertex_position, g), -25.0, 25.0, -25.0, 25.0, - gen); - - std::vector<point> displacements(num_vertices(g)); - fruchterman_reingold_force_directed_layout - (g, - get(vertex_position, g), - 50.0, - 50.0, - attractive_force(square_distance_attractive_force()). - cooling(linear_cooling<double>(50))); - - std::cout << "Disconnected layout (Fruchterman-Reingold).\n"; - print_graph_layout(g, get(vertex_position, g)); - - dump_graph_layout("disconnected-fr", g, get(vertex_position, g)); -} - -int test_main(int, char*[]) -{ - typedef adjacency_list<listS, listS, undirectedS, - // Vertex properties - property<vertex_index_t, int, - property<vertex_position_t, point> >, - // Edge properties - property<edge_weight_t, double> > Graph; - - test_circle_layout((Graph*)0, 5); - test_cube((Graph*)0); - test_triangular((Graph*)0); - test_disconnected((Graph*)0); - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/leda_graph_cc.cpp b/Utilities/BGL/boost/graph/test/leda_graph_cc.cpp deleted file mode 100644 index 40fafcf5cde05a475a888ac2af469b5be9232c6a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/leda_graph_cc.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/leda_graph.hpp> - - -int -main(int,char*[]) -{ - using namespace boost; - { - typedef leda::GRAPH<int,int> Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< BidirectionalGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< VertexMutableGraphConcept<Graph> >(); - function_requires< EdgeMutableGraphConcept<Graph> >(); - function_requires< VertexMutablePropertyGraphConcept<Graph> >(); - function_requires< EdgeMutablePropertyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Edge, edge_index_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, vertex_all_t> >(); - function_requires< - LvaluePropertyGraphConcept<Graph, Vertex, edge_all_t> >(); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/lvalue_pmap.cpp b/Utilities/BGL/boost/graph/test/lvalue_pmap.cpp deleted file mode 100644 index 0701cc5180da06fee60b6d3a38f1d77cc97c67a0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/lvalue_pmap.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//======================================================================= -// Copyright 2002 Indiana University. -// 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) -//======================================================================= - -#include <boost/graph/properties.hpp> -#include <boost/graph/adjacency_list.hpp> - -using namespace boost; - -struct vertex_info_t { }; -struct edge_info_t { }; -namespace boost { - BOOST_INSTALL_PROPERTY(vertex, info); - BOOST_INSTALL_PROPERTY(edge, info); -}; - -typedef property<vertex_info_t, double> vertex_properties; -typedef property<edge_info_t, double> edge_properties; - -typedef adjacency_list<vecS, vecS, bidirectionalS, -vertex_properties, edge_properties> graph_t; - -double& foo_1(graph_t& x) -{ - property_map<graph_t, vertex_info_t>::type pmap - = get(vertex_info_t(), x); - return pmap[vertex(0, x)]; -} - -const double& foo_2(graph_t const & x) -{ - property_map<graph_t, vertex_info_t>::const_type pmap - = get(vertex_info_t(), x); - return pmap[vertex(0, x)]; -} - -double& bar_1(graph_t& x) -{ - property_map<graph_t, edge_info_t>::type pmap - = get(edge_info_t(), x); - return pmap[edge(vertex(0, x), vertex(1, x), x).first]; -} - -const double& bar_2(graph_t const & x) -{ - property_map<graph_t, edge_info_t>::const_type pmap - = get(edge_info_t(), x); - return pmap[edge(vertex(0, x), vertex(1, x), x).first]; -} - -int -main() -{ - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/property_iter.cpp b/Utilities/BGL/boost/graph/test/property_iter.cpp deleted file mode 100644 index e420ffdd8ab47cef6c0e08cb3b30069e46585421..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/property_iter.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//======================================================================= -// -// Copyright (c) 2003 Institute of Transport, -// Railway Construction and Operation, -// University of Hanover, Germany -// -// Author: J�rgen Hunold -// -// 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) -// -//======================================================================= - -#include <boost/config.hpp> - -#include <iostream> -#include <vector> -#include <set> -#include <utility> -#include <algorithm> - -#define VERBOSE 0 - -#include <boost/utility.hpp> -#include <boost/graph/property_iter_range.hpp> -#include <boost/graph/graph_utility.hpp> -#include <boost/graph/random.hpp> -#include <boost/pending/indirect_cmp.hpp> - -#include <boost/random/mersenne_twister.hpp> - - -enum vertex_id_t { vertex_id = 500 }; -enum edge_id_t { edge_id = 501 }; -namespace boost { - BOOST_INSTALL_PROPERTY(vertex, id); - BOOST_INSTALL_PROPERTY(edge, id); -} - - -#include "graph_type.hpp" // this provides a typedef for Graph - -using namespace boost; - -/* - This program tests the property range iterators - */ - -using std::cout; -using std::endl; -using std::cerr; -using std::find; - - -int main(int, char* []) -{ - int ret = 0; - std::size_t N = 5, E = 0; - - Graph g; - typedef boost::graph_traits<Graph>::vertex_descriptor Vertex; - typedef boost::graph_traits<Graph>::edge_descriptor Edge; - - int i, j; - std::size_t current_vertex_id = 0; - std::size_t current_edge_id = 0; - - property_map<Graph, vertex_id_t>::type vertex_id_map = get(vertex_id, g); - - property_map<Graph, edge_id_t>::type edge_id_map = get(edge_id, g); - - for (std::size_t k = 0; k < N; ++k) - add_vertex(current_vertex_id++, g); - - mt19937 gen; - - for (j=0; j < 10; ++j) { - - // add_edge -#if VERBOSE - cerr << "Testing add_edge ..." << endl; -#endif - for (i=0; i < 6; ++i) { - Vertex a, b; - a = random_vertex(g, gen); - do { - b = random_vertex(g, gen); - } while ( a == b ); // don't do self edges -#if VERBOSE - cerr << "add_edge(" << vertex_id_map[a] << "," << vertex_id_map[b] <<")" << endl; -#endif - Edge e; - bool inserted; - boost::tie(e, inserted) = add_edge(a, b, current_edge_id++, g); -#if VERBOSE - std::cout << "inserted: " << inserted << std::endl; - std::cout << "source(e,g)" << source(e,g) << endl; - std::cout << "target(e,g)" << target(e,g) << endl; - std::cout << "edge_id[e] = " << edge_id_map[e] << std::endl; - print_edges2(g, vertex_id_map, edge_id_map); - print_graph(g, vertex_id_map); - std::cout << "finished printing" << std::endl; -#endif - } - ++E; - } - - typedef boost::graph_property_iter_range< Graph, vertex_id_t>::const_iterator TNodeConstIterator; - typedef boost::graph_property_iter_range< Graph, vertex_id_t>::const_type TNodeConstIteratorType; - - typedef boost::graph_property_iter_range< Graph, vertex_id_t>::iterator TNodeIterator; - typedef boost::graph_property_iter_range< Graph, vertex_id_t>::type TNodeIteratorType; - - typedef boost::graph_property_iter_range< Graph, edge_id_t>::const_iterator TLinkConstIterator; - typedef boost::graph_property_iter_range< Graph, edge_id_t>::const_type TLinkConstIteratorType; - - typedef boost::graph_property_iter_range< Graph, edge_id_t>::iterator TLinkIterator; - typedef boost::graph_property_iter_range< Graph, edge_id_t>::type TLinkIteratorType; - - typedef std::pair<TLinkConstIterator, TLinkConstIterator> tLinkConstIteratorPair; - - TLinkIterator itEdgeBegin, itEdgeEnd; - - tie(itEdgeBegin, itEdgeEnd) = get_property_iter_range(g, edge_id); - - cout << "Edge iteration:" << endl; - for (; itEdgeBegin != itEdgeEnd; ++itEdgeBegin) - { - cout << *itEdgeBegin; - } - cout << endl; - - TNodeIterator itVertexBegin, itVertexEnd; - - tie(itVertexBegin, itVertexEnd) = get_property_iter_range(g, vertex_id); - - cout << "Vertex iteration:" << endl; - for (; itVertexBegin != itVertexEnd; ++itVertexBegin) - { - cout << *itVertexBegin; - } - cout << endl; - - - return ret; -} diff --git a/Utilities/BGL/boost/graph/test/regression.cfg b/Utilities/BGL/boost/graph/test/regression.cfg deleted file mode 100644 index b9d1c9a38d65495a51449f9fec55c24c8c31f0ec..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/regression.cfg +++ /dev/null @@ -1,22 +0,0 @@ -// Boost Graph Library regression test configuration file -// -// From the boost/status directory, run -// ./regression --tests ../libs/graph/test/regression.cfg -o graph.html -// -// Please keep the entries ordered alphabetically by the test's file name. - -run libs/graph/test/graph.cpp -compile libs/graph/test/dijkstra_cc.cpp -compile libs/graph/test/adj_list_cc.cpp -compile libs/graph/test/bfs_cc.cpp -compile libs/graph/test/dfs_cc.cpp -compile libs/graph/test/graph_concepts.cpp -compile libs/graph/test/edge_list_cc.cpp -compile libs/graph/test/reverse_graph_cc.cpp -compile libs/graph/test/adj_matrix_cc.cpp -compile libs/graph/test/filtered_graph_cc.cpp -compile libs/graph/test/stanford_graph_cc.cpp -compile libs/graph/test/vector_graph_cc.cpp -run libs/graph/test/adj_list_test.cpp -run libs/graph/test/bfs.cpp -run libs/graph/test/dfs.cpp diff --git a/Utilities/BGL/boost/graph/test/relaxed_heap_test.cpp b/Utilities/BGL/boost/graph/test/relaxed_heap_test.cpp deleted file mode 100644 index 3bad264a7296cd9515bfbd8f108bc61b9122bf18..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/relaxed_heap_test.cpp +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// 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 -// Andrew Lumsdaine -#ifndef BOOST_RELAXED_HEAP_DEBUG -# define BOOST_RELAXED_HEAP_DEBUG 0 -#endif - -#include <boost/pending/relaxed_heap.hpp> -#include <boost/test/minimal.hpp> -#include <utility> -#include <iostream> -#include <vector> -#include <boost/optional.hpp> -#include <boost/random.hpp> -#include <boost/lexical_cast.hpp> -#include <boost/progress.hpp> - -typedef std::vector<boost::optional<double> > values_type; -values_type values; - -struct less_extvalue -{ - typedef bool result_type; - - bool operator()(unsigned x, unsigned y) const - { - assert(values[x] && values[y]); - return values[x] < values[y]; - } -}; - -using namespace std; - -boost::optional<double> get_min_value() -{ - boost::optional<double> min_value; - for (unsigned i = 0; i < values.size(); ++i) { - if (values[i]) { - if (!min_value || *values[i] < *min_value) min_value = values[i]; - } - } - return min_value; -} - -void interactive_test() -{ - unsigned max_values; - cout << "Enter max number of values in the heap> "; - cin >> max_values; - - values.resize(max_values); - boost::relaxed_heap<unsigned, less_extvalue> heap(max_values); - - char option; - do { - cout << "Enter command> "; - if (cin >> option) { - switch (option) { - case 'i': case 'I': - { - unsigned index; - double value; - if (cin >> index >> value) { - if (index >= values.size()) cout << "Index out of range.\n"; - else if (values[index]) cout << "Already in queue.\n"; - else { - values[index] = value; - heap.push(index); - heap.dump_tree(); - } - } - } - break; - - case 'u': case 'U': - { - unsigned index; - double value; - if (cin >> index >> value) { - if (index >= values.size()) cout << "Index out of range.\n"; - else if (!values[index]) cout << "Not in queue.\n"; - else { - values[index] = value; - heap.update(index); - heap.dump_tree(); - } - } - } - break; - - case 'r': case 'R': - { - unsigned index; - if (cin >> index) { - if (index >= values.size()) cout << "Index out of range.\n"; - else if (!values[index]) cout << "Not in queue.\n"; - else { - heap.remove(index); - heap.dump_tree(); - } - } - } - break; - - case 't': case 'T': - { - if (boost::optional<double> min_value = get_min_value()) { - cout << "Top value is (" << heap.top() << ", " - << *values[heap.top()] << ").\n"; - BOOST_CHECK(*min_value == *values[heap.top()]); - } else { - cout << "Queue is empty.\n"; - BOOST_CHECK(heap.empty()); - } - } - break; - - case 'd': case 'D': - { - if (boost::optional<double> min_value = get_min_value()) { - unsigned victim = heap.top(); - double value = *values[victim]; - cout << "Removed top value (" << victim << ", " << value << ")\n"; - BOOST_CHECK(*min_value == value); - - heap.pop(); - heap.dump_tree(); - values[victim].reset(); - } else { - cout << "Queue is empty.\n"; - BOOST_CHECK(heap.empty()); - } - } - break; - - case 'q': case 'Q': - break; - - default: - cout << "Unknown command '" << option << "'.\n"; - } - } - } while (cin && option != 'q' && option != 'Q'); -} - -void random_test(int n, int iterations, int seed) -{ - values.resize(n); - boost::relaxed_heap<unsigned, less_extvalue> heap(n); - boost::minstd_rand gen(seed); - boost::uniform_int<unsigned> rand_index(0, n-1); - boost::uniform_real<> rand_value(-1000.0, 1000.0); - boost::uniform_int<unsigned> which_option(0, 3); - - cout << n << std::endl; - -#if BOOST_RELAXED_HEAP_DEBUG > 1 - heap.dump_tree(); -#endif - - BOOST_REQUIRE(heap.valid()); - -#if BOOST_RELAXED_HEAP_DEBUG == 0 - boost::progress_display progress(iterations); -#endif - - for (int iteration = 0; iteration < iterations; ++iteration) { -#if BOOST_RELAXED_HEAP_DEBUG > 1 - std::cout << "Iteration #" << iteration << std::endl; -#endif - unsigned victim = rand_index(gen); - if (values[victim]) { - switch (which_option(gen)) { - case 0: case 3: - { - // Update with a smaller weight - boost::uniform_real<> rand_smaller((rand_value.min)(), *values[victim]); - values[victim] = rand_smaller(gen); - assert(*values[victim] >= (rand_smaller.min)()); - assert(*values[victim] <= (rand_smaller.max)()); - -#if BOOST_RELAXED_HEAP_DEBUG > 0 - cout << "u " << victim << " " << *values[victim] << std::endl; - cout.flush(); -#endif - heap.update(victim); - } - break; - - case 1: - { - // Delete minimum value in the queue. - victim = heap.top(); - double top_value = *values[victim]; - BOOST_CHECK(*get_min_value() == top_value); - if (*get_min_value() != top_value) return; -#if BOOST_RELAXED_HEAP_DEBUG > 0 - cout << "d" << std::endl; - cout.flush(); -#endif - heap.pop(); - values[victim].reset(); -#if BOOST_RELAXED_HEAP_DEBUG > 1 - cout << "(Removed " << victim << ")\n"; -#endif // BOOST_RELAXED_HEAP_DEBUG > 1 - } - break; - - case 2: - { - // Just remove this value from the queue completely - values[victim].reset(); -#if BOOST_RELAXED_HEAP_DEBUG > 0 - cout << "r " << victim << std::endl; - cout.flush(); -#endif - heap.remove(victim); - } - break; - - default: - cout << "Random number generator failed." << endl; - BOOST_CHECK(false); - return; - break; - } - } else { - values[victim] = rand_value(gen); - assert(*values[victim] >= (rand_value.min)()); - assert(*values[victim] <= (rand_value.max)()); - -#if BOOST_RELAXED_HEAP_DEBUG > 0 - cout << "i " << victim << " " << *values[victim] << std::endl; - cout.flush(); -#endif - heap.push(victim); - } - -#if BOOST_RELAXED_HEAP_DEBUG > 1 - heap.dump_tree(); -#endif // BOOST_RELAXED_HEAP_DEBUG > 1 - - BOOST_REQUIRE(heap.valid()); - -#if BOOST_RELAXED_HEAP_DEBUG == 0 - ++progress; -#endif - } -} - -int test_main(int argc, char* argv[]) -{ - if (argc >= 3) { - int n = boost::lexical_cast<int>(argv[1]); - int iterations = boost::lexical_cast<int>(argv[2]); - int seed = (argc >= 4? boost::lexical_cast<int>(argv[3]) : 1); - random_test(n, iterations, seed); - } else interactive_test(); - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/reverse_graph_cc.cpp b/Utilities/BGL/boost/graph/test/reverse_graph_cc.cpp deleted file mode 100644 index 00a362e937e730e353afe170fc21a94565da9575..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/reverse_graph_cc.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/reverse_graph.hpp> -#include <string> - -int main(int,char*[]) -{ - using namespace boost; - // Check const reverse_graph - { - typedef adjacency_list< vecS, vecS, bidirectionalS, - property<vertex_color_t, int>, - property<edge_weight_t, int>, - property<graph_name_t, std::string> - > AdjList; - typedef reverse_graph<AdjList> Graph; - function_requires< VertexListGraphConcept<Graph> >(); - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< ReadablePropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< ReadablePropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - AdjList g; - Graph gr(g); - get_property(gr, graph_name_t()); - } - // Check non-const reverse_graph - { - typedef adjacency_list< vecS, vecS, bidirectionalS, - property<vertex_color_t, int>, - property<edge_weight_t, int>, - property<graph_name_t, std::string> - > AdjList; - typedef reverse_graph<AdjList,AdjList&> Graph; - function_requires< VertexListGraphConcept<Graph> >(); - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< PropertyGraphConcept<Graph, Vertex, vertex_color_t> >(); - function_requires< PropertyGraphConcept<Graph, Edge, edge_weight_t> >(); - AdjList g; - Graph gr(g); - get_property(gr, graph_name_t()); - set_property(gr, graph_name_t(), "foo"); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/sequential_vertex_coloring.cpp b/Utilities/BGL/boost/graph/test/sequential_vertex_coloring.cpp deleted file mode 100644 index 2a0775ae06de704dafe3d211ce56e3fbb9ca049f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/sequential_vertex_coloring.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2004 The Trustees of Indiana University. - -// 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 -// Andrew Lumsdaine -#include <boost/graph/sequential_vertex_coloring.hpp> -#include <boost/test/minimal.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <utility> - -using namespace boost; - -int test_main(int, char*[]) -{ - typedef adjacency_list<listS, vecS, undirectedS> Graph; - typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor; - typedef graph_traits<Graph>::vertices_size_type vertices_size_type; - typedef property_map<Graph, vertex_index_t>::const_type vertex_index_map; - - typedef std::pair<int, int> Edge; - enum nodes {A, B, C, D, E, n}; - Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E), - Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), - Edge(E, B) }; - int m = sizeof(edge_array) / sizeof(Edge); - Graph g(edge_array, edge_array + m, n); - - // Test with the normal order - std::vector<vertices_size_type> color_vec(num_vertices(g)); - iterator_property_map<vertices_size_type*, vertex_index_map, - vertices_size_type, vertices_size_type&> - color(&color_vec.front(), get(vertex_index, g)); - vertices_size_type num_colors = sequential_vertex_coloring(g, color); - BOOST_CHECK(num_colors == 3); - BOOST_CHECK(get(color, (vertices_size_type)A) == 0); - BOOST_CHECK(get(color, (vertices_size_type)B) == 0); - BOOST_CHECK(get(color, (vertices_size_type)C) == 1); - BOOST_CHECK(get(color, (vertices_size_type)D) == 2); - BOOST_CHECK(get(color, (vertices_size_type)E) == 1); - return 0; -} - diff --git a/Utilities/BGL/boost/graph/test/stanford_graph_cc.cpp b/Utilities/BGL/boost/graph/test/stanford_graph_cc.cpp deleted file mode 100644 index 1da24d646cdeda26496b03db09ce8c849360d573..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/stanford_graph_cc.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> -#include <boost/graph/stanford_graph.hpp> - -int main(int,char*[]) -{ - using namespace boost; - // Check Stanford GraphBase Graph - { - typedef Graph* Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< PropertyGraphConcept<Graph, Edge, edge_length_t > >(); - function_requires< - PropertyGraphConcept<Graph, Vertex, u_property<Vertex> > >(); - function_requires< - PropertyGraphConcept<Graph, Edge, a_property<Vertex> > >(); - } - { - typedef const Graph* Graph; - typedef graph_traits<Graph>::vertex_descriptor Vertex; - typedef graph_traits<Graph>::edge_descriptor Edge; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Edge, edge_length_t > >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Vertex, u_property<Vertex> > >(); - function_requires< - ReadablePropertyGraphConcept<Graph, Edge, a_property<Vertex> > >(); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/subgraph.cpp b/Utilities/BGL/boost/graph/test/subgraph.cpp deleted file mode 100644 index 80c5f3a1b118ca2232a52030580766fe4e973946..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/subgraph.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// (C) Copyright Jeremy Siek 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) - -#include <set> - -#include <boost/test/minimal.hpp> - -#include <boost/graph/subgraph.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/random.hpp> -#include <boost/graph/graph_test.hpp> -#include <boost/graph/iteration_macros.hpp> - -#include <boost/random/mersenne_twister.hpp> - -// UNDER CONSTRUCTION - -int test_main(int argc, char* argv[]) -{ - using namespace boost; - typedef adjacency_list<vecS, vecS, bidirectionalS, - property<vertex_color_t, int>, - property<edge_index_t, std::size_t, property<edge_weight_t, int> > - > graph_t; - typedef subgraph<graph_t> subgraph_t; - typedef graph_traits<subgraph_t>::vertex_descriptor vertex_t; - typedef graph_traits<subgraph_t>::edge_descriptor edge_t; - - mt19937 gen; - for (int t = 0; t < 100; t += 5) { - subgraph_t g; - int N = t + 2; - std::vector<vertex_t> vertex_set; - std::vector< std::pair<vertex_t, vertex_t> > edge_set; - generate_random_graph(g, N, N * 2, gen, - std::back_inserter(vertex_set), - std::back_inserter(edge_set)); - - graph_test< subgraph_t > gt; - - gt.test_incidence_graph(vertex_set, edge_set, g); - gt.test_bidirectional_graph(vertex_set, edge_set, g); - gt.test_adjacency_graph(vertex_set, edge_set, g); - gt.test_vertex_list_graph(vertex_set, g); - gt.test_edge_list_graph(vertex_set, edge_set, g); - gt.test_adjacency_matrix(vertex_set, edge_set, g); - - std::vector<vertex_t> sub_vertex_set; - std::vector<vertex_t> sub_global_map; - std::vector<vertex_t> global_sub_map(num_vertices(g)); - std::vector< std::pair<vertex_t, vertex_t> > sub_edge_set; - - subgraph_t& g_s = g.create_subgraph(); - - const std::set<vertex_t>::size_type Nsub = N/2; - - // Collect a set of random vertices to put in the subgraph - std::set<vertex_t> verts; - while (verts.size() < Nsub) - verts.insert(random_vertex(g, gen)); - - for (std::set<vertex_t>::iterator it = verts.begin(); - it != verts.end(); ++it) { - vertex_t v_global = *it; - vertex_t v = add_vertex(v_global, g_s); - sub_vertex_set.push_back(v); - sub_global_map.push_back(v_global); - global_sub_map[v_global] = v; - } - - // compute induced edges - BGL_FORALL_EDGES(e, g, subgraph_t) - if (contains(sub_global_map, source(e, g)) - && contains(sub_global_map, target(e, g))) - sub_edge_set.push_back(std::make_pair(global_sub_map[source(e, g)], - global_sub_map[target(e, g)])); - - gt.test_incidence_graph(sub_vertex_set, sub_edge_set, g_s); - gt.test_bidirectional_graph(sub_vertex_set, sub_edge_set, g_s); - gt.test_adjacency_graph(sub_vertex_set, sub_edge_set, g_s); - gt.test_vertex_list_graph(sub_vertex_set, g_s); - gt.test_edge_list_graph(sub_vertex_set, sub_edge_set, g_s); - gt.test_adjacency_matrix(sub_vertex_set, sub_edge_set, g_s); - - if (num_vertices(g_s) == 0) - return 0; - std::vector<int> weights; - for (unsigned i = 0; i < num_vertices(g_s); ++i) - weights.push_back(i*2); - gt.test_vertex_property_graph(weights, vertex_color_t(), g_s); - - // A regression test: the copy constructor of subgraph did not - // copy one of the members, so local_edge->global_edge mapping - // was broken. - { - subgraph_t g; - graph_t::vertex_descriptor v1, v2; - v1 = add_vertex(g); - v2 = add_vertex(g); - add_edge(v1, v2, g); - - subgraph_t sub = g.create_subgraph(vertices(g).first, vertices(g).second); - - graph_t::edge_iterator ei, ee; - for (tie(ei, ee) = edges(sub); ei != ee; ++ei) { - // This used to segfault. - get(edge_weight, sub, *ei); - } - } - - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/test/transitive_closure_test.cpp b/Utilities/BGL/boost/graph/test/transitive_closure_test.cpp deleted file mode 100644 index 791ff9eea8e33e41fe63c3d8ead49f27296fe5b0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/transitive_closure_test.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (C) 2001 Vladimir Prus <ghost@cs.msu.su> -// Copyright (C) 2001 Jeremy Siek <jsiek@cs.indiana.edu> -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - - -#include <boost/graph/vector_as_graph.hpp> -#include <boost/graph/transitive_closure.hpp> - -#include <iostream> - -#include <boost/graph/vector_as_graph.hpp> -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/adjacency_list_io.hpp> -#include <boost/graph/graph_utility.hpp> - -#include <cstdlib> -#include <ctime> -#include <boost/progress.hpp> -using namespace std; -using namespace boost; - -void generate_graph(int n, double p, vector< vector<int> >& r1) -{ - static class { - public: - double operator()() { - return double(rand())/RAND_MAX; - } - } gen; - r1.clear(); - r1.resize(n); - for (int i = 0; i < n; ++i) - for (int j = 0; j < n; ++j) - if (gen() < p) - r1[i].push_back(j); -} - -template <class Graph> -typename graph_traits<Graph>::degree_size_type -num_incident(typename graph_traits<Graph>::vertex_descriptor u, - typename graph_traits<Graph>::vertex_descriptor v, - const Graph& g) -{ - typename graph_traits<Graph>::degree_size_type d = 0; - typename graph_traits<Graph>::out_edge_iterator i, i_end; - for (tie(i, i_end) = out_edges(u, g); i != i_end; ++i) - if (target(*i, g) == v) - ++d; - return d; -} - - -// (i,j) is in E' iff j is reachable from i -// Hmm, is_reachable does not detect when there is a non-trivial path -// from i to i. It always returns true for is_reachable(i,i). -// This needs to be fixed/worked around. -template <typename Graph, typename GraphTC> -bool check_transitive_closure(Graph& g, GraphTC& tc) -{ - typename graph_traits<Graph>::vertex_iterator i, i_end; - for (tie(i, i_end) = vertices(g); i != i_end; ++i) { - typename graph_traits<Graph>::vertex_iterator j, j_end; - for (tie(j, j_end) = vertices(g); j != j_end; ++j) { - bool g_has_edge; - typename graph_traits<Graph>::edge_descriptor e_g; - typename graph_traits<Graph>::degree_size_type num_tc; - tie (e_g, g_has_edge) = edge(*i, *j, g); - num_tc = num_incident(*i, *j, tc); - if (*i == *j) { - if (g_has_edge) { - if (num_tc != 1) - return false; - } else { - bool can_reach = false; - typename graph_traits<Graph>::adjacency_iterator k, k_end; - for (tie(k, k_end) = adjacent_vertices(*i, g); k != k_end; ++k) { - std::vector<default_color_type> color_map_vec(num_vertices(g)); - if (is_reachable(*k, *i, g, &color_map_vec[0])) { - can_reach = true; - break; - } - } - if (can_reach) { - if (num_tc != 1) { - std::cout << "1. " << *i << std::endl; - return false; - } - } else { - if (num_tc != 0) { - std::cout << "2. " << *i << std::endl; - return false; - } - } - } - } else { - std::vector<default_color_type> color_map_vec(num_vertices(g)); - if (is_reachable(*i, *j, g, &color_map_vec[0])) { - if (num_tc != 1) - return false; - } else { - if (num_tc != 0) - return false; - } - } - } - } - return true; -} - -bool test(int n, double p) -{ - vector< vector<int> > g1, g1_tc; - generate_graph(n, p, g1); - cout << "Created graph with " << n << " vertices.\n"; - - vector< vector<int> > g1_c(g1); - - { - progress_timer t; - cout << "transitive_closure" << endl; - transitive_closure(g1, g1_tc, vertex_index_map(identity_property_map())); - } - - if(check_transitive_closure(g1, g1_tc)) - return true; - else { - cout << "Original graph was "; - print_graph(g1, identity_property_map()); - cout << "Result is "; - print_graph(g1_tc, identity_property_map()); - return false; - } -} - - -int main() -{ - srand(time(0)); - static class { - public: - double operator()() { - return double(rand())/RAND_MAX; - } - } gen; - - - for (size_t i = 0; i < 100; ++i) { - int n = 0 + int(20*gen()); - double p = gen(); - if (!test(n, p)) { - cout << "Failed." << endl; - return 1; - } - } - cout << "Passed." << endl; -} - diff --git a/Utilities/BGL/boost/graph/test/transitive_closure_test2.cpp b/Utilities/BGL/boost/graph/test/transitive_closure_test2.cpp deleted file mode 100644 index 1dde3e4496f7ff7cabc032d11d25effc67ab067c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/transitive_closure_test2.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2004 Jeremy Siek <jsiek@cs.indiana.edu> -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/depth_first_search.hpp> -#include <boost/graph/transitive_closure.hpp> -#include <iostream> -using namespace std; - -using namespace boost; -typedef adjacency_list<> graph_t; - -int main(int argc, char *argv[]) { - graph_t g(5),g_TC; - - add_edge(0,2,g); - add_edge(1,0,g); - add_edge(1,2,g); - add_edge(1,4,g); - add_edge(3,0,g); - add_edge(3,2,g); - add_edge(4,2,g); - add_edge(4,3,g); - - transitive_closure(g,g_TC); - - cout << "original graph: 0->2, 1->0, 1->2, 1->4, 3->0, 3->2, 4->2, 4->3" - << endl; - cout << "transitive closure: "; - graph_t::edge_iterator i,iend; - for(tie(i,iend) = edges(g_TC);i!=iend;++i) { - cout << source(*i,g_TC) << "->" << target(*i,g_TC) << " "; - } - cout << endl; -} diff --git a/Utilities/BGL/boost/graph/test/vector_graph_cc.cpp b/Utilities/BGL/boost/graph/test/vector_graph_cc.cpp deleted file mode 100644 index 7f7c5ebdb857835e247b68e9556aa7a5c52b85b8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/graph/test/vector_graph_cc.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//======================================================================= -// 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) -//======================================================================= -#include <boost/config.hpp> -#include <vector> -#include <list> - -// THIS FILE MUST PRECEDE ALL OTHER BOOST GRAPH FILES -// Due to ADL nastiness involving the vertices() function -#include <boost/graph/vector_as_graph.hpp> -// THIS FILE MUST PRECEDE ALL OTHER BOOST GRAPH FILES - -#include <boost/graph/graph_concepts.hpp> -#include <boost/graph/graph_archetypes.hpp> - -int main(int,char*[]) -{ - using namespace boost; - // Check "vector as graph" - { - typedef std::vector< std::list<int> > Graph; - function_requires< VertexListGraphConcept<Graph> >(); - function_requires< IncidenceGraphConcept<Graph> >(); - function_requires< AdjacencyGraphConcept<Graph> >(); - } - return 0; -} diff --git a/Utilities/BGL/boost/graph/tiernan_all_cycles.hpp b/Utilities/BGL/boost/graph/tiernan_all_cycles.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f750eb17795cf5e3855d48e8ee36f1be0642f35e --- /dev/null +++ b/Utilities/BGL/boost/graph/tiernan_all_cycles.hpp @@ -0,0 +1,376 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_CYCLE_HPP +#define BOOST_GRAPH_CYCLE_HPP + +#include <vector> + +#include <boost/config.hpp> +#include <boost/graph/graph_concepts.hpp> +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/properties.hpp> + +#include <boost/concept/detail/concept_def.hpp> +namespace boost { + namespace concepts { + BOOST_concept(CycleVisitor,(Visitor)(Path)(Graph)) + { + BOOST_CONCEPT_USAGE(CycleVisitor) + { + vis.cycle(p, g); + } + private: + Visitor vis; + Graph g; + Path p; + }; + } /* namespace concepts */ +using concepts::CycleVisitorConcept; +} /* namespace boost */ +#include <boost/concept/detail/concept_undef.hpp> + + +namespace boost +{ + +// The implementation of this algorithm is a reproduction of the Teirnan +// approach for directed graphs: bibtex follows +// +// @article{362819, +// author = {James C. Tiernan}, +// title = {An efficient search algorithm to find the elementary circuits of a graph}, +// journal = {Commun. ACM}, +// volume = {13}, +// number = {12}, +// year = {1970}, +// issn = {0001-0782}, +// pages = {722--726}, +// doi = {http://doi.acm.org/10.1145/362814.362819}, +// publisher = {ACM Press}, +// address = {New York, NY, USA}, +// } +// +// It should be pointed out that the author does not provide a complete analysis for +// either time or space. This is in part, due to the fact that it's a fairly input +// sensitive problem related to the density and construction of the graph, not just +// its size. +// +// I've also taken some liberties with the interpretation of the algorithm - I've +// basically modernized it to use real data structures (no more arrays and matrices). +// Oh... and there's explicit control structures - not just gotos. +// +// The problem is definitely NP-complete, an an unbounded implementation of this +// will probably run for quite a while on a large graph. The conclusions +// of this paper also reference a Paton algorithm for undirected graphs as being +// much more efficient (apparently based on spanning trees). Although not implemented, +// it can be found here: +// +// @article{363232, +// author = {Keith Paton}, +// title = {An algorithm for finding a fundamental set of cycles of a graph}, +// journal = {Commun. ACM}, +// volume = {12}, +// number = {9}, +// year = {1969}, +// issn = {0001-0782}, +// pages = {514--518}, +// doi = {http://doi.acm.org/10.1145/363219.363232}, +// publisher = {ACM Press}, +// address = {New York, NY, USA}, +// } + +/** + * The default cycle visitor providse an empty visit function for cycle + * visitors. + */ +struct cycle_visitor +{ + template <typename Path, typename Graph> + inline void cycle(const Path& p, const Graph& g) + { } +}; + +/** + * The min_max_cycle_visitor simultaneously records the minimum and maximum + * cycles in a graph. + */ +struct min_max_cycle_visitor +{ + min_max_cycle_visitor(std::size_t& min_, std::size_t& max_) + : minimum(min_), maximum(max_) + { } + + template <typename Path, typename Graph> + inline void cycle(const Path& p, const Graph& g) + { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + std::size_t len = p.size(); + minimum = min BOOST_PREVENT_MACRO_SUBSTITUTION (minimum, len); + maximum = max BOOST_PREVENT_MACRO_SUBSTITUTION (maximum, len); + } + std::size_t& minimum; + std::size_t& maximum; +}; + +inline min_max_cycle_visitor +find_min_max_cycle(std::size_t& min_, std::size_t& max_) +{ return min_max_cycle_visitor(min_, max_); } + +namespace detail +{ + template <typename Graph, typename Path> + inline bool + is_vertex_in_path(const Graph&, + typename graph_traits<Graph>::vertex_descriptor v, + const Path& p) + { + return (std::find(p.begin(), p.end(), v) != p.end()); + } + + template <typename Graph, typename ClosedMatrix> + inline bool + is_path_closed(const Graph& g, + typename graph_traits<Graph>::vertex_descriptor u, + typename graph_traits<Graph>::vertex_descriptor v, + const ClosedMatrix& closed) + { + // the path from u to v is closed if v can be found in the list + // of closed vertices associated with u. + typedef typename ClosedMatrix::const_reference Row; + Row r = closed[get(vertex_index, g, u)]; + if(find(r.begin(), r.end(), v) != r.end()) { + return true; + } + return false; + } + + template <typename Graph, typename Path, typename ClosedMatrix> + inline bool + can_extend_path(const Graph& g, + typename graph_traits<Graph>::edge_descriptor e, + const Path& p, + const ClosedMatrix& m) + { + function_requires< IncidenceGraphConcept<Graph> >(); + function_requires< VertexIndexGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + + // get the vertices in question + Vertex + u = source(e, g), + v = target(e, g); + + // conditions for allowing a traversal along this edge are: + // 1. the index of v must be greater than that at which the + // the path is rooted (p.front()). + // 2. the vertex v cannot already be in the path + // 3. the vertex v cannot be closed to the vertex u + + bool indices = get(vertex_index, g, p.front()) < get(vertex_index, g, v); + bool path = !is_vertex_in_path(g, v, p); + bool closed = !is_path_closed(g, u, v, m); + return indices && path && closed; + } + + template <typename Graph, typename Path> + inline bool + can_wrap_path(const Graph& g, const Path& p) + { + function_requires< IncidenceGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::out_edge_iterator OutIterator; + + // iterate over the out-edges of the back, looking for the + // front of the path. also, we can't travel along the same + // edge that we did on the way here, but we don't quite have the + // stringent requirements that we do in can_extend_path(). + Vertex + u = p.back(), + v = p.front(); + OutIterator i, end; + for(tie(i, end) = out_edges(u, g); i != end; ++i) { + if((target(*i, g) == v)) { + return true; + } + } + return false; + } + + template <typename Graph, + typename Path, + typename ClosedMatrix> + inline typename graph_traits<Graph>::vertex_descriptor + extend_path(const Graph& g, + Path& p, + ClosedMatrix& closed) + { + function_requires< IncidenceGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::edge_descriptor Edge; + typedef typename graph_traits<Graph>::out_edge_iterator OutIterator; + + // get the current vertex + Vertex u = p.back(); + Vertex ret = graph_traits<Graph>::null_vertex(); + + // AdjacencyIterator i, end; + OutIterator i, end; + for(tie(i, end) = out_edges(u, g); i != end; ++i) { + Vertex v = target(*i, g); + + // if we can actually extend along this edge, + // then that's what we want to do + if(can_extend_path(g, *i, p, closed)) { + p.push_back(v); // add the vertex to the path + ret = v; + break; + } + } + return ret; + } + + template <typename Graph, typename Path, typename ClosedMatrix> + inline bool + exhaust_paths(const Graph& g, Path& p, ClosedMatrix& closed) + { + function_requires< GraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + + // if there's more than one vertex in the path, this closes + // of some possible routes and returns true. otherwise, if there's + // only one vertex left, the vertex has been used up + if(p.size() > 1) { + // get the last and second to last vertices, popping the last + // vertex off the path + Vertex last, prev; + last = p.back(); + p.pop_back(); + prev = p.back(); + + // reset the closure for the last vertex of the path and + // indicate that the last vertex in p is now closed to + // the next-to-last vertex in p + closed[get(vertex_index, g, last)].clear(); + closed[get(vertex_index, g, prev)].push_back(last); + return true; + } + else { + return false; + } + } + + template <typename Graph, typename Visitor> + inline void + all_cycles_from_vertex(const Graph& g, + typename graph_traits<Graph>::vertex_descriptor v, + Visitor vis, + std::size_t minlen, + std::size_t maxlen) + { + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef std::vector<Vertex> Path; + function_requires< CycleVisitorConcept<Visitor,Path,Graph> >(); + typedef std::vector<Vertex> VertexList; + typedef std::vector<VertexList> ClosedMatrix; + + Path p; + ClosedMatrix closed(num_vertices(g), VertexList()); + Vertex null = graph_traits<Graph>::null_vertex(); + + // each path investigation starts at the ith vertex + p.push_back(v); + + while(1) { + // extend the path until we've reached the end or the + // maxlen-sized cycle + Vertex j = null; + while(((j = detail::extend_path(g, p, closed)) != null) + && (p.size() < maxlen)) + ; // empty loop + + // if we're done extending the path and there's an edge + // connecting the back to the front, then we should have + // a cycle. + if(detail::can_wrap_path(g, p) && p.size() >= minlen) { + vis.cycle(p, g); + } + + if(!detail::exhaust_paths(g, p, closed)) { + break; + } + } + } + + // Select the minimum allowable length of a cycle based on the directedness + // of the graph - 2 for directed, 3 for undirected. + template <typename D> struct min_cycles { enum { value = 2 }; }; + template <> struct min_cycles<undirected_tag> { enum { value = 3 }; }; +} /* namespace detail */ + +template <typename Graph, typename Visitor> +inline void +tiernan_all_cycles(const Graph& g, + Visitor vis, + std::size_t minlen, + std::size_t maxlen) +{ + function_requires< VertexListGraphConcept<Graph> >(); + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + + VertexIterator i, end; + for(tie(i, end) = vertices(g); i != end; ++i) { + detail::all_cycles_from_vertex(g, *i, vis, minlen, maxlen); + } +} + +template <typename Graph, typename Visitor> +inline void +tiernan_all_cycles(const Graph& g, Visitor vis, std::size_t maxlen) +{ + typedef typename graph_traits<Graph>::directed_category Dir; + tiernan_all_cycles(g, vis, detail::min_cycles<Dir>::value, maxlen); +} + +template <typename Graph, typename Visitor> +inline void +tiernan_all_cycles(const Graph& g, Visitor vis) +{ + typedef typename graph_traits<Graph>::directed_category Dir; + tiernan_all_cycles(g, vis, detail::min_cycles<Dir>::value, + (std::numeric_limits<std::size_t>::max)()); +} + +template <typename Graph> +inline std::pair<std::size_t, std::size_t> +tiernan_girth_and_circumference(const Graph& g) +{ + std::size_t + min_ = (std::numeric_limits<std::size_t>::max)(), + max_ = 0; + tiernan_all_cycles(g, find_min_max_cycle(min_, max_)); + + // if this is the case, the graph is acyclic... + if(max_ == 0) max_ = min_; + + return std::make_pair(min_, max_); +} + +template <typename Graph> +inline std::size_t +tiernan_girth(const Graph& g) +{ return tiernan_girth_and_circumference(g).first; } + +template <typename Graph> +inline std::size_t +tiernan_circumference(const Graph& g) +{ return tiernan_girth_and_circumference(g).second; } + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/topological_sort.hpp b/Utilities/BGL/boost/graph/topological_sort.hpp index 2ed7e18e92afac2cea06300781b70ec316a1b088..9a7f6eb889be492f5dc354f3f11f89f91e8c0bd3 100644 --- a/Utilities/BGL/boost/graph/topological_sort.hpp +++ b/Utilities/BGL/boost/graph/topological_sort.hpp @@ -12,7 +12,7 @@ #define BOOST_GRAPH_TOPOLOGICAL_SORT_HPP #include <boost/config.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/depth_first_search.hpp> #include <boost/graph/visitors.hpp> #include <boost/graph/exception.hpp> @@ -37,7 +37,7 @@ namespace boost { : m_iter(_iter) { } template <typename Edge, typename Graph> - void back_edge(const Edge& u, Graph&) { throw not_a_dag(); } + void back_edge(const Edge&, Graph&) { throw not_a_dag(); } template <typename Vertex, typename Graph> void finish_vertex(const Vertex& u, Graph&) { *m_iter++ = u; } diff --git a/Utilities/BGL/boost/graph/topology.hpp b/Utilities/BGL/boost/graph/topology.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ada36d19ba8dcb145c2571dec0e9ab00bafacb9a --- /dev/null +++ b/Utilities/BGL/boost/graph/topology.hpp @@ -0,0 +1,598 @@ +// Copyright 2009 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine +#ifndef BOOST_GRAPH_TOPOLOGY_HPP +#define BOOST_GRAPH_TOPOLOGY_HPP + +#include <boost/config/no_tr1/cmath.hpp> +#include <cmath> +#include <boost/random/uniform_01.hpp> +#include <boost/random/linear_congruential.hpp> +#include <boost/math/constants/constants.hpp> // For root_two +#include <boost/algorithm/minmax.hpp> +#include <boost/config.hpp> // For BOOST_STATIC_CONSTANT +#include <boost/math/special_functions/hypot.hpp> + +// Classes and concepts to represent points in a space, with distance and move +// operations (used for Gurson-Atun layout), plus other things like bounding +// boxes used for other layout algorithms. + +namespace boost { + +/*********************************************************** + * Topologies * + ***********************************************************/ +template<std::size_t Dims> +class convex_topology +{ + public: // For VisualAge C++ + struct point + { + BOOST_STATIC_CONSTANT(std::size_t, dimensions = Dims); + point() { } + double& operator[](std::size_t i) {return values[i];} + const double& operator[](std::size_t i) const {return values[i];} + + private: + double values[Dims]; + }; + + public: // For VisualAge C++ + struct point_difference + { + BOOST_STATIC_CONSTANT(std::size_t, dimensions = Dims); + point_difference() { + for (std::size_t i = 0; i < Dims; ++i) values[i] = 0.; + } + double& operator[](std::size_t i) {return values[i];} + const double& operator[](std::size_t i) const {return values[i];} + + friend point_difference operator+(const point_difference& a, const point_difference& b) { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] + b[i]; + return result; + } + + friend point_difference& operator+=(point_difference& a, const point_difference& b) { + for (std::size_t i = 0; i < Dims; ++i) + a[i] += b[i]; + return a; + } + + friend point_difference operator-(const point_difference& a) { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = -a[i]; + return result; + } + + friend point_difference operator-(const point_difference& a, const point_difference& b) { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] - b[i]; + return result; + } + + friend point_difference& operator-=(point_difference& a, const point_difference& b) { + for (std::size_t i = 0; i < Dims; ++i) + a[i] -= b[i]; + return a; + } + + friend point_difference operator*(const point_difference& a, const point_difference& b) { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] * b[i]; + return result; + } + + friend point_difference operator*(const point_difference& a, double b) { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] * b; + return result; + } + + friend point_difference operator*(double a, const point_difference& b) { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a * b[i]; + return result; + } + + friend point_difference operator/(const point_difference& a, const point_difference& b) { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = (b[i] == 0.) ? 0. : a[i] / b[i]; + return result; + } + + friend double dot(const point_difference& a, const point_difference& b) { + double result = 0; + for (std::size_t i = 0; i < Dims; ++i) + result += a[i] * b[i]; + return result; + } + + private: + double values[Dims]; + }; + + public: + typedef point point_type; + typedef point_difference point_difference_type; + + double distance(point a, point b) const + { + double dist = 0.; + for (std::size_t i = 0; i < Dims; ++i) { + double diff = b[i] - a[i]; + dist = boost::math::hypot(dist, diff); + } + // Exact properties of the distance are not important, as long as + // < on what this returns matches real distances; l_2 is used because + // Fruchterman-Reingold also uses this code and it relies on l_2. + return dist; + } + + point move_position_toward(point a, double fraction, point b) const + { + point result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] + (b[i] - a[i]) * fraction; + return result; + } + + point_difference difference(point a, point b) const { + point_difference result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] - b[i]; + return result; + } + + point adjust(point a, point_difference delta) const { + point result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = a[i] + delta[i]; + return result; + } + + point pointwise_min(point a, point b) const { + BOOST_USING_STD_MIN(); + point result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = min BOOST_PREVENT_MACRO_SUBSTITUTION (a[i], b[i]); + return result; + } + + point pointwise_max(point a, point b) const { + BOOST_USING_STD_MAX(); + point result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = max BOOST_PREVENT_MACRO_SUBSTITUTION (a[i], b[i]); + return result; + } + + double norm(point_difference delta) const { + double n = 0.; + for (std::size_t i = 0; i < Dims; ++i) + n = boost::math::hypot(n, delta[i]); + return n; + } + + double volume(point_difference delta) const { + double n = 1.; + for (std::size_t i = 0; i < Dims; ++i) + n *= delta[i]; + return n; + } + +}; + +template<std::size_t Dims, + typename RandomNumberGenerator = minstd_rand> +class hypercube_topology : public convex_topology<Dims> +{ + typedef uniform_01<RandomNumberGenerator, double> rand_t; + + public: + typedef typename convex_topology<Dims>::point_type point_type; + typedef typename convex_topology<Dims>::point_difference_type point_difference_type; + + explicit hypercube_topology(double scaling = 1.0) + : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)), + scaling(scaling) + { } + + hypercube_topology(RandomNumberGenerator& gen, double scaling = 1.0) + : gen_ptr(), rand(new rand_t(gen)), scaling(scaling) { } + + point_type random_point() const + { + point_type p; + for (std::size_t i = 0; i < Dims; ++i) + p[i] = (*rand)() * scaling; + return p; + } + + point_type bound(point_type a) const + { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + point_type p; + for (std::size_t i = 0; i < Dims; ++i) + p[i] = min BOOST_PREVENT_MACRO_SUBSTITUTION (scaling, max BOOST_PREVENT_MACRO_SUBSTITUTION (-scaling, a[i])); + return p; + } + + double distance_from_boundary(point_type a) const + { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); +#ifndef BOOST_NO_STDC_NAMESPACE + using std::abs; +#endif + BOOST_STATIC_ASSERT (Dims >= 1); + double dist = abs(scaling - a[0]); + for (std::size_t i = 1; i < Dims; ++i) + dist = min BOOST_PREVENT_MACRO_SUBSTITUTION (dist, abs(scaling - a[i])); + return dist; + } + + point_type center() const { + point_type result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = scaling * .5; + return result; + } + + point_type origin() const { + point_type result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = 0; + return result; + } + + point_difference_type extent() const { + point_difference_type result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = scaling; + return result; + } + + private: + shared_ptr<RandomNumberGenerator> gen_ptr; + shared_ptr<rand_t> rand; + double scaling; +}; + +template<typename RandomNumberGenerator = minstd_rand> +class square_topology : public hypercube_topology<2, RandomNumberGenerator> +{ + typedef hypercube_topology<2, RandomNumberGenerator> inherited; + + public: + explicit square_topology(double scaling = 1.0) : inherited(scaling) { } + + square_topology(RandomNumberGenerator& gen, double scaling = 1.0) + : inherited(gen, scaling) { } +}; + +template<typename RandomNumberGenerator = minstd_rand> +class rectangle_topology : public convex_topology<2> +{ + typedef uniform_01<RandomNumberGenerator, double> rand_t; + + public: + rectangle_topology(double left, double top, double right, double bottom) + : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)), + left(std::min BOOST_PREVENT_MACRO_SUBSTITUTION (left, right)), + top(std::min BOOST_PREVENT_MACRO_SUBSTITUTION (top, bottom)), + right(std::max BOOST_PREVENT_MACRO_SUBSTITUTION (left, right)), + bottom(std::max BOOST_PREVENT_MACRO_SUBSTITUTION (top, bottom)) { } + + rectangle_topology(RandomNumberGenerator& gen, double left, double top, double right, double bottom) + : gen_ptr(), rand(new rand_t(gen)), + left(std::min BOOST_PREVENT_MACRO_SUBSTITUTION (left, right)), + top(std::min BOOST_PREVENT_MACRO_SUBSTITUTION (top, bottom)), + right(std::max BOOST_PREVENT_MACRO_SUBSTITUTION (left, right)), + bottom(std::max BOOST_PREVENT_MACRO_SUBSTITUTION (top, bottom)) { } + + typedef typename convex_topology<2>::point_type point_type; + typedef typename convex_topology<2>::point_difference_type point_difference_type; + + point_type random_point() const + { + point_type p; + p[0] = (*rand)() * (right - left) + left; + p[1] = (*rand)() * (bottom - top) + top; + return p; + } + + point_type bound(point_type a) const + { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + point_type p; + p[0] = min BOOST_PREVENT_MACRO_SUBSTITUTION (right, max BOOST_PREVENT_MACRO_SUBSTITUTION (left, a[0])); + p[1] = min BOOST_PREVENT_MACRO_SUBSTITUTION (bottom, max BOOST_PREVENT_MACRO_SUBSTITUTION (top, a[1])); + return p; + } + + double distance_from_boundary(point_type a) const + { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); +#ifndef BOOST_NO_STDC_NAMESPACE + using std::abs; +#endif + double dist = abs(left - a[0]); + dist = min BOOST_PREVENT_MACRO_SUBSTITUTION (dist, abs(right - a[0])); + dist = min BOOST_PREVENT_MACRO_SUBSTITUTION (dist, abs(top - a[1])); + dist = min BOOST_PREVENT_MACRO_SUBSTITUTION (dist, abs(bottom - a[1])); + return dist; + } + + point_type center() const { + point_type result; + result[0] = (left + right) / 2.; + result[1] = (top + bottom) / 2.; + return result; + } + + point_type origin() const { + point_type result; + result[0] = left; + result[1] = top; + return result; + } + + point_difference_type extent() const { + point_difference_type result; + result[0] = right - left; + result[1] = bottom - top; + return result; + } + + private: + shared_ptr<RandomNumberGenerator> gen_ptr; + shared_ptr<rand_t> rand; + double left, top, right, bottom; +}; + +template<typename RandomNumberGenerator = minstd_rand> +class cube_topology : public hypercube_topology<3, RandomNumberGenerator> +{ + typedef hypercube_topology<3, RandomNumberGenerator> inherited; + + public: + explicit cube_topology(double scaling = 1.0) : inherited(scaling) { } + + cube_topology(RandomNumberGenerator& gen, double scaling = 1.0) + : inherited(gen, scaling) { } +}; + +template<std::size_t Dims, + typename RandomNumberGenerator = minstd_rand> +class ball_topology : public convex_topology<Dims> +{ + typedef uniform_01<RandomNumberGenerator, double> rand_t; + + public: + typedef typename convex_topology<Dims>::point_type point_type; + typedef typename convex_topology<Dims>::point_difference_type point_difference_type; + + explicit ball_topology(double radius = 1.0) + : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)), + radius(radius) + { } + + ball_topology(RandomNumberGenerator& gen, double radius = 1.0) + : gen_ptr(), rand(new rand_t(gen)), radius(radius) { } + + point_type random_point() const + { + point_type p; + double dist_sum; + do { + dist_sum = 0.0; + for (std::size_t i = 0; i < Dims; ++i) { + double x = (*rand)() * 2*radius - radius; + p[i] = x; + dist_sum += x * x; + } + } while (dist_sum > radius*radius); + return p; + } + + point_type bound(point_type a) const + { + BOOST_USING_STD_MIN(); + BOOST_USING_STD_MAX(); + double r = 0.; + for (std::size_t i = 0; i < Dims; ++i) + r = boost::math::hypot(r, a[i]); + if (r <= radius) return a; + double scaling_factor = radius / r; + point_type p; + for (std::size_t i = 0; i < Dims; ++i) + p[i] = a[i] * scaling_factor; + return p; + } + + double distance_from_boundary(point_type a) const + { + double r = 0.; + for (std::size_t i = 0; i < Dims; ++i) + r = boost::math::hypot(r, a[i]); + return radius - r; + } + + point_type center() const { + point_type result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = 0; + return result; + } + + point_type origin() const { + point_type result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = -radius; + return result; + } + + point_difference_type extent() const { + point_difference_type result; + for (std::size_t i = 0; i < Dims; ++i) + result[i] = 2. * radius; + return result; + } + + private: + shared_ptr<RandomNumberGenerator> gen_ptr; + shared_ptr<rand_t> rand; + double radius; +}; + +template<typename RandomNumberGenerator = minstd_rand> +class circle_topology : public ball_topology<2, RandomNumberGenerator> +{ + typedef ball_topology<2, RandomNumberGenerator> inherited; + + public: + explicit circle_topology(double radius = 1.0) : inherited(radius) { } + + circle_topology(RandomNumberGenerator& gen, double radius = 1.0) + : inherited(gen, radius) { } +}; + +template<typename RandomNumberGenerator = minstd_rand> +class sphere_topology : public ball_topology<3, RandomNumberGenerator> +{ + typedef ball_topology<3, RandomNumberGenerator> inherited; + + public: + explicit sphere_topology(double radius = 1.0) : inherited(radius) { } + + sphere_topology(RandomNumberGenerator& gen, double radius = 1.0) + : inherited(gen, radius) { } +}; + +template<typename RandomNumberGenerator = minstd_rand> +class heart_topology +{ + // Heart is defined as the union of three shapes: + // Square w/ corners (+-1000, -1000), (0, 0), (0, -2000) + // Circle centered at (-500, -500) radius 500*sqrt(2) + // Circle centered at (500, -500) radius 500*sqrt(2) + // Bounding box (-1000, -2000) - (1000, 500*(sqrt(2) - 1)) + + struct point + { + point() { values[0] = 0.0; values[1] = 0.0; } + point(double x, double y) { values[0] = x; values[1] = y; } + + double& operator[](std::size_t i) { return values[i]; } + double operator[](std::size_t i) const { return values[i]; } + + private: + double values[2]; + }; + + bool in_heart(point p) const + { +#ifndef BOOST_NO_STDC_NAMESPACE + using std::abs; +#endif + + if (p[1] < abs(p[0]) - 2000) return false; // Bottom + if (p[1] <= -1000) return true; // Diagonal of square + if (boost::math::hypot(p[0] - -500, p[1] - -500) <= 500. * boost::math::constants::root_two<double>()) + return true; // Left circle + if (boost::math::hypot(p[0] - 500, p[1] - -500) <= 500. * boost::math::constants::root_two<double>()) + return true; // Right circle + return false; + } + + bool segment_within_heart(point p1, point p2) const + { + // Assumes that p1 and p2 are within the heart + if ((p1[0] < 0) == (p2[0] < 0)) return true; // Same side of symmetry line + if (p1[0] == p2[0]) return true; // Vertical + double slope = (p2[1] - p1[1]) / (p2[0] - p1[0]); + double intercept = p1[1] - p1[0] * slope; + if (intercept > 0) return false; // Crosses between circles + return true; + } + + typedef uniform_01<RandomNumberGenerator, double> rand_t; + + public: + typedef point point_type; + + heart_topology() + : gen_ptr(new RandomNumberGenerator), rand(new rand_t(*gen_ptr)) { } + + heart_topology(RandomNumberGenerator& gen) + : gen_ptr(), rand(new rand_t(gen)) { } + + point random_point() const + { + point result; + do { + result[0] = (*rand)() * (1000 + 1000 * boost::math::constants::root_two<double>()) - (500 + 500 * boost::math::constants::root_two<double>()); + result[1] = (*rand)() * (2000 + 500 * (boost::math::constants::root_two<double>() - 1)) - 2000; + } while (!in_heart(result)); + return result; + } + + // Not going to provide clipping to bounding region or distance from boundary + + double distance(point a, point b) const + { + if (segment_within_heart(a, b)) { + // Straight line + return boost::math::hypot(b[0] - a[0], b[1] - a[1]); + } else { + // Straight line bending around (0, 0) + return boost::math::hypot(a[0], a[1]) + boost::math::hypot(b[0], b[1]); + } + } + + point move_position_toward(point a, double fraction, point b) const + { + if (segment_within_heart(a, b)) { + // Straight line + return point(a[0] + (b[0] - a[0]) * fraction, + a[1] + (b[1] - a[1]) * fraction); + } else { + double distance_to_point_a = boost::math::hypot(a[0], a[1]); + double distance_to_point_b = boost::math::hypot(b[0], b[1]); + double location_of_point = distance_to_point_a / + (distance_to_point_a + distance_to_point_b); + if (fraction < location_of_point) + return point(a[0] * (1 - fraction / location_of_point), + a[1] * (1 - fraction / location_of_point)); + else + return point( + b[0] * ((fraction - location_of_point) / (1 - location_of_point)), + b[1] * ((fraction - location_of_point) / (1 - location_of_point))); + } + } + + private: + shared_ptr<RandomNumberGenerator> gen_ptr; + shared_ptr<rand_t> rand; +}; + +} // namespace boost + +#endif // BOOST_GRAPH_TOPOLOGY_HPP diff --git a/Utilities/BGL/boost/graph/transitive_closure.hpp b/Utilities/BGL/boost/graph/transitive_closure.hpp index a4742ab155e1d8f803c3bb6e89eb650d4bd83011..378dacf54f51732bb35c93f4219505fb5025fa4e 100644 --- a/Utilities/BGL/boost/graph/transitive_closure.hpp +++ b/Utilities/BGL/boost/graph/transitive_closure.hpp @@ -38,13 +38,13 @@ namespace boost namespace detail { - template < typename Container, typename ST = std::size_t, - typename VT = typename Container::value_type > + template < typename TheContainer, typename ST = std::size_t, + typename VT = typename TheContainer::value_type > struct subscript_t:public std::unary_function < ST, VT > { typedef VT& result_type; - subscript_t(Container & c):container(&c) + subscript_t(TheContainer & c):container(&c) { } VT & operator() (const ST & i) const @@ -52,11 +52,11 @@ namespace boost return (*container)[i]; } protected: - Container * container; + TheContainer * container; }; - template < typename Container > - subscript_t < Container > subscript(Container & c) { - return subscript_t < Container > (c); + template < typename TheContainer > + subscript_t < TheContainer > subscript(TheContainer & c) { + return subscript_t < TheContainer > (c); } } // namespace detail diff --git a/Utilities/BGL/boost/graph/transitive_reduction.hpp b/Utilities/BGL/boost/graph/transitive_reduction.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5cfa9627d8ff21e74b24a6276fea83719802d727 --- /dev/null +++ b/Utilities/BGL/boost/graph/transitive_reduction.hpp @@ -0,0 +1,130 @@ +// (C) Copyright 2009 Eric Bose-Wolf +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_TRANSITIVE_REDUCTION_HPP +#define BOOST_GRAPH_TRANSITIVE_REDUCTION_HPP + +#include <vector> +#include <algorithm> //std::find +#include <boost/concept/requires.hpp> +#include <boost/concept_check.hpp> + +#include <boost/graph/graph_traits.hpp> +#include <boost/graph/topological_sort.hpp> + +// also I didn't got all of the concepts thin. Am I suppose to check +// for all concepts, which are needed for functions I call? (As if I +// wouldn't do that, the users would see the functions called by +// complaining about missings concepts, which would be clearly an error +// message revealing internal implementation and should therefore be avoided?) + +// the pseudocode which I followed implementing this algorithmn was taken +// from the german book Algorithmische Graphentheorie by Volker Turau +// it is proposed to be of O(n + nm_red ) where n is the number +// of vertices and m_red is the number of edges in the transitive +// reduction, but I think my implementation spoiled this up at some point +// indicated below. + +namespace boost { + +template < + typename Graph, typename GraphTR, typename G_to_TR_VertexMap, + typename VertexIndexMap +> +BOOST_CONCEPT_REQUIRES( + ((VertexListGraphConcept< Graph >)) + ((IncidenceGraphConcept< Graph >)) + ((MutableGraphConcept< GraphTR >)) + ((ReadablePropertyMapConcept< VertexIndexMap, + typename graph_traits<Graph>::vertex_descriptor >)) + ((Integer< typename + property_traits< VertexIndexMap >::value_type >)) + ((LvaluePropertyMapConcept< G_to_TR_VertexMap, + typename graph_traits<Graph>::vertex_descriptor >)), + (void)) +transitive_reduction(const Graph& g, GraphTR& tr, + G_to_TR_VertexMap g_to_tr_map, + VertexIndexMap g_index_map ) +{ + typedef typename graph_traits<Graph>::vertex_descriptor Vertex; + typedef typename graph_traits<Graph>::vertex_iterator VertexIterator; + typedef typename std::vector<Vertex>::size_type size_type; + + std::vector<Vertex> topo_order; + topological_sort(g, std::back_inserter(topo_order)); + + std::vector<size_type> topo_number_storage(num_vertices(g)); + + iterator_property_map<size_type*, VertexIndexMap, + size_type, size_type&> topo_number( &topo_number_storage[0], g_index_map ); + + { + typename std::vector<Vertex>::reverse_iterator it = topo_order.rbegin(); + size_type n = 0; + for(; it != topo_order.rend(); ++it,++n ) { + topo_number[ *it ] = n; + } + } + + std::vector< std::vector< bool > > edge_in_closure(num_vertices(g), + std::vector<bool>( num_vertices(g), false)); + { + typename std::vector<Vertex>::reverse_iterator it = topo_order.rbegin(); + for( ; it != topo_order.rend(); ++it ) { + g_to_tr_map[*it] = add_vertex(tr); + } + } + + typename std::vector<Vertex>::iterator + it = topo_order.begin(), + end = topo_order.end(); + for( ; it != end; ++it ) { + size_type i = topo_number[ *it ]; + edge_in_closure[i][i] = true; + std::vector<Vertex> neighbors; + + //I have to collect the successors of *it and traverse them in + //ascending topological order. I didn't know a better way, how to + //do that. So what I'm doint is, collection the successors of *it here + { + typename Graph::out_edge_iterator oi,oi_end; + for( tie(oi, oi_end) = out_edges( *it, g ); oi != oi_end; ++oi ) { + neighbors.push_back( target( *oi, g ) ); + } + } + + { + //and run through all vertices in topological order + typename std::vector<Vertex>::reverse_iterator + rit = topo_order.rbegin(); + rend = topo_order.rend(); + for(; rit != rend; ++rit ) { + //looking if they are successors of *it + if( std::find( neighbors.begin(), neighbors.end(), *rit) != neighbors.end() ) { + size_type j = topo_number[ *rit ]; + if( not edge_in_closure[i][j] ) { + for(size_type k = j; k < num_vertices(g); ++k) { + if( not edge_in_closure[i][k] ) { + //here we need edge_in_closure to be in topological order, + edge_in_closure[i][k] = edge_in_closure[j][k]; + } + } + //therefore we only access edge_in_closure only through + //topo_number property_map + add_edge(g_to_tr_map[*it], g_to_tr_map[*rit], tr); + } //if ( not edge_in_ + } //if (find ( + } //for( typename vector<Vertex>::reverse_iterator + } // { + + } //for( typename vector<Vertex>::iterator + +} //void transitive_reduction + +} // namespace boost + +#endif + diff --git a/Utilities/BGL/boost/graph/two_bit_color_map.hpp b/Utilities/BGL/boost/graph/two_bit_color_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1a3336bddb3557ad977ef0701c32ab9453460972 --- /dev/null +++ b/Utilities/BGL/boost/graph/two_bit_color_map.hpp @@ -0,0 +1,100 @@ +// Copyright (C) 2005-2006 The Trustees of Indiana University. + +// 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) + +// Authors: Jeremiah Willcock +// Douglas Gregor +// Andrew Lumsdaine + +// Two bit per color property map + +#ifndef BOOST_TWO_BIT_COLOR_MAP_HPP +#define BOOST_TWO_BIT_COLOR_MAP_HPP + +#include <boost/property_map/property_map.hpp> +#include <boost/graph/properties.hpp> +#include <boost/shared_array.hpp> +#include <algorithm> + +namespace boost { + +enum two_bit_color_type { + two_bit_white = 0, + two_bit_gray = 1, + two_bit_green = 2, + two_bit_black = 3 +}; + +template <> +struct color_traits<two_bit_color_type> +{ + static two_bit_color_type white() { return two_bit_white; } + static two_bit_color_type gray() { return two_bit_gray; } + static two_bit_color_type green() { return two_bit_green; } + static two_bit_color_type black() { return two_bit_black; } +}; + + +template<typename IndexMap = identity_property_map> +struct two_bit_color_map +{ + std::size_t n; + IndexMap index; + shared_array<unsigned char> data; + + typedef typename property_traits<IndexMap>::key_type key_type; + typedef two_bit_color_type value_type; + typedef void reference; + typedef read_write_property_map_tag category; + + explicit two_bit_color_map(std::size_t n, const IndexMap& index = IndexMap()) + : n(n), index(index), data(new unsigned char[(n + 3) / 4]) + { + // Fill to white + std::fill(data.get(), data.get() + (n + 3) / 4, 0); + } +}; + +template<typename IndexMap> +inline two_bit_color_type +get(const two_bit_color_map<IndexMap>& pm, + typename two_bit_color_map<IndexMap>::key_type key) +{ + typename property_traits<IndexMap>::value_type i = get(pm.index, key); + assert ((std::size_t)i < pm.n); + return two_bit_color_type((pm.data.get()[i / 4] >> ((i % 4) * 2)) & 3); +} + +template<typename IndexMap> +inline void +put(const two_bit_color_map<IndexMap>& pm, + typename two_bit_color_map<IndexMap>::key_type key, + two_bit_color_type value) +{ + typename property_traits<IndexMap>::value_type i = get(pm.index, key); + assert ((std::size_t)i < pm.n); + assert (value >= 0 && value < 4); + std::size_t byte_num = i / 4; + std::size_t bit_position = ((i % 4) * 2); + pm.data.get()[byte_num] = + (unsigned char) + ((pm.data.get()[byte_num] & ~(3 << bit_position)) + | (value << bit_position)); +} + +template<typename IndexMap> +inline two_bit_color_map<IndexMap> +make_two_bit_color_map(std::size_t n, const IndexMap& index_map) +{ + return two_bit_color_map<IndexMap>(n, index_map); +} + +} // end namespace boost + +#endif // BOOST_TWO_BIT_COLOR_MAP_HPP + +#ifdef BOOST_GRAPH_USE_MPI +# include <boost/graph/distributed/two_bit_color_map.hpp> +#endif diff --git a/Utilities/BGL/boost/graph/undirected_graph.hpp b/Utilities/BGL/boost/graph/undirected_graph.hpp new file mode 100644 index 0000000000000000000000000000000000000000..abfa4adb977fc1e9e3ec78d74837225a49504fe2 --- /dev/null +++ b/Utilities/BGL/boost/graph/undirected_graph.hpp @@ -0,0 +1,689 @@ +// (C) Copyright 2007-2009 Andrew Sutton +// +// Use, modification and distribution are 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) + +#ifndef BOOST_GRAPH_UNDIRECTED_GRAPH_HPP +#define BOOST_GRAPH_UNDIRECTED_GRAPH_HPP + +#include <boost/utility.hpp> +#include <boost/graph/adjacency_list.hpp> +#include <boost/graph/properties.hpp> + +// NOTE: The retag_property_list is used to "normalize" a proeprty such that +// any non-property conforming parameter is wrapped in a vertex_bundle +// property. For example (with bad syntax) retag<property<X>> -> property<X>, +// but retag<foo> -> property<vertex_bundle_t, foo>. + +namespace boost +{ +struct undirected_graph_tag { }; + +/** + * The undirected_graph class template is a simplified version of the BGL + * adjacency list. This class is provided for ease of use, but may not + * perform as well as custom-defined adjacency list classes. Instances of + * this template model the VertexIndexGraph, and EdgeIndexGraph concepts. The + * graph is also fully mutable, supporting both insertions and removals of + * vertices and edges. + * + * @note Special care must be taken when removing vertices or edges since + * those operations can invalidate the numbering of vertices. + */ +template < + typename VertexProp = no_property, + typename EdgeProp= no_property, + typename GraphProp = no_property> +class undirected_graph +{ +public: + typedef typename graph_detail::vertex_prop<VertexProp>::type vertex_property_type; + typedef typename graph_detail::vertex_prop<VertexProp>::bundle vertex_bundled; + typedef typename graph_detail::edge_prop<EdgeProp>::type edge_property_type; + typedef typename graph_detail::edge_prop<EdgeProp>::bundle edge_bundled; + +private: + typedef property<vertex_index_t, unsigned, vertex_property_type> vertex_property; + typedef property<edge_index_t, unsigned, edge_property_type> edge_property; +public: + typedef adjacency_list<listS, + listS, + undirectedS, + vertex_property, + edge_property, + GraphProp, + listS> graph_type; +private: + // storage selectors + typedef typename graph_type::vertex_list_selector vertex_list_selector; + typedef typename graph_type::edge_list_selector edge_list_selector; + typedef typename graph_type::out_edge_list_selector out_edge_list_selector; + typedef typename graph_type::directed_selector directed_selector; + +public: + typedef undirected_graph_tag graph_tag; + typedef typename graph_type::graph_property_type graph_property_type; + + // more commonly used graph types + typedef typename graph_type::stored_vertex stored_vertex; + typedef typename graph_type::vertices_size_type vertices_size_type; + typedef typename graph_type::edges_size_type edges_size_type; + typedef typename graph_type::degree_size_type degree_size_type; + typedef typename graph_type::vertex_descriptor vertex_descriptor; + typedef typename graph_type::edge_descriptor edge_descriptor; + + // iterator types + typedef typename graph_type::vertex_iterator vertex_iterator; + typedef typename graph_type::edge_iterator edge_iterator; + typedef typename graph_type::out_edge_iterator out_edge_iterator; + typedef typename graph_type::in_edge_iterator in_edge_iterator; + typedef typename graph_type::adjacency_iterator adjacency_iterator; + + // miscellaneous types + typedef typename graph_type::directed_category directed_category; + typedef typename graph_type::edge_parallel_category edge_parallel_category; + typedef typename graph_type::traversal_category traversal_category; + + typedef std::size_t vertex_index_type; + typedef std::size_t edge_index_type; + + inline undirected_graph(GraphProp const& p = GraphProp()) + : m_graph(p), m_num_vertices(0), m_num_edges(0), m_max_vertex_index(0) + , m_max_edge_index(0) + { } + + inline undirected_graph(undirected_graph const& x) + : m_graph(x), m_num_vertices(x.m_num_vertices), m_num_edges(x.m_num_edges) + , m_max_vertex_index(x.m_max_vertex_index), m_max_edge_index(x.m_max_edge_index) + { } + + inline undirected_graph(vertices_size_type n, + GraphProp const& p = GraphProp()) + : m_graph(n, p), m_num_vertices(n), m_num_edges(0), m_max_vertex_index(n) + , m_max_edge_index(0) + { renumber_vertex_indices(); } + + template <typename EdgeIterator> + inline undirected_graph(EdgeIterator f, + EdgeIterator l, + vertices_size_type n, + edges_size_type m = 0, + GraphProp const& p = GraphProp()) + : m_graph(f, l, n, m, p), m_num_vertices(n), m_num_edges(0) + , m_max_vertex_index(n), m_max_edge_index(0) + { + // Unfortunately, we have to renumber to ensure correct indexing. + renumber_indices(); + + // Can't always guarantee that the number of edges is actually + // m if distance(f, l) != m (or is undefined). + m_num_edges = m_max_edge_index = boost::num_edges(m_graph); + } + + undirected_graph& operator =(undirected_graph const& g) { + if(&g != this) { + m_graph = g.m_graph; + m_num_vertices = g.m_num_vertices; + m_num_edges = g.m_num_edges; + m_max_vertex_index = g.m_max_vertex_index; + } + return *this; + } + + // The impl_() methods are not part of the public interface. + graph_type& impl() + { return m_graph; } + + graph_type const& impl() const + { return m_graph; } + + // The following methods are not part of the public interface + vertices_size_type num_vertices() const + { return m_num_vertices; } + + +private: + // This helper function manages the attribution of vertex indices. + vertex_descriptor make_index(vertex_descriptor v) { + boost::put(vertex_index, m_graph, v, m_max_vertex_index); + m_num_vertices++; + m_max_vertex_index++; + return v; + } +public: + vertex_descriptor add_vertex() + { return make_index(boost::add_vertex(m_graph)); } + + vertex_descriptor add_vertex(vertex_property_type const& p) + { return make_index(boost::add_vertex(vertex_property(0u, p), m_graph)); } + + void clear_vertex(vertex_descriptor v) { + std::pair<out_edge_iterator, out_edge_iterator> + p = boost::out_edges(v, m_graph); + m_num_edges -= std::distance(p.first, p.second); + boost::clear_vertex(v, m_graph); + } + + void remove_vertex(vertex_descriptor v) { + boost::remove_vertex(v, m_graph); + --m_num_vertices; + } + + edges_size_type num_edges() const + { return m_num_edges; } + +private: + // A helper fucntion for managing edge index attributes. + std::pair<edge_descriptor, bool> const& + make_index(std::pair<edge_descriptor, bool> const& x) + { + if(x.second) { + boost::put(edge_index, m_graph, x.first, m_max_edge_index); + ++m_num_edges; + ++m_max_edge_index; + } + return x; + } +public: + std::pair<edge_descriptor, bool> + add_edge(vertex_descriptor u, vertex_descriptor v) + { return make_index(boost::add_edge(u, v, m_graph)); } + + std::pair<edge_descriptor, bool> + add_edge(vertex_descriptor u, vertex_descriptor v, + edge_property_type const& p) + { return make_index(boost::add_edge(u, v, edge_property(0u, p), m_graph)); } + + void remove_edge(vertex_descriptor u, vertex_descriptor v) { + // find all edges, (u, v) + std::vector<edge_descriptor> edges; + out_edge_iterator i, i_end; + for(tie(i, i_end) = boost::out_edges(u, m_graph); i != i_end; ++i) { + if(boost::target(*i, m_graph) == v) { + edges.push_back(*i); + } + } + // remove all edges, (u, v) + typename std::vector<edge_descriptor>::iterator + j = edges.begin(), j_end = edges.end(); + for( ; j != j_end; ++j) { + remove_edge(*j); + } + } + + void remove_edge(edge_iterator i) { + remove_edge(*i); + } + + void remove_edge(edge_descriptor e) { + boost::remove_edge(e, m_graph); + --m_num_edges; + } + + vertex_index_type max_vertex_index() const + { return m_max_vertex_index; } + + void renumber_vertex_indices() { + vertex_iterator i, i_end; + tie(i, i_end) = vertices(m_graph); + m_max_vertex_index = renumber_vertex_indices(i, i_end, 0); + } + + void remove_vertex_and_renumber_indices(vertex_iterator i) { + vertex_iterator j = next(i), end = vertices(m_graph).second; + vertex_index_type n = get(vertex_index, m_graph, *i); + + // remove the offending vertex and renumber everything after + remove_vertex(*i); + m_max_vertex_index = renumber_vertex_indices(j, end, n); + } + + + edge_index_type max_edge_index() const + { return m_max_edge_index; } + + void renumber_edge_indices() { + edge_iterator i, end; + tie(i, end) = edges(m_graph); + m_max_edge_index = renumber_edge_indices(i, end, 0); + } + + void remove_edge_and_renumber_indices(edge_iterator i) { + edge_iterator j = next(i), end = edges(m_graph.second); + edge_index_type n = get(edge_index, m_graph, *i); + + // remove the edge and renumber everything after it + remove_edge(*i); + m_max_edge_index = renumber_edge_indices(j, end, n); + } + + void renumber_indices() { + renumber_vertex_indices(); + renumber_edge_indices(); + } + + // bundled property support +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES + vertex_bundled& operator[](vertex_descriptor v) + { return m_graph[v]; } + + vertex_bundled const& operator[](vertex_descriptor v) const + { return m_graph[v]; } + + edge_bundled& operator[](edge_descriptor e) + { return m_graph[e]; } + + edge_bundled const& operator[](edge_descriptor e) const + { return m_graph[e]; } +#endif + + // Graph concepts + static vertex_descriptor null_vertex() + { return graph_type::null_vertex(); } + + void clear() { + m_graph.clear(); + m_num_vertices = m_max_vertex_index = 0; + m_num_edges = m_max_edge_index = 0; + } + + void swap(undirected_graph& g) { + m_graph.swap(g); + std::swap(m_num_vertices, g.m_num_vertices); + std::swap(m_max_vertex_index, g.m_max_vertex_index); + std::swap(m_num_edges, g.m_num_edges); + std::swap(m_max_edge_index, g.m_max_edge_index); + } + +private: + vertices_size_type renumber_vertex_indices(vertex_iterator i, + vertex_iterator end, + vertices_size_type n) + { + typedef typename property_map<graph_type, vertex_index_t>::type IndexMap; + IndexMap indices = get(vertex_index, m_graph); + for( ; i != end; ++i) { + indices[*i] = n++; + } + return n; + } + + edges_size_type renumber_edge_indices(edge_iterator i, + edge_iterator end, + edges_size_type n) + { + typedef typename property_map<graph_type, edge_index_t>::type IndexMap; + IndexMap indices = get(edge_index, m_graph); + for( ; i != end; ++i) { + indices[*i] = n++; + } + return n; + } + + graph_type m_graph; + vertices_size_type m_num_vertices; + edges_size_type m_num_edges; + vertex_index_type m_max_vertex_index; + edge_index_type m_max_edge_index; +}; + +#define UNDIRECTED_GRAPH_PARAMS typename VP, typename EP, typename GP +#define UNDIRECTED_GRAPH undirected_graph<VP,EP,GP> + +// IncidenceGraph concepts +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::vertex_descriptor +source(typename UNDIRECTED_GRAPH::edge_descriptor e, + UNDIRECTED_GRAPH const& g) +{ return source(e, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::vertex_descriptor +target(typename UNDIRECTED_GRAPH::edge_descriptor e, + UNDIRECTED_GRAPH const& g) +{ return target(e, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::degree_size_type +out_degree(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return out_degree(v, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair< + typename UNDIRECTED_GRAPH::out_edge_iterator, + typename UNDIRECTED_GRAPH::out_edge_iterator +> +out_edges(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return out_edges(v, g.impl()); } + +// BidirectionalGraph concepts +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::degree_size_type +in_degree(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return in_degree(v, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair< + typename UNDIRECTED_GRAPH::in_edge_iterator, + typename UNDIRECTED_GRAPH::in_edge_iterator +> +in_edges(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return in_edges(v, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair< + typename UNDIRECTED_GRAPH::out_edge_iterator, + typename UNDIRECTED_GRAPH::out_edge_iterator +> +incident_edges(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return out_edges(v, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::degree_size_type +degree(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return degree(v, g.impl()); } + +// AdjacencyGraph concepts +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair< + typename UNDIRECTED_GRAPH::adjacency_iterator, + typename UNDIRECTED_GRAPH::adjacency_iterator + > +adjacent_vertices(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return adjacent_vertices(v, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +typename UNDIRECTED_GRAPH::vertex_descriptor +vertex(typename UNDIRECTED_GRAPH::vertices_size_type n, + UNDIRECTED_GRAPH const& g) +{ return vertex(g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS> +std::pair<typename UNDIRECTED_GRAPH::edge_descriptor, bool> +edge(typename UNDIRECTED_GRAPH::vertex_descriptor u, + typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return edge(u, v, g.impl()); } + +// VertexListGraph concepts +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::vertices_size_type +num_vertices(UNDIRECTED_GRAPH const& g) +{ return g.num_vertices(); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair< + typename UNDIRECTED_GRAPH::vertex_iterator, + typename UNDIRECTED_GRAPH::vertex_iterator +> +vertices(UNDIRECTED_GRAPH const& g) +{ return vertices(g.impl()); } + +// EdgeListGraph concepts +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::edges_size_type +num_edges(UNDIRECTED_GRAPH const& g) +{ return g.num_edges(); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair< + typename UNDIRECTED_GRAPH::edge_iterator, + typename UNDIRECTED_GRAPH::edge_iterator +> +edges(UNDIRECTED_GRAPH const& g) +{ return edges(g.impl()); } + +// MutableGraph concepts +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::vertex_descriptor +add_vertex(UNDIRECTED_GRAPH& g) +{ return g.add_vertex(); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::vertex_descriptor +add_vertex(typename UNDIRECTED_GRAPH::vertex_property_type const& p, + UNDIRECTED_GRAPH& g) +{ return g.add_vertex(p); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +clear_vertex(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH& g) +{ return g.clear_vertex(v); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +remove_vertex(typename UNDIRECTED_GRAPH::vertex_descriptor v, UNDIRECTED_GRAPH& g) +{ return g.remove_vertex(v); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair<typename UNDIRECTED_GRAPH::edge_descriptor, bool> +add_edge(typename UNDIRECTED_GRAPH::vertex_descriptor u, + typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH& g) +{ return g.add_edge(u, v); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline std::pair<typename UNDIRECTED_GRAPH::edge_descriptor, bool> +add_edge(typename UNDIRECTED_GRAPH::vertex_descriptor u, + typename UNDIRECTED_GRAPH::vertex_descriptor v, + typename UNDIRECTED_GRAPH::edge_property_type const& p, + UNDIRECTED_GRAPH& g) +{ return g.add_edge(u, v, p); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +remove_edge(typename UNDIRECTED_GRAPH::vertex_descriptor u, + typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH& g) +{ return g.remove_edge(u, v); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +remove_edge(typename UNDIRECTED_GRAPH::edge_descriptor e, UNDIRECTED_GRAPH& g) +{ return g.remove_edge(e); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +remove_edge(typename UNDIRECTED_GRAPH::edge_iterator i, UNDIRECTED_GRAPH& g) +{ return g.remove_edge(i); } + +template <UNDIRECTED_GRAPH_PARAMS, class Predicate> +inline void remove_edge_if(Predicate pred, UNDIRECTED_GRAPH& g) +{ return remove_edge_if(pred, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS, class Predicate> +inline void +remove_incident_edge_if(typename UNDIRECTED_GRAPH::vertex_descriptor v, + Predicate pred, + UNDIRECTED_GRAPH& g) +{ return remove_out_edge_if(v, pred, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS, class Predicate> +inline void +remove_out_edge_if(typename UNDIRECTED_GRAPH::vertex_descriptor v, + Predicate pred, + UNDIRECTED_GRAPH& g) +{ return remove_out_edge_if(v, pred, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS, class Predicate> +inline void +remove_in_edge_if(typename UNDIRECTED_GRAPH::vertex_descriptor v, + Predicate pred, + UNDIRECTED_GRAPH& g) +{ return remove_in_edge_if(v, pred, g.impl()); } + +// Helper code for working with property maps +namespace detail { + struct undirected_graph_vertex_property_selector { + template <class UndirectedGraph, class Property, class Tag> + struct bind_ { + typedef typename UndirectedGraph::graph_type Graph; + typedef property_map<Graph, Tag> PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; + + struct undirected_graph_edge_property_selector { + template <class UndirectedGraph, class Property, class Tag> + struct bind_ { + typedef typename UndirectedGraph::graph_type Graph; + typedef property_map<Graph, Tag> PropertyMap; + typedef typename PropertyMap::type type; + typedef typename PropertyMap::const_type const_type; + }; + }; +} // namespace detail + +template <> +struct vertex_property_selector<undirected_graph_tag> +{ typedef detail::undirected_graph_vertex_property_selector type; }; + +template <> +struct edge_property_selector<undirected_graph_tag> +{ typedef detail::undirected_graph_edge_property_selector type; }; + +// PropertyGraph concepts +template <UNDIRECTED_GRAPH_PARAMS, typename Property> +inline typename property_map<UNDIRECTED_GRAPH, Property>::type +get(Property p, UNDIRECTED_GRAPH& g) +{ return get(p, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS, typename Property> +inline typename property_map<UNDIRECTED_GRAPH, Property>::const_type +get(Property p, UNDIRECTED_GRAPH const& g) +{ return get(p, g.impl()); } + +template <UNDIRECTED_GRAPH_PARAMS, typename Property, typename Key> +inline typename property_traits< + typename property_map< + typename UNDIRECTED_GRAPH::graph_type, Property + >::const_type +>::value_type +get(Property p, UNDIRECTED_GRAPH const& g, Key const& k) +{ return get(p, g.impl(), k); } + +template <UNDIRECTED_GRAPH_PARAMS, typename Property, typename Key, typename Value> +inline void put(Property p, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(p, g.impl(), k, v); } + +template <UNDIRECTED_GRAPH_PARAMS, class Property> +inline typename graph_property<UNDIRECTED_GRAPH, Property>::type& +get_property(UNDIRECTED_GRAPH& g, Property p) +{ return get_property(g.impl(), p); } + +template <UNDIRECTED_GRAPH_PARAMS, class Property> +inline typename graph_property<UNDIRECTED_GRAPH, Property>::type const& +get_property(UNDIRECTED_GRAPH const& g, Property p) +{ return get_property(g.impl(), p); } + +template <UNDIRECTED_GRAPH_PARAMS, class Property, class Value> +inline void set_property(UNDIRECTED_GRAPH& g, Property p, Value v) +{ return set_property(g.impl(), p, v); } + +#ifndef BOOST_GRAPH_NO_BUNDLED_PROPERTIES +template <UNDIRECTED_GRAPH_PARAMS, typename Type, typename Bundle> +inline typename property_map<UNDIRECTED_GRAPH, Type Bundle::*>::type +get(Type Bundle::* p, UNDIRECTED_GRAPH& g) { + typedef typename property_map< + UNDIRECTED_GRAPH, Type Bundle::* + >::type return_type; + return return_type(&g, p); +} + +template <UNDIRECTED_GRAPH_PARAMS, typename Type, typename Bundle> +inline typename property_map<UNDIRECTED_GRAPH, Type Bundle::*>::const_type +get(Type Bundle::* p, UNDIRECTED_GRAPH const& g) { + typedef typename property_map< + UNDIRECTED_GRAPH, Type Bundle::* + >::const_type return_type; + return return_type(&g, p); +} + +template <UNDIRECTED_GRAPH_PARAMS, typename Type, typename Bundle, typename Key> +inline Type +get(Type Bundle::* p, UNDIRECTED_GRAPH const& g, Key const& k) +{ return get(p, g.impl(), k); } + +template <UNDIRECTED_GRAPH_PARAMS, typename Type, typename Bundle, typename Key, typename Value> +inline void +put(Type Bundle::* p, UNDIRECTED_GRAPH& g, Key const& k, Value const& v) +{ put(p, g.impl(), k, v); } +#endif + +// Indexed Vertex graph + +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::vertex_index_type +get_vertex_index(typename UNDIRECTED_GRAPH::vertex_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return get(vertex_index, g, v); } + +template <UNDIRECTED_GRAPH_PARAMS> +typename UNDIRECTED_GRAPH::vertex_index_type +max_vertex_index(UNDIRECTED_GRAPH const& g) +{ return g.max_vertex_index(); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +renumber_vertex_indices(UNDIRECTED_GRAPH& g) +{ g.renumber_vertex_indices(); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +remove_vertex_and_renumber_indices(typename UNDIRECTED_GRAPH::vertex_iterator i, + UNDIRECTED_GRAPH& g) +{ g.remove_vertex_and_renumber_indices(i); } + + +// Edge index management + +template <UNDIRECTED_GRAPH_PARAMS> +inline typename UNDIRECTED_GRAPH::edge_index_type +get_edge_index(typename UNDIRECTED_GRAPH::edge_descriptor v, + UNDIRECTED_GRAPH const& g) +{ return get(edge_index, g, v); } + +template <UNDIRECTED_GRAPH_PARAMS> +typename UNDIRECTED_GRAPH::edge_index_type +max_edge_index(UNDIRECTED_GRAPH const& g) +{ return g.max_edge_index(); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +renumber_edge_indices(UNDIRECTED_GRAPH& g) +{ g.renumber_edge_indices(); } + +template <UNDIRECTED_GRAPH_PARAMS> +inline void +remove_edge_and_renumber_indices(typename UNDIRECTED_GRAPH::edge_iterator i, + UNDIRECTED_GRAPH& g) +{ g.remove_edge_and_renumber_indices(i); } + +// Index management +template <UNDIRECTED_GRAPH_PARAMS> +inline void +renumber_indices(UNDIRECTED_GRAPH& g) +{ g.renumber_indices(); } + +// Mutability Traits +template <UNDIRECTED_GRAPH_PARAMS> +struct graph_mutability_traits<UNDIRECTED_GRAPH> { + typedef mutable_property_graph_tag category; +}; + +#undef UNDIRECTED_GRAPH_PARAMS +#undef UNDIRECTED_GRAPH + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/graph/use_mpi.hpp b/Utilities/BGL/boost/graph/use_mpi.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b77f9c0b5d261f5ae0be92ee607843e02e94edd4 --- /dev/null +++ b/Utilities/BGL/boost/graph/use_mpi.hpp @@ -0,0 +1,15 @@ +// Copyright (C) 2004-2009 The Trustees of Indiana University. + +// 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: Nick Edmonds +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_USE_MPI_HPP +#define BOOST_GRAPH_USE_MPI_HPP + +#define BOOST_GRAPH_USE_MPI + +#endif // BOOST_GRAPH_USE_MPI_HPP diff --git a/Utilities/BGL/boost/graph/vector_as_graph.hpp b/Utilities/BGL/boost/graph/vector_as_graph.hpp index 5f9e8af1f62ee84f9bbe136b783612892829f436..8ca1b916f8cfd88a32af874c89bb186acea3c513 100644 --- a/Utilities/BGL/boost/graph/vector_as_graph.hpp +++ b/Utilities/BGL/boost/graph/vector_as_graph.hpp @@ -1,7 +1,8 @@ //======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. +// Copyright 2006 The Trustees of Indiana University. // Copyright (C) 2001 Vladimir Prus <ghost@cs.msu.su> -// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek +// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Douglas Gregor // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -20,6 +21,8 @@ #include <boost/iterator.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/pending/integer_range.hpp> +#include <boost/property_map/property_map.hpp> +#include <boost/graph/properties.hpp> #include <algorithm> /* @@ -304,6 +307,26 @@ namespace boost { --*it; } + template<typename EdgeList, typename Allocator> + struct property_map<std::vector<EdgeList, Allocator>, vertex_index_t> + { + typedef identity_property_map type; + typedef type const_type; + }; + + template<typename EdgeList, typename Allocator> + identity_property_map + get(vertex_index_t, const std::vector<EdgeList, Allocator>&) + { + return identity_property_map(); + } + + template<typename EdgeList, typename Allocator> + identity_property_map + get(vertex_index_t, std::vector<EdgeList, Allocator>&) + { + return identity_property_map(); + } } // namespace boost #endif // BOOST_VECTOR_AS_GRAPH_HPP diff --git a/Utilities/BGL/boost/graph/vertex_and_edge_range.hpp b/Utilities/BGL/boost/graph/vertex_and_edge_range.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bcba2bfbbd008ad90c4cc8408c6be488cd4cdb6c --- /dev/null +++ b/Utilities/BGL/boost/graph/vertex_and_edge_range.hpp @@ -0,0 +1,141 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +#ifndef BOOST_GRAPH_VERTEX_AND_EDGE_RANGE_HPP +#define BOOST_GRAPH_VERTEX_AND_EDGE_RANGE_HPP + +#include <boost/graph/graph_traits.hpp> +#include <iterator> + +namespace boost { + +namespace graph { + template<typename Graph, typename VertexIterator, typename EdgeIterator> + class vertex_and_edge_range + { + typedef graph_traits<Graph> traits_type; + + public: + typedef typename traits_type::directed_category directed_category; + typedef typename traits_type::edge_parallel_category + edge_parallel_category; + struct traversal_category + : public virtual vertex_list_graph_tag, + public virtual edge_list_graph_tag { }; + + typedef std::size_t vertices_size_type; + typedef VertexIterator vertex_iterator; + typedef typename std::iterator_traits<VertexIterator>::value_type + vertex_descriptor; + + typedef EdgeIterator edge_iterator; + typedef typename std::iterator_traits<EdgeIterator>::value_type + edge_descriptor; + + typedef std::size_t edges_size_type; + + typedef void adjacency_iterator; + typedef void out_edge_iterator; + typedef void in_edge_iterator; + typedef void degree_size_type; + + static vertex_descriptor null_vertex() + { return traits_type::null_vertex(); } + + vertex_and_edge_range(const Graph& g, + VertexIterator first_v, VertexIterator last_v, + vertices_size_type n, + EdgeIterator first_e, EdgeIterator last_e, + edges_size_type m) + : g(&g), + first_vertex(first_v), last_vertex(last_v), m_num_vertices(n), + first_edge(first_e), last_edge(last_e), m_num_edges(m) + { + } + + vertex_and_edge_range(const Graph& g, + VertexIterator first_v, VertexIterator last_v, + EdgeIterator first_e, EdgeIterator last_e) + : g(&g), + first_vertex(first_v), last_vertex(last_v), + first_edge(first_e), last_edge(last_e) + { + m_num_vertices = std::distance(first_v, last_v); + m_num_edges = std::distance(first_e, last_e); + } + + const Graph* g; + vertex_iterator first_vertex; + vertex_iterator last_vertex; + vertices_size_type m_num_vertices; + edge_iterator first_edge; + edge_iterator last_edge; + edges_size_type m_num_edges; + }; + + template<typename Graph, typename VertexIterator, typename EdgeIterator> + inline std::pair<VertexIterator, VertexIterator> + vertices(const vertex_and_edge_range<Graph, VertexIterator, EdgeIterator>& g) + { return std::make_pair(g.first_vertex, g.last_vertex); } + + template<typename Graph, typename VertexIterator, typename EdgeIterator> + inline typename vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + ::vertices_size_type + num_vertices(const vertex_and_edge_range<Graph, VertexIterator, + EdgeIterator>& g) + { return g.m_num_vertices; } + + template<typename Graph, typename VertexIterator, typename EdgeIterator> + inline std::pair<EdgeIterator, EdgeIterator> + edges(const vertex_and_edge_range<Graph, VertexIterator, EdgeIterator>& g) + { return std::make_pair(g.first_edge, g.last_edge); } + + template<typename Graph, typename VertexIterator, typename EdgeIterator> + inline typename vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + ::edges_size_type + num_edges(const vertex_and_edge_range<Graph, VertexIterator, + EdgeIterator>& g) + { return g.m_num_edges; } + + template<typename Graph, typename VertexIterator, typename EdgeIterator> + inline typename vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + ::vertex_descriptor + source(typename vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + ::edge_descriptor e, + const vertex_and_edge_range<Graph, VertexIterator, + EdgeIterator>& g) + { return source(e, *g.g); } + + template<typename Graph, typename VertexIterator, typename EdgeIterator> + inline typename vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + ::vertex_descriptor + target(typename vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + ::edge_descriptor e, + const vertex_and_edge_range<Graph, VertexIterator, + EdgeIterator>& g) + { return target(e, *g.g); } + + template<typename Graph, typename VertexIterator, typename EdgeIterator> + inline vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + make_vertex_and_edge_range(const Graph& g, + VertexIterator first_v, VertexIterator last_v, + EdgeIterator first_e, EdgeIterator last_e) + { + typedef vertex_and_edge_range<Graph, VertexIterator, EdgeIterator> + result_type; + return result_type(g, first_v, last_v, first_e, last_e); + } + +} // end namespace graph + +using graph::vertex_and_edge_range; +using graph::make_vertex_and_edge_range; + +} // end namespace boost +#endif // BOOST_GRAPH_VERTEX_AND_EDGE_RANGE_HPP diff --git a/Utilities/BGL/boost/graph/visitors.hpp b/Utilities/BGL/boost/graph/visitors.hpp index 892f0241e3675c7607ae5c52001e1810cc05eb1d..1091f101573992a62345f8aef07f12a734d82337 100644 --- a/Utilities/BGL/boost/graph/visitors.hpp +++ b/Utilities/BGL/boost/graph/visitors.hpp @@ -15,10 +15,16 @@ #include <iosfwd> #include <boost/config.hpp> -#include <boost/property_map.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/limits.hpp> -#include <boost/graph/detail/is_same.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# define Graph Graph_ +#endif namespace boost { @@ -77,9 +83,6 @@ namespace boost { struct on_edge_not_minimized { enum { num = detail::on_edge_not_minimized_num }; }; - struct true_tag { enum { num = true }; }; - struct false_tag { enum { num = false }; }; - //======================================================================== // base_visitor and null_visitor @@ -102,21 +105,20 @@ namespace boost { namespace detail { template <class Visitor, class T, class Graph> - inline void - invoke_dispatch(Visitor& v, T x, Graph& g, true_tag) { + inline void invoke_dispatch(Visitor& v, T x, Graph& g, mpl::true_) { v(x, g); } + template <class Visitor, class T, class Graph> - inline void - invoke_dispatch(Visitor&, T, Graph&, false_tag) { } + inline void invoke_dispatch(Visitor&, T, Graph&, mpl::false_) + { } } // namespace detail template <class Visitor, class Rest, class T, class Graph, class Tag> inline void invoke_visitors(std::pair<Visitor, Rest>& vlist, T x, Graph& g, Tag tag) { typedef typename Visitor::event_filter Category; - typedef typename graph_detail::is_same<Category, Tag>::is_same_tag - IsSameTag; + typedef typename is_same<Category, Tag>::type IsSameTag; detail::invoke_dispatch(vlist.first, x, g, IsSameTag()); invoke_visitors(vlist.second, x, g, tag); } @@ -125,8 +127,7 @@ namespace boost { inline void invoke_visitors(base_visitor<Visitor>& vis, T x, Graph& g, Tag) { typedef typename Visitor::event_filter Category; - typedef typename graph_detail::is_same<Category, Tag>::is_same_tag - IsSameTag; + typedef typename is_same<Category, Tag>::type IsSameTag; Visitor& v = static_cast<Visitor&>(vis); detail::invoke_dispatch(v, x, g, IsSameTag()); } @@ -135,8 +136,7 @@ namespace boost { inline void invoke_visitors(Visitor& v, T x, Graph& g, Tag) { typedef typename Visitor::event_filter Category; - typedef typename graph_detail::is_same<Category, Tag>::is_same_tag - IsSameTag; + typedef typename is_same<Category, Tag>::type IsSameTag; detail::invoke_dispatch(v, x, g, IsSameTag()); } #endif @@ -266,4 +266,9 @@ namespace boost { } /* namespace boost */ +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of the concept checking class +# undef Graph +#endif + #endif diff --git a/Utilities/BGL/boost/graph/wavefront.hpp b/Utilities/BGL/boost/graph/wavefront.hpp index e28ab69e33d09b7ab8c0aa6187a9cc399f2a16d5..00cf35241f2ece47f56f8404a272f809c93b2fca 100644 --- a/Utilities/BGL/boost/graph/wavefront.hpp +++ b/Utilities/BGL/boost/graph/wavefront.hpp @@ -1,27 +1,11 @@ // //======================================================================= -// Copyright 2002 Marc Wintermantel (wintermantel@imes.mavt.ethz.ch) +// Copyright 2002 Marc Wintermantel (wintermantel@even-ag.ch) // ETH Zurich, Center of Structure Technologies (www.imes.ethz.ch/st) // -// This file is part of the Boost Graph Library -// -// You should have received a copy of the License Agreement for the -// Boost Graph Library along with the software; see the file LICENSE. -// If not, contact Office of Research, University of Notre Dame, Notre -// Dame, IN 46556. -// -// Permission to modify the code and to distribute modified code is -// granted, provided the text of this NOTICE is retained, a notice that -// the code was modified is included with the above COPYRIGHT NOTICE and -// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE -// file is distributed with the modified code. -// -// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. -// By way of example, but not limitation, Licensor MAKES NO -// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY -// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS -// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS -// OR OTHER RIGHTS. +// 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) //======================================================================= // @@ -32,7 +16,7 @@ #include <boost/graph/graph_traits.hpp> #include <boost/detail/numeric_traits.hpp> #include <boost/graph/bandwidth.hpp> -#include <cmath> +#include <boost/config/no_tr1/cmath.hpp> #include <vector> #include <algorithm> // for std::min and std::max diff --git a/Utilities/BGL/boost/graph/write_dimacs.hpp b/Utilities/BGL/boost/graph/write_dimacs.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0b8af17df4d03651bf0d2e51ea7f6c9cc3da0c61 --- /dev/null +++ b/Utilities/BGL/boost/graph/write_dimacs.hpp @@ -0,0 +1,72 @@ +// Copyright (c) 2006, Stephan Diederich +// +// This code may be used under either of the following two licences: +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. OF SUCH DAMAGE. +// +// Or: +// +// 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) + +/* + Writes maximal flow problem in extended DIMACS format to an OutputIterator + Vertex indices are read from an IndexMap and shiftet by 1. + so their new range is [1..num_vertices(g)] +*/ + +/* ----------------------------------------------------------------- */ + +#include <vector> +#include <string> +#include <ostream> + +namespace boost { + +template <class Graph, class CapacityMap, class IndexMap> +void write_dimacs_max_flow(const Graph& g, + CapacityMap capacity, + IndexMap idx, + typename graph_traits<Graph>::vertex_descriptor src, + typename graph_traits<Graph>::vertex_descriptor sink, + std::ostream& out) +{ + typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor; + typedef typename graph_traits<Graph>::vertices_size_type vertices_size_type; + typedef typename graph_traits<Graph>::edge_descriptor edge_descriptor; + typedef typename graph_traits<Graph>::edges_size_type edges_size_type; + typedef typename graph_traits<Graph>::edge_iterator edge_iterator; + + out << "c DIMACS max-flow file generated from boost::write_dimacs_max_flow" << std::endl; + out << "p max " << num_vertices(g) << " " << num_edges(g) << std::endl; //print problem description "max" and number of verts and edges + out << "n " << get(idx, src) + 1 << " s" << std::endl;; //say which one is source + out << "n " << get(idx, sink) + 1 << " t" << std::endl; //say which one is sink + + //output the edges + edge_iterator ei, e_end; + for(tie(ei,e_end) = edges(g); ei!=e_end; ++ei){ + out << "a " << idx[ source(*ei, g) ] + 1 << " " << idx[ target(*ei, g) ] + 1 << " " << get(capacity,*ei) << std::endl; + } +} + +} // namespace boost diff --git a/Utilities/BGL/boost/implicit_cast.hpp b/Utilities/BGL/boost/implicit_cast.hpp index 2593cb4b3dab20b20c216fa024884a18e9e6bb10..5b1cd92b9b3963e5560e87199f1c7f5625797e60 100644 --- a/Utilities/BGL/boost/implicit_cast.hpp +++ b/Utilities/BGL/boost/implicit_cast.hpp @@ -23,13 +23,7 @@ inline T implicit_cast (typename mpl::identity<T>::type x) { //template <typename T> //void implicit_cast (...); -// Macro for when you need a constant expression (Gennaro Prota) -#define BOOST_IMPLICIT_CAST(dst_type, expr) \ - ( sizeof( implicit_cast<dst_type>(expr) ) \ - , \ - static_cast<dst_type>(expr) \ - ) - } // namespace boost + #endif // IMPLICIT_CAST_DWA200356_HPP diff --git a/Utilities/BGL/boost/indirect_reference.hpp b/Utilities/BGL/boost/indirect_reference.hpp deleted file mode 100644 index 5fbb3423199924e77ca50fae960eaee0d05b7515..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/indirect_reference.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef INDIRECT_REFERENCE_DWA200415_HPP -# define INDIRECT_REFERENCE_DWA200415_HPP - -// -// Copyright David Abrahams 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) -// -// typename indirect_reference<P>::type provides the type of *p. -// -// http://www.boost.org/libs/iterator/doc/pointee.html -// - -# include <boost/detail/is_incrementable.hpp> -# include <boost/iterator/iterator_traits.hpp> -# include <boost/type_traits/remove_cv.hpp> -# include <boost/mpl/eval_if.hpp> -# include <boost/pointee.hpp> - -namespace boost { - -namespace detail -{ - template <class P> - struct smart_ptr_reference - { - typedef typename boost::pointee<P>::type& type; - }; -} - -template <class P> -struct indirect_reference - : mpl::eval_if< - detail::is_incrementable<P> - , iterator_reference<P> - , detail::smart_ptr_reference<P> - > -{ -}; - -} // namespace boost - -#endif // INDIRECT_REFERENCE_DWA200415_HPP diff --git a/Utilities/BGL/boost/integer/integer_mask.hpp b/Utilities/BGL/boost/integer/integer_mask.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8c4e1bb1c4dce14ea82c0e1103d8d43c664d250b --- /dev/null +++ b/Utilities/BGL/boost/integer/integer_mask.hpp @@ -0,0 +1,102 @@ +// Boost integer/integer_mask.hpp header file ------------------------------// + +// (C) Copyright Daryle Walker 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 for updates, documentation, and revision history. + +#ifndef BOOST_INTEGER_INTEGER_MASK_HPP +#define BOOST_INTEGER_INTEGER_MASK_HPP + +#include <boost/integer_fwd.hpp> // self include + +#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT +#include <boost/integer.hpp> // for boost::uint_t + +#include <climits> // for UCHAR_MAX, etc. +#include <cstddef> // for std::size_t + +#include <boost/limits.hpp> // for std::numeric_limits + + +namespace boost +{ + + +// Specified single-bit mask class declaration -----------------------------// +// (Lowest bit starts counting at 0.) + +template < std::size_t Bit > +struct high_bit_mask_t +{ + typedef typename uint_t<(Bit + 1)>::least least; + typedef typename uint_t<(Bit + 1)>::fast fast; + + BOOST_STATIC_CONSTANT( least, high_bit = (least( 1u ) << Bit) ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = (fast( 1u ) << Bit) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_position = Bit ); + +}; // boost::high_bit_mask_t + + +// Specified bit-block mask class declaration ------------------------------// +// Makes masks for the lowest N bits +// (Specializations are needed when N fills up a type.) + +template < std::size_t Bits > +struct low_bits_mask_t +{ + typedef typename uint_t<Bits>::least least; + typedef typename uint_t<Bits>::fast fast; + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + +}; // boost::low_bits_mask_t + + +#define BOOST_LOW_BITS_MASK_SPECIALIZE( Type ) \ + template < > struct low_bits_mask_t< std::numeric_limits<Type>::digits > { \ + typedef std::numeric_limits<Type> limits_type; \ + typedef uint_t<limits_type::digits>::least least; \ + typedef uint_t<limits_type::digits>::fast fast; \ + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); \ + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); \ + BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits ); \ + } + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4245) // 'initializing' : conversion from 'int' to 'const boost::low_bits_mask_t<8>::least', signed/unsigned mismatch +#endif + +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char ); + +#if USHRT_MAX > UCHAR_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned short ); +#endif + +#if UINT_MAX > USHRT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int ); +#endif + +#if ULONG_MAX > UINT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long ); +#endif + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#undef BOOST_LOW_BITS_MASK_SPECIALIZE + + +} // namespace boost + + +#endif // BOOST_INTEGER_INTEGER_MASK_HPP diff --git a/Utilities/BGL/boost/integer/static_log2.hpp b/Utilities/BGL/boost/integer/static_log2.hpp new file mode 100644 index 0000000000000000000000000000000000000000..56c7a001251a25a7c9a37fed5729317a8d0e2918 --- /dev/null +++ b/Utilities/BGL/boost/integer/static_log2.hpp @@ -0,0 +1,127 @@ +// -------------- Boost static_log2.hpp header file ----------------------- // +// +// Copyright (C) 2001 Daryle Walker. +// Copyright (C) 2003 Vesa Karvonen. +// Copyright (C) 2003 Gennaro Prota. +// +// 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/integer for documentation. +// ------------------------------------------------------------------------- // + + +#ifndef BOOST_INTEGER_STATIC_LOG2_HPP +#define BOOST_INTEGER_STATIC_LOG2_HPP + +#include "boost/integer_fwd.hpp" // for boost::intmax_t + +namespace boost { + + namespace detail { + + namespace static_log2_impl { + + // choose_initial_n<> + // + // Recursively doubles its integer argument, until it + // becomes >= of the "width" (C99, 6.2.6.2p4) of + // static_log2_argument_type. + // + // Used to get the maximum power of two less then the width. + // + // Example: if on your platform argument_type has 48 value + // bits it yields n=32. + // + // It's easy to prove that, starting from such a value + // of n, the core algorithm works correctly for any width + // of static_log2_argument_type and that recursion always + // terminates with x = 1 and n = 0 (see the algorithm's + // invariant). + + typedef boost::static_log2_argument_type argument_type; + typedef boost::static_log2_result_type result_type; + + template <result_type n> + struct choose_initial_n { + + BOOST_STATIC_CONSTANT(bool, c = (argument_type(1) << n << n) != 0); + BOOST_STATIC_CONSTANT( + result_type, + value = !c*n + choose_initial_n<2*c*n>::value + ); + + }; + + template <> + struct choose_initial_n<0> { + BOOST_STATIC_CONSTANT(result_type, value = 0); + }; + + + + // start computing from n_zero - must be a power of two + const result_type n_zero = 16; + const result_type initial_n = choose_initial_n<n_zero>::value; + + // static_log2_impl<> + // + // * Invariant: + // 2n + // 1 <= x && x < 2 at the start of each recursion + // (see also choose_initial_n<>) + // + // * Type requirements: + // + // argument_type maybe any unsigned type with at least n_zero + 1 + // value bits. (Note: If larger types will be standardized -e.g. + // unsigned long long- then the argument_type typedef can be + // changed without affecting the rest of the code.) + // + + template <argument_type x, result_type n = initial_n> + struct static_log2_impl { + + BOOST_STATIC_CONSTANT(bool, c = (x >> n) > 0); // x >= 2**n ? + BOOST_STATIC_CONSTANT( + result_type, + value = c*n + (static_log2_impl< (x>>c*n), n/2 >::value) + ); + + }; + + template <> + struct static_log2_impl<1, 0> { + BOOST_STATIC_CONSTANT(result_type, value = 0); + }; + + } + } // detail + + + + // -------------------------------------- + // static_log2<x> + // ---------------------------------------- + + template <static_log2_argument_type x> + struct static_log2 { + + BOOST_STATIC_CONSTANT( + static_log2_result_type, + value = detail::static_log2_impl::static_log2_impl<x>::value + ); + + }; + + + template <> + struct static_log2<0> { }; + +} + + + +#endif // include guard diff --git a/Utilities/BGL/boost/integer/static_min_max.hpp b/Utilities/BGL/boost/integer/static_min_max.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ee76fd424a127a8fe82b86bbd070327a12b6d4dd --- /dev/null +++ b/Utilities/BGL/boost/integer/static_min_max.hpp @@ -0,0 +1,51 @@ +// Boost integer/static_min_max.hpp header file ----------------------------// + +// (C) Copyright Daryle Walker 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 for updates, documentation, and revision history. + +#ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP +#define BOOST_INTEGER_STATIC_MIN_MAX_HPP + +#include <boost/integer_fwd.hpp> // self include + +namespace boost +{ + +// Compile-time extrema class declarations ---------------------------------// +// Get the minimum or maximum of two values, signed or unsigned. + +template <static_min_max_signed_type Value1, static_min_max_signed_type Value2> +struct static_signed_min +{ + BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 > Value2) ? Value2 : Value1 ); +}; + +template <static_min_max_signed_type Value1, static_min_max_signed_type Value2> +struct static_signed_max +{ + BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 < Value2) ? Value2 : Value1 ); +}; + +template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2> +struct static_unsigned_min +{ + BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value + = (Value1 > Value2) ? Value2 : Value1 ); +}; + +template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2> +struct static_unsigned_max +{ + BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value + = (Value1 < Value2) ? Value2 : Value1 ); +}; + + +} // namespace boost + + +#endif // BOOST_INTEGER_STATIC_MIN_MAX_HPP diff --git a/Utilities/BGL/boost/integer_fwd.hpp b/Utilities/BGL/boost/integer_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..01b0a0844f82a03755e133fdd64f6f74f6925641 --- /dev/null +++ b/Utilities/BGL/boost/integer_fwd.hpp @@ -0,0 +1,174 @@ +// Boost integer_fwd.hpp header file ---------------------------------------// + +// (C) Copyright Dave Abrahams and Daryle Walker 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/integer for documentation. + +#ifndef BOOST_INTEGER_FWD_HPP +#define BOOST_INTEGER_FWD_HPP + +#include <climits> // for UCHAR_MAX, etc. +#include <cstddef> // for std::size_t + +#include <boost/config.hpp> // for BOOST_NO_INTRINSIC_WCHAR_T +#include <boost/limits.hpp> // for std::numeric_limits +#include <boost/cstdint.hpp> // For intmax_t + + +namespace boost +{ + +#ifdef BOOST_NO_INTEGRAL_INT64_T + typedef unsigned long static_log2_argument_type; + typedef int static_log2_result_type; + typedef long static_min_max_signed_type; + typedef unsigned long static_min_max_unsigned_type; +#else + typedef boost::uintmax_t static_min_max_unsigned_type; + typedef boost::intmax_t static_min_max_signed_type; + typedef boost::uintmax_t static_log2_argument_type; + typedef int static_log2_result_type; +#endif + +// From <boost/cstdint.hpp> ------------------------------------------------// + +// Only has typedefs or using statements, with #conditionals + + +// From <boost/integer_traits.hpp> -----------------------------------------// + +template < class T > + class integer_traits; + +template < > + class integer_traits< bool >; + +template < > + class integer_traits< char >; + +template < > + class integer_traits< signed char >; + +template < > + class integer_traits< unsigned char >; + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template < > + class integer_traits< wchar_t >; +#endif + +template < > + class integer_traits< short >; + +template < > + class integer_traits< unsigned short >; + +template < > + class integer_traits< int >; + +template < > + class integer_traits< unsigned int >; + +template < > + class integer_traits< long >; + +template < > + class integer_traits< unsigned long >; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)) +template < > + class integer_traits< ::boost::long_long_type>; + +template < > + class integer_traits< ::boost::ulong_long_type >; +#endif + + +// From <boost/integer.hpp> ------------------------------------------------// + +template < typename LeastInt > + struct int_fast_t; + +template< int Bits > + struct int_t; + +template< int Bits > + struct uint_t; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::long_long_type MaxValue > // maximum value to require support +#else + template< long MaxValue > // maximum value to require support +#endif + struct int_max_value_t; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::long_long_type MinValue > // minimum value to require support +#else + template< long MinValue > // minimum value to require support +#endif + struct int_min_value_t; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::ulong_long_type MaxValue > // maximum value to require support +#else + template< unsigned long MaxValue > // maximum value to require support +#endif + struct uint_value_t; + + +// From <boost/integer/integer_mask.hpp> -----------------------------------// + +template < std::size_t Bit > + struct high_bit_mask_t; + +template < std::size_t Bits > + struct low_bits_mask_t; + +template < > + struct low_bits_mask_t< ::std::numeric_limits<unsigned char>::digits >; + +#if USHRT_MAX > UCHAR_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits<unsigned short>::digits >; +#endif + +#if UINT_MAX > USHRT_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits<unsigned int>::digits >; +#endif + +#if ULONG_MAX > UINT_MAX +template < > + struct low_bits_mask_t< ::std::numeric_limits<unsigned long>::digits >; +#endif + + +// From <boost/integer/static_log2.hpp> ------------------------------------// + +template <static_log2_argument_type Value > + struct static_log2; + +template <> struct static_log2<0u>; + + +// From <boost/integer/static_min_max.hpp> ---------------------------------// + +template <static_min_max_signed_type Value1, static_min_max_signed_type Value2> + struct static_signed_min; + +template <static_min_max_signed_type Value1, static_min_max_signed_type Value2> + struct static_signed_max; + +template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2> + struct static_unsigned_min; + +template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2> + struct static_unsigned_max; + +} // namespace boost + + +#endif // BOOST_INTEGER_FWD_HPP diff --git a/Utilities/BGL/boost/iterator.hpp b/Utilities/BGL/boost/iterator.hpp index d5d9f46e949c8200e3bb1ea710b4152a37dad945..a43cfe138e9644f8bccdf3fb7596c2f2a845c412 100644 --- a/Utilities/BGL/boost/iterator.hpp +++ b/Utilities/BGL/boost/iterator.hpp @@ -4,7 +4,7 @@ // 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/butility for documentation. +// See http://www.boost.org/libs/utility for documentation. // Revision History // 12 Jan 01 added <cstddef> for std::ptrdiff_t (Jens Maurer) @@ -52,7 +52,7 @@ namespace boost template <class Category, class T, class Distance = std::ptrdiff_t, class Pointer = T*, class Reference = T&> - struct iterator : detail::iterator_base<Category, T, Distance, Pointer, Reference> {}; + struct iterator : boost::detail::iterator_base<Category, T, Distance, Pointer, Reference> {}; # endif } // namespace boost diff --git a/Utilities/BGL/boost/iterator/detail/config_def.hpp b/Utilities/BGL/boost/iterator/detail/config_def.hpp index 82b3b52cb3cd4522c0f36b25c5c9f2a14757010f..fa8d667d97151aa23aa514570242c6a72320c6ff 100644 --- a/Utilities/BGL/boost/iterator/detail/config_def.hpp +++ b/Utilities/BGL/boost/iterator/detail/config_def.hpp @@ -47,9 +47,11 @@ #endif #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ - || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + # define BOOST_NO_LVALUE_RETURN_DETECTION # if 0 // test code @@ -109,11 +111,6 @@ #endif -#if BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \ - || BOOST_WORKAROUND(__MWERKS__, <= 0x2407) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -# define BOOST_ITERATOR_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work" -#endif #if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY diff --git a/Utilities/BGL/boost/iterator/detail/enable_if.hpp b/Utilities/BGL/boost/iterator/detail/enable_if.hpp index 45428a5bb24bb49e62218136a5eaa64bc2a3c9db..0fd36fc4bc3a2e2e6abef93f494d441469656908 100644 --- a/Utilities/BGL/boost/iterator/detail/enable_if.hpp +++ b/Utilities/BGL/boost/iterator/detail/enable_if.hpp @@ -72,7 +72,7 @@ namespace boost : mpl::identity<Return> # endif { -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) typedef Return type; # endif }; diff --git a/Utilities/BGL/boost/iterator/detail/facade_iterator_category.hpp b/Utilities/BGL/boost/iterator/detail/facade_iterator_category.hpp index 67287007b5be3f728d9354e8c4206fe7225798a0..2c4771d5aa7a321be39ac1717051cb374ae9791e 100644 --- a/Utilities/BGL/boost/iterator/detail/facade_iterator_category.hpp +++ b/Utilities/BGL/boost/iterator/detail/facade_iterator_category.hpp @@ -6,13 +6,12 @@ # include <boost/iterator/iterator_categories.hpp> -# include <boost/static_assert.hpp> - # include <boost/mpl/or.hpp> // used in iterator_tag inheritance logic # include <boost/mpl/and.hpp> # include <boost/mpl/if.hpp> # include <boost/mpl/eval_if.hpp> # include <boost/mpl/identity.hpp> +# include <boost/mpl/assert.hpp> # include <boost/type_traits/is_same.hpp> # include <boost/type_traits/is_const.hpp> @@ -139,29 +138,21 @@ template <class Category, class Traversal> struct iterator_category_with_traversal : Category, Traversal { -# if 0 - // Because of limitations on multiple user-defined conversions, - // this should be a good test of whether convertibility is enough - // in the spec, or whether we need to specify inheritance. - operator Category() const { return Category(); } - operator Traversal() const { return Traversal(); } -# endif - # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // Make sure this isn't used to build any categories where // convertibility to Traversal is redundant. Should just use the // Category element in that case. - BOOST_STATIC_ASSERT( - !(is_convertible< + BOOST_MPL_ASSERT_NOT(( + is_convertible< typename iterator_category_to_traversal<Category>::type , Traversal - >::value)); + >)); - BOOST_STATIC_ASSERT(is_iterator_category<Category>::value); - BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value); - BOOST_STATIC_ASSERT(!is_iterator_traversal<Category>::value); + BOOST_MPL_ASSERT((is_iterator_category<Category>)); + BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>)); + BOOST_MPL_ASSERT_NOT((is_iterator_traversal<Category>)); # if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) - BOOST_STATIC_ASSERT(is_iterator_traversal<Traversal>::value); + BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>)); # endif # endif }; @@ -172,7 +163,7 @@ template <class Traversal, class ValueParam, class Reference> struct facade_iterator_category_impl { # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value); + BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>)); # endif typedef typename iterator_facade_default_category< diff --git a/Utilities/BGL/boost/iterator/detail/minimum_category.hpp b/Utilities/BGL/boost/iterator/detail/minimum_category.hpp index 74cef63f3531a810c1894806ad4a9944c644b7d2..96501ddd462042dcae5841232d0ac2c815b6d425 100644 --- a/Utilities/BGL/boost/iterator/detail/minimum_category.hpp +++ b/Utilities/BGL/boost/iterator/detail/minimum_category.hpp @@ -22,7 +22,7 @@ namespace boost { namespace detail { // template <bool GreaterEqual, bool LessEqual> struct minimum_category_impl -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) { template <class T1, class T2> struct apply { @@ -77,12 +77,12 @@ template <class T1 = mpl::_1, class T2 = mpl::_2> struct minimum_category { typedef minimum_category_impl< -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround is_same<T2,int>::value || # endif ::boost::is_convertible<T1,T2>::value , ::boost::is_convertible<T2,T1>::value -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround || is_same<T1,int>::value # endif > outer; @@ -103,7 +103,7 @@ struct minimum_category<mpl::_1,mpl::_2> BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2)) }; -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround template <> struct minimum_category<int,int> { diff --git a/Utilities/BGL/boost/iterator/filter_iterator.hpp b/Utilities/BGL/boost/iterator/filter_iterator.hpp index 96fb84359f6cd9ff1ddf4d873dd7c0ae9f94efd3..14d640bf0939c491f3829f0cbd826a5e24e2ae17 100644 --- a/Utilities/BGL/boost/iterator/filter_iterator.hpp +++ b/Utilities/BGL/boost/iterator/filter_iterator.hpp @@ -53,14 +53,14 @@ namespace boost public: filter_iterator() { } - filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) - : super_t(x), m_predicate(f), m_end(end) + filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(f), m_end(end_) { satisfy_predicate(); } - filter_iterator(Iterator x, Iterator end = Iterator()) - : super_t(x), m_predicate(), m_end(end) + filter_iterator(Iterator x, Iterator end_ = Iterator()) + : super_t(x), m_predicate(), m_end(end_) { // Pro8 is a little too aggressive about instantiating the // body of this function. @@ -122,7 +122,7 @@ namespace boost , Iterator >::type x , Iterator end = Iterator() -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) , Predicate* = 0 #endif ) diff --git a/Utilities/BGL/boost/iterator/indirect_iterator.hpp b/Utilities/BGL/boost/iterator/indirect_iterator.hpp index f181107121598fa65b574bfca6277f14e3bbab22..abff7e76346f12c4f9cc0cbe3c89f6a30b8d6f7d 100644 --- a/Utilities/BGL/boost/iterator/indirect_iterator.hpp +++ b/Utilities/BGL/boost/iterator/indirect_iterator.hpp @@ -110,7 +110,7 @@ namespace boost private: typename super_t::reference dereference() const { -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# if BOOST_WORKAROUND(__BORLANDC__, < 0x5A0 ) return const_cast<super_t::reference>(**this->base()); # else return **this->base(); diff --git a/Utilities/BGL/boost/iterator/iterator_adaptor.hpp b/Utilities/BGL/boost/iterator/iterator_adaptor.hpp index 457c43965914ed8aa697b27065011b797b37d4e1..27b08ff018e05e3d992035f538d8d0ec61271732 100644 --- a/Utilities/BGL/boost/iterator/iterator_adaptor.hpp +++ b/Utilities/BGL/boost/iterator/iterator_adaptor.hpp @@ -24,9 +24,14 @@ #ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY # include <boost/type_traits/remove_reference.hpp> -#else + +# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) +# include <boost/type_traits/add_reference.hpp> +# endif + +#else # include <boost/type_traits/add_reference.hpp> -#endif +#endif #include <boost/iterator/detail/config_def.hpp> @@ -110,7 +115,7 @@ namespace boost is_same<From,To> , is_convertible<From, To> > - , detail::enable_type + , boost::detail::enable_type , int& >::type type; }; @@ -120,7 +125,7 @@ namespace boost template <class From, class To> struct enable_if_convertible { - typedef detail::enable_type type; + typedef boost::detail::enable_type type; }; # elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300 @@ -134,7 +139,7 @@ namespace boost is_same<From,To> , is_convertible<From, To> > - , detail::enable_type + , boost::detail::enable_type > {}; @@ -144,7 +149,7 @@ namespace boost struct enable_if_convertible : iterators::enable_if< is_convertible<From, To> - , detail::enable_type + , boost::detail::enable_type > {}; @@ -183,7 +188,7 @@ namespace boost Derived # ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY - , typename detail::ia_dflt_help< + , typename boost::detail::ia_dflt_help< Value , mpl::eval_if< is_same<Reference,use_default> @@ -192,17 +197,17 @@ namespace boost > >::type # else - , typename detail::ia_dflt_help< + , typename boost::detail::ia_dflt_help< Value, iterator_value<Base> >::type # endif - , typename detail::ia_dflt_help< + , typename boost::detail::ia_dflt_help< Traversal , iterator_traversal<Base> >::type - , typename detail::ia_dflt_help< + , typename boost::detail::ia_dflt_help< Reference , mpl::eval_if< is_same<Value,use_default> @@ -211,7 +216,7 @@ namespace boost > >::type - , typename detail::ia_dflt_help< + , typename boost::detail::ia_dflt_help< Difference, iterator_difference<Base> >::type > @@ -260,14 +265,14 @@ namespace boost , class Difference = use_default > class iterator_adaptor - : public detail::iterator_adaptor_base< + : public boost::detail::iterator_adaptor_base< Derived, Base, Value, Traversal, Reference, Difference >::type { friend class iterator_core_access; protected: - typedef typename detail::iterator_adaptor_base< + typedef typename boost::detail::iterator_adaptor_base< Derived, Base, Value, Traversal, Reference, Difference >::type super_t; public: @@ -323,7 +328,7 @@ namespace boost >::type my_traversal; # define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \ - detail::iterator_adaptor_assert_traversal<my_traversal, cat>(); + boost::detail::iterator_adaptor_assert_traversal<my_traversal, cat>(); void advance(typename super_t::difference_type n) { diff --git a/Utilities/BGL/boost/iterator/iterator_archetypes.hpp b/Utilities/BGL/boost/iterator/iterator_archetypes.hpp index 9ffa4200dc54157ab7f9f4a869056f990bc58f0d..039de1cf7409570a55a02c6c400ce27eb19eba60 100644 --- a/Utilities/BGL/boost/iterator/iterator_archetypes.hpp +++ b/Utilities/BGL/boost/iterator/iterator_archetypes.hpp @@ -196,6 +196,8 @@ namespace detail explicit archetype(ctor_arg arg) : traversal_archetype_<Derived, Value, incrementable_traversal_tag>(arg) {} + + typedef std::ptrdiff_t difference_type; }; }; @@ -219,7 +221,6 @@ namespace detail archetype() : traversal_archetype_<Derived, Value, single_pass_traversal_tag>(ctor_arg()) {} - typedef std::ptrdiff_t difference_type; }; }; diff --git a/Utilities/BGL/boost/iterator/iterator_categories.hpp b/Utilities/BGL/boost/iterator/iterator_categories.hpp index 085936f7aba6a6db54b97bce241348b1ece0a78c..1740d9818ab84d485263b2c9c7ba0aed012359c2 100644 --- a/Utilities/BGL/boost/iterator/iterator_categories.hpp +++ b/Utilities/BGL/boost/iterator/iterator_categories.hpp @@ -97,7 +97,7 @@ namespace detail > {}; -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <> struct old_category_to_traversal<int> { @@ -131,7 +131,7 @@ namespace detail { }; -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <> struct pure_traversal_tag<int> { @@ -150,7 +150,7 @@ struct iterator_category_to_traversal : mpl::eval_if< // if already convertible to a traversal tag, we're done. is_convertible<Cat,incrementable_traversal_tag> , mpl::identity<Cat> - , detail::old_category_to_traversal<Cat> + , boost::detail::old_category_to_traversal<Cat> > {}; diff --git a/Utilities/BGL/boost/iterator/iterator_concepts.hpp b/Utilities/BGL/boost/iterator/iterator_concepts.hpp index 4c27964e93596b924635fa2ce879f5b5301d3300..ced1112a61eb2674a62c653e165c1a1b1322bd73 100644 --- a/Utilities/BGL/boost/iterator/iterator_concepts.hpp +++ b/Utilities/BGL/boost/iterator/iterator_concepts.hpp @@ -6,12 +6,6 @@ #ifndef BOOST_ITERATOR_CONCEPTS_HPP #define BOOST_ITERATOR_CONCEPTS_HPP -// Revision History -// 26 Apr 2003 thw -// Adapted to new iterator concepts -// 22 Nov 2002 Thomas Witt -// Added interoperable concept. - #include <boost/concept_check.hpp> #include <boost/iterator/iterator_categories.hpp> @@ -20,7 +14,6 @@ #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_integral.hpp> -#include <boost/type_traits/is_convertible.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/if.hpp> @@ -35,247 +28,226 @@ #include <algorithm> -namespace boost_concepts { +#include <boost/concept/detail/concept_def.hpp> + +namespace boost_concepts +{ // Used a different namespace here (instead of "boost") so that the // concept descriptions do not take for granted the names in // namespace boost. - // We use this in place of STATIC_ASSERT((is_convertible<...>)) - // because some compilers (CWPro7.x) can't detect convertibility. - // - // Of course, that just gets us a different error at the moment with - // some tests, since new iterator category deduction still depends - // on convertibility detection. We might need some specializations - // to support this compiler. - template <class Target, class Source> - struct static_assert_base_and_derived - { - static_assert_base_and_derived(Target* = (Source*)0) {} - }; - //=========================================================================== // Iterator Access Concepts - template <typename Iterator> - class ReadableIteratorConcept { - public: - typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type; + BOOST_concept(ReadableIterator,(Iterator)) + : boost::Assignable<Iterator> + , boost::CopyConstructible<Iterator> - void constraints() { - boost::function_requires< boost::AssignableConcept<Iterator> >(); - boost::function_requires< boost::CopyConstructibleConcept<Iterator> >(); + { + typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference reference; - value_type v = *i; - boost::ignore_unused_variable_warning(v); - } - Iterator i; + BOOST_CONCEPT_USAGE(ReadableIterator) + { + + value_type v = *i; + boost::ignore_unused_variable_warning(v); + } + private: + Iterator i; }; template < typename Iterator , typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type > - class WritableIteratorConcept { - public: - - void constraints() { - boost::function_requires< boost::CopyConstructibleConcept<Iterator> >(); - *i = v; - } - ValueType v; - Iterator i; + struct WritableIterator + : boost::CopyConstructible<Iterator> + { + BOOST_CONCEPT_USAGE(WritableIterator) + { + *i = v; + } + private: + ValueType v; + Iterator i; }; - - template <typename Iterator> - class SwappableIteratorConcept { - public: - void constraints() { - std::iter_swap(i1, i2); - } - Iterator i1; - Iterator i2; + template < + typename Iterator + , typename ValueType = BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::value_type + > + struct WritableIteratorConcept : WritableIterator<Iterator,ValueType> {}; + + BOOST_concept(SwappableIterator,(Iterator)) + { + BOOST_CONCEPT_USAGE(SwappableIterator) + { + std::iter_swap(i1, i2); + } + private: + Iterator i1; + Iterator i2; }; - template <typename Iterator> - class LvalueIteratorConcept + BOOST_concept(LvalueIterator,(Iterator)) { - public: typedef typename boost::detail::iterator_traits<Iterator>::value_type value_type; - void constraints() + + BOOST_CONCEPT_USAGE(LvalueIterator) { value_type& r = const_cast<value_type&>(*i); boost::ignore_unused_variable_warning(r); } - Iterator i; + private: + Iterator i; }; //=========================================================================== // Iterator Traversal Concepts - template <typename Iterator> - class IncrementableIteratorConcept { - public: - typedef typename boost::iterator_traversal<Iterator>::type traversal_category; - - void constraints() { - boost::function_requires< boost::AssignableConcept<Iterator> >(); - boost::function_requires< boost::CopyConstructibleConcept<Iterator> >(); + BOOST_concept(IncrementableIterator,(Iterator)) + : boost::Assignable<Iterator> + , boost::CopyConstructible<Iterator> + { + typedef typename boost::iterator_traversal<Iterator>::type traversal_category; - BOOST_STATIC_ASSERT( - (boost::is_convertible< - traversal_category - , boost::incrementable_traversal_tag - >::value - )); + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + traversal_category + , boost::incrementable_traversal_tag + >)); - ++i; - (void)i++; - } - Iterator i; + BOOST_CONCEPT_USAGE(IncrementableIterator) + { + ++i; + (void)i++; + } + private: + Iterator i; }; - template <typename Iterator> - class SinglePassIteratorConcept { - public: - typedef typename boost::iterator_traversal<Iterator>::type traversal_category; - typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type; - - void constraints() { - boost::function_requires< IncrementableIteratorConcept<Iterator> >(); - boost::function_requires< boost::EqualityComparableConcept<Iterator> >(); - - BOOST_STATIC_ASSERT( - (boost::is_convertible< - traversal_category - , boost::single_pass_traversal_tag - >::value - )); - } + BOOST_concept(SinglePassIterator,(Iterator)) + : IncrementableIterator<Iterator> + , boost::EqualityComparable<Iterator> + + { + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME SinglePassIterator::traversal_category + , boost::single_pass_traversal_tag + > )); }; - template <typename Iterator> - class ForwardTraversalConcept { - public: - typedef typename boost::iterator_traversal<Iterator>::type traversal_category; - typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type; - - void constraints() { - boost::function_requires< SinglePassIteratorConcept<Iterator> >(); - boost::function_requires< - boost::DefaultConstructibleConcept<Iterator> >(); - - typedef boost::mpl::and_< - boost::is_integral<difference_type>, - boost::mpl::bool_< std::numeric_limits<difference_type>::is_signed > - > difference_type_is_signed_integral; - - BOOST_STATIC_ASSERT(difference_type_is_signed_integral::value); - BOOST_STATIC_ASSERT( - (boost::is_convertible< - traversal_category - , boost::forward_traversal_tag - >::value - )); - } + BOOST_concept(ForwardTraversal,(Iterator)) + : SinglePassIterator<Iterator> + , boost::DefaultConstructible<Iterator> + { + typedef typename boost::detail::iterator_traits<Iterator>::difference_type difference_type; + + BOOST_MPL_ASSERT((boost::is_integral<difference_type>)); + BOOST_MPL_ASSERT_RELATION(std::numeric_limits<difference_type>::is_signed, ==, true); + + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME ForwardTraversal::traversal_category + , boost::forward_traversal_tag + > )); }; - template <typename Iterator> - class BidirectionalTraversalConcept { - public: - typedef typename boost::iterator_traversal<Iterator>::type traversal_category; + BOOST_concept(BidirectionalTraversal,(Iterator)) + : ForwardTraversal<Iterator> + { + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME BidirectionalTraversal::traversal_category + , boost::bidirectional_traversal_tag + > )); - void constraints() { - boost::function_requires< ForwardTraversalConcept<Iterator> >(); - - BOOST_STATIC_ASSERT( - (boost::is_convertible< - traversal_category - , boost::bidirectional_traversal_tag - >::value - )); - - --i; - (void)i--; - } - Iterator i; + BOOST_CONCEPT_USAGE(BidirectionalTraversal) + { + --i; + (void)i--; + } + private: + Iterator i; }; - template <typename Iterator> - class RandomAccessTraversalConcept { - public: - typedef typename boost::iterator_traversal<Iterator>::type traversal_category; - typedef typename boost::detail::iterator_traits<Iterator>::difference_type - difference_type; - - void constraints() { - boost::function_requires< BidirectionalTraversalConcept<Iterator> >(); - - BOOST_STATIC_ASSERT( - (boost::is_convertible< - traversal_category - , boost::random_access_traversal_tag - >::value - )); + BOOST_concept(RandomAccessTraversal,(Iterator)) + : BidirectionalTraversal<Iterator> + { + BOOST_CONCEPT_ASSERT(( + boost::Convertible< + BOOST_DEDUCED_TYPENAME RandomAccessTraversal::traversal_category + , boost::random_access_traversal_tag + > )); + + BOOST_CONCEPT_USAGE(RandomAccessTraversal) + { + i += n; + i = i + n; + i = n + i; + i -= n; + i = i - n; + n = i - j; + } - i += n; - i = i + n; - i = n + i; - i -= n; - i = i - n; - n = i - j; - } - difference_type n; - Iterator i, j; + private: + typename BidirectionalTraversal<Iterator>::difference_type n; + Iterator i, j; }; //=========================================================================== - // Iterator Interoperability Concept + // Iterator Interoperability namespace detail { - template <typename Iterator1, typename Iterator2> void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2) { - bool b; - b = i1 == i2; - b = i1 != i2; - - b = i2 == i1; - b = i2 != i1; + bool b; + b = i1 == i2; + b = i1 != i2; + + b = i2 == i1; + b = i2 != i1; + boost::ignore_unused_variable_warning(b); } - + template <typename Iterator1, typename Iterator2> - void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2, - boost::random_access_traversal_tag, boost::random_access_traversal_tag) + void interop_rand_access_constraints( + Iterator1 const& i1, Iterator2 const& i2, + boost::random_access_traversal_tag, boost::random_access_traversal_tag) { - bool b; - typename boost::detail::iterator_traits<Iterator2>::difference_type n; - b = i1 < i2; - b = i1 <= i2; - b = i1 > i2; - b = i1 >= i2; - n = i1 - i2; - - b = i2 < i1; - b = i2 <= i1; - b = i2 > i1; - b = i2 >= i1; - n = i2 - i1; + bool b; + typename boost::detail::iterator_traits<Iterator2>::difference_type n; + b = i1 < i2; + b = i1 <= i2; + b = i1 > i2; + b = i1 >= i2; + n = i1 - i2; + + b = i2 < i1; + b = i2 <= i1; + b = i2 > i1; + b = i2 >= i1; + n = i2 - i1; + boost::ignore_unused_variable_warning(b); + boost::ignore_unused_variable_warning(n); } + template <typename Iterator1, typename Iterator2> - void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2, - boost::single_pass_traversal_tag, boost::single_pass_traversal_tag) + void interop_rand_access_constraints( + Iterator1 const&, Iterator2 const&, + boost::single_pass_traversal_tag, boost::single_pass_traversal_tag) { } } // namespace detail - template <typename Iterator, typename ConstIterator> - class InteroperableIteratorConcept + BOOST_concept(InteroperableIterator,(Iterator)(ConstIterator)) { - public: + private: typedef typename boost::detail::pure_traversal_tag< typename boost::iterator_traversal< Iterator @@ -287,22 +259,26 @@ namespace boost_concepts { ConstIterator >::type >::type const_traversal_category; + + public: + BOOST_CONCEPT_ASSERT((SinglePassIterator<Iterator>)); + BOOST_CONCEPT_ASSERT((SinglePassIterator<ConstIterator>)); - void constraints() + BOOST_CONCEPT_USAGE(InteroperableIterator) { - boost::function_requires< SinglePassIteratorConcept<Iterator> >(); - boost::function_requires< SinglePassIteratorConcept<ConstIterator> >(); - detail::interop_single_pass_constraints(i, ci); detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category()); ci = i; } + + private: Iterator i; ConstIterator ci; }; } // namespace boost_concepts +#include <boost/concept/detail/concept_undef.hpp> #endif // BOOST_ITERATOR_CONCEPTS_HPP diff --git a/Utilities/BGL/boost/iterator/iterator_facade.hpp b/Utilities/BGL/boost/iterator/iterator_facade.hpp index ddb237d3249fb4dc074cbf392d3648fad253bdd3..967d60f2ba63a4a776af4ad9c67429bd389afca9 100644 --- a/Utilities/BGL/boost/iterator/iterator_facade.hpp +++ b/Utilities/BGL/boost/iterator/iterator_facade.hpp @@ -106,7 +106,7 @@ namespace boost typedef typename remove_const<ValueParam>::type value_type; typedef typename mpl::eval_if< - detail::iterator_writability_disabled<ValueParam,Reference> + boost::detail::iterator_writability_disabled<ValueParam,Reference> , add_pointer<const value_type> , add_pointer<value_type> >::type pointer; @@ -293,17 +293,17 @@ namespace boost // operator->() needs special support for input iterators to strictly meet the // standard's requirements. If *i is not a reference type, we must still - // produce a (constant) lvalue to which a pointer can be formed. We do that by + // produce a lvalue to which a pointer can be formed. We do that by // returning an instantiation of this special proxy class template. template <class T> struct operator_arrow_proxy { operator_arrow_proxy(T const* px) : m_value(*px) {} - const T* operator->() const { return &m_value; } + T* operator->() const { return &m_value; } // This function is needed for MWCW and BCC, which won't call operator-> // again automatically per 13.3.1.2 para 8 - operator const T*() const { return &m_value; } - T m_value; + operator T*() const { return &m_value; } + mutable T m_value; }; // A metafunction that gets the result type for operator->. Also @@ -327,7 +327,7 @@ namespace boost } }; -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // Deal with ETI template<> struct operator_arrow_result<int, int, int> @@ -410,7 +410,7 @@ namespace boost : # ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP iterator_difference<I1> -# elif BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300) mpl::if_< is_convertible<I2,I1> , typename I1::difference_type @@ -431,28 +431,28 @@ namespace boost // Macros which describe the declarations of binary operators # ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ - template < \ - class Derived1, class V1, class TC1, class R1, class D1 \ - , class Derived2, class V2, class TC2, class R2, class D2 \ - > \ - prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \ - operator op( \ - iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs \ - , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs) +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + template < \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ + > \ + prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \ + operator op( \ + iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \ + , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs) # else # define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ template < \ - class Derived1, class V1, class TC1, class R1, class D1 \ - , class Derived2, class V2, class TC2, class R2, class D2 \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ > \ - prefix typename detail::enable_if_interoperable< \ + prefix typename boost::detail::enable_if_interoperable< \ Derived1, Derived2 \ , typename mpl::apply2<result_type,Derived1,Derived2>::type \ >::type \ operator op( \ - iterator_facade<Derived1, V1, TC1, R1, D1> const& lhs \ - , iterator_facade<Derived2, V2, TC2, R2, D2> const& rhs) + iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \ + , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs) # endif # define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ @@ -470,8 +470,7 @@ namespace boost // class iterator_core_access { -# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) // Tasteless as this may seem, making all members public allows member templates // to work in the absence of member template friends. public: @@ -480,7 +479,7 @@ namespace boost template <class I, class V, class TC, class R, class D> friend class iterator_facade; # define BOOST_ITERATOR_FACADE_RELATION(op) \ - BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, detail::always_bool2); + BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::detail::always_bool2); BOOST_ITERATOR_FACADE_RELATION(==) BOOST_ITERATOR_FACADE_RELATION(!=) @@ -492,18 +491,18 @@ namespace boost # undef BOOST_ITERATOR_FACADE_RELATION BOOST_ITERATOR_FACADE_INTEROP_HEAD( - friend, -, detail::choose_difference_type) + friend, -, boost::detail::choose_difference_type) ; BOOST_ITERATOR_FACADE_PLUS_HEAD( - friend + friend inline , (iterator_facade<Derived, V, TC, R, D> const& , typename Derived::difference_type) ) ; BOOST_ITERATOR_FACADE_PLUS_HEAD( - friend + friend inline , (typename Derived::difference_type , iterator_facade<Derived, V, TC, R, D> const&) ) @@ -594,7 +593,7 @@ namespace boost > class iterator_facade # ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE - : public detail::iterator_facade_types< + : public boost::detail::iterator_facade_types< Value, CategoryOrTraversal, Reference, Difference >::base # undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE @@ -614,13 +613,13 @@ namespace boost return *static_cast<Derived const*>(this); } - typedef detail::iterator_facade_types< + typedef boost::detail::iterator_facade_types< Value, CategoryOrTraversal, Reference, Difference > associated_types; protected: // For use by derived classes - typedef iterator_facade<Derived,Value,Reference,Difference> iterator_facade_; + typedef iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference> iterator_facade_; public: @@ -635,26 +634,26 @@ namespace boost return iterator_core_access::dereference(this->derived()); } - typename detail::operator_arrow_result< + typename boost::detail::operator_arrow_result< value_type , reference , pointer >::type operator->() const { - return detail::operator_arrow_result< + return boost::detail::operator_arrow_result< value_type , reference , pointer >::make(*this->derived()); } - typename detail::operator_brackets_result<Derived,Value,reference>::type + typename boost::detail::operator_brackets_result<Derived,Value,reference>::type operator[](difference_type n) const { - typedef detail::use_operator_brackets_proxy<Value,Reference> use_proxy; + typedef boost::detail::use_operator_brackets_proxy<Value,Reference> use_proxy; - return detail::make_operator_brackets_result<Derived>( + return boost::detail::make_operator_brackets_result<Derived>( this->derived() + n , use_proxy() ); @@ -666,11 +665,11 @@ namespace boost return this->derived(); } -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) - typename detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + typename boost::detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type operator++(int) { - typename detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type + typename boost::detail::postfix_increment_result<Derived,Value,Reference,CategoryOrTraversal>::type tmp(this->derived()); ++*this; return tmp; @@ -708,7 +707,7 @@ namespace boost return result -= x; } -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // There appears to be a bug which trashes the data of classes // derived from iterator_facade when they are assigned unless we // define this assignment operator. This bug is only revealed @@ -721,15 +720,15 @@ namespace boost # endif }; -# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) +# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <class I, class V, class TC, class R, class D> - typename detail::postfix_increment_result<I,V,R,TC>::type + inline typename boost::detail::postfix_increment_result<I,V,R,TC>::type operator++( iterator_facade<I,V,TC,R,D>& i , int ) { - typename detail::postfix_increment_result<I,V,R,TC>::type + typename boost::detail::postfix_increment_result<I,V,R,TC>::type tmp(*static_cast<I*>(&i)); ++i; @@ -829,7 +828,7 @@ namespace boost # define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \ BOOST_ITERATOR_FACADE_INTEROP( \ op \ - , detail::always_bool2 \ + , boost::detail::always_bool2 \ , return_prefix \ , base_op \ ) @@ -846,7 +845,7 @@ namespace boost // operator- requires an additional part in the static assertion BOOST_ITERATOR_FACADE_INTEROP( - - , detail::choose_difference_type + , boost::detail::choose_difference_type , return , distance_from ) diff --git a/Utilities/BGL/boost/iterator/iterator_traits.hpp b/Utilities/BGL/boost/iterator/iterator_traits.hpp index 93e282efb214e2c5ec5c8b7c7c206aa5fe8181a8..960970e8dbcc715f085c89966e6e9f6f07b27f15 100644 --- a/Utilities/BGL/boost/iterator/iterator_traits.hpp +++ b/Utilities/BGL/boost/iterator/iterator_traits.hpp @@ -27,35 +27,35 @@ namespace boost { template <class Iterator> struct iterator_value { - typedef typename detail::iterator_traits<Iterator>::value_type type; + typedef typename boost::detail::iterator_traits<Iterator>::value_type type; }; template <class Iterator> struct iterator_reference { - typedef typename detail::iterator_traits<Iterator>::reference type; + typedef typename boost::detail::iterator_traits<Iterator>::reference type; }; template <class Iterator> struct iterator_pointer { - typedef typename detail::iterator_traits<Iterator>::pointer type; + typedef typename boost::detail::iterator_traits<Iterator>::pointer type; }; template <class Iterator> struct iterator_difference { - typedef typename detail::iterator_traits<Iterator>::difference_type type; + typedef typename boost::detail::iterator_traits<Iterator>::difference_type type; }; template <class Iterator> struct BOOST_ITERATOR_CATEGORY { - typedef typename detail::iterator_traits<Iterator>::iterator_category type; + typedef typename boost::detail::iterator_traits<Iterator>::iterator_category type; }; -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <> struct iterator_value<int> { diff --git a/Utilities/BGL/boost/iterator/new_iterator_tests.hpp b/Utilities/BGL/boost/iterator/new_iterator_tests.hpp index 8bb47b01ced70415d437199e5a4601a8d21ac2fb..caad700aef5747de329df17efe7a7722fcf74f44 100644 --- a/Utilities/BGL/boost/iterator/new_iterator_tests.hpp +++ b/Utilities/BGL/boost/iterator/new_iterator_tests.hpp @@ -29,7 +29,6 @@ // (David Abrahams) # include <iterator> -# include <assert.h> # include <boost/type_traits.hpp> # include <boost/static_assert.hpp> # include <boost/concept_archetype.hpp> // for detail::dummy_constructor @@ -40,6 +39,7 @@ # include <boost/iterator/detail/config_def.hpp> # include <boost/detail/is_incrementable.hpp> +# include <boost/detail/lightweight_test.hpp> namespace boost { @@ -50,7 +50,7 @@ template <class Iterator, class T> void readable_iterator_traversal_test(Iterator i1, T v, mpl::true_) { T v2(*i1++); - assert(v == v2); + BOOST_TEST(v == v2); } template <class Iterator, class T> @@ -81,8 +81,8 @@ void readable_iterator_test(const Iterator i1, T v) ref_t r2 = *i2; T v1 = r1; T v2 = r2; - assert(v1 == v); - assert(v2 == v); + BOOST_TEST(v1 == v); + BOOST_TEST(v2 == v); # if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) readable_iterator_traversal_test(i1, v, detail::is_postfix_incrementable<Iterator>()); @@ -115,7 +115,7 @@ void swappable_iterator_test(Iterator i, Iterator j) typename detail::iterator_traits<Iterator>::value_type bi = *i, bj = *j; iter_swap(i2, j2); typename detail::iterator_traits<Iterator>::value_type ai = *i, aj = *j; - assert(bi == aj && bj == ai); + BOOST_TEST(bi == aj && bj == ai); } template <class Iterator, class T> @@ -126,7 +126,7 @@ void constant_lvalue_iterator_test(Iterator i, T v1) typedef typename detail::iterator_traits<Iterator>::reference reference; BOOST_STATIC_ASSERT((is_same<const value_type&, reference>::value)); const T& v2 = *i2; - assert(v1 == v2); + BOOST_TEST(v1 == v2); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION BOOST_STATIC_ASSERT(is_lvalue_iterator<Iterator>::value); BOOST_STATIC_ASSERT(!is_non_const_lvalue_iterator<Iterator>::value); @@ -141,14 +141,14 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) typedef typename detail::iterator_traits<Iterator>::reference reference; BOOST_STATIC_ASSERT((is_same<value_type&, reference>::value)); T& v3 = *i2; - assert(v1 == v3); + BOOST_TEST(v1 == v3); // A non-const lvalue iterator is not neccessarily writable, but we // are assuming the value_type is assignable here *i = v2; T& v4 = *i2; - assert(v2 == v4); + BOOST_TEST(v2 == v4); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION BOOST_STATIC_ASSERT(is_lvalue_iterator<Iterator>::value); BOOST_STATIC_ASSERT(is_non_const_lvalue_iterator<Iterator>::value); @@ -161,15 +161,15 @@ void forward_readable_iterator_test(Iterator i, Iterator j, T val1, T val2) Iterator i2; Iterator i3(i); i2 = i; - assert(i2 == i3); - assert(i != j); - assert(i2 != j); + BOOST_TEST(i2 == i3); + BOOST_TEST(i != j); + BOOST_TEST(i2 != j); readable_iterator_test(i, val1); readable_iterator_test(i2, val1); readable_iterator_test(i3, val1); - assert(i == i2++); - assert(i != ++i3); + BOOST_TEST(i == i2++); + BOOST_TEST(i != ++i3); readable_iterator_test(i2, val2); readable_iterator_test(i3, val2); @@ -198,16 +198,16 @@ void bidirectional_readable_iterator_test(Iterator i, T v1, T v2) Iterator i1 = i, i2 = i; - assert(i == i1--); - assert(i != --i2); + BOOST_TEST(i == i1--); + BOOST_TEST(i != --i2); readable_iterator_test(i, v2); readable_iterator_test(i1, v1); readable_iterator_test(i2, v1); --i; - assert(i == i1); - assert(i == i2); + BOOST_TEST(i == i1); + BOOST_TEST(i == i2); ++i1; ++i2; @@ -227,32 +227,32 @@ void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals) for (c = 0; c < N-1; ++c) { - assert(i == j + c); - assert(*i == vals[c]); + BOOST_TEST(i == j + c); + BOOST_TEST(*i == vals[c]); typename detail::iterator_traits<Iterator>::value_type x = j[c]; - assert(*i == x); - assert(*i == *(j + c)); - assert(*i == *(c + j)); + BOOST_TEST(*i == x); + BOOST_TEST(*i == *(j + c)); + BOOST_TEST(*i == *(c + j)); ++i; - assert(i > j); - assert(i >= j); - assert(j <= i); - assert(j < i); + BOOST_TEST(i > j); + BOOST_TEST(i >= j); + BOOST_TEST(j <= i); + BOOST_TEST(j < i); } Iterator k = j + N - 1; for (c = 0; c < N-1; ++c) { - assert(i == k - c); - assert(*i == vals[N - 1 - c]); + BOOST_TEST(i == k - c); + BOOST_TEST(*i == vals[N - 1 - c]); typename detail::iterator_traits<Iterator>::value_type x = j[N - 1 - c]; - assert(*i == x); + BOOST_TEST(*i == x); Iterator q = k - c; - assert(*i == *q); - assert(i > j); - assert(i >= j); - assert(j <= i); - assert(j < i); + BOOST_TEST(*i == *q); + BOOST_TEST(i > j); + BOOST_TEST(i >= j); + BOOST_TEST(j <= i); + BOOST_TEST(j < i); --i; } } diff --git a/Utilities/BGL/boost/iterator/permutation_iterator.hpp b/Utilities/BGL/boost/iterator/permutation_iterator.hpp index 1cd01189a701d5a514de4797ee6f0bcad33ec175..23d11986da4cb3b516c18ec1110b469b6a7db293 100644 --- a/Utilities/BGL/boost/iterator/permutation_iterator.hpp +++ b/Utilities/BGL/boost/iterator/permutation_iterator.hpp @@ -50,6 +50,11 @@ private: typename super_t::reference dereference() const { return *(m_elt_iter + *this->base()); } +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + template <class,class> friend class permutation_iterator; +#else + public: +#endif ElementIterator m_elt_iter; }; diff --git a/Utilities/BGL/boost/iterator/transform_iterator.hpp b/Utilities/BGL/boost/iterator/transform_iterator.hpp index d6375271e00a6eaf985d5bd2bc47ec4ff849806c..e449a8b0d31e14a0339a4acfceea622f090067ea 100644 --- a/Utilities/BGL/boost/iterator/transform_iterator.hpp +++ b/Utilities/BGL/boost/iterator/transform_iterator.hpp @@ -37,10 +37,10 @@ namespace boost namespace detail { - template <class UnaryFunction> + template <class UnaryFunc> struct function_object_result { - typedef typename UnaryFunction::result_type type; + typedef typename UnaryFunc::result_type type; }; #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -52,7 +52,7 @@ namespace boost #endif // Compute the iterator_adaptor instantiation to be used for transform_iterator - template <class UnaryFunction, class Iterator, class Reference, class Value> + template <class UnaryFunc, class Iterator, class Reference, class Value> struct transform_iterator_base { private: @@ -62,7 +62,7 @@ namespace boost // proposal (e.g. using Doug's result_of)? typedef typename ia_dflt_help< Reference - , function_object_result<UnaryFunction> + , function_object_result<UnaryFunc> >::type reference; // To get the default for Value: remove any reference on the @@ -77,7 +77,7 @@ namespace boost public: typedef iterator_adaptor< - transform_iterator<UnaryFunction, Iterator, Reference, Value> + transform_iterator<UnaryFunc, Iterator, Reference, Value> , Iterator , cv_value_type , use_default // Leave the traversal category alone @@ -86,12 +86,12 @@ namespace boost }; } - template <class UnaryFunction, class Iterator, class Reference, class Value> + template <class UnaryFunc, class Iterator, class Reference, class Value> class transform_iterator - : public detail::transform_iterator_base<UnaryFunction, Iterator, Reference, Value>::type + : public boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type { typedef typename - detail::transform_iterator_base<UnaryFunction, Iterator, Reference, Value>::type + boost::detail::transform_iterator_base<UnaryFunc, Iterator, Reference, Value>::type super_t; friend class iterator_core_access; @@ -99,7 +99,7 @@ namespace boost public: transform_iterator() { } - transform_iterator(Iterator const& x, UnaryFunction f) + transform_iterator(Iterator const& x, UnaryFunc f) : super_t(x), m_f(f) { } explicit transform_iterator(Iterator const& x) @@ -108,9 +108,9 @@ namespace boost // Pro8 is a little too aggressive about instantiating the // body of this function. #if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - // don't provide this constructor if UnaryFunction is a + // don't provide this constructor if UnaryFunc is a // function pointer type, since it will be 0. Too dangerous. - BOOST_STATIC_ASSERT(is_class<UnaryFunction>::value); + BOOST_STATIC_ASSERT(is_class<UnaryFunc>::value); #endif } @@ -123,13 +123,13 @@ namespace boost transform_iterator<OtherUnaryFunction, OtherIterator, OtherReference, OtherValue> const& t , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0 #if !BOOST_WORKAROUND(BOOST_MSVC, == 1310) - , typename enable_if_convertible<OtherUnaryFunction, UnaryFunction>::type* = 0 + , typename enable_if_convertible<OtherUnaryFunction, UnaryFunc>::type* = 0 #endif ) : super_t(t.base()), m_f(t.functor()) {} - UnaryFunction functor() const + UnaryFunc functor() const { return m_f; } private: @@ -138,38 +138,38 @@ namespace boost // Probably should be the initial base class so it can be // optimized away via EBO if it is an empty class. - UnaryFunction m_f; + UnaryFunc m_f; }; - template <class UnaryFunction, class Iterator> - transform_iterator<UnaryFunction, Iterator> - make_transform_iterator(Iterator it, UnaryFunction fun) + template <class UnaryFunc, class Iterator> + transform_iterator<UnaryFunc, Iterator> + make_transform_iterator(Iterator it, UnaryFunc fun) { - return transform_iterator<UnaryFunction, Iterator>(it, fun); + return transform_iterator<UnaryFunc, Iterator>(it, fun); } - // Version which allows explicit specification of the UnaryFunction + // Version which allows explicit specification of the UnaryFunc // type. // - // This generator is not provided if UnaryFunction is a function + // This generator is not provided if UnaryFunc is a function // pointer type, because it's too dangerous: the default-constructed // function pointer in the iterator be 0, leading to a runtime // crash. - template <class UnaryFunction, class Iterator> + template <class UnaryFunc, class Iterator> #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) typename mpl::if_< #else typename iterators::enable_if< #endif - is_class<UnaryFunction> // We should probably find a cheaper test than is_class<> - , transform_iterator<UnaryFunction, Iterator> + is_class<UnaryFunc> // We should probably find a cheaper test than is_class<> + , transform_iterator<UnaryFunc, Iterator> #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) , int[3] #endif >::type make_transform_iterator(Iterator it) { - return transform_iterator<UnaryFunction, Iterator>(it, UnaryFunction()); + return transform_iterator<UnaryFunc, Iterator>(it, UnaryFunc()); } #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) diff --git a/Utilities/BGL/boost/iterator/zip_iterator.hpp b/Utilities/BGL/boost/iterator/zip_iterator.hpp index 817bbab0586c8259addb9d26a509687d8d090557..f3896ad955176aa7328000db280d9d7b0d72b70a 100644 --- a/Utilities/BGL/boost/iterator/zip_iterator.hpp +++ b/Utilities/BGL/boost/iterator/zip_iterator.hpp @@ -1,22 +1,7 @@ -// (C) Copyright David Abrahams and Thomas Becker 2000. Permission to -// copy, use, modify, sell and distribute this software is granted -// provided this copyright notice appears in all copies. This software -// is provided "as is" without express or implied warranty, and with -// no claim as to its suitability for any purpose. -// -// Compilers Tested: -// ================= -// Metrowerks Codewarrior Pro 7.2, 8.3 -// gcc 2.95.3 -// gcc 3.2 -// Microsoft VC 6sp5 (test fails due to some compiler bug) -// Microsoft VC 7 (works) -// Microsoft VC 7.1 -// Intel 5 -// Intel 6 -// Intel 7.1 -// Intel 8 -// Borland 5.5.1 (broken due to lack of support from Boost.Tuples) +// Copyright David Abrahams and Thomas Becker 2000-2006. 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_ZIP_ITERATOR_TMB_07_13_2003_HPP_ # define BOOST_ZIP_ITERATOR_TMB_07_13_2003_HPP_ @@ -181,11 +166,11 @@ namespace boost { > struct tuple_meta_accumulate : mpl::eval_if< -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) mpl::or_< #endif boost::is_same<Tuple, tuples::null_type> -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) , boost::is_same<Tuple,int> > #endif @@ -316,7 +301,7 @@ namespace boost { // No point in bringing in a bunch of #ifdefs here. This is // going to go away with the next tuple implementation anyway. // - bool tuple_equal(tuples::null_type, tuples::null_type) + inline bool tuple_equal(tuples::null_type, tuples::null_type) { return true; } template<typename Tuple1, typename Tuple2> @@ -382,7 +367,7 @@ namespace boost { >::type type; }; -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // ETI workaround +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // ETI workaround template <> struct minimum_traversal_category_in_iterator_tuple<int> { diff --git a/Utilities/BGL/boost/iterator_adaptors.hpp b/Utilities/BGL/boost/iterator_adaptors.hpp deleted file mode 100644 index 7058153be06b05b22b202bd1efb8ef2b4f9ca639..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/iterator_adaptors.hpp +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright David Abrahams 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) -#ifndef ITERATOR_ADAPTORS_DWA2004725_HPP -# define ITERATOR_ADAPTORS_DWA2004725_HPP - -#define BOOST_ITERATOR_ADAPTORS_VERSION 0x0200 -#include <boost/iterator/iterator_adaptor.hpp> - -#endif // ITERATOR_ADAPTORS_DWA2004725_HPP diff --git a/Utilities/BGL/boost/lexical_cast.hpp b/Utilities/BGL/boost/lexical_cast.hpp deleted file mode 100644 index 926b95e43034febdf49f2258f647b962202f5553..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/lexical_cast.hpp +++ /dev/null @@ -1,252 +0,0 @@ -#ifndef BOOST_LEXICAL_CAST_INCLUDED -#define BOOST_LEXICAL_CAST_INCLUDED - -// Boost lexical_cast.hpp header -------------------------------------------// -// -// See http://www.boost.org for most recent version including documentation. -// See end of this header for rights and permissions. -// -// what: lexical_cast custom keyword cast -// who: contributed by Kevlin Henney, -// enhanced with contributions from Terje Sletteb�, -// with additional fixes and suggestions from Gennaro Prota, -// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov, -// and other Boosters -// when: November 2000, March 2003, June 2005 - -#include <cstddef> -#include <string> -#include <typeinfo> -#include <boost/config.hpp> -#include <boost/limits.hpp> -#include <boost/throw_exception.hpp> -#include <boost/type_traits/is_pointer.hpp> - -#ifdef BOOST_NO_STRINGSTREAM -#include <strstream> -#else -#include <sstream> -#endif - -#if defined(BOOST_NO_STRINGSTREAM) || \ - defined(BOOST_NO_STD_WSTRING) || \ - defined(BOOST_NO_STD_LOCALE) -#define DISABLE_WIDE_CHAR_SUPPORT -#endif - -namespace boost -{ - // exception used to indicate runtime lexical_cast failure - class bad_lexical_cast : public std::bad_cast - { - public: - bad_lexical_cast() : - source(&typeid(void)), target(&typeid(void)) - { - } - bad_lexical_cast( - const std::type_info &source_type, - const std::type_info &target_type) : - source(&source_type), target(&target_type) - { - } - const std::type_info &source_type() const - { - return *source; - } - const std::type_info &target_type() const - { - return *target; - } - virtual const char *what() const throw() - { - return "bad lexical cast: " - "source type value could not be interpreted as target"; - } - virtual ~bad_lexical_cast() throw() - { - } - private: - const std::type_info *source; - const std::type_info *target; - }; - - namespace detail // selectors for choosing stream character type - { - template<typename Type> - struct stream_char - { - typedef char type; - }; - - #ifndef DISABLE_WIDE_CHAR_SUPPORT -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - template<> - struct stream_char<wchar_t> - { - typedef wchar_t type; - }; -#endif - - template<> - struct stream_char<wchar_t *> - { - typedef wchar_t type; - }; - - template<> - struct stream_char<const wchar_t *> - { - typedef wchar_t type; - }; - - template<> - struct stream_char<std::wstring> - { - typedef wchar_t type; - }; - #endif - - template<typename TargetChar, typename SourceChar> - struct widest_char - { - typedef TargetChar type; - }; - - template<> - struct widest_char<char, wchar_t> - { - typedef wchar_t type; - }; - } - - namespace detail // stream wrapper for handling lexical conversions - { - template<typename Target, typename Source> - class lexical_stream - { - private: - typedef typename widest_char< - typename stream_char<Target>::type, - typename stream_char<Source>::type>::type char_type; - - public: - lexical_stream() - { - stream.unsetf(std::ios::skipws); - - if(std::numeric_limits<Target>::is_specialized) - stream.precision(std::numeric_limits<Target>::digits10 + 1); - else if(std::numeric_limits<Source>::is_specialized) - stream.precision(std::numeric_limits<Source>::digits10 + 1); - } - ~lexical_stream() - { - #if defined(BOOST_NO_STRINGSTREAM) - stream.freeze(false); - #endif - } - bool operator<<(const Source &input) - { - return !(stream << input).fail(); - } - template<typename InputStreamable> - bool operator>>(InputStreamable &output) - { - return !is_pointer<InputStreamable>::value && - stream >> output && - stream.get() == -#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING) -// GCC 2.9x lacks std::char_traits<>::eof(). -// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3 -// configurations, which do provide std::char_traits<>::eof(). - - EOF; -#else - std::char_traits<char_type>::eof(); -#endif - } - bool operator>>(std::string &output) - { - #if defined(BOOST_NO_STRINGSTREAM) - stream << '\0'; - #endif - output = stream.str(); - return true; - } - #ifndef DISABLE_WIDE_CHAR_SUPPORT - bool operator>>(std::wstring &output) - { - output = stream.str(); - return true; - } - #endif - private: - #if defined(BOOST_NO_STRINGSTREAM) - std::strstream stream; - #elif defined(BOOST_NO_STD_LOCALE) - std::stringstream stream; - #else - std::basic_stringstream<char_type> stream; - #endif - }; - } - - #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - // call-by-const reference version - - namespace detail - { - template<class T> - struct array_to_pointer_decay - { - typedef T type; - }; - - template<class T, std::size_t N> - struct array_to_pointer_decay<T[N]> - { - typedef const T * type; - }; - } - - template<typename Target, typename Source> - Target lexical_cast(const Source &arg) - { - typedef typename detail::array_to_pointer_decay<Source>::type NewSource; - - detail::lexical_stream<Target, NewSource> interpreter; - Target result; - - if(!(interpreter << arg && interpreter >> result)) - throw_exception(bad_lexical_cast(typeid(NewSource), typeid(Target))); - return result; - } - - #else - - // call-by-value fallback version (deprecated) - - template<typename Target, typename Source> - Target lexical_cast(Source arg) - { - detail::lexical_stream<Target, Source> interpreter; - Target result; - - if(!(interpreter << arg && interpreter >> result)) - throw_exception(bad_lexical_cast(typeid(Source), typeid(Target))); - return result; - } - - #endif -} - -// Copyright Kevlin Henney, 2000-2005. All rights reserved. -// -// 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) - -#undef DISABLE_WIDE_CHAR_SUPPORT -#endif diff --git a/Utilities/BGL/boost/limits.hpp b/Utilities/BGL/boost/limits.hpp index 0f7a5929325233f9262ff56b0e0f4f6bc9fe23f3..d3747a1ad135cc6d5d0b69448851ae9ddc97835e 100644 --- a/Utilities/BGL/boost/limits.hpp +++ b/Utilities/BGL/boost/limits.hpp @@ -6,7 +6,7 @@ // // use this header as a workaround for missing <limits> -// See http://www.boost.org/libs/butility/limits.html for documentation. +// See http://www.boost.org/libs/compatibility/index.html for documentation. #ifndef BOOST_LIMITS #define BOOST_LIMITS @@ -30,6 +30,8 @@ # define BOOST_ULLT ::boost::ulong_long_type #endif +#include <climits> // for CHAR_BIT + namespace std { template<> @@ -76,8 +78,8 @@ namespace std static BOOST_LLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); - BOOST_STATIC_CONSTANT(bool, is_bounded = false); - BOOST_STATIC_CONSTANT(bool, is_modulo = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = true); + BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); @@ -129,8 +131,8 @@ namespace std static BOOST_ULLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); - BOOST_STATIC_CONSTANT(bool, is_bounded = false); - BOOST_STATIC_CONSTANT(bool, is_modulo = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = true); + BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); @@ -141,3 +143,4 @@ namespace std #endif #endif + diff --git a/Utilities/BGL/boost/mem_fn.hpp b/Utilities/BGL/boost/mem_fn.hpp deleted file mode 100644 index 7097d43bec5f9b715eec551b1a81b34c94177ca4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/mem_fn.hpp +++ /dev/null @@ -1,394 +0,0 @@ -#ifndef BOOST_MEM_FN_HPP_INCLUDED -#define BOOST_MEM_FN_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// mem_fn.hpp - a generalization of std::mem_fun[_ref] -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2001 David Abrahams -// Copyright (c) 2003-2005 Peter Dimov -// -// 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/bind/mem_fn.html for documentation. -// - -#include <boost/config.hpp> -#include <boost/get_pointer.hpp> -#include <boost/detail/workaround.hpp> - -namespace boost -{ - -#if defined(BOOST_NO_VOID_RETURNS) - -#define BOOST_MEM_FN_CLASS_F , class F -#define BOOST_MEM_FN_TYPEDEF(X) - -namespace _mfi // mem_fun_impl -{ - -template<class V> struct mf -{ - -#define BOOST_MEM_FN_RETURN return - -#define BOOST_MEM_FN_NAME(X) inner_##X -#define BOOST_MEM_FN_CC - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -}; // struct mf<V> - -template<> struct mf<void> -{ - -#define BOOST_MEM_FN_RETURN - -#define BOOST_MEM_FN_NAME(X) inner_##X -#define BOOST_MEM_FN_CC - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -}; // struct mf<void> - -#undef BOOST_MEM_FN_CLASS_F -#undef BOOST_MEM_FN_TYPEDEF_F - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_NAME2(X) inner_##X -#define BOOST_MEM_FN_CC - -#include <boost/bind/mem_fn_vw.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include <boost/bind/mem_fn_vw.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include <boost/bind/mem_fn_vw.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include <boost/bind/mem_fn_vw.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#endif - -} // namespace _mfi - -#else // #ifdef BOOST_NO_VOID_RETURNS - -#define BOOST_MEM_FN_CLASS_F -#define BOOST_MEM_FN_TYPEDEF(X) typedef X; - -namespace _mfi -{ - -#define BOOST_MEM_FN_RETURN return - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_CC - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include <boost/bind/mem_fn_template.hpp> - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -} // namespace _mfi - -#undef BOOST_MEM_FN_CLASS_F -#undef BOOST_MEM_FN_TYPEDEF - -#endif // #ifdef BOOST_NO_VOID_RETURNS - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_CC - -#include <boost/bind/mem_fn_cc.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include <boost/bind/mem_fn_cc.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include <boost/bind/mem_fn_cc.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include <boost/bind/mem_fn_cc.hpp> - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#endif - -// data member support - -namespace _mfi -{ - -template<class R, class T> class dm -{ -public: - - typedef R const & result_type; - typedef T const * argument_type; - -private: - - typedef R (T::*F); - F f_; - - template<class U> R const & call(U & u, T const *) const - { - return (u.*f_); - } - - template<class U> R & call(U & u, T *) const - { - return (u.*f_); - } - - template<class U> R const & call(U & u, void const *) const - { - return (get_pointer(u)->*f_); - } - -public: - - explicit dm(F f): f_(f) {} - - R & operator()(T * p) const - { - return (p->*f_); - } - - R const & operator()(T const * p) const - { - return (p->*f_); - } - - template<class U> R const & operator()(U & u) const - { - return call(u, &u); - } - -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200) - - R & operator()(T & t) const - { - return (t.*f_); - } - -#endif - - R const & operator()(T const & t) const - { - return (t.*f_); - } - - bool operator==(dm const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(dm const & rhs) const - { - return f_ != rhs.f_; - } -}; - -} // namespace _mfi - -template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f) -{ - return _mfi::dm<R, T>(f); -} - -} // namespace boost - -#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED diff --git a/Utilities/BGL/boost/memory_order.hpp b/Utilities/BGL/boost/memory_order.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4945af623b265a3f298d261038202235200e5079 --- /dev/null +++ b/Utilities/BGL/boost/memory_order.hpp @@ -0,0 +1,53 @@ +#ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED +#define BOOST_MEMORY_ORDER_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/memory_order.hpp +// +// Defines enum boost::memory_order per the C++0x working draft +// +// Copyright (c) 2008, 2009 Peter Dimov +// +// 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) + + +namespace boost +{ + +// +// Enum values are chosen so that code that needs to insert +// a trailing fence for acquire semantics can use a single +// test such as: +// +// if( mo & memory_order_acquire ) { ...fence... } +// +// For leading fences one can use: +// +// if( mo & memory_order_release ) { ...fence... } +// +// Architectures such as Alpha that need a fence on consume +// can use: +// +// if( mo & ( memory_order_acquire | memory_order_consume ) ) { ...fence... } +// + +enum memory_order +{ + memory_order_relaxed = 0, + memory_order_acquire = 1, + memory_order_release = 2, + memory_order_acq_rel = 3, // acquire | release + memory_order_seq_cst = 7, // acq_rel | 4 + memory_order_consume = 8 +}; + +} // namespace boost + +#endif // #ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/O1_size.hpp b/Utilities/BGL/boost/mpl/O1_size.hpp index 04ff381c41e7370d11269436ddbe9d6c8a02b77a..84ba5215e056f9bae27e9edd58ef7afc456be287 100644 --- a/Utilities/BGL/boost/mpl/O1_size.hpp +++ b/Utilities/BGL/boost/mpl/O1_size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/O1_size.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/O1_size_fwd.hpp b/Utilities/BGL/boost/mpl/O1_size_fwd.hpp index 26f8748e7dae076cdd2a5790272c911806cd381e..281fcafa86de895c94244efcab5fce026215806f 100644 --- a/Utilities/BGL/boost/mpl/O1_size_fwd.hpp +++ b/Utilities/BGL/boost/mpl/O1_size_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/O1_size_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: O1_size_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/accumulate.hpp b/Utilities/BGL/boost/mpl/accumulate.hpp index 29065644cb86a7f90ad3260ef81913c9f8db9a90..dba85717c7cee0b820db2ba42ee6278f3c589afe 100644 --- a/Utilities/BGL/boost/mpl/accumulate.hpp +++ b/Utilities/BGL/boost/mpl/accumulate.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/accumulate.hpp,v $ -// $Date: 2005/01/19 15:20:21 $ -// $Revision: 1.2 $ +// $Id: accumulate.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/advance.hpp b/Utilities/BGL/boost/mpl/advance.hpp index 42450528597de9b34b7e7aa99b76d8c133cfbdb6..c8b5ae8cb3435bbd102da9b424d8fd74589443d0 100644 --- a/Utilities/BGL/boost/mpl/advance.hpp +++ b/Utilities/BGL/boost/mpl/advance.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/advance.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.9 $ +// $Id: advance.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/advance_fwd.hpp> #include <boost/mpl/less.hpp> diff --git a/Utilities/BGL/boost/mpl/advance_fwd.hpp b/Utilities/BGL/boost/mpl/advance_fwd.hpp index 4a2fe03198f7e900b57d5e7b91a1164e4e1727eb..daf0c910a067c02c743581c5ca0e5401cba47f3b 100644 --- a/Utilities/BGL/boost/mpl/advance_fwd.hpp +++ b/Utilities/BGL/boost/mpl/advance_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/advance_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: advance_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/common_name_wknd.hpp> diff --git a/Utilities/BGL/boost/mpl/alias.hpp b/Utilities/BGL/boost/mpl/alias.hpp index 88a2eeddf10721dbcc7d2db124e47a0f6c1facb6..247a635ef44125bd9dfefbe5738f2da46d0e0bbf 100644 --- a/Utilities/BGL/boost/mpl/alias.hpp +++ b/Utilities/BGL/boost/mpl/alias.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/alias.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: alias.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace { namespace mpl = boost::mpl; diff --git a/Utilities/BGL/boost/mpl/always.hpp b/Utilities/BGL/boost/mpl/always.hpp index f32cf9fd24ef01e9977d3fd342efb7682befdff6..f98423138c08b80003b0330a5aafa8d89638f2a5 100644 --- a/Utilities/BGL/boost/mpl/always.hpp +++ b/Utilities/BGL/boost/mpl/always.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/always.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: always.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/preprocessor/def_params_tail.hpp> #include <boost/mpl/aux_/na.hpp> diff --git a/Utilities/BGL/boost/mpl/and.hpp b/Utilities/BGL/boost/mpl/and.hpp index 217c46c306ca890d041b28e68b439dcb2bbee101..1b3ede229957537ddbcac3e353db97985ccfeab9 100644 --- a/Utilities/BGL/boost/mpl/and.hpp +++ b/Utilities/BGL/boost/mpl/and.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/and.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: and.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/use_preprocessed.hpp> @@ -29,21 +29,25 @@ // has to be checked in a separate condition, otherwise GCC complains // about 'and' being an alternative token #if defined(_MSC_VER) +#ifndef __GCCXML__ #if defined(and) # pragma push_macro("and") # undef and # define and(x) #endif #endif +#endif # define BOOST_MPL_PREPROCESSED_HEADER and.hpp # include <boost/mpl/aux_/include_preprocessed.hpp> #if defined(_MSC_VER) +#ifndef __GCCXML__ #if defined(and) # pragma pop_macro("and") #endif #endif +#endif #else diff --git a/Utilities/BGL/boost/mpl/apply.hpp b/Utilities/BGL/boost/mpl/apply.hpp index f42cee3db1dafbae0bdc77a14981e79cffa091f2..944619e60cc7083e04f34957e92eed067fe32c6e 100644 --- a/Utilities/BGL/boost/mpl/apply.hpp +++ b/Utilities/BGL/boost/mpl/apply.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/apply.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.17 $ +// $Id: apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/apply_fwd.hpp> @@ -135,7 +135,10 @@ struct apply ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 # define i_ BOOST_PP_FRAME_ITERATION(1) @@ -222,4 +225,5 @@ struct apply_chooser<i_> # undef i_ +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/apply_fwd.hpp b/Utilities/BGL/boost/mpl/apply_fwd.hpp index 5b850d331c97b3fa18ad0bb68fd36a54bf28e49f..a78ae8b45ae8840c73d7e8e6cec5dffc69cca1ca 100644 --- a/Utilities/BGL/boost/mpl/apply_fwd.hpp +++ b/Utilities/BGL/boost/mpl/apply_fwd.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/apply_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: apply_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/aux_/na.hpp> @@ -44,7 +44,7 @@ // agurt, 15/jan/02: top-level 'apply' template gives an ICE on MSVC // (for known reasons) -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) # define BOOST_MPL_CFG_NO_APPLY_TEMPLATE #endif diff --git a/Utilities/BGL/boost/mpl/apply_wrap.hpp b/Utilities/BGL/boost/mpl/apply_wrap.hpp index ae58189bff9f1b6cc19559cb34a6c5a7afe78a35..b3cb12b426e3a32595c9678aa238a8d6dc405a76 100644 --- a/Utilities/BGL/boost/mpl/apply_wrap.hpp +++ b/Utilities/BGL/boost/mpl/apply_wrap.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED #define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/apply_wrap.hpp,v $ -// $Date: 2004/09/03 15:56:55 $ -// $Revision: 1.3 $ +// $Id: apply_wrap.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ +// $Date: 2008-10-11 02:50:46 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49272 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/aux_/arity.hpp> @@ -39,9 +39,10 @@ # include <boost/mpl/aux_/preprocessor/params.hpp> # include <boost/mpl/aux_/preprocessor/enum.hpp> # include <boost/mpl/aux_/preprocessor/add.hpp> +# include <boost/mpl/aux_/config/bcc.hpp> +# include <boost/mpl/aux_/config/ctps.hpp> # include <boost/mpl/aux_/config/dtp.hpp> # include <boost/mpl/aux_/config/eti.hpp> -# include <boost/mpl/aux_/config/ctps.hpp> # include <boost/mpl/aux_/config/msvc.hpp> # include <boost/mpl/aux_/config/workaround.hpp> @@ -78,7 +79,10 @@ namespace boost { namespace mpl { ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 # define i_ BOOST_PP_FRAME_ITERATION(1) @@ -174,6 +178,33 @@ struct BOOST_PP_CAT(apply_wrap,i_)<AUX778076_APPLY_WRAP_SPEC_PARAMS(i_, int)> # define j_ BOOST_PP_FRAME_ITERATION(2) +#if i_ == 0 && j_ == 0 \ + && defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \ + && !defined(BOOST_MPL_CFG_NO_HAS_APPLY) + +template< typename F, bool F_has_apply > +struct apply_wrap_impl0_bcb { + typedef typename F::template apply< na > type; +}; + +template< typename F > +struct apply_wrap_impl0_bcb< F, true > { + typedef typename F::apply type; +}; + +template< + typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) + > +struct BOOST_PP_CAT(apply_wrap_impl,i_)< + BOOST_MPL_PP_ADD(i_, j_) + , F + BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T) + > +{ + typedef apply_wrap_impl0_bcb< F, aux::has_apply< F >::value >::type type; +}; +#else + template< typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T) > @@ -195,6 +226,9 @@ struct BOOST_PP_CAT(apply_wrap_impl,i_)< > type; }; +#endif + # undef j_ +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/arg.hpp b/Utilities/BGL/boost/mpl/arg.hpp index a96b86aad7deec61654931eb43dfac606a3290ce..c1c70726867799f383a8ba59f3f7b8db4669a2c4 100644 --- a/Utilities/BGL/boost/mpl/arg.hpp +++ b/Utilities/BGL/boost/mpl/arg.hpp @@ -15,9 +15,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/arg.hpp,v $ -// $Date: 2004/09/21 13:48:07 $ -// $Revision: 1.12 $ +// $Id: arg.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/arg_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/arg_fwd.hpp b/Utilities/BGL/boost/mpl/arg_fwd.hpp index 4c9e3a18501130814b82edd52a8a653139180daf..c96b48f068428d3e8e246a2dd1da1f95760406f7 100644 --- a/Utilities/BGL/boost/mpl/arg_fwd.hpp +++ b/Utilities/BGL/boost/mpl/arg_fwd.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/arg_fwd.hpp,v $ -// $Date: 2004/09/28 13:56:58 $ -// $Revision: 1.6 $ +// $Id: arg_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> #include <boost/mpl/aux_/nttp_decl.hpp> diff --git a/Utilities/BGL/boost/mpl/arithmetic.hpp b/Utilities/BGL/boost/mpl/arithmetic.hpp index 598a728669f86a2e7bb6215900d310743170ec00..b0b392d72a0d180a0dfb724fc61ef4aa4480c004 100644 --- a/Utilities/BGL/boost/mpl/arithmetic.hpp +++ b/Utilities/BGL/boost/mpl/arithmetic.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/arithmetic.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: arithmetic.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/plus.hpp> #include <boost/mpl/minus.hpp> diff --git a/Utilities/BGL/boost/mpl/as_sequence.hpp b/Utilities/BGL/boost/mpl/as_sequence.hpp index ba3d6f4cdee1161c0ccc36b5709c1036efa3d7df..2e83a3011d856a711868d3612d3c55057924664b 100644 --- a/Utilities/BGL/boost/mpl/as_sequence.hpp +++ b/Utilities/BGL/boost/mpl/as_sequence.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/as_sequence.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: as_sequence.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/is_sequence.hpp> #include <boost/mpl/single_view.hpp> diff --git a/Utilities/BGL/boost/mpl/assert.hpp b/Utilities/BGL/boost/mpl/assert.hpp index fa41292fbf949c41a37cac8212835a6b632c138f..33b82f3ffa11ab3a49cef1d93ac3f00b611d9d2d 100644 --- a/Utilities/BGL/boost/mpl/assert.hpp +++ b/Utilities/BGL/boost/mpl/assert.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_ASSERT_HPP_INCLUDED #define BOOST_MPL_ASSERT_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/assert.hpp,v $ -// $Date: 2004/09/28 13:56:58 $ -// $Revision: 1.13 $ +// $Id: assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/not.hpp> #include <boost/mpl/aux_/value_wknd.hpp> @@ -25,22 +25,39 @@ #include <boost/mpl/aux_/config/dtp.hpp> #include <boost/mpl/aux_/config/gcc.hpp> #include <boost/mpl/aux_/config/msvc.hpp> +#include <boost/mpl/aux_/config/static_constant.hpp> +#include <boost/mpl/aux_/config/pp_counter.hpp> #include <boost/mpl/aux_/config/workaround.hpp> #include <boost/preprocessor/cat.hpp> -#if BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ - || (BOOST_MPL_CFG_GCC != 0) +#include <boost/config.hpp> // make sure 'size_t' is placed into 'std' +#include <cstddef> + + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ + || (BOOST_MPL_CFG_GCC != 0) \ + || BOOST_WORKAROUND(__IBMCPP__, <= 600) # define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES #endif #if BOOST_WORKAROUND(__MWERKS__, < 0x3202) \ || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \ - || BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) # define BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER #endif +// agurt, 10/nov/06: use enums for Borland (which cannot cope with static constants) +// and GCC (which issues "unused variable" warnings when static constants are used +// at a function scope) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ + || (BOOST_MPL_CFG_GCC != 0) +# define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr } +#else +# define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) BOOST_STATIC_CONSTANT(T, expr) +#endif + BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN @@ -48,7 +65,7 @@ struct failed {}; // agurt, 24/aug/04: MSVC 7.1 workaround here and below: return/accept // 'assert<false>' by reference; can't apply it unconditionally -- apparently it -// degrades quality of GCC diagnostics +// degrades the quality of GCC diagnostics #if BOOST_WORKAROUND(BOOST_MSVC, == 1310) # define AUX778076_ASSERT_ARG(x) x& #else @@ -129,7 +146,7 @@ template< typename P > struct assert_arg_pred template< typename P > struct assert_arg_pred_not { typedef typename P::type p_type; - enum { p = !p_type::value }; + BOOST_MPL_AUX_ASSERT_CONSTANT( bool, p = !p_type::value ); typedef typename assert_arg_pred_impl<p>::type type; }; @@ -198,13 +215,14 @@ BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE // BOOST_MPL_ASSERT((pred<x,...>)) #define BOOST_MPL_ASSERT(pred) \ -enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \ boost::mpl::assertion_failed<false>( \ boost::mpl::assert_arg( (void (*) pred)0, 1 ) \ ) \ ) \ -}\ + ) \ /**/ // BOOST_MPL_ASSERT_NOT((pred<x,...>)) @@ -212,7 +230,7 @@ enum { \ #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) # define BOOST_MPL_ASSERT_NOT(pred) \ enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ + BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \ boost::mpl::assertion<false>::failed( \ boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \ ) \ @@ -221,13 +239,14 @@ enum { \ /**/ #else # define BOOST_MPL_ASSERT_NOT(pred) \ -enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \ boost::mpl::assertion_failed<false>( \ boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \ ) \ ) \ -}\ + ) \ /**/ #endif @@ -236,10 +255,13 @@ enum { \ #if defined(BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES) # if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER) -# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \ -enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ - boost::mpl::assertion_failed<(x rel y)>( \ +// agurt, 9/nov/06: 'enum' below is a workaround for gcc 4.0.4/4.1.1 bugs #29522 and #29518 +# define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y) \ +enum { BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) }; \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \ + boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \ (boost::mpl::failed ************ ( boost::mpl::assert_relation< \ boost::mpl::assert_::relations( sizeof( \ boost::mpl::assert_::arg rel boost::mpl::assert_::arg \ @@ -248,46 +270,58 @@ enum { \ , y \ >::************)) 0 ) \ ) \ -} \ + ) \ /**/ # else -# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \ -enum { \ - BOOST_PP_CAT(mpl_assert_rel,__LINE__) = sizeof(boost::mpl::assert_::arg rel boost::mpl::assert_::arg) \ - , BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) \ - , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ - boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \ +# define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y) \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assert_rel,counter) = sizeof( \ + boost::mpl::assert_::arg rel boost::mpl::assert_::arg \ + ) \ + ); \ +BOOST_MPL_AUX_ASSERT_CONSTANT( bool, BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) ); \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \ + boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \ boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \ - boost::mpl::assert_::relations(BOOST_PP_CAT(mpl_assert_rel,__LINE__)) \ + boost::mpl::assert_::relations(BOOST_PP_CAT(mpl_assert_rel,counter)) \ , x \ , y \ >() ) \ ) \ ) \ -} \ + ) \ /**/ # endif +# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \ +BOOST_MPL_ASSERT_RELATION_IMPL(BOOST_MPL_AUX_PP_COUNTER(), x, rel, y) \ +/**/ + #else // !BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES # if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER) # define BOOST_MPL_ASSERT_RELATION(x, rel, y) \ -enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \ boost::mpl::assertion_failed<(x rel y)>( boost::mpl::assert_rel_arg( \ boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \ ) ) \ ) \ -}\ + ) \ /**/ # else # define BOOST_MPL_ASSERT_RELATION(x, rel, y) \ -enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \ boost::mpl::assertion_failed<(x rel y)>( (boost::mpl::failed ************ ( \ boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \ ) \ -}\ + ) \ /**/ # endif @@ -297,34 +331,40 @@ enum { \ // BOOST_MPL_ASSERT_MSG( (pred<x,...>::value), USER_PROVIDED_MESSAGE, (types<x,...>) ) #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) -# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \ - struct msg; \ - typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \ - { \ - using boost::mpl::assert_::types; \ - static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \ - { return 0; } \ - } BOOST_PP_CAT(mpl_assert_arg,__LINE__); \ - enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ - boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \ - ) \ - }\ +# define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \ +struct msg; \ +typedef struct BOOST_PP_CAT(msg,counter) : boost::mpl::assert_ \ +{ \ + using boost::mpl::assert_::types; \ + static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \ + { return 0; } \ +} BOOST_PP_CAT(mpl_assert_arg,counter); \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \ + boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \ + ) \ + ) \ /**/ #else -# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \ - struct msg; \ - typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \ - { \ - static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \ - { return 0; } \ - } BOOST_PP_CAT(mpl_assert_arg,__LINE__); \ - enum { \ - BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \ - boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \ - ) \ - }\ +# define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \ +struct msg; \ +typedef struct BOOST_PP_CAT(msg,counter) : boost::mpl::assert_ \ +{ \ + static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \ + { return 0; } \ +} BOOST_PP_CAT(mpl_assert_arg,counter); \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \ + boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \ + ) \ + ) \ /**/ #endif +#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \ +BOOST_MPL_ASSERT_MSG_IMPL( BOOST_MPL_AUX_PP_COUNTER(), c, msg, types_ ) \ +/**/ + #endif // BOOST_MPL_ASSERT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/at.hpp b/Utilities/BGL/boost/mpl/at.hpp index 403a27911a46144a368a07d270bf795e7b069e8d..caa3462384246c834d6a554be0a22470e935103d 100644 --- a/Utilities/BGL/boost/mpl/at.hpp +++ b/Utilities/BGL/boost/mpl/at.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/at.hpp,v $ -// $Date: 2004/09/04 01:33:46 $ -// $Revision: 1.7 $ +// $Id: at.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/at_fwd.hpp> #include <boost/mpl/aux_/at_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/at_fwd.hpp b/Utilities/BGL/boost/mpl/at_fwd.hpp index 941101ec5e3c290dee35e04a7215b76ca859b6c7..6bce275198e2745ca89b3499ec5959a5ae6a8441 100644 --- a/Utilities/BGL/boost/mpl/at_fwd.hpp +++ b/Utilities/BGL/boost/mpl/at_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/at_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: at_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/O1_size_impl.hpp b/Utilities/BGL/boost/mpl/aux_/O1_size_impl.hpp index ac4e8c3c5e1ff0b047e819c4b6206ee9dc13073a..df408f089926776765a73c90430a92817d0fb7b8 100644 --- a/Utilities/BGL/boost/mpl/aux_/O1_size_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/O1_size_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/O1_size_impl.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: O1_size_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> #include <boost/mpl/long.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/adl_barrier.hpp b/Utilities/BGL/boost/mpl/aux_/adl_barrier.hpp index 3783dd022dbd800a19d5f0e9c83acd4a13ab1d1c..7d9eaea58d6895ca18773500b3a7a0e7f9a043a5 100644 --- a/Utilities/BGL/boost/mpl/aux_/adl_barrier.hpp +++ b/Utilities/BGL/boost/mpl/aux_/adl_barrier.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/adl_barrier.hpp,v $ -// $Date: 2004/09/28 13:56:59 $ -// $Revision: 1.4 $ +// $Id: adl_barrier.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/adl.hpp> #include <boost/mpl/aux_/config/gcc.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/advance_backward.hpp b/Utilities/BGL/boost/mpl/aux_/advance_backward.hpp index 51bcf035b258d061f0f06a34a2a8403a7f01cf1e..169202a3fb02f2add4edd164a353f312ed118264 100644 --- a/Utilities/BGL/boost/mpl/aux_/advance_backward.hpp +++ b/Utilities/BGL/boost/mpl/aux_/advance_backward.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/advance_backward.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.9 $ +// $Id: advance_backward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/prior.hpp> @@ -79,7 +79,10 @@ struct advance_backward ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 #define i_ BOOST_PP_FRAME_ITERATION(1) template<> @@ -121,4 +124,5 @@ struct advance_backward< BOOST_PP_FRAME_ITERATION(1) > # undef AUX778076_ITER_1 # undef AUX778076_ITER_0 +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/aux_/advance_forward.hpp b/Utilities/BGL/boost/mpl/aux_/advance_forward.hpp index 8cfa8ee579de20d289c5ec1e781614dddf451c68..058f765d2fcf25a427350f5a4b9357eefc63ba34 100644 --- a/Utilities/BGL/boost/mpl/aux_/advance_forward.hpp +++ b/Utilities/BGL/boost/mpl/aux_/advance_forward.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/advance_forward.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.9 $ +// $Id: advance_forward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/next.hpp> @@ -79,7 +79,10 @@ struct advance_forward ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 #define i_ BOOST_PP_FRAME_ITERATION(1) template<> @@ -120,4 +123,5 @@ struct advance_forward< BOOST_PP_FRAME_ITERATION(1) > # undef AUX778076_ITER_1 # undef AUX778076_ITER_0 +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/aux_/apply_1st.hpp b/Utilities/BGL/boost/mpl/aux_/apply_1st.hpp index 22a558704737c2c6554ef4f63a51e7402a70cd6f..dd8373a9460a52b186a9f760d8ba97bc31d4138b 100644 --- a/Utilities/BGL/boost/mpl/aux_/apply_1st.hpp +++ b/Utilities/BGL/boost/mpl/aux_/apply_1st.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/apply_1st.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: apply_1st.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/apply.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/arg_typedef.hpp b/Utilities/BGL/boost/mpl/aux_/arg_typedef.hpp index 04b049173c2d27a4e658f3a0175bdf551c7a6a8f..e4737b9ac97cf48d6bba62ae0bf5c8b8ea8b3328 100644 --- a/Utilities/BGL/boost/mpl/aux_/arg_typedef.hpp +++ b/Utilities/BGL/boost/mpl/aux_/arg_typedef.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/arg_typedef.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.3 $ +// $Id: arg_typedef.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/lambda.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/arithmetic_op.hpp b/Utilities/BGL/boost/mpl/aux_/arithmetic_op.hpp index a1c287a0696d31f5652663cf7a44f0e03053c010..9546e8eb8dc847da471a2d8109b75bba959d927a 100644 --- a/Utilities/BGL/boost/mpl/aux_/arithmetic_op.hpp +++ b/Utilities/BGL/boost/mpl/aux_/arithmetic_op.hpp @@ -9,9 +9,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/arithmetic_op.hpp,v $ -// $Date: 2004/09/07 08:51:32 $ -// $Revision: 1.4 $ +// $Id: arithmetic_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/integral_c.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/arity.hpp b/Utilities/BGL/boost/mpl/aux_/arity.hpp index fde07b2d5d107a505afa3ac847f7f1e1654dd2c7..f639a1034feee2feed662cd9fa609fdf9104e05f 100644 --- a/Utilities/BGL/boost/mpl/aux_/arity.hpp +++ b/Utilities/BGL/boost/mpl/aux_/arity.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/arity.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.6 $ +// $Id: arity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/dtp.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/arity_spec.hpp b/Utilities/BGL/boost/mpl/aux_/arity_spec.hpp index 3b4fe8c1529d2a6ab3755daf587aa84d44483578..ea164a62e599f362c69579224736ec75c7040f7a 100644 --- a/Utilities/BGL/boost/mpl/aux_/arity_spec.hpp +++ b/Utilities/BGL/boost/mpl/aux_/arity_spec.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/arity_spec.hpp,v $ -// $Date: 2004/11/28 02:04:02 $ -// $Revision: 1.7 $ +// $Id: arity_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/int.hpp> #include <boost/mpl/limits/arity.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/at_impl.hpp b/Utilities/BGL/boost/mpl/aux_/at_impl.hpp index a4a1f8f8bb6297dd1034c7fbb1a7d5df68746845..120738f6ca9f1a05c7619d876692a8d40163d516 100644 --- a/Utilities/BGL/boost/mpl/aux_/at_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/at_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/at_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.5 $ +// $Id: at_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/advance.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/back_impl.hpp b/Utilities/BGL/boost/mpl/aux_/back_impl.hpp index b77b231b0c9a240247fa4232ea30480b5049a27e..d151625b714dc8a202e368258cf97c25a3038163 100644 --- a/Utilities/BGL/boost/mpl/aux_/back_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/back_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/back_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.6 $ +// $Id: back_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/basic_bind.hpp b/Utilities/BGL/boost/mpl/aux_/basic_bind.hpp index 82125ab9e4648e828f1c2d3e42205b0e08bd89d1..e825f09b32b90ab8a2af0f9a33b9e71636bcd608 100644 --- a/Utilities/BGL/boost/mpl/aux_/basic_bind.hpp +++ b/Utilities/BGL/boost/mpl/aux_/basic_bind.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/basic_bind.hpp,v $ -// $Date: 2004/09/05 09:42:55 $ -// $Revision: 1.1 $ +// $Id: basic_bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT #include <boost/mpl/bind.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/begin_end_impl.hpp b/Utilities/BGL/boost/mpl/aux_/begin_end_impl.hpp index 3a4437d9321ad9ec027c5aeff53fbb276f075b5d..d3b9682ac16680b857809e92e144b39b8af3b5d0 100644 --- a/Utilities/BGL/boost/mpl/aux_/begin_end_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/begin_end_impl.hpp @@ -10,19 +10,37 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/begin_end_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.8 $ +// $Id: begin_end_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> #include <boost/mpl/sequence_tag_fwd.hpp> #include <boost/mpl/void.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/aux_/has_begin.hpp> #include <boost/mpl/aux_/na.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> #include <boost/mpl/aux_/config/eti.hpp> namespace boost { namespace mpl { + +namespace aux { + +template< typename Sequence > +struct begin_type +{ + typedef typename Sequence::begin type; +}; +template< typename Sequence > +struct end_type +{ + typedef typename Sequence::end type; +}; + +} + // default implementation; conrete sequences might override it by // specializing either the 'begin_impl/end_impl' or the primary // 'begin/end' templates @@ -32,7 +50,8 @@ struct begin_impl { template< typename Sequence > struct apply { - typedef typename Sequence::begin type; + typedef typename eval_if<aux::has_begin<Sequence, true_>, + aux::begin_type<Sequence>, void_>::type type; }; }; @@ -41,7 +60,8 @@ struct end_impl { template< typename Sequence > struct apply { - typedef typename Sequence::end type; + typedef typename eval_if<aux::has_begin<Sequence, true_>, + aux::end_type<Sequence>, void_>::type type; }; }; @@ -73,8 +93,8 @@ AUX778076_IMPL_SPEC(end, na, void_) # undef AUX778076_IMPL_SPEC -BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1,begin_impl) -BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1,end_impl) +BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(1,begin_impl) +BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(1,end_impl) }} diff --git a/Utilities/BGL/boost/mpl/aux_/clear_impl.hpp b/Utilities/BGL/boost/mpl/aux_/clear_impl.hpp index 5bcc4cb9a7d200ac9a8cc5d3b497076bc6b044c0..84da54b122e93bc960fb368a76bd92070b4c4b43 100644 --- a/Utilities/BGL/boost/mpl/aux_/clear_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/clear_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/clear_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.6 $ +// $Id: clear_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/common_name_wknd.hpp b/Utilities/BGL/boost/mpl/aux_/common_name_wknd.hpp index d7a254d60764c8252655d4e21dc56febc303be05..9d0b4b40017f28d3ebdda38a46a195a4609fd1c3 100644 --- a/Utilities/BGL/boost/mpl/aux_/common_name_wknd.hpp +++ b/Utilities/BGL/boost/mpl/aux_/common_name_wknd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/common_name_wknd.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: common_name_wknd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/comparison_op.hpp b/Utilities/BGL/boost/mpl/aux_/comparison_op.hpp index 2ca3b859011e748173840857fb6e9673cff362a4..7d0fa201acf3430f79272b43f192dd832712bd96 100644 --- a/Utilities/BGL/boost/mpl/aux_/comparison_op.hpp +++ b/Utilities/BGL/boost/mpl/aux_/comparison_op.hpp @@ -9,9 +9,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/comparison_op.hpp,v $ -// $Date: 2004/09/07 08:51:32 $ -// $Revision: 1.4 $ +// $Id: comparison_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/bool.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/adl.hpp b/Utilities/BGL/boost/mpl/aux_/config/adl.hpp index 3fdf43ac18c0bc03f01040784a8bd3fa9aafabe1..130ee9f49dd4154ffcb0c7bba32a4b71f1311dfb 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/adl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/adl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/adl.hpp,v $ -// $Date: 2004/09/16 14:08:47 $ -// $Revision: 1.1 $ +// $Id: adl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/intel.hpp> @@ -27,7 +27,7 @@ #if !defined(BOOST_MPL_CFG_NO_ADL_BARRIER_NAMESPACE) \ && ( BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ || BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, BOOST_TESTED_AT(810)) \ diff --git a/Utilities/BGL/boost/mpl/aux_/config/arrays.hpp b/Utilities/BGL/boost/mpl/aux_/config/arrays.hpp index d8a07ca6c2a59d6e570b28a28b590560e875da40..56ee0a3be8022394aed05d8aa330988e7085e832 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/arrays.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/arrays.hpp @@ -10,16 +10,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/arrays.hpp,v $ -// $Date: 2004/09/03 15:56:55 $ -// $Revision: 1.3 $ +// $Id: arrays.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> #if !defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ - && ( BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + && ( BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ ) diff --git a/Utilities/BGL/boost/mpl/aux_/config/bcc.hpp b/Utilities/BGL/boost/mpl/aux_/config/bcc.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4817ca628bc5600a3b7737871d9ba22b390fa80 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/config/bcc.hpp @@ -0,0 +1,28 @@ + +#ifndef BOOST_MPL_AUX_CONFIG_BCC_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_BCC_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: bcc.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ +// $Date: 2004-09-02 10:41:37 -0500 (Thu, 02 Sep 2004) $ +// $Revision: 24874 $ + +#include <boost/mpl/aux_/config/workaround.hpp> + +#if !defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && BOOST_WORKAROUND(__BORLANDC__, >= 0x590) \ + && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) + +# define BOOST_MPL_CFG_BCC590_WORKAROUNDS + +#endif + +#endif // BOOST_MPL_AUX_CONFIG_BCC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/aux_/config/bind.hpp b/Utilities/BGL/boost/mpl/aux_/config/bind.hpp index 0739f7ce894c7f67cf065d4c73437cfc0efc2131..d0450e6f3f5adee13f57e191e380e7ac8d16d8c3 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/bind.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/bind.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/bind.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.6 $ +// $Id: bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> @@ -21,7 +21,7 @@ #if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ && ( BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - || BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ ) # define BOOST_MPL_CFG_NO_BIND_TEMPLATE diff --git a/Utilities/BGL/boost/mpl/aux_/config/compiler.hpp b/Utilities/BGL/boost/mpl/aux_/config/compiler.hpp index cc184e3de17c4d56c4b4b312b69fc81c9cd17278..3238963c0c78da357607c629e4d36486c3f36ed5 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/compiler.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/compiler.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_AUX_CONFIG_COMPILER_HPP_INCLUDED #define BOOST_MPL_AUX_CONFIG_COMPILER_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2001-2004 +// Copyright Aleksey Gurtovoy 2001-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/compiler.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.9 $ +// $Id: compiler.hpp 53189 2009-05-22 20:07:55Z hkaiser $ +// $Date: 2009-05-22 16:07:55 -0400 (Fri, 22 May 2009) $ +// $Revision: 53189 $ #if !defined(BOOST_MPL_CFG_COMPILER_DIR) @@ -32,11 +32,13 @@ # elif BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0304)) # define BOOST_MPL_CFG_COMPILER_DIR gcc -# elif BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) # define BOOST_MPL_CFG_COMPILER_DIR bcc551 -# else +# elif BOOST_WORKAROUND(__BORLANDC__, >= 0x590) # define BOOST_MPL_CFG_COMPILER_DIR bcc +# else +# define BOOST_MPL_CFG_COMPILER_DIR bcc_pre590 # endif # elif BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) diff --git a/Utilities/BGL/boost/mpl/aux_/config/ctps.hpp b/Utilities/BGL/boost/mpl/aux_/config/ctps.hpp index 7c5aa7e5e6400ddc4b4948efccd745ebc4425751..b908cee9ff01a12f52725311e10cc4c519ec7108 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/ctps.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/ctps.hpp @@ -10,16 +10,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/ctps.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.5 $ +// $Id: ctps.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> #include <boost/config.hpp> #if !defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ - && BOOST_WORKAROUND(__BORLANDC__, < 0x600) + && BOOST_WORKAROUND(__BORLANDC__, < 0x582) # define BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC diff --git a/Utilities/BGL/boost/mpl/aux_/config/dependent_nttp.hpp b/Utilities/BGL/boost/mpl/aux_/config/dependent_nttp.hpp index 3bdbb932b41158209c18537bdba03735796cdbbf..5a3f2b8978a6c56ec44ee1150c132418380dbc55 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/dependent_nttp.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/dependent_nttp.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/dependent_nttp.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.7 $ +// $Id: dependent_nttp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/gcc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp b/Utilities/BGL/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp index d5960f823e20de9e7db05fe6238ebb780daae8bf..682770ee4526ff87b1aeb32f1cec4d5cd5617558 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.2 $ +// $Id: dmc_ambiguous_ctps.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/dtp.hpp b/Utilities/BGL/boost/mpl/aux_/config/dtp.hpp index afd084a412bab0d60d5838b221e23cde97b506e0..8f03a83001bfabd69b45d6edab755550d5e2d5f9 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/dtp.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/dtp.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/dtp.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.9 $ +// $Id: dtp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> @@ -25,7 +25,7 @@ #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ && BOOST_WORKAROUND(__BORLANDC__, >= 0x560) \ - && BOOST_WORKAROUND(__BORLANDC__, < 0x600) + && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # define BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES @@ -35,7 +35,7 @@ #if !defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ && ( BOOST_WORKAROUND(__MWERKS__, <= 0x3001) \ - || BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ || defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) \ ) diff --git a/Utilities/BGL/boost/mpl/aux_/config/eti.hpp b/Utilities/BGL/boost/mpl/aux_/config/eti.hpp index 6dbd274a71f1cf7257f8de03d624ee88f455723f..7328b6d1ff6d98883a34eab9a8f5467b1faae4e1 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/eti.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/eti.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/eti.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.6 $ +// $Id: eti.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/forwarding.hpp b/Utilities/BGL/boost/mpl/aux_/config/forwarding.hpp index 9f1f5149052ef4ced7c18ac8b0c30b51c39eb399..2390bd743132ba187d5e1590820a3a1cce195315 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/forwarding.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/forwarding.hpp @@ -10,15 +10,15 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/forwarding.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.2 $ +// $Id: forwarding.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ - && BOOST_WORKAROUND(__BORLANDC__, < 0x600) + && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # define BOOST_MPL_CFG_NO_NESTED_FORWARDING diff --git a/Utilities/BGL/boost/mpl/aux_/config/gcc.hpp b/Utilities/BGL/boost/mpl/aux_/config/gcc.hpp index 2fb9212b5c0d53f070ab15b5517072acc1cc30e3..3380d613ce1a9ce984d533dce745e58f6c69502b 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/gcc.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/gcc.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/gcc.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.2 $ +// $Id: gcc.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if defined(__GNUC__) && !defined(__EDG_VERSION__) # define BOOST_MPL_CFG_GCC ((__GNUC__ << 8) | __GNUC_MINOR__) diff --git a/Utilities/BGL/boost/mpl/aux_/config/has_apply.hpp b/Utilities/BGL/boost/mpl/aux_/config/has_apply.hpp index a24867cba6fc34887a4ed45475f0dadb90b45379..fc9176ffe7d13d07a21c117013138d1fc9529117 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/has_apply.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/has_apply.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/has_apply.hpp,v $ -// $Date: 2004/09/13 06:10:10 $ -// $Revision: 1.2 $ +// $Id: has_apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/has_xxx.hpp> #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/has_xxx.hpp b/Utilities/BGL/boost/mpl/aux_/config/has_xxx.hpp index 7dc14ea5d7a03dbe1932b970ae32ec1a767bdcbb..8f2a46d295c62cfffd5a049c877cd5dbd68526af 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/has_xxx.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/has_xxx.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/has_xxx.hpp,v $ -// $Date: 2004/09/03 15:56:56 $ -// $Revision: 1.3 $ +// $Id: has_xxx.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/overload_resolution.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/integral.hpp b/Utilities/BGL/boost/mpl/aux_/config/integral.hpp index 49ea071a4e8a104ad21b4a0d3b552ddfb17a00b8..4dec725b617be9db62780dced1404f62d5e12a4f 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/integral.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/integral.hpp @@ -10,16 +10,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/integral.hpp,v $ -// $Date: 2004/09/07 08:51:32 $ -// $Revision: 1.1 $ +// $Id: integral.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> #if !defined(BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ - && BOOST_WORKAROUND(__BORLANDC__, < 0x600) + && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # define BOOST_MPL_CFG_BCC_INTEGRAL_CONSTANTS diff --git a/Utilities/BGL/boost/mpl/aux_/config/intel.hpp b/Utilities/BGL/boost/mpl/aux_/config/intel.hpp index 7787efd053b81b3269b29d0919a3b48eb1ab2f4b..8f1de7613b8b83728eccb2cc984d95a44790de0d 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/intel.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/intel.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/intel.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.1 $ +// $Id: intel.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // BOOST_INTEL_CXX_VERSION is defined here: diff --git a/Utilities/BGL/boost/mpl/aux_/config/lambda.hpp b/Utilities/BGL/boost/mpl/aux_/config/lambda.hpp index ace8cbf2ffce8f9aa9e1749269d07502d5822c75..a46b46a7f4b57dcf43f0fdf9d67a372e2b442bde 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/lambda.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/lambda.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/lambda.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.3 $ +// $Id: lambda.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/ttp.hpp> #include <boost/mpl/aux_/config/ctps.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/msvc.hpp b/Utilities/BGL/boost/mpl/aux_/config/msvc.hpp index 43e1ab82ada617f0ea95f7ab963a73ae41638f08..18bed834645a8969757c358678791c3b293c1d49 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/msvc.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/msvc.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/msvc.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.3 $ +// $Id: msvc.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // BOOST_MSVC is defined here: diff --git a/Utilities/BGL/boost/mpl/aux_/config/msvc_typename.hpp b/Utilities/BGL/boost/mpl/aux_/config/msvc_typename.hpp index 5707148722ce29a8f910916583caa81d85135569..042c8040f8c7e3f40c06d719640b37eedee327fe 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/msvc_typename.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/msvc_typename.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/msvc_typename.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.4 $ +// $Id: msvc_typename.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/nttp.hpp b/Utilities/BGL/boost/mpl/aux_/config/nttp.hpp index 6c79c9ecabdc82cea3807f36f652e0fb3a3ddbd0..4873e20d9e63b23a02599840f4c844fc975b1a31 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/nttp.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/nttp.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/nttp.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.4 $ +// $Id: nttp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/operators.hpp b/Utilities/BGL/boost/mpl/aux_/config/operators.hpp index 7383dd401887e62aa876a2eafd0f30013babe823..2a38a3d5cc841787d7bd4e6e7ccf4fb850b34e33 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/operators.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/operators.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/operators.hpp,v $ -// $Date: 2005/06/14 12:42:08 $ -// $Revision: 1.4 $ +// $Id: operators.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/gcc.hpp> #include <boost/mpl/aux_/config/msvc.hpp> @@ -20,7 +20,7 @@ #if !defined(BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING) \ && ( BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - || BOOST_WORKAROUND(__BORLANDC__, <= 0x600) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ || BOOST_WORKAROUND(__EDG_VERSION__, <= 245) \ || BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, <= 0x0295) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ diff --git a/Utilities/BGL/boost/mpl/aux_/config/overload_resolution.hpp b/Utilities/BGL/boost/mpl/aux_/config/overload_resolution.hpp index b46603a93f331738224b0566b52672b022844e72..88c3d53f2d3c7f46e7b4cbc1aea6049694743fcb 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/overload_resolution.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/overload_resolution.hpp @@ -10,15 +10,15 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/overload_resolution.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.9 $ +// $Id: overload_resolution.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> #if !defined(BOOST_MPL_CFG_BROKEN_OVERLOAD_RESOLUTION) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ - && ( BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + && ( BOOST_WORKAROUND(__BORLANDC__, < 0x590) \ || BOOST_WORKAROUND(__MWERKS__, < 0x3001) \ ) diff --git a/Utilities/BGL/boost/mpl/aux_/config/pp_counter.hpp b/Utilities/BGL/boost/mpl/aux_/config/pp_counter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a4d07157b3e479ee64b2e3a88736202c65897854 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/config/pp_counter.hpp @@ -0,0 +1,26 @@ + +#ifndef BOOST_MPL_AUX_CONFIG_PP_COUNTER_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_PP_COUNTER_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2006 +// +// 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: pp_counter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ + +#if !defined(BOOST_MPL_AUX_PP_COUNTER) +# include <boost/mpl/aux_/config/msvc.hpp> +# if BOOST_WORKAROUND(BOOST_MSVC, >= 1300) +# define BOOST_MPL_AUX_PP_COUNTER() __COUNTER__ +# else +# define BOOST_MPL_AUX_PP_COUNTER() __LINE__ +# endif +#endif + +#endif // BOOST_MPL_AUX_CONFIG_PP_COUNTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/aux_/config/preprocessor.hpp b/Utilities/BGL/boost/mpl/aux_/config/preprocessor.hpp index dd1ef2b7e02023627f651315c13678ce6900d329..52229cd8630d723599793eebe0ec55aa4288d3c2 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/preprocessor.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/preprocessor.hpp @@ -10,15 +10,15 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/preprocessor.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.6 $ +// $Id: preprocessor.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> #if !defined(BOOST_MPL_CFG_BROKEN_PP_MACRO_EXPANSION) \ && ( BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__BORLANDC__, < 0x582) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ ) diff --git a/Utilities/BGL/boost/mpl/aux_/config/static_constant.hpp b/Utilities/BGL/boost/mpl/aux_/config/static_constant.hpp index 42c142f8ca1459f8def71a70f2a00acab95fd3cf..855d22f3ab79b22efb436d118dded418220c0641 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/static_constant.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/static_constant.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/static_constant.hpp,v $ -// $Date: 2004/09/07 08:51:32 $ -// $Revision: 1.4 $ +// $Id: static_constant.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) // BOOST_STATIC_CONSTANT is defined here: diff --git a/Utilities/BGL/boost/mpl/aux_/config/ttp.hpp b/Utilities/BGL/boost/mpl/aux_/config/ttp.hpp index d283bfdbde1af18da1f3bfb265af7b3cfbdc2b35..a5a0c2cbdf69d44183eba06d85abce62764aaea4 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/ttp.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/ttp.hpp @@ -10,16 +10,18 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/ttp.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.7 $ +// $Id: ttp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/gcc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> #if !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) \ - && defined(BOOST_NO_TEMPLATE_TEMPLATES) + && ( defined(BOOST_NO_TEMPLATE_TEMPLATES) \ + || BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x590) ) \ + ) # define BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS @@ -29,7 +31,7 @@ #if !defined(BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) \ && ( BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0302)) \ - || BOOST_WORKAROUND(__BORLANDC__, < 0x600) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ ) # define BOOST_MPL_CFG_EXTENDED_TEMPLATE_PARAMETERS_MATCHING diff --git a/Utilities/BGL/boost/mpl/aux_/config/typeof.hpp b/Utilities/BGL/boost/mpl/aux_/config/typeof.hpp index 14a513ee8e760d93c8efeaf09bbb6db6a9d81fb9..aeff9c10933eb6ee425e9bade55c2514ef9bb876 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/typeof.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/typeof.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/typeof.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.2 $ +// $Id: typeof.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/gcc.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/config/use_preprocessed.hpp b/Utilities/BGL/boost/mpl/aux_/config/use_preprocessed.hpp index 6548ac68170e347dbb0b6444da47d7e1f13c4466..3bbc2296d8969efbd14e6ba9cd9c8003a9c824d7 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/use_preprocessed.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/use_preprocessed.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/use_preprocessed.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.7 $ +// $Id: use_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS diff --git a/Utilities/BGL/boost/mpl/aux_/config/workaround.hpp b/Utilities/BGL/boost/mpl/aux_/config/workaround.hpp index 89ed715d313d6768a76af4a8d6b67da8adbca257..337bcf7c6bc3be3fe951c1d92ca85bfda0768878 100644 --- a/Utilities/BGL/boost/mpl/aux_/config/workaround.hpp +++ b/Utilities/BGL/boost/mpl/aux_/config/workaround.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/config/workaround.hpp,v $ -// $Date: 2004/09/02 15:40:45 $ -// $Revision: 1.3 $ +// $Id: workaround.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/detail/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/contains_impl.hpp b/Utilities/BGL/boost/mpl/aux_/contains_impl.hpp index 73e1b27349841be11f85f4ee9aa54b4627ccd041..2ee405694bc4afdf856ee02e13773f72320cb793 100644 --- a/Utilities/BGL/boost/mpl/aux_/contains_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/contains_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/contains_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.2 $ +// $Id: contains_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/contains_fwd.hpp> #include <boost/mpl/begin_end.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/count_args.hpp b/Utilities/BGL/boost/mpl/aux_/count_args.hpp index 14e7d0ec795592045d984d3a8871de0c00fd026d..85107ddbd2f8aeeae8b56f30c48b49d64bc24d91 100644 --- a/Utilities/BGL/boost/mpl/aux_/count_args.hpp +++ b/Utilities/BGL/boost/mpl/aux_/count_args.hpp @@ -9,9 +9,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/count_args.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.5 $ +// $Id: count_args.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/expr_if.hpp> #include <boost/preprocessor/inc.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/count_impl.hpp b/Utilities/BGL/boost/mpl/aux_/count_impl.hpp index f1f10bc350a82bf493e6435fa91fd46fc3fb5f74..22e2cf5fb50846ad205b0be177cc8c1dc9d07826 100644 --- a/Utilities/BGL/boost/mpl/aux_/count_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/count_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/count_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.2 $ +// $Id: count_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/count_fwd.hpp> #include <boost/mpl/count_if.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/empty_impl.hpp b/Utilities/BGL/boost/mpl/aux_/empty_impl.hpp index a49423cbe0e17d0d35b476129b0bc61dd461ea9b..9a553a77fe7a275761bc68e3a6f2eb0226dffc66 100644 --- a/Utilities/BGL/boost/mpl/aux_/empty_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/empty_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/empty_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: empty_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> #include <boost/mpl/begin_end.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/erase_impl.hpp b/Utilities/BGL/boost/mpl/aux_/erase_impl.hpp index 16523449113e6cd6efd27b10c05a3c8ee03e3fe5..dc8a22f1de09f7294cfadb2a72ac58e59b4d3f11 100644 --- a/Utilities/BGL/boost/mpl/aux_/erase_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/erase_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/erase_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: erase_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/clear.hpp> #include <boost/mpl/push_front.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/erase_key_impl.hpp b/Utilities/BGL/boost/mpl/aux_/erase_key_impl.hpp index 58218a63048f58422d39ffed2e20cda5913d650f..ffc6c1f33ee9aed757193117870c3d4cf776a19e 100644 --- a/Utilities/BGL/boost/mpl/aux_/erase_key_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/erase_key_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/erase_key_impl.hpp,v $ -// $Date: 2004/09/05 09:42:55 $ -// $Revision: 1.3 $ +// $Id: erase_key_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/erase_key_fwd.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/filter_iter.hpp b/Utilities/BGL/boost/mpl/aux_/filter_iter.hpp index 3bf806dff30e714fc397e90da8ee1a961f945d75..ab9c9baf38a9e70567d8864e6ee99424ad6a5c70 100644 --- a/Utilities/BGL/boost/mpl/aux_/filter_iter.hpp +++ b/Utilities/BGL/boost/mpl/aux_/filter_iter.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/filter_iter.hpp,v $ -// $Date: 2004/09/07 12:07:56 $ -// $Revision: 1.4 $ +// $Id: filter_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/find_if.hpp> #include <boost/mpl/iterator_range.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/fold_impl.hpp index 0b56671479228c7222df5f5312b8aaf4d72d8242..89e42f8b5508c5ef5ea016465b9c813f3ddd966e 100644 --- a/Utilities/BGL/boost/mpl/aux_/fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/fold_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/fold_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.6 $ +// $Id: fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/fold_impl_body.hpp b/Utilities/BGL/boost/mpl/aux_/fold_impl_body.hpp index e0061890542437fba425d8e4327f0a0e56cfbefb..41f80b4b0d52ba4405a737cdc8968bcbc89e517b 100644 --- a/Utilities/BGL/boost/mpl/aux_/fold_impl_body.hpp +++ b/Utilities/BGL/boost/mpl/aux_/fold_impl_body.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/fold_impl_body.hpp,v $ -// $Date: 2004/10/24 08:18:03 $ -// $Revision: 1.8 $ +// $Id: fold_impl_body.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ # include <boost/mpl/limits/unrolling.hpp> # include <boost/mpl/aux_/preprocessor/repeat.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/fold_op.hpp b/Utilities/BGL/boost/mpl/aux_/fold_op.hpp index fbe20d7c9bbc2922f2f95b59dda2947d9c3e0cfa..bfd5b43b35c9eae7258c9685fa0b9fe5c0a02c1b 100644 --- a/Utilities/BGL/boost/mpl/aux_/fold_op.hpp +++ b/Utilities/BGL/boost/mpl/aux_/fold_op.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/fold_op.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: fold_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/apply.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/fold_pred.hpp b/Utilities/BGL/boost/mpl/aux_/fold_pred.hpp index e3a193feb18e5eb399bb6044a245bfd5aed96eb1..a172de811bbc91466eb77b17ad49a226e5ba2605 100644 --- a/Utilities/BGL/boost/mpl/aux_/fold_pred.hpp +++ b/Utilities/BGL/boost/mpl/aux_/fold_pred.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/fold_pred.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: fold_pred.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/same_as.hpp> #include <boost/mpl/apply.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/front_impl.hpp b/Utilities/BGL/boost/mpl/aux_/front_impl.hpp index 07288d865a33670a24e79c869d68f6eff43d62e0..9bfa643f0f1d47f83da807659d5f2cd6125b3fd7 100644 --- a/Utilities/BGL/boost/mpl/aux_/front_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/front_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/front_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: front_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> #include <boost/mpl/begin_end.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/full_lambda.hpp b/Utilities/BGL/boost/mpl/aux_/full_lambda.hpp index 88ba9e56f3da77e4009743abb736d4ebecb51bb6..dfaaedbe6e240e9c034435ce82e2e4aad8c29b2a 100644 --- a/Utilities/BGL/boost/mpl/aux_/full_lambda.hpp +++ b/Utilities/BGL/boost/mpl/aux_/full_lambda.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/full_lambda.hpp,v $ -// $Date: 2004/09/04 01:10:19 $ -// $Revision: 1.14 $ +// $Id: full_lambda.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/lambda_fwd.hpp> @@ -227,7 +227,10 @@ BOOST_MPL_AUX_NA_SPEC2(2, 3, lambda) ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 #define i_ BOOST_PP_FRAME_ITERATION(1) #if i_ > 0 @@ -347,4 +350,5 @@ struct lambda< }; #undef i_ +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/aux_/has_apply.hpp b/Utilities/BGL/boost/mpl/aux_/has_apply.hpp index 8d0d0051bec23978faf4677f7ea37c919be6d4b7..b77b56170f4a00a8d1e6d623ce491a109d29d171 100644 --- a/Utilities/BGL/boost/mpl/aux_/has_apply.hpp +++ b/Utilities/BGL/boost/mpl/aux_/has_apply.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/has_apply.hpp,v $ -// $Date: 2004/09/03 15:56:55 $ -// $Revision: 1.1 $ +// $Id: has_apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> #include <boost/mpl/aux_/config/has_apply.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/has_begin.hpp b/Utilities/BGL/boost/mpl/aux_/has_begin.hpp index 1211903b5196d6fc11c2f0397b27924c6e16d08e..e7403d2412b298134e42b75f829afabfcbc1a729 100644 --- a/Utilities/BGL/boost/mpl/aux_/has_begin.hpp +++ b/Utilities/BGL/boost/mpl/aux_/has_begin.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/has_begin.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.3 $ +// $Id: has_begin.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/has_key_impl.hpp b/Utilities/BGL/boost/mpl/aux_/has_key_impl.hpp index 0b3e8f28f83c59b9f812d3aa00465d44cd832989..3a12a22d9fd9be7f104640cc915417454fbfe535 100644 --- a/Utilities/BGL/boost/mpl/aux_/has_key_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/has_key_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/has_key_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.3 $ +// $Id: has_key_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_key_fwd.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/has_rebind.hpp b/Utilities/BGL/boost/mpl/aux_/has_rebind.hpp index 5f9b83262ed9555c3567a2fb61e33846b60e6a4c..32cdb83570cb76793eeecb4b057beba3939eb777 100644 --- a/Utilities/BGL/boost/mpl/aux_/has_rebind.hpp +++ b/Utilities/BGL/boost/mpl/aux_/has_rebind.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/has_rebind.hpp,v $ -// $Date: 2004/11/28 01:33:58 $ -// $Revision: 1.13 $ +// $Id: has_rebind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/intel.hpp> @@ -20,12 +20,12 @@ #if BOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(BOOST_INTEL_CXX_VERSION) # include <boost/mpl/has_xxx.hpp> -#elif BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#elif BOOST_WORKAROUND(BOOST_MSVC, < 1300) # include <boost/mpl/has_xxx.hpp> # include <boost/mpl/if.hpp> # include <boost/mpl/bool.hpp> # include <boost/mpl/aux_/msvc_is_class.hpp> -#elif BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # include <boost/mpl/if.hpp> # include <boost/mpl/bool.hpp> # include <boost/mpl/aux_/yes_no.hpp> @@ -43,7 +43,7 @@ namespace boost { namespace mpl { namespace aux { BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_rebind, rebind, false) -#elif BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#elif BOOST_WORKAROUND(BOOST_MSVC, < 1300) BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_rebind_impl, rebind, false) @@ -62,7 +62,7 @@ struct has_rebind template< typename T > struct has_rebind_tag {}; no_tag operator|(has_rebind_tag<int>, void const volatile*); -# if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) template< typename T > struct has_rebind { diff --git a/Utilities/BGL/boost/mpl/aux_/has_size.hpp b/Utilities/BGL/boost/mpl/aux_/has_size.hpp index 9a8806a3762ea0f2bf551c8d42b6f3aedd988667..3f72c44db6ffc04c5593e5ed93a50555647d2698 100644 --- a/Utilities/BGL/boost/mpl/aux_/has_size.hpp +++ b/Utilities/BGL/boost/mpl/aux_/has_size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/has_size.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.6 $ +// $Id: has_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/has_tag.hpp b/Utilities/BGL/boost/mpl/aux_/has_tag.hpp index 9e25244ef3d24dfdbbfb1d2c7276b89d1f521f4e..c016ec520059b745e3f69f78c87504887acbd252 100644 --- a/Utilities/BGL/boost/mpl/aux_/has_tag.hpp +++ b/Utilities/BGL/boost/mpl/aux_/has_tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/has_tag.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.3 $ +// $Id: has_tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/has_type.hpp b/Utilities/BGL/boost/mpl/aux_/has_type.hpp index b89311a4ff9a0365e6ce05c78ee5e16756d349f2..1d301a2f5da32afc6c8c3c5a17d09e35dfeeca20 100644 --- a/Utilities/BGL/boost/mpl/aux_/has_type.hpp +++ b/Utilities/BGL/boost/mpl/aux_/has_type.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/has_type.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: has_type.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/include_preprocessed.hpp b/Utilities/BGL/boost/mpl/aux_/include_preprocessed.hpp index fd33f3965b88180c817bb07b1c5aea08faf3e785..b214eebc253e39966ca98c12f7b130cedf2eedc3 100644 --- a/Utilities/BGL/boost/mpl/aux_/include_preprocessed.hpp +++ b/Utilities/BGL/boost/mpl/aux_/include_preprocessed.hpp @@ -1,7 +1,7 @@ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -9,26 +9,34 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/include_preprocessed.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.5 $ +// $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/compiler.hpp> #include <boost/mpl/aux_/config/preprocessor.hpp> +#include <boost/mpl/aux_/config/workaround.hpp> #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/stringize.hpp> #if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING) -# define AUX_PREPROCESSED_HEADER \ +# define AUX778076_PREPROCESSED_HEADER \ BOOST_MPL_CFG_COMPILER_DIR/BOOST_MPL_PREPROCESSED_HEADER \ /**/ #else -# define AUX_PREPROCESSED_HEADER \ +# define AUX778076_PREPROCESSED_HEADER \ BOOST_PP_CAT(BOOST_MPL_CFG_COMPILER_DIR,/)##BOOST_MPL_PREPROCESSED_HEADER \ /**/ #endif -# include BOOST_PP_STRINGIZE(boost/mpl/aux_/preprocessed/AUX_PREPROCESSED_HEADER) -# undef AUX_PREPROCESSED_HEADER +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700)) +# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/aux_/preprocessed/AUX778076_PREPROCESSED_HEADER) +# include AUX778076_INCLUDE_STRING +# undef AUX778076_INCLUDE_STRING +#else +# include BOOST_PP_STRINGIZE(boost/mpl/aux_/preprocessed/AUX778076_PREPROCESSED_HEADER) +#endif + +# undef AUX778076_PREPROCESSED_HEADER #undef BOOST_MPL_PREPROCESSED_HEADER diff --git a/Utilities/BGL/boost/mpl/aux_/insert_impl.hpp b/Utilities/BGL/boost/mpl/aux_/insert_impl.hpp index edea0a299b53c9576e58ba9d4ad1ec11752ca090..1858a9aeebed9a95703b637327dc9211f4c70566 100644 --- a/Utilities/BGL/boost/mpl/aux_/insert_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/insert_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/insert_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: insert_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/reverse_fold.hpp> #include <boost/mpl/iterator_range.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/insert_range_impl.hpp b/Utilities/BGL/boost/mpl/aux_/insert_range_impl.hpp index 8cef7ce85b281866881344b2b83b51fbe68d8f60..c1a2f5434c45f306b531886d05fc035e6d46092d 100644 --- a/Utilities/BGL/boost/mpl/aux_/insert_range_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/insert_range_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/insert_range_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.5 $ +// $Id: insert_range_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/copy.hpp> #include <boost/mpl/clear.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/inserter_algorithm.hpp b/Utilities/BGL/boost/mpl/aux_/inserter_algorithm.hpp index e6215d08b09402636aeeb04a0c150e010d23dd61..a6f340c782b7f44a08062371328ac4fe346c4e13 100644 --- a/Utilities/BGL/boost/mpl/aux_/inserter_algorithm.hpp +++ b/Utilities/BGL/boost/mpl/aux_/inserter_algorithm.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/inserter_algorithm.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.2 $ +// $Id: inserter_algorithm.hpp 55648 2009-08-18 05:16:53Z agurtovoy $ +// $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $ +// $Revision: 55648 $ #include <boost/mpl/back_inserter.hpp> #include <boost/mpl/front_inserter.hpp> @@ -49,7 +49,7 @@ template< \ BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \ > \ struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \ - : if_< has_push_back<P1> \ + : if_< has_push_back< typename clear<P1>::type> \ , aux::name##_impl< \ BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ , back_inserter< typename clear<P1>::type > \ diff --git a/Utilities/BGL/boost/mpl/aux_/integral_wrapper.hpp b/Utilities/BGL/boost/mpl/aux_/integral_wrapper.hpp index 227a1ed9c100423252aefc1f903c728740849d63..963a738abb179c83e85a8acfa7282c02180e670d 100644 --- a/Utilities/BGL/boost/mpl/aux_/integral_wrapper.hpp +++ b/Utilities/BGL/boost/mpl/aux_/integral_wrapper.hpp @@ -1,5 +1,5 @@ -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -7,9 +7,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/integral_wrapper.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.10 $ +// $Id: integral_wrapper.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! @@ -65,7 +65,7 @@ struct AUX_WRAPPER_NAME typedef AUX_WRAPPER_INST(prior_value) prior; #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ - || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) + || (BOOST_WORKAROUND(__HP_aCC, <= 53800) && (BOOST_WORKAROUND(__hpxstd98, != 1))) typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; #else diff --git a/Utilities/BGL/boost/mpl/aux_/is_msvc_eti_arg.hpp b/Utilities/BGL/boost/mpl/aux_/is_msvc_eti_arg.hpp index 751aeaff9dc94cbf519a35036878da7ea6858f3c..322a22e0e1f61a7dc50ee63daddafac3cdf7ff84 100644 --- a/Utilities/BGL/boost/mpl/aux_/is_msvc_eti_arg.hpp +++ b/Utilities/BGL/boost/mpl/aux_/is_msvc_eti_arg.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/is_msvc_eti_arg.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: is_msvc_eti_arg.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/yes_no.hpp> #include <boost/mpl/aux_/config/eti.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/iter_apply.hpp b/Utilities/BGL/boost/mpl/aux_/iter_apply.hpp index 04bca019e2375212dad040d630463875f763c173..fc21f7355f2dda021851e93ac9d2cfa4592e6477 100644 --- a/Utilities/BGL/boost/mpl/aux_/iter_apply.hpp +++ b/Utilities/BGL/boost/mpl/aux_/iter_apply.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/iter_apply.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: iter_apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/apply.hpp> #include <boost/mpl/deref.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/iter_fold_if_impl.hpp b/Utilities/BGL/boost/mpl/aux_/iter_fold_if_impl.hpp index bc4f826d11ebb18a767f16b14fee352b33943ffd..e7c47eac1e9b26f2663c22a524b0ea76e3a64a22 100644 --- a/Utilities/BGL/boost/mpl/aux_/iter_fold_if_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/iter_fold_if_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/iter_fold_if_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.8 $ +// $Id: iter_fold_if_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/identity.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/iter_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/iter_fold_impl.hpp index 4d444db28b5d2c9915be41993578c86c513dcf8b..0ea86c3c0eae0d844d01afacd1356e23b8ab4217 100644 --- a/Utilities/BGL/boost/mpl/aux_/iter_fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/iter_fold_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/iter_fold_impl.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.5 $ +// $Id: iter_fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/iter_push_front.hpp b/Utilities/BGL/boost/mpl/aux_/iter_push_front.hpp index fad997eaf147ca0a200cac4f8f277c2f336a68cf..2fa4f94ea8cb0de89cbc0916e07b715adad72486 100644 --- a/Utilities/BGL/boost/mpl/aux_/iter_push_front.hpp +++ b/Utilities/BGL/boost/mpl/aux_/iter_push_front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/iter_push_front.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: iter_push_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_front.hpp> #include <boost/mpl/deref.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/joint_iter.hpp b/Utilities/BGL/boost/mpl/aux_/joint_iter.hpp index d510b147c663e9572c27749c683d45ed094c4589..e2589dc19a91be0da851a9f1bec36b10bf0f23a9 100644 --- a/Utilities/BGL/boost/mpl/aux_/joint_iter.hpp +++ b/Utilities/BGL/boost/mpl/aux_/joint_iter.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/joint_iter.hpp,v $ -// $Date: 2004/10/01 16:29:34 $ -// $Revision: 1.6 $ +// $Id: joint_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/next_prior.hpp> #include <boost/mpl/deref.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/lambda_arity_param.hpp b/Utilities/BGL/boost/mpl/aux_/lambda_arity_param.hpp index 48ff9d602f0046df353b77c859b6a6b555ad7d86..720918eabbf8fa7a62bc9da575a57359666eac2e 100644 --- a/Utilities/BGL/boost/mpl/aux_/lambda_arity_param.hpp +++ b/Utilities/BGL/boost/mpl/aux_/lambda_arity_param.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/lambda_arity_param.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.5 $ +// $Id: lambda_arity_param.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/ttp.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/lambda_no_ctps.hpp b/Utilities/BGL/boost/mpl/aux_/lambda_no_ctps.hpp index 721ede40bb219281c70ecce269b10f0a5be0966e..cd55fc7bef9f56fe8fa2522de557cdad00874a33 100644 --- a/Utilities/BGL/boost/mpl/aux_/lambda_no_ctps.hpp +++ b/Utilities/BGL/boost/mpl/aux_/lambda_no_ctps.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/lambda_no_ctps.hpp,v $ -// $Date: 2004/09/07 12:24:48 $ -// $Revision: 1.14 $ +// $Id: lambda_no_ctps.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/lambda_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/lambda_spec.hpp b/Utilities/BGL/boost/mpl/aux_/lambda_spec.hpp index fe53da324d5f17ec453fce945280809ff5c3da27..f167479945f0e60865695c25db83941e6cfde207 100644 --- a/Utilities/BGL/boost/mpl/aux_/lambda_spec.hpp +++ b/Utilities/BGL/boost/mpl/aux_/lambda_spec.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED #define BOOST_MPL_AUX_LAMBDA_SPEC_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2001-2004 +// Copyright Aleksey Gurtovoy 2001-2007 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/lambda_spec.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.8 $ +// $Id: lambda_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/void.hpp> #include <boost/mpl/lambda_fwd.hpp> @@ -35,7 +35,8 @@ struct lambda< \ > \ { \ typedef false_ is_le; \ - typedef name< BOOST_MPL_PP_PARAMS(i, T) > type; \ + typedef name< BOOST_MPL_PP_PARAMS(i, T) > result_; \ + typedef result_ type; \ }; \ /**/ diff --git a/Utilities/BGL/boost/mpl/aux_/lambda_support.hpp b/Utilities/BGL/boost/mpl/aux_/lambda_support.hpp index 4b9b23590609773211108d7203158160148fdc0e..fa000d89993e78b3246a600a00bbd7cb077d2f89 100644 --- a/Utilities/BGL/boost/mpl/aux_/lambda_support.hpp +++ b/Utilities/BGL/boost/mpl/aux_/lambda_support.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/lambda_support.hpp,v $ -// $Date: 2004/11/28 01:37:05 $ -// $Revision: 1.12 $ +// $Id: lambda_support.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/lambda.hpp> @@ -110,7 +110,7 @@ template< typename T > struct has_rebind_tag; typedef BOOST_PP_CAT(name,_rebind) rebind; \ /**/ -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ template< BOOST_MPL_PP_PARAMS(i,typename T) > \ ::boost::mpl::aux::yes_tag operator|( \ @@ -122,7 +122,7 @@ template< BOOST_MPL_PP_PARAMS(i,typename T) > \ , name< BOOST_MPL_PP_ENUM(i,::boost::mpl::na) >* \ ); \ /**/ -#elif !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#elif !BOOST_WORKAROUND(BOOST_MSVC, < 1300) # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ template< BOOST_MPL_PP_PARAMS(i,typename T) > \ ::boost::mpl::aux::yes_tag operator|( \ diff --git a/Utilities/BGL/boost/mpl/aux_/largest_int.hpp b/Utilities/BGL/boost/mpl/aux_/largest_int.hpp index 0c2a9c64d37f7bcf1da5efaf9c29190df4b54e01..89e987a5a72d2438c937b551bf7b3f1d4925bd07 100644 --- a/Utilities/BGL/boost/mpl/aux_/largest_int.hpp +++ b/Utilities/BGL/boost/mpl/aux_/largest_int.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/largest_int.hpp,v $ -// $Date: 2004/09/19 03:08:53 $ -// $Revision: 1.5 $ +// $Id: largest_int.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/if.hpp> #include <boost/mpl/int.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/logical_op.hpp b/Utilities/BGL/boost/mpl/aux_/logical_op.hpp index 1341301c851e9297c9f724a9d176cb68b36ff1e6..e4689c9d9e8df1a1f419c1b88e301843bb293302 100644 --- a/Utilities/BGL/boost/mpl/aux_/logical_op.hpp +++ b/Utilities/BGL/boost/mpl/aux_/logical_op.hpp @@ -7,9 +7,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/logical_op.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.3 $ +// $Id: logical_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! diff --git a/Utilities/BGL/boost/mpl/aux_/msvc_dtw.hpp b/Utilities/BGL/boost/mpl/aux_/msvc_dtw.hpp index 38c2c24e4204b8a319faefa34deba82e735eebdd..222c47708ad26889884972a160800cce66ae2f67 100644 --- a/Utilities/BGL/boost/mpl/aux_/msvc_dtw.hpp +++ b/Utilities/BGL/boost/mpl/aux_/msvc_dtw.hpp @@ -7,9 +7,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/msvc_dtw.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.4 $ +// $Id: msvc_dtw.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! diff --git a/Utilities/BGL/boost/mpl/aux_/msvc_eti_base.hpp b/Utilities/BGL/boost/mpl/aux_/msvc_eti_base.hpp index ad45c7e45d153546737f3e44ccb97af90510169d..2c1ada5b37f73f9c81c6054120d082e55f7848e7 100644 --- a/Utilities/BGL/boost/mpl/aux_/msvc_eti_base.hpp +++ b/Utilities/BGL/boost/mpl/aux_/msvc_eti_base.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/msvc_eti_base.hpp,v $ -// $Date: 2004/11/28 01:37:05 $ -// $Revision: 1.7 $ +// $Id: msvc_eti_base.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/is_msvc_eti_arg.hpp> #include <boost/mpl/aux_/config/eti.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/msvc_is_class.hpp b/Utilities/BGL/boost/mpl/aux_/msvc_is_class.hpp index d9a0f8fcf22c00cada98f2d595e8c478ad8c7638..e0ccb388761396c7e045cfbe9035bfb8a2958b2d 100644 --- a/Utilities/BGL/boost/mpl/aux_/msvc_is_class.hpp +++ b/Utilities/BGL/boost/mpl/aux_/msvc_is_class.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/msvc_is_class.hpp,v $ -// $Date: 2004/09/28 13:56:59 $ -// $Revision: 1.4 $ +// $Id: msvc_is_class.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/if.hpp> #include <boost/mpl/bool.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/msvc_never_true.hpp b/Utilities/BGL/boost/mpl/aux_/msvc_never_true.hpp index 2418cdd51c9472a961754e1bbde48128870498a3..93da72e2a32c22295c1720d81c8118dfaf942edf 100644 --- a/Utilities/BGL/boost/mpl/aux_/msvc_never_true.hpp +++ b/Utilities/BGL/boost/mpl/aux_/msvc_never_true.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/msvc_never_true.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.5 $ +// $Id: msvc_never_true.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/msvc_type.hpp b/Utilities/BGL/boost/mpl/aux_/msvc_type.hpp index 126fbddf42b77afc0c4e000ce4cf3e7c44d0691d..ab662dbc2cab303c22284dd4ca08ac63edfe1ecf 100644 --- a/Utilities/BGL/boost/mpl/aux_/msvc_type.hpp +++ b/Utilities/BGL/boost/mpl/aux_/msvc_type.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/msvc_type.hpp,v $ -// $Date: 2004/09/02 15:40:43 $ -// $Revision: 1.1 $ +// $Id: msvc_type.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/eti.hpp> #include <boost/mpl/aux_/is_msvc_eti_arg.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/na.hpp b/Utilities/BGL/boost/mpl/aux_/na.hpp index 413a1cd0cca0a6b869f297d2087d36636aa857a6..314250c6436d6e96f24ec33517d0c2fbae07e626 100644 --- a/Utilities/BGL/boost/mpl/aux_/na.hpp +++ b/Utilities/BGL/boost/mpl/aux_/na.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na.hpp,v $ -// $Date: 2004/11/28 01:37:30 $ -// $Revision: 1.6 $ +// $Id: na.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/bool.hpp> #include <boost/mpl/aux_/na_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/na_assert.hpp b/Utilities/BGL/boost/mpl/aux_/na_assert.hpp index 6d8c70d7fdad08302914b7a2da9d6998d5ed2744..ece7f4cb1c86e6a75fd2efe47f50f3bea39c76f2 100644 --- a/Utilities/BGL/boost/mpl/aux_/na_assert.hpp +++ b/Utilities/BGL/boost/mpl/aux_/na_assert.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na_assert.hpp,v $ -// $Date: 2005/07/13 13:13:38 $ -// $Revision: 1.6 $ +// $Id: na_assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/na.hpp> #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/na_fwd.hpp b/Utilities/BGL/boost/mpl/aux_/na_fwd.hpp index a82941e8f365ccb1e0c6a5ecf9186b37224ebe18..dd64fc19f20a055e07506f34a79b4297c5d00e59 100644 --- a/Utilities/BGL/boost/mpl/aux_/na_fwd.hpp +++ b/Utilities/BGL/boost/mpl/aux_/na_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na_fwd.hpp,v $ -// $Date: 2004/11/28 01:37:30 $ -// $Revision: 1.2 $ +// $Id: na_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/na_spec.hpp b/Utilities/BGL/boost/mpl/aux_/na_spec.hpp index 52c6407389450488f4a924810206098cab248b85..92b2e5a00ad94ef21c739ae7c73a342583dc5b0f 100644 --- a/Utilities/BGL/boost/mpl/aux_/na_spec.hpp +++ b/Utilities/BGL/boost/mpl/aux_/na_spec.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na_spec.hpp,v $ -// $Date: 2004/11/28 01:38:15 $ -// $Revision: 1.3 $ +// $Id: na_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/lambda_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/nested_type_wknd.hpp b/Utilities/BGL/boost/mpl/aux_/nested_type_wknd.hpp index 0b8c02e4587e621003260c6a839074944ed360aa..cee38314bec50ae2881b567b2469c328a87acf62 100644 --- a/Utilities/BGL/boost/mpl/aux_/nested_type_wknd.hpp +++ b/Utilities/BGL/boost/mpl/aux_/nested_type_wknd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/nested_type_wknd.hpp,v $ -// $Date: 2004/09/28 13:56:59 $ -// $Revision: 1.7 $ +// $Id: nested_type_wknd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/gcc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/nttp_decl.hpp b/Utilities/BGL/boost/mpl/aux_/nttp_decl.hpp index 5fba8a8a9c02c903449aad7eeed7b52e334ac36a..0fa254df0c0ee90abf7d833ed6dab2d65ad6a8b4 100644 --- a/Utilities/BGL/boost/mpl/aux_/nttp_decl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/nttp_decl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/nttp_decl.hpp,v $ -// $Date: 2004/12/16 22:43:05 $ -// $Revision: 1.2 $ +// $Id: nttp_decl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/nttp.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/numeric_cast_utils.hpp b/Utilities/BGL/boost/mpl/aux_/numeric_cast_utils.hpp index 4afb11b24f25647c0de600ce3d459e3bb615e32b..cc5ea91eae6080838050bae03f7b0b684836ce1f 100644 --- a/Utilities/BGL/boost/mpl/aux_/numeric_cast_utils.hpp +++ b/Utilities/BGL/boost/mpl/aux_/numeric_cast_utils.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/numeric_cast_utils.hpp,v $ -// $Date: 2004/11/28 01:39:23 $ -// $Revision: 1.2 $ +// $Id: numeric_cast_utils.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/numeric_cast.hpp> #include <boost/mpl/apply_wrap.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/numeric_op.hpp b/Utilities/BGL/boost/mpl/aux_/numeric_op.hpp index 95ef6e41e35981bef931f62673c2891ffb53ef1e..2b0d6eb2676ea3f0b7a85bea853a185c087ec36b 100644 --- a/Utilities/BGL/boost/mpl/aux_/numeric_op.hpp +++ b/Utilities/BGL/boost/mpl/aux_/numeric_op.hpp @@ -13,9 +13,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/numeric_op.hpp,v $ -// $Date: 2004/12/20 19:17:06 $ -// $Revision: 1.9 $ +// $Id: numeric_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/numeric_cast.hpp> @@ -145,7 +145,7 @@ template<> struct AUX778076_OP_IMPL_NAME<integral_c_tag,na> #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && BOOST_WORKAROUND(BOOST_MSVC, != 1200) + && BOOST_WORKAROUND(BOOST_MSVC, >= 1300) template< typename T > struct AUX778076_OP_TAG_NAME : tag<T,na> { @@ -287,7 +287,10 @@ BOOST_MPL_AUX_NA_SPEC2(2, AUX778076_OP_ARITY, AUX778076_OP_NAME) ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 # define i_ BOOST_PP_FRAME_ITERATION(1) @@ -308,4 +311,5 @@ struct AUX778076_OP_NAME<BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(i_, N, na)> # undef i_ +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/aux_/order_impl.hpp b/Utilities/BGL/boost/mpl/aux_/order_impl.hpp index 4a5bc9a7a45937cafe466429bb4f87fd87bfb1c0..7129d82259878187c8facb1b778979b9fabbccfa 100644 --- a/Utilities/BGL/boost/mpl/aux_/order_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/order_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/order_impl.hpp,v $ -// $Date: 2004/10/13 18:23:20 $ -// $Revision: 1.5 $ +// $Id: order_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/order_fwd.hpp> #include <boost/mpl/if.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/overload_names.hpp b/Utilities/BGL/boost/mpl/aux_/overload_names.hpp index 09593f673cf453b6e78a80ffcd02ac183b1f9a5a..0fa4a983d3b141c936ff4e13d495076290acb4cc 100644 --- a/Utilities/BGL/boost/mpl/aux_/overload_names.hpp +++ b/Utilities/BGL/boost/mpl/aux_/overload_names.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/overload_names.hpp,v $ -// $Date: 2004/10/13 18:23:20 $ -// $Revision: 1.2 $ +// $Id: overload_names.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/ptr_to_ref.hpp> #include <boost/mpl/aux_/config/operators.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/partition_op.hpp b/Utilities/BGL/boost/mpl/aux_/partition_op.hpp index 63233aea50c84f4aed1d9d14a2e936ac80c1f193..95ae2fb5f41cebefddf07ecd733626682398ac22 100644 --- a/Utilities/BGL/boost/mpl/aux_/partition_op.hpp +++ b/Utilities/BGL/boost/mpl/aux_/partition_op.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/partition_op.hpp,v $ -// $Date: 2004/11/28 01:46:37 $ -// $Revision: 1.4 $ +// $Id: partition_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/apply.hpp> #include <boost/mpl/eval_if.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/pop_back_impl.hpp b/Utilities/BGL/boost/mpl/aux_/pop_back_impl.hpp index dfe0c916dcf12b24ade6f6a9b6d0d236731cc6ce..b8b4a9b72ce46f2f9b950471c84539e6faf2976a 100644 --- a/Utilities/BGL/boost/mpl/aux_/pop_back_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/pop_back_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/pop_back_impl.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.4 $ +// $Id: pop_back_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/pop_back_fwd.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/pop_front_impl.hpp b/Utilities/BGL/boost/mpl/aux_/pop_front_impl.hpp index d80e2d1507a25f1e58571b6bebb7a9f94497b67e..c28db20f391ba4b4aa6a0a403fc9ccdf69c1c373 100644 --- a/Utilities/BGL/boost/mpl/aux_/pop_front_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/pop_front_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/pop_front_impl.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.5 $ +// $Id: pop_front_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/pop_front_fwd.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_backward.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_backward.hpp index 26de94cea1ad6aa642db891ca9e08b68e5bcc685..5cb50dc0c2e88b983b35fe58ae492ca8eb191580 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_backward.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_backward.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/advance_backward.hpp" header +// *Preprocessed* version of the main "advance_backward.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_forward.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_forward.hpp index b137cc72af1e034c783377e2746dd451239a6c65..9654ee330bf51f58618933f8bb1852288b512c21 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_forward.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/advance_forward.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/advance_forward.hpp" header +// *Preprocessed* version of the main "advance_forward.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/and.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/and.hpp index 010ad1fc849cb96ab84d0ca02ea5f9d0dd613d2a..f34568902dd19c9b6b1e189daf5f65733f19ab1d 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/and.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/and.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/and.hpp" header +// *Preprocessed* version of the main "and.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply.hpp index e08eaccf03a2dd93114fee200d290cc893b690ad..bce7c2c3ab9ed81135d603f8cd1b05bb9c490d75 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/apply.hpp" header +// *Preprocessed* version of the main "apply.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_fwd.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_fwd.hpp index b2ed5d513011d7ab59bb27395de8581d4fddb505..1ba706ff2aaefb6a26465dd76be40ddeae02b04c 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_fwd.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_fwd.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/apply_fwd.hpp" header +// *Preprocessed* version of the main "apply_fwd.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_wrap.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_wrap.hpp index 2ffe7091bc32ceba7270c38c343790c48dc15adf..45b75c78ec1eca9d0a6d99c086c49f0251ea62b2 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_wrap.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/apply_wrap.hpp @@ -1,12 +1,12 @@ -// Copyright Aleksey Gurtovoy 2000-2004 +// 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 "boost/mpl/apply_wrap.hpp" header +// *Preprocessed* version of the main "apply_wrap.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { @@ -16,6 +16,16 @@ template< > struct apply_wrap_impl0; +template< typename F, bool F_has_apply > +struct apply_wrap_impl0_bcb { + typedef typename F::template apply<na> type; +}; + +template< typename F > +struct apply_wrap_impl0_bcb< F,true > { + typedef typename F::apply type; +}; + template< typename F > @@ -25,12 +35,7 @@ struct apply_wrap_impl0< > { - typedef typename F::template apply< - -/// since the defaults are "lost", we have to pass *something* even for nullary -/// metafunction classes - na - > type; + typedef apply_wrap_impl0_bcb< F, aux::has_apply<F>::value >::type type; }; template< diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/arg.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/arg.hpp index 9a766e79cee6253757373e930a0756d562062c0f..3ac43401af5453a05d58e37813cdb88c05a3414d 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/arg.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/arg.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/arg.hpp" header +// *Preprocessed* version of the main "arg.hpp" header // -- DO NOT modify by hand! BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/basic_bind.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/basic_bind.hpp index d24e2245a9cbd1d798106326ef4e88881a4605ce..74b00299124b4f5b5474d5b549528a0e99f3fdad 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/basic_bind.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/basic_bind.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/basic_bind.hpp" header +// *Preprocessed* version of the main "basic_bind.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind.hpp index edafd0cf5d2be40dd80b8de65d387c6c5b6dad4c..e769a0cb9dd30e7ebf168653d8ec0a39ec8e0e49 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/bind.hpp" header +// *Preprocessed* version of the main "bind.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind_fwd.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind_fwd.hpp index 022cba346119c3fc4c946861a74bc3faf22c9d9f..962b5c98bc591079b17375590278460a1dc1e703 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind_fwd.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bind_fwd.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/bind_fwd.hpp" header +// *Preprocessed* version of the main "bind_fwd.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitand.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitand.hpp index 0bbf54ea26d42b485fb83ecc88d3f65c6eb7e048..527b6894fcd983413b0cefde7ca0cf125babc3d5 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitand.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitand.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/bitand.hpp" header +// *Preprocessed* version of the main "bitand.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitor.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitor.hpp index 55b31cb8a9ce2241fe063e5dca7fd40078d3f85f..3f0d5caa5a07b27cb35580394747c2a0975db515 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitor.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitor.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/bitor.hpp" header +// *Preprocessed* version of the main "bitor.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitxor.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitxor.hpp index ec1939151d0255d6cb4146bf319aac5eb1cf0e1e..06996c03b895f657324f43aef9d8398519d47cc4 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitxor.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/bitxor.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/bitxor.hpp" header +// *Preprocessed* version of the main "bitxor.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/deque.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/deque.hpp index de67398a37ca5e11b019749fd05d2525368460d4..06505c9360c5858046a0f29c73ddfcda546479a8 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/deque.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/deque.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/deque.hpp" header +// *Preprocessed* version of the main "deque.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/divides.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/divides.hpp index 86f16826f797729f1598d396b6d5dd9ebaa5d8c8..6b4178a9c73f30082b14c78699c2edd28154d2b7 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/divides.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/divides.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/divides.hpp" header +// *Preprocessed* version of the main "divides.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/equal_to.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/equal_to.hpp index 62c994589f4cbc9d8af1c70496fa15e6a2ce07b9..901a93c2f4d46c61e0b3b3517beb47ff383523f4 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/equal_to.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/equal_to.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/equal_to.hpp" header +// *Preprocessed* version of the main "equal_to.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/fold_impl.hpp index 9e7a29300d65ba374e877a6140644502b0746c15..45ab4e7c6deada064fdb73816941019900b2299a 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/fold_impl.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/fold_impl.hpp" header +// *Preprocessed* version of the main "fold_impl.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp index e3eef71b1ea08dd8ba867be6a77f90e57485c616..8b2bf590632bc166b4157fe6cc6da79cfb3b4f54 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/full_lambda.hpp" header +// *Preprocessed* version of the main "full_lambda.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater.hpp index 14d8e08bff036fde48c5cc92d9b1827d063282fd..3d1c3dcead484c8ce7f6bb9812853de006ce83bb 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/greater.hpp" header +// *Preprocessed* version of the main "greater.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater_equal.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater_equal.hpp index 2603f9184a0343f9fa138c8b6d704dab3b12d5dc..fb011866e77804060fb6e8cf1597d69c618c13ae 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater_equal.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/greater_equal.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/greater_equal.hpp" header +// *Preprocessed* version of the main "greater_equal.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/inherit.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/inherit.hpp index 31ab0dc490f93390ca99d5b75ab98b22ced46fad..6adcc0142e39fff1e4e38e183fba8d65b9a5f6c9 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/inherit.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/inherit.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/inherit.hpp" header +// *Preprocessed* version of the main "inherit.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_if_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_if_impl.hpp index 695179584d3e74922048ac3afbb8541e337f7919..b767e95862486cb43c8cfef4719fb39eff92b15a 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_if_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_if_impl.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/iter_fold_if_impl.hpp" header +// *Preprocessed* version of the main "iter_fold_if_impl.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_impl.hpp index 805790e86d69bb832f7dfc6fe94b66578ee46b30..1dd216c8aa7cc602ede9a50349e69a924853fff4 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/iter_fold_impl.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/iter_fold_impl.hpp" header +// *Preprocessed* version of the main "iter_fold_impl.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/lambda_no_ctps.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/lambda_no_ctps.hpp index 890a198a4641d9580d8865eae285774c45390762..75b30ce32f8c40f83690adf02b57259c82b9c931 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/lambda_no_ctps.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/lambda_no_ctps.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/lambda_no_ctps.hpp" header +// *Preprocessed* version of the main "lambda_no_ctps.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less.hpp index 4fe3cd17c491906b7b4e1d6cbf8701402fc7d422..0b6ce1d4bf0b8260e07ee95950562b6f96bd23de 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/less.hpp" header +// *Preprocessed* version of the main "less.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less_equal.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less_equal.hpp index ca2894f6f93fedafdeeb26b2750ba881c0afd76d..0010e084514944e0b4a5d7f87ae13111a25fb4db 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less_equal.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/less_equal.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/less_equal.hpp" header +// *Preprocessed* version of the main "less_equal.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list.hpp index 4e8ad53d2122d5d8ca811fc45b9e0c1f456f8d1d..cbd58acd863f3a9102692afcc9584aaae1cc1757 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/list.hpp" header +// *Preprocessed* version of the main "list.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list_c.hpp index 0b48a7f8e119d267d7fe3900cd3f4591eab651f3..495c3f7f19d5e8698138ffa6b5c4ae40fcc2cf8d 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/list_c.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/list_c.hpp" header +// *Preprocessed* version of the main "list_c.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/map.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/map.hpp index 837e01377188c8e75a284d3101ce4570865cda68..80ef156e4957b06f5da9d5323e03561068c06ca4 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/map.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/map.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/map.hpp" header +// *Preprocessed* version of the main "map.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/minus.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/minus.hpp index 71d491376609749c2df81140210c5b07af252c94..cfddc15b78755ed62e6168531ce47bc77f2cade1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/minus.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/minus.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/minus.hpp" header +// *Preprocessed* version of the main "minus.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/modulus.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/modulus.hpp index 224b34930c92b440da775cae10ac79c8ae5fbd49..eb5eff07e295b6a53f77af69c694d1f9e26a4a30 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/modulus.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/modulus.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/modulus.hpp" header +// *Preprocessed* version of the main "modulus.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/not_equal_to.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/not_equal_to.hpp index 98b21b1e22d4655e833ffe8c9aa2223451ad4e89..68356eee4d8560224926e569d1d1a6eb01be0fa9 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/not_equal_to.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/not_equal_to.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/not_equal_to.hpp" header +// *Preprocessed* version of the main "not_equal_to.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/or.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/or.hpp index 31e1aaa4e60cfe8cb73f0e1ee9dc506e0204aff5..ff7ce9fd5879e67ca2ed38f8907e03b1867c513d 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/or.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/or.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/or.hpp" header +// *Preprocessed* version of the main "or.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/placeholders.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/placeholders.hpp index ff97364b9ba1c408645065d8965f74c105e86d3a..b306bbbcb9c2eb24c51be47cb649e379487b7489 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/placeholders.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/placeholders.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/placeholders.hpp" header +// *Preprocessed* version of the main "placeholders.hpp" header // -- DO NOT modify by hand! BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/plus.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/plus.hpp index a9f6ee79a5cdfd15354ed683b94948f5132a2f5a..82539abc4c8e357d35a1e85784b46ef3c6a6881a 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/plus.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/plus.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/plus.hpp" header +// *Preprocessed* version of the main "plus.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/quote.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/quote.hpp index e7a7f0019619bec59665b5d49be5317bf1876a50..677a3f9babc7b04392f19f2a1ba72cfa057ffd32 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/quote.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/quote.hpp @@ -1,11 +1,119 @@ -// Copyright Aleksey Gurtovoy 2000-2004 +// 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 "boost/mpl/quote.hpp" header +// *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; + }; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_fold_impl.hpp index 7a07414adff9a483ab39c8db5a4aa8af14f4e99e..372f0d260ae7993c0ed7e8add707af1875487d75 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_fold_impl.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/reverse_fold_impl.hpp" header +// *Preprocessed* version of the main "reverse_fold_impl.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_iter_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_iter_fold_impl.hpp index 39a4057b77d200cb43aed9f3494f8fe5d2375419..44aadf7a6d20975d0faa6877b987747a8542c375 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_iter_fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/reverse_iter_fold_impl.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/reverse_iter_fold_impl.hpp" header +// *Preprocessed* version of the main "reverse_iter_fold_impl.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set.hpp index 5721922e1110358dd5d3ba8d6f750e08a9f1e124..ace3a4f07cbfbc6acb92059dc44f65380f1c5bb6 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/set.hpp" header +// *Preprocessed* version of the main "set.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set_c.hpp index cbeb932c13da6b9e879f973eabc9a79127588e92..4e6993ce2728b12428dc31ef79b8f88623a92768 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/set_c.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/set_c.hpp" header +// *Preprocessed* version of the main "set_c.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_left.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_left.hpp index b5b181ce196f1f4d17bfb2cc8f31e624ff279b60..6d19e94ed3412131a33642d381263d576f48b6e3 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_left.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_left.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/shift_left.hpp" header +// *Preprocessed* version of the main "shift_left.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_right.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_right.hpp index f7a342e989a48a4a8094a15629586270f459e939..dd31d97cec98a97e61f8c38d152739baabfc9278 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_right.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/shift_right.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/shift_right.hpp" header +// *Preprocessed* version of the main "shift_right.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/template_arity.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/template_arity.hpp index 1164f0f8c2784bc6c60843e85db3c92ec6688384..b24a0a7e7fb2a593aa895362db816b46c1e991e0 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/template_arity.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/template_arity.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/aux_/template_arity.hpp" header +// *Preprocessed* version of the main "template_arity.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/times.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/times.hpp index cb97cc4e1329c1b95fc94fd84b2af2775aaf9e39..ab100f1cb3f3c7bb7aa227172af4f6b61a402630 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/times.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/times.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/times.hpp" header +// *Preprocessed* version of the main "times.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/unpack_args.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/unpack_args.hpp index ef7c2b016ef10235d9acc03126ee05566b807d75..f391dc1ab84acda94b549ae2172a05e97289787d 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/unpack_args.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/unpack_args.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/unpack_args.hpp" header +// *Preprocessed* version of the main "unpack_args.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector.hpp index bfa9565a537be8f617f586911714379044a34f03..803e217850a068fa3a6665dabd8996e0ec198b82 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector.hpp @@ -6,7 +6,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -// Preprocessed version of "boost/mpl/vector.hpp" header +// *Preprocessed* version of the main "vector.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector_c.hpp index 840c2e1ab9a48381c4239ef40e48fb92d7a1ecf9..643b7fd636729083884335d3c17cb5cc9a7b8d2d 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc/vector_c.hpp @@ -1,12 +1,12 @@ -// Copyright Aleksey Gurtovoy 2000-2004 +// 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 "boost/mpl/vector_c.hpp" header +// *Preprocessed* version of the main "vector_c.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc551/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc551/vector_c.hpp index 840c2e1ab9a48381c4239ef40e48fb92d7a1ecf9..0f1560d7f139f5e661c20311a8ce77b684fd6cc1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc551/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc551/vector_c.hpp @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/advance_backward.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/advance_backward.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5cb50dc0c2e88b983b35fe58ae492ca8eb191580 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/advance_backward.hpp @@ -0,0 +1,97 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "advance_backward.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +template< long N > struct advance_backward; +template<> +struct advance_backward<0> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef iter0 type; + }; +}; + +template<> +struct advance_backward<1> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename prior<iter0>::type iter1; + typedef iter1 type; + }; +}; + +template<> +struct advance_backward<2> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename prior<iter0>::type iter1; + typedef typename prior<iter1>::type iter2; + typedef iter2 type; + }; +}; + +template<> +struct advance_backward<3> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename prior<iter0>::type iter1; + typedef typename prior<iter1>::type iter2; + typedef typename prior<iter2>::type iter3; + typedef iter3 type; + }; +}; + +template<> +struct advance_backward<4> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename prior<iter0>::type iter1; + typedef typename prior<iter1>::type iter2; + typedef typename prior<iter2>::type iter3; + typedef typename prior<iter3>::type iter4; + typedef iter4 type; + }; +}; + +template< long N > +struct advance_backward +{ + template< typename Iterator > struct apply + { + typedef typename apply_wrap1< + advance_backward<4> + , Iterator + >::type chunk_result_; + + typedef typename apply_wrap1< + advance_backward<( + (N - 4) < 0 + ? 0 + : N - 4 + )> + , chunk_result_ + >::type type; + }; +}; + +}}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/advance_forward.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/advance_forward.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9654ee330bf51f58618933f8bb1852288b512c21 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/advance_forward.hpp @@ -0,0 +1,97 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "advance_forward.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +template< long N > struct advance_forward; +template<> +struct advance_forward<0> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef iter0 type; + }; +}; + +template<> +struct advance_forward<1> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename next<iter0>::type iter1; + typedef iter1 type; + }; +}; + +template<> +struct advance_forward<2> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename next<iter0>::type iter1; + typedef typename next<iter1>::type iter2; + typedef iter2 type; + }; +}; + +template<> +struct advance_forward<3> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename next<iter0>::type iter1; + typedef typename next<iter1>::type iter2; + typedef typename next<iter2>::type iter3; + typedef iter3 type; + }; +}; + +template<> +struct advance_forward<4> +{ + template< typename Iterator > struct apply + { + typedef Iterator iter0; + typedef typename next<iter0>::type iter1; + typedef typename next<iter1>::type iter2; + typedef typename next<iter2>::type iter3; + typedef typename next<iter3>::type iter4; + typedef iter4 type; + }; +}; + +template< long N > +struct advance_forward +{ + template< typename Iterator > struct apply + { + typedef typename apply_wrap1< + advance_forward<4> + , Iterator + >::type chunk_result_; + + typedef typename apply_wrap1< + advance_forward<( + (N - 4) < 0 + ? 0 + : N - 4 + )> + , chunk_result_ + >::type type; + }; +}; + +}}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/and.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/and.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f34568902dd19c9b6b1e189daf5f65733f19ab1d --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/and.hpp @@ -0,0 +1,69 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "and.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +namespace aux { + +template< bool C_, typename T1, typename T2, typename T3, typename T4 > +struct and_impl + : false_ +{ +}; + +template< typename T1, typename T2, typename T3, typename T4 > +struct and_impl< true,T1,T2,T3,T4 > + : and_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4 + , true_ + > +{ +}; + +template<> +struct and_impl< + true + , true_, true_, true_, true_ + > + : true_ +{ +}; + +} // namespace aux + +template< + typename BOOST_MPL_AUX_NA_PARAM(T1) + , typename BOOST_MPL_AUX_NA_PARAM(T2) + , typename T3 = true_, typename T4 = true_, typename T5 = true_ + > +struct and_ + + : aux::and_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4, T5 + > + +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , and_ + , ( T1, T2, T3, T4, T5) + ) +}; + +BOOST_MPL_AUX_NA_SPEC2( + 2 + , 5 + , and_ + ) + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bce7c2c3ab9ed81135d603f8cd1b05bb9c490d75 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply.hpp @@ -0,0 +1,169 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "apply.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename F + > +struct apply0 + + : apply_wrap0< + typename lambda<F>::type + + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 1 + , apply0 + , (F ) + ) +}; + +template< + typename F + > +struct apply< F,na,na,na,na,na > + : apply0<F> +{ +}; + +template< + typename F, typename T1 + > +struct apply1 + + : apply_wrap1< + typename lambda<F>::type + , T1 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 2 + , apply1 + , (F, T1) + ) +}; + +template< + typename F, typename T1 + > +struct apply< F,T1,na,na,na,na > + : apply1< F,T1 > +{ +}; + +template< + typename F, typename T1, typename T2 + > +struct apply2 + + : apply_wrap2< + typename lambda<F>::type + , T1, T2 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 3 + , apply2 + , (F, T1, T2) + ) +}; + +template< + typename F, typename T1, typename T2 + > +struct apply< F,T1,T2,na,na,na > + : apply2< F,T1,T2 > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply3 + + : apply_wrap3< + typename lambda<F>::type + , T1, T2, T3 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 4 + , apply3 + , (F, T1, T2, T3) + ) +}; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply< F,T1,T2,T3,na,na > + : apply3< F,T1,T2,T3 > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply4 + + : apply_wrap4< + typename lambda<F>::type + , T1, T2, T3, T4 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , apply4 + , (F, T1, T2, T3, T4) + ) +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply< F,T1,T2,T3,T4,na > + : apply4< F,T1,T2,T3,T4 > +{ +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply5 + + : apply_wrap5< + typename lambda<F>::type + , T1, T2, T3, T4, T5 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 6 + , apply5 + , (F, T1, T2, T3, T4, T5) + ) +}; + +/// primary template (not a specialization!) + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply + : apply5< F,T1,T2,T3,T4,T5 > +{ +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply_fwd.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1ba706ff2aaefb6a26465dd76be40ddeae02b04c --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply_fwd.hpp @@ -0,0 +1,52 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "apply_fwd.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename F, typename T1 = na, typename T2 = na, typename T3 = na + , typename T4 = na, typename T5 = na + > +struct apply; + +template< + typename F + > +struct apply0; + +template< + typename F, typename T1 + > +struct apply1; + +template< + typename F, typename T1, typename T2 + > +struct apply2; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply3; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply4; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply5; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply_wrap.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply_wrap.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d88129dadf0454ac46a965da7e070f32ec777575 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/apply_wrap.hpp @@ -0,0 +1,456 @@ + +// 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 "apply_wrap.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + int N, typename F + > +struct apply_wrap_impl0; + +template< + typename F + > +struct apply_wrap_impl0< + 0 + , F + + > +{ + typedef typename F::template apply< + +/// since the defaults are "lost", we have to pass *something* even for nullary +/// metafunction classes + na + > type; +}; + +template< + typename F + > +struct apply_wrap_impl0< + 1 + , F + + > +{ + typedef typename F::template apply< + + na + > type; +}; + +template< + typename F + > +struct apply_wrap_impl0< + 2 + , F + + > +{ + typedef typename F::template apply< + + na, na + + > type; +}; + +template< + typename F + > +struct apply_wrap_impl0< + 3 + , F + + > +{ + typedef typename F::template apply< + + na, na, na + + > type; +}; + +template< + typename F + > +struct apply_wrap_impl0< + 4 + , F + + > +{ + typedef typename F::template apply< + + na, na, na, na + + > type; +}; + +template< + typename F + > +struct apply_wrap_impl0< + 5 + , F + + > +{ + typedef typename F::template apply< + + na, na, na, na, na + + > type; +}; + +template< + typename F + > +struct apply_wrap0 + : apply_wrap_impl0< + ::boost::mpl::aux::arity< F,0 >::value + , F + + >::type +{ +}; + +template< + int N, typename F, typename T1 + > +struct apply_wrap_impl1; + +template< + typename F, typename T1 + > +struct apply_wrap_impl1< + 1 + , F + , T1 + > +{ + typedef typename F::template apply< + T1 + > type; +}; + +template< + typename F, typename T1 + > +struct apply_wrap_impl1< + 2 + , F + , T1 + > +{ + typedef typename F::template apply< + T1 + , na + + > type; +}; + +template< + typename F, typename T1 + > +struct apply_wrap_impl1< + 3 + , F + , T1 + > +{ + typedef typename F::template apply< + T1 + , na, na + + > type; +}; + +template< + typename F, typename T1 + > +struct apply_wrap_impl1< + 4 + , F + , T1 + > +{ + typedef typename F::template apply< + T1 + , na, na, na + + > type; +}; + +template< + typename F, typename T1 + > +struct apply_wrap_impl1< + 5 + , F + , T1 + > +{ + typedef typename F::template apply< + T1 + , na, na, na, na + + > type; +}; + +template< + typename F, typename T1 + > +struct apply_wrap1 + : apply_wrap_impl1< + ::boost::mpl::aux::arity< F,1 >::value + , F + , T1 + >::type +{ +}; + +template< + int N, typename F, typename T1, typename T2 + > +struct apply_wrap_impl2; + +template< + typename F, typename T1, typename T2 + > +struct apply_wrap_impl2< + 2 + , F + , T1, T2 + > +{ + typedef typename F::template apply< + T1, T2 + + > type; +}; + +template< + typename F, typename T1, typename T2 + > +struct apply_wrap_impl2< + 3 + , F + , T1, T2 + > +{ + typedef typename F::template apply< + T1, T2 + + , na + + > type; +}; + +template< + typename F, typename T1, typename T2 + > +struct apply_wrap_impl2< + 4 + , F + , T1, T2 + > +{ + typedef typename F::template apply< + T1, T2 + + , na, na + + > type; +}; + +template< + typename F, typename T1, typename T2 + > +struct apply_wrap_impl2< + 5 + , F + , T1, T2 + > +{ + typedef typename F::template apply< + T1, T2 + + , na, na, na + + > type; +}; + +template< + typename F, typename T1, typename T2 + > +struct apply_wrap2 + : apply_wrap_impl2< + ::boost::mpl::aux::arity< F,2 >::value + , F + , T1, T2 + >::type +{ +}; + +template< + int N, typename F, typename T1, typename T2, typename T3 + > +struct apply_wrap_impl3; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply_wrap_impl3< + 3 + , F + , T1, T2, T3 + > +{ + typedef typename F::template apply< + T1, T2, T3 + + > type; +}; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply_wrap_impl3< + 4 + , F + , T1, T2, T3 + > +{ + typedef typename F::template apply< + T1, T2, T3 + + , na + + > type; +}; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply_wrap_impl3< + 5 + , F + , T1, T2, T3 + > +{ + typedef typename F::template apply< + T1, T2, T3 + + , na, na + + > type; +}; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct apply_wrap3 + : apply_wrap_impl3< + ::boost::mpl::aux::arity< F,3 >::value + , F + , T1, T2, T3 + >::type +{ +}; + +template< + int N, typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply_wrap_impl4; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply_wrap_impl4< + 4 + , F + , T1, T2, T3, T4 + > +{ + typedef typename F::template apply< + T1, T2, T3, T4 + + > type; +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply_wrap_impl4< + 5 + , F + , T1, T2, T3, T4 + > +{ + typedef typename F::template apply< + T1, T2, T3, T4 + + , na + + > type; +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct apply_wrap4 + : apply_wrap_impl4< + ::boost::mpl::aux::arity< F,4 >::value + , F + , T1, T2, T3, T4 + >::type +{ +}; + +template< + int N, typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply_wrap_impl5; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply_wrap_impl5< + 5 + , F + , T1, T2, T3, T4, T5 + > +{ + typedef typename F::template apply< + T1, T2, T3, T4, T5 + + > type; +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct apply_wrap5 + : apply_wrap_impl5< + ::boost::mpl::aux::arity< F,5 >::value + , F + , T1, T2, T3, T4, T5 + >::type +{ +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/arg.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/arg.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3ac43401af5453a05d58e37813cdb88c05a3414d --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/arg.hpp @@ -0,0 +1,117 @@ + +// Copyright Peter Dimov 2001-2002 +// 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) +// + +// *Preprocessed* version of the main "arg.hpp" header +// -- DO NOT modify by hand! + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +template<> struct arg< -1 > +{ + BOOST_STATIC_CONSTANT(int, value = -1); + BOOST_MPL_AUX_ARG_TYPEDEF(na, tag) + BOOST_MPL_AUX_ARG_TYPEDEF(na, type) + + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + typedef U1 type; + BOOST_MPL_AUX_ASSERT_NOT_NA(type); + }; +}; + +template<> struct arg<1> +{ + BOOST_STATIC_CONSTANT(int, value = 1); + typedef arg<2> next; + BOOST_MPL_AUX_ARG_TYPEDEF(na, tag) + BOOST_MPL_AUX_ARG_TYPEDEF(na, type) + + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + typedef U1 type; + BOOST_MPL_AUX_ASSERT_NOT_NA(type); + }; +}; + +template<> struct arg<2> +{ + BOOST_STATIC_CONSTANT(int, value = 2); + typedef arg<3> next; + BOOST_MPL_AUX_ARG_TYPEDEF(na, tag) + BOOST_MPL_AUX_ARG_TYPEDEF(na, type) + + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + typedef U2 type; + BOOST_MPL_AUX_ASSERT_NOT_NA(type); + }; +}; + +template<> struct arg<3> +{ + BOOST_STATIC_CONSTANT(int, value = 3); + typedef arg<4> next; + BOOST_MPL_AUX_ARG_TYPEDEF(na, tag) + BOOST_MPL_AUX_ARG_TYPEDEF(na, type) + + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + typedef U3 type; + BOOST_MPL_AUX_ASSERT_NOT_NA(type); + }; +}; + +template<> struct arg<4> +{ + BOOST_STATIC_CONSTANT(int, value = 4); + typedef arg<5> next; + BOOST_MPL_AUX_ARG_TYPEDEF(na, tag) + BOOST_MPL_AUX_ARG_TYPEDEF(na, type) + + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + typedef U4 type; + BOOST_MPL_AUX_ASSERT_NOT_NA(type); + }; +}; + +template<> struct arg<5> +{ + BOOST_STATIC_CONSTANT(int, value = 5); + typedef arg<6> next; + BOOST_MPL_AUX_ARG_TYPEDEF(na, tag) + BOOST_MPL_AUX_ARG_TYPEDEF(na, type) + + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + typedef U5 type; + BOOST_MPL_AUX_ASSERT_NOT_NA(type); + }; +}; + +BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1,int, arg) + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/basic_bind.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/basic_bind.hpp new file mode 100644 index 0000000000000000000000000000000000000000..74b00299124b4f5b5474d5b549528a0e99f3fdad --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/basic_bind.hpp @@ -0,0 +1,300 @@ + +// Copyright Peter Dimov 2001 +// 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) +// + +// *Preprocessed* version of the main "basic_bind.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +namespace aux { + +template< + typename T, typename U1, typename U2, typename U3, typename U4 + , typename U5 + > +struct resolve_bind_arg +{ + typedef T type; +}; + +template< + int N, typename U1, typename U2, typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 > +{ + typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type; +}; + +} // namespace aux + +template< + typename F + > +struct bind0 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_; + + public: + typedef typename apply_wrap0< + f_ + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename U1, typename U2, typename U3, typename U4 + , typename U5 + > +struct resolve_bind_arg< + bind0<F>, U1, U2, U3, U4, U5 + > +{ + typedef bind0<F> f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(1, bind0) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0) + +template< + typename F, typename T1 + > +struct bind1 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_; + typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1; + + public: + typedef typename apply_wrap1< + f_ + , typename t1::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename U1, typename U2, typename U3 + , typename U4, typename U5 + > +struct resolve_bind_arg< + bind1< F,T1 >, U1, U2, U3, U4, U5 + > +{ + typedef bind1< F,T1 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(2, bind1) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1) + +template< + typename F, typename T1, typename T2 + > +struct bind2 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_; + typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1; + typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2; + + public: + typedef typename apply_wrap2< + f_ + , typename t1::type, typename t2::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename U1, typename U2 + , typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< + bind2< F,T1,T2 >, U1, U2, U3, U4, U5 + > +{ + typedef bind2< F,T1,T2 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(3, bind2) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2) + +template< + typename F, typename T1, typename T2, typename T3 + > +struct bind3 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_; + typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1; + typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2; + typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3; + + public: + typedef typename apply_wrap3< + f_ + , typename t1::type, typename t2::type, typename t3::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename T3, typename U1 + , typename U2, typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< + bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5 + > +{ + typedef bind3< F,T1,T2,T3 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(4, bind3) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3) + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct bind4 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_; + typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1; + typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2; + typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3; + typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4; + + public: + typedef typename apply_wrap4< + f_ + , typename t1::type, typename t2::type, typename t3::type + , typename t4::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename U1, typename U2, typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< + bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5 + > +{ + typedef bind4< F,T1,T2,T3,T4 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(5, bind4) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4) + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct bind5 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_; + typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1; + typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2; + typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3; + typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4; + typedef aux::resolve_bind_arg< T5,U1,U2,U3,U4,U5 > t5; + + public: + typedef typename apply_wrap5< + f_ + , typename t1::type, typename t2::type, typename t3::type + , typename t4::type, typename t5::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename U1, typename U2, typename U3, typename U4 + , typename U5 + > +struct resolve_bind_arg< + bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5 + > +{ + typedef bind5< F,T1,T2,T3,T4,T5 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(6, bind5) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5) +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bind.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bind.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e769a0cb9dd30e7ebf168653d8ec0a39ec8e0e49 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bind.hpp @@ -0,0 +1,397 @@ + +// Copyright Peter Dimov 2001 +// 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) +// + +// *Preprocessed* version of the main "bind.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +namespace aux { + +template< + typename T, typename U1, typename U2, typename U3, typename U4 + , typename U5 + > +struct resolve_bind_arg +{ + typedef T type; +}; + +template< + typename T + , typename Arg + > +struct replace_unnamed_arg +{ + typedef Arg next; + typedef T type; +}; + +template< + typename Arg + > +struct replace_unnamed_arg< arg< -1 >, Arg > +{ + typedef typename Arg::next next; + typedef Arg type; +}; + +template< + int N, typename U1, typename U2, typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< arg<N>, U1, U2, U3, U4, U5 > +{ + typedef typename apply_wrap5<mpl::arg<N>, U1, U2, U3, U4, U5>::type type; +}; + +} // namespace aux + +template< + typename F + > +struct bind0 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; + typedef typename r0::type a0; + typedef typename r0::next n1; + typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; + /// + public: + typedef typename apply_wrap0< + f_ + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename U1, typename U2, typename U3, typename U4 + , typename U5 + > +struct resolve_bind_arg< + bind0<F>, U1, U2, U3, U4, U5 + > +{ + typedef bind0<F> f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(1, bind0) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0) + +template< + typename F, typename T1 + > +struct bind1 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; + typedef typename r0::type a0; + typedef typename r0::next n1; + typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; + /// + typedef aux::replace_unnamed_arg< T1,n1 > r1; + typedef typename r1::type a1; + typedef typename r1::next n2; + typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; + /// + public: + typedef typename apply_wrap1< + f_ + , typename t1::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename U1, typename U2, typename U3 + , typename U4, typename U5 + > +struct resolve_bind_arg< + bind1< F,T1 >, U1, U2, U3, U4, U5 + > +{ + typedef bind1< F,T1 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(2, bind1) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1) + +template< + typename F, typename T1, typename T2 + > +struct bind2 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; + typedef typename r0::type a0; + typedef typename r0::next n1; + typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; + /// + typedef aux::replace_unnamed_arg< T1,n1 > r1; + typedef typename r1::type a1; + typedef typename r1::next n2; + typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; + /// + typedef aux::replace_unnamed_arg< T2,n2 > r2; + typedef typename r2::type a2; + typedef typename r2::next n3; + typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; + /// + public: + typedef typename apply_wrap2< + f_ + , typename t1::type, typename t2::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename U1, typename U2 + , typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< + bind2< F,T1,T2 >, U1, U2, U3, U4, U5 + > +{ + typedef bind2< F,T1,T2 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(3, bind2) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2) + +template< + typename F, typename T1, typename T2, typename T3 + > +struct bind3 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; + typedef typename r0::type a0; + typedef typename r0::next n1; + typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; + /// + typedef aux::replace_unnamed_arg< T1,n1 > r1; + typedef typename r1::type a1; + typedef typename r1::next n2; + typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; + /// + typedef aux::replace_unnamed_arg< T2,n2 > r2; + typedef typename r2::type a2; + typedef typename r2::next n3; + typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; + /// + typedef aux::replace_unnamed_arg< T3,n3 > r3; + typedef typename r3::type a3; + typedef typename r3::next n4; + typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3; + /// + public: + typedef typename apply_wrap3< + f_ + , typename t1::type, typename t2::type, typename t3::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename T3, typename U1 + , typename U2, typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< + bind3< F,T1,T2,T3 >, U1, U2, U3, U4, U5 + > +{ + typedef bind3< F,T1,T2,T3 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(4, bind3) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3) + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct bind4 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; + typedef typename r0::type a0; + typedef typename r0::next n1; + typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; + /// + typedef aux::replace_unnamed_arg< T1,n1 > r1; + typedef typename r1::type a1; + typedef typename r1::next n2; + typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; + /// + typedef aux::replace_unnamed_arg< T2,n2 > r2; + typedef typename r2::type a2; + typedef typename r2::next n3; + typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; + /// + typedef aux::replace_unnamed_arg< T3,n3 > r3; + typedef typename r3::type a3; + typedef typename r3::next n4; + typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3; + /// + typedef aux::replace_unnamed_arg< T4,n4 > r4; + typedef typename r4::type a4; + typedef typename r4::next n5; + typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4; + /// + public: + typedef typename apply_wrap4< + f_ + , typename t1::type, typename t2::type, typename t3::type + , typename t4::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename U1, typename U2, typename U3, typename U4, typename U5 + > +struct resolve_bind_arg< + bind4< F,T1,T2,T3,T4 >, U1, U2, U3, U4, U5 + > +{ + typedef bind4< F,T1,T2,T3,T4 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(5, bind4) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4) + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct bind5 +{ + template< + typename U1, typename U2, typename U3, typename U4, typename U5 + > + struct apply + { + private: + typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; + typedef typename r0::type a0; + typedef typename r0::next n1; + typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; + /// + typedef aux::replace_unnamed_arg< T1,n1 > r1; + typedef typename r1::type a1; + typedef typename r1::next n2; + typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; + /// + typedef aux::replace_unnamed_arg< T2,n2 > r2; + typedef typename r2::type a2; + typedef typename r2::next n3; + typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; + /// + typedef aux::replace_unnamed_arg< T3,n3 > r3; + typedef typename r3::type a3; + typedef typename r3::next n4; + typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3; + /// + typedef aux::replace_unnamed_arg< T4,n4 > r4; + typedef typename r4::type a4; + typedef typename r4::next n5; + typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4; + /// + typedef aux::replace_unnamed_arg< T5,n5 > r5; + typedef typename r5::type a5; + typedef typename r5::next n6; + typedef aux::resolve_bind_arg< a5,U1,U2,U3,U4,U5 > t5; + /// + public: + typedef typename apply_wrap5< + f_ + , typename t1::type, typename t2::type, typename t3::type + , typename t4::type, typename t5::type + >::type type; + + }; +}; + +namespace aux { + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename U1, typename U2, typename U3, typename U4 + , typename U5 + > +struct resolve_bind_arg< + bind5< F,T1,T2,T3,T4,T5 >, U1, U2, U3, U4, U5 + > +{ + typedef bind5< F,T1,T2,T3,T4,T5 > f_; + typedef typename apply_wrap5< f_,U1,U2,U3,U4,U5 >::type type; +}; + +} // namespace aux + +BOOST_MPL_AUX_ARITY_SPEC(6, bind5) +BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5) +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bind_fwd.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bind_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..962b5c98bc591079b17375590278460a1dc1e703 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bind_fwd.hpp @@ -0,0 +1,46 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "bind_fwd.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename F + > +struct bind0; + +template< + typename F, typename T1 + > +struct bind1; + +template< + typename F, typename T1, typename T2 + > +struct bind2; + +template< + typename F, typename T1, typename T2, typename T3 + > +struct bind3; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + > +struct bind4; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct bind5; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitand.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitand.hpp new file mode 100644 index 0000000000000000000000000000000000000000..527b6894fcd983413b0cefde7ca0cf125babc3d5 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitand.hpp @@ -0,0 +1,147 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Jaap Suter 2003 +// +// 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 "bitand.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct bitand_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< bitand_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< bitand_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct bitand_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct bitand_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct bitand_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct bitand_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + , typename N3 = na, typename N4 = na, typename N5 = na + > +struct bitand_ + : bitand_< bitand_< bitand_< bitand_< N1,N2 >, N3>, N4>, N5> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , bitand_ + , ( N1, N2, N3, N4, N5 ) + ) +}; + +template< + typename N1, typename N2, typename N3, typename N4 + > +struct bitand_< N1,N2,N3,N4,na > + + : bitand_< bitand_< bitand_< N1,N2 >, N3>, N4> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitand_ + , ( N1, N2, N3, N4, na ) + ) +}; + +template< + typename N1, typename N2, typename N3 + > +struct bitand_< N1,N2,N3,na,na > + + : bitand_< bitand_< N1,N2 >, N3> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitand_ + , ( N1, N2, N3, na, na ) + ) +}; + +template< + typename N1, typename N2 + > +struct bitand_< N1,N2,na,na,na > + : bitand_impl< + typename bitand_tag<N1>::type + , typename bitand_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitand_ + , ( N1, N2, na, na, na ) + ) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 5, bitand_) + +}} + +namespace boost { namespace mpl { +template<> +struct bitand_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + & BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitor.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3f0d5caa5a07b27cb35580394747c2a0975db515 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitor.hpp @@ -0,0 +1,147 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Jaap Suter 2003 +// +// 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 "bitor.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct bitor_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< bitor_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< bitor_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct bitor_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct bitor_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct bitor_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct bitor_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + , typename N3 = na, typename N4 = na, typename N5 = na + > +struct bitor_ + : bitor_< bitor_< bitor_< bitor_< N1,N2 >, N3>, N4>, N5> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , bitor_ + , ( N1, N2, N3, N4, N5 ) + ) +}; + +template< + typename N1, typename N2, typename N3, typename N4 + > +struct bitor_< N1,N2,N3,N4,na > + + : bitor_< bitor_< bitor_< N1,N2 >, N3>, N4> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitor_ + , ( N1, N2, N3, N4, na ) + ) +}; + +template< + typename N1, typename N2, typename N3 + > +struct bitor_< N1,N2,N3,na,na > + + : bitor_< bitor_< N1,N2 >, N3> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitor_ + , ( N1, N2, N3, na, na ) + ) +}; + +template< + typename N1, typename N2 + > +struct bitor_< N1,N2,na,na,na > + : bitor_impl< + typename bitor_tag<N1>::type + , typename bitor_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitor_ + , ( N1, N2, na, na, na ) + ) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 5, bitor_) + +}} + +namespace boost { namespace mpl { +template<> +struct bitor_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + | BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitxor.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitxor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..06996c03b895f657324f43aef9d8398519d47cc4 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/bitxor.hpp @@ -0,0 +1,147 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Jaap Suter 2003 +// +// 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 "bitxor.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct bitxor_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< bitxor_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< bitxor_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct bitxor_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct bitxor_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct bitxor_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct bitxor_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + , typename N3 = na, typename N4 = na, typename N5 = na + > +struct bitxor_ + : bitxor_< bitxor_< bitxor_< bitxor_< N1,N2 >, N3>, N4>, N5> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , bitxor_ + , ( N1, N2, N3, N4, N5 ) + ) +}; + +template< + typename N1, typename N2, typename N3, typename N4 + > +struct bitxor_< N1,N2,N3,N4,na > + + : bitxor_< bitxor_< bitxor_< N1,N2 >, N3>, N4> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitxor_ + , ( N1, N2, N3, N4, na ) + ) +}; + +template< + typename N1, typename N2, typename N3 + > +struct bitxor_< N1,N2,N3,na,na > + + : bitxor_< bitxor_< N1,N2 >, N3> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitxor_ + , ( N1, N2, N3, na, na ) + ) +}; + +template< + typename N1, typename N2 + > +struct bitxor_< N1,N2,na,na,na > + : bitxor_impl< + typename bitxor_tag<N1>::type + , typename bitxor_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , bitxor_ + , ( N1, N2, na, na, na ) + ) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 5, bitxor_) + +}} + +namespace boost { namespace mpl { +template<> +struct bitxor_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + ^ BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/deque.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/deque.hpp new file mode 100644 index 0000000000000000000000000000000000000000..06505c9360c5858046a0f29c73ddfcda546479a8 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/deque.hpp @@ -0,0 +1,323 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "deque.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na + , typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na + , typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na + , typename T12 = na, typename T13 = na, typename T14 = na + , typename T15 = na, typename T16 = na, typename T17 = na + , typename T18 = na, typename T19 = na + > +struct deque; + +template< + + > +struct deque< + na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector0< > +{ + typedef vector0< >::type type; +}; + +template< + typename T0 + > +struct deque< + T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector1<T0> +{ + typedef typename vector1<T0>::type type; +}; + +template< + typename T0, typename T1 + > +struct deque< + T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector2< T0,T1 > +{ + typedef typename vector2< T0,T1 >::type type; +}; + +template< + typename T0, typename T1, typename T2 + > +struct deque< + T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector3< T0,T1,T2 > +{ + typedef typename vector3< T0,T1,T2 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3 + > +struct deque< + T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector4< T0,T1,T2,T3 > +{ + typedef typename vector4< T0,T1,T2,T3 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + > +struct deque< + T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector5< T0,T1,T2,T3,T4 > +{ + typedef typename vector5< T0,T1,T2,T3,T4 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct deque< + T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector6< T0,T1,T2,T3,T4,T5 > +{ + typedef typename vector6< T0,T1,T2,T3,T4,T5 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector7< T0,T1,T2,T3,T4,T5,T6 > +{ + typedef typename vector7< T0,T1,T2,T3,T4,T5,T6 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector8< T0,T1,T2,T3,T4,T5,T6,T7 > +{ + typedef typename vector8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na + , na, na, na + > + : vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 > +{ + typedef typename vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na + , na, na, na + > + : vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 > +{ + typedef typename vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na + , na, na, na + > + : vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 > +{ + typedef typename vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na + , na, na, na, na + > + : vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 > +{ + typedef typename vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na + , na, na, na, na + > + : vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 > +{ + typedef typename vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na + , na, na, na, na + > + : vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 > +{ + typedef typename vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na + , na, na, na, na + > + : vector15< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + > +{ + typedef typename vector15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, na, na, na, na + > + : vector16< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15 + > +{ + typedef typename vector16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, na, na, na + > + : vector17< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16 + > +{ + typedef typename vector17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, na, na + > + : vector18< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17 + > +{ + typedef typename vector18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18 + > +struct deque< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, na + > + : vector19< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18 + > +{ + typedef typename vector19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18, typename T19 + > +struct deque + : vector20< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, T19 + > +{ + typedef typename vector20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/divides.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/divides.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6b4178a9c73f30082b14c78699c2edd28154d2b7 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/divides.hpp @@ -0,0 +1,146 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "divides.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct divides_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< divides_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< divides_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct divides_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct divides_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct divides_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct divides_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + , typename N3 = na, typename N4 = na, typename N5 = na + > +struct divides + : divides< divides< divides< divides< N1,N2 >, N3>, N4>, N5> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , divides + , ( N1, N2, N3, N4, N5 ) + ) +}; + +template< + typename N1, typename N2, typename N3, typename N4 + > +struct divides< N1,N2,N3,N4,na > + + : divides< divides< divides< N1,N2 >, N3>, N4> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , divides + , ( N1, N2, N3, N4, na ) + ) +}; + +template< + typename N1, typename N2, typename N3 + > +struct divides< N1,N2,N3,na,na > + + : divides< divides< N1,N2 >, N3> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , divides + , ( N1, N2, N3, na, na ) + ) +}; + +template< + typename N1, typename N2 + > +struct divides< N1,N2,na,na,na > + : divides_impl< + typename divides_tag<N1>::type + , typename divides_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , divides + , ( N1, N2, na, na, na ) + ) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 5, divides) + +}} + +namespace boost { namespace mpl { +template<> +struct divides_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + / BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/equal_to.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/equal_to.hpp new file mode 100644 index 0000000000000000000000000000000000000000..901a93c2f4d46c61e0b3b3517beb47ff383523f4 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/equal_to.hpp @@ -0,0 +1,94 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "equal_to.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct equal_to_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< equal_to_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< equal_to_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct equal_to_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct equal_to_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct equal_to_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct equal_to_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct equal_to + + : equal_to_impl< + typename equal_to_tag<N1>::type + , typename equal_to_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, equal_to, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, equal_to) + +}} + +namespace boost { namespace mpl { + +template<> +struct equal_to_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value == BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/fold_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..45ab4e7c6deada064fdb73816941019900b2299a --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/fold_impl.hpp @@ -0,0 +1,180 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "fold_impl.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +/// forward declaration + +template< + int N + , typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl< 0,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef state0 state; + typedef iter0 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl< 1,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1; + typedef typename mpl::next<iter0>::type iter1; + + + typedef state1 state; + typedef iter1 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl< 2,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2; + typedef typename mpl::next<iter1>::type iter2; + + + typedef state2 state; + typedef iter2 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl< 3,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3; + typedef typename mpl::next<iter2>::type iter3; + + + typedef state3 state; + typedef iter3 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl< 4,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp, state0, typename deref<iter0>::type >::type state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp, state1, typename deref<iter1>::type >::type state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp, state2, typename deref<iter2>::type >::type state3; + typedef typename mpl::next<iter2>::type iter3; + typedef typename apply2< ForwardOp, state3, typename deref<iter3>::type >::type state4; + typedef typename mpl::next<iter3>::type iter4; + + + typedef state4 state; + typedef iter4 iterator; +}; + +template< + int N + , typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl +{ + typedef fold_impl< + 4 + , First + , Last + , State + , ForwardOp + > chunk_; + + typedef fold_impl< + ( (N - 4) < 0 ? 0 : N - 4 ) + , typename chunk_::iterator + , Last + , typename chunk_::state + , ForwardOp + > res_; + + typedef typename res_::state state; + typedef typename res_::iterator iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct fold_impl< -1,First,Last,State,ForwardOp > + : fold_impl< + -1 + , typename mpl::next<First>::type + , Last + , typename apply2<ForwardOp,State, typename deref<First>::type>::type + , ForwardOp + > +{ +}; + +template< + typename Last + , typename State + , typename ForwardOp + > +struct fold_impl< -1,Last,Last,State,ForwardOp > +{ + typedef State state; + typedef Last iterator; +}; + +}}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/full_lambda.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/full_lambda.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8b2bf590632bc166b4157fe6cc6da79cfb3b4f54 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/full_lambda.hpp @@ -0,0 +1,558 @@ + +// 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) +// + +// *Preprocessed* version of the main "full_lambda.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +namespace aux { + +template< + bool C1 = false, bool C2 = false, bool C3 = false, bool C4 = false + , bool C5 = false + > +struct lambda_or + : true_ +{ +}; + +template<> +struct lambda_or< false,false,false,false,false > + : false_ +{ +}; + +} // namespace aux + +template< + typename T + , typename Tag + , typename Arity + > +struct lambda +{ + typedef false_ is_le; + typedef T result_; + typedef T type; +}; + +template< + typename T + > +struct is_lambda_expression + : lambda<T>::is_le +{ +}; + +template< int N, typename Tag > +struct lambda< arg<N>,Tag, int_< -1 > > +{ + typedef true_ is_le; + typedef mpl::arg<N> result_; // qualified for the sake of MIPSpro 7.41 + typedef mpl::protect<result_> type; +}; + +template< + typename F + , typename Tag + > +struct lambda< + bind0<F> + , Tag + , int_<1> + > +{ + typedef false_ is_le; + typedef bind0< + F + > result_; + + typedef result_ type; +}; + +namespace aux { + +template< + typename IsLE, typename Tag + , template< typename P1 > class F + , typename L1 + > +struct le_result1 +{ + typedef F< + typename L1::type + > result_; + + typedef result_ type; +}; + +template< + typename Tag + , template< typename P1 > class F + , typename L1 + > +struct le_result1< true_,Tag,F,L1 > +{ + typedef bind1< + quote1< F,Tag > + , typename L1::result_ + > result_; + + typedef mpl::protect<result_> type; +}; + +} // namespace aux + +template< + template< typename P1 > class F + , typename T1 + , typename Tag + > +struct lambda< + F<T1> + , Tag + , int_<1> + > +{ + typedef lambda< T1,Tag > l1; + typedef typename l1::is_le is_le1; + typedef typename aux::lambda_or< + is_le1::value + >::type is_le; + + typedef aux::le_result1< + is_le, Tag, F, l1 + > le_result_; + + typedef typename le_result_::result_ result_; + typedef typename le_result_::type type; +}; + +template< + typename F, typename T1 + , typename Tag + > +struct lambda< + bind1< F,T1 > + , Tag + , int_<2> + > +{ + typedef false_ is_le; + typedef bind1< + F + , T1 + > result_; + + typedef result_ type; +}; + +namespace aux { + +template< + typename IsLE, typename Tag + , template< typename P1, typename P2 > class F + , typename L1, typename L2 + > +struct le_result2 +{ + typedef F< + typename L1::type, typename L2::type + > result_; + + typedef result_ type; +}; + +template< + typename Tag + , template< typename P1, typename P2 > class F + , typename L1, typename L2 + > +struct le_result2< true_,Tag,F,L1,L2 > +{ + typedef bind2< + quote2< F,Tag > + , typename L1::result_, typename L2::result_ + > result_; + + typedef mpl::protect<result_> type; +}; + +} // namespace aux + +template< + template< typename P1, typename P2 > class F + , typename T1, typename T2 + , typename Tag + > +struct lambda< + F< T1,T2 > + , Tag + , int_<2> + > +{ + typedef lambda< T1,Tag > l1; + typedef lambda< T2,Tag > l2; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + + + typedef typename aux::lambda_or< + is_le1::value, is_le2::value + >::type is_le; + + typedef aux::le_result2< + is_le, Tag, F, l1, l2 + > le_result_; + + typedef typename le_result_::result_ result_; + typedef typename le_result_::type type; +}; + +template< + typename F, typename T1, typename T2 + , typename Tag + > +struct lambda< + bind2< F,T1,T2 > + , Tag + , int_<3> + > +{ + typedef false_ is_le; + typedef bind2< + F + , T1, T2 + > result_; + + typedef result_ type; +}; + +namespace aux { + +template< + typename IsLE, typename Tag + , template< typename P1, typename P2, typename P3 > class F + , typename L1, typename L2, typename L3 + > +struct le_result3 +{ + typedef F< + typename L1::type, typename L2::type, typename L3::type + > result_; + + typedef result_ type; +}; + +template< + typename Tag + , template< typename P1, typename P2, typename P3 > class F + , typename L1, typename L2, typename L3 + > +struct le_result3< true_,Tag,F,L1,L2,L3 > +{ + typedef bind3< + quote3< F,Tag > + , typename L1::result_, typename L2::result_, typename L3::result_ + > result_; + + typedef mpl::protect<result_> type; +}; + +} // namespace aux + +template< + template< typename P1, typename P2, typename P3 > class F + , typename T1, typename T2, typename T3 + , typename Tag + > +struct lambda< + F< T1,T2,T3 > + , Tag + , int_<3> + > +{ + typedef lambda< T1,Tag > l1; + typedef lambda< T2,Tag > l2; + typedef lambda< T3,Tag > l3; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + typedef typename l3::is_le is_le3; + + + typedef typename aux::lambda_or< + is_le1::value, is_le2::value, is_le3::value + >::type is_le; + + typedef aux::le_result3< + is_le, Tag, F, l1, l2, l3 + > le_result_; + + typedef typename le_result_::result_ result_; + typedef typename le_result_::type type; +}; + +template< + typename F, typename T1, typename T2, typename T3 + , typename Tag + > +struct lambda< + bind3< F,T1,T2,T3 > + , Tag + , int_<4> + > +{ + typedef false_ is_le; + typedef bind3< + F + , T1, T2, T3 + > result_; + + typedef result_ type; +}; + +namespace aux { + +template< + typename IsLE, typename Tag + , template< typename P1, typename P2, typename P3, typename P4 > class F + , typename L1, typename L2, typename L3, typename L4 + > +struct le_result4 +{ + typedef F< + typename L1::type, typename L2::type, typename L3::type + , typename L4::type + > result_; + + typedef result_ type; +}; + +template< + typename Tag + , template< typename P1, typename P2, typename P3, typename P4 > class F + , typename L1, typename L2, typename L3, typename L4 + > +struct le_result4< true_,Tag,F,L1,L2,L3,L4 > +{ + typedef bind4< + quote4< F,Tag > + , typename L1::result_, typename L2::result_, typename L3::result_ + , typename L4::result_ + > result_; + + typedef mpl::protect<result_> type; +}; + +} // namespace aux + +template< + template< typename P1, typename P2, typename P3, typename P4 > class F + , typename T1, typename T2, typename T3, typename T4 + , typename Tag + > +struct lambda< + F< T1,T2,T3,T4 > + , Tag + , int_<4> + > +{ + typedef lambda< T1,Tag > l1; + typedef lambda< T2,Tag > l2; + typedef lambda< T3,Tag > l3; + typedef lambda< T4,Tag > l4; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + typedef typename l3::is_le is_le3; + typedef typename l4::is_le is_le4; + + + typedef typename aux::lambda_or< + is_le1::value, is_le2::value, is_le3::value, is_le4::value + >::type is_le; + + typedef aux::le_result4< + is_le, Tag, F, l1, l2, l3, l4 + > le_result_; + + typedef typename le_result_::result_ result_; + typedef typename le_result_::type type; +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename Tag + > +struct lambda< + bind4< F,T1,T2,T3,T4 > + , Tag + , int_<5> + > +{ + typedef false_ is_le; + typedef bind4< + F + , T1, T2, T3, T4 + > result_; + + typedef result_ type; +}; + +namespace aux { + +template< + typename IsLE, typename Tag + , template< typename P1, typename P2, typename P3, typename P4, typename P5 > class F + , typename L1, typename L2, typename L3, typename L4, typename L5 + > +struct le_result5 +{ + typedef F< + typename L1::type, typename L2::type, typename L3::type + , typename L4::type, typename L5::type + > result_; + + typedef result_ type; +}; + +template< + typename Tag + , template< typename P1, typename P2, typename P3, typename P4, typename P5 > class F + , typename L1, typename L2, typename L3, typename L4, typename L5 + > +struct le_result5< true_,Tag,F,L1,L2,L3,L4,L5 > +{ + typedef bind5< + quote5< F,Tag > + , typename L1::result_, typename L2::result_, typename L3::result_ + , typename L4::result_, typename L5::result_ + > result_; + + typedef mpl::protect<result_> type; +}; + +} // namespace aux + +template< + template< + typename P1, typename P2, typename P3, typename P4 + , typename P5 + > + class F + , typename T1, typename T2, typename T3, typename T4, typename T5 + , typename Tag + > +struct lambda< + F< T1,T2,T3,T4,T5 > + , Tag + , int_<5> + > +{ + typedef lambda< T1,Tag > l1; + typedef lambda< T2,Tag > l2; + typedef lambda< T3,Tag > l3; + typedef lambda< T4,Tag > l4; + typedef lambda< T5,Tag > l5; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + typedef typename l3::is_le is_le3; + typedef typename l4::is_le is_le4; + typedef typename l5::is_le is_le5; + + + typedef typename aux::lambda_or< + is_le1::value, is_le2::value, is_le3::value, is_le4::value + , is_le5::value + >::type is_le; + + typedef aux::le_result5< + is_le, Tag, F, l1, l2, l3, l4, l5 + > le_result_; + + typedef typename le_result_::result_ result_; + typedef typename le_result_::type type; +}; + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + , typename Tag + > +struct lambda< + bind5< F,T1,T2,T3,T4,T5 > + , Tag + , int_<6> + > +{ + typedef false_ is_le; + typedef bind5< + F + , T1, T2, T3, T4, T5 + > result_; + + typedef result_ type; +}; + +/// special case for 'protect' +template< typename T, typename Tag > +struct lambda< mpl::protect<T>,Tag, int_<1> > +{ + typedef false_ is_le; + typedef mpl::protect<T> result_; + typedef result_ type; +}; + +/// specializations for the main 'bind' form + +template< + typename F, typename T1, typename T2, typename T3, typename T4 + , typename T5 + , typename Tag + > +struct lambda< + bind< F,T1,T2,T3,T4,T5 > + , Tag + , int_<6> + > +{ + typedef false_ is_le; + typedef bind< F,T1,T2,T3,T4,T5 > result_; + typedef result_ type; +}; + +template< + typename F + , typename Tag1 + , typename Tag2 + , typename Arity + > +struct lambda< + lambda< F,Tag1,Arity > + , Tag2 + , int_<3> + > +{ + typedef lambda< F,Tag2 > l1; + typedef lambda< Tag1,Tag2 > l2; + typedef typename l1::is_le is_le; + typedef bind1< quote1<aux::template_arity>, typename l1::result_ > arity_; + typedef lambda< typename if_< is_le,arity_,Arity >::type, Tag2 > l3; + typedef aux::le_result3<is_le, Tag2, mpl::lambda, l1, l2, l3> le_result_; + typedef typename le_result_::result_ result_; + typedef typename le_result_::type type; +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 3, lambda) + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/greater.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/greater.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3d1c3dcead484c8ce7f6bb9812853de006ce83bb --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/greater.hpp @@ -0,0 +1,94 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "greater.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct greater_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< greater_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< greater_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct greater_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct greater_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct greater_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct greater_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct greater + + : greater_impl< + typename greater_tag<N1>::type + , typename greater_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, greater, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, greater) + +}} + +namespace boost { namespace mpl { + +template<> +struct greater_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value > BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/greater_equal.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/greater_equal.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fb011866e77804060fb6e8cf1597d69c618c13ae --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/greater_equal.hpp @@ -0,0 +1,94 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "greater_equal.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct greater_equal_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< greater_equal_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< greater_equal_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct greater_equal_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct greater_equal_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct greater_equal_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct greater_equal_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct greater_equal + + : greater_equal_impl< + typename greater_equal_tag<N1>::type + , typename greater_equal_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, greater_equal, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, greater_equal) + +}} + +namespace boost { namespace mpl { + +template<> +struct greater_equal_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value >= BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/inherit.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/inherit.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6adcc0142e39fff1e4e38e183fba8d65b9a5f6c9 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/inherit.hpp @@ -0,0 +1,139 @@ + +// 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) +// + +// *Preprocessed* version of the main "inherit.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename BOOST_MPL_AUX_NA_PARAM(T1) + , typename BOOST_MPL_AUX_NA_PARAM(T2) + > +struct inherit2 + : T1, T2 +{ + typedef inherit2 type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, inherit2, (T1, T2)) +}; + +template< typename T1 > +struct inherit2< T1,empty_base > +{ + typedef T1 type; + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (T1, empty_base)) +}; + +template< typename T2 > +struct inherit2< empty_base,T2 > +{ + typedef T2 type; + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base, T2)) +}; + +template<> +struct inherit2< empty_base,empty_base > +{ + typedef empty_base type; + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2, inherit2, (empty_base, empty_base)) +}; + +BOOST_MPL_AUX_NA_SPEC(2, inherit2) + +template< + typename T1 = na, typename T2 = na, typename T3 = na + > +struct inherit3 + : inherit2< + typename inherit2< + T1, T2 + >::type + , T3 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 3 + , inherit3 + , ( T1, T2, T3) + ) +}; + +BOOST_MPL_AUX_NA_SPEC(3, inherit3) + +template< + typename T1 = na, typename T2 = na, typename T3 = na, typename T4 = na + > +struct inherit4 + : inherit2< + typename inherit3< + T1, T2, T3 + >::type + , T4 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 4 + , inherit4 + , ( T1, T2, T3, T4) + ) +}; + +BOOST_MPL_AUX_NA_SPEC(4, inherit4) + +template< + typename T1 = na, typename T2 = na, typename T3 = na, typename T4 = na + , typename T5 = na + > +struct inherit5 + : inherit2< + typename inherit4< + T1, T2, T3, T4 + >::type + , T5 + > +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , inherit5 + , ( T1, T2, T3, T4, T5) + ) +}; + +BOOST_MPL_AUX_NA_SPEC(5, inherit5) + +/// primary template + +template< + typename T1 = empty_base, typename T2 = empty_base + , typename T3 = empty_base, typename T4 = empty_base + , typename T5 = empty_base + > +struct inherit + : inherit5< T1,T2,T3,T4,T5 > +{ +}; + +template<> +struct inherit< na,na,na,na,na > +{ + template< + + typename T1, typename T2, typename T3, typename T4, typename T5 + + > + struct apply + : inherit< T1,T2,T3,T4,T5 > + { + }; +}; + +BOOST_MPL_AUX_NA_SPEC_LAMBDA(5, inherit) +BOOST_MPL_AUX_NA_SPEC_ARITY(5, inherit) +BOOST_MPL_AUX_NA_SPEC_TEMPLATE_ARITY(5, 5, inherit) +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_if_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_if_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b767e95862486cb43c8cfef4719fb39eff92b15a --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_if_impl.hpp @@ -0,0 +1,133 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// Copyright David Abrahams 2001-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) +// + +// *Preprocessed* version of the main "iter_fold_if_impl.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +template< typename Iterator, typename State > +struct iter_fold_if_null_step +{ + typedef State state; + typedef Iterator iterator; +}; + +template< bool > +struct iter_fold_if_step_impl +{ + template< + typename Iterator + , typename State + , typename StateOp + , typename IteratorOp + > + struct result_ + { + typedef typename apply2< StateOp,State,Iterator >::type state; + typedef typename IteratorOp::type iterator; + }; +}; + +template<> +struct iter_fold_if_step_impl<false> +{ + template< + typename Iterator + , typename State + , typename StateOp + , typename IteratorOp + > + struct result_ + { + typedef State state; + typedef Iterator iterator; + }; +}; + +template< + typename Iterator + , typename State + , typename ForwardOp + , typename Predicate + > +struct iter_fold_if_forward_step +{ + typedef typename apply2< Predicate,State,Iterator >::type not_last; + typedef typename iter_fold_if_step_impl< + BOOST_MPL_AUX_MSVC_VALUE_WKND(not_last)::value + >::template result_< Iterator,State,ForwardOp, mpl::next<Iterator> > impl_; + + typedef typename impl_::state state; + typedef typename impl_::iterator iterator; +}; + +template< + typename Iterator + , typename State + , typename BackwardOp + , typename Predicate + > +struct iter_fold_if_backward_step +{ + typedef typename apply2< Predicate,State,Iterator >::type not_last; + typedef typename iter_fold_if_step_impl< + BOOST_MPL_AUX_MSVC_VALUE_WKND(not_last)::value + >::template result_< Iterator,State,BackwardOp, identity<Iterator> > impl_; + + typedef typename impl_::state state; + typedef typename impl_::iterator iterator; +}; + +template< + typename Iterator + , typename State + , typename ForwardOp + , typename ForwardPredicate + , typename BackwardOp + , typename BackwardPredicate + > +struct iter_fold_if_impl +{ + private: + typedef iter_fold_if_null_step< Iterator,State > forward_step0; + typedef iter_fold_if_forward_step< typename forward_step0::iterator, typename forward_step0::state, ForwardOp, ForwardPredicate > forward_step1; + typedef iter_fold_if_forward_step< typename forward_step1::iterator, typename forward_step1::state, ForwardOp, ForwardPredicate > forward_step2; + typedef iter_fold_if_forward_step< typename forward_step2::iterator, typename forward_step2::state, ForwardOp, ForwardPredicate > forward_step3; + typedef iter_fold_if_forward_step< typename forward_step3::iterator, typename forward_step3::state, ForwardOp, ForwardPredicate > forward_step4; + + + typedef typename if_< + typename forward_step4::not_last + , iter_fold_if_impl< + typename forward_step4::iterator + , typename forward_step4::state + , ForwardOp + , ForwardPredicate + , BackwardOp + , BackwardPredicate + > + , iter_fold_if_null_step< + typename forward_step4::iterator + , typename forward_step4::state + > + >::type backward_step4; + + typedef iter_fold_if_backward_step< typename forward_step3::iterator, typename backward_step4::state, BackwardOp, BackwardPredicate > backward_step3; + typedef iter_fold_if_backward_step< typename forward_step2::iterator, typename backward_step3::state, BackwardOp, BackwardPredicate > backward_step2; + typedef iter_fold_if_backward_step< typename forward_step1::iterator, typename backward_step2::state, BackwardOp, BackwardPredicate > backward_step1; + typedef iter_fold_if_backward_step< typename forward_step0::iterator, typename backward_step1::state, BackwardOp, BackwardPredicate > backward_step0; + + + public: + typedef typename backward_step0::state state; + typedef typename backward_step4::iterator iterator; +}; + +}}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1dd216c8aa7cc602ede9a50349e69a924853fff4 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_impl.hpp @@ -0,0 +1,180 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "iter_fold_impl.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +/// forward declaration + +template< + int N + , typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl< 0,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef state0 state; + typedef iter0 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl< 1,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp,state0,iter0 >::type state1; + typedef typename mpl::next<iter0>::type iter1; + + + typedef state1 state; + typedef iter1 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl< 2,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp,state0,iter0 >::type state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp,state1,iter1 >::type state2; + typedef typename mpl::next<iter1>::type iter2; + + + typedef state2 state; + typedef iter2 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl< 3,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp,state0,iter0 >::type state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp,state1,iter1 >::type state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp,state2,iter2 >::type state3; + typedef typename mpl::next<iter2>::type iter3; + + + typedef state3 state; + typedef iter3 iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl< 4,First,Last,State,ForwardOp > +{ + typedef First iter0; + typedef State state0; + typedef typename apply2< ForwardOp,state0,iter0 >::type state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp,state1,iter1 >::type state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp,state2,iter2 >::type state3; + typedef typename mpl::next<iter2>::type iter3; + typedef typename apply2< ForwardOp,state3,iter3 >::type state4; + typedef typename mpl::next<iter3>::type iter4; + + + typedef state4 state; + typedef iter4 iterator; +}; + +template< + int N + , typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl +{ + typedef iter_fold_impl< + 4 + , First + , Last + , State + , ForwardOp + > chunk_; + + typedef iter_fold_impl< + ( (N - 4) < 0 ? 0 : N - 4 ) + , typename chunk_::iterator + , Last + , typename chunk_::state + , ForwardOp + > res_; + + typedef typename res_::state state; + typedef typename res_::iterator iterator; +}; + +template< + typename First + , typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl< -1,First,Last,State,ForwardOp > + : iter_fold_impl< + -1 + , typename mpl::next<First>::type + , Last + , typename apply2< ForwardOp,State,First >::type + , ForwardOp + > +{ +}; + +template< + typename Last + , typename State + , typename ForwardOp + > +struct iter_fold_impl< -1,Last,Last,State,ForwardOp > +{ + typedef State state; + typedef Last iterator; +}; + +}}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/lambda_no_ctps.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/lambda_no_ctps.hpp new file mode 100644 index 0000000000000000000000000000000000000000..75b30ce32f8c40f83690adf02b57259c82b9c931 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/lambda_no_ctps.hpp @@ -0,0 +1,229 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "lambda_no_ctps.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +namespace aux { + +template< + bool C1 = false, bool C2 = false, bool C3 = false, bool C4 = false + , bool C5 = false + > +struct lambda_or + : true_ +{ +}; + +template<> +struct lambda_or< false,false,false,false,false > + : false_ +{ +}; + +template< typename Arity > struct lambda_impl +{ + template< typename T, typename Tag, typename Protect > struct result_ + { + typedef T type; + typedef is_placeholder<T> is_le; + }; +}; + +template<> struct lambda_impl< int_<1> > +{ + template< typename F, typename Tag, typename Protect > struct result_ + { + typedef lambda< typename F::arg1, Tag, false_ > l1; + typedef typename l1::is_le is_le1; + typedef aux::lambda_or< + BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value + > is_le; + + typedef bind1< + typename F::rebind + , typename l1::type + > bind_; + + typedef typename if_< + is_le + , if_< Protect, mpl::protect<bind_>, bind_ > + , identity<F> + >::type type_; + + typedef typename type_::type type; + }; +}; + +template<> struct lambda_impl< int_<2> > +{ + template< typename F, typename Tag, typename Protect > struct result_ + { + typedef lambda< typename F::arg1, Tag, false_ > l1; + typedef lambda< typename F::arg2, Tag, false_ > l2; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + + + typedef aux::lambda_or< + BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value + > is_le; + + typedef bind2< + typename F::rebind + , typename l1::type, typename l2::type + > bind_; + + typedef typename if_< + is_le + , if_< Protect, mpl::protect<bind_>, bind_ > + , identity<F> + >::type type_; + + typedef typename type_::type type; + }; +}; + +template<> struct lambda_impl< int_<3> > +{ + template< typename F, typename Tag, typename Protect > struct result_ + { + typedef lambda< typename F::arg1, Tag, false_ > l1; + typedef lambda< typename F::arg2, Tag, false_ > l2; + typedef lambda< typename F::arg3, Tag, false_ > l3; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + typedef typename l3::is_le is_le3; + + + typedef aux::lambda_or< + BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le3)::value + > is_le; + + typedef bind3< + typename F::rebind + , typename l1::type, typename l2::type, typename l3::type + > bind_; + + typedef typename if_< + is_le + , if_< Protect, mpl::protect<bind_>, bind_ > + , identity<F> + >::type type_; + + typedef typename type_::type type; + }; +}; + +template<> struct lambda_impl< int_<4> > +{ + template< typename F, typename Tag, typename Protect > struct result_ + { + typedef lambda< typename F::arg1, Tag, false_ > l1; + typedef lambda< typename F::arg2, Tag, false_ > l2; + typedef lambda< typename F::arg3, Tag, false_ > l3; + typedef lambda< typename F::arg4, Tag, false_ > l4; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + typedef typename l3::is_le is_le3; + typedef typename l4::is_le is_le4; + + + typedef aux::lambda_or< + BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le3)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le4)::value + > is_le; + + typedef bind4< + typename F::rebind + , typename l1::type, typename l2::type, typename l3::type + , typename l4::type + > bind_; + + typedef typename if_< + is_le + , if_< Protect, mpl::protect<bind_>, bind_ > + , identity<F> + >::type type_; + + typedef typename type_::type type; + }; +}; + +template<> struct lambda_impl< int_<5> > +{ + template< typename F, typename Tag, typename Protect > struct result_ + { + typedef lambda< typename F::arg1, Tag, false_ > l1; + typedef lambda< typename F::arg2, Tag, false_ > l2; + typedef lambda< typename F::arg3, Tag, false_ > l3; + typedef lambda< typename F::arg4, Tag, false_ > l4; + typedef lambda< typename F::arg5, Tag, false_ > l5; + + typedef typename l1::is_le is_le1; + typedef typename l2::is_le is_le2; + typedef typename l3::is_le is_le3; + typedef typename l4::is_le is_le4; + typedef typename l5::is_le is_le5; + + + typedef aux::lambda_or< + BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le3)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le4)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le5)::value + > is_le; + + typedef bind5< + typename F::rebind + , typename l1::type, typename l2::type, typename l3::type + , typename l4::type, typename l5::type + > bind_; + + typedef typename if_< + is_le + , if_< Protect, mpl::protect<bind_>, bind_ > + , identity<F> + >::type type_; + + typedef typename type_::type type; + }; +}; + +} // namespace aux + +template< + typename T + , typename Tag + , typename Protect + > +struct lambda +{ + /// Metafunction forwarding confuses MSVC 6.x + typedef typename aux::template_arity<T>::type arity_; + typedef typename aux::lambda_impl<arity_> + ::template result_< T,Tag,Protect > l_; + + typedef typename l_::type type; + typedef typename l_::is_le is_le; + BOOST_MPL_AUX_LAMBDA_SUPPORT(3, lambda, (T, Tag, Protect)) +}; + +BOOST_MPL_AUX_NA_SPEC2(1, 3, lambda) + +template< + typename T + > +struct is_lambda_expression + : lambda<T>::is_le +{ +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/less.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/less.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0b6ce1d4bf0b8260e07ee95950562b6f96bd23de --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/less.hpp @@ -0,0 +1,94 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "less.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct less_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< less_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< less_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct less_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct less_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct less_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct less_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct less + + : less_impl< + typename less_tag<N1>::type + , typename less_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, less) + +}} + +namespace boost { namespace mpl { + +template<> +struct less_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : bool_< ( BOOST_MPL_AUX_VALUE_WKND(N2)::value > BOOST_MPL_AUX_VALUE_WKND(N1)::value ) > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/less_equal.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/less_equal.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0010e084514944e0b4a5d7f87ae13111a25fb4db --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/less_equal.hpp @@ -0,0 +1,94 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "less_equal.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct less_equal_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< less_equal_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< less_equal_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct less_equal_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct less_equal_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct less_equal_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct less_equal_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct less_equal + + : less_equal_impl< + typename less_equal_tag<N1>::type + , typename less_equal_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less_equal, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, less_equal) + +}} + +namespace boost { namespace mpl { + +template<> +struct less_equal_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value <= BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/list.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/list.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cbd58acd863f3a9102692afcc9584aaae1cc1757 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/list.hpp @@ -0,0 +1,323 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "list.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na + , typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na + , typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na + , typename T12 = na, typename T13 = na, typename T14 = na + , typename T15 = na, typename T16 = na, typename T17 = na + , typename T18 = na, typename T19 = na + > +struct list; + +template< + + > +struct list< + na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list0< > +{ + typedef list0< >::type type; +}; + +template< + typename T0 + > +struct list< + T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list1<T0> +{ + typedef typename list1<T0>::type type; +}; + +template< + typename T0, typename T1 + > +struct list< + T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list2< T0,T1 > +{ + typedef typename list2< T0,T1 >::type type; +}; + +template< + typename T0, typename T1, typename T2 + > +struct list< + T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list3< T0,T1,T2 > +{ + typedef typename list3< T0,T1,T2 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3 + > +struct list< + T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list4< T0,T1,T2,T3 > +{ + typedef typename list4< T0,T1,T2,T3 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + > +struct list< + T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list5< T0,T1,T2,T3,T4 > +{ + typedef typename list5< T0,T1,T2,T3,T4 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct list< + T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list6< T0,T1,T2,T3,T4,T5 > +{ + typedef typename list6< T0,T1,T2,T3,T4,T5 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list7< T0,T1,T2,T3,T4,T5,T6 > +{ + typedef typename list7< T0,T1,T2,T3,T4,T5,T6 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na + , na, na, na + > + : list8< T0,T1,T2,T3,T4,T5,T6,T7 > +{ + typedef typename list8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na + , na, na, na + > + : list9< T0,T1,T2,T3,T4,T5,T6,T7,T8 > +{ + typedef typename list9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na + , na, na, na + > + : list10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 > +{ + typedef typename list10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na + , na, na, na + > + : list11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 > +{ + typedef typename list11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na + , na, na, na, na + > + : list12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 > +{ + typedef typename list12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na + , na, na, na, na + > + : list13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 > +{ + typedef typename list13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na + , na, na, na, na + > + : list14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 > +{ + typedef typename list14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na + , na, na, na, na + > + : list15< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + > +{ + typedef typename list15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, na, na, na, na + > + : list16< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15 + > +{ + typedef typename list16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, na, na, na + > + : list17< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16 + > +{ + typedef typename list17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, na, na + > + : list18< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17 + > +{ + typedef typename list18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18 + > +struct list< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, na + > + : list19< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18 + > +{ + typedef typename list19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18, typename T19 + > +struct list + : list20< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, T19 + > +{ + typedef typename list20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/list_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/list_c.hpp new file mode 100644 index 0000000000000000000000000000000000000000..495c3f7f19d5e8698138ffa6b5c4ae40fcc2cf8d --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/list_c.hpp @@ -0,0 +1,328 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "list_c.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T, long C0 = LONG_MAX, long C1 = LONG_MAX, long C2 = LONG_MAX + , long C3 = LONG_MAX, long C4 = LONG_MAX, long C5 = LONG_MAX + , long C6 = LONG_MAX, long C7 = LONG_MAX, long C8 = LONG_MAX + , long C9 = LONG_MAX, long C10 = LONG_MAX, long C11 = LONG_MAX + , long C12 = LONG_MAX, long C13 = LONG_MAX, long C14 = LONG_MAX + , long C15 = LONG_MAX, long C16 = LONG_MAX, long C17 = LONG_MAX + , long C18 = LONG_MAX, long C19 = LONG_MAX + > +struct list_c; + +template< + typename T + > +struct list_c< + T, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list0_c<T> +{ + typedef typename list0_c<T>::type type; +}; + +template< + typename T, long C0 + > +struct list_c< + T, C0, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list1_c< T,C0 > +{ + typedef typename list1_c< T,C0 >::type type; +}; + +template< + typename T, long C0, long C1 + > +struct list_c< + T, C0, C1, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list2_c< T,C0,C1 > +{ + typedef typename list2_c< T,C0,C1 >::type type; +}; + +template< + typename T, long C0, long C1, long C2 + > +struct list_c< + T, C0, C1, C2, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list3_c< T,C0,C1,C2 > +{ + typedef typename list3_c< T,C0,C1,C2 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3 + > +struct list_c< + T, C0, C1, C2, C3, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list4_c< T,C0,C1,C2,C3 > +{ + typedef typename list4_c< T,C0,C1,C2,C3 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4 + > +struct list_c< + T, C0, C1, C2, C3, C4, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list5_c< T,C0,C1,C2,C3,C4 > +{ + typedef typename list5_c< T,C0,C1,C2,C3,C4 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX + > + : list6_c< T,C0,C1,C2,C3,C4,C5 > +{ + typedef typename list6_c< T,C0,C1,C2,C3,C4,C5 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX + > + : list7_c< T,C0,C1,C2,C3,C4,C5,C6 > +{ + typedef typename list7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX + > + : list8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > +{ + typedef typename list8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX + > + : list9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > +{ + typedef typename list9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX + > + : list10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > +{ + typedef typename list10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > +{ + typedef typename list11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > +{ + typedef typename list12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > +{ + typedef typename list13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list14_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + > +{ + typedef typename list14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list15_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + > +{ + typedef typename list15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : list16_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15 + > +{ + typedef typename list16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX + > + : list17_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16 + > +{ + typedef typename list17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, LONG_MAX, LONG_MAX + > + : list18_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17 + > +{ + typedef typename list18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17, long C18 + > +struct list_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, C18, LONG_MAX + > + : list19_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, C18 + > +{ + typedef typename list19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17, long C18, long C19 + > +struct list_c + : list20_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, C18, C19 + > +{ + typedef typename list20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/map.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..80ef156e4957b06f5da9d5323e03561068c06ca4 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/map.hpp @@ -0,0 +1,323 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "map.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na + , typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na + , typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na + , typename T12 = na, typename T13 = na, typename T14 = na + , typename T15 = na, typename T16 = na, typename T17 = na + , typename T18 = na, typename T19 = na + > +struct map; + +template< + + > +struct map< + na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map0< > +{ + typedef map0< >::type type; +}; + +template< + typename T0 + > +struct map< + T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map1<T0> +{ + typedef typename map1<T0>::type type; +}; + +template< + typename T0, typename T1 + > +struct map< + T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map2< T0,T1 > +{ + typedef typename map2< T0,T1 >::type type; +}; + +template< + typename T0, typename T1, typename T2 + > +struct map< + T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map3< T0,T1,T2 > +{ + typedef typename map3< T0,T1,T2 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3 + > +struct map< + T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map4< T0,T1,T2,T3 > +{ + typedef typename map4< T0,T1,T2,T3 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + > +struct map< + T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map5< T0,T1,T2,T3,T4 > +{ + typedef typename map5< T0,T1,T2,T3,T4 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct map< + T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map6< T0,T1,T2,T3,T4,T5 > +{ + typedef typename map6< T0,T1,T2,T3,T4,T5 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map7< T0,T1,T2,T3,T4,T5,T6 > +{ + typedef typename map7< T0,T1,T2,T3,T4,T5,T6 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na + , na, na, na + > + : map8< T0,T1,T2,T3,T4,T5,T6,T7 > +{ + typedef typename map8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na + , na, na, na + > + : map9< T0,T1,T2,T3,T4,T5,T6,T7,T8 > +{ + typedef typename map9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na + , na, na, na + > + : map10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 > +{ + typedef typename map10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na + , na, na, na + > + : map11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 > +{ + typedef typename map11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na + , na, na, na, na + > + : map12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 > +{ + typedef typename map12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na + , na, na, na, na + > + : map13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 > +{ + typedef typename map13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na + , na, na, na, na + > + : map14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 > +{ + typedef typename map14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na + , na, na, na, na + > + : map15< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + > +{ + typedef typename map15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, na, na, na, na + > + : map16< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15 + > +{ + typedef typename map16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, na, na, na + > + : map17< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16 + > +{ + typedef typename map17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, na, na + > + : map18< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17 + > +{ + typedef typename map18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18 + > +struct map< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, na + > + : map19< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18 + > +{ + typedef typename map19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18, typename T19 + > +struct map + : map20< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, T19 + > +{ + typedef typename map20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/minus.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/minus.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cfddc15b78755ed62e6168531ce47bc77f2cade1 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/minus.hpp @@ -0,0 +1,146 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "minus.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct minus_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< minus_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< minus_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct minus_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct minus_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct minus_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct minus_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + , typename N3 = na, typename N4 = na, typename N5 = na + > +struct minus + : minus< minus< minus< minus< N1,N2 >, N3>, N4>, N5> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , minus + , ( N1, N2, N3, N4, N5 ) + ) +}; + +template< + typename N1, typename N2, typename N3, typename N4 + > +struct minus< N1,N2,N3,N4,na > + + : minus< minus< minus< N1,N2 >, N3>, N4> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , minus + , ( N1, N2, N3, N4, na ) + ) +}; + +template< + typename N1, typename N2, typename N3 + > +struct minus< N1,N2,N3,na,na > + + : minus< minus< N1,N2 >, N3> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , minus + , ( N1, N2, N3, na, na ) + ) +}; + +template< + typename N1, typename N2 + > +struct minus< N1,N2,na,na,na > + : minus_impl< + typename minus_tag<N1>::type + , typename minus_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , minus + , ( N1, N2, na, na, na ) + ) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 5, minus) + +}} + +namespace boost { namespace mpl { +template<> +struct minus_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + - BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/modulus.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/modulus.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eb5eff07e295b6a53f77af69c694d1f9e26a4a30 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/modulus.hpp @@ -0,0 +1,101 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "modulus.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct modulus_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< modulus_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< modulus_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct modulus_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct modulus_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct modulus_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct modulus_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct modulus + + : modulus_impl< + typename modulus_tag<N1>::type + , typename modulus_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, modulus, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, modulus) + +}} + +namespace boost { namespace mpl { +template<> +struct modulus_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + % BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/not_equal_to.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/not_equal_to.hpp new file mode 100644 index 0000000000000000000000000000000000000000..68356eee4d8560224926e569d1d1a6eb01be0fa9 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/not_equal_to.hpp @@ -0,0 +1,94 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "not_equal_to.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct not_equal_to_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< not_equal_to_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< not_equal_to_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct not_equal_to_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct not_equal_to_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct not_equal_to_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct not_equal_to_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct not_equal_to + + : not_equal_to_impl< + typename not_equal_to_tag<N1>::type + , typename not_equal_to_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, not_equal_to, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, not_equal_to) + +}} + +namespace boost { namespace mpl { + +template<> +struct not_equal_to_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value != BOOST_MPL_AUX_VALUE_WKND(N2)::value ) > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/or.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/or.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff7ce9fd5879e67ca2ed38f8907e03b1867c513d --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/or.hpp @@ -0,0 +1,69 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "or.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +namespace aux { + +template< bool C_, typename T1, typename T2, typename T3, typename T4 > +struct or_impl + : true_ +{ +}; + +template< typename T1, typename T2, typename T3, typename T4 > +struct or_impl< false,T1,T2,T3,T4 > + : or_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4 + , false_ + > +{ +}; + +template<> +struct or_impl< + false + , false_, false_, false_, false_ + > + : false_ +{ +}; + +} // namespace aux + +template< + typename BOOST_MPL_AUX_NA_PARAM(T1) + , typename BOOST_MPL_AUX_NA_PARAM(T2) + , typename T3 = false_, typename T4 = false_, typename T5 = false_ + > +struct or_ + + : aux::or_impl< + BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value + , T2, T3, T4, T5 + > + +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , or_ + , ( T1, T2, T3, T4, T5) + ) +}; + +BOOST_MPL_AUX_NA_SPEC2( + 2 + , 5 + , or_ + ) + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/placeholders.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/placeholders.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b306bbbcb9c2eb24c51be47cb649e379487b7489 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/placeholders.hpp @@ -0,0 +1,105 @@ + +// Copyright Aleksey Gurtovoy 2001-2004 +// Copyright Peter Dimov 2001-2003 +// +// 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 "placeholders.hpp" header +// -- DO NOT modify by hand! + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +typedef arg< -1 > _; +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +namespace boost { namespace mpl { + +BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_) + +namespace placeholders { +using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_; +} + +}} + +/// agurt, 17/mar/02: one more placeholder for the last 'apply#' +/// specialization +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +typedef arg<1> _1; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +namespace boost { namespace mpl { + +BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_1) + +namespace placeholders { +using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_1; +} + +}} +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +typedef arg<2> _2; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +namespace boost { namespace mpl { + +BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_2) + +namespace placeholders { +using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_2; +} + +}} +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +typedef arg<3> _3; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +namespace boost { namespace mpl { + +BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_3) + +namespace placeholders { +using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_3; +} + +}} +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +typedef arg<4> _4; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +namespace boost { namespace mpl { + +BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_4) + +namespace placeholders { +using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_4; +} + +}} +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +typedef arg<5> _5; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +namespace boost { namespace mpl { + +BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_5) + +namespace placeholders { +using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_5; +} + +}} +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN +typedef arg<6> _6; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +namespace boost { namespace mpl { + +BOOST_MPL_AUX_ARG_ADL_BARRIER_DECL(_6) + +namespace placeholders { +using BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::_6; +} + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/plus.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/plus.hpp new file mode 100644 index 0000000000000000000000000000000000000000..82539abc4c8e357d35a1e85784b46ef3c6a6881a --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/plus.hpp @@ -0,0 +1,146 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "plus.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct plus_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< plus_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< plus_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct plus_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct plus_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct plus_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct plus_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + , typename N3 = na, typename N4 = na, typename N5 = na + > +struct plus + : plus< plus< plus< plus< N1,N2 >, N3>, N4>, N5> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , plus + , ( N1, N2, N3, N4, N5 ) + ) +}; + +template< + typename N1, typename N2, typename N3, typename N4 + > +struct plus< N1,N2,N3,N4,na > + + : plus< plus< plus< N1,N2 >, N3>, N4> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , plus + , ( N1, N2, N3, N4, na ) + ) +}; + +template< + typename N1, typename N2, typename N3 + > +struct plus< N1,N2,N3,na,na > + + : plus< plus< N1,N2 >, N3> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , plus + , ( N1, N2, N3, na, na ) + ) +}; + +template< + typename N1, typename N2 + > +struct plus< N1,N2,na,na,na > + : plus_impl< + typename plus_tag<N1>::type + , typename plus_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , plus + , ( N1, N2, na, na, na ) + ) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 5, plus) + +}} + +namespace boost { namespace mpl { +template<> +struct plus_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + + BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/quote.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/quote.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7f9d18bc306a4cbb9c71a6a1acf6ecf97ae56623 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/quote.hpp @@ -0,0 +1,11 @@ + +// 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! + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_fold_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..372f0d260ae7993c0ed7e8add707af1875487d75 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_fold_impl.hpp @@ -0,0 +1,295 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "reverse_fold_impl.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +/// forward declaration + +template< + long N + , typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_fold_impl; + +template< long N > +struct reverse_fold_chunk; + +template<> struct reverse_fold_chunk<0> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef fwd_state0 bkwd_state0; + typedef bkwd_state0 state; + typedef iter0 iterator; + }; +}; + +template<> struct reverse_fold_chunk<1> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + + + typedef fwd_state1 bkwd_state1; + typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; + typedef bkwd_state0 state; + typedef iter1 iterator; + }; +}; + +template<> struct reverse_fold_chunk<2> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + + + typedef fwd_state2 bkwd_state2; + typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; + typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef iter2 iterator; + }; +}; + +template<> struct reverse_fold_chunk<3> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3; + typedef typename mpl::next<iter2>::type iter3; + + + typedef fwd_state3 bkwd_state3; + typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2; + typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; + typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef iter3 iterator; + }; +}; + +template<> struct reverse_fold_chunk<4> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3; + typedef typename mpl::next<iter2>::type iter3; + typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4; + typedef typename mpl::next<iter3>::type iter4; + + + typedef fwd_state4 bkwd_state4; + typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3; + typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2; + typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; + typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef iter4 iterator; + }; +}; + +template< long N > +struct reverse_fold_chunk +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp, fwd_state0, typename deref<iter0>::type >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp, fwd_state1, typename deref<iter1>::type >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp, fwd_state2, typename deref<iter2>::type >::type fwd_state3; + typedef typename mpl::next<iter2>::type iter3; + typedef typename apply2< ForwardOp, fwd_state3, typename deref<iter3>::type >::type fwd_state4; + typedef typename mpl::next<iter3>::type iter4; + + + typedef reverse_fold_impl< + ( (N - 4) < 0 ? 0 : N - 4 ) + , iter4 + , Last + , fwd_state4 + , BackwardOp + , ForwardOp + > nested_chunk; + + typedef typename nested_chunk::state bkwd_state4; + typedef typename apply2< BackwardOp, bkwd_state4, typename deref<iter3>::type >::type bkwd_state3; + typedef typename apply2< BackwardOp, bkwd_state3, typename deref<iter2>::type >::type bkwd_state2; + typedef typename apply2< BackwardOp, bkwd_state2, typename deref<iter1>::type >::type bkwd_state1; + typedef typename apply2< BackwardOp, bkwd_state1, typename deref<iter0>::type >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef typename nested_chunk::iterator iterator; + }; +}; + +template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_fold_step; + +template< + typename Last + , typename State + > +struct reverse_fold_null_step +{ + typedef Last iterator; + typedef State state; +}; + +template<> +struct reverse_fold_chunk< -1 > +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef typename if_< + typename is_same< First,Last >::type + , reverse_fold_null_step< Last,State > + , reverse_fold_step< First,Last,State,BackwardOp,ForwardOp > + >::type res_; + + typedef typename res_::state state; + typedef typename res_::iterator iterator; + }; +}; + +template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_fold_step +{ + typedef reverse_fold_chunk< -1 >::template result_< + typename mpl::next<First>::type + , Last + , typename apply2<ForwardOp,State, typename deref<First>::type>::type + , BackwardOp + , ForwardOp + > nested_step; + + typedef typename apply2< + BackwardOp + , typename nested_step::state + , typename deref<First>::type + >::type state; + + typedef typename nested_step::iterator iterator; +}; + +template< + long N + , typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_fold_impl + : reverse_fold_chunk<N> + ::template result_< First,Last,State,BackwardOp,ForwardOp > +{ +}; + +}}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_iter_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_iter_fold_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..44aadf7a6d20975d0faa6877b987747a8542c375 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_iter_fold_impl.hpp @@ -0,0 +1,295 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "reverse_iter_fold_impl.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +/// forward declaration + +template< + long N + , typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_iter_fold_impl; + +template< long N > +struct reverse_iter_fold_chunk; + +template<> struct reverse_iter_fold_chunk<0> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef fwd_state0 bkwd_state0; + typedef bkwd_state0 state; + typedef iter0 iterator; + }; +}; + +template<> struct reverse_iter_fold_chunk<1> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + + + typedef fwd_state1 bkwd_state1; + typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; + typedef bkwd_state0 state; + typedef iter1 iterator; + }; +}; + +template<> struct reverse_iter_fold_chunk<2> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + + + typedef fwd_state2 bkwd_state2; + typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; + typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef iter2 iterator; + }; +}; + +template<> struct reverse_iter_fold_chunk<3> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; + typedef typename mpl::next<iter2>::type iter3; + + + typedef fwd_state3 bkwd_state3; + typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; + typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; + typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef iter3 iterator; + }; +}; + +template<> struct reverse_iter_fold_chunk<4> +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; + typedef typename mpl::next<iter2>::type iter3; + typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4; + typedef typename mpl::next<iter3>::type iter4; + + + typedef fwd_state4 bkwd_state4; + typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3; + typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; + typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; + typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef iter4 iterator; + }; +}; + +template< long N > +struct reverse_iter_fold_chunk +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef First iter0; + typedef State fwd_state0; + typedef typename apply2< ForwardOp,fwd_state0,iter0 >::type fwd_state1; + typedef typename mpl::next<iter0>::type iter1; + typedef typename apply2< ForwardOp,fwd_state1,iter1 >::type fwd_state2; + typedef typename mpl::next<iter1>::type iter2; + typedef typename apply2< ForwardOp,fwd_state2,iter2 >::type fwd_state3; + typedef typename mpl::next<iter2>::type iter3; + typedef typename apply2< ForwardOp,fwd_state3,iter3 >::type fwd_state4; + typedef typename mpl::next<iter3>::type iter4; + + + typedef reverse_iter_fold_impl< + ( (N - 4) < 0 ? 0 : N - 4 ) + , iter4 + , Last + , fwd_state4 + , BackwardOp + , ForwardOp + > nested_chunk; + + typedef typename nested_chunk::state bkwd_state4; + typedef typename apply2< BackwardOp,bkwd_state4,iter3 >::type bkwd_state3; + typedef typename apply2< BackwardOp,bkwd_state3,iter2 >::type bkwd_state2; + typedef typename apply2< BackwardOp,bkwd_state2,iter1 >::type bkwd_state1; + typedef typename apply2< BackwardOp,bkwd_state1,iter0 >::type bkwd_state0; + + + typedef bkwd_state0 state; + typedef typename nested_chunk::iterator iterator; + }; +}; + +template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_iter_fold_step; + +template< + typename Last + , typename State + > +struct reverse_iter_fold_null_step +{ + typedef Last iterator; + typedef State state; +}; + +template<> +struct reverse_iter_fold_chunk< -1 > +{ + template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > + struct result_ + { + typedef typename if_< + typename is_same< First,Last >::type + , reverse_iter_fold_null_step< Last,State > + , reverse_iter_fold_step< First,Last,State,BackwardOp,ForwardOp > + >::type res_; + + typedef typename res_::state state; + typedef typename res_::iterator iterator; + }; +}; + +template< + typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_iter_fold_step +{ + typedef reverse_iter_fold_chunk< -1 >::template result_< + typename mpl::next<First>::type + , Last + , typename apply2< ForwardOp,State,First >::type + , BackwardOp + , ForwardOp + > nested_step; + + typedef typename apply2< + BackwardOp + , typename nested_step::state + , First + >::type state; + + typedef typename nested_step::iterator iterator; +}; + +template< + long N + , typename First + , typename Last + , typename State + , typename BackwardOp + , typename ForwardOp + > +struct reverse_iter_fold_impl + : reverse_iter_fold_chunk<N> + ::template result_< First,Last,State,BackwardOp,ForwardOp > +{ +}; + +}}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/set.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ace3a4f07cbfbc6acb92059dc44f65380f1c5bb6 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/set.hpp @@ -0,0 +1,323 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "set.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na + , typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na + , typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na + , typename T12 = na, typename T13 = na, typename T14 = na + , typename T15 = na, typename T16 = na, typename T17 = na + , typename T18 = na, typename T19 = na + > +struct set; + +template< + + > +struct set< + na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set0< > +{ + typedef set0< >::type type; +}; + +template< + typename T0 + > +struct set< + T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set1<T0> +{ + typedef typename set1<T0>::type type; +}; + +template< + typename T0, typename T1 + > +struct set< + T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set2< T0,T1 > +{ + typedef typename set2< T0,T1 >::type type; +}; + +template< + typename T0, typename T1, typename T2 + > +struct set< + T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set3< T0,T1,T2 > +{ + typedef typename set3< T0,T1,T2 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3 + > +struct set< + T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set4< T0,T1,T2,T3 > +{ + typedef typename set4< T0,T1,T2,T3 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + > +struct set< + T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set5< T0,T1,T2,T3,T4 > +{ + typedef typename set5< T0,T1,T2,T3,T4 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct set< + T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set6< T0,T1,T2,T3,T4,T5 > +{ + typedef typename set6< T0,T1,T2,T3,T4,T5 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set7< T0,T1,T2,T3,T4,T5,T6 > +{ + typedef typename set7< T0,T1,T2,T3,T4,T5,T6 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na + , na, na, na + > + : set8< T0,T1,T2,T3,T4,T5,T6,T7 > +{ + typedef typename set8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na + , na, na, na + > + : set9< T0,T1,T2,T3,T4,T5,T6,T7,T8 > +{ + typedef typename set9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na + , na, na, na + > + : set10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 > +{ + typedef typename set10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na + , na, na, na + > + : set11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 > +{ + typedef typename set11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na + , na, na, na, na + > + : set12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 > +{ + typedef typename set12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na + , na, na, na, na + > + : set13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 > +{ + typedef typename set13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na + , na, na, na, na + > + : set14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 > +{ + typedef typename set14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na + , na, na, na, na + > + : set15< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + > +{ + typedef typename set15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, na, na, na, na + > + : set16< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15 + > +{ + typedef typename set16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, na, na, na + > + : set17< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16 + > +{ + typedef typename set17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, na, na + > + : set18< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17 + > +{ + typedef typename set18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18 + > +struct set< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, na + > + : set19< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18 + > +{ + typedef typename set19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18, typename T19 + > +struct set + : set20< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, T19 + > +{ + typedef typename set20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/set_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/set_c.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4e6993ce2728b12428dc31ef79b8f88623a92768 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/set_c.hpp @@ -0,0 +1,328 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "set_c.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T, long C0 = LONG_MAX, long C1 = LONG_MAX, long C2 = LONG_MAX + , long C3 = LONG_MAX, long C4 = LONG_MAX, long C5 = LONG_MAX + , long C6 = LONG_MAX, long C7 = LONG_MAX, long C8 = LONG_MAX + , long C9 = LONG_MAX, long C10 = LONG_MAX, long C11 = LONG_MAX + , long C12 = LONG_MAX, long C13 = LONG_MAX, long C14 = LONG_MAX + , long C15 = LONG_MAX, long C16 = LONG_MAX, long C17 = LONG_MAX + , long C18 = LONG_MAX, long C19 = LONG_MAX + > +struct set_c; + +template< + typename T + > +struct set_c< + T, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set0_c<T> +{ + typedef typename set0_c<T>::type type; +}; + +template< + typename T, long C0 + > +struct set_c< + T, C0, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set1_c< T,C0 > +{ + typedef typename set1_c< T,C0 >::type type; +}; + +template< + typename T, long C0, long C1 + > +struct set_c< + T, C0, C1, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set2_c< T,C0,C1 > +{ + typedef typename set2_c< T,C0,C1 >::type type; +}; + +template< + typename T, long C0, long C1, long C2 + > +struct set_c< + T, C0, C1, C2, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set3_c< T,C0,C1,C2 > +{ + typedef typename set3_c< T,C0,C1,C2 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3 + > +struct set_c< + T, C0, C1, C2, C3, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set4_c< T,C0,C1,C2,C3 > +{ + typedef typename set4_c< T,C0,C1,C2,C3 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4 + > +struct set_c< + T, C0, C1, C2, C3, C4, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set5_c< T,C0,C1,C2,C3,C4 > +{ + typedef typename set5_c< T,C0,C1,C2,C3,C4 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX + > + : set6_c< T,C0,C1,C2,C3,C4,C5 > +{ + typedef typename set6_c< T,C0,C1,C2,C3,C4,C5 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX + > + : set7_c< T,C0,C1,C2,C3,C4,C5,C6 > +{ + typedef typename set7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX + > + : set8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > +{ + typedef typename set8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX + > + : set9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > +{ + typedef typename set9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX + > + : set10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > +{ + typedef typename set10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > +{ + typedef typename set11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > +{ + typedef typename set12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > +{ + typedef typename set13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set14_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + > +{ + typedef typename set14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set15_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + > +{ + typedef typename set15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : set16_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15 + > +{ + typedef typename set16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX + > + : set17_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16 + > +{ + typedef typename set17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, LONG_MAX, LONG_MAX + > + : set18_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17 + > +{ + typedef typename set18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17, long C18 + > +struct set_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, C18, LONG_MAX + > + : set19_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, C18 + > +{ + typedef typename set19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17, long C18, long C19 + > +struct set_c + : set20_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, C18, C19 + > +{ + typedef typename set20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/shift_left.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/shift_left.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6d19e94ed3412131a33642d381263d576f48b6e3 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/shift_left.hpp @@ -0,0 +1,99 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Jaap Suter 2003 +// +// 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 "shift_left.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct shift_left_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< shift_left_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< shift_left_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct shift_left_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct shift_left_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct shift_left_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct shift_left_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct shift_left + + : shift_left_impl< + typename shift_left_tag<N1>::type + , typename shift_left_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, shift_left, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, shift_left) + +}} + +namespace boost { namespace mpl { +template<> +struct shift_left_impl< integral_c_tag,integral_c_tag > +{ + template< typename N, typename S > struct apply + + : integral_c< + typename N::value_type + , ( BOOST_MPL_AUX_VALUE_WKND(N)::value + << BOOST_MPL_AUX_VALUE_WKND(S)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/shift_right.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/shift_right.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dd31d97cec98a97e61f8c38d152739baabfc9278 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/shift_right.hpp @@ -0,0 +1,99 @@ + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Jaap Suter 2003 +// +// 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 "shift_right.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct shift_right_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< shift_right_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< shift_right_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct shift_right_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct shift_right_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct shift_right_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct shift_right_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct shift_right + + : shift_right_impl< + typename shift_right_tag<N1>::type + , typename shift_right_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, shift_right, (N1, N2)) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 2, shift_right) + +}} + +namespace boost { namespace mpl { +template<> +struct shift_right_impl< integral_c_tag,integral_c_tag > +{ + template< typename N, typename S > struct apply + + : integral_c< + typename N::value_type + , ( BOOST_MPL_AUX_VALUE_WKND(N)::value + >> BOOST_MPL_AUX_VALUE_WKND(S)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/template_arity.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/template_arity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b24a0a7e7fb2a593aa895362db816b46c1e991e0 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/template_arity.hpp @@ -0,0 +1,40 @@ + +// 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) +// + +// *Preprocessed* version of the main "template_arity.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { namespace aux { + +template< bool > +struct template_arity_impl +{ + template< typename F > struct result_ + : mpl::int_< -1 > + { + }; +}; + +template<> +struct template_arity_impl<true> +{ + template< typename F > struct result_ + : F::arity + { + }; +}; + +template< typename F > +struct template_arity + : template_arity_impl< ::boost::mpl::aux::has_rebind<F>::value > + ::template result_<F> +{ +}; + +}}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/times.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/times.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ab100f1cb3f3c7bb7aa227172af4f6b61a402630 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/times.hpp @@ -0,0 +1,146 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "times.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename Tag1 + , typename Tag2 + > +struct times_impl + : if_c< + ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1) + > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2) + ) + + , aux::cast2nd_impl< times_impl< Tag1,Tag1 >,Tag1, Tag2 > + , aux::cast1st_impl< times_impl< Tag2,Tag2 >,Tag1, Tag2 > + >::type +{ +}; + +/// for Digital Mars C++/compilers with no CTPS/TTP support +template<> struct times_impl< na,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct times_impl< na,Tag > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename Tag > struct times_impl< Tag,na > +{ + template< typename U1, typename U2 > struct apply + { + typedef apply type; + BOOST_STATIC_CONSTANT(int, value = 0); + }; +}; + +template< typename T > struct times_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + , typename N3 = na, typename N4 = na, typename N5 = na + > +struct times + : times< times< times< times< N1,N2 >, N3>, N4>, N5> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT( + 5 + , times + , ( N1, N2, N3, N4, N5 ) + ) +}; + +template< + typename N1, typename N2, typename N3, typename N4 + > +struct times< N1,N2,N3,N4,na > + + : times< times< times< N1,N2 >, N3>, N4> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , times + , ( N1, N2, N3, N4, na ) + ) +}; + +template< + typename N1, typename N2, typename N3 + > +struct times< N1,N2,N3,na,na > + + : times< times< N1,N2 >, N3> +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , times + , ( N1, N2, N3, na, na ) + ) +}; + +template< + typename N1, typename N2 + > +struct times< N1,N2,na,na,na > + : times_impl< + typename times_tag<N1>::type + , typename times_tag<N2>::type + >::template apply< N1,N2 >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC( + 5 + , times + , ( N1, N2, na, na, na ) + ) + +}; + +BOOST_MPL_AUX_NA_SPEC2(2, 5, times) + +}} + +namespace boost { namespace mpl { +template<> +struct times_impl< integral_c_tag,integral_c_tag > +{ + template< typename N1, typename N2 > struct apply + + : integral_c< + typename aux::largest_int< + typename N1::value_type + , typename N2::value_type + >::type + , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value + * BOOST_MPL_AUX_VALUE_WKND(N2)::value + ) + > + { + }; +}; + +}} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/unpack_args.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/unpack_args.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f391dc1ab84acda94b549ae2172a05e97289787d --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/unpack_args.hpp @@ -0,0 +1,97 @@ + +// Copyright Aleksey Gurtovoy 2002-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) +// + +// *Preprocessed* version of the main "unpack_args.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +namespace aux { + +template< int size, typename F, typename Args > +struct unpack_args_impl; + +template< typename F, typename Args > +struct unpack_args_impl< 0,F,Args > + : apply0< + F + > +{ +}; + +template< typename F, typename Args > +struct unpack_args_impl< 1,F,Args > + : apply1< + F + , typename at_c< Args,0 >::type + > +{ +}; + +template< typename F, typename Args > +struct unpack_args_impl< 2,F,Args > + : apply2< + F + , typename at_c< Args,0 >::type, typename at_c< Args,1 >::type + > +{ +}; + +template< typename F, typename Args > +struct unpack_args_impl< 3,F,Args > + : apply3< + F + , typename at_c< Args,0 >::type, typename at_c< Args,1 >::type + , typename at_c< Args,2 >::type + > +{ +}; + +template< typename F, typename Args > +struct unpack_args_impl< 4,F,Args > + : apply4< + F + , typename at_c< Args,0 >::type, typename at_c< Args,1 >::type + , typename at_c< Args,2 >::type, typename at_c< Args,3 >::type + > +{ +}; + +template< typename F, typename Args > +struct unpack_args_impl< 5,F,Args > + : apply5< + F + , typename at_c< Args,0 >::type, typename at_c< Args,1 >::type + , typename at_c< Args,2 >::type, typename at_c< Args,3 >::type + , typename at_c< Args,4 >::type + > +{ +}; + +} + +template< + typename F + > +struct unpack_args +{ + template< typename Args > struct apply + { + typedef typename aux::unpack_args_impl< + size<Args>::value + , F + , Args + >::type type; + + }; +}; + +BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(1, unpack_args) + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/vector.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/vector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..803e217850a068fa3a6665dabd8996e0ec198b82 --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/vector.hpp @@ -0,0 +1,323 @@ + +// Copyright Aleksey Gurtovoy 2000-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) +// + +// *Preprocessed* version of the main "vector.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na + , typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na + , typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na + , typename T12 = na, typename T13 = na, typename T14 = na + , typename T15 = na, typename T16 = na, typename T17 = na + , typename T18 = na, typename T19 = na + > +struct vector; + +template< + + > +struct vector< + na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector0< > +{ + typedef vector0< >::type type; +}; + +template< + typename T0 + > +struct vector< + T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector1<T0> +{ + typedef typename vector1<T0>::type type; +}; + +template< + typename T0, typename T1 + > +struct vector< + T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector2< T0,T1 > +{ + typedef typename vector2< T0,T1 >::type type; +}; + +template< + typename T0, typename T1, typename T2 + > +struct vector< + T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector3< T0,T1,T2 > +{ + typedef typename vector3< T0,T1,T2 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3 + > +struct vector< + T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector4< T0,T1,T2,T3 > +{ + typedef typename vector4< T0,T1,T2,T3 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + > +struct vector< + T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector5< T0,T1,T2,T3,T4 > +{ + typedef typename vector5< T0,T1,T2,T3,T4 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5 + > +struct vector< + T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector6< T0,T1,T2,T3,T4,T5 > +{ + typedef typename vector6< T0,T1,T2,T3,T4,T5 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector7< T0,T1,T2,T3,T4,T5,T6 > +{ + typedef typename vector7< T0,T1,T2,T3,T4,T5,T6 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na + , na, na, na + > + : vector8< T0,T1,T2,T3,T4,T5,T6,T7 > +{ + typedef typename vector8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na + , na, na, na + > + : vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 > +{ + typedef typename vector9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na + , na, na, na + > + : vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 > +{ + typedef typename vector10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na + , na, na, na + > + : vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 > +{ + typedef typename vector11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na + , na, na, na, na + > + : vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 > +{ + typedef typename vector12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na + , na, na, na, na + > + : vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 > +{ + typedef typename vector13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na + , na, na, na, na + > + : vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 > +{ + typedef typename vector14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na + , na, na, na, na + > + : vector15< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + > +{ + typedef typename vector15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, na, na, na, na + > + : vector16< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15 + > +{ + typedef typename vector16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, na, na, na + > + : vector17< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16 + > +{ + typedef typename vector17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, na, na + > + : vector18< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17 + > +{ + typedef typename vector18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type; +}; + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18 + > +struct vector< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, na + > + : vector19< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18 + > +{ + typedef typename vector19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T0, typename T1, typename T2, typename T3, typename T4 + , typename T5, typename T6, typename T7, typename T8, typename T9 + , typename T10, typename T11, typename T12, typename T13, typename T14 + , typename T15, typename T16, typename T17, typename T18, typename T19 + > +struct vector + : vector20< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 + , T15, T16, T17, T18, T19 + > +{ + typedef typename vector20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/vector_c.hpp new file mode 100644 index 0000000000000000000000000000000000000000..643b7fd636729083884335d3c17cb5cc9a7b8d2d --- /dev/null +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/bcc_pre590/vector_c.hpp @@ -0,0 +1,309 @@ + +// 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 "vector_c.hpp" header +// -- DO NOT modify by hand! + +namespace boost { namespace mpl { + +template< + typename T, long C0 = LONG_MAX, long C1 = LONG_MAX, long C2 = LONG_MAX + , long C3 = LONG_MAX, long C4 = LONG_MAX, long C5 = LONG_MAX + , long C6 = LONG_MAX, long C7 = LONG_MAX, long C8 = LONG_MAX + , long C9 = LONG_MAX, long C10 = LONG_MAX, long C11 = LONG_MAX + , long C12 = LONG_MAX, long C13 = LONG_MAX, long C14 = LONG_MAX + , long C15 = LONG_MAX, long C16 = LONG_MAX, long C17 = LONG_MAX + , long C18 = LONG_MAX, long C19 = LONG_MAX + > +struct vector_c; + +template< + typename T + > +struct vector_c< + T, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector0_c<T> +{ + typedef typename vector0_c<T>::type type; +}; + +template< + typename T, long C0 + > +struct vector_c< + T, C0, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector1_c< T, T(C0) > +{ + typedef typename vector1_c< T, T(C0) >::type type; +}; + +template< + typename T, long C0, long C1 + > +struct vector_c< + T, C0, C1, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector2_c< T, T(C0), T(C1) > +{ + typedef typename vector2_c< T, T(C0), T(C1) >::type type; +}; + +template< + typename T, long C0, long C1, long C2 + > +struct vector_c< + T, C0, C1, C2, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector3_c< T, T(C0), T(C1), T(C2) > +{ + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3 + > +struct vector_c< + T, C0, C1, C2, C3, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > +{ + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4 + > +struct vector_c< + T, C0, C1, C2, C3, C4, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > +{ + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX + > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > +{ + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX + > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > +{ + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX + > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > +{ + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX + > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > +{ + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + , LONG_MAX + > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > +{ + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > +{ + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > +{ + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > +{ + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > +{ + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > +{ + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > +{ + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX + > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > +{ + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, LONG_MAX, LONG_MAX + > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > +{ + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; +}; + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17, long C18 + > +struct vector_c< + T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + , C15, C16, C17, C18, LONG_MAX + > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > +{ + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; +}; + +/// primary template (not a specialization!) + +template< + typename T, long C0, long C1, long C2, long C3, long C4, long C5 + , long C6, long C7, long C8, long C9, long C10, long C11, long C12 + , long C13, long C14, long C15, long C16, long C17, long C18, long C19 + > +struct vector_c + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > +{ + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; +}; + +}} + diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/dmc/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/dmc/vector_c.hpp index 840c2e1ab9a48381c4239ef40e48fb92d7a1ecf9..0f1560d7f139f5e661c20311a8ce77b684fd6cc1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/dmc/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/dmc/vector_c.hpp @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/quote.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/quote.hpp index d7d0420e4d86a4fa2bf385528cd870e0cad84f5f..020f093965a139c1b87b02e9cbb728602a3ee11c 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/quote.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/quote.hpp @@ -13,8 +13,8 @@ namespace boost { namespace mpl { template< typename T, bool has_type_ > struct quote_impl - : T { + typedef typename T::type type; }; template< typename T > diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/vector_c.hpp index 840c2e1ab9a48381c4239ef40e48fb92d7a1ecf9..0f1560d7f139f5e661c20311a8ce77b684fd6cc1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/gcc/vector_c.hpp @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc60/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc60/vector_c.hpp index 6cf7b449b7204e21ef1bb081a76d869f9ab9715c..c522d0826ff53f0c02d0b10e37800f3ab9638adc 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc60/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc60/vector_c.hpp @@ -51,7 +51,7 @@ struct vector_c_chooser<1> struct result_ { typedef typename vector1_c< - T, C0 + T, T(C0) >::type type; }; @@ -72,7 +72,7 @@ struct vector_c_chooser<2> struct result_ { typedef typename vector2_c< - T, C0, C1 + T, T(C0), T(C1) >::type type; }; @@ -93,7 +93,7 @@ struct vector_c_chooser<3> struct result_ { typedef typename vector3_c< - T, C0, C1, C2 + T, T(C0), T(C1), T(C2) >::type type; }; @@ -114,7 +114,7 @@ struct vector_c_chooser<4> struct result_ { typedef typename vector4_c< - T, C0, C1, C2, C3 + T, T(C0), T(C1), T(C2), T(C3) >::type type; }; @@ -135,7 +135,7 @@ struct vector_c_chooser<5> struct result_ { typedef typename vector5_c< - T, C0, C1, C2, C3, C4 + T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; @@ -156,7 +156,7 @@ struct vector_c_chooser<6> struct result_ { typedef typename vector6_c< - T, C0, C1, C2, C3, C4, C5 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; @@ -177,7 +177,7 @@ struct vector_c_chooser<7> struct result_ { typedef typename vector7_c< - T, C0, C1, C2, C3, C4, C5, C6 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; @@ -198,7 +198,7 @@ struct vector_c_chooser<8> struct result_ { typedef typename vector8_c< - T, C0, C1, C2, C3, C4, C5, C6, C7 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; @@ -219,7 +219,7 @@ struct vector_c_chooser<9> struct result_ { typedef typename vector9_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; @@ -240,7 +240,7 @@ struct vector_c_chooser<10> struct result_ { typedef typename vector10_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; @@ -261,7 +261,7 @@ struct vector_c_chooser<11> struct result_ { typedef typename vector11_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; @@ -282,7 +282,7 @@ struct vector_c_chooser<12> struct result_ { typedef typename vector12_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; @@ -303,7 +303,7 @@ struct vector_c_chooser<13> struct result_ { typedef typename vector13_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; @@ -324,7 +324,7 @@ struct vector_c_chooser<14> struct result_ { typedef typename vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; @@ -345,7 +345,7 @@ struct vector_c_chooser<15> struct result_ { typedef typename vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; @@ -366,7 +366,7 @@ struct vector_c_chooser<16> struct result_ { typedef typename vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; @@ -387,7 +387,7 @@ struct vector_c_chooser<17> struct result_ { typedef typename vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; @@ -408,7 +408,7 @@ struct vector_c_chooser<18> struct result_ { typedef typename vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; @@ -429,7 +429,7 @@ struct vector_c_chooser<19> struct result_ { typedef typename vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C18 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; @@ -450,7 +450,7 @@ struct vector_c_chooser<20> struct result_ { typedef typename vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C18, C19 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc70/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc70/vector_c.hpp index 6cf7b449b7204e21ef1bb081a76d869f9ab9715c..c522d0826ff53f0c02d0b10e37800f3ab9638adc 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc70/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/msvc70/vector_c.hpp @@ -51,7 +51,7 @@ struct vector_c_chooser<1> struct result_ { typedef typename vector1_c< - T, C0 + T, T(C0) >::type type; }; @@ -72,7 +72,7 @@ struct vector_c_chooser<2> struct result_ { typedef typename vector2_c< - T, C0, C1 + T, T(C0), T(C1) >::type type; }; @@ -93,7 +93,7 @@ struct vector_c_chooser<3> struct result_ { typedef typename vector3_c< - T, C0, C1, C2 + T, T(C0), T(C1), T(C2) >::type type; }; @@ -114,7 +114,7 @@ struct vector_c_chooser<4> struct result_ { typedef typename vector4_c< - T, C0, C1, C2, C3 + T, T(C0), T(C1), T(C2), T(C3) >::type type; }; @@ -135,7 +135,7 @@ struct vector_c_chooser<5> struct result_ { typedef typename vector5_c< - T, C0, C1, C2, C3, C4 + T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; @@ -156,7 +156,7 @@ struct vector_c_chooser<6> struct result_ { typedef typename vector6_c< - T, C0, C1, C2, C3, C4, C5 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; @@ -177,7 +177,7 @@ struct vector_c_chooser<7> struct result_ { typedef typename vector7_c< - T, C0, C1, C2, C3, C4, C5, C6 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; @@ -198,7 +198,7 @@ struct vector_c_chooser<8> struct result_ { typedef typename vector8_c< - T, C0, C1, C2, C3, C4, C5, C6, C7 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; @@ -219,7 +219,7 @@ struct vector_c_chooser<9> struct result_ { typedef typename vector9_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; @@ -240,7 +240,7 @@ struct vector_c_chooser<10> struct result_ { typedef typename vector10_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; @@ -261,7 +261,7 @@ struct vector_c_chooser<11> struct result_ { typedef typename vector11_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; @@ -282,7 +282,7 @@ struct vector_c_chooser<12> struct result_ { typedef typename vector12_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; @@ -303,7 +303,7 @@ struct vector_c_chooser<13> struct result_ { typedef typename vector13_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; @@ -324,7 +324,7 @@ struct vector_c_chooser<14> struct result_ { typedef typename vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; @@ -345,7 +345,7 @@ struct vector_c_chooser<15> struct result_ { typedef typename vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; @@ -366,7 +366,7 @@ struct vector_c_chooser<16> struct result_ { typedef typename vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; @@ -387,7 +387,7 @@ struct vector_c_chooser<17> struct result_ { typedef typename vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; @@ -408,7 +408,7 @@ struct vector_c_chooser<18> struct result_ { typedef typename vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; @@ -429,7 +429,7 @@ struct vector_c_chooser<19> struct result_ { typedef typename vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C18 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; @@ -450,7 +450,7 @@ struct vector_c_chooser<20> struct result_ { typedef typename vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C18, C19 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/mwcw/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/mwcw/vector_c.hpp index 840c2e1ab9a48381c4239ef40e48fb92d7a1ecf9..0f1560d7f139f5e661c20311a8ce77b684fd6cc1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/mwcw/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/mwcw/vector_c.hpp @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ctps/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ctps/vector_c.hpp index 6cf7b449b7204e21ef1bb081a76d869f9ab9715c..c522d0826ff53f0c02d0b10e37800f3ab9638adc 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ctps/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ctps/vector_c.hpp @@ -51,7 +51,7 @@ struct vector_c_chooser<1> struct result_ { typedef typename vector1_c< - T, C0 + T, T(C0) >::type type; }; @@ -72,7 +72,7 @@ struct vector_c_chooser<2> struct result_ { typedef typename vector2_c< - T, C0, C1 + T, T(C0), T(C1) >::type type; }; @@ -93,7 +93,7 @@ struct vector_c_chooser<3> struct result_ { typedef typename vector3_c< - T, C0, C1, C2 + T, T(C0), T(C1), T(C2) >::type type; }; @@ -114,7 +114,7 @@ struct vector_c_chooser<4> struct result_ { typedef typename vector4_c< - T, C0, C1, C2, C3 + T, T(C0), T(C1), T(C2), T(C3) >::type type; }; @@ -135,7 +135,7 @@ struct vector_c_chooser<5> struct result_ { typedef typename vector5_c< - T, C0, C1, C2, C3, C4 + T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; @@ -156,7 +156,7 @@ struct vector_c_chooser<6> struct result_ { typedef typename vector6_c< - T, C0, C1, C2, C3, C4, C5 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; @@ -177,7 +177,7 @@ struct vector_c_chooser<7> struct result_ { typedef typename vector7_c< - T, C0, C1, C2, C3, C4, C5, C6 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; @@ -198,7 +198,7 @@ struct vector_c_chooser<8> struct result_ { typedef typename vector8_c< - T, C0, C1, C2, C3, C4, C5, C6, C7 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; @@ -219,7 +219,7 @@ struct vector_c_chooser<9> struct result_ { typedef typename vector9_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; @@ -240,7 +240,7 @@ struct vector_c_chooser<10> struct result_ { typedef typename vector10_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; @@ -261,7 +261,7 @@ struct vector_c_chooser<11> struct result_ { typedef typename vector11_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; @@ -282,7 +282,7 @@ struct vector_c_chooser<12> struct result_ { typedef typename vector12_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; @@ -303,7 +303,7 @@ struct vector_c_chooser<13> struct result_ { typedef typename vector13_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; @@ -324,7 +324,7 @@ struct vector_c_chooser<14> struct result_ { typedef typename vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; @@ -345,7 +345,7 @@ struct vector_c_chooser<15> struct result_ { typedef typename vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; @@ -366,7 +366,7 @@ struct vector_c_chooser<16> struct result_ { typedef typename vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; @@ -387,7 +387,7 @@ struct vector_c_chooser<17> struct result_ { typedef typename vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; @@ -408,7 +408,7 @@ struct vector_c_chooser<18> struct result_ { typedef typename vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; @@ -429,7 +429,7 @@ struct vector_c_chooser<19> struct result_ { typedef typename vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C18 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; @@ -450,7 +450,7 @@ struct vector_c_chooser<20> struct result_ { typedef typename vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16, C17, C18, C19 + T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ttp/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ttp/vector_c.hpp index 840c2e1ab9a48381c4239ef40e48fb92d7a1ecf9..0f1560d7f139f5e661c20311a8ce77b684fd6cc1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ttp/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/no_ttp/vector_c.hpp @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessed/plain/vector_c.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessed/plain/vector_c.hpp index 840c2e1ab9a48381c4239ef40e48fb92d7a1ecf9..0f1560d7f139f5e661c20311a8ce77b684fd6cc1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessed/plain/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessed/plain/vector_c.hpp @@ -43,9 +43,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector1_c< T,C0 > + : vector1_c< T, T(C0) > { - typedef typename vector1_c< T,C0 >::type type; + typedef typename vector1_c< T, T(C0) >::type type; }; template< @@ -56,9 +56,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector2_c< T,C0,C1 > + : vector2_c< T, T(C0), T(C1) > { - typedef typename vector2_c< T,C0,C1 >::type type; + typedef typename vector2_c< T, T(C0), T(C1) >::type type; }; template< @@ -69,9 +69,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector3_c< T,C0,C1,C2 > + : vector3_c< T, T(C0), T(C1), T(C2) > { - typedef typename vector3_c< T,C0,C1,C2 >::type type; + typedef typename vector3_c< T, T(C0), T(C1), T(C2) >::type type; }; template< @@ -82,9 +82,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector4_c< T,C0,C1,C2,C3 > + : vector4_c< T, T(C0), T(C1), T(C2), T(C3) > { - typedef typename vector4_c< T,C0,C1,C2,C3 >::type type; + typedef typename vector4_c< T, T(C0), T(C1), T(C2), T(C3) >::type type; }; template< @@ -95,9 +95,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector5_c< T,C0,C1,C2,C3,C4 > + : vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) > { - typedef typename vector5_c< T,C0,C1,C2,C3,C4 >::type type; + typedef typename vector5_c< T, T(C0), T(C1), T(C2), T(C3), T(C4) >::type type; }; template< @@ -108,9 +108,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector6_c< T,C0,C1,C2,C3,C4,C5 > + : vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) > { - typedef typename vector6_c< T,C0,C1,C2,C3,C4,C5 >::type type; + typedef typename vector6_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5) >::type type; }; template< @@ -122,9 +122,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX > - : vector7_c< T,C0,C1,C2,C3,C4,C5,C6 > + : vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) > { - typedef typename vector7_c< T,C0,C1,C2,C3,C4,C5,C6 >::type type; + typedef typename vector7_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6) >::type type; }; template< @@ -136,9 +136,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX > - : vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 > + : vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) > { - typedef typename vector8_c< T,C0,C1,C2,C3,C4,C5,C6,C7 >::type type; + typedef typename vector8_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7) >::type type; }; template< @@ -150,9 +150,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 > + : vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) > { - typedef typename vector9_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8 >::type type; + typedef typename vector9_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8) >::type type; }; template< @@ -164,9 +164,9 @@ struct vector_c< , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX , LONG_MAX > - : vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 > + : vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) > { - typedef typename vector10_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9 >::type type; + typedef typename vector10_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9) >::type type; }; template< @@ -177,9 +177,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, LONG_MAX, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 > + : vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) > { - typedef typename vector11_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10 >::type type; + typedef typename vector11_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10) >::type type; }; template< @@ -190,9 +190,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 > + : vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) > { - typedef typename vector12_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 >::type type; + typedef typename vector12_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11) >::type type; }; template< @@ -203,9 +203,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, LONG_MAX , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 > + : vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) > { - typedef typename vector13_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12 >::type type; + typedef typename vector13_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12) >::type type; }; template< @@ -217,11 +217,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector14_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13 - > + : vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) > { - typedef typename vector14_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 >::type type; + typedef typename vector14_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13) >::type type; }; template< @@ -233,11 +231,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector15_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - > + : vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) > { - typedef typename vector15_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14 >::type type; + typedef typename vector15_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14) >::type type; }; template< @@ -249,12 +245,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, LONG_MAX, LONG_MAX, LONG_MAX, LONG_MAX > - : vector16_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15 - > + : vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) > { - typedef typename vector16_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15 >::type type; + typedef typename vector16_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15) >::type type; }; template< @@ -266,12 +259,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, LONG_MAX, LONG_MAX, LONG_MAX > - : vector17_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16 - > + : vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) > { - typedef typename vector17_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16 >::type type; + typedef typename vector17_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16) >::type type; }; template< @@ -283,12 +273,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, LONG_MAX, LONG_MAX > - : vector18_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17 - > + : vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) > { - typedef typename vector18_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17 >::type type; + typedef typename vector18_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17) >::type type; }; template< @@ -300,12 +287,9 @@ struct vector_c< T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 , C15, C16, C17, C18, LONG_MAX > - : vector19_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18 - > + : vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) > { - typedef typename vector19_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18 >::type type; + typedef typename vector19_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18) >::type type; }; /// primary template (not a specialization!) @@ -316,12 +300,9 @@ template< , long C13, long C14, long C15, long C16, long C17, long C18, long C19 > struct vector_c - : vector20_c< - T, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14 - , C15, C16, C17, C18, C19 - > + : vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) > { - typedef typename vector20_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C17,C18,C19 >::type type; + typedef typename vector20_c< T, T(C0), T(C1), T(C2), T(C3), T(C4), T(C5), T(C6), T(C7), T(C8), T(C9), T(C10), T(C11), T(C12), T(C13), T(C14), T(C15), T(C16), T(C17), T(C18), T(C19) >::type type; }; }} diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/add.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/add.hpp index b358915119842948cea46b2b02c075e7866acba5..9cf4a9a82e52b23c33488d0f5eb6e090a1335b29 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/add.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/add.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/add.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.6 $ +// $Id: add.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/def_params_tail.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/def_params_tail.hpp index 85e9707873a8fcddef12f63483a84181e1d7cced..7b0b0afb35f6d3c5bbdc21e0ee6227276527c4fb 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/def_params_tail.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/def_params_tail.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/def_params_tail.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.6 $ +// $Id: def_params_tail.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/limits/arity.hpp> #include <boost/mpl/aux_/config/dtp.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/default_params.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/default_params.hpp index c904b27dd731ee4f584e4e6c9a2a1bd9501d1738..63cf92e3dd5cc1d77dd84093cf9799ab2ab51ef1 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/default_params.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/default_params.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/default_params.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.5 $ +// $Id: default_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/enum.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/enum.hpp index c452c1d1769bced376002e2f927d1d8332c9e4e4..a7f95e34bea3dcddb468794a5d1c37d55b33cd1b 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/enum.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/enum.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/enum.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.5 $ +// $Id: enum.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/ext_params.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/ext_params.hpp index 1038eee7a8bf2711287ae1e7a5af2484c8bb73f4..6bbb1113e139379e0f33ee47166bf5eee6d62c8c 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/ext_params.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/ext_params.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/ext_params.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.5 $ +// $Id: ext_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/filter_params.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/filter_params.hpp index 80324638b8b3924b0c48b013ff5db59691124abe..38f3cbfd717072dc266bd56f1ccbc5300a6d9e07 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/filter_params.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/filter_params.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/filter_params.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.4 $ +// $Id: filter_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define BOOST_MPL_PP_FILTER_PARAMS_0(p1,p2,p3,p4,p5,p6,p7,p8,p9) #define BOOST_MPL_PP_FILTER_PARAMS_1(p1,p2,p3,p4,p5,p6,p7,p8,p9) p1 diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/is_seq.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/is_seq.hpp index 0f7a2e790f37cb8ac2d172559f9a1dd4873bf01a..5d8acf590e4717040a17bf16599b6464ae7d9f7f 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/is_seq.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/is_seq.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/is_seq.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.3 $ +// $Id: is_seq.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/seq/size.hpp> #include <boost/preprocessor/arithmetic/dec.hpp> @@ -27,7 +27,7 @@ // BOOST_PP_ASSERT( BOOST_MPL_PP_IS_SEQ( (int) ) ) // BOOST_PP_ASSERT( BOOST_MPL_PP_IS_SEQ( (1)(2) ) ) -#if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC() +#if (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC()) || defined(_MSC_VER) && defined(__INTEL_COMPILER) && __INTEL_COMPILER == 1010 # define BOOST_MPL_PP_IS_SEQ(seq) BOOST_PP_DEC( BOOST_PP_SEQ_SIZE( BOOST_MPL_PP_IS_SEQ_(seq) ) ) # define BOOST_MPL_PP_IS_SEQ_(seq) BOOST_MPL_PP_IS_SEQ_SEQ_( BOOST_MPL_PP_IS_SEQ_SPLIT_ seq ) diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/params.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/params.hpp index 80e354baed67357636dc2e1b0815b396f89abf66..410a8d0d0aa63819204b4b2c95cc89ed9cd281ce 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/params.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/params.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/params.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.5 $ +// $Id: params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/partial_spec_params.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/partial_spec_params.hpp index cee22c357904db78e58259727940cfb5685d91e8..346d9cdc09477b713d844a8709c67f07c9e91b01 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/partial_spec_params.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/partial_spec_params.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/partial_spec_params.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.3 $ +// $Id: partial_spec_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/limits/arity.hpp> #include <boost/mpl/aux_/preprocessor/params.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/range.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/range.hpp index d51eb416fcb90fece32442a1de551a90b105a9d9..cd4c5113c9e15e6bb73c6a27294a2520207b520b 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/range.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/range.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/range.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.3 $ +// $Id: range.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/seq/subseq.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/repeat.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/repeat.hpp index 630f7841792e6c9daff8b8fec951e0f2b810df3b..cfebe043b56ddda6d6f71220b24cf1c77881d8f7 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/repeat.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/repeat.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/repeat.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.5 $ +// $Id: repeat.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/sub.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/sub.hpp index 38b88876827936a8d03b4f77d1dc2dc071275b8a..8ba8132e9c8b94a0ec78f981fca770a56eb9f6af 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/sub.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/sub.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/sub.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.7 $ +// $Id: sub.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/token_equal.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/token_equal.hpp index 6ec4de813fd1652edd4fc58b44e6a4331b611b1b..0df58b7525848fc1dfb202877c1ee73fa0b6f7fe 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/token_equal.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/token_equal.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/token_equal.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.3 $ +// $Id: token_equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/preprocessor/is_seq.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/preprocessor/tuple.hpp b/Utilities/BGL/boost/mpl/aux_/preprocessor/tuple.hpp index b2459e53bf9ef807b0bf1fd01eb75137c661e4dd..f46d0e965160a9a596cab4f86e88fa558bf7ce06 100644 --- a/Utilities/BGL/boost/mpl/aux_/preprocessor/tuple.hpp +++ b/Utilities/BGL/boost/mpl/aux_/preprocessor/tuple.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/preprocessor/tuple.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.5 $ +// $Id: tuple.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define BOOST_MPL_PP_TUPLE_11_ELEM_0(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10) e0 #define BOOST_MPL_PP_TUPLE_11_ELEM_1(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10) e1 diff --git a/Utilities/BGL/boost/mpl/aux_/ptr_to_ref.hpp b/Utilities/BGL/boost/mpl/aux_/ptr_to_ref.hpp index 49c74c9682478dde08a9c9ea315b8c6553cc6e48..3b5415c26eab56618d407afe60212f857b3dfe6f 100644 --- a/Utilities/BGL/boost/mpl/aux_/ptr_to_ref.hpp +++ b/Utilities/BGL/boost/mpl/aux_/ptr_to_ref.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/ptr_to_ref.hpp,v $ -// $Date: 2005/06/22 15:20:18 $ -// $Revision: 1.5 $ +// $Id: ptr_to_ref.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/static_cast.hpp> #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/push_back_impl.hpp b/Utilities/BGL/boost/mpl/aux_/push_back_impl.hpp index f296e72b93068fcad116dfae8797234a90e5915e..2f839cb88ac5ea226ac6d8044610133e1c7fcd93 100644 --- a/Utilities/BGL/boost/mpl/aux_/push_back_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/push_back_impl.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_AUX_PUSH_BACK_IMPL_HPP_INCLUDED #define BOOST_MPL_AUX_PUSH_BACK_IMPL_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,24 +10,39 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/push_back_impl.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.4 $ +// $Id: push_back_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $ +// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $ +// $Revision: 55679 $ #include <boost/mpl/push_back_fwd.hpp> +#include <boost/mpl/assert.hpp> #include <boost/mpl/aux_/has_type.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> #include <boost/mpl/aux_/config/forwarding.hpp> #include <boost/mpl/aux_/config/static_constant.hpp> +#include <boost/type_traits/is_same.hpp> + namespace boost { namespace mpl { +struct has_push_back_arg {}; + // agurt 05/feb/04: no default implementation; the stub definition is needed // to enable the default 'has_push_back' implementation below template< typename Tag > struct push_back_impl { - template< typename Sequence, typename T > struct apply {}; + template< typename Sequence, typename T > struct apply + { + // should be instantiated only in the context of 'has_push_back_impl'; + // if you've got an assert here, you are requesting a 'push_back' + // specialization that doesn't exist. + BOOST_MPL_ASSERT_MSG( + ( boost::is_same< T, has_push_back_arg >::value ) + , REQUESTED_PUSH_BACK_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST + , ( Sequence ) + ); + }; }; template< typename Tag > @@ -35,13 +50,13 @@ struct has_push_back_impl { template< typename Seq > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) - : aux::has_type< push_back<Seq,int> > + : aux::has_type< push_back< Seq, has_push_back_arg > > { #else { - typedef aux::has_type< push_back<Seq,int> > type; + typedef aux::has_type< push_back< Seq, has_push_back_arg > > type; BOOST_STATIC_CONSTANT(bool, value = - (aux::has_type< push_back<Seq,int> >::value) + (aux::has_type< push_back< Seq, has_push_back_arg > >::value) ); #endif }; diff --git a/Utilities/BGL/boost/mpl/aux_/push_front_impl.hpp b/Utilities/BGL/boost/mpl/aux_/push_front_impl.hpp index 6cef9442584690cacdf4479659982f3044df2b51..6723ea3894bfe3505b019049d6e090a473f4dbbe 100644 --- a/Utilities/BGL/boost/mpl/aux_/push_front_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/push_front_impl.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_AUX_PUSH_FRONT_IMPL_HPP_INCLUDED #define BOOST_MPL_AUX_PUSH_FRONT_IMPL_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,25 +10,40 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/push_front_impl.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.4 $ +// $Id: push_front_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $ +// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $ +// $Revision: 55679 $ #include <boost/mpl/push_front_fwd.hpp> +#include <boost/mpl/assert.hpp> #include <boost/mpl/aux_/has_type.hpp> #include <boost/mpl/aux_/traits_lambda_spec.hpp> #include <boost/mpl/aux_/config/forwarding.hpp> #include <boost/mpl/aux_/config/static_constant.hpp> +#include <boost/type_traits/is_same.hpp> + namespace boost { namespace mpl { +struct has_push_front_arg {}; + // agurt 05/feb/04: no default implementation; the stub definition is needed // to enable the default 'has_push_front' implementation below template< typename Tag > struct push_front_impl { - template< typename Sequence, typename T > struct apply {}; + template< typename Sequence, typename T > struct apply + { + // should be instantiated only in the context of 'has_push_front_impl'; + // if you've got an assert here, you are requesting a 'push_front' + // specialization that doesn't exist. + BOOST_MPL_ASSERT_MSG( + ( boost::is_same< T, has_push_front_arg >::value ) + , REQUESTED_PUSH_FRONT_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST + , ( Sequence ) + ); + }; }; template< typename Tag > @@ -36,13 +51,13 @@ struct has_push_front_impl { template< typename Seq > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) - : aux::has_type< push_front<Seq,int> > + : aux::has_type< push_front< Seq, has_push_front_arg > > { #else { - typedef aux::has_type< push_front<Seq,int> > type; + typedef aux::has_type< push_front< Seq, has_push_front_arg > > type; BOOST_STATIC_CONSTANT(bool, value = - (aux::has_type< push_front<Seq,int> >::value) + (aux::has_type< push_front< Seq, has_push_front_arg > >::value) ); #endif }; diff --git a/Utilities/BGL/boost/mpl/aux_/range_c/O1_size.hpp b/Utilities/BGL/boost/mpl/aux_/range_c/O1_size.hpp index ae5545faaff0526ca1549c27c93d2186420a9f4b..2aa05cd75be3f6d8ba07b6b6677a9c5837baaf5e 100644 --- a/Utilities/BGL/boost/mpl/aux_/range_c/O1_size.hpp +++ b/Utilities/BGL/boost/mpl/aux_/range_c/O1_size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/range_c/O1_size.hpp,v $ -// $Date: 2004/09/02 15:40:56 $ -// $Revision: 1.4 $ +// $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> #include <boost/mpl/aux_/range_c/size.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/range_c/back.hpp b/Utilities/BGL/boost/mpl/aux_/range_c/back.hpp index 9f92d961589b55e940844105f2e8a5de269c9685..84f6e9d59ca90e95fd4118b345847efdab816d7c 100644 --- a/Utilities/BGL/boost/mpl/aux_/range_c/back.hpp +++ b/Utilities/BGL/boost/mpl/aux_/range_c/back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/range_c/back.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.4 $ +// $Id: back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/back_fwd.hpp> #include <boost/mpl/prior.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/range_c/empty.hpp b/Utilities/BGL/boost/mpl/aux_/range_c/empty.hpp index a3af984b34feb871eb8b0ed47aa62aa12658f4cf..076447d26a9104ea748fd02c6c402eb5df16ee21 100644 --- a/Utilities/BGL/boost/mpl/aux_/range_c/empty.hpp +++ b/Utilities/BGL/boost/mpl/aux_/range_c/empty.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/range_c/empty.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.5 $ +// $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> #include <boost/mpl/equal_to.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/range_c/front.hpp b/Utilities/BGL/boost/mpl/aux_/range_c/front.hpp index 97902b9b78cb69c7ba1c1aff23f2c63e6ebf82b1..0a5f41186e94e07cd695a942bd35a94b42a9f354 100644 --- a/Utilities/BGL/boost/mpl/aux_/range_c/front.hpp +++ b/Utilities/BGL/boost/mpl/aux_/range_c/front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/range_c/front.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.4 $ +// $Id: front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> #include <boost/mpl/aux_/range_c/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/range_c/iterator.hpp b/Utilities/BGL/boost/mpl/aux_/range_c/iterator.hpp index 726f602b14c2d21b2980591fe5cf179cedf5bc1b..e19946b24dba3bd8060608a8c07d026af3f1a7ac 100644 --- a/Utilities/BGL/boost/mpl/aux_/range_c/iterator.hpp +++ b/Utilities/BGL/boost/mpl/aux_/range_c/iterator.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/range_c/iterator.hpp,v $ -// $Date: 2004/12/20 17:52:43 $ -// $Revision: 1.8 $ +// $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/iterator_tags.hpp> #include <boost/mpl/advance_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/range_c/size.hpp b/Utilities/BGL/boost/mpl/aux_/range_c/size.hpp index 3c71f1a5fae3d700d0fb53ea39d3d4208e534085..384243cc5865b113f4a0ff43c4df9c4d4b61bd68 100644 --- a/Utilities/BGL/boost/mpl/aux_/range_c/size.hpp +++ b/Utilities/BGL/boost/mpl/aux_/range_c/size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/range_c/size.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.5 $ +// $Id: size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/minus.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/range_c/tag.hpp b/Utilities/BGL/boost/mpl/aux_/range_c/tag.hpp index 0951efe40f7b3ee219dec62b13359179bfeaa6b8..895793b3ef332ef49af042d9529e9e851d543a1f 100644 --- a/Utilities/BGL/boost/mpl/aux_/range_c/tag.hpp +++ b/Utilities/BGL/boost/mpl/aux_/range_c/tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/range_c/tag.hpp,v $ -// $Date: 2004/11/28 01:31:44 $ -// $Revision: 1.5 $ +// $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl.hpp index c5ea0e6f979b076f4489727f47867b23d0c5be07..b8e2308e84baef2ce38128021551dfbe4a38f140 100644 --- a/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/reverse_fold_impl.hpp,v $ -// $Date: 2004/10/01 16:29:34 $ -// $Revision: 1.3 $ +// $Id: reverse_fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl_body.hpp b/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl_body.hpp index 30a3db2a5dc201e6b4c8e63ee3552c486210af14..7bd561874bd74062cfdbf5e26629bfbd8454482c 100644 --- a/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl_body.hpp +++ b/Utilities/BGL/boost/mpl/aux_/reverse_fold_impl_body.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/reverse_fold_impl_body.hpp,v $ -// $Date: 2004/10/24 08:18:03 $ -// $Revision: 1.3 $ +// $Id: reverse_fold_impl_body.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ # include <boost/mpl/limits/unrolling.hpp> # include <boost/mpl/aux_/preprocessor/repeat.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/reverse_iter_fold_impl.hpp b/Utilities/BGL/boost/mpl/aux_/reverse_iter_fold_impl.hpp index 9c4e253305c63daef32d41b5f0b69892f5dfbe5c..ce9257fb0e3e8a543320fe9e116d7e2a0f3720e3 100644 --- a/Utilities/BGL/boost/mpl/aux_/reverse_iter_fold_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/reverse_iter_fold_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/reverse_iter_fold_impl.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.2 $ +// $Id: reverse_iter_fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/sequence_wrapper.hpp b/Utilities/BGL/boost/mpl/aux_/sequence_wrapper.hpp index ebb614cec443bd0febbfa7366253e4c7e4bdf8ba..3f9f8cad2577e3cae3c422c48f23615b56d558aa 100644 --- a/Utilities/BGL/boost/mpl/aux_/sequence_wrapper.hpp +++ b/Utilities/BGL/boost/mpl/aux_/sequence_wrapper.hpp @@ -5,7 +5,7 @@ ///// header body -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -13,9 +13,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/sequence_wrapper.hpp,v $ -// $Date: 2004/11/28 01:46:37 $ -// $Revision: 1.4 $ +// $Id: sequence_wrapper.hpp 49271 2008-10-11 06:46:00Z agurtovoy $ +// $Date: 2008-10-11 02:46:00 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49271 $ # include <boost/mpl/aux_/config/ctps.hpp> # include <boost/mpl/aux_/config/static_constant.hpp> @@ -124,9 +124,13 @@ namespace boost { namespace mpl { BOOST_PP_ENUM_PARAMS(n, AUX778076_SEQUENCE_TEMPLATE_PARAM) \ /**/ +# if !defined(AUX778076_SEQUENCE_CONVERT_CN_TO) +# define AUX778076_SEQUENCE_CONVERT_CN_TO(z,n,TARGET) BOOST_PP_CAT(C,n) +# endif + # define AUX778076_SEQUENCE_N_ARGS(n) \ T BOOST_PP_COMMA_IF(n) \ - BOOST_PP_ENUM_PARAMS(n, C) \ + BOOST_PP_ENUM(n,AUX778076_SEQUENCE_CONVERT_CN_TO,T) \ /**/ # define AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS(n) \ @@ -204,6 +208,7 @@ struct AUX778076_SEQUENCE_NAME # undef AUX778076_SEQUENCE_N_PARTIAL_SPEC_ARGS # undef AUX778076_SEQUENCE_N_ARGS +# undef AUX778076_SEQUENCE_CONVERT_CN_TO # undef AUX778076_SEQUENCE_N_PARAMS # undef AUX778076_SEQUENCE_DEFAULT_PARAMS # undef AUX778076_SEQUENCE_ARGS diff --git a/Utilities/BGL/boost/mpl/aux_/shift_op.hpp b/Utilities/BGL/boost/mpl/aux_/shift_op.hpp index de9da83d985fcf1a8d39e6f92dfa0932de6efdf1..fbfd46f0b1975d43c491a8affd90862f4508f145 100644 --- a/Utilities/BGL/boost/mpl/aux_/shift_op.hpp +++ b/Utilities/BGL/boost/mpl/aux_/shift_op.hpp @@ -9,9 +9,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/shift_op.hpp,v $ -// $Date: 2004/09/07 08:51:32 $ -// $Revision: 1.4 $ +// $Id: shift_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/integral_c.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/single_element_iter.hpp b/Utilities/BGL/boost/mpl/aux_/single_element_iter.hpp index 410f2f802ca980b811cdebeee175ac0efbf59afb..ab20d97fe09dfc0ff53a413a8162b054e7ee5447 100644 --- a/Utilities/BGL/boost/mpl/aux_/single_element_iter.hpp +++ b/Utilities/BGL/boost/mpl/aux_/single_element_iter.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/single_element_iter.hpp,v $ -// $Date: 2004/11/28 01:47:44 $ -// $Revision: 1.8 $ +// $Id: single_element_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/iterator_tags.hpp> #include <boost/mpl/advance_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/size_impl.hpp b/Utilities/BGL/boost/mpl/aux_/size_impl.hpp index d10ca8e6035ac474df3af0ec530590da9059cb31..0e4885d7fc2f52369a4d37f0f9bf5cfdfbc6d7bf 100644 --- a/Utilities/BGL/boost/mpl/aux_/size_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/size_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/size_impl.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.5 $ +// $Id: size_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/begin_end.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/sort_impl.hpp b/Utilities/BGL/boost/mpl/aux_/sort_impl.hpp index b1e3b49424ab95d748ef7225bbb8ab15f6054811..24f219400b067198c5068b6ca7f7060381f3d101 100644 --- a/Utilities/BGL/boost/mpl/aux_/sort_impl.hpp +++ b/Utilities/BGL/boost/mpl/aux_/sort_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/sort_impl.hpp,v $ -// $Date: 2004/11/28 01:47:44 $ -// $Revision: 1.5 $ +// $Id: sort_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/partition.hpp> #include <boost/mpl/copy.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/static_cast.hpp b/Utilities/BGL/boost/mpl/aux_/static_cast.hpp index 5a46a1e05675531229761fe457b8a67ee55ab82f..133730d3badbd15884c2a56155dce4f4165f8fa6 100644 --- a/Utilities/BGL/boost/mpl/aux_/static_cast.hpp +++ b/Utilities/BGL/boost/mpl/aux_/static_cast.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/static_cast.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.3 $ +// $Id: static_cast.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/template_arity.hpp b/Utilities/BGL/boost/mpl/aux_/template_arity.hpp index cbabbe1e05e34eabcb2d8b1c3e141c5025ff7deb..47e4eeb54fb88583b4fad187f788110ed73e0f63 100644 --- a/Utilities/BGL/boost/mpl/aux_/template_arity.hpp +++ b/Utilities/BGL/boost/mpl/aux_/template_arity.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/template_arity.hpp,v $ -// $Date: 2004/09/07 12:24:48 $ -// $Revision: 1.11 $ +// $Id: template_arity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/ttp.hpp> #include <boost/mpl/aux_/config/lambda.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/template_arity_fwd.hpp b/Utilities/BGL/boost/mpl/aux_/template_arity_fwd.hpp index faeeb03de0454a448dfb4d227c1f099a8ff7ae9a..4b7c8b819e844c29def10865c527f1c1dc60a852 100644 --- a/Utilities/BGL/boost/mpl/aux_/template_arity_fwd.hpp +++ b/Utilities/BGL/boost/mpl/aux_/template_arity_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/template_arity_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.4 $ +// $Id: template_arity_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/aux_/test.hpp b/Utilities/BGL/boost/mpl/aux_/test.hpp index 0b0c875b885c79ecbded77991b36e4c586ea699f..853556f50bdc7a54fca3c01cfe78da9e64a6d2bd 100644 --- a/Utilities/BGL/boost/mpl/aux_/test.hpp +++ b/Utilities/BGL/boost/mpl/aux_/test.hpp @@ -10,19 +10,20 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/test.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.3 $ +// $Id: test.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/test/test_case.hpp> #include <boost/mpl/aux_/test/data.hpp> #include <boost/mpl/aux_/test/assert.hpp> +#include <boost/detail/lightweight_test.hpp> #include <boost/type_traits/is_same.hpp> int main() { - return 0; + return boost::report_errors(); } using namespace boost; diff --git a/Utilities/BGL/boost/mpl/aux_/test/assert.hpp b/Utilities/BGL/boost/mpl/aux_/test/assert.hpp index ab37bd4b81c5e1e573cd4b4381fc6418301b4756..97cbe9687be942c6089d42bebef321d7c8908d21 100644 --- a/Utilities/BGL/boost/mpl/aux_/test/assert.hpp +++ b/Utilities/BGL/boost/mpl/aux_/test/assert.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/test/assert.hpp,v $ -// $Date: 2004/10/01 16:29:37 $ -// $Revision: 1.4 $ +// $Id: assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/assert.hpp> #include <boost/preprocessor/cat.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/test/data.hpp b/Utilities/BGL/boost/mpl/aux_/test/data.hpp index 59799051c7029127b42690bf6a7cd8fd4d073b89..0a11571720249c5b9d68793084bcbf71b9cf0a45 100644 --- a/Utilities/BGL/boost/mpl/aux_/test/data.hpp +++ b/Utilities/BGL/boost/mpl/aux_/test/data.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/test/data.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.3 $ +// $Id: data.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/noncopyable.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/test/test_case.hpp b/Utilities/BGL/boost/mpl/aux_/test/test_case.hpp index d946359d9b8c99cd257896bd75c60d4a06485ab2..48038128d570a40bfb487c607cf56e6144dab3e7 100644 --- a/Utilities/BGL/boost/mpl/aux_/test/test_case.hpp +++ b/Utilities/BGL/boost/mpl/aux_/test/test_case.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/test/test_case.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.3 $ +// $Id: test_case.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/cat.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/traits_lambda_spec.hpp b/Utilities/BGL/boost/mpl/aux_/traits_lambda_spec.hpp index 6c9d47b2de8a02fadf4fbf1c0e9840438c2157a0..f312f6d39d5dfe32bb8433471a2c217ec3b0a934 100644 --- a/Utilities/BGL/boost/mpl/aux_/traits_lambda_spec.hpp +++ b/Utilities/BGL/boost/mpl/aux_/traits_lambda_spec.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_AUX_TRAITS_LAMBDA_SPEC_HPP_INCLUDED #define BOOST_MPL_AUX_TRAITS_LAMBDA_SPEC_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,21 +10,22 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/traits_lambda_spec.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.6 $ +// $Id: traits_lambda_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ +#include <boost/mpl/sequence_tag_fwd.hpp> #include <boost/mpl/void.hpp> #include <boost/mpl/aux_/preprocessor/params.hpp> #include <boost/mpl/aux_/config/lambda.hpp> #if !defined(BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT) -# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) /**/ +# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(i, trait) /**/ #elif !defined(BOOST_MPL_CFG_MSVC_ETI_BUG) -# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) \ +# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(i, trait) \ template<> struct trait<void_> \ { \ template< BOOST_MPL_PP_PARAMS(i, typename T) > struct apply \ @@ -35,7 +36,7 @@ template<> struct trait<void_> \ #else -# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) \ +# define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(i, trait) \ template<> struct trait<void_> \ { \ template< BOOST_MPL_PP_PARAMS(i, typename T) > struct apply \ @@ -53,4 +54,10 @@ template<> struct trait<int> \ #endif // BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT + +#define BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(i, trait) \ + BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC_IMPL(i, trait) \ + template<> struct trait<non_sequence_tag> {}; \ +/**/ + #endif // BOOST_MPL_AUX_TRAITS_LAMBDA_SPEC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/aux_/transform_iter.hpp b/Utilities/BGL/boost/mpl/aux_/transform_iter.hpp index d35436065da029e7ff1a32553861f2199b3ee1c6..2d678935d4e5ae9772dc2a5a4339dacce17c160c 100644 --- a/Utilities/BGL/boost/mpl/aux_/transform_iter.hpp +++ b/Utilities/BGL/boost/mpl/aux_/transform_iter.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/transform_iter.hpp,v $ -// $Date: 2004/09/07 12:07:56 $ -// $Revision: 1.4 $ +// $Id: transform_iter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/apply.hpp> #include <boost/mpl/iterator_tags.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/type_wrapper.hpp b/Utilities/BGL/boost/mpl/aux_/type_wrapper.hpp index a92d0a3ab8ff532219b19536093e2f40573b867e..0583f72c03deaae8619345fe6cce2a8e38c75fc1 100644 --- a/Utilities/BGL/boost/mpl/aux_/type_wrapper.hpp +++ b/Utilities/BGL/boost/mpl/aux_/type_wrapper.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/type_wrapper.hpp,v $ -// $Date: 2004/09/28 13:56:59 $ -// $Revision: 1.6 $ +// $Id: type_wrapper.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/ctps.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/unwrap.hpp b/Utilities/BGL/boost/mpl/aux_/unwrap.hpp index f8b1ee1364691cc94409b1a6e5df4b21cf1e4665..dd710a7e8edb2d05cea1b9b3e1acd61b1dc78a0c 100644 --- a/Utilities/BGL/boost/mpl/aux_/unwrap.hpp +++ b/Utilities/BGL/boost/mpl/aux_/unwrap.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/unwrap.hpp,v $ -// $Date: 2004/09/02 15:40:44 $ -// $Revision: 1.3 $ +// $Id: unwrap.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/ref.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/value_wknd.hpp b/Utilities/BGL/boost/mpl/aux_/value_wknd.hpp index b94b62486be38124c2bb374b67bb70da191aa3f0..9de1103b1cadec4f68fff138c9e7e30e8d1326a4 100644 --- a/Utilities/BGL/boost/mpl/aux_/value_wknd.hpp +++ b/Utilities/BGL/boost/mpl/aux_/value_wknd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/value_wknd.hpp,v $ -// $Date: 2004/12/20 17:51:57 $ -// $Revision: 1.14 $ +// $Id: value_wknd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/static_cast.hpp> #include <boost/mpl/aux_/config/integral.hpp> diff --git a/Utilities/BGL/boost/mpl/aux_/yes_no.hpp b/Utilities/BGL/boost/mpl/aux_/yes_no.hpp index c2c1e6aebfba2273c8ce74a2c55f79b1ee14d660..c3f567d88af29a4d60fe038fc867717ff2d41b2c 100644 --- a/Utilities/BGL/boost/mpl/aux_/yes_no.hpp +++ b/Utilities/BGL/boost/mpl/aux_/yes_no.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/aux_/yes_no.hpp,v $ -// $Date: 2004/09/28 13:56:59 $ -// $Revision: 1.7 $ +// $Id: yes_no.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/nttp_decl.hpp> #include <boost/mpl/aux_/config/arrays.hpp> @@ -38,7 +38,7 @@ template<> struct yes_no_tag<true> template< BOOST_MPL_AUX_NTTP_DECL(long, n) > struct weighted_tag { -#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) typedef char (&type)[n]; #else char buf[n]; diff --git a/Utilities/BGL/boost/mpl/back.hpp b/Utilities/BGL/boost/mpl/back.hpp index b140d06b1f50c4e9e014dc7b1682ff31df4d446f..fe2158f1e20462f104e3aa84f83a82aeaf02be05 100644 --- a/Utilities/BGL/boost/mpl/back.hpp +++ b/Utilities/BGL/boost/mpl/back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/back.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/back_fwd.hpp> #include <boost/mpl/aux_/back_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/back_fwd.hpp b/Utilities/BGL/boost/mpl/back_fwd.hpp index c4892591bd3244e81cd8dcd5abaa8ec8ecebe478..cc01e33c64b3ed860ca5c320640ff58aa3c7ef06 100644 --- a/Utilities/BGL/boost/mpl/back_fwd.hpp +++ b/Utilities/BGL/boost/mpl/back_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/back_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: back_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/back_inserter.hpp b/Utilities/BGL/boost/mpl/back_inserter.hpp index 614231e82b9d4048fbc2789e97703181126f1d45..fa4ede802df46b817cb2ba847b8af2aa68fb3b0e 100644 --- a/Utilities/BGL/boost/mpl/back_inserter.hpp +++ b/Utilities/BGL/boost/mpl/back_inserter.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/back_inserter.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: back_inserter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_back.hpp> #include <boost/mpl/inserter.hpp> diff --git a/Utilities/BGL/boost/mpl/base.hpp b/Utilities/BGL/boost/mpl/base.hpp index 8bc5a575752495d69eef95d39d6a73cb9cb81785..3f7e8a4ed329567a87493750bd0e4d111f1d6e42 100644 --- a/Utilities/BGL/boost/mpl/base.hpp +++ b/Utilities/BGL/boost/mpl/base.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/base.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: base.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> diff --git a/Utilities/BGL/boost/mpl/begin.hpp b/Utilities/BGL/boost/mpl/begin.hpp index 58378a69b6c28c56302434b3a885c0faeae10f2b..74ae3b90feb24189ddfa84e3d34cf07b72a2fd7f 100644 --- a/Utilities/BGL/boost/mpl/begin.hpp +++ b/Utilities/BGL/boost/mpl/begin.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/begin.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: begin.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/Utilities/BGL/boost/mpl/begin_end.hpp b/Utilities/BGL/boost/mpl/begin_end.hpp index d535501f6ac63220743d6e20ab409e40ee1fec5c..7d8d9eb25a860fc5c933408551b216a72a12ec06 100644 --- a/Utilities/BGL/boost/mpl/begin_end.hpp +++ b/Utilities/BGL/boost/mpl/begin_end.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/begin_end.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: begin_end.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> #include <boost/mpl/aux_/begin_end_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/begin_end_fwd.hpp b/Utilities/BGL/boost/mpl/begin_end_fwd.hpp index a8280f3fa46b50fdaffdae6511e4e804c7f5eb56..1ac62c6d0a2c35afdd2c24bfa55b51caa6f6f92d 100644 --- a/Utilities/BGL/boost/mpl/begin_end_fwd.hpp +++ b/Utilities/BGL/boost/mpl/begin_end_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/begin_end_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: begin_end_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/bind.hpp b/Utilities/BGL/boost/mpl/bind.hpp index 869eb956a435a8c6fcd17b1faacd9cf062605314..5d851ef5ad8c6aa739dcf2c5c8d69b0f28e750d5 100644 --- a/Utilities/BGL/boost/mpl/bind.hpp +++ b/Utilities/BGL/boost/mpl/bind.hpp @@ -15,9 +15,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bind.hpp,v $ -// $Date: 2004/10/26 14:51:04 $ -// $Revision: 1.13 $ +// $Id: bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/bind_fwd.hpp> @@ -361,7 +361,10 @@ BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC( ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 # define i_ BOOST_PP_FRAME_ITERATION(1) @@ -544,4 +547,5 @@ struct bind_chooser<i_> # endif # undef j_ +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/bind_fwd.hpp b/Utilities/BGL/boost/mpl/bind_fwd.hpp index dc2024bf19c7d4fcc70ea666db2fc989caed9f16..18ac881221ace16eeb4a82dec59f998334fd1544 100644 --- a/Utilities/BGL/boost/mpl/bind_fwd.hpp +++ b/Utilities/BGL/boost/mpl/bind_fwd.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bind_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: bind_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/aux_/na.hpp> diff --git a/Utilities/BGL/boost/mpl/bitand.hpp b/Utilities/BGL/boost/mpl/bitand.hpp index 50c82bf48886a77a98caa1d2cb2fa4df2553dc1f..b7d658ba35fb3b366cd01b10b41805c8317f47ab 100644 --- a/Utilities/BGL/boost/mpl/bitand.hpp +++ b/Utilities/BGL/boost/mpl/bitand.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bitand.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: bitand.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME bitand_ #define AUX778076_OP_PREFIX bitand diff --git a/Utilities/BGL/boost/mpl/bitor.hpp b/Utilities/BGL/boost/mpl/bitor.hpp index e17f4a0dddfd0cd6b6d6617b4dfc0e57256afb90..1c7a10aaa6c7638c8b759fac1c5c8c36d25dcfb9 100644 --- a/Utilities/BGL/boost/mpl/bitor.hpp +++ b/Utilities/BGL/boost/mpl/bitor.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bitor.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: bitor.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME bitor_ #define AUX778076_OP_PREFIX bitor diff --git a/Utilities/BGL/boost/mpl/bitwise.hpp b/Utilities/BGL/boost/mpl/bitwise.hpp index abbf0dd960ce4194fcce4c4509cc348cfd80bc9c..740fff1e8bc1d5d87d734dcf00ae57c3119438a6 100644 --- a/Utilities/BGL/boost/mpl/bitwise.hpp +++ b/Utilities/BGL/boost/mpl/bitwise.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bitwise.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: bitwise.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/bitand.hpp> #include <boost/mpl/bitor.hpp> diff --git a/Utilities/BGL/boost/mpl/bitxor.hpp b/Utilities/BGL/boost/mpl/bitxor.hpp index 203b3a3c99caa27b42cb18019f837f04287d0d04..bbbc3dd5bced743114816a6573f17c81e35d1d19 100644 --- a/Utilities/BGL/boost/mpl/bitxor.hpp +++ b/Utilities/BGL/boost/mpl/bitxor.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bitxor.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: bitxor.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME bitxor_ #define AUX778076_OP_PREFIX bitxor diff --git a/Utilities/BGL/boost/mpl/bool.hpp b/Utilities/BGL/boost/mpl/bool.hpp index d48c3da42f7ec84b68c413e3e2fe3a3e15ec1985..a815ac5f4ddb4b69803af86a249048d995b97e59 100644 --- a/Utilities/BGL/boost/mpl/bool.hpp +++ b/Utilities/BGL/boost/mpl/bool.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bool.hpp,v $ -// $Date: 2004/09/26 09:54:25 $ -// $Revision: 1.6 $ +// $Id: bool.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/bool_fwd.hpp> #include <boost/mpl/integral_c_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/bool_fwd.hpp b/Utilities/BGL/boost/mpl/bool_fwd.hpp index 806fa7bc93f1949be4e40bbc885058fdd441829e..080d8762187070217511c950e9cbf0e2a7e883ab 100644 --- a/Utilities/BGL/boost/mpl/bool_fwd.hpp +++ b/Utilities/BGL/boost/mpl/bool_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/bool_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: bool_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/Utilities/BGL/boost/mpl/char.hpp b/Utilities/BGL/boost/mpl/char.hpp new file mode 100644 index 0000000000000000000000000000000000000000..08828c247a3090caffe81024e494503e6d1c4d77 --- /dev/null +++ b/Utilities/BGL/boost/mpl/char.hpp @@ -0,0 +1,22 @@ + +#ifndef BOOST_MPL_CHAR_HPP_INCLUDED +#define BOOST_MPL_CHAR_HPP_INCLUDED + +// Copyright Eric Niebler 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $ +// $Revision: 24874 $ + +#include <boost/mpl/char_fwd.hpp> + +#define AUX_WRAPPER_VALUE_TYPE char +#include <boost/mpl/aux_/integral_wrapper.hpp> + +#endif // BOOST_MPL_CHAR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/char_fwd.hpp b/Utilities/BGL/boost/mpl/char_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..442d0a161929d5954644587eb89e45e945d0a479 --- /dev/null +++ b/Utilities/BGL/boost/mpl/char_fwd.hpp @@ -0,0 +1,27 @@ + +#ifndef BOOST_MPL_CHAR_FWD_HPP_INCLUDED +#define BOOST_MPL_CHAR_FWD_HPP_INCLUDED + +// Copyright Eric Niebler 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $ +// $Revision: 24874 $ + +#include <boost/mpl/aux_/adl_barrier.hpp> +#include <boost/mpl/aux_/nttp_decl.hpp> + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN + +template< BOOST_MPL_AUX_NTTP_DECL(char, N) > struct char_; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +BOOST_MPL_AUX_ADL_BARRIER_DECL(char_) + +#endif // BOOST_MPL_CHAR_FWD_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/clear.hpp b/Utilities/BGL/boost/mpl/clear.hpp index 0850514a163952e5e78c77587d6ef4ecbef01529..c27f4b36ee81238f9ba8c4b4ecfca41b25029256 100644 --- a/Utilities/BGL/boost/mpl/clear.hpp +++ b/Utilities/BGL/boost/mpl/clear.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/clear.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: clear.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> #include <boost/mpl/aux_/clear_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/clear_fwd.hpp b/Utilities/BGL/boost/mpl/clear_fwd.hpp index 22ea994df5c03b688be033ff30900ab758638bf6..da5a6eb4c760ac08cc7ed20ea9c67460dd5dfca7 100644 --- a/Utilities/BGL/boost/mpl/clear_fwd.hpp +++ b/Utilities/BGL/boost/mpl/clear_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/clear_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: clear_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/comparison.hpp b/Utilities/BGL/boost/mpl/comparison.hpp index 2c4d72bfbe192d9218e5caddb17d681054d0282b..005d280b46cd8016e18a4da10933c462be9ae097 100644 --- a/Utilities/BGL/boost/mpl/comparison.hpp +++ b/Utilities/BGL/boost/mpl/comparison.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/comparison.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: comparison.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/equal_to.hpp> #include <boost/mpl/not_equal_to.hpp> diff --git a/Utilities/BGL/boost/mpl/contains.hpp b/Utilities/BGL/boost/mpl/contains.hpp index ed14ebedf52c9187085c1ae083f617d63766c51d..68e50bb8eae9c2d79cc10a0624f1f0fc3341cc49 100644 --- a/Utilities/BGL/boost/mpl/contains.hpp +++ b/Utilities/BGL/boost/mpl/contains.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/contains.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.6 $ +// $Id: contains.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/contains_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/contains_fwd.hpp b/Utilities/BGL/boost/mpl/contains_fwd.hpp index 5e074082210df5dea622a8cd4d847a55bd477f8b..57ae63f28f329e3513f8867a1b27d67b8458d635 100644 --- a/Utilities/BGL/boost/mpl/contains_fwd.hpp +++ b/Utilities/BGL/boost/mpl/contains_fwd.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/contains_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: contains_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/copy.hpp b/Utilities/BGL/boost/mpl/copy.hpp index 8045aaab6164781efd684669614b975c00eb1fb8..77376d064a039190c86417b28668d4f2719470bb 100644 --- a/Utilities/BGL/boost/mpl/copy.hpp +++ b/Utilities/BGL/boost/mpl/copy.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/copy.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: copy.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/reverse_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/copy_if.hpp b/Utilities/BGL/boost/mpl/copy_if.hpp index 1bfd84b222a297663d9f07ca9e887a40a04e70aa..937812e3b65c77bb5c4053941af2128c30eca579 100644 --- a/Utilities/BGL/boost/mpl/copy_if.hpp +++ b/Utilities/BGL/boost/mpl/copy_if.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/copy_if.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: copy_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/reverse_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/count.hpp b/Utilities/BGL/boost/mpl/count.hpp index 6a0feea39e9b7030962f4ac4327677404004f893..8fc054a0cfbdf46b264f41ebf4d71a7e035eb6d0 100644 --- a/Utilities/BGL/boost/mpl/count.hpp +++ b/Utilities/BGL/boost/mpl/count.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/count.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: count.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/count_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/count_fwd.hpp b/Utilities/BGL/boost/mpl/count_fwd.hpp index 8dcb2311bd26e795d3505b6e618fa7bd938a2039..d94ff0d6bc1d62818a286b78fdd6b81bf9b344b4 100644 --- a/Utilities/BGL/boost/mpl/count_fwd.hpp +++ b/Utilities/BGL/boost/mpl/count_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/count_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: count_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/count_if.hpp b/Utilities/BGL/boost/mpl/count_if.hpp index 5d20cec301a4f28bb4ef84310251a2484b77e18e..1bc8f9bf87cffb7204f868174d55fe4dd6da70d0 100644 --- a/Utilities/BGL/boost/mpl/count_if.hpp +++ b/Utilities/BGL/boost/mpl/count_if.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/count_if.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: count_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/next.hpp> diff --git a/Utilities/BGL/boost/mpl/deque.hpp b/Utilities/BGL/boost/mpl/deque.hpp index 40d9f53671f1d82c698b18a405285d8123221dd4..0e59316df735c6dc4f2e4c9a81c638b72ac3b896 100644 --- a/Utilities/BGL/boost/mpl/deque.hpp +++ b/Utilities/BGL/boost/mpl/deque.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/deque.hpp,v $ -// $Date: 2004/11/28 01:53:40 $ -// $Revision: 1.2 $ +// $Id: deque.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/vector.hpp> diff --git a/Utilities/BGL/boost/mpl/deref.hpp b/Utilities/BGL/boost/mpl/deref.hpp index 3705540d780d7e09bb21f41651a380fea4e76e3e..fedf79e46f792b81773dca8c65e73fdee87aa095 100644 --- a/Utilities/BGL/boost/mpl/deref.hpp +++ b/Utilities/BGL/boost/mpl/deref.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/deref.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: deref.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/msvc_type.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/distance.hpp b/Utilities/BGL/boost/mpl/distance.hpp index 7d16862930b93ad92d57228f6cde5e46331c5347..9a180ab8d5bb56721c33558de21d2555c700d6bf 100644 --- a/Utilities/BGL/boost/mpl/distance.hpp +++ b/Utilities/BGL/boost/mpl/distance.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/distance.hpp,v $ -// $Date: 2005/01/26 01:58:33 $ -// $Revision: 1.10 $ +// $Id: distance.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/distance_fwd.hpp> #include <boost/mpl/iter_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/distance_fwd.hpp b/Utilities/BGL/boost/mpl/distance_fwd.hpp index d0a419c34dd84b0c01f2625acf48272e75290167..ddd869801177e6c3de34763a909efdcb952ca14c 100644 --- a/Utilities/BGL/boost/mpl/distance_fwd.hpp +++ b/Utilities/BGL/boost/mpl/distance_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/distance_fwd.hpp,v $ -// $Date: 2004/11/28 01:53:40 $ -// $Revision: 1.3 $ +// $Id: distance_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/common_name_wknd.hpp> diff --git a/Utilities/BGL/boost/mpl/divides.hpp b/Utilities/BGL/boost/mpl/divides.hpp index 06f768b39196f1a372202d0a1e4c3f789e88d1fb..bef224bf2a1079939bbbea3bdc77196fd7a1ccff 100644 --- a/Utilities/BGL/boost/mpl/divides.hpp +++ b/Utilities/BGL/boost/mpl/divides.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/divides.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: divides.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME divides #define AUX778076_OP_TOKEN / diff --git a/Utilities/BGL/boost/mpl/empty.hpp b/Utilities/BGL/boost/mpl/empty.hpp index 244681dc8e279d33b72009d84092af5e6a8c1f96..adb3c76c449019e9dad13ec1d70455727b8c10cc 100644 --- a/Utilities/BGL/boost/mpl/empty.hpp +++ b/Utilities/BGL/boost/mpl/empty.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/empty.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/empty_base.hpp b/Utilities/BGL/boost/mpl/empty_base.hpp index 0f45ce05a6209907d4e8fc9c82eb11d8cda8cd0e..ace1bdf56a41f690f370df953f25807a8ee30413 100644 --- a/Utilities/BGL/boost/mpl/empty_base.hpp +++ b/Utilities/BGL/boost/mpl/empty_base.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/empty_base.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: empty_base.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/bool.hpp> #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/Utilities/BGL/boost/mpl/empty_fwd.hpp b/Utilities/BGL/boost/mpl/empty_fwd.hpp index f4313c1abf0173f3c29e4f3c98f2180939433e6a..28b226352ebc700c44c3ed90e703d51ac9c3b8f0 100644 --- a/Utilities/BGL/boost/mpl/empty_fwd.hpp +++ b/Utilities/BGL/boost/mpl/empty_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/empty_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: empty_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/empty_sequence.hpp b/Utilities/BGL/boost/mpl/empty_sequence.hpp index 47e82c44426b2f77c49a73839a68f7d21e56e14e..eefb6d805c17c6770a1512d377588c9d36018924 100644 --- a/Utilities/BGL/boost/mpl/empty_sequence.hpp +++ b/Utilities/BGL/boost/mpl/empty_sequence.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/empty_sequence.hpp,v $ -// $Date: 2004/11/28 01:53:40 $ -// $Revision: 1.2 $ +// $Id: empty_sequence.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/int.hpp> diff --git a/Utilities/BGL/boost/mpl/end.hpp b/Utilities/BGL/boost/mpl/end.hpp index d052dbf4d3318374f5943dbe6e48e856f3a3b700..3b7f33d0a9ffdcd4c2acd50965c3409a792b4cde 100644 --- a/Utilities/BGL/boost/mpl/end.hpp +++ b/Utilities/BGL/boost/mpl/end.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/end.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: end.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/Utilities/BGL/boost/mpl/equal.hpp b/Utilities/BGL/boost/mpl/equal.hpp index 671c9ae2fbc073230299962ed19de00a8291276c..741e9109b51bda8749bb821a0a8d6d2fa2a6fc77 100644 --- a/Utilities/BGL/boost/mpl/equal.hpp +++ b/Utilities/BGL/boost/mpl/equal.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/equal.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.6 $ +// $Id: equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/iter_fold_if_impl.hpp> #include <boost/mpl/aux_/iter_apply.hpp> diff --git a/Utilities/BGL/boost/mpl/equal_to.hpp b/Utilities/BGL/boost/mpl/equal_to.hpp index fb9be1bd0ff571ee547b3df888f8beb996b82cb9..dee5f59efe4bcaeb735f996149b0e3c589781147 100644 --- a/Utilities/BGL/boost/mpl/equal_to.hpp +++ b/Utilities/BGL/boost/mpl/equal_to.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/equal_to.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: equal_to.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME equal_to #define AUX778076_OP_TOKEN == diff --git a/Utilities/BGL/boost/mpl/erase.hpp b/Utilities/BGL/boost/mpl/erase.hpp index cf6104e0fb2bcf0b87723320c634c4b8094e7216..659530976770aab9cba14fae4ca263f2082356cd 100644 --- a/Utilities/BGL/boost/mpl/erase.hpp +++ b/Utilities/BGL/boost/mpl/erase.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/erase.hpp,v $ -// $Date: 2004/11/28 01:54:10 $ -// $Revision: 1.5 $ +// $Id: erase.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/erase_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/erase_fwd.hpp b/Utilities/BGL/boost/mpl/erase_fwd.hpp index 02a50a1967a1ff9c7712d133bba51a8c24f45aa9..0626ecbfe6b75c6bcc1b953f304add38b1b49b95 100644 --- a/Utilities/BGL/boost/mpl/erase_fwd.hpp +++ b/Utilities/BGL/boost/mpl/erase_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/erase_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: erase_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/erase_key.hpp b/Utilities/BGL/boost/mpl/erase_key.hpp index 8a89e5d5ca048d06b426f5ef4c4379ae2c769de2..84b486634f73895951ae1c87439c84acb7cd0885 100644 --- a/Utilities/BGL/boost/mpl/erase_key.hpp +++ b/Utilities/BGL/boost/mpl/erase_key.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/erase_key.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: erase_key.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/erase_key_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/erase_key_fwd.hpp b/Utilities/BGL/boost/mpl/erase_key_fwd.hpp index 12c7c5d666c4791b4d101ac8d167204aa494dc6d..4844893213e468a6924f79cbe8a8c4b48d9398f8 100644 --- a/Utilities/BGL/boost/mpl/erase_key_fwd.hpp +++ b/Utilities/BGL/boost/mpl/erase_key_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/erase_key_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: erase_key_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/eval_if.hpp b/Utilities/BGL/boost/mpl/eval_if.hpp index a15ac72f9dce0ef857ad68002958119b7a6748ea..3d94caf8253c78bdb66a68f61ad0e17f7e5630d9 100644 --- a/Utilities/BGL/boost/mpl/eval_if.hpp +++ b/Utilities/BGL/boost/mpl/eval_if.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/eval_if.hpp,v $ -// $Date: 2004/11/28 01:54:10 $ -// $Revision: 1.3 $ +// $Id: eval_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/if.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/filter_view.hpp b/Utilities/BGL/boost/mpl/filter_view.hpp index 67c81905d8cd22141fe68b948867aa2d938aa80f..c605f7fe50a245dc37cf063dc3762d4f9342ca41 100644 --- a/Utilities/BGL/boost/mpl/filter_view.hpp +++ b/Utilities/BGL/boost/mpl/filter_view.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/filter_view.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: filter_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/lambda.hpp> diff --git a/Utilities/BGL/boost/mpl/find.hpp b/Utilities/BGL/boost/mpl/find.hpp index a77f3cc9d283d339f72ea620ac189c91a5093d3e..6d71a88f0a69f16057da6f6e4058855f5ee6bcf2 100644 --- a/Utilities/BGL/boost/mpl/find.hpp +++ b/Utilities/BGL/boost/mpl/find.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/find.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: find.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/find_if.hpp> #include <boost/mpl/same_as.hpp> diff --git a/Utilities/BGL/boost/mpl/find_if.hpp b/Utilities/BGL/boost/mpl/find_if.hpp index db06ecc317fb2fca1a7e3b256c14bdd14ec618f4..b1d41b789d23d5fb653c2c45561c28ce48016708 100644 --- a/Utilities/BGL/boost/mpl/find_if.hpp +++ b/Utilities/BGL/boost/mpl/find_if.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/find_if.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.10 $ +// $Id: find_if.hpp 49274 2008-10-11 07:22:05Z agurtovoy $ +// $Date: 2008-10-11 03:22:05 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49274 $ #include <boost/mpl/aux_/find_if_pred.hpp> #include <boost/mpl/arg.hpp> @@ -34,7 +34,7 @@ struct find_if typedef typename iter_fold_if< Sequence , void - , arg<1> // ignore + , mpl::arg<1> // ignore , protect< aux::find_if_pred<Predicate> > >::type result_; diff --git a/Utilities/BGL/boost/mpl/fold.hpp b/Utilities/BGL/boost/mpl/fold.hpp index 69fa823bb5b6a7e20e1ab55d7224c51ab17fef32..9645681f8ec719719bd145fdc918852e539799aa 100644 --- a/Utilities/BGL/boost/mpl/fold.hpp +++ b/Utilities/BGL/boost/mpl/fold.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/fold.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: fold.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/O1_size.hpp> diff --git a/Utilities/BGL/boost/mpl/for_each.hpp b/Utilities/BGL/boost/mpl/for_each.hpp index b1138b3df55aa8f98680e2c2de39276bc5765fe7..89abc85d5edfd8de7d4bb6a86583f027056c3dc5 100644 --- a/Utilities/BGL/boost/mpl/for_each.hpp +++ b/Utilities/BGL/boost/mpl/for_each.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_FOR_EACH_HPP_INCLUDED #define BOOST_MPL_FOR_EACH_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,20 +10,22 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/for_each.hpp,v $ -// $Date: 2004/09/04 01:33:46 $ -// $Revision: 1.9 $ +// $Id: for_each.hpp 55648 2009-08-18 05:16:53Z agurtovoy $ +// $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $ +// $Revision: 55648 $ +#include <boost/mpl/is_sequence.hpp> #include <boost/mpl/begin_end.hpp> #include <boost/mpl/apply.hpp> #include <boost/mpl/bool.hpp> #include <boost/mpl/next_prior.hpp> #include <boost/mpl/deref.hpp> #include <boost/mpl/identity.hpp> +#include <boost/mpl/assert.hpp> #include <boost/mpl/aux_/unwrap.hpp> #include <boost/type_traits/is_same.hpp> -#include <boost/butility/value_init.hpp> +#include <boost/utility/value_init.hpp> namespace boost { namespace mpl { @@ -74,7 +76,7 @@ struct for_each_impl<false> typedef typename mpl::next<Iterator>::type iter; for_each_impl<boost::is_same<iter,LastIterator>::value> - ::execute((iter*)0, (LastIterator*)0, (TransformFunc*)0, f); + ::execute( static_cast<iter*>(0), static_cast<LastIterator*>(0), static_cast<TransformFunc*>(0), f); } }; @@ -90,11 +92,13 @@ template< inline void for_each(F f, Sequence* = 0, TransformOp* = 0) { + BOOST_MPL_ASSERT(( is_sequence<Sequence> )); + typedef typename begin<Sequence>::type first; typedef typename end<Sequence>::type last; aux::for_each_impl< boost::is_same<first,last>::value > - ::execute((first*)0, (last*)0, (TransformOp*)0, f); + ::execute(static_cast<first*>(0), static_cast<last*>(0), static_cast<TransformOp*>(0), f); } template< diff --git a/Utilities/BGL/boost/mpl/front.hpp b/Utilities/BGL/boost/mpl/front.hpp index cfcdcaac805f3847f39b09aa204be3647c29133a..3ad64e4b9c67153537c166a1be6427d7e5e4d83a 100644 --- a/Utilities/BGL/boost/mpl/front.hpp +++ b/Utilities/BGL/boost/mpl/front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/front.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> #include <boost/mpl/aux_/front_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/front_fwd.hpp b/Utilities/BGL/boost/mpl/front_fwd.hpp index 158210a45adb563c87df4739ef3bb025531f91d4..65ffcf2e4a0c45a82ad5c0222501d35c0c8e2f52 100644 --- a/Utilities/BGL/boost/mpl/front_fwd.hpp +++ b/Utilities/BGL/boost/mpl/front_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/front_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: front_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/front_inserter.hpp b/Utilities/BGL/boost/mpl/front_inserter.hpp index 44d864e4dc042f46c9e857feb8d7e322145ca448..ee754cf43382356380be58fb48b295da23e07648 100644 --- a/Utilities/BGL/boost/mpl/front_inserter.hpp +++ b/Utilities/BGL/boost/mpl/front_inserter.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/front_inserter.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: front_inserter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_front.hpp> #include <boost/mpl/inserter.hpp> diff --git a/Utilities/BGL/boost/mpl/greater.hpp b/Utilities/BGL/boost/mpl/greater.hpp index a76e5f85e00799e62b5945fd15d4480c1056a7e6..e33ae487d5166b1170eae14bafcec02236dea92a 100644 --- a/Utilities/BGL/boost/mpl/greater.hpp +++ b/Utilities/BGL/boost/mpl/greater.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/greater.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: greater.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME greater #define AUX778076_OP_TOKEN > diff --git a/Utilities/BGL/boost/mpl/greater_equal.hpp b/Utilities/BGL/boost/mpl/greater_equal.hpp index 9f9151de2192547f74c06fcbff90a6846e0f49ef..91ccf83ecefcee79eb4ec753e6d2528ff635dd87 100644 --- a/Utilities/BGL/boost/mpl/greater_equal.hpp +++ b/Utilities/BGL/boost/mpl/greater_equal.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/greater_equal.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: greater_equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME greater_equal #define AUX778076_OP_TOKEN >= diff --git a/Utilities/BGL/boost/mpl/has_key.hpp b/Utilities/BGL/boost/mpl/has_key.hpp index d1cbe8832da6d1488dcf6aa7ce3d59f243402cb3..85102edb9fa4b0d288e9e4371e5fc6cc1f560592 100644 --- a/Utilities/BGL/boost/mpl/has_key.hpp +++ b/Utilities/BGL/boost/mpl/has_key.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/has_key.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: has_key.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_key_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/has_key_fwd.hpp b/Utilities/BGL/boost/mpl/has_key_fwd.hpp index 49ecb1f6ef4887c2a27a395652134cecaa71c5fa..49b0fb5191c9a65db91a427e5d4f835d1af2f94f 100644 --- a/Utilities/BGL/boost/mpl/has_key_fwd.hpp +++ b/Utilities/BGL/boost/mpl/has_key_fwd.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/has_key_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: has_key_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/has_xxx.hpp b/Utilities/BGL/boost/mpl/has_xxx.hpp index 9203f33d98743eb9a9665699d5860c0248319e98..39ed90931449fc8243209a1202189c7df2596f82 100644 --- a/Utilities/BGL/boost/mpl/has_xxx.hpp +++ b/Utilities/BGL/boost/mpl/has_xxx.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_HAS_XXX_HPP_INCLUDED #define BOOST_MPL_HAS_XXX_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2002-2004 +// Copyright Aleksey Gurtovoy 2002-2006 // Copyright David Abrahams 2002-2003 // // Distributed under the Boost Software License, Version 1.0. @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/has_xxx.hpp,v $ -// $Date: 2005/06/15 10:43:23 $ -// $Revision: 1.4 $ +// $Id: has_xxx.hpp 49273 2008-10-11 06:54:06Z agurtovoy $ +// $Date: 2008-10-11 02:54:06 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49273 $ #include <boost/mpl/bool.hpp> #include <boost/mpl/aux_/type_wrapper.hpp> @@ -26,6 +26,10 @@ #include <boost/preprocessor/cat.hpp> +#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x590) ) +# include <boost/type_traits/is_class.hpp> +#endif + #if !defined(BOOST_MPL_CFG_NO_HAS_XXX) # if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) @@ -144,19 +148,22 @@ template<> struct trait<T> \ // SFINAE-based implementations below are derived from a USENET newsgroup's // posting by Rani Sharoni (comp.lang.c++.moderated, 2002-03-17 07:45:09 PST) -# elif BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) +# elif BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ + || BOOST_WORKAROUND(__IBMCPP__, <= 700) -// MSVC 7.1+ +// MSVC 7.1+ & VACPP // agurt, 15/jun/05: replace overload-based SFINAE implementation with SFINAE // applied to partial specialization to fix some apparently random failures // (thanks to Daniel Wallin for researching this!) -namespace boost { namespace mpl { namespace aux { -template< typename T > struct msvc71_sfinae_helper { typedef void type; }; -}}} - # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_) \ +template< typename T > \ +struct BOOST_PP_CAT(trait, _msvc_sfinae_helper) \ +{ \ + typedef void type; \ +};\ +\ template< typename T, typename U = void > \ struct BOOST_PP_CAT(trait,_impl_) \ { \ @@ -167,7 +174,7 @@ struct BOOST_PP_CAT(trait,_impl_) \ template< typename T > \ struct BOOST_PP_CAT(trait,_impl_)< \ T \ - , typename boost::mpl::aux::msvc71_sfinae_helper< typename T::name >::type \ + , typename BOOST_PP_CAT(trait, _msvc_sfinae_helper)< typename T::name >::type \ > \ { \ BOOST_STATIC_CONSTANT(bool, value = true); \ @@ -181,6 +188,41 @@ struct trait \ }; \ /**/ +# elif BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x590) ) + +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_BCB_DEF(trait, trait_tester, name, default_) \ +template< typename T, bool IS_CLASS > \ +struct trait_tester \ +{ \ + BOOST_STATIC_CONSTANT( bool, value = false ); \ +}; \ +template< typename T > \ +struct trait_tester< T, true > \ +{ \ + struct trait_tester_impl \ + { \ + template < class U > \ + static int resolve( boost::mpl::aux::type_wrapper<U> const volatile * \ + , boost::mpl::aux::type_wrapper<typename U::name >* = 0 ); \ + static char resolve( ... ); \ + }; \ + typedef boost::mpl::aux::type_wrapper<T> t_; \ + BOOST_STATIC_CONSTANT( bool, value = ( sizeof( trait_tester_impl::resolve( static_cast< t_ * >(0) ) ) == sizeof(int) ) ); \ +}; \ +template< typename T, typename fallback_ = boost::mpl::bool_<default_> > \ +struct trait \ +{ \ + BOOST_STATIC_CONSTANT( bool, value = (trait_tester< T, boost::is_class< T >::value >::value) ); \ + typedef boost::mpl::bool_< trait< T, fallback_ >::value > type; \ +}; + +# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_) \ + BOOST_MPL_HAS_XXX_TRAIT_NAMED_BCB_DEF( trait \ + , BOOST_PP_CAT(trait,_tester) \ + , name \ + , default_ ) \ +/**/ + # else // other SFINAE-capable compilers # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_) \ diff --git a/Utilities/BGL/boost/mpl/identity.hpp b/Utilities/BGL/boost/mpl/identity.hpp index 247b9d9bdcb1c1e15cd157e75a78d177b12f1f55..d72540bbf46834ee07a0a9d15a3274465b6883a0 100644 --- a/Utilities/BGL/boost/mpl/identity.hpp +++ b/Utilities/BGL/boost/mpl/identity.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/identity.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: identity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> diff --git a/Utilities/BGL/boost/mpl/if.hpp b/Utilities/BGL/boost/mpl/if.hpp index 03acd5bcf19be5978bfd88196fd8d8f69bbfb652..aa14d880171c87f3ba565decb04e9e8a2a72b48e 100644 --- a/Utilities/BGL/boost/mpl/if.hpp +++ b/Utilities/BGL/boost/mpl/if.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/if.hpp,v $ -// $Date: 2004/09/07 08:51:31 $ -// $Revision: 1.25 $ +// $Id: if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/value_wknd.hpp> #include <boost/mpl/aux_/static_cast.hpp> diff --git a/Utilities/BGL/boost/mpl/index_if.hpp b/Utilities/BGL/boost/mpl/index_if.hpp index fa627ad8b1489d8cb18d0eeae252ea14c8afc65b..75bd9bbdc536bcae136dbd6da360aaf66beadd10 100644 --- a/Utilities/BGL/boost/mpl/index_if.hpp +++ b/Utilities/BGL/boost/mpl/index_if.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/index_if.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.7 $ +// $Id: index_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/find_if_pred.hpp> #include <boost/mpl/begin_end.hpp> diff --git a/Utilities/BGL/boost/mpl/index_of.hpp b/Utilities/BGL/boost/mpl/index_of.hpp index f77bd24b7dfc84c7da64e2bf4612cafc1d3928e2..19b1ac41deec5e86c25c6b02392b5b7dbb731109 100644 --- a/Utilities/BGL/boost/mpl/index_of.hpp +++ b/Utilities/BGL/boost/mpl/index_of.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/index_of.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: index_of.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/index_if.hpp> #include <boost/mpl/same_as.hpp> diff --git a/Utilities/BGL/boost/mpl/inherit.hpp b/Utilities/BGL/boost/mpl/inherit.hpp index 43b41cec2deb34fc5163f8e600cbe4af512965ba..39e8ae1e28fa0e3ea992d01935c17867743c7779 100644 --- a/Utilities/BGL/boost/mpl/inherit.hpp +++ b/Utilities/BGL/boost/mpl/inherit.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/inherit.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: inherit.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/empty_base.hpp> diff --git a/Utilities/BGL/boost/mpl/inherit_linearly.hpp b/Utilities/BGL/boost/mpl/inherit_linearly.hpp index 8575f3166c67b047fdd50387d50de3ec14ef2deb..567d7d9e2950ce6329cdcf2faa022a0790beed7e 100644 --- a/Utilities/BGL/boost/mpl/inherit_linearly.hpp +++ b/Utilities/BGL/boost/mpl/inherit_linearly.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/inherit_linearly.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: inherit_linearly.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/empty_base.hpp> diff --git a/Utilities/BGL/boost/mpl/insert.hpp b/Utilities/BGL/boost/mpl/insert.hpp index 7b8e3df6bd597f3823d36dbb40974f14c6557653..ebc52bcd70e4ddf07b7e4286be0471e55fd21acc 100644 --- a/Utilities/BGL/boost/mpl/insert.hpp +++ b/Utilities/BGL/boost/mpl/insert.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/insert.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: insert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/insert_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/insert_fwd.hpp b/Utilities/BGL/boost/mpl/insert_fwd.hpp index b1063153201555ef0e7697f7cfcb85a655997cea..9c6ff6437a65214d7d88be5e147e1efbc51ef8ba 100644 --- a/Utilities/BGL/boost/mpl/insert_fwd.hpp +++ b/Utilities/BGL/boost/mpl/insert_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/insert_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: insert_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/insert_range.hpp b/Utilities/BGL/boost/mpl/insert_range.hpp index 79bb227c3c3c9987ce9d07306e537b8d8d8c9863..9332b9e9fd9f14ca9c4954e5b06ce9eeae489e2d 100644 --- a/Utilities/BGL/boost/mpl/insert_range.hpp +++ b/Utilities/BGL/boost/mpl/insert_range.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/insert_range.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: insert_range.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/insert_range_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/insert_range_fwd.hpp b/Utilities/BGL/boost/mpl/insert_range_fwd.hpp index 5a2a711acac467817d0c3f17d38794a767d2af26..256d2a2f80403520b4fd3387d4e4b253e56397ed 100644 --- a/Utilities/BGL/boost/mpl/insert_range_fwd.hpp +++ b/Utilities/BGL/boost/mpl/insert_range_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/insert_range_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: insert_range_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/inserter.hpp b/Utilities/BGL/boost/mpl/inserter.hpp index e09c6ec0d00b51b1ecfe8d07f45bf6c45f37325f..8e2c676f73fb152b80ef92118f88f07b4910e557 100644 --- a/Utilities/BGL/boost/mpl/inserter.hpp +++ b/Utilities/BGL/boost/mpl/inserter.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/inserter.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: inserter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/int.hpp b/Utilities/BGL/boost/mpl/int.hpp index f0078daad864661976e26388b9e7da6fe6892f39..971ca90002ed0ef77bbcab42f2ee952198b476a7 100644 --- a/Utilities/BGL/boost/mpl/int.hpp +++ b/Utilities/BGL/boost/mpl/int.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/int.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: int.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/int_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/int_fwd.hpp b/Utilities/BGL/boost/mpl/int_fwd.hpp index 919c6f1a9a75cd1f60f099aefca4a2e2d8565c08..0a0140ff4922d1fcccc6694255c906f9045c233c 100644 --- a/Utilities/BGL/boost/mpl/int_fwd.hpp +++ b/Utilities/BGL/boost/mpl/int_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/int_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: int_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> #include <boost/mpl/aux_/nttp_decl.hpp> diff --git a/Utilities/BGL/boost/mpl/integral_c.hpp b/Utilities/BGL/boost/mpl/integral_c.hpp index f32b1fe38f70c051101e42fde223a77f68208ef3..6c4d2bcdda92121751004071b557fc910617d564 100644 --- a/Utilities/BGL/boost/mpl/integral_c.hpp +++ b/Utilities/BGL/boost/mpl/integral_c.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_INTEGRAL_C_HPP_INCLUDED #define BOOST_MPL_INTEGRAL_C_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,16 +10,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/integral_c.hpp,v $ -// $Date: 2005/07/19 04:03:12 $ -// $Revision: 1.22 $ +// $Id: integral_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/integral_c_fwd.hpp> #include <boost/mpl/aux_/config/ctps.hpp> #include <boost/mpl/aux_/config/static_constant.hpp> #include <boost/mpl/aux_/config/workaround.hpp> -#if BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) +#if BOOST_WORKAROUND(__HP_aCC, <= 53800) // the type of non-type template arguments may not depend on template arguments # define AUX_WRAPPER_PARAMS(N) typename T, long N #else diff --git a/Utilities/BGL/boost/mpl/integral_c_fwd.hpp b/Utilities/BGL/boost/mpl/integral_c_fwd.hpp index 7f4237cfad51f89d78726a7ecd1d3905d3057e18..46da935c2c2fdd1cd43fd1445f7a1c59573b7f87 100644 --- a/Utilities/BGL/boost/mpl/integral_c_fwd.hpp +++ b/Utilities/BGL/boost/mpl/integral_c_fwd.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED #define BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,16 +10,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/integral_c_fwd.hpp,v $ -// $Date: 2004/09/28 13:56:58 $ -// $Revision: 1.4 $ +// $Id: integral_c_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> #include <boost/mpl/aux_/adl_barrier.hpp> BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN -#if BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) +#if BOOST_WORKAROUND(__HP_aCC, <= 53800) // the type of non-type template arguments may not depend on template arguments template< typename T, long N > struct integral_c; #else diff --git a/Utilities/BGL/boost/mpl/integral_c_tag.hpp b/Utilities/BGL/boost/mpl/integral_c_tag.hpp index 87dc16b8ac29a9409be2f87394f37cbc6603ca5f..2b43e7924797049adba60fbff9b4601301ebda9a 100644 --- a/Utilities/BGL/boost/mpl/integral_c_tag.hpp +++ b/Utilities/BGL/boost/mpl/integral_c_tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/integral_c_tag.hpp,v $ -// $Date: 2004/09/28 13:56:58 $ -// $Revision: 1.2 $ +// $Id: integral_c_tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/Utilities/BGL/boost/mpl/is_placeholder.hpp b/Utilities/BGL/boost/mpl/is_placeholder.hpp index 9618e31b2edef9586be901ee38567942ed84205b..5b28b472f5d8aa3d622780052549dc0c0cc6eee8 100644 --- a/Utilities/BGL/boost/mpl/is_placeholder.hpp +++ b/Utilities/BGL/boost/mpl/is_placeholder.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/is_placeholder.hpp,v $ -// $Date: 2004/09/07 08:51:31 $ -// $Revision: 1.6 $ +// $Id: is_placeholder.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/arg_fwd.hpp> #include <boost/mpl/bool.hpp> diff --git a/Utilities/BGL/boost/mpl/is_sequence.hpp b/Utilities/BGL/boost/mpl/is_sequence.hpp index 08b3b87c7d8bf56785325d130792234f34db365c..0c1f67baaf311466240902c843e92e9a403192c9 100644 --- a/Utilities/BGL/boost/mpl/is_sequence.hpp +++ b/Utilities/BGL/boost/mpl/is_sequence.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/is_sequence.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.8 $ +// $Id: is_sequence.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/not.hpp> #include <boost/mpl/and.hpp> @@ -29,7 +29,7 @@ #include <boost/mpl/aux_/config/eti.hpp> #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) # include <boost/mpl/aux_/msvc_is_class.hpp> #elif BOOST_WORKAROUND(BOOST_MSVC, == 1300) # include <boost/type_traits/is_class.hpp> @@ -63,7 +63,7 @@ template< > struct is_sequence : if_< -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) aux::msvc_is_class<T> #else boost::is_class<T> diff --git a/Utilities/BGL/boost/mpl/iter_fold.hpp b/Utilities/BGL/boost/mpl/iter_fold.hpp index 59978de68760b00b4e5d4a06b36296a87f89ca48..cb247076199f625ffa56a8342f2ba9bfaa71de5e 100644 --- a/Utilities/BGL/boost/mpl/iter_fold.hpp +++ b/Utilities/BGL/boost/mpl/iter_fold.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/iter_fold.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: iter_fold.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/O1_size.hpp> diff --git a/Utilities/BGL/boost/mpl/iter_fold_if.hpp b/Utilities/BGL/boost/mpl/iter_fold_if.hpp index 3328c9d1a585fba886f3f372cd01536f6260f669..da80564adc6e3bdced0404bd34276cf9b659ba33 100644 --- a/Utilities/BGL/boost/mpl/iter_fold_if.hpp +++ b/Utilities/BGL/boost/mpl/iter_fold_if.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/iter_fold_if.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.7 $ +// $Id: iter_fold_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/logical.hpp> diff --git a/Utilities/BGL/boost/mpl/iterator_category.hpp b/Utilities/BGL/boost/mpl/iterator_category.hpp index f522d74be96b2dbe8a35700484550d62ad51ad47..084c32f3052731d140840add0a7f8a91c4dc659b 100644 --- a/Utilities/BGL/boost/mpl/iterator_category.hpp +++ b/Utilities/BGL/boost/mpl/iterator_category.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/iterator_category.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.6 $ +// $Id: iterator_category.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> diff --git a/Utilities/BGL/boost/mpl/iterator_range.hpp b/Utilities/BGL/boost/mpl/iterator_range.hpp index ed6766d8c8e206c34b635ac11ba6f275e136c3e1..d3fd43b537f7a0eaf171ee31f341fba750b4d10b 100644 --- a/Utilities/BGL/boost/mpl/iterator_range.hpp +++ b/Utilities/BGL/boost/mpl/iterator_range.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/iterator_range.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: iterator_range.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> diff --git a/Utilities/BGL/boost/mpl/iterator_tags.hpp b/Utilities/BGL/boost/mpl/iterator_tags.hpp index 93a8256ea61e9070f575d18e56c6e01a14e93d5e..46431a3231061cd91e6605c957a33907b52a6e2e 100644 --- a/Utilities/BGL/boost/mpl/iterator_tags.hpp +++ b/Utilities/BGL/boost/mpl/iterator_tags.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/iterator_tags.hpp,v $ -// $Date: 2004/11/28 01:54:51 $ -// $Revision: 1.3 $ +// $Id: iterator_tags.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/int.hpp> diff --git a/Utilities/BGL/boost/mpl/joint_view.hpp b/Utilities/BGL/boost/mpl/joint_view.hpp index 5af5eb106eaf7a2b76c1e832ec9e5ad279326dcb..dd8d91f646a7172535ddecd775d8c48d3d7d81da 100644 --- a/Utilities/BGL/boost/mpl/joint_view.hpp +++ b/Utilities/BGL/boost/mpl/joint_view.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/joint_view.hpp,v $ -// $Date: 2004/10/02 19:08:57 $ -// $Revision: 1.8 $ +// $Id: joint_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/joint_iter.hpp> #include <boost/mpl/plus.hpp> diff --git a/Utilities/BGL/boost/mpl/key_type.hpp b/Utilities/BGL/boost/mpl/key_type.hpp index 6e330bc048f36a3b4943626969edafd5019d33de..f32a886d0b1e73de102848566bec4418c93915f4 100644 --- a/Utilities/BGL/boost/mpl/key_type.hpp +++ b/Utilities/BGL/boost/mpl/key_type.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/key_type.hpp,v $ -// $Date: 2004/12/14 22:34:44 $ -// $Revision: 1.4 $ +// $Id: key_type.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/key_type_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/key_type_fwd.hpp b/Utilities/BGL/boost/mpl/key_type_fwd.hpp index aad6313c0d3e81fd9e5731ff266ea9a9f645349f..95f84451c162749fc36b8ae333a7cd5e9f6363f5 100644 --- a/Utilities/BGL/boost/mpl/key_type_fwd.hpp +++ b/Utilities/BGL/boost/mpl/key_type_fwd.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/key_type_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: key_type_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/lambda.hpp b/Utilities/BGL/boost/mpl/lambda.hpp index 2f19eddc2ce68e0cb033b1180b2f85b6c3c315ff..165135f5e78d9d41eae670e4ec0d6e62f35661e4 100644 --- a/Utilities/BGL/boost/mpl/lambda.hpp +++ b/Utilities/BGL/boost/mpl/lambda.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/lambda.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: lambda.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/lambda_fwd.hpp> #include <boost/mpl/bind.hpp> diff --git a/Utilities/BGL/boost/mpl/lambda_fwd.hpp b/Utilities/BGL/boost/mpl/lambda_fwd.hpp index 096a4a61efd1a3cac5136c63e6fd0a03ca07dcef..f02837bd7f420995f3efa0918c57cffc5935b2b0 100644 --- a/Utilities/BGL/boost/mpl/lambda_fwd.hpp +++ b/Utilities/BGL/boost/mpl/lambda_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/lambda_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.7 $ +// $Id: lambda_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/void_fwd.hpp> #include <boost/mpl/aux_/na.hpp> diff --git a/Utilities/BGL/boost/mpl/less.hpp b/Utilities/BGL/boost/mpl/less.hpp index 39fc27f5704c81851d1a212092deffd33b19ca19..11d860d1c50c88b8da09da6a5d767adc41b5add2 100644 --- a/Utilities/BGL/boost/mpl/less.hpp +++ b/Utilities/BGL/boost/mpl/less.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/less.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: less.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME less #define AUX778076_OP_TOKEN < diff --git a/Utilities/BGL/boost/mpl/less_equal.hpp b/Utilities/BGL/boost/mpl/less_equal.hpp index c36d4799104526d48709cbc106ee7ebc7fc3ff86..2284d1d0c2c81bd67841fb628955fda0461ffba5 100644 --- a/Utilities/BGL/boost/mpl/less_equal.hpp +++ b/Utilities/BGL/boost/mpl/less_equal.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/less_equal.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: less_equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME less_equal #define AUX778076_OP_TOKEN <= diff --git a/Utilities/BGL/boost/mpl/limits/arity.hpp b/Utilities/BGL/boost/mpl/limits/arity.hpp index 18d87d9931371530353ee607c23afd9ae62d8636..91e46063927b8a59262e78cc3bb8f09ea4e827ac 100644 --- a/Utilities/BGL/boost/mpl/limits/arity.hpp +++ b/Utilities/BGL/boost/mpl/limits/arity.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/limits/arity.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.4 $ +// $Id: arity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) # define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 5 diff --git a/Utilities/BGL/boost/mpl/limits/list.hpp b/Utilities/BGL/boost/mpl/limits/list.hpp index 83c0ca37b551295252e95bc732a511a420f987c7..ee9c7aa1876944db8ed1e28094d450a8d8535a82 100644 --- a/Utilities/BGL/boost/mpl/limits/list.hpp +++ b/Utilities/BGL/boost/mpl/limits/list.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/limits/list.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.4 $ +// $Id: list.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_LIST_SIZE) # define BOOST_MPL_LIMIT_LIST_SIZE 20 diff --git a/Utilities/BGL/boost/mpl/limits/map.hpp b/Utilities/BGL/boost/mpl/limits/map.hpp index 16d9240f746d7505c2806eab7d9bd7f8341dbbf4..1c24890f96a5775ced0e21b269317888d612f242 100644 --- a/Utilities/BGL/boost/mpl/limits/map.hpp +++ b/Utilities/BGL/boost/mpl/limits/map.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/limits/map.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.2 $ +// $Id: map.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_MAP_SIZE) # define BOOST_MPL_LIMIT_MAP_SIZE 20 diff --git a/Utilities/BGL/boost/mpl/limits/set.hpp b/Utilities/BGL/boost/mpl/limits/set.hpp index 3ba1e64cb599aad94444cf3af7a79b3ce196edd2..01edbcdb73e9a00094752e06b7134a63b77f93cc 100644 --- a/Utilities/BGL/boost/mpl/limits/set.hpp +++ b/Utilities/BGL/boost/mpl/limits/set.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/limits/set.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.2 $ +// $Id: set.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_SET_SIZE) # define BOOST_MPL_LIMIT_SET_SIZE 20 diff --git a/Utilities/BGL/boost/mpl/limits/string.hpp b/Utilities/BGL/boost/mpl/limits/string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eb85aa389fb9a7c426a56dc816d1d3d8d3b94f1b --- /dev/null +++ b/Utilities/BGL/boost/mpl/limits/string.hpp @@ -0,0 +1,21 @@ + +#ifndef BOOST_MPL_LIMITS_STRING_HPP_INCLUDED +#define BOOST_MPL_LIMITS_STRING_HPP_INCLUDED + +// Copyright Eric Niebler 2009 +// +// 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: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $ +// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49239 $ + +#if !defined(BOOST_MPL_LIMIT_STRING_SIZE) +# define BOOST_MPL_LIMIT_STRING_SIZE 32 +#endif + +#endif // BOOST_MPL_LIMITS_STRING_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/limits/unrolling.hpp b/Utilities/BGL/boost/mpl/limits/unrolling.hpp index 773e16aabdb5f0e7617c81a98f499d5f46fc900c..4ba3efb94f01d33314c2a8c3d29f05b58494a3c7 100644 --- a/Utilities/BGL/boost/mpl/limits/unrolling.hpp +++ b/Utilities/BGL/boost/mpl/limits/unrolling.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/limits/unrolling.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.4 $ +// $Id: unrolling.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_UNROLLING) # define BOOST_MPL_LIMIT_UNROLLING 4 diff --git a/Utilities/BGL/boost/mpl/limits/vector.hpp b/Utilities/BGL/boost/mpl/limits/vector.hpp index ca79aea8f14f3a2a093a254123f108cd2edc8d8d..9a0accfa1bae76bdfa0e0c590b4dcf8ca8a0f5b8 100644 --- a/Utilities/BGL/boost/mpl/limits/vector.hpp +++ b/Utilities/BGL/boost/mpl/limits/vector.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/limits/vector.hpp,v $ -// $Date: 2004/09/02 15:40:57 $ -// $Revision: 1.4 $ +// $Id: vector.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_VECTOR_SIZE) # define BOOST_MPL_LIMIT_VECTOR_SIZE 20 diff --git a/Utilities/BGL/boost/mpl/list.hpp b/Utilities/BGL/boost/mpl/list.hpp index b3f7408669878445e4022c230e504ae5f55bbad4..838b8f4b12cc341a3da5a4ada18a2ff190ca1cea 100644 --- a/Utilities/BGL/boost/mpl/list.hpp +++ b/Utilities/BGL/boost/mpl/list.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list.hpp,v $ -// $Date: 2004/11/28 01:54:51 $ -// $Revision: 1.9 $ +// $Id: list.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/list.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/O1_size.hpp b/Utilities/BGL/boost/mpl/list/aux_/O1_size.hpp index 4040d66583c65260329d0f30786ad7f8301abefa..6ef2cf7fa04fe695a0ebae3959ed596b81a74835 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/O1_size.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/O1_size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/O1_size.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.4 $ +// $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> #include <boost/mpl/list/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/begin_end.hpp b/Utilities/BGL/boost/mpl/list/aux_/begin_end.hpp index 3a60dee7bc6054b7bef6387012f2433eb90a692e..dab60f318ce3cd8c7c6708da7420aa705cb05332 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/begin_end.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/begin_end.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/begin_end.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.4 $ +// $Id: begin_end.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> #include <boost/mpl/list/aux_/iterator.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/clear.hpp b/Utilities/BGL/boost/mpl/list/aux_/clear.hpp index e5d977245fe5bf7a60acc3432ab6cbcbf4d8c453..247a4de5360a521553357ba61d20fa27ed6cc874 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/clear.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/clear.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/clear.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.4 $ +// $Id: clear.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> #include <boost/mpl/list/aux_/item.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/empty.hpp b/Utilities/BGL/boost/mpl/list/aux_/empty.hpp index d2681fcac63dafe495728452f28b20072af93273..6ab60cfee0301f739ee75b58c6ce77f7c34d596e 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/empty.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/empty.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/empty.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.5 $ +// $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> #include <boost/mpl/not.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/front.hpp b/Utilities/BGL/boost/mpl/list/aux_/front.hpp index 267063dc58ab834a8d0e8f6deaf40d6ff9259db3..8defa99450552d0b974624b2fcf31be7bda9704f 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/front.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/front.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.4 $ +// $Id: front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> #include <boost/mpl/list/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/include_preprocessed.hpp b/Utilities/BGL/boost/mpl/list/aux_/include_preprocessed.hpp index 619e18239430093f9428d646c2fb8d16fef5552e..431b51f5d906ea50856ee658f7eba21b9348ded1 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/include_preprocessed.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/include_preprocessed.hpp @@ -1,5 +1,5 @@ -// Copyright Aleksey Gurtovoy 2001-2004 +// Copyright Aleksey Gurtovoy 2001-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -7,12 +7,14 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/include_preprocessed.hpp,v $ -// $Date: 2004/11/28 01:48:53 $ -// $Revision: 1.4 $ +// $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! +#include <boost/mpl/aux_/config/workaround.hpp> + #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/stringize.hpp> @@ -20,7 +22,13 @@ aux_/preprocessed/plain/BOOST_MPL_PREPROCESSED_HEADER \ /**/ +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700)) +# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_HEADER) +# include AUX778076_INCLUDE_STRING +# undef AUX778076_INCLUDE_STRING +#else # include BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_HEADER) +#endif # undef AUX778076_HEADER diff --git a/Utilities/BGL/boost/mpl/list/aux_/item.hpp b/Utilities/BGL/boost/mpl/list/aux_/item.hpp index 9110efe121f61e11bc0004ce8d9deaa6200eab0d..37ddff75e4e7579e62d5590835610e9fd3117906 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/item.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/item.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/item.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.2 $ +// $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long.hpp> #include <boost/mpl/list/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/iterator.hpp b/Utilities/BGL/boost/mpl/list/aux_/iterator.hpp index a51b154648f43e044f30198e9a6af872b1e580a3..b94126cf72d9331f9b44e4f3d922da0bb57360d3 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/iterator.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/iterator.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/iterator.hpp,v $ -// $Date: 2004/10/01 16:29:37 $ -// $Revision: 1.6 $ +// $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/iterator_tags.hpp> #include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/numbered.hpp b/Utilities/BGL/boost/mpl/list/aux_/numbered.hpp index e9447eadeb9d4098cd5feb3c5683735d4e3dd437..de8d4041d3614d1b1cf48eb78ec8b6fe5040fb10 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/numbered.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/numbered.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/numbered.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.4 $ +// $Id: numbered.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if defined(BOOST_PP_IS_ITERATING) diff --git a/Utilities/BGL/boost/mpl/list/aux_/numbered_c.hpp b/Utilities/BGL/boost/mpl/list/aux_/numbered_c.hpp index 7c5329a3861612049f632b4ec0c4a9ae2ac4d872..f3043827b1dbf818600887b820113150b174c87d 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/numbered_c.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/numbered_c.hpp @@ -9,9 +9,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/numbered_c.hpp,v $ -// $Date: 2004/11/28 01:48:53 $ -// $Revision: 1.5 $ +// $Id: numbered_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if defined(BOOST_PP_IS_ITERATING) diff --git a/Utilities/BGL/boost/mpl/list/aux_/pop_front.hpp b/Utilities/BGL/boost/mpl/list/aux_/pop_front.hpp index f58471d55e0a80d54340ac0a0f0a45d95afbf74e..e053391c84b2da2d4707c2a493d661f6a8502f61 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/pop_front.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/pop_front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/pop_front.hpp,v $ -// $Date: 2004/10/24 08:18:08 $ -// $Revision: 1.5 $ +// $Id: pop_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/pop_front_fwd.hpp> #include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/push_back.hpp b/Utilities/BGL/boost/mpl/list/aux_/push_back.hpp index 38ae8ec6ee98e1daf31f84638040691ac2b39446..6adb7db76200d4172f3ea00428dff708f8b1d5c7 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/push_back.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/push_back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/push_back.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.2 $ +// $Id: push_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_back_fwd.hpp> #include <boost/mpl/bool.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/push_front.hpp b/Utilities/BGL/boost/mpl/list/aux_/push_front.hpp index deb6bb327b54869ff40662d903cc955bda25c32f..a601fea1698e9e0ec9d89e7b431f44253a2102e6 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/push_front.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/push_front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/push_front.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.4 $ +// $Id: push_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_front_fwd.hpp> #include <boost/mpl/next.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/size.hpp b/Utilities/BGL/boost/mpl/list/aux_/size.hpp index f390ed7c28d3461aefad505238797c2e94fd3a93..4ecbab83cae3922151d9c064d7fda1a8d1dbe2df 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/size.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/size.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.4 $ +// $Id: size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/list/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/list/aux_/tag.hpp b/Utilities/BGL/boost/mpl/list/aux_/tag.hpp index c484f37470c83c1a4d76b6b13db650f062ffe8ef..d44bfe40e8f4f419a0668b18d1581e58103b59d3 100644 --- a/Utilities/BGL/boost/mpl/list/aux_/tag.hpp +++ b/Utilities/BGL/boost/mpl/list/aux_/tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/aux_/tag.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.4 $ +// $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/list/list0.hpp b/Utilities/BGL/boost/mpl/list/list0.hpp index b2d41f432273a5b765d84b83ee9bffe6d63fb851..58e93cff569348721296ed0ac4e849f2731a0607 100644 --- a/Utilities/BGL/boost/mpl/list/list0.hpp +++ b/Utilities/BGL/boost/mpl/list/list0.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list0.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.4 $ +// $Id: list0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long.hpp> #include <boost/mpl/aux_/na.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list0_c.hpp b/Utilities/BGL/boost/mpl/list/list0_c.hpp index 43f8ad8340c932dc286a46385e8e3d824e0ee8fc..ed9bca5f43cf628198bf70f16ab0a0e1c4faa457 100644 --- a/Utilities/BGL/boost/mpl/list/list0_c.hpp +++ b/Utilities/BGL/boost/mpl/list/list0_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list0_c.hpp,v $ -// $Date: 2004/11/28 07:18:24 $ -// $Revision: 1.5 $ +// $Id: list0_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/list/list0.hpp> #include <boost/mpl/integral_c.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list10.hpp b/Utilities/BGL/boost/mpl/list/list10.hpp index 6b1de483c589e7a39f0a981abbdf2190bb64c110..4a4ee19954c3d05dde2cdb76cd0804df1914cd59 100644 --- a/Utilities/BGL/boost/mpl/list/list10.hpp +++ b/Utilities/BGL/boost/mpl/list/list10.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list10.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list10.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list0.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list10_c.hpp b/Utilities/BGL/boost/mpl/list/list10_c.hpp index af77809466e02dee5ae4fdfafd0ae25d53d2979d..e05ef875305c047b8e8473192008f11ac069aa35 100644 --- a/Utilities/BGL/boost/mpl/list/list10_c.hpp +++ b/Utilities/BGL/boost/mpl/list/list10_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list10_c.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list10_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list0_c.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list20.hpp b/Utilities/BGL/boost/mpl/list/list20.hpp index 71fe5f42901bc81bab6de01d359b55715c2eef64..9321192a49eb54fe358efb57419178c2b81cc77e 100644 --- a/Utilities/BGL/boost/mpl/list/list20.hpp +++ b/Utilities/BGL/boost/mpl/list/list20.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list20.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list20.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list10.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list20_c.hpp b/Utilities/BGL/boost/mpl/list/list20_c.hpp index 14112eb8944b625924c3668bc34df0a10ec25b06..bc807e664d98866fb5db70bb406e3fa8096184ce 100644 --- a/Utilities/BGL/boost/mpl/list/list20_c.hpp +++ b/Utilities/BGL/boost/mpl/list/list20_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list20_c.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list20_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list10_c.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list30.hpp b/Utilities/BGL/boost/mpl/list/list30.hpp index 6b7324c53b20176acbc30d1c40cf4c957d6e549d..f736f8c5907c923318761fc4b2ad5a4ff9b4c270 100644 --- a/Utilities/BGL/boost/mpl/list/list30.hpp +++ b/Utilities/BGL/boost/mpl/list/list30.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list30.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list30.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list20.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list30_c.hpp b/Utilities/BGL/boost/mpl/list/list30_c.hpp index c0b6a99f0c7cb3e9227b0ba76eef67ffc17dcd19..e682086d9942485b598c1e77ad7119f8a3ba4468 100644 --- a/Utilities/BGL/boost/mpl/list/list30_c.hpp +++ b/Utilities/BGL/boost/mpl/list/list30_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list30_c.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list30_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list20_c.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list40.hpp b/Utilities/BGL/boost/mpl/list/list40.hpp index 0f807cd4f1b52f8ffa7666c570f56fac29aefa52..8560d8fa37bd2ef7d2593151e80cd56e66ca99b4 100644 --- a/Utilities/BGL/boost/mpl/list/list40.hpp +++ b/Utilities/BGL/boost/mpl/list/list40.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list40.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list40.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list30.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list40_c.hpp b/Utilities/BGL/boost/mpl/list/list40_c.hpp index 07f26822ede99e4cfc25ad4c73b439b2191c9bc7..5c5bfdfa4dd41f649724310bfdc4d5dee0ce7791 100644 --- a/Utilities/BGL/boost/mpl/list/list40_c.hpp +++ b/Utilities/BGL/boost/mpl/list/list40_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list40_c.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list40_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list30_c.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list50.hpp b/Utilities/BGL/boost/mpl/list/list50.hpp index 9c95c4845879a77391d60ddab386335629c2fd49..dcaf18ebfd6859e589d0b0afbf9917c1f03dc949 100644 --- a/Utilities/BGL/boost/mpl/list/list50.hpp +++ b/Utilities/BGL/boost/mpl/list/list50.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list50.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list50.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list40.hpp> diff --git a/Utilities/BGL/boost/mpl/list/list50_c.hpp b/Utilities/BGL/boost/mpl/list/list50_c.hpp index a25bc470f37df089cbee9cc1f1eb29c835bbd5e9..0f38e07d132319033dc0abf8898743fa5234bdb1 100644 --- a/Utilities/BGL/boost/mpl/list/list50_c.hpp +++ b/Utilities/BGL/boost/mpl/list/list50_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list/list50_c.hpp,v $ -// $Date: 2004/09/02 15:40:58 $ -// $Revision: 1.6 $ +// $Id: list50_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/list/list40_c.hpp> diff --git a/Utilities/BGL/boost/mpl/list_c.hpp b/Utilities/BGL/boost/mpl/list_c.hpp index e33fa584a6b5a0827909501c79710b07fc5c7f0f..eb46db108af56e0c6923b01865c3cc1a72786565 100644 --- a/Utilities/BGL/boost/mpl/list_c.hpp +++ b/Utilities/BGL/boost/mpl/list_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/list_c.hpp,v $ -// $Date: 2004/11/28 01:54:51 $ -// $Revision: 1.8 $ +// $Id: list_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/list.hpp> diff --git a/Utilities/BGL/boost/mpl/logical.hpp b/Utilities/BGL/boost/mpl/logical.hpp index 391d9e0e9bcec7762195959f543c5b1ba1d962c7..256ea32b18d01aad3d182d95bb9ebbe444e187db 100644 --- a/Utilities/BGL/boost/mpl/logical.hpp +++ b/Utilities/BGL/boost/mpl/logical.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/logical.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.5 $ +// $Id: logical.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/or.hpp> #include <boost/mpl/and.hpp> diff --git a/Utilities/BGL/boost/mpl/long.hpp b/Utilities/BGL/boost/mpl/long.hpp index e6f16c8b926d1d646cb1c6f2884434a6c3afecc8..a3e35b16bb73376cd3994797e78f34ea53633225 100644 --- a/Utilities/BGL/boost/mpl/long.hpp +++ b/Utilities/BGL/boost/mpl/long.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/long.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.4 $ +// $Id: long.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/long_fwd.hpp b/Utilities/BGL/boost/mpl/long_fwd.hpp index 7c0df6d724a0ab15b505671a20a5de2d5dd2de25..4c1b604603c63bc6decb91ad8b510e878ad0e039 100644 --- a/Utilities/BGL/boost/mpl/long_fwd.hpp +++ b/Utilities/BGL/boost/mpl/long_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/long_fwd.hpp,v $ -// $Date: 2004/09/28 13:56:58 $ -// $Revision: 1.4 $ +// $Id: long_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> #include <boost/mpl/aux_/nttp_decl.hpp> diff --git a/Utilities/BGL/boost/mpl/lower_bound.hpp b/Utilities/BGL/boost/mpl/lower_bound.hpp index 6d59c0a83c8fc1e15e266de3104178f66d6af096..21dca16ccddf524309ebab290dac1562c9014f5e 100644 --- a/Utilities/BGL/boost/mpl/lower_bound.hpp +++ b/Utilities/BGL/boost/mpl/lower_bound.hpp @@ -10,16 +10,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/lower_bound.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.8 $ +// $Id: lower_bound.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/less.hpp> #include <boost/mpl/lambda.hpp> #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/config/workaround.hpp> -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # define BOOST_MPL_CFG_STRIPPED_DOWN_LOWER_BOUND_IMPL #endif diff --git a/Utilities/BGL/boost/mpl/map.hpp b/Utilities/BGL/boost/mpl/map.hpp index af6c839857615a0125cde0ec2d2c320581f8ddc6..ceecbf17fe4e7b0b55ea1205081d70f57b5fd6e3 100644 --- a/Utilities/BGL/boost/mpl/map.hpp +++ b/Utilities/BGL/boost/mpl/map.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: map.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/map.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/at_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/at_impl.hpp index 28a761aa6a79cf7fe4671eddcde13009aa9802d8..dcec6b2c341800b0827937686898f7d5b75eed74 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/at_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/at_impl.hpp @@ -1,6 +1,6 @@ -#ifndef BOOST_MPL_SET_AUX_AT_IMPL_HPP_INCLUDED -#define BOOST_MPL_SET_AUX_AT_IMPL_HPP_INCLUDED +#ifndef BOOST_MPL_MAP_AUX_AT_IMPL_HPP_INCLUDED +#define BOOST_MPL_MAP_AUX_AT_IMPL_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2003-2004 // Copyright David Abrahams 2003-2004 @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/at_impl.hpp,v $ -// $Date: 2004/12/14 14:05:31 $ -// $Revision: 1.6 $ +// $Id: at_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/at_fwd.hpp> #include <boost/mpl/long.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/begin_end_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/begin_end_impl.hpp index 76f7616dce8c31a7d41b077da2714e16b6547e5e..7e5afb9b9cfa4ebe50c8a533b562090fc05514d5 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/begin_end_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/begin_end_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/begin_end_impl.hpp,v $ -// $Date: 2004/09/05 09:42:58 $ -// $Revision: 1.3 $ +// $Id: begin_end_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> #include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/clear_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/clear_impl.hpp index 40faddfc41fa91bdd8b661740c3772d5768d3fed..eb5ac9b3b55988ea4f6f46bed9634719ca693776 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/clear_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/clear_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/clear_impl.hpp,v $ -// $Date: 2004/09/02 15:41:00 $ -// $Revision: 1.2 $ +// $Id: clear_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> #include <boost/mpl/map/aux_/map0.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/contains_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/contains_impl.hpp index 67a48c7bab614e02a3ba9b6374659c8dd169b0a0..73a832ec1597bde4b810cee9885a6e78a7f57cf5 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/contains_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/contains_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/contains_impl.hpp,v $ -// $Date: 2004/09/02 15:41:00 $ -// $Revision: 1.2 $ +// $Id: contains_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/contains_fwd.hpp> #include <boost/mpl/if.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/empty_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/empty_impl.hpp index 35bee0c275fc13ed8b188708384cb6def1484b66..99dde3e268d95e821fc0ad14d6278d61f9e16cb3 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/empty_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/empty_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/empty_impl.hpp,v $ -// $Date: 2004/09/02 15:41:00 $ -// $Revision: 1.2 $ +// $Id: empty_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> #include <boost/mpl/not.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/erase_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/erase_impl.hpp index d8c1d83d8b94d1e7eb29b00d13e43aad2d71db42..1eae1442624e29b8cd4bfbe71279a950f56e2b0c 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/erase_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/erase_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/erase_impl.hpp,v $ -// $Date: 2004/09/05 09:42:58 $ -// $Revision: 1.3 $ +// $Id: erase_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/erase_fwd.hpp> #include <boost/mpl/map/aux_/erase_key_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/erase_key_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/erase_key_impl.hpp index 98bb2a1eb0a6f5069097910b12b60b329ed4ea76..d1dbd7c6fa73c50422549df04adfa547ad4f58cd 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/erase_key_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/erase_key_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/erase_key_impl.hpp,v $ -// $Date: 2004/09/05 09:42:58 $ -// $Revision: 1.3 $ +// $Id: erase_key_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/erase_key_fwd.hpp> #include <boost/mpl/map/aux_/has_key_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/has_key_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/has_key_impl.hpp index 3a529f0e059e3c58353665b153fcc0a3b7a2d473..70278ac97ba4ac14660394952e2041b2cb2d638d 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/has_key_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/has_key_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/has_key_impl.hpp,v $ -// $Date: 2004/09/05 09:42:58 $ -// $Revision: 1.3 $ +// $Id: has_key_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/has_key_fwd.hpp> #include <boost/mpl/map/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/include_preprocessed.hpp b/Utilities/BGL/boost/mpl/map/aux_/include_preprocessed.hpp index e1270b121dd00fef2ef79ba7ca1fc86aa2e7b288..bff33965a62fc59f4129f4814fd96f7061302c40 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/include_preprocessed.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/include_preprocessed.hpp @@ -7,15 +7,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/include_preprocessed.hpp,v $ -// $Date: 2004/09/05 09:42:58 $ -// $Revision: 1.3 $ +// $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! #include <boost/mpl/aux_/config/typeof.hpp> #include <boost/mpl/aux_/config/ctps.hpp> #include <boost/mpl/aux_/config/preprocessor.hpp> +#include <boost/mpl/aux_/config/workaround.hpp> #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/stringize.hpp> @@ -38,8 +39,13 @@ /**/ #endif - +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700)) +# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/map/aux_/preprocessed/AUX778076_HEADER) +# include AUX778076_INCLUDE_STRING +# undef AUX778076_INCLUDE_STRING +#else # include BOOST_PP_STRINGIZE(boost/mpl/map/aux_/preprocessed/AUX778076_HEADER) +#endif # undef AUX778076_HEADER # undef AUX778076_INCLUDE_DIR diff --git a/Utilities/BGL/boost/mpl/map/aux_/insert_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/insert_impl.hpp index 86b60109d242abc6b241a15c4f4cc46eb5f644dd..411909f8f2deb8d3e5b419f591bad991816eb5ac 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/insert_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/insert_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/insert_impl.hpp,v $ -// $Date: 2004/12/14 14:05:31 $ -// $Revision: 1.4 $ +// $Id: insert_impl.hpp 55751 2009-08-24 04:11:00Z agurtovoy $ +// $Date: 2009-08-24 00:11:00 -0400 (Mon, 24 Aug 2009) $ +// $Revision: 55751 $ #include <boost/mpl/insert_fwd.hpp> #include <boost/mpl/next_prior.hpp> @@ -39,7 +39,7 @@ struct map_insert_impl > #else , m_item< - next< typename Map::size >::type::value + Map::order::value , typename Pair::first , typename Pair::second , Map diff --git a/Utilities/BGL/boost/mpl/map/aux_/item.hpp b/Utilities/BGL/boost/mpl/map/aux_/item.hpp index 516ebeab1205f6138d0a1959244666e18c92719a..e9b5eccbfb2ee9ae1c6aa583484c6a14fe1b3143 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/item.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/item.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/item.hpp,v $ -// $Date: 2004/12/14 14:05:32 $ -// $Revision: 1.5 $ +// $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/void.hpp> #include <boost/mpl/pair.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/iterator.hpp b/Utilities/BGL/boost/mpl/map/aux_/iterator.hpp index 85fe3a52a060e74ade75d8df2d36c4dcd46430db..403170751d85f52cb2a1968e1755d73e66ee4fbc 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/iterator.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/iterator.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/iterator.hpp,v $ -// $Date: 2004/12/14 14:05:32 $ -// $Revision: 1.3 $ +// $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/map/aux_/map0.hpp> #include <boost/mpl/map/aux_/at_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/key_type_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/key_type_impl.hpp index 0a50415e31e399bf687153bd884b6b7ec25acdb2..e8750eb377ac17739d72fcbbf9a7122a10d30c05 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/key_type_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/key_type_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/key_type_impl.hpp,v $ -// $Date: 2004/09/02 15:41:00 $ -// $Revision: 1.2 $ +// $Id: key_type_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/key_type_fwd.hpp> #include <boost/mpl/pair.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/map0.hpp b/Utilities/BGL/boost/mpl/map/aux_/map0.hpp index e4a52f6c47b46fe72f3bc78b37d87643059a81b7..9646cf8fb1c96e1ccd5d94c33d113ca5a07c11de 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/map0.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/map0.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/map0.hpp,v $ -// $Date: 2004/10/13 18:23:36 $ -// $Revision: 1.4 $ +// $Id: map0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long.hpp> #include <boost/mpl/void.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/numbered.hpp b/Utilities/BGL/boost/mpl/map/aux_/numbered.hpp index 8dd0dd0f0f3e615f7bb804790fb82e5f2cd50028..b092839b867da61433e5473627f6e721fec45ef3 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/numbered.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/numbered.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/numbered.hpp,v $ -// $Date: 2004/12/14 14:05:32 $ -// $Revision: 1.4 $ +// $Id: numbered.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #else diff --git a/Utilities/BGL/boost/mpl/map/aux_/size_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/size_impl.hpp index 881a6484d4e487acd60379fa6d828d3bfb9b1e55..70febc57cd881e3bc550d78d5259ab5a7257760e 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/size_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/size_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/size_impl.hpp,v $ -// $Date: 2004/09/02 15:41:00 $ -// $Revision: 1.2 $ +// $Id: size_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/map/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/map/aux_/tag.hpp b/Utilities/BGL/boost/mpl/map/aux_/tag.hpp index a585b990756bdc361e8b307325072aadd2a10edc..a698ddcf9c22a7103bdfae22d75a60748d041d63 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/tag.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/tag.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/tag.hpp,v $ -// $Date: 2004/09/02 15:41:00 $ -// $Revision: 1.2 $ +// $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/map/aux_/value_type_impl.hpp b/Utilities/BGL/boost/mpl/map/aux_/value_type_impl.hpp index bf64269db1bc1e8cfe1b5f9442a6ba2230f58a1d..ca779677d0873e4071db5811b0cf8884acba32c5 100644 --- a/Utilities/BGL/boost/mpl/map/aux_/value_type_impl.hpp +++ b/Utilities/BGL/boost/mpl/map/aux_/value_type_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/value_type_impl.hpp,v $ -// $Date: 2004/09/02 15:41:00 $ -// $Revision: 1.2 $ +// $Id: value_type_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/value_type_fwd.hpp> #include <boost/mpl/pair.hpp> diff --git a/Utilities/BGL/boost/mpl/map/map0.hpp b/Utilities/BGL/boost/mpl/map/map0.hpp index 16fd46935c1c66a0d8814cb8e5ba7dd437ecb815..a130844ec7a39e80f9ce631851b80a2032e78b40 100644 --- a/Utilities/BGL/boost/mpl/map/map0.hpp +++ b/Utilities/BGL/boost/mpl/map/map0.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/map0.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.2 $ +// $Id: map0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/map/aux_/contains_impl.hpp> #include <boost/mpl/map/aux_/at_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/map/map10.hpp b/Utilities/BGL/boost/mpl/map/map10.hpp index c5c05ab842c413d6c30d48940dad6875ccb1a6c6..bc9ab754a0d56bf7088c4322306816c374b84723 100644 --- a/Utilities/BGL/boost/mpl/map/map10.hpp +++ b/Utilities/BGL/boost/mpl/map/map10.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/map10.hpp,v $ -// $Date: 2004/09/05 09:42:58 $ -// $Revision: 1.3 $ +// $Id: map10.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/map/map0.hpp> diff --git a/Utilities/BGL/boost/mpl/map/map20.hpp b/Utilities/BGL/boost/mpl/map/map20.hpp index a2e3a307298bd51f929cd4cbfb74a929fa8f6383..f63571e3c94a2a7bc49d8361333ce9d29ed11f9e 100644 --- a/Utilities/BGL/boost/mpl/map/map20.hpp +++ b/Utilities/BGL/boost/mpl/map/map20.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/map20.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.2 $ +// $Id: map20.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/map/map10.hpp> diff --git a/Utilities/BGL/boost/mpl/map/map30.hpp b/Utilities/BGL/boost/mpl/map/map30.hpp index 0997fb700796471604e7d977e1ada0c0d67f95b9..c08b89d67d04ad780483884c4eefb438806143f9 100644 --- a/Utilities/BGL/boost/mpl/map/map30.hpp +++ b/Utilities/BGL/boost/mpl/map/map30.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/map30.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.2 $ +// $Id: map30.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/map/map20.hpp> diff --git a/Utilities/BGL/boost/mpl/map/map40.hpp b/Utilities/BGL/boost/mpl/map/map40.hpp index 0f04472800626f5662a74d57f4601aaba3b53cb0..426c31b540cd805337271b245c68295c907aa74e 100644 --- a/Utilities/BGL/boost/mpl/map/map40.hpp +++ b/Utilities/BGL/boost/mpl/map/map40.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/map40.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.2 $ +// $Id: map40.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/map/map30.hpp> diff --git a/Utilities/BGL/boost/mpl/map/map50.hpp b/Utilities/BGL/boost/mpl/map/map50.hpp index 55809362620cb92c77eadef511566603c02ed7a3..2058e54a713f776367ef63b3c0d0b2cbd47fd171 100644 --- a/Utilities/BGL/boost/mpl/map/map50.hpp +++ b/Utilities/BGL/boost/mpl/map/map50.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/map/map50.hpp,v $ -// $Date: 2004/09/02 15:40:59 $ -// $Revision: 1.2 $ +// $Id: map50.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/map/map40.hpp> diff --git a/Utilities/BGL/boost/mpl/math/fixed_c.hpp b/Utilities/BGL/boost/mpl/math/fixed_c.hpp index 62feed163efa57a8cb8222da05e9b5554ceabe54..25e775dd5259684aae92ed0ec214f97702a03173 100644 --- a/Utilities/BGL/boost/mpl/math/fixed_c.hpp +++ b/Utilities/BGL/boost/mpl/math/fixed_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/math/fixed_c.hpp,v $ -// $Date: 2004/09/02 15:41:01 $ -// $Revision: 1.4 $ +// $Id: fixed_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/static_constant.hpp> diff --git a/Utilities/BGL/boost/mpl/math/is_even.hpp b/Utilities/BGL/boost/mpl/math/is_even.hpp index 41dbafbb6450a2c5f152e12bf593fafe4d72a90d..46a5711e0b74f522e5e2e427172a0dc0db7efacc 100644 --- a/Utilities/BGL/boost/mpl/math/is_even.hpp +++ b/Utilities/BGL/boost/mpl/math/is_even.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/math/is_even.hpp,v $ -// $Date: 2004/09/02 15:41:01 $ -// $Revision: 1.5 $ +// $Id: is_even.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/bool.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/math/rational_c.hpp b/Utilities/BGL/boost/mpl/math/rational_c.hpp index e99f06f7a0741eae7e63617541e9c689b4fc0317..44eb755d4d501756cf20dfdf8a877aca306e74d5 100644 --- a/Utilities/BGL/boost/mpl/math/rational_c.hpp +++ b/Utilities/BGL/boost/mpl/math/rational_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/math/rational_c.hpp,v $ -// $Date: 2004/09/02 15:41:01 $ -// $Revision: 1.4 $ +// $Id: rational_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/static_constant.hpp> diff --git a/Utilities/BGL/boost/mpl/max.hpp b/Utilities/BGL/boost/mpl/max.hpp index b307f34ef368b032b0ecbe6650f5760cb63d50ea..c3c9bb68be920a0408b676e0c9e857ebd163a092 100644 --- a/Utilities/BGL/boost/mpl/max.hpp +++ b/Utilities/BGL/boost/mpl/max.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/max.hpp,v $ -// $Date: 2004/11/28 01:55:27 $ -// $Revision: 1.2 $ +// $Id: max.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/min_max.hpp> diff --git a/Utilities/BGL/boost/mpl/max_element.hpp b/Utilities/BGL/boost/mpl/max_element.hpp index 916ca2cb065c052d6485e7df09d64e08955a9cb5..6d16dfcb8176360e0c8417605fe81ce9e26f330e 100644 --- a/Utilities/BGL/boost/mpl/max_element.hpp +++ b/Utilities/BGL/boost/mpl/max_element.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/max_element.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.7 $ +// $Id: max_element.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/less.hpp> #include <boost/mpl/iter_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/min.hpp b/Utilities/BGL/boost/mpl/min.hpp index 34487c929966a1df8edc191e41b21e5d0042663c..23d093dba5f581610b8c61d1a41da2cb85780b80 100644 --- a/Utilities/BGL/boost/mpl/min.hpp +++ b/Utilities/BGL/boost/mpl/min.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/min.hpp,v $ -// $Date: 2004/11/28 01:55:27 $ -// $Revision: 1.2 $ +// $Id: min.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/min_max.hpp> diff --git a/Utilities/BGL/boost/mpl/min_element.hpp b/Utilities/BGL/boost/mpl/min_element.hpp index 9f4b00636df488eaa1ab817fb10827a256a0513a..88c1cc48ecdb6b58fe51c797f5a782b94c83c1a8 100644 --- a/Utilities/BGL/boost/mpl/min_element.hpp +++ b/Utilities/BGL/boost/mpl/min_element.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/min_element.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: min_element.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/max_element.hpp> #include <boost/mpl/not.hpp> diff --git a/Utilities/BGL/boost/mpl/min_max.hpp b/Utilities/BGL/boost/mpl/min_max.hpp index f28b1c6d415e49ef62980efaa566a828e2c61065..944b776d6124f9a56d73c52743b1eb7687b9a2a3 100644 --- a/Utilities/BGL/boost/mpl/min_max.hpp +++ b/Utilities/BGL/boost/mpl/min_max.hpp @@ -1,8 +1,8 @@ -#ifndef BOOST_MPL_MAX_HPP_INCLUDED -#define BOOST_MPL_MAX_HPP_INCLUDED +#ifndef BOOST_MPL_MIN_MAX_HPP_INCLUDED +#define BOOST_MPL_MIN_MAX_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/min_max.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.2 $ +// $Id: min_max.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/less.hpp> #include <boost/mpl/if.hpp> @@ -43,4 +43,4 @@ BOOST_MPL_AUX_NA_SPEC(2, max) }} -#endif // BOOST_MPL_MAX_HPP_INCLUDED +#endif // BOOST_MPL_MIN_MAX_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/minus.hpp b/Utilities/BGL/boost/mpl/minus.hpp index fe6e2ace6595cd553a281f9d3df2d52148ddbad4..a737185a78c53fa7dd51d50ea9e876dbf3448d91 100644 --- a/Utilities/BGL/boost/mpl/minus.hpp +++ b/Utilities/BGL/boost/mpl/minus.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/minus.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: minus.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME minus #define AUX778076_OP_TOKEN - diff --git a/Utilities/BGL/boost/mpl/modulus.hpp b/Utilities/BGL/boost/mpl/modulus.hpp index 292e58e92fd0b05e83bfb409545f5be53d12022d..b3777b6ed9357d1f8e3dc67f1fe2c3e1b9c29db4 100644 --- a/Utilities/BGL/boost/mpl/modulus.hpp +++ b/Utilities/BGL/boost/mpl/modulus.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/modulus.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: modulus.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME modulus #define AUX778076_OP_TOKEN % diff --git a/Utilities/BGL/boost/mpl/multiplies.hpp b/Utilities/BGL/boost/mpl/multiplies.hpp index 14ae36144b71a08b6d71f8fb5a13492b1a9edee1..772b7bd86996e1dbf7adab864212a0153dd8fb92 100644 --- a/Utilities/BGL/boost/mpl/multiplies.hpp +++ b/Utilities/BGL/boost/mpl/multiplies.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/multiplies.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: multiplies.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/times.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/multiset/aux_/count_impl.hpp b/Utilities/BGL/boost/mpl/multiset/aux_/count_impl.hpp index 0969dcee1d152bab9657825ba22f88234eca6573..a1a6215a2d3f64819c553452797525647998e06d 100644 --- a/Utilities/BGL/boost/mpl/multiset/aux_/count_impl.hpp +++ b/Utilities/BGL/boost/mpl/multiset/aux_/count_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/multiset/aux_/count_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: count_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/multiset/aux_/tag.hpp> #include <boost/mpl/count_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/multiset/aux_/insert_impl.hpp b/Utilities/BGL/boost/mpl/multiset/aux_/insert_impl.hpp index 60a25fc573a648ad3700efbcb9bbf29a69edeef0..db5e7761e8af01f9fbd94655db89a8327fbd8829 100644 --- a/Utilities/BGL/boost/mpl/multiset/aux_/insert_impl.hpp +++ b/Utilities/BGL/boost/mpl/multiset/aux_/insert_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/multiset/aux_/insert_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: insert_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/multiset/aux_/item.hpp> #include <boost/mpl/multiset/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/multiset/aux_/item.hpp b/Utilities/BGL/boost/mpl/multiset/aux_/item.hpp index a102b0a6d5401722dea802fbc0fad58f1eade87a..9512930af9989a2a06683dd2f3cf8de85698c29f 100644 --- a/Utilities/BGL/boost/mpl/multiset/aux_/item.hpp +++ b/Utilities/BGL/boost/mpl/multiset/aux_/item.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/multiset/aux_/item.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/multiset/aux_/tag.hpp> #include <boost/mpl/int.hpp> diff --git a/Utilities/BGL/boost/mpl/multiset/aux_/multiset0.hpp b/Utilities/BGL/boost/mpl/multiset/aux_/multiset0.hpp index 01cefada7c55e534e6b58ba4015c12226833baf7..b4b325a75947e0eebc5afebcd2fc0aa655646061 100644 --- a/Utilities/BGL/boost/mpl/multiset/aux_/multiset0.hpp +++ b/Utilities/BGL/boost/mpl/multiset/aux_/multiset0.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/multiset/aux_/multiset0.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: multiset0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/multiset/aux_/tag.hpp> #include <boost/mpl/int.hpp> diff --git a/Utilities/BGL/boost/mpl/multiset/aux_/tag.hpp b/Utilities/BGL/boost/mpl/multiset/aux_/tag.hpp index c2e616411513ed0653f3abd4da5265f1270b9443..5f3a8c001556acc225a9e76a08b316f269015a16 100644 --- a/Utilities/BGL/boost/mpl/multiset/aux_/tag.hpp +++ b/Utilities/BGL/boost/mpl/multiset/aux_/tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/multiset/aux_/tag.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/multiset/multiset0.hpp b/Utilities/BGL/boost/mpl/multiset/multiset0.hpp index 9b23635facc59e767bd2dd3636d286b8186089ce..d01d93893786f61e0051bab670f8a3b0f9f12bad 100644 --- a/Utilities/BGL/boost/mpl/multiset/multiset0.hpp +++ b/Utilities/BGL/boost/mpl/multiset/multiset0.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/multiset/multiset0.hpp,v $ -// $Date: 2004/09/02 15:41:01 $ -// $Revision: 1.2 $ +// $Id: multiset0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ //#include <boost/mpl/multiset/aux_/at.hpp> //#include <boost/mpl/multiset/aux_/front.hpp> diff --git a/Utilities/BGL/boost/mpl/negate.hpp b/Utilities/BGL/boost/mpl/negate.hpp index 5d158bc4819d10703b4dca8c20764e64e3fc3641..bb8bcdd2aaf5b19c8f3c77f9cfa13677b5ec5810 100644 --- a/Utilities/BGL/boost/mpl/negate.hpp +++ b/Utilities/BGL/boost/mpl/negate.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/negate.hpp,v $ -// $Date: 2004/09/07 09:06:08 $ -// $Revision: 1.4 $ +// $Id: negate.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/integral_c.hpp> #include <boost/mpl/aux_/msvc_eti_base.hpp> diff --git a/Utilities/BGL/boost/mpl/next.hpp b/Utilities/BGL/boost/mpl/next.hpp index 3aec2236ff4d347c78f025195af420b02841b9fb..3d4e7119b8c36d3f6ca8eb6140073f3817c3ea63 100644 --- a/Utilities/BGL/boost/mpl/next.hpp +++ b/Utilities/BGL/boost/mpl/next.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/next.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.7 $ +// $Id: next.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/next_prior.hpp b/Utilities/BGL/boost/mpl/next_prior.hpp index c8f4ca3ace0b89b5eb93f49f44c0a4a664cc48d1..4a9655b0400ede6f79368ef645716e1ab6ba13c4 100644 --- a/Utilities/BGL/boost/mpl/next_prior.hpp +++ b/Utilities/BGL/boost/mpl/next_prior.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/next_prior.hpp,v $ -// $Date: 2004/09/17 06:09:38 $ -// $Revision: 1.3 $ +// $Id: next_prior.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/common_name_wknd.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/not.hpp b/Utilities/BGL/boost/mpl/not.hpp index 9a51fc50f9da300b12ee53f479905ad1d6313e22..2abc0db049dd82fe5d70303fe1e1090a5199f5f8 100644 --- a/Utilities/BGL/boost/mpl/not.hpp +++ b/Utilities/BGL/boost/mpl/not.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/not.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: not.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/bool.hpp> #include <boost/mpl/aux_/nttp_decl.hpp> diff --git a/Utilities/BGL/boost/mpl/not_equal_to.hpp b/Utilities/BGL/boost/mpl/not_equal_to.hpp index 74787e1a1ed7b8811c5a4313f51994a60025dcd1..00132b1eaaf8dfa0d511c77f16d77f0ee33938a4 100644 --- a/Utilities/BGL/boost/mpl/not_equal_to.hpp +++ b/Utilities/BGL/boost/mpl/not_equal_to.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/not_equal_to.hpp,v $ -// $Date: 2004/09/02 15:40:41 $ -// $Revision: 1.3 $ +// $Id: not_equal_to.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME not_equal_to #define AUX778076_OP_TOKEN != diff --git a/Utilities/BGL/boost/mpl/numeric_cast.hpp b/Utilities/BGL/boost/mpl/numeric_cast.hpp index 106a2d0432dacd0cd11b6423051b54d9f58f9a39..808ede06879c079867091bd145b2743a0969e785 100644 --- a/Utilities/BGL/boost/mpl/numeric_cast.hpp +++ b/Utilities/BGL/boost/mpl/numeric_cast.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/numeric_cast.hpp,v $ -// $Date: 2005/06/26 17:14:04 $ -// $Revision: 1.9 $ +// $Id: numeric_cast.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/Utilities/BGL/boost/mpl/or.hpp b/Utilities/BGL/boost/mpl/or.hpp index 7ab97ff8b50a3af89b38c10ce18b0541629de740..470644905dc92ca67d1d4e8c87b898cd890d547a 100644 --- a/Utilities/BGL/boost/mpl/or.hpp +++ b/Utilities/BGL/boost/mpl/or.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/or.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: or.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/use_preprocessed.hpp> @@ -30,21 +30,25 @@ // has to be checked in a separate condition, otherwise GCC complains // about 'or' being an alternative token #if defined(_MSC_VER) +#ifndef __GCCXML__ #if defined(or) # pragma push_macro("or") # undef or # define or(x) #endif #endif +#endif # define BOOST_MPL_PREPROCESSED_HEADER or.hpp # include <boost/mpl/aux_/include_preprocessed.hpp> #if defined(_MSC_VER) +#ifndef __GCCXML__ #if defined(or) # pragma pop_macro("or") #endif #endif +#endif #else diff --git a/Utilities/BGL/boost/mpl/order.hpp b/Utilities/BGL/boost/mpl/order.hpp index 23a5fb61b0464e891544e0acf038a1a10861db77..25dab66df5d2697b32a1d4dda2251e8e9abefdc1 100644 --- a/Utilities/BGL/boost/mpl/order.hpp +++ b/Utilities/BGL/boost/mpl/order.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/order.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: order.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/order_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/order_fwd.hpp b/Utilities/BGL/boost/mpl/order_fwd.hpp index ecaa285ffa3ec015865292e922fec3861a6e37b3..313a2c3f2c2c272daa887799c5f871653f68cb8e 100644 --- a/Utilities/BGL/boost/mpl/order_fwd.hpp +++ b/Utilities/BGL/boost/mpl/order_fwd.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/order_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: order_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/pair.hpp b/Utilities/BGL/boost/mpl/pair.hpp index 8a9a47331ae6dd1b8a38be2c987c9bc2c5af159d..b3fb02658d950605486841872d2274daa4f2d20c 100644 --- a/Utilities/BGL/boost/mpl/pair.hpp +++ b/Utilities/BGL/boost/mpl/pair.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/pair.hpp,v $ -// $Date: 2004/12/14 14:05:31 $ -// $Revision: 1.5 $ +// $Id: pair.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/msvc_eti_base.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/pair_view.hpp b/Utilities/BGL/boost/mpl/pair_view.hpp index 04bea087ca7583778b8c7645fb75e717bfe79b43..43430f53a513bd400735e96e40f26fdc26be31b4 100644 --- a/Utilities/BGL/boost/mpl/pair_view.hpp +++ b/Utilities/BGL/boost/mpl/pair_view.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/pair_view.hpp,v $ -// $Date: 2004/11/28 01:56:21 $ -// $Revision: 1.5 $ +// $Id: pair_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/iterator_category.hpp> diff --git a/Utilities/BGL/boost/mpl/partition.hpp b/Utilities/BGL/boost/mpl/partition.hpp index 264b68725c6dbf1c4f772af503dafa8c473d9a59..97a569a1463c9702a764593f513ad13d3c5657fb 100644 --- a/Utilities/BGL/boost/mpl/partition.hpp +++ b/Utilities/BGL/boost/mpl/partition.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/partition.hpp,v $ -// $Date: 2004/11/28 01:56:21 $ -// $Revision: 1.4 $ +// $Id: partition.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/stable_partition.hpp> #include <boost/mpl/aux_/inserter_algorithm.hpp> diff --git a/Utilities/BGL/boost/mpl/placeholders.hpp b/Utilities/BGL/boost/mpl/placeholders.hpp index f12f5a853105fde6de35c32bcd602427e3bece29..c1a38d9f4a6aca833d258d7bd801d96f141a055a 100644 --- a/Utilities/BGL/boost/mpl/placeholders.hpp +++ b/Utilities/BGL/boost/mpl/placeholders.hpp @@ -15,9 +15,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/placeholders.hpp,v $ -// $Date: 2004/09/16 14:08:46 $ -// $Revision: 1.4 $ +// $Id: placeholders.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/Utilities/BGL/boost/mpl/plus.hpp b/Utilities/BGL/boost/mpl/plus.hpp index fefe79aacb1d7beb894b063d69b87ec915d64c45..79642eb8409d89be3d15b2c27b833a3455341985 100644 --- a/Utilities/BGL/boost/mpl/plus.hpp +++ b/Utilities/BGL/boost/mpl/plus.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/plus.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: plus.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME plus #define AUX778076_OP_TOKEN + diff --git a/Utilities/BGL/boost/mpl/pop_back.hpp b/Utilities/BGL/boost/mpl/pop_back.hpp index 61173d486d00324199c5d569ec1d3920ba18d415..429fb8743218336749e59cc59d219ef72b441669 100644 --- a/Utilities/BGL/boost/mpl/pop_back.hpp +++ b/Utilities/BGL/boost/mpl/pop_back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/pop_back.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: pop_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/pop_back_fwd.hpp> #include <boost/mpl/aux_/pop_back_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/pop_back_fwd.hpp b/Utilities/BGL/boost/mpl/pop_back_fwd.hpp index f776842c2fe1e7cb55037551f52166ce46f25e56..4fba829fa813c0ee3a79d082334159486288e21b 100644 --- a/Utilities/BGL/boost/mpl/pop_back_fwd.hpp +++ b/Utilities/BGL/boost/mpl/pop_back_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/pop_back_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: pop_back_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/pop_front.hpp b/Utilities/BGL/boost/mpl/pop_front.hpp index 871d5e18defcd18a8e9b445f98c7ef10135d9fc1..6f6c3b990ca759fd127f444142c0eb805e30a717 100644 --- a/Utilities/BGL/boost/mpl/pop_front.hpp +++ b/Utilities/BGL/boost/mpl/pop_front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/pop_front.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: pop_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/pop_front_fwd.hpp> #include <boost/mpl/aux_/pop_front_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/pop_front_fwd.hpp b/Utilities/BGL/boost/mpl/pop_front_fwd.hpp index 0d0ef38d1a6135ebc9a8c8d60f5263d3f4a155b9..64d4c58e8e9f2a5d403ca742ad45f1f833ed3e6f 100644 --- a/Utilities/BGL/boost/mpl/pop_front_fwd.hpp +++ b/Utilities/BGL/boost/mpl/pop_front_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/pop_front_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: pop_front_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/print.hpp b/Utilities/BGL/boost/mpl/print.hpp index a1974826ee2762bd0e4abb925e8e1d3b83825877..a8528500ccaf98a00988a2bd80b347be511d203d 100644 --- a/Utilities/BGL/boost/mpl/print.hpp +++ b/Utilities/BGL/boost/mpl/print.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/print.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: print.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> #include <boost/mpl/identity.hpp> @@ -57,7 +57,7 @@ struct print # if defined(__EDG_VERSION__) aux::dependent_unsigned<T>::value > -1 # else - sizeof(T) > -1, + sizeof(T) > -1 # endif }; #endif diff --git a/Utilities/BGL/boost/mpl/prior.hpp b/Utilities/BGL/boost/mpl/prior.hpp index 376cc275f9343c0228027017ff0c67bb1857b35a..e08d9670048396900124aa587474f94199e4e857 100644 --- a/Utilities/BGL/boost/mpl/prior.hpp +++ b/Utilities/BGL/boost/mpl/prior.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/prior.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.7 $ +// $Id: prior.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/protect.hpp b/Utilities/BGL/boost/mpl/protect.hpp index 6a87fea689075cfc4c264a4e35a9e6ba830e3abe..4fad8352b6735ea6007f4c6f14901d5081b5fe14 100644 --- a/Utilities/BGL/boost/mpl/protect.hpp +++ b/Utilities/BGL/boost/mpl/protect.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/protect.hpp,v $ -// $Date: 2004/09/07 21:37:24 $ -// $Revision: 1.10 $ +// $Id: protect.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/arity.hpp> #include <boost/mpl/aux_/config/dtp.hpp> diff --git a/Utilities/BGL/boost/mpl/push_back.hpp b/Utilities/BGL/boost/mpl/push_back.hpp index 8b17541205a0848b7a72a5148a60488751d8dcc7..96389a37dd7a17645b6706738cba722791b51ba4 100644 --- a/Utilities/BGL/boost/mpl/push_back.hpp +++ b/Utilities/BGL/boost/mpl/push_back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/push_back.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: push_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_back_fwd.hpp> #include <boost/mpl/aux_/push_back_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/push_back_fwd.hpp b/Utilities/BGL/boost/mpl/push_back_fwd.hpp index 2701ce14060862c388d5dcfb2393484fb93fda72..381aa299b2a0c8d50f067d4d63f2a0c83168cd09 100644 --- a/Utilities/BGL/boost/mpl/push_back_fwd.hpp +++ b/Utilities/BGL/boost/mpl/push_back_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/push_back_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: push_back_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/push_front.hpp b/Utilities/BGL/boost/mpl/push_front.hpp index a9a02f930613cdcf5d004d413108978fc8c83ad2..3c4283cc3e13353d9cb7c837eb79cc86a9de439b 100644 --- a/Utilities/BGL/boost/mpl/push_front.hpp +++ b/Utilities/BGL/boost/mpl/push_front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/push_front.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: push_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_front_fwd.hpp> #include <boost/mpl/aux_/push_front_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/push_front_fwd.hpp b/Utilities/BGL/boost/mpl/push_front_fwd.hpp index 155480a236c557e0f2a7e9dada4f87b9363d9b70..11123bf4a6a2b115e491bd6269f820ac75ca9fb6 100644 --- a/Utilities/BGL/boost/mpl/push_front_fwd.hpp +++ b/Utilities/BGL/boost/mpl/push_front_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/push_front_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: push_front_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/quote.hpp b/Utilities/BGL/boost/mpl/quote.hpp index f2e89763660612f8ed92439eb30b70eadf4ccafd..52f67bf62b807b98d987ea18e8956f1ef15fa54c 100644 --- a/Utilities/BGL/boost/mpl/quote.hpp +++ b/Utilities/BGL/boost/mpl/quote.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_MPL_QUOTE_HPP_INCLUDED #define BOOST_MPL_QUOTE_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -14,18 +14,20 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/quote.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.5 $ +// $Id: quote.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ +// $Date: 2008-10-11 02:50:46 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49272 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/void.hpp> # include <boost/mpl/aux_/has_type.hpp> #endif +#include <boost/mpl/aux_/config/bcc.hpp> #include <boost/mpl/aux_/config/ttp.hpp> -#if defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) +#if defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) \ + && !defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) # define BOOST_MPL_CFG_NO_QUOTE_TEMPLATE #endif @@ -60,9 +62,19 @@ namespace boost { namespace mpl { template< typename T, bool has_type_ > struct quote_impl +// GCC has a problem with metafunction forwarding when T is a +// specialization of a template called 'type'. +# if BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(4)) \ + && BOOST_WORKAROUND(__GNUC_MINOR__, BOOST_TESTED_AT(0)) \ + && BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, BOOST_TESTED_AT(2)) +{ + typedef typename T::type type; +}; +# else : T { }; +# endif template< typename T > struct quote_impl<T,false> @@ -113,17 +125,26 @@ template< struct BOOST_PP_CAT(quote,i_) { template< BOOST_MPL_PP_PARAMS(i_, typename U) > struct apply -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) + { + typedef typename quote_impl< + F< BOOST_MPL_PP_PARAMS(i_, U) > + , aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value + >::type type; + }; +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) : quote_impl< F< BOOST_MPL_PP_PARAMS(i_, U) > , aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value > + { + }; #else : quote_impl< aux::has_type< F< BOOST_MPL_PP_PARAMS(i_, U) > >::value > ::template result_< F< BOOST_MPL_PP_PARAMS(i_, U) > > -#endif { }; +#endif }; #undef i_ diff --git a/Utilities/BGL/boost/mpl/range_c.hpp b/Utilities/BGL/boost/mpl/range_c.hpp index 4a969bdd2aad7cd5dadaaae077c7241edf94c514..d3e07a82cc4a015945942ac65648d4081ce1414d 100644 --- a/Utilities/BGL/boost/mpl/range_c.hpp +++ b/Utilities/BGL/boost/mpl/range_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/range_c.hpp,v $ -// $Date: 2004/11/28 01:57:09 $ -// $Revision: 1.5 $ +// $Id: range_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/integral_c.hpp> #include <boost/mpl/aux_/range_c/front.hpp> diff --git a/Utilities/BGL/boost/mpl/remove.hpp b/Utilities/BGL/boost/mpl/remove.hpp index 2345da1e01d11ad8d1b0a507c5455def9c137b5b..61f42a9e71456369a54ce30c431e08f01a9943a6 100644 --- a/Utilities/BGL/boost/mpl/remove.hpp +++ b/Utilities/BGL/boost/mpl/remove.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/remove.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.5 $ +// $Id: remove.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/remove_if.hpp> #include <boost/mpl/same_as.hpp> diff --git a/Utilities/BGL/boost/mpl/remove_if.hpp b/Utilities/BGL/boost/mpl/remove_if.hpp index 25d0c1c042ddfdf11c062ccf662a2f4249cc7c7e..f707abd42398613941ed69a25bfa138fd1ef05eb 100644 --- a/Utilities/BGL/boost/mpl/remove_if.hpp +++ b/Utilities/BGL/boost/mpl/remove_if.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/remove_if.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.7 $ +// $Id: remove_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/reverse_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/replace.hpp b/Utilities/BGL/boost/mpl/replace.hpp index 50992b06ec8bf94a507c99641fd9a66486eee264..6bc12b2fc24453dcfc962bb1c76da893108d6368 100644 --- a/Utilities/BGL/boost/mpl/replace.hpp +++ b/Utilities/BGL/boost/mpl/replace.hpp @@ -12,9 +12,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/replace.hpp,v $ -// $Date: 2004/11/28 01:57:09 $ -// $Revision: 1.8 $ +// $Id: replace.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/replace_if.hpp> #include <boost/mpl/same_as.hpp> diff --git a/Utilities/BGL/boost/mpl/replace_if.hpp b/Utilities/BGL/boost/mpl/replace_if.hpp index a5a5668c66a4e6c2f5dd12e0f751843fc35e6903..64ccb14a1ad073ba37c82ca3e528b670ea443055 100644 --- a/Utilities/BGL/boost/mpl/replace_if.hpp +++ b/Utilities/BGL/boost/mpl/replace_if.hpp @@ -12,9 +12,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/replace_if.hpp,v $ -// $Date: 2004/11/28 01:57:09 $ -// $Revision: 1.7 $ +// $Id: replace_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/transform.hpp> #include <boost/mpl/apply.hpp> diff --git a/Utilities/BGL/boost/mpl/reverse.hpp b/Utilities/BGL/boost/mpl/reverse.hpp index 83fee4e169833b049fd6802fef75fc52223ed4c4..fc3383778cce744357206c07cfb474bae3775ada 100644 --- a/Utilities/BGL/boost/mpl/reverse.hpp +++ b/Utilities/BGL/boost/mpl/reverse.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/reverse.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.5 $ +// $Id: reverse.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/copy.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/reverse_fold.hpp b/Utilities/BGL/boost/mpl/reverse_fold.hpp index 12259038fb61ebb66391d74bd9609b9c6ba4975d..79b6ec775697472fb3601bf3e8ffb774e722cc80 100644 --- a/Utilities/BGL/boost/mpl/reverse_fold.hpp +++ b/Utilities/BGL/boost/mpl/reverse_fold.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/reverse_fold.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: reverse_fold.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/O1_size.hpp> diff --git a/Utilities/BGL/boost/mpl/reverse_iter_fold.hpp b/Utilities/BGL/boost/mpl/reverse_iter_fold.hpp index 3aa7f2881da94443cfd0d43cc65680c869001797..e6b3ed3ac285aa990c5f49fa74152b4bf3fe1b5a 100644 --- a/Utilities/BGL/boost/mpl/reverse_iter_fold.hpp +++ b/Utilities/BGL/boost/mpl/reverse_iter_fold.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/reverse_iter_fold.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: reverse_iter_fold.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/O1_size.hpp> diff --git a/Utilities/BGL/boost/mpl/same_as.hpp b/Utilities/BGL/boost/mpl/same_as.hpp index 28f882cb063f097227bbfb9e389df7adce9f22ce..e95d55f0a166d74aecbdfed229245c47b7e7d16a 100644 --- a/Utilities/BGL/boost/mpl/same_as.hpp +++ b/Utilities/BGL/boost/mpl/same_as.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/same_as.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.6 $ +// $Id: same_as.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/not.hpp> #include <boost/mpl/aux_/lambda_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/sequence_tag.hpp b/Utilities/BGL/boost/mpl/sequence_tag.hpp index f4e891304d074b4b94b711f300787c98ff9b8236..41450ed36b8947b88c268fbbaadb4a2f8df1f3dd 100644 --- a/Utilities/BGL/boost/mpl/sequence_tag.hpp +++ b/Utilities/BGL/boost/mpl/sequence_tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/sequence_tag.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.8 $ +// $Id: sequence_tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/sequence_tag_fwd.hpp> #include <boost/mpl/aux_/has_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/sequence_tag_fwd.hpp b/Utilities/BGL/boost/mpl/sequence_tag_fwd.hpp index a9dd7776e321e3ac1535cdbe86fd3a096204bf5d..07d54a4aceb79e233fa910357fa3586c41278d1f 100644 --- a/Utilities/BGL/boost/mpl/sequence_tag_fwd.hpp +++ b/Utilities/BGL/boost/mpl/sequence_tag_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/sequence_tag_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: sequence_tag_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/set.hpp b/Utilities/BGL/boost/mpl/set.hpp index 61749a261fc4f0f26652410910d3407fd5b663f6..5d16e5a837d8469bb1e50f6a65d43c7082322694 100644 --- a/Utilities/BGL/boost/mpl/set.hpp +++ b/Utilities/BGL/boost/mpl/set.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: set.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/set.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/at_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/at_impl.hpp index d5120d44c16e69a5737bdd2525c0988c7c2bad29..ad7447749b236a5a0ef93fc68ba7feef154ced49 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/at_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/at_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/at_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: at_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/at_fwd.hpp> #include <boost/mpl/set/aux_/has_key_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/begin_end_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/begin_end_impl.hpp index e9647a4e4fee8bf547146fd93fb28c5b91bb80ba..f012c2ac192dad9c4f759ada7274183997bcfd26 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/begin_end_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/begin_end_impl.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_SET_AUX_BEGIN_END_IMPL_HPP_INCLUDED #define BOOST_MPL_SET_AUX_BEGIN_END_IMPL_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright Aleksey Gurtovoy 2003-2007 // Copyright David Abrahams 2003-2004 // // Distributed under the Boost Software License, Version 1.0. @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/begin_end_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.3 $ +// $Id: begin_end_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> #include <boost/mpl/set/aux_/iterator.hpp> @@ -24,8 +24,8 @@ template<> struct begin_impl< aux::set_tag > { template< typename Set > struct apply + : s_iter_get<Set,typename Set::item_> { - typedef s_iter<Set,Set> type; }; }; diff --git a/Utilities/BGL/boost/mpl/set/aux_/clear_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/clear_impl.hpp index 20fd4fe41a0d4fd0999c9d29cb340c0d4c390c69..4c965f672f9b200f570d617c6a9761ef00d95695 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/clear_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/clear_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/clear_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: clear_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> #include <boost/mpl/set/aux_/set0.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/empty_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/empty_impl.hpp index 622390b4930be6284ded381ba7fc36d387570ef5..d40a9c48f77c53446df350a9cc430fd3d972a457 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/empty_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/empty_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/empty_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: empty_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> #include <boost/mpl/not.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/erase_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/erase_impl.hpp index d74c41a5a3eaf2e4c0c868c6d67837062043235b..954a70c6fc3c1d741f4fd03598a97310be849643 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/erase_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/erase_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/erase_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: erase_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/erase_fwd.hpp> #include <boost/mpl/set/aux_/erase_key_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/erase_key_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/erase_key_impl.hpp index fd448bb0745e88791c021e5156005a050c9d387d..9885196fc0d85f4f94ce21333d0990e6dd0993f8 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/erase_key_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/erase_key_impl.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_SET_AUX_ERASE_KEY_IMPL_HPP_INCLUDED #define BOOST_MPL_SET_AUX_ERASE_KEY_IMPL_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright Aleksey Gurtovoy 2003-2007 // Copyright David Abrahams 2003-2004 // // Distributed under the Boost Software License, Version 1.0. @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/erase_key_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: erase_key_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/erase_key_fwd.hpp> #include <boost/mpl/set/aux_/has_key_impl.hpp> @@ -40,7 +40,7 @@ struct erase_key_impl< aux::set_tag > , eval_if< is_same< T,typename Set::item_type_ > , base<Set> - , identity< s_mask<T,Set> > + , identity< s_mask<T,typename Set::item_> > > , identity<Set> > diff --git a/Utilities/BGL/boost/mpl/set/aux_/has_key_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/has_key_impl.hpp index 55aaa25cd32516630d897a0895b95ae945bf4af3..d3cae504b3e22107945933075af7831c5e910c09 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/has_key_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/has_key_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/has_key_impl.hpp,v $ -// $Date: 2004/10/13 18:23:37 $ -// $Revision: 1.7 $ +// $Id: has_key_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/set/aux_/tag.hpp> #include <boost/mpl/has_key_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/include_preprocessed.hpp b/Utilities/BGL/boost/mpl/set/aux_/include_preprocessed.hpp index 2bb73ecec7ac8aa88d3a8c6479f67320f177a5c5..5016aed209ef07a0acada8c436accfc5c67a65e0 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/include_preprocessed.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/include_preprocessed.hpp @@ -1,7 +1,7 @@ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION -// Copyright Aleksey Gurtovoy 2001-2004 +// Copyright Aleksey Gurtovoy 2001-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -9,11 +9,12 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/include_preprocessed.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> +#include <boost/mpl/aux_/config/workaround.hpp> #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/stringize.hpp> @@ -28,8 +29,13 @@ /**/ #endif - +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700)) +# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/set/aux_/preprocessed/AUX778076_HEADER) +# include AUX778076_INCLUDE_STRING +# undef AUX778076_INCLUDE_STRING +#else # include BOOST_PP_STRINGIZE(boost/mpl/set/aux_/preprocessed/AUX778076_HEADER) +#endif # undef AUX778076_HEADER diff --git a/Utilities/BGL/boost/mpl/set/aux_/insert_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/insert_impl.hpp index 64ac31727315c4e5f818c538e411e4eb49e64d67..f1d72ec0f8ee810de6b790c46011cb022714cc42 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/insert_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/insert_impl.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_SET_AUX_INSERT_IMPL_HPP_INCLUDED #define BOOST_MPL_SET_AUX_INSERT_IMPL_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright Aleksey Gurtovoy 2003-2007 // Copyright David Abrahams 2003-2004 // // Distributed under the Boost Software License, Version 1.0. @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/insert_impl.hpp,v $ -// $Date: 2004/09/05 09:42:59 $ -// $Revision: 1.4 $ +// $Id: insert_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/insert_fwd.hpp> #include <boost/mpl/set/aux_/has_key_impl.hpp> @@ -36,7 +36,7 @@ template< typename Set, typename T > struct set_insert_impl , eval_if< is_same< T,typename Set::last_masked_ > , base<Set> - , identity< s_item<T,Set> > + , identity< s_item<T,typename Set::item_> > > > { diff --git a/Utilities/BGL/boost/mpl/set/aux_/item.hpp b/Utilities/BGL/boost/mpl/set/aux_/item.hpp index 5a66be40168bbfa193130d19903bdfbd22197964..b9ca19ebdf9a2acdbd547b7b7a746788e27e7555 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/item.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/item.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_SET_AUX_ITEM_HPP_INCLUDED #define BOOST_MPL_SET_AUX_ITEM_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright Aleksey Gurtovoy 2003-2007 // Copyright David Abrahams 2003-2004 // // Distributed under the Boost Software License, Version 1.0. @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/item.hpp,v $ -// $Date: 2005/06/18 22:03:09 $ -// $Revision: 1.7 $ +// $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long.hpp> #include <boost/mpl/void.hpp> @@ -31,9 +31,7 @@ struct s_item { typedef s_item<T,Base> item_; typedef void_ last_masked_; - typedef Base next_; typedef T item_type_; - typedef item_type_ type; typedef Base base; typedef typename next< typename Base::size >::type size; diff --git a/Utilities/BGL/boost/mpl/set/aux_/iterator.hpp b/Utilities/BGL/boost/mpl/set/aux_/iterator.hpp index cb1c9482ce0b90e60fb6be7c1c1fe155a14978bc..90666a689226fddafa6db06a1f4c48d70320445b 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/iterator.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/iterator.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_SET_AUX_ITERATOR_HPP_INCLUDED #define BOOST_MPL_SET_AUX_ITERATOR_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2003-2004 +// Copyright Aleksey Gurtovoy 2003-2007 // Copyright David Abrahams 2003-2004 // // Distributed under the Boost Software License, Version 1.0. @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/iterator.hpp,v $ -// $Date: 2005/06/18 22:03:09 $ -// $Revision: 1.4 $ +// $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/set/aux_/set0.hpp> #include <boost/mpl/has_key.hpp> @@ -26,21 +26,26 @@ namespace boost { namespace mpl { -// used by 's_iter_impl' +// used by 's_iter_get' template< typename Set, typename Tail > struct s_iter; +template< typename Set, typename Tail > struct s_iter_get + : eval_if< + has_key< Set,typename Tail::item_type_ > + , identity< s_iter<Set,Tail> > + , next< s_iter<Set,Tail> > + > +{ +}; + template< typename Set, typename Tail > struct s_iter_impl { typedef Tail tail_; typedef forward_iterator_tag category; - typedef typename Tail::item_::type type; + typedef typename Tail::item_type_ type; #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - typedef typename eval_if< - has_key< Set,typename Tail::next_::type > - , identity< s_iter<Set,typename Tail::next_> > - , next< s_iter<Set,typename Tail::next_> > - >::type next; + typedef typename s_iter_get< Set,typename Tail::base >::type next; #endif }; @@ -48,11 +53,7 @@ template< typename Set, typename Tail > struct s_iter_impl template< typename Set, typename Tail > struct next< s_iter<Set,Tail> > - : eval_if< - has_key< Set,typename Tail::next_::type > - , identity< s_iter<Set,typename Tail::next_> > - , next< s_iter<Set,typename Tail::next_> > - > + : s_iter_get< Set,typename Tail::base > { }; diff --git a/Utilities/BGL/boost/mpl/set/aux_/key_type_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/key_type_impl.hpp index 2810169bc7ad1d157a2f916b469f8f188d4b23ec..23b1a1823f1167c1363bf9f6dfbcc0bcc790d61a 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/key_type_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/key_type_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/key_type_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: key_type_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/key_type_fwd.hpp> #include <boost/mpl/set/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/numbered.hpp b/Utilities/BGL/boost/mpl/set/aux_/numbered.hpp index 45b158d41e37c52f270c401512c4d5d88f87bf9b..09d9849c44ee65bc58827ede646b9e2d0c5bcde2 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/numbered.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/numbered.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/numbered.hpp,v $ -// $Date: 2005/06/18 22:03:09 $ -// $Revision: 1.4 $ +// $Id: numbered.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/enum_params.hpp> #include <boost/preprocessor/dec.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/numbered_c.hpp b/Utilities/BGL/boost/mpl/set/aux_/numbered_c.hpp index 4bf85d1f5ae24ef84237ff137734ab5a1087da40..179172be102e341a4b772bdb0613b0f92527c518 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/numbered_c.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/numbered_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/numbered_c.hpp,v $ -// $Date: 2004/11/28 01:50:43 $ -// $Revision: 1.2 $ +// $Id: numbered_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_trailing_params.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/set0.hpp b/Utilities/BGL/boost/mpl/set/aux_/set0.hpp index 617d0990af0afe4b06d531040ba8fe380dc6260b..58f1d7d7781c9c338d9d5b6ca42db43c675a9f4a 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/set0.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/set0.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/set0.hpp,v $ -// $Date: 2005/06/18 22:03:08 $ -// $Revision: 1.8 $ +// $Id: set0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long.hpp> #include <boost/mpl/void.hpp> @@ -53,10 +53,10 @@ namespace boost { namespace mpl { template< typename Dummy = na > struct set0 { typedef set0<> item_; + typedef item_ type; typedef aux::set_tag tag; typedef void_ last_masked_; typedef void_ item_type_; - typedef item_type_ type; typedef long_<0> size; typedef long_<1> order; diff --git a/Utilities/BGL/boost/mpl/set/aux_/size_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/size_impl.hpp index ff2dd4fb78a4c230da64c58dd3831d0661caad74..04437766c5dc2be2e18cb6e3359d237a6af0af3b 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/size_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/size_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/size_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: size_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/set/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/set/aux_/tag.hpp b/Utilities/BGL/boost/mpl/set/aux_/tag.hpp index 6aedcb26f0a4b371f0ca4680b9cdf81d3573a9f0..651ed44bb5724ce9a62c448b3d96d2da90d2dd90 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/tag.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/tag.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/tag.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.3 $ +// $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/Utilities/BGL/boost/mpl/set/aux_/value_type_impl.hpp b/Utilities/BGL/boost/mpl/set/aux_/value_type_impl.hpp index a02d85e686336f71b18afa7ae4090a3abcbcf3f4..7166dae0ed465dc287b586dcd9977cb28b3e6577 100644 --- a/Utilities/BGL/boost/mpl/set/aux_/value_type_impl.hpp +++ b/Utilities/BGL/boost/mpl/set/aux_/value_type_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/aux_/value_type_impl.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: value_type_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/value_type_fwd.hpp> #include <boost/mpl/set/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set0.hpp b/Utilities/BGL/boost/mpl/set/set0.hpp index 52f2b992c7751837579db50c7763d4527502d464..f6e5b6089e96ca8aa1095e5464e500fcac3f4b90 100644 --- a/Utilities/BGL/boost/mpl/set/set0.hpp +++ b/Utilities/BGL/boost/mpl/set/set0.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set0.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.5 $ +// $Id: set0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/set/aux_/at_impl.hpp> #include <boost/mpl/set/aux_/clear_impl.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set0_c.hpp b/Utilities/BGL/boost/mpl/set/set0_c.hpp index 4602e7d07420fcdc58fce70d9eaeaa1d5e845420..ed9c9acd782a0c0fdb00aa0a4ea0ccfdc910bd28 100644 --- a/Utilities/BGL/boost/mpl/set/set0_c.hpp +++ b/Utilities/BGL/boost/mpl/set/set0_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set0_c.hpp,v $ -// $Date: 2004/11/28 01:51:10 $ -// $Revision: 1.2 $ +// $Id: set0_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/set/set0.hpp> #include <boost/mpl/integral_c.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set10.hpp b/Utilities/BGL/boost/mpl/set/set10.hpp index acb513545d6c85c07654a02334ed7351724de56a..d474245b048465b0b6fb67de195c32e30c65947e 100644 --- a/Utilities/BGL/boost/mpl/set/set10.hpp +++ b/Utilities/BGL/boost/mpl/set/set10.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set10.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: set10.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set0.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set10_c.hpp b/Utilities/BGL/boost/mpl/set/set10_c.hpp index 02af4b9c2ef5cc4a0df730707b348f1bd986e480..cfb5d76d3391585821208875c7951576c7ef77df 100644 --- a/Utilities/BGL/boost/mpl/set/set10_c.hpp +++ b/Utilities/BGL/boost/mpl/set/set10_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set10_c.hpp,v $ -// $Date: 2004/11/28 01:51:10 $ -// $Revision: 1.2 $ +// $Id: set10_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set0_c.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set20.hpp b/Utilities/BGL/boost/mpl/set/set20.hpp index 0003ca9aebabc31194ff9e6ffa738de0903b3335..c7367b802e5daa2d881ba21533d1200369b547ba 100644 --- a/Utilities/BGL/boost/mpl/set/set20.hpp +++ b/Utilities/BGL/boost/mpl/set/set20.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set20.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: set20.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set10.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set20_c.hpp b/Utilities/BGL/boost/mpl/set/set20_c.hpp index 9f5f64adb62e2f2b1564c8b19d5df8845e485e27..822dc2f2dbc0753a61ddbe7b902dfb6d6edfe448 100644 --- a/Utilities/BGL/boost/mpl/set/set20_c.hpp +++ b/Utilities/BGL/boost/mpl/set/set20_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set20_c.hpp,v $ -// $Date: 2004/11/28 01:51:10 $ -// $Revision: 1.2 $ +// $Id: set20_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set10_c.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set30.hpp b/Utilities/BGL/boost/mpl/set/set30.hpp index 66745a204e5263c5868cd31c2b0d610c237538ce..64b1646db225ff2d19ee55e383a13480b024b0aa 100644 --- a/Utilities/BGL/boost/mpl/set/set30.hpp +++ b/Utilities/BGL/boost/mpl/set/set30.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set30.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: set30.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set20.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set30_c.hpp b/Utilities/BGL/boost/mpl/set/set30_c.hpp index f4b2ccf3d86f8d695b0629cc279d7aeaa661baa6..458755922bb2868c415cb258b72a1096889c6a07 100644 --- a/Utilities/BGL/boost/mpl/set/set30_c.hpp +++ b/Utilities/BGL/boost/mpl/set/set30_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set30_c.hpp,v $ -// $Date: 2004/11/28 01:51:10 $ -// $Revision: 1.2 $ +// $Id: set30_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set20_c.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set40.hpp b/Utilities/BGL/boost/mpl/set/set40.hpp index 110f639e1c4f23b26535544e53a147a875650dd9..8ac37528d60dd383de009130eb0ea8a4d2d61489 100644 --- a/Utilities/BGL/boost/mpl/set/set40.hpp +++ b/Utilities/BGL/boost/mpl/set/set40.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set40.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: set40.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set30.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set40_c.hpp b/Utilities/BGL/boost/mpl/set/set40_c.hpp index b42c62b0187df5626ca54c8e30b340db951cd46f..12bd0fadf6168ea7dee9f96a78c146a82ea3468c 100644 --- a/Utilities/BGL/boost/mpl/set/set40_c.hpp +++ b/Utilities/BGL/boost/mpl/set/set40_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set40_c.hpp,v $ -// $Date: 2004/11/28 01:51:10 $ -// $Revision: 1.2 $ +// $Id: set40_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set30_c.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set50.hpp b/Utilities/BGL/boost/mpl/set/set50.hpp index 9e953f19096406da8075a303d4028f788e4e473d..bf459b1349bd050cb0dc23964dbbf2b27701379d 100644 --- a/Utilities/BGL/boost/mpl/set/set50.hpp +++ b/Utilities/BGL/boost/mpl/set/set50.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set50.hpp,v $ -// $Date: 2004/09/02 15:41:02 $ -// $Revision: 1.2 $ +// $Id: set50.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set40.hpp> diff --git a/Utilities/BGL/boost/mpl/set/set50_c.hpp b/Utilities/BGL/boost/mpl/set/set50_c.hpp index c856cd203909586d5f3021e8f7a2e9dd09f6066f..6e24792ba8e2abba9ccd58fe929bd17ea4392cbc 100644 --- a/Utilities/BGL/boost/mpl/set/set50_c.hpp +++ b/Utilities/BGL/boost/mpl/set/set50_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set/set50_c.hpp,v $ -// $Date: 2004/11/28 01:51:10 $ -// $Revision: 1.2 $ +// $Id: set50_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/set/set40_c.hpp> diff --git a/Utilities/BGL/boost/mpl/set_c.hpp b/Utilities/BGL/boost/mpl/set_c.hpp index c27002901cb9521c2cdbe5fe49b19d701722ad44..43cffcb2d581ca15b9d02082d2584782de1008fc 100644 --- a/Utilities/BGL/boost/mpl/set_c.hpp +++ b/Utilities/BGL/boost/mpl/set_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/set_c.hpp,v $ -// $Date: 2004/11/28 01:58:03 $ -// $Revision: 1.2 $ +// $Id: set_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/set.hpp> diff --git a/Utilities/BGL/boost/mpl/shift_left.hpp b/Utilities/BGL/boost/mpl/shift_left.hpp index ac38e9d3345d423f6e1847bc386403f55d4f5d2a..8a7e248cbbe82a0d17b5d15a0cbbdaeb96ecc012 100644 --- a/Utilities/BGL/boost/mpl/shift_left.hpp +++ b/Utilities/BGL/boost/mpl/shift_left.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/shift_left.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: shift_left.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME shift_left #define AUX778076_OP_TOKEN << diff --git a/Utilities/BGL/boost/mpl/shift_right.hpp b/Utilities/BGL/boost/mpl/shift_right.hpp index 26a7ef4e0e3c1052b9386522ccc864d877896a83..114d972a52507730694f80bb35be01187616ba76 100644 --- a/Utilities/BGL/boost/mpl/shift_right.hpp +++ b/Utilities/BGL/boost/mpl/shift_right.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/shift_right.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: shift_right.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME shift_right #define AUX778076_OP_TOKEN >> diff --git a/Utilities/BGL/boost/mpl/single_view.hpp b/Utilities/BGL/boost/mpl/single_view.hpp index e9bb990d379c847843dfa054aa084c398c1a4636..8bd72c38fe05c26209d214dc349705f5938f62c9 100644 --- a/Utilities/BGL/boost/mpl/single_view.hpp +++ b/Utilities/BGL/boost/mpl/single_view.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/single_view.hpp,v $ -// $Date: 2004/11/28 01:58:03 $ -// $Revision: 1.4 $ +// $Id: single_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/single_element_iter.hpp> #include <boost/mpl/iterator_range.hpp> diff --git a/Utilities/BGL/boost/mpl/size.hpp b/Utilities/BGL/boost/mpl/size.hpp index 3a01f013c1b811ea3b66a2adae86b214aed9d9ac..6ff2e65cbc9b81d4a3b00ff10613fef5affb58d9 100644 --- a/Utilities/BGL/boost/mpl/size.hpp +++ b/Utilities/BGL/boost/mpl/size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/size.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.5 $ +// $Id: size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/size_fwd.hpp b/Utilities/BGL/boost/mpl/size_fwd.hpp index 53a999bd23d8a9a8e1f46a364aa51fa934870a82..2bab81663d5144b7a70e55766c946acbb8019df1 100644 --- a/Utilities/BGL/boost/mpl/size_fwd.hpp +++ b/Utilities/BGL/boost/mpl/size_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/size_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: size_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/size_t.hpp b/Utilities/BGL/boost/mpl/size_t.hpp index 3e71f4c6f1a5f8c1b25c6055c9b84441aae47940..e72d77f8cd24bb6fd16184ee9a4a0147fd2051da 100644 --- a/Utilities/BGL/boost/mpl/size_t.hpp +++ b/Utilities/BGL/boost/mpl/size_t.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/size_t.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: size_t.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_t_fwd.hpp> diff --git a/Utilities/BGL/boost/mpl/size_t_fwd.hpp b/Utilities/BGL/boost/mpl/size_t_fwd.hpp index 746fb4d5126e3bbea0b1ba722d038896c5c5fb0c..84e903b0414cd3fa59dcf09832fb394a6bec919b 100644 --- a/Utilities/BGL/boost/mpl/size_t_fwd.hpp +++ b/Utilities/BGL/boost/mpl/size_t_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/size_t_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: size_t_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> #include <boost/config.hpp> // make sure 'size_t' is placed into 'std' diff --git a/Utilities/BGL/boost/mpl/sizeof.hpp b/Utilities/BGL/boost/mpl/sizeof.hpp index 8b89d6ce7b7134de91c01bdc6836bdc10195e715..8ad9d24d3f2174fec695f3ad2981c0014ced1493 100644 --- a/Utilities/BGL/boost/mpl/sizeof.hpp +++ b/Utilities/BGL/boost/mpl/sizeof.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/sizeof.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.4 $ +// $Id: sizeof.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_t.hpp> #include <boost/mpl/aux_/na_spec.hpp> diff --git a/Utilities/BGL/boost/mpl/sort.hpp b/Utilities/BGL/boost/mpl/sort.hpp index bde4352a9ae5b80f04a5e630588feeb1fd992441..0136d4c56e5dc0257c3c613cd167b0010701e3ef 100644 --- a/Utilities/BGL/boost/mpl/sort.hpp +++ b/Utilities/BGL/boost/mpl/sort.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/sort.hpp,v $ -// $Date: 2004/11/28 01:58:03 $ -// $Revision: 1.4 $ +// $Id: sort.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/sort_impl.hpp> #include <boost/mpl/aux_/inserter_algorithm.hpp> diff --git a/Utilities/BGL/boost/mpl/stable_partition.hpp b/Utilities/BGL/boost/mpl/stable_partition.hpp index c46faa4369add937f6de34e75261d36b67648c7e..6dc4eeadb43fc97d83577326a85290d976f783d4 100644 --- a/Utilities/BGL/boost/mpl/stable_partition.hpp +++ b/Utilities/BGL/boost/mpl/stable_partition.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/stable_partition.hpp,v $ -// $Date: 2004/11/28 01:58:27 $ -// $Revision: 1.4 $ +// $Id: stable_partition.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/reverse_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/string.hpp b/Utilities/BGL/boost/mpl/string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6a9481aaabe386ed3f3b16bb7553bc890fb5a242 --- /dev/null +++ b/Utilities/BGL/boost/mpl/string.hpp @@ -0,0 +1,559 @@ + +#ifndef BOOST_MPL_STRING_HPP_INCLUDED +#define BOOST_MPL_STRING_HPP_INCLUDED + +// Copyright Eric Niebler 2009 +// +// 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: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $ +// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49239 $ +// +// Thanks to: +// Dmitry Goncharov for porting this to the Sun compiler + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/detail/endian.hpp> +#include <boost/mpl/limits/string.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/char.hpp> +#include <boost/mpl/copy.hpp> +#include <boost/mpl/size.hpp> +#include <boost/mpl/empty.hpp> +#include <boost/mpl/assert.hpp> +#include <boost/mpl/size_t.hpp> +#include <boost/mpl/begin_end.hpp> +#include <boost/mpl/joint_view.hpp> +#include <boost/mpl/insert_range.hpp> +#include <boost/mpl/back_inserter.hpp> +#include <boost/mpl/front_inserter.hpp> +#include <boost/mpl/iterator_range.hpp> +#include <boost/preprocessor/arithmetic/dec.hpp> +#include <boost/preprocessor/arithmetic/add.hpp> +#include <boost/preprocessor/arithmetic/div.hpp> +#include <boost/preprocessor/punctuation/comma_if.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/repeat_from_to.hpp> +#include <boost/preprocessor/repetition/enum_shifted_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> +#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> + +#include <iterator> // for bidirectional_iterator_tag +#include <climits> + +namespace boost { namespace mpl +{ + #define BOOST_MPL_STRING_MAX_PARAMS \ + BOOST_PP_DIV(BOOST_PP_ADD(BOOST_MPL_LIMIT_STRING_SIZE, 3), 4) + + // Low-level bit-twiddling is done by macros. Any implementation-defined behavior of + // multi-character literals should be localized to these macros. + + #define BOOST_MPL_MULTICHAR_LENGTH(c) \ + (std::size_t)((c<CHAR_MIN) ? 4 : ((c>0xffffff)+(c>0xffff)+(c>0xff)+1)) + + #if defined(BOOST_LITTLE_ENDIAN) && defined(__SUNPRO_CC) + + #define BOOST_MPL_MULTICHAR_AT(c,i) \ + (char)(0xff&((unsigned)(c)>>(8*(std::size_t)(i)))) + + #define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \ + ((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c)) + + #define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \ + (((unsigned)(c)<<8)|(unsigned char)(i)) + + #define BOOST_MPL_MULTICHAR_POP_BACK(c) \ + (((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c)) + + #define BOOST_MPL_MULTICHAR_POP_FRONT(c) \ + ((unsigned)(c)>>8) + + #else + + #define BOOST_MPL_MULTICHAR_AT(c,i) \ + (char)(0xff&((unsigned)(c)>>(8*(BOOST_MPL_MULTICHAR_LENGTH(c)-(std::size_t)(i)-1)))) + + #define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \ + (((unsigned)(c)<<8)|(unsigned char)(i)) + + #define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \ + ((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c)) + + #define BOOST_MPL_MULTICHAR_POP_BACK(c) \ + ((unsigned)(c)>>8) + + #define BOOST_MPL_MULTICHAR_POP_FRONT(c) \ + (((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c)) + + #endif + + struct string_tag; + struct string_iterator_tag; + + template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_MPL_STRING_MAX_PARAMS, int C, 0)> + struct string; + + template<typename Sequence, int I, int J> + struct string_iterator; + + template<typename Sequence> + struct sequence_tag; + + template<typename Tag> + struct size_impl; + + template<> + struct size_impl<mpl::string_tag> + { + template<typename Sequence> + struct apply; + + #define M0(z, n, data) \ + + BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C,n)) + + #define M1(z, n, data) \ + template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \ + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \ + : mpl::size_t<(0 BOOST_PP_REPEAT_ ## z(n, M0, ~))> \ + {}; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M1, ~) + #undef M0 + #undef M1 + }; + + template<> + struct size_impl<mpl::string_tag>::apply<mpl::string<> > + : mpl::size_t<0> + {}; + + template<typename Tag> + struct begin_impl; + + template<> + struct begin_impl<mpl::string_tag> + { + template<typename Sequence> + struct apply + { + typedef mpl::string_iterator<Sequence, 0, 0> type; + }; + }; + + template<typename Tag> + struct end_impl; + + template<> + struct end_impl<mpl::string_tag> + { + template<typename Sequence> + struct apply; + + #define M0(z,n,data) \ + template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \ + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \ + { \ + typedef mpl::string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, n, 0> type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~) + #undef M0 + }; + + template<> + struct end_impl<mpl::string_tag>::apply<mpl::string<> > + { + typedef mpl::string_iterator<mpl::string<>, 0, 0> type; + }; + + template<typename Tag> + struct push_back_impl; + + template<> + struct push_back_impl<mpl::string_tag> + { + template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::back_))> + struct apply + { + BOOST_MPL_ASSERT_MSG( + (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value) + , PUSH_BACK_FAILED_MPL_STRING_IS_FULL + , (Sequence) + ); + // If the above assertion didn't fire, then the string is sparse. + // Repack the string and retry the push_back + typedef + typename mpl::push_back< + typename mpl::copy< + Sequence + , mpl::back_inserter<mpl::string<> > + >::type + , Value + >::type + type; + }; + + template<typename Value> + struct apply<mpl::string<>, Value, false> + { + typedef mpl::string<(char)Value::value> type; + }; + + #define M0(z,n,data) \ + template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \ + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, false> \ + { \ + typedef \ + mpl::string< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \ + ?BOOST_PP_CAT(C,BOOST_PP_DEC(n)) \ + :BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n)), Value::value) \ + , ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \ + ?(char)Value::value \ + :0 \ + > \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value> + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false> + { + typedef + mpl::string< + BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), C) + , BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)), Value::value) + > + type; + }; + }; + + template<typename Tag> + struct pop_back_impl; + + template<> + struct pop_back_impl<mpl::string_tag> + { + template<typename Sequence> + struct apply; + + #define M0(z,n,data) \ + template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \ + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \ + { \ + BOOST_MPL_ASSERT_MSG((C0 != 0), POP_BACK_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \ + typedef \ + mpl::string< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_MPL_MULTICHAR_POP_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n))) \ + > \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~) + #undef M0 + }; + + template<typename Tag> + struct push_front_impl; + + template<> + struct push_front_impl<mpl::string_tag> + { + template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))> + struct apply + { + BOOST_MPL_ASSERT_MSG( + (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value) + , PUSH_FRONT_FAILED_MPL_STRING_IS_FULL + , (Sequence) + ); + // If the above assertion didn't fire, then the string is sparse. + // Repack the string and retry the push_front. + typedef + typename mpl::push_front< + typename mpl::reverse_copy< + Sequence + , mpl::front_inserter<string<> > + >::type + , Value + >::type + type; + }; + + #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + template<typename Value> + struct apply<mpl::string<>, Value, false> + { + typedef mpl::string<(char)Value::value> type; + }; + #endif + + #define M0(z,n,data) \ + template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \ + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, true> \ + { \ + typedef \ + mpl::string< \ + (char)Value::value \ + BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, C) \ + > \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value> + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false> + { + typedef + mpl::string< + BOOST_MPL_MULTICHAR_PUSH_FRONT(C0, Value::value) + , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C) + > + type0; + + #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + typedef + typename mpl::if_< + mpl::empty<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> > + , mpl::string<(char)Value::value> + , type0 + >::type + type; + #else + typedef type0 type; + #endif + }; + }; + + template<typename Tag> + struct pop_front_impl; + + template<> + struct pop_front_impl<mpl::string_tag> + { + template<typename Sequence, bool B = (1==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))> + struct apply; + + #define M0(z,n,data) \ + template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \ + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, true> \ + { \ + BOOST_MPL_ASSERT_MSG((C0 != 0), POP_FRONT_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \ + typedef \ + mpl::string<BOOST_PP_ENUM_SHIFTED_PARAMS_Z(z, n, C)> \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)> + struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, false> + { + typedef + mpl::string< + BOOST_MPL_MULTICHAR_POP_FRONT(C0) + , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C) + > + type; + }; + }; + + template<typename Tag> + struct insert_range_impl; + + template<> + struct insert_range_impl<mpl::string_tag> + { + template<typename Sequence, typename Pos, typename Range> + struct apply + : mpl::copy< + mpl::joint_view< + mpl::iterator_range< + mpl::string_iterator<Sequence, 0, 0> + , Pos + > + , mpl::joint_view< + Range + , mpl::iterator_range< + Pos + , typename mpl::end<Sequence>::type + > + > + > + , mpl::back_inserter<mpl::string<> > + > + {}; + }; + + template<typename Tag> + struct insert_impl; + + template<> + struct insert_impl<mpl::string_tag> + { + template<typename Sequence, typename Pos, typename Value> + struct apply + : mpl::insert_range<Sequence, Pos, mpl::string<(char)Value::value> > + {}; + }; + + template<typename Tag> + struct erase_impl; + + template<> + struct erase_impl<mpl::string_tag> + { + template<typename Sequence, typename First, typename Last> + struct apply + : mpl::copy< + mpl::joint_view< + mpl::iterator_range< + mpl::string_iterator<Sequence, 0, 0> + , First + > + , mpl::iterator_range< + typename mpl::if_na<Last, typename mpl::next<First>::type>::type + , typename mpl::end<Sequence>::type + > + > + , mpl::back_inserter<mpl::string<> > + > + {}; + }; + + template<typename Tag> + struct clear_impl; + + template<> + struct clear_impl<mpl::string_tag> + { + template<typename> + struct apply + { + typedef mpl::string<> type; + }; + }; + + #define M0(z, n, data) \ + template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), int J> \ + struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, J> \ + { \ + enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == J + 1) }; \ + typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \ + typedef std::bidirectional_iterator_tag category; \ + typedef \ + mpl::string_iterator<string, n + eomc_, eomc_ ? 0 : J + 1> \ + next; \ + typedef \ + mpl::string_iterator<string, n, J - 1> \ + prior; \ + typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), J)> type; \ + }; \ + template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)> \ + struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, 0> \ + { \ + enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == 1) }; \ + typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \ + typedef std::bidirectional_iterator_tag category; \ + typedef \ + mpl::string_iterator<string, n + eomc_, !eomc_> \ + next; \ + typedef \ + mpl::string_iterator< \ + string \ + , n - 1 \ + , BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, BOOST_PP_DEC(n))) - 1 \ + > \ + prior; \ + typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), 0)> type; \ + }; + + BOOST_PP_REPEAT(BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)> + struct string + { + /// INTERNAL ONLY + enum + { + front_ = C0 + , back_ = BOOST_PP_CAT(C, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)) + }; + + typedef char value_type; + typedef string type; + typedef string_tag tag; + }; + + namespace aux_ + { + template<typename It, typename End> + struct next_unless + : mpl::next<It> + {}; + + template<typename End> + struct next_unless<End, End> + { + typedef End type; + }; + + template<typename It, typename End> + struct deref_unless + : mpl::deref<It> + {}; + + template<typename End> + struct deref_unless<End, End> + { + typedef mpl::char_<'\0'> type; + }; + } + + template<typename Sequence> + struct c_str + { + typedef typename mpl::end<Sequence>::type iend; + typedef typename mpl::begin<Sequence>::type i0; + #define M0(z, n, data) \ + typedef \ + typename mpl::aux_::next_unless<BOOST_PP_CAT(i, n), iend>::type \ + BOOST_PP_CAT(i, BOOST_PP_INC(n)); + BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~) + #undef M0 + + typedef c_str type; + static typename Sequence::value_type const value[BOOST_MPL_LIMIT_STRING_SIZE+1]; + }; + + template<typename Sequence> + typename Sequence::value_type const c_str<Sequence>::value[BOOST_MPL_LIMIT_STRING_SIZE+1] = + { + #define M0(z, n, data) \ + mpl::aux_::deref_unless<BOOST_PP_CAT(i, n), iend>::type::value, + BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~) + #undef M0 + '\0' + }; + +}} // namespace boost + +#endif // BOOST_MPL_STRING_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/switch.hpp b/Utilities/BGL/boost/mpl/switch.hpp index 5744f35b8925aa04cc3d8868540ae86e8dc20653..bfba5b09729f7538550860aff106db81620fbf27 100644 --- a/Utilities/BGL/boost/mpl/switch.hpp +++ b/Utilities/BGL/boost/mpl/switch.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/switch.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: switch.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/find_if.hpp> #include <boost/mpl/deref.hpp> diff --git a/Utilities/BGL/boost/mpl/tag.hpp b/Utilities/BGL/boost/mpl/tag.hpp index c0cf4c191c554519b5acda6cf81f6a2c9d252be6..747646cccaf898ea6915d792070f5b7409833344 100644 --- a/Utilities/BGL/boost/mpl/tag.hpp +++ b/Utilities/BGL/boost/mpl/tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/tag.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/eval_if.hpp> #include <boost/mpl/void.hpp> diff --git a/Utilities/BGL/boost/mpl/times.hpp b/Utilities/BGL/boost/mpl/times.hpp index 9d56d1941cacec5ec39abcba5e482c559cdf5968..ea61eaff498e84507f3d13aaf125fbea253bb2b9 100644 --- a/Utilities/BGL/boost/mpl/times.hpp +++ b/Utilities/BGL/boost/mpl/times.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/times.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: times.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #define AUX778076_OP_NAME times #define AUX778076_OP_TOKEN * diff --git a/Utilities/BGL/boost/mpl/transform.hpp b/Utilities/BGL/boost/mpl/transform.hpp index 023a99a373aa744a4957b0c1ea327f7ab28ab518..f36720786c28ea16987c92747c8b38ee22e027e7 100644 --- a/Utilities/BGL/boost/mpl/transform.hpp +++ b/Utilities/BGL/boost/mpl/transform.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/transform.hpp,v $ -// $Date: 2004/12/20 17:18:17 $ -// $Revision: 1.10 $ +// $Id: transform.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/reverse_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/transform_view.hpp b/Utilities/BGL/boost/mpl/transform_view.hpp index 28cccb027054bd6127e3570e4ae06f4ce2a86ed6..3448d7a7ae3fe86d6d0f533c749dd221ae4f5c1c 100644 --- a/Utilities/BGL/boost/mpl/transform_view.hpp +++ b/Utilities/BGL/boost/mpl/transform_view.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/transform_view.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.5 $ +// $Id: transform_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> #include <boost/mpl/lambda.hpp> diff --git a/Utilities/BGL/boost/mpl/unique.hpp b/Utilities/BGL/boost/mpl/unique.hpp index 5a01d0df2c794a3349762cc7c17030ccdabdf65f..e1ef8f50751af7e20a3a4161ac363917f70928e0 100644 --- a/Utilities/BGL/boost/mpl/unique.hpp +++ b/Utilities/BGL/boost/mpl/unique.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/unique.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.7 $ +// $Id: unique.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/fold.hpp> #include <boost/mpl/reverse_fold.hpp> diff --git a/Utilities/BGL/boost/mpl/unpack_args.hpp b/Utilities/BGL/boost/mpl/unpack_args.hpp index 85e6bf10f62ff4716a61491b742a60ece7174270..c5949939b6354e3fd3b13a1d16d73dc770cfcab5 100644 --- a/Utilities/BGL/boost/mpl/unpack_args.hpp +++ b/Utilities/BGL/boost/mpl/unpack_args.hpp @@ -14,9 +14,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/unpack_args.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: unpack_args.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/apply.hpp> @@ -111,7 +111,10 @@ BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(1, unpack_args) ///// iteration, depth == 1 -#elif BOOST_PP_ITERATION_DEPTH() == 1 +// For gcc 4.4 compatability, we must include the +// BOOST_PP_ITERATION_DEPTH test inside an #else clause. +#else // BOOST_PP_IS_ITERATING +#if BOOST_PP_ITERATION_DEPTH() == 1 # define i_ BOOST_PP_FRAME_ITERATION(1) @@ -143,4 +146,5 @@ template<> struct unpack_args_impl<i_> # undef i_ +#endif // BOOST_PP_ITERATION_DEPTH() #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/mpl/upper_bound.hpp b/Utilities/BGL/boost/mpl/upper_bound.hpp index 95df961ea4be54a2bf28bb48ce5d88e5057aabed..527e74dff0752a8f1db9d247530853647a16a321 100644 --- a/Utilities/BGL/boost/mpl/upper_bound.hpp +++ b/Utilities/BGL/boost/mpl/upper_bound.hpp @@ -10,16 +10,16 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/upper_bound.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.8 $ +// $Id: upper_bound.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/less.hpp> #include <boost/mpl/lambda.hpp> #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/config/workaround.hpp> -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # define BOOST_MPL_CFG_STRIPPED_DOWN_UPPER_BOUND_IMPL #endif diff --git a/Utilities/BGL/boost/mpl/value_type.hpp b/Utilities/BGL/boost/mpl/value_type.hpp index 5aa3a54cb920f1c3bbd46b946047ae358b95e5e2..6286d21f047a6051607eaa56907ee12131d7faf0 100644 --- a/Utilities/BGL/boost/mpl/value_type.hpp +++ b/Utilities/BGL/boost/mpl/value_type.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/value_type.hpp,v $ -// $Date: 2004/12/14 22:34:44 $ -// $Revision: 1.4 $ +// $Id: value_type.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/value_type_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> diff --git a/Utilities/BGL/boost/mpl/value_type_fwd.hpp b/Utilities/BGL/boost/mpl/value_type_fwd.hpp index 875a758df5e18136ceab48b7458b0e9b5ea4da72..96de3ad333b3922e588f44ab3e82af125c0ca1b8 100644 --- a/Utilities/BGL/boost/mpl/value_type_fwd.hpp +++ b/Utilities/BGL/boost/mpl/value_type_fwd.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/value_type_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.2 $ +// $Id: value_type_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/Utilities/BGL/boost/mpl/vector.hpp b/Utilities/BGL/boost/mpl/vector.hpp index 56f1c955919fa064c4bc9eabb3e1f4b6bd7f7008..94858ff7c168e324c38ac4e236c15353850d33a6 100644 --- a/Utilities/BGL/boost/mpl/vector.hpp +++ b/Utilities/BGL/boost/mpl/vector.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector.hpp,v $ -// $Date: 2004/11/28 01:58:27 $ -// $Revision: 1.8 $ +// $Id: vector.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/vector.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/O1_size.hpp b/Utilities/BGL/boost/mpl/vector/aux_/O1_size.hpp index 2bc734233a8778a8839d3b96f6d8bae1bcd49301..7697a24fff2066c05cc51ec8d4fc93bd52137ff3 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/O1_size.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/O1_size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/O1_size.hpp,v $ -// $Date: 2004/09/04 01:33:47 $ -// $Revision: 1.5 $ +// $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> #include <boost/mpl/minus.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/at.hpp b/Utilities/BGL/boost/mpl/vector/aux_/at.hpp index a3276b409dfea284499dc00e0cf9c5176917c7fb..c859f2d00122b5e5c60ca50f337f7a715c3f5482 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/at.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/at.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/at.hpp,v $ -// $Date: 2004/12/20 19:35:33 $ -// $Revision: 1.6 $ +// $Id: at.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/at_fwd.hpp> #include <boost/mpl/vector/aux_/tag.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/back.hpp b/Utilities/BGL/boost/mpl/vector/aux_/back.hpp index a067b29634f40a37d551d51f42a1816dc59b8d2e..4969e622d087dc0413fa24526e8336b2be1c62aa 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/back.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/back.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/back_fwd.hpp> #include <boost/mpl/next_prior.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/begin_end.hpp b/Utilities/BGL/boost/mpl/vector/aux_/begin_end.hpp index 976fa1275a3e4cfbbb9f853dbf01c4694b80b617..f2bedf3219d50e3144f893fd25ac9b90479e9bbd 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/begin_end.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/begin_end.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/begin_end.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: begin_end.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/clear.hpp b/Utilities/BGL/boost/mpl/vector/aux_/clear.hpp index 5c468aea925f68fb8be1b23adb54b0d39c1a8dad..5a5d2d03d8b4ebfffd5e78d91ee3d2e9b301f32f 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/clear.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/clear.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/clear.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: clear.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> #include <boost/mpl/vector/aux_/vector0.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/empty.hpp b/Utilities/BGL/boost/mpl/vector/aux_/empty.hpp index dfb986a91308cb32d8122a56d5baa09555deb7db..8e76c3e4ca1bcb5d33390e483a0207a12e9ddcd8 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/empty.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/empty.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/empty.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.5 $ +// $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> #include <boost/mpl/bool.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/front.hpp b/Utilities/BGL/boost/mpl/vector/aux_/front.hpp index 7e54e68ec2fafb2c50135c2ec089fb0437673c2b..74b4c500843b2f95132e22c6381b88a87d8b36dd 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/front.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/front.hpp @@ -1,8 +1,8 @@ -#ifndef BOOST_MPL_LIST_AUX_FRONT_HPP_INCLUDED -#define BOOST_MPL_LIST_AUX_FRONT_HPP_INCLUDED +#ifndef BOOST_MPL_VECTOR_AUX_FRONT_HPP_INCLUDED +#define BOOST_MPL_VECTOR_AUX_FRONT_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/front.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> #include <boost/mpl/vector/aux_/at.hpp> @@ -53,4 +53,4 @@ struct front_impl< aux::vector_tag<n_> > }} -#endif // BOOST_MPL_LIST_AUX_FRONT_HPP_INCLUDED +#endif // BOOST_MPL_VECTOR_AUX_FRONT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/mpl/vector/aux_/include_preprocessed.hpp b/Utilities/BGL/boost/mpl/vector/aux_/include_preprocessed.hpp index bbe9fd86895008ee5d4dd6e5069dcf2f6031ec06..247b6edd870edcd6748b07d3aa0ffc5f04a4d505 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/include_preprocessed.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/include_preprocessed.hpp @@ -1,7 +1,7 @@ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -9,13 +9,14 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/include_preprocessed.hpp,v $ -// $Date: 2004/11/28 01:52:12 $ -// $Revision: 1.4 $ +// $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/typeof.hpp> #include <boost/mpl/aux_/config/ctps.hpp> #include <boost/mpl/aux_/config/preprocessor.hpp> +#include <boost/mpl/aux_/config/workaround.hpp> #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/stringize.hpp> @@ -40,7 +41,13 @@ #endif +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700)) +# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/vector/aux_/preprocessed/AUX778076_HEADER) +# include AUX778076_INCLUDE_STRING +# undef AUX778076_INCLUDE_STRING +#else # include BOOST_PP_STRINGIZE(boost/mpl/vector/aux_/preprocessed/AUX778076_HEADER) +#endif # undef AUX778076_HEADER # undef AUX778076_INCLUDE_DIR diff --git a/Utilities/BGL/boost/mpl/vector/aux_/item.hpp b/Utilities/BGL/boost/mpl/vector/aux_/item.hpp index 84673463f7d05eb2d2a741dce5b670b530826692..96002b9484ba8f54cef0215dc062f2cbfabda23d 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/item.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/item.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/item.hpp,v $ -// $Date: 2005/05/15 00:39:04 $ -// $Revision: 1.8 $ +// $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long.hpp> #include <boost/mpl/void.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/iterator.hpp b/Utilities/BGL/boost/mpl/vector/aux_/iterator.hpp index 493048324a64d59dc7603ef69d179e88c1fee7e4..5864affb8b3177ef0e3b34a777918a590484c6a3 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/iterator.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/iterator.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/iterator.hpp,v $ -// $Date: 2004/11/28 01:52:12 $ -// $Revision: 1.11 $ +// $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/vector/aux_/at.hpp> #include <boost/mpl/iterator_tags.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/numbered.hpp b/Utilities/BGL/boost/mpl/vector/aux_/numbered.hpp index 29348e357b4c7cbc573af9b6b0b638e7822a6307..0e5acc016dc986c34b30fe1dbc3a191134d19ee7 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/numbered.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/numbered.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/numbered.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.8 $ +// $Id: numbered.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/enum_params.hpp> #include <boost/preprocessor/enum_shifted_params.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/numbered_c.hpp b/Utilities/BGL/boost/mpl/vector/aux_/numbered_c.hpp index 1ed78acd3543f1282174ed5ab5fd2cffd7d0d717..dc1349784b90b74e6f6f11b21aeb794e4f75fde0 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/numbered_c.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/numbered_c.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/numbered_c.hpp,v $ -// $Date: 2004/11/28 01:52:12 $ -// $Revision: 1.6 $ +// $Id: numbered_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/preprocessor/enum_params.hpp> #include <boost/preprocessor/enum_shifted_params.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/pop_back.hpp b/Utilities/BGL/boost/mpl/vector/aux_/pop_back.hpp index ebca77677307b2dd1c360501c2f987a8f68d52cd..aa902169de522ffecdfb4182b10146d47e811b17 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/pop_back.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/pop_back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/pop_back.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: pop_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/pop_back_fwd.hpp> #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/pop_front.hpp b/Utilities/BGL/boost/mpl/vector/aux_/pop_front.hpp index 25fd86927fecfa584141950e242169dd46fd21e4..854d1e7700e4ae71d9a274f35395a7d1d1853a12 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/pop_front.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/pop_front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/pop_front.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: pop_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/pop_front_fwd.hpp> #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/push_back.hpp b/Utilities/BGL/boost/mpl/vector/aux_/push_back.hpp index ab7197116b9008c18358dcde751ea1e1b56d124a..b51c770f64a1215aab4d59974be4675dc18ba800 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/push_back.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/push_back.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/push_back.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: push_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_back_fwd.hpp> #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/push_front.hpp b/Utilities/BGL/boost/mpl/vector/aux_/push_front.hpp index 1ea7f2cf1a24af4c168d50d727762f75637aaeae..efa2aae8415c6233a20055b60c022856d95a13c6 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/push_front.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/push_front.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/push_front.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: push_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/push_front_fwd.hpp> #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/size.hpp b/Utilities/BGL/boost/mpl/vector/aux_/size.hpp index f20297d25a138fa784a0982fb36ed9221fb4aaea..bd40b549c942149210e4df0db18777c3eeb00cbb 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/size.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/size.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/size.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/vector/aux_/O1_size.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/tag.hpp b/Utilities/BGL/boost/mpl/vector/aux_/tag.hpp index 03beee98d30af875b2e8ceff0945915716c067dd..77d627b25f416c9dae299e3fdeca653636cbe974 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/tag.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/tag.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/tag.hpp,v $ -// $Date: 2004/11/28 01:52:12 $ -// $Revision: 1.5 $ +// $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/config/typeof.hpp> #include <boost/mpl/aux_/nttp_decl.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/aux_/vector0.hpp b/Utilities/BGL/boost/mpl/vector/aux_/vector0.hpp index 98797f47e80f7a0acc889b71b18c383c01c7e5ef..65c5544e0b1e971ce3a87ac02ef4b90ae6968052 100644 --- a/Utilities/BGL/boost/mpl/vector/aux_/vector0.hpp +++ b/Utilities/BGL/boost/mpl/vector/aux_/vector0.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/aux_/vector0.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: vector0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/long.hpp> #include <boost/mpl/void.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector0.hpp b/Utilities/BGL/boost/mpl/vector/vector0.hpp index 84792c264fd210b688dbb76dcde4a137bfb8fac5..249ecbb8c90e8e6151e17c8a2f45aaf8c6c73931 100644 --- a/Utilities/BGL/boost/mpl/vector/vector0.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector0.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector0.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.4 $ +// $Id: vector0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/vector/aux_/at.hpp> #include <boost/mpl/vector/aux_/front.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector0_c.hpp b/Utilities/BGL/boost/mpl/vector/vector0_c.hpp index 13e6297b6ef58165efcfd625d366ee9963c4e438..630af92a8ffc75551d4f7c2141a59f297fa5a770 100644 --- a/Utilities/BGL/boost/mpl/vector/vector0_c.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector0_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector0_c.hpp,v $ -// $Date: 2004/11/28 01:52:56 $ -// $Revision: 1.5 $ +// $Id: vector0_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/vector/vector0.hpp> #include <boost/mpl/integral_c.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector10.hpp b/Utilities/BGL/boost/mpl/vector/vector10.hpp index cd4f9760cfb198eefd7fde896d18ba958a6e5871..344c92cfcc29b82b92d7d534fc5a86aa6711e631 100644 --- a/Utilities/BGL/boost/mpl/vector/vector10.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector10.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector10.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector10.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector0.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector10_c.hpp b/Utilities/BGL/boost/mpl/vector/vector10_c.hpp index b5419c448d06cc9241a4deab704d57b8315712d1..05e97ad7c37365f36022632002c1c2dffa3d8506 100644 --- a/Utilities/BGL/boost/mpl/vector/vector10_c.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector10_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector10_c.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector10_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector0_c.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector20.hpp b/Utilities/BGL/boost/mpl/vector/vector20.hpp index 25557df3d8bdf372dbe3991a91802c49c13c2d64..ffa867e0364b85ec30c5951930d37aa6e1ba3eb6 100644 --- a/Utilities/BGL/boost/mpl/vector/vector20.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector20.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector20.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector20.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector10.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector20_c.hpp b/Utilities/BGL/boost/mpl/vector/vector20_c.hpp index 2682254aa5fc1bfd1498dd91bc9141e459eb8526..cc13d517dc7728c434ba299daacc3739f38dca8b 100644 --- a/Utilities/BGL/boost/mpl/vector/vector20_c.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector20_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector20_c.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector20_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector10_c.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector30.hpp b/Utilities/BGL/boost/mpl/vector/vector30.hpp index 55f772e56125254e77d656c6ca9914b6d5d797cf..f54c61cf1b7055382a386ad89ca069b670c7bd75 100644 --- a/Utilities/BGL/boost/mpl/vector/vector30.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector30.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector30.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector30.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector20.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector30_c.hpp b/Utilities/BGL/boost/mpl/vector/vector30_c.hpp index 2a1b4cae51d0c83cbc3a470be5f79c1095280dab..a8e3e60d98ca4b352ba939effb3da7a60bcb7a93 100644 --- a/Utilities/BGL/boost/mpl/vector/vector30_c.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector30_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector30_c.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector30_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector20_c.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector40.hpp b/Utilities/BGL/boost/mpl/vector/vector40.hpp index 1c9f81d27c374c6612afbb657d196b5e29ac0ba0..2d24b6d87a28b7b6ec887db9fe8a4dc1cb4f9a4f 100644 --- a/Utilities/BGL/boost/mpl/vector/vector40.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector40.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector40.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector40.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector30.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector40_c.hpp b/Utilities/BGL/boost/mpl/vector/vector40_c.hpp index a62b3b38e9684392fde4d0e2a585fdaaef2816a1..9179b263e9a6d582f77b114a62afd2d614f20019 100644 --- a/Utilities/BGL/boost/mpl/vector/vector40_c.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector40_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector40_c.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector40_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector30_c.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector50.hpp b/Utilities/BGL/boost/mpl/vector/vector50.hpp index 119798ff83aa26d542156742e443cdb653dfde4e..0050483b214aa90517aa5cc108596e1371ccb065 100644 --- a/Utilities/BGL/boost/mpl/vector/vector50.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector50.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector50.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector50.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector40.hpp> diff --git a/Utilities/BGL/boost/mpl/vector/vector50_c.hpp b/Utilities/BGL/boost/mpl/vector/vector50_c.hpp index 96f9488026dbc5471a21e487573ea839ad318595..04967421fb9f65fa5e5f559394af211a48679c6c 100644 --- a/Utilities/BGL/boost/mpl/vector/vector50_c.hpp +++ b/Utilities/BGL/boost/mpl/vector/vector50_c.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector/vector50_c.hpp,v $ -// $Date: 2004/09/02 15:41:19 $ -// $Revision: 1.6 $ +// $Id: vector50_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector40_c.hpp> diff --git a/Utilities/BGL/boost/mpl/vector_c.hpp b/Utilities/BGL/boost/mpl/vector_c.hpp index f0c326a92b0dedab6c59d3e1547b07cb68c88ef4..44da44603436ed09700b5fabc45e52207f5c78ee 100644 --- a/Utilities/BGL/boost/mpl/vector_c.hpp +++ b/Utilities/BGL/boost/mpl/vector_c.hpp @@ -2,7 +2,7 @@ #ifndef BOOST_MPL_VECTOR_C_HPP_INCLUDED #define BOOST_MPL_VECTOR_C_HPP_INCLUDED -// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright Aleksey Gurtovoy 2000-2008 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/vector_c.hpp,v $ -// $Date: 2004/11/28 01:58:27 $ -// $Revision: 1.8 $ +// $Id: vector_c.hpp 49271 2008-10-11 06:46:00Z agurtovoy $ +// $Date: 2008-10-11 02:46:00 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49271 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/limits/vector.hpp> @@ -53,6 +53,7 @@ # define AUX778076_SEQUENCE_NAME vector_c # define AUX778076_SEQUENCE_LIMIT BOOST_MPL_LIMIT_VECTOR_SIZE # define AUX778076_SEQUENCE_NAME_N(n) BOOST_PP_CAT(BOOST_PP_CAT(vector,n),_c) +# define AUX778076_SEQUENCE_CONVERT_CN_TO(z,n,TARGET) TARGET(BOOST_PP_CAT(C,n)) # define AUX778076_SEQUENCE_INTEGRAL_WRAPPER # include <boost/mpl/aux_/sequence_wrapper.hpp> diff --git a/Utilities/BGL/boost/mpl/void.hpp b/Utilities/BGL/boost/mpl/void.hpp index 9c429a3f81ab3547c9339bf4689afcdf2df1bf15..f464acb551e02de1d9a62d3e91e2175e25ca65cd 100644 --- a/Utilities/BGL/boost/mpl/void.hpp +++ b/Utilities/BGL/boost/mpl/void.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/void.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.9 $ +// $Id: void.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/void_fwd.hpp> #include <boost/mpl/bool.hpp> diff --git a/Utilities/BGL/boost/mpl/void_fwd.hpp b/Utilities/BGL/boost/mpl/void_fwd.hpp index 13381b6babfafd00f2fb9fff66b18598e7fd857c..0dcd6392a74474262f9379229f2ff9dd88f78a76 100644 --- a/Utilities/BGL/boost/mpl/void_fwd.hpp +++ b/Utilities/BGL/boost/mpl/void_fwd.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/void_fwd.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: void_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/Utilities/BGL/boost/mpl/zip_view.hpp b/Utilities/BGL/boost/mpl/zip_view.hpp index c09215c766aeecc96366b1ccd54cdbec7a090e76..7e8e1ac716722196cead95fc5ebfecb76a174605 100644 --- a/Utilities/BGL/boost/mpl/zip_view.hpp +++ b/Utilities/BGL/boost/mpl/zip_view.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Source: /cvsroot/boost/boost/boost/mpl/zip_view.hpp,v $ -// $Date: 2004/09/02 15:40:42 $ -// $Revision: 1.3 $ +// $Id: zip_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Revision: 49267 $ #include <boost/mpl/transform.hpp> #include <boost/mpl/begin_end.hpp> @@ -37,7 +37,7 @@ struct zip_iterator typedef zip_iterator< typename transform1< IteratorSeq - , next<_1> + , mpl::next<_1> >::type > next; }; @@ -48,8 +48,8 @@ template< struct zip_view { private: - typedef typename transform1< Sequences, begin<_1> >::type first_ones_; - typedef typename transform1< Sequences, end<_1> >::type last_ones_; + typedef typename transform1< Sequences, mpl::begin<_1> >::type first_ones_; + typedef typename transform1< Sequences, mpl::end<_1> >::type last_ones_; public: typedef nested_begin_end_tag tag; diff --git a/Utilities/BGL/boost/multi_index/composite_key.hpp b/Utilities/BGL/boost/multi_index/composite_key.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cedc75e04f1dfe18abbdb943e142741dffbdb6fa --- /dev/null +++ b/Utilities/BGL/boost/multi_index/composite_key.hpp @@ -0,0 +1,1324 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_COMPOSITE_KEY_HPP +#define BOOST_MULTI_INDEX_COMPOSITE_KEY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/functional/hash_fwd.hpp> +#include <boost/multi_index/detail/access_specifier.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/or.hpp> +#include <boost/mpl/aux_/nttp_decl.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/control/expr_if.hpp> +#include <boost/preprocessor/list/at.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/static_assert.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/utility/enable_if.hpp> +#include <functional> + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +#include <boost/ref.hpp> +#endif + +#if !defined(BOOST_NO_SFINAE) +#include <boost/type_traits/is_convertible.hpp> +#endif + +/* A composite key stores n key extractors and "computes" the + * result on a given value as a packed reference to the value and + * the composite key itself. Actual invocations to the component + * key extractors are lazily performed when executing an operation + * on composite_key results (equality, comparison, hashing.) + * As the other key extractors in Boost.MultiIndex, composite_key<T,...> + * is overloaded to work on chained pointers to T and reference_wrappers + * of T. + */ + +/* This user_definable macro limits the number of elements of a composite + * key; useful for shortening resulting symbol names (MSVC++ 6.0, for + * instance has problems coping with very long symbol names.) + * NB: This cannot exceed the maximum number of arguments of + * boost::tuple. In Boost 1.32, the limit is 10. + */ + +#if !defined(BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE) +#if defined(BOOST_MSVC)&&(BOOST_MSVC<1300) +#define BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE 5 +#else +#define BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE 10 +#endif +#endif + +/* maximum number of key extractors in a composite key */ + +#if BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE<10 /* max length of a tuple */ +#define BOOST_MULTI_INDEX_COMPOSITE_KEY_SIZE \ + BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE +#else +#define BOOST_MULTI_INDEX_COMPOSITE_KEY_SIZE 10 +#endif + +/* BOOST_PP_ENUM of BOOST_MULTI_INDEX_COMPOSITE_KEY_SIZE elements */ + +#define BOOST_MULTI_INDEX_CK_ENUM(macro,data) \ + BOOST_PP_ENUM(BOOST_MULTI_INDEX_COMPOSITE_KEY_SIZE,macro,data) + +/* BOOST_PP_ENUM_PARAMS of BOOST_MULTI_INDEX_COMPOSITE_KEY_SIZE elements */ + +#define BOOST_MULTI_INDEX_CK_ENUM_PARAMS(param) \ + BOOST_PP_ENUM_PARAMS(BOOST_MULTI_INDEX_COMPOSITE_KEY_SIZE,param) + +/* if n==0 -> text0 + * otherwise -> textn=tuples::null_type + */ + +#define BOOST_MULTI_INDEX_CK_TEMPLATE_PARM(z,n,text) \ + typename BOOST_PP_CAT(text,n) BOOST_PP_EXPR_IF(n,=tuples::null_type) + +/* const textn& kn=textn() */ + +#define BOOST_MULTI_INDEX_CK_CTOR_ARG(z,n,text) \ + const BOOST_PP_CAT(text,n)& BOOST_PP_CAT(k,n) = BOOST_PP_CAT(text,n)() + +/* typename list(0)<list(1),n>::type */ + +#define BOOST_MULTI_INDEX_CK_APPLY_METAFUNCTION_N(z,n,list) \ + BOOST_DEDUCED_TYPENAME BOOST_PP_LIST_AT(list,0)< \ + BOOST_PP_LIST_AT(list,1),n \ + >::type + +namespace boost{ + +template<class T> class reference_wrapper; /* fwd decl. */ + +namespace multi_index{ + +namespace detail{ + +/* n-th key extractor of a composite key */ + +template<typename CompositeKey,BOOST_MPL_AUX_NTTP_DECL(int, N)> +struct nth_key_from_value +{ + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename prevent_eti< + tuples::element<N,key_extractor_tuple>, + typename mpl::eval_if_c< + N<tuples::length<key_extractor_tuple>::value, + tuples::element<N,key_extractor_tuple>, + mpl::identity<tuples::null_type> + >::type + >::type type; +}; + +/* nth_composite_key_##name<CompositeKey,N>::type yields + * functor<nth_key_from_value<CompositeKey,N> >, or tuples::null_type + * if N exceeds the length of the composite key. + */ + +#define BOOST_MULTI_INDEX_CK_NTH_COMPOSITE_KEY_FUNCTOR(name,functor) \ +template<typename KeyFromValue> \ +struct BOOST_PP_CAT(key_,name) \ +{ \ + typedef functor<typename KeyFromValue::result_type> type; \ +}; \ + \ +template<> \ +struct BOOST_PP_CAT(key_,name)<tuples::null_type> \ +{ \ + typedef tuples::null_type type; \ +}; \ + \ +template<typename CompositeKey,BOOST_MPL_AUX_NTTP_DECL(int, N)> \ +struct BOOST_PP_CAT(nth_composite_key_,name) \ +{ \ + typedef typename nth_key_from_value<CompositeKey,N>::type key_from_value; \ + typedef typename BOOST_PP_CAT(key_,name)<key_from_value>::type type; \ +}; + +/* nth_composite_key_equal_to + * nth_composite_key_less + * nth_composite_key_greater + * nth_composite_key_hash + */ + +BOOST_MULTI_INDEX_CK_NTH_COMPOSITE_KEY_FUNCTOR(equal_to,std::equal_to) +BOOST_MULTI_INDEX_CK_NTH_COMPOSITE_KEY_FUNCTOR(less,std::less) +BOOST_MULTI_INDEX_CK_NTH_COMPOSITE_KEY_FUNCTOR(greater,std::greater) +BOOST_MULTI_INDEX_CK_NTH_COMPOSITE_KEY_FUNCTOR(hash,boost::hash) + +/* used for defining equality and comparison ops of composite_key_result */ + +#define BOOST_MULTI_INDEX_CK_IDENTITY_ENUM_MACRO(z,n,text) text + +struct generic_operator_equal +{ + template<typename T,typename Q> + bool operator()(const T& x,const Q& y)const{return x==y;} +}; + +typedef tuple< + BOOST_MULTI_INDEX_CK_ENUM( + BOOST_MULTI_INDEX_CK_IDENTITY_ENUM_MACRO, + detail::generic_operator_equal)> generic_operator_equal_tuple; + +struct generic_operator_less +{ + template<typename T,typename Q> + bool operator()(const T& x,const Q& y)const{return x<y;} +}; + +typedef tuple< + BOOST_MULTI_INDEX_CK_ENUM( + BOOST_MULTI_INDEX_CK_IDENTITY_ENUM_MACRO, + detail::generic_operator_less)> generic_operator_less_tuple; + +/* Metaprogramming machinery for implementing equality, comparison and + * hashing operations of composite_key_result. + * + * equal_* checks for equality between composite_key_results and + * between those and tuples, accepting a tuple of basic equality functors. + * compare_* does lexicographical comparison. + * hash_* computes a combination of elementwise hash values. + */ + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename EqualCons +> +struct equal_ckey_ckey; /* fwd decl. */ + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename EqualCons +> +struct equal_ckey_ckey_terminal +{ + static bool compare( + const KeyCons1&,const Value1&, + const KeyCons2&,const Value2&, + const EqualCons&) + { + return true; + } +}; + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename EqualCons +> +struct equal_ckey_ckey_normal +{ + static bool compare( + const KeyCons1& c0,const Value1& v0, + const KeyCons2& c1,const Value2& v1, + const EqualCons& eq) + { + if(!eq.get_head()(c0.get_head()(v0),c1.get_head()(v1)))return false; + return equal_ckey_ckey< + BOOST_DEDUCED_TYPENAME KeyCons1::tail_type,Value1, + BOOST_DEDUCED_TYPENAME KeyCons2::tail_type,Value2, + BOOST_DEDUCED_TYPENAME EqualCons::tail_type + >::compare(c0.get_tail(),v0,c1.get_tail(),v1,eq.get_tail()); + } +}; + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename EqualCons +> +struct equal_ckey_ckey: + mpl::if_< + mpl::or_< + is_same<KeyCons1,tuples::null_type>, + is_same<KeyCons2,tuples::null_type> + >, + equal_ckey_ckey_terminal<KeyCons1,Value1,KeyCons2,Value2,EqualCons>, + equal_ckey_ckey_normal<KeyCons1,Value1,KeyCons2,Value2,EqualCons> + >::type +{ +}; + +template +< + typename KeyCons,typename Value, + typename ValCons,typename EqualCons +> +struct equal_ckey_cval; /* fwd decl. */ + +template +< + typename KeyCons,typename Value, + typename ValCons,typename EqualCons +> +struct equal_ckey_cval_terminal +{ + static bool compare( + const KeyCons&,const Value&,const ValCons&,const EqualCons&) + { + return true; + } + + static bool compare( + const ValCons&,const KeyCons&,const Value&,const EqualCons&) + { + return true; + } +}; + +template +< + typename KeyCons,typename Value, + typename ValCons,typename EqualCons +> +struct equal_ckey_cval_normal +{ + static bool compare( + const KeyCons& c,const Value& v,const ValCons& vc, + const EqualCons& eq) + { + if(!eq.get_head()(c.get_head()(v),vc.get_head()))return false; + return equal_ckey_cval< + BOOST_DEDUCED_TYPENAME KeyCons::tail_type,Value, + BOOST_DEDUCED_TYPENAME ValCons::tail_type, + BOOST_DEDUCED_TYPENAME EqualCons::tail_type + >::compare(c.get_tail(),v,vc.get_tail(),eq.get_tail()); + } + + static bool compare( + const ValCons& vc,const KeyCons& c,const Value& v, + const EqualCons& eq) + { + if(!eq.get_head()(vc.get_head(),c.get_head()(v)))return false; + return equal_ckey_cval< + BOOST_DEDUCED_TYPENAME KeyCons::tail_type,Value, + BOOST_DEDUCED_TYPENAME ValCons::tail_type, + BOOST_DEDUCED_TYPENAME EqualCons::tail_type + >::compare(vc.get_tail(),c.get_tail(),v,eq.get_tail()); + } +}; + +template +< + typename KeyCons,typename Value, + typename ValCons,typename EqualCons +> +struct equal_ckey_cval: + mpl::if_< + mpl::or_< + is_same<KeyCons,tuples::null_type>, + is_same<ValCons,tuples::null_type> + >, + equal_ckey_cval_terminal<KeyCons,Value,ValCons,EqualCons>, + equal_ckey_cval_normal<KeyCons,Value,ValCons,EqualCons> + >::type +{ +}; + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename CompareCons +> +struct compare_ckey_ckey; /* fwd decl. */ + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename CompareCons +> +struct compare_ckey_ckey_terminal +{ + static bool compare( + const KeyCons1&,const Value1&, + const KeyCons2&,const Value2&, + const CompareCons&) + { + return false; + } +}; + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename CompareCons +> +struct compare_ckey_ckey_normal +{ + static bool compare( + const KeyCons1& c0,const Value1& v0, + const KeyCons2& c1,const Value2& v1, + const CompareCons& comp) + { + if(comp.get_head()(c0.get_head()(v0),c1.get_head()(v1)))return true; + if(comp.get_head()(c1.get_head()(v1),c0.get_head()(v0)))return false; + return compare_ckey_ckey< + BOOST_DEDUCED_TYPENAME KeyCons1::tail_type,Value1, + BOOST_DEDUCED_TYPENAME KeyCons2::tail_type,Value2, + BOOST_DEDUCED_TYPENAME CompareCons::tail_type + >::compare(c0.get_tail(),v0,c1.get_tail(),v1,comp.get_tail()); + } +}; + +template +< + typename KeyCons1,typename Value1, + typename KeyCons2, typename Value2, + typename CompareCons +> +struct compare_ckey_ckey: + mpl::if_< + mpl::or_< + is_same<KeyCons1,tuples::null_type>, + is_same<KeyCons2,tuples::null_type> + >, + compare_ckey_ckey_terminal<KeyCons1,Value1,KeyCons2,Value2,CompareCons>, + compare_ckey_ckey_normal<KeyCons1,Value1,KeyCons2,Value2,CompareCons> + >::type +{ +}; + +template +< + typename KeyCons,typename Value, + typename ValCons,typename CompareCons +> +struct compare_ckey_cval; /* fwd decl. */ + +template +< + typename KeyCons,typename Value, + typename ValCons,typename CompareCons +> +struct compare_ckey_cval_terminal +{ + static bool compare( + const KeyCons&,const Value&,const ValCons&,const CompareCons&) + { + return false; + } + + static bool compare( + const ValCons&,const KeyCons&,const Value&,const CompareCons&) + { + return false; + } +}; + +template +< + typename KeyCons,typename Value, + typename ValCons,typename CompareCons +> +struct compare_ckey_cval_normal +{ + static bool compare( + const KeyCons& c,const Value& v,const ValCons& vc, + const CompareCons& comp) + { + if(comp.get_head()(c.get_head()(v),vc.get_head()))return true; + if(comp.get_head()(vc.get_head(),c.get_head()(v)))return false; + return compare_ckey_cval< + BOOST_DEDUCED_TYPENAME KeyCons::tail_type,Value, + BOOST_DEDUCED_TYPENAME ValCons::tail_type, + BOOST_DEDUCED_TYPENAME CompareCons::tail_type + >::compare(c.get_tail(),v,vc.get_tail(),comp.get_tail()); + } + + static bool compare( + const ValCons& vc,const KeyCons& c,const Value& v, + const CompareCons& comp) + { + if(comp.get_head()(vc.get_head(),c.get_head()(v)))return true; + if(comp.get_head()(c.get_head()(v),vc.get_head()))return false; + return compare_ckey_cval< + BOOST_DEDUCED_TYPENAME KeyCons::tail_type,Value, + BOOST_DEDUCED_TYPENAME ValCons::tail_type, + BOOST_DEDUCED_TYPENAME CompareCons::tail_type + >::compare(vc.get_tail(),c.get_tail(),v,comp.get_tail()); + } +}; + +template +< + typename KeyCons,typename Value, + typename ValCons,typename CompareCons +> +struct compare_ckey_cval: + mpl::if_< + mpl::or_< + is_same<KeyCons,tuples::null_type>, + is_same<ValCons,tuples::null_type> + >, + compare_ckey_cval_terminal<KeyCons,Value,ValCons,CompareCons>, + compare_ckey_cval_normal<KeyCons,Value,ValCons,CompareCons> + >::type +{ +}; + +template<typename KeyCons,typename Value,typename HashCons> +struct hash_ckey; /* fwd decl. */ + +template<typename KeyCons,typename Value,typename HashCons> +struct hash_ckey_terminal +{ + static std::size_t hash( + const KeyCons&,const Value&,const HashCons&,std::size_t carry) + { + return carry; + } +}; + +template<typename KeyCons,typename Value,typename HashCons> +struct hash_ckey_normal +{ + static std::size_t hash( + const KeyCons& c,const Value& v,const HashCons& h,std::size_t carry=0) + { + /* same hashing formula as boost::hash_combine */ + + carry^=h.get_head()(c.get_head()(v))+0x9e3779b9+(carry<<6)+(carry>>2); + return hash_ckey< + BOOST_DEDUCED_TYPENAME KeyCons::tail_type,Value, + BOOST_DEDUCED_TYPENAME HashCons::tail_type + >::hash(c.get_tail(),v,h.get_tail(),carry); + } +}; + +template<typename KeyCons,typename Value,typename HashCons> +struct hash_ckey: + mpl::if_< + is_same<KeyCons,tuples::null_type>, + hash_ckey_terminal<KeyCons,Value,HashCons>, + hash_ckey_normal<KeyCons,Value,HashCons> + >::type +{ +}; + +template<typename ValCons,typename HashCons> +struct hash_cval; /* fwd decl. */ + +template<typename ValCons,typename HashCons> +struct hash_cval_terminal +{ + static std::size_t hash(const ValCons&,const HashCons&,std::size_t carry) + { + return carry; + } +}; + +template<typename ValCons,typename HashCons> +struct hash_cval_normal +{ + static std::size_t hash( + const ValCons& vc,const HashCons& h,std::size_t carry=0) + { + carry^=h.get_head()(vc.get_head())+0x9e3779b9+(carry<<6)+(carry>>2); + return hash_cval< + BOOST_DEDUCED_TYPENAME ValCons::tail_type, + BOOST_DEDUCED_TYPENAME HashCons::tail_type + >::hash(vc.get_tail(),h.get_tail(),carry); + } +}; + +template<typename ValCons,typename HashCons> +struct hash_cval: + mpl::if_< + is_same<ValCons,tuples::null_type>, + hash_cval_terminal<ValCons,HashCons>, + hash_cval_normal<ValCons,HashCons> + >::type +{ +}; + +} /* namespace multi_index::detail */ + +/* composite_key_result */ + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4512) +#endif + +template<typename CompositeKey> +struct composite_key_result +{ + typedef CompositeKey composite_key_type; + typedef typename composite_key_type::value_type value_type; + + composite_key_result( + const composite_key_type& composite_key_,const value_type& value_): + composite_key(composite_key_),value(value_) + {} + + const composite_key_type& composite_key; + const value_type& value; +}; + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +/* composite_key */ + +/* NB. Some overloads of operator() have an extra dummy parameter int=0. + * This disambiguator serves several purposes: + * - Without it, MSVC++ 6.0 incorrectly regards some overloads as + * specializations of a previous member function template. + * - MSVC++ 6.0/7.0 seem to incorrectly treat some different memfuns + * as if they have the same signature. + * - If remove_const is broken due to lack of PTS, int=0 avoids the + * declaration of memfuns with identical signature. + */ + +template< + typename Value, + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_TEMPLATE_PARM,KeyFromValue) +> +struct composite_key: + private tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(KeyFromValue)> +{ +private: + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(KeyFromValue)> super; + +public: + typedef super key_extractor_tuple; + typedef Value value_type; + typedef composite_key_result<composite_key> result_type; + + composite_key( + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_CTOR_ARG,KeyFromValue)): + super(BOOST_MULTI_INDEX_CK_ENUM_PARAMS(k)) + {} + + composite_key(const key_extractor_tuple& x):super(x){} + + const key_extractor_tuple& key_extractors()const{return *this;} + key_extractor_tuple& key_extractors(){return *this;} + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const value_type&>,result_type>::type +#else + result_type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + result_type operator()(const value_type& x)const + { + return result_type(*this,x); + } + + result_type operator()(const reference_wrapper<const value_type>& x)const + { + return result_type(*this,x.get()); + } + + result_type operator()(const reference_wrapper<value_type>& x,int=0)const + { + return result_type(*this,x.get()); + } +}; + +/* comparison operators */ + +/* == */ + +template<typename CompositeKey1,typename CompositeKey2> +inline bool operator==( + const composite_key_result<CompositeKey1>& x, + const composite_key_result<CompositeKey2>& y) +{ + typedef typename CompositeKey1::key_extractor_tuple key_extractor_tuple1; + typedef typename CompositeKey1::value_type value_type1; + typedef typename CompositeKey2::key_extractor_tuple key_extractor_tuple2; + typedef typename CompositeKey2::value_type value_type2; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple1>::value== + tuples::length<key_extractor_tuple2>::value); + + return detail::equal_ckey_ckey< + key_extractor_tuple1,value_type1, + key_extractor_tuple2,value_type2, + detail::generic_operator_equal_tuple + >::compare( + x.composite_key.key_extractors(),x.value, + y.composite_key.key_extractors(),y.value, + detail::generic_operator_equal_tuple()); +} + +template< + typename CompositeKey, + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value) +> +inline bool operator==( + const composite_key_result<CompositeKey>& x, + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& y) +{ + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple>::value== + tuples::length<key_tuple>::value); + + return detail::equal_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,detail::generic_operator_equal_tuple + >::compare( + x.composite_key.key_extractors(),x.value, + y,detail::generic_operator_equal_tuple()); +} + +template +< + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value), + typename CompositeKey +> +inline bool operator==( + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& x, + const composite_key_result<CompositeKey>& y) +{ + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple>::value== + tuples::length<key_tuple>::value); + + return detail::equal_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,detail::generic_operator_equal_tuple + >::compare( + x,y.composite_key.key_extractors(), + y.value,detail::generic_operator_equal_tuple()); +} + +/* < */ + +template<typename CompositeKey1,typename CompositeKey2> +inline bool operator<( + const composite_key_result<CompositeKey1>& x, + const composite_key_result<CompositeKey2>& y) +{ + typedef typename CompositeKey1::key_extractor_tuple key_extractor_tuple1; + typedef typename CompositeKey1::value_type value_type1; + typedef typename CompositeKey2::key_extractor_tuple key_extractor_tuple2; + typedef typename CompositeKey2::value_type value_type2; + + return detail::compare_ckey_ckey< + key_extractor_tuple1,value_type1, + key_extractor_tuple2,value_type2, + detail::generic_operator_less_tuple + >::compare( + x.composite_key.key_extractors(),x.value, + y.composite_key.key_extractors(),y.value, + detail::generic_operator_less_tuple()); +} + +template +< + typename CompositeKey, + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value) +> +inline bool operator<( + const composite_key_result<CompositeKey>& x, + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& y) +{ + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + return detail::compare_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,detail::generic_operator_less_tuple + >::compare( + x.composite_key.key_extractors(),x.value, + y,detail::generic_operator_less_tuple()); +} + +template +< + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value), + typename CompositeKey +> +inline bool operator<( + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& x, + const composite_key_result<CompositeKey>& y) +{ + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + return detail::compare_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,detail::generic_operator_less_tuple + >::compare( + x,y.composite_key.key_extractors(), + y.value,detail::generic_operator_less_tuple()); +} + +/* rest of comparison operators */ + +#define BOOST_MULTI_INDEX_CK_COMPLETE_COMP_OPS(t1,t2,a1,a2) \ +template<t1,t2> inline bool operator!=(const a1& x,const a2& y) \ +{ \ + return !(x==y); \ +} \ + \ +template<t1,t2> inline bool operator>(const a1& x,const a2& y) \ +{ \ + return y<x; \ +} \ + \ +template<t1,t2> inline bool operator>=(const a1& x,const a2& y) \ +{ \ + return !(x<y); \ +} \ + \ +template<t1,t2> inline bool operator<=(const a1& x,const a2& y) \ +{ \ + return !(y<x); \ +} + +BOOST_MULTI_INDEX_CK_COMPLETE_COMP_OPS( + typename CompositeKey1, + typename CompositeKey2, + composite_key_result<CompositeKey1>, + composite_key_result<CompositeKey2> +) + +BOOST_MULTI_INDEX_CK_COMPLETE_COMP_OPS( + typename CompositeKey, + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value), + composite_key_result<CompositeKey>, + tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> +) + +BOOST_MULTI_INDEX_CK_COMPLETE_COMP_OPS( + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value), + typename CompositeKey, + tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>, + composite_key_result<CompositeKey> +) + +/* composite_key_equal_to */ + +template +< + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_TEMPLATE_PARM,Pred) +> +struct composite_key_equal_to: + private tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Pred)> +{ +private: + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Pred)> super; + +public: + typedef super key_eq_tuple; + + composite_key_equal_to( + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_CTOR_ARG,Pred)): + super(BOOST_MULTI_INDEX_CK_ENUM_PARAMS(k)) + {} + + composite_key_equal_to(const key_eq_tuple& x):super(x){} + + const key_eq_tuple& key_eqs()const{return *this;} + key_eq_tuple& key_eqs(){return *this;} + + template<typename CompositeKey1,typename CompositeKey2> + bool operator()( + const composite_key_result<CompositeKey1> & x, + const composite_key_result<CompositeKey2> & y)const + { + typedef typename CompositeKey1::key_extractor_tuple key_extractor_tuple1; + typedef typename CompositeKey1::value_type value_type1; + typedef typename CompositeKey2::key_extractor_tuple key_extractor_tuple2; + typedef typename CompositeKey2::value_type value_type2; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple1>::value<= + tuples::length<key_eq_tuple>::value&& + tuples::length<key_extractor_tuple1>::value== + tuples::length<key_extractor_tuple2>::value); + + return detail::equal_ckey_ckey< + key_extractor_tuple1,value_type1, + key_extractor_tuple2,value_type2, + key_eq_tuple + >::compare( + x.composite_key.key_extractors(),x.value, + y.composite_key.key_extractors(),y.value, + key_eqs()); + } + + template + < + typename CompositeKey, + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value) + > + bool operator()( + const composite_key_result<CompositeKey>& x, + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& y)const + { + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple>::value<= + tuples::length<key_eq_tuple>::value&& + tuples::length<key_extractor_tuple>::value== + tuples::length<key_tuple>::value); + + return detail::equal_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,key_eq_tuple + >::compare(x.composite_key.key_extractors(),x.value,y,key_eqs()); + } + + template + < + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value), + typename CompositeKey + > + bool operator()( + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& x, + const composite_key_result<CompositeKey>& y)const + { + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + BOOST_STATIC_ASSERT( + tuples::length<key_tuple>::value<= + tuples::length<key_eq_tuple>::value&& + tuples::length<key_tuple>::value== + tuples::length<key_extractor_tuple>::value); + + return detail::equal_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,key_eq_tuple + >::compare(x,y.composite_key.key_extractors(),y.value,key_eqs()); + } +}; + +/* composite_key_compare */ + +template +< + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_TEMPLATE_PARM,Compare) +> +struct composite_key_compare: + private tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Compare)> +{ +private: + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Compare)> super; + +public: + typedef super key_comp_tuple; + + composite_key_compare( + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_CTOR_ARG,Compare)): + super(BOOST_MULTI_INDEX_CK_ENUM_PARAMS(k)) + {} + + composite_key_compare(const key_comp_tuple& x):super(x){} + + const key_comp_tuple& key_comps()const{return *this;} + key_comp_tuple& key_comps(){return *this;} + + template<typename CompositeKey1,typename CompositeKey2> + bool operator()( + const composite_key_result<CompositeKey1> & x, + const composite_key_result<CompositeKey2> & y)const + { + typedef typename CompositeKey1::key_extractor_tuple key_extractor_tuple1; + typedef typename CompositeKey1::value_type value_type1; + typedef typename CompositeKey2::key_extractor_tuple key_extractor_tuple2; + typedef typename CompositeKey2::value_type value_type2; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple1>::value<= + tuples::length<key_comp_tuple>::value|| + tuples::length<key_extractor_tuple2>::value<= + tuples::length<key_comp_tuple>::value); + + return detail::compare_ckey_ckey< + key_extractor_tuple1,value_type1, + key_extractor_tuple2,value_type2, + key_comp_tuple + >::compare( + x.composite_key.key_extractors(),x.value, + y.composite_key.key_extractors(),y.value, + key_comps()); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template<typename CompositeKey,typename Value> + bool operator()( + const composite_key_result<CompositeKey>& x, + const Value& y)const + { + return operator()(x,make_tuple(cref(y))); + } +#endif + + template + < + typename CompositeKey, + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value) + > + bool operator()( + const composite_key_result<CompositeKey>& x, + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& y)const + { + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple>::value<= + tuples::length<key_comp_tuple>::value|| + tuples::length<key_tuple>::value<= + tuples::length<key_comp_tuple>::value); + + return detail::compare_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,key_comp_tuple + >::compare(x.composite_key.key_extractors(),x.value,y,key_comps()); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template<typename Value,typename CompositeKey> + bool operator()( + const Value& x, + const composite_key_result<CompositeKey>& y)const + { + return operator()(make_tuple(cref(x)),y); + } +#endif + + template + < + BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value), + typename CompositeKey + > + bool operator()( + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& x, + const composite_key_result<CompositeKey>& y)const + { + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + BOOST_STATIC_ASSERT( + tuples::length<key_tuple>::value<= + tuples::length<key_comp_tuple>::value|| + tuples::length<key_extractor_tuple>::value<= + tuples::length<key_comp_tuple>::value); + + return detail::compare_ckey_cval< + key_extractor_tuple,value_type, + key_tuple,key_comp_tuple + >::compare(x,y.composite_key.key_extractors(),y.value,key_comps()); + } +}; + +/* composite_key_hash */ + +template +< + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_TEMPLATE_PARM,Hash) +> +struct composite_key_hash: + private tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Hash)> +{ +private: + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Hash)> super; + +public: + typedef super key_hasher_tuple; + + composite_key_hash( + BOOST_MULTI_INDEX_CK_ENUM(BOOST_MULTI_INDEX_CK_CTOR_ARG,Hash)): + super(BOOST_MULTI_INDEX_CK_ENUM_PARAMS(k)) + {} + + composite_key_hash(const key_hasher_tuple& x):super(x){} + + const key_hasher_tuple& key_hash_functions()const{return *this;} + key_hasher_tuple& key_hash_functions(){return *this;} + + template<typename CompositeKey> + std::size_t operator()(const composite_key_result<CompositeKey> & x)const + { + typedef typename CompositeKey::key_extractor_tuple key_extractor_tuple; + typedef typename CompositeKey::value_type value_type; + + BOOST_STATIC_ASSERT( + tuples::length<key_extractor_tuple>::value== + tuples::length<key_hasher_tuple>::value); + + return detail::hash_ckey< + key_extractor_tuple,value_type, + key_hasher_tuple + >::hash(x.composite_key.key_extractors(),x.value,key_hash_functions()); + } + + template<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value)> + std::size_t operator()( + const tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)>& x)const + { + typedef tuple<BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)> key_tuple; + + BOOST_STATIC_ASSERT( + tuples::length<key_tuple>::value== + tuples::length<key_hasher_tuple>::value); + + return detail::hash_cval< + key_tuple,key_hasher_tuple + >::hash(x,key_hash_functions()); + } +}; + +/* Instantiations of the former functors with "natural" basic components: + * composite_key_result_equal_to uses std::equal_to of the values. + * composite_key_result_less uses std::less. + * composite_key_result_greater uses std::greater. + * composite_key_result_hash uses boost::hash. + */ + +#define BOOST_MULTI_INDEX_CK_RESULT_EQUAL_TO_SUPER \ +composite_key_equal_to< \ + BOOST_MULTI_INDEX_CK_ENUM( \ + BOOST_MULTI_INDEX_CK_APPLY_METAFUNCTION_N, \ + /* the argument is a PP list */ \ + (detail::nth_composite_key_equal_to, \ + (BOOST_DEDUCED_TYPENAME CompositeKeyResult::composite_key_type, \ + BOOST_PP_NIL))) \ + > + +template<typename CompositeKeyResult> +struct composite_key_result_equal_to: +BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS +BOOST_MULTI_INDEX_CK_RESULT_EQUAL_TO_SUPER +{ +private: + typedef BOOST_MULTI_INDEX_CK_RESULT_EQUAL_TO_SUPER super; + +public: + typedef CompositeKeyResult first_argument_type; + typedef first_argument_type second_argument_type; + typedef bool result_type; + + using super::operator(); +}; + +#define BOOST_MULTI_INDEX_CK_RESULT_LESS_SUPER \ +composite_key_compare< \ + BOOST_MULTI_INDEX_CK_ENUM( \ + BOOST_MULTI_INDEX_CK_APPLY_METAFUNCTION_N, \ + /* the argument is a PP list */ \ + (detail::nth_composite_key_less, \ + (BOOST_DEDUCED_TYPENAME CompositeKeyResult::composite_key_type, \ + BOOST_PP_NIL))) \ + > + +template<typename CompositeKeyResult> +struct composite_key_result_less: +BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS +BOOST_MULTI_INDEX_CK_RESULT_LESS_SUPER +{ +private: + typedef BOOST_MULTI_INDEX_CK_RESULT_LESS_SUPER super; + +public: + typedef CompositeKeyResult first_argument_type; + typedef first_argument_type second_argument_type; + typedef bool result_type; + + using super::operator(); +}; + +#define BOOST_MULTI_INDEX_CK_RESULT_GREATER_SUPER \ +composite_key_compare< \ + BOOST_MULTI_INDEX_CK_ENUM( \ + BOOST_MULTI_INDEX_CK_APPLY_METAFUNCTION_N, \ + /* the argument is a PP list */ \ + (detail::nth_composite_key_greater, \ + (BOOST_DEDUCED_TYPENAME CompositeKeyResult::composite_key_type, \ + BOOST_PP_NIL))) \ + > + +template<typename CompositeKeyResult> +struct composite_key_result_greater: +BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS +BOOST_MULTI_INDEX_CK_RESULT_GREATER_SUPER +{ +private: + typedef BOOST_MULTI_INDEX_CK_RESULT_GREATER_SUPER super; + +public: + typedef CompositeKeyResult first_argument_type; + typedef first_argument_type second_argument_type; + typedef bool result_type; + + using super::operator(); +}; + +#define BOOST_MULTI_INDEX_CK_RESULT_HASH_SUPER \ +composite_key_hash< \ + BOOST_MULTI_INDEX_CK_ENUM( \ + BOOST_MULTI_INDEX_CK_APPLY_METAFUNCTION_N, \ + /* the argument is a PP list */ \ + (detail::nth_composite_key_hash, \ + (BOOST_DEDUCED_TYPENAME CompositeKeyResult::composite_key_type, \ + BOOST_PP_NIL))) \ + > + +template<typename CompositeKeyResult> +struct composite_key_result_hash: +BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS +BOOST_MULTI_INDEX_CK_RESULT_HASH_SUPER +{ +private: + typedef BOOST_MULTI_INDEX_CK_RESULT_HASH_SUPER super; + +public: + typedef CompositeKeyResult argument_type; + typedef std::size_t result_type; + + using super::operator(); +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +/* Specializations of std::equal_to, std::less, std::greater and boost::hash + * for composite_key_results enabling interoperation with tuples of values. + */ + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +namespace std{ + +template<typename CompositeKey> +struct equal_to<boost::multi_index::composite_key_result<CompositeKey> >: + boost::multi_index::composite_key_result_equal_to< + boost::multi_index::composite_key_result<CompositeKey> + > +{ +}; + +template<typename CompositeKey> +struct less<boost::multi_index::composite_key_result<CompositeKey> >: + boost::multi_index::composite_key_result_less< + boost::multi_index::composite_key_result<CompositeKey> + > +{ +}; + +template<typename CompositeKey> +struct greater<boost::multi_index::composite_key_result<CompositeKey> >: + boost::multi_index::composite_key_result_greater< + boost::multi_index::composite_key_result<CompositeKey> + > +{ +}; + +} /* namespace std */ + +namespace boost{ + +template<typename CompositeKey> +struct hash<boost::multi_index::composite_key_result<CompositeKey> >: + boost::multi_index::composite_key_result_hash< + boost::multi_index::composite_key_result<CompositeKey> + > +{ +}; + +} /* namespace boost */ +#else +/* Lacking template partial specialization, std::equal_to, std::less and + * std::greater will still work for composite_key_results although without + * tuple interoperability. To achieve the same graceful degrading with + * boost::hash, we define the appropriate hash_value overload. + */ + +namespace boost{ + +#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +namespace multi_index{ +#endif + +template<typename CompositeKey> +inline std::size_t hash_value( + const boost::multi_index::composite_key_result<CompositeKey>& x) +{ + boost::multi_index::composite_key_result_hash< + boost::multi_index::composite_key_result<CompositeKey> > h; + return h(x); +} + +#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +} /* namespace multi_index */ +#endif + +} /* namespace boost */ +#endif + +#undef BOOST_MULTI_INDEX_CK_RESULT_HASH_SUPER +#undef BOOST_MULTI_INDEX_CK_RESULT_GREATER_SUPER +#undef BOOST_MULTI_INDEX_CK_RESULT_LESS_SUPER +#undef BOOST_MULTI_INDEX_CK_RESULT_EQUAL_TO_SUPER +#undef BOOST_MULTI_INDEX_CK_COMPLETE_COMP_OPS +#undef BOOST_MULTI_INDEX_CK_IDENTITY_ENUM_MACRO +#undef BOOST_MULTI_INDEX_CK_NTH_COMPOSITE_KEY_FUNCTOR +#undef BOOST_MULTI_INDEX_CK_APPLY_METAFUNCTION_N +#undef BOOST_MULTI_INDEX_CK_CTOR_ARG +#undef BOOST_MULTI_INDEX_CK_TEMPLATE_PARM +#undef BOOST_MULTI_INDEX_CK_ENUM_PARAMS +#undef BOOST_MULTI_INDEX_CK_ENUM +#undef BOOST_MULTI_INDEX_COMPOSITE_KEY_SIZE + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/access_specifier.hpp b/Utilities/BGL/boost/multi_index/detail/access_specifier.hpp new file mode 100644 index 0000000000000000000000000000000000000000..84c2f7dc927792fc1df09e7042d93ede7bc391b5 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/access_specifier.hpp @@ -0,0 +1,55 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_ACCESS_SPECIFIER_HPP +#define BOOST_MULTI_INDEX_DETAIL_ACCESS_SPECIFIER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +/* In those compilers that do not accept the member template friend syntax, + * some protected and private sections might need to be specified as + * public. + */ + +#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) +#define BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS public +#define BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS public +#else +#define BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS protected +#define BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS private +#endif + +/* GCC does not correctly support in-class using declarations for template + * functions. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9810 + * MSVC 7.1/8.0 seem to have a similar problem, though the conditions in + * which the error happens are not that simple. I have yet to isolate this + * into a snippet suitable for bug reporting. + * Sun Studio also has this problem, which might be related, from the + * information gathered at Sun forums, with a known issue notified at the + * internal bug report 6421933. The bug is present up to Studio Express 2, + * the latest preview version of the future Sun Studio 12. As of this writing + * (October 2006) it is not known whether a fix will finally make it into the + * official Sun Studio 12. + */ + +#if BOOST_WORKAROUND(__GNUC__, <3)||\ + BOOST_WORKAROUND(__GNUC__,==3)&&(__GNUC_MINOR__<4)||\ + BOOST_WORKAROUND(BOOST_MSVC,==1310)||\ + BOOST_WORKAROUND(BOOST_MSVC,==1400)||\ + BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590)) +#define BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS public +#else +#define BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS private +#endif + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/adl_swap.hpp b/Utilities/BGL/boost/multi_index/detail/adl_swap.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e78235d762bab454a4da9e5a437e70f5b65e7928 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/adl_swap.hpp @@ -0,0 +1,44 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_ADL_SWAP_HPP +#define BOOST_MULTI_INDEX_DETAIL_ADL_SWAP_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template<typename T> +void adl_swap(T& x,T& y) +{ + +#if !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) + using std::swap; + swap(x,y); +#else + std::swap(x,y); +#endif + +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/archive_constructed.hpp b/Utilities/BGL/boost/multi_index/detail/archive_constructed.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ee00dfaffc9a10cf62df8389d869986275785c91 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/archive_constructed.hpp @@ -0,0 +1,79 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_ARCHIVE_CONSTRUCTED_HPP +#define BOOST_MULTI_INDEX_DETAIL_ARCHIVE_CONSTRUCTED_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/noncopyable.hpp> +#include <boost/serialization/serialization.hpp> +#include <boost/type_traits/aligned_storage.hpp> +#include <boost/type_traits/alignment_of.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* constructs a stack-based object from a serialization archive */ + +template<typename T> +struct archive_constructed:private noncopyable +{ + template<class Archive> + archive_constructed(Archive& ar,const unsigned int version) + { + serialization::load_construct_data_adl(ar,&get(),version); + BOOST_TRY{ + ar>>get(); + } + BOOST_CATCH(...){ + (&get())->~T(); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + template<class Archive> + archive_constructed(const char* name,Archive& ar,const unsigned int version) + { + serialization::load_construct_data_adl(ar,&get(),version); + BOOST_TRY{ + ar>>serialization::make_nvp(name,get()); + } + BOOST_CATCH(...){ + (&get())->~T(); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + ~archive_constructed() + { + (&get())->~T(); + } + + T& get(){return *static_cast<T*>(static_cast<void*>(&space));} + +private: + typename aligned_storage<sizeof(T),alignment_of<T>::value>::type space; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/auto_space.hpp b/Utilities/BGL/boost/multi_index/detail/auto_space.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b0a0dc618cca4705aa07d455414a6f013c91e4a --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/auto_space.hpp @@ -0,0 +1,95 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_AUTO_SPACE_HPP +#define BOOST_MULTI_INDEX_DETAIL_AUTO_SPACE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/multi_index/detail/adl_swap.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/noncopyable.hpp> +#include <memory> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* auto_space provides uninitialized space suitably to store + * a given number of elements of a given type. + */ + +/* NB: it is not clear whether using an allocator to handle + * zero-sized arrays of elements is conformant or not. GCC 3.3.1 + * and prior fail here, other stdlibs handle the issue gracefully. + * To be on the safe side, the case n==0 is given special treatment. + * References: + * GCC Bugzilla, "standard allocator crashes when deallocating segment + * "of zero length", http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14176 + * C++ Standard Library Defect Report List (Revision 28), issue 199 + * "What does allocate(0) return?", + * http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#199 + */ + +template<typename T,typename Allocator=std::allocator<T> > +struct auto_space:private noncopyable +{ + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,T + >::type + >::type::pointer pointer; + + explicit auto_space(const Allocator& al=Allocator(),std::size_t n=1): + al_(al),n_(n),data_(n_?al_.allocate(n_):pointer(0)) + {} + + ~auto_space() + { + if(n_)al_.deallocate(data_,n_); + } + + Allocator get_allocator()const{return al_;} + + pointer data()const{return data_;} + + void swap(auto_space& x) + { + if(al_!=x.al_)adl_swap(al_,x.al_); + std::swap(n_,x.n_); + std::swap(data_,x.data_); + } + +private: + typename boost::detail::allocator::rebind_to< + Allocator,T>::type al_; + std::size_t n_; + pointer data_; +}; + +template<typename T,typename Allocator> +void swap(auto_space<T,Allocator>& x,auto_space<T,Allocator>& y) +{ + x.swap(y); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/base_type.hpp b/Utilities/BGL/boost/multi_index/detail/base_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d25332e4e26b3a27a2a87847555dd869e1485e20 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/base_type.hpp @@ -0,0 +1,87 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_BASE_TYPE_HPP +#define BOOST_MULTI_INDEX_DETAIL_BASE_TYPE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/workaround.hpp> +#include <boost/mpl/at.hpp> +#include <boost/mpl/apply.hpp> +#include <boost/mpl/size.hpp> +#include <boost/multi_index/detail/index_base.hpp> +#include <boost/multi_index/detail/is_index_list.hpp> +#include <boost/multi_index/detail/msvc_index_specifier.hpp> +#include <boost/static_assert.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* MPL machinery to construct a linear hierarchy of indices out of + * a index list. + */ + +#if BOOST_WORKAROUND(BOOST_MSVC,<1310) +struct index_applier +{ + template<typename IndexSpecifierMeta,typename SuperMeta> + struct apply: + msvc_index_specifier<IndexSpecifierMeta::type>:: + template result_index_class<SuperMeta> + { + }; +}; +#else +struct index_applier +{ + template<typename IndexSpecifierMeta,typename SuperMeta> + struct apply + { + typedef typename IndexSpecifierMeta::type index_specifier; + typedef typename index_specifier:: + BOOST_NESTED_TEMPLATE index_class<SuperMeta>::type type; + }; +}; +#endif + +template<int N,typename Value,typename IndexSpecifierList,typename Allocator> +struct nth_layer +{ + BOOST_STATIC_CONSTANT(int,length=mpl::size<IndexSpecifierList>::value); + + typedef typename mpl::eval_if_c< + N==length, + mpl::identity<index_base<Value,IndexSpecifierList,Allocator> >, + mpl::apply2< + index_applier, + mpl::at_c<IndexSpecifierList,N>, + nth_layer<N+1,Value,IndexSpecifierList,Allocator> + > + >::type type; +}; + +template<typename Value,typename IndexSpecifierList,typename Allocator> +struct multi_index_base_type:nth_layer<0,Value,IndexSpecifierList,Allocator> +{ + BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value); +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/bidir_node_iterator.hpp b/Utilities/BGL/boost/multi_index/detail/bidir_node_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2155255c4cfe8f766804a70702e0c6ade140081b --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/bidir_node_iterator.hpp @@ -0,0 +1,113 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_BIDIR_NODE_ITERATOR_HPP +#define BOOST_MULTI_INDEX_DETAIL_BIDIR_NODE_ITERATOR_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/operators.hpp> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/split_member.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Iterator class for node-based indices with bidirectional + * iterators (ordered and sequenced indices.) + */ + +template<typename Node> +class bidir_node_iterator: + public bidirectional_iterator_helper< + bidir_node_iterator<Node>, + typename Node::value_type, + std::ptrdiff_t, + const typename Node::value_type*, + const typename Node::value_type&> +{ +public: + bidir_node_iterator(){} + explicit bidir_node_iterator(Node* node_):node(node_){} + + const typename Node::value_type& operator*()const + { + return node->value(); + } + + bidir_node_iterator& operator++() + { + Node::increment(node); + return *this; + } + + bidir_node_iterator& operator--() + { + Node::decrement(node); + return *this; + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* Serialization. As for why the following is public, + * see explanation in safe_mode_iterator notes in safe_mode.hpp. + */ + + BOOST_SERIALIZATION_SPLIT_MEMBER() + + typedef typename Node::base_type node_base_type; + + template<class Archive> + void save(Archive& ar,const unsigned int)const + { + node_base_type* bnode=node; + ar<<serialization::make_nvp("pointer",bnode); + } + + template<class Archive> + void load(Archive& ar,const unsigned int) + { + node_base_type* bnode; + ar>>serialization::make_nvp("pointer",bnode); + node=static_cast<Node*>(bnode); + } +#endif + + /* get_node is not to be used by the user */ + + typedef Node node_type; + + Node* get_node()const{return node;} + +private: + Node* node; +}; + +template<typename Node> +bool operator==( + const bidir_node_iterator<Node>& x, + const bidir_node_iterator<Node>& y) +{ + return x.get_node()==y.get_node(); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/bucket_array.hpp b/Utilities/BGL/boost/multi_index/detail/bucket_array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a6772adb7ff3625805bbc2399f3104cb07533e2c --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/bucket_array.hpp @@ -0,0 +1,211 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_BUCKET_ARRAY_HPP +#define BOOST_MULTI_INDEX_DETAIL_BUCKET_ARRAY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/multi_index/detail/auto_space.hpp> +#include <boost/multi_index/detail/hash_index_node.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/noncopyable.hpp> +#include <cstddef> +#include <limits.h> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/archive/archive_exception.hpp> +#include <boost/serialization/access.hpp> +#include <boost/throw_exception.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* bucket structure for use by hashed indices */ + +class bucket_array_base:private noncopyable +{ +protected: + inline static std::size_t next_prime(std::size_t n) + { + static const std::size_t prime_list[]={ + 53ul, 97ul, 193ul, 389ul, 769ul, + 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, + 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, + 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, + 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, + 1610612741ul, 3221225473ul, + +#if ((((ULONG_MAX>>16)>>16)>>16)>>15)==0 /* unsigned long less than 64 bits */ + 4294967291ul +#else + /* obtained with aid from + * http://javaboutique.internet.com/prime_numb/ + * http://www.rsok.com/~jrm/next_ten_primes.html + * and verified with + * http://www.alpertron.com.ar/ECM.HTM + */ + + 6442450939ul, 12884901893ul, 25769803751ul, 51539607551ul, + 103079215111ul, 206158430209ul, 412316860441ul, 824633720831ul, + 1649267441651ul, 3298534883309ul, 6597069766657ul, 13194139533299ul, + 26388279066623ul, 52776558133303ul, 105553116266489ul, 211106232532969ul, + 422212465066001ul, 844424930131963ul, 1688849860263953ul, + 3377699720527861ul, 6755399441055731ul, 13510798882111483ul, + 27021597764222939ul, 54043195528445957ul, 108086391056891903ul, + 216172782113783843ul, 432345564227567621ul, 864691128455135207ul, + 1729382256910270481ul, 3458764513820540933ul, 6917529027641081903ul, + 13835058055282163729ul, 18446744073709551557ul +#endif + + }; + static const std::size_t prime_list_size= + sizeof(prime_list)/sizeof(prime_list[0]); + + std::size_t const *bound= + std::lower_bound(prime_list,prime_list+prime_list_size,n); + if(bound==prime_list+prime_list_size)bound--; + return *bound; + } +}; + +template<typename Allocator> +class bucket_array:public bucket_array_base +{ + typedef typename prevent_eti< + Allocator, + hashed_index_node_impl< + typename boost::detail::allocator::rebind_to< + Allocator, + char + >::type + > + >::type node_impl_type; + +public: + typedef typename node_impl_type::pointer pointer; + + bucket_array(const Allocator& al,pointer end_,std::size_t size): + size_(bucket_array_base::next_prime(size)), + spc(al,size_+1) + { + clear(); + end()->next()=end_; + end_->next()=end(); + } + + std::size_t size()const + { + return size_; + } + + std::size_t position(std::size_t hash)const + { + return hash%size_; + } + + pointer begin()const{return buckets();} + pointer end()const{return buckets()+size_;} + pointer at(std::size_t n)const{return buckets()+n;} + + std::size_t first_nonempty(std::size_t n)const + { + for(;;++n){ + pointer x=at(n); + if(x->next()!=x)return n; + } + } + + void clear() + { + for(pointer x=begin(),y=end();x!=y;++x)x->next()=x; + } + + void swap(bucket_array& x) + { + std::swap(size_,x.size_); + spc.swap(x.spc); + } + +private: + std::size_t size_; + auto_space<node_impl_type,Allocator> spc; + + pointer buckets()const + { + return spc.data(); + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + friend class boost::serialization::access; + + /* bucket_arrays do not emit any kind of serialization info. They are + * fed to Boost.Serialization as hashed index iterators need to track + * them during serialization. + */ + + template<class Archive> + void serialize(Archive&,const unsigned int) + { + } +#endif +}; + +template<typename Allocator> +void swap(bucket_array<Allocator>& x,bucket_array<Allocator>& y) +{ + x.swap(y); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +/* bucket_arrays never get constructed directly by Boost.Serialization, + * as archives are always fed pointers to previously existent + * arrays. So, if this is called it means we are dealing with a + * somehow invalid archive. + */ + +#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +namespace serialization{ +#else +namespace multi_index{ +namespace detail{ +#endif + +template<class Archive,typename Allocator> +inline void load_construct_data( + Archive&,boost::multi_index::detail::bucket_array<Allocator>*, + const unsigned int) +{ + throw_exception( + archive::archive_exception(archive::archive_exception::other_exception)); +} + +#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +} /* namespace serialization */ +#else +} /* namespace multi_index::detail */ +} /* namespace multi_index */ +#endif + +#endif + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/converter.hpp b/Utilities/BGL/boost/multi_index/detail/converter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a46cff621a76cd9ab81793b7f91677ab409f150b --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/converter.hpp @@ -0,0 +1,52 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_CONVERTER_HPP +#define BOOST_MULTI_INDEX_DETAIL_CONVERTER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* converter offers means to access indices of a given multi_index_container + * and for convertibilty between index iterators, so providing a + * localized access point for get() and project() functions. + */ + +template<typename MultiIndexContainer,typename Index> +struct converter +{ + static const Index& index(const MultiIndexContainer& x){return x;} + static Index& index(MultiIndexContainer& x){return x;} + + static typename Index::const_iterator const_iterator( + const MultiIndexContainer& x,typename MultiIndexContainer::node_type* node) + { + return x.Index::make_iterator(node); + } + + static typename Index::iterator iterator( + MultiIndexContainer& x,typename MultiIndexContainer::node_type* node) + { + return x.Index::make_iterator(node); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/copy_map.hpp b/Utilities/BGL/boost/multi_index/detail/copy_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4279a8d0c2b2d759492f06f6077fc24377c64775 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/copy_map.hpp @@ -0,0 +1,140 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_COPY_MAP_HPP +#define BOOST_MULTI_INDEX_DETAIL_COPY_MAP_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/multi_index/detail/auto_space.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/noncopyable.hpp> +#include <cstddef> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* copy_map is used as an auxiliary structure during copy_() operations. + * When a container with n nodes is replicated, node_map holds the pairings + * between original and copied nodes, and provides a fast way to find a + * copied node from an original one. + * The semantics of the class are not simple, and no attempt has been made + * to enforce it: multi_index_container handles it right. On the other hand, + * the const interface, which is the one provided to index implementations, + * only allows for: + * - Enumeration of pairs of (original,copied) nodes (excluding the headers), + * - fast retrieval of copied nodes (including the headers.) + */ + +template <typename Node> +struct copy_map_entry +{ + copy_map_entry(Node* f,Node* s):first(f),second(s){} + + Node* first; + Node* second; + + bool operator<(const copy_map_entry<Node>& x)const + { + return std::less<Node*>()(first,x.first); + } +}; + +template <typename Node,typename Allocator> +class copy_map:private noncopyable +{ +public: + typedef const copy_map_entry<Node>* const_iterator; + + copy_map( + const Allocator& al,std::size_t size,Node* header_org,Node* header_cpy): + al_(al),size_(size),spc(al_,size_),n(0), + header_org_(header_org),header_cpy_(header_cpy),released(false) + {} + + ~copy_map() + { + if(!released){ + for(std::size_t i=0;i<n;++i){ + boost::detail::allocator::destroy(&(spc.data()+i)->second->value()); + deallocate((spc.data()+i)->second); + } + } + } + + const_iterator begin()const{return &*spc.data();} + const_iterator end()const{return &*(spc.data()+n);} + + void clone(Node* node) + { + (spc.data()+n)->first=node; + (spc.data()+n)->second=&*al_.allocate(1); + BOOST_TRY{ + boost::detail::allocator::construct( + &(spc.data()+n)->second->value(),node->value()); + } + BOOST_CATCH(...){ + deallocate((spc.data()+n)->second); + BOOST_RETHROW; + } + BOOST_CATCH_END + ++n; + + if(n==size_)std::sort(&*spc.data(),&*spc.data()+size_); + } + + Node* find(Node* node)const + { + if(node==header_org_)return header_cpy_; + return std::lower_bound( + begin(),end(),copy_map_entry<Node>(node,0))->second; + } + + void release() + { + released=true; + } + +private: + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,Node>::type + >::type allocator_type; + typedef typename allocator_type::pointer allocator_pointer; + + allocator_type al_; + std::size_t size_; + auto_space<copy_map_entry<Node>,Allocator> spc; + std::size_t n; + Node* header_org_; + Node* header_cpy_; + bool released; + + void deallocate(Node* node) + { + al_.deallocate(static_cast<allocator_pointer>(node),1); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/duplicates_iterator.hpp b/Utilities/BGL/boost/multi_index/detail/duplicates_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..027dabd21523994638b6c864bc31eb0cc4c8ec75 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/duplicates_iterator.hpp @@ -0,0 +1,120 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_DUPLICATES_ITERATOR_HPP +#define BOOST_MULTI_INDEX_DETAIL_DUPLICATES_ITERATOR_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <cstddef> +#include <iterator> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* duplicates_operator is given a range of ordered elements and + * passes only over those which are duplicated. + */ + +template<typename Node,typename Predicate> +class duplicates_iterator +{ +public: + typedef typename Node::value_type value_type; + typedef std::ptrdiff_t difference_type; + typedef const typename Node::value_type* pointer; + typedef const typename Node::value_type& reference; + typedef std::forward_iterator_tag iterator_category; + + duplicates_iterator(Node* node_,Node* end_,Predicate pred_): + node(node_),begin_chunk(0),end(end_),pred(pred_) + { + advance(); + } + + duplicates_iterator(Node* end_,Predicate pred_): + node(end_),begin_chunk(end_),end(end_),pred(pred_) + { + } + + reference operator*()const + { + return node->value(); + } + + pointer operator->()const + { + return &node->value(); + } + + duplicates_iterator& operator++() + { + Node::increment(node); + sync(); + return *this; + } + + duplicates_iterator operator++(int) + { + duplicates_iterator tmp(*this); + ++(*this); + return tmp; + } + + Node* get_node()const{return node;} + +private: + void sync() + { + if(node!=end&&pred(begin_chunk->value(),node->value()))advance(); + } + + void advance() + { + for(Node* node2=node;node!=end;node=node2){ + Node::increment(node2); + if(node2!=end&&!pred(node->value(),node2->value()))break; + } + begin_chunk=node; + } + + Node* node; + Node* begin_chunk; + Node* end; + Predicate pred; +}; + +template<typename Node,typename Predicate> +bool operator==( + const duplicates_iterator<Node,Predicate>& x, + const duplicates_iterator<Node,Predicate>& y) +{ + return x.get_node()==y.get_node(); +} + +template<typename Node,typename Predicate> +bool operator!=( + const duplicates_iterator<Node,Predicate>& x, + const duplicates_iterator<Node,Predicate>& y) +{ + return !(x==y); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/has_tag.hpp b/Utilities/BGL/boost/multi_index/detail/has_tag.hpp new file mode 100644 index 0000000000000000000000000000000000000000..83b28ccb6bbe7e47566184eea33c8ab1ddf1c8d7 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/has_tag.hpp @@ -0,0 +1,42 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_HAS_TAG_HPP +#define BOOST_MULTI_INDEX_DETAIL_HAS_TAG_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/contains.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* determines whether an index type has a given tag in its tag list */ + +template<typename Tag> +struct has_tag +{ + template<typename Index> + struct apply:mpl::contains<BOOST_DEDUCED_TYPENAME Index::tag_list,Tag> + { + }; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/hash_index_args.hpp b/Utilities/BGL/boost/multi_index/detail/hash_index_args.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4972f9bbe10a7dcd9351b5d3608847eaa5b24dd9 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/hash_index_args.hpp @@ -0,0 +1,105 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ARGS_HPP +#define BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ARGS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/functional/hash.hpp> +#include <boost/mpl/aux_/na.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/if.hpp> +#include <boost/multi_index/tag.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/is_same.hpp> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Hashed index specifiers can be instantiated in two forms: + * + * (hashed_unique|hashed_non_unique)< + * KeyFromValue, + * Hash=boost::hash<KeyFromValue::result_type>, + * Pred=std::equal_to<KeyFromValue::result_type> > + * (hashed_unique|hashed_non_unique)< + * TagList, + * KeyFromValue, + * Hash=boost::hash<KeyFromValue::result_type>, + * Pred=std::equal_to<KeyFromValue::result_type> > + * + * hashed_index_args implements the machinery to accept this + * argument-dependent polymorphism. + */ + +template<typename KeyFromValue> +struct index_args_default_hash +{ + typedef ::boost::hash<typename KeyFromValue::result_type> type; +}; + +template<typename KeyFromValue> +struct index_args_default_pred +{ + typedef std::equal_to<typename KeyFromValue::result_type> type; +}; + +template<typename Arg1,typename Arg2,typename Arg3,typename Arg4> +struct hashed_index_args +{ + typedef is_tag<Arg1> full_form; + + typedef typename mpl::if_< + full_form, + Arg1, + tag< > >::type tag_list_type; + typedef typename mpl::if_< + full_form, + Arg2, + Arg1>::type key_from_value_type; + typedef typename mpl::if_< + full_form, + Arg3, + Arg2>::type supplied_hash_type; + typedef typename mpl::eval_if< + mpl::is_na<supplied_hash_type>, + index_args_default_hash<key_from_value_type>, + mpl::identity<supplied_hash_type> + >::type hash_type; + typedef typename mpl::if_< + full_form, + Arg4, + Arg3>::type supplied_pred_type; + typedef typename mpl::eval_if< + mpl::is_na<supplied_pred_type>, + index_args_default_pred<key_from_value_type>, + mpl::identity<supplied_pred_type> + >::type pred_type; + + BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value); + BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value); + BOOST_STATIC_ASSERT(!mpl::is_na<hash_type>::value); + BOOST_STATIC_ASSERT(!mpl::is_na<pred_type>::value); +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/hash_index_iterator.hpp b/Utilities/BGL/boost/multi_index/detail/hash_index_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..352c1d805a01aa3b1722b1b4313a9be6e257bc01 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/hash_index_iterator.hpp @@ -0,0 +1,111 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ITERATOR_HPP +#define BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ITERATOR_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/operators.hpp> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/split_member.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Iterator class for hashed indices. + */ + +template<typename Node,typename BucketArray> +class hashed_index_iterator: + public forward_iterator_helper< + hashed_index_iterator<Node,BucketArray>, + typename Node::value_type, + std::ptrdiff_t, + const typename Node::value_type*, + const typename Node::value_type&> +{ +public: + hashed_index_iterator(){} + hashed_index_iterator(Node* node_,BucketArray* buckets_): + node(node_),buckets(buckets_) + {} + + const typename Node::value_type& operator*()const + { + return node->value(); + } + + hashed_index_iterator& operator++() + { + Node::increment(node,buckets->begin(),buckets->end()); + return *this; + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* Serialization. As for why the following is public, + * see explanation in safe_mode_iterator notes in safe_mode.hpp. + */ + + BOOST_SERIALIZATION_SPLIT_MEMBER() + + typedef typename Node::base_type node_base_type; + + template<class Archive> + void save(Archive& ar,const unsigned int)const + { + node_base_type* bnode=node; + ar<<serialization::make_nvp("pointer",bnode); + ar<<serialization::make_nvp("pointer",buckets); + } + + template<class Archive> + void load(Archive& ar,const unsigned int) + { + node_base_type* bnode; + ar>>serialization::make_nvp("pointer",bnode); + node=static_cast<Node*>(bnode); + ar>>serialization::make_nvp("pointer",buckets); + } +#endif + + /* get_node is not to be used by the user */ + + typedef Node node_type; + + Node* get_node()const{return node;} + +private: + Node* node; + BucketArray* buckets; +}; + +template<typename Node,typename BucketArray> +bool operator==( + const hashed_index_iterator<Node,BucketArray>& x, + const hashed_index_iterator<Node,BucketArray>& y) +{ + return x.get_node()==y.get_node(); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/hash_index_node.hpp b/Utilities/BGL/boost/multi_index/detail/hash_index_node.hpp new file mode 100644 index 0000000000000000000000000000000000000000..edb2c106494f422b0ab51d0a735a9a0186930628 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/hash_index_node.hpp @@ -0,0 +1,165 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_NODE_HPP +#define BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_NODE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/allocator_utilities.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* singly-linked node for use by hashed_index */ + +template<typename Allocator> +struct hashed_index_node_impl +{ + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,hashed_index_node_impl + >::type + >::type::pointer pointer; + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,hashed_index_node_impl + >::type + >::type::const_pointer const_pointer; + + pointer& next(){return next_;} + pointer next()const{return next_;} + + /* algorithmic stuff */ + + static void increment(pointer& x,pointer bbegin,pointer bend) + { + std::less_equal<pointer> leq; + + x=x->next(); + if(leq(bbegin,x)&&leq(x,bend)){ /* bucket node */ + do{ + ++x; + }while(x->next()==x); + x=x->next(); + } + } + + static void link(pointer x,pointer pos) + { + x->next()=pos->next(); + pos->next()=x; + }; + + static void unlink(pointer x) + { + pointer y=x->next(); + while(y->next()!=x){y=y->next();} + y->next()=x->next(); + } + + static pointer prev(pointer x) + { + pointer y=x->next(); + while(y->next()!=x){y=y->next();} + return y; + } + + static void unlink_next(pointer x) + { + x->next()=x->next()->next(); + } + +private: + pointer next_; +}; + +template<typename Super> +struct hashed_index_node_trampoline: + prevent_eti< + Super, + hashed_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type +{ + typedef typename prevent_eti< + Super, + hashed_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type impl_type; +}; + +template<typename Super> +struct hashed_index_node:Super,hashed_index_node_trampoline<Super> +{ +private: + typedef hashed_index_node_trampoline<Super> trampoline; + +public: + typedef typename trampoline::impl_type impl_type; + typedef typename trampoline::pointer impl_pointer; + typedef typename trampoline::const_pointer const_impl_pointer; + + impl_pointer impl() + { + return static_cast<impl_pointer>( + static_cast<impl_type*>(static_cast<trampoline*>(this))); + } + + const_impl_pointer impl()const + { + return static_cast<const_impl_pointer>( + static_cast<const impl_type*>(static_cast<const trampoline*>(this))); + } + + static hashed_index_node* from_impl(impl_pointer x) + { + return static_cast<hashed_index_node*>( + static_cast<trampoline*>(&*x)); + } + + static const hashed_index_node* from_impl(const_impl_pointer x) + { + return static_cast<const hashed_index_node*>( + static_cast<const trampoline*>(&*x)); + } + + static void increment( + hashed_index_node*& x,impl_pointer bbegin,impl_pointer bend) + { + impl_pointer xi=x->impl(); + trampoline::increment(xi,bbegin,bend); + x=from_impl(xi); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/header_holder.hpp b/Utilities/BGL/boost/multi_index/detail/header_holder.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8716e83af1cf064fc132114c68b846e74fbf7141 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/header_holder.hpp @@ -0,0 +1,50 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_HEADER_HOLDER_HPP +#define BOOST_MULTI_INDEX_DETAIL_HEADER_HOLDER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/noncopyable.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* A utility class used to hold a pointer to the header node. + * The base from member idiom is used because index classes, which are + * superclasses of multi_index_container, need this header in construction + * time. The allocation is made by the allocator of the multi_index_container + * class --hence, this allocator needs also be stored resorting + * to the base from member trick. + */ + +template<typename NodeTypePtr,typename Final> +struct header_holder:private noncopyable +{ + header_holder():member(final().allocate_node()){} + ~header_holder(){final().deallocate_node(&*member);} + + NodeTypePtr member; + +private: + Final& final(){return *static_cast<Final*>(this);} +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/index_base.hpp b/Utilities/BGL/boost/multi_index/detail/index_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b73a4bb85074a25ad5e3dc904f2595b654f7468 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/index_base.hpp @@ -0,0 +1,185 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_BASE_HPP +#define BOOST_MULTI_INDEX_DETAIL_INDEX_BASE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/call_traits.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/multi_index/detail/copy_map.hpp> +#include <boost/multi_index/detail/node_type.hpp> +#include <boost/multi_index_container_fwd.hpp> +#include <boost/tuple/tuple.hpp> +#include <utility> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/multi_index/detail/index_loader.hpp> +#include <boost/multi_index/detail/index_saver.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* The role of this class is threefold: + * - tops the linear hierarchy of indices. + * - terminates some cascading backbone function calls (insert_, etc.), + * - grants access to the backbone functions of the final + * multi_index_container class (for access restriction reasons, these + * cannot be called directly from the index classes.) + */ + +template<typename Value,typename IndexSpecifierList,typename Allocator> +class index_base +{ +protected: + typedef index_node_base<Value,Allocator> node_type; + typedef typename multi_index_node_type< + Value,IndexSpecifierList,Allocator>::type final_node_type; + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> final_type; + typedef tuples::null_type ctor_args_list; + typedef typename + boost::detail::allocator::rebind_to< + Allocator, + typename Allocator::value_type>::type final_allocator_type; + typedef mpl::vector0<> index_type_list; + typedef mpl::vector0<> iterator_type_list; + typedef mpl::vector0<> const_iterator_type_list; + typedef copy_map< + final_node_type, + final_allocator_type> copy_map_type; + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + typedef index_saver< + node_type, + final_allocator_type> index_saver_type; + typedef index_loader< + node_type, + final_node_type, + final_allocator_type> index_loader_type; +#endif + +private: + typedef typename call_traits<Value>::param_type value_param_type; + +protected: + explicit index_base(const ctor_args_list&,const Allocator&){} + + void copy_( + const index_base<Value,IndexSpecifierList,Allocator>&,const copy_map_type&) + {} + + node_type* insert_(value_param_type v,node_type* x) + { + boost::detail::allocator::construct(&x->value(),v); + return x; + } + + node_type* insert_(value_param_type v,node_type*,node_type* x) + { + boost::detail::allocator::construct(&x->value(),v); + return x; + } + + void erase_(node_type* x) + { + boost::detail::allocator::destroy(&x->value()); + } + + void delete_node_(node_type* x) + { + boost::detail::allocator::destroy(&x->value()); + } + + void clear_(){} + + void swap_(index_base<Value,IndexSpecifierList,Allocator>&){} + + bool replace_(value_param_type v,node_type* x) + { + x->value()=v; + return true; + } + + bool modify_(node_type*){return true;} + + bool modify_rollback_(node_type*){return true;} + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* serialization */ + + template<typename Archive> + void save_(Archive&,const unsigned int,const index_saver_type&)const{} + + template<typename Archive> + void load_(Archive&,const unsigned int,const index_loader_type&){} +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + /* invariant stuff */ + + bool invariant_()const{return true;} +#endif + + /* access to backbone memfuns of Final class */ + + final_type& final(){return *static_cast<final_type*>(this);} + const final_type& final()const{return *static_cast<const final_type*>(this);} + + final_node_type* final_header()const{return final().header();} + + bool final_empty_()const{return final().empty_();} + std::size_t final_size_()const{return final().size_();} + std::size_t final_max_size_()const{return final().max_size_();} + + std::pair<final_node_type*,bool> final_insert_(value_param_type x) + {return final().insert_(x);} + std::pair<final_node_type*,bool> final_insert_( + value_param_type x,final_node_type* position) + {return final().insert_(x,position);} + + void final_erase_(final_node_type* x){final().erase_(x);} + + void final_delete_node_(final_node_type* x){final().delete_node_(x);} + void final_delete_all_nodes_(){final().delete_all_nodes_();} + void final_clear_(){final().clear_();} + + void final_swap_(final_type& x){final().swap_(x);} + bool final_replace_( + value_param_type k,final_node_type* x) + {return final().replace_(k,x);} + + template<typename Modifier> + bool final_modify_(Modifier& mod,final_node_type* x) + {return final().modify_(mod,x);} + + template<typename Modifier,typename Rollback> + bool final_modify_(Modifier& mod,Rollback& back,final_node_type* x) + {return final().modify_(mod,back,x);} + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + void final_check_invariant_()const{final().check_invariant_();} +#endif +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/index_loader.hpp b/Utilities/BGL/boost/multi_index/detail/index_loader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..001c01bb204d735ee863a2054a6fe3007e282372 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/index_loader.hpp @@ -0,0 +1,138 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_LOADER_HPP +#define BOOST_MULTI_INDEX_DETAIL_INDEX_LOADER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/archive/archive_exception.hpp> +#include <boost/noncopyable.hpp> +#include <boost/multi_index/detail/auto_space.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/throw_exception.hpp> +#include <cstddef> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Counterpart of index_saver (check index_saver.hpp for serialization + * details.)* multi_index_container is in charge of supplying the info about + * the base sequence, and each index can subsequently load itself using the + * const interface of index_loader. + */ + +template<typename Node,typename FinalNode,typename Allocator> +class index_loader:private noncopyable +{ +public: + index_loader(const Allocator& al,std::size_t size): + spc(al,size),size_(size),n(0),sorted(false) + { + } + + template<class Archive> + void add(Node* node,Archive& ar,const unsigned int) + { + ar>>serialization::make_nvp("position",*node); + entries()[n++]=node; + } + + template<class Archive> + void add_track(Node* node,Archive& ar,const unsigned int) + { + ar>>serialization::make_nvp("position",*node); + } + + /* A rearranger is passed two nodes, and is expected to + * reposition the second after the first. + * If the first node is 0, then the second should be moved + * to the beginning of the sequence. + */ + + template<typename Rearranger,class Archive> + void load(Rearranger r,Archive& ar,const unsigned int)const + { + FinalNode* prev=unchecked_load_node(ar); + if(!prev)return; + + if(!sorted){ + std::sort(entries(),entries()+size_); + sorted=true; + } + + check_node(prev); + + for(;;){ + for(;;){ + FinalNode* node=load_node(ar); + if(!node)break; + + if(node==prev)prev=0; + r(prev,node); + + prev=node; + } + prev=load_node(ar); + if(!prev)break; + } + } + +private: + Node** entries()const{return &*spc.data();} + + /* We try to delay sorting as much as possible just in case it + * is not necessary, hence this version of load_node. + */ + + template<class Archive> + FinalNode* unchecked_load_node(Archive& ar)const + { + Node* node=0; + ar>>serialization::make_nvp("pointer",node); + return static_cast<FinalNode*>(node); + } + + template<class Archive> + FinalNode* load_node(Archive& ar)const + { + Node* node=0; + ar>>serialization::make_nvp("pointer",node); + check_node(node); + return static_cast<FinalNode*>(node); + } + + void check_node(Node* node)const + { + if(node!=0&&!std::binary_search(entries(),entries()+size_,node)){ + throw_exception( + archive::archive_exception( + archive::archive_exception::other_exception)); + } + } + + auto_space<Node*,Allocator> spc; + std::size_t size_; + std::size_t n; + mutable bool sorted; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/index_matcher.hpp b/Utilities/BGL/boost/multi_index/detail/index_matcher.hpp new file mode 100644 index 0000000000000000000000000000000000000000..582813730c5676784f70ee36a66214cf47475550 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/index_matcher.hpp @@ -0,0 +1,248 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_MATCHER_HPP +#define BOOST_MULTI_INDEX_DETAIL_INDEX_MATCHER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/noncopyable.hpp> +#include <boost/multi_index/detail/auto_space.hpp> +#include <cstddef> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* index_matcher compares a sequence of elements against a + * base sequence, identifying those elements that belong to the + * longest subsequence which is ordered with respect to the base. + * For instance, if the base sequence is: + * + * 0 1 2 3 4 5 6 7 8 9 + * + * and the compared sequence (not necesarilly the same length): + * + * 1 4 2 3 0 7 8 9 + * + * the elements of the longest ordered subsequence are: + * + * 1 2 3 7 8 9 + * + * The algorithm for obtaining such a subsequence is called + * Patience Sorting, described in ch. 1 of: + * Aldous, D., Diaconis, P.: "Longest increasing subsequences: from + * patience sorting to the Baik-Deift-Johansson Theorem", Bulletin + * of the American Mathematical Society, vol. 36, no 4, pp. 413-432, + * July 1999. + * http://www.ams.org/bull/1999-36-04/S0273-0979-99-00796-X/ + * S0273-0979-99-00796-X.pdf + * + * This implementation is not fully generic since it assumes that + * the sequences given are pointed to by index iterators (having a + * get_node() memfun.) + */ + +namespace index_matcher{ + +/* The algorithm stores the nodes of the base sequence and a number + * of "piles" that are dynamically updated during the calculation + * stage. From a logical point of view, nodes form an independent + * sequence from piles. They are stored together so as to minimize + * allocated memory. + */ + +struct entry +{ + entry(void* node_,std::size_t pos_=0):node(node_),pos(pos_){} + + /* node stuff */ + + void* node; + std::size_t pos; + entry* previous; + bool ordered; + + struct less_by_node + { + bool operator()( + const entry& x,const entry& y)const + { + return std::less<void*>()(x.node,y.node); + } + }; + + /* pile stuff */ + + std::size_t pile_top; + entry* pile_top_entry; + + struct less_by_pile_top + { + bool operator()( + const entry& x,const entry& y)const + { + return x.pile_top<y.pile_top; + } + }; +}; + +/* common code operating on void *'s */ + +template<typename Allocator> +class algorithm_base:private noncopyable +{ +protected: + algorithm_base(const Allocator& al,std::size_t size): + spc(al,size),size_(size),n(0),sorted(false) + { + } + + void add(void* node) + { + entries()[n]=entry(node,n); + ++n; + } + + void begin_algorithm()const + { + if(!sorted){ + std::sort(entries(),entries()+size_,entry::less_by_node()); + sorted=true; + } + num_piles=0; + } + + void add_node_to_algorithm(void* node)const + { + entry* ent= + std::lower_bound( + entries(),entries()+size_, + entry(node),entry::less_by_node()); /* localize entry */ + ent->ordered=false; + std::size_t n=ent->pos; /* get its position */ + + entry dummy(0); + dummy.pile_top=n; + + entry* pile_ent= /* find the first available pile */ + std::lower_bound( /* to stack the entry */ + entries(),entries()+num_piles, + dummy,entry::less_by_pile_top()); + + pile_ent->pile_top=n; /* stack the entry */ + pile_ent->pile_top_entry=ent; + + /* if not the first pile, link entry to top of the preceding pile */ + if(pile_ent>&entries()[0]){ + ent->previous=(pile_ent-1)->pile_top_entry; + } + + if(pile_ent==&entries()[num_piles]){ /* new pile? */ + ++num_piles; + } + } + + void finish_algorithm()const + { + if(num_piles>0){ + /* Mark those elements which are in their correct position, i.e. those + * belonging to the longest increasing subsequence. These are those + * elements linked from the top of the last pile. + */ + + entry* ent=entries()[num_piles-1].pile_top_entry; + for(std::size_t n=num_piles;n--;){ + ent->ordered=true; + ent=ent->previous; + } + } + } + + bool is_ordered(void * node)const + { + return std::lower_bound( + entries(),entries()+size_, + entry(node),entry::less_by_node())->ordered; + } + +private: + entry* entries()const{return &*spc.data();} + + auto_space<entry,Allocator> spc; + std::size_t size_; + std::size_t n; + mutable bool sorted; + mutable std::size_t num_piles; +}; + +/* The algorithm has three phases: + * - Initialization, during which the nodes of the base sequence are added. + * - Execution. + * - Results querying, through the is_ordered memfun. + */ + +template<typename Node,typename Allocator> +class algorithm:private algorithm_base<Allocator> +{ + typedef algorithm_base<Allocator> super; + +public: + algorithm(const Allocator& al,std::size_t size):super(al,size){} + + void add(Node* node) + { + super::add(node); + } + + template<typename IndexIterator> + void execute(IndexIterator first,IndexIterator last)const + { + super::begin_algorithm(); + + for(IndexIterator it=first;it!=last;++it){ + add_node_to_algorithm(get_node(it)); + } + + super::finish_algorithm(); + } + + bool is_ordered(Node* node)const + { + return super::is_ordered(node); + } + +private: + void add_node_to_algorithm(Node* node)const + { + super::add_node_to_algorithm(node); + } + + template<typename IndexIterator> + static Node* get_node(IndexIterator it) + { + return static_cast<Node*>(it.get_node()); + } +}; + +} /* namespace multi_index::detail::index_matcher */ + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/index_node_base.hpp b/Utilities/BGL/boost/multi_index/detail/index_node_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ee9f1c67f88de688d8a11b45a620aa4c345c8c4b --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/index_node_base.hpp @@ -0,0 +1,135 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_NODE_BASE_HPP +#define BOOST_MULTI_INDEX_DETAIL_INDEX_NODE_BASE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/type_traits/aligned_storage.hpp> +#include <boost/type_traits/alignment_of.hpp> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/archive/archive_exception.hpp> +#include <boost/serialization/access.hpp> +#include <boost/throw_exception.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* index_node_base tops the node hierarchy of multi_index_container. It holds + * the value of the element contained. + */ + +template<typename Value> +struct pod_value_holder +{ + typename aligned_storage< + sizeof(Value), + alignment_of<Value>::value + >::type space; +}; + +template<typename Value,typename Allocator> +struct index_node_base:private pod_value_holder<Value> +{ + typedef index_node_base base_type; /* used for serialization purposes */ + typedef Value value_type; + typedef Allocator allocator_type; + + value_type& value() + { + return *static_cast<value_type*>( + static_cast<void*>(&this->space)); + } + + const value_type& value()const + { + return *static_cast<const value_type*>( + static_cast<const void*>(&this->space)); + } + + static index_node_base* from_value(const value_type* p) + { + return static_cast<index_node_base *>( + reinterpret_cast<pod_value_holder<Value>*>( /* std 9.2.17 */ + const_cast<value_type*>(p))); + } + +private: +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + friend class boost::serialization::access; + + /* nodes do not emit any kind of serialization info. They are + * fed to Boost.Serialization so that pointers to nodes are + * tracked correctly. + */ + + template<class Archive> + void serialize(Archive&,const unsigned int) + { + } +#endif +}; + +template<typename Node,typename Value> +Node* node_from_value( + const Value* p + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Node)) +{ + typedef typename Node::allocator_type allocator_type; + return static_cast<Node*>( + index_node_base<Value,allocator_type>::from_value(p)); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +/* Index nodes never get constructed directly by Boost.Serialization, + * as archives are always fed pointers to previously existent + * nodes. So, if this is called it means we are dealing with a + * somehow invalid archive. + */ + +#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +namespace serialization{ +#else +namespace multi_index{ +namespace detail{ +#endif + +template<class Archive,typename Value,typename Allocator> +inline void load_construct_data( + Archive&,boost::multi_index::detail::index_node_base<Value,Allocator>*, + const unsigned int) +{ + throw_exception( + archive::archive_exception(archive::archive_exception::other_exception)); +} + +#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) +} /* namespace serialization */ +#else +} /* namespace multi_index::detail */ +} /* namespace multi_index */ +#endif + +#endif + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/index_saver.hpp b/Utilities/BGL/boost/multi_index/detail/index_saver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d9e6bc7ccc1018d81a6248f804c3191dea2352b3 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/index_saver.hpp @@ -0,0 +1,135 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_SAVER_HPP +#define BOOST_MULTI_INDEX_DETAIL_INDEX_SAVER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/multi_index/detail/index_matcher.hpp> +#include <boost/noncopyable.hpp> +#include <boost/serialization/nvp.hpp> +#include <cstddef> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* index_saver accepts a base sequence of previously saved elements + * and saves a possibly reordered subsequence in an efficient manner, + * serializing only the information needed to rearrange the subsequence + * based on the original order of the base. + * multi_index_container is in charge of supplying the info about the + * base sequence, and each index can subsequently save itself using the + * const interface of index_saver. + */ + +template<typename Node,typename Allocator> +class index_saver:private noncopyable +{ +public: + index_saver(const Allocator& al,std::size_t size):alg(al,size){} + + template<class Archive> + void add(Node* node,Archive& ar,const unsigned int) + { + ar<<serialization::make_nvp("position",*node); + alg.add(node); + } + + template<class Archive> + void add_track(Node* node,Archive& ar,const unsigned int) + { + ar<<serialization::make_nvp("position",*node); + } + + template<typename IndexIterator,class Archive> + void save( + IndexIterator first,IndexIterator last,Archive& ar, + const unsigned int)const + { + /* calculate ordered positions */ + + alg.execute(first,last); + + /* Given a consecutive subsequence of displaced elements + * x1,...,xn, the following information is serialized: + * + * p0,p1,...,pn,0 + * + * where pi is a pointer to xi and p0 is a pointer to the element + * preceding x1. Crealy, from this information is possible to + * restore the original order on loading time. If x1 is the first + * element in the sequence, the following is serialized instead: + * + * p1,p1,...,pn,0 + * + * For each subsequence of n elements, n+2 pointers are serialized. + * An optimization policy is applied: consider for instance the + * sequence + * + * a,B,c,D + * + * where B and D are displaced, but c is in its correct position. + * Applying the schema described above we would serialize 6 pointers: + * + * p(a),p(B),0 + * p(c),p(D),0 + * + * but this can be reduced to 5 pointers by treating c as a displaced + * element: + * + * p(a),p(B),p(c),p(D),0 + */ + + std::size_t last_saved=3; /* distance to last pointer saved */ + for(IndexIterator it=first,prev=first;it!=last;prev=it++,++last_saved){ + if(!alg.is_ordered(get_node(it))){ + if(last_saved>1)save_node(get_node(prev),ar); + save_node(get_node(it),ar); + last_saved=0; + } + else if(last_saved==2)save_node(null_node(),ar); + } + if(last_saved<=2)save_node(null_node(),ar); + + /* marks the end of the serialization info for [first,last) */ + + save_node(null_node(),ar); + } + +private: + template<typename IndexIterator> + static Node* get_node(IndexIterator it) + { + return it.get_node(); + } + + static Node* null_node(){return 0;} + + template<typename Archive> + static void save_node(Node* node,Archive& ar) + { + ar<<serialization::make_nvp("pointer",node); + } + + index_matcher::algorithm<Node,Allocator> alg; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/invariant_assert.hpp b/Utilities/BGL/boost/multi_index/detail/invariant_assert.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d5fc256d8dbe86c6e8f583e9bcd4cd3daf80e133 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/invariant_assert.hpp @@ -0,0 +1,21 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_INVARIANT_ASSERT_HPP +#define BOOST_MULTI_INDEX_DETAIL_INVARIANT_ASSERT_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#if !defined(BOOST_MULTI_INDEX_INVARIANT_ASSERT) +#include <boost/assert.hpp> +#define BOOST_MULTI_INDEX_INVARIANT_ASSERT BOOST_ASSERT +#endif + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/is_index_list.hpp b/Utilities/BGL/boost/multi_index/detail/is_index_list.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9ee30baf2169364ba85e43cc597520b8baece840 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/is_index_list.hpp @@ -0,0 +1,40 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_IS_INDEX_LIST_HPP +#define BOOST_MULTI_INDEX_DETAIL_IS_INDEX_LIST_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/empty.hpp> +#include <boost/mpl/is_sequence.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template<typename T> +struct is_index_list +{ + BOOST_STATIC_CONSTANT(bool,mpl_sequence=mpl::is_sequence<T>::value); + BOOST_STATIC_CONSTANT(bool,non_empty=!mpl::empty<T>::value); + BOOST_STATIC_CONSTANT(bool,value=mpl_sequence&&non_empty); +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/iter_adaptor.hpp b/Utilities/BGL/boost/multi_index/detail/iter_adaptor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..034618458c69acf6187f5d800d288a45a6b77ce9 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/iter_adaptor.hpp @@ -0,0 +1,325 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_ITER_ADAPTOR_HPP +#define BOOST_MULTI_INDEX_DETAIL_ITER_ADAPTOR_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/apply.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/operators.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Poor man's version of boost::iterator_adaptor. Used instead of the + * original as compile times for the latter are significantly higher. + * The interface is not replicated exactly, only to the extent necessary + * for internal consumption. + */ + +/* NB. The purpose of the (non-inclass) global operators ==, < and - defined + * above is to partially alleviate a problem of MSVC++ 6.0 by * which + * friend-injected operators on T are not visible if T is instantiated only + * in template code where T is a dependent type. + */ + +class iter_adaptor_access +{ +public: + template<class Class> + static typename Class::reference dereference(const Class& x) + { + return x.dereference(); + } + + template<class Class> + static bool equal(const Class& x,const Class& y) + { + return x.equal(y); + } + + template<class Class> + static void increment(Class& x) + { + x.increment(); + } + + template<class Class> + static void decrement(Class& x) + { + x.decrement(); + } + + template<class Class> + static void advance(Class& x,typename Class::difference_type n) + { + x.advance(n); + } + + template<class Class> + static typename Class::difference_type distance_to( + const Class& x,const Class& y) + { + return x.distance_to(y); + } +}; + +template<typename Category> +struct iter_adaptor_selector; + +template<class Derived,class Base> +class forward_iter_adaptor_base: + public forward_iterator_helper< + Derived, + typename Base::value_type, + typename Base::difference_type, + typename Base::pointer, + typename Base::reference> +{ +public: + typedef typename Base::reference reference; + + reference operator*()const + { + return iter_adaptor_access::dereference(final()); + } + + friend bool operator==(const Derived& x,const Derived& y) + { + return iter_adaptor_access::equal(x,y); + } + + Derived& operator++() + { + iter_adaptor_access::increment(final()); + return final(); + } + +private: + Derived& final(){return *static_cast<Derived*>(this);} + const Derived& final()const{return *static_cast<const Derived*>(this);} +}; + +template<class Derived,class Base> +bool operator==( + const forward_iter_adaptor_base<Derived,Base>& x, + const forward_iter_adaptor_base<Derived,Base>& y) +{ + return iter_adaptor_access::equal( + static_cast<const Derived&>(x),static_cast<const Derived&>(y)); +} + +template<> +struct iter_adaptor_selector<std::forward_iterator_tag> +{ + template<class Derived,class Base> + struct apply + { + typedef forward_iter_adaptor_base<Derived,Base> type; + }; +}; + +template<class Derived,class Base> +class bidirectional_iter_adaptor_base: + public bidirectional_iterator_helper< + Derived, + typename Base::value_type, + typename Base::difference_type, + typename Base::pointer, + typename Base::reference> +{ +public: + typedef typename Base::reference reference; + + reference operator*()const + { + return iter_adaptor_access::dereference(final()); + } + + friend bool operator==(const Derived& x,const Derived& y) + { + return iter_adaptor_access::equal(x,y); + } + + Derived& operator++() + { + iter_adaptor_access::increment(final()); + return final(); + } + + Derived& operator--() + { + iter_adaptor_access::decrement(final()); + return final(); + } + +private: + Derived& final(){return *static_cast<Derived*>(this);} + const Derived& final()const{return *static_cast<const Derived*>(this);} +}; + +template<class Derived,class Base> +bool operator==( + const bidirectional_iter_adaptor_base<Derived,Base>& x, + const bidirectional_iter_adaptor_base<Derived,Base>& y) +{ + return iter_adaptor_access::equal( + static_cast<const Derived&>(x),static_cast<const Derived&>(y)); +} + +template<> +struct iter_adaptor_selector<std::bidirectional_iterator_tag> +{ + template<class Derived,class Base> + struct apply + { + typedef bidirectional_iter_adaptor_base<Derived,Base> type; + }; +}; + +template<class Derived,class Base> +class random_access_iter_adaptor_base: + public random_access_iterator_helper< + Derived, + typename Base::value_type, + typename Base::difference_type, + typename Base::pointer, + typename Base::reference> +{ +public: + typedef typename Base::reference reference; + typedef typename Base::difference_type difference_type; + + reference operator*()const + { + return iter_adaptor_access::dereference(final()); + } + + friend bool operator==(const Derived& x,const Derived& y) + { + return iter_adaptor_access::equal(x,y); + } + + friend bool operator<(const Derived& x,const Derived& y) + { + return iter_adaptor_access::distance_to(x,y)>0; + } + + Derived& operator++() + { + iter_adaptor_access::increment(final()); + return final(); + } + + Derived& operator--() + { + iter_adaptor_access::decrement(final()); + return final(); + } + + Derived& operator+=(difference_type n) + { + iter_adaptor_access::advance(final(),n); + return final(); + } + + Derived& operator-=(difference_type n) + { + iter_adaptor_access::advance(final(),-n); + return final(); + } + + friend difference_type operator-(const Derived& x,const Derived& y) + { + return iter_adaptor_access::distance_to(y,x); + } + +private: + Derived& final(){return *static_cast<Derived*>(this);} + const Derived& final()const{return *static_cast<const Derived*>(this);} +}; + +template<class Derived,class Base> +bool operator==( + const random_access_iter_adaptor_base<Derived,Base>& x, + const random_access_iter_adaptor_base<Derived,Base>& y) +{ + return iter_adaptor_access::equal( + static_cast<const Derived&>(x),static_cast<const Derived&>(y)); +} + +template<class Derived,class Base> +bool operator<( + const random_access_iter_adaptor_base<Derived,Base>& x, + const random_access_iter_adaptor_base<Derived,Base>& y) +{ + return iter_adaptor_access::distance_to( + static_cast<const Derived&>(x),static_cast<const Derived&>(y))>0; +} + +template<class Derived,class Base> +typename random_access_iter_adaptor_base<Derived,Base>::difference_type +operator-( + const random_access_iter_adaptor_base<Derived,Base>& x, + const random_access_iter_adaptor_base<Derived,Base>& y) +{ + return iter_adaptor_access::distance_to( + static_cast<const Derived&>(y),static_cast<const Derived&>(x)); +} + +template<> +struct iter_adaptor_selector<std::random_access_iterator_tag> +{ + template<class Derived,class Base> + struct apply + { + typedef random_access_iter_adaptor_base<Derived,Base> type; + }; +}; + +template<class Derived,class Base> +struct iter_adaptor_base +{ + typedef iter_adaptor_selector< + typename Base::iterator_category> selector; + typedef typename prevent_eti< + selector, + typename mpl::apply2< + selector,Derived,Base>::type + >::type type; +}; + +template<class Derived,class Base> +class iter_adaptor:public iter_adaptor_base<Derived,Base>::type +{ +protected: + iter_adaptor(){} + explicit iter_adaptor(const Base& b_):b(b_){} + + const Base& base_reference()const{return b;} + Base& base_reference(){return b;} + +private: + Base b; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/modify_key_adaptor.hpp b/Utilities/BGL/boost/multi_index/detail/modify_key_adaptor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8a93b9648f01c68784efd864b49b83c22f09d3b1 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/modify_key_adaptor.hpp @@ -0,0 +1,49 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP +#define BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Functional adaptor to resolve modify_key as a call to modify. + * Preferred over compose_f_gx and stuff cause it eliminates problems + * with references to references, dealing with function pointers, etc. + */ + +template<typename Fun,typename Value,typename KeyFromValue> +struct modify_key_adaptor +{ + + modify_key_adaptor(Fun f_,KeyFromValue kfv_):f(f_),kfv(kfv_){} + + void operator()(Value& x) + { + f(kfv(x)); + } + +private: + Fun f; + KeyFromValue kfv; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/msvc_index_specifier.hpp b/Utilities/BGL/boost/multi_index/detail/msvc_index_specifier.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4766e539af80f70a5b01c7afbcbd507087124c61 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/msvc_index_specifier.hpp @@ -0,0 +1,69 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_MSVC_INDEX_SPECIFIER_HPP +#define BOOST_MULTI_INDEX_DETAIL_MSVC_INDEX_SPECIFIER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC,<1310) +/* Workaround for a problem in MSVC with dependent template typedefs + * when accesing index specifiers. + * Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!) + */ + +#include <boost/mpl/aux_/msvc_never_true.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template<typename IndexSpecifier> +struct msvc_index_specifier +{ + template<bool> struct fake_index_type:IndexSpecifier{}; + template<> struct fake_index_type<true> + { + template<typename Super> + struct node_class{}; + + template<typename Super> + struct index_class{}; + }; + + template<typename Super> + struct result_node_class: + fake_index_type<mpl::aux::msvc_never_true<IndexSpecifier>::value>:: + template node_class<Super> + { + }; + + template<typename Super> + struct result_index_class: + fake_index_type<mpl::aux::msvc_never_true<IndexSpecifier>::value>:: + template index_class<Super> + { + }; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif /* workaround */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/no_duplicate_tags.hpp b/Utilities/BGL/boost/multi_index/detail/no_duplicate_tags.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b56e8371ff6a38c44b77b01c8ecd42d2ed16314 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/no_duplicate_tags.hpp @@ -0,0 +1,97 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_NO_DUPLICATE_TAGS_HPP +#define BOOST_MULTI_INDEX_DETAIL_NO_DUPLICATE_TAGS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/fold.hpp> +#include <boost/mpl/set/set0.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* no_duplicate_tags check at compile-time that a tag list + * has no duplicate tags. + * The algorithm deserves some explanation: tags + * are sequentially inserted into a mpl::set if they were + * not already present. Due to the magic of mpl::set + * (mpl::has_key is contant time), this operation takes linear + * time, and even MSVC++ 6.5 handles it gracefully (other obvious + * solutions are quadratic.) + */ + +struct duplicate_tag_mark{}; + +struct duplicate_tag_marker +{ + template <typename MplSet,typename Tag> + struct apply + { + typedef mpl::s_item< + typename mpl::if_<mpl::has_key<MplSet,Tag>,duplicate_tag_mark,Tag>::type, + MplSet + > type; + }; +}; + +template<typename TagList> +struct no_duplicate_tags +{ + typedef typename mpl::fold< + TagList, + mpl::set0<>, + duplicate_tag_marker + >::type aux; + + BOOST_STATIC_CONSTANT( + bool,value=!(mpl::has_key<aux,duplicate_tag_mark>::value)); +}; + +/* Variant for an index list: duplication is checked + * across all the indices. + */ + +struct duplicate_tag_list_marker +{ + template <typename MplSet,typename Index> + struct apply:mpl::fold< + BOOST_DEDUCED_TYPENAME Index::tag_list, + MplSet, + duplicate_tag_marker> + { + }; +}; + +template<typename IndexList> +struct no_duplicate_tags_in_index_list +{ + typedef typename mpl::fold< + IndexList, + mpl::set0<>, + duplicate_tag_list_marker + >::type aux; + + BOOST_STATIC_CONSTANT( + bool,value=!(mpl::has_key<aux,duplicate_tag_mark>::value)); +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/node_type.hpp b/Utilities/BGL/boost/multi_index/detail/node_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0e87261aace1b001c3feb7aa5582624cb28ed218 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/node_type.hpp @@ -0,0 +1,79 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_NODE_TYPE_HPP +#define BOOST_MULTI_INDEX_DETAIL_NODE_TYPE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/workaround.hpp> +#include <boost/mpl/bind.hpp> +#include <boost/mpl/reverse_iter_fold.hpp> +#include <boost/mpl/deref.hpp> +#include <boost/multi_index_container_fwd.hpp> +#include <boost/multi_index/detail/header_holder.hpp> +#include <boost/multi_index/detail/index_node_base.hpp> +#include <boost/multi_index/detail/is_index_list.hpp> +#include <boost/multi_index/detail/msvc_index_specifier.hpp> +#include <boost/static_assert.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* MPL machinery to construct the internal node type associated to an + * index list. + */ + +#if BOOST_WORKAROUND(BOOST_MSVC,<1310) +struct index_node_applier +{ + template<typename IndexSpecifierIterator,typename Super> + struct apply: + msvc_index_specifier< mpl::deref<IndexSpecifierIterator>::type >:: + template result_node_class<Super> + { + }; +}; +#else +struct index_node_applier +{ + template<typename IndexSpecifierIterator,typename Super> + struct apply + { + typedef typename mpl::deref<IndexSpecifierIterator>::type index_specifier; + typedef typename index_specifier:: + BOOST_NESTED_TEMPLATE node_class<Super>::type type; + }; +}; +#endif + +template<typename Value,typename IndexSpecifierList,typename Allocator> +struct multi_index_node_type +{ + BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value); + + typedef typename mpl::reverse_iter_fold< + IndexSpecifierList, + index_node_base<Value,Allocator>, + mpl::bind2<index_node_applier,mpl::_2,mpl::_1> + >::type type; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/ord_index_args.hpp b/Utilities/BGL/boost/multi_index/detail/ord_index_args.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bb8eb4129e891eadddc4c02f57d6bc197028ba67 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/ord_index_args.hpp @@ -0,0 +1,83 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_ARGS_HPP +#define BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_ARGS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/aux_/na.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/if.hpp> +#include <boost/multi_index/tag.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/is_same.hpp> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Oredered index specifiers can be instantiated in two forms: + * + * (ordered_unique|ordered_non_unique)< + * KeyFromValue,Compare=std::less<KeyFromValue::result_type> > + * (ordered_unique|ordered_non_unique)< + * TagList,KeyFromValue,Compare=std::less<KeyFromValue::result_type> > + * + * index_args implements the machinery to accept this argument-dependent + * polymorphism. + */ + +template<typename KeyFromValue> +struct index_args_default_compare +{ + typedef std::less<typename KeyFromValue::result_type> type; +}; + +template<typename Arg1,typename Arg2,typename Arg3> +struct ordered_index_args +{ + typedef is_tag<Arg1> full_form; + + typedef typename mpl::if_< + full_form, + Arg1, + tag< > >::type tag_list_type; + typedef typename mpl::if_< + full_form, + Arg2, + Arg1>::type key_from_value_type; + typedef typename mpl::if_< + full_form, + Arg3, + Arg2>::type supplied_compare_type; + typedef typename mpl::eval_if< + mpl::is_na<supplied_compare_type>, + index_args_default_compare<key_from_value_type>, + mpl::identity<supplied_compare_type> + >::type compare_type; + + BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value); + BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value); + BOOST_STATIC_ASSERT(!mpl::is_na<compare_type>::value); +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/ord_index_node.hpp b/Utilities/BGL/boost/multi_index/detail/ord_index_node.hpp new file mode 100644 index 0000000000000000000000000000000000000000..edc4329dd2ff06340efa7c7cf6bdcf3f6cd5582d --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/ord_index_node.hpp @@ -0,0 +1,650 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + * + * The internal implementation of red-black trees is based on that of SGI STL + * stl_tree.h file: + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_NODE_HPP +#define BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_NODE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <cstddef> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES) +#include <boost/mpl/and.hpp> +#include <boost/mpl/if.hpp> +#include <boost/multi_index/detail/uintptr_type.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <boost/type_traits/is_same.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* definition of red-black nodes for ordered_index */ + +enum ordered_index_color{red=false,black=true}; +enum ordered_index_side{to_left=false,to_right=true}; + +template<typename Allocator> +struct ordered_index_node_impl; /* fwd decl. */ + +template<typename Allocator> +struct ordered_index_node_std_base +{ + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator, + ordered_index_node_impl<Allocator> + >::type + >::type::pointer pointer; + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator, + ordered_index_node_impl<Allocator> + >::type + >::type::const_pointer const_pointer; + typedef ordered_index_color& color_ref; + typedef pointer& parent_ref; + + ordered_index_color& color(){return color_;} + ordered_index_color color()const{return color_;} + pointer& parent(){return parent_;} + pointer parent()const{return parent_;} + pointer& left(){return left_;} + pointer left()const{return left_;} + pointer& right(){return right_;} + pointer right()const{return right_;} + +private: + ordered_index_color color_; + pointer parent_; + pointer left_; + pointer right_; +}; + +#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES) +/* If ordered_index_node_impl has even alignment, we can use the least + * significant bit of one of the ordered_index_node_impl pointers to + * store color information. This typically reduces the size of + * ordered_index_node_impl by 25%. + */ + +#if defined(BOOST_MSVC) +/* This code casts pointers to an integer type that has been computed + * to be large enough to hold the pointer, however the metaprogramming + * logic is not always spotted by the VC++ code analyser that issues a + * long list of warnings. + */ + +#pragma warning(push) +#pragma warning(disable:4312 4311) +#endif + +template<typename Allocator> +struct ordered_index_node_compressed_base +{ + typedef ordered_index_node_impl<Allocator>* pointer; + typedef const ordered_index_node_impl<Allocator>* const_pointer; + + struct color_ref + { + color_ref(uintptr_type* r_):r(r_){} + + operator ordered_index_color()const + { + return ordered_index_color(*r&uintptr_type(1)); + } + + color_ref& operator=(ordered_index_color c) + { + *r&=~uintptr_type(1); + *r|=uintptr_type(c); + return *this; + } + + color_ref& operator=(const color_ref& x) + { + return operator=(x.operator ordered_index_color()); + } + + private: + uintptr_type* r; + }; + + struct parent_ref + { + parent_ref(uintptr_type* r_):r(r_){} + + operator pointer()const + { + return (pointer)(void*)(*r&~uintptr_type(1)); + } + + parent_ref& operator=(pointer p) + { + *r=((uintptr_type)(void*)p)|(*r&uintptr_type(1)); + return *this; + } + + parent_ref& operator=(const parent_ref& x) + { + return operator=(x.operator pointer()); + } + + pointer operator->()const + { + return operator pointer(); + } + + private: + uintptr_type* r; + }; + + color_ref color(){return color_ref(&parentcolor_);} + ordered_index_color color()const + { + return ordered_index_color(parentcolor_&std::size_t(1ul)); + } + + parent_ref parent(){return parent_ref(&parentcolor_);} + pointer parent()const + { + return (pointer)(void*)(parentcolor_&~uintptr_type(1)); + } + + pointer& left(){return left_;} + pointer left()const{return left_;} + pointer& right(){return right_;} + pointer right()const{return right_;} + +private: + uintptr_type parentcolor_; + pointer left_; + pointer right_; +}; +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif +#endif + +template<typename Allocator> +struct ordered_index_node_impl_base: + +#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES) + mpl::if_c< + !(has_uintptr_type::value)|| + (alignment_of<ordered_index_node_compressed_base<Allocator> >::value%2)|| + !(is_same< + typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator, + ordered_index_node_impl<Allocator> + >::type + >::type::pointer, + ordered_index_node_impl<Allocator>*>::value), + ordered_index_node_std_base<Allocator>, + ordered_index_node_compressed_base<Allocator> + >::type +#else + ordered_index_node_std_base<Allocator> +#endif + +{}; + +template<typename Allocator> +struct ordered_index_node_impl:ordered_index_node_impl_base<Allocator> +{ +private: + typedef ordered_index_node_impl_base<Allocator> super; + +public: + typedef typename super::color_ref color_ref; + typedef typename super::parent_ref parent_ref; + typedef typename super::pointer pointer; + typedef typename super::const_pointer const_pointer; + + /* interoperability with bidir_node_iterator */ + + static void increment(pointer& x) + { + if(x->right()!=pointer(0)){ + x=x->right(); + while(x->left()!=pointer(0))x=x->left(); + } + else{ + pointer y=x->parent(); + while(x==y->right()){ + x=y; + y=y->parent(); + } + if(x->right()!=y)x=y; + } + } + + static void decrement(pointer& x) + { + if(x->color()==red&&x->parent()->parent()==x){ + x=x->right(); + } + else if(x->left()!=pointer(0)){ + pointer y=x->left(); + while(y->right()!=pointer(0))y=y->right(); + x=y; + }else{ + pointer y=x->parent(); + while(x==y->left()){ + x=y; + y=y->parent(); + } + x=y; + } + } + + /* algorithmic stuff */ + + static void rotate_left(pointer x,parent_ref root) + { + pointer y=x->right(); + x->right()=y->left(); + if(y->left()!=pointer(0))y->left()->parent()=x; + y->parent()=x->parent(); + + if(x==root) root=y; + else if(x==x->parent()->left())x->parent()->left()=y; + else x->parent()->right()=y; + y->left()=x; + x->parent()=y; + } + + static pointer minimum(pointer x) + { + while(x->left()!=pointer(0))x=x->left(); + return x; + } + + static pointer maximum(pointer x) + { + while(x->right()!=pointer(0))x=x->right(); + return x; + } + + static void rotate_right(pointer x,parent_ref root) + { + pointer y=x->left(); + x->left()=y->right(); + if(y->right()!=pointer(0))y->right()->parent()=x; + y->parent()=x->parent(); + + if(x==root) root=y; + else if(x==x->parent()->right())x->parent()->right()=y; + else x->parent()->left()=y; + y->right()=x; + x->parent()=y; + } + + static void rebalance(pointer x,parent_ref root) + { + x->color()=red; + while(x!=root&&x->parent()->color()==red){ + if(x->parent()==x->parent()->parent()->left()){ + pointer y=x->parent()->parent()->right(); + if(y!=pointer(0)&&y->color()==red){ + x->parent()->color()=black; + y->color()=black; + x->parent()->parent()->color()=red; + x=x->parent()->parent(); + } + else{ + if(x==x->parent()->right()){ + x=x->parent(); + rotate_left(x,root); + } + x->parent()->color()=black; + x->parent()->parent()->color()=red; + rotate_right(x->parent()->parent(),root); + } + } + else{ + pointer y=x->parent()->parent()->left(); + if(y!=pointer(0)&&y->color()==red){ + x->parent()->color()=black; + y->color()=black; + x->parent()->parent()->color()=red; + x=x->parent()->parent(); + } + else{ + if(x==x->parent()->left()){ + x=x->parent(); + rotate_right(x,root); + } + x->parent()->color()=black; + x->parent()->parent()->color()=red; + rotate_left(x->parent()->parent(),root); + } + } + } + root->color()=black; + } + + static void link( + pointer x,ordered_index_side side,pointer position,pointer header) + { + if(side==to_left){ + position->left()=x; /* also makes leftmost=x when parent==header */ + if(position==header){ + header->parent()=x; + header->right()=x; + } + else if(position==header->left()){ + header->left()=x; /* maintain leftmost pointing to min node */ + } + } + else{ + position->right()=x; + if(position==header->right()){ + header->right()=x; /* maintain rightmost pointing to max node */ + } + } + x->parent()=position; + x->left()=pointer(0); + x->right()=pointer(0); + ordered_index_node_impl::rebalance(x,header->parent()); + } + + static pointer rebalance_for_erase( + pointer z,parent_ref root,pointer& leftmost,pointer& rightmost) + { + pointer y=z; + pointer x=pointer(0); + pointer x_parent=pointer(0); + if(y->left()==pointer(0)){ /* z has at most one non-null child. y==z. */ + x=y->right(); /* x might be null */ + } + else{ + if(y->right()==pointer(0)){ /* z has exactly one non-null child. y==z. */ + x=y->left(); /* x is not null */ + } + else{ /* z has two non-null children. Set y to */ + y=y->right(); /* z's successor. x might be null. */ + while(y->left()!=pointer(0))y=y->left(); + x=y->right(); + } + } + if(y!=z){ + z->left()->parent()=y; /* relink y in place of z. y is z's successor */ + y->left()=z->left(); + if(y!=z->right()){ + x_parent=y->parent(); + if(x!=pointer(0))x->parent()=y->parent(); + y->parent()->left()=x; /* y must be a child of left */ + y->right()=z->right(); + z->right()->parent()=y; + } + else{ + x_parent=y; + } + + if(root==z) root=y; + else if(z->parent()->left()==z)z->parent()->left()=y; + else z->parent()->right()=y; + y->parent()=z->parent(); + ordered_index_color c=y->color(); + y->color()=z->color(); + z->color()=c; + y=z; /* y now points to node to be actually deleted */ + } + else{ /* y==z */ + x_parent=y->parent(); + if(x!=pointer(0))x->parent()=y->parent(); + if(root==z){ + root=x; + } + else{ + if(z->parent()->left()==z)z->parent()->left()=x; + else z->parent()->right()=x; + } + if(leftmost==z){ + if(z->right()==pointer(0)){ /* z->left() must be null also */ + leftmost=z->parent(); + } + else{ + leftmost=minimum(x); /* makes leftmost==header if z==root */ + } + } + if(rightmost==z){ + if(z->left()==pointer(0)){ /* z->right() must be null also */ + rightmost=z->parent(); + } + else{ /* x==z->left() */ + rightmost=maximum(x); /* makes rightmost==header if z==root */ + } + } + } + if(y->color()!=red){ + while(x!=root&&(x==pointer(0)|| x->color()==black)){ + if(x==x_parent->left()){ + pointer w=x_parent->right(); + if(w->color()==red){ + w->color()=black; + x_parent->color()=red; + rotate_left(x_parent,root); + w=x_parent->right(); + } + if((w->left()==pointer(0)||w->left()->color()==black) && + (w->right()==pointer(0)||w->right()->color()==black)){ + w->color()=red; + x=x_parent; + x_parent=x_parent->parent(); + } + else{ + if(w->right()==pointer(0 ) + || w->right()->color()==black){ + if(w->left()!=pointer(0)) w->left()->color()=black; + w->color()=red; + rotate_right(w,root); + w=x_parent->right(); + } + w->color()=x_parent->color(); + x_parent->color()=black; + if(w->right()!=pointer(0))w->right()->color()=black; + rotate_left(x_parent,root); + break; + } + } + else{ /* same as above,with right <-> left */ + pointer w=x_parent->left(); + if(w->color()==red){ + w->color()=black; + x_parent->color()=red; + rotate_right(x_parent,root); + w=x_parent->left(); + } + if((w->right()==pointer(0)||w->right()->color()==black) && + (w->left()==pointer(0)||w->left()->color()==black)){ + w->color()=red; + x=x_parent; + x_parent=x_parent->parent(); + } + else{ + if(w->left()==pointer(0)||w->left()->color()==black){ + if(w->right()!=pointer(0))w->right()->color()=black; + w->color()=red; + rotate_left(w,root); + w=x_parent->left(); + } + w->color()=x_parent->color(); + x_parent->color()=black; + if(w->left()!=pointer(0))w->left()->color()=black; + rotate_right(x_parent,root); + break; + } + } + } + if(x!=pointer(0))x->color()=black; + } + return y; + } + + static void restore(pointer x,pointer position,pointer header) + { + if(position->left()==pointer(0)||position->left()==header){ + link(x,to_left,position,header); + } + else{ + decrement(position); + link(x,to_right,position,header); + } + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + /* invariant stuff */ + + static std::size_t black_count(pointer node,pointer root) + { + if(node==pointer(0))return 0; + std::size_t sum=0; + for(;;){ + if(node->color()==black)++sum; + if(node==root)break; + node=node->parent(); + } + return sum; + } +#endif +}; + +template<typename Super> +struct ordered_index_node_trampoline: + prevent_eti< + Super, + ordered_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type +{ + typedef typename prevent_eti< + Super, + ordered_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type impl_type; +}; + +template<typename Super> +struct ordered_index_node:Super,ordered_index_node_trampoline<Super> +{ +private: + typedef ordered_index_node_trampoline<Super> trampoline; + +public: + typedef typename trampoline::impl_type impl_type; + typedef typename trampoline::color_ref impl_color_ref; + typedef typename trampoline::parent_ref impl_parent_ref; + typedef typename trampoline::pointer impl_pointer; + typedef typename trampoline::const_pointer const_impl_pointer; + + impl_color_ref color(){return trampoline::color();} + ordered_index_color color()const{return trampoline::color();} + impl_parent_ref parent(){return trampoline::parent();} + impl_pointer parent()const{return trampoline::parent();} + impl_pointer& left(){return trampoline::left();} + impl_pointer left()const{return trampoline::left();} + impl_pointer& right(){return trampoline::right();} + impl_pointer right()const{return trampoline::right();} + + impl_pointer impl() + { + return static_cast<impl_pointer>( + static_cast<impl_type*>(static_cast<trampoline*>(this))); + } + + const_impl_pointer impl()const + { + return static_cast<const_impl_pointer>( + static_cast<const impl_type*>(static_cast<const trampoline*>(this))); + } + + static ordered_index_node* from_impl(impl_pointer x) + { + return static_cast<ordered_index_node*>( + static_cast<trampoline*>(&*x)); + } + + static const ordered_index_node* from_impl(const_impl_pointer x) + { + return static_cast<const ordered_index_node*>( + static_cast<const trampoline*>(&*x)); + } + + /* interoperability with bidir_node_iterator */ + + static void increment(ordered_index_node*& x) + { + impl_pointer xi=x->impl(); + trampoline::increment(xi); + x=from_impl(xi); + } + + static void decrement(ordered_index_node*& x) + { + impl_pointer xi=x->impl(); + trampoline::decrement(xi); + x=from_impl(xi); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/ord_index_ops.hpp b/Utilities/BGL/boost/multi_index/detail/ord_index_ops.hpp new file mode 100644 index 0000000000000000000000000000000000000000..caa71aa272a24414077004a9fd7e39d51826a1ba --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/ord_index_ops.hpp @@ -0,0 +1,147 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + * + * The internal implementation of red-black trees is based on that of SGI STL + * stl_tree.h file: + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_OPS_HPP +#define BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_OPS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <utility> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Common code for index memfuns having templatized and + * non-templatized versions. + */ + +template< + typename Node,typename KeyFromValue, + typename CompatibleKey,typename CompatibleCompare +> +inline Node* ordered_index_find( + Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x, + const CompatibleCompare& comp) +{ + Node* y0=y; + + while (top){ + if(!comp(key(top->value()),x)){ + y=top; + top=Node::from_impl(top->left()); + } + else top=Node::from_impl(top->right()); + } + + return (y==y0||comp(x,key(y->value())))?y0:y; +} + +template< + typename Node,typename KeyFromValue, + typename CompatibleKey,typename CompatibleCompare +> +inline Node* ordered_index_lower_bound( + Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x, + const CompatibleCompare& comp) +{ + while(top){ + if(!comp(key(top->value()),x)){ + y=top; + top=Node::from_impl(top->left()); + } + else top=Node::from_impl(top->right()); + } + + return y; +} + +template< + typename Node,typename KeyFromValue, + typename CompatibleKey,typename CompatibleCompare +> +inline Node* ordered_index_upper_bound( + Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x, + const CompatibleCompare& comp) +{ + while(top){ + if(comp(x,key(top->value()))){ + y=top; + top=Node::from_impl(top->left()); + } + else top=Node::from_impl(top->right()); + } + + return y; +} + +template< + typename Node,typename KeyFromValue, + typename CompatibleKey,typename CompatibleCompare +> +inline std::pair<Node*,Node*> ordered_index_equal_range( + Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x, + const CompatibleCompare& comp) +{ + while(top){ + if(comp(key(top->value()),x)){ + top=Node::from_impl(top->right()); + } + else if(comp(x,key(top->value()))){ + y=top; + top=Node::from_impl(top->left()); + } + else{ + return std::pair<Node*,Node*>( + ordered_index_lower_bound(Node::from_impl(top->left()),top,key,x,comp), + ordered_index_upper_bound(Node::from_impl(top->right()),y,key,x,comp)); + } + } + + return std::pair<Node*,Node*>(y,y); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/prevent_eti.hpp b/Utilities/BGL/boost/multi_index/detail/prevent_eti.hpp new file mode 100644 index 0000000000000000000000000000000000000000..56c067a3db7eb88011900b28d0ad6520ac8217c0 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/prevent_eti.hpp @@ -0,0 +1,60 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_PREVENT_ETI_HPP +#define BOOST_MULTI_INDEX_DETAIL_PREVENT_ETI_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) +#include <boost/mpl/if.hpp> +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/aux_/msvc_never_true.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) +/* See + * http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_MPL + * Item 5.6, Beware of the 'early template instantiation' trap. + */ + +template<typename Type,typename Construct> +struct prevent_eti +{ + typedef typename mpl::if_< + mpl::aux::msvc_never_true<Type>, + mpl::integral_c<int,0>, + Construct + >::type type; +}; +#else +template<typename Type,typename Construct> +struct prevent_eti +{ + typedef Construct type; +}; +#endif + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/rnd_index_loader.hpp b/Utilities/BGL/boost/multi_index/detail/rnd_index_loader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..793c52177e3af7b096adf05171c834134f14fd46 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/rnd_index_loader.hpp @@ -0,0 +1,176 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_RND_INDEX_LOADER_HPP +#define BOOST_MULTI_INDEX_DETAIL_RND_INDEX_LOADER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/multi_index/detail/auto_space.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/multi_index/detail/rnd_index_ptr_array.hpp> +#include <boost/noncopyable.hpp> +#include <cstddef> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* This class implements a serialization rearranger for random access + * indices. In order to achieve O(n) performance, the following strategy + * is followed: the nodes of the index are handled as if in a bidirectional + * list, where the next pointers are stored in the original + * random_access_index_ptr_array and the prev pointers are stored in + * an auxiliary array. Rearranging of nodes in such a bidirectional list + * is constant time. Once all the arrangements are performed (on destruction + * time) the list is traversed in reverse order and + * pointers are swapped and set accordingly so that they recover its + * original semantics ( *(node->up())==node ) while retaining the + * new order. + */ + +template<typename Allocator> +class random_access_index_loader_base:private noncopyable +{ +protected: + typedef typename prevent_eti< + Allocator, + random_access_index_node_impl< + typename boost::detail::allocator::rebind_to< + Allocator, + char + >::type + > + >::type node_impl_type; + typedef typename node_impl_type::pointer node_impl_pointer; + typedef random_access_index_ptr_array<Allocator> ptr_array; + + random_access_index_loader_base(const Allocator& al_,ptr_array& ptrs_): + al(al_), + ptrs(ptrs_), + header(*ptrs.end()), + prev_spc(al,0), + preprocessed(false) + {} + + ~random_access_index_loader_base() + { + if(preprocessed) + { + node_impl_pointer n=header; + next(n)=n; + + for(std::size_t i=ptrs.size();i--;){ + n=prev(n); + std::size_t d=position(n); + if(d!=i){ + node_impl_pointer m=prev(next_at(i)); + std::swap(m->up(),n->up()); + next_at(d)=next_at(i); + std::swap(prev_at(d),prev_at(i)); + } + next(n)=n; + } + } + } + + void rearrange(node_impl_pointer position,node_impl_pointer x) + { + preprocess(); /* only incur this penalty if rearrange() is ever called */ + if(position==node_impl_pointer(0))position=header; + next(prev(x))=next(x); + prev(next(x))=prev(x); + prev(x)=position; + next(x)=next(position); + next(prev(x))=prev(next(x))=x; + } + +private: + void preprocess() + { + if(!preprocessed){ + /* get space for the auxiliary prev array */ + auto_space<node_impl_pointer,Allocator> tmp(al,ptrs.size()+1); + prev_spc.swap(tmp); + + /* prev_spc elements point to the prev nodes */ + std::rotate_copy( + &*ptrs.begin(),&*ptrs.end(),&*ptrs.end()+1,&*prev_spc.data()); + + /* ptrs elements point to the next nodes */ + std::rotate(&*ptrs.begin(),&*ptrs.begin()+1,&*ptrs.end()+1); + + preprocessed=true; + } + } + + std::size_t position(node_impl_pointer x)const + { + return (std::size_t)(x->up()-ptrs.begin()); + } + + node_impl_pointer& next_at(std::size_t n)const + { + return *ptrs.at(n); + } + + node_impl_pointer& prev_at(std::size_t n)const + { + return *(prev_spc.data()+n); + } + + node_impl_pointer& next(node_impl_pointer x)const + { + return *(x->up()); + } + + node_impl_pointer& prev(node_impl_pointer x)const + { + return prev_at(position(x)); + } + + Allocator al; + ptr_array& ptrs; + node_impl_pointer header; + auto_space<node_impl_pointer,Allocator> prev_spc; + bool preprocessed; +}; + +template<typename Node,typename Allocator> +class random_access_index_loader: + private random_access_index_loader_base<Allocator> +{ + typedef random_access_index_loader_base<Allocator> super; + typedef typename super::node_impl_pointer node_impl_pointer; + typedef typename super::ptr_array ptr_array; + +public: + random_access_index_loader(const Allocator& al_,ptr_array& ptrs_): + super(al_,ptrs_) + {} + + void rearrange(Node* position,Node *x) + { + super::rearrange(position?position->impl():node_impl_pointer(0),x->impl()); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/rnd_index_node.hpp b/Utilities/BGL/boost/multi_index/detail/rnd_index_node.hpp new file mode 100644 index 0000000000000000000000000000000000000000..43b25268118a34b261c13f0c577d2ce30572bd49 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/rnd_index_node.hpp @@ -0,0 +1,281 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_RND_INDEX_NODE_HPP +#define BOOST_MULTI_INDEX_DETAIL_RND_INDEX_NODE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/math/common_factor_rt.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <cstddef> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template<typename Allocator> +struct random_access_index_node_impl +{ + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,random_access_index_node_impl + >::type + >::type::pointer pointer; + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,random_access_index_node_impl + >::type + >::type::const_pointer const_pointer; + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,pointer + >::type + >::type::pointer ptr_pointer; + + ptr_pointer& up(){return up_;} + ptr_pointer up()const{return up_;} + + /* interoperability with rnd_node_iterator */ + + static void increment(pointer& x) + { + x=*(x->up()+1); + } + + static void decrement(pointer& x) + { + x=*(x->up()-1); + } + + static void advance(pointer& x,std::ptrdiff_t n) + { + x=*(x->up()+n); + } + + static std::ptrdiff_t distance(pointer x,pointer y) + { + return y->up()-x->up(); + } + + /* algorithmic stuff */ + + static void relocate(ptr_pointer pos,ptr_pointer x) + { + pointer n=*x; + if(x<pos){ + extract(x,pos); + *(pos-1)=n; + n->up()=pos-1; + } + else{ + while(x!=pos){ + *x=*(x-1); + (*x)->up()=x; + --x; + } + *pos=n; + n->up()=pos; + } + }; + + static void relocate(ptr_pointer pos,ptr_pointer first,ptr_pointer last) + { + ptr_pointer begin,middle,end; + if(pos<first){ + begin=pos; + middle=first; + end=last; + } + else{ + begin=first; + middle=last; + end=pos; + } + + std::ptrdiff_t n=end-begin; + std::ptrdiff_t m=middle-begin; + std::ptrdiff_t n_m=n-m; + std::ptrdiff_t p=math::gcd(n,m); + + for(std::ptrdiff_t i=0;i<p;++i){ + pointer tmp=begin[i]; + for(std::ptrdiff_t j=i,k;;){ + if(j<n_m)k=j+m; + else k=j-n_m; + if(k==i){ + *(begin+j)=tmp; + (*(begin+j))->up()=begin+j; + break; + } + else{ + *(begin+j)=*(begin+k); + (*(begin+j))->up()=begin+j; + } + + if(k<n_m)j=k+m; + else j=k-n_m; + if(j==i){ + *(begin+k)=tmp; + (*(begin+k))->up()=begin+k; + break; + } + else{ + *(begin+k)=*(begin+j); + (*(begin+k))->up()=begin+k; + } + } + } + }; + + static void extract(ptr_pointer x,ptr_pointer pend) + { + --pend; + while(x!=pend){ + *x=*(x+1); + (*x)->up()=x; + ++x; + } + } + + static void transfer( + ptr_pointer pbegin0,ptr_pointer pend0,ptr_pointer pbegin1) + { + while(pbegin0!=pend0){ + *pbegin1=*pbegin0++; + (*pbegin1)->up()=pbegin1; + ++pbegin1; + } + } + + static void reverse(ptr_pointer pbegin,ptr_pointer pend) + { + std::ptrdiff_t d=(pend-pbegin)/2; + for(std::ptrdiff_t i=0;i<d;++i){ + std::swap(*pbegin,*--pend); + (*pbegin)->up()=pbegin; + (*pend)->up()=pend; + ++pbegin; + } + } + +private: + ptr_pointer up_; +}; + +template<typename Super> +struct random_access_index_node_trampoline: + prevent_eti< + Super, + random_access_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type +{ + typedef typename prevent_eti< + Super, + random_access_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type impl_type; +}; + +template<typename Super> +struct random_access_index_node: + Super,random_access_index_node_trampoline<Super> +{ +private: + typedef random_access_index_node_trampoline<Super> trampoline; + +public: + typedef typename trampoline::impl_type impl_type; + typedef typename trampoline::pointer impl_pointer; + typedef typename trampoline::const_pointer const_impl_pointer; + typedef typename trampoline::ptr_pointer impl_ptr_pointer; + + impl_ptr_pointer& up(){return trampoline::up();} + impl_ptr_pointer up()const{return trampoline::up();} + + impl_pointer impl() + { + return static_cast<impl_pointer>( + static_cast<impl_type*>(static_cast<trampoline*>(this))); + } + + const_impl_pointer impl()const + { + return static_cast<const_impl_pointer>( + static_cast<const impl_type*>(static_cast<const trampoline*>(this))); + } + + static random_access_index_node* from_impl(impl_pointer x) + { + return static_cast<random_access_index_node*>( + static_cast<trampoline*>(&*x)); + } + + static const random_access_index_node* from_impl(const_impl_pointer x) + { + return static_cast<const random_access_index_node*>( + static_cast<const trampoline*>(&*x)); + } + + /* interoperability with rnd_node_iterator */ + + static void increment(random_access_index_node*& x) + { + impl_pointer xi=x->impl(); + trampoline::increment(xi); + x=from_impl(xi); + } + + static void decrement(random_access_index_node*& x) + { + impl_pointer xi=x->impl(); + trampoline::decrement(xi); + x=from_impl(xi); + } + + static void advance(random_access_index_node*& x,std::ptrdiff_t n) + { + impl_pointer xi=x->impl(); + trampoline::advance(xi,n); + x=from_impl(xi); + } + + static std::ptrdiff_t distance( + random_access_index_node* x,random_access_index_node* y) + { + return trampoline::distance(x->impl(),y->impl()); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/rnd_index_ops.hpp b/Utilities/BGL/boost/multi_index/detail/rnd_index_ops.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5bf1ade7f5b4f73f72d976da5a20e5b2f4705f2d --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/rnd_index_ops.hpp @@ -0,0 +1,208 @@ +/* Copyright 2003-2009 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_RND_INDEX_OPS_HPP +#define BOOST_MULTI_INDEX_DETAIL_RND_INDEX_OPS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/multi_index/detail/rnd_index_ptr_array.hpp> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Common code for random_access_index memfuns having templatized and + * non-templatized versions. + */ + +template<typename Node,typename Allocator,typename Predicate> +Node* random_access_index_remove( + random_access_index_ptr_array<Allocator>& ptrs,Predicate pred + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Node)) +{ + typedef typename Node::value_type value_type; + typedef typename Node::impl_ptr_pointer impl_ptr_pointer; + + impl_ptr_pointer first=ptrs.begin(), + res=first, + last=ptrs.end(); + for(;first!=last;++first){ + if(!pred( + const_cast<const value_type&>(Node::from_impl(*first)->value()))){ + if(first!=res){ + std::swap(*first,*res); + (*first)->up()=first; + (*res)->up()=res; + } + ++res; + } + } + return Node::from_impl(*res); +} + +template<typename Node,typename Allocator,class BinaryPredicate> +Node* random_access_index_unique( + random_access_index_ptr_array<Allocator>& ptrs,BinaryPredicate binary_pred + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Node)) +{ + typedef typename Node::value_type value_type; + typedef typename Node::impl_ptr_pointer impl_ptr_pointer; + + impl_ptr_pointer first=ptrs.begin(), + res=first, + last=ptrs.end(); + if(first!=last){ + for(;++first!=last;){ + if(!binary_pred( + const_cast<const value_type&>(Node::from_impl(*res)->value()), + const_cast<const value_type&>(Node::from_impl(*first)->value()))){ + ++res; + if(first!=res){ + std::swap(*first,*res); + (*first)->up()=first; + (*res)->up()=res; + } + } + } + ++res; + } + return Node::from_impl(*res); +} + +template<typename Node,typename Allocator,typename Compare> +void random_access_index_inplace_merge( + const Allocator& al, + random_access_index_ptr_array<Allocator>& ptrs, + BOOST_DEDUCED_TYPENAME Node::impl_ptr_pointer first1,Compare comp + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Node)) +{ + typedef typename Node::value_type value_type; + typedef typename Node::impl_pointer impl_pointer; + typedef typename Node::impl_ptr_pointer impl_ptr_pointer; + + auto_space<impl_pointer,Allocator> spc(al,ptrs.size()); + + impl_ptr_pointer first0=ptrs.begin(), + last0=first1, + last1=ptrs.end(), + out=spc.data(); + while(first0!=last0&&first1!=last1){ + if(comp( + const_cast<const value_type&>(Node::from_impl(*first1)->value()), + const_cast<const value_type&>(Node::from_impl(*first0)->value()))){ + *out++=*first1++; + } + else{ + *out++=*first0++; + } + } + std::copy(&*first0,&*last0,&*out); + std::copy(&*first1,&*last1,&*out); + + first1=ptrs.begin(); + out=spc.data(); + while(first1!=last1){ + *first1=*out++; + (*first1)->up()=first1; + ++first1; + } +} + +/* sorting */ + +/* auxiliary stuff */ + +template<typename Node,typename Compare> +struct random_access_index_sort_compare: + std::binary_function< + typename Node::impl_pointer, + typename Node::impl_pointer,bool> +{ + random_access_index_sort_compare(Compare comp_=Compare()):comp(comp_){} + + bool operator()( + typename Node::impl_pointer x,typename Node::impl_pointer y)const + { + typedef typename Node::value_type value_type; + + return comp( + const_cast<const value_type&>(Node::from_impl(x)->value()), + const_cast<const value_type&>(Node::from_impl(y)->value())); + } + +private: + Compare comp; +}; + +template<typename Node,typename Allocator,class Compare> +void random_access_index_sort( + const Allocator& al, + random_access_index_ptr_array<Allocator>& ptrs, + Compare comp + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Node)) +{ + /* The implementation is extremely simple: an auxiliary + * array of pointers is sorted using stdlib facilities and + * then used to rearrange the index. This is suboptimal + * in space and time, but has some advantages over other + * possible approaches: + * - Use std::stable_sort() directly on ptrs using some + * special iterator in charge of maintaining pointers + * and up() pointers in sync: we cannot guarantee + * preservation of the container invariants in the face of + * exceptions, if, for instance, std::stable_sort throws + * when ptrs transitorily contains duplicate elements. + * - Rewrite the internal algorithms of std::stable_sort + * adapted for this case: besides being a fair amount of + * work, making a stable sort compatible with Boost.MultiIndex + * invariants (basically, no duplicates or missing elements + * even if an exception is thrown) is complicated, error-prone + * and possibly won't perform much better than the + * solution adopted. + */ + + if(ptrs.size()<=1)return; + + typedef typename Node::value_type value_type; + typedef typename Node::impl_pointer impl_pointer; + typedef typename Node::impl_ptr_pointer impl_ptr_pointer; + typedef random_access_index_sort_compare< + Node,Compare> ptr_compare; + + impl_ptr_pointer first=ptrs.begin(); + impl_ptr_pointer last=ptrs.end(); + auto_space< + impl_pointer, + Allocator> spc(al,ptrs.size()); + impl_ptr_pointer buf=spc.data(); + + std::copy(&*first,&*last,&*buf); + std::stable_sort(&*buf,&*buf+ptrs.size(),ptr_compare(comp)); + + while(first!=last){ + *first=*buf++; + (*first)->up()=first; + ++first; + } +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/rnd_index_ptr_array.hpp b/Utilities/BGL/boost/multi_index/detail/rnd_index_ptr_array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c0a2d67cbde1262d3b7028d2de1ca2a78196db48 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/rnd_index_ptr_array.hpp @@ -0,0 +1,143 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_RND_INDEX_PTR_ARRAY_HPP +#define BOOST_MULTI_INDEX_DETAIL_RND_INDEX_PTR_ARRAY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/multi_index/detail/auto_space.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/multi_index/detail/rnd_index_node.hpp> +#include <boost/noncopyable.hpp> +#include <cstddef> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* pointer structure for use by random access indices */ + +template<typename Allocator> +class random_access_index_ptr_array:private noncopyable +{ + typedef typename prevent_eti< + Allocator, + random_access_index_node_impl< + typename boost::detail::allocator::rebind_to< + Allocator, + char + >::type + > + >::type node_impl_type; + +public: + typedef typename node_impl_type::pointer value_type; + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,value_type + >::type + >::type::pointer pointer; + + random_access_index_ptr_array( + const Allocator& al,value_type end_,std::size_t size): + size_(size), + capacity_(size), + spc(al,capacity_+1) + { + *end()=end_; + end_->up()=end(); + } + + std::size_t size()const{return size_;} + std::size_t capacity()const{return capacity_;} + + void room_for_one() + { + if(size_==capacity_){ + reserve(capacity_<=10?15:capacity_+capacity_/2); + } + } + + void reserve(std::size_t c) + { + if(c>capacity_){ + auto_space<value_type,Allocator> spc1(spc.get_allocator(),c+1); + node_impl_type::transfer(begin(),end()+1,spc1.data()); + spc.swap(spc1); + capacity_=c; + } + } + + pointer begin()const{return ptrs();} + pointer end()const{return ptrs()+size_;} + pointer at(std::size_t n)const{return ptrs()+n;} + + void push_back(value_type x) + { + *(end()+1)=*end(); + (*(end()+1))->up()=end()+1; + *end()=x; + (*end())->up()=end(); + ++size_; + } + + void erase(value_type x) + { + node_impl_type::extract(x->up(),end()+1); + --size_; + } + + void clear() + { + *begin()=*end(); + (*begin())->up()=begin(); + size_=0; + } + + void swap(random_access_index_ptr_array& x) + { + std::swap(size_,x.size_); + std::swap(capacity_,x.capacity_); + spc.swap(x.spc); + } + +private: + std::size_t size_; + std::size_t capacity_; + auto_space<value_type,Allocator> spc; + + pointer ptrs()const + { + return spc.data(); + } +}; + +template<typename Allocator> +void swap( + random_access_index_ptr_array<Allocator>& x, + random_access_index_ptr_array<Allocator>& y) +{ + x.swap(y); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/rnd_node_iterator.hpp b/Utilities/BGL/boost/multi_index/detail/rnd_node_iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5ae3286dd4a454ba72207123e57c2b5bf237b5a2 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/rnd_node_iterator.hpp @@ -0,0 +1,139 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_RND_NODE_ITERATOR_HPP +#define BOOST_MULTI_INDEX_DETAIL_RND_NODE_ITERATOR_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/operators.hpp> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/split_member.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Iterator class for node-based indices with random access iterators. */ + +template<typename Node> +class rnd_node_iterator: + public random_access_iterator_helper< + rnd_node_iterator<Node>, + typename Node::value_type, + std::ptrdiff_t, + const typename Node::value_type*, + const typename Node::value_type&> +{ +public: + rnd_node_iterator(){} + explicit rnd_node_iterator(Node* node_):node(node_){} + + const typename Node::value_type& operator*()const + { + return node->value(); + } + + rnd_node_iterator& operator++() + { + Node::increment(node); + return *this; + } + + rnd_node_iterator& operator--() + { + Node::decrement(node); + return *this; + } + + rnd_node_iterator& operator+=(std::ptrdiff_t n) + { + Node::advance(node,n); + return *this; + } + + rnd_node_iterator& operator-=(std::ptrdiff_t n) + { + Node::advance(node,-n); + return *this; + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* Serialization. As for why the following is public, + * see explanation in safe_mode_iterator notes in safe_mode.hpp. + */ + + BOOST_SERIALIZATION_SPLIT_MEMBER() + + typedef typename Node::base_type node_base_type; + + template<class Archive> + void save(Archive& ar,const unsigned int)const + { + node_base_type* bnode=node; + ar<<serialization::make_nvp("pointer",bnode); + } + + template<class Archive> + void load(Archive& ar,const unsigned int) + { + node_base_type* bnode; + ar>>serialization::make_nvp("pointer",bnode); + node=static_cast<Node*>(bnode); + } +#endif + + /* get_node is not to be used by the user */ + + typedef Node node_type; + + Node* get_node()const{return node;} + +private: + Node* node; +}; + +template<typename Node> +bool operator==( + const rnd_node_iterator<Node>& x, + const rnd_node_iterator<Node>& y) +{ + return x.get_node()==y.get_node(); +} + +template<typename Node> +bool operator<( + const rnd_node_iterator<Node>& x, + const rnd_node_iterator<Node>& y) +{ + return Node::distance(x.get_node(),y.get_node())>0; +} + +template<typename Node> +std::ptrdiff_t operator-( + const rnd_node_iterator<Node>& x, + const rnd_node_iterator<Node>& y) +{ + return Node::distance(y.get_node(),x.get_node()); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/safe_ctr_proxy.hpp b/Utilities/BGL/boost/multi_index/detail/safe_ctr_proxy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c733f968ae5672603e98e5056d4e7ed2575f3cbb --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/safe_ctr_proxy.hpp @@ -0,0 +1,105 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_SAFE_CTR_PROXY_HPP +#define BOOST_MULTI_INDEX_DETAIL_SAFE_CTR_PROXY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) +#include <boost/multi_index/detail/safe_mode.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* A safe iterator is instantiated in the form + * safe_iterator<Iterator,Container>: MSVC++ 6.0 has serious troubles with + * the resulting symbols names, given that index names (which stand for + * Container) are fairly long themselves. safe_ctr_proxy does not statically + * depend on Container, and provides the necessary methods (begin and end) to + * the safe mode framework via an abstract interface. With safe_ctr_proxy, + * instead of deriving from safe_container<Container> the following base class + * must be used: + * + * safe_ctr_proxy_impl<Iterator,Container> + * + * where Iterator is the type of the *unsafe* iterator being wrapped. + * The corresponding safe iterator instantiation is then + * + * safe_iterator<Iterator,safe_ctr_proxy<Iterator> >, + * + * which does not include the name of Container. + */ + +template<typename Iterator> +class safe_ctr_proxy: + public safe_mode::safe_container<safe_ctr_proxy<Iterator> > +{ +public: + typedef safe_mode::safe_iterator<Iterator,safe_ctr_proxy> iterator; + typedef iterator const_iterator; + + iterator begin(){return begin_impl();} + const_iterator begin()const{return begin_impl();} + iterator end(){return end_impl();} + const_iterator end()const{return end_impl();} + +protected: + virtual iterator begin_impl()=0; + virtual const_iterator begin_impl()const=0; + virtual iterator end_impl()=0; + virtual const_iterator end_impl()const=0; +}; + +template<typename Iterator,typename Container> +class safe_ctr_proxy_impl:public safe_ctr_proxy<Iterator> +{ + typedef safe_ctr_proxy<Iterator> super; + typedef Container container_type; + +public: + typedef typename super::iterator iterator; + typedef typename super::const_iterator const_iterator; + + virtual iterator begin_impl(){return container().begin();} + virtual const_iterator begin_impl()const{return container().begin();} + virtual iterator end_impl(){return container().end();} + virtual const_iterator end_impl()const{return container().end();} + +private: + container_type& container() + { + return *static_cast<container_type*>(this); + } + + const container_type& container()const + { + return *static_cast<const container_type*>(this); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif /* workaround */ + +#endif /* BOOST_MULTI_INDEX_ENABLE_SAFE_MODE */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/safe_mode.hpp b/Utilities/BGL/boost/multi_index/detail/safe_mode.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dbfebd8c8fe1bec33f6e3a3cefe12229fe422689 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/safe_mode.hpp @@ -0,0 +1,574 @@ +/* Copyright 2003-2009 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_SAFE_MODE_HPP +#define BOOST_MULTI_INDEX_DETAIL_SAFE_MODE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +/* Safe mode machinery, in the spirit of Cay Hortmann's "Safe STL" + * (http://www.horstmann.com/safestl.html). + * In this mode, containers of type Container are derived from + * safe_container<Container>, and their corresponding iterators + * are wrapped with safe_iterator. These classes provide + * an internal record of which iterators are at a given moment associated + * to a given container, and properly mark the iterators as invalid + * when the container gets destroyed. + * Iterators are chained in a single attached list, whose header is + * kept by the container. More elaborate data structures would yield better + * performance, but I decided to keep complexity to a minimum since + * speed is not an issue here. + * Safe mode iterators automatically check that only proper operations + * are performed on them: for instance, an invalid iterator cannot be + * dereferenced. Additionally, a set of utilty macros and functions are + * provided that serve to implement preconditions and cooperate with + * the framework within the container. + * Iterators can also be unchecked, i.e. they do not have info about + * which container they belong in. This situation arises when the iterator + * is restored from a serialization archive: only information on the node + * is available, and it is not possible to determine to which container + * the iterator is associated to. The only sensible policy is to assume + * unchecked iterators are valid, though this can certainly generate false + * positive safe mode checks. + * This is not a full-fledged safe mode framework, and is only intended + * for use within the limits of Boost.MultiIndex. + */ + +/* Assertion macros. These resolve to no-ops if + * !defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE). + */ + +#if !defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#undef BOOST_MULTI_INDEX_SAFE_MODE_ASSERT +#define BOOST_MULTI_INDEX_SAFE_MODE_ASSERT(expr,error_code) ((void)0) +#else +#if !defined(BOOST_MULTI_INDEX_SAFE_MODE_ASSERT) +#include <boost/assert.hpp> +#define BOOST_MULTI_INDEX_SAFE_MODE_ASSERT(expr,error_code) BOOST_ASSERT(expr) +#endif +#endif + +#define BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_valid_iterator(it), \ + safe_mode::invalid_iterator); + +#define BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(it) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_dereferenceable_iterator(it), \ + safe_mode::not_dereferenceable_iterator); + +#define BOOST_MULTI_INDEX_CHECK_INCREMENTABLE_ITERATOR(it) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_incrementable_iterator(it), \ + safe_mode::not_incrementable_iterator); + +#define BOOST_MULTI_INDEX_CHECK_DECREMENTABLE_ITERATOR(it) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_decrementable_iterator(it), \ + safe_mode::not_decrementable_iterator); + +#define BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,cont) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_is_owner(it,cont), \ + safe_mode::not_owner); + +#define BOOST_MULTI_INDEX_CHECK_SAME_OWNER(it0,it1) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_same_owner(it0,it1), \ + safe_mode::not_same_owner); + +#define BOOST_MULTI_INDEX_CHECK_VALID_RANGE(it0,it1) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_valid_range(it0,it1), \ + safe_mode::invalid_range); + +#define BOOST_MULTI_INDEX_CHECK_OUTSIDE_RANGE(it,it0,it1) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_outside_range(it,it0,it1), \ + safe_mode::inside_range); + +#define BOOST_MULTI_INDEX_CHECK_IN_BOUNDS(it,n) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_in_bounds(it,n), \ + safe_mode::out_of_bounds); + +#define BOOST_MULTI_INDEX_CHECK_DIFFERENT_CONTAINER(cont0,cont1) \ + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT( \ + safe_mode::check_different_container(cont0,cont1), \ + safe_mode::same_container); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/iterator.hpp> +#include <boost/multi_index/detail/access_specifier.hpp> +#include <boost/multi_index/detail/iter_adaptor.hpp> +#include <boost/multi_index/safe_mode_errors.hpp> +#include <boost/noncopyable.hpp> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/serialization/split_member.hpp> +#endif + +#if defined(BOOST_HAS_THREADS) +#include <boost/detail/lightweight_mutex.hpp> +#endif + +namespace boost{ + +namespace multi_index{ + +namespace safe_mode{ + +/* Checking routines. Assume the best for unchecked iterators + * (i.e. they pass the checking when there is not enough info + * to know.) + */ + +template<typename Iterator> +inline bool check_valid_iterator(const Iterator& it) +{ + return it.valid()||it.unchecked(); +} + +template<typename Iterator> +inline bool check_dereferenceable_iterator(const Iterator& it) +{ + return it.valid()&&it!=it.owner()->end()||it.unchecked(); +} + +template<typename Iterator> +inline bool check_incrementable_iterator(const Iterator& it) +{ + return it.valid()&&it!=it.owner()->end()||it.unchecked(); +} + +template<typename Iterator> +inline bool check_decrementable_iterator(const Iterator& it) +{ + return it.valid()&&it!=it.owner()->begin()||it.unchecked(); +} + +template<typename Iterator> +inline bool check_is_owner( + const Iterator& it,const typename Iterator::container_type& cont) +{ + return it.valid()&&it.owner()==&cont||it.unchecked(); +} + +template<typename Iterator> +inline bool check_same_owner(const Iterator& it0,const Iterator& it1) +{ + return it0.valid()&&it1.valid()&&it0.owner()==it1.owner()|| + it0.unchecked()||it1.unchecked(); +} + +template<typename Iterator> +inline bool check_valid_range(const Iterator& it0,const Iterator& it1) +{ + if(!check_same_owner(it0,it1))return false; + + if(it0.valid()){ + Iterator last=it0.owner()->end(); + if(it1==last)return true; + + for(Iterator first=it0;first!=last;++first){ + if(first==it1)return true; + } + return false; + } + return true; +} + +template<typename Iterator> +inline bool check_outside_range( + const Iterator& it,const Iterator& it0,const Iterator& it1) +{ + if(!check_same_owner(it0,it1))return false; + + if(it0.valid()){ + Iterator last=it0.owner()->end(); + bool found=false; + + Iterator first=it0; + for(;first!=last;++first){ + if(first==it1)break; + + /* crucial that this check goes after previous break */ + + if(first==it)found=true; + } + if(first!=it1)return false; + return !found; + } + return true; +} + +template<typename Iterator,typename Difference> +inline bool check_in_bounds(const Iterator& it,Difference n) +{ + if(it.unchecked())return true; + if(!it.valid()) return false; + if(n>0) return it.owner()->end()-it>=n; + else return it.owner()->begin()-it<=n; +} + +template<typename Container> +inline bool check_different_container( + const Container& cont0,const Container& cont1) +{ + return &cont0!=&cont1; +} + +/* Invalidates all iterators equivalent to that given. Safe containers + * must call this when deleting elements: the safe mode framework cannot + * perform this operation automatically without outside help. + */ + +template<typename Iterator> +inline void detach_equivalent_iterators(Iterator& it) +{ + if(it.valid()){ + { +#if defined(BOOST_HAS_THREADS) + boost::detail::lightweight_mutex::scoped_lock lock(it.cont->mutex); +#endif + + Iterator *prev_,*next_; + for( + prev_=static_cast<Iterator*>(&it.cont->header); + (next_=static_cast<Iterator*>(prev_->next))!=0;){ + if(next_!=&it&&*next_==it){ + prev_->next=next_->next; + next_->cont=0; + } + else prev_=next_; + } + } + it.detach(); + } +} + +template<typename Container> class safe_container; /* fwd decl. */ + +} /* namespace multi_index::safe_mode */ + +namespace detail{ + +class safe_container_base; /* fwd decl. */ + +class safe_iterator_base +{ +public: + bool valid()const{return cont!=0;} + bool unchecked()const{return unchecked_;} + + inline void detach(); + + void uncheck() + { + detach(); + unchecked_=true; + } + +protected: + safe_iterator_base():cont(0),next(0),unchecked_(false){} + + explicit safe_iterator_base(safe_container_base* cont_): + unchecked_(false) + { + attach(cont_); + } + + safe_iterator_base(const safe_iterator_base& it): + unchecked_(it.unchecked_) + { + attach(it.cont); + } + + safe_iterator_base& operator=(const safe_iterator_base& it) + { + unchecked_=it.unchecked_; + safe_container_base* new_cont=it.cont; + if(cont!=new_cont){ + detach(); + attach(new_cont); + } + return *this; + } + + ~safe_iterator_base() + { + detach(); + } + + const safe_container_base* owner()const{return cont;} + +BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS: + friend class safe_container_base; + +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template<typename> friend class safe_mode::safe_container; + template<typename Iterator> friend + void safe_mode::detach_equivalent_iterators(Iterator&); +#endif + + inline void attach(safe_container_base* cont_); + + safe_container_base* cont; + safe_iterator_base* next; + bool unchecked_; +}; + +class safe_container_base:private noncopyable +{ +public: + safe_container_base(){} + +BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: + friend class safe_iterator_base; + +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template<typename Iterator> friend + void safe_mode::detach_equivalent_iterators(Iterator&); +#endif + + ~safe_container_base() + { + /* Detaches all remaining iterators, which by now will + * be those pointing to the end of the container. + */ + + for(safe_iterator_base* it=header.next;it;it=it->next)it->cont=0; + header.next=0; + } + + void swap(safe_container_base& x) + { + for(safe_iterator_base* it0=header.next;it0;it0=it0->next)it0->cont=&x; + for(safe_iterator_base* it1=x.header.next;it1;it1=it1->next)it1->cont=this; + std::swap(header.cont,x.header.cont); + std::swap(header.next,x.header.next); + } + + safe_iterator_base header; + +#if defined(BOOST_HAS_THREADS) + boost::detail::lightweight_mutex mutex; +#endif +}; + +void safe_iterator_base::attach(safe_container_base* cont_) +{ + cont=cont_; + if(cont){ +#if defined(BOOST_HAS_THREADS) + boost::detail::lightweight_mutex::scoped_lock lock(cont->mutex); +#endif + + next=cont->header.next; + cont->header.next=this; + } +} + +void safe_iterator_base::detach() +{ + if(cont){ +#if defined(BOOST_HAS_THREADS) + boost::detail::lightweight_mutex::scoped_lock lock(cont->mutex); +#endif + + safe_iterator_base *prev_,*next_; + for(prev_=&cont->header;(next_=prev_->next)!=this;prev_=next_){} + prev_->next=next; + cont=0; + } +} + +} /* namespace multi_index::detail */ + +namespace safe_mode{ + +/* In order to enable safe mode on a container: + * - The container must derive from safe_container<container_type>, + * - iterators must be generated via safe_iterator, which adapts a + * preexistent unsafe iterator class. + */ + +template<typename Container> +class safe_container; + +template<typename Iterator,typename Container> +class safe_iterator: + public detail::iter_adaptor<safe_iterator<Iterator,Container>,Iterator>, + public detail::safe_iterator_base +{ + typedef detail::iter_adaptor<safe_iterator,Iterator> super; + typedef detail::safe_iterator_base safe_super; + +public: + typedef Container container_type; + typedef typename Iterator::reference reference; + typedef typename Iterator::difference_type difference_type; + + safe_iterator(){} + explicit safe_iterator(safe_container<container_type>* cont_): + safe_super(cont_){} + template<typename T0> + safe_iterator(const T0& t0,safe_container<container_type>* cont_): + super(Iterator(t0)),safe_super(cont_){} + template<typename T0,typename T1> + safe_iterator( + const T0& t0,const T1& t1,safe_container<container_type>* cont_): + super(Iterator(t0,t1)),safe_super(cont_){} + + safe_iterator& operator=(const safe_iterator& x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(x); + this->base_reference()=x.base_reference(); + safe_super::operator=(x); + return *this; + } + + const container_type* owner()const + { + return + static_cast<const container_type*>( + static_cast<const safe_container<container_type>*>( + this->safe_super::owner())); + } + + /* get_node is not to be used by the user */ + + typedef typename Iterator::node_type node_type; + + node_type* get_node()const{return this->base_reference().get_node();} + +private: + friend class boost::multi_index::detail::iter_adaptor_access; + + reference dereference()const + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(*this); + return *(this->base_reference()); + } + + bool equal(const safe_iterator& x)const + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(x); + BOOST_MULTI_INDEX_CHECK_SAME_OWNER(*this,x); + return this->base_reference()==x.base_reference(); + } + + void increment() + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this); + BOOST_MULTI_INDEX_CHECK_INCREMENTABLE_ITERATOR(*this); + ++(this->base_reference()); + } + + void decrement() + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this); + BOOST_MULTI_INDEX_CHECK_DECREMENTABLE_ITERATOR(*this); + --(this->base_reference()); + } + + void advance(difference_type n) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this); + BOOST_MULTI_INDEX_CHECK_IN_BOUNDS(*this,n); + this->base_reference()+=n; + } + + difference_type distance_to(const safe_iterator& x)const + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(x); + BOOST_MULTI_INDEX_CHECK_SAME_OWNER(*this,x); + return x.base_reference()-this->base_reference(); + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* Serialization. Note that Iterator::save and Iterator:load + * are assumed to be defined and public: at first sight it seems + * like we could have resorted to the public serialization interface + * for doing the forwarding to the adapted iterator class: + * ar<<base_reference(); + * ar>>base_reference(); + * but this would cause incompatibilities if a saving + * program is in safe mode and the loading program is not, or + * viceversa --in safe mode, the archived iterator data is one layer + * deeper, this is especially relevant with XML archives. + * It'd be nice if Boost.Serialization provided some forwarding + * facility for use by adaptor classes. + */ + + friend class boost::serialization::access; + + BOOST_SERIALIZATION_SPLIT_MEMBER() + + template<class Archive> + void save(Archive& ar,const unsigned int version)const + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(*this); + this->base_reference().save(ar,version); + } + + template<class Archive> + void load(Archive& ar,const unsigned int version) + { + this->base_reference().load(ar,version); + safe_super::uncheck(); + } +#endif +}; + +template<typename Container> +class safe_container:public detail::safe_container_base +{ + typedef detail::safe_container_base super; + +public: + void detach_dereferenceable_iterators() + { + typedef typename Container::iterator iterator; + + iterator end_=static_cast<Container*>(this)->end(); + iterator *prev_,*next_; + for( + prev_=static_cast<iterator*>(&this->header); + (next_=static_cast<iterator*>(prev_->next))!=0;){ + if(*next_!=end_){ + prev_->next=next_->next; + next_->cont=0; + } + else prev_=next_; + } + } + + void swap(safe_container<Container>& x) + { + super::swap(x); + } +}; + +} /* namespace multi_index::safe_mode */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif /* BOOST_MULTI_INDEX_ENABLE_SAFE_MODE */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/scope_guard.hpp b/Utilities/BGL/boost/multi_index/detail/scope_guard.hpp new file mode 100644 index 0000000000000000000000000000000000000000..12624c5176daf34836c9308680a7938a34b057e9 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/scope_guard.hpp @@ -0,0 +1,277 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_SCOPE_GUARD_HPP +#define BOOST_MULTI_INDEX_DETAIL_SCOPE_GUARD_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Until some official version of the ScopeGuard idiom makes it into Boost, + * we locally define our own. This is a merely reformated version of + * ScopeGuard.h as defined in: + * Alexandrescu, A., Marginean, P.:"Generic<Programming>: Change the Way You + * Write Exception-Safe Code - Forever", C/C++ Users Jornal, Dec 2000, + * http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/ + * with the following modifications: + * - General pretty formatting (pretty to my taste at least.) + * - Naming style changed to standard C++ library requirements. + * - safe_execute does not feature a try-catch protection, so we can + * use this even if BOOST_NO_EXCEPTIONS is defined. + * - Added scope_guard_impl4 and obj_scope_guard_impl3, (Boost.MultiIndex + * needs them). A better design would provide guards for many more + * arguments through the Boost Preprocessor Library. + * - Added scope_guard_impl_base::touch (see below.) + * - Removed RefHolder and ByRef, whose functionality is provided + * already by Boost.Ref. + * - Removed static make_guard's and make_obj_guard's, so that the code + * will work even if BOOST_NO_MEMBER_TEMPLATES is defined. This forces + * us to move some private ctors to public, though. + * + * NB: CodeWarrior Pro 8 seems to have problems looking up safe_execute + * without an explicit qualification. + */ + +class scope_guard_impl_base +{ +public: + scope_guard_impl_base():dismissed_(false){} + void dismiss()const{dismissed_=true;} + + /* This helps prevent some "unused variable" warnings under, for instance, + * GCC 3.2. + */ + void touch()const{} + +protected: + ~scope_guard_impl_base(){} + + scope_guard_impl_base(const scope_guard_impl_base& other): + dismissed_(other.dismissed_) + { + other.dismiss(); + } + + template<typename J> + static void safe_execute(J& j){if(!j.dismissed_)j.execute();} + + mutable bool dismissed_; + +private: + scope_guard_impl_base& operator=(const scope_guard_impl_base&); +}; + +typedef const scope_guard_impl_base& scope_guard; + +template<typename F> +class scope_guard_impl0:public scope_guard_impl_base +{ +public: + scope_guard_impl0(F fun):fun_(fun){} + ~scope_guard_impl0(){scope_guard_impl_base::safe_execute(*this);} + void execute(){fun_();} + +protected: + + F fun_; +}; + +template<typename F> +inline scope_guard_impl0<F> make_guard(F fun) +{ + return scope_guard_impl0<F>(fun); +} + +template<typename F,typename P1> +class scope_guard_impl1:public scope_guard_impl_base +{ +public: + scope_guard_impl1(F fun,P1 p1):fun_(fun),p1_(p1){} + ~scope_guard_impl1(){scope_guard_impl_base::safe_execute(*this);} + void execute(){fun_(p1_);} + +protected: + F fun_; + const P1 p1_; +}; + +template<typename F,typename P1> +inline scope_guard_impl1<F,P1> make_guard(F fun,P1 p1) +{ + return scope_guard_impl1<F,P1>(fun,p1); +} + +template<typename F,typename P1,typename P2> +class scope_guard_impl2:public scope_guard_impl_base +{ +public: + scope_guard_impl2(F fun,P1 p1,P2 p2):fun_(fun),p1_(p1),p2_(p2){} + ~scope_guard_impl2(){scope_guard_impl_base::safe_execute(*this);} + void execute(){fun_(p1_,p2_);} + +protected: + F fun_; + const P1 p1_; + const P2 p2_; +}; + +template<typename F,typename P1,typename P2> +inline scope_guard_impl2<F,P1,P2> make_guard(F fun,P1 p1,P2 p2) +{ + return scope_guard_impl2<F,P1,P2>(fun,p1,p2); +} + +template<typename F,typename P1,typename P2,typename P3> +class scope_guard_impl3:public scope_guard_impl_base +{ +public: + scope_guard_impl3(F fun,P1 p1,P2 p2,P3 p3):fun_(fun),p1_(p1),p2_(p2),p3_(p3){} + ~scope_guard_impl3(){scope_guard_impl_base::safe_execute(*this);} + void execute(){fun_(p1_,p2_,p3_);} + +protected: + F fun_; + const P1 p1_; + const P2 p2_; + const P3 p3_; +}; + +template<typename F,typename P1,typename P2,typename P3> +inline scope_guard_impl3<F,P1,P2,P3> make_guard(F fun,P1 p1,P2 p2,P3 p3) +{ + return scope_guard_impl3<F,P1,P2,P3>(fun,p1,p2,p3); +} + +template<typename F,typename P1,typename P2,typename P3,typename P4> +class scope_guard_impl4:public scope_guard_impl_base +{ +public: + scope_guard_impl4(F fun,P1 p1,P2 p2,P3 p3,P4 p4): + fun_(fun),p1_(p1),p2_(p2),p3_(p3),p4_(p4){} + ~scope_guard_impl4(){scope_guard_impl_base::safe_execute(*this);} + void execute(){fun_(p1_,p2_,p3_,p4_);} + +protected: + F fun_; + const P1 p1_; + const P2 p2_; + const P3 p3_; + const P4 p4_; +}; + +template<typename F,typename P1,typename P2,typename P3,typename P4> +inline scope_guard_impl4<F,P1,P2,P3,P4> make_guard( + F fun,P1 p1,P2 p2,P3 p3,P4 p4) +{ + return scope_guard_impl4<F,P1,P2,P3,P4>(fun,p1,p2,p3,p4); +} + +template<class Obj,typename MemFun> +class obj_scope_guard_impl0:public scope_guard_impl_base +{ +public: + obj_scope_guard_impl0(Obj& obj,MemFun mem_fun):obj_(obj),mem_fun_(mem_fun){} + ~obj_scope_guard_impl0(){scope_guard_impl_base::safe_execute(*this);} + void execute(){(obj_.*mem_fun_)();} + +protected: + Obj& obj_; + MemFun mem_fun_; +}; + +template<class Obj,typename MemFun> +inline obj_scope_guard_impl0<Obj,MemFun> make_obj_guard(Obj& obj,MemFun mem_fun) +{ + return obj_scope_guard_impl0<Obj,MemFun>(obj,mem_fun); +} + +template<class Obj,typename MemFun,typename P1> +class obj_scope_guard_impl1:public scope_guard_impl_base +{ +public: + obj_scope_guard_impl1(Obj& obj,MemFun mem_fun,P1 p1): + obj_(obj),mem_fun_(mem_fun),p1_(p1){} + ~obj_scope_guard_impl1(){scope_guard_impl_base::safe_execute(*this);} + void execute(){(obj_.*mem_fun_)(p1_);} + +protected: + Obj& obj_; + MemFun mem_fun_; + const P1 p1_; +}; + +template<class Obj,typename MemFun,typename P1> +inline obj_scope_guard_impl1<Obj,MemFun,P1> make_obj_guard( + Obj& obj,MemFun mem_fun,P1 p1) +{ + return obj_scope_guard_impl1<Obj,MemFun,P1>(obj,mem_fun,p1); +} + +template<class Obj,typename MemFun,typename P1,typename P2> +class obj_scope_guard_impl2:public scope_guard_impl_base +{ +public: + obj_scope_guard_impl2(Obj& obj,MemFun mem_fun,P1 p1,P2 p2): + obj_(obj),mem_fun_(mem_fun),p1_(p1),p2_(p2) + {} + ~obj_scope_guard_impl2(){scope_guard_impl_base::safe_execute(*this);} + void execute(){(obj_.*mem_fun_)(p1_,p2_);} + +protected: + Obj& obj_; + MemFun mem_fun_; + const P1 p1_; + const P2 p2_; +}; + +template<class Obj,typename MemFun,typename P1,typename P2> +inline obj_scope_guard_impl2<Obj,MemFun,P1,P2> +make_obj_guard(Obj& obj,MemFun mem_fun,P1 p1,P2 p2) +{ + return obj_scope_guard_impl2<Obj,MemFun,P1,P2>(obj,mem_fun,p1,p2); +} + +template<class Obj,typename MemFun,typename P1,typename P2,typename P3> +class obj_scope_guard_impl3:public scope_guard_impl_base +{ +public: + obj_scope_guard_impl3(Obj& obj,MemFun mem_fun,P1 p1,P2 p2,P3 p3): + obj_(obj),mem_fun_(mem_fun),p1_(p1),p2_(p2),p3_(p3) + {} + ~obj_scope_guard_impl3(){scope_guard_impl_base::safe_execute(*this);} + void execute(){(obj_.*mem_fun_)(p1_,p2_,p3_);} + +protected: + Obj& obj_; + MemFun mem_fun_; + const P1 p1_; + const P2 p2_; + const P3 p3_; +}; + +template<class Obj,typename MemFun,typename P1,typename P2,typename P3> +inline obj_scope_guard_impl3<Obj,MemFun,P1,P2,P3> +make_obj_guard(Obj& obj,MemFun mem_fun,P1 p1,P2 p2,P3 p3) +{ + return obj_scope_guard_impl3<Obj,MemFun,P1,P2,P3>(obj,mem_fun,p1,p2,p3); +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/seq_index_node.hpp b/Utilities/BGL/boost/multi_index/detail/seq_index_node.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cf409ed0b72d1b48808c48a1cac182d7ff6e7192 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/seq_index_node.hpp @@ -0,0 +1,223 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_SEQ_INDEX_NODE_HPP +#define BOOST_MULTI_INDEX_DETAIL_SEQ_INDEX_NODE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* doubly-linked node for use by sequenced_index */ + +template<typename Allocator> +struct sequenced_index_node_impl +{ + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,sequenced_index_node_impl + >::type + >::type::pointer pointer; + typedef typename prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator,sequenced_index_node_impl + >::type + >::type::const_pointer const_pointer; + + pointer& prior(){return prior_;} + pointer prior()const{return prior_;} + pointer& next(){return next_;} + pointer next()const{return next_;} + + /* interoperability with bidir_node_iterator */ + + static void increment(pointer& x){x=x->next();} + static void decrement(pointer& x){x=x->prior();} + + /* algorithmic stuff */ + + static void link(pointer x,pointer header) + { + x->prior()=header->prior(); + x->next()=header; + x->prior()->next()=x->next()->prior()=x; + }; + + static void unlink(pointer x) + { + x->prior()->next()=x->next(); + x->next()->prior()=x->prior(); + } + + static void relink(pointer position,pointer x) + { + unlink(x); + x->prior()=position->prior(); + x->next()=position; + x->prior()->next()=x->next()->prior()=x; + } + + static void relink(pointer position,pointer x,pointer y) + { + /* position is assumed not to be in [x,y) */ + + if(x!=y){ + pointer z=y->prior(); + x->prior()->next()=y; + y->prior()=x->prior(); + x->prior()=position->prior(); + z->next()=position; + x->prior()->next()=x; + z->next()->prior()=z; + } + } + + static void reverse(pointer header) + { + pointer x=header; + do{ + pointer y=x->next(); + std::swap(x->prior(),x->next()); + x=y; + }while(x!=header); + } + + static void swap(pointer x,pointer y) + { + /* This swap function does not exchange the header nodes, + * but rather their pointers. This is *not* used for implementing + * sequenced_index::swap. + */ + + if(x->next()!=x){ + if(y->next()!=y){ + std::swap(x->next(),y->next()); + std::swap(x->prior(),y->prior()); + x->next()->prior()=x->prior()->next()=x; + y->next()->prior()=y->prior()->next()=y; + } + else{ + y->next()=x->next(); + y->prior()=x->prior(); + x->next()=x->prior()=x; + y->next()->prior()=y->prior()->next()=y; + } + } + else if(y->next()!=y){ + x->next()=y->next(); + x->prior()=y->prior(); + y->next()=y->prior()=y; + x->next()->prior()=x->prior()->next()=x; + } + } + +private: + pointer prior_; + pointer next_; +}; + +template<typename Super> +struct sequenced_index_node_trampoline: + prevent_eti< + Super, + sequenced_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type +{ + typedef typename prevent_eti< + Super, + sequenced_index_node_impl< + typename boost::detail::allocator::rebind_to< + typename Super::allocator_type, + char + >::type + > + >::type impl_type; +}; + +template<typename Super> +struct sequenced_index_node:Super,sequenced_index_node_trampoline<Super> +{ +private: + typedef sequenced_index_node_trampoline<Super> trampoline; + +public: + typedef typename trampoline::impl_type impl_type; + typedef typename trampoline::pointer impl_pointer; + typedef typename trampoline::const_pointer const_impl_pointer; + + impl_pointer& prior(){return trampoline::prior();} + impl_pointer prior()const{return trampoline::prior();} + impl_pointer& next(){return trampoline::next();} + impl_pointer next()const{return trampoline::next();} + + impl_pointer impl() + { + return static_cast<impl_pointer>( + static_cast<impl_type*>(static_cast<trampoline*>(this))); + } + + const_impl_pointer impl()const + { + return static_cast<const_impl_pointer>( + static_cast<const impl_type*>(static_cast<const trampoline*>(this))); + } + + static sequenced_index_node* from_impl(impl_pointer x) + { + return static_cast<sequenced_index_node*>( + static_cast<trampoline*>(&*x)); + } + + static const sequenced_index_node* from_impl(const_impl_pointer x) + { + return static_cast<const sequenced_index_node*>( + static_cast<const trampoline*>(&*x)); + } + + /* interoperability with bidir_node_iterator */ + + static void increment(sequenced_index_node*& x) + { + impl_pointer xi=x->impl(); + trampoline::increment(xi); + x=from_impl(xi); + } + + static void decrement(sequenced_index_node*& x) + { + impl_pointer xi=x->impl(); + trampoline::decrement(xi); + x=from_impl(xi); + } +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/seq_index_ops.hpp b/Utilities/BGL/boost/multi_index/detail/seq_index_ops.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8135074c23ec4ba2b4136ad901e4ddafc348d9a2 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/seq_index_ops.hpp @@ -0,0 +1,200 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_SEQ_INDEX_OPS_HPP +#define BOOST_MULTI_INDEX_DETAIL_SEQ_INDEX_OPS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/multi_index/detail/seq_index_node.hpp> +#include <boost/limits.hpp> +#include <boost/type_traits/aligned_storage.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <cstddef> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* Common code for sequenced_index memfuns having templatized and + * non-templatized versions. + */ + +template <typename SequencedIndex,typename Predicate> +void sequenced_index_remove(SequencedIndex& x,Predicate pred) +{ + typedef typename SequencedIndex::iterator iterator; + iterator first=x.begin(),last=x.end(); + while(first!=last){ + if(pred(*first))x.erase(first++); + else ++first; + } +} + +template <typename SequencedIndex,class BinaryPredicate> +void sequenced_index_unique(SequencedIndex& x,BinaryPredicate binary_pred) +{ + typedef typename SequencedIndex::iterator iterator; + iterator first=x.begin(); + iterator last=x.end(); + if(first!=last){ + for(iterator middle=first;++middle!=last;middle=first){ + if(binary_pred(*middle,*first))x.erase(middle); + else first=middle; + } + } +} + +template <typename SequencedIndex,typename Compare> +void sequenced_index_merge(SequencedIndex& x,SequencedIndex& y,Compare comp) +{ + typedef typename SequencedIndex::iterator iterator; + if(&x!=&y){ + iterator first0=x.begin(),last0=x.end(); + iterator first1=y.begin(),last1=y.end(); + while(first0!=last0&&first1!=last1){ + if(comp(*first1,*first0))x.splice(first0,y,first1++); + else ++first0; + } + x.splice(last0,y,first1,last1); + } +} + +/* sorting */ + +/* auxiliary stuff */ + +template<typename Node,typename Compare> +void sequenced_index_collate( + BOOST_DEDUCED_TYPENAME Node::impl_type* x, + BOOST_DEDUCED_TYPENAME Node::impl_type* y, + Compare comp + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Node)) +{ + typedef typename Node::impl_type impl_type; + typedef typename Node::impl_pointer impl_pointer; + + impl_pointer first0=x->next(); + impl_pointer last0=x; + impl_pointer first1=y->next(); + impl_pointer last1=y; + while(first0!=last0&&first1!=last1){ + if(comp( + Node::from_impl(first1)->value(),Node::from_impl(first0)->value())){ + impl_pointer tmp=first1->next(); + impl_type::relink(first0,first1); + first1=tmp; + } + else first0=first0->next(); + } + impl_type::relink(last0,first1,last1); +} + +/* Some versions of CGG require a bogus typename in counter_spc + * inside sequenced_index_sort if the following is defined + * also inside sequenced_index_sort. + */ + +BOOST_STATIC_CONSTANT( + std::size_t, + sequenced_index_sort_max_fill= + (std::size_t)std::numeric_limits<std::size_t>::digits+1); + +template<typename Node,typename Compare> +void sequenced_index_sort(Node* header,Compare comp) +{ + /* Musser's mergesort, see http://www.cs.rpi.edu/~musser/gp/List/lists1.html. + * The implementation is a little convoluted: in the original code + * counter elements and carry are std::lists: here we do not want + * to use multi_index instead, so we do things at a lower level, managing + * directly the internal node representation. + * Incidentally, the implementations I've seen of this algorithm (SGI, + * Dinkumware, STLPort) are not exception-safe: this is. Moreover, we do not + * use any dynamic storage. + */ + + if(header->next()==header->impl()|| + header->next()->next()==header->impl())return; + + typedef typename Node::impl_type impl_type; + typedef typename Node::impl_pointer impl_pointer; + + typedef typename aligned_storage< + sizeof(impl_type), + alignment_of<impl_type>::value + >::type carry_spc_type; + carry_spc_type carry_spc; + impl_type& carry= + *static_cast<impl_type*>(static_cast<void*>(&carry_spc)); + typedef typename aligned_storage< + sizeof( + impl_type + [sequenced_index_sort_max_fill]), + alignment_of< + impl_type + [sequenced_index_sort_max_fill] + >::value + >::type counter_spc_type; + counter_spc_type counter_spc; + impl_type* counter= + static_cast<impl_type*>(static_cast<void*>(&counter_spc)); + std::size_t fill=0; + + carry.prior()=carry.next()=static_cast<impl_pointer>(&carry); + counter[0].prior()=counter[0].next()=static_cast<impl_pointer>(&counter[0]); + + BOOST_TRY{ + while(header->next()!=header->impl()){ + impl_type::relink(carry.next(),header->next()); + std::size_t i=0; + while(i<fill&&counter[i].next()!=static_cast<impl_pointer>(&counter[i])){ + sequenced_index_collate<Node>(&carry,&counter[i++],comp); + } + impl_type::swap( + static_cast<impl_pointer>(&carry), + static_cast<impl_pointer>(&counter[i])); + if(i==fill){ + ++fill; + counter[fill].prior()=counter[fill].next()= + static_cast<impl_pointer>(&counter[fill]); + } + } + + for(std::size_t i=1;i<fill;++i){ + sequenced_index_collate<Node>(&counter[i],&counter[i-1],comp); + } + impl_type::swap( + header->impl(),static_cast<impl_pointer>(&counter[fill-1])); + } + BOOST_CATCH(...) + { + impl_type::relink( + header->impl(),carry.next(),static_cast<impl_pointer>(&carry)); + for(std::size_t i=0;i<=fill;++i){ + impl_type::relink( + header->impl(),counter[i].next(), + static_cast<impl_pointer>(&counter[i])); + } + BOOST_RETHROW; + } + BOOST_CATCH_END +} + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/uintptr_type.hpp b/Utilities/BGL/boost/multi_index/detail/uintptr_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..529c623153aeedd89e95e24390ab0709ceee7773 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/uintptr_type.hpp @@ -0,0 +1,76 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_UINTPTR_TYPE_HPP +#define BOOST_MULTI_INDEX_DETAIL_UINTPTR_TYPE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/bool.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* has_uintptr_type is an MPL integral constant determining whether + * there exists an unsigned integral type with the same size as + * void *. + * uintptr_type is such a type if has_uintptr is true, or unsigned int + * otherwise. + * Note that uintptr_type is more restrictive than C99 uintptr_t, + * where an integral type with size greater than that of void * + * would be conformant. + */ + +template<int N>struct uintptr_candidates; +template<>struct uintptr_candidates<-1>{typedef unsigned int type;}; +template<>struct uintptr_candidates<0> {typedef unsigned int type;}; +template<>struct uintptr_candidates<1> {typedef unsigned short type;}; +template<>struct uintptr_candidates<2> {typedef unsigned long type;}; + +#if defined(BOOST_HAS_LONG_LONG) +template<>struct uintptr_candidates<3> {typedef boost::ulong_long_type type;}; +#else +template<>struct uintptr_candidates<3> {typedef unsigned int type;}; +#endif + +#if defined(BOOST_HAS_MS_INT64) +template<>struct uintptr_candidates<4> {typedef unsigned __int64 type;}; +#else +template<>struct uintptr_candidates<4> {typedef unsigned int type;}; +#endif + +struct uintptr_aux +{ + BOOST_STATIC_CONSTANT(int,index= + sizeof(void*)==sizeof(uintptr_candidates<0>::type)?0: + sizeof(void*)==sizeof(uintptr_candidates<1>::type)?1: + sizeof(void*)==sizeof(uintptr_candidates<2>::type)?2: + sizeof(void*)==sizeof(uintptr_candidates<3>::type)?3: + sizeof(void*)==sizeof(uintptr_candidates<4>::type)?4:-1); + + BOOST_STATIC_CONSTANT(bool,has_uintptr_type=(index>=0)); + + typedef uintptr_candidates<index>::type type; +}; + +typedef mpl::bool_<uintptr_aux::has_uintptr_type> has_uintptr_type; +typedef uintptr_aux::type uintptr_type; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/unbounded.hpp b/Utilities/BGL/boost/multi_index/detail/unbounded.hpp new file mode 100644 index 0000000000000000000000000000000000000000..40c303445e1df3a66c99fb63584b1a98c4c1d2e8 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/unbounded.hpp @@ -0,0 +1,83 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP +#define BOOST_MULTI_INDEX_DETAIL_UNBOUNDED_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/detail/workaround.hpp> + +namespace boost{ + +namespace multi_index{ + +/* dummy type and variable for use in ordered_index::range() */ + +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) +/* The default branch actually works for MSVC 6.0, but seems like + * this implementation of unbounded improves the performance of ordered + * indices! This behavior is hard to explain and probably a test artifact, + * but it does not hurt to have the workaround anyway. + */ + +namespace detail{struct unbounded_type{};} + +namespace{ + +static detail::unbounded_type unbounded_obj=detail::unbounded_type(); +static detail::unbounded_type& unbounded=unbounded_obj; + +} /* unnamed */ +#else +/* ODR-abiding technique shown at the example attached to + * http://lists.boost.org/Archives/boost/2006/07/108355.php + */ + +namespace detail{class unbounded_helper;} + +detail::unbounded_helper unbounded(detail::unbounded_helper); + +namespace detail{ + +class unbounded_helper +{ + unbounded_helper(){} + unbounded_helper(const unbounded_helper&){} + friend unbounded_helper multi_index::unbounded(unbounded_helper); +}; + +typedef unbounded_helper (*unbounded_type)(unbounded_helper); + +} /* namespace multi_index::detail */ + +inline detail::unbounded_helper unbounded(detail::unbounded_helper) +{ + return detail::unbounded_helper(); +} +#endif + +/* tags used in the implementation of range */ + +namespace detail{ + +struct none_unbounded_tag{}; +struct lower_unbounded_tag{}; +struct upper_unbounded_tag{}; +struct both_unbounded_tag{}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/detail/value_compare.hpp b/Utilities/BGL/boost/multi_index/detail/value_compare.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0bd7b4f2db607e94089127e2b8ca7332105d8e1b --- /dev/null +++ b/Utilities/BGL/boost/multi_index/detail/value_compare.hpp @@ -0,0 +1,53 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_VALUE_COMPARE_HPP +#define BOOST_MULTI_INDEX_DETAIL_VALUE_COMPARE_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/call_traits.hpp> +#include <functional> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template<typename Value,typename KeyFromValue,typename Compare> +struct value_comparison:std::binary_function<Value,Value,bool> +{ + value_comparison( + const KeyFromValue& key_=KeyFromValue(),const Compare& comp_=Compare()): + key(key_),comp(comp_) + { + } + + bool operator()( + typename call_traits<Value>::param_type x, + typename call_traits<Value>::param_type y)const + { + return comp(key(x),key(y)); + } + +private: + KeyFromValue key; + Compare comp; +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/global_fun.hpp b/Utilities/BGL/boost/multi_index/global_fun.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8520e4d0c7a41fd5a83fafc415d1fa7b5b2ef4ca --- /dev/null +++ b/Utilities/BGL/boost/multi_index/global_fun.hpp @@ -0,0 +1,188 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_GLOBAL_FUN_HPP +#define BOOST_MULTI_INDEX_GLOBAL_FUN_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/utility/enable_if.hpp> + +#if !defined(BOOST_NO_SFINAE) +#include <boost/type_traits/is_convertible.hpp> +#endif + +namespace boost{ + +template<class T> class reference_wrapper; /* fwd decl. */ + +namespace multi_index{ + +namespace detail{ + +/* global_fun is a read-only key extractor from Value based on a given global + * (or static member) function with signature: + * + * Type f([const] Value [&]); + * + * Additionally, global_fun and const_global_fun are overloaded to support + * referece_wrappers of Value and "chained pointers" to Value's. By chained + * pointer to T we mean a type P such that, given a p of Type P + * *...n...*x is convertible to T&, for some n>=1. + * Examples of chained pointers are raw and smart pointers, iterators and + * arbitrary combinations of these (vg. T** or auto_ptr<T*>.) + */ + +/* NB. Some overloads of operator() have an extra dummy parameter int=0. + * This disambiguator serves several purposes: + * - Without it, MSVC++ 6.0 incorrectly regards some overloads as + * specializations of a previous member function template. + * - MSVC++ 6.0/7.0 seem to incorrectly treat some different memfuns + * as if they have the same signature. + * - If remove_const is broken due to lack of PTS, int=0 avoids the + * declaration of memfuns with identical signature. + */ + +template<class Value,typename Type,Type (*PtrToFunction)(Value)> +struct const_ref_global_fun_base +{ + typedef typename remove_reference<Type>::type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,Value>,Type>::type +#else + Type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type operator()(Value x)const + { + return PtrToFunction(x); + } + + Type operator()( + const reference_wrapper< + typename remove_reference<Value>::type>& x)const + { + return operator()(x.get()); + } + + Type operator()( + const reference_wrapper< + typename remove_const< + typename remove_reference<Value>::type>::type>& x,int=0)const + { + return operator()(x.get()); + } +}; + +template<class Value,typename Type,Type (*PtrToFunction)(Value)> +struct non_const_ref_global_fun_base +{ + typedef typename remove_reference<Type>::type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<ChainedPtr&,Value>,Type>::type +#else + Type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type operator()(Value x)const + { + return PtrToFunction(x); + } + + Type operator()( + const reference_wrapper< + typename remove_reference<Value>::type>& x)const + { + return operator()(x.get()); + } +}; + +template<class Value,typename Type,Type (*PtrToFunction)(Value)> +struct non_ref_global_fun_base +{ + typedef typename remove_reference<Type>::type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Value&>,Type>::type +#else + Type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type operator()(const Value& x)const + { + return PtrToFunction(x); + } + + Type operator()(const reference_wrapper<const Value>& x)const + { + return operator()(x.get()); + } + + Type operator()( + const reference_wrapper< + typename remove_const<Value>::type>& x,int=0)const + { + return operator()(x.get()); + } +}; + +} /* namespace multi_index::detail */ + +template<class Value,typename Type,Type (*PtrToFunction)(Value)> +struct global_fun: + mpl::if_c< + is_reference<Value>::value, + typename mpl::if_c< + is_const<typename remove_reference<Value>::type>::value, + detail::const_ref_global_fun_base<Value,Type,PtrToFunction>, + detail::non_const_ref_global_fun_base<Value,Type,PtrToFunction> + >::type, + detail::non_ref_global_fun_base<Value,Type,PtrToFunction> + >::type +{ +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/hashed_index.hpp b/Utilities/BGL/boost/multi_index/hashed_index.hpp new file mode 100644 index 0000000000000000000000000000000000000000..103eb675a1048923bb2e447e13cc9fe953ed732c --- /dev/null +++ b/Utilities/BGL/boost/multi_index/hashed_index.hpp @@ -0,0 +1,1245 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_HASHED_INDEX_HPP +#define BOOST_MULTI_INDEX_HASHED_INDEX_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/call_traits.hpp> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/limits.hpp> +#include <boost/mpl/push_front.hpp> +#include <boost/multi_index/detail/access_specifier.hpp> +#include <boost/multi_index/detail/auto_space.hpp> +#include <boost/multi_index/detail/bucket_array.hpp> +#include <boost/multi_index/detail/hash_index_iterator.hpp> +#include <boost/multi_index/detail/index_node_base.hpp> +#include <boost/multi_index/detail/modify_key_adaptor.hpp> +#include <boost/multi_index/detail/safe_ctr_proxy.hpp> +#include <boost/multi_index/detail/safe_mode.hpp> +#include <boost/multi_index/detail/scope_guard.hpp> +#include <boost/multi_index/hashed_index_fwd.hpp> +#include <boost/tuple/tuple.hpp> +#include <cstddef> +#include <functional> +#include <utility> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/serialization/nvp.hpp> +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) +#define BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT \ + detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ + detail::make_obj_guard(*this,&hashed_index::check_invariant_); \ + BOOST_JOIN(check_invariant_,__LINE__).touch(); +#else +#define BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* hashed_index adds a layer of hashed indexing to a given Super */ + +/* Most of the implementation of unique and non-unique indices is + * shared. We tell from one another on instantiation time by using + * these tags. + */ + +struct hashed_unique_tag{}; +struct hashed_non_unique_tag{}; + +template< + typename KeyFromValue,typename Hash,typename Pred, + typename SuperMeta,typename TagList,typename Category +> +class hashed_index: + BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + ,public safe_ctr_proxy_impl< + hashed_index_iterator< + hashed_index_node<typename SuperMeta::type::node_type>, + bucket_array<typename SuperMeta::type::final_allocator_type> >, + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category> > +#else + ,public safe_mode::safe_container< + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category> > +#endif +#endif + +{ +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the + * lifetime of const references bound to temporaries --precisely what + * scopeguards are. + */ + +#pragma parse_mfunc_templ off +#endif + + typedef typename SuperMeta::type super; + +protected: + typedef hashed_index_node< + typename super::node_type> node_type; + +private: + typedef typename node_type::impl_type node_impl_type; + typedef typename node_impl_type::pointer node_impl_pointer; + typedef bucket_array< + typename super::final_allocator_type> bucket_array_type; + +public: + /* types */ + + typedef typename KeyFromValue::result_type key_type; + typedef typename node_type::value_type value_type; + typedef KeyFromValue key_from_value; + typedef Hash hasher; + typedef Pred key_equal; + typedef tuple<std::size_t, + key_from_value,hasher,key_equal> ctor_args; + typedef typename super::final_allocator_type allocator_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_mode::safe_iterator< + hashed_index_iterator< + node_type,bucket_array_type>, + safe_ctr_proxy< + hashed_index_iterator< + node_type,bucket_array_type> > > iterator; +#else + typedef safe_mode::safe_iterator< + hashed_index_iterator< + node_type,bucket_array_type>, + hashed_index> iterator; +#endif +#else + typedef hashed_index_iterator< + node_type,bucket_array_type> iterator; +#endif + + typedef iterator const_iterator; + + typedef iterator local_iterator; + typedef const_iterator const_local_iterator; + typedef TagList tag_list; + +protected: + typedef typename super::final_node_type final_node_type; + typedef tuples::cons< + ctor_args, + typename super::ctor_args_list> ctor_args_list; + typedef typename mpl::push_front< + typename super::index_type_list, + hashed_index>::type index_type_list; + typedef typename mpl::push_front< + typename super::iterator_type_list, + iterator>::type iterator_type_list; + typedef typename mpl::push_front< + typename super::const_iterator_type_list, + const_iterator>::type const_iterator_type_list; + typedef typename super::copy_map_type copy_map_type; + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + typedef typename super::index_saver_type index_saver_type; + typedef typename super::index_loader_type index_loader_type; +#endif + +private: +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_ctr_proxy_impl< + hashed_index_iterator< + node_type,bucket_array_type>, + hashed_index> safe_super; +#else + typedef safe_mode::safe_container< + hashed_index> safe_super; +#endif +#endif + + typedef typename call_traits<value_type>::param_type value_param_type; + typedef typename call_traits< + key_type>::param_type key_param_type; + +public: + + /* construct/destroy/copy + * Default and copy ctors are in the protected section as indices are + * not supposed to be created on their own. No range ctor either. + */ + + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& operator=( + const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x) + { + this->final()=x.final(); + return *this; + } + + allocator_type get_allocator()const + { + return this->final().get_allocator(); + } + + /* size and capacity */ + + bool empty()const{return this->final_empty_();} + size_type size()const{return this->final_size_();} + size_type max_size()const{return this->final_max_size_();} + + /* iterators */ + + iterator begin() + { + return make_iterator( + node_type::from_impl(buckets.at(first_bucket)->next())); + } + + const_iterator begin()const + { + return make_iterator( + node_type::from_impl(buckets.at(first_bucket)->next())); + } + + iterator end(){return make_iterator(header());} + const_iterator end()const{return make_iterator(header());} + + const_iterator cbegin()const{return begin();} + const_iterator cend()const{return end();} + + iterator iterator_to(const value_type& x) + { + return make_iterator(node_from_value<node_type>(&x)); + } + + const_iterator iterator_to(const value_type& x)const + { + return make_iterator(node_from_value<node_type>(&x)); + } + + /* modifiers */ + + std::pair<iterator,bool> insert(value_param_type x) + { + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_(x); + return std::pair<iterator,bool>(make_iterator(p.first),p.second); + } + + iterator insert(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_( + x,static_cast<final_node_type*>(position.get_node())); + return make_iterator(p.first); + } + + template<typename InputIterator> + void insert(InputIterator first,InputIterator last) + { + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + iterator hint=end(); + for(;first!=last;++first)hint=insert(hint,*first); + } + + iterator erase(iterator position) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + this->final_erase_(static_cast<final_node_type*>(position++.get_node())); + return position; + } + + size_type erase(key_param_type k) + { + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + + size_type s=0; + std::size_t buc=buckets.position(hash(k)); + node_impl_pointer x=buckets.at(buc); + node_impl_pointer y=x->next(); + while(y!=x){ + if(eq(k,key(node_type::from_impl(y)->value()))){ + bool b; + do{ + node_impl_pointer z=y->next(); + b=z!=x&&eq( + key(node_type::from_impl(y)->value()), + key(node_type::from_impl(z)->value())); + this->final_erase_( + static_cast<final_node_type*>(node_type::from_impl(y))); + y=z; + ++s; + }while(b); + break; + } + y=y->next(); + } + return s; + } + + iterator erase(iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + while(first!=last){ + first=erase(first); + } + return first; + } + + bool replace(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + return this->final_replace_( + x,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier> + bool modify(iterator position,Modifier mod) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier,typename Rollback> + bool modify(iterator position,Modifier mod,Rollback back) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,back,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier> + bool modify_key(iterator position,Modifier mod) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + return modify( + position,modify_key_adaptor<Modifier,value_type,KeyFromValue>(mod,key)); + } + + template<typename Modifier,typename Rollback> + bool modify_key(iterator position,Modifier mod,Rollback back) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + return modify( + position, + modify_key_adaptor<Modifier,value_type,KeyFromValue>(mod,key), + modify_key_adaptor<Modifier,value_type,KeyFromValue>(back,key)); + } + + void clear() + { + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + this->final_clear_(); + } + + void swap(hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x) + { + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + this->final_swap_(x.final()); + } + + /* observers */ + + key_from_value key_extractor()const{return key;} + hasher hash_function()const{return hash;} + key_equal key_eq()const{return eq;} + + /* lookup */ + + /* Internally, these ops rely on const_iterator being the same + * type as iterator. + */ + + template<typename CompatibleKey> + iterator find(const CompatibleKey& k)const + { + return find(k,hash,eq); + } + + template< + typename CompatibleKey,typename CompatibleHash,typename CompatiblePred + > + iterator find( + const CompatibleKey& k, + const CompatibleHash& hash,const CompatiblePred& eq)const + { + std::size_t buc=buckets.position(hash(k)); + node_impl_pointer x=buckets.at(buc); + node_impl_pointer y=x->next(); + while(y!=x){ + if(eq(k,key(node_type::from_impl(y)->value()))){ + return make_iterator(node_type::from_impl(y)); + } + y=y->next(); + } + return end(); + } + + template<typename CompatibleKey> + size_type count(const CompatibleKey& k)const + { + return count(k,hash,eq); + } + + template< + typename CompatibleKey,typename CompatibleHash,typename CompatiblePred + > + size_type count( + const CompatibleKey& k, + const CompatibleHash& hash,const CompatiblePred& eq)const + { + size_type res=0; + std::size_t buc=buckets.position(hash(k)); + node_impl_pointer x=buckets.at(buc); + node_impl_pointer y=x->next(); + while(y!=x){ + if(eq(k,key(node_type::from_impl(y)->value()))){ + do{ + ++res; + y=y->next(); + }while(y!=x&&eq(k,key(node_type::from_impl(y)->value()))); + break; + } + y=y->next(); + } + return res; + } + + template<typename CompatibleKey> + std::pair<iterator,iterator> equal_range(const CompatibleKey& k)const + { + return equal_range(k,hash,eq); + } + + template< + typename CompatibleKey,typename CompatibleHash,typename CompatiblePred + > + std::pair<iterator,iterator> equal_range( + const CompatibleKey& k, + const CompatibleHash& hash,const CompatiblePred& eq)const + { + std::size_t buc=buckets.position(hash(k)); + node_impl_pointer x=buckets.at(buc); + node_impl_pointer y=x->next(); + while(y!=x){ + if(eq(k,key(node_type::from_impl(y)->value()))){ + node_impl_pointer y0=y; + do{ + y=y->next(); + }while(y!=x&&eq(k,key(node_type::from_impl(y)->value()))); + if(y==x){ + do{ + ++y; + }while(y==y->next()); + y=y->next(); + } + return std::pair<iterator,iterator>( + make_iterator(node_type::from_impl(y0)), + make_iterator(node_type::from_impl(y))); + } + y=y->next(); + } + return std::pair<iterator,iterator>(end(),end()); + } + + /* bucket interface */ + + size_type bucket_count()const{return buckets.size();} + size_type max_bucket_count()const{return static_cast<size_type>(-1);} + + size_type bucket_size(size_type n)const + { + size_type res=0; + node_impl_pointer x=buckets.at(n); + node_impl_pointer y=x->next(); + while(y!=x){ + ++res; + y=y->next(); + } + return res; + } + + size_type bucket(key_param_type k)const + { + return buckets.position(hash(k)); + } + + local_iterator begin(size_type n) + { + return const_cast<const hashed_index*>(this)->begin(n); + } + + const_local_iterator begin(size_type n)const + { + node_impl_pointer x=buckets.at(n); + node_impl_pointer y=x->next(); + if(y==x)return end(); + return make_iterator(node_type::from_impl(y)); + } + + local_iterator end(size_type n) + { + return const_cast<const hashed_index*>(this)->end(n); + } + + const_local_iterator end(size_type n)const + { + node_impl_pointer x=buckets.at(n); + if(x==x->next())return end(); + do{ + ++x; + }while(x==x->next()); + return make_iterator(node_type::from_impl(x->next())); + } + + const_local_iterator cbegin(size_type n)const{return begin(n);} + const_local_iterator cend(size_type n)const{return end(n);} + + local_iterator local_iterator_to(const value_type& x) + { + return make_iterator(node_from_value<node_type>(&x)); + } + + const_local_iterator local_iterator_to(const value_type& x)const + { + return make_iterator(node_from_value<node_type>(&x)); + } + + /* hash policy */ + + float load_factor()const{return static_cast<float>(size())/bucket_count();} + float max_load_factor()const{return mlf;} + void max_load_factor(float z){mlf=z;calculate_max_load();} + + void rehash(size_type n) + { + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + if(size()<max_load&&n<=bucket_count())return; + + size_type bc =(std::numeric_limits<size_type>::max)(); + float fbc=static_cast<float>(1+size()/mlf); + if(bc>fbc){ + bc=static_cast<size_type>(fbc); + if(bc<n)bc=n; + } + unchecked_rehash(bc); + } + +BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: + hashed_index(const ctor_args_list& args_list,const allocator_type& al): + super(args_list.get_tail(),al), + key(tuples::get<1>(args_list.get_head())), + hash(tuples::get<2>(args_list.get_head())), + eq(tuples::get<3>(args_list.get_head())), + buckets(al,header()->impl(),tuples::get<0>(args_list.get_head())), + mlf(1.0), + first_bucket(buckets.size()) + { + calculate_max_load(); + } + + hashed_index( + const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x): + super(x), + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super(), +#endif + + key(x.key), + hash(x.hash), + eq(x.eq), + buckets(x.get_allocator(),header()->impl(),x.buckets.size()), + mlf(x.mlf), + max_load(x.max_load), + first_bucket(x.first_bucket) + { + /* Copy ctor just takes the internal configuration objects from x. The rest + * is done in subsequent call to copy_(). + */ + } + + ~hashed_index() + { + /* the container is guaranteed to be empty by now */ + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + iterator make_iterator(node_type* node) + { + return iterator(node,&buckets,this); + } + + const_iterator make_iterator(node_type* node)const + { + return const_iterator( + node, + &const_cast<bucket_array_type&>(buckets), + const_cast<hashed_index*>(this)); + } +#else + iterator make_iterator(node_type* node) + { + return iterator(node,&buckets); + } + + const_iterator make_iterator(node_type* node)const + { + return const_iterator(node,&const_cast<bucket_array_type&>(buckets)); + } +#endif + + void copy_( + const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x, + const copy_map_type& map) + { + for(node_impl_pointer begin_org=x.buckets.begin(), + begin_cpy=buckets.begin(), + end_org=x.buckets.end(); + begin_org!=end_org;++begin_org,++begin_cpy){ + + node_impl_pointer next_org=begin_org->next(); + node_impl_pointer cpy=begin_cpy; + while(next_org!=begin_org){ + cpy->next()= + static_cast<node_type*>( + map.find( + static_cast<final_node_type*>( + node_type::from_impl(next_org))))->impl(); + next_org=next_org->next(); + cpy=cpy->next(); + } + cpy->next()=begin_cpy; + } + + super::copy_(x,map); + } + + node_type* insert_(value_param_type v,node_type* x) + { + reserve(size()+1); + + std::size_t buc=find_bucket(v); + node_impl_pointer pos=buckets.at(buc); + if(!link_point(v,pos,Category()))return node_type::from_impl(pos); + + node_type* res=static_cast<node_type*>(super::insert_(v,x)); + if(res==x){ + link(x,pos); + if(first_bucket>buc)first_bucket=buc; + } + return res; + } + + node_type* insert_(value_param_type v,node_type* position,node_type* x) + { + reserve(size()+1); + + std::size_t buc=find_bucket(v); + node_impl_pointer pos=buckets.at(buc); + if(!link_point(v,pos,Category()))return node_type::from_impl(pos); + + node_type* res=static_cast<node_type*>(super::insert_(v,position,x)); + if(res==x){ + link(x,pos); + if(first_bucket>buc)first_bucket=buc; + } + return res; + } + + void erase_(node_type* x) + { + unlink(x); + first_bucket=buckets.first_nonempty(first_bucket); + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + } + + void delete_all_nodes_() + { + for(node_impl_pointer x=buckets.begin(),x_end=buckets.end(); + x!=x_end;++x){ + node_impl_pointer y=x->next(); + while(y!=x){ + node_impl_pointer z=y->next(); + this->final_delete_node_( + static_cast<final_node_type*>(node_type::from_impl(y))); + y=z; + } + } + } + + void clear_() + { + super::clear_(); + buckets.clear(); + first_bucket=buckets.size(); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::detach_dereferenceable_iterators(); +#endif + } + + void swap_( + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x) + { + std::swap(key,x.key); + std::swap(hash,x.hash); + std::swap(eq,x.eq); + buckets.swap(x.buckets); + std::swap(mlf,x.mlf); + std::swap(max_load,x.max_load); + std::swap(first_bucket,x.first_bucket); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::swap(x); +#endif + + super::swap_(x); + } + + bool replace_(value_param_type v,node_type* x) + { + if(eq(key(v),key(x->value()))){ + return super::replace_(v,x); + } + + node_impl_pointer y=prev(x); + unlink_next(y); + + BOOST_TRY{ + std::size_t buc=find_bucket(v); + node_impl_pointer pos=buckets.at(buc); + if(link_point(v,pos,Category())&&super::replace_(v,x)){ + link(x,pos); + if(first_bucket>buc){ + first_bucket=buc; + } + else if(first_bucket<buc){ + first_bucket=buckets.first_nonempty(first_bucket); + } + return true; + } + link(x,y); + return false; + } + BOOST_CATCH(...){ + link(x,y); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + bool modify_(node_type* x) + { + std::size_t buc; + bool b; + BOOST_TRY{ + buc=find_bucket(x->value()); + b=in_place(x->impl(),key(x->value()),buc,Category()); + } + BOOST_CATCH(...){ + erase_(x); + BOOST_RETHROW; + } + BOOST_CATCH_END + if(!b){ + unlink(x); + BOOST_TRY{ + node_impl_pointer pos=buckets.at(buc); + if(!link_point(x->value(),pos,Category())){ + first_bucket=buckets.first_nonempty(first_bucket); + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + return false; + } + link(x,pos); + if(first_bucket>buc){ + first_bucket=buc; + } + else if(first_bucket<buc){ + first_bucket=buckets.first_nonempty(first_bucket); + } + } + BOOST_CATCH(...){ + first_bucket=buckets.first_nonempty(first_bucket); + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + BOOST_TRY{ + if(!super::modify_(x)){ + unlink(x); + first_bucket=buckets.first_nonempty(first_bucket); +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + return false; + } + else return true; + } + BOOST_CATCH(...){ + unlink(x); + first_bucket=buckets.first_nonempty(first_bucket); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + bool modify_rollback_(node_type* x) + { + std::size_t buc=find_bucket(x->value()); + if(in_place(x->impl(),key(x->value()),buc,Category())){ + return super::modify_rollback_(x); + } + + node_impl_pointer y=prev(x); + unlink_next(y); + + BOOST_TRY{ + node_impl_pointer pos=buckets.at(buc); + if(link_point(x->value(),pos,Category())&&super::modify_rollback_(x)){ + link(x,pos); + if(first_bucket>buc){ + first_bucket=buc; + } + else if(first_bucket<buc){ + first_bucket=buckets.first_nonempty(first_bucket); + } + return true; + } + link(x,y); + return false; + } + BOOST_CATCH(...){ + link(x,y); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* serialization */ + + template<typename Archive> + void save_( + Archive& ar,const unsigned int version,const index_saver_type& sm)const + { + ar<<serialization::make_nvp("position",buckets); + super::save_(ar,version,sm); + } + + template<typename Archive> + void load_(Archive& ar,const unsigned int version,const index_loader_type& lm) + { + ar>>serialization::make_nvp("position",buckets); + super::load_(ar,version,lm); + } +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + /* invariant stuff */ + + bool invariant_()const + { + if(size()==0||begin()==end()){ + if(size()!=0||begin()!=end())return false; + } + else{ + size_type s0=0; + for(const_iterator it=begin(),it_end=end();it!=it_end;++it,++s0){} + if(s0!=size())return false; + + size_type s1=0; + for(size_type buc=0;buc<bucket_count();++buc){ + size_type ss1=0; + for(const_local_iterator it=begin(buc),it_end=end(buc); + it!=it_end;++it,++ss1){ + if(find_bucket(*it)!=buc)return false; + } + if(ss1!=bucket_size(buc))return false; + s1+=ss1; + } + if(s1!=size())return false; + } + + if(first_bucket!=buckets.first_nonempty(0))return false; + + return super::invariant_(); + } + + /* This forwarding function eases things for the boost::mem_fn construct + * in BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT. Actually, + * final_check_invariant is already an inherited member function of index. + */ + void check_invariant_()const{this->final_check_invariant_();} +#endif + +private: + node_type* header()const{return this->final_header();} + + std::size_t find_bucket(value_param_type v)const + { + return bucket(key(v)); + } + + bool link_point( + value_param_type v,node_impl_pointer& pos,hashed_unique_tag) + { + node_impl_pointer x=pos->next(); + while(x!=pos){ + if(eq(key(v),key(node_type::from_impl(x)->value()))){ + pos=x; + return false; + } + x=x->next(); + } + return true; + } + + bool link_point( + value_param_type v,node_impl_pointer& pos,hashed_non_unique_tag) + { + node_impl_pointer prev=pos; + node_impl_pointer x=pos->next(); + while(x!=pos){ + if(eq(key(v),key(node_type::from_impl(x)->value()))){ + pos=prev; + return true; + } + prev=x; + x=x->next(); + } + return true; + } + + static void link(node_type* x,node_impl_pointer pos) + { + node_impl_type::link(x->impl(),pos); + }; + + static void link(node_impl_pointer x,node_impl_pointer pos) + { + node_impl_type::link(x,pos); + }; + + static void unlink(node_type* x) + { + node_impl_type::unlink(x->impl()); + }; + + static node_impl_pointer prev(node_type* x) + { + return node_impl_type::prev(x->impl()); + } + + static node_impl_pointer prev_from(node_type* x,node_impl_pointer y) + { + return node_impl_type::prev_from(x->impl(),y); + } + + static void unlink_next(node_impl_pointer x) + { + node_impl_type::unlink_next(x); + } + + void calculate_max_load() + { + float fml=static_cast<float>(mlf*bucket_count()); + max_load=(std::numeric_limits<size_type>::max)(); + if(max_load>fml)max_load=static_cast<size_type>(fml); + } + + void reserve(size_type n) + { + if(n>max_load){ + size_type bc =(std::numeric_limits<size_type>::max)(); + float fbc=static_cast<float>(1+n/mlf); + if(bc>fbc)bc =static_cast<size_type>(fbc); + unchecked_rehash(bc); + } + } + + void unchecked_rehash(size_type n) + { + bucket_array_type buckets1(get_allocator(),header()->impl(),n); + auto_space<std::size_t,allocator_type> hashes(get_allocator(),size()); + + std::size_t i=0; + node_impl_pointer x=buckets.begin(); + node_impl_pointer x_end=buckets.end(); + for(;x!=x_end;++x){ + node_impl_pointer y=x->next(); + while(y!=x){ + hashes.data()[i++]=hash(key(node_type::from_impl(y)->value())); + y=y->next(); + } + } + + i=0; + x=buckets.begin(); + for(;x!=x_end;++x){ + node_impl_pointer y=x->next(); + while(y!=x){ + node_impl_pointer z=y->next(); + std::size_t buc1=buckets1.position(hashes.data()[i++]); + node_impl_pointer x1=buckets1.at(buc1); + link(y,x1); + y=z; + } + } + + buckets.swap(buckets1); + calculate_max_load(); + first_bucket=buckets.first_nonempty(0); + } + + bool in_place( + node_impl_pointer x,key_param_type k,std::size_t buc, + hashed_unique_tag)const + { + std::less_equal<node_impl_pointer> leq; + node_impl_pointer bbegin=buckets.begin(); + node_impl_pointer bend=buckets.end(); + node_impl_pointer pbuc=x->next(); + + while(!leq(bbegin,pbuc)||!leq(pbuc,bend))pbuc=pbuc->next(); + if(buc!=static_cast<std::size_t>(pbuc-bbegin))return false; + + node_impl_pointer y=x; + while(y->next()!=x){ + y=y->next(); + if(y==pbuc)continue; + if(eq(k,key(node_type::from_impl(y)->value())))return false; + } + return true; + } + + bool in_place( + node_impl_pointer x,key_param_type k,std::size_t buc, + hashed_non_unique_tag)const + { + std::less_equal<node_impl_pointer> leq; + node_impl_pointer bbegin=buckets.begin(); + node_impl_pointer bend=buckets.end(); + node_impl_pointer pbuc=x->next(); + + while(!leq(bbegin,pbuc)||!leq(pbuc,bend))pbuc=pbuc->next(); + if(buc!=static_cast<std::size_t>(pbuc-bbegin))return false; + + node_impl_pointer y=x->next(); + if(y!=pbuc){ + if(eq(k,key(node_type::from_impl(y)->value()))){ + /* adjacent to equivalent element -> in place */ + return true; + } + else{ + y=y->next(); + while(y!=pbuc){ + if(eq(k,key(node_type::from_impl(y)->value())))return false; + y=y->next(); + } + } + } + while(y->next()!=x){ + y=y->next(); + if(eq(k,key(node_type::from_impl(y)->value()))){ + while(y->next()!=x){ + y=y->next(); + if(!eq(k,key(node_type::from_impl(y)->value())))return false; + } + /* after a group of equivalent elements --> in place */ + return true; + } + } + return true; + } + + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + void detach_iterators(node_type* x) + { + iterator it=make_iterator(x); + safe_mode::detach_equivalent_iterators(it); + } +#endif + + key_from_value key; + hasher hash; + key_equal eq; + bucket_array_type buckets; + float mlf; + size_type max_load; + std::size_t first_bucket; + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +#pragma parse_mfunc_templ reset +#endif +}; + +/* specialized algorithms */ + +template< + typename KeyFromValue,typename Hash,typename Pred, + typename SuperMeta,typename TagList,typename Category +> +void swap( + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x, + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& y) +{ + x.swap(y); +} + +} /* namespace multi_index::detail */ + +/* hashed index specifiers */ + +template<typename Arg1,typename Arg2,typename Arg3,typename Arg4> +struct hashed_unique +{ + typedef typename detail::hashed_index_args< + Arg1,Arg2,Arg3,Arg4> index_args; + typedef typename index_args::tag_list_type::type tag_list_type; + typedef typename index_args::key_from_value_type key_from_value_type; + typedef typename index_args::hash_type hash_type; + typedef typename index_args::pred_type pred_type; + + template<typename Super> + struct node_class + { + typedef detail::hashed_index_node<Super> type; + }; + + template<typename SuperMeta> + struct index_class + { + typedef detail::hashed_index< + key_from_value_type,hash_type,pred_type, + SuperMeta,tag_list_type,detail::hashed_unique_tag> type; + }; +}; + +template<typename Arg1,typename Arg2,typename Arg3,typename Arg4> +struct hashed_non_unique +{ + typedef typename detail::hashed_index_args< + Arg1,Arg2,Arg3,Arg4> index_args; + typedef typename index_args::tag_list_type::type tag_list_type; + typedef typename index_args::key_from_value_type key_from_value_type; + typedef typename index_args::hash_type hash_type; + typedef typename index_args::pred_type pred_type; + + template<typename Super> + struct node_class + { + typedef detail::hashed_index_node<Super> type; + }; + + template<typename SuperMeta> + struct index_class + { + typedef detail::hashed_index< + key_from_value_type,hash_type,pred_type, + SuperMeta,tag_list_type,detail::hashed_non_unique_tag> type; + }; +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#undef BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT + +#endif diff --git a/Utilities/BGL/boost/multi_index/hashed_index_fwd.hpp b/Utilities/BGL/boost/multi_index/hashed_index_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cd8c2272ad5bf888bfe8b17665e9b94b13c39b62 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/hashed_index_fwd.hpp @@ -0,0 +1,58 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_HASHED_INDEX_FWD_HPP +#define BOOST_MULTI_INDEX_HASHED_INDEX_FWD_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/multi_index/detail/hash_index_args.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template< + typename KeyFromValue,typename Hash,typename Pred, + typename SuperMeta,typename TagList,typename Category +> +class hashed_index; + +template< + typename KeyFromValue,typename Hash,typename Pred, + typename SuperMeta,typename TagList,typename Category +> +void swap( + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x, + hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& y); + +} /* namespace multi_index::detail */ + +/* hashed_index specifiers */ + +template< + typename Arg1,typename Arg2=mpl::na, + typename Arg3=mpl::na,typename Arg4=mpl::na +> +struct hashed_unique; + +template< + typename Arg1,typename Arg2=mpl::na, + typename Arg3=mpl::na,typename Arg4=mpl::na +> +struct hashed_non_unique; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/identity.hpp b/Utilities/BGL/boost/multi_index/identity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b402ad70d0dd8b245acc040efb3625bf0f2a7dd3 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/identity.hpp @@ -0,0 +1,147 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_IDENTITY_HPP +#define BOOST_MULTI_INDEX_IDENTITY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> +#include <boost/mpl/if.hpp> +#include <boost/multi_index/identity_fwd.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/utility/enable_if.hpp> + +#if !defined(BOOST_NO_SFINAE) +#include <boost/type_traits/is_convertible.hpp> +#endif + +namespace boost{ + +template<class Type> class reference_wrapper; /* fwd decl. */ + +namespace multi_index{ + +namespace detail{ + +/* identity is a do-nothing key extractor that returns the [const] Type& + * object passed. + * Additionally, identity is overloaded to support referece_wrappers + * of Type and "chained pointers" to Type's. By chained pointer to Type we + * mean a type P such that, given a p of type P + * *...n...*x is convertible to Type&, for some n>=1. + * Examples of chained pointers are raw and smart pointers, iterators and + * arbitrary combinations of these (vg. Type** or auto_ptr<Type*>.) + */ + +/* NB. Some overloads of operator() have an extra dummy parameter int=0. + * This disambiguator serves several purposes: + * - Without it, MSVC++ 6.0 incorrectly regards some overloads as + * specializations of a previous member function template. + * - MSVC++ 6.0/7.0 seem to incorrectly treat some different memfuns + * as if they have the same signature. + * - If remove_const is broken due to lack of PTS, int=0 avoids the + * declaration of memfuns with identical signature. + */ + +template<typename Type> +struct const_identity_base +{ + typedef Type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if<is_convertible<const ChainedPtr&,Type&>,Type&>::type +#else + Type& +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type& operator()(Type& x)const + { + return x; + } + + Type& operator()(const reference_wrapper<Type>& x)const + { + return x.get(); + } + + Type& operator()( + const reference_wrapper<typename remove_const<Type>::type>& x,int=0)const + { + return x.get(); + } +}; + +template<typename Type> +struct non_const_identity_base +{ + typedef Type result_type; + + /* templatized for pointer-like types */ + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Type&>,Type&>::type +#else + Type& +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + const Type& operator()(const Type& x,int=0)const + { + return x; + } + + Type& operator()(Type& x)const + { + return x; + } + + const Type& operator()(const reference_wrapper<const Type>& x,int=0)const + { + return x.get(); + } + + Type& operator()(const reference_wrapper<Type>& x)const + { + return x.get(); + } +}; + +} /* namespace multi_index::detail */ + +template<class Type> +struct identity: + mpl::if_c< + is_const<Type>::value, + detail::const_identity_base<Type>,detail::non_const_identity_base<Type> + >::type +{ +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/identity_fwd.hpp b/Utilities/BGL/boost/multi_index/identity_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..baafa43a5e29cab3f4278efdf2ba6086977323ba --- /dev/null +++ b/Utilities/BGL/boost/multi_index/identity_fwd.hpp @@ -0,0 +1,26 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_IDENTITY_FWD_HPP +#define BOOST_MULTI_INDEX_IDENTITY_FWD_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +namespace boost{ + +namespace multi_index{ + +template<class Type> struct identity; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/indexed_by.hpp b/Utilities/BGL/boost/multi_index/indexed_by.hpp new file mode 100644 index 0000000000000000000000000000000000000000..94a8dcb7c0cd3ddbc061ab5a91732e9637057872 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/indexed_by.hpp @@ -0,0 +1,72 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_INDEXED_BY_HPP +#define BOOST_MULTI_INDEX_INDEXED_BY_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/vector.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/control/expr_if.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> + +/* An alias to mpl::vector used to hide MPL from the user. + * indexed_by contains the index specifiers for instantiation + * of a multi_index_container. + */ + +/* This user_definable macro limits the number of elements of an index list; + * useful for shortening resulting symbol names (MSVC++ 6.0, for instance, + * has problems coping with very long symbol names.) + */ + +#if !defined(BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE) +#if defined(BOOST_MSVC)&&(BOOST_MSVC<1300) +#define BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE 5 +#else +#define BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE +#endif +#endif + +#if BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE<BOOST_MPL_LIMIT_VECTOR_SIZE +#define BOOST_MULTI_INDEX_INDEXED_BY_SIZE \ + BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE +#else +#define BOOST_MULTI_INDEX_INDEXED_BY_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE +#endif + +#define BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM(z,n,var) \ + typename BOOST_PP_CAT(var,n) BOOST_PP_EXPR_IF(n,=mpl::na) + +namespace boost{ + +namespace multi_index{ + +template< + BOOST_PP_ENUM( + BOOST_MULTI_INDEX_INDEXED_BY_SIZE, + BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM,T) +> +struct indexed_by: + mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_MULTI_INDEX_INDEXED_BY_SIZE,T)> +{ +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#undef BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM +#undef BOOST_MULTI_INDEX_INDEXED_BY_SIZE + +#endif diff --git a/Utilities/BGL/boost/multi_index/key_extractors.hpp b/Utilities/BGL/boost/multi_index/key_extractors.hpp new file mode 100644 index 0000000000000000000000000000000000000000..806de958b3cc146c5890e08599076d550f477498 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/key_extractors.hpp @@ -0,0 +1,22 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_KEY_EXTRACTORS_HPP +#define BOOST_MULTI_INDEX_KEY_EXTRACTORS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/multi_index/composite_key.hpp> +#include <boost/multi_index/identity.hpp> +#include <boost/multi_index/global_fun.hpp> +#include <boost/multi_index/member.hpp> +#include <boost/multi_index/mem_fun.hpp> + +#endif diff --git a/Utilities/BGL/boost/multi_index/mem_fun.hpp b/Utilities/BGL/boost/multi_index/mem_fun.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bb18c109731a69c6f142b09e0dd0be3aec9d6fa3 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/mem_fun.hpp @@ -0,0 +1,212 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_MEM_FUN_HPP +#define BOOST_MULTI_INDEX_MEM_FUN_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/if.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/utility/enable_if.hpp> + +#if !defined(BOOST_NO_SFINAE) +#include <boost/type_traits/is_convertible.hpp> +#endif + +namespace boost{ + +template<class T> class reference_wrapper; /* fwd decl. */ + +namespace multi_index{ + +/* mem_fun implements a read-only key extractor based on a given non-const + * member function of a class. + * const_mem_fun does the same for const member functions. + * Additionally, mem_fun and const_mem_fun are overloaded to support + * referece_wrappers of T and "chained pointers" to T's. By chained pointer + * to T we mean a type P such that, given a p of Type P + * *...n...*x is convertible to T&, for some n>=1. + * Examples of chained pointers are raw and smart pointers, iterators and + * arbitrary combinations of these (vg. T** or auto_ptr<T*>.) + */ + +template<class Class,typename Type,Type (Class::*PtrToMemberFunction)()const> +struct const_mem_fun +{ + typedef typename remove_reference<Type>::type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Class&>,Type>::type +#else + Type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type operator()(const Class& x)const + { + return (x.*PtrToMemberFunction)(); + } + + Type operator()(const reference_wrapper<const Class>& x)const + { + return operator()(x.get()); + } + + Type operator()(const reference_wrapper<Class>& x)const + { + return operator()(x.get()); + } +}; + +template<class Class,typename Type,Type (Class::*PtrToMemberFunction)()> +struct mem_fun +{ + typedef typename remove_reference<Type>::type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<ChainedPtr&,Class&>,Type>::type +#else + Type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type operator()(Class& x)const + { + return (x.*PtrToMemberFunction)(); + } + + Type operator()(const reference_wrapper<Class>& x)const + { + return operator()(x.get()); + } +}; + +/* MSVC++ 6.0 has problems with const member functions as non-type template + * parameters, somehow it takes them as non-const. const_mem_fun_explicit + * workarounds this deficiency by accepting an extra type parameter that + * specifies the signature of the member function. The workaround was found at: + * Daniel, C.:"Re: weird typedef problem in VC", + * news:microsoft.public.vc.language, 21st nov 2002, + * http://groups.google.com/groups? + * hl=en&lr=&ie=UTF-8&selm=ukwvg3O0BHA.1512%40tkmsftngp05 + */ + +template< + class Class,typename Type, + typename PtrToMemberFunctionType,PtrToMemberFunctionType PtrToMemberFunction> +struct const_mem_fun_explicit +{ + typedef typename remove_reference<Type>::type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Class&>,Type>::type +#else + Type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type operator()(const Class& x)const + { + return (x.*PtrToMemberFunction)(); + } + + Type operator()(const reference_wrapper<const Class>& x)const + { + return operator()(x.get()); + } + + Type operator()(const reference_wrapper<Class>& x)const + { + return operator()(x.get()); + } +}; + +template< + class Class,typename Type, + typename PtrToMemberFunctionType,PtrToMemberFunctionType PtrToMemberFunction> +struct mem_fun_explicit +{ + typedef typename remove_reference<Type>::type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<ChainedPtr&,Class&>,Type>::type +#else + Type +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type operator()(Class& x)const + { + return (x.*PtrToMemberFunction)(); + } + + Type operator()(const reference_wrapper<Class>& x)const + { + return operator()(x.get()); + } +}; + +/* BOOST_MULTI_INDEX_CONST_MEM_FUN and BOOST_MULTI_INDEX_MEM_FUN resolve to + * [const_]mem_fun_explicit for MSVC++ 6.0 and to [const_]mem_fun otherwise. + */ + +#if defined(BOOST_MSVC)&&(BOOST_MSVC<1300) + +#define BOOST_MULTI_INDEX_CONST_MEM_FUN(Class,Type,MemberFunName) \ +::boost::multi_index::const_mem_fun_explicit<\ + Class,Type,Type (Class::*)()const,&Class::MemberFunName > +#define BOOST_MULTI_INDEX_MEM_FUN(Class,Type,MemberFunName) \ +::boost::multi_index::mem_fun_explicit<\ + Class,Type,Type (Class::*)(),&Class::MemberFunName > + +#else + +#define BOOST_MULTI_INDEX_CONST_MEM_FUN(Class,Type,MemberFunName) \ +::boost::multi_index::const_mem_fun< Class,Type,&Class::MemberFunName > +#define BOOST_MULTI_INDEX_MEM_FUN(Class,Type,MemberFunName) \ +::boost::multi_index::mem_fun< Class,Type,&Class::MemberFunName > + +#endif + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/member.hpp b/Utilities/BGL/boost/multi_index/member.hpp new file mode 100644 index 0000000000000000000000000000000000000000..848e9b23b6d37095b84e96a158b0e306dd5d81bb --- /dev/null +++ b/Utilities/BGL/boost/multi_index/member.hpp @@ -0,0 +1,269 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_MEMBER_HPP +#define BOOST_MULTI_INDEX_MEMBER_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/utility/enable_if.hpp> +#include <cstddef> + +#if !defined(BOOST_NO_SFINAE) +#include <boost/type_traits/is_convertible.hpp> +#endif + +namespace boost{ + +template<class T> class reference_wrapper; /* fwd decl. */ + +namespace multi_index{ + +namespace detail{ + +/* member is a read/write key extractor for accessing a given + * member of a class. + * Additionally, member is overloaded to support referece_wrappers + * of T and "chained pointers" to T's. By chained pointer to T we mean + * a type P such that, given a p of Type P + * *...n...*x is convertible to T&, for some n>=1. + * Examples of chained pointers are raw and smart pointers, iterators and + * arbitrary combinations of these (vg. T** or auto_ptr<T*>.) + */ + +/* NB. Some overloads of operator() have an extra dummy parameter int=0. + * This disambiguator serves several purposes: + * - Without it, MSVC++ 6.0 incorrectly regards some overloads as + * specializations of a previous member function template. + * - MSVC++ 6.0/7.0 seem to incorrectly treat some different memfuns + * as if they have the same signature. + * - If remove_const is broken due to lack of PTS, int=0 avoids the + * declaration of memfuns with identical signature. + */ + +template<class Class,typename Type,Type Class::*PtrToMember> +struct const_member_base +{ + typedef Type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Class&>,Type&>::type +#else + Type& +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type& operator()(const Class& x)const + { + return x.*PtrToMember; + } + + Type& operator()(const reference_wrapper<const Class>& x)const + { + return operator()(x.get()); + } + + Type& operator()(const reference_wrapper<Class>& x,int=0)const + { + return operator()(x.get()); + } +}; + +template<class Class,typename Type,Type Class::*PtrToMember> +struct non_const_member_base +{ + typedef Type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Class&>,Type&>::type +#else + Type& +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + const Type& operator()(const Class& x,int=0)const + { + return x.*PtrToMember; + } + + Type& operator()(Class& x)const + { + return x.*PtrToMember; + } + + const Type& operator()(const reference_wrapper<const Class>& x,int=0)const + { + return operator()(x.get()); + } + + Type& operator()(const reference_wrapper<Class>& x)const + { + return operator()(x.get()); + } +}; + +} /* namespace multi_index::detail */ + +template<class Class,typename Type,Type Class::*PtrToMember> +struct member: + mpl::if_c< + is_const<Type>::value, + detail::const_member_base<Class,Type,PtrToMember>, + detail::non_const_member_base<Class,Type,PtrToMember> + >::type +{ +}; + +namespace detail{ + +/* MSVC++ 6.0 does not support properly pointers to members as + * non-type template arguments, as reported in + * http://support.microsoft.com/default.aspx?scid=kb;EN-US;249045 + * A similar problem (though not identical) is shown by MSVC++ 7.0. + * We provide an alternative to member<> accepting offsets instead + * of pointers to members. This happens to work even for non-POD + * types (although the standard forbids use of offsetof on these), + * so it serves as a workaround in this compiler for all practical + * purposes. + * Surprisingly enough, other compilers, like Intel C++ 7.0/7.1 and + * Visual Age 6.0, have similar bugs. This replacement of member<> + * can be used for them too. + */ + +template<class Class,typename Type,std::size_t OffsetOfMember> +struct const_member_offset_base +{ + typedef Type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Class&>,Type&>::type +#else + Type& +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + Type& operator()(const Class& x)const + { + return *static_cast<const Type*>( + static_cast<const void*>( + static_cast<const char*>( + static_cast<const void *>(&x))+OffsetOfMember)); + } + + Type& operator()(const reference_wrapper<const Class>& x)const + { + return operator()(x.get()); + } + + Type& operator()(const reference_wrapper<Class>& x,int=0)const + { + return operator()(x.get()); + } +}; + +template<class Class,typename Type,std::size_t OffsetOfMember> +struct non_const_member_offset_base +{ + typedef Type result_type; + + template<typename ChainedPtr> + +#if !defined(BOOST_NO_SFINAE) + typename disable_if< + is_convertible<const ChainedPtr&,const Class&>,Type&>::type +#else + Type& +#endif + + operator()(const ChainedPtr& x)const + { + return operator()(*x); + } + + const Type& operator()(const Class& x,int=0)const + { + return *static_cast<const Type*>( + static_cast<const void*>( + static_cast<const char*>( + static_cast<const void *>(&x))+OffsetOfMember)); + } + + Type& operator()(Class& x)const + { + return *static_cast<Type*>( + static_cast<void*>( + static_cast<char*>(static_cast<void *>(&x))+OffsetOfMember)); + } + + const Type& operator()(const reference_wrapper<const Class>& x,int=0)const + { + return operator()(x.get()); + } + + Type& operator()(const reference_wrapper<Class>& x)const + { + return operator()(x.get()); + } +}; + +} /* namespace multi_index::detail */ + +template<class Class,typename Type,std::size_t OffsetOfMember> +struct member_offset: + mpl::if_c< + is_const<Type>::value, + detail::const_member_offset_base<Class,Type,OffsetOfMember>, + detail::non_const_member_offset_base<Class,Type,OffsetOfMember> + >::type +{ +}; + +/* BOOST_MULTI_INDEX_MEMBER resolves to member in the normal cases, + * and to member_offset as a workaround in those defective compilers for + * which BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS is defined. + */ + +#if defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS) +#define BOOST_MULTI_INDEX_MEMBER(Class,Type,MemberName) \ +::boost::multi_index::member_offset< Class,Type,offsetof(Class,MemberName) > +#else +#define BOOST_MULTI_INDEX_MEMBER(Class,Type,MemberName) \ +::boost::multi_index::member< Class,Type,&Class::MemberName > +#endif + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/ordered_index.hpp b/Utilities/BGL/boost/multi_index/ordered_index.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4b2519c4048511ba48e7260a42c2116a87a5cd5 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/ordered_index.hpp @@ -0,0 +1,1390 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + * + * The internal implementation of red-black trees is based on that of SGI STL + * stl_tree.h file: + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef BOOST_MULTI_INDEX_ORDERED_INDEX_HPP +#define BOOST_MULTI_INDEX_ORDERED_INDEX_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/call_traits.hpp> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/iterator/reverse_iterator.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/push_front.hpp> +#include <boost/multi_index/detail/access_specifier.hpp> +#include <boost/multi_index/detail/bidir_node_iterator.hpp> +#include <boost/multi_index/detail/index_node_base.hpp> +#include <boost/multi_index/detail/modify_key_adaptor.hpp> +#include <boost/multi_index/detail/ord_index_node.hpp> +#include <boost/multi_index/detail/ord_index_ops.hpp> +#include <boost/multi_index/detail/safe_ctr_proxy.hpp> +#include <boost/multi_index/detail/safe_mode.hpp> +#include <boost/multi_index/detail/scope_guard.hpp> +#include <boost/multi_index/detail/unbounded.hpp> +#include <boost/multi_index/detail/value_compare.hpp> +#include <boost/multi_index/ordered_index_fwd.hpp> +#include <boost/ref.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/type_traits/is_same.hpp> +#include <utility> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/archive/archive_exception.hpp> +#include <boost/bind.hpp> +#include <boost/multi_index/detail/duplicates_iterator.hpp> +#include <boost/throw_exception.hpp> +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) +#define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT \ + detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ + detail::make_obj_guard(*this,&ordered_index::check_invariant_); \ + BOOST_JOIN(check_invariant_,__LINE__).touch(); +#else +#define BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* ordered_index adds a layer of ordered indexing to a given Super */ + +/* Most of the implementation of unique and non-unique indices is + * shared. We tell from one another on instantiation time by using + * these tags. + */ + +struct ordered_unique_tag{}; +struct ordered_non_unique_tag{}; + +template< + typename KeyFromValue,typename Compare, + typename SuperMeta,typename TagList,typename Category +> +class ordered_index: + BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + ,public safe_ctr_proxy_impl< + bidir_node_iterator< + ordered_index_node<typename SuperMeta::type::node_type> >, + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category> > +#else + ,public safe_mode::safe_container< + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category> > +#endif +#endif + +{ +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the + * lifetime of const references bound to temporaries --precisely what + * scopeguards are. + */ + +#pragma parse_mfunc_templ off +#endif + + typedef typename SuperMeta::type super; + +protected: + typedef ordered_index_node< + typename super::node_type> node_type; + +private: + typedef typename node_type::impl_type node_impl_type; + typedef typename node_impl_type::pointer node_impl_pointer; + +public: + /* types */ + + typedef typename KeyFromValue::result_type key_type; + typedef typename node_type::value_type value_type; + typedef KeyFromValue key_from_value; + typedef Compare key_compare; + typedef value_comparison< + value_type,KeyFromValue,Compare> value_compare; + typedef tuple<key_from_value,key_compare> ctor_args; + typedef typename super::final_allocator_type allocator_type; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_mode::safe_iterator< + bidir_node_iterator<node_type>, + safe_ctr_proxy< + bidir_node_iterator<node_type> > > iterator; +#else + typedef safe_mode::safe_iterator< + bidir_node_iterator<node_type>, + ordered_index> iterator; +#endif +#else + typedef bidir_node_iterator<node_type> iterator; +#endif + + typedef iterator const_iterator; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename + boost::reverse_iterator<iterator> reverse_iterator; + typedef typename + boost::reverse_iterator<const_iterator> const_reverse_iterator; + typedef TagList tag_list; + +protected: + typedef typename super::final_node_type final_node_type; + typedef tuples::cons< + ctor_args, + typename super::ctor_args_list> ctor_args_list; + typedef typename mpl::push_front< + typename super::index_type_list, + ordered_index>::type index_type_list; + typedef typename mpl::push_front< + typename super::iterator_type_list, + iterator>::type iterator_type_list; + typedef typename mpl::push_front< + typename super::const_iterator_type_list, + const_iterator>::type const_iterator_type_list; + typedef typename super::copy_map_type copy_map_type; + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + typedef typename super::index_saver_type index_saver_type; + typedef typename super::index_loader_type index_loader_type; +#endif + +private: +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_ctr_proxy_impl< + bidir_node_iterator<node_type>, + ordered_index> safe_super; +#else + typedef safe_mode::safe_container<ordered_index> safe_super; +#endif +#endif + + typedef typename call_traits< + value_type>::param_type value_param_type; + typedef typename call_traits< + key_type>::param_type key_param_type; + +public: + + /* construct/copy/destroy + * Default and copy ctors are in the protected section as indices are + * not supposed to be created on their own. No range ctor either. + */ + + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& operator=( + const ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x) + { + this->final()=x.final(); + return *this; + } + + allocator_type get_allocator()const + { + return this->final().get_allocator(); + } + + /* iterators */ + + iterator begin(){return make_iterator(leftmost());} + const_iterator begin()const{return make_iterator(leftmost());} + iterator end(){return make_iterator(header());} + const_iterator end()const{return make_iterator(header());} + reverse_iterator rbegin(){return make_reverse_iterator(end());} + const_reverse_iterator rbegin()const{return make_reverse_iterator(end());} + reverse_iterator rend(){return make_reverse_iterator(begin());} + const_reverse_iterator rend()const{return make_reverse_iterator(begin());} + const_iterator cbegin()const{return begin();} + const_iterator cend()const{return end();} + const_reverse_iterator crbegin()const{return rbegin();} + const_reverse_iterator crend()const{return rend();} + + iterator iterator_to(const value_type& x) + { + return make_iterator(node_from_value<node_type>(&x)); + } + + const_iterator iterator_to(const value_type& x)const + { + return make_iterator(node_from_value<node_type>(&x)); + } + + /* capacity */ + + bool empty()const{return this->final_empty_();} + size_type size()const{return this->final_size_();} + size_type max_size()const{return this->final_max_size_();} + + /* modifiers */ + + std::pair<iterator,bool> insert(value_param_type x) + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_(x); + return std::pair<iterator,bool>(make_iterator(p.first),p.second); + } + + iterator insert(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_( + x,static_cast<final_node_type*>(position.get_node())); + return make_iterator(p.first); + } + + template<typename InputIterator> + void insert(InputIterator first,InputIterator last) + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + iterator hint=end(); + for(;first!=last;++first)hint=insert(hint,*first); + } + + iterator erase(iterator position) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + this->final_erase_(static_cast<final_node_type*>(position++.get_node())); + return position; + } + + size_type erase(key_param_type x) + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pair<iterator,iterator> p=equal_range(x); + size_type s=0; + while(p.first!=p.second){ + p.first=erase(p.first); + ++s; + } + return s; + } + + iterator erase(iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + while(first!=last){ + first=erase(first); + } + return first; + } + + bool replace(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + return this->final_replace_( + x,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier> + bool modify(iterator position,Modifier mod) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier,typename Rollback> + bool modify(iterator position,Modifier mod,Rollback back) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,back,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier> + bool modify_key(iterator position,Modifier mod) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + return modify( + position,modify_key_adaptor<Modifier,value_type,KeyFromValue>(mod,key)); + } + + template<typename Modifier,typename Rollback> + bool modify_key(iterator position,Modifier mod,Rollback back) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + return modify( + position, + modify_key_adaptor<Modifier,value_type,KeyFromValue>(mod,key), + modify_key_adaptor<Modifier,value_type,KeyFromValue>(back,key)); + } + + void swap(ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x) + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + this->final_swap_(x.final()); + } + + void clear() + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + this->final_clear_(); + } + + /* observers */ + + key_from_value key_extractor()const{return key;} + key_compare key_comp()const{return comp;} + value_compare value_comp()const{return value_compare(key,comp);} + + /* set operations */ + + /* Internally, these ops rely on const_iterator being the same + * type as iterator. + */ + + template<typename CompatibleKey> + iterator find(const CompatibleKey& x)const + { + return make_iterator(ordered_index_find(root(),header(),key,x,comp)); + } + + template<typename CompatibleKey,typename CompatibleCompare> + iterator find( + const CompatibleKey& x,const CompatibleCompare& comp)const + { + return make_iterator(ordered_index_find(root(),header(),key,x,comp)); + } + + template<typename CompatibleKey> + size_type count(const CompatibleKey& x)const + { + return count(x,comp); + } + + template<typename CompatibleKey,typename CompatibleCompare> + size_type count(const CompatibleKey& x,const CompatibleCompare& comp)const + { + std::pair<iterator,iterator> p=equal_range(x,comp); + size_type n=std::distance(p.first,p.second); + return n; + } + + template<typename CompatibleKey> + iterator lower_bound(const CompatibleKey& x)const + { + return make_iterator( + ordered_index_lower_bound(root(),header(),key,x,comp)); + } + + template<typename CompatibleKey,typename CompatibleCompare> + iterator lower_bound( + const CompatibleKey& x,const CompatibleCompare& comp)const + { + return make_iterator( + ordered_index_lower_bound(root(),header(),key,x,comp)); + } + + template<typename CompatibleKey> + iterator upper_bound(const CompatibleKey& x)const + { + return make_iterator( + ordered_index_upper_bound(root(),header(),key,x,comp)); + } + + template<typename CompatibleKey,typename CompatibleCompare> + iterator upper_bound( + const CompatibleKey& x,const CompatibleCompare& comp)const + { + return make_iterator( + ordered_index_upper_bound(root(),header(),key,x,comp)); + } + + template<typename CompatibleKey> + std::pair<iterator,iterator> equal_range( + const CompatibleKey& x)const + { + std::pair<node_type*,node_type*> p= + ordered_index_equal_range(root(),header(),key,x,comp); + return std::pair<iterator,iterator>( + make_iterator(p.first),make_iterator(p.second)); + } + + template<typename CompatibleKey,typename CompatibleCompare> + std::pair<iterator,iterator> equal_range( + const CompatibleKey& x,const CompatibleCompare& comp)const + { + std::pair<node_type*,node_type*> p= + ordered_index_equal_range(root(),header(),key,x,comp); + return std::pair<iterator,iterator>( + make_iterator(p.first),make_iterator(p.second)); + } + + /* range */ + + template<typename LowerBounder,typename UpperBounder> + std::pair<iterator,iterator> + range(LowerBounder lower,UpperBounder upper)const + { + typedef typename mpl::if_< + is_same<LowerBounder,unbounded_type>, + BOOST_DEDUCED_TYPENAME mpl::if_< + is_same<UpperBounder,unbounded_type>, + both_unbounded_tag, + lower_unbounded_tag + >::type, + BOOST_DEDUCED_TYPENAME mpl::if_< + is_same<UpperBounder,unbounded_type>, + upper_unbounded_tag, + none_unbounded_tag + >::type + >::type dispatch; + + return range(lower,upper,dispatch()); + } + +BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: + ordered_index(const ctor_args_list& args_list,const allocator_type& al): + super(args_list.get_tail(),al), + key(tuples::get<0>(args_list.get_head())), + comp(tuples::get<1>(args_list.get_head())) + { + empty_initialize(); + } + + ordered_index( + const ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x): + super(x), + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super(), +#endif + + key(x.key), + comp(x.comp) + { + /* Copy ctor just takes the key and compare objects from x. The rest is + * done in subsequent call to copy_(). + */ + } + + ~ordered_index() + { + /* the container is guaranteed to be empty by now */ + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + iterator make_iterator(node_type* node){return iterator(node,this);} + const_iterator make_iterator(node_type* node)const + {return const_iterator(node,const_cast<ordered_index*>(this));} +#else + iterator make_iterator(node_type* node){return iterator(node);} + const_iterator make_iterator(node_type* node)const + {return const_iterator(node);} +#endif + + void copy_( + const ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x, + const copy_map_type& map) + { + if(!x.root()){ + empty_initialize(); + } + else{ + header()->color()=x.header()->color(); + + node_type* root_cpy=map.find(static_cast<final_node_type*>(x.root())); + header()->parent()=root_cpy->impl(); + + node_type* leftmost_cpy=map.find( + static_cast<final_node_type*>(x.leftmost())); + header()->left()=leftmost_cpy->impl(); + + node_type* rightmost_cpy=map.find( + static_cast<final_node_type*>(x.rightmost())); + header()->right()=rightmost_cpy->impl(); + + typedef typename copy_map_type::const_iterator copy_map_iterator; + for(copy_map_iterator it=map.begin(),it_end=map.end();it!=it_end;++it){ + node_type* org=it->first; + node_type* cpy=it->second; + + cpy->color()=org->color(); + + node_impl_pointer parent_org=org->parent(); + if(parent_org==node_impl_pointer(0))cpy->parent()=node_impl_pointer(0); + else{ + node_type* parent_cpy=map.find( + static_cast<final_node_type*>(node_type::from_impl(parent_org))); + cpy->parent()=parent_cpy->impl(); + if(parent_org->left()==org->impl()){ + parent_cpy->left()=cpy->impl(); + } + else if(parent_org->right()==org->impl()){ + /* header() does not satisfy this nor the previous check */ + parent_cpy->right()=cpy->impl(); + } + } + + if(org->left()==node_impl_pointer(0)) + cpy->left()=node_impl_pointer(0); + if(org->right()==node_impl_pointer(0)) + cpy->right()=node_impl_pointer(0); + } + } + + super::copy_(x,map); + } + + node_type* insert_(value_param_type v,node_type* x) + { + link_info inf; + if(!link_point(key(v),inf,Category())){ + return node_type::from_impl(inf.pos); + } + + node_type* res=static_cast<node_type*>(super::insert_(v,x)); + if(res==x){ + node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); + } + return res; + } + + node_type* insert_(value_param_type v,node_type* position,node_type* x) + { + link_info inf; + if(!hinted_link_point(key(v),position,inf,Category())){ + return node_type::from_impl(inf.pos); + } + + node_type* res=static_cast<node_type*>(super::insert_(v,position,x)); + if(res==x){ + node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); + } + return res; + } + + void erase_(node_type* x) + { + node_impl_type::rebalance_for_erase( + x->impl(),header()->parent(),header()->left(),header()->right()); + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + } + + void delete_all_nodes_() + { + delete_all_nodes(root()); + } + + void clear_() + { + super::clear_(); + empty_initialize(); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::detach_dereferenceable_iterators(); +#endif + } + + void swap_(ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x) + { + std::swap(key,x.key); + std::swap(comp,x.comp); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::swap(x); +#endif + + super::swap_(x); + } + + bool replace_(value_param_type v,node_type* x) + { + if(in_place(v,x,Category())){ + return super::replace_(v,x); + } + + node_type* next=x; + node_type::increment(next); + + node_impl_type::rebalance_for_erase( + x->impl(),header()->parent(),header()->left(),header()->right()); + + BOOST_TRY{ + link_info inf; + if(link_point(key(v),inf,Category())&&super::replace_(v,x)){ + node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); + return true; + } + node_impl_type::restore(x->impl(),next->impl(),header()->impl()); + return false; + } + BOOST_CATCH(...){ + node_impl_type::restore(x->impl(),next->impl(),header()->impl()); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + bool modify_(node_type* x) + { + bool b; + BOOST_TRY{ + b=in_place(x->value(),x,Category()); + } + BOOST_CATCH(...){ + erase_(x); + BOOST_RETHROW; + } + BOOST_CATCH_END + if(!b){ + node_impl_type::rebalance_for_erase( + x->impl(),header()->parent(),header()->left(),header()->right()); + BOOST_TRY{ + link_info inf; + if(!link_point(key(x->value()),inf,Category())){ + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + return false; + } + node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); + } + BOOST_CATCH(...){ + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + BOOST_TRY{ + if(!super::modify_(x)){ + node_impl_type::rebalance_for_erase( + x->impl(),header()->parent(),header()->left(),header()->right()); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + return false; + } + else return true; + } + BOOST_CATCH(...){ + node_impl_type::rebalance_for_erase( + x->impl(),header()->parent(),header()->left(),header()->right()); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + bool modify_rollback_(node_type* x) + { + if(in_place(x->value(),x,Category())){ + return super::modify_rollback_(x); + } + + node_type* next=x; + node_type::increment(next); + + node_impl_type::rebalance_for_erase( + x->impl(),header()->parent(),header()->left(),header()->right()); + + BOOST_TRY{ + link_info inf; + if(link_point(key(x->value()),inf,Category())&& + super::modify_rollback_(x)){ + node_impl_type::link(x->impl(),inf.side,inf.pos,header()->impl()); + return true; + } + node_impl_type::restore(x->impl(),next->impl(),header()->impl()); + return false; + } + BOOST_CATCH(...){ + node_impl_type::restore(x->impl(),next->impl(),header()->impl()); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* serialization */ + + template<typename Archive> + void save_( + Archive& ar,const unsigned int version,const index_saver_type& sm)const + { + save_(ar,version,sm,Category()); + } + + template<typename Archive> + void load_(Archive& ar,const unsigned int version,const index_loader_type& lm) + { + load_(ar,version,lm,Category()); + } +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + /* invariant stuff */ + + bool invariant_()const + { + if(size()==0||begin()==end()){ + if(size()!=0||begin()!=end()|| + header()->left()!=header()->impl()|| + header()->right()!=header()->impl())return false; + } + else{ + if((size_type)std::distance(begin(),end())!=size())return false; + + std::size_t len=node_impl_type::black_count( + leftmost()->impl(),root()->impl()); + for(const_iterator it=begin(),it_end=end();it!=it_end;++it){ + node_type* x=it.get_node(); + node_type* left_x=node_type::from_impl(x->left()); + node_type* right_x=node_type::from_impl(x->right()); + + if(x->color()==red){ + if((left_x&&left_x->color()==red)|| + (right_x&&right_x->color()==red))return false; + } + if(left_x&&comp(key(x->value()),key(left_x->value())))return false; + if(right_x&&comp(key(right_x->value()),key(x->value())))return false; + if(!left_x&&!right_x&& + node_impl_type::black_count(x->impl(),root()->impl())!=len) + return false; + } + + if(leftmost()->impl()!=node_impl_type::minimum(root()->impl())) + return false; + if(rightmost()->impl()!=node_impl_type::maximum(root()->impl())) + return false; + } + + return super::invariant_(); + } + + + /* This forwarding function eases things for the boost::mem_fn construct + * in BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT. Actually, + * final_check_invariant is already an inherited member function of + * ordered_index. + */ + void check_invariant_()const{this->final_check_invariant_();} +#endif + +private: + node_type* header()const{return this->final_header();} + node_type* root()const{return node_type::from_impl(header()->parent());} + node_type* leftmost()const{return node_type::from_impl(header()->left());} + node_type* rightmost()const{return node_type::from_impl(header()->right());} + + void empty_initialize() + { + header()->color()=red; + /* used to distinguish header() from root, in iterator.operator++ */ + + header()->parent()=node_impl_pointer(0); + header()->left()=header()->impl(); + header()->right()=header()->impl(); + } + + struct link_info + { + link_info():side(to_left){} + + ordered_index_side side; + node_impl_pointer pos; + }; + + bool link_point(key_param_type k,link_info& inf,ordered_unique_tag) + { + node_type* y=header(); + node_type* x=root(); + bool c=true; + while(x){ + y=x; + c=comp(k,key(x->value())); + x=node_type::from_impl(c?x->left():x->right()); + } + node_type* yy=y; + if(c){ + if(yy==leftmost()){ + inf.side=to_left; + inf.pos=y->impl(); + return true; + } + else node_type::decrement(yy); + } + + if(comp(key(yy->value()),k)){ + inf.side=c?to_left:to_right; + inf.pos=y->impl(); + return true; + } + else{ + inf.pos=yy->impl(); + return false; + } + } + + bool link_point(key_param_type k,link_info& inf,ordered_non_unique_tag) + { + node_type* y=header(); + node_type* x=root(); + bool c=true; + while (x){ + y=x; + c=comp(k,key(x->value())); + x=node_type::from_impl(c?x->left():x->right()); + } + inf.side=c?to_left:to_right; + inf.pos=y->impl(); + return true; + } + + bool lower_link_point(key_param_type k,link_info& inf,ordered_non_unique_tag) + { + node_type* y=header(); + node_type* x=root(); + bool c=false; + while (x){ + y=x; + c=comp(key(x->value()),k); + x=node_type::from_impl(c?x->right():x->left()); + } + inf.side=c?to_right:to_left; + inf.pos=y->impl(); + return true; + } + + bool hinted_link_point( + key_param_type k,node_type* position,link_info& inf,ordered_unique_tag) + { + if(position->impl()==header()->left()){ + if(size()>0&&comp(k,key(position->value()))){ + inf.side=to_left; + inf.pos=position->impl(); + return true; + } + else return link_point(k,inf,ordered_unique_tag()); + } + else if(position==header()){ + if(comp(key(rightmost()->value()),k)){ + inf.side=to_right; + inf.pos=rightmost()->impl(); + return true; + } + else return link_point(k,inf,ordered_unique_tag()); + } + else{ + node_type* before=position; + node_type::decrement(before); + if(comp(key(before->value()),k)&&comp(k,key(position->value()))){ + if(before->right()==node_impl_pointer(0)){ + inf.side=to_right; + inf.pos=before->impl(); + return true; + } + else{ + inf.side=to_left; + inf.pos=position->impl(); + return true; + } + } + else return link_point(k,inf,ordered_unique_tag()); + } + } + + bool hinted_link_point( + key_param_type k,node_type* position,link_info& inf,ordered_non_unique_tag) + { + if(position->impl()==header()->left()){ + if(size()>0&&!comp(key(position->value()),k)){ + inf.side=to_left; + inf.pos=position->impl(); + return true; + } + else return lower_link_point(k,inf,ordered_non_unique_tag()); + } + else if(position==header()){ + if(!comp(k,key(rightmost()->value()))){ + inf.side=to_right; + inf.pos=rightmost()->impl(); + return true; + } + else return link_point(k,inf,ordered_non_unique_tag()); + } + else{ + node_type* before=position; + node_type::decrement(before); + if(!comp(k,key(before->value()))){ + if(!comp(key(position->value()),k)){ + if(before->right()==node_impl_pointer(0)){ + inf.side=to_right; + inf.pos=before->impl(); + return true; + } + else{ + inf.side=to_left; + inf.pos=position->impl(); + return true; + } + } + else return lower_link_point(k,inf,ordered_non_unique_tag()); + } + else return link_point(k,inf,ordered_non_unique_tag()); + } + } + + void delete_all_nodes(node_type* x) + { + if(!x)return; + + delete_all_nodes(node_type::from_impl(x->left())); + delete_all_nodes(node_type::from_impl(x->right())); + this->final_delete_node_(static_cast<final_node_type*>(x)); + } + + bool in_place(value_param_type v,node_type* x,ordered_unique_tag) + { + node_type* y; + if(x!=leftmost()){ + y=x; + node_type::decrement(y); + if(!comp(key(y->value()),key(v)))return false; + } + + y=x; + node_type::increment(y); + return y==header()||comp(key(v),key(y->value())); + } + + bool in_place(value_param_type v,node_type* x,ordered_non_unique_tag) + { + node_type* y; + if(x!=leftmost()){ + y=x; + node_type::decrement(y); + if(comp(key(v),key(y->value())))return false; + } + + y=x; + node_type::increment(y); + return y==header()||!comp(key(y->value()),key(v)); + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + void detach_iterators(node_type* x) + { + iterator it=make_iterator(x); + safe_mode::detach_equivalent_iterators(it); + } +#endif + + template<typename LowerBounder,typename UpperBounder> + std::pair<iterator,iterator> + range(LowerBounder lower,UpperBounder upper,none_unbounded_tag)const + { + node_type* y=header(); + node_type* z=root(); + + while(z){ + if(!lower(key(z->value()))){ + z=node_type::from_impl(z->right()); + } + else if(!upper(key(z->value()))){ + y=z; + z=node_type::from_impl(z->left()); + } + else{ + return std::pair<iterator,iterator>( + make_iterator( + lower_range(node_type::from_impl(z->left()),z,lower)), + make_iterator( + upper_range(node_type::from_impl(z->right()),y,upper))); + } + } + + return std::pair<iterator,iterator>(make_iterator(y),make_iterator(y)); + } + + template<typename LowerBounder,typename UpperBounder> + std::pair<iterator,iterator> + range(LowerBounder,UpperBounder upper,lower_unbounded_tag)const + { + return std::pair<iterator,iterator>( + begin(), + make_iterator(upper_range(root(),header(),upper))); + } + + template<typename LowerBounder,typename UpperBounder> + std::pair<iterator,iterator> + range(LowerBounder lower,UpperBounder,upper_unbounded_tag)const + { + return std::pair<iterator,iterator>( + make_iterator(lower_range(root(),header(),lower)), + end()); + } + + template<typename LowerBounder,typename UpperBounder> + std::pair<iterator,iterator> + range(LowerBounder,UpperBounder,both_unbounded_tag)const + { + return std::pair<iterator,iterator>(begin(),end()); + } + + template<typename LowerBounder> + node_type * lower_range(node_type* top,node_type* y,LowerBounder lower)const + { + while(top){ + if(lower(key(top->value()))){ + y=top; + top=node_type::from_impl(top->left()); + } + else top=node_type::from_impl(top->right()); + } + + return y; + } + + template<typename UpperBounder> + node_type * upper_range(node_type* top,node_type* y,UpperBounder upper)const + { + while(top){ + if(!upper(key(top->value()))){ + y=top; + top=node_type::from_impl(top->left()); + } + else top=node_type::from_impl(top->right()); + } + + return y; + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + template<typename Archive> + void save_( + Archive& ar,const unsigned int version,const index_saver_type& sm, + ordered_unique_tag)const + { + super::save_(ar,version,sm); + } + + template<typename Archive> + void load_( + Archive& ar,const unsigned int version,const index_loader_type& lm, + ordered_unique_tag) + { + super::load_(ar,version,lm); + } + + template<typename Archive> + void save_( + Archive& ar,const unsigned int version,const index_saver_type& sm, + ordered_non_unique_tag)const + { + typedef duplicates_iterator<node_type,value_compare> dup_iterator; + + sm.save( + dup_iterator(begin().get_node(),end().get_node(),value_comp()), + dup_iterator(end().get_node(),value_comp()), + ar,version); + super::save_(ar,version,sm); + } + + template<typename Archive> + void load_( + Archive& ar,const unsigned int version,const index_loader_type& lm, + ordered_non_unique_tag) + { + lm.load( + ::boost::bind(&ordered_index::rearranger,this,_1,_2), + ar,version); + super::load_(ar,version,lm); + } + + void rearranger(node_type* position,node_type *x) + { + if(!position||comp(key(position->value()),key(x->value()))){ + position=lower_bound(key(x->value())).get_node(); + } + else if(comp(key(x->value()),key(position->value()))){ + /* inconsistent rearrangement */ + throw_exception( + archive::archive_exception( + archive::archive_exception::other_exception)); + } + else node_type::increment(position); + + if(position!=x){ + node_impl_type::rebalance_for_erase( + x->impl(),header()->parent(),header()->left(),header()->right()); + node_impl_type::restore( + x->impl(),position->impl(),header()->impl()); + } + } +#endif /* serialization */ + + key_from_value key; + key_compare comp; + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +#pragma parse_mfunc_templ reset +#endif +}; + +/* comparison */ + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator==( + const ordered_index<KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index<KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y) +{ + return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin()); +} + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator<( + const ordered_index<KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index<KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y) +{ + return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); +} + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator!=( + const ordered_index<KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index<KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y) +{ + return !(x==y); +} + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator>( + const ordered_index<KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index<KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y) +{ + return y<x; +} + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator>=( + const ordered_index<KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index<KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y) +{ + return !(x<y); +} + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator<=( + const ordered_index<KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index<KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y) +{ + return !(x>y); +} + +/* specialized algorithms */ + +template< + typename KeyFromValue,typename Compare, + typename SuperMeta,typename TagList,typename Category +> +void swap( + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x, + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& y) +{ + x.swap(y); +} + +} /* namespace multi_index::detail */ + +/* ordered_index specifiers */ + +template<typename Arg1,typename Arg2,typename Arg3> +struct ordered_unique +{ + typedef typename detail::ordered_index_args< + Arg1,Arg2,Arg3> index_args; + typedef typename index_args::tag_list_type::type tag_list_type; + typedef typename index_args::key_from_value_type key_from_value_type; + typedef typename index_args::compare_type compare_type; + + template<typename Super> + struct node_class + { + typedef detail::ordered_index_node<Super> type; + }; + + template<typename SuperMeta> + struct index_class + { + typedef detail::ordered_index< + key_from_value_type,compare_type, + SuperMeta,tag_list_type,detail::ordered_unique_tag> type; + }; +}; + +template<typename Arg1,typename Arg2,typename Arg3> +struct ordered_non_unique +{ + typedef detail::ordered_index_args< + Arg1,Arg2,Arg3> index_args; + typedef typename index_args::tag_list_type::type tag_list_type; + typedef typename index_args::key_from_value_type key_from_value_type; + typedef typename index_args::compare_type compare_type; + + template<typename Super> + struct node_class + { + typedef detail::ordered_index_node<Super> type; + }; + + template<typename SuperMeta> + struct index_class + { + typedef detail::ordered_index< + key_from_value_type,compare_type, + SuperMeta,tag_list_type,detail::ordered_non_unique_tag> type; + }; +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#undef BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT + +#endif diff --git a/Utilities/BGL/boost/multi_index/ordered_index_fwd.hpp b/Utilities/BGL/boost/multi_index/ordered_index_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6288a712d04c89b70821a8a1077d7818cf665f93 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/ordered_index_fwd.hpp @@ -0,0 +1,124 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_ORDERED_INDEX_FWD_HPP +#define BOOST_MULTI_INDEX_ORDERED_INDEX_FWD_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/multi_index/detail/ord_index_args.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template< + typename KeyFromValue,typename Compare, + typename SuperMeta,typename TagList,typename Category +> +class ordered_index; + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator==( + const ordered_index< + KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index< + KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y); + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator<( + const ordered_index< + KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index< + KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y); + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator!=( + const ordered_index< + KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index< + KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y); + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator>( + const ordered_index< + KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index< + KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y); + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator>=( + const ordered_index< + KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index< + KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y); + +template< + typename KeyFromValue1,typename Compare1, + typename SuperMeta1,typename TagList1,typename Category1, + typename KeyFromValue2,typename Compare2, + typename SuperMeta2,typename TagList2,typename Category2 +> +bool operator<=( + const ordered_index< + KeyFromValue1,Compare1,SuperMeta1,TagList1,Category1>& x, + const ordered_index< + KeyFromValue2,Compare2,SuperMeta2,TagList2,Category2>& y); + +template< + typename KeyFromValue,typename Compare, + typename SuperMeta,typename TagList,typename Category +> +void swap( + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& x, + ordered_index<KeyFromValue,Compare,SuperMeta,TagList,Category>& y); + +} /* namespace multi_index::detail */ + +/* ordered_index specifiers */ + +template<typename Arg1,typename Arg2=mpl::na,typename Arg3=mpl::na> +struct ordered_unique; + +template<typename Arg1,typename Arg2=mpl::na,typename Arg3=mpl::na> +struct ordered_non_unique; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/random_access_index.hpp b/Utilities/BGL/boost/multi_index/random_access_index.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b779549369517076b0cf27887619adb8390473e5 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/random_access_index.hpp @@ -0,0 +1,1008 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_RANDOM_ACCESS_INDEX_HPP +#define BOOST_MULTI_INDEX_RANDOM_ACCESS_INDEX_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/call_traits.hpp> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/iterator/reverse_iterator.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/push_front.hpp> +#include <boost/multi_index/detail/access_specifier.hpp> +#include <boost/multi_index/detail/index_node_base.hpp> +#include <boost/multi_index/detail/rnd_node_iterator.hpp> +#include <boost/multi_index/detail/rnd_index_node.hpp> +#include <boost/multi_index/detail/rnd_index_ops.hpp> +#include <boost/multi_index/detail/rnd_index_ptr_array.hpp> +#include <boost/multi_index/detail/safe_ctr_proxy.hpp> +#include <boost/multi_index/detail/safe_mode.hpp> +#include <boost/multi_index/detail/scope_guard.hpp> +#include <boost/multi_index/random_access_index_fwd.hpp> +#include <boost/throw_exception.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <cstddef> +#include <functional> +#include <stdexcept> +#include <utility> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/bind.hpp> +#include <boost/multi_index/detail/rnd_index_loader.hpp> +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) +#define BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT \ + detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ + detail::make_obj_guard(*this,&random_access_index::check_invariant_); \ + BOOST_JOIN(check_invariant_,__LINE__).touch(); +#else +#define BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* random_access_index adds a layer of random access indexing + * to a given Super + */ + +template<typename SuperMeta,typename TagList> +class random_access_index: + BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + ,public safe_ctr_proxy_impl< + rnd_node_iterator< + random_access_index_node<typename SuperMeta::type::node_type> >, + random_access_index<SuperMeta,TagList> > +#else + ,public safe_mode::safe_container< + random_access_index<SuperMeta,TagList> > +#endif +#endif + +{ +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the + * lifetime of const references bound to temporaries --precisely what + * scopeguards are. + */ + +#pragma parse_mfunc_templ off +#endif + + typedef typename SuperMeta::type super; + +protected: + typedef random_access_index_node< + typename super::node_type> node_type; + +private: + typedef typename node_type::impl_type node_impl_type; + typedef random_access_index_ptr_array< + typename super::final_allocator_type> ptr_array; + typedef typename ptr_array::pointer node_impl_ptr_pointer; + +public: + /* types */ + + typedef typename node_type::value_type value_type; + typedef tuples::null_type ctor_args; + typedef typename super::final_allocator_type allocator_type; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_mode::safe_iterator< + rnd_node_iterator<node_type>, + safe_ctr_proxy< + rnd_node_iterator<node_type> > > iterator; +#else + typedef safe_mode::safe_iterator< + rnd_node_iterator<node_type>, + random_access_index> iterator; +#endif +#else + typedef rnd_node_iterator<node_type> iterator; +#endif + + typedef iterator const_iterator; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename + boost::reverse_iterator<iterator> reverse_iterator; + typedef typename + boost::reverse_iterator<const_iterator> const_reverse_iterator; + typedef TagList tag_list; + +protected: + typedef typename super::final_node_type final_node_type; + typedef tuples::cons< + ctor_args, + typename super::ctor_args_list> ctor_args_list; + typedef typename mpl::push_front< + typename super::index_type_list, + random_access_index>::type index_type_list; + typedef typename mpl::push_front< + typename super::iterator_type_list, + iterator>::type iterator_type_list; + typedef typename mpl::push_front< + typename super::const_iterator_type_list, + const_iterator>::type const_iterator_type_list; + typedef typename super::copy_map_type copy_map_type; + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + typedef typename super::index_saver_type index_saver_type; + typedef typename super::index_loader_type index_loader_type; +#endif + +private: +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_ctr_proxy_impl< + rnd_node_iterator<node_type>, + random_access_index> safe_super; +#else + typedef safe_mode::safe_container< + random_access_index> safe_super; +#endif +#endif + + typedef typename call_traits< + value_type>::param_type value_param_type; + +public: + + /* construct/copy/destroy + * Default and copy ctors are in the protected section as indices are + * not supposed to be created on their own. No range ctor either. + */ + + random_access_index<SuperMeta,TagList>& operator=( + const random_access_index<SuperMeta,TagList>& x) + { + this->final()=x.final(); + return *this; + } + + template <class InputIterator> + void assign(InputIterator first,InputIterator last) + { + assign_iter(first,last,mpl::not_<is_integral<InputIterator> >()); + } + + void assign(size_type n,value_param_type value) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + clear(); + for(size_type i=0;i<n;++i)push_back(value); + } + + allocator_type get_allocator()const + { + return this->final().get_allocator(); + } + + /* iterators */ + + iterator begin() + {return make_iterator(node_type::from_impl(*ptrs.begin()));} + const_iterator begin()const + {return make_iterator(node_type::from_impl(*ptrs.begin()));} + iterator end(){return make_iterator(header());} + const_iterator end()const{return make_iterator(header());} + reverse_iterator rbegin(){return make_reverse_iterator(end());} + const_reverse_iterator rbegin()const{return make_reverse_iterator(end());} + reverse_iterator rend(){return make_reverse_iterator(begin());} + const_reverse_iterator rend()const{return make_reverse_iterator(begin());} + const_iterator cbegin()const{return begin();} + const_iterator cend()const{return end();} + const_reverse_iterator crbegin()const{return rbegin();} + const_reverse_iterator crend()const{return rend();} + + iterator iterator_to(const value_type& x) + { + return make_iterator(node_from_value<node_type>(&x)); + } + + const_iterator iterator_to(const value_type& x)const + { + return make_iterator(node_from_value<node_type>(&x)); + } + + /* capacity */ + + bool empty()const{return this->final_empty_();} + size_type size()const{return this->final_size_();} + size_type max_size()const{return this->final_max_size_();} + size_type capacity()const{return ptrs.capacity();} + void reserve(size_type n){ptrs.reserve(n);} + + void resize(size_type n,value_param_type x=value_type()) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + if(n>size())insert(end(),n-size(),x); + else if(n<size())erase(begin()+n,end()); + } + + /* access: no non-const versions provided as random_access_index + * handles const elements. + */ + + const_reference operator[](size_type n)const + { + BOOST_MULTI_INDEX_SAFE_MODE_ASSERT(n<size(),safe_mode::out_of_bounds); + return node_type::from_impl(*ptrs.at(n))->value(); + } + + const_reference at(size_type n)const + { + if(n>=size())throw_exception(std::out_of_range("random access index")); + return node_type::from_impl(*ptrs.at(n))->value(); + } + + const_reference front()const{return operator[](0);} + const_reference back()const{return operator[](size()-1);} + + /* modifiers */ + + std::pair<iterator,bool> push_front(value_param_type x) + {return insert(begin(),x);} + void pop_front(){erase(begin());} + std::pair<iterator,bool> push_back(value_param_type x) + {return insert(end(),x);} + void pop_back(){erase(--end());} + + std::pair<iterator,bool> insert(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_(x); + if(p.second&&position.get_node()!=header()){ + relocate(position.get_node(),p.first); + } + return std::pair<iterator,bool>(make_iterator(p.first),p.second); + } + + void insert(iterator position,size_type n,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + size_type s=0; + BOOST_TRY{ + while(n--){ + if(push_back(x).second)++s; + } + } + BOOST_CATCH(...){ + relocate(position,end()-s,end()); + BOOST_RETHROW; + } + BOOST_CATCH_END + relocate(position,end()-s,end()); + } + + template<typename InputIterator> + void insert(iterator position,InputIterator first,InputIterator last) + { + insert_iter(position,first,last,mpl::not_<is_integral<InputIterator> >()); + } + + iterator erase(iterator position) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + this->final_erase_(static_cast<final_node_type*>(position++.get_node())); + return position; + } + + iterator erase(iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + difference_type n=last-first; + relocate(end(),first,last); + while(n--)pop_back(); + return last; + } + + bool replace(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + return this->final_replace_( + x,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier> + bool modify(iterator position,Modifier mod) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier,typename Rollback> + bool modify(iterator position,Modifier mod,Rollback back) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,back,static_cast<final_node_type*>(position.get_node())); + } + + void swap(random_access_index<SuperMeta,TagList>& x) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + this->final_swap_(x.final()); + } + + void clear() + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + this->final_clear_(); + } + + /* list operations */ + + void splice(iterator position,random_access_index<SuperMeta,TagList>& x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_DIFFERENT_CONTAINER(*this,x); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + iterator first=x.begin(),last=x.end(); + size_type n=0; + BOOST_TRY{ + while(first!=last){ + if(push_back(*first).second){ + first=x.erase(first); + ++n; + } + else ++first; + } + } + BOOST_CATCH(...){ + relocate(position,end()-n,end()); + BOOST_RETHROW; + } + BOOST_CATCH_END + relocate(position,end()-n,end()); + } + + void splice( + iterator position,random_access_index<SuperMeta,TagList>& x,iterator i) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(i,x); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + if(&x==this)relocate(position,i); + else{ + if(insert(position,*i).second){ + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer has a hard time with safe mode, and the following + * workaround is needed. Left it for all compilers as it does no + * harm. + */ + i.detach(); + x.erase(x.make_iterator(i.get_node())); +#else + x.erase(i); +#endif + + } + } + } + + void splice( + iterator position,random_access_index<SuperMeta,TagList>& x, + iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,x); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,x); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + if(&x==this)relocate(position,first,last); + else{ + size_type n=0; + BOOST_TRY{ + while(first!=last){ + if(push_back(*first).second){ + first=x.erase(first); + ++n; + } + else ++first; + } + } + BOOST_CATCH(...){ + relocate(position,end()-n,end()); + BOOST_RETHROW; + } + BOOST_CATCH_END + relocate(position,end()-n,end()); + } + } + + void remove(value_param_type value) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + difference_type n= + end()-make_iterator( + random_access_index_remove<node_type>( + ptrs,std::bind2nd(std::equal_to<value_type>(),value))); + while(n--)pop_back(); + } + + template<typename Predicate> + void remove_if(Predicate pred) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + difference_type n= + end()-make_iterator(random_access_index_remove<node_type>(ptrs,pred)); + while(n--)pop_back(); + } + + void unique() + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + difference_type n= + end()-make_iterator( + random_access_index_unique<node_type>( + ptrs,std::equal_to<value_type>())); + while(n--)pop_back(); + } + + template <class BinaryPredicate> + void unique(BinaryPredicate binary_pred) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + difference_type n= + end()-make_iterator( + random_access_index_unique<node_type>(ptrs,binary_pred)); + while(n--)pop_back(); + } + + void merge(random_access_index<SuperMeta,TagList>& x) + { + if(this!=&x){ + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + size_type s=size(); + splice(end(),x); + random_access_index_inplace_merge<node_type>( + get_allocator(),ptrs,ptrs.at(s),std::less<value_type>()); + } + } + + template <typename Compare> + void merge(random_access_index<SuperMeta,TagList>& x,Compare comp) + { + if(this!=&x){ + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + size_type s=size(); + splice(end(),x); + random_access_index_inplace_merge<node_type>( + get_allocator(),ptrs,ptrs.at(s),comp); + } + } + + void sort() + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + random_access_index_sort<node_type>( + get_allocator(),ptrs,std::less<value_type>()); + } + + template <typename Compare> + void sort(Compare comp) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + random_access_index_sort<node_type>( + get_allocator(),ptrs,comp); + } + + void reverse() + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + node_impl_type::reverse(ptrs.begin(),ptrs.end()); + } + + /* rearrange operations */ + + void relocate(iterator position,iterator i) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(i,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + if(position!=i)relocate(position.get_node(),i.get_node()); + } + + void relocate(iterator position,iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_CHECK_OUTSIDE_RANGE(position,first,last); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + if(position!=last)relocate( + position.get_node(),first.get_node(),last.get_node()); + } + + template<typename InputIterator> + void rearrange(InputIterator first) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + for(node_impl_ptr_pointer p0=ptrs.begin(),p0_end=ptrs.end(); + p0!=p0_end;++first,++p0){ + const value_type& v1=*first; + node_impl_ptr_pointer p1=node_from_value<node_type>(&v1)->up(); + + std::swap(*p0,*p1); + (*p0)->up()=p0; + (*p1)->up()=p1; + } + } + +BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: + random_access_index( + const ctor_args_list& args_list,const allocator_type& al): + super(args_list.get_tail(),al), + ptrs(al,header()->impl(),0) + { + } + + random_access_index(const random_access_index<SuperMeta,TagList>& x): + super(x), + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super(), +#endif + + ptrs(x.get_allocator(),header()->impl(),x.size()) + { + /* The actual copying takes place in subsequent call to copy_(). + */ + } + + ~random_access_index() + { + /* the container is guaranteed to be empty by now */ + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + iterator make_iterator(node_type* node){return iterator(node,this);} + const_iterator make_iterator(node_type* node)const + {return const_iterator(node,const_cast<random_access_index*>(this));} +#else + iterator make_iterator(node_type* node){return iterator(node);} + const_iterator make_iterator(node_type* node)const + {return const_iterator(node);} +#endif + + void copy_( + const random_access_index<SuperMeta,TagList>& x,const copy_map_type& map) + { + for(node_impl_ptr_pointer begin_org=x.ptrs.begin(), + begin_cpy=ptrs.begin(), + end_org=x.ptrs.end(); + begin_org!=end_org;++begin_org,++begin_cpy){ + *begin_cpy= + static_cast<node_type*>( + map.find( + static_cast<final_node_type*>( + node_type::from_impl(*begin_org))))->impl(); + (*begin_cpy)->up()=begin_cpy; + } + + super::copy_(x,map); + } + + node_type* insert_(value_param_type v,node_type* x) + { + ptrs.room_for_one(); + node_type* res=static_cast<node_type*>(super::insert_(v,x)); + if(res==x)ptrs.push_back(x->impl()); + return res; + } + + node_type* insert_(value_param_type v,node_type* position,node_type* x) + { + ptrs.room_for_one(); + node_type* res=static_cast<node_type*>(super::insert_(v,position,x)); + if(res==x)ptrs.push_back(x->impl()); + return res; + } + + void erase_(node_type* x) + { + ptrs.erase(x->impl()); + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + } + + void delete_all_nodes_() + { + for(node_impl_ptr_pointer x=ptrs.begin(),x_end=ptrs.end();x!=x_end;++x){ + this->final_delete_node_( + static_cast<final_node_type*>(node_type::from_impl(*x))); + } + } + + void clear_() + { + super::clear_(); + ptrs.clear(); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::detach_dereferenceable_iterators(); +#endif + } + + void swap_(random_access_index<SuperMeta,TagList>& x) + { + ptrs.swap(x.ptrs); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::swap(x); +#endif + + super::swap_(x); + } + + bool replace_(value_param_type v,node_type* x) + { + return super::replace_(v,x); + } + + bool modify_(node_type* x) + { + BOOST_TRY{ + if(!super::modify_(x)){ + ptrs.erase(x->impl()); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + return false; + } + else return true; + } + BOOST_CATCH(...){ + ptrs.erase(x->impl()); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + bool modify_rollback_(node_type* x) + { + return super::modify_rollback_(x); + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* serialization */ + + template<typename Archive> + void save_( + Archive& ar,const unsigned int version,const index_saver_type& sm)const + { + sm.save(begin(),end(),ar,version); + super::save_(ar,version,sm); + } + + template<typename Archive> + void load_( + Archive& ar,const unsigned int version,const index_loader_type& lm) + { + { + typedef random_access_index_loader<node_type,allocator_type> loader; + + loader ld(get_allocator(),ptrs); + lm.load(::boost::bind(&loader::rearrange,&ld,_1,_2),ar,version); + } /* exit scope so that ld frees its resources */ + super::load_(ar,version,lm); + } +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + /* invariant stuff */ + + bool invariant_()const + { + if(size()>capacity())return false; + if(size()==0||begin()==end()){ + if(size()!=0||begin()!=end())return false; + } + else{ + size_type s=0; + for(const_iterator it=begin(),it_end=end();;++it,++s){ + if(*(it.get_node()->up())!=it.get_node()->impl())return false; + if(it==it_end)break; + } + if(s!=size())return false; + } + + return super::invariant_(); + } + + /* This forwarding function eases things for the boost::mem_fn construct + * in BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT. Actually, + * final_check_invariant is already an inherited member function of index. + */ + void check_invariant_()const{this->final_check_invariant_();} +#endif + +private: + node_type* header()const{return this->final_header();} + + static void relocate(node_type* position,node_type* x) + { + node_impl_type::relocate(position->up(),x->up()); + } + + static void relocate(node_type* position,node_type* first,node_type* last) + { + node_impl_type::relocate( + position->up(),first->up(),last->up()); + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + void detach_iterators(node_type* x) + { + iterator it=make_iterator(x); + safe_mode::detach_equivalent_iterators(it); + } +#endif + + template <class InputIterator> + void assign_iter(InputIterator first,InputIterator last,mpl::true_) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + clear(); + for(;first!=last;++first)push_back(*first); + } + + void assign_iter(size_type n,value_param_type value,mpl::false_) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + clear(); + for(size_type i=0;i<n;++i)push_back(value); + } + + template<typename InputIterator> + void insert_iter( + iterator position,InputIterator first,InputIterator last,mpl::true_) + { + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + size_type s=0; + BOOST_TRY{ + for(;first!=last;++first){ + if(push_back(*first).second)++s; + } + } + BOOST_CATCH(...){ + relocate(position,end()-s,end()); + BOOST_RETHROW; + } + BOOST_CATCH_END + relocate(position,end()-s,end()); + } + + void insert_iter( + iterator position,size_type n,value_param_type x,mpl::false_) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + size_type s=0; + BOOST_TRY{ + while(n--){ + if(push_back(x).second)++s; + } + } + BOOST_CATCH(...){ + relocate(position,end()-s,end()); + BOOST_RETHROW; + } + BOOST_CATCH_END + relocate(position,end()-s,end()); + } + + ptr_array ptrs; + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +#pragma parse_mfunc_templ reset +#endif +}; + +/* comparison */ + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator==( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y) +{ + return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin()); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y) +{ + return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator!=( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y) +{ + return !(x==y); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y) +{ + return y<x; +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>=( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y) +{ + return !(x<y); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<=( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y) +{ + return !(x>y); +} + +/* specialized algorithms */ + +template<typename SuperMeta,typename TagList> +void swap( + random_access_index<SuperMeta,TagList>& x, + random_access_index<SuperMeta,TagList>& y) +{ + x.swap(y); +} + +} /* namespace multi_index::detail */ + +/* random access index specifier */ + +template <typename TagList> +struct random_access +{ + BOOST_STATIC_ASSERT(detail::is_tag<TagList>::value); + + template<typename Super> + struct node_class + { + typedef detail::random_access_index_node<Super> type; + }; + + template<typename SuperMeta> + struct index_class + { + typedef detail::random_access_index< + SuperMeta,typename TagList::type> type; + }; +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#undef BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT + +#endif diff --git a/Utilities/BGL/boost/multi_index/random_access_index_fwd.hpp b/Utilities/BGL/boost/multi_index/random_access_index_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cf8f2ca03e5a41bdd5ecc46fa87e7b57efa90363 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/random_access_index_fwd.hpp @@ -0,0 +1,91 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_RANDOM_ACCESS_INDEX_FWD_HPP +#define BOOST_MULTI_INDEX_RANDOM_ACCESS_INDEX_FWD_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/multi_index/tag.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template<typename SuperMeta,typename TagList> +class random_access_index; + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator==( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator!=( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>=( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<=( + const random_access_index<SuperMeta1,TagList1>& x, + const random_access_index<SuperMeta2,TagList2>& y); + +template<typename SuperMeta,typename TagList> +void swap( + random_access_index<SuperMeta,TagList>& x, + random_access_index<SuperMeta,TagList>& y); + +} /* namespace multi_index::detail */ + +/* index specifiers */ + +template <typename TagList=tag<> > +struct random_access; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/safe_mode_errors.hpp b/Utilities/BGL/boost/multi_index/safe_mode_errors.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff6f96065cb62a0e9159064519713f83101a43b1 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/safe_mode_errors.hpp @@ -0,0 +1,48 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_SAFE_MODE_ERRORS_HPP +#define BOOST_MULTI_INDEX_SAFE_MODE_ERRORS_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +namespace boost{ + +namespace multi_index{ + +namespace safe_mode{ + +/* Error codes for Boost.MultiIndex safe mode. These go in a separate + * header so that the user can include it when redefining + * BOOST_MULTI_INDEX_SAFE_MODE_ASSERT prior to the inclusion of + * any other header of Boost.MultiIndex. + */ + +enum error_code +{ + invalid_iterator=0, + not_dereferenceable_iterator, + not_incrementable_iterator, + not_decrementable_iterator, + not_owner, + not_same_owner, + invalid_range, + inside_range, + out_of_bounds, + same_container +}; + +} /* namespace multi_index::safe_mode */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/sequenced_index.hpp b/Utilities/BGL/boost/multi_index/sequenced_index.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8e091157450efcde521dd4132a6fe6d53d228651 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/sequenced_index.hpp @@ -0,0 +1,922 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP +#define BOOST_MULTI_INDEX_SEQUENCED_INDEX_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/call_traits.hpp> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/iterator/reverse_iterator.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/push_front.hpp> +#include <boost/multi_index/detail/access_specifier.hpp> +#include <boost/multi_index/detail/bidir_node_iterator.hpp> +#include <boost/multi_index/detail/index_node_base.hpp> +#include <boost/multi_index/detail/safe_ctr_proxy.hpp> +#include <boost/multi_index/detail/safe_mode.hpp> +#include <boost/multi_index/detail/scope_guard.hpp> +#include <boost/multi_index/detail/seq_index_node.hpp> +#include <boost/multi_index/detail/seq_index_ops.hpp> +#include <boost/multi_index/sequenced_index_fwd.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <cstddef> +#include <functional> +#include <utility> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/bind.hpp> +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) +#define BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT \ + detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ + detail::make_obj_guard(*this,&sequenced_index::check_invariant_); \ + BOOST_JOIN(check_invariant_,__LINE__).touch(); +#else +#define BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +/* sequenced_index adds a layer of sequenced indexing to a given Super */ + +template<typename SuperMeta,typename TagList> +class sequenced_index: + BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + ,public safe_ctr_proxy_impl< + bidir_node_iterator< + sequenced_index_node<typename SuperMeta::type::node_type> >, + sequenced_index<SuperMeta,TagList> > +#else + ,public safe_mode::safe_container< + sequenced_index<SuperMeta,TagList> > +#endif +#endif + +{ +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the + * lifetime of const references bound to temporaries --precisely what + * scopeguards are. + */ + +#pragma parse_mfunc_templ off +#endif + + typedef typename SuperMeta::type super; + +protected: + typedef sequenced_index_node< + typename super::node_type> node_type; + +private: + typedef typename node_type::impl_type node_impl_type; + +public: + /* types */ + + typedef typename node_type::value_type value_type; + typedef tuples::null_type ctor_args; + typedef typename super::final_allocator_type allocator_type; + typedef typename allocator_type::reference reference; + typedef typename allocator_type::const_reference const_reference; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_mode::safe_iterator< + bidir_node_iterator<node_type>, + safe_ctr_proxy< + bidir_node_iterator<node_type> > > iterator; +#else + typedef safe_mode::safe_iterator< + bidir_node_iterator<node_type>, + sequenced_index> iterator; +#endif +#else + typedef bidir_node_iterator<node_type> iterator; +#endif + + typedef iterator const_iterator; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef typename allocator_type::pointer pointer; + typedef typename allocator_type::const_pointer const_pointer; + typedef typename + boost::reverse_iterator<iterator> reverse_iterator; + typedef typename + boost::reverse_iterator<const_iterator> const_reverse_iterator; + typedef TagList tag_list; + +protected: + typedef typename super::final_node_type final_node_type; + typedef tuples::cons< + ctor_args, + typename super::ctor_args_list> ctor_args_list; + typedef typename mpl::push_front< + typename super::index_type_list, + sequenced_index>::type index_type_list; + typedef typename mpl::push_front< + typename super::iterator_type_list, + iterator>::type iterator_type_list; + typedef typename mpl::push_front< + typename super::const_iterator_type_list, + const_iterator>::type const_iterator_type_list; + typedef typename super::copy_map_type copy_map_type; + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + typedef typename super::index_saver_type index_saver_type; + typedef typename super::index_loader_type index_loader_type; +#endif + +private: +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + typedef safe_ctr_proxy_impl< + bidir_node_iterator<node_type>, + sequenced_index> safe_super; +#else + typedef safe_mode::safe_container< + sequenced_index> safe_super; +#endif +#endif + + typedef typename call_traits<value_type>::param_type value_param_type; + +public: + + /* construct/copy/destroy + * Default and copy ctors are in the protected section as indices are + * not supposed to be created on their own. No range ctor either. + */ + + sequenced_index<SuperMeta,TagList>& operator=( + const sequenced_index<SuperMeta,TagList>& x) + { + this->final()=x.final(); + return *this; + } + + template <class InputIterator> + void assign(InputIterator first,InputIterator last) + { + assign_iter(first,last,mpl::not_<is_integral<InputIterator> >()); + } + + void assign(size_type n,value_param_type value) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + clear(); + for(size_type i=0;i<n;++i)push_back(value); + } + + allocator_type get_allocator()const + { + return this->final().get_allocator(); + } + + /* iterators */ + + iterator begin() + {return make_iterator(node_type::from_impl(header()->next()));} + const_iterator begin()const + {return make_iterator(node_type::from_impl(header()->next()));} + iterator end(){return make_iterator(header());} + const_iterator end()const{return make_iterator(header());} + reverse_iterator rbegin(){return make_reverse_iterator(end());} + const_reverse_iterator rbegin()const{return make_reverse_iterator(end());} + reverse_iterator rend(){return make_reverse_iterator(begin());} + const_reverse_iterator rend()const{return make_reverse_iterator(begin());} + const_iterator cbegin()const{return begin();} + const_iterator cend()const{return end();} + const_reverse_iterator crbegin()const{return rbegin();} + const_reverse_iterator crend()const{return rend();} + + iterator iterator_to(const value_type& x) + { + return make_iterator(node_from_value<node_type>(&x)); + } + + const_iterator iterator_to(const value_type& x)const + { + return make_iterator(node_from_value<node_type>(&x)); + } + + /* capacity */ + + bool empty()const{return this->final_empty_();} + size_type size()const{return this->final_size_();} + size_type max_size()const{return this->final_max_size_();} + + void resize(size_type n,value_param_type x=value_type()) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + if(n>size())insert(end(),n-size(),x); + else if(n<size()){ + iterator it; + if(n<=size()/2){ + it=begin(); + std::advance(it,n); + } + else{ + it=end(); + for(size_type m=size()-n;m--;--it){} + } + erase(it,end()); + } + } + + /* access: no non-const versions provided as sequenced_index + * handles const elements. + */ + + const_reference front()const{return *begin();} + const_reference back()const{return *--end();} + + /* modifiers */ + + std::pair<iterator,bool> push_front(value_param_type x) + {return insert(begin(),x);} + void pop_front(){erase(begin());} + std::pair<iterator,bool> push_back(value_param_type x) + {return insert(end(),x);} + void pop_back(){erase(--end());} + + std::pair<iterator,bool> insert(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + std::pair<final_node_type*,bool> p=this->final_insert_(x); + if(p.second&&position.get_node()!=header()){ + relink(position.get_node(),p.first); + } + return std::pair<iterator,bool>(make_iterator(p.first),p.second); + } + + void insert(iterator position,size_type n,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + for(size_type i=0;i<n;++i)insert(position,x); + } + + template<typename InputIterator> + void insert(iterator position,InputIterator first,InputIterator last) + { + insert_iter(position,first,last,mpl::not_<is_integral<InputIterator> >()); + } + + iterator erase(iterator position) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + this->final_erase_(static_cast<final_node_type*>(position++.get_node())); + return position; + } + + iterator erase(iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + while(first!=last){ + first=erase(first); + } + return first; + } + + bool replace(iterator position,value_param_type x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + return this->final_replace_( + x,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier> + bool modify(iterator position,Modifier mod) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,static_cast<final_node_type*>(position.get_node())); + } + + template<typename Modifier,typename Rollback> + bool modify(iterator position,Modifier mod,Rollback back) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer on safe mode code chokes if this + * this is not added. Left it for all compilers as it does no + * harm. + */ + + position.detach(); +#endif + + return this->final_modify_( + mod,back,static_cast<final_node_type*>(position.get_node())); + } + + void swap(sequenced_index<SuperMeta,TagList>& x) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + this->final_swap_(x.final()); + } + + void clear() + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + this->final_clear_(); + } + + /* list operations */ + + void splice(iterator position,sequenced_index<SuperMeta,TagList>& x) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_DIFFERENT_CONTAINER(*this,x); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + iterator first=x.begin(),last=x.end(); + while(first!=last){ + if(insert(position,*first).second)first=x.erase(first); + else ++first; + } + } + + void splice(iterator position,sequenced_index<SuperMeta,TagList>& x,iterator i) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(i,x); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + if(&x==this){ + if(position!=i)relink(position.get_node(),i.get_node()); + } + else{ + if(insert(position,*i).second){ + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + /* MSVC++ 6.0 optimizer has a hard time with safe mode, and the following + * workaround is needed. Left it for all compilers as it does no + * harm. + */ + i.detach(); + x.erase(x.make_iterator(i.get_node())); +#else + x.erase(i); +#endif + + } + } + } + + void splice( + iterator position,sequenced_index<SuperMeta,TagList>& x, + iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,x); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,x); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + if(&x==this){ + BOOST_MULTI_INDEX_CHECK_OUTSIDE_RANGE(position,first,last); + if(position!=last)relink( + position.get_node(),first.get_node(),last.get_node()); + } + else{ + while(first!=last){ + if(insert(position,*first).second)first=x.erase(first); + else ++first; + } + } + } + + void remove(value_param_type value) + { + sequenced_index_remove( + *this,std::bind2nd(std::equal_to<value_type>(),value)); + } + + template<typename Predicate> + void remove_if(Predicate pred) + { + sequenced_index_remove(*this,pred); + } + + void unique() + { + sequenced_index_unique(*this,std::equal_to<value_type>()); + } + + template <class BinaryPredicate> + void unique(BinaryPredicate binary_pred) + { + sequenced_index_unique(*this,binary_pred); + } + + void merge(sequenced_index<SuperMeta,TagList>& x) + { + sequenced_index_merge(*this,x,std::less<value_type>()); + } + + template <typename Compare> + void merge(sequenced_index<SuperMeta,TagList>& x,Compare comp) + { + sequenced_index_merge(*this,x,comp); + } + + void sort() + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + sequenced_index_sort(header(),std::less<value_type>()); + } + + template <typename Compare> + void sort(Compare comp) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + sequenced_index_sort(header(),comp); + } + + void reverse() + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + node_impl_type::reverse(header()->impl()); + } + + /* rearrange operations */ + + void relocate(iterator position,iterator i) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(i,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + if(position!=i)relink(position.get_node(),i.get_node()); + } + + void relocate(iterator position,iterator first,iterator last) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(first,*this); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(last,*this); + BOOST_MULTI_INDEX_CHECK_VALID_RANGE(first,last); + BOOST_MULTI_INDEX_CHECK_OUTSIDE_RANGE(position,first,last); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + if(position!=last)relink( + position.get_node(),first.get_node(),last.get_node()); + } + + template<typename InputIterator> + void rearrange(InputIterator first) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + node_type* pos=header(); + for(size_type s=size();s--;){ + const value_type& v=*first++; + relink(pos,node_from_value<node_type>(&v)); + } + } + +BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: + sequenced_index(const ctor_args_list& args_list,const allocator_type& al): + super(args_list.get_tail(),al) + { + empty_initialize(); + } + + sequenced_index(const sequenced_index<SuperMeta,TagList>& x): + super(x) + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + ,safe_super() +#endif + + { + /* The actual copying takes place in subsequent call to copy_(). + */ + } + + ~sequenced_index() + { + /* the container is guaranteed to be empty by now */ + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + iterator make_iterator(node_type* node){return iterator(node,this);} + const_iterator make_iterator(node_type* node)const + {return const_iterator(node,const_cast<sequenced_index*>(this));} +#else + iterator make_iterator(node_type* node){return iterator(node);} + const_iterator make_iterator(node_type* node)const + {return const_iterator(node);} +#endif + + void copy_( + const sequenced_index<SuperMeta,TagList>& x,const copy_map_type& map) + { + node_type* org=x.header(); + node_type* cpy=header(); + do{ + node_type* next_org=node_type::from_impl(org->next()); + node_type* next_cpy=map.find(static_cast<final_node_type*>(next_org)); + cpy->next()=next_cpy->impl(); + next_cpy->prior()=cpy->impl(); + org=next_org; + cpy=next_cpy; + }while(org!=x.header()); + + super::copy_(x,map); + } + + node_type* insert_(value_param_type v,node_type* x) + { + node_type* res=static_cast<node_type*>(super::insert_(v,x)); + if(res==x)link(x); + return res; + } + + node_type* insert_(value_param_type v,node_type* position,node_type* x) + { + node_type* res=static_cast<node_type*>(super::insert_(v,position,x)); + if(res==x)link(x); + return res; + } + + void erase_(node_type* x) + { + unlink(x); + super::erase_(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + } + + void delete_all_nodes_() + { + for(node_type* x=node_type::from_impl(header()->next());x!=header();){ + node_type* y=node_type::from_impl(x->next()); + this->final_delete_node_(static_cast<final_node_type*>(x)); + x=y; + } + } + + void clear_() + { + super::clear_(); + empty_initialize(); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::detach_dereferenceable_iterators(); +#endif + } + + void swap_(sequenced_index<SuperMeta,TagList>& x) + { +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + safe_super::swap(x); +#endif + + super::swap_(x); + } + + bool replace_(value_param_type v,node_type* x) + { + return super::replace_(v,x); + } + + bool modify_(node_type* x) + { + BOOST_TRY{ + if(!super::modify_(x)){ + unlink(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + return false; + } + else return true; + } + BOOST_CATCH(...){ + unlink(x); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + detach_iterators(x); +#endif + + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + bool modify_rollback_(node_type* x) + { + return super::modify_rollback_(x); + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* serialization */ + + template<typename Archive> + void save_( + Archive& ar,const unsigned int version,const index_saver_type& sm)const + { + sm.save(begin(),end(),ar,version); + super::save_(ar,version,sm); + } + + template<typename Archive> + void load_( + Archive& ar,const unsigned int version,const index_loader_type& lm) + { + lm.load( + ::boost::bind(&sequenced_index::rearranger,this,_1,_2), + ar,version); + super::load_(ar,version,lm); + } +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + /* invariant stuff */ + + bool invariant_()const + { + if(size()==0||begin()==end()){ + if(size()!=0||begin()!=end()|| + header()->next()!=header()->impl()|| + header()->prior()!=header()->impl())return false; + } + else{ + size_type s=0; + for(const_iterator it=begin(),it_end=end();it!=it_end;++it,++s){ + if(it.get_node()->next()->prior()!=it.get_node()->impl())return false; + if(it.get_node()->prior()->next()!=it.get_node()->impl())return false; + } + if(s!=size())return false; + } + + return super::invariant_(); + } + + /* This forwarding function eases things for the boost::mem_fn construct + * in BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT. Actually, + * final_check_invariant is already an inherited member function of index. + */ + void check_invariant_()const{this->final_check_invariant_();} +#endif + +private: + node_type* header()const{return this->final_header();} + + void empty_initialize() + { + header()->prior()=header()->next()=header()->impl(); + } + + void link(node_type* x) + { + node_impl_type::link(x->impl(),header()->impl()); + }; + + static void unlink(node_type* x) + { + node_impl_type::unlink(x->impl()); + } + + static void relink(node_type* position,node_type* x) + { + node_impl_type::relink(position->impl(),x->impl()); + } + + static void relink(node_type* position,node_type* first,node_type* last) + { + node_impl_type::relink( + position->impl(),first->impl(),last->impl()); + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + void rearranger(node_type* position,node_type *x) + { + if(!position)position=header(); + node_type::increment(position); + if(position!=x)relink(position,x); + } +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + void detach_iterators(node_type* x) + { + iterator it=make_iterator(x); + safe_mode::detach_equivalent_iterators(it); + } +#endif + + template <class InputIterator> + void assign_iter(InputIterator first,InputIterator last,mpl::true_) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + clear(); + for(;first!=last;++first)push_back(*first); + } + + void assign_iter(size_type n,value_param_type value,mpl::false_) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + clear(); + for(size_type i=0;i<n;++i)push_back(value); + } + + template<typename InputIterator> + void insert_iter( + iterator position,InputIterator first,InputIterator last,mpl::true_) + { + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + for(;first!=last;++first)insert(position,*first); + } + + void insert_iter( + iterator position,size_type n,value_param_type x,mpl::false_) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + for(size_type i=0;i<n;++i)insert(position,x); + } + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +#pragma parse_mfunc_templ reset +#endif +}; + +/* comparison */ + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator==( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y) +{ + return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin()); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y) +{ + return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator!=( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y) +{ + return !(x==y); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y) +{ + return y<x; +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>=( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y) +{ + return !(x<y); +} + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<=( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y) +{ + return !(x>y); +} + +/* specialized algorithms */ + +template<typename SuperMeta,typename TagList> +void swap( + sequenced_index<SuperMeta,TagList>& x, + sequenced_index<SuperMeta,TagList>& y) +{ + x.swap(y); +} + +} /* namespace multi_index::detail */ + +/* sequenced index specifier */ + +template <typename TagList> +struct sequenced +{ + BOOST_STATIC_ASSERT(detail::is_tag<TagList>::value); + + template<typename Super> + struct node_class + { + typedef detail::sequenced_index_node<Super> type; + }; + + template<typename SuperMeta> + struct index_class + { + typedef detail::sequenced_index<SuperMeta,typename TagList::type> type; + }; +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#undef BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT + +#endif diff --git a/Utilities/BGL/boost/multi_index/sequenced_index_fwd.hpp b/Utilities/BGL/boost/multi_index/sequenced_index_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5211390b6b6cdbe1544590f506277da3f6a25bad --- /dev/null +++ b/Utilities/BGL/boost/multi_index/sequenced_index_fwd.hpp @@ -0,0 +1,91 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_SEQUENCED_INDEX_FWD_HPP +#define BOOST_MULTI_INDEX_SEQUENCED_INDEX_FWD_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/multi_index/tag.hpp> + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +template<typename SuperMeta,typename TagList> +class sequenced_index; + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator==( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator!=( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator>=( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y); + +template< + typename SuperMeta1,typename TagList1, + typename SuperMeta2,typename TagList2 +> +bool operator<=( + const sequenced_index<SuperMeta1,TagList1>& x, + const sequenced_index<SuperMeta2,TagList2>& y); + +template<typename SuperMeta,typename TagList> +void swap( + sequenced_index<SuperMeta,TagList>& x, + sequenced_index<SuperMeta,TagList>& y); + +} /* namespace multi_index::detail */ + +/* index specifiers */ + +template <typename TagList=tag<> > +struct sequenced; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/multi_index/tag.hpp b/Utilities/BGL/boost/multi_index/tag.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba7cab4f1510b91a8ad10112ddc564044343efd3 --- /dev/null +++ b/Utilities/BGL/boost/multi_index/tag.hpp @@ -0,0 +1,92 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_TAG_HPP +#define BOOST_MULTI_INDEX_TAG_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/multi_index/detail/no_duplicate_tags.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/transform.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/preprocessor/facilities/intercept.hpp> +#include <boost/preprocessor/repetition/enum_binary_params.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> + +/* A wrapper of mpl::vector used to hide MPL from the user. + * tag contains types used as tag names for indices in get() functions. + */ + +/* This user_definable macro limits the number of elements of a tag; + * useful for shortening resulting symbol names (MSVC++ 6.0, for instance, + * has problems coping with very long symbol names.) + */ + +#if !defined(BOOST_MULTI_INDEX_LIMIT_TAG_SIZE) +#if defined(BOOST_MSVC)&&(BOOST_MSVC<1300) +#define BOOST_MULTI_INDEX_LIMIT_TAG_SIZE 3 +#else +#define BOOST_MULTI_INDEX_LIMIT_TAG_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE +#endif +#endif + +#if BOOST_MULTI_INDEX_LIMIT_TAG_SIZE<BOOST_MPL_LIMIT_VECTOR_SIZE +#define BOOST_MULTI_INDEX_TAG_SIZE BOOST_MULTI_INDEX_LIMIT_TAG_SIZE +#else +#define BOOST_MULTI_INDEX_TAG_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE +#endif + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +struct tag_marker{}; + +template<typename T> +struct is_tag +{ + BOOST_STATIC_CONSTANT(bool,value=(is_base_and_derived<tag_marker,T>::value)); +}; + +} /* namespace multi_index::detail */ + +template< + BOOST_PP_ENUM_BINARY_PARAMS( + BOOST_MULTI_INDEX_TAG_SIZE, + typename T, + =mpl::na BOOST_PP_INTERCEPT) +> +struct tag:private detail::tag_marker +{ + /* The mpl::transform pass produces shorter symbols (without + * trailing mpl::na's.) + */ + + typedef typename mpl::transform< + mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_MULTI_INDEX_TAG_SIZE,T)>, + mpl::identity<mpl::_1> + >::type type; + + BOOST_STATIC_ASSERT(detail::no_duplicate_tags<type>::value); +}; + +} /* namespace multi_index */ + +} /* namespace boost */ + +#undef BOOST_MULTI_INDEX_TAG_SIZE + +#endif diff --git a/Utilities/BGL/boost/multi_index_container.hpp b/Utilities/BGL/boost/multi_index_container.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b4815fbca1dd047ae4044e95b9ac389e627f187 --- /dev/null +++ b/Utilities/BGL/boost/multi_index_container.hpp @@ -0,0 +1,1129 @@ +/* Multiply indexed container. + * + * Copyright 2003-2009 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_HPP +#define BOOST_MULTI_INDEX_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <algorithm> +#include <boost/detail/allocator_utilities.hpp> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/mpl/at.hpp> +#include <boost/mpl/contains.hpp> +#include <boost/mpl/find_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/size.hpp> +#include <boost/mpl/deref.hpp> +#include <boost/multi_index_container_fwd.hpp> +#include <boost/multi_index/detail/access_specifier.hpp> +#include <boost/multi_index/detail/adl_swap.hpp> +#include <boost/multi_index/detail/base_type.hpp> +#include <boost/multi_index/detail/converter.hpp> +#include <boost/multi_index/detail/header_holder.hpp> +#include <boost/multi_index/detail/has_tag.hpp> +#include <boost/multi_index/detail/no_duplicate_tags.hpp> +#include <boost/multi_index/detail/prevent_eti.hpp> +#include <boost/multi_index/detail/safe_mode.hpp> +#include <boost/multi_index/detail/scope_guard.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/utility/base_from_member.hpp> + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include <boost/multi_index/detail/archive_constructed.hpp> +#include <boost/serialization/collection_size_type.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/split_member.hpp> +#include <boost/serialization/version.hpp> +#include <boost/throw_exception.hpp> +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) +#include <boost/multi_index/detail/invariant_assert.hpp> +#define BOOST_MULTI_INDEX_CHECK_INVARIANT \ + detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ + detail::make_obj_guard(*this,&multi_index_container::check_invariant_); \ + BOOST_JOIN(check_invariant_,__LINE__).touch(); +#else +#define BOOST_MULTI_INDEX_CHECK_INVARIANT +#endif + +namespace boost{ + +namespace multi_index{ + +template<typename Value,typename IndexSpecifierList,typename Allocator> +class multi_index_container: + private ::boost::base_from_member< + typename boost::detail::allocator::rebind_to< + Allocator, + typename detail::multi_index_node_type< + Value,IndexSpecifierList,Allocator>::type + >::type>, + BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS detail::header_holder< + typename detail::prevent_eti< + Allocator, + typename boost::detail::allocator::rebind_to< + Allocator, + typename detail::multi_index_node_type< + Value,IndexSpecifierList,Allocator>::type + >::type + >::type::pointer, + multi_index_container<Value,IndexSpecifierList,Allocator> >, + public detail::multi_index_base_type< + Value,IndexSpecifierList,Allocator>::type +{ +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the + * lifetime of const references bound to temporaries --precisely what + * scopeguards are. + */ + +#pragma parse_mfunc_templ off +#endif + +private: +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template <typename,typename,typename> friend class detail::index_base; + template <typename,typename> friend struct detail::header_holder; + template <typename,typename> friend struct detail::converter; +#endif + + typedef typename detail::multi_index_base_type< + Value,IndexSpecifierList,Allocator>::type super; + typedef typename + boost::detail::allocator::rebind_to< + Allocator, + typename super::node_type + >::type node_allocator; + typedef ::boost::base_from_member< + node_allocator> bfm_allocator; + typedef detail::header_holder< + typename detail::prevent_eti< + Allocator, + node_allocator + >::type::pointer, + multi_index_container> bfm_header; + +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + /* see definition of index_type_list below */ + typedef typename super::index_type_list super_index_type_list; +#endif + +public: + /* All types are inherited from super, a few are explicitly + * brought forward here to save us some typename's. + */ + + typedef typename super::ctor_args_list ctor_args_list; + typedef IndexSpecifierList index_specifier_type_list; + +#if BOOST_WORKAROUND(BOOST_MSVC,<1300) + /* MSVC++ 6.0 chokes on moderately long index lists (around 6 indices + * or more), with errors ranging from corrupt exes to duplicate + * comdats. The following type hiding hack alleviates this condition; + * best results combined with type hiding of the indexed_by construct + * itself, as explained in the "Compiler specifics" section of + * the documentation. + */ + + struct index_type_list:super_index_type_list + { + typedef index_type_list type; + typedef typename super_index_type_list::back back; + typedef mpl::v_iter<type,0> begin; + typedef mpl::v_iter< + type, + mpl::size<super_index_type_list>::value> end; + }; +#else + typedef typename super::index_type_list index_type_list; +#endif + + typedef typename super::iterator_type_list iterator_type_list; + typedef typename super::const_iterator_type_list const_iterator_type_list; + typedef typename super::value_type value_type; + typedef typename super::final_allocator_type allocator_type; + typedef typename super::iterator iterator; + typedef typename super::const_iterator const_iterator; + + BOOST_STATIC_ASSERT( + detail::no_duplicate_tags_in_index_list<index_type_list>::value); + + /* global project() needs to see this publicly */ + + typedef typename super::node_type node_type; + + /* construct/copy/destroy */ + + explicit multi_index_container( + +#if BOOST_WORKAROUND(__IBMCPP__,<=600) + /* VisualAge seems to have an ETI issue with the default values + * for arguments args_list and al. + */ + + const ctor_args_list& args_list= + typename mpl::identity<multi_index_container>::type:: + ctor_args_list(), + const allocator_type& al= + typename mpl::identity<multi_index_container>::type:: + allocator_type()): +#else + const ctor_args_list& args_list=ctor_args_list(), + const allocator_type& al=allocator_type()): +#endif + + bfm_allocator(al), + super(args_list,bfm_allocator::member), + node_count(0) + { + BOOST_MULTI_INDEX_CHECK_INVARIANT; + } + + explicit multi_index_container(const allocator_type& al): + bfm_allocator(al), + super(ctor_args_list(),bfm_allocator::member), + node_count(0) + { + BOOST_MULTI_INDEX_CHECK_INVARIANT; + } + + template<typename InputIterator> + multi_index_container( + InputIterator first,InputIterator last, + +#if BOOST_WORKAROUND(__IBMCPP__,<=600) + /* VisualAge seems to have an ETI issue with the default values + * for arguments args_list and al. + */ + + const ctor_args_list& args_list= + typename mpl::identity<multi_index_container>::type:: + ctor_args_list(), + const allocator_type& al= + typename mpl::identity<multi_index_container>::type:: + allocator_type()): +#else + const ctor_args_list& args_list=ctor_args_list(), + const allocator_type& al=allocator_type()): +#endif + + bfm_allocator(al), + super(args_list,bfm_allocator::member), + node_count(0) + { + BOOST_MULTI_INDEX_CHECK_INVARIANT; + BOOST_TRY{ + iterator hint=super::end(); + for(;first!=last;++first){ + hint=super::make_iterator(insert_(*first,hint.get_node()).first); + } + } + BOOST_CATCH(...){ + clear_(); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + multi_index_container( + const multi_index_container<Value,IndexSpecifierList,Allocator>& x): + bfm_allocator(x.bfm_allocator::member), + bfm_header(), + super(x), + node_count(0) + { + copy_map_type map(bfm_allocator::member,x.size(),x.header(),header()); + for(const_iterator it=x.begin(),it_end=x.end();it!=it_end;++it){ + map.clone(it.get_node()); + } + super::copy_(x,map); + map.release(); + node_count=x.size(); + + /* Not until this point are the indices required to be consistent, + * hence the position of the invariant checker. + */ + + BOOST_MULTI_INDEX_CHECK_INVARIANT; + } + + ~multi_index_container() + { + delete_all_nodes_(); + } + + multi_index_container<Value,IndexSpecifierList,Allocator>& operator=( + multi_index_container<Value,IndexSpecifierList,Allocator> x) + { + BOOST_MULTI_INDEX_CHECK_INVARIANT; + this->swap(x); + return *this; + } + + allocator_type get_allocator()const + { + return allocator_type(bfm_allocator::member); + } + + /* retrieval of indices by number */ + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) + template<int N> + struct nth_index + { + BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value); + typedef typename mpl::at_c<index_type_list,N>::type type; + }; + + template<int N> + typename nth_index<N>::type& get(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) + { + BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value); + return *this; + } + + template<int N> + const typename nth_index<N>::type& get( + BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int,N))const + { + BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value); + return *this; + } +#endif + + /* retrieval of indices by tag */ + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) + template<typename Tag> + struct index + { + typedef typename mpl::find_if< + index_type_list, + detail::has_tag<Tag> + >::type iter; + + BOOST_STATIC_CONSTANT( + bool,index_found=!(is_same<iter,typename mpl::end<index_type_list>::type >::value)); + BOOST_STATIC_ASSERT(index_found); + + typedef typename mpl::deref<iter>::type type; + }; + + template<typename Tag> + typename index<Tag>::type& get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag)) + { + return *this; + } + + template<typename Tag> + const typename index<Tag>::type& get( + BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))const + { + return *this; + } +#endif + + /* projection of iterators by number */ + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) + template<int N> + struct nth_index_iterator + { + typedef typename nth_index<N>::type::iterator type; + }; + + template<int N> + struct nth_index_const_iterator + { + typedef typename nth_index<N>::type::const_iterator type; + }; + + template<int N,typename IteratorType> + typename nth_index_iterator<N>::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) + { + typedef typename nth_index<N>::type index; + +#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ + BOOST_STATIC_ASSERT( + (mpl::contains<iterator_type_list,IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast<typename IteratorType::container_type&>(*this)); + + return index::make_iterator(static_cast<node_type*>(it.get_node())); + } + + template<int N,typename IteratorType> + typename nth_index_const_iterator<N>::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N))const + { + typedef typename nth_index<N>::type index; + +#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ + BOOST_STATIC_ASSERT(( + mpl::contains<iterator_type_list,IteratorType>::value|| + mpl::contains<const_iterator_type_list,IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast<const typename IteratorType::container_type&>(*this)); + return index::make_iterator(static_cast<node_type*>(it.get_node())); + } +#endif + + /* projection of iterators by tag */ + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) + template<typename Tag> + struct index_iterator + { + typedef typename index<Tag>::type::iterator type; + }; + + template<typename Tag> + struct index_const_iterator + { + typedef typename index<Tag>::type::const_iterator type; + }; + + template<typename Tag,typename IteratorType> + typename index_iterator<Tag>::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) + { + typedef typename index<Tag>::type index; + +#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ + BOOST_STATIC_ASSERT( + (mpl::contains<iterator_type_list,IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast<typename IteratorType::container_type&>(*this)); + return index::make_iterator(static_cast<node_type*>(it.get_node())); + } + + template<typename Tag,typename IteratorType> + typename index_const_iterator<Tag>::type project( + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag))const + { + typedef typename index<Tag>::type index; + +#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ + BOOST_STATIC_ASSERT(( + mpl::contains<iterator_type_list,IteratorType>::value|| + mpl::contains<const_iterator_type_list,IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + BOOST_MULTI_INDEX_CHECK_IS_OWNER( + it,static_cast<const typename IteratorType::container_type&>(*this)); + return index::make_iterator(static_cast<node_type*>(it.get_node())); + } +#endif + +BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: + typedef typename super::copy_map_type copy_map_type; + + node_type* header()const + { + return &*bfm_header::member; + } + + node_type* allocate_node() + { + return &*bfm_allocator::member.allocate(1); + } + + void deallocate_node(node_type* x) + { + typedef typename node_allocator::pointer node_pointer; + bfm_allocator::member.deallocate(static_cast<node_pointer>(x),1); + } + + bool empty_()const + { + return node_count==0; + } + + std::size_t size_()const + { + return node_count; + } + + std::size_t max_size_()const + { + return static_cast<std::size_t >(-1); + } + + std::pair<node_type*,bool> insert_(const Value& v) + { + node_type* x=allocate_node(); + BOOST_TRY{ + node_type* res=super::insert_(v,x); + if(res==x){ + ++node_count; + return std::pair<node_type*,bool>(res,true); + } + else{ + deallocate_node(x); + return std::pair<node_type*,bool>(res,false); + } + } + BOOST_CATCH(...){ + deallocate_node(x); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + std::pair<node_type*,bool> insert_(const Value& v,node_type* position) + { + node_type* x=allocate_node(); + BOOST_TRY{ + node_type* res=super::insert_(v,position,x); + if(res==x){ + ++node_count; + return std::pair<node_type*,bool>(res,true); + } + else{ + deallocate_node(x); + return std::pair<node_type*,bool>(res,false); + } + } + BOOST_CATCH(...){ + deallocate_node(x); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + void erase_(node_type* x) + { + --node_count; + super::erase_(x); + deallocate_node(x); + } + + void delete_node_(node_type* x) + { + super::delete_node_(x); + deallocate_node(x); + } + + void delete_all_nodes_() + { + super::delete_all_nodes_(); + } + + void clear_() + { + delete_all_nodes_(); + super::clear_(); + node_count=0; + } + + void swap_(multi_index_container<Value,IndexSpecifierList,Allocator>& x) + { + if(bfm_allocator::member!=x.bfm_allocator::member){ + detail::adl_swap(bfm_allocator::member,x.bfm_allocator::member); + } + std::swap(bfm_header::member,x.bfm_header::member); + super::swap_(x); + std::swap(node_count,x.node_count); + } + + bool replace_(const Value& k,node_type* x) + { + return super::replace_(k,x); + } + + template<typename Modifier> + bool modify_(Modifier& mod,node_type* x) + { + mod(const_cast<value_type&>(x->value())); + + BOOST_TRY{ + if(!super::modify_(x)){ + deallocate_node(x); + --node_count; + return false; + } + else return true; + } + BOOST_CATCH(...){ + deallocate_node(x); + --node_count; + BOOST_RETHROW; + } + BOOST_CATCH_END + } + + template<typename Modifier,typename Rollback> + bool modify_(Modifier& mod,Rollback& back,node_type* x) + { + mod(const_cast<value_type&>(x->value())); + + bool b; + BOOST_TRY{ + b=super::modify_rollback_(x); + } + BOOST_CATCH(...){ + BOOST_TRY{ + back(const_cast<value_type&>(x->value())); + BOOST_RETHROW; + } + BOOST_CATCH(...){ + this->erase_(x); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + BOOST_CATCH_END + + BOOST_TRY{ + if(!b){ + back(const_cast<value_type&>(x->value())); + return false; + } + else return true; + } + BOOST_CATCH(...){ + this->erase_(x); + BOOST_RETHROW; + } + BOOST_CATCH_END + } + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) + /* serialization */ + + friend class boost::serialization::access; + + BOOST_SERIALIZATION_SPLIT_MEMBER() + + typedef typename super::index_saver_type index_saver_type; + typedef typename super::index_loader_type index_loader_type; + + template<class Archive> + void save(Archive& ar,const unsigned int version)const + { + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + const serialization::collection_size_type s(size_()); + ar<<serialization::make_nvp("count",s); +#else + const std::size_t s=size_(); + ar<<serialization::make_nvp("count",s); +#endif + + index_saver_type sm(bfm_allocator::member,s); + + for(iterator it=super::begin(),it_end=super::end();it!=it_end;++it){ + ar<<serialization::make_nvp("item",*it); + sm.add(it.get_node(),ar,version); + } + sm.add_track(header(),ar,version); + + super::save_(ar,version,sm); + } + + template<class Archive> + void load(Archive& ar,const unsigned int version) + { + BOOST_MULTI_INDEX_CHECK_INVARIANT; + + clear_(); + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + serialization::collection_size_type s; + if(version<1){ + std::size_t sz; + ar>>serialization::make_nvp("count",sz); + s=sz; + } + else{ + ar>>serialization::make_nvp("count",s); + } +#else + std::size_t s; + ar>>serialization::make_nvp("count",s); +#endif + + index_loader_type lm(bfm_allocator::member,s); + + for(std::size_t n=0;n<s;++n){ + detail::archive_constructed<Value> value("item",ar,version); + std::pair<node_type*,bool> p=insert_( + value.get(),super::end().get_node()); + if(!p.second)throw_exception( + archive::archive_exception( + archive::archive_exception::other_exception)); + ar.reset_object_address(&p.first->value(),&value.get()); + lm.add(p.first,ar,version); + } + lm.add_track(header(),ar,version); + + super::load_(ar,version,lm); + } +#endif + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) + /* invariant stuff */ + + bool invariant_()const + { + return super::invariant_(); + } + + void check_invariant_()const + { + BOOST_MULTI_INDEX_INVARIANT_ASSERT(invariant_()); + } +#endif + +private: + std::size_t node_count; + +#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ + BOOST_WORKAROUND(__MWERKS__,<=0x3003) +#pragma parse_mfunc_templ reset +#endif +}; + +/* retrieval of indices by number */ + +template<typename MultiIndexContainer,int N> +struct nth_index +{ + BOOST_STATIC_CONSTANT( + int, + M=mpl::size<typename MultiIndexContainer::index_type_list>::type::value); + BOOST_STATIC_ASSERT(N>=0&&N<M); + typedef typename mpl::at_c< + typename MultiIndexContainer::index_type_list,N>::type type; +}; + +template<int N,typename Value,typename IndexSpecifierList,typename Allocator> +typename nth_index< + multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type& +get( + multi_index_container<Value,IndexSpecifierList,Allocator>& m + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename nth_index< + multi_index_container< + Value,IndexSpecifierList,Allocator>, + N + >::type index; + + BOOST_STATIC_ASSERT(N>=0&& + N< + mpl::size< + BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list + >::type::value); + + return detail::converter<multi_index_type,index>::index(m); +} + +template<int N,typename Value,typename IndexSpecifierList,typename Allocator> +const typename nth_index< + multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type& +get( + const multi_index_container<Value,IndexSpecifierList,Allocator>& m + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename nth_index< + multi_index_container< + Value,IndexSpecifierList,Allocator>, + N + >::type index; + + BOOST_STATIC_ASSERT(N>=0&& + N< + mpl::size< + BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list + >::type::value); + + return detail::converter<multi_index_type,index>::index(m); +} + +/* retrieval of indices by tag */ + +template<typename MultiIndexContainer,typename Tag> +struct index +{ + typedef typename MultiIndexContainer::index_type_list index_type_list; + + typedef typename mpl::find_if< + index_type_list, + detail::has_tag<Tag> + >::type iter; + + BOOST_STATIC_CONSTANT( + bool,index_found=!(is_same<iter,typename mpl::end<index_type_list>::type >::value)); + BOOST_STATIC_ASSERT(index_found); + + typedef typename mpl::deref<iter>::type type; +}; + +template< + typename Tag,typename Value,typename IndexSpecifierList,typename Allocator +> +typename ::boost::multi_index::index< + multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type& +get( + multi_index_container<Value,IndexSpecifierList,Allocator>& m + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename ::boost::multi_index::index< + multi_index_container< + Value,IndexSpecifierList,Allocator>, + Tag + >::type index; + + return detail::converter<multi_index_type,index>::index(m); +} + +template< + typename Tag,typename Value,typename IndexSpecifierList,typename Allocator +> +const typename ::boost::multi_index::index< + multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type& +get( + const multi_index_container<Value,IndexSpecifierList,Allocator>& m + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename ::boost::multi_index::index< + multi_index_container< + Value,IndexSpecifierList,Allocator>, + Tag + >::type index; + + return detail::converter<multi_index_type,index>::index(m); +} + +/* projection of iterators by number */ + +template<typename MultiIndexContainer,int N> +struct nth_index_iterator +{ + typedef typename detail::prevent_eti< + nth_index<MultiIndexContainer,N>, + typename nth_index<MultiIndexContainer,N>::type>::type::iterator type; +}; + +template<typename MultiIndexContainer,int N> +struct nth_index_const_iterator +{ + typedef typename detail::prevent_eti< + nth_index<MultiIndexContainer,N>, + typename nth_index<MultiIndexContainer,N>::type + >::type::const_iterator type; +}; + +template< + int N,typename IteratorType, + typename Value,typename IndexSpecifierList,typename Allocator> +typename nth_index_iterator< + multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type +project( + multi_index_container<Value,IndexSpecifierList,Allocator>& m, + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename nth_index<multi_index_type,N>::type index; + +#if (!defined(BOOST_MSVC)||!(BOOST_MSVC<1310))&& /* MSVC++ 6.0/7.0 fails */\ + (!defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580)) /* as does Sun C++ 5.7 */ + BOOST_STATIC_ASSERT(( + mpl::contains< + BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + typedef detail::converter< + multi_index_type, + BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; + BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); +#endif + + return detail::converter<multi_index_type,index>::iterator( + m,static_cast<typename multi_index_type::node_type*>(it.get_node())); +} + +template< + int N,typename IteratorType, + typename Value,typename IndexSpecifierList,typename Allocator> +typename nth_index_const_iterator< + multi_index_container<Value,IndexSpecifierList,Allocator>,N>::type +project( + const multi_index_container<Value,IndexSpecifierList,Allocator>& m, + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(int,N)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename nth_index<multi_index_type,N>::type index; + +#if (!defined(BOOST_MSVC)||!(BOOST_MSVC<1310))&& /* MSVC++ 6.0/7.0 fails */\ + (!defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580)) /* as does Sun C++ 5.7 */ + BOOST_STATIC_ASSERT(( + mpl::contains< + BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + IteratorType>::value|| + mpl::contains< + BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list, + IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + typedef detail::converter< + multi_index_type, + BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; + BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); +#endif + + return detail::converter<multi_index_type,index>::const_iterator( + m,static_cast<typename multi_index_type::node_type*>(it.get_node())); +} + +/* projection of iterators by tag */ + +template<typename MultiIndexContainer,typename Tag> +struct index_iterator +{ + typedef typename ::boost::multi_index::index< + MultiIndexContainer,Tag>::type::iterator type; +}; + +template<typename MultiIndexContainer,typename Tag> +struct index_const_iterator +{ + typedef typename ::boost::multi_index::index< + MultiIndexContainer,Tag>::type::const_iterator type; +}; + +template< + typename Tag,typename IteratorType, + typename Value,typename IndexSpecifierList,typename Allocator> +typename index_iterator< + multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type +project( + multi_index_container<Value,IndexSpecifierList,Allocator>& m, + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename ::boost::multi_index::index< + multi_index_type,Tag>::type index; + +#if (!defined(BOOST_MSVC)||!(BOOST_MSVC<1310))&& /* MSVC++ 6.0/7.0 fails */\ + (!defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580)) /* as does Sun C++ 5.7 */ + BOOST_STATIC_ASSERT(( + mpl::contains< + BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + typedef detail::converter< + multi_index_type, + BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; + BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); +#endif + + return detail::converter<multi_index_type,index>::iterator( + m,static_cast<typename multi_index_type::node_type*>(it.get_node())); +} + +template< + typename Tag,typename IteratorType, + typename Value,typename IndexSpecifierList,typename Allocator> +typename index_const_iterator< + multi_index_container<Value,IndexSpecifierList,Allocator>,Tag>::type +project( + const multi_index_container<Value,IndexSpecifierList,Allocator>& m, + IteratorType it + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Tag)) +{ + typedef multi_index_container< + Value,IndexSpecifierList,Allocator> multi_index_type; + typedef typename ::boost::multi_index::index< + multi_index_type,Tag>::type index; + +#if (!defined(BOOST_MSVC)||!(BOOST_MSVC<1310))&& /* MSVC++ 6.0/7.0 fails */\ + (!defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580)) /* as does Sun C++ 5.7 */ + BOOST_STATIC_ASSERT(( + mpl::contains< + BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + IteratorType>::value|| + mpl::contains< + BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list, + IteratorType>::value)); +#endif + + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); + +#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) + typedef detail::converter< + multi_index_type, + BOOST_DEDUCED_TYPENAME IteratorType::container_type> converter; + BOOST_MULTI_INDEX_CHECK_IS_OWNER(it,converter::index(m)); +#endif + + return detail::converter<multi_index_type,index>::const_iterator( + m,static_cast<typename multi_index_type::node_type*>(it.get_node())); +} + +/* Comparison. Simple forward to first index. */ + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator==( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y) +{ + return get<0>(x)==get<0>(y); +} + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator<( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y) +{ + return get<0>(x)<get<0>(y); +} + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator!=( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y) +{ + return get<0>(x)!=get<0>(y); +} + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator>( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y) +{ + return get<0>(x)>get<0>(y); +} + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator>=( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y) +{ + return get<0>(x)>=get<0>(y); +} + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator<=( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y) +{ + return get<0>(x)<=get<0>(y); +} + +/* specialized algorithms */ + +template<typename Value,typename IndexSpecifierList,typename Allocator> +void swap( + multi_index_container<Value,IndexSpecifierList,Allocator>& x, + multi_index_container<Value,IndexSpecifierList,Allocator>& y) +{ + x.swap(y); +} + +} /* namespace multi_index */ + +#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)&&\ + !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +/* Serialization class version bump as we now serialize the size + * through boost::serialization::collection_size_type. + */ + +namespace serialization { +template<typename Value,typename IndexSpecifierList,typename Allocator> +struct version< + boost::multi_index_container<Value,IndexSpecifierList,Allocator> +> +{ + BOOST_STATIC_CONSTANT(unsigned int,value=1); +}; +} /* namespace serialization */ +#endif + +/* Associated global functions are promoted to namespace boost, except + * comparison operators and swap, which are meant to be Koenig looked-up. + */ + +using multi_index::get; +using multi_index::project; + +} /* namespace boost */ + +#undef BOOST_MULTI_INDEX_CHECK_INVARIANT + +#endif diff --git a/Utilities/BGL/boost/multi_index_container_fwd.hpp b/Utilities/BGL/boost/multi_index_container_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..99e8db36cf259784fc7e541fd5713c2005630541 --- /dev/null +++ b/Utilities/BGL/boost/multi_index_container_fwd.hpp @@ -0,0 +1,121 @@ +/* Copyright 2003-2008 Joaquin M Lopez Munoz. + * 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/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_FWD_HPP +#define BOOST_MULTI_INDEX_FWD_HPP + +#if defined(_MSC_VER)&&(_MSC_VER>=1200) +#pragma once +#endif + +#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ +#include <boost/multi_index/identity.hpp> +#include <boost/multi_index/indexed_by.hpp> +#include <boost/multi_index/ordered_index_fwd.hpp> +#include <memory> + +namespace boost{ + +namespace multi_index{ + +/* Default value for IndexSpecifierList specifies a container + * equivalent to std::set<Value>. + */ + +template< + typename Value, + typename IndexSpecifierList=indexed_by<ordered_unique<identity<Value> > >, + typename Allocator=std::allocator<Value> > +class multi_index_container; + +template<typename MultiIndexContainer,int N> +struct nth_index; + +template<typename MultiIndexContainer,typename Tag> +struct index; + +template<typename MultiIndexContainer,int N> +struct nth_index_iterator; + +template<typename MultiIndexContainer,int N> +struct nth_index_const_iterator; + +template<typename MultiIndexContainer,typename Tag> +struct index_iterator; + +template<typename MultiIndexContainer,typename Tag> +struct index_const_iterator; + +/* get and project functions not fwd declared due to problems + * with dependent typenames + */ + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator==( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator<( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator!=( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator>( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator>=( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y); + +template< + typename Value1,typename IndexSpecifierList1,typename Allocator1, + typename Value2,typename IndexSpecifierList2,typename Allocator2 +> +bool operator<=( + const multi_index_container<Value1,IndexSpecifierList1,Allocator1>& x, + const multi_index_container<Value2,IndexSpecifierList2,Allocator2>& y); + +template<typename Value,typename IndexSpecifierList,typename Allocator> +void swap( + multi_index_container<Value,IndexSpecifierList,Allocator>& x, + multi_index_container<Value,IndexSpecifierList,Allocator>& y); + +} /* namespace multi_index */ + +/* multi_index_container, being the main type of this library, is promoted to + * namespace boost. + */ + +using multi_index::multi_index_container; + +} /* namespace boost */ + +#endif diff --git a/Utilities/BGL/boost/next_prior.hpp b/Utilities/BGL/boost/next_prior.hpp index ac130f6c5e4fbe44665285181142531a7b953176..e1d2e42891976c678a5bd5fe1f1ba86526346e7d 100644 --- a/Utilities/BGL/boost/next_prior.hpp +++ b/Utilities/BGL/boost/next_prior.hpp @@ -4,7 +4,7 @@ // 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/butility for documentation. +// See http://www.boost.org/libs/utility for documentation. // Revision History // 13 Dec 2003 Added next(x, n) and prior(x, n) (Daniel Walker) diff --git a/Utilities/BGL/boost/non_type.hpp b/Utilities/BGL/boost/non_type.hpp deleted file mode 100644 index 896aed4d34b8d68bf3d8fd363834abca68e4b189..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/non_type.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// ------------------------------------- -// -// (C) Copyright Gennaro Prota 2003. -// -// 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_NON_TYPE_HPP_GP_20030417 -#define BOOST_NON_TYPE_HPP_GP_20030417 - - -namespace boost { - - // Just a simple "envelope" for non-type template parameters. Useful - // to work around some MSVC deficiencies. - - template <typename T, T n> - struct non_type { }; - - -} - - -#endif // include guard diff --git a/Utilities/BGL/boost/noncopyable.hpp b/Utilities/BGL/boost/noncopyable.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7770bdbd372027a4d87866b9a781393d0ad69c06 --- /dev/null +++ b/Utilities/BGL/boost/noncopyable.hpp @@ -0,0 +1,36 @@ +// Boost noncopyable.hpp header file --------------------------------------// + +// (C) Copyright Beman Dawes 1999-2003. 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/utility for documentation. + +#ifndef BOOST_NONCOPYABLE_HPP_INCLUDED +#define BOOST_NONCOPYABLE_HPP_INCLUDED + +namespace boost { + +// Private copy constructor and copy assignment ensure classes derived from +// class noncopyable cannot be copied. + +// Contributed by Dave Abrahams + +namespace noncopyable_ // protection from unintended ADL +{ + class noncopyable + { + protected: + noncopyable() {} + ~noncopyable() {} + private: // emphasize the following members are private + noncopyable( const noncopyable& ); + const noncopyable& operator=( const noncopyable& ); + }; +} + +typedef noncopyable_::noncopyable noncopyable; + +} // namespace boost + +#endif // BOOST_NONCOPYABLE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/none.hpp b/Utilities/BGL/boost/none.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bd342da30ad6b875f221e271e06bf44754109782 --- /dev/null +++ b/Utilities/BGL/boost/none.hpp @@ -0,0 +1,28 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// +// 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/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_NONE_17SEP2003_HPP +#define BOOST_NONE_17SEP2003_HPP + +#include "boost/none_t.hpp" + +// NOTE: Borland users have to include this header outside any precompiled headers +// (bcc<=5.64 cannot include instance data in a precompiled header) +// -- * To be verified, now that there's no unnamed namespace + +namespace boost { + +none_t const none = ((none_t)0) ; + +} // namespace boost + +#endif + diff --git a/Utilities/BGL/boost/none_t.hpp b/Utilities/BGL/boost/none_t.hpp index 4b97e20992bb53b6f46b3bf02f445b6b3e8d6293..63ad92652ac8cf6015a57adcd1c73986ff505f49 100644 --- a/Utilities/BGL/boost/none_t.hpp +++ b/Utilities/BGL/boost/none_t.hpp @@ -4,7 +4,7 @@ // 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/lib/optional for documentation. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/Utilities/BGL/boost/operators.hpp b/Utilities/BGL/boost/operators.hpp index 7c80dc4262b52774dc1bd1cd6cfce4313a39b9d6..4b47ba40c1baa21c6498ec940fc638a56ae99592 100644 --- a/Utilities/BGL/boost/operators.hpp +++ b/Utilities/BGL/boost/operators.hpp @@ -5,9 +5,14 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// See http://www.boost.org/libs/butility/operators.htm for documentation. +// See http://www.boost.org/libs/utility/operators.htm for documentation. // Revision History +// 07 Aug 08 Added "euclidean" spelling. (Daniel Frey) +// 03 Apr 08 Make sure "convertible to bool" is sufficient +// for T::operator<, etc. (Daniel Frey) +// 24 May 07 Changed empty_base to depend on T, see +// http://svn.boost.org/trac/boost/ticket/979 // 21 Oct 02 Modified implementation of operators to allow compilers with a // correct named return value optimization (NRVO) to produce optimal // code. (Daniel Frey) @@ -90,15 +95,15 @@ namespace boost { namespace detail { +template <typename T> class empty_base { + // Helmut Zeisel, empty base class optimization bug with GCC 3.0.0 #if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0 -class empty_base { bool dummy; -}; -#else -class empty_base {}; #endif +}; + } // namespace detail } // namespace boost @@ -119,37 +124,37 @@ namespace boost // Note that friend functions defined in a class are implicitly inline. // See the C++ std, 11.4 [class.friend] paragraph 5 -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct less_than_comparable2 : B { - friend bool operator<=(const T& x, const U& y) { return !(x > y); } - friend bool operator>=(const T& x, const U& y) { return !(x < y); } + friend bool operator<=(const T& x, const U& y) { return !static_cast<bool>(x > y); } + friend bool operator>=(const T& x, const U& y) { return !static_cast<bool>(x < y); } friend bool operator>(const U& x, const T& y) { return y < x; } friend bool operator<(const U& x, const T& y) { return y > x; } - friend bool operator<=(const U& x, const T& y) { return !(y < x); } - friend bool operator>=(const U& x, const T& y) { return !(y > x); } + friend bool operator<=(const U& x, const T& y) { return !static_cast<bool>(y < x); } + friend bool operator>=(const U& x, const T& y) { return !static_cast<bool>(y > x); } }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct less_than_comparable1 : B { friend bool operator>(const T& x, const T& y) { return y < x; } - friend bool operator<=(const T& x, const T& y) { return !(y < x); } - friend bool operator>=(const T& x, const T& y) { return !(x < y); } + friend bool operator<=(const T& x, const T& y) { return !static_cast<bool>(y < x); } + friend bool operator>=(const T& x, const T& y) { return !static_cast<bool>(x < y); } }; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct equality_comparable2 : B { friend bool operator==(const U& y, const T& x) { return x == y; } - friend bool operator!=(const U& y, const T& x) { return !(x == y); } - friend bool operator!=(const T& y, const U& x) { return !(y == x); } + friend bool operator!=(const U& y, const T& x) { return !static_cast<bool>(x == y); } + friend bool operator!=(const T& y, const U& x) { return !static_cast<bool>(y == x); } }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct equality_comparable1 : B { - friend bool operator!=(const T& x, const T& y) { return !(x == y); } + friend bool operator!=(const T& x, const T& y) { return !static_cast<bool>(x == y); } }; // A macro which produces "name_2left" from "name". @@ -165,7 +170,7 @@ struct equality_comparable1 : B // implementation available. #define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( const T& lhs, const U& rhs ) \ @@ -174,33 +179,33 @@ struct NAME##2 : B \ { T nrv( rhs ); nrv OP##= lhs; return nrv; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( const T& lhs, const T& rhs ) \ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; -#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ -struct NAME##2 : B \ -{ \ - friend T operator OP( const T& lhs, const U& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ -}; \ - \ -template <class T, class U, class B = ::boost::detail::empty_base> \ -struct BOOST_OPERATOR2_LEFT(NAME) : B \ -{ \ - friend T operator OP( const U& lhs, const T& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ -}; \ - \ -template <class T, class B = ::boost::detail::empty_base> \ -struct NAME##1 : B \ -{ \ - friend T operator OP( const T& lhs, const T& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ +struct NAME##2 : B \ +{ \ + friend T operator OP( const T& lhs, const U& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ +struct BOOST_OPERATOR2_LEFT(NAME) : B \ +{ \ + friend T operator OP( const U& lhs, const T& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template <class T, class B = ::boost::detail::empty_base<T> > \ +struct NAME##1 : B \ +{ \ + friend T operator OP( const T& lhs, const T& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) @@ -210,35 +215,35 @@ struct NAME##1 : B \ // BOOST_OPERATOR2_LEFT(NAME) only looks cool, but doesn't provide // optimization opportunities to the compiler :) -#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ -struct NAME##2 : B \ -{ \ - friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ - friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \ -}; \ - \ -template <class T, class B = ::boost::detail::empty_base> \ -struct NAME##1 : B \ -{ \ - friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ +#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ +struct NAME##2 : B \ +{ \ + friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ + friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \ +}; \ + \ +template <class T, class B = ::boost::detail::empty_base<T> > \ +struct NAME##1 : B \ +{ \ + friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ }; #define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ }; \ \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct BOOST_OPERATOR2_LEFT(NAME) : B \ { \ friend T operator OP( const U& lhs, const T& rhs ) \ { return T( lhs ) OP##= rhs; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ @@ -261,7 +266,7 @@ BOOST_BINARY_OPERATOR_COMMUTATIVE( orable, | ) // incrementable and decrementable contributed by Jeremy Siek -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct incrementable : B { friend T operator++(T& x, int) @@ -274,7 +279,7 @@ private: // The use of this typedef works around a Borland bug typedef T incrementable_type; }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct decrementable : B { friend T operator--(T& x, int) @@ -289,7 +294,7 @@ private: // The use of this typedef works around a Borland bug // Iterator operator classes (contributed by Jeremy Siek) ------------------// -template <class T, class P, class B = ::boost::detail::empty_base> +template <class T, class P, class B = ::boost::detail::empty_base<T> > struct dereferenceable : B { P operator->() const @@ -298,7 +303,7 @@ struct dereferenceable : B } }; -template <class T, class I, class R, class B = ::boost::detail::empty_base> +template <class T, class I, class R, class B = ::boost::detail::empty_base<T> > struct indexable : B { R operator[](I n) const @@ -313,14 +318,14 @@ struct indexable : B #if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) #define BOOST_BINARY_OPERATOR( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( const T& lhs, const U& rhs ) \ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( const T& lhs, const T& rhs ) \ @@ -330,13 +335,13 @@ struct NAME##1 : B \ #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) #define BOOST_BINARY_OPERATOR( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ @@ -349,209 +354,209 @@ BOOST_BINARY_OPERATOR( right_shiftable, >> ) #undef BOOST_BINARY_OPERATOR -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct equivalent2 : B { friend bool operator==(const T& x, const U& y) { - return !(x < y) && !(x > y); + return !static_cast<bool>(x < y) && !static_cast<bool>(x > y); } }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct equivalent1 : B { friend bool operator==(const T&x, const T&y) { - return !(x < y) && !(y < x); + return !static_cast<bool>(x < y) && !static_cast<bool>(y < x); } }; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct partially_ordered2 : B { friend bool operator<=(const T& x, const U& y) - { return (x < y) || (x == y); } + { return static_cast<bool>(x < y) || static_cast<bool>(x == y); } friend bool operator>=(const T& x, const U& y) - { return (x > y) || (x == y); } + { return static_cast<bool>(x > y) || static_cast<bool>(x == y); } friend bool operator>(const U& x, const T& y) { return y < x; } friend bool operator<(const U& x, const T& y) { return y > x; } friend bool operator<=(const U& x, const T& y) - { return (y > x) || (y == x); } + { return static_cast<bool>(y > x) || static_cast<bool>(y == x); } friend bool operator>=(const U& x, const T& y) - { return (y < x) || (y == x); } + { return static_cast<bool>(y < x) || static_cast<bool>(y == x); } }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct partially_ordered1 : B { friend bool operator>(const T& x, const T& y) { return y < x; } friend bool operator<=(const T& x, const T& y) - { return (x < y) || (x == y); } + { return static_cast<bool>(x < y) || static_cast<bool>(x == y); } friend bool operator>=(const T& x, const T& y) - { return (y < x) || (x == y); } + { return static_cast<bool>(y < x) || static_cast<bool>(x == y); } }; // Combined operator classes (contributed by Daryle Walker) ----------------// -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct totally_ordered2 : less_than_comparable2<T, U , equality_comparable2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct totally_ordered1 : less_than_comparable1<T , equality_comparable1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct additive2 : addable2<T, U , subtractable2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct additive1 : addable1<T , subtractable1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct multiplicative2 : multipliable2<T, U , dividable2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct multiplicative1 : multipliable1<T , dividable1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct integer_multiplicative2 : multiplicative2<T, U , modable2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct integer_multiplicative1 : multiplicative1<T , modable1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct arithmetic2 : additive2<T, U , multiplicative2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct arithmetic1 : additive1<T , multiplicative1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct integer_arithmetic2 : additive2<T, U , integer_multiplicative2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct integer_arithmetic1 : additive1<T , integer_multiplicative1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct bitwise2 : xorable2<T, U , andable2<T, U , orable2<T, U, B > > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct bitwise1 : xorable1<T , andable1<T , orable1<T, B > > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct unit_steppable : incrementable<T , decrementable<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct shiftable2 : left_shiftable2<T, U , right_shiftable2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct shiftable1 : left_shiftable1<T , right_shiftable1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct ring_operators2 : additive2<T, U , subtractable2_left<T, U , multipliable2<T, U, B > > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct ring_operators1 : additive1<T , multipliable1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct ordered_ring_operators2 : ring_operators2<T, U , totally_ordered2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct ordered_ring_operators1 : ring_operators1<T , totally_ordered1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct field_operators2 : ring_operators2<T, U , dividable2<T, U , dividable2_left<T, U, B > > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct field_operators1 : ring_operators1<T , dividable1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct ordered_field_operators2 : field_operators2<T, U , totally_ordered2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct ordered_field_operators1 : field_operators1<T , totally_ordered1<T, B > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct euclidian_ring_operators2 : ring_operators2<T, U , dividable2<T, U @@ -560,43 +565,71 @@ struct euclidian_ring_operators2 , modable2_left<T, U, B > > > > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct euclidian_ring_operators1 : ring_operators1<T , dividable1<T , modable1<T, B > > > {}; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct ordered_euclidian_ring_operators2 : totally_ordered2<T, U , euclidian_ring_operators2<T, U, B > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct ordered_euclidian_ring_operators1 : totally_ordered1<T , euclidian_ring_operators1<T, B > > {}; - -template <class T, class P, class B = ::boost::detail::empty_base> + +template <class T, class U, class B = ::boost::detail::empty_base<T> > +struct euclidean_ring_operators2 + : ring_operators2<T, U + , dividable2<T, U + , dividable2_left<T, U + , modable2<T, U + , modable2_left<T, U, B + > > > > > {}; + +template <class T, class B = ::boost::detail::empty_base<T> > +struct euclidean_ring_operators1 + : ring_operators1<T + , dividable1<T + , modable1<T, B + > > > {}; + +template <class T, class U, class B = ::boost::detail::empty_base<T> > +struct ordered_euclidean_ring_operators2 + : totally_ordered2<T, U + , euclidean_ring_operators2<T, U, B + > > {}; + +template <class T, class B = ::boost::detail::empty_base<T> > +struct ordered_euclidean_ring_operators1 + : totally_ordered1<T + , euclidean_ring_operators1<T, B + > > {}; + +template <class T, class P, class B = ::boost::detail::empty_base<T> > struct input_iteratable : equality_comparable1<T , incrementable<T , dereferenceable<T, P, B > > > {}; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct output_iteratable : incrementable<T, B > {}; -template <class T, class P, class B = ::boost::detail::empty_base> +template <class T, class P, class B = ::boost::detail::empty_base<T> > struct forward_iteratable : input_iteratable<T, P, B > {}; -template <class T, class P, class B = ::boost::detail::empty_base> +template <class T, class P, class B = ::boost::detail::empty_base<T> > struct bidirectional_iteratable : forward_iteratable<T, P , decrementable<T, B @@ -606,7 +639,7 @@ struct bidirectional_iteratable // which is an indirect base class of bidirectional_iterable, // random_access_iteratable must not be derived from totally_ordered1 // but from less_than_comparable1 only. (Helmut Zeisel, 02-Dec-2001) -template <class T, class P, class D, class R, class B = ::boost::detail::empty_base> +template <class T, class P, class D, class R, class B = ::boost::detail::empty_base<T> > struct random_access_iteratable : bidirectional_iteratable<T, P , less_than_comparable1<T @@ -650,20 +683,20 @@ struct random_access_iteratable // Otherwise, because a Borland C++ 5.5 bug prevents a using declaration // from working, we are forced to use inheritance for that compiler. -# define BOOST_IMPORT_TEMPLATE4(template_name) \ - template <class T, class U, class V, class W, class B = ::boost::detail::empty_base> \ +# define BOOST_IMPORT_TEMPLATE4(template_name) \ + template <class T, class U, class V, class W, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, U, V, W, B> {}; -# define BOOST_IMPORT_TEMPLATE3(template_name) \ - template <class T, class U, class V, class B = ::boost::detail::empty_base> \ +# define BOOST_IMPORT_TEMPLATE3(template_name) \ + template <class T, class U, class V, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, U, V, B> {}; -# define BOOST_IMPORT_TEMPLATE2(template_name) \ - template <class T, class U, class B = ::boost::detail::empty_base> \ +# define BOOST_IMPORT_TEMPLATE2(template_name) \ + template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, U, B> {}; -# define BOOST_IMPORT_TEMPLATE1(template_name) \ - template <class T, class B = ::boost::detail::empty_base> \ +# define BOOST_IMPORT_TEMPLATE1(template_name) \ + template <class T, class B = ::boost::detail::empty_base<T> > \ struct template_name : ::template_name<T, B> {}; # endif // BOOST_NO_USING_TEMPLATE @@ -752,7 +785,7 @@ template<class T> struct is_chained_base { # define BOOST_OPERATOR_TEMPLATE(template_name) \ template <class T \ ,class U = T \ - ,class B = ::boost::detail::empty_base \ + ,class B = ::boost::detail::empty_base<T> \ ,class O = typename is_chained_base<U>::value \ > \ struct template_name : template_name##2<T, U, B> {}; \ @@ -788,7 +821,7 @@ BOOST_OPERATOR_TEMPLATE1(template_name##1) // In this case we can only assume that template_name<> is equivalent to the // more commonly needed template_name1<> form. # define BOOST_OPERATOR_TEMPLATE(template_name) \ - template <class T, class B = ::boost::detail::empty_base> \ + template <class T, class B = ::boost::detail::empty_base<T> > \ struct template_name : template_name##1<T, B> {}; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -835,6 +868,8 @@ BOOST_OPERATOR_TEMPLATE(field_operators) BOOST_OPERATOR_TEMPLATE(ordered_field_operators) BOOST_OPERATOR_TEMPLATE(euclidian_ring_operators) BOOST_OPERATOR_TEMPLATE(ordered_euclidian_ring_operators) +BOOST_OPERATOR_TEMPLATE(euclidean_ring_operators) +BOOST_OPERATOR_TEMPLATE(ordered_euclidean_ring_operators) BOOST_OPERATOR_TEMPLATE2(input_iteratable) BOOST_OPERATOR_TEMPLATE1(output_iteratable) BOOST_OPERATOR_TEMPLATE2(forward_iteratable) diff --git a/Utilities/BGL/boost/optional.hpp b/Utilities/BGL/boost/optional.hpp index bc5c5d30a097c87685465b3f957551b33f24b3b6..40cf12e65605d5895f2de947ca7251a591a6fff2 100644 --- a/Utilities/BGL/boost/optional.hpp +++ b/Utilities/BGL/boost/optional.hpp @@ -4,7 +4,7 @@ // 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/lib/optional for documentation. +// See http://www.boost.org/libs/optional for documentation. // // You are welcome to contact the author at: // fernando_cacciola@hotmail.com diff --git a/Utilities/BGL/boost/optional/optional.hpp b/Utilities/BGL/boost/optional/optional.hpp index a357dc372c2a7b466f520133961767937e8bb61f..42277ba61e5fd462cd18e55ae772c2e03215655c 100644 --- a/Utilities/BGL/boost/optional/optional.hpp +++ b/Utilities/BGL/boost/optional/optional.hpp @@ -26,8 +26,10 @@ #include "boost/mpl/bool.hpp" #include "boost/mpl/not.hpp" #include "boost/detail/reference_content.hpp" -#include "boost/none_t.hpp" -#include "boost/butility/compare_pointees.hpp" +#include "boost/none.hpp" +#include "boost/utility/compare_pointees.hpp" + +#include "boost/optional/optional_fwd.hpp" #if BOOST_WORKAROUND(BOOST_MSVC, == 1200) // VC6.0 has the following bug: @@ -64,7 +66,7 @@ #endif #if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \ - && BOOST_WORKAROUND(__BORLANDC__, <= 0x564) + && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581) ) // BCB (up to 5.64) has the following bug: // If there is a member function/operator template of the form // template<class Expr> mfunc( Expr expr ) ; @@ -74,6 +76,19 @@ #define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION #endif +// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> +// member template of a factory as used in the optional<> implementation. +// He proposed this simple fix which is to move the call to apply<> outside +// namespace boost. +namespace boost_optional_detail +{ + template <class T, class Factory> + void construct(Factory const& factory, void* address) + { + factory.BOOST_NESTED_TEMPLATE apply<T>(address); + } +} + namespace boost { @@ -131,7 +146,11 @@ class optional_base : public optional_tag { private : - typedef BOOST_DEDUCED_TYPENAME detail::make_reference_content<T>::type internal_type ; + typedef +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + BOOST_DEDUCED_TYPENAME +#endif + ::boost::detail::make_reference_content<T>::type internal_type ; typedef aligned_storage<internal_type> storage_type ; @@ -167,7 +186,7 @@ class optional_base : public optional_tag // Creates an optional<T> uninitialized. // No-throw - optional_base ( none_t const& ) + optional_base ( none_t ) : m_initialized(false) {} @@ -179,6 +198,16 @@ class optional_base : public optional_tag { construct(val); } + + // Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialzed optional<T>. + // Can throw if T::T(T const&) does + optional_base ( bool cond, argument_type val ) + : + m_initialized(false) + { + if ( cond ) + construct(val); + } // Creates a deep copy of another optional<T> // Can throw if T::T(T const&) does @@ -223,6 +252,23 @@ class optional_base : public optional_tag } } + // Assigns from another _convertible_ optional<U> (deep-copies the rhs value) + template<class U> + void assign ( optional<U> const& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(static_cast<value_type>(rhs.get()), is_reference_predicate() ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(static_cast<value_type>(rhs.get())); + } + } + // Assigns from a T (deep-copies the rhs value) void assign ( argument_type val ) { @@ -233,7 +279,7 @@ class optional_base : public optional_tag // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED // No-throw (assuming T::~T() doesn't) - void assign ( none_t const& ) { destroy(); } + void assign ( none_t ) { destroy(); } #ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT template<class Expr> @@ -276,7 +322,7 @@ class optional_base : public optional_tag void construct ( Expr const& factory, in_place_factory_base const* ) { BOOST_STATIC_ASSERT ( ::boost::mpl::not_<is_reference_predicate>::value ) ; - factory.BOOST_NESTED_TEMPLATE apply<value_type>(m_storage.address()) ; + boost_optional_detail::construct<value_type>(factory, m_storage.address()); m_initialized = true ; } @@ -382,7 +428,7 @@ class optional_base : public optional_tag reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; } reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; } -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; } #else void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->T::~T() ; m_initialized = false ; } @@ -395,6 +441,8 @@ class optional_base : public optional_tag // the following olverloads are used to filter out the case and guarantee an error in case of T being a reference. pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; } pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; } + pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; } + pointer_type cast_ptr( internal_type * p, is_reference_tag ) { return &p->get() ; } bool m_initialized ; storage_type m_storage ; @@ -426,12 +474,15 @@ class optional : public optional_detail::optional_base<T> // Creates an optional<T> uninitialized. // No-throw - optional( none_t const& none_ ) : base(none_) {} + optional( none_t none_ ) : base(none_) {} // Creates an optional<T> initialized with 'val'. // Can throw if T::T(T const&) does optional ( argument_type val ) : base(val) {} + // Creates an optional<T> initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T const&) does + optional ( bool cond, argument_type val ) : base(cond,val) {} #ifndef BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR // NOTE: MSVC needs templated versions first @@ -481,6 +532,7 @@ class optional : public optional_detail::optional_base<T> } #endif + #ifndef BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT // Assigns from another convertible optional<U> (converts && deep-copies the rhs value) // Requires a valid conversion from U to T. @@ -488,7 +540,7 @@ class optional : public optional_detail::optional_base<T> template<class U> optional& operator= ( optional<U> const& rhs ) { - this->assign(rhs.get()); + this->assign(rhs); return *this ; } #endif @@ -513,7 +565,7 @@ class optional : public optional_detail::optional_base<T> // Assigns from a "none" // Which destroys the current value, if any, leaving this UNINITIALIZED // No-throw (assuming T::~T() doesn't) - optional& operator= ( none_t const& none_ ) + optional& operator= ( none_t none_ ) { this->assign( none_ ) ; return *this ; @@ -525,6 +577,10 @@ class optional : public optional_detail::optional_base<T> reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + // Returns a copy of the value if this is initialized, 'v' otherwise + reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } + reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } + // Returns a pointer to the value if this is initialized, otherwise, // the behaviour is UNDEFINED // No-throw @@ -546,6 +602,22 @@ class optional : public optional_detail::optional_base<T> bool operator!() const { return !this->is_initialized() ; } } ; +// Returns optional<T>(v) +template<class T> +inline +optional<T> make_optional ( T const& v ) +{ + return optional<T>(v); +} + +// Returns optional<T>(cond,v) +template<class T> +inline +optional<T> make_optional ( bool cond, T const& v ) +{ + return optional<T>(cond,v); +} + // Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. // No-throw template<class T> @@ -582,6 +654,24 @@ get ( optional<T>* opt ) return opt->get_ptr() ; } +// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. +// No-throw +template<class T> +inline +BOOST_DEDUCED_TYPENAME optional<T>::reference_const_type +get_optional_value_or ( optional<T> const& opt, BOOST_DEDUCED_TYPENAME optional<T>::reference_const_type v ) +{ + return opt.get_value_or(v) ; +} + +template<class T> +inline +BOOST_DEDUCED_TYPENAME optional<T>::reference_type +get_optional_value_or ( optional<T>& opt, BOOST_DEDUCED_TYPENAME optional<T>::reference_type v ) +{ + return opt.get_value_or(v) ; +} + // Returns a pointer to the value if this is initialized, otherwise, returns NULL. // No-throw template<class T> @@ -603,6 +693,11 @@ get_pointer ( optional<T>& opt ) // optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). // WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. + +// +// optional<T> vs optional<T> cases +// + template<class T> inline bool operator == ( optional<T> const& x, optional<T> const& y ) @@ -633,64 +728,141 @@ inline bool operator >= ( optional<T> const& x, optional<T> const& y ) { return !( x < y ) ; } + +// +// optional<T> vs T cases +// +template<class T> +inline +bool operator == ( optional<T> const& x, T const& y ) +{ return equal_pointees(x, optional<T>(y)); } + +template<class T> +inline +bool operator < ( optional<T> const& x, T const& y ) +{ return less_pointees(x, optional<T>(y)); } + +template<class T> +inline +bool operator != ( optional<T> const& x, T const& y ) +{ return !( x == y ) ; } + +template<class T> +inline +bool operator > ( optional<T> const& x, T const& y ) +{ return y < x ; } + +template<class T> +inline +bool operator <= ( optional<T> const& x, T const& y ) +{ return !( y < x ) ; } + +template<class T> +inline +bool operator >= ( optional<T> const& x, T const& y ) +{ return !( x < y ) ; } + +// +// T vs optional<T> cases +// + +template<class T> +inline +bool operator == ( T const& x, optional<T> const& y ) +{ return equal_pointees( optional<T>(x), y ); } + +template<class T> +inline +bool operator < ( T const& x, optional<T> const& y ) +{ return less_pointees( optional<T>(x), y ); } + +template<class T> +inline +bool operator != ( T const& x, optional<T> const& y ) +{ return !( x == y ) ; } + +template<class T> +inline +bool operator > ( T const& x, optional<T> const& y ) +{ return y < x ; } + +template<class T> +inline +bool operator <= ( T const& x, optional<T> const& y ) +{ return !( y < x ) ; } + +template<class T> +inline +bool operator >= ( T const& x, optional<T> const& y ) +{ return !( x < y ) ; } + + +// +// optional<T> vs none cases +// + template<class T> inline -bool operator == ( optional<T> const& x, none_t const& ) +bool operator == ( optional<T> const& x, none_t ) { return equal_pointees(x, optional<T>() ); } template<class T> inline -bool operator < ( optional<T> const& x, none_t const& ) +bool operator < ( optional<T> const& x, none_t ) { return less_pointees(x,optional<T>() ); } template<class T> inline -bool operator != ( optional<T> const& x, none_t const& y ) +bool operator != ( optional<T> const& x, none_t y ) { return !( x == y ) ; } template<class T> inline -bool operator > ( optional<T> const& x, none_t const& y ) +bool operator > ( optional<T> const& x, none_t y ) { return y < x ; } template<class T> inline -bool operator <= ( optional<T> const& x, none_t const& y ) +bool operator <= ( optional<T> const& x, none_t y ) { return !( y < x ) ; } template<class T> inline -bool operator >= ( optional<T> const& x, none_t const& y ) +bool operator >= ( optional<T> const& x, none_t y ) { return !( x < y ) ; } +// +// none vs optional<T> cases +// + template<class T> inline -bool operator == ( none_t const& x, optional<T> const& y ) +bool operator == ( none_t x, optional<T> const& y ) { return equal_pointees(optional<T>() ,y); } template<class T> inline -bool operator < ( none_t const& x, optional<T> const& y ) +bool operator < ( none_t x, optional<T> const& y ) { return less_pointees(optional<T>() ,y); } template<class T> inline -bool operator != ( none_t const& x, optional<T> const& y ) +bool operator != ( none_t x, optional<T> const& y ) { return !( x == y ) ; } template<class T> inline -bool operator > ( none_t const& x, optional<T> const& y ) +bool operator > ( none_t x, optional<T> const& y ) { return y < x ; } template<class T> inline -bool operator <= ( none_t const& x, optional<T> const& y ) +bool operator <= ( none_t x, optional<T> const& y ) { return !( y < x ) ; } template<class T> inline -bool operator >= ( none_t const& x, optional<T> const& y ) +bool operator >= ( none_t x, optional<T> const& y ) { return !( x < y ) ; } // @@ -743,6 +915,7 @@ template<class T> inline void swap ( optional<T>& x, optional<T>& y ) optional_detail::optional_swap(x,y); } + } // namespace boost #endif diff --git a/Utilities/BGL/boost/optional/optional_io.hpp b/Utilities/BGL/boost/optional/optional_io.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ef1ecaf3a066461dc4e887aa2775d3d99bee20fb --- /dev/null +++ b/Utilities/BGL/boost/optional/optional_io.hpp @@ -0,0 +1,84 @@ +// Copyright (C) 2005, Fernando Luis Cacciola Carballal. +// +// 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/lib/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_OPTIONAL_IO_FLC_19NOV2002_HPP + +#if defined __GNUC__ +# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97) +# define BOOST_OPTIONAL_NO_TEMPLATED_STREAMS +# endif +#endif // __GNUC__ + +#if defined BOOST_OPTIONAL_NO_TEMPLATED_STREAMS +# include <iostream> +#else +# include <istream> +# include <ostream> +#endif + + +#include "boost/optional/optional.hpp" +#include "boost/utility/value_init.hpp" + +namespace boost +{ + +#if defined (BOOST_NO_TEMPLATED_STREAMS) +template<class T> +inline std::ostream& operator<<(std::ostream& out, optional<T> const& v) +#else +template<class CharType, class CharTrait, class T> +inline +std::basic_ostream<CharType, CharTrait>& +operator<<(std::basic_ostream<CharType, CharTrait>& out, optional<T> const& v) +#endif +{ + if ( out.good() ) + { + if ( !v ) + out << "--" ; + else out << ' ' << *v ; + } + + return out; +} + +#if defined (BOOST_NO_TEMPLATED_STREAMS) +template<class T> +inline std::istream& operator>>(std::istream& in, optional<T>& v) +#else +template<class CharType, class CharTrait, class T> +inline +std::basic_istream<CharType, CharTrait>& +operator>>(std::basic_istream<CharType, CharTrait>& in, optional<T>& v) +#endif +{ + if ( in.good() ) + { + int d = in.get(); + if ( d == ' ' ) + { + T x ; + in >> x; + v = x ; + } + else + v = optional<T>() ; + } + + return in; +} + +} // namespace boost + +#endif + diff --git a/Utilities/BGL/boost/pending/container_traits.hpp b/Utilities/BGL/boost/pending/container_traits.hpp index 9b0760b5d0d8b7f2029cddfc2dc4332710743023..571eedb1c1a1fdf4479af5c6be622a86175651e2 100644 --- a/Utilities/BGL/boost/pending/container_traits.hpp +++ b/Utilities/BGL/boost/pending/container_traits.hpp @@ -17,12 +17,32 @@ #include <list> #include <map> #include <set> -#ifndef BOOST_NO_SLIST -# include <slist> + +#if !defined BOOST_NO_HASH +# ifdef BOOST_HASH_SET_HEADER +# include BOOST_HASH_SET_HEADER +# else +# include <hash_set> +# endif +# ifdef BOOST_HASH_MAP_HEADER +# include BOOST_HASH_MAP_HEADER +# else +# include <hash_map> +# endif #endif -#ifndef BOOST_NO_HASH -# include <hash_map> -# include <hash_set> + +#if !defined BOOST_NO_SLIST +# ifdef BOOST_SLIST_HEADER +# include BOOST_SLIST_HEADER +# else +# include <slist> +# endif +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of concept checking class templates +# define Container Container_ +# define AssociativeContainer AssociativeContainer_ #endif // The content of this file is in 'graph_detail' because otherwise @@ -396,4 +416,10 @@ namespace boost { namespace graph_detail { }} // namespace boost::graph_detail +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +// Stay out of the way of concept checking class templates +# undef Container +# undef AssociativeContainer +#endif + #endif // BOOST_GRAPH_DETAIL_CONTAINER_TRAITS_H diff --git a/Utilities/BGL/boost/pending/ct_if.hpp b/Utilities/BGL/boost/pending/ct_if.hpp deleted file mode 100644 index 2f8540d89339510fead142127e9b9a204b80d63f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/pending/ct_if.hpp +++ /dev/null @@ -1,111 +0,0 @@ -// (C) Copyright Jeremy Siek 2000. -// 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) - -// The ct_if implementation that avoids partial specialization is -// based on the IF class by Ulrich W. Eisenecker and Krzysztof -// Czarnecki. - -#ifndef BOOST_CT_IF_HPP -#define BOOST_CT_IF_HPP - -#include <boost/config.hpp> - -/* - There is a bug in the Borland compiler with regards to using - integers to specialize templates. This made it hard to use ct_if in - the graph library. Changing from 'ct_if' to 'ct_if_t' fixed the - problem. -*/ - -#include <boost/type_traits/integral_constant.hpp> // true_type and false_type - -namespace boost { - - struct ct_if_error { }; - - template <class A, class B> - struct ct_and { typedef false_type type; }; - template <> struct ct_and<true_type,true_type> { typedef true_type type; }; - - template <class A> struct ct_not { typedef ct_if_error type; }; - template <> struct ct_not<true_type> { typedef false_type type; }; - template <> struct ct_not<false_type> { typedef true_type type; }; - -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -// agurt, 15/sep/02: in certain cases Borland has problems with -// choosing the right 'ct_if' specialization even though 'cond' -// _does_ equal '1'; the easiest way to fix it is to make first -// 'ct_if' non-type template parameter boolean. -#if !defined(__BORLANDC__) - template <bool cond, class A, class B> - struct ct_if { typedef ct_if_error type; }; - template <class A, class B> - struct ct_if<true, A, B> { typedef A type; }; - template <class A, class B> - struct ct_if<false, A, B> { typedef B type; }; -#else - template <bool cond, class A, class B> - struct ct_if { typedef A type; }; - template <class A, class B> - struct ct_if<false, A, B> { typedef B type; }; -#endif - - template <class cond, class A, class B> - struct ct_if_t { typedef ct_if_error type; }; - template <class A, class B> - struct ct_if_t<true_type, A, B> { typedef A type; }; - template <class A, class B> - struct ct_if_t<false_type, A, B> { typedef B type; }; - -#else - - namespace detail { - - template <int condition, class A, class B> struct IF; - template <int condition> struct SlectSelector; - struct SelectFirstType; - struct SelectSecondType; - - struct SelectFirstType { - template<class A, class B> - struct Template { typedef A type; }; - }; - - struct SelectSecondType { - template<class A, class B> - struct Template { typedef B type; }; - }; - - template<int condition> - struct SlectSelector { - typedef SelectFirstType type; - }; - - template <> - struct SlectSelector<0> { - typedef SelectSecondType type; - }; - - } // namespace detail - - template<int condition, class A, class B> - struct ct_if - { - typedef typename detail::SlectSelector<condition>::type Selector; - typedef typename Selector::template Template<A, B>::type type; - }; - - template <class cond, class A, class B> - struct ct_if_t { - typedef typename ct_if<cond::value, A, B>::type type; - }; - -#endif - -} // namespace boost - -#endif // BOOST_CT_IF_HPP - diff --git a/Utilities/BGL/boost/pending/fibonacci_heap.hpp b/Utilities/BGL/boost/pending/fibonacci_heap.hpp index f63bf6d1c3ab1fc38752912085fd6e5682c8429c..a386e285e35a1df58aa0116c6e00f2b861feae66 100644 --- a/Utilities/BGL/boost/pending/fibonacci_heap.hpp +++ b/Utilities/BGL/boost/pending/fibonacci_heap.hpp @@ -8,13 +8,13 @@ #if defined(__sgi) && !defined(__GNUC__) # include <math.h> #else -# include <cmath> +# include <boost/config/no_tr1/cmath.hpp> #endif #include <iosfwd> #include <vector> #include <functional> #include <boost/config.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> // // An adaptation of Knuth's Fibonacci heap implementation @@ -120,12 +120,14 @@ public: new_roots[r] = nil(); if (_compare(_key[u], _key[v])) { _degree[v] = r; + _mark[v] = false; std::swap(u, v); } make_child(u, v, r); ++r; } _degree[v] = r; + _mark[v] = false; } // 40 void make_child(size_type u, size_type v, size_type r) { @@ -140,6 +142,7 @@ public: _right[t] = u; _left[_right[u]] = u; } + _p[u] = v; } // 41 inline void rebuild_root_list(LinkIter new_roots, int& h) @@ -177,7 +180,7 @@ public: if (p == nil()) { if (_compare(d, _key[_root])) _root = v; - } else if (_compare(d, _key[_root])) + } else if (_compare(d, _key[p])) while (1) { size_type r = _degree[p]; if (r >= 2) @@ -190,6 +193,7 @@ public: } if (_mark[p] == false) { _mark[p] = true; + --_degree[p]; break; } else --_degree[p]; @@ -236,7 +240,7 @@ protected: void print_recur(size_type x, std::ostream& os) { if (x != nil()) { os << x; - if (_child[x] != nil()) { + if (_degree[x] > 0) { os << "("; size_type i = _child[x]; do { diff --git a/Utilities/BGL/boost/pending/indirect_cmp.hpp b/Utilities/BGL/boost/pending/indirect_cmp.hpp index c97594933f928b5696bbfda46bc99aff3cfba7fe..5e866561b7683967b81d5a6fab0de040d2b110d1 100644 --- a/Utilities/BGL/boost/pending/indirect_cmp.hpp +++ b/Utilities/BGL/boost/pending/indirect_cmp.hpp @@ -14,7 +14,7 @@ #include <functional> #include <boost/config.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> namespace boost { diff --git a/Utilities/BGL/boost/pending/integer_log2.hpp b/Utilities/BGL/boost/pending/integer_log2.hpp index fd8e4465d1545ba236217de44395739a85ae52f2..f4bc84600cc033080ddf65b82f794a5e34fa717b 100644 --- a/Utilities/BGL/boost/pending/integer_log2.hpp +++ b/Utilities/BGL/boost/pending/integer_log2.hpp @@ -1,25 +1,24 @@ -// ------------------------------------- +// ----------------------------------------------------------- // integer_log2.hpp // // Gives the integer part of the logarithm, in base 2, of a // given number. Behavior is undefined if the argument is <= 0. // -// -// (C) Copyright Gennaro Prota 2003 - 2004. +// Copyright (c) 2003-2004, 2008 Gennaro Prota // // 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_INTEGER_LOG2_HPP_GP_20030301 #define BOOST_INTEGER_LOG2_HPP_GP_20030301 -#include <cassert> -#include <climits> // actually used for Borland only +#include <assert.h> +#ifdef __BORLANDC__ +#include <climits> +#endif #include "boost/limits.hpp" #include "boost/config.hpp" @@ -34,7 +33,7 @@ namespace boost { while (x != 1) { - const T t = x >> n; + const T t = static_cast<T>(x >> n); if (t) { result += n; x = t; diff --git a/Utilities/BGL/boost/pending/lowest_bit.hpp b/Utilities/BGL/boost/pending/lowest_bit.hpp index dd8914e9f62ea6463b8a51893b03023d8e10d46e..dd6e6e8c9ecdaa59d413779a19c56a816df6ede0 100644 --- a/Utilities/BGL/boost/pending/lowest_bit.hpp +++ b/Utilities/BGL/boost/pending/lowest_bit.hpp @@ -1,20 +1,20 @@ -// ------------------------------------- +// ----------------------------------------------------------- // lowest_bit.hpp // // Position of the lowest bit 'on' // -// (C) Copyright Gennaro Prota 2003 - 2004. +// Copyright (c) 2003-2004, 2008 Gennaro Prota // // 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_LOWEST_BIT_HPP_GP_20030301 #define BOOST_LOWEST_BIT_HPP_GP_20030301 -#include <cassert> +#include <assert.h> #include "boost/pending/integer_log2.hpp" diff --git a/Utilities/BGL/boost/pending/mutable_queue.hpp b/Utilities/BGL/boost/pending/mutable_queue.hpp index b0f1073f12f0778fd256bb4e7b90432936749cf0..a4e2050d9f45a4d53c73d3f55cadbd5d88aab721 100644 --- a/Utilities/BGL/boost/pending/mutable_queue.hpp +++ b/Utilities/BGL/boost/pending/mutable_queue.hpp @@ -14,7 +14,7 @@ #include <vector> #include <algorithm> #include <functional> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/pending/mutable_heap.hpp> #include <boost/pending/is_heap.hpp> #include <boost/graph/detail/array_binary_tree.hpp> diff --git a/Utilities/BGL/boost/pending/property.hpp b/Utilities/BGL/boost/pending/property.hpp index 7300c62d49c8ed07eefc4822c6be055648ac06b9..07cea5f070764e4bd3db48904379eea5381587ac 100644 --- a/Utilities/BGL/boost/pending/property.hpp +++ b/Utilities/BGL/boost/pending/property.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Jeremy Siek 2004 +// (C) Copyright Jeremy Siek 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) @@ -6,26 +6,32 @@ #ifndef BOOST_PROPERTY_HPP #define BOOST_PROPERTY_HPP -#include <boost/pending/ct_if.hpp> +#include <boost/mpl/bool.hpp> namespace boost { - struct no_property { + struct no_property { typedef no_property tag_type; typedef no_property next_type; typedef no_property value_type; enum { num = 0 }; typedef void kind; }; + template <class Tag, class T, class Base = no_property> struct property : public Base { typedef Base next_type; typedef Tag tag_type; typedef T value_type; +#if BOOST_WORKAROUND (__GNUC__, < 3) property() { } +#else + property() : m_value() { } +#endif property(const T& v) : m_value(v) { } property(const T& v, const Base& b) : Base(b), m_value(v) { } // copy constructor and assignment operator will be generated by compiler + T m_value; }; @@ -41,15 +47,9 @@ namespace boost { }; template <class P> - struct has_property { - BOOST_STATIC_CONSTANT(bool, value = true); - typedef true_type type; - }; + struct has_property : boost::mpl::true_ {}; template <> - struct has_property<no_property> { - BOOST_STATIC_CONSTANT(bool, value = false); - typedef false_type type; - }; + struct has_property<no_property> : boost::mpl::false_ {}; } // namespace boost @@ -66,13 +66,19 @@ namespace boost { typedef typename detail::build_property_tag_value_alist<PropertyList>::type AList; typedef typename detail::ev_selector<AList>::type Extractor; typedef typename Extractor::template bind_<AList,Tag>::type type; -#endif +#endif }; + template <class Tag2> + inline detail::error_property_not_found + get_property_value(const no_property& p, Tag2) { + return detail::error_property_not_found(); + } + template <class Tag1, class Tag2, class T1, class Base> - inline typename property_value<property<Tag1,T1,Base>, Tag2>::type& + inline typename property_value<property<Tag1,T1,Base>, Tag2>::type& get_property_value(property<Tag1,T1,Base>& p, Tag2 tag2) { - BOOST_STATIC_CONSTANT(bool, + BOOST_STATIC_CONSTANT(bool, match = (detail::same_property<Tag1,Tag2>::value)); typedef property<Tag1,T1,Base> Prop; typedef typename property_value<Prop, Tag2>::type T2; @@ -82,9 +88,9 @@ namespace boost { } template <class Tag1, class Tag2, class T1, class Base> inline - const typename property_value<property<Tag1,T1,Base>, Tag2>::type& + const typename property_value<property<Tag1,T1,Base>, Tag2>::type& get_property_value(const property<Tag1,T1,Base>& p, Tag2 tag2) { - BOOST_STATIC_CONSTANT(bool, + BOOST_STATIC_CONSTANT(bool, match = (detail::same_property<Tag1,Tag2>::value)); typedef property<Tag1,T1,Base> Prop; typedef typename property_value<Prop, Tag2>::type T2; @@ -94,33 +100,68 @@ namespace boost { } namespace detail { + + /** This trait returns true if T is no_property. */ + template <typename T> + struct is_no_property + : mpl::bool_<is_same<T, no_property>::value> + { }; + #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - template<typename FinalTag, typename FinalType> - struct retag_property_list - { - typedef property<FinalTag, FinalType> type; - typedef FinalType retagged; - }; - - template<typename FinalTag, typename Tag, typename T, typename Base> - struct retag_property_list<FinalTag, property<Tag, T, Base> > - { - private: - typedef retag_property_list<FinalTag, Base> next; - - public: - typedef property<Tag, T, typename next::type> type; - typedef typename next::retagged retagged; - }; - - template<typename FinalTag> - struct retag_property_list<FinalTag, no_property> - { - typedef no_property type; - typedef no_property retagged; - }; + /** @internal @name Retag Property List + * This metafunction is used internally to normalize a property if it is + * actually modeling a property. Specifically this is used in Boost.Graph + * to map user-provided classes into bundled properties. + */ + //@{ + // One base case of the recursive form (see below). This matches any + // retag request that does not include a property<...> or no_property as + // the FinalType. This is used for generating bundles in Boost.Graph. + template<typename FinalTag, typename FinalType> + struct retag_property_list + { + typedef property<FinalTag, FinalType> type; + typedef FinalType retagged; + }; + + // Recursively retag the nested property list. + template<typename FinalTag, typename Tag, typename T, typename Base> + struct retag_property_list<FinalTag, property<Tag, T, Base> > + { + private: + typedef retag_property_list<FinalTag, Base> next; + + public: + typedef property<Tag, T, typename next::type> type; + typedef typename next::retagged retagged; + }; + + // This base case will correctly deduce the final property type if the + // retagged property is given in property form. This should not hide + // the base case below. + // NOTE: This addresses a problem of layering bundled properties in the BGL + // where multiple retaggings will fail to deduce the correct retagged + // type. + template<typename FinalTag, typename FinalType> + struct retag_property_list<FinalTag, property<FinalTag, FinalType> > + { + public: + typedef property<FinalTag, FinalType> type; + typedef FinalType retagged; + }; + + // A final base case of the retag_propert_list, this will terminate a + // properly structured list. + template<typename FinalTag> + struct retag_property_list<FinalTag, no_property> + { + typedef no_property type; + typedef no_property retagged; + }; + //@} #endif - } +} // namespace detail + } // namesapce boost #endif /* BOOST_PROPERTY_HPP */ diff --git a/Utilities/BGL/boost/pending/property_serialize.hpp b/Utilities/BGL/boost/pending/property_serialize.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff2623f2264919a25fce5cf3608dd530da1a8a6c --- /dev/null +++ b/Utilities/BGL/boost/pending/property_serialize.hpp @@ -0,0 +1,70 @@ +// (C) Copyright Jeremy Siek 2006 +// 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_PROPERTY_SERIALIZE_HPP +#define BOOST_PROPERTY_SERIALIZE_HPP + +#include <boost/pending/property.hpp> +#ifdef BOOST_GRAPH_USE_MPI +#include <boost/mpi/datatype.hpp> +#include <boost/serialization/is_bitwise_serializable.hpp> +#endif // BOOST_GRAPH_USE_MPI + +#include <boost/serialization/base_object.hpp> +#include <boost/serialization/nvp.hpp> + +namespace boost { + template<class Archive> + inline void serialize(Archive&, no_property&, const unsigned int) { } + + template<class Archive, class Tag, class T, class Base> + void + serialize(Archive& ar, property<Tag, T, Base>& prop, + const unsigned int version) + { + ar & serialization::make_nvp( "property_base" , boost::serialization::base_object<Base>(prop) ); + ar & serialization::make_nvp( "property_value" , prop.m_value ); + } + +#ifdef BOOST_GRAPH_USE_MPI + namespace mpi { + template<typename Tag, typename T, typename Base> + struct is_mpi_datatype<property<Tag, T, Base> > + : mpl::and_<is_mpi_datatype<T>, + is_mpi_datatype<Base> > { }; + } + + namespace serialization { + template<typename Tag, typename T, typename Base> + struct is_bitwise_serializable<property<Tag, T, Base> > + : mpl::and_<is_bitwise_serializable<T>, + is_bitwise_serializable<Base> > { }; + + template<typename Tag, typename T, typename Base> + struct implementation_level<property<Tag, T, Base> > + : mpl::int_<object_serializable> {} ; + + template<typename Tag, typename T, typename Base> + struct tracking_level<property<Tag, T, Base> > + : mpl::int_<track_never> {} ; + + } +#endif // BOOST_GRAPH_USE_MPI + +} // end namespace boost + +#ifdef BOOST_GRAPH_USE_MPI +namespace boost { namespace mpi { + template<> + struct is_mpi_datatype<boost::no_property> : mpl::true_ { }; + +} } // end namespace boost::mpi + +BOOST_IS_BITWISE_SERIALIZABLE(boost::no_property) +BOOST_CLASS_IMPLEMENTATION(boost::no_property,object_serializable) +BOOST_CLASS_TRACKING(boost::no_property,track_never) +#endif // BOOST_GRAPH_USE_MPI + +#endif // BOOST_PROPERTY_SERIALIZE_HPP diff --git a/Utilities/BGL/boost/pending/relaxed_heap.hpp b/Utilities/BGL/boost/pending/relaxed_heap.hpp index 4b672d5beb228669bc58e49b55803e190fab160a..b3ab2ed202f0fd39c06efcf01e0780ff420abc36 100644 --- a/Utilities/BGL/boost/pending/relaxed_heap.hpp +++ b/Utilities/BGL/boost/pending/relaxed_heap.hpp @@ -10,9 +10,11 @@ #define BOOST_RELAXED_HEAP_HEADER #include <functional> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/optional.hpp> #include <vector> +#include <climits> // for CHAR_BIT +#include <boost/none.hpp> #ifdef BOOST_RELAXED_HEAP_DEBUG # include <iostream> @@ -86,7 +88,7 @@ private: group** children; }; - size_type log2(size_type n) + size_type log_base_2(size_type n) // log2 is a macro on some platforms { size_type leading_zeroes = 0; do { @@ -112,12 +114,11 @@ public: return; } - log_n = log2(n); - + log_n = log_base_2(n); if (log_n == 0) log_n = 1; size_type g = n / log_n; if (n % log_n > 0) ++g; - size_type log_g = log2(g); + size_type log_g = log_base_2(g); size_type r = log_g; // Reserve an appropriate amount of space for data structures, so @@ -134,7 +135,7 @@ public: root.children[r] = &index_to_group[idx]; idx = build_tree(root, idx, r, log_g + 1); if (idx != g) - r = static_cast<size_type>(log2(g-idx)); + r = static_cast<size_type>(log_base_2(g-idx)); } } @@ -173,14 +174,14 @@ public: value_type& top() { find_smallest(); - assert(smallest_value->value != 0); + assert(smallest_value->value != none); return *smallest_value->value; } const value_type& top() const { find_smallest(); - assert(smallest_value->value != 0); + assert(smallest_value->value != none); return *smallest_value->value; } @@ -203,7 +204,7 @@ public: rank_type r = x->rank; group* p = x->parent; { - assert(x->value != 0); + assert(x->value != none); // Find x's group size_type start = get(id, *x->value) - get(id, *x->value) % log_n; @@ -629,7 +630,7 @@ private: */ mutable group* smallest_value; - /// Cached value log2(n) + /// Cached value log_base_2(n) size_type log_n; }; diff --git a/Utilities/BGL/boost/pending/stringtok.hpp b/Utilities/BGL/boost/pending/stringtok.hpp index ae52e8db1d2f00359898cc7079d26e69951661c6..3b8e5e32491e8c3b6f057ff5884135fb58afe613 100644 --- a/Utilities/BGL/boost/pending/stringtok.hpp +++ b/Utilities/BGL/boost/pending/stringtok.hpp @@ -3,6 +3,9 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_STRINGTOK_HPP +#define BOOST_STRINGTOK_HPP + /* * stringtok.hpp -- Breaks a string into tokens. This is an example for lib3. * @@ -63,14 +66,14 @@ * This is the only part of the implementation that I don't like. * It can probably be improved upon by the reader... */ -namespace { + inline bool isws (char c, char const * const wstr) { using namespace std; return (strchr(wstr,c) != NULL); } -} + namespace boost { @@ -109,3 +112,5 @@ stringtok (Container &l, std::string const &s, char const * const ws = " \t\n") } // namespace boost + +#endif // BOOST_STRINGTOK_HPP diff --git a/Utilities/BGL/boost/pointee.hpp b/Utilities/BGL/boost/pointee.hpp deleted file mode 100644 index 9794b8e7dbeb63f1401b479c835c6429cbfb08b4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/pointee.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef POINTEE_DWA200415_HPP -# define POINTEE_DWA200415_HPP - -// -// Copyright David Abrahams 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) -// -// typename pointee<P>::type provides the pointee type of P. -// -// For example, it is T for T* and X for shared_ptr<X>. -// -// http://www.boost.org/libs/iterator/doc/pointee.html -// - -# include <boost/detail/is_incrementable.hpp> -# include <boost/iterator/iterator_traits.hpp> -# include <boost/type_traits/add_const.hpp> -# include <boost/type_traits/remove_cv.hpp> -# include <boost/mpl/if.hpp> -# include <boost/mpl/eval_if.hpp> - -namespace boost { - -namespace detail -{ - template <class P> - struct smart_ptr_pointee - { - typedef typename P::element_type type; - }; - - template <class Iterator> - struct iterator_pointee - { - typedef typename iterator_traits<Iterator>::value_type value_type; - - struct impl - { - template <class T> - static char test(T const&); - - static char (& test(value_type&) )[2]; - - static Iterator& x; - }; - - BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1); - - typedef typename mpl::if_c< -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - ::boost::detail::iterator_pointee<Iterator>::is_constant -# else - is_constant -# endif - , typename add_const<value_type>::type - , value_type - >::type type; - }; -} - -template <class P> -struct pointee - : mpl::eval_if< - detail::is_incrementable<P> - , detail::iterator_pointee<P> - , detail::smart_ptr_pointee<P> - > -{ -}; - -} // namespace boost - -#endif // POINTEE_DWA200415_HPP diff --git a/Utilities/BGL/boost/preprocessor.hpp b/Utilities/BGL/boost/preprocessor.hpp deleted file mode 100644 index 6f5c822f856224fdd58c92d2c7b3fc5e7a98c9d8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/preprocessor.hpp +++ /dev/null @@ -1,19 +0,0 @@ -# /* Copyright (C) 2001 -# * Housemarque Oy -# * http://www.housemarque.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) -# */ -# -# /* Revised by Paul Mensonides (2002) */ -# -# /* See http://www.boost.org/libs/preprocessor for documentation. */ -# -# ifndef BOOST_PREPROCESSOR_HPP -# define BOOST_PREPROCESSOR_HPP -# -# include <boost/preprocessor/library.hpp> -# -# endif diff --git a/Utilities/BGL/boost/preprocessor/config/config.hpp b/Utilities/BGL/boost/preprocessor/config/config.hpp index 06b3c5a6e130c28ded359c339fcc13fe57602632..dd0f7138d03473d846fe70e78c14959da5973d51 100644 --- a/Utilities/BGL/boost/preprocessor/config/config.hpp +++ b/Utilities/BGL/boost/preprocessor/config/config.hpp @@ -24,14 +24,24 @@ # define BOOST_PP_CONFIG_DMC() 0x0040 # # ifndef BOOST_PP_CONFIG_FLAGS -# if defined(__SPIRIT_PP__) || defined(__MWERKS__) && __MWERKS__ >= 0x3200 +# 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__) -# define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT()) +# if defined(_MSC_VER) && __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) diff --git a/Utilities/BGL/boost/preprocessor/detail/check.hpp b/Utilities/BGL/boost/preprocessor/detail/check.hpp index 6346be7ff68234d86674fbbf79bb680cd085ea96..63f8ff91665ae70cc36ba0e3e8551d24157f774b 100644 --- a/Utilities/BGL/boost/preprocessor/detail/check.hpp +++ b/Utilities/BGL/boost/preprocessor/detail/check.hpp @@ -35,7 +35,7 @@ # define BOOST_PP_CHECK_3(im) BOOST_PP_CHECK_5(BOOST_PP_CHECK_4 im) # define BOOST_PP_CHECK_4(res, _) res # define BOOST_PP_CHECK_5(res) res -# else // DMC +# else /* DMC */ # define BOOST_PP_CHECK_D(x, type) BOOST_PP_CHECK_OO((type x)) # define BOOST_PP_CHECK_OO(par) BOOST_PP_CHECK_0 ## par # define BOOST_PP_CHECK_0(chk) BOOST_PP_CHECK_1(BOOST_PP_CAT(BOOST_PP_CHECK_RESULT_, chk)) diff --git a/Utilities/BGL/boost/preprocessor/repetition.hpp b/Utilities/BGL/boost/preprocessor/repetition.hpp index 6e8bb3d8172f138e022f2158f2474433667e8f3f..efcd60a27df8d62380ba78804eab0af8475bbf90 100644 --- a/Utilities/BGL/boost/preprocessor/repetition.hpp +++ b/Utilities/BGL/boost/preprocessor/repetition.hpp @@ -20,6 +20,7 @@ # include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> # include <boost/preprocessor/repetition/enum_params_with_defaults.hpp> # include <boost/preprocessor/repetition/enum_shifted.hpp> +# include <boost/preprocessor/repetition/enum_shifted_binary_params.hpp> # include <boost/preprocessor/repetition/enum_shifted_params.hpp> # include <boost/preprocessor/repetition/enum_trailing.hpp> # include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> diff --git a/Utilities/BGL/boost/preprocessor/repetition/enum_shifted_binary_params.hpp b/Utilities/BGL/boost/preprocessor/repetition/enum_shifted_binary_params.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f3d20fc7b475266447c2f0d3e27bbbb5c24c2bcd --- /dev/null +++ b/Utilities/BGL/boost/preprocessor/repetition/enum_shifted_binary_params.hpp @@ -0,0 +1,51 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Paul Mensonides 2005. * +# * 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_REPETITION_ENUM_SHIFTED_BINARY_PARAMS_HPP +# define BOOST_PREPROCESSOR_REPETITION_ENUM_SHIFTED_BINARY_PARAMS_HPP +# +# include <boost/preprocessor/arithmetic/dec.hpp> +# include <boost/preprocessor/arithmetic/inc.hpp> +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/punctuation/comma_if.hpp> +# include <boost/preprocessor/repetition/repeat.hpp> +# include <boost/preprocessor/tuple/elem.hpp> +# include <boost/preprocessor/tuple/rem.hpp> +# +# /* BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(count, p1, p2) BOOST_PP_REPEAT(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2)) +# else +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(count, p1, p2) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_I(count, p1, p2) +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_I(count, p1, p2) BOOST_PP_REPEAT(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2)) +# endif +# +# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M(z, n, pp) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_IM(z, n, BOOST_PP_TUPLE_REM_2 pp) +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_I(z, n, im) +# else +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M(z, n, pp) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, pp), BOOST_PP_TUPLE_ELEM(2, 1, pp)) +# endif +# +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M_I(z, n, p1, p2) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(p1, BOOST_PP_INC(n)) BOOST_PP_CAT(p2, BOOST_PP_INC(n)) +# +# /* BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z(z, count, p1, p2) BOOST_PP_REPEAT_ ## z(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2)) +# else +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z(z, count, p1, p2) BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z_I(z, count, p1, p2) +# define BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_Z_I(z, count, p1, p2) BOOST_PP_REPEAT_ ## z(BOOST_PP_DEC(count), BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS_M, (p1, p2)) +# endif +# +# endif diff --git a/Utilities/BGL/boost/preprocessor/seq/cat.hpp b/Utilities/BGL/boost/preprocessor/seq/cat.hpp index 24c886869e09a0d39f33e0551984ea3027def7b4..0efd8e556479888bc07900a165b3c12c32659a54 100644 --- a/Utilities/BGL/boost/preprocessor/seq/cat.hpp +++ b/Utilities/BGL/boost/preprocessor/seq/cat.hpp @@ -12,29 +12,37 @@ # ifndef BOOST_PREPROCESSOR_SEQ_CAT_HPP # define BOOST_PREPROCESSOR_SEQ_CAT_HPP # +# include <boost/preprocessor/arithmetic/dec.hpp> # include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/control/if.hpp> # include <boost/preprocessor/seq/fold_left.hpp> # include <boost/preprocessor/seq/seq.hpp> +# include <boost/preprocessor/seq/size.hpp> +# include <boost/preprocessor/tuple/eat.hpp> # # /* BOOST_PP_SEQ_CAT */ # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_SEQ_CAT(seq) BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) -# else -# define BOOST_PP_SEQ_CAT(seq) BOOST_PP_SEQ_CAT_I(seq) -# define BOOST_PP_SEQ_CAT_I(seq) BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) -# endif +# define BOOST_PP_SEQ_CAT(seq) \ + BOOST_PP_IF( \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \ + BOOST_PP_SEQ_CAT_I, \ + BOOST_PP_SEQ_HEAD(seq) BOOST_PP_TUPLE_EAT_1 \ + )(seq) \ + /**/ +# define BOOST_PP_SEQ_CAT_I(seq) BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) # # define BOOST_PP_SEQ_CAT_O(s, st, elem) BOOST_PP_SEQ_CAT_O_I(st, elem) # define BOOST_PP_SEQ_CAT_O_I(a, b) a ## b # # /* BOOST_PP_SEQ_CAT_S */ # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_SEQ_CAT_S(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) -# else -# define BOOST_PP_SEQ_CAT_S(s, seq) BOOST_PP_SEQ_CAT_S_I(s, seq) -# define BOOST_PP_SEQ_CAT_S_I(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) -# endif +# define BOOST_PP_SEQ_CAT_S(s, seq) \ + BOOST_PP_IF( \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \ + BOOST_PP_SEQ_CAT_S_I, \ + BOOST_PP_SEQ_HEAD(seq) BOOST_PP_TUPLE_EAT_2 \ + )(s, seq) \ + /**/ +# define BOOST_PP_SEQ_CAT_S_I(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) # # endif diff --git a/Utilities/BGL/boost/preprocessor/slot/counter.hpp b/Utilities/BGL/boost/preprocessor/slot/counter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d257a649a1b8e9bb6f429f5fcff560401b403cf2 --- /dev/null +++ b/Utilities/BGL/boost/preprocessor/slot/counter.hpp @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Paul Mensonides 2005. * +# * 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_SLOT_COUNTER_HPP +# define BOOST_PREPROCESSOR_SLOT_COUNTER_HPP +# +# include <boost/preprocessor/slot/detail/def.hpp> +# +# /* BOOST_PP_COUNTER */ +# +# define BOOST_PP_COUNTER 0 +# +# /* BOOST_PP_UPDATE_COUNTER */ +# +# define BOOST_PP_UPDATE_COUNTER() <boost/preprocessor/slot/detail/counter.hpp> +# +# endif diff --git a/Utilities/BGL/boost/preprocessor/slot/detail/counter.hpp b/Utilities/BGL/boost/preprocessor/slot/detail/counter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a1c0df1759a29b01705c553bf8e9fdbe8a96d65f --- /dev/null +++ b/Utilities/BGL/boost/preprocessor/slot/detail/counter.hpp @@ -0,0 +1,269 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Paul Mensonides 2005. * +# * 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. */ +# +# define BOOST_PP_VALUE BOOST_PP_COUNTER + 1 +# +# include <boost/preprocessor/slot/detail/shared.hpp> +# +# undef BOOST_PP_COUNTER +# +# undef BOOST_PP_COUNTER_DIGIT_1 +# undef BOOST_PP_COUNTER_DIGIT_2 +# undef BOOST_PP_COUNTER_DIGIT_3 +# undef BOOST_PP_COUNTER_DIGIT_4 +# undef BOOST_PP_COUNTER_DIGIT_5 +# undef BOOST_PP_COUNTER_DIGIT_6 +# undef BOOST_PP_COUNTER_DIGIT_7 +# undef BOOST_PP_COUNTER_DIGIT_8 +# undef BOOST_PP_COUNTER_DIGIT_9 +# undef BOOST_PP_COUNTER_DIGIT_10 +# +# if BOOST_PP_SLOT_TEMP_10 == 0 +# define BOOST_PP_COUNTER_DIGIT_10 0 +# elif BOOST_PP_SLOT_TEMP_10 == 1 +# define BOOST_PP_COUNTER_DIGIT_10 1 +# elif BOOST_PP_SLOT_TEMP_10 == 2 +# define BOOST_PP_COUNTER_DIGIT_10 2 +# elif BOOST_PP_SLOT_TEMP_10 == 3 +# define BOOST_PP_COUNTER_DIGIT_10 3 +# elif BOOST_PP_SLOT_TEMP_10 == 4 +# define BOOST_PP_COUNTER_DIGIT_10 4 +# elif BOOST_PP_SLOT_TEMP_10 == 5 +# define BOOST_PP_COUNTER_DIGIT_10 5 +# elif BOOST_PP_SLOT_TEMP_10 == 6 +# define BOOST_PP_COUNTER_DIGIT_10 6 +# elif BOOST_PP_SLOT_TEMP_10 == 7 +# define BOOST_PP_COUNTER_DIGIT_10 7 +# elif BOOST_PP_SLOT_TEMP_10 == 8 +# define BOOST_PP_COUNTER_DIGIT_10 8 +# elif BOOST_PP_SLOT_TEMP_10 == 9 +# define BOOST_PP_COUNTER_DIGIT_10 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_9 == 0 +# define BOOST_PP_COUNTER_DIGIT_9 0 +# elif BOOST_PP_SLOT_TEMP_9 == 1 +# define BOOST_PP_COUNTER_DIGIT_9 1 +# elif BOOST_PP_SLOT_TEMP_9 == 2 +# define BOOST_PP_COUNTER_DIGIT_9 2 +# elif BOOST_PP_SLOT_TEMP_9 == 3 +# define BOOST_PP_COUNTER_DIGIT_9 3 +# elif BOOST_PP_SLOT_TEMP_9 == 4 +# define BOOST_PP_COUNTER_DIGIT_9 4 +# elif BOOST_PP_SLOT_TEMP_9 == 5 +# define BOOST_PP_COUNTER_DIGIT_9 5 +# elif BOOST_PP_SLOT_TEMP_9 == 6 +# define BOOST_PP_COUNTER_DIGIT_9 6 +# elif BOOST_PP_SLOT_TEMP_9 == 7 +# define BOOST_PP_COUNTER_DIGIT_9 7 +# elif BOOST_PP_SLOT_TEMP_9 == 8 +# define BOOST_PP_COUNTER_DIGIT_9 8 +# elif BOOST_PP_SLOT_TEMP_9 == 9 +# define BOOST_PP_COUNTER_DIGIT_9 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_8 == 0 +# define BOOST_PP_COUNTER_DIGIT_8 0 +# elif BOOST_PP_SLOT_TEMP_8 == 1 +# define BOOST_PP_COUNTER_DIGIT_8 1 +# elif BOOST_PP_SLOT_TEMP_8 == 2 +# define BOOST_PP_COUNTER_DIGIT_8 2 +# elif BOOST_PP_SLOT_TEMP_8 == 3 +# define BOOST_PP_COUNTER_DIGIT_8 3 +# elif BOOST_PP_SLOT_TEMP_8 == 4 +# define BOOST_PP_COUNTER_DIGIT_8 4 +# elif BOOST_PP_SLOT_TEMP_8 == 5 +# define BOOST_PP_COUNTER_DIGIT_8 5 +# elif BOOST_PP_SLOT_TEMP_8 == 6 +# define BOOST_PP_COUNTER_DIGIT_8 6 +# elif BOOST_PP_SLOT_TEMP_8 == 7 +# define BOOST_PP_COUNTER_DIGIT_8 7 +# elif BOOST_PP_SLOT_TEMP_8 == 8 +# define BOOST_PP_COUNTER_DIGIT_8 8 +# elif BOOST_PP_SLOT_TEMP_8 == 9 +# define BOOST_PP_COUNTER_DIGIT_8 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_7 == 0 +# define BOOST_PP_COUNTER_DIGIT_7 0 +# elif BOOST_PP_SLOT_TEMP_7 == 1 +# define BOOST_PP_COUNTER_DIGIT_7 1 +# elif BOOST_PP_SLOT_TEMP_7 == 2 +# define BOOST_PP_COUNTER_DIGIT_7 2 +# elif BOOST_PP_SLOT_TEMP_7 == 3 +# define BOOST_PP_COUNTER_DIGIT_7 3 +# elif BOOST_PP_SLOT_TEMP_7 == 4 +# define BOOST_PP_COUNTER_DIGIT_7 4 +# elif BOOST_PP_SLOT_TEMP_7 == 5 +# define BOOST_PP_COUNTER_DIGIT_7 5 +# elif BOOST_PP_SLOT_TEMP_7 == 6 +# define BOOST_PP_COUNTER_DIGIT_7 6 +# elif BOOST_PP_SLOT_TEMP_7 == 7 +# define BOOST_PP_COUNTER_DIGIT_7 7 +# elif BOOST_PP_SLOT_TEMP_7 == 8 +# define BOOST_PP_COUNTER_DIGIT_7 8 +# elif BOOST_PP_SLOT_TEMP_7 == 9 +# define BOOST_PP_COUNTER_DIGIT_7 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_6 == 0 +# define BOOST_PP_COUNTER_DIGIT_6 0 +# elif BOOST_PP_SLOT_TEMP_6 == 1 +# define BOOST_PP_COUNTER_DIGIT_6 1 +# elif BOOST_PP_SLOT_TEMP_6 == 2 +# define BOOST_PP_COUNTER_DIGIT_6 2 +# elif BOOST_PP_SLOT_TEMP_6 == 3 +# define BOOST_PP_COUNTER_DIGIT_6 3 +# elif BOOST_PP_SLOT_TEMP_6 == 4 +# define BOOST_PP_COUNTER_DIGIT_6 4 +# elif BOOST_PP_SLOT_TEMP_6 == 5 +# define BOOST_PP_COUNTER_DIGIT_6 5 +# elif BOOST_PP_SLOT_TEMP_6 == 6 +# define BOOST_PP_COUNTER_DIGIT_6 6 +# elif BOOST_PP_SLOT_TEMP_6 == 7 +# define BOOST_PP_COUNTER_DIGIT_6 7 +# elif BOOST_PP_SLOT_TEMP_6 == 8 +# define BOOST_PP_COUNTER_DIGIT_6 8 +# elif BOOST_PP_SLOT_TEMP_6 == 9 +# define BOOST_PP_COUNTER_DIGIT_6 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_5 == 0 +# define BOOST_PP_COUNTER_DIGIT_5 0 +# elif BOOST_PP_SLOT_TEMP_5 == 1 +# define BOOST_PP_COUNTER_DIGIT_5 1 +# elif BOOST_PP_SLOT_TEMP_5 == 2 +# define BOOST_PP_COUNTER_DIGIT_5 2 +# elif BOOST_PP_SLOT_TEMP_5 == 3 +# define BOOST_PP_COUNTER_DIGIT_5 3 +# elif BOOST_PP_SLOT_TEMP_5 == 4 +# define BOOST_PP_COUNTER_DIGIT_5 4 +# elif BOOST_PP_SLOT_TEMP_5 == 5 +# define BOOST_PP_COUNTER_DIGIT_5 5 +# elif BOOST_PP_SLOT_TEMP_5 == 6 +# define BOOST_PP_COUNTER_DIGIT_5 6 +# elif BOOST_PP_SLOT_TEMP_5 == 7 +# define BOOST_PP_COUNTER_DIGIT_5 7 +# elif BOOST_PP_SLOT_TEMP_5 == 8 +# define BOOST_PP_COUNTER_DIGIT_5 8 +# elif BOOST_PP_SLOT_TEMP_5 == 9 +# define BOOST_PP_COUNTER_DIGIT_5 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_4 == 0 +# define BOOST_PP_COUNTER_DIGIT_4 0 +# elif BOOST_PP_SLOT_TEMP_4 == 1 +# define BOOST_PP_COUNTER_DIGIT_4 1 +# elif BOOST_PP_SLOT_TEMP_4 == 2 +# define BOOST_PP_COUNTER_DIGIT_4 2 +# elif BOOST_PP_SLOT_TEMP_4 == 3 +# define BOOST_PP_COUNTER_DIGIT_4 3 +# elif BOOST_PP_SLOT_TEMP_4 == 4 +# define BOOST_PP_COUNTER_DIGIT_4 4 +# elif BOOST_PP_SLOT_TEMP_4 == 5 +# define BOOST_PP_COUNTER_DIGIT_4 5 +# elif BOOST_PP_SLOT_TEMP_4 == 6 +# define BOOST_PP_COUNTER_DIGIT_4 6 +# elif BOOST_PP_SLOT_TEMP_4 == 7 +# define BOOST_PP_COUNTER_DIGIT_4 7 +# elif BOOST_PP_SLOT_TEMP_4 == 8 +# define BOOST_PP_COUNTER_DIGIT_4 8 +# elif BOOST_PP_SLOT_TEMP_4 == 9 +# define BOOST_PP_COUNTER_DIGIT_4 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_3 == 0 +# define BOOST_PP_COUNTER_DIGIT_3 0 +# elif BOOST_PP_SLOT_TEMP_3 == 1 +# define BOOST_PP_COUNTER_DIGIT_3 1 +# elif BOOST_PP_SLOT_TEMP_3 == 2 +# define BOOST_PP_COUNTER_DIGIT_3 2 +# elif BOOST_PP_SLOT_TEMP_3 == 3 +# define BOOST_PP_COUNTER_DIGIT_3 3 +# elif BOOST_PP_SLOT_TEMP_3 == 4 +# define BOOST_PP_COUNTER_DIGIT_3 4 +# elif BOOST_PP_SLOT_TEMP_3 == 5 +# define BOOST_PP_COUNTER_DIGIT_3 5 +# elif BOOST_PP_SLOT_TEMP_3 == 6 +# define BOOST_PP_COUNTER_DIGIT_3 6 +# elif BOOST_PP_SLOT_TEMP_3 == 7 +# define BOOST_PP_COUNTER_DIGIT_3 7 +# elif BOOST_PP_SLOT_TEMP_3 == 8 +# define BOOST_PP_COUNTER_DIGIT_3 8 +# elif BOOST_PP_SLOT_TEMP_3 == 9 +# define BOOST_PP_COUNTER_DIGIT_3 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_2 == 0 +# define BOOST_PP_COUNTER_DIGIT_2 0 +# elif BOOST_PP_SLOT_TEMP_2 == 1 +# define BOOST_PP_COUNTER_DIGIT_2 1 +# elif BOOST_PP_SLOT_TEMP_2 == 2 +# define BOOST_PP_COUNTER_DIGIT_2 2 +# elif BOOST_PP_SLOT_TEMP_2 == 3 +# define BOOST_PP_COUNTER_DIGIT_2 3 +# elif BOOST_PP_SLOT_TEMP_2 == 4 +# define BOOST_PP_COUNTER_DIGIT_2 4 +# elif BOOST_PP_SLOT_TEMP_2 == 5 +# define BOOST_PP_COUNTER_DIGIT_2 5 +# elif BOOST_PP_SLOT_TEMP_2 == 6 +# define BOOST_PP_COUNTER_DIGIT_2 6 +# elif BOOST_PP_SLOT_TEMP_2 == 7 +# define BOOST_PP_COUNTER_DIGIT_2 7 +# elif BOOST_PP_SLOT_TEMP_2 == 8 +# define BOOST_PP_COUNTER_DIGIT_2 8 +# elif BOOST_PP_SLOT_TEMP_2 == 9 +# define BOOST_PP_COUNTER_DIGIT_2 9 +# endif +# +# if BOOST_PP_SLOT_TEMP_1 == 0 +# define BOOST_PP_COUNTER_DIGIT_1 0 +# elif BOOST_PP_SLOT_TEMP_1 == 1 +# define BOOST_PP_COUNTER_DIGIT_1 1 +# elif BOOST_PP_SLOT_TEMP_1 == 2 +# define BOOST_PP_COUNTER_DIGIT_1 2 +# elif BOOST_PP_SLOT_TEMP_1 == 3 +# define BOOST_PP_COUNTER_DIGIT_1 3 +# elif BOOST_PP_SLOT_TEMP_1 == 4 +# define BOOST_PP_COUNTER_DIGIT_1 4 +# elif BOOST_PP_SLOT_TEMP_1 == 5 +# define BOOST_PP_COUNTER_DIGIT_1 5 +# elif BOOST_PP_SLOT_TEMP_1 == 6 +# define BOOST_PP_COUNTER_DIGIT_1 6 +# elif BOOST_PP_SLOT_TEMP_1 == 7 +# define BOOST_PP_COUNTER_DIGIT_1 7 +# elif BOOST_PP_SLOT_TEMP_1 == 8 +# define BOOST_PP_COUNTER_DIGIT_1 8 +# elif BOOST_PP_SLOT_TEMP_1 == 9 +# define BOOST_PP_COUNTER_DIGIT_1 9 +# endif +# +# if BOOST_PP_COUNTER_DIGIT_10 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_10(BOOST_PP_COUNTER_DIGIT_10, BOOST_PP_COUNTER_DIGIT_9, BOOST_PP_COUNTER_DIGIT_8, BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_9 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_9(BOOST_PP_COUNTER_DIGIT_9, BOOST_PP_COUNTER_DIGIT_8, BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_8 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_8(BOOST_PP_COUNTER_DIGIT_8, BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_7 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_7(BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_6 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_6(BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_5 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_5(BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_4 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_4(BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_3 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_3(BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# elif BOOST_PP_COUNTER_DIGIT_2 +# define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_2(BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1) +# else +# define BOOST_PP_COUNTER BOOST_PP_COUNTER_DIGIT_1 +# endif diff --git a/Utilities/BGL/boost/preprocessor/slot/detail/slot1.hpp b/Utilities/BGL/boost/preprocessor/slot/detail/slot1.hpp index c298444cb82d97580840d43bea3be044a12ae99d..b22748e6ac40ad4990d728a8db7f547b7f8faafb 100644 --- a/Utilities/BGL/boost/preprocessor/slot/detail/slot1.hpp +++ b/Utilities/BGL/boost/preprocessor/slot/detail/slot1.hpp @@ -247,7 +247,7 @@ # if BOOST_PP_SLOT_1_DIGIT_10 # define BOOST_PP_SLOT_1() BOOST_PP_SLOT_CC_10(BOOST_PP_SLOT_1_DIGIT_10, BOOST_PP_SLOT_1_DIGIT_9, BOOST_PP_SLOT_1_DIGIT_8, BOOST_PP_SLOT_1_DIGIT_7, BOOST_PP_SLOT_1_DIGIT_6, BOOST_PP_SLOT_1_DIGIT_5, BOOST_PP_SLOT_1_DIGIT_4, BOOST_PP_SLOT_1_DIGIT_3, BOOST_PP_SLOT_1_DIGIT_2, BOOST_PP_SLOT_1_DIGIT_1) # elif BOOST_PP_SLOT_1_DIGIT_9 -# define BOOST_PP_SLOT_1 BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_1_DIGIT_9, BOOST_PP_SLOT_1_DIGIT_8, BOOST_PP_SLOT_1_DIGIT_7, BOOST_PP_SLOT_1_DIGIT_6, BOOST_PP_SLOT_1_DIGIT_5, BOOST_PP_SLOT_1_DIGIT_4, BOOST_PP_SLOT_1_DIGIT_3, BOOST_PP_SLOT_1_DIGIT_2, BOOST_PP_SLOT_1_DIGIT_1) +# define BOOST_PP_SLOT_1() BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_1_DIGIT_9, BOOST_PP_SLOT_1_DIGIT_8, BOOST_PP_SLOT_1_DIGIT_7, BOOST_PP_SLOT_1_DIGIT_6, BOOST_PP_SLOT_1_DIGIT_5, BOOST_PP_SLOT_1_DIGIT_4, BOOST_PP_SLOT_1_DIGIT_3, BOOST_PP_SLOT_1_DIGIT_2, BOOST_PP_SLOT_1_DIGIT_1) # elif BOOST_PP_SLOT_1_DIGIT_8 # define BOOST_PP_SLOT_1() BOOST_PP_SLOT_CC_8(BOOST_PP_SLOT_1_DIGIT_8, BOOST_PP_SLOT_1_DIGIT_7, BOOST_PP_SLOT_1_DIGIT_6, BOOST_PP_SLOT_1_DIGIT_5, BOOST_PP_SLOT_1_DIGIT_4, BOOST_PP_SLOT_1_DIGIT_3, BOOST_PP_SLOT_1_DIGIT_2, BOOST_PP_SLOT_1_DIGIT_1) # elif BOOST_PP_SLOT_1_DIGIT_7 diff --git a/Utilities/BGL/boost/preprocessor/slot/detail/slot2.hpp b/Utilities/BGL/boost/preprocessor/slot/detail/slot2.hpp index 47b01ea3e7ecacfe06848ef498b5ae11289f0652..5d5258c225822c5f8ead2894cf8315457bceb4fa 100644 --- a/Utilities/BGL/boost/preprocessor/slot/detail/slot2.hpp +++ b/Utilities/BGL/boost/preprocessor/slot/detail/slot2.hpp @@ -247,7 +247,7 @@ # if BOOST_PP_SLOT_2_DIGIT_10 # define BOOST_PP_SLOT_2() BOOST_PP_SLOT_CC_10(BOOST_PP_SLOT_2_DIGIT_10, BOOST_PP_SLOT_2_DIGIT_9, BOOST_PP_SLOT_2_DIGIT_8, BOOST_PP_SLOT_2_DIGIT_7, BOOST_PP_SLOT_2_DIGIT_6, BOOST_PP_SLOT_2_DIGIT_5, BOOST_PP_SLOT_2_DIGIT_4, BOOST_PP_SLOT_2_DIGIT_3, BOOST_PP_SLOT_2_DIGIT_2, BOOST_PP_SLOT_2_DIGIT_1) # elif BOOST_PP_SLOT_2_DIGIT_9 -# define BOOST_PP_SLOT_2 BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_2_DIGIT_9, BOOST_PP_SLOT_2_DIGIT_8, BOOST_PP_SLOT_2_DIGIT_7, BOOST_PP_SLOT_2_DIGIT_6, BOOST_PP_SLOT_2_DIGIT_5, BOOST_PP_SLOT_2_DIGIT_4, BOOST_PP_SLOT_2_DIGIT_3, BOOST_PP_SLOT_2_DIGIT_2, BOOST_PP_SLOT_2_DIGIT_1) +# define BOOST_PP_SLOT_2() BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_2_DIGIT_9, BOOST_PP_SLOT_2_DIGIT_8, BOOST_PP_SLOT_2_DIGIT_7, BOOST_PP_SLOT_2_DIGIT_6, BOOST_PP_SLOT_2_DIGIT_5, BOOST_PP_SLOT_2_DIGIT_4, BOOST_PP_SLOT_2_DIGIT_3, BOOST_PP_SLOT_2_DIGIT_2, BOOST_PP_SLOT_2_DIGIT_1) # elif BOOST_PP_SLOT_2_DIGIT_8 # define BOOST_PP_SLOT_2() BOOST_PP_SLOT_CC_8(BOOST_PP_SLOT_2_DIGIT_8, BOOST_PP_SLOT_2_DIGIT_7, BOOST_PP_SLOT_2_DIGIT_6, BOOST_PP_SLOT_2_DIGIT_5, BOOST_PP_SLOT_2_DIGIT_4, BOOST_PP_SLOT_2_DIGIT_3, BOOST_PP_SLOT_2_DIGIT_2, BOOST_PP_SLOT_2_DIGIT_1) # elif BOOST_PP_SLOT_2_DIGIT_7 diff --git a/Utilities/BGL/boost/preprocessor/slot/detail/slot3.hpp b/Utilities/BGL/boost/preprocessor/slot/detail/slot3.hpp index bf665f09e70373f233b78c0d5523a6d120a04fe3..005cf219005203a00ad4e9335870b0f5d8288356 100644 --- a/Utilities/BGL/boost/preprocessor/slot/detail/slot3.hpp +++ b/Utilities/BGL/boost/preprocessor/slot/detail/slot3.hpp @@ -247,7 +247,7 @@ # if BOOST_PP_SLOT_3_DIGIT_10 # define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_10(BOOST_PP_SLOT_3_DIGIT_10, BOOST_PP_SLOT_3_DIGIT_9, BOOST_PP_SLOT_3_DIGIT_8, BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1) # elif BOOST_PP_SLOT_3_DIGIT_9 -# define BOOST_PP_SLOT_3 BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_3_DIGIT_9, BOOST_PP_SLOT_3_DIGIT_8, BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1) +# define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_3_DIGIT_9, BOOST_PP_SLOT_3_DIGIT_8, BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1) # elif BOOST_PP_SLOT_3_DIGIT_8 # define BOOST_PP_SLOT_3() BOOST_PP_SLOT_CC_8(BOOST_PP_SLOT_3_DIGIT_8, BOOST_PP_SLOT_3_DIGIT_7, BOOST_PP_SLOT_3_DIGIT_6, BOOST_PP_SLOT_3_DIGIT_5, BOOST_PP_SLOT_3_DIGIT_4, BOOST_PP_SLOT_3_DIGIT_3, BOOST_PP_SLOT_3_DIGIT_2, BOOST_PP_SLOT_3_DIGIT_1) # elif BOOST_PP_SLOT_3_DIGIT_7 diff --git a/Utilities/BGL/boost/preprocessor/slot/detail/slot4.hpp b/Utilities/BGL/boost/preprocessor/slot/detail/slot4.hpp index 8d5a755d498a784669352e3638acc91b2a52baa7..9aa4d8ab8d9167e91eb0ea1ab9349d322ade45ce 100644 --- a/Utilities/BGL/boost/preprocessor/slot/detail/slot4.hpp +++ b/Utilities/BGL/boost/preprocessor/slot/detail/slot4.hpp @@ -247,7 +247,7 @@ # if BOOST_PP_SLOT_4_DIGIT_10 # define BOOST_PP_SLOT_4() BOOST_PP_SLOT_CC_10(BOOST_PP_SLOT_4_DIGIT_10, BOOST_PP_SLOT_4_DIGIT_9, BOOST_PP_SLOT_4_DIGIT_8, BOOST_PP_SLOT_4_DIGIT_7, BOOST_PP_SLOT_4_DIGIT_6, BOOST_PP_SLOT_4_DIGIT_5, BOOST_PP_SLOT_4_DIGIT_4, BOOST_PP_SLOT_4_DIGIT_3, BOOST_PP_SLOT_4_DIGIT_2, BOOST_PP_SLOT_4_DIGIT_1) # elif BOOST_PP_SLOT_4_DIGIT_9 -# define BOOST_PP_SLOT_4 BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_4_DIGIT_9, BOOST_PP_SLOT_4_DIGIT_8, BOOST_PP_SLOT_4_DIGIT_7, BOOST_PP_SLOT_4_DIGIT_6, BOOST_PP_SLOT_4_DIGIT_5, BOOST_PP_SLOT_4_DIGIT_4, BOOST_PP_SLOT_4_DIGIT_3, BOOST_PP_SLOT_4_DIGIT_2, BOOST_PP_SLOT_4_DIGIT_1) +# define BOOST_PP_SLOT_4() BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_4_DIGIT_9, BOOST_PP_SLOT_4_DIGIT_8, BOOST_PP_SLOT_4_DIGIT_7, BOOST_PP_SLOT_4_DIGIT_6, BOOST_PP_SLOT_4_DIGIT_5, BOOST_PP_SLOT_4_DIGIT_4, BOOST_PP_SLOT_4_DIGIT_3, BOOST_PP_SLOT_4_DIGIT_2, BOOST_PP_SLOT_4_DIGIT_1) # elif BOOST_PP_SLOT_4_DIGIT_8 # define BOOST_PP_SLOT_4() BOOST_PP_SLOT_CC_8(BOOST_PP_SLOT_4_DIGIT_8, BOOST_PP_SLOT_4_DIGIT_7, BOOST_PP_SLOT_4_DIGIT_6, BOOST_PP_SLOT_4_DIGIT_5, BOOST_PP_SLOT_4_DIGIT_4, BOOST_PP_SLOT_4_DIGIT_3, BOOST_PP_SLOT_4_DIGIT_2, BOOST_PP_SLOT_4_DIGIT_1) # elif BOOST_PP_SLOT_4_DIGIT_7 diff --git a/Utilities/BGL/boost/preprocessor/slot/detail/slot5.hpp b/Utilities/BGL/boost/preprocessor/slot/detail/slot5.hpp index 9323ee52bf3aedd229974cb001ae442bf1d7676e..d17535daf4b413b6ffdb95ea769a7ab61ee03339 100644 --- a/Utilities/BGL/boost/preprocessor/slot/detail/slot5.hpp +++ b/Utilities/BGL/boost/preprocessor/slot/detail/slot5.hpp @@ -247,7 +247,7 @@ # if BOOST_PP_SLOT_5_DIGIT_10 # define BOOST_PP_SLOT_5() BOOST_PP_SLOT_CC_10(BOOST_PP_SLOT_5_DIGIT_10, BOOST_PP_SLOT_5_DIGIT_9, BOOST_PP_SLOT_5_DIGIT_8, BOOST_PP_SLOT_5_DIGIT_7, BOOST_PP_SLOT_5_DIGIT_6, BOOST_PP_SLOT_5_DIGIT_5, BOOST_PP_SLOT_5_DIGIT_4, BOOST_PP_SLOT_5_DIGIT_3, BOOST_PP_SLOT_5_DIGIT_2, BOOST_PP_SLOT_5_DIGIT_1) # elif BOOST_PP_SLOT_5_DIGIT_9 -# define BOOST_PP_SLOT_5 BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_5_DIGIT_9, BOOST_PP_SLOT_5_DIGIT_8, BOOST_PP_SLOT_5_DIGIT_7, BOOST_PP_SLOT_5_DIGIT_6, BOOST_PP_SLOT_5_DIGIT_5, BOOST_PP_SLOT_5_DIGIT_4, BOOST_PP_SLOT_5_DIGIT_3, BOOST_PP_SLOT_5_DIGIT_2, BOOST_PP_SLOT_5_DIGIT_1) +# define BOOST_PP_SLOT_5() BOOST_PP_SLOT_CC_9(BOOST_PP_SLOT_5_DIGIT_9, BOOST_PP_SLOT_5_DIGIT_8, BOOST_PP_SLOT_5_DIGIT_7, BOOST_PP_SLOT_5_DIGIT_6, BOOST_PP_SLOT_5_DIGIT_5, BOOST_PP_SLOT_5_DIGIT_4, BOOST_PP_SLOT_5_DIGIT_3, BOOST_PP_SLOT_5_DIGIT_2, BOOST_PP_SLOT_5_DIGIT_1) # elif BOOST_PP_SLOT_5_DIGIT_8 # define BOOST_PP_SLOT_5() BOOST_PP_SLOT_CC_8(BOOST_PP_SLOT_5_DIGIT_8, BOOST_PP_SLOT_5_DIGIT_7, BOOST_PP_SLOT_5_DIGIT_6, BOOST_PP_SLOT_5_DIGIT_5, BOOST_PP_SLOT_5_DIGIT_4, BOOST_PP_SLOT_5_DIGIT_3, BOOST_PP_SLOT_5_DIGIT_2, BOOST_PP_SLOT_5_DIGIT_1) # elif BOOST_PP_SLOT_5_DIGIT_7 diff --git a/Utilities/BGL/boost/preprocessor/stringize.hpp b/Utilities/BGL/boost/preprocessor/stringize.hpp index 01f283e852b07bf45c8fea6b6a7657947b1c41c3..64dd5fde3e3cd837cff7c057dfb9a47aec1d21e7 100644 --- a/Utilities/BGL/boost/preprocessor/stringize.hpp +++ b/Utilities/BGL/boost/preprocessor/stringize.hpp @@ -20,8 +20,7 @@ # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_A((text)) -# define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_B ## (arg) -# define BOOST_PP_STRINGIZE_B(arg) BOOST_PP_STRINGIZE_I ## arg +# define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_I arg # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_OO((text)) # define BOOST_PP_STRINGIZE_OO(par) BOOST_PP_STRINGIZE_I ## par diff --git a/Utilities/BGL/boost/dynamic_property_map.hpp b/Utilities/BGL/boost/property_map/dynamic_property_map.hpp similarity index 96% rename from Utilities/BGL/boost/dynamic_property_map.hpp rename to Utilities/BGL/boost/property_map/dynamic_property_map.hpp index f968833a3f0de3878010380c1345b98d3dc60107..ea95d544388732c5cc3033aa8281187d376b0996 100644 --- a/Utilities/BGL/boost/dynamic_property_map.hpp +++ b/Utilities/BGL/boost/property_map/dynamic_property_map.hpp @@ -18,7 +18,7 @@ #include <boost/config.hpp> -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/lexical_cast.hpp> #include <boost/any.hpp> #include <boost/function/function3.hpp> @@ -253,7 +253,7 @@ public: std::auto_ptr<dynamic_property_map> pm( new detail::dynamic_property_map_adaptor<PropertyMap>(property_map)); property_maps_type::iterator i = - property_maps.insert(property_maps_type::value_type(name, 0)); + property_maps.insert(property_maps_type::value_type(name, (dynamic_property_map*)0)); i->second = pm.release(); return *this; @@ -356,7 +356,15 @@ get(const std::string& name, const dynamic_properties& dp, const Key& key) throw dynamic_get_failure(name); } - +// The easy way to ignore properties. +inline +std::auto_ptr<boost::dynamic_property_map> +ignore_other_properties(const std::string&, + const boost::any&, + const boost::any&) { + return std::auto_ptr<boost::dynamic_property_map>(0); } +} // namespace boost + #endif // DYNAMIC_PROPERTY_MAP_RG09302004_HPP diff --git a/Utilities/BGL/boost/property_map/parallel/caching_property_map.hpp b/Utilities/BGL/boost/property_map/parallel/caching_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..54cf1466b77b6f0da5918b6ee70fd8781fc412ef --- /dev/null +++ b/Utilities/BGL/boost/property_map/parallel/caching_property_map.hpp @@ -0,0 +1,96 @@ +// Copyright 2004 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_PARALLEL_CACHING_PROPERTY_MAP_HPP +#define BOOST_PARALLEL_CACHING_PROPERTY_MAP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/property_map/property_map.hpp> + +namespace boost { + +// This probably doesn't belong here +template<typename Key, typename Value> +inline void local_put(dummy_property_map, const Key&, const Value&) {} + +namespace parallel { + +/** Property map that caches values placed in it but does not + * broadcast values to remote processors. This class template is + * meant as an adaptor for @ref distributed_property_map that + * suppresses communication in the event of a remote @c put operation + * by mapping it to a local @c put operation. + * + * @todo Find a better name for @ref caching_property_map + */ +template<typename PropertyMap> +class caching_property_map +{ +public: + typedef typename property_traits<PropertyMap>::key_type key_type; + typedef typename property_traits<PropertyMap>::value_type value_type; + typedef typename property_traits<PropertyMap>::reference reference; + typedef typename property_traits<PropertyMap>::category category; + + explicit caching_property_map(const PropertyMap& property_map) + : property_map(property_map) {} + + PropertyMap& base() { return property_map; } + const PropertyMap& base() const { return property_map; } + + template<typename Reduce> + void set_reduce(const Reduce& reduce) + { property_map.set_reduce(reduce); } + + void reset() { property_map.reset(); } + +#if 0 + reference operator[](const key_type& key) const + { + return property_map[key]; + } +#endif + +private: + PropertyMap property_map; +}; + +template<typename PropertyMap, typename Key> +inline typename caching_property_map<PropertyMap>::value_type +get(const caching_property_map<PropertyMap>& pm, const Key& key) +{ return get(pm.base(), key); } + +template<typename PropertyMap, typename Key, typename Value> +inline void +local_put(const caching_property_map<PropertyMap>& pm, const Key& key, + const Value& value) +{ local_put(pm.base(), key, value); } + +template<typename PropertyMap, typename Key, typename Value> +inline void +cache(const caching_property_map<PropertyMap>& pm, const Key& key, + const Value& value) +{ cache(pm.base(), key, value); } + +template<typename PropertyMap, typename Key, typename Value> +inline void +put(const caching_property_map<PropertyMap>& pm, const Key& key, + const Value& value) +{ local_put(pm.base(), key, value); } + +template<typename PropertyMap> +inline caching_property_map<PropertyMap> +make_caching_property_map(const PropertyMap& pm) +{ return caching_property_map<PropertyMap>(pm); } + +} } // end namespace boost::parallel + +#endif // BOOST_PARALLEL_CACHING_PROPERTY_MAP_HPP diff --git a/Utilities/BGL/boost/property_map/parallel/distributed_property_map.hpp b/Utilities/BGL/boost/property_map/parallel/distributed_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a58d2862d9e04891fd9742a11be919a3e59233d3 --- /dev/null +++ b/Utilities/BGL/boost/property_map/parallel/distributed_property_map.hpp @@ -0,0 +1,694 @@ +// Copyright (C) 2004-2008 The Trustees of Indiana University. + +// 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 +// Nick Edmonds +// Andrew Lumsdaine + +// The placement of this #include probably looks very odd relative to +// the #ifndef/#define pair below. However, this placement is +// extremely important to allow the various property map headers to be +// included in any order. +#include <boost/property_map/property_map.hpp> + +#ifndef BOOST_PARALLEL_DISTRIBUTED_PROPERTY_MAP_HPP +#define BOOST_PARALLEL_DISTRIBUTED_PROPERTY_MAP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> +#include <boost/optional.hpp> +#include <boost/graph/parallel/process_group.hpp> +#include <boost/graph/detail/edge.hpp> +#include <boost/function/function1.hpp> +#include <vector> +#include <set> +#include <boost/graph/parallel/basic_reduce.hpp> +#include <boost/graph/parallel/detail/untracked_pair.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/property_map/parallel/local_property_map.hpp> +#include <map> +#include <boost/version.hpp> +#include <boost/graph/distributed/unsafe_serialize.hpp> +#include <boost/multi_index_container.hpp> +#include <boost/multi_index/hashed_index.hpp> +#include <boost/multi_index/member.hpp> +#include <boost/multi_index/sequenced_index.hpp> + +// Serialization functions for constructs we use +#include <boost/serialization/utility.hpp> + +namespace boost { namespace parallel { + +using boost::graph::parallel::trigger_receive_context; + +namespace detail { + /************************************************************************** + * Metafunction that degrades an Lvalue Property Map category tag to + * a Read Write Property Map category tag. + **************************************************************************/ + template<bool IsLvaluePropertyMap> + struct make_nonlvalue_property_map + { + template<typename T> struct apply { typedef T type; }; + }; + + template<> + struct make_nonlvalue_property_map<true> + { + template<typename> + struct apply + { + typedef read_write_property_map_tag type; + }; + }; + + /************************************************************************** + * Performs a "put" on a property map so long as the property map is + * a Writable Property Map or a mutable Lvalue Property Map. This + * is required because the distributed property map's message + * handler handles "put" messages even for a const property map, + * although receipt of a "put" message is ill-formed. + **************************************************************************/ + template<bool IsLvaluePropertyMap> + struct maybe_put_in_lvalue_pm + { + template<typename PropertyMap, typename Key, typename Value> + static inline void + do_put(PropertyMap, const Key&, const Value&) + { assert(false); } + }; + + template<> + struct maybe_put_in_lvalue_pm<true> + { + template<typename PropertyMap, typename Key, typename Value> + static inline void + do_put(PropertyMap pm, const Key& key, const Value& value) + { + using boost::put; + + put(pm, key, value); + } + }; + + template<typename PropertyMap, typename Key, typename Value> + inline void + maybe_put_impl(PropertyMap pm, const Key& key, const Value& value, + writable_property_map_tag) + { + using boost::put; + + put(pm, key, value); + } + + template<typename PropertyMap, typename Key, typename Value> + inline void + maybe_put_impl(PropertyMap pm, const Key& key, const Value& value, + lvalue_property_map_tag) + { + typedef typename property_traits<PropertyMap>::value_type value_type; + typedef typename property_traits<PropertyMap>::reference reference; + // DPG TBD: Some property maps are improperly characterized as + // lvalue_property_maps, when in fact they do not provide true + // references. The most typical example is those property maps + // built from vector<bool> and its iterators, which deal with + // proxies. We don't want to mischaracterize these as not having a + // "put" operation, so we only consider an lvalue_property_map as + // constant if its reference is const value_type&. In fact, this + // isn't even quite correct (think of a + // vector<bool>::const_iterator), but at present C++ doesn't + // provide us with any alternatives. + typedef is_same<const value_type&, reference> is_constant; + + maybe_put_in_lvalue_pm<(!is_constant::value)>::do_put(pm, key, value); + } + + template<typename PropertyMap, typename Key, typename Value> + inline void + maybe_put_impl(PropertyMap, const Key&, const Value&, ...) + { assert(false); } + + template<typename PropertyMap, typename Key, typename Value> + inline void + maybe_put(PropertyMap pm, const Key& key, const Value& value) + { + maybe_put_impl(pm, key, value, + typename property_traits<PropertyMap>::category()); + } +} // end namespace detail + +/** The consistency model used by the distributed property map. */ +enum consistency_model { + cm_forward = 1 << 0, + cm_backward = 1 << 1, + cm_bidirectional = cm_forward | cm_backward, + cm_flush = 1 << 2, + cm_reset = 1 << 3, + cm_clear = 1 << 4 +}; + +/** Distributed property map adaptor. + * + * The distributed property map adaptor is a property map whose + * stored values are distributed across multiple non-overlapping + * memory spaces on different processes. Values local to the current + * process are stored within a local property map and may be + * immediately accessed via @c get and @c put. Values stored on + * remote processes may also be access via @c get and @c put, but the + * behavior differs slightly: + * + * - @c put operations update a local ghost cell and send a "put" + * message to the process that owns the value. The owner is free to + * update its own "official" value or may ignore the put request. + * + * - @c get operations returns the contents of the local ghost + * cell. If no ghost cell is available, one is created using the + * default value provided by the "reduce" operation. See, e.g., + * @ref basic_reduce and @ref property_reduce. + * + * Using distributed property maps requires a bit more care than using + * local, sequential property maps. While the syntax and semantics are + * similar, distributed property maps may contain out-of-date + * information that can only be guaranteed to be synchronized by + * calling the @ref synchronize function in all processes. + * + * To address the issue of out-of-date values, distributed property + * maps are supplied with a reduction operation. The reduction + * operation has two roles: + * + * -# When a value is needed for a remote key but no value is + * immediately available, the reduction operation provides a + * suitable default. For instance, a distributed property map + * storing distances may have a reduction operation that returns + * an infinite value as the default, whereas a distributed + * property map for vertex colors may return white as the + * default. + * + * -# When a value is received from a remote process, the process + * owning the key associated with that value must determine which + * value---the locally stored value, the value received from a + * remote process, or some combination of the two---will be + * stored as the "official" value in the property map. The + * reduction operation transforms the local and remote values + * into the "official" value to be stored. + * + * @tparam ProcessGroup the type of the process group over which the + * property map is distributed and is also the medium for + * communication. + * + * @tparam StorageMap the type of the property map that will + * store values for keys local to this processor. The @c value_type of + * this property map will become the @c value_type of the distributed + * property map. The distributed property map models the same property + * map concepts as the @c LocalPropertyMap, with one exception: a + * distributed property map cannot be an LvaluePropertyMap (because + * remote values are not addressable), and is therefore limited to + * ReadWritePropertyMap. + */ +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +class distributed_property_map +{ + public: + /// The key type of the property map. + typedef typename property_traits<GlobalMap>::key_type key_type; + + /// The value type of the property map. + typedef typename property_traits<StorageMap>::value_type value_type; + typedef typename property_traits<StorageMap>::reference reference; + typedef ProcessGroup process_group_type; + + private: + typedef distributed_property_map self_type; + typedef typename property_traits<StorageMap>::category local_category; + typedef typename property_traits<StorageMap>::key_type local_key_type; + typedef typename property_traits<GlobalMap>::value_type owner_local_pair; + typedef typename ProcessGroup::process_id_type process_id_type; + + enum property_map_messages { + /** A request to store a value in a property map. The message + * contains a std::pair<key, data>. + */ + property_map_put, + + /** A request to retrieve a particular value in a property + * map. The message contains a key. The owner of that key will + * reply with a value. + */ + property_map_get, + + /** A request to update values stored on a remote processor. The + * message contains a vector of keys for which the source + * requests updated values. This message will only be transmitted + * during synchronization. + */ + property_map_multiget, + + /** A request to store values in a ghost cell. This message + * contains a vector of key/value pairs corresponding to the + * sequence of keys sent to the source processor. + */ + property_map_multiget_reply, + + /** The payload containing a vector of local key-value pairs to be + * put into the remote property map. A key-value std::pair will be + * used to store each local key-value pair. + */ + property_map_multiput + }; + + public: + /// The type of the ghost cells + typedef multi_index::multi_index_container< + std::pair<key_type, value_type>, + multi_index::indexed_by< + multi_index::sequenced<>, + multi_index::hashed_unique< + multi_index::member<std::pair<key_type, value_type>, + key_type, + &std::pair<key_type, value_type>::first> + > + > + > ghost_cells_type; + + /// Iterator into the ghost cells + typedef typename ghost_cells_type::iterator iterator; + + /// Key-based index into the ghost cells + typedef typename ghost_cells_type::template nth_index<1>::type + ghost_cells_key_index_type; + + /// Iterator into the ghost cells (by key) + typedef typename ghost_cells_key_index_type::iterator key_iterator; + + /** The property map category. A distributed property map cannot be + * an Lvalue Property Map, because values on remote processes cannot + * be addresses. + */ + typedef typename detail::make_nonlvalue_property_map< + (is_base_and_derived<lvalue_property_map_tag, local_category>::value + || is_same<lvalue_property_map_tag, local_category>::value)> + ::template apply<local_category>::type category; + + /** Default-construct a distributed property map. This function + * creates an initialized property map that must be assigned to a + * valid value before being used. It is only provided here because + * property maps must be Default Constructible. + */ + distributed_property_map() {} + + /** Construct a distributed property map. Builds a distributed + * property map communicating over the given process group and using + * the given local property map for storage. Since no reduction + * operation is provided, the default reduction operation @c + * basic_reduce<value_type> is used. + */ + distributed_property_map(const ProcessGroup& pg, const GlobalMap& global, + const StorageMap& pm) + : data(new data_t(pg, global, pm, basic_reduce<value_type>(), false)) + { + typedef handle_message<basic_reduce<value_type> > Handler; + + data->ghost_cells.reset(new ghost_cells_type()); + Handler handler(data); + data->process_group.replace_handler(handler, true); + data->process_group.template get_receiver<Handler>() + ->setup_triggers(data->process_group); + } + + /** Construct a distributed property map. Builds a distributed + * property map communicating over the given process group and using + * the given local property map for storage. The given @p reduce + * parameter is used as the reduction operation. + */ + template<typename Reduce> + distributed_property_map(const ProcessGroup& pg, const GlobalMap& global, + const StorageMap& pm, + const Reduce& reduce); + + ~distributed_property_map(); + + /// Set the reduce operation of the distributed property map. + template<typename Reduce> + void set_reduce(const Reduce& reduce); + + // Set the consistency model for the distributed property map + void set_consistency_model(int model); + + // Get the consistency model + int get_consistency_model() const { return data->model; } + + // Set the maximum number of ghost cells that we are allowed to + // maintain. If 0, all ghost cells will be retained. + void set_max_ghost_cells(std::size_t max_ghost_cells); + + // Clear out all ghost cells + void clear(); + + // Reset the values in all ghost cells to the default value + void reset(); + + // Flush all values destined for remote processors + void flush(); + + reference operator[](const key_type& key) const + { + owner_local_pair p = get(data->global, key); + + if (p.first == process_id(data->process_group)) { + return data->storage[p.second]; + } else { + return cell(key); + } + } + + process_group_type process_group() const + { + return data->process_group.base(); + } + + StorageMap& base() { return data->storage; } + const StorageMap& base() const { return data->storage; } + + /** Sends a "put" request. + * \internal + * + */ + void + request_put(process_id_type p, const key_type& k, const value_type& v) const + { + send(data->process_group, p, property_map_put, + boost::parallel::detail::make_untracked_pair(k, v)); + } + + /** Access the ghost cell for the given key. + * \internal + */ + value_type& cell(const key_type& k, bool request_if_missing = true) const; + + /** Perform synchronization + * \internal + */ + void do_synchronize(); + + const GlobalMap& global() const { return data->global; } + GlobalMap& global() { return data->global; } + + struct data_t + { + data_t(const ProcessGroup& pg, const GlobalMap& global, + const StorageMap& pm, const function1<value_type, key_type>& dv, + bool has_default_resolver) + : process_group(pg), global(global), storage(pm), + ghost_cells(), max_ghost_cells(1000000), get_default_value(dv), + has_default_resolver(has_default_resolver), model(cm_forward) { } + + /// The process group + ProcessGroup process_group; + + /// A mapping from the keys of this property map to the global + /// descriptor. + GlobalMap global; + + /// Local property map + StorageMap storage; + + /// The ghost cells + shared_ptr<ghost_cells_type> ghost_cells; + + /// The maximum number of ghost cells we are permitted to hold. If + /// zero, we are permitted to have an infinite number of ghost + /// cells. + std::size_t max_ghost_cells; + + /// Default value for remote ghost cells, as defined by the + /// reduction operation. + function1<value_type, key_type> get_default_value; + + /// True if this resolver is the "default" resolver, meaning that + /// we should not be able to get() a default value; it needs to be + /// request()ed first. + bool has_default_resolver; + + // Current consistency model + int model; + + // Function that resets all of the ghost cells to their default + // values. It knows the type of the resolver, so we can eliminate + // a large number of calls through function pointers. + void (data_t::*reset)(); + + // Clear out all ghost cells + void clear(); + + // Flush all values destined for remote processors + void flush(); + + // Send out requests to "refresh" the values of ghost cells that + // we're holding. + void refresh_ghost_cells(); + + private: + template<typename Resolver> void do_reset(); + + friend class distributed_property_map; + }; + friend struct data_t; + + shared_ptr<data_t> data; + + private: + // Prunes the least recently used ghost cells until we have @c + // max_ghost_cells or fewer ghost cells. + void prune_ghost_cells() const; + + /** Handles incoming messages. + * + * This function object is responsible for handling all incoming + * messages for the distributed property map. + */ + template<typename Reduce> + struct handle_message + { + explicit handle_message(const shared_ptr<data_t>& data, + const Reduce& reduce = Reduce()) + : data_ptr(data), reduce(reduce) { } + + void operator()(process_id_type source, int tag); + + /// Individual message handlers + void + handle_put(int source, int tag, + const boost::parallel::detail::untracked_pair<key_type, value_type>& data, + trigger_receive_context); + + value_type + handle_get(int source, int tag, const key_type& data, + trigger_receive_context); + + void + handle_multiget(int source, int tag, + const std::vector<key_type>& data, + trigger_receive_context); + + void + handle_multiget_reply + (int source, int tag, + const std::vector<boost::parallel::detail::untracked_pair<key_type, value_type> >& msg, + trigger_receive_context); + + void + handle_multiput + (int source, int tag, + const std::vector<unsafe_pair<local_key_type, value_type> >& data, + trigger_receive_context); + + void setup_triggers(process_group_type& pg); + + private: + weak_ptr<data_t> data_ptr; + Reduce reduce; + }; + + /* Sets up the next stage in a multi-stage synchronization, for + bidirectional consistency. */ + struct on_synchronize + { + explicit on_synchronize(const shared_ptr<data_t>& data) : data_ptr(data) { } + + void operator()(); + + private: + weak_ptr<data_t> data_ptr; + }; +}; + +/* An implementation helper macro for the common case of naming + distributed property maps with all of the normal template + parameters. */ +#define PBGL_DISTRIB_PMAP \ + distributed_property_map<ProcessGroup, GlobalMap, StorageMap> + +/* Request that the value for the given remote key be retrieved in + the next synchronization round. */ +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline void +request(const PBGL_DISTRIB_PMAP& pm, + typename PBGL_DISTRIB_PMAP::key_type const& key) +{ + if (get(pm.data->global, key).first != process_id(pm.data->process_group)) + pm.cell(key, false); +} + +/** Get the value associated with a particular key. Retrieves the + * value associated with the given key. If the key denotes a + * locally-owned object, it returns the value from the local property + * map; if the key denotes a remotely-owned object, retrieves the + * value of the ghost cell for that key, which may be the default + * value provided by the reduce operation. + * + * Complexity: For a local key, O(1) get operations on the underlying + * property map. For a non-local key, O(1) accesses to the ghost cells. + */ +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline +typename PBGL_DISTRIB_PMAP::value_type +get(const PBGL_DISTRIB_PMAP& pm, + typename PBGL_DISTRIB_PMAP::key_type const& key) +{ + using boost::get; + + typename property_traits<GlobalMap>::value_type p = + get(pm.data->global, key); + + if (p.first == process_id(pm.data->process_group)) { + return get(pm.data->storage, p.second); + } else { + return pm.cell(key); + } +} + +/** Put a value associated with the given key into the property map. + * When the key denotes a locally-owned object, this operation updates + * the underlying local property map. Otherwise, the local ghost cell + * is updated and a "put" message is sent to the processor owning this + * key. + * + * Complexity: For a local key, O(1) put operations on the underlying + * property map. For a nonlocal key, O(1) accesses to the ghost cells + * and will send O(1) messages of size O(sizeof(key) + sizeof(value)). + */ +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void +put(const PBGL_DISTRIB_PMAP& pm, + typename PBGL_DISTRIB_PMAP::key_type const & key, + typename PBGL_DISTRIB_PMAP::value_type const & value) +{ + using boost::put; + + typename property_traits<GlobalMap>::value_type p = + get(pm.data->global, key); + + if (p.first == process_id(pm.data->process_group)) { + put(pm.data->storage, p.second, value); + } else { + if (pm.data->model & cm_forward) + pm.request_put(p.first, key, value); + + pm.cell(key, false) = value; + } +} + +/** Put a value associated with a given key into the local view of the + * property map. This operation is equivalent to @c put, but with one + * exception: no message will be sent to the owning processor in the + * case of a remote update. The effect is that any value written via + * @c local_put for a remote key may be overwritten in the next + * synchronization round. + */ +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void +local_put(const PBGL_DISTRIB_PMAP& pm, + typename PBGL_DISTRIB_PMAP::key_type const & key, + typename PBGL_DISTRIB_PMAP::value_type const & value) +{ + using boost::put; + + typename property_traits<GlobalMap>::value_type p = + get(pm.data->global, key); + + if (p.first == process_id(pm.data->process_group)) + put(pm.data->storage, p.second, value); + else pm.cell(key, false) = value; +} + +/** Cache the value associated with the given remote key. If the key + * is local, ignore the operation. */ +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline void +cache(const PBGL_DISTRIB_PMAP& pm, + typename PBGL_DISTRIB_PMAP::key_type const & key, + typename PBGL_DISTRIB_PMAP::value_type const & value) +{ + typename ProcessGroup::process_id_type id = get(pm.data->global, key).first; + + if (id != process_id(pm.data->process_group)) pm.cell(key, false) = value; +} + +/// Synchronize the property map. +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void +synchronize(PBGL_DISTRIB_PMAP& pm) +{ + pm.do_synchronize(); +} + +/// Create a distributed property map. +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +inline distributed_property_map<ProcessGroup, GlobalMap, StorageMap> +make_distributed_property_map(const ProcessGroup& pg, GlobalMap global, + StorageMap storage) +{ + typedef distributed_property_map<ProcessGroup, GlobalMap, StorageMap> + result_type; + return result_type(pg, global, storage); +} + +/** + * \overload + */ +template<typename ProcessGroup, typename GlobalMap, typename StorageMap, + typename Reduce> +inline distributed_property_map<ProcessGroup, GlobalMap, StorageMap> +make_distributed_property_map(const ProcessGroup& pg, GlobalMap global, + StorageMap storage, Reduce reduce) +{ + typedef distributed_property_map<ProcessGroup, GlobalMap, StorageMap> + result_type; + return result_type(pg, global, storage, reduce); +} + +} } // end namespace boost::parallel + +// Boost's functional/hash +namespace boost { + template<typename D, typename V> + struct hash<boost::detail::edge_desc_impl<D, V> > + { + std::size_t operator()(const boost::detail::edge_desc_impl<D, V> & x) const + { return hash_value(x.get_property()); } + }; +} + +#include <boost/property_map/parallel/impl/distributed_property_map.ipp> + +#undef PBGL_DISTRIB_PMAP + +#endif // BOOST_PARALLEL_DISTRIBUTED_PROPERTY_MAP_HPP diff --git a/Utilities/BGL/boost/property_map/parallel/global_index_map.hpp b/Utilities/BGL/boost/property_map/parallel/global_index_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e40d27a07a36577a115de737345ee7586c63bfbf --- /dev/null +++ b/Utilities/BGL/boost/property_map/parallel/global_index_map.hpp @@ -0,0 +1,74 @@ +// Copyright 2005 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine +#ifndef BOOST_PARALLEL_GLOBAL_INDEX_MAP_HPP +#define BOOST_PARALLEL_GLOBAL_INDEX_MAP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <boost/property_map/property_map.hpp> +#include <vector> +#include <boost/shared_ptr.hpp> + +namespace boost { namespace parallel { + +template<typename IndexMap, typename GlobalMap> +class global_index_map +{ +public: + typedef typename property_traits<IndexMap>::key_type key_type; + typedef typename property_traits<IndexMap>::value_type value_type; + typedef value_type reference; + typedef readable_property_map_tag category; + + template<typename ProcessGroup> + global_index_map(ProcessGroup pg, value_type num_local_indices, + IndexMap index_map, GlobalMap global) + : index_map(index_map), global(global) + { + typedef typename ProcessGroup::process_id_type process_id_type; + starting_index.reset(new std::vector<value_type>(num_processes(pg) + 1)); + send(pg, 0, 0, num_local_indices); + synchronize(pg); + + // Populate starting_index in all processes + if (process_id(pg) == 0) { + (*starting_index)[0] = 0; + for (process_id_type src = 0; src < num_processes(pg); ++src) { + value_type n; + receive(pg, src, 0, n); + (*starting_index)[src + 1] = (*starting_index)[src] + n; + } + for (process_id_type dest = 1; dest < num_processes(pg); ++dest) + send(pg, dest, 1, &starting_index->front(), num_processes(pg)); + synchronize(pg); + } else { + synchronize(pg); + receive(pg, 0, 1, &starting_index->front(), num_processes(pg)); + } + } + + friend inline value_type + get(const global_index_map& gim, const key_type& x) + { + using boost::get; + return (*gim.starting_index)[get(gim.global, x).first] + + get(gim.index_map, x); + } + +private: + shared_ptr<std::vector<value_type> > starting_index; + IndexMap index_map; + GlobalMap global; +}; + +} } // end namespace boost::parallel + +#endif // BOOST_PARALLEL_GLOBAL_INDEX_MAP_HPP diff --git a/Utilities/BGL/boost/property_map/parallel/impl/distributed_property_map.ipp b/Utilities/BGL/boost/property_map/parallel/impl/distributed_property_map.ipp new file mode 100644 index 0000000000000000000000000000000000000000..0d8f946189299a71b76b6e992f1701db83af6b97 --- /dev/null +++ b/Utilities/BGL/boost/property_map/parallel/impl/distributed_property_map.ipp @@ -0,0 +1,431 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Nick Edmonds +// Andrew Lumsdaine +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/graph/parallel/detail/untracked_pair.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/bind.hpp> +#include <boost/graph/parallel/simple_trigger.hpp> + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +namespace boost { namespace parallel { + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +PBGL_DISTRIB_PMAP +::distributed_property_map(const ProcessGroup& pg, const GlobalMap& global, + const StorageMap& pm, const Reduce& reduce) + : data(new data_t(pg, global, pm, reduce, Reduce::non_default_resolver)) +{ + typedef handle_message<Reduce> Handler; + + data->ghost_cells.reset(new ghost_cells_type()); + data->reset = &data_t::template do_reset<Reduce>; + data->process_group.replace_handler(Handler(data, reduce)); + data->process_group.template get_receiver<Handler>() + ->setup_triggers(data->process_group); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +PBGL_DISTRIB_PMAP::~distributed_property_map() { } + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +void +PBGL_DISTRIB_PMAP::set_reduce(const Reduce& reduce) +{ + typedef handle_message<Reduce> Handler; + data->process_group.replace_handler(Handler(data, reduce)); + Handler* handler = data->process_group.template get_receiver<Handler>(); + assert(handler); + handler->setup_triggers(data->process_group); + data->get_default_value = reduce; + data->has_default_resolver = Reduce::non_default_resolver; + int model = data->model; + data->reset = &data_t::template do_reset<Reduce>; + set_consistency_model(model); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::prune_ghost_cells() const +{ + if (data->max_ghost_cells == 0) + return; + + while (data->ghost_cells->size() > data->max_ghost_cells) { + // Evict the last ghost cell + + if (data->model & cm_flush) { + // We need to flush values when we evict them. + boost::parallel::detail::untracked_pair<key_type, value_type> const& victim + = data->ghost_cells->back(); + send(data->process_group, get(data->global, victim.first).first, + property_map_put, victim); + } + + // Actually remove the ghost cell + data->ghost_cells->pop_back(); + } +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +typename PBGL_DISTRIB_PMAP::value_type& +PBGL_DISTRIB_PMAP::cell(const key_type& key, bool request_if_missing) const +{ + // Index by key + ghost_cells_key_index_type const& key_index + = data->ghost_cells->template get<1>(); + + // Search for the ghost cell by key, and project back to the sequence + iterator ghost_cell + = data->ghost_cells->template project<0>(key_index.find(key)); + if (ghost_cell == data->ghost_cells->end()) { + value_type value; + if (data->has_default_resolver) + // Since we have a default resolver, use it to create a default + // value for this ghost cell. + value = data->get_default_value(key); + else if (request_if_missing) + // Request the actual value of this key from its owner + send_oob_with_reply(data->process_group, get(data->global, key).first, + property_map_get, key, value); + else + value = value_type(); + + // Create a ghost cell containing the new value + ghost_cell + = data->ghost_cells->push_front(std::make_pair(key, value)).first; + + // If we need to, prune the ghost cells + if (data->max_ghost_cells > 0) + prune_ghost_cells(); + } else if (data->max_ghost_cells > 0) + // Put this cell at the beginning of the MRU list + data->ghost_cells->relocate(data->ghost_cells->begin(), ghost_cell); + + return const_cast<value_type&>(ghost_cell->second); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +void +PBGL_DISTRIB_PMAP +::handle_message<Reduce>::operator()(process_id_type source, int tag) +{ + assert(false); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +void +PBGL_DISTRIB_PMAP::handle_message<Reduce>:: +handle_put(int /*source*/, int /*tag*/, + const boost::parallel::detail::untracked_pair<key_type, value_type>& req, trigger_receive_context) +{ + using boost::get; + + shared_ptr<data_t> data(data_ptr); + + owner_local_pair p = get(data->global, req.first); + assert(p.first == process_id(data->process_group)); + + detail::maybe_put(data->storage, p.second, + reduce(req.first, + get(data->storage, p.second), + req.second)); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +typename PBGL_DISTRIB_PMAP::value_type +PBGL_DISTRIB_PMAP::handle_message<Reduce>:: +handle_get(int source, int /*tag*/, const key_type& key, + trigger_receive_context) +{ + using boost::get; + + shared_ptr<data_t> data(data_ptr); + assert(data); + + owner_local_pair p = get(data->global, key); + return get(data->storage, p.second); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +void +PBGL_DISTRIB_PMAP::handle_message<Reduce>:: +handle_multiget(int source, int tag, const std::vector<key_type>& keys, + trigger_receive_context) +{ + shared_ptr<data_t> data(data_ptr); + assert(data); + + typedef boost::parallel::detail::untracked_pair<key_type, value_type> key_value; + std::vector<key_value> results; + std::size_t n = keys.size(); + results.reserve(n); + + using boost::get; + + for (std::size_t i = 0; i < n; ++i) { + local_key_type local_key = get(data->global, keys[i]).second; + results.push_back(key_value(keys[i], get(data->storage, local_key))); + } + send(data->process_group, source, property_map_multiget_reply, results); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +void +PBGL_DISTRIB_PMAP::handle_message<Reduce>:: +handle_multiget_reply + (int source, int tag, + const std::vector<boost::parallel::detail::untracked_pair<key_type, value_type> >& msg, + trigger_receive_context) +{ + shared_ptr<data_t> data(data_ptr); + assert(data); + + // Index by key + ghost_cells_key_index_type const& key_index + = data->ghost_cells->template get<1>(); + + std::size_t n = msg.size(); + for (std::size_t i = 0; i < n; ++i) { + // Search for the ghost cell by key, and project back to the sequence + iterator position + = data->ghost_cells->template project<0>(key_index.find(msg[i].first)); + + if (position != data->ghost_cells->end()) + const_cast<value_type&>(position->second) = msg[i].second; + } +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +void +PBGL_DISTRIB_PMAP::handle_message<Reduce>:: +handle_multiput + (int source, int tag, + const std::vector<unsafe_pair<local_key_type, value_type> >& values, + trigger_receive_context) +{ + using boost::get; + + shared_ptr<data_t> data(data_ptr); + assert(data); + + std::size_t n = values.size(); + for (std::size_t i = 0; i < n; ++i) { + local_key_type local_key = values[i].first; + value_type local_value = get(data->storage, local_key); + detail::maybe_put(data->storage, values[i].first, + reduce(values[i].first, + local_value, + values[i].second)); + } +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Reduce> +void +PBGL_DISTRIB_PMAP::handle_message<Reduce>:: +setup_triggers(process_group_type& pg) +{ + using boost::graph::parallel::simple_trigger; + + simple_trigger(pg, property_map_put, this, &handle_message::handle_put); + simple_trigger(pg, property_map_get, this, &handle_message::handle_get); + simple_trigger(pg, property_map_multiget, this, + &handle_message::handle_multiget); + simple_trigger(pg, property_map_multiget_reply, this, + &handle_message::handle_multiget_reply); + simple_trigger(pg, property_map_multiput, this, + &handle_message::handle_multiput); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void +PBGL_DISTRIB_PMAP +::on_synchronize::operator()() +{ + int stage=0; // we only get called at the start now + shared_ptr<data_t> data(data_ptr); + assert(data); + + // Determine in which stage backward consistency messages should be sent. + int backward_stage = -1; + if (data->model & cm_backward) { + if (data->model & cm_flush) backward_stage = 1; + else backward_stage = 0; + } + + // Flush results in first stage + if (stage == 0 && data->model & cm_flush) + data->flush(); + + // Backward consistency + if (stage == backward_stage && !(data->model & (cm_clear | cm_reset))) + data->refresh_ghost_cells(); + + // Optionally clear results + if (data->model & cm_clear) + data->clear(); + + // Optionally reset results + if (data->model & cm_reset) { + if (data->reset) ((*data).*data->reset)(); + } +} + + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void +PBGL_DISTRIB_PMAP::set_consistency_model(int model) +{ + data->model = model; + + int stages = 1; + bool need_on_synchronize = (model != cm_forward); + + // Backward consistency is a two-stage process. + if (model & cm_backward) { + if (model & cm_flush) stages = 3; + else stages = 2; + + // For backward consistency to work, we absolutely cannot throw + // away any ghost cells. + data->max_ghost_cells = 0; + } + + // attach the on_synchronize handler. + if (need_on_synchronize) + data->process_group.replace_on_synchronize_handler(on_synchronize(data)); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void +PBGL_DISTRIB_PMAP::set_max_ghost_cells(std::size_t max_ghost_cells) +{ + if ((data->model & cm_backward) && max_ghost_cells > 0) + boost::throw_exception(std::runtime_error("distributed_property_map::set_max_ghost_cells: " + "cannot limit ghost-cell usage with a backward " + "consistency model")); + + if (max_ghost_cells == 1) + // It is not safe to have only 1 ghost cell; the cell() method + // will fail. + max_ghost_cells = 2; + + data->max_ghost_cells = max_ghost_cells; + prune_ghost_cells(); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::clear() +{ + data->clear(); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::data_t::clear() +{ + ghost_cells->clear(); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::reset() +{ + if (data->reset) ((*data).*data->reset)(); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::flush() +{ + data->flush(); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::data_t::refresh_ghost_cells() +{ + using boost::get; + + std::vector<std::vector<key_type> > keys; + keys.resize(num_processes(process_group)); + + // Collect the set of keys for which we will request values + for (iterator i = ghost_cells->begin(); i != ghost_cells->end(); ++i) + keys[get(global, i->first).first].push_back(i->first); + + // Send multiget requests to each of the other processors + typedef typename ProcessGroup::process_size_type process_size_type; + process_size_type n = num_processes(process_group); + process_id_type id = process_id(process_group); + for (process_size_type p = (id + 1) % n ; p != id ; p = (p + 1) % n) { + if (!keys[p].empty()) + send(process_group, p, property_map_multiget, keys[p]); + } +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::data_t::flush() +{ + using boost::get; + + int n = num_processes(process_group); + std::vector<std::vector<unsafe_pair<local_key_type, value_type> > > values; + values.resize(n); + + // Collect all of the flushed values + for (iterator i = ghost_cells->begin(); i != ghost_cells->end(); ++i) { + std::pair<int, local_key_type> g = get(global, i->first); + values[g.first].push_back(std::make_pair(g.second, i->second)); + } + + // Transmit flushed values + for (int p = 0; p < n; ++p) { + if (!values[p].empty()) + send(process_group, p, property_map_multiput, values[p]); + } +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +void PBGL_DISTRIB_PMAP::do_synchronize() +{ + if (data->model & cm_backward) { + synchronize(data->process_group); + return; + } + + // Request refreshes of the values of our ghost cells + data->refresh_ghost_cells(); + + // Allows all of the multigets to get to their destinations + synchronize(data->process_group); + + // Allows all of the multiget responses to get to their destinations + synchronize(data->process_group); +} + +template<typename ProcessGroup, typename GlobalMap, typename StorageMap> +template<typename Resolver> +void PBGL_DISTRIB_PMAP::data_t::do_reset() +{ + Resolver* resolver = get_default_value.template target<Resolver>(); + assert(resolver); + + for (iterator i = ghost_cells->begin(); i != ghost_cells->end(); ++i) + const_cast<value_type&>(i->second) = (*resolver)(i->first); +} + +} } // end namespace boost::parallel diff --git a/Utilities/BGL/boost/property_map/parallel/local_property_map.hpp b/Utilities/BGL/boost/property_map/parallel/local_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..85e427477320c3e89543835442658770f052554e --- /dev/null +++ b/Utilities/BGL/boost/property_map/parallel/local_property_map.hpp @@ -0,0 +1,91 @@ +// Copyright (C) 2004-2006 The Trustees of Indiana University. + +// 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 +// Andrew Lumsdaine + +// The placement of this #include probably looks very odd relative to +// the #ifndef/#define pair below. However, this placement is +// extremely important to allow the various property map headers to be +// included in any order. +#include <boost/property_map/property_map.hpp> + +#ifndef BOOST_PARALLEL_LOCAL_PROPERTY_MAP_HPP +#define BOOST_PARALLEL_LOCAL_PROPERTY_MAP_HPP + +#ifndef BOOST_GRAPH_USE_MPI +#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" +#endif + +#include <cassert> + +namespace boost { + /** Property map that accesses an underlying, local property map + * using a subset of the global keys. + */ + template<typename ProcessGroup, typename GlobalMap, typename StorageMap> + class local_property_map + { + typedef typename property_traits<GlobalMap>::value_type owner_local_pair; + + public: + typedef ProcessGroup process_group_type; + typedef typename property_traits<StorageMap>::value_type value_type; + typedef typename property_traits<GlobalMap>::key_type key_type; + typedef typename property_traits<StorageMap>::reference reference; + typedef typename property_traits<StorageMap>::category category; + + local_property_map() { } + + local_property_map(const ProcessGroup& process_group, + const GlobalMap& global, const StorageMap& storage) + : process_group_(process_group), global_(global), storage(storage) { } + + reference operator[](const key_type& key) + { + owner_local_pair p = get(global_, key); + assert(p.first == process_id(process_group_)); + return storage[p.second]; + } + + GlobalMap& global() const { return global_; } + StorageMap& base() const { return storage; } + + ProcessGroup& process_group() { return process_group_; } + const ProcessGroup& process_group() const { return process_group_; } + + private: + ProcessGroup process_group_; + mutable GlobalMap global_; + mutable StorageMap storage; + }; + + template<typename ProcessGroup, typename GlobalMap, typename StorageMap> + inline + typename local_property_map<ProcessGroup, GlobalMap, StorageMap>::reference + get(const local_property_map<ProcessGroup, GlobalMap, StorageMap>& pm, + typename local_property_map<ProcessGroup, GlobalMap, StorageMap>::key_type + const & key) + + { + typename property_traits<GlobalMap>::value_type p = get(pm.global(), key); + return get(pm.base(), p.second); + } + + template<typename ProcessGroup, typename GlobalMap, typename StorageMap> + inline void + put(const local_property_map<ProcessGroup, GlobalMap, StorageMap>& pm, + typename local_property_map<ProcessGroup, GlobalMap, StorageMap> + ::key_type const & key, + typename local_property_map<ProcessGroup, GlobalMap, StorageMap> + ::value_type const& v) + { + typename property_traits<GlobalMap>::value_type p = get(pm.global(), key); + assert(p.first == process_id(pm.process_group())); + put(pm.base(), p.second, v); + } +} // end namespace boost +#endif // BOOST_PARALLEL_LOCAL_PROPERTY_MAP_HPP diff --git a/Utilities/BGL/boost/property_map.hpp b/Utilities/BGL/boost/property_map/property_map.hpp similarity index 63% rename from Utilities/BGL/boost/property_map.hpp rename to Utilities/BGL/boost/property_map/property_map.hpp index 9077ea37cd10d3f690e08462244cacbad706b2dd..fce69b4d54f869d47d63fa4f1a3fb2c4c5f9ada1 100644 --- a/Utilities/BGL/boost/property_map.hpp +++ b/Utilities/BGL/boost/property_map/property_map.hpp @@ -1,4 +1,7 @@ // (C) Copyright Jeremy Siek 1999-2001. +// Copyright (C) 2006 Trustees of Indiana University +// Authors: Douglas Gregor and Jeremy 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) @@ -14,6 +17,9 @@ #include <boost/detail/iterator.hpp> #include <boost/concept_check.hpp> #include <boost/concept_archetype.hpp> +#include <boost/mpl/assert.hpp> +#include <boost/mpl/or.hpp> +#include <boost/type_traits/is_same.hpp> namespace boost { @@ -240,8 +246,9 @@ namespace boost { function_requires< ConvertibleConcept<Category, LvalueTag> >(); typedef typename property_traits<PMap>::value_type value_type; - typedef typename require_same< - const value_type&, reference>::type req; + BOOST_MPL_ASSERT((boost::mpl::or_< + boost::is_same<const value_type&, reference>, + boost::is_same<value_type&, reference> >)); reference ref = pmap[k]; ignore_unused_variable_warning(ref); @@ -273,9 +280,7 @@ namespace boost { boost::function_requires<ConvertibleConcept<Category, LvalueTag> >(); typedef typename property_traits<PMap>::value_type value_type; - typedef typename require_same< - value_type&, - reference>::type req; + BOOST_MPL_ASSERT((boost::is_same<value_type&, reference>)); reference ref = pmap[k]; ignore_unused_variable_warning(ref); @@ -297,7 +302,8 @@ namespace boost { } }; - struct identity_property_map; + template <typename T> + struct typed_identity_property_map; // A helper class for constructing a property map // from a class that implements operator[] @@ -496,19 +502,61 @@ namespace boost { } //========================================================================= - // A property map that applies the identity function to integers - struct identity_property_map - : public boost::put_get_helper<std::size_t, - identity_property_map> + // A property map that always returns the same object by value. + // + template <typename ValueType> + class static_property_map : + public + boost::put_get_helper<ValueType,static_property_map<ValueType> > + { + ValueType value; + public: + typedef void key_type; + typedef ValueType value_type; + typedef ValueType reference; + typedef readable_property_map_tag category; + static_property_map(ValueType v) : value(v) {} + + template<typename T> + inline reference operator[](T) const { return value; } + }; + + //========================================================================= + // A property map that always returns a reference to the same object. + // + template <typename KeyType, typename ValueType> + class ref_property_map : + public + boost::put_get_helper<ValueType&,ref_property_map<KeyType,ValueType> > + { + ValueType* value; + public: + typedef KeyType key_type; + typedef ValueType value_type; + typedef ValueType& reference; + typedef lvalue_property_map_tag category; + ref_property_map(ValueType& v) : value(&v) {} + ValueType& operator[](key_type const&) const { return *value; } + }; + + //========================================================================= + // A generalized identity property map + template <typename T> + struct typed_identity_property_map + : public boost::put_get_helper<T, typed_identity_property_map<T> > { - typedef std::size_t key_type; - typedef std::size_t value_type; - typedef std::size_t reference; + typedef T key_type; + typedef T value_type; + typedef T reference; typedef boost::readable_property_map_tag category; inline value_type operator[](const key_type& v) const { return v; } }; +//========================================================================= + // A property map that applies the identity function to integers + typedef typed_identity_property_map<std::size_t> identity_property_map; + //========================================================================= // A property map that does not do anything, for // when you have to supply a property map, but don't need it. @@ -538,9 +586,226 @@ namespace boost { value_type c; }; + // Convert a Readable property map into a function object + template <typename PropMap> + class property_map_function { + PropMap pm; + typedef typename property_traits<PropMap>::key_type param_type; + public: + explicit property_map_function(const PropMap& pm): pm(pm) {} + typedef typename property_traits<PropMap>::value_type result_type; + result_type operator()(const param_type& k) const {return get(pm, k);} + }; + + template <typename PropMap> + property_map_function<PropMap> + make_property_map_function(const PropMap& pm) { + return property_map_function<PropMap>(pm); + } } // namespace boost +#ifdef BOOST_GRAPH_USE_MPI +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/property_map/parallel/local_property_map.hpp> + +namespace boost { +/** Distributed iterator property map. + * + * This specialization of @ref iterator_property_map builds a + * distributed iterator property map given the local index maps + * generated by distributed graph types that automatically have index + * properties. + * + * This specialization is useful when creating external distributed + * property maps via the same syntax used to create external + * sequential property maps. + */ +template<typename RandomAccessIterator, typename ProcessGroup, + typename GlobalMap, typename StorageMap, + typename ValueType, typename Reference> +class iterator_property_map + <RandomAccessIterator, + local_property_map<ProcessGroup, GlobalMap, StorageMap>, + ValueType, Reference> + : public parallel::distributed_property_map + <ProcessGroup, + GlobalMap, + iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> > +{ + typedef iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> local_iterator_map; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + local_iterator_map> inherited; + + typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> + index_map_type; + typedef iterator_property_map self_type; + +public: + iterator_property_map() { } + + iterator_property_map(RandomAccessIterator cc, const index_map_type& id) + : inherited(id.process_group(), id.global(), + local_iterator_map(cc, id.base())) { } +}; + +/** Distributed iterator property map. + * + * This specialization of @ref iterator_property_map builds a + * distributed iterator property map given a distributed index + * map. Only the local portion of the distributed index property map + * is utilized. + * + * This specialization is useful when creating external distributed + * property maps via the same syntax used to create external + * sequential property maps. + */ +template<typename RandomAccessIterator, typename ProcessGroup, + typename GlobalMap, typename StorageMap, + typename ValueType, typename Reference> +class iterator_property_map< + RandomAccessIterator, + parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>, + ValueType, Reference + > + : public parallel::distributed_property_map + <ProcessGroup, + GlobalMap, + iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> > +{ + typedef iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> local_iterator_map; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + local_iterator_map> inherited; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + StorageMap> + index_map_type; + +public: + iterator_property_map() { } + + iterator_property_map(RandomAccessIterator cc, const index_map_type& id) + : inherited(id.process_group(), id.global(), + local_iterator_map(cc, id.base())) { } +}; + +namespace parallel { +// Generate an iterator property map with a specific kind of ghost +// cells +template<typename RandomAccessIterator, typename ProcessGroup, + typename GlobalMap, typename StorageMap> +distributed_property_map<ProcessGroup, + GlobalMap, + iterator_property_map<RandomAccessIterator, + StorageMap> > +make_iterator_property_map(RandomAccessIterator cc, + local_property_map<ProcessGroup, GlobalMap, + StorageMap> index_map) +{ + typedef distributed_property_map< + ProcessGroup, GlobalMap, + iterator_property_map<RandomAccessIterator, StorageMap> > + result_type; + return result_type(index_map.process_group(), index_map.global(), + make_iterator_property_map(cc, index_map.base())); +} + +} // end namespace parallel + +/** Distributed safe iterator property map. + * + * This specialization of @ref safe_iterator_property_map builds a + * distributed iterator property map given the local index maps + * generated by distributed graph types that automatically have index + * properties. + * + * This specialization is useful when creating external distributed + * property maps via the same syntax used to create external + * sequential property maps. + */ +template<typename RandomAccessIterator, typename ProcessGroup, + typename GlobalMap, typename StorageMap, typename ValueType, + typename Reference> +class safe_iterator_property_map + <RandomAccessIterator, + local_property_map<ProcessGroup, GlobalMap, StorageMap>, + ValueType, Reference> + : public parallel::distributed_property_map + <ProcessGroup, + GlobalMap, + safe_iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> > +{ + typedef safe_iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> local_iterator_map; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + local_iterator_map> inherited; + + typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type; + +public: + safe_iterator_property_map() { } + + safe_iterator_property_map(RandomAccessIterator cc, std::size_t n, + const index_map_type& id) + : inherited(id.process_group(), id.global(), + local_iterator_map(cc, n, id.base())) { } +}; + +/** Distributed safe iterator property map. + * + * This specialization of @ref safe_iterator_property_map builds a + * distributed iterator property map given a distributed index + * map. Only the local portion of the distributed index property map + * is utilized. + * + * This specialization is useful when creating external distributed + * property maps via the same syntax used to create external + * sequential property maps. + */ +template<typename RandomAccessIterator, typename ProcessGroup, + typename GlobalMap, typename StorageMap, + typename ValueType, typename Reference> +class safe_iterator_property_map< + RandomAccessIterator, + parallel::distributed_property_map<ProcessGroup,GlobalMap,StorageMap>, + ValueType, Reference> + : public parallel::distributed_property_map + <ProcessGroup, + GlobalMap, + safe_iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> > +{ + typedef safe_iterator_property_map<RandomAccessIterator, StorageMap, + ValueType, Reference> local_iterator_map; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + local_iterator_map> inherited; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + StorageMap> + index_map_type; + +public: + safe_iterator_property_map() { } + + safe_iterator_property_map(RandomAccessIterator cc, std::size_t n, + const index_map_type& id) + : inherited(id.process_group(), id.global(), + local_iterator_map(cc, n, id.base())) { } +}; + +} +#endif // BOOST_GRAPH_USE_MPI + +#include <boost/property_map/vector_property_map.hpp> #endif /* BOOST_PROPERTY_MAP_HPP */ diff --git a/Utilities/BGL/boost/property_map_iterator.hpp b/Utilities/BGL/boost/property_map/property_map_iterator.hpp similarity index 95% rename from Utilities/BGL/boost/property_map_iterator.hpp rename to Utilities/BGL/boost/property_map/property_map_iterator.hpp index 56d5954584877a70918ae8d35d7e21265922fcca..a7be8afecfc8d9993f2745d0fdba23abb59b640c 100644 --- a/Utilities/BGL/boost/property_map_iterator.hpp +++ b/Utilities/BGL/boost/property_map/property_map_iterator.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_PROPERTY_MAP_ITERATOR_HPP #define BOOST_PROPERTY_MAP_ITERATOR_HPP -#include <boost/property_map.hpp> +#include <boost/property_map/property_map.hpp> #include <boost/iterator/iterator_adaptor.hpp> #include <boost/mpl/if.hpp> #include <boost/type_traits/is_same.hpp> @@ -16,7 +16,7 @@ namespace boost { //====================================================================== - // property iterator, generalized from ideas by Fran�ois Faure + // property iterator, generalized from ideas by Francois Faure namespace detail { @@ -63,7 +63,7 @@ namespace boost { { - friend class iterator_core_access; + friend class boost::iterator_core_access; typedef iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >, Iterator, diff --git a/Utilities/BGL/boost/property_map/shared_array_property_map.hpp b/Utilities/BGL/boost/property_map/shared_array_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8056d95e5ab909506d752dd98c07cc33bc314c8d --- /dev/null +++ b/Utilities/BGL/boost/property_map/shared_array_property_map.hpp @@ -0,0 +1,52 @@ +// Copyright (C) 2009 Trustees of Indiana University +// Authors: Jeremiah Willcock, Andrew Lumsdaine + +// 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/property_map for documentation. + +#ifndef BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP +#define BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP + +#include <boost/smart_ptr/shared_array.hpp> +#include <boost/property_map/property_map.hpp> + +namespace boost { + +template <class T, class IndexMap> +class shared_array_property_map + : public boost::put_get_helper<T&, shared_array_property_map<T, IndexMap> > +{ + public: + typedef typename property_traits<IndexMap>::key_type key_type; + typedef T value_type; + typedef T& reference; + typedef boost::lvalue_property_map_tag category; + + inline shared_array_property_map(): data(), index() {} + + explicit inline shared_array_property_map( + size_t n, + const IndexMap& _id = IndexMap()) + : data(new T[n]), index(_id) {} + + inline T& operator[](key_type v) const { + return data[get(index, v)]; + } + + private: + boost::shared_array<T> data; + IndexMap index; +}; + +template <class T, class IndexMap> +shared_array_property_map<T, IndexMap> +make_shared_array_property_map(size_t n, const T&, const IndexMap& index) { + return shared_array_property_map<T, IndexMap>(n, index); +} + +} // end namespace boost + +#endif // BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP diff --git a/Utilities/BGL/boost/property_map/vector_property_map.hpp b/Utilities/BGL/boost/property_map/vector_property_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a97fb8105b2072ce95c44238e36b064dd33bbfef --- /dev/null +++ b/Utilities/BGL/boost/property_map/vector_property_map.hpp @@ -0,0 +1,185 @@ +// Copyright (C) Vladimir Prus 2003. +// 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/graph/vector_property_map.html for +// documentation. +// + +#ifndef VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04 +#define VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04 + +#include <boost/property_map/property_map.hpp> +#include <boost/shared_ptr.hpp> +#include <vector> + +namespace boost { + template<typename T, typename IndexMap = identity_property_map> + class vector_property_map + : public boost::put_get_helper< + typename std::iterator_traits< + typename std::vector<T>::iterator >::reference, + vector_property_map<T, IndexMap> > + { + public: + typedef typename property_traits<IndexMap>::key_type key_type; + typedef T value_type; + typedef typename std::iterator_traits< + typename std::vector<T>::iterator >::reference reference; + typedef boost::lvalue_property_map_tag category; + + vector_property_map(const IndexMap& index = IndexMap()) + : store(new std::vector<T>()), index(index) + {} + + vector_property_map(unsigned initial_size, + const IndexMap& index = IndexMap()) + : store(new std::vector<T>(initial_size)), index(index) + {} + + typename std::vector<T>::iterator storage_begin() + { + return store->begin(); + } + + typename std::vector<T>::iterator storage_end() + { + return store->end(); + } + + typename std::vector<T>::const_iterator storage_begin() const + { + return store->begin(); + } + + typename std::vector<T>::const_iterator storage_end() const + { + return store->end(); + } + + IndexMap& get_index_map() { return index; } + const IndexMap& get_index_map() const { return index; } + + public: + // Copy ctor absent, default semantics is OK. + // Assignment operator absent, default semantics is OK. + // CONSIDER: not sure that assignment to 'index' is correct. + + reference operator[](const key_type& v) const { + typename property_traits<IndexMap>::value_type i = get(index, v); + if (static_cast<unsigned>(i) >= store->size()) { + store->resize(i + 1, T()); + } + return (*store)[i]; + } + private: + // Conceptually, we have a vector of infinite size. For practical + // purposes, we start with an empty vector and grow it as needed. + // Note that we cannot store pointer to vector here -- we cannot + // store pointer to data, because if copy of property map resizes + // the vector, the pointer to data will be invalidated. + // I wonder if class 'pmap_ref' is simply needed. + shared_ptr< std::vector<T> > store; + IndexMap index; + }; + + template<typename T, typename IndexMap> + vector_property_map<T, IndexMap> + make_vector_property_map(IndexMap index) + { + return vector_property_map<T, IndexMap>(index); + } +} + +#ifdef BOOST_GRAPH_USE_MPI +#include <boost/property_map/parallel/distributed_property_map.hpp> +#include <boost/property_map/parallel/local_property_map.hpp> + +namespace boost { + +/** Distributed vector property map. + * + * This specialization of @ref vector_property_map builds a + * distributed vector property map given the local index maps + * generated by distributed graph types that automatically have index + * properties. + * + * This specialization is useful when creating external distributed + * property maps via the same syntax used to create external + * sequential property maps. + */ +template<typename T, typename ProcessGroup, typename GlobalMap, + typename StorageMap> +class vector_property_map<T, + local_property_map<ProcessGroup, GlobalMap, + StorageMap> > + : public parallel::distributed_property_map< + ProcessGroup, GlobalMap, vector_property_map<T, StorageMap> > +{ + typedef vector_property_map<T, StorageMap> local_iterator_map; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + local_iterator_map> inherited; + + typedef local_property_map<ProcessGroup, GlobalMap, StorageMap> index_map_type; + +public: + vector_property_map(const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_iterator_map(index.base())) { } + + vector_property_map(unsigned inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_iterator_map(inital_size, index.base())) { } +}; + +/** Distributed vector property map. + * + * This specialization of @ref vector_property_map builds a + * distributed vector property map given the local index maps + * generated by distributed graph types that automatically have index + * properties. + * + * This specialization is useful when creating external distributed + * property maps via the same syntax used to create external + * sequential property maps. + */ +template<typename T, typename ProcessGroup, typename GlobalMap, + typename StorageMap> +class vector_property_map< + T, + parallel::distributed_property_map< + ProcessGroup, + GlobalMap, + StorageMap + > + > + : public parallel::distributed_property_map< + ProcessGroup, GlobalMap, vector_property_map<T, StorageMap> > +{ + typedef vector_property_map<T, StorageMap> local_iterator_map; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + local_iterator_map> inherited; + + typedef parallel::distributed_property_map<ProcessGroup, GlobalMap, + StorageMap> + index_map_type; + +public: + vector_property_map(const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_iterator_map(index.base())) { } + + vector_property_map(unsigned inital_size, + const index_map_type& index = index_map_type()) + : inherited(index.process_group(), index.global(), + local_iterator_map(inital_size, index.base())) { } +}; + +} +#endif // BOOST_GRAPH_USE_MPI + +#endif diff --git a/Utilities/BGL/boost/ref.hpp b/Utilities/BGL/boost/ref.hpp index c4d40430e666d9eca1dce4bc550ddc850acba1e0..6058d6983197a72ab040bbfeb7e0b04006cc3ece 100644 --- a/Utilities/BGL/boost/ref.hpp +++ b/Utilities/BGL/boost/ref.hpp @@ -8,13 +8,14 @@ #endif #include <boost/config.hpp> -#include <boost/butility/addressof.hpp> +#include <boost/utility/addressof.hpp> #include <boost/mpl/bool.hpp> +#include <boost/detail/workaround.hpp> // // ref.hpp - ref/cref, useful helper functions // -// Copyright (C) 1999, 2000 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // Copyright (C) 2001, 2002 Peter Dimov // Copyright (C) 2002 David Abrahams // @@ -33,7 +34,7 @@ template<class T> class reference_wrapper public: typedef T type; -#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1300 ) explicit reference_wrapper(T& t): t_(&t) {} @@ -54,7 +55,7 @@ private: T* t_; }; -# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x570) +# if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) # define BOOST_REF_CONST # else # define BOOST_REF_CONST const @@ -172,6 +173,17 @@ class unwrap_reference # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template <class T> inline typename unwrap_reference<T>::type& +unwrap_ref(T& t) +{ + return t; +} + +template<class T> inline T* get_pointer( reference_wrapper<T> const & r ) +{ + return r.get_pointer(); +} + } // namespace boost #endif // #ifndef BOOST_REF_HPP_INCLUDED diff --git a/Utilities/BGL/boost/serialization/access.hpp b/Utilities/BGL/boost/serialization/access.hpp new file mode 100644 index 0000000000000000000000000000000000000000..40256d6cd3dccea295afd58c2b8f941a852e647b --- /dev/null +++ b/Utilities/BGL/boost/serialization/access.hpp @@ -0,0 +1,147 @@ +#ifndef BOOST_SERIALIZATION_ACCESS_HPP +#define BOOST_SERIALIZATION_ACCESS_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// access.hpp: interface for serialization system. + +// (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/serialization/pfto.hpp> + +namespace boost { + +namespace archive { +namespace detail { + template<class Archive, class T> + class iserializer; + template<class Archive, class T> + class oserializer; +} // namespace detail +} // namespace archive + +namespace serialization { + +// forward declarations +template<class Archive, class T> +inline void serialize_adl(Archive &, T &, const unsigned int); +namespace detail { + template<class Archive, class T> + struct member_saver; + template<class Archive, class T> + struct member_loader; +} // namespace detail + +// use an "accessor class so that we can use: +// "friend class boost::serialization::access;" +// in any serialized class to permit clean, safe access to private class members +// by the serialization system + +class access { +public: + // grant access to "real" serialization defaults +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + template<class Archive, class T> + friend struct detail::member_saver; + template<class Archive, class T> + friend struct detail::member_loader; + template<class Archive, class T> + friend class archive::detail::iserializer; + template<class Archive, class T> + friend class archive::detail::oserializer; + template<class Archive, class T> + friend inline void serialize( + Archive & ar, + T & t, + const BOOST_PFTO unsigned int file_version + ); + template<class Archive, class T> + friend inline void save_construct_data( + Archive & ar, + const T * t, + const BOOST_PFTO unsigned int file_version + ); + template<class Archive, class T> + friend inline void load_construct_data( + Archive & ar, + T * t, + const BOOST_PFTO unsigned int file_version + ); +#endif + + // pass calls to users's class implementation + template<class Archive, class T> + static void member_save( + Archive & ar, + //const T & t, + T & t, + const unsigned int file_version + ){ + t.save(ar, file_version); + } + template<class Archive, class T> + static void member_load( + Archive & ar, + T & t, + const unsigned int file_version + ){ + t.load(ar, file_version); + } + template<class Archive, class T> + static void serialize( + Archive & ar, + T & t, + const unsigned int file_version + ){ + // note: if you get a compile time error here with a + // message something like: + // cannot convert parameter 1 from <file type 1> to <file type 2 &> + // a likely possible cause is that the class T contains a + // serialize function - but that serialize function isn't + // a template and corresponds to a file type different than + // the class Archive. To resolve this, don't include an + // archive type other than that for which the serialization + // function is defined!!! + t.serialize(ar, file_version); + } + template<class T> + static void destroy( const T * t) // const appropriate here? + { + // the const business is an MSVC 6.0 hack that should be + // benign on everything else + delete const_cast<T *>(t); + } + template<class T> + static void construct(T * t){ + // default is inplace invocation of default constructor + // Note the :: before the placement new. Required if the + // class doesn't have a class-specific placement new defined. + ::new(t)T; + } + template<class T, class U> + static T & cast_reference(U & u){ + return static_cast<T &>(u); + } + template<class T, class U> + static T * cast_pointer(U * u){ + return static_cast<T *>(u); + } +}; + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_ACCESS_HPP diff --git a/Utilities/BGL/boost/serialization/array.hpp b/Utilities/BGL/boost/serialization/array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c5a6ec4e02b8e9664976bc55b4a230c10df48235 --- /dev/null +++ b/Utilities/BGL/boost/serialization/array.hpp @@ -0,0 +1,155 @@ +#ifndef BOOST_SERIALIZATION_ARRAY_HPP +#define BOOST_SERIALIZATION_ARRAY_HPP + +// (C) Copyright 2005 Matthias Troyer and Dave Abrahams +// 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) + +#include <iostream> +#include <cstddef> // std::size_t +#include <cstddef> +#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/split_member.hpp> +#include <boost/serialization/wrapper.hpp> +#include <boost/mpl/always.hpp> +#include <boost/mpl/apply.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/array.hpp> + +namespace boost { namespace serialization { + +// traits to specify whether to use an optimized array serialization + +#ifdef __BORLANDC__ +// workaround for Borland compiler +template <class Archive> +struct use_array_optimization { + template <class T> struct apply : boost::mpl::false_ {}; +}; + +#else +template <class Archive> +struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {}; +#endif + +template<class T> +class array : + public wrapper_traits<const array<T> > +{ +public: + typedef T value_type; + + array(value_type* t, std::size_t s) : + m_t(t), + m_element_count(s) + {} + array(const array & rhs) : + m_t(rhs.m_t), + m_element_count(rhs.m_element_count) + {} + array & operator=(const array & rhs){ + m_t = rhs.m_t; + m_element_count = rhs.m_element_count; + } + + // default implementation + template<class Archive> + void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const + { + // default implemention does the loop + std::size_t c = count(); + value_type * t = address(); + while(0 < c--) + ar & boost::serialization::make_nvp("item", *t++); + } + + // optimized implementation + template<class Archive> + void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ ) + { + boost::serialization::split_member(ar, *this, version); + } + + // default implementation + template<class Archive> + void save(Archive &ar, const unsigned int version) const + { + ar.save_array(*this,version); + } + + // default implementation + template<class Archive> + void load(Archive &ar, const unsigned int version) + { + ar.load_array(*this,version); + } + + // default implementation + template<class Archive> + void serialize(Archive &ar, const unsigned int version) + { + typedef BOOST_DEDUCED_TYPENAME + boost::serialization::use_array_optimization<Archive>::template apply< + BOOST_DEDUCED_TYPENAME remove_const<T>::type + >::type use_optimized; + serialize_optimized(ar,version,use_optimized()); + } + + value_type* address() const + { + return m_t; + } + + std::size_t count() const + { + return m_element_count; + } + +private: + value_type* m_t; + std::size_t m_element_count; +}; + +template<class T> +inline +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +const +#endif +array<T> make_array( T* t, std::size_t s){ + return array<T>(t, s); +} + +template <class Archive, class T, std::size_t N> +void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */) +{ + ar & boost::serialization::make_nvp("elems",a.elems); +} + + + +} } // end namespace boost::serialization + +#ifdef __BORLANDC__ +// ignore optimizations for Borland +#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) +#else +#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \ +namespace boost { namespace serialization { \ +template <> struct use_array_optimization<Archive> { \ + template <class ValueType> \ + struct apply : boost::mpl::apply1<Archive::use_array_optimization \ + , BOOST_DEDUCED_TYPENAME boost::remove_const<ValueType>::type \ + >::type {}; \ +}; }} +#endif // __BORLANDC__ + +#endif //BOOST_SERIALIZATION_ARRAY_HPP diff --git a/Utilities/BGL/boost/serialization/assume_abstract.hpp b/Utilities/BGL/boost/serialization/assume_abstract.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a89cc44bd2456c9b338910e2dafdad929d907386 --- /dev/null +++ b/Utilities/BGL/boost/serialization/assume_abstract.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_SERIALIZATION_ASSUME_ABSTRACT_HPP +#define BOOST_SERIALIZATION_ASSUME_ABSTRACT_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// assume_abstract_class.hpp: + +// (C) Copyright 2008 Robert Ramey +// 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. + +// this is useful for compilers which don't support the boost::is_abstract + +#include <boost/type_traits/is_abstract.hpp> + +#ifndef BOOST_NO_IS_ABSTRACT + +// if there is an intrinsic is_abstract defined, we don't have to do anything +#define BOOST_SERIALIZATION_ASSUME_ABSTRACT(T) + +// but forward to the "official" is_abstract +namespace boost { +namespace serialization { + template<class T> + struct is_abstract : boost::is_abstract<T> {} ; +} // namespace serialization +} // namespace boost + +#else +// we have to "make" one + +namespace boost { +namespace serialization { + template<class T> + struct is_abstract : boost::false_type {}; +} // namespace serialization +} // namespace boost + +// define a macro to make explicit designation of this more transparent +#define BOOST_SERIALIZATION_ASSUME_ABSTRACT(T) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct is_abstract< T > : boost::true_type {}; \ +template<> \ +struct is_abstract< const T > : boost::true_type {}; \ +}} \ +/**/ + +#endif // BOOST_NO_IS_ABSTRACT + +#endif //BOOST_SERIALIZATION_ASSUME_ABSTRACT_HPP diff --git a/Utilities/BGL/boost/serialization/base_object.hpp b/Utilities/BGL/boost/serialization/base_object.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b840d25e99f85c9bffd05933b4ddc243b9f289c0 --- /dev/null +++ b/Utilities/BGL/boost/serialization/base_object.hpp @@ -0,0 +1,112 @@ +#ifndef BOOST_SERIALIZATION_BASE_OBJECT_HPP +#define BOOST_SERIALIZATION_BASE_OBJECT_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// base_object.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. + +// if no archive headers have been included this is a no op +// this is to permit BOOST_EXPORT etc to be included in a +// file declaration header + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/identity.hpp> + +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_polymorphic.hpp> + +#include <boost/static_assert.hpp> +#include <boost/serialization/access.hpp> +#include <boost/serialization/force_include.hpp> +#include <boost/serialization/void_cast_fwd.hpp> + +namespace boost { +namespace serialization { + +namespace detail +{ + // get the base type for a given derived type + // preserving the const-ness + template<class B, class D> + struct base_cast + { + typedef BOOST_DEDUCED_TYPENAME + mpl::if_< + is_const<D>, + const B, + B + >::type type; + BOOST_STATIC_ASSERT(is_const<type>::value == is_const<D>::value); + }; + + // only register void casts if the types are polymorphic + template<class Base, class Derived> + struct base_register + { + struct polymorphic { + static void const * invoke(){ + Base const * const b = 0; + Derived const * const d = 0; + return & void_cast_register(d, b); + } + }; + struct non_polymorphic { + static void const * invoke(){ + return 0; + } + }; + static void const * invoke(){ + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_polymorphic<Base>, + mpl::identity<polymorphic>, + mpl::identity<non_polymorphic> + >::type type; + return type::invoke(); + } + }; + +} // namespace detail +#if defined(__BORLANDC__) && __BORLANDC__ < 0x610 +template<class Base, class Derived> +const Base & +base_object(const Derived & d) +{ + BOOST_STATIC_ASSERT(! is_pointer<Derived>::value); + detail::base_register<Base, Derived>::invoke(); + return access::cast_reference<const Base, Derived>(d); +} +#else +template<class Base, class Derived> +BOOST_DEDUCED_TYPENAME detail::base_cast<Base, Derived>::type & +base_object(Derived &d) +{ + BOOST_STATIC_ASSERT(( is_base_and_derived<Base,Derived>::value)); + BOOST_STATIC_ASSERT(! is_pointer<Derived>::value); + typedef BOOST_DEDUCED_TYPENAME detail::base_cast<Base, Derived>::type type; + detail::base_register<type, Derived>::invoke(); + return access::cast_reference<type, Derived>(d); +} +#endif + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_BASE_OBJECT_HPP diff --git a/Utilities/BGL/boost/serialization/binary_object.hpp b/Utilities/BGL/boost/serialization/binary_object.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0d8d027cd0ca0d711e26f7b468fc78fe79c12e56 --- /dev/null +++ b/Utilities/BGL/boost/serialization/binary_object.hpp @@ -0,0 +1,82 @@ +#ifndef BOOST_SERIALIZATION_BINARY_OBJECT_HPP +#define BOOST_SERIALIZATION_BINARY_OBJECT_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// nvp.hpp: interface for serialization system. + +// (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 <cassert> + +#include <cstddef> // std::size_t +#include <boost/config.hpp> +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include <boost/preprocessor/stringize.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/level.hpp> +#include <boost/serialization/split_member.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/wrapper.hpp> + +namespace boost { +namespace serialization { + +struct binary_object : + public wrapper_traits<nvp<const binary_object> > +{ + void const * m_t; + std::size_t m_size; + template<class Archive> + void save(Archive & ar, const unsigned int /* file_version */) const { + ar.save_binary(m_t, m_size); + } + template<class Archive> + void load(Archive & ar, const unsigned int /* file_version */) const { + ar.load_binary(const_cast<void *>(m_t), m_size); + } + BOOST_SERIALIZATION_SPLIT_MEMBER() + binary_object & operator=(const binary_object & rhs) { + m_t = rhs.m_t; + m_size = rhs.m_size; + return *this; + } + binary_object(/* const */ void * const t, std::size_t size) : + m_t(t), + m_size(size) + {} + binary_object(const binary_object & rhs) : + m_t(rhs.m_t), + m_size(rhs.m_size) + {} +}; + +// just a little helper to support the convention that all serialization +// wrappers follow the naming convention make_xxxxx +inline +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +const +#endif +binary_object +make_binary_object(/* const */ void * t, std::size_t size){ + return binary_object(t, size); +} + +} // namespace serialization +} // boost + +#endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP diff --git a/Utilities/BGL/boost/serialization/bitset.hpp b/Utilities/BGL/boost/serialization/bitset.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0e109ce29c7779b72e090c7035c19fae4871c1fd --- /dev/null +++ b/Utilities/BGL/boost/serialization/bitset.hpp @@ -0,0 +1,75 @@ +/*! + * \file bitset.hpp + * \brief Provides Boost.Serialization support for std::bitset + * \author Brian Ravnsgaard Riis + * \author Kenneth Riddile + * \date 16.09.2004, updated 04.03.2009 + * \copyright 2004 Brian Ravnsgaard Riis + * \license Boost Software License 1.0 + */ +#ifndef BOOST_SERIALIZATION_BITSET_HPP +#define BOOST_SERIALIZATION_BITSET_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <bitset> +#include <cstddef> // size_t + +#include <boost/config.hpp> +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/string.hpp> +#include <boost/serialization/nvp.hpp> + +namespace boost{ +namespace serialization{ + +template <class Archive, std::size_t size> +inline void save( + Archive & ar, + std::bitset<size> const & t, + const unsigned int /* version */ +){ + const std::string bits = t.template to_string< + std::string::value_type, + std::string::traits_type, + std::string::allocator_type + >(); + ar << BOOST_SERIALIZATION_NVP( bits ); +} + +template <class Archive, std::size_t size> +inline void load( + Archive & ar, + std::bitset<size> & t, + const unsigned int /* version */ +){ + std::string bits; + ar >> BOOST_SERIALIZATION_NVP( bits ); + t = std::bitset<size>(bits); +} + +template <class Archive, std::size_t size> +inline void serialize( + Archive & ar, + std::bitset<size> & t, + const unsigned int version +){ + boost::serialization::split_free( ar, t, version ); +} + +// don't track bitsets since that would trigger tracking +// all over the program - which probably would be a surprise. +// also, tracking would be hard to implement since, we're +// serialization a representation of the data rather than +// the data itself. +template <std::size_t size> +struct tracking_level<std::bitset<size> > + : mpl::int_<track_never> {} ; + +} //serialization +} //boost + +#endif // BOOST_SERIALIZATION_BITSET_HPP diff --git a/Utilities/BGL/boost/serialization/collection_size_type.hpp b/Utilities/BGL/boost/serialization/collection_size_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b56f4d70f704a4636a4687621cf6d9bb0c902d55 --- /dev/null +++ b/Utilities/BGL/boost/serialization/collection_size_type.hpp @@ -0,0 +1,20 @@ +#ifndef BOOST_SERIALIZATION_COLLECTION_SIZE_TYPE_HPP +#define BOOST_SERIALIZATION_COLLECTION_SIZE_TYPE_HPP + +// (C) Copyright 2005 Matthias Troyer +// 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) + +#include <boost/serialization/strong_typedef.hpp> +#include <boost/serialization/level.hpp> + +namespace boost { namespace serialization { + +BOOST_STRONG_TYPEDEF(std::size_t, collection_size_type) + +} } // end namespace boost::serialization + +BOOST_CLASS_IMPLEMENTATION(boost::serialization::collection_size_type, primitive_type) + +#endif //BOOST_SERIALIZATION_COLLECTION_SIZE_TYPE_HPP diff --git a/Utilities/BGL/boost/serialization/collection_traits.hpp b/Utilities/BGL/boost/serialization/collection_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..568b8074022c899e551163347d58966978d6864b --- /dev/null +++ b/Utilities/BGL/boost/serialization/collection_traits.hpp @@ -0,0 +1,98 @@ +#ifndef BOOST_SERIALIZATION_COLLECTION_TRAITS_HPP +#define BOOST_SERIALIZATION_COLLECTION_TRAITS_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// collection_traits.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. + +// This header assigns a level implemenation trait to a collection type +// for all primitives. It is needed so that archives which are meant to be +// portable don't write class information in the archive. Since, not all +// compiles recognize the same set of primitive types, the possibility +// exists for archives to be non-portable if class information for primitive +// types is included. This is addressed by the following macros. +#include <boost/config.hpp> +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/integral_c_tag.hpp> + +#include <boost/cstdint.hpp> +#include <climits> // ULONG_MAX +#include <boost/serialization/level.hpp> + +#define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(T, C) \ +template<> \ +struct implementation_level< C < T > > { \ + typedef mpl::integral_c_tag tag; \ + typedef mpl::int_<object_serializable> type; \ + BOOST_STATIC_CONSTANT(int, value = object_serializable); \ +}; \ +/**/ + +#if defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_INTRINSIC_WCHAR_T) + #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_WCHAR(C) +#else + #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_WCHAR(C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(wchar_t, C) \ + /**/ +#endif + +// determine if its necessary to handle (u)int64_t specifically +// i.e. that its not a synonym for (unsigned) long +// if there is no 64 bit int or if its the same as a long +// we shouldn't define separate functions for int64 data types. +#if defined(BOOST_NO_INT64_T) + #define BOOST_NO_INTRINSIC_INT64_T +#else + #if defined(ULLONG_MAX) + #if(ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #elif defined(ULONG_MAX) + #if(ULONG_MAX != 0xffffffff && ULONG_MAX == 18446744073709551615ul) // 2**64 - 1 + #define BOOST_NO_INTRINSIC_INT64_T + #endif + #else + #define BOOST_NO_INTRINSIC_INT64_T + #endif +#endif + +#if !defined(BOOST_NO_INTRINSIC_INT64_T) + #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_INT64(C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(boost::int64_t, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(boost::uint64_t, C) \ + /**/ +#else + #define BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_INT64(C) +#endif + +#define BOOST_SERIALIZATION_COLLECTION_TRAITS(C) \ + namespace boost { namespace serialization { \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(bool, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(char, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed char, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned char, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed int, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned int, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed long, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned long, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(float, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(double, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(unsigned short, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER(signed short, C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_INT64(C) \ + BOOST_SERIALIZATION_COLLECTION_TRAITS_HELPER_WCHAR(C) \ + } } \ + /**/ + +#endif // BOOST_SERIALIZATION_COLLECTION_TRAITS diff --git a/Utilities/BGL/boost/serialization/collections_load_imp.hpp b/Utilities/BGL/boost/serialization/collections_load_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4013778c650513f3c88d6f9e7022f40aec7abbf3 --- /dev/null +++ b/Utilities/BGL/boost/serialization/collections_load_imp.hpp @@ -0,0 +1,163 @@ +#ifndef BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP +#define BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1020) +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// collections_load_imp.hpp: serialization for loading stl collections + +// (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. + +// helper function templates for serialization of collections + +#include <cassert> +#include <cstddef> // size_t +#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif +#include <boost/detail/workaround.hpp> + +#include <boost/serialization/access.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/detail/stack_constructor.hpp> +#include <boost/serialization/collection_size_type.hpp> + + +namespace boost{ +namespace serialization { +namespace stl { + +////////////////////////////////////////////////////////////////////// +// implementation of serialization for STL containers +// + +// sequential container input +template<class Archive, class Container> +struct archive_input_seq +{ + inline BOOST_DEDUCED_TYPENAME Container::iterator + operator()( + Archive &ar, + Container &s, + const unsigned int v, + BOOST_DEDUCED_TYPENAME Container::iterator hint + ){ + typedef BOOST_DEDUCED_TYPENAME Container::value_type type; + detail::stack_construct<Archive, type> t(ar, v); + // borland fails silently w/o full namespace + ar >> boost::serialization::make_nvp("item", t.reference()); + s.push_back(t.reference()); + ar.reset_object_address(& s.back() , & t.reference()); + return hint; + } +}; + +// map input +template<class Archive, class Container> +struct archive_input_map +{ + inline BOOST_DEDUCED_TYPENAME Container::iterator + operator()( + Archive &ar, + Container &s, + const unsigned int v, + BOOST_DEDUCED_TYPENAME Container::iterator hint + ){ + typedef BOOST_DEDUCED_TYPENAME Container::value_type type; + detail::stack_construct<Archive, type> t(ar, v); + // borland fails silently w/o full namespace + ar >> boost::serialization::make_nvp("item", t.reference()); + BOOST_DEDUCED_TYPENAME Container::iterator result = + s.insert(hint, t.reference()); + // note: the following presumes that the map::value_type was NOT tracked + // in the archive. This is the usual case, but here there is no way + // to determine that. + ar.reset_object_address( + & (result->second), + & t.reference().second + ); + return result; + } +}; + +// set input +template<class Archive, class Container> +struct archive_input_set +{ + inline BOOST_DEDUCED_TYPENAME Container::iterator + operator()( + Archive &ar, + Container &s, + const unsigned int v, + BOOST_DEDUCED_TYPENAME Container::iterator hint + ){ + typedef BOOST_DEDUCED_TYPENAME Container::value_type type; + detail::stack_construct<Archive, type> t(ar, v); + // borland fails silently w/o full namespace + ar >> boost::serialization::make_nvp("item", t.reference()); + BOOST_DEDUCED_TYPENAME Container::iterator result = + s.insert(hint, t.reference()); + ar.reset_object_address(& (* result), & t.reference()); + return result; + } +}; + +template<class Container> +class reserve_imp +{ +public: + void operator()(Container &s, std::size_t count) const { + s.reserve(count); + } +}; + +template<class Container> +class no_reserve_imp +{ +public: + void operator()(Container & /* s */, std::size_t /* count */) const{} +}; + +template<class Archive, class Container, class InputFunction, class R> +inline void load_collection(Archive & ar, Container &s) +{ + s.clear(); + // retrieve number of elements + collection_size_type count; + unsigned int item_version; + ar >> BOOST_SERIALIZATION_NVP(count); + if(3 < ar.get_library_version()) + ar >> BOOST_SERIALIZATION_NVP(item_version); + else + item_version = 0; + R rx; + rx(s, count); + std::size_t c = count; + InputFunction ifunc; + BOOST_DEDUCED_TYPENAME Container::iterator hint; + hint = s.begin(); + while(c-- > 0){ + hint = ifunc(ar, s, item_version, hint); + } +} + +} // namespace stl +} // namespace serialization +} // namespace boost + +#endif //BOOST_SERIALIZATION_COLLECTIONS_LOAD_IMP_HPP diff --git a/Utilities/BGL/boost/serialization/collections_save_imp.hpp b/Utilities/BGL/boost/serialization/collections_save_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..02f8944c82fd105301c6f9cf6886172aa50869ca --- /dev/null +++ b/Utilities/BGL/boost/serialization/collections_save_imp.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP +#define BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// collections_save_imp.hpp: serialization for stl collections + +// (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. + +// helper function templates for serialization of collections + +#include <boost/config.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/serialization.hpp> +#include <boost/serialization/version.hpp> +#include <boost/serialization/collection_size_type.hpp> + +namespace boost{ +namespace serialization { +namespace stl { + +////////////////////////////////////////////////////////////////////// +// implementation of serialization for STL containers +// + +template<class Archive, class Container> +inline void save_collection(Archive & ar, const Container &s) +{ + // record number of elements + collection_size_type const count(s.size()); + ar << BOOST_SERIALIZATION_NVP(count); + // make sure the target type is registered so we can retrieve + // the version when we load + if(3 < ar.get_library_version()){ + const unsigned int item_version = version< + BOOST_DEDUCED_TYPENAME Container::value_type + >::value; + ar << BOOST_SERIALIZATION_NVP(item_version); + } + BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin(); + collection_size_type c=count; + while(c-- > 0){ + // note borland emits a no-op without the explicit namespace + boost::serialization::save_construct_data_adl( + ar, + &(*it), + boost::serialization::version< + BOOST_DEDUCED_TYPENAME Container::value_type + >::value + ); + ar << boost::serialization::make_nvp("item", *it++); + } +} + +} // namespace stl +} // namespace serialization +} // namespace boost + +#endif //BOOST_SERIALIZATION_COLLECTIONS_SAVE_IMP_HPP diff --git a/Utilities/BGL/boost/serialization/complex.hpp b/Utilities/BGL/boost/serialization/complex.hpp new file mode 100644 index 0000000000000000000000000000000000000000..125766fc07f1279ea0de64d1e134243f02fa21dc --- /dev/null +++ b/Utilities/BGL/boost/serialization/complex.hpp @@ -0,0 +1,81 @@ +#ifndef BOOST_SERIALIZATION_COMPLEX_HPP +#define BOOST_SERIALIZATION_COMPLEX_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// serialization/utility.hpp: +// serialization for stl utility templates + +// (C) Copyright 2007 Matthias Troyer . +// 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 <complex> +#include <boost/config.hpp> + +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/is_bitwise_serializable.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +template<class Archive, class T> +inline void serialize( + Archive & ar, + std::complex<T> & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +template<class Archive, class T> +inline void save( + Archive & ar, + std::complex<T> const & t, + const unsigned int /* file_version */ +){ + const T re = t.real(); + const T im = t.imag(); + ar << boost::serialization::make_nvp("real", re); + ar << boost::serialization::make_nvp("imag", im); +} + +template<class Archive, class T> +inline void load( + Archive & ar, + std::complex<T>& t, + const unsigned int /* file_version */ +){ + T re; + T im; + ar >> boost::serialization::make_nvp("real", re); + ar >> boost::serialization::make_nvp("imag", im); + t = std::complex<T>(re,im); +} + +// specialization of serialization traits for complex +template <class T> +struct is_bitwise_serializable<std::complex<T> > + : public is_bitwise_serializable<T> {}; + +template <class T> +struct implementation_level<std::complex<T> > + : mpl::int_<object_serializable> {} ; + +// treat complex just like builtin arithmetic types for tracking +template <class T> +struct tracking_level<std::complex<T> > + : mpl::int_<track_never> {} ; + +} // serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_COMPLEX_HPP diff --git a/Utilities/BGL/boost/serialization/config.hpp b/Utilities/BGL/boost/serialization/config.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4c4eb683f951189b6885d673e0d8cfd399222ac0 --- /dev/null +++ b/Utilities/BGL/boost/serialization/config.hpp @@ -0,0 +1,82 @@ +// note lack of include guards. This is intentional + +// config.hpp ---------------------------------------------// + +// (c) Copyright Robert Ramey 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) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/preprocessor/facilities/empty.hpp> + +// note: this version incorporates the related code into the the +// the same library as BOOST_ARCHIVE. This could change some day in the +// future + +// if BOOST_SERIALIZATION_DECL is defined undefine it now: +#ifdef BOOST_SERIALIZATION_DECL + #undef BOOST_SERIALIZATION_DECL +#endif + +#ifdef BOOST_HAS_DECLSPEC // defined in config system +// we need to import/export our code only if the user has specifically +// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost +// libraries to be dynamically linked, or BOOST_SERIALIZATION_DYN_LINK +// if they want just this one to be dynamically liked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) + #if !defined(BOOST_DYN_LINK) + #define BOOST_DYN_LINK + #endif + // export if this is our own source, otherwise import: + #if defined(BOOST_SERIALIZATION_SOURCE) + #if defined(__BORLANDC__) + #define BOOST_SERIALIZATION_DECL(T) T __export + #else + #define BOOST_SERIALIZATION_DECL(T) __declspec(dllexport) T + #endif + #else + #if defined(__BORLANDC__) + #define BOOST_SERIALIZATION_DECL(T) T __import + #else + #define BOOST_SERIALIZATION_DECL(T) __declspec(dllimport) T + #endif + #endif // defined(BOOST_SERIALIZATION_SOURCE) +#endif // defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) +#endif // BOOST_HAS_DECLSPEC + +// if BOOST_SERIALIZATION_DECL isn't defined yet define it now: +#ifndef BOOST_SERIALIZATION_DECL + #define BOOST_SERIALIZATION_DECL(T) T +#endif + +// enable automatic library variant selection ------------------------------// + +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \ +&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \ +&& !defined(BOOST_SERIALIZATION_SOURCE) + // + // Set the name of our library, this will get undef'ed by auto_link.hpp + // once it's done with it: + // + #define BOOST_LIB_NAME boost_serialization + // + // If we're importing code from a dll, then tell auto_link.hpp about it: + // + #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) + # define BOOST_DYN_LINK + #endif + // + // And include the header that does the work: + // + #include <boost/config/auto_link.hpp> + +#endif diff --git a/Utilities/BGL/boost/serialization/deque.hpp b/Utilities/BGL/boost/serialization/deque.hpp new file mode 100644 index 0000000000000000000000000000000000000000..340d5feedc23c4e802624f3adefb280f89b9d39d --- /dev/null +++ b/Utilities/BGL/boost/serialization/deque.hpp @@ -0,0 +1,75 @@ +#ifndef BOOST_SERIALIZATION_DEQUE_HPP +#define BOOST_SERIALIZATION_DEQUE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// deque.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 <deque> + +#include <boost/config.hpp> + +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +template<class Archive, class U, class Allocator> +inline void save( + Archive & ar, + const std::deque<U, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::save_collection< + Archive, std::deque<U, Allocator> + >(ar, t); +} + +template<class Archive, class U, class Allocator> +inline void load( + Archive & ar, + std::deque<U, Allocator> &t, + const unsigned int /*file_version*/ +){ + boost::serialization::stl::load_collection< + Archive, + std::deque<U, Allocator>, + boost::serialization::stl::archive_input_seq< + Archive, std::deque<U, Allocator> + >, + boost::serialization::stl::no_reserve_imp<std::deque<U, Allocator> > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class U, class Allocator> +inline void serialize( + Archive & ar, + std::deque<U, Allocator> &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(std::deque) + +#endif // BOOST_SERIALIZATION_DEQUE_HPP diff --git a/Utilities/BGL/boost/serialization/detail/get_data.hpp b/Utilities/BGL/boost/serialization/detail/get_data.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0e9c190295cfbdcbb085c1d517f7f3658f4fc3c3 --- /dev/null +++ b/Utilities/BGL/boost/serialization/detail/get_data.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2005 Matthias Troyer +// 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. + +#ifndef BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP +#define BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +#define STD _STLP_STD +#else +#define STD std +#endif + + +#include <vector> +#include <valarray> + +namespace boost { namespace serialization { namespace detail { + +template <class T, class Allocator> +T* get_data(STD::vector<T,Allocator>& v) +{ + return v.empty() ? 0 : &(v[0]); +} + +template <class T, class Allocator> +T* get_data(STD::vector<T,Allocator> const & v) +{ + return get_data(const_cast<STD::vector<T,Allocator>&>(v)); +} + + +template <class T> +T* get_data(STD::valarray<T>& v) +{ + return v.size()==0 ? 0 : &(v[0]); +} + +template <class T> +const T* get_data(STD::valarray<T> const& v) +{ + return get_data(const_cast<STD::valarray<T>&>(v)); +} + +} } } //namespace boost::serialization::detail + +#endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP diff --git a/Utilities/BGL/boost/serialization/detail/shared_count_132.hpp b/Utilities/BGL/boost/serialization/detail/shared_count_132.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0665e8749d7e896c9d05a3da9f5dfe8a1911635a --- /dev/null +++ b/Utilities/BGL/boost/serialization/detail/shared_count_132.hpp @@ -0,0 +1,569 @@ +#ifndef BOOST_DETAIL_SHARED_COUNT_132_HPP_INCLUDED +#define BOOST_DETAIL_SHARED_COUNT_132_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/shared_count.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/config.hpp> + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) +# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. +#endif + +#include <boost/checked_delete.hpp> +#include <boost/serialization/throw_exception.hpp> +#include <boost/detail/lightweight_mutex.hpp> + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) +#include <boost/detail/quick_allocator.hpp> +#endif + +#include <memory> // std::auto_ptr, std::allocator +#include <functional> // std::less +#include <exception> // std::exception +#include <new> // std::bad_alloc +#include <typeinfo> // std::type_info in get_deleter +#include <cstddef> // std::size_t + +#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifdef __BORLANDC__ +# pragma warn -8026 // Functions with excep. spec. are not expanded inline +# pragma warn -8027 // Functions containing try are not expanded inline +#endif + +namespace boost_132 { + +// Debug hooks + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_scalar_constructor_hook(void * px, std::size_t size, void * pn); +void sp_array_constructor_hook(void * px); +void sp_scalar_destructor_hook(void * px, std::size_t size, void * pn); +void sp_array_destructor_hook(void * px); + +#endif + + +// The standard library that comes with Borland C++ 5.5.1 +// defines std::exception and its members as having C calling +// convention (-pc). When the definition of bad_weak_ptr +// is compiled with -ps, the compiler issues an error. +// Hence, the temporary #pragma option -pc below. The version +// check is deliberately conservative. + +#if defined(__BORLANDC__) && __BORLANDC__ == 0x551 +# pragma option push -pc +#endif + +class bad_weak_ptr: public std::exception +{ +public: + + virtual char const * what() const throw() + { + return "boost::bad_weak_ptr"; + } +}; + +#if defined(__BORLANDC__) && __BORLANDC__ == 0x551 +# pragma option pop +#endif + +namespace detail{ + +class sp_counted_base +{ +//private: + + typedef boost::detail::lightweight_mutex mutex_type; + +public: + + sp_counted_base(): use_count_(1), weak_count_(1) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destruct() is called when weak_count_ drops to zero. + + virtual void destruct() // nothrow + { + delete this; + } + + virtual void * get_deleter(std::type_info const & ti) = 0; + + void add_ref_copy() + { +#if defined(BOOST_HAS_THREADS) + mutex_type::scoped_lock lock(mtx_); +#endif + ++use_count_; + } + + void add_ref_lock() + { +#if defined(BOOST_HAS_THREADS) + mutex_type::scoped_lock lock(mtx_); +#endif + if(use_count_ == 0) boost::serialization::throw_exception(bad_weak_ptr()); + ++use_count_; + } + + void release() // nothrow + { + { +#if defined(BOOST_HAS_THREADS) + mutex_type::scoped_lock lock(mtx_); +#endif + long new_use_count = --use_count_; + + if(new_use_count != 0) return; + } + + dispose(); + weak_release(); + } + + void weak_add_ref() // nothrow + { +#if defined(BOOST_HAS_THREADS) + mutex_type::scoped_lock lock(mtx_); +#endif + ++weak_count_; + } + + void weak_release() // nothrow + { + long new_weak_count; + + { +#if defined(BOOST_HAS_THREADS) + mutex_type::scoped_lock lock(mtx_); +#endif + new_weak_count = --weak_count_; + } + + if(new_weak_count == 0) + { + destruct(); + } + } + + long use_count() const // nothrow + { +#if defined(BOOST_HAS_THREADS) + mutex_type::scoped_lock lock(mtx_); +#endif + return use_count_; + } + +//private: +public: + sp_counted_base(sp_counted_base const &); + sp_counted_base & operator= (sp_counted_base const &); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +#if defined(BOOST_HAS_THREADS) || defined(BOOST_LWM_WIN32) + mutable mutex_type mtx_; +#endif +}; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +template<class T> void cbi_call_constructor_hook(sp_counted_base * pn, T * px, checked_deleter<T> const &, int) +{ + boost::sp_scalar_constructor_hook(px, sizeof(T), pn); +} + +template<class T> void cbi_call_constructor_hook(sp_counted_base *, T * px, checked_array_deleter<T> const &, int) +{ + boost::sp_array_constructor_hook(px); +} + +template<class P, class D> void cbi_call_constructor_hook(sp_counted_base *, P const &, D const &, long) +{ +} + +template<class T> void cbi_call_destructor_hook(sp_counted_base * pn, T * px, checked_deleter<T> const &, int) +{ + boost::sp_scalar_destructor_hook(px, sizeof(T), pn); +} + +template<class T> void cbi_call_destructor_hook(sp_counted_base *, T * px, checked_array_deleter<T> const &, int) +{ + boost::sp_array_destructor_hook(px); +} + +template<class P, class D> void cbi_call_destructor_hook(sp_counted_base *, P const &, D const &, long) +{ +} + +#endif + +// +// Borland's Codeguard trips up over the -Vx- option here: +// +#ifdef __CODEGUARD__ +# pragma option push -Vx- +#endif + +template<class P, class D> class sp_counted_base_impl: public sp_counted_base +{ +//private: +public: + P ptr; // copy constructor must not throw + D del; // copy constructor must not throw + + sp_counted_base_impl(sp_counted_base_impl const &); + sp_counted_base_impl & operator= (sp_counted_base_impl const &); + + typedef sp_counted_base_impl<P, D> this_type; + +public: + + // pre: initial_use_count <= initial_weak_count, d(p) must not throw + + sp_counted_base_impl(P p, D d): ptr(p), del(d) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + detail::cbi_call_constructor_hook(this, p, d, 0); +#endif + } + + virtual void dispose() // nothrow + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + detail::cbi_call_destructor_hook(this, ptr, del, 0); +#endif + del(ptr); + } + + virtual void * get_deleter(std::type_info const & ti) + { + return ti == typeid(D)? &del: 0; + } + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) + + void * operator new(std::size_t) + { + return std::allocator<this_type>().allocate(1, static_cast<this_type *>(0)); + } + + void operator delete(void * p) + { + std::allocator<this_type>().deallocate(static_cast<this_type *>(p), 1); + } + +#endif + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) + + void * operator new(std::size_t) + { + return boost::detail::quick_allocator<this_type>::alloc(); + } + + void operator delete(void * p) + { + boost::detail::quick_allocator<this_type>::dealloc(p); + } + +#endif +}; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +int const shared_count_id = 0x2C35F101; +int const weak_count_id = 0x298C38A4; + +#endif + +class weak_count; + +class shared_count +{ +//private: +public: + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class weak_count; + +public: + + shared_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + } + + template<class P, class D> shared_count(P p, D d): pi_(0) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_base_impl<P, D>(p, d); + } + catch(...) + { + d(p); // delete p + throw; + } + +#else + + pi_ = new sp_counted_base_impl<P, D>(p, d); + + if(pi_ == 0) + { + d(p); // delete p + boost::serialization::throw_exception(std::bad_alloc()); + } + +#endif + } + +#ifndef BOOST_NO_AUTO_PTR + + // auto_ptr<Y> is special cased to provide the strong guarantee + + template<class Y> + explicit shared_count(std::auto_ptr<Y> & r): pi_( + new sp_counted_base_impl< + Y *, + boost::checked_deleter<Y> + >(r.get(), boost::checked_deleter<Y>())) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + r.release(); + } + +#endif + + ~shared_count() // nothrow + { + if(pi_ != 0) pi_->release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + shared_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if(pi_ != 0) pi_->add_ref_copy(); + } + + explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 + + shared_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if(tmp != pi_) + { + if(tmp != 0) tmp->add_ref_copy(); + if(pi_ != 0) pi_->release(); + pi_ = tmp; + } + + return *this; + } + + void swap(shared_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + bool unique() const // nothrow + { + return use_count() == 1; + } + + friend inline bool operator==(shared_count const & a, shared_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(shared_count const & a, shared_count const & b) + { + return std::less<sp_counted_base *>()(a.pi_, b.pi_); + } + + void * get_deleter(std::type_info const & ti) const + { + return pi_? pi_->get_deleter(ti): 0; + } +}; + +#ifdef __CODEGUARD__ +# pragma option pop +#endif + + +class weak_count +{ +private: + + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class shared_count; + +public: + + weak_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + } + + weak_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + weak_count(weak_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + ~weak_count() // nothrow + { + if(pi_ != 0) pi_->weak_release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + weak_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + + return *this; + } + + weak_count & operator= (weak_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + + return *this; + } + + void swap(weak_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + friend inline bool operator==(weak_count const & a, weak_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(weak_count const & a, weak_count const & b) + { + return std::less<sp_counted_base *>()(a.pi_, b.pi_); + } +}; + +inline shared_count::shared_count(weak_count const & r): pi_(r.pi_) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if(pi_ != 0) + { + pi_->add_ref_lock(); + } + else + { + boost::serialization::throw_exception(bad_weak_ptr()); + } +} + +} // namespace detail + +} // namespace boost + +BOOST_SERIALIZATION_ASSUME_ABSTRACT(boost_132::detail::sp_counted_base) + +#ifdef __BORLANDC__ +# pragma warn .8027 // Functions containing try are not expanded inline +# pragma warn .8026 // Functions with excep. spec. are not expanded inline +#endif + +#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/serialization/detail/shared_ptr_132.hpp b/Utilities/BGL/boost/serialization/detail/shared_ptr_132.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bd5355d0caa9e9a4cac6512016df2892ae7e07e3 --- /dev/null +++ b/Utilities/BGL/boost/serialization/detail/shared_ptr_132.hpp @@ -0,0 +1,478 @@ +#ifndef BOOST_SHARED_PTR_132_HPP_INCLUDED +#define BOOST_SHARED_PTR_132_HPP_INCLUDED + +// +// shared_ptr.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002, 2003 Peter Dimov +// +// 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/smart_ptr/shared_ptr.htm for documentation. +// + +#include <boost/config.hpp> // for broken compiler workarounds + +#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) +#include <boost/serialization/detail/shared_ptr_nmt_132.hpp> +#else + +#include <boost/assert.hpp> +#include <boost/checked_delete.hpp> +#include <boost/serialization/throw_exception.hpp> +#include <boost/detail/workaround.hpp> + +#include <boost/serialization/access.hpp> +#include <boost/serialization/detail/shared_count_132.hpp> + +#include <memory> // for std::auto_ptr +#include <algorithm> // for std::swap +#include <functional> // for std::less +#include <typeinfo> // for std::bad_cast +#include <iosfwd> // for std::basic_ostream + +#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash +# pragma warning(push) +# pragma warning(disable:4284) // odd return type for operator-> +#endif + +namespace boost_132 { + +template<class T> class weak_ptr; +template<class T> class enable_shared_from_this; + +namespace detail +{ + +struct static_cast_tag {}; +struct const_cast_tag {}; +struct dynamic_cast_tag {}; +struct polymorphic_cast_tag {}; + +template<class T> struct shared_ptr_traits +{ + typedef T & reference; +}; + +template<> struct shared_ptr_traits<void> +{ + typedef void reference; +}; + +#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) + +template<> struct shared_ptr_traits<void const> +{ + typedef void reference; +}; + +template<> struct shared_ptr_traits<void volatile> +{ + typedef void reference; +}; + +template<> struct shared_ptr_traits<void const volatile> +{ + typedef void reference; +}; + +#endif + +// enable_shared_from_this support + +template<class T, class Y> void sp_enable_shared_from_this( shared_count const & pn, enable_shared_from_this<T> const * pe, Y const * px ) +{ + if(pe != 0) pe->_internal_weak_this._internal_assign(const_cast<Y*>(px), pn); +} + +inline void sp_enable_shared_from_this( shared_count const & /*pn*/, ... ) +{ +} + +} // namespace detail + + +// +// shared_ptr +// +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. +// + +template<class T> class shared_ptr +{ +private: + // Borland 5.5.1 specific workaround + typedef shared_ptr<T> this_type; + +public: + + typedef T element_type; + typedef T value_type; + typedef T * pointer; + typedef BOOST_DEDUCED_TYPENAME detail::shared_ptr_traits<T>::reference reference; + + shared_ptr(): px(0), pn() // never throws in 1.30+ + { + } + +#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x564) ) + template<class Y> + explicit shared_ptr(Y * p): px(p), pn(p, boost::checked_deleter<Y>()) // Y must be complete +#else + template<class Y> + explicit shared_ptr(Y * p): px(p), pn(p, boost::checked_deleter<Y>()) // Y must be complete +#endif + { + detail::sp_enable_shared_from_this( pn, p, p ); + } + + // + // Requirements: D's copy constructor must not throw + // + // shared_ptr will release p by calling d(p) + // + + template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d) + { + detail::sp_enable_shared_from_this( pn, p, p ); + } + +// generated copy constructor, assignment, destructor are fine... + +// except that Borland C++ has a bug, and g++ with -Wsynth warns +#if defined(__BORLANDC__) || defined(__GNUC__) + + shared_ptr & operator=(shared_ptr const & r) // never throws + { + px = r.px; + pn = r.pn; // shared_count::op= doesn't throw + return *this; + } + +#endif + + template<class Y> + explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw + { + // it is now safe to copy r.px, as pn(r.pn) did not throw + px = r.px; + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws + { + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn) + { + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn) + { + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) + { + if(px == 0) // need to allocate new counter -- the cast failed + { + pn = detail::shared_count(); + } + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) + { + if(px == 0) + { + boost::serialization::throw_exception(std::bad_cast()); + } + } + +#ifndef BOOST_NO_AUTO_PTR + + template<class Y> + explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn() + { + Y * tmp = r.get(); + pn = detail::shared_count(r); + detail::sp_enable_shared_from_this( pn, tmp, tmp ); + } + +#endif + +#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) + + template<class Y> + shared_ptr & operator=(shared_ptr<Y> const & r) // never throws + { + px = r.px; + pn = r.pn; // shared_count::op= doesn't throw + return *this; + } + +#endif + +#ifndef BOOST_NO_AUTO_PTR + + template<class Y> + shared_ptr & operator=(std::auto_ptr<Y> & r) + { + this_type(r).swap(*this); + return *this; + } + +#endif + + void reset() // never throws in 1.30+ + { + this_type().swap(*this); + } + + template<class Y> void reset(Y * p) // Y must be complete + { + BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors + this_type(p).swap(*this); + } + + template<class Y, class D> void reset(Y * p, D d) + { + this_type(p, d).swap(*this); + } + + reference operator* () const // never throws + { + BOOST_ASSERT(px != 0); + return *px; + } + + T * operator-> () const // never throws + { + BOOST_ASSERT(px != 0); + return px; + } + + T * get() const // never throws + { + return px; + } + + // implicit conversion to "bool" + +#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530) + + operator bool () const + { + return px != 0; + } + +#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::get; + } + +#else + + typedef T * this_type::*unspecified_bool_type; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::px; + } + +#endif + + // operator! is redundant, but some compilers need it + + bool operator! () const // never throws + { + return px == 0; + } + + bool unique() const // never throws + { + return pn.unique(); + } + + long use_count() const // never throws + { + return pn.use_count(); + } + + void swap(shared_ptr<T> & other) // never throws + { + std::swap(px, other.px); + pn.swap(other.pn); + } + + template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const + { + return pn < rhs.pn; + } + + void * _internal_get_deleter(std::type_info const & ti) const + { + return pn.get_deleter(ti); + } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + +private: + + template<class Y> friend class shared_ptr; + template<class Y> friend class weak_ptr; + + +#endif +public: // for serialization + T * px; // contained pointer + detail::shared_count pn; // reference counter + +}; // shared_ptr + +template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a.get() == b.get(); +} + +template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a.get() != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b) +{ + return a.get() != b.get(); +} + +#endif + +template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a._internal_less(b); +} + +template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) +{ + a.swap(b); +} + +template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, detail::static_cast_tag()); +} + +template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, detail::const_cast_tag()); +} + +template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, detail::dynamic_cast_tag()); +} + +// shared_*_cast names are deprecated. Use *_pointer_cast instead. + +template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, detail::static_cast_tag()); +} + +template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, detail::dynamic_cast_tag()); +} + +template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, detail::polymorphic_cast_tag()); +} + +template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r) +{ + BOOST_ASSERT(dynamic_cast<T *>(r.get()) == r.get()); + return shared_static_cast<T>(r); +} + +// get_pointer() enables boost::mem_fn to recognize shared_ptr + +template<class T> inline T * get_pointer(shared_ptr<T> const & p) +{ + return p.get(); +} + +// operator<< + +#if defined(__GNUC__) && (__GNUC__ < 3) + +template<class Y> std::ostream & operator<< (std::ostream & os, shared_ptr<Y> const & p) +{ + os << p.get(); + return os; +} + +#else + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT) +// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL +using std::basic_ostream; +template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared_ptr<Y> const & p) +# else +template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p) +# endif +{ + os << p.get(); + return os; +} + +#endif + +// get_deleter (experimental) + +#if (defined(__GNUC__) && (__GNUC__ < 3)) || (defined(__EDG_VERSION__) && (__EDG_VERSION__ <= 238)) + +// g++ 2.9x doesn't allow static_cast<X const *>(void *) +// apparently EDG 2.38 also doesn't accept it + +template<class D, class T> D * get_deleter(shared_ptr<T> const & p) +{ + void const * q = p._internal_get_deleter(typeid(D)); + return const_cast<D *>(static_cast<D const *>(q)); +} + +#else + +template<class D, class T> D * get_deleter(shared_ptr<T> const & p) +{ + return static_cast<D *>(p._internal_get_deleter(typeid(D))); +} + +#endif + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) + +#endif // #ifndef BOOST_SHARED_PTR_132_HPP_INCLUDED diff --git a/Utilities/BGL/boost/serialization/detail/shared_ptr_nmt_132.hpp b/Utilities/BGL/boost/serialization/detail/shared_ptr_nmt_132.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c73e98128e71c6d3027e6aebef725b62f3061f80 --- /dev/null +++ b/Utilities/BGL/boost/serialization/detail/shared_ptr_nmt_132.hpp @@ -0,0 +1,182 @@ +#ifndef BOOST_DETAIL_SHARED_PTR_NMT_132_HPP_INCLUDED +#define BOOST_DETAIL_SHARED_PTR_NMT_132_HPP_INCLUDED + +// +// detail/shared_ptr_nmt.hpp - shared_ptr.hpp without member templates +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// 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/smart_ptr/shared_ptr.htm for documentation. +// + +#include <boost/assert.hpp> +#include <boost/checked_delete.hpp> +#include <boost/serialization/throw_exception.hpp> +#include <boost/detail/atomic_count.hpp> + +#ifndef BOOST_NO_AUTO_PTR +# include <memory> // for std::auto_ptr +#endif + +#include <algorithm> // for std::swap +#include <functional> // for std::less +#include <new> // for std::bad_alloc + +namespace boost +{ + +template<class T> class shared_ptr +{ +private: + + typedef detail::atomic_count count_type; + +public: + + typedef T element_type; + typedef T value_type; + + explicit shared_ptr(T * p = 0): px(p) + { +#ifndef BOOST_NO_EXCEPTIONS + + try // prevent leak if new throws + { + pn = new count_type(1); + } + catch(...) + { + boost::checked_delete(p); + throw; + } + +#else + + pn = new count_type(1); + + if(pn == 0) + { + boost::checked_delete(p); + boost::serialization::throw_exception(std::bad_alloc()); + } + +#endif + } + + ~shared_ptr() + { + if(--*pn == 0) + { + boost::checked_delete(px); + delete pn; + } + } + + shared_ptr(shared_ptr const & r): px(r.px) // never throws + { + pn = r.pn; + ++*pn; + } + + shared_ptr & operator=(shared_ptr const & r) + { + shared_ptr(r).swap(*this); + return *this; + } + +#ifndef BOOST_NO_AUTO_PTR + + explicit shared_ptr(std::auto_ptr<T> & r) + { + pn = new count_type(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } + + shared_ptr & operator=(std::auto_ptr<T> & r) + { + shared_ptr(r).swap(*this); + return *this; + } + +#endif + + void reset(T * p = 0) + { + BOOST_ASSERT(p == 0 || p != px); + shared_ptr(p).swap(*this); + } + + T & operator*() const // never throws + { + BOOST_ASSERT(px != 0); + return *px; + } + + T * operator->() const // never throws + { + BOOST_ASSERT(px != 0); + return px; + } + + T * get() const // never throws + { + return px; + } + + long use_count() const // never throws + { + return *pn; + } + + bool unique() const // never throws + { + return *pn == 1; + } + + void swap(shared_ptr<T> & other) // never throws + { + std::swap(px, other.px); + std::swap(pn, other.pn); + } + +private: + + T * px; // contained pointer + count_type * pn; // ptr to reference counter +}; + +template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a.get() == b.get(); +} + +template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a.get() != b.get(); +} + +template<class T> inline bool operator<(shared_ptr<T> const & a, shared_ptr<T> const & b) +{ + return std::less<T*>()(a.get(), b.get()); +} + +template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b) +{ + a.swap(b); +} + +// get_pointer() enables boost::mem_fn to recognize shared_ptr + +template<class T> inline T * get_pointer(shared_ptr<T> const & p) +{ + return p.get(); +} + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SHARED_PTR_NMT_132_HPP_INCLUDED diff --git a/Utilities/BGL/boost/serialization/detail/stack_constructor.hpp b/Utilities/BGL/boost/serialization/detail/stack_constructor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..de623b0d4f7ae69e61fbea1a2e915d00105950ac --- /dev/null +++ b/Utilities/BGL/boost/serialization/detail/stack_constructor.hpp @@ -0,0 +1,73 @@ +#ifndef BOOST_SERIALIZATION_DETAIL_STACH_CONSTRUCTOR_HPP +#define BOOST_SERIALIZATION_DETAIL_STACH_CONSTRUCTOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1020) +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// collections_load_imp.hpp: serialization for loading stl collections + +// (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/aligned_storage.hpp> + +namespace boost{ +namespace serialization { +namespace detail { + +// reserve space on stack for an object of type T without actually +// construction such an object +template<typename T > +struct stack_allocate +{ + T * address() { + return static_cast<T*>(storage_.address()); + } + T & reference() { + return * address(); + } +private: + typedef BOOST_DEDUCED_TYPENAME boost::aligned_storage< + sizeof(T), + #if BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x560)) + 8 + #else + boost::alignment_of<T>::value + #endif + > type; + type storage_; +}; + +// construct element on the stack +template<class Archive, class T> +struct stack_construct : public stack_allocate<T> +{ + stack_construct(Archive & ar, const unsigned int version){ + // note borland emits a no-op without the explicit namespace + boost::serialization::load_construct_data_adl( + ar, + this->address(), + version + ); + } + ~stack_construct(){ + this->address()->~T(); // undo load_construct_data above + } +}; + +} // detail +} // serializaition +} // boost + +#endif // BOOST_SERIALIZATION_DETAIL_STACH_CONSTRUCTOR_HPP diff --git a/Utilities/BGL/boost/serialization/ephemeral.hpp b/Utilities/BGL/boost/serialization/ephemeral.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f559bec99f5bb8051807537361edd0e3ba908b52 --- /dev/null +++ b/Utilities/BGL/boost/serialization/ephemeral.hpp @@ -0,0 +1,80 @@ +#ifndef BOOST_SERIALIZATION_EPHEMERAL_HPP +#define BOOST_SERIALIZATION_EPHEMERAL_HPP + +// MS compatible compilers support +#pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// ephemeral_object.hpp: interface for serialization system. + +// (C) Copyright 2007 Matthias Troyer. +// 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 <utility> + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +// supress noise +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/integral_c_tag.hpp> + +#include <boost/serialization/level.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/split_member.hpp> +#include <boost/serialization/base_object.hpp> +#include <boost/serialization/traits.hpp> +#include <boost/serialization/wrapper.hpp> + +namespace boost { +namespace serialization { + +template<class T> +struct ephemeral_object : + public wrapper_traits<ephemeral_object<T> > +{ + explicit ephemeral_object(T& t) : + val(t) + {} + + T & value() const { + return val; + } + + const T & const_value() const { + return val; + } + + template<class Archive> + void serialize(Archive &ar, const unsigned int) const + { + ar & val; + } + +private: + T & val; +}; + +template<class T> +inline +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +const +#endif +ephemeral_object<T> ephemeral(const char * name, T & t){ + return ephemeral_object<T>(name, t); +} + +} // seralization +} // boost + +#endif // BOOST_SERIALIZATION_EPHEMERAL_HPP diff --git a/Utilities/BGL/boost/serialization/export.hpp b/Utilities/BGL/boost/serialization/export.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d1637007eb2544f76d3a2c7366c2f31a2bbfbc07 --- /dev/null +++ b/Utilities/BGL/boost/serialization/export.hpp @@ -0,0 +1,229 @@ +#ifndef BOOST_SERIALIZATION_EXPORT_HPP +#define BOOST_SERIALIZATION_EXPORT_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// export.hpp: set traits of classes to be serialized + +// (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. + +// (C) Copyright 2006 David Abrahams - http://www.boost.org. +// implementation of class export functionality. This is an alternative to +// "forward declaration" method to provoke instantiation of derived classes +// that are to be serialized through pointers. + +#include <utility> +#include <cstddef> // NULL + +#include <boost/config.hpp> +#include <boost/static_assert.hpp> +#include <boost/preprocessor/stringize.hpp> +#include <boost/type_traits/is_polymorphic.hpp> + +#include <boost/mpl/assert.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/bool.hpp> + +#include <boost/serialization/static_warning.hpp> +#include <boost/serialization/assume_abstract.hpp> +#include <boost/serialization/force_include.hpp> +#include <boost/serialization/singleton.hpp> + +#include <boost/archive/detail/register_archive.hpp> + +#include <iostream> + +namespace boost { +namespace archive { +namespace detail { + +class basic_pointer_iserializer; +class basic_pointer_oserializer; + +template<class Archive, class T> +class pointer_iserializer; +template<class Archive, class T> +class pointer_oserializer; + +template <class Archive, class Serializable> +struct export_impl +{ + static const basic_pointer_iserializer & + enable_load(mpl::true_){ + return boost::serialization::singleton< + pointer_iserializer<Archive, Serializable> + >::get_const_instance(); + } + + static const basic_pointer_oserializer & + enable_save(mpl::true_){ + return boost::serialization::singleton< + pointer_oserializer<Archive, Serializable> + >::get_const_instance(); + } + inline static void enable_load(mpl::false_) {} + inline static void enable_save(mpl::false_) {} +}; + +// On many platforms, naming a specialization of this template is +// enough to cause its argument to be instantiated. +template <void(*)()> +struct instantiate_function {}; + +template <class Archive, class Serializable> +struct ptr_serialization_support +{ +# if defined(BOOST_MSVC) || defined(__SUNPRO_CC) + virtual BOOST_DLLEXPORT void instantiate() BOOST_USED; +# elif defined(__BORLANDC__) + static BOOST_DLLEXPORT void instantiate() BOOST_USED; + enum { x = sizeof(instantiate(),3) }; +# else + static BOOST_DLLEXPORT void instantiate() BOOST_USED; + typedef instantiate_function< + &ptr_serialization_support::instantiate + > x; +# endif +}; + +template <class Archive, class Serializable> +BOOST_DLLEXPORT void +ptr_serialization_support<Archive,Serializable>::instantiate() +{ + export_impl<Archive,Serializable>::enable_save( + #if ! defined(__BORLANDC__) + BOOST_DEDUCED_TYPENAME + #endif + Archive::is_saving() + ); + + export_impl<Archive,Serializable>::enable_load( + #if ! defined(__BORLANDC__) + BOOST_DEDUCED_TYPENAME + #endif + Archive::is_loading() + ); +} + +namespace { + +template<class T> +struct guid_initializer +{ + void export_guid(mpl::false_) const { + // generates the statically-initialized objects whose constructors + // register the information allowing serialization of T objects + // through pointers to their base classes. + instantiate_ptr_serialization((T*)0, 0, adl_tag()); + } + const void export_guid(mpl::true_) const { + } + guid_initializer const & export_guid() const { + BOOST_STATIC_WARNING(boost::is_polymorphic<T>::value); + // note: exporting an abstract base class will have no effect + // and cannot be used to instantitiate serialization code + // (one might be using this in a DLL to instantiate code) + //BOOST_STATIC_WARNING(! boost::serialization::is_abstract<T>::value); + export_guid(boost::serialization::is_abstract<T>()); + return *this; + } +}; + +template<typename T> +struct init_guid; + +} // anonymous +} // namespace detail +} // namespace archive +} // namespace boost + +#define BOOST_CLASS_EXPORT_IMPLEMENT(T) \ + namespace boost { \ + namespace archive { \ + namespace detail { \ + namespace { \ + template<> \ + struct init_guid< T > { \ + static guid_initializer< T > const & g; \ + }; \ + guid_initializer< T > const & init_guid< T >::g = \ + ::boost::serialization::singleton< \ + guid_initializer< T > \ + >::get_mutable_instance().export_guid(); \ + }}}} \ +/**/ + +#define BOOST_CLASS_EXPORT_KEY2(T, K) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct guid_defined<T> : boost::mpl::true_ {}; \ +template<> \ +inline const char * guid<T>(){ \ + return K; \ +} \ +} /* serialization */ \ +} /* boost */ \ +/**/ + +#define BOOST_CLASS_EXPORT_KEY(T) \ + BOOST_CLASS_EXPORT_KEY2(T, BOOST_PP_STRINGIZE(T)) \ +/**/ + +#define BOOST_CLASS_EXPORT_GUID(T, K) \ +BOOST_CLASS_EXPORT_KEY2(T, K) \ +BOOST_CLASS_EXPORT_IMPLEMENT(T) \ +/**/ + +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + +// CodeWarrior fails to construct static members of class templates +// when they are instantiated from within templates, so on that +// compiler we ask users to specifically register base/derived class +// relationships for exported classes. On all other compilers, use of +// this macro is entirely optional. +# define BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(Base,Derived) \ +namespace { \ + static int BOOST_PP_CAT(boost_serialization_mwerks_init_, __LINE__) = \ + (::boost::archive::detail::instantiate_ptr_serialization((Derived*)0,0), 3); \ + static int BOOST_PP_CAT(boost_serialization_mwerks_init2_, __LINE__) = ( \ + ::boost::serialization::void_cast_register((Derived*)0,(Base*)0) \ + , 3); \ +} + +#else + +# define BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(Base,Derived) + +#endif + +// check for unnecessary export. T isn't polymorphic so there is no +// need to export it. +#define BOOST_CLASS_EXPORT_CHECK(T) \ + BOOST_STATIC_WARNING( \ + boost::is_polymorphic<U>::value \ + ); \ + /**/ + +// the default exportable class identifier is the class name +// the default list of archives types for which code id generated +// are the originally included with this serialization system +#define BOOST_CLASS_EXPORT(T) \ + BOOST_CLASS_EXPORT_GUID( \ + T, \ + BOOST_PP_STRINGIZE(T) \ + ) \ + /**/ + +#endif // BOOST_SERIALIZATION_EXPORT_HPP + diff --git a/Utilities/BGL/boost/serialization/extended_type_info.hpp b/Utilities/BGL/boost/serialization/extended_type_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4799432885fe6df13ee5bb490e014cb311a98187 --- /dev/null +++ b/Utilities/BGL/boost/serialization/extended_type_info.hpp @@ -0,0 +1,105 @@ +#ifndef BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP +#define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// extended_type_info.hpp: interface for portable version of type_info + +// (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. + +// for now, extended type info is part of the serialization libraries +// this could change in the future. +#include <cstdarg> +#include <cassert> +#include <cstddef> // NULL +#include <boost/config.hpp> +#include <boost/noncopyable.hpp> +#include <boost/serialization/config.hpp> +#include <boost/mpl/bool.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last header +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275) +#endif + +#define BOOST_SERIALIZATION_MAX_KEY_SIZE 128 + +namespace boost { +namespace serialization { + +namespace void_cast_detail{ + class void_caster; +} + +class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info : + private boost::noncopyable +{ +private: + friend class boost::serialization::void_cast_detail::void_caster; + + // used to uniquely identify the type of class derived from this one + // so that different derivations of this class can be simultaneously + // included in implementation of sets and maps. + const unsigned int m_type_info_key; + virtual bool is_less_than(const extended_type_info & /*rhs*/) const = 0; + virtual bool is_equal(const extended_type_info & /*rhs*/) const = 0; + const char * m_key; + +protected: + void key_unregister() const; + void key_register() const; + // this class can't be used as is. It's just the + // common functionality for all type_info replacement + // systems. Hence, make these protected + extended_type_info( + const unsigned int type_info_key, + const char * key + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~extended_type_info(); +public: + const char * get_key() const { + return m_key; + } + virtual const char * get_debug_info() const = 0; + bool operator<(const extended_type_info &rhs) const; + bool operator==(const extended_type_info &rhs) const; + bool operator!=(const extended_type_info &rhs) const { + return !(operator==(rhs)); + } + static const extended_type_info * find(const char *key); + // for plugins + virtual void * construct(unsigned int /*count*/ = 0, ...) const = 0; + virtual void destroy(void const * const /*p*/) const = 0; +}; + +template<class T> +struct guid_defined : boost::mpl::false_ {}; +template<class T> +inline const char * guid(){ + return NULL; +} + +} // namespace serialization +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP diff --git a/Utilities/BGL/boost/serialization/extended_type_info_no_rtti.hpp b/Utilities/BGL/boost/serialization/extended_type_info_no_rtti.hpp new file mode 100644 index 0000000000000000000000000000000000000000..46a756e7b5f815c36148c403445e3344eaea5305 --- /dev/null +++ b/Utilities/BGL/boost/serialization/extended_type_info_no_rtti.hpp @@ -0,0 +1,180 @@ +#ifndef BOOST_EXTENDED_TYPE_INFO_NO_RTTI_HPP +#define BOOST_EXTENDED_TYPE_INFO_NO_RTTI_HPP + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// extended_type_info_no_rtti.hpp: implementation for version that depends +// on runtime typing (rtti - typeid) but uses a user specified string +// as the portable class identifier. + +// (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 <cassert> + +#include <boost/config.hpp> +#include <boost/static_assert.hpp> + +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_polymorphic.hpp> + +#include <boost/serialization/static_warning.hpp> +#include <boost/serialization/singleton.hpp> +#include <boost/serialization/extended_type_info.hpp> +#include <boost/serialization/factory.hpp> +#include <boost/serialization/throw_exception.hpp> + +// hijack serialization access +#include <boost/serialization/access.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last header +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275 4511 4512) +#endif + +namespace boost { +namespace serialization { +/////////////////////////////////////////////////////////////////////// +// define a special type_info that doesn't depend on rtti which is not +// available in all situations. + +namespace no_rtti_system { + +// common base class to share type_info_key. This is used to +// identify the method used to keep track of the extended type +class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info_no_rtti_0 : + public extended_type_info +{ +protected: + extended_type_info_no_rtti_0(const char * key); + ~extended_type_info_no_rtti_0(); +public: + virtual bool + is_less_than(const boost::serialization::extended_type_info &rhs) const ; + virtual bool + is_equal(const boost::serialization::extended_type_info &rhs) const ; +}; + +} // no_rtti_system + +template<class T> +class extended_type_info_no_rtti : + public no_rtti_system::extended_type_info_no_rtti_0, + public singleton<extended_type_info_no_rtti<T> > +{ + template<bool tf> + struct action { + struct defined { + static const char * invoke(){ + return guid<T>(); + } + }; + struct undefined { + // if your program traps here - you failed to + // export a guid for this type. the no_rtti + // system requires export for types serialized + // as pointers. + BOOST_STATIC_ASSERT(0 == sizeof(T)); + static const char * invoke(); + }; + static const char * invoke(){ + typedef + BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + tf, + defined, + undefined + >::type type; + return type::invoke(); + } + }; +public: + extended_type_info_no_rtti() : + no_rtti_system::extended_type_info_no_rtti_0(get_key()) + { + key_register(); + } + ~extended_type_info_no_rtti(){ + key_unregister(); + } + const extended_type_info * + get_derived_extended_type_info(const T & t) const { + // find the type that corresponds to the most derived type. + // this implementation doesn't depend on typeid() but assumes + // that the specified type has a function of the following signature. + // A common implemention of such a function is to define as a virtual + // function. So if the is not a polymporphic type it's likely an error + BOOST_STATIC_WARNING(boost::is_polymorphic<T>::value); + const char * derived_key = t.get_key(); + assert(NULL != derived_key); + return boost::serialization::extended_type_info::find(derived_key); + } + const char * get_key() const{ + return action<guid_defined<T>::value >::invoke(); + } + virtual const char * get_debug_info() const{ + return action<guid_defined<T>::value >::invoke(); + } + virtual void * construct(unsigned int count, ...) const{ + // count up the arguments + std::va_list ap; + va_start(ap, count); + switch(count){ + case 0: + return factory<T, 0>(ap); + case 1: + return factory<T, 1>(ap); + case 2: + return factory<T, 2>(ap); + case 3: + return factory<T, 3>(ap); + case 4: + return factory<T, 4>(ap); + default: + assert(false); // too many arguments + // throw exception here? + return NULL; + } + } + virtual void destroy(void const * const p) const{ + boost::serialization::access::destroy( + static_cast<T const * const>(p) + ); + //delete static_cast<T const * const>(p) ; + } +}; + +} // namespace serialization +} // namespace boost + +/////////////////////////////////////////////////////////////////////////////// +// If no other implementation has been designated as default, +// use this one. To use this implementation as the default, specify it +// before any of the other headers. + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #define BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + namespace boost { + namespace serialization { + template<class T> + struct extended_type_info_impl { + typedef BOOST_DEDUCED_TYPENAME + boost::serialization::extended_type_info_no_rtti<T> type; + }; + } // namespace serialization + } // namespace boost +#endif + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif +#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_EXTENDED_TYPE_INFO_NO_RTTI_HPP diff --git a/Utilities/BGL/boost/serialization/extended_type_info_typeid.hpp b/Utilities/BGL/boost/serialization/extended_type_info_typeid.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ac5d57c98f738068487094253444683e48fc71ac --- /dev/null +++ b/Utilities/BGL/boost/serialization/extended_type_info_typeid.hpp @@ -0,0 +1,164 @@ +#ifndef BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_TYPEID_HPP +#define BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_TYPEID_HPP + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// extended_type_info_typeid.hpp: implementation for version that depends +// on runtime typing (rtti - typeid) but uses a user specified string +// as the portable class identifier. + +// (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 <typeinfo> +#include <cstdarg> +#include <cassert> +#include <boost/config.hpp> + +#include <boost/static_assert.hpp> +#include <boost/serialization/static_warning.hpp> +#include <boost/type_traits/is_polymorphic.hpp> +#include <boost/type_traits/remove_const.hpp> + +#include <boost/serialization/singleton.hpp> +#include <boost/serialization/extended_type_info.hpp> +#include <boost/serialization/factory.hpp> + +// hijack serialization access +#include <boost/serialization/access.hpp> + +#include <boost/mpl/if.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275 4511 4512) +#endif + +namespace boost { +namespace serialization { +namespace typeid_system { + +class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info_typeid_0 : + public extended_type_info +{ + virtual const char * get_debug_info() const { + if(static_cast<const std::type_info *>(0) == m_ti) + return static_cast<const char *>(0); + return m_ti->name(); + } +protected: + const std::type_info * m_ti; + extended_type_info_typeid_0(const char * key); + ~extended_type_info_typeid_0(); + void type_register(const std::type_info & ti); + void type_unregister(); + const extended_type_info * + get_extended_type_info(const std::type_info & ti) const; +public: + virtual bool + is_less_than(const extended_type_info &rhs) const; + virtual bool + is_equal(const extended_type_info &rhs) const; + const std::type_info & get_typeid() const { + return *m_ti; + } +}; + +} // typeid_system + +template<class T> +class extended_type_info_typeid : + public typeid_system::extended_type_info_typeid_0, + public singleton<extended_type_info_typeid<T> > +{ +public: + extended_type_info_typeid() : + typeid_system::extended_type_info_typeid_0(get_key()) + { + type_register(typeid(T)); + key_register(); + } + ~extended_type_info_typeid(){ + key_unregister(); + type_unregister(); + } + // get the eti record for the true type of this record + // relying upon standard type info implemenation (rtti) + const extended_type_info * + get_derived_extended_type_info(const T & t) const { + // note: this implementation - based on usage of typeid (rtti) + // only does something if the class has at least one virtual function. + BOOST_STATIC_WARNING(boost::is_polymorphic<T>::value); + return + typeid_system::extended_type_info_typeid_0::get_extended_type_info( + typeid(t) + ); + } + const char * get_key() const { + return boost::serialization::guid<T>(); + } + virtual void * construct(unsigned int count, ...) const{ + // count up the arguments + std::va_list ap; + va_start(ap, count); + switch(count){ + case 0: + return factory<boost::remove_const<T>, 0>(ap); + case 1: + return factory<boost::remove_const<T>, 1>(ap); + case 2: + return factory<boost::remove_const<T>, 2>(ap); + case 3: + return factory<boost::remove_const<T>, 3>(ap); + case 4: + return factory<boost::remove_const<T>, 4>(ap); + default: + assert(false); // too many arguments + // throw exception here? + return NULL; + } + } + virtual void destroy(void const * const p) const { + boost::serialization::access::destroy( + static_cast<T const * const>(p) + ); + //delete static_cast<T const * const>(p); + } +}; + +} // namespace serialization +} // namespace boost + +/////////////////////////////////////////////////////////////////////////////// +// If no other implementation has been designated as default, +// use this one. To use this implementation as the default, specify it +// before any of the other headers. +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #define BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + namespace boost { + namespace serialization { + template<class T> + struct extended_type_info_impl { + typedef BOOST_DEDUCED_TYPENAME + boost::serialization::extended_type_info_typeid<T> type; + }; + } // namespace serialization + } // namespace boost +#endif + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_TYPEID_HPP diff --git a/Utilities/BGL/boost/serialization/factory.hpp b/Utilities/BGL/boost/serialization/factory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c7730cb8c4d90ce693a1d393f38619e5d931baef --- /dev/null +++ b/Utilities/BGL/boost/serialization/factory.hpp @@ -0,0 +1,93 @@ +#ifndef BOOST_SERIALIZATION_FACTORY_HPP +#define BOOST_SERIALIZATION_FACTORY_HPP + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// factory.hpp: create an instance from an extended_type_info instance. + +// (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 <cstdarg> // valist +#include <cstddef> // NULL + +#include <boost/preprocessor/control/if.hpp> +#include <boost/preprocessor/comparison/greater.hpp> +#include <boost/preprocessor/facilities/empty.hpp> + +namespace std{ + #if defined(__LIBCOMO__) + using ::va_list; + #endif +} // namespace std + +namespace boost { +namespace serialization { + +// default implementation does nothing. +template<class T, int N> +T * factory(std::va_list){ + assert(false); + // throw exception here? + return NULL; +} + +} // namespace serialization +} // namespace boost + +#define BOOST_SERIALIZATION_FACTORY(N, T, A0, A1, A2, A3) \ +namespace boost { \ +namespace serialization { \ + template<> \ + T * factory<T, N>(std::va_list ap){ \ + BOOST_PP_IF(BOOST_PP_GREATER(N,0) \ + ,A0 a0 = va_arg(ap, A0); \ + ,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \ + ,A1 a1 = va_arg(ap, A1); \ + ,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \ + ,A2 a2 = va_arg(ap, A2); \ + ,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \ + ,A3 a3 = va_arg(ap, A3); \ + ,BOOST_PP_EMPTY() \ + )))) \ + return new T( \ + BOOST_PP_IF(BOOST_PP_GREATER(N,0) \ + ,a0 \ + ,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \ + ,a1 \ + ,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \ + ,a2 \ + ,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \ + ,a3 \ + ,BOOST_PP_EMPTY() \ + )))) \ + ); \ + } \ +} \ +} \ +/**/ + +#define BOOST_SERIALIZATION_FACTORY_4(T, A0, A1, A2, A3) \ + BOOST_SERIALIZATION_FACTORY(4, T, A0, A1, A2, A3) + +#define BOOST_SERIALIZATION_FACTORY_3(T, A0, A1, A2) \ + BOOST_SERIALIZATION_FACTORY(3, T, A0, A1, A2, 0) + +#define BOOST_SERIALIZATION_FACTORY_2(T, A0, A1) \ + BOOST_SERIALIZATION_FACTORY(2, T, A0, A1, 0, 0) + +#define BOOST_SERIALIZATION_FACTORY_1(T, A0) \ + BOOST_SERIALIZATION_FACTORY(1, T, A0, 0, 0, 0) + +#define BOOST_SERIALIZATION_FACTORY_0(T) \ + BOOST_SERIALIZATION_FACTORY(0, T, 0, 0, 0, 0) + +#endif // BOOST_SERIALIZATION_FACTORY_HPP diff --git a/Utilities/BGL/boost/serialization/force_include.hpp b/Utilities/BGL/boost/serialization/force_include.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6801eef1fcddca71e77fc0f997f41ed08b597438 --- /dev/null +++ b/Utilities/BGL/boost/serialization/force_include.hpp @@ -0,0 +1,57 @@ +#ifndef BOOST_SERIALIZATION_FORCE_INCLUDE_HPP +#define BOOST_SERIALIZATION_FORCE_INCLUDE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// force_include.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> + +// the following help macro is to guarentee that certain coded +// is not removed by over-eager linker optimiser. In certain cases +// we create static objects must be created but are actually never +// referenced - creation has a side-effect such as global registration +// which is important to us. We make an effort to refer these objects +// so that a smart linker won't remove them as being unreferenced. +// In microsoft compilers, inlining the code that does the referring +// means the code gets lost and the static object is not included +// in the library and hence never registered. This manifests itself +// in an ungraceful crash at runtime when (and only when) built in +// release mode. + +#if defined(BOOST_HAS_DECLSPEC) && !defined(__COMO__) +# if defined(__BORLANDC__) +# define BOOST_DLLEXPORT __export +# else +# define BOOST_DLLEXPORT __declspec(dllexport) +# endif +#elif ! defined(_WIN32) && ! defined(_WIN64) +# if defined(__MWERKS__) +# define BOOST_DLLEXPORT __declspec(dllexport) +# elif defined(__GNUC__) && (__GNUC__ >= 3) +# define BOOST_USED __attribute__ ((used)) +# elif defined(__INTEL_COMPILER) && (BOOST_INTEL_CXX_VERSION >= 800) +# define BOOST_USED __attribute__ ((used)) +# endif +#endif + +#ifndef BOOST_USED +# define BOOST_USED +#endif + +#ifndef BOOST_DLLEXPORT +# define BOOST_DLLEXPORT +#endif + +#endif // BOOST_SERIALIZATION_FORCE_INCLUDE_HPP diff --git a/Utilities/BGL/boost/serialization/hash_collections_load_imp.hpp b/Utilities/BGL/boost/serialization/hash_collections_load_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..45319153d66d2e08eb8d00ec45f240a1978c2a02 --- /dev/null +++ b/Utilities/BGL/boost/serialization/hash_collections_load_imp.hpp @@ -0,0 +1,58 @@ +#ifndef BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP +#define BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// hash_collections_load_imp.hpp: serialization for loading stl collections + +// (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. + +// helper function templates for serialization of hashed collections +#include <boost/config.hpp> +#include <boost/serialization/nvp.hpp> +//#include <boost/serialization/collections_load_imp.hpp> + +namespace boost{ +namespace serialization { +namespace stl { + +////////////////////////////////////////////////////////////////////// +// implementation of serialization for STL containers +// +template<class Archive, class Container, class InputFunction> +inline void load_hash_collection(Archive & ar, Container &s) +{ + s.clear(); + // retrieve number of elements + unsigned int count; + unsigned int item_version(0); + unsigned int bucket_count;; + ar >> BOOST_SERIALIZATION_NVP(count); + if(3 < ar.get_library_version()){ + ar >> BOOST_SERIALIZATION_NVP(bucket_count); + ar >> BOOST_SERIALIZATION_NVP(item_version); + } + #if ! defined(__MWERKS__) + s.resize(bucket_count); + #endif + InputFunction ifunc; + while(count-- > 0){ + ifunc(ar, s, item_version); + } +} + +} // namespace stl +} // namespace serialization +} // namespace boost + +#endif //BOOST_SERIALIZATION_HASH_COLLECTIONS_LOAD_IMP_HPP diff --git a/Utilities/BGL/boost/serialization/hash_collections_save_imp.hpp b/Utilities/BGL/boost/serialization/hash_collections_save_imp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e0dc0a24dfff8ae63d149f0b16b93942b72cc151 --- /dev/null +++ b/Utilities/BGL/boost/serialization/hash_collections_save_imp.hpp @@ -0,0 +1,66 @@ +#ifndef BOOST_SERIALIZATION_HASH_COLLECTIONS_SAVE_IMP_HPP +#define BOOST_SERIALIZATION_HASH_COLLECTIONS_SAVE_IMP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// hash_collections_save_imp.hpp: serialization for stl collections + +// (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. + +// helper function templates for serialization of collections + +#include <boost/config.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/serialization.hpp> +#include <boost/serialization/version.hpp> + +namespace boost{ +namespace serialization { +namespace stl { + +////////////////////////////////////////////////////////////////////// +// implementation of serialization for STL containers +// + +template<class Archive, class Container> +inline void save_hash_collection(Archive & ar, const Container &s) +{ + // record number of elements + unsigned int count = s.size(); + ar << BOOST_SERIALIZATION_NVP(count); + // make sure the target type is registered so we can retrieve + // the version when we load + if(3 < ar.get_library_version()){ + const unsigned int bucket_count = s.bucket_count(); + ar << BOOST_SERIALIZATION_NVP(bucket_count); + const unsigned int item_version = version<BOOST_DEDUCED_TYPENAME Container::value_type>::value; + ar << BOOST_SERIALIZATION_NVP(item_version); + } + BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin(); + while(count-- > 0){ + // note borland emits a no-op without the explicit namespace + boost::serialization::save_construct_data_adl( + ar, + &(*it), + boost::serialization::version< + BOOST_DEDUCED_TYPENAME Container::value_type + >::value + ); + ar << boost::serialization::make_nvp("item", *it++); + } +} + +} // namespace stl +} // namespace serialization +} // namespace boost + +#endif //BOOST_SERIALIZATION_HASH_COLLECTIONS_SAVE_IMP_HPP diff --git a/Utilities/BGL/boost/serialization/hash_map.hpp b/Utilities/BGL/boost/serialization/hash_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f5327388aa7eaace62b075462311634693bba901 --- /dev/null +++ b/Utilities/BGL/boost/serialization/hash_map.hpp @@ -0,0 +1,231 @@ +#ifndef BOOST_SERIALIZATION_HASH_MAP_HPP +#define BOOST_SERIALIZATION_HASH_MAP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// serialization/hash_map.hpp: +// serialization for stl hash_map templates + +// (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> +#ifdef BOOST_HAS_HASH +#include BOOST_HASH_MAP_HEADER + +#include <boost/serialization/utility.hpp> +#include <boost/serialization/hash_collections_save_imp.hpp> +#include <boost/serialization/hash_collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +namespace stl { + +// map input +template<class Archive, class Container> +struct archive_input_hash_map +{ + inline void operator()( + Archive &ar, + Container &s, + const unsigned int v + ){ + typedef BOOST_DEDUCED_TYPENAME Container::value_type type; + detail::stack_construct<Archive, type> t(ar, v); + // borland fails silently w/o full namespace + ar >> boost::serialization::make_nvp("item", t.reference()); + std::pair<BOOST_DEDUCED_TYPENAME Container::const_iterator, bool> result = + s.insert(t.reference()); + // note: the following presumes that the map::value_type was NOT tracked + // in the archive. This is the usual case, but here there is no way + // to determine that. + if(result.second){ + ar.reset_object_address( + & (result.first->second), + & t.reference().second + ); + } + } +}; + +// multimap input +template<class Archive, class Container> +struct archive_input_hash_multimap +{ + inline void operator()( + Archive &ar, + Container &s, + const unsigned int v + ){ + typedef BOOST_DEDUCED_TYPENAME Container::value_type type; + detail::stack_construct<Archive, type> t(ar, v); + // borland fails silently w/o full namespace + ar >> boost::serialization::make_nvp("item", t.reference()); + BOOST_DEDUCED_TYPENAME Container::const_iterator result + = s.insert(t.reference()); + // note: the following presumes that the map::value_type was NOT tracked + // in the archive. This is the usual case, but here there is no way + // to determine that. + ar.reset_object_address( + & result->second, + & t.reference() + ); + } +}; + +} // stl + +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void save( + Archive & ar, + const BOOST_STD_EXTENSION_NAMESPACE::hash_map< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::save_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_map< + Key, HashFcn, EqualKey, Allocator + > + >(ar, t); +} + +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void load( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_map< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::load_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_map< + Key, HashFcn, EqualKey, Allocator + >, + boost::serialization::stl::archive_input_hash_map< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_map< + Key, HashFcn, EqualKey, Allocator + > + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void serialize( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_map< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +// hash_multimap +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void save( + Archive & ar, + const BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::save_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< + Key, HashFcn, EqualKey, Allocator + > + >(ar, t); +} + +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void load( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::load_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< + Key, HashFcn, EqualKey, Allocator + >, + boost::serialization::stl::archive_input_hash_multimap< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< + Key, HashFcn, EqualKey, Allocator + > + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void serialize( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_multimap< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +#endif // BOOST_HAS_HASH +#endif // BOOST_SERIALIZATION_HASH_MAP_HPP diff --git a/Utilities/BGL/boost/serialization/hash_set.hpp b/Utilities/BGL/boost/serialization/hash_set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..916c2dd146edeca82b0a9903f0e7540af57fe317 --- /dev/null +++ b/Utilities/BGL/boost/serialization/hash_set.hpp @@ -0,0 +1,221 @@ +#ifndef BOOST_SERIALIZATION_HASH_SET_HPP +#define BOOST_SERIALIZATION_HASH_SET_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// hash_set.hpp: serialization for stl hash_set templates + +// (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> +#ifdef BOOST_HAS_HASH +#include BOOST_HASH_SET_HEADER + +#include <boost/serialization/hash_collections_save_imp.hpp> +#include <boost/serialization/hash_collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +namespace stl { + +// hash_set input +template<class Archive, class Container> +struct archive_input_hash_set +{ + inline void operator()( + Archive &ar, + Container &s, + const unsigned int v + ){ + typedef BOOST_DEDUCED_TYPENAME Container::value_type type; + detail::stack_construct<Archive, type> t(ar, v); + // borland fails silently w/o full namespace + ar >> boost::serialization::make_nvp("item", t.reference()); + std::pair<BOOST_DEDUCED_TYPENAME Container::const_iterator, bool> result = + s.insert(t.reference()); + if(result.second) + ar.reset_object_address(& (* result.first), & t.reference()); + } +}; + +// hash_multiset input +template<class Archive, class Container> +struct archive_input_hash_multiset +{ + inline void operator()( + Archive &ar, + Container &s, + const unsigned int v + ){ + typedef BOOST_DEDUCED_TYPENAME Container::value_type type; + detail::stack_construct<Archive, type> t(ar, v); + // borland fails silently w/o full namespace + ar >> boost::serialization::make_nvp("item", t.reference()); + BOOST_DEDUCED_TYPENAME Container::const_iterator result + = s.insert(t.reference()); + ar.reset_object_address(& (* result), & t.reference()); + } +}; + +} // stl + +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void save( + Archive & ar, + const BOOST_STD_EXTENSION_NAMESPACE::hash_set< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::save_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_set< + Key, HashFcn, EqualKey, Allocator + > + >(ar, t); +} + +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void load( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_set< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::load_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_set< + Key, HashFcn, EqualKey, Allocator + >, + boost::serialization::stl::archive_input_hash_set< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_set< + Key, HashFcn, EqualKey, Allocator + > + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void serialize( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_set< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +// hash_multiset +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void save( + Archive & ar, + const BOOST_STD_EXTENSION_NAMESPACE::hash_multiset< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::save_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_multiset< + Key, HashFcn, EqualKey, Allocator + > + >(ar, t); +} + +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void load( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_multiset< + Key, HashFcn, EqualKey, Allocator + > &t, + const unsigned int file_version +){ + boost::serialization::stl::load_hash_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_multiset< + Key, HashFcn, EqualKey, Allocator + >, + boost::serialization::stl::archive_input_hash_multiset< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::hash_multiset< + Key, HashFcn, EqualKey, Allocator + > + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template< + class Archive, + class Key, + class HashFcn, + class EqualKey, + class Allocator +> +inline void serialize( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::hash_multiset< + Key, HashFcn, EqualKey, Allocator + > & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::hash_set) +BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::hash_multiset) + +#endif // BOOST_HAS_HASH +#endif // BOOST_SERIALIZATION_HASH_SET_HPP diff --git a/Utilities/BGL/boost/serialization/is_bitwise_serializable.hpp b/Utilities/BGL/boost/serialization/is_bitwise_serializable.hpp new file mode 100644 index 0000000000000000000000000000000000000000..97d80b9a5b56444c4550dc60108acfeda1e5e025 --- /dev/null +++ b/Utilities/BGL/boost/serialization/is_bitwise_serializable.hpp @@ -0,0 +1,46 @@ +// (C) Copyright 2007 Matthias Troyer + +// 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: Matthias Troyer + +/** @file is_bitwise_serializable.hpp + * + * This header provides a traits class for determining whether a class + * can be serialized (in a non-portable way) just by copying the bits. + */ + + +#ifndef BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP +#define BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/mpl/bool.hpp> +#include <boost/type_traits/is_arithmetic.hpp> + +namespace boost { +namespace serialization { + template<class T> + struct is_bitwise_serializable + : public is_arithmetic<T> + {}; +} // namespace serialization +} // namespace boost + + +// define a macro to make explicit designation of this more transparent +#define BOOST_IS_BITWISE_SERIALIZABLE(T) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct is_bitwise_serializable< T > : mpl::true_ {}; \ +}} \ +/**/ + +#endif //BOOST_SERIALIZATION_IS_BITWISE_SERIALIZABLE_HPP diff --git a/Utilities/BGL/boost/serialization/level.hpp b/Utilities/BGL/boost/serialization/level.hpp new file mode 100644 index 0000000000000000000000000000000000000000..aedbe9fbeab1ddea7d42b9c63746c16304b6bc29 --- /dev/null +++ b/Utilities/BGL/boost/serialization/level.hpp @@ -0,0 +1,125 @@ +#ifndef BOOST_SERIALIZATION_LEVEL_HPP +#define BOOST_SERIALIZATION_LEVEL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// level.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/detail/workaround.hpp> + +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_array.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/integral_c_tag.hpp> +#include <boost/mpl/aux_/nttp_decl.hpp> + +#include <boost/serialization/level_enum.hpp> + +namespace boost { +namespace serialization { + +struct basic_traits; + +// default serialization implementation level +template<class T> +struct implementation_level_impl { + template<class U> + struct traits_class_level { + typedef BOOST_DEDUCED_TYPENAME U::level type; + }; + + typedef mpl::integral_c_tag tag; + // note: at least one compiler complained w/o the full qualification + // on basic traits below + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_base_and_derived<boost::serialization::basic_traits, T>, + traits_class_level<T>, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_fundamental<T>, + mpl::int_<primitive_type>, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_class<T>, + mpl::int_<object_class_info>, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_array<T>, + #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) + mpl::int_<not_serializable>, + #else + mpl::int_<object_serializable>, + #endif + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_enum<T>, + //#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) + // mpl::int_<not_serializable>, + //#else + mpl::int_<primitive_type>, + //#endif + //else + mpl::int_<not_serializable> + > + > + > + > + >::type type; + // vc 7.1 doesn't like enums here + BOOST_STATIC_CONSTANT(int, value = type::value); +}; + +template<class T> +struct implementation_level : + public implementation_level_impl<const T> +{ +}; + +template<class T, BOOST_MPL_AUX_NTTP_DECL(int, L) > +inline bool operator>=(implementation_level<T> t, enum level_type l) +{ + return t.value >= (int)l; +} + +} // namespace serialization +} // namespace boost + +// specify the level of serialization implementation for the class +// require that class info saved when versioning is used +#define BOOST_CLASS_IMPLEMENTATION(T, E) \ + namespace boost { \ + namespace serialization { \ + template <> \ + struct implementation_level_impl< const T > \ + { \ + typedef mpl::integral_c_tag tag; \ + typedef mpl::int_< E > type; \ + BOOST_STATIC_CONSTANT( \ + int, \ + value = implementation_level_impl::type::value \ + ); \ + }; \ + } \ + } + /**/ + +#endif // BOOST_SERIALIZATION_LEVEL_HPP diff --git a/Utilities/BGL/boost/serialization/level_enum.hpp b/Utilities/BGL/boost/serialization/level_enum.hpp new file mode 100644 index 0000000000000000000000000000000000000000..11bd17f67d60a23c4e1a3e15f187db3044c22788 --- /dev/null +++ b/Utilities/BGL/boost/serialization/level_enum.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_SERIALIZATION_LEVEL_ENUM_HPP +#define BOOST_SERIALIZATION_LEVEL_ENUM_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// level_enum.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. + +namespace boost { +namespace serialization { + +// for each class used in the program, specify which level +// of serialization should be implemented + +// names for each level +enum level_type +{ + // Don't serialize this type. An attempt to do so should + // invoke a compile time assertion. + not_serializable = 0, + // write/read this type directly to the archive. In this case + // serialization code won't be called. This is the default + // case for fundamental types. It presumes a member function or + // template in the archive class that can handle this type. + // there is no runtime overhead associated reading/writing + // instances of this level + primitive_type = 1, + // Serialize the objects of this type using the objects "serialize" + // function or template. This permits values to be written/read + // to/from archives but includes no class or version information. + object_serializable = 2, + /////////////////////////////////////////////////////////////////// + // once an object is serialized at one of the above levels, the + // corresponding archives cannot be read if the implementation level + // for the archive object is changed. + /////////////////////////////////////////////////////////////////// + // Add class information to the archive. Class information includes + // implementation level, class version and class name if available + object_class_info = 3 +}; + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_LEVEL_ENUM_HPP diff --git a/Utilities/BGL/boost/serialization/list.hpp b/Utilities/BGL/boost/serialization/list.hpp new file mode 100644 index 0000000000000000000000000000000000000000..469bb230ec0f6715cccf5da98babf8eb2896a2a5 --- /dev/null +++ b/Utilities/BGL/boost/serialization/list.hpp @@ -0,0 +1,77 @@ +#ifndef BOOST_SERIALIZATION_LIST_HPP +#define BOOST_SERIALIZATION_LIST_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// list.hpp: serialization for stl list templates + +// (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 <list> + +#include <boost/config.hpp> + +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +template<class Archive, class U, class Allocator> +inline void save( + Archive & ar, + const std::list<U, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::save_collection< + Archive, + std::list<U, Allocator> + >(ar, t); +} + +template<class Archive, class U, class Allocator> +inline void load( + Archive & ar, + std::list<U, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::load_collection< + Archive, + std::list<U, Allocator>, + boost::serialization::stl::archive_input_seq< + Archive, + std::list<U, Allocator> + >, + boost::serialization::stl::no_reserve_imp<std::list<U, Allocator> > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class U, class Allocator> +inline void serialize( + Archive & ar, + std::list<U, Allocator> & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // serialization +} // namespace boost + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(std::list) + +#endif // BOOST_SERIALIZATION_LIST_HPP diff --git a/Utilities/BGL/boost/serialization/map.hpp b/Utilities/BGL/boost/serialization/map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..624290df1ab8f7606e2ea374e22d554bc7e8d6b5 --- /dev/null +++ b/Utilities/BGL/boost/serialization/map.hpp @@ -0,0 +1,118 @@ +#ifndef BOOST_SERIALIZATION_MAP_HPP +#define BOOST_SERIALIZATION_MAP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// serialization/map.hpp: +// serialization for stl map templates + +// (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 <map> + +#include <boost/config.hpp> + +#include <boost/serialization/utility.hpp> +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +template<class Archive, class Type, class Key, class Compare, class Allocator > +inline void save( + Archive & ar, + const std::map<Key, Type, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::save_collection< + Archive, + std::map<Key, Type, Compare, Allocator> + >(ar, t); +} + +template<class Archive, class Type, class Key, class Compare, class Allocator > +inline void load( + Archive & ar, + std::map<Key, Type, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::load_collection< + Archive, + std::map<Key, Type, Compare, Allocator>, + boost::serialization::stl::archive_input_map< + Archive, std::map<Key, Type, Compare, Allocator> >, + boost::serialization::stl::no_reserve_imp<std::map< + Key, Type, Compare, Allocator + > + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class Type, class Key, class Compare, class Allocator > +inline void serialize( + Archive & ar, + std::map<Key, Type, Compare, Allocator> &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +// multimap +template<class Archive, class Type, class Key, class Compare, class Allocator > +inline void save( + Archive & ar, + const std::multimap<Key, Type, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::save_collection< + Archive, + std::multimap<Key, Type, Compare, Allocator> + >(ar, t); +} + +template<class Archive, class Type, class Key, class Compare, class Allocator > +inline void load( + Archive & ar, + std::multimap<Key, Type, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::load_collection< + Archive, + std::multimap<Key, Type, Compare, Allocator>, + boost::serialization::stl::archive_input_map< + Archive, std::multimap<Key, Type, Compare, Allocator> + >, + boost::serialization::stl::no_reserve_imp< + std::multimap<Key, Type, Compare, Allocator> + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class Type, class Key, class Compare, class Allocator > +inline void serialize( + Archive & ar, + std::multimap<Key, Type, Compare, Allocator> &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_MAP_HPP diff --git a/Utilities/BGL/boost/serialization/nvp.hpp b/Utilities/BGL/boost/serialization/nvp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..79a8de02cc6a36e604dcf6050dd65a171a90b66a --- /dev/null +++ b/Utilities/BGL/boost/serialization/nvp.hpp @@ -0,0 +1,144 @@ +#ifndef BOOST_SERIALIZATION_NVP_HPP +#define BOOST_SERIALIZATION_NVP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// nvp.hpp: interface for serialization system. + +// (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 <utility> + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +// supress noise +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/integral_c_tag.hpp> + +#include <boost/serialization/level.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/split_member.hpp> +#include <boost/serialization/base_object.hpp> +#include <boost/serialization/traits.hpp> +#include <boost/serialization/wrapper.hpp> + +namespace boost { +namespace serialization { + +template<class T> +struct nvp : + public std::pair<const char *, T *>, + public wrapper_traits<const nvp<T> > +{ + explicit nvp(const char * name_, T & t) : + // note: redundant cast works around borland issue + // note: added _ to suppress useless gcc warning + std::pair<const char *, T *>(name_, (T*)(& t)) + {} + nvp(const nvp & rhs) : + // note: redundant cast works around borland issue + std::pair<const char *, T *>(rhs.first, (T*)rhs.second) + {} + + const char * name() const { + return this->first; + } + T & value() const { + return *(this->second); + } + + const T & const_value() const { + return *(this->second); + } + + // True64 compiler complains with a warning about the use of + // the name "Archive" hiding some higher level usage. I'm sure this + // is an error but I want to accomodated as it generates a long warning + // listing and might be related to a lot of test failures. + // default treatment for name-value pairs. The name is + // just discarded and only the value is serialized. + template<class Archivex> + void save( + Archivex & ar, + const unsigned int /* file_version */ + ) const { + // CodeWarrior 8.x can't seem to resolve the << op for a rhs of "const T *" + ar.operator<<(const_value()); + } + template<class Archivex> + void load( + Archivex & ar, + const unsigned int /* file_version */ + ){ + // CodeWarrior 8.x can't seem to resolve the >> op for a rhs of "const T *" + ar.operator>>(value()); + } + BOOST_SERIALIZATION_SPLIT_MEMBER() +}; + +template<class T> +inline +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +const +#endif +nvp<T> make_nvp(const char * name, T & t){ + return nvp<T>(name, t); +} + +// to maintain efficiency and portability, we want to assign +// specific serialization traits to all instances of this wrappers. +// we can't strait forward method below as it depends upon +// Partial Template Specialization and doing so would mean that wrappers +// wouldn't be treated the same on different platforms. This would +// break archive portability. Leave this here as reminder not to use it !!! +#if 0 // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +template <class T> +struct implementation_level<nvp<T> > +{ + typedef mpl::integral_c_tag tag; + typedef mpl::int_<object_serializable> type; + BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value); +}; + +// nvp objects are generally created on the stack and are never tracked +template<class T> +struct tracking_level<nvp<T> > +{ + typedef mpl::integral_c_tag tag; + typedef mpl::int_<track_never> type; + BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value); +}; + +#endif + +} // seralization +} // boost + +#include <boost/preprocessor/stringize.hpp> + +#define BOOST_SERIALIZATION_NVP(name) \ + boost::serialization::make_nvp(BOOST_PP_STRINGIZE(name), name) +/**/ + +#define BOOST_SERIALIZATION_BASE_OBJECT_NVP(name) \ + boost::serialization::make_nvp( \ + BOOST_PP_STRINGIZE(name), \ + boost::serialization::base_object<name >(*this) \ + ) +/**/ + +#endif // BOOST_SERIALIZATION_NVP_HPP diff --git a/Utilities/BGL/boost/serialization/optional.hpp b/Utilities/BGL/boost/serialization/optional.hpp new file mode 100644 index 0000000000000000000000000000000000000000..68d236b71df1252fdc4bfee673f0588b6bc04596 --- /dev/null +++ b/Utilities/BGL/boost/serialization/optional.hpp @@ -0,0 +1,113 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 + +// (C) Copyright 2002-4 Pavel Vozenilek . +// 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) + +// Provides non-intrusive serialization for boost::optional. + +#ifndef BOOST_SERIALIZATION_OPTIONAL_HPP_ +#define BOOST_SERIALIZATION_OPTIONAL_HPP_ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/config.hpp> + +#include <boost/optional.hpp> +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/level.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/version.hpp> +#include <boost/serialization/detail/stack_constructor.hpp> + +// function specializations must be defined in the appropriate +// namespace - boost::serialization +namespace boost { +namespace serialization { + +template<class Archive, class T> +void save( + Archive & ar, + const boost::optional<T> & t, + const unsigned int /*version*/ +){ + const bool tflag = t.is_initialized(); + ar << boost::serialization::make_nvp("initialized", tflag); + if (tflag){ + if(3 < ar.get_library_version()){ + const int v = version<T>::value; + ar << boost::serialization::make_nvp("item_version", v); + } + ar << boost::serialization::make_nvp("value", *t); + } +} + +template<class Archive, class T> +void load( + Archive & ar, + boost::optional<T> & t, + const unsigned int /*version*/ +){ + bool tflag; + ar >> boost::serialization::make_nvp("initialized", tflag); + if (tflag){ + unsigned int v = 0; + if(3 < ar.get_library_version()){ + ar >> boost::serialization::make_nvp("item_version", v); + } + detail::stack_construct<Archive, T> aux(ar, v); + ar >> boost::serialization::make_nvp("value", aux.reference()); + t.reset(aux.reference()); + } + else { + t.reset(); + } +} + +template<class Archive, class T> +void serialize( + Archive & ar, + boost::optional<T> & t, + const unsigned int version +){ + boost::serialization::split_free(ar, t, version); +} + +// the following would be slightly more efficient. But it +// would mean that archives created with programs that support +// TPS wouldn't be readable by programs that don't support TPS. +// Hence we decline to support this otherwise convenient optimization. +//#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#if 0 + +template <class T> +struct implementation_level<optional<T> > +{ + typedef mpl::integral_c_tag tag; + typedef mpl::int_<boost::serialization::object_serializable> type; + BOOST_STATIC_CONSTANT( + int , + value = boost::serialization::implementation_level::type::value + ); +}; + +template<class T> +struct tracking_level<optional<T> > +{ + typedef mpl::integral_c_tag tag; + typedef mpl::int_<boost::serialization::track_never> type; + BOOST_STATIC_CONSTANT( + int , + value = boost::serialization::tracking_level::type::value + ); +}; + +#endif + +} // serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_OPTIONAL_HPP_ diff --git a/Utilities/BGL/boost/serialization/pfto.hpp b/Utilities/BGL/boost/serialization/pfto.hpp new file mode 100644 index 0000000000000000000000000000000000000000..109f6d44e8340675659dff2a72b68941284edd0c --- /dev/null +++ b/Utilities/BGL/boost/serialization/pfto.hpp @@ -0,0 +1,78 @@ +#ifndef BOOST_SERIALIZATION_PFTO_HPP +#define BOOST_SERIALIZATION_PFTO_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// pfto.hpp: workarounds for compilers which have problems supporting +// Partial Function Template Ordering (PFTO). + +// (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/libs/serialization for updates, documentation, and revision history. +// PFTO version is used to specify the last argument of certain functions +// Function it is used to support compilers that fail to support correct Partial +// Template Ordering +#include <boost/config.hpp> + +// some compilers can use an exta argument and use function overloading +// to choose desired function. This extra argument is long in the default +// function implementation and int for the rest. The function is called +// with an int argument. This first attempts to match functions with an +// int argument before the default one (with a long argument). This is +// known to function with VC 6.0. On other compilers this fails (Borland) +// or causes other problems (GCC). note: this + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + #define BOOST_PFTO long +#else + #define BOOST_PFTO +#endif + +// here's another approach. Rather than use a default function - make sure +// there is no default at all by requiring that all function invocations +// have a "wrapped" argument type. This solves a problem with VC 6.0 +// (and perhaps others) while implementing templated constructors. + +namespace boost { +namespace serialization { + +template<class T> +struct pfto_wrapper { + const T & t; + operator const T & (){ + return t; + } + pfto_wrapper (const T & rhs) : t(rhs) {} +}; + +template<class T> +pfto_wrapper<T> make_pfto_wrapper(const T & t, BOOST_PFTO int){ + return pfto_wrapper<T>(t); +} + +template<class T> +pfto_wrapper<T> make_pfto_wrapper(const pfto_wrapper<T> & t, int){ + return t; +} + +} // namespace serialization +} // namespace boost + +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + #define BOOST_PFTO_WRAPPER(T) \ + boost::serialization::pfto_wrapper<T> + #define BOOST_MAKE_PFTO_WRAPPER(t) \ + boost::serialization::make_pfto_wrapper(t, 0) +#else + #define BOOST_PFTO_WRAPPER(T) T + #define BOOST_MAKE_PFTO_WRAPPER(t) t +#endif + +#endif // BOOST_SERIALIZATION_PFTO_HPP diff --git a/Utilities/BGL/boost/serialization/scoped_ptr.hpp b/Utilities/BGL/boost/serialization/scoped_ptr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..52642c7dc61e8ef07de0528854e7bd77bf3733ba --- /dev/null +++ b/Utilities/BGL/boost/serialization/scoped_ptr.hpp @@ -0,0 +1,58 @@ +#ifndef BOOST_SERIALIZATION_SCOPED_PTR_HPP_VP_2003_10_30 +#define BOOST_SERIALIZATION_SCOPED_PTR_HPP_VP_2003_10_30 + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// Copyright (c) 2003 Vladimir Prus. +// 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) + +// Provides non-intrusive serialization for boost::scoped_ptr +// Does not allow to serialize scoped_ptr's to builtin types. + +#include <boost/config.hpp> + +#include <boost/scoped_ptr.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + + template<class Archive, class T> + void save( + Archive & ar, + const boost::scoped_ptr<T> & t, + const unsigned int /* version */ + ){ + T* r = t.get(); + ar << boost::serialization::make_nvp("scoped_ptr", r); + } + + template<class Archive, class T> + void load( + Archive & ar, + boost::scoped_ptr<T> & t, + const unsigned int /* version */ + ){ + T* r; + ar >> boost::serialization::make_nvp("scoped_ptr", r); + t.reset(r); + } + + template<class Archive, class T> + void serialize( + Archive& ar, + boost::scoped_ptr<T>& t, + const unsigned int version + ){ + boost::serialization::split_free(ar, t, version); + } + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_SCOPED_PTR_HPP_VP_2003_10_30 diff --git a/Utilities/BGL/boost/serialization/serialization.hpp b/Utilities/BGL/boost/serialization/serialization.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0d8ecef150a5e43dec093e12cbe19f35e3bc36e5 --- /dev/null +++ b/Utilities/BGL/boost/serialization/serialization.hpp @@ -0,0 +1,172 @@ +#ifndef BOOST_SERIALIZATION_SERIALIZATION_HPP +#define BOOST_SERIALIZATION_SERIALIZATION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(_MSC_VER) && (_MSC_VER >= 1310) +# pragma warning (disable : 4675) // suppress ADL warning +#endif + +#include <boost/config.hpp> +#include <boost/serialization/strong_typedef.hpp> +#include <boost/serialization/pfto.hpp> +#include <boost/serialization/throw_exception.hpp> +#include <boost/serialization/nvp.hpp> + +// incremented for each "release" +#define BOOST_SERIALIZATION_LIBRARY_VERSION 19 + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// serialization.hpp: interface for serialization system. + +// (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. + +////////////////////////////////////////////////////////////////////// +// public interface to serialization. + +///////////////////////////////////////////////////////////////////////////// +// layer 0 - intrusive verison +// declared and implemented for each user defined class to be serialized +// +// template<Archive> +// serialize(Archive &ar, const unsigned int file_version){ +// ar & base_object<base>(*this) & member1 & member2 ... ; +// } + +///////////////////////////////////////////////////////////////////////////// +// layer 1 - layer that routes member access through the access class. +// this is what permits us to grant access to private class member functions +// by specifying friend class boost::serialization::access + +#include <boost/serialization/access.hpp> + +///////////////////////////////////////////////////////////////////////////// +// layer 2 - default implementation of non-intrusive serialization. +// +// note the usage of function overloading to compensate that C++ does not +// currently support Partial Template Specialization for function templates +// We have declared the version number as "const unsigned long". +// Overriding templates for specific data types should declare the version +// number as "const unsigned int". Template matching will first be applied +// to functions with the same version types - that is the overloads. +// If there is no declared function prototype that matches, the second argument +// will be converted to "const unsigned long" and a match will be made with +// one of the default template functions below. + +namespace boost { +namespace serialization { + +BOOST_STRONG_TYPEDEF(unsigned int, version_type) + +// default implementation - call the member function "serialize" +template<class Archive, class T> +inline void serialize( + Archive & ar, T & t, const BOOST_PFTO unsigned int file_version +){ + access::serialize(ar, t, static_cast<unsigned int>(file_version)); +} + +// save data required for construction +template<class Archive, class T> +inline void save_construct_data( + Archive & /*ar*/, + const T * /*t*/, + const BOOST_PFTO unsigned int /*file_version */ +){ + // default is to save no data because default constructor + // requires no arguments. +} + +// load data required for construction and invoke constructor in place +template<class Archive, class T> +inline void load_construct_data( + Archive & /*ar*/, + T * t, + const BOOST_PFTO unsigned int /*file_version*/ +){ + // default just uses the default constructor. going + // through access permits usage of otherwise private default + // constructor + access::construct(t); +} + +///////////////////////////////////////////////////////////////////////////// +// layer 3 - move call into serialization namespace so that ADL will function +// in the manner we desire. +// +// on compilers which don't implement ADL. only the current namespace +// i.e. boost::serialization will be searched. +// +// on compilers which DO implement ADL +// serialize overrides can be in any of the following +// +// 1) same namepace as Archive +// 2) same namespace as T +// 3) boost::serialization +// +// Due to Martin Ecker + +template<class Archive, class T> +inline void serialize_adl( + Archive & ar, + T & t, + const unsigned int file_version +){ + // note usage of function overloading to delay final resolution + // until the point of instantiation. This works around the two-phase + // lookup "feature" which inhibits redefintion of a default function + // template implementation. Due to Robert Ramey + // + // Note that this trick generates problems for compiles which don't support + // PFTO, suppress it here. As far as we know, there are no compilers + // which fail to support PFTO while supporting two-phase lookup. + #if ! defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + const version_type v(file_version); + serialize(ar, t, v); + #else + serialize(ar, t, file_version); + #endif +} + +template<class Archive, class T> +inline void save_construct_data_adl( + Archive & ar, + const T * t, + const unsigned int file_version +){ + // see above + #if ! defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + const version_type v(file_version); + save_construct_data(ar, t, v); + #else + save_construct_data(ar, t, file_version); + #endif +} + +template<class Archive, class T> +inline void load_construct_data_adl( + Archive & ar, + T * t, + const unsigned int file_version +){ + // see above comment + #if ! defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + const version_type v(file_version); + load_construct_data(ar, t, v); + #else + load_construct_data(ar, t, file_version); + #endif +} + +} // namespace serialization +} // namespace boost + +#endif //BOOST_SERIALIZATION_SERIALIZATION_HPP diff --git a/Utilities/BGL/boost/serialization/set.hpp b/Utilities/BGL/boost/serialization/set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4bb69abb9360576833e0a0887ebaca6242d99b3d --- /dev/null +++ b/Utilities/BGL/boost/serialization/set.hpp @@ -0,0 +1,120 @@ +#ifndef BOOST_SERIALIZATION_SET_HPP +#define BOOST_SERIALIZATION_SET_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// set.hpp: serialization for stl set templates + +// (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 <set> + +#include <boost/config.hpp> + +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +template<class Archive, class Key, class Compare, class Allocator > +inline void save( + Archive & ar, + const std::set<Key, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::save_collection< + Archive, std::set<Key, Compare, Allocator> + >(ar, t); +} + +template<class Archive, class Key, class Compare, class Allocator > +inline void load( + Archive & ar, + std::set<Key, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::load_collection< + Archive, + std::set<Key, Compare, Allocator>, + boost::serialization::stl::archive_input_set< + Archive, std::set<Key, Compare, Allocator> + >, + boost::serialization::stl::no_reserve_imp<std::set< + Key, Compare, Allocator> + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class Key, class Compare, class Allocator > +inline void serialize( + Archive & ar, + std::set<Key, Compare, Allocator> & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +// multiset +template<class Archive, class Key, class Compare, class Allocator > +inline void save( + Archive & ar, + const std::multiset<Key, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::save_collection< + Archive, + std::multiset<Key, Compare, Allocator> + >(ar, t); +} + +template<class Archive, class Key, class Compare, class Allocator > +inline void load( + Archive & ar, + std::multiset<Key, Compare, Allocator> &t, + const unsigned int /* file_version */ +){ + boost::serialization::stl::load_collection< + Archive, + std::multiset<Key, Compare, Allocator>, + boost::serialization::stl::archive_input_set< + Archive, std::multiset<Key, Compare, Allocator> + >, + boost::serialization::stl::no_reserve_imp< + std::multiset<Key, Compare, Allocator> + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class Key, class Compare, class Allocator > +inline void serialize( + Archive & ar, + std::multiset<Key, Compare, Allocator> & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(std::set) +BOOST_SERIALIZATION_COLLECTION_TRAITS(std::multiset) + +#endif // BOOST_SERIALIZATION_SET_HPP diff --git a/Utilities/BGL/boost/serialization/shared_ptr.hpp b/Utilities/BGL/boost/serialization/shared_ptr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dc4c17b8018cc173a2ccb7380bd75f3a56dfb791 --- /dev/null +++ b/Utilities/BGL/boost/serialization/shared_ptr.hpp @@ -0,0 +1,178 @@ +#ifndef BOOST_SERIALIZATION_SHARED_PTR_HPP +#define BOOST_SERIALIZATION_SHARED_PTR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// shared_ptr.hpp: serialization for boost shared pointer + +// (C) Copyright 2004 Robert Ramey and Martin Ecker +// 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 <map> +#include <cstddef> // NULL + +#include <boost/config.hpp> +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/integral_c_tag.hpp> + +#include <boost/detail/workaround.hpp> +#include <boost/shared_ptr.hpp> + +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/version.hpp> +#include <boost/serialization/tracking.hpp> + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// shared_ptr serialization traits +// version 1 to distinguish from boost 1.32 version. Note: we can only do this +// for a template when the compiler supports partial template specialization + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + namespace boost { + namespace serialization{ + template<class T> + struct version< ::boost::shared_ptr<T> > { + typedef mpl::integral_c_tag tag; + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + typedef BOOST_DEDUCED_TYPENAME mpl::int_<1> type; + #else + typedef mpl::int_<1> type; + #endif + #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) + BOOST_STATIC_CONSTANT(unsigned int, value = 1); + #else + BOOST_STATIC_CONSTANT(unsigned int, value = type::value); + #endif + }; + // don't track shared pointers + template<class T> + struct tracking_level< ::boost::shared_ptr<T> > { + typedef mpl::integral_c_tag tag; + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + typedef BOOST_DEDUCED_TYPENAME mpl::int_< ::boost::serialization::track_never> type; + #else + typedef mpl::int_< ::boost::serialization::track_never> type; + #endif + #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) + BOOST_STATIC_CONSTANT(int, value = ::boost::serialization::track_never); + #else + BOOST_STATIC_CONSTANT(int, value = type::value); + #endif + }; + }} + #define BOOST_SERIALIZATION_SHARED_PTR(T) +#else + // define macro to let users of these compilers do this + #define BOOST_SERIALIZATION_SHARED_PTR(T) \ + BOOST_CLASS_VERSION( \ + ::boost::shared_ptr< T >, \ + 1 \ + ) \ + BOOST_CLASS_TRACKING( \ + ::boost::shared_ptr< T >, \ + ::boost::serialization::track_never \ + ) \ + /**/ +#endif + +namespace boost { +namespace serialization{ + +struct null_deleter { + void operator()(void const *) const {} +}; + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// serialization for shared_ptr + +template<class Archive, class T> +inline void save( + Archive & ar, + const boost::shared_ptr<T> &t, + const unsigned int /* file_version */ +){ + // The most common cause of trapping here would be serializing + // something like shared_ptr<int>. This occurs because int + // is never tracked by default. Wrap int in a trackable type + BOOST_STATIC_ASSERT((tracking_level<T>::value != track_never)); + const T * t_ptr = t.get(); + ar << boost::serialization::make_nvp("px", t_ptr); +} + +#ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP +template<class Archive, class T> +inline void load( + Archive & ar, + boost::shared_ptr<T> &t, + const unsigned int file_version +){ + // The most common cause of trapping here would be serializing + // something like shared_ptr<int>. This occurs because int + // is never tracked by default. Wrap int in a trackable type + BOOST_STATIC_ASSERT((tracking_level<T>::value != track_never)); + T* r; + if(file_version < 1){ + //ar.register_type(static_cast< + // boost_132::detail::sp_counted_base_impl<T *, boost::checked_deleter<T> > * + //>(NULL)); + ar.register_type(static_cast< + boost_132::detail::sp_counted_base_impl<T *, null_deleter > * + >(NULL)); + boost_132::shared_ptr<T> sp; + ar >> boost::serialization::make_nvp("px", sp.px); + ar >> boost::serialization::make_nvp("pn", sp.pn); + // got to keep the sps around so the sp.pns don't disappear + ar.append(sp); + r = sp.get(); + } + else{ + ar >> boost::serialization::make_nvp("px", r); + } + ar.reset(t,r); +} + +#else +template<class Archive, class T> +inline void load( + Archive & ar, + boost::shared_ptr<T> &t, + const unsigned int /*file_version*/ +){ + // The most common cause of trapping here would be serializing + // something like shared_ptr<int>. This occurs because int + // is never tracked by default. Wrap int in a trackable type + BOOST_STATIC_ASSERT((tracking_level<T>::value != track_never)); + T* r; + ar >> boost::serialization::make_nvp("px", r); + ar.reset(t,r); +} +#endif + +template<class Archive, class T> +inline void serialize( + Archive & ar, + boost::shared_ptr<T> &t, + const unsigned int file_version +){ + // correct shared_ptr serialization depends upon object tracking + // being used. + BOOST_STATIC_ASSERT( + boost::serialization::tracking_level<T>::value + != boost::serialization::track_never + ); + boost::serialization::split_free(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_SHARED_PTR_HPP diff --git a/Utilities/BGL/boost/serialization/shared_ptr_132.hpp b/Utilities/BGL/boost/serialization/shared_ptr_132.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f0c311399440fd4cc992add9c785e10c674b1d15 --- /dev/null +++ b/Utilities/BGL/boost/serialization/shared_ptr_132.hpp @@ -0,0 +1,222 @@ +#ifndef BOOST_SERIALIZATION_SHARED_PTR_132_HPP +#define BOOST_SERIALIZATION_SHARED_PTR_132_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// shared_ptr.hpp: serialization for boost shared pointer + +// (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. + +// note: totally unadvised hack to gain access to private variables +// in shared_ptr and shared_count. Unfortunately its the only way to +// do this without changing shared_ptr and shared_count +// the best we can do is to detect a conflict here +#include <boost/config.hpp> + +#include <list> +#include <cstddef> // NULL + +#include <boost/serialization/assume_abstract.hpp> +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/tracking.hpp> +#include <boost/serialization/void_cast.hpp> + +// mark base class as an (uncreatable) base class +#include <boost/serialization/detail/shared_ptr_132.hpp> + +///////////////////////////////////////////////////////////// +// Maintain a couple of lists of loaded shared pointers of the old previous +// version (1.32) + +namespace boost_132 { +namespace serialization { +namespace detail { + +struct null_deleter { + void operator()(void const *) const {} +}; + +} // namespace detail +} // namespace serialization +} // namespace boost_132 + +///////////////////////////////////////////////////////////// +// sp_counted_base_impl serialization + +namespace boost { +namespace serialization { + +template<class Archive, class P, class D> +inline void serialize( + Archive & /* ar */, + boost_132::detail::sp_counted_base_impl<P, D> & /* t */, + const unsigned int /*file_version*/ +){ + // register the relationship between each derived class + // its polymorphic base + boost::serialization::void_cast_register< + boost_132::detail::sp_counted_base_impl<P, D>, + boost_132::detail::sp_counted_base + >( + static_cast<boost_132::detail::sp_counted_base_impl<P, D> *>(NULL), + static_cast<boost_132::detail::sp_counted_base *>(NULL) + ); +} + +template<class Archive, class P, class D> +inline void save_construct_data( + Archive & ar, + const + boost_132::detail::sp_counted_base_impl<P, D> *t, + const BOOST_PFTO unsigned int /* file_version */ +){ + // variables used for construction + ar << boost::serialization::make_nvp("ptr", t->ptr); +} + +template<class Archive, class P, class D> +inline void load_construct_data( + Archive & ar, + boost_132::detail::sp_counted_base_impl<P, D> * t, + const unsigned int /* file_version */ +){ + P ptr_; + ar >> boost::serialization::make_nvp("ptr", ptr_); + // ::new(t)boost_132::detail::sp_counted_base_impl<P, D>(ptr_, D()); + // placement + // note: the original ::new... above is replaced by the one here. This one + // creates all new objects with a null_deleter so that after the archive + // is finished loading and the shared_ptrs are destroyed - the underlying + // raw pointers are NOT deleted. This is necessary as they are used by the + // new system as well. + ::new(t)boost_132::detail::sp_counted_base_impl< + P, + boost_132::serialization::detail::null_deleter + >( + ptr_, boost_132::serialization::detail::null_deleter() + ); // placement new + // compensate for that fact that a new shared count always is + // initialized with one. the add_ref_copy below will increment it + // every time its serialized so without this adjustment + // the use and weak counts will be off by one. + t->use_count_ = 0; +} + +} // serialization +} // namespace boost + +///////////////////////////////////////////////////////////// +// shared_count serialization + +namespace boost { +namespace serialization { + +template<class Archive> +inline void save( + Archive & ar, + const boost_132::detail::shared_count &t, + const unsigned int /* file_version */ +){ + ar << boost::serialization::make_nvp("pi", t.pi_); +} + +template<class Archive> +inline void load( + Archive & ar, + boost_132::detail::shared_count &t, + const unsigned int /* file_version */ +){ + ar >> boost::serialization::make_nvp("pi", t.pi_); + if(NULL != t.pi_) + t.pi_->add_ref_copy(); +} + +} // serialization +} // namespace boost + +BOOST_SERIALIZATION_SPLIT_FREE(boost_132::detail::shared_count) + +///////////////////////////////////////////////////////////// +// implement serialization for shared_ptr<T> + +namespace boost { +namespace serialization { + +template<class Archive, class T> +inline void save( + Archive & ar, + const boost_132::shared_ptr<T> &t, + const unsigned int /* file_version */ +){ + // only the raw pointer has to be saved + // the ref count is maintained automatically as shared pointers are loaded + ar.register_type(static_cast< + boost_132::detail::sp_counted_base_impl<T *, boost::checked_deleter<T> > * + >(NULL)); + ar << boost::serialization::make_nvp("px", t.px); + ar << boost::serialization::make_nvp("pn", t.pn); +} + +template<class Archive, class T> +inline void load( + Archive & ar, + boost_132::shared_ptr<T> &t, + const unsigned int /* file_version */ +){ + // only the raw pointer has to be saved + // the ref count is maintained automatically as shared pointers are loaded + ar.register_type(static_cast< + boost_132::detail::sp_counted_base_impl<T *, boost::checked_deleter<T> > * + >(NULL)); + ar >> boost::serialization::make_nvp("px", t.px); + ar >> boost::serialization::make_nvp("pn", t.pn); +} + +template<class Archive, class T> +inline void serialize( + Archive & ar, + boost_132::shared_ptr<T> &t, + const unsigned int file_version +){ + // correct shared_ptr serialization depends upon object tracking + // being used. + BOOST_STATIC_ASSERT( + boost::serialization::tracking_level<T>::value + != boost::serialization::track_never + ); + boost::serialization::split_free(ar, t, file_version); +} + +} // serialization +} // namespace boost + +// note: change below uses null_deleter +// This macro is used to export GUIDS for shared pointers to allow +// the serialization system to export them properly. David Tonge +#define BOOST_SHARED_POINTER_EXPORT_GUID(T, K) \ + typedef boost_132::detail::sp_counted_base_impl< \ + T *, \ + boost::checked_deleter< T > \ + > __shared_ptr_ ## T; \ + BOOST_CLASS_EXPORT_GUID(__shared_ptr_ ## T, "__shared_ptr_" K) \ + BOOST_CLASS_EXPORT_GUID(T, K) \ + /**/ + +#define BOOST_SHARED_POINTER_EXPORT(T) \ + BOOST_SHARED_POINTER_EXPORT_GUID( \ + T, \ + BOOST_PP_STRINGIZE(T) \ + ) \ + /**/ + +#endif // BOOST_SERIALIZATION_SHARED_PTR_132_HPP diff --git a/Utilities/BGL/boost/serialization/singleton.hpp b/Utilities/BGL/boost/serialization/singleton.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b22e517c3b341cf38d0223c3cb68518759be80e3 --- /dev/null +++ b/Utilities/BGL/boost/serialization/singleton.hpp @@ -0,0 +1,158 @@ +#ifndef BOOST_SERIALIZATION_SINGLETON_HPP +#define BOOST_SERIALIZATION_SINGLETON_HPP + +/////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8 +// singleton.hpp +// +// Copyright David Abrahams 2006. Original version +// +// Copyright Robert Ramey 2007. Changes made to permit +// application throughout the serialization library. +// +// 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) +// +// The intention here is to define a template which will convert +// any class into a singleton with the following features: +// +// a) initialized before first use. +// b) thread-safe for const access to the class +// c) non-locking +// +// In order to do this, +// a) Initialize dynamically when used. +// b) Require that all singletons be initialized before main +// is called or any entry point into the shared library is invoked. +// This guarentees no race condition for initialization. +// In debug mode, we assert that no non-const functions are called +// after main is invoked. +// + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <cassert> +#include <boost/config.hpp> +#include <boost/noncopyable.hpp> +#include <boost/serialization/force_include.hpp> + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace serialization { + +////////////////////////////////////////////////////////////////////// +// Provides a dynamically-initialized (singleton) instance of T in a +// way that avoids LNK1179 on vc6. See http://tinyurl.com/ljdp8 or +// http://lists.boost.org/Archives/boost/2006/05/105286.php for +// details. +// + +// singletons created by this code are guarenteed to be unique +// within the executable or shared library which creates them. +// This is sufficient and in fact ideal for the serialization library. +// The singleton is created when the module is loaded and destroyed +// when the module is unloaded. + +// This base class has two functions. + +// First it provides a module handle for each singleton indicating +// the executable or shared library in which it was created. This +// turns out to be necessary and sufficient to implement the tables +// used by serialization library. + +// Second, it provides a mechanism to detect when a non-const function +// is called after initialization. + +// make a singleton to lock/unlock all singletons for alteration. +// The intent is that all singletons created/used by this code +// are to be initialized before main is called. A test program +// can lock all the singletons when main is entereed. This any +// attempt to retieve a mutable instances while locked will +// generate a assertion if compiled for debug. + +class singleton_module : + public boost::noncopyable +{ +private: + static bool & get_lock(){ + static bool lock = false; + return lock; + } +public: +// static const void * get_module_handle(){ +// return static_cast<const void *>(get_module_handle); +// } + static void lock(){ + get_lock() = true; + } + static void unlock(){ + get_lock() = false; + } + static bool is_locked() { + return get_lock(); + } +}; + +namespace detail { + +template<class T> +class singleton_wrapper : public T +{ +public: + static bool m_is_destroyed; + ~singleton_wrapper(){ + m_is_destroyed = true; + } +}; + +template<class T> +bool detail::singleton_wrapper<T>::m_is_destroyed = false; + +} // detail + +template <class T> +class singleton : public singleton_module +{ +private: + BOOST_DLLEXPORT static T & instance; + // include this to provoke instantiation at pre-execution time + static void use(T const &) {} + BOOST_DLLEXPORT static T & get_instance() { + static detail::singleton_wrapper<T> t; + // refer to instance, causing it to be instantiated (and + // initialized at startup on working compilers) + assert(! detail::singleton_wrapper<T>::m_is_destroyed); + use(instance); + return static_cast<T &>(t); + } +public: + BOOST_DLLEXPORT static T & get_mutable_instance(){ + assert(! is_locked()); + return get_instance(); + } + BOOST_DLLEXPORT static const T & get_const_instance(){ + return get_instance(); + } + BOOST_DLLEXPORT static bool is_destroyed(){ + return detail::singleton_wrapper<T>::m_is_destroyed; + } +}; + +template<class T> +BOOST_DLLEXPORT T & singleton<T>::instance = singleton<T>::get_instance(); + +} // namespace serialization +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_SERIALIZATION_SINGLETON_HPP diff --git a/Utilities/BGL/boost/serialization/slist.hpp b/Utilities/BGL/boost/serialization/slist.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9e741cc3690d42b8a1fc0ea84312f8234467b459 --- /dev/null +++ b/Utilities/BGL/boost/serialization/slist.hpp @@ -0,0 +1,101 @@ +#ifndef BOOST_SERIALIZATION_SLIST_HPP +#define BOOST_SERIALIZATION_SLIST_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// slist.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 <cstddef> // size_t +#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifdef BOOST_HAS_SLIST +#include BOOST_SLIST_HEADER + +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/nvp.hpp> + +namespace boost { +namespace serialization { + +template<class Archive, class U, class Allocator> +inline void save( + Archive & ar, + const BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator> &t, + const unsigned int file_version +){ + boost::serialization::stl::save_collection< + Archive, + BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator> + >(ar, t); +} + +template<class Archive, class U, class Allocator> +inline void load( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator> &t, + const unsigned int file_version +){ + // retrieve number of elements + t.clear(); + // retrieve number of elements + collection_size_type count; + ar >> BOOST_SERIALIZATION_NVP(count); + if(std::size_t(0) == count) + return; + unsigned int v; + if(3 < ar.get_library_version()){ + ar >> boost::serialization::make_nvp("item_version", v); + } + boost::serialization::detail::stack_construct<Archive, U> u(ar, v); + ar >> boost::serialization::make_nvp("item", u.reference()); + t.push_front(u.reference()); + BOOST_DEDUCED_TYPENAME BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator>::iterator last; + last = t.begin(); + collection_size_type c = count; + while(--c > 0){ + boost::serialization::detail::stack_construct<Archive, U> + u(ar, file_version); + ar >> boost::serialization::make_nvp("item", u.reference()); + last = t.insert_after(last, u.reference()); + ar.reset_object_address(& (*last), & u.reference()); + } +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class U, class Allocator> +inline void serialize( + Archive & ar, + BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator> &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // serialization +} // namespace boost + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(BOOST_STD_EXTENSION_NAMESPACE::slist) + +#endif // BOOST_HAS_SLIST +#endif // BOOST_SERIALIZATION_SLIST_HPP diff --git a/Utilities/BGL/boost/serialization/smart_cast.hpp b/Utilities/BGL/boost/serialization/smart_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..89a79c4068b6e42dfa1808275ecdea3e2b9acef1 --- /dev/null +++ b/Utilities/BGL/boost/serialization/smart_cast.hpp @@ -0,0 +1,301 @@ +#ifndef BOOST_SERIALIZATION_SMART_CAST_HPP +#define BOOST_SERIALIZATION_SMART_CAST_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// smart_cast.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/libs/serialization for updates, documentation, and revision history. + +// casting of pointers and references. + +// In casting between different C++ classes, there are a number of +// rules that have to be kept in mind in deciding whether to use +// static_cast or dynamic_cast. + +// a) dynamic casting can only be applied when one of the types is polymorphic +// Otherwise static_cast must be used. +// b) only dynamic casting can do runtime error checking +// use of static_cast is generally un checked even when compiled for debug +// c) static_cast would be considered faster than dynamic_cast. + +// If casting is applied to a template parameter, there is no apriori way +// to know which of the two casting methods will be permitted or convenient. + +// smart_cast uses C++ type_traits, and program debug mode to select the +// most convenient cast to use. + +#include <exception> +#include <typeinfo> +#include <cstddef> // NULL + +#include <boost/config.hpp> +#include <boost/static_assert.hpp> + +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_polymorphic.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/type_traits/remove_reference.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/or.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/identity.hpp> + +namespace boost { +namespace serialization { +namespace smart_cast_impl { + + template<class T> + struct reference { + + struct polymorphic { + + struct linear { + template<class U> + static T cast(U & u){ + return static_cast<T>(u); + } + }; + + struct cross { + template<class U> + static T cast(U & u){ + return dynamic_cast<T>(u); + } + }; + + template<class U> + static T cast(U & u){ + // if we're in debug mode + #if ! defined(NDEBUG) \ + || defined(__BORLANDC__) && (__BORLANDC__ <= 0x560) \ + || defined(__MWERKS__) + // do a checked dynamic cast + return cross::cast(u); + #else + // borland 5.51 chokes here so we can't use it + // note: if remove_reference isn't function for these types + // cross casting will be selected this will work but will + // not be the most efficient method. This will conflict with + // the original smart_cast motivation. + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME mpl::and_< + mpl::not_<is_base_and_derived< + BOOST_DEDUCED_TYPENAME remove_reference<T>::type, + U + > >, + mpl::not_<is_base_and_derived< + U, + BOOST_DEDUCED_TYPENAME remove_reference<T>::type + > > + >, + // borland chokes w/o full qualification here + mpl::identity<cross>, + mpl::identity<linear> + >::type typex; + // typex works around gcc 2.95 issue + return typex::cast(u); + #endif + } + }; + + struct non_polymorphic { + template<class U> + static T cast(U & u){ + return static_cast<T>(u); + } + }; + template<class U> + static T cast(U & u){ + #if defined(__BORLANDC__) + return mpl::eval_if< + boost::is_polymorphic<U>, + mpl::identity<polymorphic>, + mpl::identity<non_polymorphic> + >::type::cast(u); + #else + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + boost::is_polymorphic<U>, + mpl::identity<polymorphic>, + mpl::identity<non_polymorphic> + >::type typex; + return typex::cast(u); + #endif + } + }; + + template<class T> + struct pointer { + + struct polymorphic { + // unfortunately, this below fails to work for virtual base + // classes. need has_virtual_base to do this. + // Subject for further study + #if 0 + struct linear { + template<class U> + static T cast(U * u){ + return static_cast<T>(u); + } + }; + + struct cross { + template<class U> + static T cast(U * u){ + T tmp = dynamic_cast<T>(u); + #ifndef NDEBUG + if ( tmp == 0 ) throw std::bad_cast(); + #endif + return tmp; + } + }; + + template<class U> + static T cast(U * u){ + // if we're in debug mode + #if ! defined(NDEBUG) || defined(__BORLANDC__) && (__BORLANDC__ <= 0x560) + // do a checked dynamic cast + return cross::cast(u); + #else + // borland 5.51 chokes here so we can't use it + // note: if remove_pointer isn't function for these types + // cross casting will be selected this will work but will + // not be the most efficient method. This will conflict with + // the original smart_cast motivation. + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME mpl::and_< + mpl::not_<is_base_and_derived< + BOOST_DEDUCED_TYPENAME remove_pointer<T>::type, + U + > >, + mpl::not_<is_base_and_derived< + U, + BOOST_DEDUCED_TYPENAME remove_pointer<T>::type + > > + >, + // borland chokes w/o full qualification here + mpl::identity<cross>, + mpl::identity<linear> + >::type typex; + return typex::cast(u); + #endif + } + #else + template<class U> + static T cast(U * u){ + T tmp = dynamic_cast<T>(u); + #ifndef NDEBUG + if ( tmp == 0 ) throw std::bad_cast(); + #endif + return tmp; + } + #endif + }; + + struct non_polymorphic { + template<class U> + static T cast(U * u){ + return static_cast<T>(u); + } + }; + + template<class U> + static T cast(U * u){ + #if defined(__BORLANDC__) + return mpl::eval_if< + boost::is_polymorphic<U>, + mpl::identity<polymorphic>, + mpl::identity<non_polymorphic> + >::type::cast(u); + #else + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + boost::is_polymorphic<U>, + mpl::identity<polymorphic>, + mpl::identity<non_polymorphic> + >::type typex; + return typex::cast(u); + #endif + } + + }; + + template<class TPtr> + struct void_pointer { + template<class UPtr> + static TPtr cast(UPtr uptr){ + return static_cast<TPtr>(uptr); + } + }; + + template<class T> + struct error { + // if we get here, its because we are using one argument in the + // cast on a system which doesn't support partial template + // specialization + template<class U> + static T cast(U u){ + BOOST_STATIC_ASSERT(sizeof(T)==0); + return * static_cast<T *>(NULL); + } + }; + +} // smart_cast_impl + +// this implements: +// smart_cast<Target *, Source *>(Source * s) +// smart_cast<Target &, Source &>(s) +// note that it will fail with +// smart_cast<Target &>(s) +template<class T, class U> +T smart_cast(U u) { + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME mpl::or_< + boost::is_same<void *, U>, + boost::is_same<void *, T>, + boost::is_same<const void *, U>, + boost::is_same<const void *, T> + >, + mpl::identity<smart_cast_impl::void_pointer<T> >, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if<boost::is_pointer<U>, + mpl::identity<smart_cast_impl::pointer<T> >, + // else + BOOST_DEDUCED_TYPENAME mpl::eval_if<boost::is_reference<U>, + mpl::identity<smart_cast_impl::reference<T> >, + // else + mpl::identity<smart_cast_impl::error<T> + > + > + > + >::type typex; + return typex::cast(u); +} + +// this implements: +// smart_cast_reference<Target &>(Source & s) +template<class T, class U> +T smart_cast_reference(U & u) { + return smart_cast_impl::reference<T>::cast(u); +} + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_SMART_CAST_HPP diff --git a/Utilities/BGL/boost/serialization/split_free.hpp b/Utilities/BGL/boost/serialization/split_free.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9dbcd2fd1d4894186dab916ade8d9b6d1de7b13c --- /dev/null +++ b/Utilities/BGL/boost/serialization/split_free.hpp @@ -0,0 +1,93 @@ +#ifndef BOOST_SERIALIZATION_SPLIT_FREE_HPP +#define BOOST_SERIALIZATION_SPLIT_FREE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// split_free.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/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/serialization/serialization.hpp> + +namespace boost { +namespace archive { + namespace detail { + template<class Archive> class interface_oarchive; + template<class Archive> class interface_iarchive; + } // namespace detail +} // namespace archive + +namespace serialization { + +//namespace detail { +template<class Archive, class T> +struct free_saver { + static void invoke( + Archive & ar, + const T & t, + const unsigned int file_version + ){ + // use function overload (version_type) to workaround + // two-phase lookup issue + const version_type v(file_version); + save(ar, t, v); + } +}; +template<class Archive, class T> +struct free_loader { + static void invoke( + Archive & ar, + T & t, + const unsigned int file_version + ){ + // use function overload (version_type) to workaround + // two-phase lookup issue + const version_type v(file_version); + load(ar, t, v); + } +}; +//} // namespace detail + +template<class Archive, class T> +inline void split_free( + Archive & ar, + T & t, + const unsigned int file_version +){ + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME Archive::is_saving, + mpl::identity</* detail:: */ free_saver<Archive, T> >, + mpl::identity</* detail:: */ free_loader<Archive, T> > + >::type typex; + typex::invoke(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +#define BOOST_SERIALIZATION_SPLIT_FREE(T) \ +namespace boost { namespace serialization { \ +template<class Archive> \ +inline void serialize( \ + Archive & ar, \ + T & t, \ + const unsigned int file_version \ +){ \ + split_free(ar, t, file_version); \ +} \ +}} +/**/ + +#endif // BOOST_SERIALIZATION_SPLIT_FREE_HPP diff --git a/Utilities/BGL/boost/serialization/split_member.hpp b/Utilities/BGL/boost/serialization/split_member.hpp new file mode 100644 index 0000000000000000000000000000000000000000..69879450d8f8b5d8bed05e15030c488bd4d79a6b --- /dev/null +++ b/Utilities/BGL/boost/serialization/split_member.hpp @@ -0,0 +1,86 @@ +#ifndef BOOST_SERIALIZATION_SPLIT_MEMBER_HPP +#define BOOST_SERIALIZATION_SPLIT_MEMBER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// split_member.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/eval_if.hpp> +#include <boost/mpl/identity.hpp> + +#include <boost/serialization/access.hpp> + +namespace boost { +namespace archive { + namespace detail { + template<class Archive> class interface_oarchive; + template<class Archive> class interface_iarchive; + } // namespace detail +} // namespace archive + +namespace serialization { +namespace detail { + + template<class Archive, class T> + struct member_saver { + static void invoke( + Archive & ar, + const T & t, + const unsigned int file_version + ){ + access::member_save(ar, t, file_version); + } + }; + + template<class Archive, class T> + struct member_loader { + static void invoke( + Archive & ar, + T & t, + const unsigned int file_version + ){ + access::member_load(ar, t, file_version); + } + }; + +} // detail + +template<class Archive, class T> +inline void split_member( + Archive & ar, T & t, const unsigned int file_version +){ + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + BOOST_DEDUCED_TYPENAME Archive::is_saving, + mpl::identity<detail::member_saver<Archive, T> >, + mpl::identity<detail::member_loader<Archive, T> > + >::type typex; + typex::invoke(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +// split member function serialize funcition into save/load +#define BOOST_SERIALIZATION_SPLIT_MEMBER() \ +template<class Archive> \ +void serialize( \ + Archive &ar, \ + const unsigned int file_version \ +){ \ + boost::serialization::split_member(ar, *this, file_version); \ +} \ +/**/ + +#endif // BOOST_SERIALIZATION_SPLIT_MEMBER_HPP diff --git a/Utilities/BGL/boost/serialization/state_saver.hpp b/Utilities/BGL/boost/serialization/state_saver.hpp new file mode 100644 index 0000000000000000000000000000000000000000..76bb4d6a50eaa312646fb72212f0b12e2c8cf5aa --- /dev/null +++ b/Utilities/BGL/boost/serialization/state_saver.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_SERIALIZATION_STATE_SAVER_HPP +#define BOOST_SERIALIZATION_STATE_SAVER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// state_saver.hpp: + +// (C) Copyright 2003-4 Pavel Vozenilek and 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/libs/serialization for updates, documentation, and revision history. + +// Inspired by Daryle Walker's iostate_saver concept. This saves the original +// value of a variable when a state_saver is constructed and restores +// upon destruction. Useful for being sure that state is restored to +// variables upon exit from scope. + + +#include <boost/config.hpp> +#ifndef BOOST_NO_EXCEPTIONS + #include <exception> +#endif + +#include <boost/call_traits.hpp> +#include <boost/noncopyable.hpp> +#include <boost/type_traits/has_nothrow_copy.hpp> +#include <boost/detail/no_exceptions_support.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> + +namespace boost { +namespace serialization { + +template<class T> +// T requirements: +// - POD or object semantic (cannot be reference, function, ...) +// - copy constructor +// - operator = (no-throw one preferred) +class state_saver : private boost::noncopyable +{ +private: + const T previous_value; + T & previous_ref; + + struct restore { + static void invoke(T & previous_ref, const T & previous_value){ + previous_ref = previous_value; // won't throw + } + }; + + struct restore_with_exception { + static void invoke(T & previous_ref, const T & previous_value){ + BOOST_TRY{ + previous_ref = previous_value; + } + BOOST_CATCH(::std::exception &) { + // we must ignore it - we are in destructor + } + BOOST_CATCH_END + } + }; + +public: + state_saver( + T & object + ) : + previous_value(object), + previous_ref(object) + {} + + ~state_saver() { + #ifndef BOOST_NO_EXCEPTIONS + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + has_nothrow_copy<T>, + mpl::identity<restore>, + mpl::identity<restore_with_exception> + >::type typex; + typex::invoke(previous_ref, previous_value); + #else + previous_ref = previous_value; + #endif + } + +}; // state_saver<> + +} // serialization +} // boost + +#endif //BOOST_SERIALIZATION_STATE_SAVER_HPP diff --git a/Utilities/BGL/boost/serialization/static_warning.hpp b/Utilities/BGL/boost/serialization/static_warning.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b41791ad86c0de40b6f9ff8bfdde5ab294dc2970 --- /dev/null +++ b/Utilities/BGL/boost/serialization/static_warning.hpp @@ -0,0 +1,108 @@ +#ifndef BOOST_SERIALIZATION_STATIC_WARNING_HPP +#define BOOST_SERIALIZATION_STATIC_WARNING_HPP + +// (C) Copyright Robert Ramey 2003. Jonathan Turkanis 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 +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/static_assert for documentation. + +/* + Revision history: + 15 June 2003 - Initial version. + 31 March 2004 - improved diagnostic messages and portability + (Jonathan Turkanis) + 03 April 2004 - works on VC6 at class and namespace scope + - ported to DigitalMars + - static warnings disabled by default; when enabled, + uses pragmas to enable required compiler warnings + on MSVC, Intel, Metrowerks and Borland 5.x. + (Jonathan Turkanis) + 30 May 2004 - tweaked for msvc 7.1 and gcc 3.3 + - static warnings ENabled by default; when enabled, + (Robert Ramey) +*/ + +#include <boost/config.hpp> + +// +// Implementation +// Makes use of the following warnings: +// 1. GCC prior to 3.3: division by zero. +// 2. BCC 6.0 preview: unreferenced local variable. +// 3. DigitalMars: returning address of local automatic variable. +// 4. VC6: class previously seen as struct (as in 'boost/mpl/print.hpp') +// 5. All others: deletion of pointer to incomplete type. +// +// The trick is to find code which produces warnings containing the name of +// a structure or variable. Details, with same numbering as above: +// 1. static_warning_impl<B>::value is zero iff B is false, so diving an int +// by this value generates a warning iff B is false. +// 2. static_warning_impl<B>::type has a constructor iff B is true, so an +// unreferenced variable of this type generates a warning iff B is false. +// 3. static_warning_impl<B>::type overloads operator& to return a dynamically +// allocated int pointer only is B is true, so returning the address of an +// automatic variable of this type generates a warning iff B is fasle. +// 4. static_warning_impl<B>::STATIC_WARNING is decalred as a struct iff B is +// false. +// 5. static_warning_impl<B>::type is incomplete iff B is false, so deleting a +// pointer to this type generates a warning iff B is false. +// + +//------------------Enable selected warnings----------------------------------// + +// Enable the warnings relied on by BOOST_STATIC_WARNING, where possible. The +// only pragma which is absolutely necessary here is for Borland 5.x, since +// W8073 is disabled by default. If enabling selected warnings is considered +// unacceptable, this section can be replaced with: +// #if defined(__BORLANDC__) && (__BORLANDC__ <= 0x600) +// pragma warn +st +// #endif + +// 6. replaced implementation with one which depends solely on +// mpl::print<>. The previous one was found to fail for functions +// under recent versions of gcc and intel compilers - Robert Ramey + +#include <boost/mpl/bool.hpp> +#include <boost/mpl/print.hpp> +#include <boost/mpl/eval_if.hpp> + +namespace boost { +namespace serialization { + +template<int L> +struct BOOST_SERIALIZATION_STATIC_WARNING_LINE{}; + +template<bool B, int L> +struct static_warning_test{ + typename boost::mpl::eval_if_c< + B, + boost::mpl::true_, + typename boost::mpl::identity< + boost::mpl::print< + BOOST_SERIALIZATION_STATIC_WARNING_LINE<L> + > + > + >::type type; +}; + +template<int i> +struct BOOST_SERIALIZATION_SS {}; + +} // serialization +} // boost + +#define BOOST_SERIALIZATION_BSW(B, L) \ + typedef boost::serialization::BOOST_SERIALIZATION_SS< \ + sizeof( boost::serialization::static_warning_test< B, L > ) \ + > BOOST_JOIN(STATIC_WARNING_LINE, L); + +#define BOOST_STATIC_WARNING(B) BOOST_SERIALIZATION_BSW(B, __LINE__) + +#endif // BOOST_SERIALIZATION_STATIC_WARNING_HPP diff --git a/Utilities/BGL/boost/serialization/string.hpp b/Utilities/BGL/boost/serialization/string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..36d15942a878fdcaf41e0f498cec9011330002fe --- /dev/null +++ b/Utilities/BGL/boost/serialization/string.hpp @@ -0,0 +1,91 @@ +#ifndef BOOST_SERIALIZATION_STRING_HPP +#define BOOST_SERIALIZATION_STRING_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// serialization/string.hpp: +// serialization for stl string templates + +// (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 <string> + +#include <boost/config.hpp> +#include <boost/serialization/level.hpp> + +BOOST_CLASS_IMPLEMENTATION(std::string, boost::serialization::primitive_type) +#ifndef BOOST_NO_STD_WSTRING +BOOST_CLASS_IMPLEMENTATION(std::wstring, boost::serialization::primitive_type) +#endif + +// left over from a previous incarnation - strings are now always primitive types +#if 0 +#include <string> +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> + +namespace boost { +namespace serialization { + +// basic_string - general case +template<class Archive, class U, class Allocator> +inline void save( + Archive & ar, + const std::basic_string<U, Allocator> &t, + const unsigned int file_version +){ + boost::serialization::stl::save_collection< + Archive, std::basic_string<U, Allocator> + >(ar, t); +} + +template<class Archive, class U, class Allocator> +inline void load( + Archive & ar, + std::basic_string<U, Allocator> &t, + const unsigned int file_version +){ + boost::serialization::stl::load_collection< + Archive, + std::basic_string<U, Allocator>, + boost::serialization::stl::archive_input_seq< + Archive, + std::basic_string<U, Allocator> + >, + boost::serialization::stl::reserve_imp< + std::basic_string<U, Allocator> + > + >(ar, t); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class U, class Allocator> +inline void serialize( + Archive & ar, + std::basic_string<U, Allocator> & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // serialization +} // namespace boost + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(std::vector) + +#endif + +#endif // BOOST_SERIALIZATION_STRING_HPP diff --git a/Utilities/BGL/boost/serialization/strong_typedef.hpp b/Utilities/BGL/boost/serialization/strong_typedef.hpp new file mode 100644 index 0000000000000000000000000000000000000000..647c302efb7c9c49411837f7cb6b1b45ad341768 --- /dev/null +++ b/Utilities/BGL/boost/serialization/strong_typedef.hpp @@ -0,0 +1,66 @@ +#ifndef BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP +#define BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// strong_typedef.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/libs/serialization for updates, documentation, and revision history. + +// macro used to implement a strong typedef. strong typedef +// guarentees that two types are distinguised even though the +// share the same underlying implementation. typedef does not create +// a new type. BOOST_STRONG_TYPEDEF(T, D) creates a new type named D +// that operates as a type T. + +#include <boost/config.hpp> +#include <boost/operators.hpp> + +#if !defined(__BORLANDC__) || __BORLANDC__ >= 0x590 + #define BOOST_STRONG_TYPEDEF(T, D) \ + struct D \ + : boost::totally_ordered1< D \ + , boost::totally_ordered2< D, T \ + > > \ + { \ + T t; \ + explicit D(const T t_) : t(t_) {}; \ + D(){}; \ + D(const D & t_) : t(t_.t){} \ + D & operator=(const D & rhs) { t = rhs.t; return *this;} \ + D & operator=(const T & rhs) { t = rhs; return *this;} \ + operator const T & () const {return t; } \ + operator T & () { return t; } \ + bool operator==(const D & rhs) const { return t == rhs.t; } \ + bool operator<(const D & rhs) const { return t < rhs.t; } \ + }; +#else + #define BOOST_STRONG_TYPEDEF(T, D) \ + struct D \ + : boost::totally_ordered1< D \ + , boost::totally_ordered2< D, T \ + > > \ + { \ + T t; \ + explicit D(const T t_) : t(t_) {}; \ + D(){}; \ + D(const D & t_) : t(t_.t){} \ + D & operator=(const D & rhs) { t = rhs.t; return *this;} \ + D & operator=(const T & rhs) { t = rhs; return *this;} \ + /*operator const T & () const {return t; }*/ \ + operator T & () { return t; } \ + bool operator==(const D & rhs) const { return t == rhs.t; } \ + bool operator<(const D & rhs) const { return t < rhs.t; } \ + }; +#endif // !defined(__BORLANDC) || __BORLANDC__ >= 0x590 + +#endif // BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP diff --git a/Utilities/BGL/boost/serialization/throw_exception.hpp b/Utilities/BGL/boost/serialization/throw_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dad0efe5799022c648a8e5698d0de96cf0a2db6d --- /dev/null +++ b/Utilities/BGL/boost/serialization/throw_exception.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_SERIALIZATION_THROW_EXCEPTION_HPP_INCLUDED +#define BOOST_SERIALIZATION_THROW_EXCEPTION_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/throw_exception.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/config.hpp> + +#ifndef BOOST_NO_EXCEPTIONS +#include <exception> +#endif + +namespace boost { +namespace serialization { + +#ifdef BOOST_NO_EXCEPTIONS + +void inline throw_exception(std::exception const & e) { + ::boost::throw_exception(e); +} + +#else + +template<class E> inline void throw_exception(E const & e){ + throw e; +} + +#endif + +} // namespace serialization +} // namespace boost + +#endif // #ifndef BOOST_SERIALIZATION_THROW_EXCEPTION_HPP_INCLUDED diff --git a/Utilities/BGL/boost/serialization/tracking.hpp b/Utilities/BGL/boost/serialization/tracking.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5ed2910ddfa41909cecd1dab5e93c2e64128c6d7 --- /dev/null +++ b/Utilities/BGL/boost/serialization/tracking.hpp @@ -0,0 +1,118 @@ +#ifndef BOOST_SERIALIZATION_TRACKING_HPP +#define BOOST_SERIALIZATION_TRACKING_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// tracking.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/static_assert.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/equal_to.hpp> +#include <boost/mpl/greater.hpp> +#include <boost/mpl/integral_c_tag.hpp> + +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/serialization/level.hpp> +#include <boost/serialization/tracking_enum.hpp> +#include <boost/serialization/type_info_implementation.hpp> + +namespace boost { +namespace serialization { + +struct basic_traits; + +// default tracking level +template<class T> +struct tracking_level_impl { + template<class U> + struct traits_class_tracking { + typedef BOOST_DEDUCED_TYPENAME U::tracking type; + }; + typedef mpl::integral_c_tag tag; + // note: at least one compiler complained w/o the full qualification + // on basic traits below + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_base_and_derived<boost::serialization::basic_traits, T>, + traits_class_tracking<T>, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_pointer<T>, + // pointers are not tracked by default + mpl::int_<track_never>, + //else + BOOST_DEDUCED_TYPENAME mpl::eval_if< + // for primitives + BOOST_DEDUCED_TYPENAME mpl::equal_to< + implementation_level<T>, + mpl::int_<primitive_type> + >, + // is never + mpl::int_<track_never>, + // otherwise its selective + mpl::int_<track_selectively> + > > >::type type; + BOOST_STATIC_CONSTANT(int, value = type::value); +}; + +template<class T> +struct tracking_level : + public tracking_level_impl<const T> +{ +}; + +template<class T, enum tracking_type L> +inline bool operator>=(tracking_level<T> t, enum tracking_type l) +{ + return t.value >= (int)l; +} + +} // namespace serialization +} // namespace boost + + +// The STATIC_ASSERT is prevents one from setting tracking for a primitive type. +// This almost HAS to be an error. Doing this will effect serialization of all +// char's in your program which is almost certainly what you don't want to do. +// If you want to track all instances of a given primitive type, You'll have to +// wrap it in your own type so its not a primitive anymore. Then it will compile +// without problem. +#define BOOST_CLASS_TRACKING(T, E) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct tracking_level< T > \ +{ \ + typedef mpl::integral_c_tag tag; \ + typedef mpl::int_< E> type; \ + BOOST_STATIC_CONSTANT( \ + int, \ + value = tracking_level::type::value \ + ); \ + /* tracking for a class */ \ + BOOST_STATIC_ASSERT(( \ + mpl::greater< \ + /* that is a prmitive */ \ + implementation_level< T >, \ + mpl::int_<primitive_type> \ + >::value \ + )); \ +}; \ +}} + +#endif // BOOST_SERIALIZATION_TRACKING_HPP diff --git a/Utilities/BGL/boost/serialization/tracking_enum.hpp b/Utilities/BGL/boost/serialization/tracking_enum.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e4e4e2135996e68db65c20c62faeea9b3189d62f --- /dev/null +++ b/Utilities/BGL/boost/serialization/tracking_enum.hpp @@ -0,0 +1,41 @@ +#ifndef BOOST_SERIALIZATION_TRACKING_ENUM_HPP +#define BOOST_SERIALIZATION_TRACKING_ENUM_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// tracking_enum.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. + +namespace boost { +namespace serialization { + +// addresses of serialized objects may be tracked to avoid saving/loading +// redundant copies. This header defines a class trait that can be used +// to specify when objects should be tracked + +// names for each tracking level +enum tracking_type +{ + // never track this type + track_never = 0, + // track objects of this type if the object is serialized through a + // pointer. + track_selectively = 1, + // always track this type + track_always = 2 +}; + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_TRACKING_ENUM_HPP diff --git a/Utilities/BGL/boost/serialization/traits.hpp b/Utilities/BGL/boost/serialization/traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..da800098a2da1b0e11fcb23fa86261040acf7da7 --- /dev/null +++ b/Utilities/BGL/boost/serialization/traits.hpp @@ -0,0 +1,65 @@ +#ifndef BOOST_SERIALIZATION_TRAITS_HPP +#define BOOST_SERIALIZATION_TRAITS_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// traits.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. + +// This header is used to apply serialization traits to templates. The +// standard system can't be used for platforms which don't support +// Partial Templlate Specialization. + +// The motivation for this is the Name-Value Pair (NVP) template. +// it has to work the same on all platforms in order for archives +// to be portable accross platforms. + +#include <boost/config.hpp> +#include <boost/static_assert.hpp> + +#include <boost/mpl/int.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/serialization/level_enum.hpp> +#include <boost/serialization/tracking_enum.hpp> + +namespace boost { +namespace serialization { + +// common base class used to detect appended traits class +struct basic_traits {}; + +template <class T> +struct extended_type_info_impl; + +template< + class T, + int Level, + int Tracking, + unsigned int Version = 0, + class ETII = extended_type_info_impl< T >, + class Wrapper = mpl::false_ +> +struct traits : public basic_traits { + BOOST_STATIC_ASSERT(Version == 0 || Level >= object_class_info); + BOOST_STATIC_ASSERT(Tracking == track_never || Level >= object_serializable); + typedef BOOST_DEDUCED_TYPENAME mpl::int_<Level> level; + typedef BOOST_DEDUCED_TYPENAME mpl::int_<Tracking> tracking; + typedef BOOST_DEDUCED_TYPENAME mpl::int_<Version> version; + typedef ETII type_info_implementation; + typedef Wrapper is_wrapper; +}; + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_TRAITS_HPP diff --git a/Utilities/BGL/boost/serialization/type_info_implementation.hpp b/Utilities/BGL/boost/serialization/type_info_implementation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0dbdcd55a82915b57002a1be1d50613788bd5da2 --- /dev/null +++ b/Utilities/BGL/boost/serialization/type_info_implementation.hpp @@ -0,0 +1,86 @@ +#ifndef BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP +#define BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// type_info_implementation.hpp: interface for portable version of type_info + +// (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/detail/workaround.hpp> + +#include <boost/static_assert.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/serialization/traits.hpp> + +namespace boost { +namespace serialization { + +// note that T and const T are folded into const T so that +// there is only one table entry per type +template<class T> +struct type_info_implementation { + template<class U> + struct traits_class_typeinfo_implementation { + typedef BOOST_DEDUCED_TYPENAME U::type_info_implementation::type type; + }; + // note: at least one compiler complained w/o the full qualification + // on basic traits below + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_base_and_derived<boost::serialization::basic_traits, T>, + traits_class_typeinfo_implementation<T>, + //else + mpl::identity< + BOOST_DEDUCED_TYPENAME extended_type_info_impl<T>::type + > + >::type type; +}; + +} // namespace serialization +} // namespace boost + +// define a macro to assign a particular derivation of extended_type_info +// to a specified a class. +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) +#define BOOST_CLASS_TYPE_INFO(T, ETI) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct type_info_implementation< T > { \ + typedef const ETI type; \ +}; \ +} \ +} \ +/**/ +#else +#define BOOST_CLASS_TYPE_INFO(T, ETI) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct type_info_implementation< T > { \ + typedef ETI type; \ +}; \ +template<> \ +struct type_info_implementation< const T > { \ + typedef ETI type; \ +}; \ +} \ +} \ +/**/ +#endif + +#endif /// BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP diff --git a/Utilities/BGL/boost/serialization/utility.hpp b/Utilities/BGL/boost/serialization/utility.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f36b50f5ac9b00d57a2a4ca7173ee3742beced43 --- /dev/null +++ b/Utilities/BGL/boost/serialization/utility.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_SERIALIZATION_UTILITY_HPP +#define BOOST_SERIALIZATION_UTILITY_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// serialization/utility.hpp: +// serialization for stl utility templates + +// (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 <utility> +#include <boost/config.hpp> + +#include <boost/type_traits/remove_const.hpp> +#include <boost/serialization/nvp.hpp> +#include <boost/serialization/is_bitwise_serializable.hpp> +#include <boost/mpl/and.hpp> + +namespace boost { +namespace serialization { + +// pair +template<class Archive, class F, class S> +inline void serialize( + Archive & ar, + std::pair<F, S> & p, + const unsigned int /* file_version */ +){ + // note: we remove any const-ness on the first argument. The reason is that + // for stl maps, the type saved is pair<const key, T). We remove + // the const-ness in order to be able to load it. + typedef BOOST_DEDUCED_TYPENAME boost::remove_const<F>::type typef; + ar & boost::serialization::make_nvp("first", const_cast<typef &>(p.first)); + ar & boost::serialization::make_nvp("second", p.second); +} + +/// specialization of is_bitwise_serializable for pairs +template <class T, class U> +struct is_bitwise_serializable<std::pair<T,U> > + : public mpl::and_<is_bitwise_serializable<T>,is_bitwise_serializable<U> > +{ +}; + +} // serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_UTILITY_HPP diff --git a/Utilities/BGL/boost/serialization/valarray.hpp b/Utilities/BGL/boost/serialization/valarray.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7a81e1da58ea7840c2cc7f75474b12e6aad9a8c0 --- /dev/null +++ b/Utilities/BGL/boost/serialization/valarray.hpp @@ -0,0 +1,74 @@ +#ifndef BOOST_SERIALIZATION_VALARAY_HPP +#define BOOST_SERIALIZATION_VALARAY_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// valarray.hpp: serialization for stl vector templates + +// (C) Copyright 2005 Matthias Troyer . +// 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 <valarray> +#include <boost/config.hpp> +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/array.hpp> +#include <boost/serialization/collection_size_type.hpp> +#include <boost/serialization/detail/get_data.hpp> + +// function specializations must be defined in the appropriate +// namespace - boost::serialization +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +#define STD _STLP_STD +#else +#define STD std +#endif + +namespace boost { namespace serialization { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// valarray<T> + +template<class Archive, class U> +void save( Archive & ar, const STD::valarray<U> &t, const unsigned int /*file_version*/ ) +{ + const collection_size_type count(t.size()); + ar << BOOST_SERIALIZATION_NVP(count); + if (t.size()) + ar << make_array(detail::get_data(t), t.size()); +} + + +template<class Archive, class U> +void load( Archive & ar, STD::valarray<U> &t, const unsigned int /*file_version*/ ) +{ + collection_size_type count; + ar >> BOOST_SERIALIZATION_NVP(count); + t.resize(count); + if (t.size()) + ar >> make_array(detail::get_data(t), t.size()); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class U> +inline void serialize( Archive & ar, STD::valarray<U> & t, const unsigned int file_version) +{ + boost::serialization::split_free(ar, t, file_version); +} + +} } // end namespace boost::serialization + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::valarray) +#undef STD + +#endif // BOOST_SERIALIZATION_VALARAY_HPP diff --git a/Utilities/BGL/boost/serialization/variant.hpp b/Utilities/BGL/boost/serialization/variant.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5ab822d5431a704f980d6c62f9c9ee8f03a2a0c2 --- /dev/null +++ b/Utilities/BGL/boost/serialization/variant.hpp @@ -0,0 +1,162 @@ +#ifndef BOOST_SERIALIZATION_VARIANT_HPP +#define BOOST_SERIALIZATION_VARIANT_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1020) +# pragma warning (disable : 4786) // too long name, harmless warning +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// variant.hpp - non-intrusive serialization of variant types +// +// copyright (c) 2005 +// troy d. straszheim <troy@resophonic.com> +// http://www.resophonic.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. +// +// thanks to Robert Ramey, Peter Dimov, and Richard Crossley. +// + +#include <boost/mpl/front.hpp> +#include <boost/mpl/pop_front.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/size.hpp> +#include <boost/mpl/empty.hpp> + +#include <boost/serialization/throw_exception.hpp> + +#include <boost/variant.hpp> + +#include <boost/archive/archive_exception.hpp> + +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/serialization.hpp> + +namespace boost { +namespace serialization { + +template<class Archive> +struct variant_save_visitor : + boost::static_visitor<> +{ + variant_save_visitor(Archive& ar) : + m_ar(ar) + {} + template<class T> + void operator()(T const & value) const + { + m_ar << BOOST_SERIALIZATION_NVP(value); + } +private: + Archive & m_ar; +}; + +template<class Archive, BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)> +void save( + Archive & ar, + boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const & v, + unsigned int /*version*/ +){ + int which = v.which(); + ar << BOOST_SERIALIZATION_NVP(which); + typedef BOOST_DEDUCED_TYPENAME boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types types; + variant_save_visitor<Archive> visitor(ar); + v.apply_visitor(visitor); +} + +template<class S> +struct variant_impl { + + struct load_null { + template<class Archive, class V> + static void invoke( + Archive & /*ar*/, + int /*which*/, + V & /*v*/, + const unsigned int /*version*/ + ){} + }; + + struct load_impl { + template<class Archive, class V> + static void invoke( + Archive & ar, + int which, + V & v, + const unsigned int version + ){ + if(which == 0){ + // note: A non-intrusive implementation (such as this one) + // necessary has to copy the value. This wouldn't be necessary + // with an implementation that de-serialized to the address of the + // aligned storage included in the variant. + typedef BOOST_DEDUCED_TYPENAME mpl::front<S>::type head_type; + head_type value; + ar >> BOOST_SERIALIZATION_NVP(value); + v = value; + ar.reset_object_address(& boost::get<head_type>(v), & value); + return; + } + typedef BOOST_DEDUCED_TYPENAME mpl::pop_front<S>::type type; + variant_impl<type>::load(ar, which - 1, v, version); + } + }; + + template<class Archive, class V> + static void load( + Archive & ar, + int which, + V & v, + const unsigned int version + ){ + typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<mpl::empty<S>, + mpl::identity<load_null>, + mpl::identity<load_impl> + >::type typex; + typex::invoke(ar, which, v, version); + } + +}; + +template<class Archive, BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)> +void load( + Archive & ar, + boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>& v, + const unsigned int version +){ + int which; + typedef BOOST_DEDUCED_TYPENAME boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types types; + ar >> BOOST_SERIALIZATION_NVP(which); + if(which >= mpl::size<types>::value) + // this might happen if a type was removed from the list of variant types + boost::serialization::throw_exception( + boost::archive::archive_exception( + boost::archive::archive_exception::unsupported_version + ) + ); + variant_impl<types>::load(ar, which, v, version); +} + +template<class Archive,BOOST_VARIANT_ENUM_PARAMS(/* typename */ class T)> +inline void serialize( + Archive & ar, + boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> & v, + const unsigned int file_version +){ + split_free(ar,v,file_version); +} + +} // namespace serialization +} // namespace boost + +#endif //BOOST_SERIALIZATION_VARIANT_HPP diff --git a/Utilities/BGL/boost/serialization/vector.hpp b/Utilities/BGL/boost/serialization/vector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c7f840730fdb2580235c15d52eb47d7472ef9d44 --- /dev/null +++ b/Utilities/BGL/boost/serialization/vector.hpp @@ -0,0 +1,211 @@ +#ifndef BOOST_SERIALIZATION_VECTOR_HPP +#define BOOST_SERIALIZATION_VECTOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// vector.hpp: serialization for stl vector templates + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// fast array serialization (C) Copyright 2005 Matthias Troyer +// 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 <vector> + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/type_traits/is_arithmetic.hpp> + +#include <boost/serialization/collections_save_imp.hpp> +#include <boost/serialization/collections_load_imp.hpp> +#include <boost/serialization/split_free.hpp> +#include <boost/serialization/array.hpp> +#include <boost/serialization/detail/get_data.hpp> +#include <boost/mpl/bool.hpp> + +// default is being compatible with version 1.34.1 files, not 1.35 files +#ifndef BOOST_SERIALIZATION_VECTOR_VERSIONED +#define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V==4 || V==5) +#endif + +namespace boost { +namespace serialization { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// vector<T> + +// the default versions + +template<class Archive, class U, class Allocator> +inline void save( + Archive & ar, + const std::vector<U, Allocator> &t, + const unsigned int /* file_version */, + mpl::false_ +){ + boost::serialization::stl::save_collection<Archive, STD::vector<U, Allocator> >( + ar, t + ); +} + +template<class Archive, class U, class Allocator> +inline void load( + Archive & ar, + std::vector<U, Allocator> &t, + const unsigned int /* file_version */, + mpl::false_ +){ + boost::serialization::stl::load_collection< + Archive, + std::vector<U, Allocator>, + boost::serialization::stl::archive_input_seq< + Archive, STD::vector<U, Allocator> + >, + boost::serialization::stl::reserve_imp<STD::vector<U, Allocator> > + >(ar, t); +} + +// the optimized versions + +template<class Archive, class U, class Allocator> +inline void save( + Archive & ar, + const std::vector<U, Allocator> &t, + const unsigned int /* file_version */, + mpl::true_ +){ + const collection_size_type count(t.size()); + ar << BOOST_SERIALIZATION_NVP(count); + if (!t.empty()) + ar << make_array(detail::get_data(t),t.size()); +} + +template<class Archive, class U, class Allocator> +inline void load( + Archive & ar, + std::vector<U, Allocator> &t, + const unsigned int /* file_version */, + mpl::true_ +){ + collection_size_type count(t.size()); + ar >> BOOST_SERIALIZATION_NVP(count); + t.resize(count); + unsigned int item_version=0; + if(BOOST_SERIALIZATION_VECTOR_VERSIONED(ar.get_library_version())) { + ar >> BOOST_SERIALIZATION_NVP(item_version); + } + if (!t.empty()) + ar >> make_array(detail::get_data(t),t.size()); + } + +// dispatch to either default or optimized versions + +template<class Archive, class U, class Allocator> +inline void save( + Archive & ar, + const std::vector<U, Allocator> &t, + const unsigned int file_version +){ + typedef BOOST_DEDUCED_TYPENAME + boost::serialization::use_array_optimization<Archive>::template apply< + BOOST_DEDUCED_TYPENAME remove_const<U>::type + >::type use_optimized; + save(ar,t,file_version, use_optimized()); +} + +template<class Archive, class U, class Allocator> +inline void load( + Archive & ar, + std::vector<U, Allocator> &t, + const unsigned int file_version +){ +#ifdef BOOST_SERIALIZATION_VECTOR_135_HPP + if (ar.get_library_version()==5) + { + load(ar,t,file_version, boost::is_arithmetic<U>()); + return; + } +#endif + typedef BOOST_DEDUCED_TYPENAME + boost::serialization::use_array_optimization<Archive>::template apply< + BOOST_DEDUCED_TYPENAME remove_const<U>::type + >::type use_optimized; + load(ar,t,file_version, use_optimized()); +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class U, class Allocator> +inline void serialize( + Archive & ar, + std::vector<U, Allocator> & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// vector<bool> +template<class Archive, class Allocator> +inline void save( + Archive & ar, + const std::vector<bool, Allocator> &t, + const unsigned int /* file_version */ +){ + // record number of elements + collection_size_type count (t.size()); + ar << BOOST_SERIALIZATION_NVP(count); + std::vector<bool>::const_iterator it = t.begin(); + while(count-- > 0){ + bool tb = *it++; + ar << boost::serialization::make_nvp("item", tb); + } +} + +template<class Archive, class Allocator> +inline void load( + Archive & ar, + std::vector<bool, Allocator> &t, + const unsigned int /* file_version */ +){ + // retrieve number of elements + collection_size_type count; + ar >> BOOST_SERIALIZATION_NVP(count); + t.clear(); + while(count-- > 0){ + bool i; + ar >> boost::serialization::make_nvp("item", i); + t.push_back(i); + } +} + +// split non-intrusive serialization function member into separate +// non intrusive save/load member functions +template<class Archive, class Allocator> +inline void serialize( + Archive & ar, + std::vector<bool, Allocator> & t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +#endif // BOOST_WORKAROUND + +} // serialization +} // namespace boost + +#include <boost/serialization/collection_traits.hpp> + +BOOST_SERIALIZATION_COLLECTION_TRAITS(std::vector) + +#endif // BOOST_SERIALIZATION_VECTOR_HPP diff --git a/Utilities/BGL/boost/serialization/vector_135.hpp b/Utilities/BGL/boost/serialization/vector_135.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3554a24471bfab3ca9448da5f4944cb8603b387c --- /dev/null +++ b/Utilities/BGL/boost/serialization/vector_135.hpp @@ -0,0 +1,26 @@ +////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// vector_135.hpp: serialization for stl vector templates for compatibility +// with release 1.35, which had a bug + +// (C) Copyright 2008 Matthias Troyer +// 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. + + +#ifndef BOOST_SERIALIZATION_VECTOR_135_HPP +#define BOOST_SERIALIZATION_VECTOR_135_HPP + +#ifdef BOOST_SERIALIZATION_VECTOR_VERSIONED +#if BOOST_SERIALIZATION_VECTOR_VERSION != 4 +#error Boost.Serialization cannot be compatible with both 1.35 and 1.36-1.40 files +#endif +#else +#define BOOST_SERIALIZATION_VECTOR_VERSIONED(V) (V==4) +#endif + +#include <boost/serialization/vector.hpp> + +#endif // BOOST_SERIALIZATION_VECTOR_135_HPP diff --git a/Utilities/BGL/boost/serialization/version.hpp b/Utilities/BGL/boost/serialization/version.hpp new file mode 100644 index 0000000000000000000000000000000000000000..54c72fc26e8255ab0aa69a4ff50e15bba8676eb5 --- /dev/null +++ b/Utilities/BGL/boost/serialization/version.hpp @@ -0,0 +1,92 @@ +#ifndef BOOST_SERIALIZATION_VERSION_HPP +#define BOOST_SERIALIZATION_VERSION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// version.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/int.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/integral_c_tag.hpp> + +#include <boost/type_traits/is_base_and_derived.hpp> +//#include <boost/serialization/traits.hpp> + +namespace boost { +namespace serialization { + +struct basic_traits; + +// default version number is 0. Override with higher version +// when class definition changes. +template<class T> +struct version +{ + template<class U> + struct traits_class_version { + typedef BOOST_DEDUCED_TYPENAME U::version type; + }; + + typedef mpl::integral_c_tag tag; + // note: at least one compiler complained w/o the full qualification + // on basic traits below + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if< + is_base_and_derived<boost::serialization::basic_traits,T>, + traits_class_version<T>, + mpl::int_<0> + >::type type; + BOOST_STATIC_CONSTANT(int, value = version::type::value); +}; + +} // namespace serialization +} // namespace boost + +/* note: at first it seemed that this would be a good place to trap + * as an error an attempt to set a version # for a class which doesn't + * save its class information (including version #) in the archive. + * However, this imposes a requirement that the version be set after + * the implemention level which would be pretty confusing. If this + * is to be done, do this check in the input or output operators when + * ALL the serialization traits are available. Included the implementation + * here with this comment as a reminder not to do this! + */ +//#include <boost/serialization/level.hpp> +//#include <boost/mpl/equal_to.hpp> + +// specify the current version number for the class +#define BOOST_CLASS_VERSION(T, N) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct version<T > \ +{ \ + typedef mpl::int_<N> type; \ + typedef mpl::integral_c_tag tag; \ + BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value); \ + /* \ + BOOST_STATIC_ASSERT(( \ + mpl::equal_to< \ + :implementation_level<T >, \ + mpl::int_<object_class_info> \ + >::value \ + )); \ + */ \ +}; \ +} \ +} + +#endif // BOOST_SERIALIZATION_VERSION_HPP diff --git a/Utilities/BGL/boost/serialization/void_cast.hpp b/Utilities/BGL/boost/serialization/void_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6190849da2086e781fa3a3b0067cdc538969c7af --- /dev/null +++ b/Utilities/BGL/boost/serialization/void_cast.hpp @@ -0,0 +1,290 @@ +#ifndef BOOST_SERIALIZATION_VOID_CAST_HPP +#define BOOST_SERIALIZATION_VOID_CAST_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// void_cast.hpp: interface for run-time casting of void pointers. + +// (C) Copyright 2002-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) +// gennadiy.rozental@tfn.com + +// See http://www.boost.org for updates, documentation, and revision history. + +#include <cstddef> // for ptrdiff_t +#include <boost/noncopyable.hpp> + +#include <boost/serialization/config.hpp> +#include <boost/serialization/smart_cast.hpp> +#include <boost/serialization/singleton.hpp> +#include <boost/serialization/force_include.hpp> +#include <boost/serialization/type_info_implementation.hpp> +#include <boost/serialization/extended_type_info.hpp> +#include <boost/type_traits/is_virtual_base_of.hpp> +#include <boost/serialization/void_cast_fwd.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275) +#endif + +namespace boost { +namespace serialization { + +class extended_type_info; + +// Given a void *, assume that it really points to an instance of one type +// and alter it so that it would point to an instance of a related type. +// Return the altered pointer. If there exists no sequence of casts that +// can transform from_type to to_type, return a NULL. + +BOOST_SERIALIZATION_DECL(void const *) +void_upcast( + extended_type_info const & derived, + extended_type_info const & base, + void const * const t +); + +inline void * +void_upcast( + extended_type_info const & derived, + extended_type_info const & base, + void * const t +){ + return const_cast<void*>(void_upcast( + derived, + base, + const_cast<void const *>(t) + )); +} + +BOOST_SERIALIZATION_DECL(void const *) +void_downcast( + extended_type_info const & derived, + extended_type_info const & base, + void const * const t +); + +inline void * +void_downcast( + extended_type_info const & derived, + extended_type_info const & base, + void * const t +){ + return const_cast<void*>(void_downcast( + derived, + base, + const_cast<void const *>(t) + )); +} + +namespace void_cast_detail { + +class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) void_caster : + private boost::noncopyable +{ + friend + BOOST_SERIALIZATION_DECL(void const *) + boost::serialization::void_upcast( + extended_type_info const & derived, + extended_type_info const & base, + void const * const + ); + friend + BOOST_SERIALIZATION_DECL(void const *) + boost::serialization::void_downcast( + extended_type_info const & derived, + extended_type_info const & base, + void const * const + ); +protected: + void recursive_register(bool includes_virtual_base = false) const; + void recursive_unregister() const; +public: + // Data members + const extended_type_info * m_derived; + const extended_type_info * m_base; + /*const*/ std::ptrdiff_t m_difference; + void_caster const * const m_parent; + + // note that void_casters are keyed on value of + // member extended type info records - NOT their + // addresses. This is necessary in order for the + // void cast operations to work across dll and exe + // module boundries. + bool operator<(const void_caster & rhs) const; + + const void_caster & operator*(){ + return *this; + } + // each derived class must re-implement these; + virtual void const * upcast(void const * const t) const = 0; + virtual void const * downcast(void const * const t) const = 0; + // Constructor + void_caster( + extended_type_info const * derived, + extended_type_info const * base, + std::ptrdiff_t difference = 0, + void_caster const * const parent = 0 + ) : + m_derived(derived), + m_base(base), + m_difference(difference), + m_parent(parent) + {} + virtual ~void_caster(){} +}; + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275 4511 4512) +#endif + +template <class Derived, class Base> +class void_caster_primitive : + public void_caster +{ + virtual void const * downcast(void const * const t) const { + const Derived * d = + boost::serialization::smart_cast<const Derived *, const Base *>( + static_cast<const Base *>(t) + ); + return d; + } + virtual void const * upcast(void const * const t) const { + const Base * b = + boost::serialization::smart_cast<const Base *, const Derived *>( + static_cast<const Derived *>(t) + ); + return b; + } +public: + void_caster_primitive(); + virtual ~void_caster_primitive(); +}; + +template <class Derived, class Base> +void_caster_primitive<Derived, Base>::void_caster_primitive() : + void_caster( + & type_info_implementation<Derived>::type::get_const_instance(), + & type_info_implementation<Base>::type::get_const_instance(), + // note:I wanted to display from 0 here, but at least one compiler + // treated 0 by not shifting it at all. + reinterpret_cast<std::ptrdiff_t>( + static_cast<Derived *>( + reinterpret_cast<Base *>(1) + ) + ) - 1 + ) +{ + recursive_register(); +} + +template <class Derived, class Base> +void_caster_primitive<Derived, Base>::~void_caster_primitive(){ + recursive_unregister(); +} + +template <class Derived, class Base> +class void_caster_virtual_base : + public void_caster +{ +public: + virtual void const * downcast(void const * const t) const { + const Derived * d = + dynamic_cast<const Derived *>( + static_cast<const Base *>(t) + ); + return d; + } + virtual void const * upcast(void const * const t) const { + const Base * b = + dynamic_cast<const Base *>( + static_cast<const Derived *>(t) + ); + return b; + } + void_caster_virtual_base(); + virtual ~void_caster_virtual_base(); +}; + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +template <class Derived, class Base> +void_caster_virtual_base<Derived,Base>::void_caster_virtual_base() : + void_caster( + & (type_info_implementation<Derived>::type::get_const_instance()), + & (type_info_implementation<Base>::type::get_const_instance()) + ) +{ + recursive_register(true); +} + +template <class Derived, class Base> +void_caster_virtual_base<Derived,Base>::~void_caster_virtual_base(){ + recursive_unregister(); +} + +template <class Derived, class Base> +struct void_caster_base : + public void_caster +{ + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if<boost::is_virtual_base_of<Base,Derived>, + mpl::identity< + void_cast_detail::void_caster_virtual_base<Derived, Base> + > + ,// else + mpl::identity< + void_cast_detail::void_caster_primitive<Derived, Base> + > + >::type type; +}; + +} // void_cast_detail + +template<class Derived, class Base> +BOOST_DLLEXPORT +inline const void_cast_detail::void_caster & void_cast_register( + Derived const * /* dnull = NULL */, + Base const * /* bnull = NULL */ +){ + typedef + BOOST_DEDUCED_TYPENAME mpl::eval_if<boost::is_virtual_base_of<Base,Derived>, + mpl::identity< + void_cast_detail::void_caster_virtual_base<Derived, Base> + > + ,// else + mpl::identity< + void_cast_detail::void_caster_primitive<Derived, Base> + > + >::type typex; + return singleton<typex>::get_const_instance(); +} + +template<class Derived, class Base> +class void_caster : + public void_cast_detail::void_caster_base<Derived, Base>::type +{ +}; + +} // namespace serialization +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas + +#endif // BOOST_SERIALIZATION_VOID_CAST_HPP diff --git a/Utilities/BGL/boost/serialization/void_cast_fwd.hpp b/Utilities/BGL/boost/serialization/void_cast_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c94adb2ec25f48bd41d858581b0aced61e47a66e --- /dev/null +++ b/Utilities/BGL/boost/serialization/void_cast_fwd.hpp @@ -0,0 +1,37 @@ +#ifndef BOOST_SERIALIZATION_VOID_CAST_FWD_HPP +#define BOOST_SERIALIZATION_VOID_CAST_FWD_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// void_cast_fwd.hpp: interface for run-time casting of void pointers. + +// (C) Copyright 2005 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) +// gennadiy.rozental@tfn.com + +// See http://www.boost.org for updates, documentation, and revision history. + +#include <cstddef> // NULL +#include <boost/serialization/force_include.hpp> + +namespace boost { +namespace serialization { +namespace void_cast_detail{ +class void_caster; +} // namespace void_cast_detail +template<class Derived, class Base> +BOOST_DLLEXPORT +inline const void_cast_detail::void_caster & void_cast_register( + const Derived * dnull = NULL, + const Base * bnull = NULL +) BOOST_USED; +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_VOID_CAST_HPP diff --git a/Utilities/BGL/boost/serialization/weak_ptr.hpp b/Utilities/BGL/boost/serialization/weak_ptr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..403c18ab550d17b965a079acc1af0e314653cd25 --- /dev/null +++ b/Utilities/BGL/boost/serialization/weak_ptr.hpp @@ -0,0 +1,58 @@ +#ifndef BOOST_SERIALIZATION_WEAK_PTR_HPP +#define BOOST_SERIALIZATION_WEAK_PTR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// shared_ptr.hpp: serialization for boost shared pointer + +// (C) Copyright 2004 Robert Ramey and Martin Ecker +// 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/weak_ptr.hpp> +#include <boost/serialization/shared_ptr.hpp> + +namespace boost { +namespace serialization{ + +template<class Archive, class T> +inline void save( + Archive & ar, + const boost::weak_ptr<T> &t, + const unsigned int /* file_version */ +){ + const boost::shared_ptr<T> sp = t.lock(); + ar << boost::serialization::make_nvp("weak_ptr", sp); +} + +template<class Archive, class T> +inline void load( + Archive & ar, + boost::weak_ptr<T> &t, + const unsigned int /* file_version */ +){ + boost::shared_ptr<T> sp; + ar >> boost::serialization::make_nvp("weak_ptr", sp); + t = sp; +} + +template<class Archive, class T> +inline void serialize( + Archive & ar, + boost::weak_ptr<T> &t, + const unsigned int file_version +){ + boost::serialization::split_free(ar, t, file_version); +} + +} // namespace serialization +} // namespace boost + +#endif // BOOST_SERIALIZATION_WEAK_PTR_HPP diff --git a/Utilities/BGL/boost/serialization/wrapper.hpp b/Utilities/BGL/boost/serialization/wrapper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eeb4333cac827483b3b5a275ed40bee93b52f3fc --- /dev/null +++ b/Utilities/BGL/boost/serialization/wrapper.hpp @@ -0,0 +1,60 @@ +#ifndef BOOST_SERIALIZATION_WRAPPER_HPP +#define BOOST_SERIALIZATION_WRAPPER_HPP + +// (C) Copyright 2005-2006 Matthias Troyer +// 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) + +#include <boost/serialization/traits.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/bool.hpp> + +namespace boost { namespace serialization { + +/// the base class for serialization wrappers +/// +/// wrappers need to be treated differently at various places in the serialization library, +/// e.g. saving of non-const wrappers has to be possible. Since partial specialization +// is not supported by all compilers, we derive all wrappers from wrapper_traits. + +template< + class T, + int Level = object_serializable, + int Tracking = track_never, + unsigned int Version = 0, + class ETII = extended_type_info_impl< T > +> +struct wrapper_traits : + public traits<T,Level,Tracking,Version,ETII,mpl::true_> +{}; + +template<class T> +struct is_wrapper_impl : + boost::mpl::eval_if< + boost::is_base_and_derived<basic_traits,T>, + boost::mpl::true_, + boost::mpl::false_ + >::type +{}; + +template<class T> +struct is_wrapper { + typedef BOOST_DEDUCED_TYPENAME is_wrapper_impl<const T>::type type; +}; + +} // serialization +} // boost + +// A macro to define that a class is a wrapper +#define BOOST_CLASS_IS_WRAPPER(T) \ +namespace boost { \ +namespace serialization { \ +template<> \ +struct is_wrapper_impl<const T> : boost::mpl::true_ {}; \ +} \ +} \ +/**/ + +#endif //BOOST_SERIALIZATION_WRAPPER_HPP diff --git a/Utilities/BGL/boost/shared_ptr.hpp b/Utilities/BGL/boost/shared_ptr.hpp index 8d6196cadbce547b97c973ebd0c50d0df70f233f..d31978c9250e55f97b1be8c6abb6938382f28845 100644 --- a/Utilities/BGL/boost/shared_ptr.hpp +++ b/Utilities/BGL/boost/shared_ptr.hpp @@ -5,7 +5,7 @@ // shared_ptr.hpp // // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002, 2003 Peter Dimov +// Copyright (c) 2001-2008 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -14,465 +14,6 @@ // See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation. // -#include <boost/config.hpp> // for broken compiler workarounds - -#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) -#include <boost/detail/shared_ptr_nmt.hpp> -#else - -#include <boost/assert.hpp> -#include <boost/checked_delete.hpp> -#include <boost/throw_exception.hpp> -#include <boost/detail/shared_count.hpp> -#include <boost/detail/workaround.hpp> - -#include <memory> // for std::auto_ptr -#include <algorithm> // for std::swap -#include <functional> // for std::less -#include <typeinfo> // for std::bad_cast -#include <iosfwd> // for std::basic_ostream - -#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash -# pragma warning(push) -# pragma warning(disable:4284) // odd return type for operator-> -#endif - -namespace boost -{ - -template<class T> class weak_ptr; -template<class T> class enable_shared_from_this; - -namespace detail -{ - -struct static_cast_tag {}; -struct const_cast_tag {}; -struct dynamic_cast_tag {}; -struct polymorphic_cast_tag {}; - -template<class T> struct shared_ptr_traits -{ - typedef T & reference; -}; - -template<> struct shared_ptr_traits<void> -{ - typedef void reference; -}; - -#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) - -template<> struct shared_ptr_traits<void const> -{ - typedef void reference; -}; - -template<> struct shared_ptr_traits<void volatile> -{ - typedef void reference; -}; - -template<> struct shared_ptr_traits<void const volatile> -{ - typedef void reference; -}; - -#endif - -// enable_shared_from_this support - -template<class T, class Y> void sp_enable_shared_from_this( shared_count const & pn, boost::enable_shared_from_this<T> const * pe, Y const * px ) -{ - if(pe != 0) pe->_internal_weak_this._internal_assign(const_cast<Y*>(px), pn); -} - -inline void sp_enable_shared_from_this( shared_count const & /*pn*/, ... ) -{ -} - -} // namespace detail - - -// -// shared_ptr -// -// An enhanced relative of scoped_ptr with reference counted copy semantics. -// The object pointed to is deleted when the last shared_ptr pointing to it -// is destroyed or reset. -// - -template<class T> class shared_ptr -{ -private: - - // Borland 5.5.1 specific workaround - typedef shared_ptr<T> this_type; - -public: - - typedef T element_type; - typedef T value_type; - typedef T * pointer; - typedef typename detail::shared_ptr_traits<T>::reference reference; - - shared_ptr(): px(0), pn() // never throws in 1.30+ - { - } - - template<class Y> - explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete - { - detail::sp_enable_shared_from_this( pn, p, p ); - } - - // - // Requirements: D's copy constructor must not throw - // - // shared_ptr will release p by calling d(p) - // - - template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d) - { - detail::sp_enable_shared_from_this( pn, p, p ); - } - -// generated copy constructor, assignment, destructor are fine... - -// except that Borland C++ has a bug, and g++ with -Wsynth warns -#if defined(__BORLANDC__) || defined(__GNUC__) - - shared_ptr & operator=(shared_ptr const & r) // never throws - { - px = r.px; - pn = r.pn; // shared_count::op= doesn't throw - return *this; - } - -#endif - - template<class Y> - explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw - { - // it is now safe to copy r.px, as pn(r.pn) did not throw - px = r.px; - } - - template<class Y> - shared_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws - { - } - - template<class Y> - shared_ptr(shared_ptr<Y> const & r, detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn) - { - } - - template<class Y> - shared_ptr(shared_ptr<Y> const & r, detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn) - { - } - - template<class Y> - shared_ptr(shared_ptr<Y> const & r, detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) - { - if(px == 0) // need to allocate new counter -- the cast failed - { - pn = detail::shared_count(); - } - } - - template<class Y> - shared_ptr(shared_ptr<Y> const & r, detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) - { - if(px == 0) - { - boost::throw_exception(std::bad_cast()); - } - } - -#ifndef BOOST_NO_AUTO_PTR - - template<class Y> - explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn() - { - Y * tmp = r.get(); - pn = detail::shared_count(r); - detail::sp_enable_shared_from_this( pn, tmp, tmp ); - } - -#endif - -#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) - - template<class Y> - shared_ptr & operator=(shared_ptr<Y> const & r) // never throws - { - px = r.px; - pn = r.pn; // shared_count::op= doesn't throw - return *this; - } - -#endif - -#ifndef BOOST_NO_AUTO_PTR - - template<class Y> - shared_ptr & operator=(std::auto_ptr<Y> & r) - { - this_type(r).swap(*this); - return *this; - } - -#endif - - void reset() // never throws in 1.30+ - { - this_type().swap(*this); - } - - template<class Y> void reset(Y * p) // Y must be complete - { - BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors - this_type(p).swap(*this); - } - - template<class Y, class D> void reset(Y * p, D d) - { - this_type(p, d).swap(*this); - } - - reference operator* () const // never throws - { - BOOST_ASSERT(px != 0); - return *px; - } - - T * operator-> () const // never throws - { - BOOST_ASSERT(px != 0); - return px; - } - - T * get() const // never throws - { - return px; - } - - // implicit conversion to "bool" - -#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530) - - operator bool () const - { - return px != 0; - } - -#elif \ - ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ - ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) - - typedef T * (this_type::*unspecified_bool_type)() const; - - operator unspecified_bool_type() const // never throws - { - return px == 0? 0: &this_type::get; - } - -#else - - typedef T * this_type::*unspecified_bool_type; - - operator unspecified_bool_type() const // never throws - { - return px == 0? 0: &this_type::px; - } - -#endif - - // operator! is redundant, but some compilers need it - - bool operator! () const // never throws - { - return px == 0; - } - - bool unique() const // never throws - { - return pn.unique(); - } - - long use_count() const // never throws - { - return pn.use_count(); - } - - void swap(shared_ptr<T> & other) // never throws - { - std::swap(px, other.px); - pn.swap(other.pn); - } - - template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const - { - return pn < rhs.pn; - } - - void * _internal_get_deleter(std::type_info const & ti) const - { - return pn.get_deleter(ti); - } - -// Tasteless as this may seem, making all members public allows member templates -// to work in the absence of member template friends. (Matthew Langston) - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - -private: - - template<class Y> friend class shared_ptr; - template<class Y> friend class weak_ptr; - - -#endif - - T * px; // contained pointer - detail::shared_count pn; // reference counter - -}; // shared_ptr - -template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) -{ - return a.get() == b.get(); -} - -template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) -{ - return a.get() != b.get(); -} - -#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 - -// Resolve the ambiguity between our op!= and the one in rel_ops - -template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b) -{ - return a.get() != b.get(); -} - -#endif - -template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) -{ - return a._internal_less(b); -} - -template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) -{ - a.swap(b); -} - -template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) -{ - return shared_ptr<T>(r, detail::static_cast_tag()); -} - -template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) -{ - return shared_ptr<T>(r, detail::const_cast_tag()); -} - -template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r) -{ - return shared_ptr<T>(r, detail::dynamic_cast_tag()); -} - -// shared_*_cast names are deprecated. Use *_pointer_cast instead. - -template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r) -{ - return shared_ptr<T>(r, detail::static_cast_tag()); -} - -template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r) -{ - return shared_ptr<T>(r, detail::dynamic_cast_tag()); -} - -template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r) -{ - return shared_ptr<T>(r, detail::polymorphic_cast_tag()); -} - -template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r) -{ - BOOST_ASSERT(dynamic_cast<T *>(r.get()) == r.get()); - return shared_static_cast<T>(r); -} - -// get_pointer() enables boost::mem_fn to recognize shared_ptr - -template<class T> inline T * get_pointer(shared_ptr<T> const & p) -{ - return p.get(); -} - -// operator<< - -#if defined(__GNUC__) && (__GNUC__ < 3) - -template<class Y> std::ostream & operator<< (std::ostream & os, shared_ptr<Y> const & p) -{ - os << p.get(); - return os; -} - -#else - -# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT) -// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL -using std::basic_ostream; -template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared_ptr<Y> const & p) -# else -template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p) -# endif -{ - os << p.get(); - return os; -} - -#endif - -// get_deleter (experimental) - -#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \ - ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \ - ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) ) - -// g++ 2.9x doesn't allow static_cast<X const *>(void *) -// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it - -template<class D, class T> D * get_deleter(shared_ptr<T> const & p) -{ - void const * q = p._internal_get_deleter(typeid(D)); - return const_cast<D *>(static_cast<D const *>(q)); -} - -#else - -template<class D, class T> D * get_deleter(shared_ptr<T> const & p) -{ - return static_cast<D *>(p._internal_get_deleter(typeid(D))); -} - -#endif - -} // namespace boost - -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - -#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) +#include <boost/smart_ptr/shared_ptr.hpp> #endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/bad_weak_ptr.hpp b/Utilities/BGL/boost/smart_ptr/bad_weak_ptr.hpp similarity index 83% rename from Utilities/BGL/boost/detail/bad_weak_ptr.hpp rename to Utilities/BGL/boost/smart_ptr/bad_weak_ptr.hpp index a08d7b17002f434322bbfbf4c7ae1489dbfbd58c..3e0a1b728677d0da025967f735db4e54c9f4fb83 100644 --- a/Utilities/BGL/boost/detail/bad_weak_ptr.hpp +++ b/Utilities/BGL/boost/smart_ptr/bad_weak_ptr.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED -#define BOOST_BAD_WEAK_PTR_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -8,7 +8,7 @@ #endif // -// detail/bad_weak_ptr.hpp +// boost/smart_ptr/bad_weak_ptr.hpp // // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. // @@ -42,7 +42,7 @@ public: virtual char const * what() const throw() { - return "boost::bad_weak_ptr"; + return "tr1::bad_weak_ptr"; } }; @@ -56,4 +56,4 @@ public: # pragma warn .8026 // Functions with excep. spec. are not expanded inline #endif -#endif // #ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/atomic_count.hpp b/Utilities/BGL/boost/smart_ptr/detail/atomic_count.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cc44ac2f96d815a0581b93115f71e22c0d8dfa7d --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/atomic_count.hpp @@ -0,0 +1,119 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/atomic_count.hpp - thread/SMP safe reference counter +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// +// 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) +// +// typedef <implementation-defined> boost::detail::atomic_count; +// +// atomic_count a(n); +// +// (n is convertible to long) +// +// Effects: Constructs an atomic_count with an initial value of n +// +// a; +// +// Returns: (long) the current value of a +// +// ++a; +// +// Effects: Atomically increments the value of a +// Returns: (long) the new value of a +// +// --a; +// +// Effects: Atomically decrements the value of a +// Returns: (long) the new value of a +// +// Important note: when --a returns zero, it must act as a +// read memory barrier (RMB); i.e. the calling thread must +// have a synchronized view of the memory +// +// On Intel IA-32 (x86) memory is always synchronized, so this +// is not a problem. +// +// On many architectures the atomic instructions already act as +// a memory barrier. +// +// This property is necessary for proper reference counting, since +// a thread can update the contents of a shared object, then +// release its reference, and another thread may immediately +// release the last reference causing object destruction. +// +// The destructor needs to have a synchronized view of the +// object to perform proper cleanup. +// +// Original example by Alexander Terekhov: +// +// Given: +// +// - a mutable shared object OBJ; +// - two threads THREAD1 and THREAD2 each holding +// a private smart_ptr object pointing to that OBJ. +// +// t1: THREAD1 updates OBJ (thread-safe via some synchronization) +// and a few cycles later (after "unlock") destroys smart_ptr; +// +// t2: THREAD2 destroys smart_ptr WITHOUT doing any synchronization +// with respect to shared mutable object OBJ; OBJ destructors +// are called driven by smart_ptr interface... +// + +#include <boost/config.hpp> +#include <boost/smart_ptr/detail/sp_has_sync.hpp> + +#ifndef BOOST_HAS_THREADS + +namespace boost +{ + +namespace detail +{ + +typedef long atomic_count; + +} + +} + +#elif defined(BOOST_AC_USE_PTHREADS) +# include <boost/smart_ptr/detail/atomic_count_pthreads.hpp> + +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) +# include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp> + +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include <boost/smart_ptr/detail/atomic_count_win32.hpp> + +#elif defined( BOOST_SP_HAS_SYNC ) +# include <boost/smart_ptr/detail/atomic_count_sync.hpp> + +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +# include <boost/smart_ptr/detail/atomic_count_gcc.hpp> + +#elif defined(BOOST_HAS_PTHREADS) + +# define BOOST_AC_USE_PTHREADS +# include <boost/smart_ptr/detail/atomic_count_pthreads.hpp> + +#else + +// Use #define BOOST_DISABLE_THREADS to avoid the error +#error Unrecognized threading platform + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/atomic_count_gcc.hpp b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_gcc.hpp similarity index 63% rename from Utilities/BGL/boost/detail/atomic_count_gcc.hpp rename to Utilities/BGL/boost/smart_ptr/detail/atomic_count_gcc.hpp index 1160e44dff0e14812bfaa25d8027fe75003b1f9b..54807e944e22e4f60ca2fe407caf54bcedfedd2e 100644 --- a/Utilities/BGL/boost/detail/atomic_count_gcc.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_gcc.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED -#define BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED // // boost/detail/atomic_count_gcc.hpp @@ -17,7 +17,11 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <bits/atomicity.h> +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402 +# include <ext/atomicity.h> +#else +# include <bits/atomicity.h> +#endif namespace boost { @@ -36,21 +40,21 @@ class atomic_count { public: - explicit atomic_count(long v) : value_(v) {} + explicit atomic_count( long v ) : value_( v ) {} - void operator++() + long operator++() { - __atomic_add(&value_, 1); + return __exchange_and_add( &value_, +1 ) + 1; } long operator--() { - return __exchange_and_add(&value_, -1) - 1; + return __exchange_and_add( &value_, -1 ) - 1; } operator long() const { - return __exchange_and_add(&value_, 0); + return __exchange_and_add( &value_, 0 ); } private: @@ -65,4 +69,4 @@ private: } // namespace boost -#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5c44d7c1efaa22ae8f01435099c71582ffabd352 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp @@ -0,0 +1,77 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED + +// +// boost/detail/atomic_count_gcc_x86.hpp +// +// atomic_count for g++ on 486+/AMD64 +// +// Copyright 2007 Peter Dimov +// +// 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) +// + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ) : value_( static_cast< int >( v ) ) {} + + long operator++() + { + return atomic_exchange_and_add( &value_, +1 ) + 1; + } + + long operator--() + { + return atomic_exchange_and_add( &value_, -1 ) - 1; + } + + operator long() const + { + return atomic_exchange_and_add( &value_, 0 ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable int value_; + +private: + + static int atomic_exchange_and_add( int * pw, int dv ) + { + // int r = *pw; + // *pw += dv; + // return r; + + int r; + + __asm__ __volatile__ + ( + "lock\n\t" + "xadd %1, %0": + "+m"( *pw ), "=r"( r ): // outputs (%0, %1) + "1"( dv ): // inputs (%2 == %1) + "memory", "cc" // clobbers + ); + + return r; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/atomic_count_pthreads.hpp b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_pthreads.hpp similarity index 85% rename from Utilities/BGL/boost/detail/atomic_count_pthreads.hpp rename to Utilities/BGL/boost/smart_ptr/detail/atomic_count_pthreads.hpp index 7ed055f7d696b4d7f0f767d4eaf3056bb4904405..05f78673c68e842084dd9197b470fa0d1024e3fc 100644 --- a/Utilities/BGL/boost/detail/atomic_count_pthreads.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_pthreads.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED -#define BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED // // boost/detail/atomic_count_pthreads.hpp @@ -62,10 +62,10 @@ public: pthread_mutex_destroy(&mutex_); } - void operator++() + long operator++() { scoped_lock lock(mutex_); - ++value_; + return ++value_; } long operator--() @@ -93,4 +93,4 @@ private: } // namespace boost -#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/atomic_count_solaris.hpp b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_solaris.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a13bcfb42302c4427a9c00caa6afca9a6b7b5b37 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_solaris.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED + +// +// boost/detail/atomic_count_solaris.hpp +// based on: boost/detail/atomic_count_win32.hpp +// +// Copyright (c) 2001-2005 Peter Dimov +// Copyright (c) 2006 Michael van der Westhuizen +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <atomic.h> + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( uint32_t v ): value_( v ) + { + } + + long operator++() + { + return atomic_inc_32_nv( &value_ ); + } + + long operator--() + { + return atomic_dec_32_nv( &value_ ); + } + + operator uint32_t() const + { + return static_cast<uint32_t const volatile &>( value_ ); + } + +private: + + atomic_count( atomic_count const & ); + atomic_count & operator=( atomic_count const & ); + + uint32_t value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/atomic_count_sync.hpp b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_sync.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b6359b5bcf06f6013ba15e6f2a6d13c019e1aa70 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_sync.hpp @@ -0,0 +1,61 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED + +// +// boost/detail/atomic_count_sync.hpp +// +// atomic_count for g++ 4.1+ +// +// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html +// +// Copyright 2007 Peter Dimov +// +// 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( __ia64__ ) && defined( __INTEL_COMPILER ) +# include <ia64intrin.h> +#endif + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ) : value_( v ) {} + + long operator++() + { + return __sync_add_and_fetch( &value_, 1 ); + } + + long operator--() + { + return __sync_add_and_fetch( &value_, -1 ); + } + + operator long() const + { + return __sync_fetch_and_add( &value_, 0 ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/atomic_count_win32.hpp b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_win32.hpp similarity index 83% rename from Utilities/BGL/boost/detail/atomic_count_win32.hpp rename to Utilities/BGL/boost/smart_ptr/detail/atomic_count_win32.hpp index 0de25377fa5e6ad42d2740dd5a26efc22fa4601b..60a056943b6646f3e910f81336919464e8423cf6 100644 --- a/Utilities/BGL/boost/detail/atomic_count_win32.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/atomic_count_win32.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED -#define BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -60,4 +60,4 @@ private: } // namespace boost -#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/lightweight_mutex.hpp b/Utilities/BGL/boost/smart_ptr/detail/lightweight_mutex.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d46b1932c2b862ea597d4228a758d75470d64ba2 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/lightweight_mutex.hpp @@ -0,0 +1,42 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lightweight_mutex.hpp - lightweight mutex +// +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// 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) +// +// typedef <unspecified> boost::detail::lightweight_mutex; +// +// boost::detail::lightweight_mutex is a header-only implementation of +// a subset of the Mutex concept requirements: +// +// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex +// +// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. +// + +#include <boost/config.hpp> + +#if !defined(BOOST_HAS_THREADS) +# include <boost/smart_ptr/detail/lwm_nop.hpp> +#elif defined(BOOST_HAS_PTHREADS) +# include <boost/smart_ptr/detail/lwm_pthreads.hpp> +#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include <boost/smart_ptr/detail/lwm_win32_cs.hpp> +#else +// Use #define BOOST_DISABLE_THREADS to avoid the error +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/lwm_nop.hpp b/Utilities/BGL/boost/smart_ptr/detail/lwm_nop.hpp similarity index 76% rename from Utilities/BGL/boost/detail/lwm_nop.hpp rename to Utilities/BGL/boost/smart_ptr/detail/lwm_nop.hpp index c73ab68f5eeba9655b89e6e7c3a8722eddf53684..521a88ec1cdba0a44c8187b4603f8658442db9cc 100644 --- a/Utilities/BGL/boost/detail/lwm_nop.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/lwm_nop.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED -#define BOOST_DETAIL_LWM_NOP_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -34,4 +34,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/lwm_pthreads.hpp b/Utilities/BGL/boost/smart_ptr/detail/lwm_pthreads.hpp similarity index 69% rename from Utilities/BGL/boost/detail/lwm_pthreads.hpp rename to Utilities/BGL/boost/smart_ptr/detail/lwm_pthreads.hpp index a5bf75bde7326b015b14e046bf2d00837659d36b..8eda51823383bfd6dd17486a657a5fde8c884e0a 100644 --- a/Utilities/BGL/boost/detail/lwm_pthreads.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/lwm_pthreads.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED -#define BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -17,6 +17,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // +#include <boost/assert.hpp> #include <pthread.h> namespace boost @@ -42,15 +43,15 @@ public: // HPUX 10.20 / DCE has a nonstandard pthread_mutex_init #if defined(__hpux) && defined(_DECTHREADS_) - pthread_mutex_init(&m_, pthread_mutexattr_default); + BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); #else - pthread_mutex_init(&m_, 0); + BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); #endif } ~lightweight_mutex() { - pthread_mutex_destroy(&m_); + BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); } class scoped_lock; @@ -69,12 +70,12 @@ public: scoped_lock(lightweight_mutex & m): m_(m.m_) { - pthread_mutex_lock(&m_); + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); } ~scoped_lock() { - pthread_mutex_unlock(&m_); + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); } }; }; @@ -83,4 +84,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/lwm_win32_cs.hpp b/Utilities/BGL/boost/smart_ptr/detail/lwm_win32_cs.hpp similarity index 82% rename from Utilities/BGL/boost/detail/lwm_win32_cs.hpp rename to Utilities/BGL/boost/smart_ptr/detail/lwm_win32_cs.hpp index 4ee0a71ca232c083953eb38714ddd116f1996cee..00477e49f8fec71ecc19e85c6e3646b7a3a049a9 100644 --- a/Utilities/BGL/boost/detail/lwm_win32_cs.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/lwm_win32_cs.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED -#define BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -29,7 +29,7 @@ namespace detail #ifndef BOOST_USE_WINDOWS_H -struct CRITICAL_SECTION +struct critical_section { struct critical_section_debug * DebugInfo; long LockCount; @@ -43,10 +43,14 @@ struct CRITICAL_SECTION #endif }; -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(CRITICAL_SECTION *); +extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(critical_section *); +extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(critical_section *); +extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(critical_section *); +extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(critical_section *); + +#else + +typedef ::CRITICAL_SECTION critical_section; #endif // #ifndef BOOST_USE_WINDOWS_H @@ -54,7 +58,7 @@ class lightweight_mutex { private: - CRITICAL_SECTION cs_; + critical_section cs_; lightweight_mutex(lightweight_mutex const &); lightweight_mutex & operator=(lightweight_mutex const &); @@ -101,4 +105,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/operator_bool.hpp b/Utilities/BGL/boost/smart_ptr/detail/operator_bool.hpp new file mode 100644 index 0000000000000000000000000000000000000000..842a05d02bc20b1d1a616c9b283d0e3ef368061f --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/operator_bool.hpp @@ -0,0 +1,56 @@ +// This header intentionally has no include guards. +// +// Copyright (c) 2001-2009 Peter Dimov +// +// 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(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) + + operator bool () const + { + return px != 0; + } + +#elif defined( _MANAGED ) + + static void unspecified_bool( this_type*** ) + { + } + + typedef void (*unspecified_bool_type)( this_type*** ); + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: unspecified_bool; + } + +#elif \ + ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ + ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ + ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) + + typedef T * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::get; + } + +#else + + typedef T * this_type::*unspecified_bool_type; + + operator unspecified_bool_type() const // never throws + { + return px == 0? 0: &this_type::px; + } + +#endif + + // operator! is redundant, but some compilers need it + bool operator! () const // never throws + { + return px == 0; + } diff --git a/Utilities/BGL/boost/smart_ptr/detail/quick_allocator.hpp b/Utilities/BGL/boost/smart_ptr/detail/quick_allocator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..159bd5e7aa88e86cf8b519ac39af944a189bd5e0 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/quick_allocator.hpp @@ -0,0 +1,199 @@ +#ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/quick_allocator.hpp +// +// Copyright (c) 2003 David Abrahams +// Copyright (c) 2003 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/config.hpp> + +#include <boost/smart_ptr/detail/lightweight_mutex.hpp> +#include <boost/type_traits/type_with_alignment.hpp> +#include <boost/type_traits/alignment_of.hpp> + +#include <new> // ::operator new, ::operator delete +#include <cstddef> // std::size_t + +namespace boost +{ + +namespace detail +{ + +template<unsigned size, unsigned align_> union freeblock +{ + typedef typename boost::type_with_alignment<align_>::type aligner_type; + aligner_type aligner; + char bytes[size]; + freeblock * next; +}; + +template<unsigned size, unsigned align_> struct allocator_impl +{ + typedef freeblock<size, align_> block; + + // It may seem odd to use such small pages. + // + // However, on a typical Windows implementation that uses + // the OS allocator, "normal size" pages interact with the + // "ordinary" operator new, slowing it down dramatically. + // + // 512 byte pages are handled by the small object allocator, + // and don't interfere with ::new. + // + // The other alternative is to use much bigger pages (1M.) + // + // It is surprisingly easy to hit pathological behavior by + // varying the page size. g++ 2.96 on Red Hat Linux 7.2, + // for example, passionately dislikes 496. 512 seems OK. + +#if defined(BOOST_QA_PAGE_SIZE) + + enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; + +#else + + enum { items_per_page = 512 / size }; // 1048560 / size + +#endif + +#ifdef BOOST_HAS_THREADS + + static lightweight_mutex & mutex() + { + static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm; + static lightweight_mutex * pm = new( &fbm ) lightweight_mutex; + return *pm; + } + + static lightweight_mutex * mutex_init; + +#endif + + static block * free; + static block * page; + static unsigned last; + + static inline void * alloc() + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + // "Listen to me carefully: there is no memory leak" + // -- Scott Meyers, Eff C++ 2nd Ed Item 10 + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + + static inline void * alloc(std::size_t n) + { + if(n != size) // class-specific new called for a derived object + { + return ::operator new(n); + } + else + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + } + + static inline void dealloc(void * pv) + { + if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast<block *>(pv); + pb->next = free; + free = pb; + } + } + + static inline void dealloc(void * pv, std::size_t n) + { + if(n != size) // class-specific delete called for a derived object + { + ::operator delete(pv); + } + else if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast<block *>(pv); + pb->next = free; + free = pb; + } + } +}; + +#ifdef BOOST_HAS_THREADS + +template<unsigned size, unsigned align_> + lightweight_mutex * allocator_impl<size, align_>::mutex_init = &allocator_impl<size, align_>::mutex(); + +#endif + +template<unsigned size, unsigned align_> + freeblock<size, align_> * allocator_impl<size, align_>::free = 0; + +template<unsigned size, unsigned align_> + freeblock<size, align_> * allocator_impl<size, align_>::page = 0; + +template<unsigned size, unsigned align_> + unsigned allocator_impl<size, align_>::last = allocator_impl<size, align_>::items_per_page; + +template<class T> +struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of<T>::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/shared_array_nmt.hpp b/Utilities/BGL/boost/smart_ptr/detail/shared_array_nmt.hpp similarity index 92% rename from Utilities/BGL/boost/detail/shared_array_nmt.hpp rename to Utilities/BGL/boost/smart_ptr/detail/shared_array_nmt.hpp index 13ca6aca1513e77aef552646ebcdad6638ad99b2..450c9bcf595a6c818a34d934624f8be99cef95a1 100644 --- a/Utilities/BGL/boost/detail/shared_array_nmt.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/shared_array_nmt.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED -#define BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED // // detail/shared_array_nmt.hpp - shared_array.hpp without member templates @@ -17,7 +17,7 @@ #include <boost/assert.hpp> #include <boost/checked_delete.hpp> #include <boost/throw_exception.hpp> -#include <boost/detail/atomic_count.hpp> +#include <boost/smart_ptr/detail/atomic_count.hpp> #include <cstddef> // for std::ptrdiff_t #include <algorithm> // for std::swap @@ -148,4 +148,4 @@ template<class T> void swap(shared_array<T> & a, shared_array<T> & b) } // namespace boost -#endif // #ifndef BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/shared_count.hpp b/Utilities/BGL/boost/smart_ptr/detail/shared_count.hpp similarity index 64% rename from Utilities/BGL/boost/detail/shared_count.hpp rename to Utilities/BGL/boost/smart_ptr/detail/shared_count.hpp index 49aca857f71ee534da2c9073266d13b1c4786ec9..4943e37643fc5ed7399128f27303774eca2a22e0 100644 --- a/Utilities/BGL/boost/detail/shared_count.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/shared_count.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED -#define BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -25,14 +25,17 @@ #include <boost/config.hpp> #include <boost/checked_delete.hpp> #include <boost/throw_exception.hpp> -#include <boost/detail/bad_weak_ptr.hpp> -#include <boost/detail/sp_counted_base.hpp> -#include <boost/detail/sp_counted_impl.hpp> - -#include <memory> // std::auto_ptr, std::allocator +#include <boost/smart_ptr/bad_weak_ptr.hpp> +#include <boost/smart_ptr/detail/sp_counted_base.hpp> +#include <boost/smart_ptr/detail/sp_counted_impl.hpp> +#include <boost/detail/workaround.hpp> +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of <memory> doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including <memory> directly: +#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr #include <functional> // std::less #include <new> // std::bad_alloc -#include <typeinfo> // std::type_info in get_deleter namespace boost { @@ -47,6 +50,8 @@ int const weak_count_id = 0x298C38A4; #endif +struct sp_nothrow_tag {}; + class weak_count; class shared_count @@ -100,11 +105,18 @@ public: #endif } - template<class P, class D> shared_count(P p, D d): pi_(0) +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + template<class Y, class D> shared_count( Y * p, D d ): pi_(0) +#else + template<class P, class D> shared_count( P p, D d ): pi_(0) +#endif #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) #endif { +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + typedef Y* P; +#endif #ifndef BOOST_NO_EXCEPTIONS try @@ -127,6 +139,52 @@ public: boost::throw_exception(std::bad_alloc()); } +#endif + } + + template<class P, class D, class A> shared_count( P p, D d, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda<P, D, A> impl_type; + typedef typename A::template rebind< impl_type >::other A2; + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + catch(...) + { + d( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + + if( pi_ != 0 ) + { + new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + else + { + d( p ); + boost::throw_exception( std::bad_alloc() ); + } + #endif } @@ -170,7 +228,20 @@ public: if( pi_ != 0 ) pi_->add_ref_copy(); } +#if defined( BOOST_HAS_RVALUE_REFS ) + + shared_count(shared_count && r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + r.pi_ = 0; + } + +#endif + explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 + shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 shared_count & operator= (shared_count const & r) // nothrow { @@ -203,6 +274,11 @@ public: return use_count() == 1; } + bool empty() const // nothrow + { + return pi_ == 0; + } + friend inline bool operator==(shared_count const & a, shared_count const & b) { return a.pi_ == b.pi_; @@ -213,7 +289,7 @@ public: return std::less<sp_counted_base *>()( a.pi_, b.pi_ ); } - void * get_deleter(std::type_info const & ti) const + void * get_deleter( sp_typeinfo const & ti ) const { return pi_? pi_->get_deleter( ti ): 0; } @@ -243,7 +319,7 @@ public: weak_count(shared_count const & r): pi_(r.pi_) // nothrow #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) + , id_(weak_count_id) #endif { if(pi_ != 0) pi_->weak_add_ref(); @@ -251,12 +327,26 @@ public: weak_count(weak_count const & r): pi_(r.pi_) // nothrow #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) + , id_(weak_count_id) #endif { if(pi_ != 0) pi_->weak_add_ref(); } +// Move support + +#if defined( BOOST_HAS_RVALUE_REFS ) + + weak_count(weak_count && r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + r.pi_ = 0; + } + +#endif + ~weak_count() // nothrow { if(pi_ != 0) pi_->weak_release(); @@ -268,9 +358,13 @@ public: weak_count & operator= (shared_count const & r) // nothrow { sp_counted_base * tmp = r.pi_; - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } return *this; } @@ -278,9 +372,13 @@ public: weak_count & operator= (weak_count const & r) // nothrow { sp_counted_base * tmp = r.pi_; - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } return *this; } @@ -297,6 +395,11 @@ public: return pi_ != 0? pi_->use_count(): 0; } + bool empty() const // nothrow + { + return pi_ == 0; + } + friend inline bool operator==(weak_count const & a, weak_count const & b) { return a.pi_ == b.pi_; @@ -319,6 +422,17 @@ inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) } } +inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if( pi_ != 0 && !pi_->add_ref_lock() ) + { + pi_ = 0; + } +} + } // namespace detail } // namespace boost @@ -327,4 +441,4 @@ inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) # pragma warn .8027 // Functions containing try are not expanded inline #endif -#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/shared_ptr_nmt.hpp b/Utilities/BGL/boost/smart_ptr/detail/shared_ptr_nmt.hpp similarity index 93% rename from Utilities/BGL/boost/detail/shared_ptr_nmt.hpp rename to Utilities/BGL/boost/smart_ptr/detail/shared_ptr_nmt.hpp index 0780e305b599040249aa77b8462c1de1a177ef81..afc1ec03f1b569a55dcb00d2248088511d788400 100644 --- a/Utilities/BGL/boost/detail/shared_ptr_nmt.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/shared_ptr_nmt.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED -#define BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED // // detail/shared_ptr_nmt.hpp - shared_ptr.hpp without member templates @@ -17,7 +17,7 @@ #include <boost/assert.hpp> #include <boost/checked_delete.hpp> #include <boost/throw_exception.hpp> -#include <boost/detail/atomic_count.hpp> +#include <boost/smart_ptr/detail/atomic_count.hpp> #ifndef BOOST_NO_AUTO_PTR # include <memory> // for std::auto_ptr @@ -179,4 +179,4 @@ template<class T> inline T * get_pointer(shared_ptr<T> const & p) } // namespace boost -#endif // #ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_convertible.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_convertible.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b7f0ea8f2ddd26ee0bde8762dead3b7c61143fc0 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_convertible.hpp @@ -0,0 +1,76 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_convertible.hpp +// +// Copyright 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/config.hpp> + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x620 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +namespace boost +{ + +namespace detail +{ + +template< class Y, class T > struct sp_convertible +{ + typedef char (&yes) [1]; + typedef char (&no) [2]; + + static yes f( T* ); + static no f( ... ); + + enum _vt { value = sizeof( f( static_cast<Y*>(0) ) ) == sizeof(yes) }; +}; + +struct sp_empty +{ +}; + +template< bool > struct sp_enable_if_convertible_impl; + +template<> struct sp_enable_if_convertible_impl<true> +{ + typedef sp_empty type; +}; + +template<> struct sp_enable_if_convertible_impl<false> +{ +}; + +template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cab45cce30dc41e4ee45cd1c151ce6e4fa9410bd --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base.hpp @@ -0,0 +1,70 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base.hpp +// +// Copyright 2005, 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/config.hpp> +#include <boost/smart_ptr/detail/sp_has_sync.hpp> + +#if defined( BOOST_SP_DISABLE_THREADS ) +# include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> + +#elif defined( BOOST_SP_USE_SPINLOCK ) +# include <boost/smart_ptr/detail/sp_counted_base_spin.hpp> + +#elif defined( BOOST_SP_USE_PTHREADS ) +# include <boost/smart_ptr/detail/sp_counted_base_pt.hpp> + +#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) +# include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> + +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) +# include <boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp> + +#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) +# include <boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp> + +#elif defined(__HP_aCC) && defined(__ia64) +# include <boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp> + +#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) +# include <boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp> + +#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) +# include <boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp> + +#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) +# include <boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp> + +#elif defined( BOOST_SP_HAS_SYNC ) +# include <boost/smart_ptr/detail/sp_counted_base_sync.hpp> + +#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) +# include <boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp> + +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) +# include <boost/smart_ptr/detail/sp_counted_base_w32.hpp> + +#elif !defined( BOOST_HAS_THREADS ) +# include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> + +#else +# include <boost/smart_ptr/detail/sp_counted_base_spin.hpp> + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dffd995b16e6fecfd282124d75f4c72170a60655 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp @@ -0,0 +1,150 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED + +// +// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64 +// +// Copyright 2007 Baruch Zilber +// Copyright 2007 Boris Gubenko +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include <boost/detail/sp_typeinfo.hpp> +#include <machine/sys/inline.h> + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + _Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int r = static_cast<int>(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE)); + if (1 == r) + { + _Asm_mf(); + } + + return r - 1; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int v = *pw; + + for (;;) + { + if (0 == v) + { + return 0; + } + + _Asm_mov_to_ar(_AREG_CCV, + v, + (_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE)); + int r = static_cast<int>(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE)); + if (r == v) + { + return r + 1; + } + + v = r; + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast<int const volatile &>( use_count_ ); // TODO use ld.acq here + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_cw_ppc.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp similarity index 89% rename from Utilities/BGL/boost/detail/sp_counted_base_cw_ppc.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp index c56a56268a7edc4634006deb82efeb840631ff14..51ac56a943835ad95fffb8e068d6ff612808a9f2 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_cw_ppc.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -24,7 +24,7 @@ // formulation // -#include <typeinfo> +#include <boost/detail/sp_typeinfo.hpp> namespace boost { @@ -123,7 +123,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -167,4 +167,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_cw_x86.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp similarity index 89% rename from Utilities/BGL/boost/detail/sp_counted_base_cw_x86.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp index 63c9fa204c0b3ed80e48a1adaa9a0b4349ee5af5..1234e78a6b487c31d97bff845589eef73dc4dff4 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_cw_x86.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -25,7 +25,7 @@ // formulation // -#include <typeinfo> +#include <boost/detail/sp_typeinfo.hpp> namespace boost { @@ -111,7 +111,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -155,4 +155,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_gcc_ia64.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp similarity index 71% rename from Utilities/BGL/boost/detail/sp_counted_base_gcc_ia64.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp index 8016c8d2d196dc7369a9c2332265398637b667eb..d122a49bdb2dd879de958b3bca97839901d994b4 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_gcc_ia64.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp @@ -1,11 +1,11 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED // // detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 // // Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov +// Copyright 2004-2006 Peter Dimov // Copyright 2005 Ben Hutchings // // Distributed under the Boost Software License, Version 1.0. (See @@ -16,7 +16,7 @@ // Lock-free algorithm by Alexander Terekhov // -#include <typeinfo> +#include <boost/detail/sp_typeinfo.hpp> namespace boost { @@ -24,55 +24,55 @@ namespace boost namespace detail { -inline void atomic_increment( long * pw ) +inline void atomic_increment( int * pw ) { // ++*pw; - long tmp; + int tmp; // No barrier is required here but fetchadd always has an acquire or // release barrier associated with it. We choose release as it should be // cheaper. - __asm__ ("fetchadd8.rel %0=[%2],1" : + __asm__ ("fetchadd4.rel %0=%1,1" : "=r"(tmp), "=m"(*pw) : - "r"(pw)); + "m"( *pw )); } -inline long atomic_decrement( long * pw ) +inline int atomic_decrement( int * pw ) { // return --*pw; - long rv; + int rv; - __asm__ (" fetchadd8.rel %0=[%2],-1 ;; \n" + __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" " cmp.eq p7,p0=1,%0 ;; \n" - "(p7) ld8.acq %0=[%2] " : + "(p7) ld4.acq %0=%1 " : "=&r"(rv), "=m"(*pw) : - "r"(pw) : + "m"( *pw ) : "p7"); return rv; } -inline long atomic_conditional_increment( long * pw ) +inline int atomic_conditional_increment( int * pw ) { // if( *pw != 0 ) ++*pw; // return *pw; - long rv, tmp, tmp2; + int rv, tmp, tmp2; - __asm__ ("0: ld8 %0=[%4] ;; \n" + __asm__ ("0: ld4 %0=%3 ;; \n" " cmp.eq p7,p0=0,%0 ;; \n" "(p7) br.cond.spnt 1f \n" " mov ar.ccv=%0 \n" " add %1=1,%0 ;; \n" - " cmpxchg8.acq %2=[%4],%1,ar.ccv ;; \n" + " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" " cmp.ne p7,p0=%0,%2 ;; \n" "(p7) br.cond.spnt 0b \n" " mov %0=%1 ;; \n" "1:" : "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : - "r"(pw) : + "m"( *pw ) : "ar.ccv", "p7"); return rv; @@ -85,8 +85,8 @@ private: sp_counted_base( sp_counted_base const & ); sp_counted_base & operator= ( sp_counted_base const & ); - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) public: @@ -110,7 +110,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -146,7 +146,7 @@ public: long use_count() const // nothrow { - return static_cast<long const volatile &>( use_count_ ); + return static_cast<int const volatile &>( use_count_ ); // TODO use ld.acq here } }; @@ -154,4 +154,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c69b0b891f2d62c261d39d40bcfeb1311bcc335 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp @@ -0,0 +1,172 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_mips.hpp - g++ on MIPS +// +// Copyright (c) 2009, Spirent Communications, Inc. +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include <boost/detail/sp_typeinfo.hpp> + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + "ll %0, %1\n\t" + "addiu %0, 1\n\t" + "sc %0, %1\n\t" + "beqz %0, 0b": + "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ) + ); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv, tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + "ll %1, %2\n\t" + "addiu %0, %1, -1\n\t" + "sc %0, %2\n\t" + "beqz %0, 0b\n\t" + "addiu %0, %1, -1": + "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ): + "memory" + ); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv, tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + "ll %0, %2\n\t" + "beqz %0, 1f\n\t" + "addiu %1, %0, 1\n\t" + "sc %1, %2\n\t" + "beqz %1, 0b\n\t" + "addiu %0, %0, 1\n\t" + "1:": + "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ): + "memory" + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast<int const volatile &>( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_gcc_ppc.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp similarity index 88% rename from Utilities/BGL/boost/detail/sp_counted_base_gcc_ppc.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp index fc2925e6288ca4a7c321ecb3fd0b0d5b38a893f5..7f5c414f17fa518c3a98495136a26d84134b4330 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_gcc_ppc.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -24,7 +24,7 @@ // formulation // -#include <typeinfo> +#include <boost/detail/sp_typeinfo.hpp> namespace boost { @@ -47,7 +47,7 @@ inline void atomic_increment( int * pw ) "bne- 0b": "=m"( *pw ), "=&b"( tmp ): - "r"( pw ): + "r"( pw ), "m"( *pw ): "cc" ); } @@ -69,7 +69,7 @@ inline int atomic_decrement( int * pw ) "isync": "=m"( *pw ), "=&b"( rv ): - "r"( pw ): + "r"( pw ), "m"( *pw ): "memory", "cc" ); @@ -95,7 +95,7 @@ inline int atomic_conditional_increment( int * pw ) "bne- 0b": "=m"( *pw ), "=&b"( rv ): - "r"( pw ): + "r"( pw ), "m"( *pw ): "cc" ); @@ -134,7 +134,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -178,4 +178,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp new file mode 100644 index 0000000000000000000000000000000000000000..21fa59dcc4fa3cc58dd95b1b2af2fcc952f74f15 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp @@ -0,0 +1,166 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ +// +// Copyright (c) 2006 Piotr Wyderski +// Copyright (c) 2006 Tomas Puverle +// Copyright (c) 2006 Peter Dimov +// +// 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 +// +// Thanks to Michael van der Westhuizen + +#include <boost/detail/sp_typeinfo.hpp> +#include <inttypes.h> // int32_t + +namespace boost +{ + +namespace detail +{ + +inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) +{ + __asm__ __volatile__( "cas [%1], %2, %0" + : "+r" (swap_) + : "r" (dest_), "r" (compare_) + : "memory" ); + + return swap_; +} + +inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv ) +{ + // long r = *pw; + // *pw += dv; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) + { + return r; + } + } +} + +inline void atomic_increment( int32_t * pw ) +{ + atomic_fetch_and_add( pw, 1 ); +} + +inline int32_t atomic_decrement( int32_t * pw ) +{ + return atomic_fetch_and_add( pw, -1 ); +} + +inline int32_t atomic_conditional_increment( int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( r == 0 ) + { + return r; + } + + if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int32_t use_count_; // #shared + int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_gcc_x86.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp similarity index 91% rename from Utilities/BGL/boost/detail/sp_counted_base_gcc_x86.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp index 0a8e189b58601cb3902fe9312c5c2d1b845ae90e..4d7fa8d4ab3ea0c03405388819bc6ddb6e330cb1 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_gcc_x86.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -24,7 +24,7 @@ // formulation // -#include <typeinfo> +#include <boost/detail/sp_typeinfo.hpp> namespace boost { @@ -126,7 +126,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -170,4 +170,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_nt.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_nt.hpp similarity index 85% rename from Utilities/BGL/boost/detail/sp_counted_base_nt.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_nt.hpp index 4a4401d7ae1c1501886522eb5b84b91d6fc4add1..dfd70e7d7e0bd24214b13c346a88aca0dee8aca6 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_nt.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_nt.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -18,7 +18,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <typeinfo> +#include <boost/detail/sp_typeinfo.hpp> namespace boost { @@ -58,7 +58,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -104,4 +104,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_pt.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_pt.hpp similarity index 89% rename from Utilities/BGL/boost/detail/sp_counted_base_pt.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_pt.hpp index 191064f59f9369383d182125f5f636c84071b10b..3c56fecfc362c56c45fd170db28487dbb1205541 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_pt.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_pt.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -18,7 +18,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <typeinfo> +#include <boost/detail/sp_typeinfo.hpp> #include <pthread.h> namespace boost @@ -69,7 +69,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -132,4 +132,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_solaris.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_solaris.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d1b6beceb1832c1319a59e595be499f14a85c98f --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_solaris.hpp @@ -0,0 +1,113 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED + +// +// detail/sp_counted_base_solaris.hpp +// based on: detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2006 Michael van der Westhuizen +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include <boost/detail/sp_typeinfo.hpp> +#include <atomic.h> + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + uint32_t use_count_; // #shared + uint32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_inc_32( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + for( ;; ) + { + uint32_t tmp = static_cast< uint32_t const volatile& >( use_count_ ); + if( tmp == 0 ) return false; + if( atomic_cas_32( &use_count_, tmp, tmp + 1 ) == tmp ) return true; + } + } + + void release() // nothrow + { + if( atomic_dec_32_nv( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_inc_32( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_dec_32_nv( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast<long const volatile &>( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_spin.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bbd11e60e905bdf1a2e74122aab4b073f01a14c5 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_spin.hpp @@ -0,0 +1,131 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/spinlock_pool.hpp> + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int r = *pw; + *pw += dv; + return r; +} + +inline void atomic_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + ++*pw; +} + +inline int atomic_conditional_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int rv = *pw; + if( rv != 0 ) ++*pw; + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + spinlock_pool<1>::scoped_lock lock( &use_count_ ); + return use_count_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_sync.hpp new file mode 100644 index 0000000000000000000000000000000000000000..41f654e19b19c87381019c6809c6444d897b1f1e --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_sync.hpp @@ -0,0 +1,155 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics +// +// Copyright (c) 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/detail/sp_typeinfo.hpp> +#include <limits.h> + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include <ia64intrin.h> +#endif + +namespace boost +{ + +namespace detail +{ + +#if INT_MAX >= 2147483647 + +typedef int sp_int32_t; + +#else + +typedef long sp_int32_t; + +#endif + +inline void atomic_increment( sp_int32_t * pw ) +{ + __sync_fetch_and_add( pw, 1 ); +} + +inline sp_int32_t atomic_decrement( sp_int32_t * pw ) +{ + return __sync_fetch_and_add( pw, -1 ); +} + +inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + sp_int32_t r = *pw; + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); + + if( r2 == r ) + { + return r; + } + else + { + r = r2; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + sp_int32_t use_count_; // #shared + sp_int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< sp_int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_base_w32.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_w32.hpp similarity index 78% rename from Utilities/BGL/boost/detail/sp_counted_base_w32.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_w32.hpp index e84f06e7f2651b831385cbcb648cef34f66385b6..06aa4565712e240a220c2440298cb6d032f5b6d1 100644 --- a/Utilities/BGL/boost/detail/sp_counted_base_w32.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_base_w32.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -25,7 +25,8 @@ // #include <boost/detail/interlocked.hpp> -#include <typeinfo> +#include <boost/detail/workaround.hpp> +#include <boost/detail/sp_typeinfo.hpp> namespace boost { @@ -65,7 +66,7 @@ public: delete this; } - virtual void * get_deleter( std::type_info const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; void add_ref_copy() { @@ -78,7 +79,19 @@ public: { long tmp = static_cast< long const volatile& >( use_count_ ); if( tmp == 0 ) return false; + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) + + // work around a code generation bug + + long tmp2 = tmp + 1; + if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; + +#else + if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; + +#endif } } @@ -114,4 +127,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED diff --git a/Utilities/BGL/boost/detail/sp_counted_impl.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_impl.hpp similarity index 70% rename from Utilities/BGL/boost/detail/sp_counted_impl.hpp rename to Utilities/BGL/boost/smart_ptr/detail/sp_counted_impl.hpp index 51093b522bdaa5726af5530bbc48039fc93d5b58..397421ae9fae05e5efa6d081333a86ed5f6e1dcf 100644 --- a/Utilities/BGL/boost/detail/sp_counted_impl.hpp +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -25,14 +25,16 @@ #endif #include <boost/checked_delete.hpp> -#include <boost/detail/sp_counted_base.hpp> +#include <boost/smart_ptr/detail/sp_counted_base.hpp> #if defined(BOOST_SP_USE_QUICK_ALLOCATOR) -#include <boost/detail/quick_allocator.hpp> +#include <boost/smart_ptr/detail/quick_allocator.hpp> #endif +#if defined(BOOST_SP_USE_STD_ALLOCATOR) #include <memory> // std::allocator -#include <typeinfo> // std::type_info in get_deleter +#endif + #include <cstddef> // std::size_t namespace boost @@ -76,7 +78,7 @@ public: boost::checked_delete( px_ ); } - virtual void * get_deleter( std::type_info const & ) + virtual void * get_deleter( detail::sp_typeinfo const & ) { return 0; } @@ -142,9 +144,9 @@ public: del( ptr ); } - virtual void * get_deleter( std::type_info const & ti ) + virtual void * get_deleter( detail::sp_typeinfo const & ti ) { - return ti == typeid(D)? &del: 0; + return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0; } #if defined(BOOST_SP_USE_STD_ALLOCATOR) @@ -176,6 +178,48 @@ public: #endif }; +template<class P, class D, class A> class sp_counted_impl_pda: public sp_counted_base +{ +private: + + P p_; // copy constructor must not throw + D d_; // copy constructor must not throw + A a_; // copy constructor must not throw + + sp_counted_impl_pda( sp_counted_impl_pda const & ); + sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); + + typedef sp_counted_impl_pda<P, D, A> this_type; + +public: + + // pre: d( p ) must not throw + + sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a ) + { + } + + virtual void dispose() // nothrow + { + d_( p_ ); + } + + virtual void destroy() // nothrow + { + typedef typename A::template rebind< this_type >::other A2; + + A2 a2( a_ ); + + this->~this_type(); + a2.deallocate( this, 1 ); + } + + virtual void * get_deleter( detail::sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0; + } +}; + #ifdef __CODEGUARD__ # pragma option pop #endif @@ -184,4 +228,4 @@ public: } // namespace boost -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/sp_has_sync.hpp b/Utilities/BGL/boost/smart_ptr/detail/sp_has_sync.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7fcd09ef08bf89f62b1be1d20bf08c194b0b2f8a --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/sp_has_sync.hpp @@ -0,0 +1,49 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/detail/sp_has_sync.hpp +// +// Copyright (c) 2008, 2009 Peter Dimov +// +// 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) +// +// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics +// are available. +// + +#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) + +#define BOOST_SP_HAS_SYNC + +#if defined( __arm__ ) || defined( __armel__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __hppa ) || defined( __hppa__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __m68k__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __sparc__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1100 ) +#undef BOOST_SP_HAS_SYNC +#endif + +#endif // __GNUC__ * 100 + __GNUC_MINOR__ >= 401 + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/spinlock.hpp b/Utilities/BGL/boost/smart_ptr/detail/spinlock.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1640a38d4944a72f5b65252a4d3341917b642553 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/spinlock.hpp @@ -0,0 +1,53 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// 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) +// +// struct spinlock +// { +// void lock(); +// bool try_lock(); +// void unlock(); +// +// class scoped_lock; +// }; +// +// #define BOOST_DETAIL_SPINLOCK_INIT <unspecified> +// + +#include <boost/config.hpp> +#include <boost/smart_ptr/detail/sp_has_sync.hpp> + +#if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) +# include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp> + +#elif defined( BOOST_SP_HAS_SYNC ) +# include <boost/smart_ptr/detail/spinlock_sync.hpp> + +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include <boost/smart_ptr/detail/spinlock_w32.hpp> + +#elif defined(BOOST_HAS_PTHREADS) +# include <boost/smart_ptr/detail/spinlock_pt.hpp> + +#elif !defined(BOOST_HAS_THREADS) +# include <boost/smart_ptr/detail/spinlock_nt.hpp> + +#else +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/Utilities/BGL/boost/smart_ptr/detail/spinlock_gcc_arm.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba6c511e28015409229a4ef1ec82428a909bc3ee --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/spinlock_gcc_arm.hpp @@ -0,0 +1,85 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/smart_ptr/detail/yield_k.hpp> + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r; + + __asm__ __volatile__( + "swp %0, %1, [%2]": + "=&r"( r ): // outputs + "r"( 1 ), "r"( &v_ ): // inputs + "memory", "cc" ); + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __asm__ __volatile__( "" ::: "memory" ); + *const_cast< int volatile* >( &v_ ) = 0; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/spinlock_nt.hpp b/Utilities/BGL/boost/smart_ptr/detail/spinlock_nt.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f399d0dd4162551b369ac35f27f28bb02275cba --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/spinlock_nt.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/assert.hpp> + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + bool locked_; + +public: + + inline bool try_lock() + { + if( locked_ ) + { + return false; + } + else + { + locked_ = true; + return true; + } + } + + inline void lock() + { + BOOST_ASSERT( !locked_ ); + locked_ = true; + } + + inline void unlock() + { + BOOST_ASSERT( locked_ ); + locked_ = false; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { false } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/spinlock_pool.hpp b/Utilities/BGL/boost/smart_ptr/detail/spinlock_pool.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0e2e08ac80a8cc985bcf49a7a01d5cabf616ac2a --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/spinlock_pool.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock_pool.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// 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) +// +// spinlock_pool<0> is reserved for atomic<>, when/if it arrives +// spinlock_pool<1> is reserved for shared_ptr reference counts +// spinlock_pool<2> is reserved for shared_ptr atomic access +// + +#include <boost/config.hpp> +#include <boost/smart_ptr/detail/spinlock.hpp> +#include <cstddef> + +namespace boost +{ + +namespace detail +{ + +template< int I > class spinlock_pool +{ +private: + + static spinlock pool_[ 41 ]; + +public: + + static spinlock & spinlock_for( void const * pv ) + { + std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; + return pool_[ i ]; + } + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) ) + { + sp_.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +template< int I > spinlock spinlock_pool< I >::pool_[ 41 ] = +{ + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT +}; + +} // namespace detail +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/spinlock_pt.hpp b/Utilities/BGL/boost/smart_ptr/detail/spinlock_pt.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f9cabfc3a7c599b2dfedf28458ef33d4734cfd1f --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/spinlock_pt.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <pthread.h> + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + pthread_mutex_t v_; + +public: + + bool try_lock() + { + return pthread_mutex_trylock( &v_ ) == 0; + } + + void lock() + { + pthread_mutex_lock( &v_ ); + } + + void unlock() + { + pthread_mutex_unlock( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/spinlock_sync.hpp b/Utilities/BGL/boost/smart_ptr/detail/spinlock_sync.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a7145c5ac2782e7051a75db82e2f524334ce8443 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/spinlock_sync.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/smart_ptr/detail/yield_k.hpp> + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include <ia64intrin.h> +#endif + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r = __sync_lock_test_and_set( &v_, 1 ); + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __sync_lock_release( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/spinlock_w32.hpp b/Utilities/BGL/boost/smart_ptr/detail/spinlock_w32.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fb97629c7cdb811fbe0f2997a9b8118c87113cfd --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/spinlock_w32.hpp @@ -0,0 +1,113 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include <boost/detail/interlocked.hpp> +#include <boost/smart_ptr/detail/yield_k.hpp> + +// BOOST_COMPILER_FENCE + +#if defined(__INTEL_COMPILER) + +#define BOOST_COMPILER_FENCE __memory_barrier(); + +#elif defined( _MSC_VER ) && _MSC_VER >= 1310 + +extern "C" void _ReadWriteBarrier(); +#pragma intrinsic( _ReadWriteBarrier ) + +#define BOOST_COMPILER_FENCE _ReadWriteBarrier(); + +#elif defined(__GNUC__) + +#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" ); + +#else + +#define BOOST_COMPILER_FENCE + +#endif + +// + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + long v_; + +public: + + bool try_lock() + { + long r = BOOST_INTERLOCKED_EXCHANGE( &v_, 1 ); + + BOOST_COMPILER_FENCE + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + BOOST_COMPILER_FENCE + *const_cast< long volatile* >( &v_ ) = 0; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/detail/yield_k.hpp b/Utilities/BGL/boost/smart_ptr/detail/yield_k.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a956cc0c974168883d99badc46961e076b983493 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/detail/yield_k.hpp @@ -0,0 +1,149 @@ +#ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// yield_k.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// void yield( unsigned k ); +// +// Typical use: +// +// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include <boost/config.hpp> + +// BOOST_SMT_PAUSE + +#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) + +extern "C" void _mm_pause(); +#pragma intrinsic( _mm_pause ) + +#define BOOST_SMT_PAUSE _mm_pause(); + +#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) + +#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); + +#endif + +// + +#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +#if defined( BOOST_USE_WINDOWS_H ) +# include <windows.h> +#endif + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_USE_WINDOWS_H ) + extern "C" void __stdcall Sleep( unsigned ms ); +#endif + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif + else if( k < 32 ) + { + Sleep( 0 ); + } + else + { + Sleep( 1 ); + } +} + +} // namespace detail + +} // namespace boost + +#elif defined( BOOST_HAS_PTHREADS ) + +#include <sched.h> +#include <time.h> + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif + else if( k < 32 || k & 1 ) + { + sched_yield(); + } + else + { + // g++ -Wextra warns on {} or {0} + struct timespec rqtp = { 0, 0 }; + + // POSIX says that timespec has tv_sec and tv_nsec + // But it doesn't guarantee order or placement + + rqtp.tv_sec = 0; + rqtp.tv_nsec = 1000; + + nanosleep( &rqtp, 0 ); + } +} + +} // namespace detail + +} // namespace boost + +#else + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned ) +{ +} + +} // namespace detail + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/enable_shared_from_this.hpp b/Utilities/BGL/boost/smart_ptr/enable_shared_from_this.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f7b144525b16057341c25ad3ce164a7763480aa9 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/enable_shared_from_this.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED +#define BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED + +// +// enable_shared_from_this.hpp +// +// Copyright 2002, 2009 Peter Dimov +// +// 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 +// +// http://www.boost.org/libs/smart_ptr/enable_shared_from_this.html +// + +#include <boost/smart_ptr/weak_ptr.hpp> +#include <boost/smart_ptr/shared_ptr.hpp> +#include <boost/assert.hpp> +#include <boost/config.hpp> + +namespace boost +{ + +template<class T> class enable_shared_from_this +{ +protected: + + enable_shared_from_this() + { + } + + enable_shared_from_this(enable_shared_from_this const &) + { + } + + enable_shared_from_this & operator=(enable_shared_from_this const &) + { + return *this; + } + + ~enable_shared_from_this() + { + } + +public: + + shared_ptr<T> shared_from_this() + { + shared_ptr<T> p( weak_this_ ); + BOOST_ASSERT( p.get() == this ); + return p; + } + + shared_ptr<T const> shared_from_this() const + { + shared_ptr<T const> p( weak_this_ ); + BOOST_ASSERT( p.get() == this ); + return p; + } + +public: // actually private, but avoids compiler template friendship issues + + // Note: invoked automatically by shared_ptr; do not call + template<class X, class Y> void _internal_accept_owner( shared_ptr<X> const * ppx, Y * py ) const + { + if( weak_this_.expired() ) + { + weak_this_ = shared_ptr<T>( *ppx, py ); + } + } + +private: + + mutable weak_ptr<T> weak_this_; +}; + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/enable_shared_from_this2.hpp b/Utilities/BGL/boost/smart_ptr/enable_shared_from_this2.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a5bfcff836fd6dd0a6126c83ca08c9704773c460 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/enable_shared_from_this2.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED +#define BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED + +// +// enable_shared_from_this2.hpp +// +// Copyright 2002, 2009 Peter Dimov +// Copyright 2008 Frank Mori Hess +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include <boost/config.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/assert.hpp> +#include <boost/detail/workaround.hpp> + +namespace boost +{ + +namespace detail +{ + +class esft2_deleter_wrapper +{ +private: + + shared_ptr<void> deleter_; + +public: + + esft2_deleter_wrapper() + { + } + + template< class T > void set_deleter( shared_ptr<T> const & deleter ) + { + deleter_ = deleter; + } + + template< class T> void operator()( T* ) + { + BOOST_ASSERT( deleter_.use_count() <= 1 ); + deleter_.reset(); + } +}; + +} // namespace detail + +template< class T > class enable_shared_from_this2 +{ +protected: + + enable_shared_from_this2() + { + } + + enable_shared_from_this2( enable_shared_from_this2 const & ) + { + } + + enable_shared_from_this2 & operator=( enable_shared_from_this2 const & ) + { + return *this; + } + + ~enable_shared_from_this2() + { + BOOST_ASSERT( shared_this_.use_count() <= 1 ); // make sure no dangling shared_ptr objects exist + } + +private: + + mutable weak_ptr<T> weak_this_; + mutable shared_ptr<T> shared_this_; + +public: + + shared_ptr<T> shared_from_this() + { + init_weak_once(); + return shared_ptr<T>( weak_this_ ); + } + + shared_ptr<T const> shared_from_this() const + { + init_weak_once(); + return shared_ptr<T>( weak_this_ ); + } + +private: + + void init_weak_once() const + { + if( weak_this_._empty() ) + { + shared_this_.reset( static_cast< T* >( 0 ), detail::esft2_deleter_wrapper() ); + weak_this_ = shared_this_; + } + } + +public: // actually private, but avoids compiler template friendship issues + + // Note: invoked automatically by shared_ptr; do not call + template<class X, class Y> void _internal_accept_owner( shared_ptr<X> * ppx, Y * py ) const + { + BOOST_ASSERT( ppx != 0 ); + + if( weak_this_.use_count() == 0 ) + { + weak_this_ = shared_ptr<T>( *ppx, py ); + } + else if( shared_this_.use_count() != 0 ) + { + BOOST_ASSERT( ppx->unique() ); // no weak_ptrs should exist either, but there's no way to check that + + detail::esft2_deleter_wrapper * pd = boost::get_deleter<detail::esft2_deleter_wrapper>( shared_this_ ); + BOOST_ASSERT( pd != 0 ); + + pd->set_deleter( *ppx ); + + ppx->reset( shared_this_, ppx->get() ); + shared_this_.reset(); + } + } +}; + +} // namespace boost + +#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/intrusive_ptr.hpp b/Utilities/BGL/boost/smart_ptr/intrusive_ptr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e72eb2186985d93acbb9387e874895a23bdf1e79 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/intrusive_ptr.hpp @@ -0,0 +1,299 @@ +#ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED + +// +// intrusive_ptr.hpp +// +// Copyright (c) 2001, 2002 Peter Dimov +// +// 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/smart_ptr/intrusive_ptr.html for documentation. +// + +#include <boost/config.hpp> + +#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash +# pragma warning(push) +# pragma warning(disable:4284) // odd return type for operator-> +#endif + +#include <boost/assert.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/smart_ptr/detail/sp_convertible.hpp> + +#include <boost/config/no_tr1/functional.hpp> // for std::less + +#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_NO_IOSFWD) +#include <iosfwd> // for std::basic_ostream +#else +#include <ostream> +#endif +#endif + + +namespace boost +{ + +// +// intrusive_ptr +// +// A smart pointer that uses intrusive reference counting. +// +// Relies on unqualified calls to +// +// void intrusive_ptr_add_ref(T * p); +// void intrusive_ptr_release(T * p); +// +// (p != 0) +// +// The object is responsible for destroying itself. +// + +template<class T> class intrusive_ptr +{ +private: + + typedef intrusive_ptr this_type; + +public: + + typedef T element_type; + + intrusive_ptr(): px( 0 ) + { + } + + intrusive_ptr( T * p, bool add_ref = true ): px( p ) + { + if( px != 0 && add_ref ) intrusive_ptr_add_ref( px ); + } + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) + + template<class U> +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + intrusive_ptr( intrusive_ptr<U> const & rhs, typename boost::detail::sp_enable_if_convertible<U,T>::type = boost::detail::sp_empty() ) + +#else + + intrusive_ptr( intrusive_ptr<U> const & rhs ) + +#endif + : px( rhs.get() ) + { + if( px != 0 ) intrusive_ptr_add_ref( px ); + } + +#endif + + intrusive_ptr(intrusive_ptr const & rhs): px( rhs.px ) + { + if( px != 0 ) intrusive_ptr_add_ref( px ); + } + + ~intrusive_ptr() + { + if( px != 0 ) intrusive_ptr_release( px ); + } + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) + + template<class U> intrusive_ptr & operator=(intrusive_ptr<U> const & rhs) + { + this_type(rhs).swap(*this); + return *this; + } + +#endif + +// Move support + +#if defined( BOOST_HAS_RVALUE_REFS ) + + intrusive_ptr(intrusive_ptr && rhs): px( rhs.px ) + { + rhs.px = 0; + } + + intrusive_ptr & operator=(intrusive_ptr && rhs) + { + this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this); + return *this; + } + +#endif + + intrusive_ptr & operator=(intrusive_ptr const & rhs) + { + this_type(rhs).swap(*this); + return *this; + } + + intrusive_ptr & operator=(T * rhs) + { + this_type(rhs).swap(*this); + return *this; + } + + void reset() + { + this_type().swap( *this ); + } + + void reset( T * rhs ) + { + this_type( rhs ).swap( *this ); + } + + T * get() const + { + return px; + } + + T & operator*() const + { + BOOST_ASSERT( px != 0 ); + return *px; + } + + T * operator->() const + { + BOOST_ASSERT( px != 0 ); + return px; + } + +// implicit conversion to "bool" +#include <boost/smart_ptr/detail/operator_bool.hpp> + + void swap(intrusive_ptr & rhs) + { + T * tmp = px; + px = rhs.px; + rhs.px = tmp; + } + +private: + + T * px; +}; + +template<class T, class U> inline bool operator==(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) +{ + return a.get() == b.get(); +} + +template<class T, class U> inline bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<U> const & b) +{ + return a.get() != b.get(); +} + +template<class T, class U> inline bool operator==(intrusive_ptr<T> const & a, U * b) +{ + return a.get() == b; +} + +template<class T, class U> inline bool operator!=(intrusive_ptr<T> const & a, U * b) +{ + return a.get() != b; +} + +template<class T, class U> inline bool operator==(T * a, intrusive_ptr<U> const & b) +{ + return a == b.get(); +} + +template<class T, class U> inline bool operator!=(T * a, intrusive_ptr<U> const & b) +{ + return a != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template<class T> inline bool operator!=(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) +{ + return a.get() != b.get(); +} + +#endif + +template<class T> inline bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) +{ + return std::less<T *>()(a.get(), b.get()); +} + +template<class T> void swap(intrusive_ptr<T> & lhs, intrusive_ptr<T> & rhs) +{ + lhs.swap(rhs); +} + +// mem_fn support + +template<class T> T * get_pointer(intrusive_ptr<T> const & p) +{ + return p.get(); +} + +template<class T, class U> intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & p) +{ + return static_cast<T *>(p.get()); +} + +template<class T, class U> intrusive_ptr<T> const_pointer_cast(intrusive_ptr<U> const & p) +{ + return const_cast<T *>(p.get()); +} + +template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U> const & p) +{ + return dynamic_cast<T *>(p.get()); +} + +// operator<< + +#if !defined(BOOST_NO_IOSTREAM) + +#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) + +template<class Y> std::ostream & operator<< (std::ostream & os, intrusive_ptr<Y> const & p) +{ + os << p.get(); + return os; +} + +#else + +// in STLport's no-iostreams mode no iostream symbols can be used +#ifndef _STLP_NO_IOSTREAMS + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) +// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL +using std::basic_ostream; +template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, intrusive_ptr<Y> const & p) +# else +template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, intrusive_ptr<Y> const & p) +# endif +{ + os << p.get(); + return os; +} + +#endif // _STLP_NO_IOSTREAMS + +#endif // __GNUC__ < 3 + +#endif // !defined(BOOST_NO_IOSTREAM) + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/make_shared.hpp b/Utilities/BGL/boost/smart_ptr/make_shared.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d47718808c44c0473ba5ba0f2ebcb75028609509 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/make_shared.hpp @@ -0,0 +1,506 @@ +#ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED +#define BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED + +// make_shared.hpp +// +// Copyright (c) 2007, 2008 Peter Dimov +// +// 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/smart_ptr/make_shared.html +// for documentation. + +#include <boost/config.hpp> +#include <boost/smart_ptr/shared_ptr.hpp> +#include <boost/type_traits/type_with_alignment.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <cstddef> +#include <new> + +namespace boost +{ + +namespace detail +{ + +template< std::size_t N, std::size_t A > struct sp_aligned_storage +{ + union type + { + char data_[ N ]; + typename boost::type_with_alignment< A >::type align_; + }; +}; + +template< class T > class sp_ms_deleter +{ +private: + + typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; + + bool initialized_; + storage_type storage_; + +private: + + void destroy() + { + if( initialized_ ) + { + reinterpret_cast< T* >( storage_.data_ )->~T(); + initialized_ = false; + } + } + +public: + + sp_ms_deleter(): initialized_( false ) + { + } + + // optimization: do not copy storage_ + sp_ms_deleter( sp_ms_deleter const & ): initialized_( false ) + { + } + + ~sp_ms_deleter() + { + destroy(); + } + + void operator()( T * ) + { + destroy(); + } + + void * address() + { + return storage_.data_; + } + + void set_initialized() + { + initialized_ = true; + } +}; + +#if defined( BOOST_HAS_RVALUE_REFS ) +template< class T > T&& forward( T &&t ) +{ + return t; +} +#endif + +} // namespace detail + +// Zero-argument versions +// +// Used even when variadic templates are available because of the new T() vs new T issue + +template< class T > boost::shared_ptr< T > make_shared() +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T(); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T(); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#if defined( BOOST_HAS_VARIADIC_TMPL ) && defined( BOOST_HAS_RVALUE_REFS ) + +// Variadic templates, rvalue reference + +template< class T, class... Args > boost::shared_ptr< T > make_shared( Args && ... args ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( detail::forward<Args>( args )... ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Args && ... args ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( detail::forward<Args>( args )... ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#else + +// C++03 version + +template< class T, class A1 > +boost::shared_ptr< T > make_shared( A1 const & a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >() ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::sp_ms_deleter< T >(), a ); + + detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#endif + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/scoped_array.hpp b/Utilities/BGL/boost/smart_ptr/scoped_array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..483460fa06bb372a7a1edf7040f2c23fef60fb5b --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/scoped_array.hpp @@ -0,0 +1,107 @@ +#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED +#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// 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) +// +// http://www.boost.org/libs/smart_ptr/scoped_array.htm +// + +#include <boost/assert.hpp> +#include <boost/checked_delete.hpp> +#include <boost/config.hpp> // in case ptrdiff_t not in std + +#include <boost/detail/workaround.hpp> + +#include <cstddef> // for std::ptrdiff_t + +namespace boost +{ + +// Debug hooks + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_array_constructor_hook(void * p); +void sp_array_destructor_hook(void * p); + +#endif + +// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to +// is guaranteed, either on destruction of the scoped_array or via an explicit +// reset(). Use shared_array or std::vector if your needs are more complex. + +template<class T> class scoped_array // noncopyable +{ +private: + + T * px; + + scoped_array(scoped_array const &); + scoped_array & operator=(scoped_array const &); + + typedef scoped_array<T> this_type; + + void operator==( scoped_array const& ) const; + void operator!=( scoped_array const& ) const; + +public: + + typedef T element_type; + + explicit scoped_array( T * p = 0 ) : px( p ) // never throws + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_array_constructor_hook( px ); +#endif + } + + ~scoped_array() // never throws + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_array_destructor_hook( px ); +#endif + boost::checked_array_delete( px ); + } + + void reset(T * p = 0) // never throws + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type(p).swap(*this); + } + + T & operator[](std::ptrdiff_t i) const // never throws + { + BOOST_ASSERT( px != 0 ); + BOOST_ASSERT( i >= 0 ); + return px[i]; + } + + T * get() const // never throws + { + return px; + } + +// implicit conversion to "bool" +#include <boost/smart_ptr/detail/operator_bool.hpp> + + void swap(scoped_array & b) // never throws + { + T * tmp = b.px; + b.px = px; + px = tmp; + } +}; + +template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) // never throws +{ + a.swap(b); +} + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED diff --git a/Utilities/BGL/boost/scoped_ptr.hpp b/Utilities/BGL/boost/smart_ptr/scoped_ptr.hpp similarity index 59% rename from Utilities/BGL/boost/scoped_ptr.hpp rename to Utilities/BGL/boost/smart_ptr/scoped_ptr.hpp index 651deed6906b4603b240f1214f800477977635a5..df479e57279bdbccc55970aa41d616737c1f5b32 100644 --- a/Utilities/BGL/boost/scoped_ptr.hpp +++ b/Utilities/BGL/boost/smart_ptr/scoped_ptr.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED -#define BOOST_SCOPED_PTR_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. // Copyright (c) 2001, 2002 Peter Dimov @@ -40,30 +40,33 @@ template<class T> class scoped_ptr // noncopyable { private: - T * ptr; + T * px; scoped_ptr(scoped_ptr const &); scoped_ptr & operator=(scoped_ptr const &); typedef scoped_ptr<T> this_type; + void operator==( scoped_ptr const& ) const; + void operator!=( scoped_ptr const& ) const; + public: typedef T element_type; - explicit scoped_ptr(T * p = 0): ptr(p) // never throws + explicit scoped_ptr( T * p = 0 ): px( p ) // never throws { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook(ptr); + boost::sp_scalar_constructor_hook( px ); #endif } #ifndef BOOST_NO_AUTO_PTR - explicit scoped_ptr(std::auto_ptr<T> p): ptr(p.release()) // never throws + explicit scoped_ptr( std::auto_ptr<T> p ): px( p.release() ) // never throws { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook(ptr); + boost::sp_scalar_constructor_hook( px ); #endif } @@ -72,71 +75,42 @@ public: ~scoped_ptr() // never throws { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_destructor_hook(ptr); + boost::sp_scalar_destructor_hook( px ); #endif - boost::checked_delete(ptr); + boost::checked_delete( px ); } void reset(T * p = 0) // never throws { - BOOST_ASSERT(p == 0 || p != ptr); // catch self-reset errors + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors this_type(p).swap(*this); } T & operator*() const // never throws { - BOOST_ASSERT(ptr != 0); - return *ptr; + BOOST_ASSERT( px != 0 ); + return *px; } T * operator->() const // never throws { - BOOST_ASSERT(ptr != 0); - return ptr; + BOOST_ASSERT( px != 0 ); + return px; } T * get() const // never throws { - return ptr; - } - - // implicit conversion to "bool" - -#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530) - - operator bool () const - { - return ptr != 0; - } - -#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - typedef T * (this_type::*unspecified_bool_type)() const; - - operator unspecified_bool_type() const // never throws - { - return ptr == 0? 0: &this_type::get; + return px; } -#else - typedef T * this_type::*unspecified_bool_type; - - operator unspecified_bool_type() const // never throws - { - return ptr == 0? 0: &this_type::ptr; - } - -#endif - - bool operator! () const // never throws - { - return ptr == 0; - } +// implicit conversion to "bool" +#include <boost/smart_ptr/detail/operator_bool.hpp> void swap(scoped_ptr & b) // never throws { - T * tmp = b.ptr; - b.ptr = ptr; - ptr = tmp; + T * tmp = b.px; + b.px = px; + px = tmp; } }; @@ -154,4 +128,4 @@ template<class T> inline T * get_pointer(scoped_ptr<T> const & p) } // namespace boost -#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/shared_array.hpp b/Utilities/BGL/boost/smart_ptr/shared_array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f50403a3825b3fe5a60b89b7cdd0e85f4669b93 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/shared_array.hpp @@ -0,0 +1,147 @@ +#ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED +#define BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED + +// +// shared_array.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// 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/smart_ptr/shared_array.htm for documentation. +// + +#include <boost/config.hpp> // for broken compiler workarounds + +#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) +#include <boost/smart_ptr/detail/shared_array_nmt.hpp> +#else + +#include <memory> // TR1 cyclic inclusion fix + +#include <boost/assert.hpp> +#include <boost/checked_delete.hpp> + +#include <boost/smart_ptr/detail/shared_count.hpp> +#include <boost/detail/workaround.hpp> + +#include <cstddef> // for std::ptrdiff_t +#include <algorithm> // for std::swap +#include <functional> // for std::less + +namespace boost +{ + +// +// shared_array +// +// shared_array extends shared_ptr to arrays. +// The array pointed to is deleted when the last shared_array pointing to it +// is destroyed or reset. +// + +template<class T> class shared_array +{ +private: + + // Borland 5.5.1 specific workarounds + typedef checked_array_deleter<T> deleter; + typedef shared_array<T> this_type; + +public: + + typedef T element_type; + + explicit shared_array(T * p = 0): px(p), pn(p, deleter()) + { + } + + // + // Requirements: D's copy constructor must not throw + // + // shared_array will release p by calling d(p) + // + + template<class D> shared_array(T * p, D d): px(p), pn(p, d) + { + } + +// generated copy constructor, assignment, destructor are fine + + void reset(T * p = 0) + { + BOOST_ASSERT(p == 0 || p != px); + this_type(p).swap(*this); + } + + template <class D> void reset(T * p, D d) + { + this_type(p, d).swap(*this); + } + + T & operator[] (std::ptrdiff_t i) const // never throws + { + BOOST_ASSERT(px != 0); + BOOST_ASSERT(i >= 0); + return px[i]; + } + + T * get() const // never throws + { + return px; + } + +// implicit conversion to "bool" +#include <boost/smart_ptr/detail/operator_bool.hpp> + + bool unique() const // never throws + { + return pn.unique(); + } + + long use_count() const // never throws + { + return pn.use_count(); + } + + void swap(shared_array<T> & other) // never throws + { + std::swap(px, other.px); + pn.swap(other.pn); + } + +private: + + T * px; // contained pointer + detail::shared_count pn; // reference counter + +}; // shared_array + +template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) // never throws +{ + return a.get() == b.get(); +} + +template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) // never throws +{ + return a.get() != b.get(); +} + +template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) // never throws +{ + return std::less<T*>()(a.get(), b.get()); +} + +template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never throws +{ + a.swap(b); +} + +} // namespace boost + +#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) + +#endif // #ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED diff --git a/Utilities/BGL/boost/smart_ptr/shared_ptr.hpp b/Utilities/BGL/boost/smart_ptr/shared_ptr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..609cce903221ab5687ccbabc9d651348e883dc76 --- /dev/null +++ b/Utilities/BGL/boost/smart_ptr/shared_ptr.hpp @@ -0,0 +1,701 @@ +#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED + +// +// shared_ptr.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001-2008 Peter Dimov +// +// 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/smart_ptr/shared_ptr.htm for documentation. +// + +#include <boost/config.hpp> // for broken compiler workarounds + +#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) +#include <boost/smart_ptr/detail/shared_ptr_nmt.hpp> +#else + +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of <memory> doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including <memory> directly: +#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr + +#include <boost/assert.hpp> +#include <boost/checked_delete.hpp> +#include <boost/throw_exception.hpp> +#include <boost/smart_ptr/detail/shared_count.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/smart_ptr/detail/sp_convertible.hpp> + +#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) +#include <boost/smart_ptr/detail/spinlock_pool.hpp> +#include <boost/memory_order.hpp> +#endif + +#include <algorithm> // for std::swap +#include <functional> // for std::less +#include <typeinfo> // for std::bad_cast + +#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_NO_IOSFWD) +#include <iosfwd> // for std::basic_ostream +#else +#include <ostream> +#endif +#endif + +#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash +# pragma warning(push) +# pragma warning(disable:4284) // odd return type for operator-> +#endif + +namespace boost +{ + +template<class T> class shared_ptr; +template<class T> class weak_ptr; +template<class T> class enable_shared_from_this; +template<class T> class enable_shared_from_this2; + +namespace detail +{ + +struct static_cast_tag {}; +struct const_cast_tag {}; +struct dynamic_cast_tag {}; +struct polymorphic_cast_tag {}; + +template<class T> struct shared_ptr_traits +{ + typedef T & reference; +}; + +template<> struct shared_ptr_traits<void> +{ + typedef void reference; +}; + +#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) + +template<> struct shared_ptr_traits<void const> +{ + typedef void reference; +}; + +template<> struct shared_ptr_traits<void volatile> +{ + typedef void reference; +}; + +template<> struct shared_ptr_traits<void const volatile> +{ + typedef void reference; +}; + +#endif + +// enable_shared_from_this support + +template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe ) +{ + if( pe != 0 ) + { + pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); + } +} + +template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> * ppx, Y const * py, boost::enable_shared_from_this2< T > const * pe ) +{ + if( pe != 0 ) + { + pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); + } +} + +#ifdef _MANAGED + +// Avoid C4793, ... causes native code generation + +struct sp_any_pointer +{ + template<class T> sp_any_pointer( T* ) {} +}; + +inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer ) +{ +} + +#else // _MANAGED + +inline void sp_enable_shared_from_this( ... ) +{ +} + +#endif // _MANAGED + +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) + +// rvalue auto_ptr support based on a technique by Dave Abrahams + +template< class T, class R > struct sp_enable_if_auto_ptr +{ +}; + +template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > +{ + typedef R type; +}; + +#endif + +} // namespace detail + + +// +// shared_ptr +// +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. +// + +template<class T> class shared_ptr +{ +private: + + // Borland 5.5.1 specific workaround + typedef shared_ptr<T> this_type; + +public: + + typedef T element_type; + typedef T value_type; + typedef T * pointer; + typedef typename boost::detail::shared_ptr_traits<T>::reference reference; + + shared_ptr(): px(0), pn() // never throws in 1.30+ + { + } + + template<class Y> + explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete + { + boost::detail::sp_enable_shared_from_this( this, p, p ); + } + + // + // Requirements: D's copy constructor must not throw + // + // shared_ptr will release p by calling d(p) + // + + template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d) + { + boost::detail::sp_enable_shared_from_this( this, p, p ); + } + + // As above, but with allocator. A's copy constructor shall not throw. + + template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) + { + boost::detail::sp_enable_shared_from_this( this, p, p ); + } + +// generated copy constructor, destructor are fine + + template<class Y> + explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw + { + // it is now safe to copy r.px, as pn(r.pn) did not throw + px = r.px; + } + + template<class Y> + shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws + { + if( !pn.empty() ) + { + px = r.px; + } + } + + template<class Y> +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + shared_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) + +#else + + shared_ptr( shared_ptr<Y> const & r ) + +#endif + : px( r.px ), pn( r.pn ) // never throws + { + } + + // aliasing + template< class Y > + shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws + { + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn) + { + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn) + { + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, boost::detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) + { + if(px == 0) // need to allocate new counter -- the cast failed + { + pn = boost::detail::shared_count(); + } + } + + template<class Y> + shared_ptr(shared_ptr<Y> const & r, boost::detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn) + { + if(px == 0) + { + boost::throw_exception(std::bad_cast()); + } + } + +#ifndef BOOST_NO_AUTO_PTR + + template<class Y> + explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn() + { + Y * tmp = r.get(); + pn = boost::detail::shared_count(r); + boost::detail::sp_enable_shared_from_this( this, tmp, tmp ); + } + +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template<class Ap> + explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn() + { + typename Ap::element_type * tmp = r.get(); + pn = boost::detail::shared_count( r ); + boost::detail::sp_enable_shared_from_this( this, tmp, tmp ); + } + + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR + + // assignment + + shared_ptr & operator=( shared_ptr const & r ) // never throws + { + this_type(r).swap(*this); + return *this; + } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) + + template<class Y> + shared_ptr & operator=(shared_ptr<Y> const & r) // never throws + { + this_type(r).swap(*this); + return *this; + } + +#endif + +#ifndef BOOST_NO_AUTO_PTR + + template<class Y> + shared_ptr & operator=( std::auto_ptr<Y> & r ) + { + this_type(r).swap(*this); + return *this; + } + +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template<class Ap> + typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) + { + this_type( r ).swap( *this ); + return *this; + } + + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR + +// Move support + +#if defined( BOOST_HAS_RVALUE_REFS ) + + shared_ptr( shared_ptr && r ): px( r.px ), pn() // never throws + { + pn.swap( r.pn ); + r.px = 0; + } + + template<class Y> +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + shared_ptr( shared_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) + +#else + + shared_ptr( shared_ptr<Y> && r ) + +#endif + : px( r.px ), pn() // never throws + { + pn.swap( r.pn ); + r.px = 0; + } + + shared_ptr & operator=( shared_ptr && r ) // never throws + { + this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); + return *this; + } + + template<class Y> + shared_ptr & operator=( shared_ptr<Y> && r ) // never throws + { + this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this ); + return *this; + } + +#endif + + void reset() // never throws in 1.30+ + { + this_type().swap(*this); + } + + template<class Y> void reset(Y * p) // Y must be complete + { + BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors + this_type(p).swap(*this); + } + + template<class Y, class D> void reset( Y * p, D d ) + { + this_type( p, d ).swap( *this ); + } + + template<class Y, class D, class A> void reset( Y * p, D d, A a ) + { + this_type( p, d, a ).swap( *this ); + } + + template<class Y> void reset( shared_ptr<Y> const & r, T * p ) + { + this_type( r, p ).swap( *this ); + } + + reference operator* () const // never throws + { + BOOST_ASSERT(px != 0); + return *px; + } + + T * operator-> () const // never throws + { + BOOST_ASSERT(px != 0); + return px; + } + + T * get() const // never throws + { + return px; + } + +// implicit conversion to "bool" +#include <boost/smart_ptr/detail/operator_bool.hpp> + + bool unique() const // never throws + { + return pn.unique(); + } + + long use_count() const // never throws + { + return pn.use_count(); + } + + void swap(shared_ptr<T> & other) // never throws + { + std::swap(px, other.px); + pn.swap(other.pn); + } + + template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const + { + return pn < rhs.pn; + } + + void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const + { + return pn.get_deleter( ti ); + } + + bool _internal_equiv( shared_ptr const & r ) const + { + return px == r.px && pn == r.pn; + } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + +private: + + template<class Y> friend class shared_ptr; + template<class Y> friend class weak_ptr; + + +#endif + + T * px; // contained pointer + boost::detail::shared_count pn; // reference counter + +}; // shared_ptr + +template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a.get() == b.get(); +} + +template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a.get() != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b) +{ + return a.get() != b.get(); +} + +#endif + +template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) +{ + return a._internal_less(b); +} + +template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) +{ + a.swap(b); +} + +template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, boost::detail::static_cast_tag()); +} + +template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, boost::detail::const_cast_tag()); +} + +template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, boost::detail::dynamic_cast_tag()); +} + +// shared_*_cast names are deprecated. Use *_pointer_cast instead. + +template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, boost::detail::static_cast_tag()); +} + +template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, boost::detail::dynamic_cast_tag()); +} + +template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r) +{ + return shared_ptr<T>(r, boost::detail::polymorphic_cast_tag()); +} + +template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r) +{ + BOOST_ASSERT(dynamic_cast<T *>(r.get()) == r.get()); + return shared_static_cast<T>(r); +} + +// get_pointer() enables boost::mem_fn to recognize shared_ptr + +template<class T> inline T * get_pointer(shared_ptr<T> const & p) +{ + return p.get(); +} + +// operator<< + +#if !defined(BOOST_NO_IOSTREAM) + +#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) + +template<class Y> std::ostream & operator<< (std::ostream & os, shared_ptr<Y> const & p) +{ + os << p.get(); + return os; +} + +#else + +// in STLport's no-iostreams mode no iostream symbols can be used +#ifndef _STLP_NO_IOSTREAMS + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) +// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL +using std::basic_ostream; +template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared_ptr<Y> const & p) +# else +template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p) +# endif +{ + os << p.get(); + return os; +} + +#endif // _STLP_NO_IOSTREAMS + +#endif // __GNUC__ < 3 + +#endif // !defined(BOOST_NO_IOSTREAM) + +// get_deleter + +#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \ + ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \ + ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) ) + +// g++ 2.9x doesn't allow static_cast<X const *>(void *) +// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it + +template<class D, class T> D * get_deleter(shared_ptr<T> const & p) +{ + void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D)); + return const_cast<D *>(static_cast<D const *>(q)); +} + +#else + +template<class D, class T> D * get_deleter(shared_ptr<T> const & p) +{ + return static_cast<D *>(p._internal_get_deleter(BOOST_SP_TYPEID(D))); +} + +#endif + +// atomic access + +#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) + +template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ ) +{ + return false; +} + +template<class T> shared_ptr<T> atomic_load( shared_ptr<T> const * p ) +{ + boost::detail::spinlock_pool<2>::scoped_lock lock( p ); + return *p; +} + +template<class T> inline shared_ptr<T> atomic_load_explicit( shared_ptr<T> const * p, memory_order /*mo*/ ) +{ + return atomic_load( p ); +} + +template<class T> void atomic_store( shared_ptr<T> * p, shared_ptr<T> r ) +{ + boost::detail::spinlock_pool<2>::scoped_lock lock( p ); + p->swap( r ); +} + +template<class T> inline void atomic_store_explicit( shared_ptr<T> * p, shared_ptr<T> r, memory_order /*mo*/ ) +{ + atomic_store( p, r ); // std::move( r ) +} + +template<class T> shared_ptr<T> atomic_exchange( shared_ptr<T> * p, shared_ptr<T> r ) +{ + boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); + + sp.lock(); + p->swap( r ); + sp.unlock(); + + return r; // return std::move( r ) +} + +template<class T> shared_ptr<T> atomic_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> r, memory_order /*mo*/ ) +{ + return atomic_exchange( p, r ); // std::move( r ) +} + +template<class T> bool atomic_compare_exchange( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w ) +{ + boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); + + sp.lock(); + + if( p->_internal_equiv( *v ) ) + { + p->swap( w ); + + sp.unlock(); + + return true; + } + else + { + shared_ptr<T> tmp( *p ); + + sp.unlock(); + + tmp.swap( *v ); + return false; + } +} + +template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, memory_order /*success*/, memory_order /*failure*/ ) +{ + return atomic_compare_exchange( p, v, w ); // std::move( w ) +} + +#endif + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) + +#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/weak_ptr.hpp b/Utilities/BGL/boost/smart_ptr/weak_ptr.hpp similarity index 56% rename from Utilities/BGL/boost/weak_ptr.hpp rename to Utilities/BGL/boost/smart_ptr/weak_ptr.hpp index c2385007931109873e670bced64dd8082d523fa2..d314b0df3eabca979f96ab0041250ff38335273b 100644 --- a/Utilities/BGL/boost/weak_ptr.hpp +++ b/Utilities/BGL/boost/smart_ptr/weak_ptr.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_WEAK_PTR_HPP_INCLUDED -#define BOOST_WEAK_PTR_HPP_INCLUDED +#ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED // // weak_ptr.hpp @@ -13,7 +13,9 @@ // See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for documentation. // -#include <boost/shared_ptr.hpp> +#include <memory> // boost.TR1 include order fix +#include <boost/smart_ptr/detail/shared_count.hpp> +#include <boost/smart_ptr/shared_ptr.hpp> #ifdef BOOST_MSVC // moved here to work around VC++ compiler crash # pragma warning(push) @@ -59,17 +61,67 @@ public: // template<class Y> - weak_ptr(weak_ptr<Y> const & r): pn(r.pn) // never throws +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) + +#else + + weak_ptr( weak_ptr<Y> const & r ) + +#endif + : px(r.lock().get()), pn(r.pn) // never throws { - px = r.lock().get(); } +#if defined( BOOST_HAS_RVALUE_REFS ) + template<class Y> - weak_ptr(shared_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) + +#else + + weak_ptr( weak_ptr<Y> && r ) + +#endif + : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws { + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws + { + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr & operator=( weak_ptr && r ) // never throws + { + this_type( static_cast< weak_ptr && >( r ) ).swap( *this ); + return *this; } -#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) + +#endif + + template<class Y> +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() ) + +#else + + weak_ptr( shared_ptr<Y> const & r ) + +#endif + : px( r.px ), pn( r.pn ) // never throws + { + } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) template<class Y> weak_ptr & operator=(weak_ptr<Y> const & r) // never throws @@ -79,6 +131,17 @@ public: return *this; } +#if defined( BOOST_HAS_RVALUE_REFS ) + + template<class Y> + weak_ptr & operator=( weak_ptr<Y> && r ) + { + this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this ); + return *this; + } + +#endif + template<class Y> weak_ptr & operator=(shared_ptr<Y> const & r) // never throws { @@ -91,31 +154,7 @@ public: shared_ptr<T> lock() const // never throws { -#if defined(BOOST_HAS_THREADS) - - // optimization: avoid throw overhead - if(expired()) - { - return shared_ptr<element_type>(); - } - - try - { - return shared_ptr<element_type>(*this); - } - catch(bad_weak_ptr const &) - { - // Q: how can we get here? - // A: another thread may have invalidated r after the use_count test above. - return shared_ptr<element_type>(); - } - -#else - - // optimization: avoid try/catch overhead when single threaded - return expired()? shared_ptr<element_type>(): shared_ptr<element_type>(*this); - -#endif + return shared_ptr<element_type>( *this, boost::detail::sp_nothrow_tag() ); } long use_count() const // never throws @@ -128,6 +167,11 @@ public: return pn.use_count() == 0; } + bool _empty() const // extension, not in std::weak_ptr + { + return pn.empty(); + } + void reset() // never throws in 1.30+ { this_type().swap(*this); @@ -139,7 +183,7 @@ public: pn.swap(other.pn); } - void _internal_assign(T * px2, detail::shared_count const & pn2) + void _internal_assign(T * px2, boost::detail::shared_count const & pn2) { px = px2; pn = pn2; @@ -162,8 +206,8 @@ private: #endif - T * px; // contained pointer - detail::weak_count pn; // reference counter + T * px; // contained pointer + boost::detail::weak_count pn; // reference counter }; // weak_ptr @@ -177,16 +221,10 @@ template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) a.swap(b); } -// deprecated, provided for backward compatibility -template<class T> shared_ptr<T> make_shared(weak_ptr<T> const & r) -{ - return r.lock(); -} - } // namespace boost #ifdef BOOST_MSVC # pragma warning(pop) #endif -#endif // #ifndef BOOST_WEAK_PTR_HPP_INCLUDED +#endif // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/spirit.hpp b/Utilities/BGL/boost/spirit.hpp deleted file mode 100644 index cae9ad1552162360c09aa817bde75a9c6f335d12..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2001-2003 Hartmut Kaiser - Copyright (c) 2002-2003 Martin Wille - Copyright (c) 2002 Juan Carlos Arevalo-Baeza - Copyright (c) 2002 Raghavendra Satish - Copyright (c) 2002 Jeff Westfahl - Copyright (c) 2001 Bruce Florman - Copyright (c) 2003 Giovanni Bajo - Copyright (c) 2003 Vaclav Vesely - Copyright (c) 2003 Jonathan de Halleux - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(SPIRIT_HPP) -#define SPIRIT_HPP - -/////////////////////////////////////////////////////////////////////////////// -// -// If BOOST_SPIRIT_DEBUG is defined, the following header includes the -// Spirit.Debug layer, otherwise the non-debug Spirit.Core is included. -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.Meta -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/meta.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.ErrorHandling -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/error_handling.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.Iterators -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/iterator.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.Symbols -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/symbols.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.Utilities -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/utility.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.Attributes -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/attribute.hpp> - -#endif // !defined(SPIRIT_HPP) diff --git a/Utilities/BGL/boost/spirit/actor.hpp b/Utilities/BGL/boost/spirit/actor.hpp deleted file mode 100644 index 57b1044404fc75dd4414c19016337af27f1cc4b7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor.hpp +++ /dev/null @@ -1,114 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Actors documentation and convention -// -// Actors -// -// Actors are predefined semantic action functors. They are used to do an -// action on the parse result if the parser has had a successful match. An -// example of actor is the append_actor described in the Spirit -// documentation. -// -// The action takes place through a call to the () operator: single argument -// () operator call for character parsers and two argument (first,last) call -// for phrase parsers. Actors should implement at least one of the two () -// operator. -// -// Actor instances are not created direcly since they usually involve a -// number of template parameters. Instead generator functions ("helper -// functions") are provided to generate actors according to their arguments. -// All helper functions have the "_a" suffix. For example, append_actor is -// created using the append_a function. -// -// Policy holder actors and policy actions -// -// A lot of actors need to store reference to one or more objects. For -// example, actions on container need to store a reference to the container. -// Therefore, this kind of actor have been broken down into -// -// - a action policy that does the action (act method), -// - a policy holder actor that stores the references and feeds the act -// method. -// -// Policy holder actors -// -// Policy holder have the following naming convention: -// <member>_ >> *<member> >> !value >> actor -// where member are the policy stored member, they can be of type: -// -// - ref, a reference, -// - const_ref, a const reference, -// - value, by value, -// - empty, no stored members -// - !value states if the policy uses the parse result or not. -// -// The available policy holder are enumerated below: -// -// - empty_actor, nothing stored, feeds parse result -// - value_actor, 1 object stored by value, feeds value -// - ref_actor, 1 reference stored, feeds ref -// - ref_value_actor, 1 reference stored, feeds ref and parse result -// -// Doc. convention -// -// - ref is a reference to an object stored in a policy holder actor, -// - value_ref,value1_ref, value2_ref are a const reference stored in a -// policy holder actor, -// - value is the parse result in the single argument () operator, -// - first,last are the parse result in the two argument () operator -// -// Actors (generator functions) and quick description -// -// - assign_a(ref) assign parse result to ref -// - assign_a(ref, value_ref) assign value_ref to ref -// - increment_a(ref) increment ref -// - decrement_a(ref) decrement ref -// - push_back_a(ref) push back the parse result in ref -// - push_back_a(ref, value_ref) push back value_ref in ref -// - push_front_a(ref) push front the parse result in ref -// - push_front_a(ref, value_ref) push front value_ref in ref -// - insert_key_a(ref,value_ref) insert value_ref in ref using the -// parse result as key -// - insert_at_a(ref, key_ref) insert the parse result in ref at key_ref -// - insert_at_a(ref, key_ref insert value_ref in ref at key_ref -// , value_ref) -// - assign_key_a(ref, value_ref) assign value_ref in ref using the -// parse result as key -// - erase_a(ref, key) erase data at key from ref -// - clear_a(ref) clears ref -// - swap_a(aref, bref) swaps aref and bref -// -/////////////////////////////////////////////////////////////////////////////// - -#include <boost/spirit/actor/ref_actor.hpp> -#include <boost/spirit/actor/ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_const_ref_a.hpp> - -#include <boost/spirit/actor/assign_actor.hpp> -#include <boost/spirit/actor/clear_actor.hpp> -#include <boost/spirit/actor/increment_actor.hpp> -#include <boost/spirit/actor/decrement_actor.hpp> -#include <boost/spirit/actor/push_back_actor.hpp> -#include <boost/spirit/actor/push_front_actor.hpp> -#include <boost/spirit/actor/erase_actor.hpp> -#include <boost/spirit/actor/insert_key_actor.hpp> -#include <boost/spirit/actor/insert_at_actor.hpp> -#include <boost/spirit/actor/assign_key_actor.hpp> -#include <boost/spirit/actor/swap_actor.hpp> - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/assign_actor.hpp b/Utilities/BGL/boost/spirit/actor/assign_actor.hpp deleted file mode 100644 index 6eb58c9e20bc8543c6469de5da60c3efcdbb79f5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/assign_actor.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP - -#include <boost/spirit/actor/ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that applies the assignement operator. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does): - // ref = value; - // ref = T(first,last); - // ref = value_ref; - // - // Policy name: - // assign_action - // - // Policy holder, corresponding helper method: - // ref_value_actor, assign_a( ref ); - // ref_const_ref_actor, assign_a( ref, value_ref ); - // - // () operators: both - // - // See also ref_value_actor and ref_const_ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct assign_action - { - template< - typename T, - typename ValueT - > - void act(T& ref_, ValueT const& value_) const - { - ref_ = value_; - } - template< - typename T, - typename IteratorT - > - void act( - T& ref_, - IteratorT const& first_, - IteratorT const& last_ - ) const - { - typedef T value_type; -#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS - value_type value(first_,last_); -#else - value_type value; - std::copy(first_, last_, std::inserter(value, value.end())); -#endif - ref_ = value; - } - }; - - // Deprecated. Please use assign_a - template<typename T> - inline ref_value_actor<T,assign_action> assign(T& ref_) - { - return ref_value_actor<T,assign_action>(ref_); - } - - template<typename T> - inline ref_value_actor<T,assign_action> assign_a(T& ref_) - { - return ref_value_actor<T,assign_action>(ref_); - } - - template< - typename T, - typename ValueT - > - inline ref_const_ref_actor<T,ValueT,assign_action> assign_a( - T& ref_, - ValueT const& value_ - ) - { - return ref_const_ref_actor<T,ValueT,assign_action>(ref_,value_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/assign_key_actor.hpp b/Utilities/BGL/boost/spirit/actor/assign_key_actor.hpp deleted file mode 100644 index 8122400cd5166b11ff4bffac01269a1faafbd85b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/assign_key_actor.hpp +++ /dev/null @@ -1,92 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP - -#include <boost/spirit/actor/ref_const_ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_const_ref_a.hpp> - -namespace boost { namespace spirit { - - struct assign_key_action - { - template< - typename T, - typename ValueT, - typename KeyT - > - void act(T& ref_, ValueT const& value_, KeyT const& key_) const - { - ref_[ key_ ] = value_; - } - - template< - typename T, - typename ValueT, - typename IteratorT - > - void act( - T& ref_, - ValueT const& value_, - IteratorT const& first_, - IteratorT const& last_ - ) const - { - typedef typename T::key_type key_type; - key_type key(first_,last_); - - ref_[key] = value_; - } - }; - - template< - typename T, - typename ValueT - > - inline ref_const_ref_value_actor<T,ValueT,assign_key_action> - assign_key_a(T& ref_, ValueT const& value_) - { - return ref_const_ref_value_actor<T,ValueT,assign_key_action>( - ref_, - value_ - ); - } - - template< - typename T, - typename ValueT, - typename KeyT - > - inline ref_const_ref_const_ref_actor< - T, - ValueT, - KeyT, - assign_key_action - > - assign_key_a( - T& ref_, - ValueT const& value_, - KeyT const& key_ - ) - { - return ref_const_ref_const_ref_actor< - T, - ValueT, - KeyT, - assign_key_action - >( - ref_, - value_, - key_ - ); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/clear_actor.hpp b/Utilities/BGL/boost/spirit/actor/clear_actor.hpp deleted file mode 100644 index 58c971a1943e1955e641afe3eb5929d6ba85755a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/clear_actor.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_CLEAR_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_CLEAR_ACTOR_HPP - -#include <boost/spirit/actor/ref_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that calls clear method. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does): - // ref.clear(); - // - // Policy name: - // clear_action - // - // Policy holder, corresponding helper method: - // ref_actor, clear_a( ref ); - // - // () operators: both. - // - // See also ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct clear_action - { - template< - typename T - > - void act(T& ref_) const - { - ref_.clear(); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // helper method that creates a and_assign_actor. - /////////////////////////////////////////////////////////////////////////// - template<typename T> - inline ref_actor<T,clear_action> clear_a(T& ref_) - { - return ref_actor<T,clear_action>(ref_); - } - - -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/actor/decrement_actor.hpp b/Utilities/BGL/boost/spirit/actor/decrement_actor.hpp deleted file mode 100644 index 6198ef5f97d789595900023750747c1bcf23cc27..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/decrement_actor.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_DECREMENT_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_DECREMENT_ACTOR_HPP - -#include <boost/spirit/actor/ref_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that calls the -- operator on a reference. - // (This doc uses convention available in actors.hpp) - // - // Actions: - // --ref; - // - // Policy name: - // decrement_action - // - // Policy holder, corresponding helper method: - // ref_actor, decrement_a( ref ); - // - // () operators: both. - // - // See also ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct decrement_action - { - template< - typename T - > - void act(T& ref_) const - { - --ref_; - } - }; - - /////////////////////////////////////////////////////////////////////////// - // helper method that creates a and_assign_actor. - /////////////////////////////////////////////////////////////////////////// - template<typename T> - inline ref_actor<T,decrement_action> decrement_a(T& ref_) - { - return ref_actor<T,decrement_action>(ref_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/erase_actor.hpp b/Utilities/BGL/boost/spirit/actor/erase_actor.hpp deleted file mode 100644 index 19595dac3edfea3449399ab1536f8571607675a4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/erase_actor.hpp +++ /dev/null @@ -1,85 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_ERASE_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_ERASE_ACTOR_HPP - -#include <boost/spirit/actor/ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that calss the erase method. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does): - // ref.erase( value ); - // ref.erase( T::key_type(first,last) ); - // ref.erase( key_ref ); - // - // Policy name: - // erase_action - // - // Policy holder, corresponding helper method: - // ref_value_actor, erase_a( ref ); - // ref_const_ref_actor, erase_a( ref, key_ref ); - // - // () operators: both - // - // See also ref_value_actor and ref_const_ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct erase_action - { - template< - typename T, - typename KeyT - > - void act(T& ref_, KeyT const& key_) const - { - ref_.erase(key_); - } - template< - typename T, - typename IteratorT - > - void act( - T& ref_, - IteratorT const& first_, - IteratorT const& last_ - ) const - { - typedef typename T::key_type key_type; - key_type key(first_,last_); - - ref_.erase(key); - } - }; - - template<typename T> - inline ref_value_actor<T,erase_action> erase_a(T& ref_) - { - return ref_value_actor<T,erase_action>(ref_); - } - - template< - typename T, - typename KeyT - > - inline ref_const_ref_actor<T,KeyT,erase_action> erase_a( - T& ref_, - KeyT const& key_ - ) - { - return ref_const_ref_actor<T,KeyT,erase_action>(ref_,key_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/increment_actor.hpp b/Utilities/BGL/boost/spirit/actor/increment_actor.hpp deleted file mode 100644 index 48e1cb47956e09630726d6e603254abec387478f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/increment_actor.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_INCREMENT_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_INCREMENT_ACTOR_HPP - -#include <boost/spirit/actor/ref_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that calls the ++ operator on a reference. - // (This doc uses convention available in actors.hpp) - // - // Actions: - // ++ref; - // - // Policy name: - // increment_action - // - // Policy holder, corresponding helper method: - // ref_actor, increment_a( ref ); - // - // () operators: both. - // - // See also ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct increment_action - { - template< - typename T - > - void act(T& ref_) const - { - ++ref_; - } - }; - - /////////////////////////////////////////////////////////////////////////// - // helper method that creates a increment_actor. - /////////////////////////////////////////////////////////////////////////// - template<typename T> - inline ref_actor<T,increment_action> increment_a(T& ref_) - { - return ref_actor<T,increment_action>(ref_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/insert_at_actor.hpp b/Utilities/BGL/boost/spirit/actor/insert_at_actor.hpp deleted file mode 100644 index 0690fdd2d2b7e1bed6259ecc5c9cb474de99740e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/insert_at_actor.hpp +++ /dev/null @@ -1,117 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_INSERT_AT_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_INSERT_AT_ACTOR_HPP - -#include <boost/spirit/actor/ref_const_ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_const_ref_a.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that insert data into an associative - // container using a const reference to a key. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does): - // ref.insert( T::value_type(key_ref,value) ); - // ref.insert( T::value_type(key_ref, T::mapped_type(first,last)));; - // ref.insert( T::value_type(key_ref,value_ref) ); - // - // Policy name: - // insert_at_action - // - // Policy holder, corresponding helper method: - // ref_const_ref_value_actor, insert_at_a( ref, key_ref ); - // ref_const_ref_const_ref_actor, insert_a( ref, key_ref, value_ref ); - // - // () operators: both - // - // See also ref_const_ref_value_actor and ref_const_ref_const_ref_actor - // for more details. - /////////////////////////////////////////////////////////////////////////// - struct insert_at_action - { - template< - typename T, - typename ReferentT, - typename ValueT - > - void act( - T& ref_, - ReferentT const& key_, - ValueT const& value_ - ) const - { - typedef typename T::value_type value_type; - ref_.insert( value_type(key_, value_) ); - } - - template< - typename T, - typename ReferentT, - typename IteratorT - > - void act( - T& ref_, - ReferentT const& key_, - IteratorT const& first_, - IteratorT const& last_ - ) const - { - typedef typename T::mapped_type mapped_type; - typedef typename T::value_type value_type; - - mapped_type value(first_,last_); - value_type key_value(key_, value); - ref_.insert( key_value ); - } - }; - - template< - typename T, - typename ReferentT - > - inline ref_const_ref_value_actor<T,ReferentT,insert_at_action> - insert_at_a( - T& ref_, - ReferentT const& key_ - ) - { - return ref_const_ref_value_actor< - T, - ReferentT, - insert_at_action - >(ref_,key_); - } - - template< - typename T, - typename ReferentT, - typename ValueT - > - inline ref_const_ref_const_ref_actor<T,ReferentT,ValueT,insert_at_action> - insert_at_a( - T& ref_, - ReferentT const& key_, - ValueT const& value_ - ) - { - return ref_const_ref_const_ref_actor< - T, - ReferentT, - ValueT, - insert_at_action - >(ref_,key_,value_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/insert_key_actor.hpp b/Utilities/BGL/boost/spirit/actor/insert_key_actor.hpp deleted file mode 100644 index 1448c4f25c4eddabb0ed2b9a7680a219c65c10f9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/insert_key_actor.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP - -#include <boost/spirit/actor/ref_const_ref_value_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that insert data into an associative - // container using a const reference to data. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does): - // ref.insert( T::value_type(value,value_ref) ); - // ref.insert( T::value_type(T::key_type(first,last), value_ref));; - // - // Policy name: - // insert_key_action - // - // Policy holder, corresponding helper method: - // ref_const_ref_value_actor, insert_key_a( ref, value_ref ); - // - // () operators: both - // - // See also ref_const_ref_value_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct insert_key_action - { - template< - typename T, - typename ValueT, - typename ReferentT - > - void act( - T& ref_, - ValueT const& value_, - ReferentT const& key_ - ) const - { - typedef typename T::value_type value_type; - value_type key_value(key_, value_); - ref_.insert( key_value ); - } - - template< - typename T, - typename ValueT, - typename IteratorT - > - void act( - T& ref_, - ValueT const& value_, - IteratorT const& first_, - IteratorT const& last_ - ) const - { - typedef typename T::key_type key_type; - typedef typename T::value_type value_type; - - key_type key(first_,last_); - value_type key_value(key, value_); - ref_.insert( key_value ); - } - }; - - template< - typename T, - typename ValueT - > - inline ref_const_ref_value_actor<T,ValueT,insert_key_action> insert_key_a( - T& ref_, - ValueT const& value_ - ) - { - return ref_const_ref_value_actor< - T, - ValueT, - insert_key_action - >(ref_,value_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/push_back_actor.hpp b/Utilities/BGL/boost/spirit/actor/push_back_actor.hpp deleted file mode 100644 index 6fbd24f4644927e96daa88c0de71cc1663685790..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/push_back_actor.hpp +++ /dev/null @@ -1,97 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_PUSH_BACK_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_PUSH_BACK_ACTOR_HPP - -#include <boost/spirit/actor/ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // - // A semantic action policy that appends a value to the back of a - // container. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does and what ref, value_ref must support): - // ref.push_back( value ); - // ref.push_back( T::value_type(first,last) ); - // ref.push_back( value_ref ); - // - // Policy name: - // push_back_action - // - // Policy holder, corresponding helper method: - // ref_value_actor, push_back_a( ref ); - // ref_const_ref_actor, push_back_a( ref, value_ref ); - // - // () operators: both - // - // See also ref_value_actor and ref_const_ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct push_back_action - { - template< - typename T, - typename ValueT - > - void act(T& ref_, ValueT const& value_) const - { - ref_.push_back( value_ ); - } - template< - typename T, - typename IteratorT - > - void act( - T& ref_, - IteratorT const& first_, - IteratorT const& last_ - ) const - { - typedef typename T::value_type value_type; - value_type value(first_,last_); - - ref_.push_back( value ); - } - }; - -// Deprecated interface. Use push_back_a - template<typename T> - inline ref_value_actor<T,push_back_action> - append(T& ref_) - { - return ref_value_actor<T,push_back_action>(ref_); - } - - template<typename T> - inline ref_value_actor<T,push_back_action> - push_back_a(T& ref_) - { - return ref_value_actor<T,push_back_action>(ref_); - } - - template< - typename T, - typename ValueT - > - inline ref_const_ref_actor<T,ValueT,push_back_action> - push_back_a( - T& ref_, - ValueT const& value_ - ) - { - return ref_const_ref_actor<T,ValueT,push_back_action>(ref_,value_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/push_front_actor.hpp b/Utilities/BGL/boost/spirit/actor/push_front_actor.hpp deleted file mode 100644 index 9ea2204bd3a7944fdd0d6ba3380c8b7bc695596f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/push_front_actor.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_PUSH_FRONT_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_PUSH_FRONT_ACTOR_HPP - -#include <boost/spirit/actor/ref_value_actor.hpp> -#include <boost/spirit/actor/ref_const_ref_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // - // A semantic action policy that appends a value to the front of a - // container. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does and what ref, value_ref must support): - // ref.push_front( value ); - // ref.push_front( T::value_type(first,last) ); - // ref.push_front( value_ref ); - // - // Policy name: - // push_front_action - // - // Policy holder, corresponding helper method: - // ref_value_actor, push_front_a( ref ); - // ref_const_ref_actor, push_front_a( ref, value_ref ); - // - // () operators: both - // - // See also ref_value_actor and ref_const_ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - struct push_front_action - { - template< - typename T, - typename ValueT - > - void act(T& ref_, ValueT const& value_) const - { - ref_.push_front( value_ ); - } - template< - typename T, - typename IteratorT - > - void act( - T& ref_, - IteratorT const& first_, - IteratorT const& last_ - ) const - { - typedef typename T::value_type value_type; - value_type value(first_,last_); - - ref_.push_front( value ); - } - }; - - template<typename T> - inline ref_value_actor<T,push_front_action> push_front_a(T& ref_) - { - return ref_value_actor<T,push_front_action>(ref_); - } - - template< - typename T, - typename ValueT - > - inline ref_const_ref_actor<T,ValueT,push_front_action> push_front_a( - T& ref_, - ValueT const& value_ - ) - { - return ref_const_ref_actor<T,ValueT,push_front_action>(ref_,value_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/ref_actor.hpp b/Utilities/BGL/boost/spirit/actor/ref_actor.hpp deleted file mode 100644 index 4023518ef14b89a7f57410385d49cf641ba58330..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/ref_actor.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_REF_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_REF_ACTOR_HPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy holder. This holder stores a reference to ref, - // act methods are fead with this reference. The parse result is not used - // by this holder. - // - // (This doc uses convention available in actors.hpp) - // - // Constructor: - // ...(T& ref_); - // where ref_ is stored. - // - // Action calls: - // act(ref); - // - // () operators: both - // - /////////////////////////////////////////////////////////////////////////// - template< - typename T, - typename ActionT - > - class ref_actor : public ActionT - { - private: - T& ref; - public: - explicit - ref_actor(T& ref_) - : ref(ref_){} - - - template<typename T2> - void operator()(T2 const& /*val*/) const - { - this->act(ref); // defined in ActionT - } - - - template<typename IteratorT> - void operator()( - IteratorT const& /*first*/, - IteratorT const& /*last*/ - ) const - { - this->act(ref); // defined in ActionT - } - }; - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/ref_const_ref_actor.hpp b/Utilities/BGL/boost/spirit/actor/ref_const_ref_actor.hpp deleted file mode 100644 index 3691606810e1eb9156ccccc253033766ce7e6d6d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/ref_const_ref_actor.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy holder. This holder stores a reference to ref - // and a const reference to value_ref. - // act methods are feed with ref and value_ref. The parse result is - // not used by this holder. - // - // (This doc uses convention available in actors.hpp) - // - // Constructor: - // ...(T& ref_, ValueT const& value_ref_); - // where ref_ and value_ref_ are stored in the holder. - // - // Action calls: - // act(ref, value_ref); - // - // () operators: both - // - /////////////////////////////////////////////////////////////////////////// - template< - typename T, - typename ValueT, - typename ActionT - > - class ref_const_ref_actor : public ActionT - { - private: - T& ref; - ValueT const& value_ref; - public: - ref_const_ref_actor( - T& ref_, - ValueT const& value_ref_ - ) - : - ref(ref_), - value_ref(value_ref_) - {} - - - template<typename T2> - void operator()(T2 const& /*val*/) const - { - this->act(ref,value_ref); // defined in ActionT - } - - - template<typename IteratorT> - void operator()( - IteratorT const& /*first*/, - IteratorT const& /*last*/ - ) const - { - this->act(ref,value_ref); // defined in ActionT - } - }; - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/ref_const_ref_const_ref_a.hpp b/Utilities/BGL/boost/spirit/actor/ref_const_ref_const_ref_a.hpp deleted file mode 100644 index 2cf1786fc2c133024af92c9f923b599080be79ce..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/ref_const_ref_const_ref_a.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_CONST_REF_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_CONST_REF_ACTOR_HPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy holder. This holder stores a reference to ref - // , a const reference to value1_ref and a const reference to value2_ref. - // Typically, value1_ref is a key and value2_ref is value for associative - // container operations. - // act methods are feed with ref, value1_ref, value2_ref. The parse result - // is not used by this holder. - // - // (This doc uses convention available in actors.hpp) - // - // Constructor: - // ...( - // T& ref_, - // Value1T const& value1_ref_, - // Value2T const& value2_ref_ ); - // where ref_, value1_ref and value2_ref_ are stored in the holder. - // - // Action calls: - // act(ref, value1_ref, value2_ref); - // - // () operators: both - // - /////////////////////////////////////////////////////////////////////////// - template< - typename T, - typename Value1T, - typename Value2T, - typename ActionT - > - class ref_const_ref_const_ref_actor : public ActionT - { - private: - T& ref; - Value1T const& value1_ref; - Value2T const& value2_ref; - public: - ref_const_ref_const_ref_actor( - T& ref_, - Value1T const& value1_ref_, - Value2T const& value2_ref_ - ) - : - ref(ref_), - value1_ref(value1_ref_), - value2_ref(value2_ref_) - {} - - - template<typename T2> - void operator()(T2 const& /*val*/) const - { - this->act(ref,value1_ref,value2_ref); // defined in ActionT - } - - - template<typename IteratorT> - void operator()( - IteratorT const& /*first*/, - IteratorT const& /*last*/ - ) const - { - this->act(ref,value1_ref,value2_ref); // defined in ActionT - } - }; - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/ref_const_ref_value_actor.hpp b/Utilities/BGL/boost/spirit/actor/ref_const_ref_value_actor.hpp deleted file mode 100644 index 54a6a242a052c0559fc74e95c781eda1be8beded..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/ref_const_ref_value_actor.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_VALUE_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_VALUE_ACTOR_HPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy holder. This holder stores a reference to ref - // and a const reference to value_ref. - // act methods are feed with ref, value_ref and the parse result. - // - // (This doc uses convention available in actors.hpp) - // - // Constructor: - // ...(T& ref_, ValueT const& value_ref_); - // where ref_ and value_ref_ are stored in the holder. - // - // Action calls: - // act(ref, value_ref, value); - // act(ref, value_ref, first, last); - // - // () operators: both - // - /////////////////////////////////////////////////////////////////////////// - template< - typename T, - typename ValueT, - typename ActionT - > - class ref_const_ref_value_actor : public ActionT - { - private: - T& ref; - ValueT const& value_ref; - public: - ref_const_ref_value_actor( - T& ref_, - ValueT const& value_ref_ - ) - : - ref(ref_), - value_ref(value_ref_) - {} - - - template<typename T2> - void operator()(T2 const& val_) const - { - this->act(ref,value_ref,val_); // defined in ActionT - } - - - template<typename IteratorT> - void operator()( - IteratorT const& first_, - IteratorT const& last_ - ) const - { - this->act(ref,value_ref,first_,last_); // defined in ActionT - } - }; - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/ref_value_actor.hpp b/Utilities/BGL/boost/spirit/actor/ref_value_actor.hpp deleted file mode 100644 index cd21ab8bcbb8ce6045be1ba7710c524fb5dc508d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/ref_value_actor.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_REF_VALUE_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_REF_VALUE_ACTOR_HPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy holder. This holder stores a reference to ref. - // act methods are feed with ref and the parse result. - // - // (This doc uses convention available in actors.hpp) - // - // Constructor: - // ...(T& ref_); - // where ref_ is stored. - // - // Action calls: - // act(ref, value); - // act(ref, first,last); - // - // () operators: both - // - /////////////////////////////////////////////////////////////////////////// - template< - typename T, - typename ActionT - > - class ref_value_actor : public ActionT - { - private: - T& ref; - public: - explicit - ref_value_actor(T& ref_) - : ref(ref_){} - - - template<typename T2> - void operator()(T2 const& val_) const - { - this->act(ref,val_); // defined in ActionT - } - - - template<typename IteratorT> - void operator()( - IteratorT const& first_, - IteratorT const& last_ - ) const - { - this->act(ref,first_,last_); // defined in ActionT - } - }; - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/actor/swap_actor.hpp b/Utilities/BGL/boost/spirit/actor/swap_actor.hpp deleted file mode 100644 index 257d1ca4b7c13a349eead60120cebe6c950ec089..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/actor/swap_actor.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com) - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTOR_SWAP_ACTOR_HPP -#define BOOST_SPIRIT_ACTOR_SWAP_ACTOR_HPP - -#include <boost/spirit/actor/ref_value_actor.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // Summary: - // A semantic action policy that swaps values. - // (This doc uses convention available in actors.hpp) - // - // Actions (what it does): - // ref.swap( value_ref ); - // - // Policy name: - // swap_action - // - // Policy holder, corresponding helper method: - // ref_value_actor, swap_a( ref ); - // ref_const_ref_actor, swap_a( ref, value_ref ); - // - // () operators: both - // - // See also ref_value_actor and ref_const_ref_actor for more details. - /////////////////////////////////////////////////////////////////////////// - template< - typename T - > - class swap_actor - { - private: - T& ref; - T& swap_ref; - - public: - swap_actor( - T& ref_, - T& swap_ref_) - : ref(ref_), swap_ref(swap_ref_) - {}; - - template<typename T2> - void operator()(T2 const& /*val*/) const - { - ref.swap(swap_ref); - } - - - template<typename IteratorT> - void operator()( - IteratorT const& /*first*/, - IteratorT const& /*last*/ - ) const - { - ref.swap(swap_ref); - } - }; - - template< - typename T - > - inline swap_actor<T> swap_a( - T& ref_, - T& swap_ref_ - ) - { - return swap_actor<T>(ref_,swap_ref_); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/attribute.hpp b/Utilities/BGL/boost/spirit/attribute.hpp deleted file mode 100644 index 48e9a5dfc55ce99dad2f1f3ff6ff8ce32feb75b5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/attribute.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_ATTRIBUTE_MAIN_HPP) -#define BOOST_SPIRIT_ATTRIBUTE_MAIN_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Master header for Spirit.Attributes -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Phoenix predefined maximum limit. This limit defines the maximum -// number of elements a tuple can hold. This number defaults to 3. The -// actual maximum is rounded up in multiples of 3. Thus, if this value -// is 4, the actual limit is 6. The ultimate maximum limit in this -// implementation is 15. -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(PHOENIX_LIMIT) -#define PHOENIX_LIMIT 3 -#endif // !defined(PHOENIX_LIMIT) - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/attribute/parametric.hpp> -#include <boost/spirit/attribute/closure.hpp> - -#endif // !defined(BOOST_SPIRIT_ATTRIBUTE_MAIN_HPP) diff --git a/Utilities/BGL/boost/spirit/attribute/closure.hpp b/Utilities/BGL/boost/spirit/attribute/closure.hpp deleted file mode 100644 index 60886b8afcf28d75b6856502b38ad7f3096352a5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/attribute/closure.hpp +++ /dev/null @@ -1,1078 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CLOSURE_HPP -#define BOOST_SPIRIT_CLOSURE_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/attribute/parametric.hpp> -#include <boost/spirit/attribute/closure_context.hpp> - -#include <boost/spirit/phoenix/closures.hpp> -#include <boost/spirit/phoenix/primitives.hpp> -#include <boost/spirit/phoenix/casts.hpp> -#include <boost/spirit/phoenix/operators.hpp> -#include <boost/spirit/phoenix/tuple_helpers.hpp> - -#include <boost/static_assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit predefined maximum closure limit. This limit defines the maximum -// number of elements a closure can hold. This number defaults to 3. The -// actual maximum is rounded up in multiples of 3. Thus, if this value -// is 4, the actual limit is 6. The ultimate maximum limit in this -// implementation is 15. -// -// It should NOT be greater than PHOENIX_LIMIT! -// -/////////////////////////////////////////////////////////////////////////////// - -#if !defined(BOOST_SPIRIT_CLOSURE_LIMIT) -#define BOOST_SPIRIT_CLOSURE_LIMIT PHOENIX_LIMIT -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// ensure BOOST_SPIRIT_CLOSURE_LIMIT <= PHOENIX_LIMIT and SPIRIT_CLOSURE_LIMIT <= 15 -// -/////////////////////////////////////////////////////////////////////////////// -BOOST_STATIC_ASSERT(BOOST_SPIRIT_CLOSURE_LIMIT <= PHOENIX_LIMIT); -BOOST_STATIC_ASSERT(BOOST_SPIRIT_CLOSURE_LIMIT <= 15); - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // closure_context class - // - /////////////////////////////////////////////////////////////////////////// - template <typename ClosureT> - class closure_context : public parser_context_base - { - public: - - typedef typename phoenix::tuple_element<0, - typename ClosureT::tuple_t>::type attr_t; - typedef ClosureT base_t; - typedef closure_context_linker<closure_context<ClosureT> > - context_linker_t; - - closure_context(ClosureT const& clos) - : frame(clos) {} - - ~closure_context() {} - - template <typename ParserT, typename ScannerT> - void pre_parse(ParserT const&, ScannerT const&) {} - - template <typename ResultT, typename ParserT, typename ScannerT> - ResultT& post_parse(ResultT& hit, ParserT const&, ScannerT const&) - { hit.value(frame[phoenix::tuple_index<0>()]); return hit; } - - private: - - phoenix::closure_frame<typename ClosureT::phoenix_closure_t> frame; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // init_closure_context class - // - // The init_closure_context class is a special parser context type - // which additionally initializes a closure contained in the derived - // parser with values from a given tuple. Please note, that this - // given tuple does not contain the required values directly, it - // contains phoenix::actor objects. These actors have to be - // dereferenced to gain the values to be used for initialization - // (this is done by the help of the phoenix::convert_actors<> - // template). - // - /////////////////////////////////////////////////////////////////////////// - - template <typename ClosureT> - class init_closure_context : public parser_context_base - { - typedef typename ClosureT::tuple_t tuple_t; - typedef typename ClosureT::closure_t closure_t; - - public: - - init_closure_context(ClosureT const& clos) - : frame(clos.subject(), phoenix::convert_actors<tuple_t>(clos.init)) {} - - ~init_closure_context() {} - - template <typename ParserT, typename ScannerT> - void pre_parse(ParserT const& /*p*/, ScannerT const&) {} - - template <typename ResultT, typename ParserT, typename ScannerT> - ResultT& post_parse(ResultT& hit, ParserT const&, ScannerT const&) - { hit.value(frame[phoenix::tuple_index<0>()]); return hit; } - - private: - - phoenix::closure_frame<closure_t> frame; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // init_closure_parser class - // - /////////////////////////////////////////////////////////////////////////// - template <typename ParserT, typename ActorTupleT> - struct init_closure_parser - : public unary<ParserT, parser<init_closure_parser<ParserT, ActorTupleT> > > - { - typedef init_closure_parser<ParserT, ActorTupleT> self_t; - typedef unary<ParserT, parser<self_t> > base_t; - typedef typename ParserT::phoenix_closure_t closure_t; - typedef typename ParserT::tuple_t tuple_t; - typedef typename phoenix::tuple_element<0, tuple_t>::type attr_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, attr_t>::type type; - }; - - init_closure_parser(ParserT const& p, ActorTupleT const& init_) - : base_t(p), init(init_) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse_main(ScannerT const& scan) const - { - return this->subject().parse_main(scan); - } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef init_closure_context<self_t> init_context_t; - typedef parser_scanner_linker<ScannerT> scanner_t; - typedef closure_context_linker<init_context_t> context_t; - typedef typename parser_result<self_t, ScannerT>::type result_t; - BOOST_SPIRIT_CONTEXT_PARSE( - scan, *this, scanner_t, context_t, result_t); - } - - ActorTupleT init; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // closure class - // - /////////////////////////////////////////////////////////////////////////// - template < - typename DerivedT - , typename T0 = phoenix::nil_t - , typename T1 = phoenix::nil_t - , typename T2 = phoenix::nil_t - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 3 - , typename T3 = phoenix::nil_t - , typename T4 = phoenix::nil_t - , typename T5 = phoenix::nil_t - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 6 - , typename T6 = phoenix::nil_t - , typename T7 = phoenix::nil_t - , typename T8 = phoenix::nil_t - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 9 - , typename T9 = phoenix::nil_t - , typename T10 = phoenix::nil_t - , typename T11 = phoenix::nil_t - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 12 - , typename T12 = phoenix::nil_t - , typename T13 = phoenix::nil_t - , typename T14 = phoenix::nil_t - - #endif - #endif - #endif - #endif - > - struct closure : - public phoenix::closure< - T0, T1, T2 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 3 - , T3, T4, T5 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 6 - , T6, T7, T8 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 9 - , T9, T10, T11 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 12 - , T12, T13, T14 - #endif - #endif - #endif - #endif - > - { - typedef phoenix::closure< - T0, T1, T2 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 3 - , T3, T4, T5 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 6 - , T6, T7, T8 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 9 - , T9, T10, T11 - #if BOOST_SPIRIT_CLOSURE_LIMIT > 12 - , T12, T13, T14 - #endif - #endif - #endif - #endif - > phoenix_closure_t; - - typedef closure_context<DerivedT> context_t; - - template <typename DerivedT2> - struct aux - { - DerivedT2& aux_derived() - { return *static_cast<DerivedT2*>(this); } - - DerivedT2 const& aux_derived() const - { return *static_cast<DerivedT2 const*>(this); } - - // initialization functions - template <typename A> - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type - > - > - operator()(A const &a) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef phoenix::tuple<a_t> actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a) - ) - ); - } - - template <typename A, typename B> - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type - > - > - operator()(A const &a, B const &b) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef phoenix::tuple<a_t, b_t> actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b) - ) - ); - } - - template <typename A, typename B, typename C> - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type - > - > - operator()(A const &a, B const &b, C const &c) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef phoenix::tuple<a_t, b_t, c_t> actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c) - ) - ); - } - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 3 - - template < - typename A, typename B, typename C, typename D - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f) - ) - ); - } - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 6 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type, - typename phoenix::as_actor<I>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h, I const &i - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef typename phoenix::as_actor<I>::type i_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h), - phoenix::as_actor<I>::convert(i) - ) - ); - } - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 9 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type, - typename phoenix::as_actor<I>::type, - typename phoenix::as_actor<J>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h, I const &i, J const &j - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef typename phoenix::as_actor<I>::type i_t; - typedef typename phoenix::as_actor<J>::type j_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h), - phoenix::as_actor<I>::convert(i), - phoenix::as_actor<J>::convert(j) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type, - typename phoenix::as_actor<I>::type, - typename phoenix::as_actor<J>::type, - typename phoenix::as_actor<K>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h, I const &i, J const &j, - K const &k - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef typename phoenix::as_actor<I>::type i_t; - typedef typename phoenix::as_actor<J>::type j_t; - typedef typename phoenix::as_actor<K>::type k_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t, - k_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h), - phoenix::as_actor<I>::convert(i), - phoenix::as_actor<J>::convert(j), - phoenix::as_actor<K>::convert(k) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type, - typename phoenix::as_actor<I>::type, - typename phoenix::as_actor<J>::type, - typename phoenix::as_actor<K>::type, - typename phoenix::as_actor<L>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h, I const &i, J const &j, - K const &k, L const &l - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef typename phoenix::as_actor<I>::type i_t; - typedef typename phoenix::as_actor<J>::type j_t; - typedef typename phoenix::as_actor<K>::type k_t; - typedef typename phoenix::as_actor<L>::type l_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t, - k_t, l_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h), - phoenix::as_actor<I>::convert(i), - phoenix::as_actor<J>::convert(j), - phoenix::as_actor<K>::convert(k), - phoenix::as_actor<L>::convert(l) - ) - ); - } - - #if BOOST_SPIRIT_CLOSURE_LIMIT > 12 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type, - typename phoenix::as_actor<I>::type, - typename phoenix::as_actor<J>::type, - typename phoenix::as_actor<K>::type, - typename phoenix::as_actor<L>::type, - typename phoenix::as_actor<M>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h, I const &i, J const &j, - K const &k, L const &l, M const &m - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef typename phoenix::as_actor<I>::type i_t; - typedef typename phoenix::as_actor<J>::type j_t; - typedef typename phoenix::as_actor<K>::type k_t; - typedef typename phoenix::as_actor<L>::type l_t; - typedef typename phoenix::as_actor<M>::type m_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t, - k_t, l_t, m_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h), - phoenix::as_actor<I>::convert(i), - phoenix::as_actor<J>::convert(j), - phoenix::as_actor<K>::convert(k), - phoenix::as_actor<L>::convert(l), - phoenix::as_actor<M>::convert(m) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type, - typename phoenix::as_actor<I>::type, - typename phoenix::as_actor<J>::type, - typename phoenix::as_actor<K>::type, - typename phoenix::as_actor<L>::type, - typename phoenix::as_actor<M>::type, - typename phoenix::as_actor<N>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h, I const &i, J const &j, - K const &k, L const &l, M const &m, N const &n - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef typename phoenix::as_actor<I>::type i_t; - typedef typename phoenix::as_actor<J>::type j_t; - typedef typename phoenix::as_actor<K>::type k_t; - typedef typename phoenix::as_actor<L>::type l_t; - typedef typename phoenix::as_actor<M>::type m_t; - typedef typename phoenix::as_actor<N>::type n_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t, - k_t, l_t, m_t, n_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h), - phoenix::as_actor<I>::convert(i), - phoenix::as_actor<J>::convert(j), - phoenix::as_actor<K>::convert(k), - phoenix::as_actor<L>::convert(l), - phoenix::as_actor<M>::convert(m), - phoenix::as_actor<N>::convert(n) - ) - ); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O - > - init_closure_parser< - DerivedT2, - phoenix::tuple< - typename phoenix::as_actor<A>::type, - typename phoenix::as_actor<B>::type, - typename phoenix::as_actor<C>::type, - typename phoenix::as_actor<D>::type, - typename phoenix::as_actor<E>::type, - typename phoenix::as_actor<F>::type, - typename phoenix::as_actor<G>::type, - typename phoenix::as_actor<H>::type, - typename phoenix::as_actor<I>::type, - typename phoenix::as_actor<J>::type, - typename phoenix::as_actor<K>::type, - typename phoenix::as_actor<L>::type, - typename phoenix::as_actor<M>::type, - typename phoenix::as_actor<N>::type, - typename phoenix::as_actor<O>::type - > - > - operator()( - A const &a, B const &b, C const &c, D const &d, E const &e, - F const &f, G const &g, H const &h, I const &i, J const &j, - K const &k, L const &l, M const &m, N const &n, O const &o - ) const - { - typedef typename phoenix::as_actor<A>::type a_t; - typedef typename phoenix::as_actor<B>::type b_t; - typedef typename phoenix::as_actor<C>::type c_t; - typedef typename phoenix::as_actor<D>::type d_t; - typedef typename phoenix::as_actor<E>::type e_t; - typedef typename phoenix::as_actor<F>::type f_t; - typedef typename phoenix::as_actor<G>::type g_t; - typedef typename phoenix::as_actor<H>::type h_t; - typedef typename phoenix::as_actor<I>::type i_t; - typedef typename phoenix::as_actor<J>::type j_t; - typedef typename phoenix::as_actor<K>::type k_t; - typedef typename phoenix::as_actor<L>::type l_t; - typedef typename phoenix::as_actor<M>::type m_t; - typedef typename phoenix::as_actor<N>::type n_t; - typedef typename phoenix::as_actor<O>::type o_t; - typedef phoenix::tuple< - a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t, - k_t, l_t, m_t, n_t, o_t - > actor_tuple_t; - - return init_closure_parser<DerivedT2, actor_tuple_t>( - aux_derived(), - actor_tuple_t( - phoenix::as_actor<A>::convert(a), - phoenix::as_actor<B>::convert(b), - phoenix::as_actor<C>::convert(c), - phoenix::as_actor<D>::convert(d), - phoenix::as_actor<E>::convert(e), - phoenix::as_actor<F>::convert(f), - phoenix::as_actor<G>::convert(g), - phoenix::as_actor<H>::convert(h), - phoenix::as_actor<I>::convert(i), - phoenix::as_actor<J>::convert(j), - phoenix::as_actor<K>::convert(k), - phoenix::as_actor<L>::convert(l), - phoenix::as_actor<M>::convert(m), - phoenix::as_actor<N>::convert(n), - phoenix::as_actor<O>::convert(o) - ) - ); - } - - #endif - #endif - #endif - #endif - }; - - ~closure() {} - }; - - /////////////////////////////////////////////////////////////////////////// - // - // overloads for chseq_p and str_p taking in phoenix actors - // - /////////////////////////////////////////////////////////////////////////// - template <typename ActorT> - struct container_begin - { - typedef container_begin<ActorT> self_t; - - template <typename TupleT> - struct result - { - typedef typename phoenix::actor_result<ActorT, TupleT> - ::plain_type::iterator type; - }; - - container_begin(ActorT actor_) - : actor(actor_) {} - - template <typename TupleT> - typename phoenix::actor_result<self_t, TupleT>::type - eval(TupleT const& /*args*/) const - { return actor().begin(); } - - ActorT actor; - }; - - template <typename ActorT> - struct container_end - { - typedef container_begin<ActorT> self_t; - - template <typename TupleT> - struct result - { - typedef typename phoenix::actor_result<ActorT, TupleT> - ::plain_type::iterator type; - }; - - container_end(ActorT actor_) - : actor(actor_) {} - - template <typename TupleT> - typename phoenix::actor_result<self_t, TupleT>::type - eval(TupleT const& /*args*/) const - { return actor().end(); } - - ActorT actor; - }; - - template <typename BaseT> - inline f_chseq< - phoenix::actor<container_begin<phoenix::actor<BaseT> > >, - phoenix::actor<container_end<phoenix::actor<BaseT> > > - > - f_chseq_p(phoenix::actor<BaseT> const& a) - { - typedef phoenix::actor<container_begin<phoenix::actor<BaseT> > > - container_begin_t; - typedef phoenix::actor<container_end<phoenix::actor<BaseT> > > - container_end_t; - typedef f_chseq<container_begin_t, container_end_t> result_t; - - return result_t(container_begin_t(a), container_end_t(a)); - } - - template <typename BaseT> - inline f_strlit< - phoenix::actor<container_begin<phoenix::actor<BaseT> > >, - phoenix::actor<container_end<phoenix::actor<BaseT> > > - > - f_str_p(phoenix::actor<BaseT> const& a) - { - typedef phoenix::actor<container_begin<phoenix::actor<BaseT> > > - container_begin_t; - typedef phoenix::actor<container_end<phoenix::actor<BaseT> > > - container_end_t; - typedef f_strlit<container_begin_t, container_end_t> result_t; - - return result_t(container_begin_t(a), container_end_t(a)); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/attribute/closure_context.hpp b/Utilities/BGL/boost/spirit/attribute/closure_context.hpp deleted file mode 100644 index ff46228acafae973a68f76d477a98a8fa66698a4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/attribute/closure_context.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_HPP) -#define BOOST_SPIRIT_CLOSURE_CONTEXT_HPP - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -#if !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) -#define BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED - -/////////////////////////////////////////////////////////////////////////////// -// -// closure_context_linker -// { helper template for the closure extendability } -// -// This classes can be 'overloaded' (defined elsewhere), to plug -// in additional functionality into the closure parsing process. -// -/////////////////////////////////////////////////////////////////////////////// - -template<typename ContextT> -struct closure_context_linker : public ContextT -{ - template <typename ParserT> - closure_context_linker(ParserT const& p) - : ContextT(p) {} - - template <typename ParserT, typename ScannerT> - void pre_parse(ParserT const& p, ScannerT const& scan) - { ContextT::pre_parse(p, scan); } - - template <typename ResultT, typename ParserT, typename ScannerT> - ResultT& - post_parse(ResultT& hit, ParserT const& p, ScannerT const& scan) - { return ContextT::post_parse(hit, p, scan); } -}; - -#endif // !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_CLOSURE_CONTEXT_HPP diff --git a/Utilities/BGL/boost/spirit/attribute/parametric.hpp b/Utilities/BGL/boost/spirit/attribute/parametric.hpp deleted file mode 100644 index 2e2883bf2e7ad067afcf15002e69ca0bbf9b6442..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/attribute/parametric.hpp +++ /dev/null @@ -1,140 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_PARAMETRIC_HPP -#define BOOST_SPIRIT_PARAMETRIC_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // f_chlit class [ functional version of chlit ] - // - /////////////////////////////////////////////////////////////////////////// - template <typename ChGenT> - struct f_chlit : public char_parser<f_chlit<ChGenT> > - { - f_chlit(ChGenT chgen_) - : chgen(chgen_) {} - - template <typename T> - bool test(T ch) const - { return ch == chgen(); } - - ChGenT chgen; - }; - - template <typename ChGenT> - inline f_chlit<ChGenT> - f_ch_p(ChGenT chgen) - { return f_chlit<ChGenT>(chgen); } - - /////////////////////////////////////////////////////////////////////////// - // - // f_range class [ functional version of range ] - // - /////////////////////////////////////////////////////////////////////////// - template <typename ChGenAT, typename ChGenBT> - struct f_range : public char_parser<f_range<ChGenAT, ChGenBT> > - { - f_range(ChGenAT first_, ChGenBT last_) - : first(first_), last(last_) - {} - - template <typename T> - bool test(T ch) const - { - BOOST_SPIRIT_ASSERT(first() <= last()); - return (ch >= first()) && (ch <= last()); - } - - ChGenAT first; - ChGenBT last; - }; - - template <typename ChGenAT, typename ChGenBT> - inline f_range<ChGenAT, ChGenBT> - f_range_p(ChGenAT first, ChGenBT last) - { return f_range<ChGenAT, ChGenBT>(first, last); } - - /////////////////////////////////////////////////////////////////////////// - // - // f_chseq class [ functional version of chseq ] - // - /////////////////////////////////////////////////////////////////////////// - template <typename IterGenAT, typename IterGenBT> - class f_chseq : public parser<f_chseq<IterGenAT, IterGenBT> > - { - public: - - typedef f_chseq<IterGenAT, IterGenBT> self_t; - - f_chseq(IterGenAT first_, IterGenBT last_) - : first(first_), last(last_) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::string_parser_parse<result_t>(first(), last(), scan); - } - - private: - - IterGenAT first; - IterGenBT last; - }; - - template <typename IterGenAT, typename IterGenBT> - inline f_chseq<IterGenAT, IterGenBT> - f_chseq_p(IterGenAT first, IterGenBT last) - { return f_chseq<IterGenAT, IterGenBT>(first, last); } - - /////////////////////////////////////////////////////////////////////////// - // - // f_strlit class [ functional version of strlit ] - // - /////////////////////////////////////////////////////////////////////////// - template <typename IterGenAT, typename IterGenBT> - class f_strlit : public parser<f_strlit<IterGenAT, IterGenBT> > - { - public: - - typedef f_strlit<IterGenAT, IterGenBT> self_t; - - f_strlit(IterGenAT first, IterGenBT last) - : seq(first, last) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::contiguous_parser_parse<result_t> - (seq, scan, scan); - } - - private: - - f_chseq<IterGenAT, IterGenBT> seq; - }; - - template <typename IterGenAT, typename IterGenBT> - inline f_strlit<IterGenAT, IterGenBT> - f_str_p(IterGenAT first, IterGenBT last) - { return f_strlit<IterGenAT, IterGenBT>(first, last); } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/butility/chset.hpp b/Utilities/BGL/boost/spirit/butility/chset.hpp deleted file mode 100644 index 94fa99fe9023563f1492dd9bf3eb3e0d58ef5ee5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/chset.hpp +++ /dev/null @@ -1,183 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CHSET_HPP -#define BOOST_SPIRIT_CHSET_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/shared_ptr.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/butility/impl/chset/basic_chset.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -namespace utility { namespace impl { - - // This is here because some compilers choke on out-of-line member - // template functions. And we don't want to put the whole algorithm - // in the chset constructor in the class definition. - template <typename CharT, typename CharT2> - void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr, - CharT2 const* definition); - -}} // namespace utility::impl - -/////////////////////////////////////////////////////////////////////////////// -// -// chset class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT = char> -class chset: public char_parser<chset<CharT> > { - -public: - chset(); - chset(chset const& arg_); - explicit chset(CharT arg_); - explicit chset(anychar_parser arg_); - explicit chset(nothing_parser arg_); - explicit chset(chlit<CharT> const& arg_); - explicit chset(range<CharT> const& arg_); - explicit chset(negated_char_parser<chlit<CharT> > const& arg_); - explicit chset(negated_char_parser<range<CharT> > const& arg_); - - template <typename CharT2> - explicit chset(CharT2 const* definition) - : ptr(new basic_chset<CharT>()) - { - utility::impl::construct_chset(ptr, definition); - } - ~chset(); - - chset& operator=(chset const& rhs); - chset& operator=(CharT rhs); - chset& operator=(anychar_parser rhs); - chset& operator=(nothing_parser rhs); - chset& operator=(chlit<CharT> const& rhs); - chset& operator=(range<CharT> const& rhs); - chset& operator=(negated_char_parser<chlit<CharT> > const& rhs); - chset& operator=(negated_char_parser<range<CharT> > const& rhs); - - void set(range<CharT> const& arg_); - void set(negated_char_parser<chlit<CharT> > const& arg_); - void set(negated_char_parser<range<CharT> > const& arg_); - - void clear(range<CharT> const& arg_); - void clear(negated_char_parser<range<CharT> > const& arg_); - bool test(CharT ch) const; - chset& inverse(); - void swap(chset& x); - - chset& operator|=(chset const& x); - chset& operator&=(chset const& x); - chset& operator-=(chset const& x); - chset& operator^=(chset const& x); - -private: - - boost::shared_ptr<basic_chset<CharT> > ptr; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Generator functions -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -chset_p(chlit<CharT> const& arg_) -{ return chset<CharT>(arg_); } - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -chset_p(range<CharT> const& arg_) -{ return chset<CharT>(arg_); } - -template <typename CharT> -inline chset<CharT> -chset_p(negated_char_parser<chlit<CharT> > const& arg_) -{ return chset<CharT>(arg_); } - -template <typename CharT> -inline chset<CharT> -chset_p(negated_char_parser<range<CharT> > const& arg_) -{ return chset<CharT>(arg_); } - -////////////////////////////////// -inline chset<char> -chset_p(char const* init) -{ return chset<char>(init); } - -////////////////////////////////// -inline chset<wchar_t> -chset_p(wchar_t const* init) -{ return chset<wchar_t>(init); } - -////////////////////////////////// -inline chset<char> -chset_p(char ch) -{ return chset<char>(ch); } - -////////////////////////////////// -inline chset<wchar_t> -chset_p(wchar_t ch) -{ return chset<wchar_t>(ch); } - -////////////////////////////////// -inline chset<int> -chset_p(int ch) -{ return chset<int>(ch); } - -////////////////////////////////// -inline chset<unsigned int> -chset_p(unsigned int ch) -{ return chset<unsigned int>(ch); } - -////////////////////////////////// -inline chset<short> -chset_p(short ch) -{ return chset<short>(ch); } - -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) -////////////////////////////////// -inline chset<unsigned short> -chset_p(unsigned short ch) -{ return chset<unsigned short>(ch); } -#endif -////////////////////////////////// -inline chset<long> -chset_p(long ch) -{ return chset<long>(ch); } - -////////////////////////////////// -inline chset<unsigned long> -chset_p(unsigned long ch) -{ return chset<unsigned long>(ch); } - -#ifdef BOOST_HAS_LONG_LONG -////////////////////////////////// -inline chset< ::boost::long_long_type> -chset_p( ::boost::long_long_type ch) -{ return chset< ::boost::long_long_type>(ch); } - -////////////////////////////////// -inline chset< ::boost::ulong_long_type> -chset_p( ::boost::ulong_long_type ch) -{ return chset< ::boost::ulong_long_type>(ch); } -#endif - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/butility/impl/chset.ipp> -#include <boost/spirit/butility/chset_operators.hpp> diff --git a/Utilities/BGL/boost/spirit/butility/chset_operators.hpp b/Utilities/BGL/boost/spirit/butility/chset_operators.hpp deleted file mode 100644 index 215d20d5aa93e7965f7bc41c1cedda623e4aaf17..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/chset_operators.hpp +++ /dev/null @@ -1,398 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CHSET_OPERATORS_HPP -#define BOOST_SPIRIT_CHSET_OPERATORS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/butility/chset.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// chset free operators -// -// Where a and b are both chsets, implements: -// -// a | b, a & b, a - b, a ^ b -// -// Where a is a chset, implements: -// -// ~a -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator~(chset<CharT> const& a); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -// -// range <--> chset free operators -// -// Where a is a chset and b is a range, and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, range<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, range<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, range<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, range<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(range<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(range<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(range<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(range<CharT> const& a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -// -// chlit <--> chset free operators -// -// Where a is a chset and b is a chlit, and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, chlit<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, chlit<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, chlit<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, chlit<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chlit<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chlit<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chlit<CharT> const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chlit<CharT> const& a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -// -// negated_char_parser<range> <--> chset free operators -// -// Where a is a chset and b is a range, and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -// -// negated_char_parser<chlit> <--> chset free operators -// -// Where a is a chset and b is a chlit, and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -// -// literal primitives <--> chset free operators -// -// Where a is a chset and b is a literal primitive, -// and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, CharT b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, CharT b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, CharT b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, CharT b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(CharT a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(CharT a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(CharT a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(CharT a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -// -// anychar_parser <--> chset free operators -// -// Where a is chset and b is a anychar_parser, and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, anychar_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, anychar_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, anychar_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, anychar_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(anychar_parser a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(anychar_parser a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(anychar_parser a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(anychar_parser a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -// -// nothing_parser <--> chset free operators -// -// Where a is chset and b is nothing_parser, and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(chset<CharT> const& a, nothing_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(chset<CharT> const& a, nothing_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(chset<CharT> const& a, nothing_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(chset<CharT> const& a, nothing_parser b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator|(nothing_parser a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator&(nothing_parser a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator-(nothing_parser a, chset<CharT> const& b); - -////////////////////////////////// -template <typename CharT> -chset<CharT> -operator^(nothing_parser a, chset<CharT> const& b); - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/butility/impl/chset_operators.ipp> diff --git a/Utilities/BGL/boost/spirit/butility/confix.hpp b/Utilities/BGL/boost/spirit/butility/confix.hpp deleted file mode 100644 index 030ed65fca4ec6c036648d8fcec0c5e9839c291f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/confix.hpp +++ /dev/null @@ -1,396 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CONFIX_HPP -#define BOOST_SPIRIT_CONFIX_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/config.hpp> -#include <boost/spirit/meta/as_parser.hpp> -#include <boost/spirit/core/composite/operators.hpp> -#include <boost/spirit/butility/impl/confix.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// confix_parser class -// -// Parses a sequence of 3 sub-matches. This class may -// be used to parse structures, where the opening part is possibly -// contained in the expression part and the whole sequence is only -// parsed after seeing the closing part matching the first opening -// subsequence. Example: C-comments: -// -// /* This is a C-comment */ -// -/////////////////////////////////////////////////////////////////////////////// - -template<typename NestedT = non_nested, typename LexemeT = non_lexeme> -struct confix_parser_gen; - -template < - typename OpenT, typename ExprT, typename CloseT, typename CategoryT, - typename NestedT = non_nested, typename LexemeT = non_lexeme -> -struct confix_parser : - public parser< - confix_parser<OpenT, ExprT, CloseT, CategoryT, NestedT, LexemeT> - > -{ - typedef - confix_parser<OpenT, ExprT, CloseT, CategoryT, NestedT, LexemeT> - self_t; - - confix_parser(OpenT const &open_, ExprT const &expr_, CloseT const &close_) - : open(open_), expr(expr_), close(close_) - {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return impl::confix_parser_type<CategoryT>:: - parse(NestedT(), LexemeT(), *this, scan, open, expr, close); - } - -private: - - typename as_parser<OpenT>::type::embed_t open; - typename as_parser<ExprT>::type::embed_t expr; - typename as_parser<CloseT>::type::embed_t close; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Confix parser generator template -// -// This is a helper for generating a correct confix_parser<> from -// auxiliary parameters. There are the following types supported as -// parameters yet: parsers, single characters and strings (see -// as_parser). -// -// If the body parser is an action_parser_category type parser (a parser -// with an attached semantic action) we have to do something special. This -// happens, if the user wrote something like: -// -// confix_p(open, body[f], close) -// -// where 'body' is the parser matching the body of the confix sequence -// and 'f' is a functor to be called after matching the body. If we would -// do nothing, the resulting code would parse the sequence as follows: -// -// start >> (body[f] - close) >> close -// -// what in most cases is not what the user expects. -// (If this _is_ what you've expected, then please use the confix_p -// generator function 'direct()', which will inhibit -// re-attaching the actor to the body parser). -// -// To make the confix parser behave as expected: -// -// start >> (body - close)[f] >> close -// -// the actor attached to the 'body' parser has to be re-attached to the -// (body - close) parser construct, which will make the resulting confix -// parser 'do the right thing'. This refactoring is done by the help of -// the refactoring parsers (see the files refactoring.[hi]pp). -// -// Additionally special care must be taken, if the body parser is a -// unary_parser_category type parser as -// -// confix_p(open, *anychar_p, close) -// -// which without any refactoring would result in -// -// start >> (*anychar_p - close) >> close -// -// and will not give the expected result (*anychar_p will eat up all the -// input up to the end of the input stream). So we have to refactor this -// into: -// -// start >> *(anychar_p - close) >> close -// -// what will give the correct result. -// -// The case, where the body parser is a combination of the two mentioned -// problems (i.e. the body parser is a unary parser with an attached -// action), is handled accordingly too: -// -// confix_p(start, (*anychar_p)[f], end) -// -// will be parsed as expected: -// -// start >> (*(anychar_p - end))[f] >> end. -// -/////////////////////////////////////////////////////////////////////////////// - -template<typename NestedT, typename LexemeT> -struct confix_parser_gen -{ - // Generic generator function for creation of concrete confix parsers - - template<typename StartT, typename ExprT, typename EndT> - confix_parser< - typename as_parser<StartT>::type, - typename as_parser<ExprT>::type, - typename as_parser<EndT>::type, - typename as_parser<ExprT>::type::parser_category_t, - NestedT, - LexemeT - > - operator()( - StartT const &start_, ExprT const &expr_, EndT const &end_) const - { - typedef typename as_parser<StartT>::type start_t; - typedef typename as_parser<ExprT>::type expr_t; - typedef typename as_parser<EndT>::type end_t; - typedef - typename as_parser<ExprT>::type::parser_category_t - parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, LexemeT - > - return_t; - - return return_t( - as_parser<StartT>::convert(start_), - as_parser<ExprT>::convert(expr_), - as_parser<EndT>::convert(end_) - ); - } - - // Generic generator function for creation of concrete confix parsers - // which have an action directly attached to the ExprT part of the - // parser (see comment above, no automatic refactoring) - - template<typename StartT, typename ExprT, typename EndT> - confix_parser< - typename as_parser<StartT>::type, - typename as_parser<ExprT>::type, - typename as_parser<EndT>::type, - plain_parser_category, // do not re-attach action - NestedT, - LexemeT - > - direct(StartT const &start_, ExprT const &expr_, EndT const &end_) const - { - typedef typename as_parser<StartT>::type start_t; - typedef typename as_parser<ExprT>::type expr_t; - typedef typename as_parser<EndT>::type end_t; - typedef plain_parser_category parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, LexemeT - > - return_t; - - return return_t( - as_parser<StartT>::convert(start_), - as_parser<ExprT>::convert(expr_), - as_parser<EndT>::convert(end_) - ); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Predefined non_nested confix parser generators -// -/////////////////////////////////////////////////////////////////////////////// - -const confix_parser_gen<non_nested, non_lexeme> confix_p = - confix_parser_gen<non_nested, non_lexeme>(); - -/////////////////////////////////////////////////////////////////////////////// -// -// Comments are special types of confix parsers -// -// Comment parser generator template. This is a helper for generating a -// correct confix_parser<> from auxiliary parameters, which is able to -// parse comment constructs: (StartToken >> Comment text >> EndToken). -// -// There are the following types supported as parameters yet: parsers, -// single characters and strings (see as_parser). -// -// There are two diffenerent predefined comment parser generators -// (comment_p and comment_nest_p, see below), which may be used for -// creating special comment parsers in two different ways. -// -// If these are used with one parameter, a comment starting with the given -// first parser parameter up to the end of the line is matched. So for -// instance the following parser matches C++ style comments: -// -// comment_p("//"). -// -// If these are used with two parameters, a comment starting with the -// first parser parameter up to the second parser parameter is matched. -// For instance a C style comment parser should be constrcuted as: -// -// comment_p("/*", "*/"). -// -// Please note, that a comment is parsed implicitly as if the whole -// comment_p(...) statement were embedded into a lexeme_d[] directive. -// -/////////////////////////////////////////////////////////////////////////////// - -template<typename NestedT> -struct comment_parser_gen -{ - // Generic generator function for creation of concrete comment parsers - // from an open token. The newline parser eol_p is used as the - // closing token. - - template<typename StartT> - confix_parser< - typename as_parser<StartT>::type, - kleene_star<anychar_parser>, - alternative<eol_parser, end_parser>, - unary_parser_category, // there is no action to re-attach - NestedT, - is_lexeme // insert implicit lexeme_d[] - > - operator() (StartT const &start_) const - { - typedef typename as_parser<StartT>::type start_t; - typedef kleene_star<anychar_parser> expr_t; - typedef alternative<eol_parser, end_parser> end_t; - typedef unary_parser_category parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, is_lexeme - > - return_t; - - return return_t( - as_parser<StartT>::convert(start_), - *anychar_p, - eol_p | end_p - ); - } - - // Generic generator function for creation of concrete comment parsers - // from an open and a close tokens. - - template<typename StartT, typename EndT> - confix_parser< - typename as_parser<StartT>::type, - kleene_star<anychar_parser>, - typename as_parser<EndT>::type, - unary_parser_category, // there is no action to re-attach - NestedT, - is_lexeme // insert implicit lexeme_d[] - > - operator() (StartT const &start_, EndT const &end_) const - { - typedef typename as_parser<StartT>::type start_t; - typedef kleene_star<anychar_parser> expr_t; - typedef typename as_parser<EndT>::type end_t; - typedef unary_parser_category parser_category_t; - - typedef - confix_parser< - start_t, expr_t, end_t, parser_category_t, NestedT, is_lexeme - > - return_t; - - return return_t( - as_parser<StartT>::convert(start_), - *anychar_p, - as_parser<EndT>::convert(end_) - ); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Predefined non_nested comment parser generator -// -/////////////////////////////////////////////////////////////////////////////// - -const comment_parser_gen<non_nested> comment_p = - comment_parser_gen<non_nested>(); - -/////////////////////////////////////////////////////////////////////////////// -// -// comment_nest_parser class -// -// Parses a nested comments. -// Example: nested PASCAL-comments: -// -// { This is a { nested } PASCAL-comment } -// -/////////////////////////////////////////////////////////////////////////////// - -template<typename OpenT, typename CloseT> -struct comment_nest_parser: - public parser<comment_nest_parser<OpenT, CloseT> > -{ - typedef comment_nest_parser<OpenT, CloseT> self_t; - - comment_nest_parser(OpenT const &open_, CloseT const &close_): - open(open_), close(close_) - {} - - template<typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const &scan) const - { - return do_parse( - open >> *(*this | (anychar_p - close)) >> close, - scan); - } - -private: - template<typename ParserT, typename ScannerT> - typename parser_result<self_t, ScannerT>::type - do_parse(ParserT const &p, ScannerT const &scan) const - { - return - impl::contiguous_parser_parse< - BOOST_DEDUCED_TYPENAME parser_result<ParserT, ScannerT>::type - >(p, scan, scan); - } - - typename as_parser<OpenT>::type::embed_t open; - typename as_parser<CloseT>::type::embed_t close; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Predefined nested comment parser generator -// -/////////////////////////////////////////////////////////////////////////////// - -template<typename OpenT, typename CloseT> -inline -comment_nest_parser< - typename as_parser<OpenT>::type, - typename as_parser<CloseT>::type -> - comment_nest_p(OpenT const &open, CloseT const &close) -{ - return - comment_nest_parser< - BOOST_DEDUCED_TYPENAME as_parser<OpenT>::type, - BOOST_DEDUCED_TYPENAME as_parser<CloseT>::type - >( - as_parser<OpenT>::convert(open), - as_parser<CloseT>::convert(close) - ); -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/butility/distinct.hpp b/Utilities/BGL/boost/spirit/butility/distinct.hpp deleted file mode 100644 index c65716ca3c8bae65751220f7b78ad7348f110da2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/distinct.hpp +++ /dev/null @@ -1,225 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2003 Vaclav Vesely - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_DISTINCT_HPP) -#define BOOST_SPIRIT_DISTINCT_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/operators.hpp> -#include <boost/spirit/core/composite/directives.hpp> -#include <boost/spirit/core/composite/epsilon.hpp> -#include <boost/spirit/core/non_terminal/rule.hpp> -#include <boost/spirit/butility/chset.hpp> - -namespace boost { - namespace spirit { -//----------------------------------------------------------------------------- -// distinct_parser class - -template <typename CharT = char, typename TailT = chset<CharT> > -class distinct_parser -{ -public: - typedef - contiguous< - sequence< - chseq<CharT const*>, - negated_empty_match_parser< - TailT - > - > - > - result_t; - - distinct_parser() - : tail(chset<CharT>()) - { - } - - explicit distinct_parser(parser<TailT> const & tail_) - : tail(tail_.derived()) - { - } - - explicit distinct_parser(CharT const* letters) - : tail(chset_p(letters)) - { - } - - result_t operator()(CharT const* str) const - { - return lexeme_d[chseq_p(str) >> ~epsilon_p(tail)]; - } - - TailT tail; -}; - -//----------------------------------------------------------------------------- -// distinct_directive class - -template <typename CharT = char, typename TailT = chset<CharT> > -class distinct_directive -{ -public: - template<typename ParserT> - struct result { - typedef - contiguous< - sequence< - ParserT, - negated_empty_match_parser< - TailT - > - > - > - type; - }; - - distinct_directive() - : tail(chset<CharT>()) - { - } - - explicit distinct_directive(CharT const* letters) - : tail(chset_p(letters)) - { - } - - explicit distinct_directive(parser<TailT> const & tail_) - : tail(tail_.derived()) - { - } - - template<typename ParserT> - typename result<typename as_parser<ParserT>::type>::type - operator[](ParserT const &subject) const - { - return - lexeme_d[as_parser<ParserT>::convert(subject) >> ~epsilon_p(tail)]; - } - - TailT tail; -}; - -//----------------------------------------------------------------------------- -// dynamic_distinct_parser class - -template <typename ScannerT = scanner<> > -class dynamic_distinct_parser -{ -public: - typedef typename ScannerT::value_t char_t; - - typedef - rule< - typename no_actions_scanner< - typename lexeme_scanner<ScannerT>::type - >::type - > - tail_t; - - typedef - contiguous< - sequence< - chseq<char_t const*>, - negated_empty_match_parser< - tail_t - > - > - > - result_t; - - dynamic_distinct_parser() - : tail(nothing_p) - { - } - - template<typename ParserT> - explicit dynamic_distinct_parser(parser<ParserT> const & tail_) - : tail(tail_.derived()) - { - } - - explicit dynamic_distinct_parser(char_t const* letters) - : tail(chset_p(letters)) - { - } - - result_t operator()(char_t const* str) const - { - return lexeme_d[chseq_p(str) >> ~epsilon_p(tail)]; - } - - tail_t tail; -}; - -//----------------------------------------------------------------------------- -// dynamic_distinct_directive class - -template <typename ScannerT = scanner<> > -class dynamic_distinct_directive -{ -public: - typedef typename ScannerT::value_t char_t; - - typedef - rule< - typename no_actions_scanner< - typename lexeme_scanner<ScannerT>::type - >::type - > - tail_t; - - template<typename ParserT> - struct result { - typedef - contiguous< - sequence< - ParserT, - negated_empty_match_parser< - tail_t - > - > - > - type; - }; - - dynamic_distinct_directive() - : tail(nothing_p) - { - } - - template<typename ParserT> - explicit dynamic_distinct_directive(parser<ParserT> const & tail_) - : tail(tail_.derived()) - { - } - - explicit dynamic_distinct_directive(char_t const* letters) - : tail(chset_p(letters)) - { - } - - template<typename ParserT> - typename result<typename as_parser<ParserT>::type>::type - operator[](ParserT const &subject) const - { - return - lexeme_d[as_parser<ParserT>::convert(subject) >> ~epsilon_p(tail)]; - } - - tail_t tail; -}; - -//----------------------------------------------------------------------------- - } // namespace spirit -} // namespace boost - -#endif // !defined(BOOST_SPIRIT_DISTINCT_HPP) diff --git a/Utilities/BGL/boost/spirit/butility/escape_char.hpp b/Utilities/BGL/boost/spirit/butility/escape_char.hpp deleted file mode 100644 index 58a7651e4b0cef0ee770c2f73345282f001ba634..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/escape_char.hpp +++ /dev/null @@ -1,179 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ESCAPE_CHAR_HPP -#define BOOST_SPIRIT_ESCAPE_CHAR_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <string> -#include <iterator> -#include <cctype> -#include <boost/limits.hpp> - -#include <boost/spirit/debug.hpp> - -#include <boost/spirit/butility/impl/escape_char.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// escape_char_action class -// -// Links an escape char parser with a user defined semantic action. -// The semantic action may be a function or a functor. A function -// should be compatible with the interface: -// -// void f(CharT ch); -// -// A functor should have a member operator() with a compatible signature -// as above. The matching character is passed into the function/functor. -// This is the default class that character parsers use when dealing with -// the construct: -// -// p[f] -// -// where p is a parser and f is a function or functor. -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename ParserT, typename ActionT, - unsigned long Flags, typename CharT -> -struct escape_char_action -: public unary<ParserT, - parser<escape_char_action<ParserT, ActionT, Flags, CharT> > > -{ - typedef escape_char_action - <ParserT, ActionT, Flags, CharT> self_t; - typedef action_parser_category parser_category_t; - typedef unary<ParserT, parser<self_t> > base_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, CharT>::type type; - }; - - escape_char_action(ParserT const& p, ActionT const& a) - : base_t(p), actor(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return impl::escape_char_action_parse<Flags, CharT>:: - parse(scan, *this); - } - - ActionT const& predicate() const { return actor; } - -private: - - ActionT actor; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// escape_char_parser class -// -// The escape_char_parser helps in conjunction with the escape_char_action -// template class (see above) in parsing escaped characters. There are two -// different variants of this parser: one for parsing C style escaped -// characters and one for parsing LEX style escaped characters. -// -// The C style escaped character parser is generated, when the template -// parameter 'Flags' is equal to 'c_escapes' (a constant defined in the -// file impl/escape_char.ipp). This parser recognizes all valid C escape -// character sequences: '\t', '\b', '\f', '\n', '\r', '\"', '\'', '\\' -// and the numeric style escapes '\120' (octal) and '\x2f' (hexadecimal) -// and converts these to their character equivalent, for instance the -// sequence of a backslash and a 'b' is parsed as the character '\b'. -// All other escaped characters are rejected by this parser. -// -// The LEX style escaped character parser is generated, when the template -// parameter 'Flags' is equal to 'lex_escapes' (a constant defined in the -// file impl/escape_char.ipp). This parser recognizes all the C style -// escaped character sequences (as described above) and additionally -// does not reject all other escape sequences. All not mentioned escape -// sequences are converted by the parser to the plain character, for -// instance '\a' will be parsed as 'a'. -// -// All not escaped characters are parsed without modification. -// -/////////////////////////////////////////////////////////////////////////////// - -template <unsigned long Flags, typename CharT> -struct escape_char_action_parser_gen; - -template <unsigned long Flags, typename CharT = char> -struct escape_char_parser : - public parser<escape_char_parser<Flags, CharT> > { - - // only the values c_escapes and lex_escapes are valid for Flags - BOOST_STATIC_ASSERT(Flags == c_escapes || Flags == lex_escapes); - - typedef escape_char_parser<Flags, CharT> self_t; - typedef - escape_char_action_parser_gen<Flags, CharT> - action_parser_generator_t; - - template <typename ScannerT> - struct result { - - typedef typename match_result<ScannerT, CharT>::type type; - }; - - template <typename ActionT> - escape_char_action<self_t, ActionT, Flags, CharT> - operator[](ActionT const& actor) const - { - return escape_char_action<self_t, ActionT, Flags, CharT>(*this, actor); - } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const &scan) const - { - return impl::escape_char_parse<CharT>::parse(scan, *this); - } -}; - -template <unsigned long Flags, typename CharT> -struct escape_char_action_parser_gen { - - template <typename ParserT, typename ActionT> - static escape_char_action<ParserT, ActionT, Flags, CharT> - generate (ParserT const &p, ActionT const &actor) - { - typedef - escape_char_action<ParserT, ActionT, Flags, CharT> - action_parser_t; - return action_parser_t(p, actor); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// predefined escape_char_parser objects -// -// These objects should be used for generating correct escaped character -// parsers. -// -/////////////////////////////////////////////////////////////////////////////// -const escape_char_parser<lex_escapes> lex_escape_ch_p = - escape_char_parser<lex_escapes>(); - -const escape_char_parser<c_escapes> c_escape_ch_p = - escape_char_parser<c_escapes>(); - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/butility/flush_multi_pass.hpp b/Utilities/BGL/boost/spirit/butility/flush_multi_pass.hpp deleted file mode 100644 index c33ea0a446891708e422402bdbd2761c89d79147..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/flush_multi_pass.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_FLUSH_MULTI_PASS_HPP -#define BOOST_SPIRIT_FLUSH_MULTI_PASS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core.hpp> -#include <boost/spirit/iterator/multi_pass.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - namespace impl { - - template <typename T> - void flush_iterator(T &) {} - - template <typename T1, typename T2, typename T3, typename T4> - void flush_iterator(boost::spirit::multi_pass< - T1, T2, T3, T4, boost::spirit::multi_pass_policies::std_deque> &i) - { - i.clear_queue(); - } - - } // namespace impl - - /////////////////////////////////////////////////////////////////////////// - // - // flush_multi_pass_parser - // - // The flush_multi_pass_parser flushes an underlying - // multi_pass_iterator during the normal parsing process. This may - // be used at certain points during the parsing process, when it is - // clear, that no backtracking is needed anymore and the input - // gathered so far may be discarded. - // - /////////////////////////////////////////////////////////////////////////// - class flush_multi_pass_parser - : public parser<flush_multi_pass_parser> - { - public: - typedef flush_multi_pass_parser this_t; - - template <typename ScannerT> - typename parser_result<this_t, ScannerT>::type - parse(ScannerT const& scan) const - { - impl::flush_iterator(scan.first); - return scan.empty_match(); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // predefined flush_multi_pass_p object - // - // This object should may used to flush a multi_pass_iterator along - // the way during the normal parsing process. - // - /////////////////////////////////////////////////////////////////////////// - - flush_multi_pass_parser const - flush_multi_pass_p = flush_multi_pass_parser(); - -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_FLUSH_MULTI_PASS_HPP diff --git a/Utilities/BGL/boost/spirit/butility/functor_parser.hpp b/Utilities/BGL/boost/spirit/butility/functor_parser.hpp deleted file mode 100644 index fe72d4e3139b184aaa4cd74250a6506e0f5d4a28..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/functor_parser.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Juan Carlos Arevalo-Baeza - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_FUNCTOR_PARSER_HPP -#define BOOST_SPIRIT_FUNCTOR_PARSER_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/parser.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // functor_parser class - // - // Once a functor parser has been defined, you can build a real - // parser from it by passing it to this class as the template - // parameter. - // - /////////////////////////////////////////////////////////////////////////// - template < class FunctorT > - struct functor_parser : public parser<functor_parser<FunctorT> > - { - FunctorT functor; - - functor_parser(): functor() {} - functor_parser(FunctorT const& functor_): functor(functor_) {} - - typedef typename FunctorT::result_t functor_result_t; - typedef functor_parser<FunctorT> self_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, functor_result_t>::type - type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::value_t value_t; - typedef typename ScannerT::iterator_t iterator_t; - - iterator_t const s(scan.first); - functor_result_t result; - std::ptrdiff_t len = functor(scan, result); - - if (len < 0) - return scan.no_match(); - else - return scan.create_match(std::size_t(len), result, s, scan.first); - } - }; - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/butility/grammar_def.hpp b/Utilities/BGL/boost/spirit/butility/grammar_def.hpp deleted file mode 100644 index 1a5227b086941eda98820b4503eaf6d388693325..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/grammar_def.hpp +++ /dev/null @@ -1,323 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Hartmut Kaiser - Copyright (c) 2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_GRAMMAR_DEF_HPP) -#define BOOST_SPIRIT_GRAMMAR_DEF_HPP - -#include <boost/mpl/if.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/arithmetic/dec.hpp> -#include <boost/preprocessor/enum.hpp> -#include <boost/preprocessor/enum_params.hpp> -#include <boost/preprocessor/enum_params_with_defaults.hpp> -#include <boost/preprocessor/facilities/intercept.hpp> -#include <boost/preprocessor/repeat.hpp> -#include <boost/preprocessor/repeat_from_to.hpp> -#include <boost/spirit/phoenix/tuples.hpp> -#include <boost/spirit/core/assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit predefined maximum grammar start parser limit. This limit defines -// the maximum number of of possible different parsers exposed from a -// particular grammar. This number defaults to 3. -// The actual maximum is rounded up in multiples of 3. Thus, if this value -// is 4, the actual limit is 6. The ultimate maximum limit in this -// implementation is 15. -// -// It should NOT be greater than PHOENIX_LIMIT! -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT) -#define BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT PHOENIX_LIMIT -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// ensure BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT <= PHOENIX_LIMIT and -// BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT <= 15 and -// BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT > 0 -// -/////////////////////////////////////////////////////////////////////////////// -BOOST_STATIC_ASSERT(BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT <= PHOENIX_LIMIT); -BOOST_STATIC_ASSERT(BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT <= 15); -BOOST_STATIC_ASSERT(BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT > 0); - -/////////////////////////////////////////////////////////////////////////////// -// -// Calculate an integer rounded up to the nearest integer dividable by 3 -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT > 12 -#define BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A 15 -#elif BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT > 9 -#define BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A 12 -#elif BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT > 6 -#define BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A 9 -#elif BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT > 3 -#define BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A 6 -#else -#define BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A 3 -#endif - -////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -struct same {}; - -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - - /////////////////////////////////////////////////////////////////////////// - // - // The make_const_pointer meta function allows to generate a T const* - // needed to store the pointer to a given start parser from a grammar. - // - /////////////////////////////////////////////////////////////////////////// - template <typename T0, typename T = T0> - struct make_const_pointer { - - private: - // T0 shouldn't be of type 'same' - BOOST_STATIC_ASSERT((!boost::is_same<T0, same>::value)); - - typedef typename boost::mpl::if_c< - boost::is_same<T, same>::value, - T0 const *, - T const * - >::type - ptr_type; - - public: - // If the type in question is phoenix::nil_t, then the returned type - // is still phoenix::nil_t, otherwise a constant pointer type to the - // inspected type is returned. - typedef typename boost::mpl::if_c< - boost::is_same<T, phoenix::nil_t>::value, - phoenix::nil_t, - ptr_type - >::type - type; - }; - - /////////////////////////////////////////////////////////////////////////// - template <int N, typename ElementT> - struct assign_zero_to_tuple_member { - - template <typename TupleT> - static void do_(TupleT &t) { t[phoenix::tuple_index<N>()] = 0; } - }; - - template <int N> - struct assign_zero_to_tuple_member<N, phoenix::nil_t> { - - template <typename TupleT> - static void do_(TupleT& /*t*/) {} - }; - - struct phoenix_nil_type { - - typedef phoenix::nil_t type; - }; - - template <int N> - struct init_tuple_member { - - template <typename TupleT> - static void - do_(TupleT &t) - { - typedef typename boost::mpl::eval_if_c< - (N < TupleT::length), - phoenix::tuple_element<N, TupleT>, - phoenix_nil_type - >::type - element_type; - - assign_zero_to_tuple_member<N, element_type>::do_(t); - } - }; - -/////////////////////////////////////////////////////////////////////////////// -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// -// grammar_def class -// -// This class may be used as a base class for the embedded definition -// class inside the grammar<> derived user grammar. -// It exposes the two functions needed for start rule access: -// -// rule<> const &start() const; -// -// and -// -// template <int N> -// rule<> const *get_start_parser() const; -// -// Additionally it exposes a set o 'start_parsers' functions, which are to -// be called by the user to define the parsers to use as start parsers -// of the given grammar. -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename T, - BOOST_PP_ENUM_BINARY_PARAMS( - BOOST_PP_DEC(BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A), - typename T, = phoenix::nil_t BOOST_PP_INTERCEPT - ) -> -class grammar_def { - -private: - /////////////////////////////////////////////////////////////////////////// - // - // This generates the full tuple type from the given template parameters - // T, T0, ... - // - // typedef phoenix::tuple< - // typename impl::make_const_pointer<T>::type, - // typename impl::make_const_pointer<T, T0>::type, - // ... - // > tuple_t; - // - /////////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_GRAMMARDEF_TUPLE_PARAM(z, N, _) \ - typename impl::make_const_pointer<T, BOOST_PP_CAT(T, N)>::type \ - /**/ - - typedef phoenix::tuple< - typename impl::make_const_pointer<T>::type, - BOOST_PP_ENUM( - BOOST_PP_DEC(BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A), - BOOST_SPIRIT_GRAMMARDEF_TUPLE_PARAM, - _ - ) - > tuple_t; - - #undef BOOST_SPIRIT_GRAMMARDEF_TUPLE_PARAM - /////////////////////////////////////////////////////////////////////////// - -protected: - /////////////////////////////////////////////////////////////////////////// - // - // This generates a sequence of 'start_parsers' functions with increasing - // number of arguments, which allow to initialize the tuple members with - // the pointers to the start parsers of the grammar: - // - // template <typename TC0, ...> - // void start_parsers (TC0 const &t0, ...) - // { - // using phoenix::tuple_index_names::_1; - // t[_1] = &t0; - // ... - // } - // - // where a TC0 const* must be convertible to a T0 const* - // - /////////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_GRAMMARDEF_ENUM_PARAMS(z, N, _) \ - BOOST_PP_CAT(TC, N) const &BOOST_PP_CAT(t, N) \ - /**/ - #define BOOST_SPIRIT_GRAMMARDEF_ENUM_ASSIGN(z, N, _) \ - using phoenix::tuple_index_names::BOOST_PP_CAT(_, BOOST_PP_INC(N)); \ - t[BOOST_PP_CAT(_, BOOST_PP_INC(N))] = &BOOST_PP_CAT(t, N); \ - /**/ - #define BOOST_SPIRIT_GRAMMARDEF_ENUM_START(z, N, _) \ - template <BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), typename TC)> \ - void \ - start_parsers(BOOST_PP_ENUM_ ## z(BOOST_PP_INC(N), \ - BOOST_SPIRIT_GRAMMARDEF_ENUM_PARAMS, _) ) \ - { \ - BOOST_PP_REPEAT_ ## z(BOOST_PP_INC(N), \ - BOOST_SPIRIT_GRAMMARDEF_ENUM_ASSIGN, _) \ - } \ - /**/ - - BOOST_PP_REPEAT( - BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A, - BOOST_SPIRIT_GRAMMARDEF_ENUM_START, _) - - #undef BOOST_SPIRIT_GRAMMARDEF_ENUM_START - #undef BOOST_SPIRIT_GRAMMARDEF_ENUM_ASSIGN - #undef BOOST_SPIRIT_GRAMMARDEF_ENUM_PARAMS - /////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - // - // This generates some initialization code, which allows to initialize all - // used tuple members to 0 (zero): - // - // t[_1] = 0; - // impl::init_tuple_member<1>::do_(t); - // ... - // - /////////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_GRAMMARDEF_ENUM_INIT(z, N, _) \ - impl::init_tuple_member<N>::do_(t); \ - /**/ - - grammar_def() - { - using phoenix::tuple_index_names::_1; - t[_1] = 0; - BOOST_PP_REPEAT_FROM_TO( - 1, BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A, - BOOST_SPIRIT_GRAMMARDEF_ENUM_INIT, _) - } - - #undef BOOST_SPIRIT_GRAMMARDEF_ENUM_INIT - /////////////////////////////////////////////////////////////////////////// - -public: - T const & - start() const - { - // If the following assertion is fired, you have probably forgot to call - // the start_parser() function from inside the constructor of your - // embedded definition class to initialize the start parsers to be exposed - // from your grammar. - using phoenix::tuple_index_names::_1; - BOOST_SPIRIT_ASSERT(0 != t[_1]); - return *t[_1]; - } - - template <int N> - typename phoenix::tuple_element<N, tuple_t>::crtype - get_start_parser() const - { - // If the following expression yields a compiler error, you have probably - // tried to access a start rule, which isn't exposed as such from your - // grammar. - BOOST_STATIC_ASSERT(N > 0 && N < tuple_t::length); - - // If the following assertion is fired, you have probably forgot to call - // the start_parser() function from inside the constructor of your - // embedded definition class to initialize the start parsers to be exposed - // from your grammar. - // Another reason may be, that there is a count mismatch between - // the number of template parameters to the grammar_def<> class and the - // number of parameters used while calling start_parsers(). - BOOST_SPIRIT_ASSERT(0 != t[phoenix::tuple_index<N>()]); - - return t[phoenix::tuple_index<N>()]; - } - -private: - tuple_t t; -}; - -#undef BOOST_SPIRIT_GRAMMAR_STARTRULE_TYPE_LIMIT_A - -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_GRAMMAR_DEF_HPP diff --git a/Utilities/BGL/boost/spirit/butility/impl/chset.ipp b/Utilities/BGL/boost/spirit/butility/impl/chset.ipp deleted file mode 100644 index e185352dd82e44844dcd7d042b8a39f53deb5fe3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/chset.ipp +++ /dev/null @@ -1,362 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CHSET_IPP -#define BOOST_SPIRIT_CHSET_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/limits.hpp> -#include <boost/spirit/butility/chset.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// chset class -// -/////////////////////////////////////////////////////////////////////////////// -namespace utility { namespace impl { - template <typename CharT> - inline void - detach(boost::shared_ptr<basic_chset<CharT> >& ptr) - { - if (!ptr.unique()) - ptr = boost::shared_ptr<basic_chset<CharT> > - (new basic_chset<CharT>(*ptr)); - } - - template <typename CharT> - inline void - detach_clear(boost::shared_ptr<basic_chset<CharT> >& ptr) - { - if (ptr.unique()) - ptr->clear(); - else - ptr.reset(new basic_chset<CharT>()); - } - - template <typename CharT, typename CharT2> - void construct_chset(boost::shared_ptr<basic_chset<CharT> >& ptr, - CharT2 const* definition) - { - CharT2 ch = *definition++; - while (ch) - { - CharT2 next = *definition++; - if (next == '-') - { - next = *definition++; - if (next == 0) - { - ptr->set(ch); - ptr->set('-'); - break; - } - ptr->set(ch, next); - } - else - { - ptr->set(ch); - } - ch = next; - } - } - - ////////////////////////////////// - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - - template <typename CharT, typename FakeT> - void chset_negated_set(boost::shared_ptr<basic_chset<CharT> > &ptr, chlit<CharT> const &ch, - FakeT) - { - if(ch.ch != (std::numeric_limits<CharT>::min)()) { - ptr->set((std::numeric_limits<CharT>::min)(), ch.ch - 1); - } - if(ch.ch != (std::numeric_limits<CharT>::max)()) { - ptr->set(ch.ch + 1, (std::numeric_limits<CharT>::max)()); - } - } - - template <typename CharT, typename FakeT> - void chset_negated_set(boost::shared_ptr<basic_chset<CharT> > &ptr, - spirit::range<CharT> const &rng, FakeT) - { - if(rng.first != (std::numeric_limits<CharT>::min)()) { - ptr->set((std::numeric_limits<CharT>::min)(), rng.first - 1); - } - if(rng.last != (std::numeric_limits<CharT>::max)()) { - ptr->set(rng.last + 1, (std::numeric_limits<CharT>::max)()); - } - } - -#endif // BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -////////////////////////////////// - -}} // namespace utility::impl - -template <typename CharT> -inline chset<CharT>::chset() -: ptr(new basic_chset<CharT>()) {} - -template <typename CharT> -inline chset<CharT>::chset(chset const& arg_) -: ptr(new basic_chset<CharT>(*arg_.ptr)) {} - -template <typename CharT> -inline chset<CharT>::chset(CharT arg_) -: ptr(new basic_chset<CharT>()) -{ ptr->set(arg_); } - -template <typename CharT> -inline chset<CharT>::chset(anychar_parser /*arg*/) -: ptr(new basic_chset<CharT>()) -{ - ptr->set( - (std::numeric_limits<CharT>::min)(), - (std::numeric_limits<CharT>::max)() - ); -} - -template <typename CharT> -inline chset<CharT>::chset(nothing_parser arg_) -: ptr(new basic_chset<CharT>()) {} - -template <typename CharT> -inline chset<CharT>::chset(chlit<CharT> const& arg_) -: ptr(new basic_chset<CharT>()) -{ ptr->set(arg_.ch); } - -template <typename CharT> -inline chset<CharT>::chset(range<CharT> const& arg_) -: ptr(new basic_chset<CharT>()) -{ ptr->set(arg_.first, arg_.last); } - -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -template <typename CharT> -inline chset<CharT>::chset(negated_char_parser<chlit<CharT> > const& arg_) -: ptr(new basic_chset<CharT>()) -{ - set(arg_); -} - -template <typename CharT> -inline chset<CharT>::chset(negated_char_parser<range<CharT> > const& arg_) -: ptr(new basic_chset<CharT>()) -{ - set(arg_); -} - -#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -template <typename CharT> -inline chset<CharT>::~chset() {} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(chset const& rhs) -{ - ptr = rhs.ptr; - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(CharT rhs) -{ - utility::impl::detach_clear(ptr); - ptr->set(rhs); - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(anychar_parser rhs) -{ - utility::impl::detach_clear(ptr); - ptr->set( - (std::numeric_limits<CharT>::min)(), - (std::numeric_limits<CharT>::max)() - ); - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(nothing_parser rhs) -{ - utility::impl::detach_clear(ptr); - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(chlit<CharT> const& rhs) -{ - utility::impl::detach_clear(ptr); - ptr->set(rhs.ch); - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(range<CharT> const& rhs) -{ - utility::impl::detach_clear(ptr); - ptr->set(rhs.first, rhs.last); - return *this; -} - -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(negated_char_parser<chlit<CharT> > const& rhs) -{ - utility::impl::detach_clear(ptr); - set(rhs); - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator=(negated_char_parser<range<CharT> > const& rhs) -{ - utility::impl::detach_clear(ptr); - set(rhs); - return *this; -} - -#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -template <typename CharT> -inline void -chset<CharT>::set(range<CharT> const& arg_) -{ - utility::impl::detach(ptr); - ptr->set(arg_.first, arg_.last); -} - -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -template <typename CharT> -inline void -chset<CharT>::set(negated_char_parser<chlit<CharT> > const& arg_) -{ - utility::impl::detach(ptr); - - if(arg_.positive.ch != (std::numeric_limits<CharT>::min)()) { - ptr->set((std::numeric_limits<CharT>::min)(), arg_.positive.ch - 1); - } - if(arg_.positive.ch != (std::numeric_limits<CharT>::max)()) { - ptr->set(arg_.positive.ch + 1, (std::numeric_limits<CharT>::max)()); - } -} - -template <typename CharT> -inline void -chset<CharT>::set(negated_char_parser<range<CharT> > const& arg_) -{ - utility::impl::detach(ptr); - - if(arg_.positive.first != (std::numeric_limits<CharT>::min)()) { - ptr->set((std::numeric_limits<CharT>::min)(), arg_.positive.first - 1); - } - if(arg_.positive.last != (std::numeric_limits<CharT>::max)()) { - ptr->set(arg_.positive.last + 1, (std::numeric_limits<CharT>::max)()); - } -} - -#endif // !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -template <typename CharT> -inline void -chset<CharT>::clear(range<CharT> const& arg_) -{ - utility::impl::detach(ptr); - ptr->clear(arg_.first, arg_.last); -} - -template <typename CharT> -inline void -chset<CharT>::clear(negated_char_parser<range<CharT> > const& arg_) -{ - utility::impl::detach(ptr); - - if(arg_.positive.first != (std::numeric_limits<CharT>::min)()) { - ptr->clear((std::numeric_limits<CharT>::min)(), arg_.positive.first - 1); - } - if(arg_.positive.last != (std::numeric_limits<CharT>::max)()) { - ptr->clear(arg_.positive.last + 1, (std::numeric_limits<CharT>::max)()); - } -} - -template <typename CharT> -inline bool -chset<CharT>::test(CharT ch) const -{ return ptr->test(ch); } - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::inverse() -{ - utility::impl::detach(ptr); - ptr->inverse(); - return *this; -} - -template <typename CharT> -inline void -chset<CharT>::swap(chset& x) -{ ptr.swap(x.ptr); } - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator|=(chset const& x) -{ - utility::impl::detach(ptr); - *ptr |= *x.ptr; - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator&=(chset const& x) -{ - utility::impl::detach(ptr); - *ptr &= *x.ptr; - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator-=(chset const& x) -{ - utility::impl::detach(ptr); - *ptr -= *x.ptr; - return *this; -} - -template <typename CharT> -inline chset<CharT>& -chset<CharT>::operator^=(chset const& x) -{ - utility::impl::detach(ptr); - *ptr ^= *x.ptr; - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/butility/impl/chset/basic_chset.hpp b/Utilities/BGL/boost/spirit/butility/impl/chset/basic_chset.hpp deleted file mode 100644 index c065d7232cc640adea95e138e581e453a93a12a3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/chset/basic_chset.hpp +++ /dev/null @@ -1,102 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_BASIC_CHSET_HPP -#define BOOST_SPIRIT_BASIC_CHSET_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <bitset> -#include <boost/spirit/butility/impl/chset/range_run.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // basic_chset: basic character set implementation using range_run - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT> - class basic_chset - { - public: - basic_chset(); - basic_chset(basic_chset const& arg_); - - bool test(CharT v) const; - void set(CharT from, CharT to); - void set(CharT c); - void clear(CharT from, CharT to); - void clear(CharT c); - void clear(); - - void inverse(); - void swap(basic_chset& x); - - basic_chset& operator|=(basic_chset const& x); - basic_chset& operator&=(basic_chset const& x); - basic_chset& operator-=(basic_chset const& x); - basic_chset& operator^=(basic_chset const& x); - - private: utility::impl::range_run<CharT> rr; - }; - - #if (CHAR_BIT == 8) - - /////////////////////////////////////////////////////////////////////////// - // - // basic_chset: specializations for 8 bit chars using std::bitset - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT> - class basic_chset_8bit { - - public: - basic_chset_8bit(); - basic_chset_8bit(basic_chset_8bit const& arg_); - - bool test(CharT v) const; - void set(CharT from, CharT to); - void set(CharT c); - void clear(CharT from, CharT to); - void clear(CharT c); - void clear(); - - void inverse(); - void swap(basic_chset_8bit& x); - - basic_chset_8bit& operator|=(basic_chset_8bit const& x); - basic_chset_8bit& operator&=(basic_chset_8bit const& x); - basic_chset_8bit& operator-=(basic_chset_8bit const& x); - basic_chset_8bit& operator^=(basic_chset_8bit const& x); - - private: std::bitset<256> bset; - }; - - ///////////////////////////////// - template <> - class basic_chset<char> - : public basic_chset_8bit<char> {}; - - ///////////////////////////////// - template <> - class basic_chset<signed char> - : public basic_chset_8bit<signed char> {}; - - ///////////////////////////////// - template <> - class basic_chset<unsigned char> - : public basic_chset_8bit<unsigned char> {}; - -#endif - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/butility/impl/chset/basic_chset.ipp> diff --git a/Utilities/BGL/boost/spirit/butility/impl/chset/basic_chset.ipp b/Utilities/BGL/boost/spirit/butility/impl/chset/basic_chset.ipp deleted file mode 100644 index 01b95120227cfa19667ddb38bf366990bd6849d6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/chset/basic_chset.ipp +++ /dev/null @@ -1,241 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_BASIC_CHSET_IPP -#define BOOST_SPIRIT_BASIC_CHSET_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <bitset> -#include <boost/spirit/butility/impl/chset/basic_chset.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// basic_chset: character set implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline basic_chset<CharT>::basic_chset() {} - -////////////////////////////////// -template <typename CharT> -inline basic_chset<CharT>::basic_chset(basic_chset const& arg_) -: rr(arg_.rr) {} - -////////////////////////////////// -template <typename CharT> -inline bool -basic_chset<CharT>::test(CharT v) const -{ return rr.test(v); } - -////////////////////////////////// -template <typename CharT> -inline void -basic_chset<CharT>::set(CharT from, CharT to) -{ rr.set(utility::impl::range<CharT>(from, to)); } - -////////////////////////////////// -template <typename CharT> -inline void -basic_chset<CharT>::set(CharT c) -{ rr.set(utility::impl::range<CharT>(c, c)); } - -////////////////////////////////// -template <typename CharT> -inline void -basic_chset<CharT>::clear(CharT from, CharT to) -{ rr.clear(utility::impl::range<CharT>(from, to)); } - -////////////////////////////////// -template <typename CharT> -inline void -basic_chset<CharT>::clear() -{ rr.clear(); } - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset<CharT>::inverse() -{ - basic_chset inv; - inv.set( - (std::numeric_limits<CharT>::min)(), - (std::numeric_limits<CharT>::max)() - ); - inv -= *this; - swap(inv); -} - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset<CharT>::swap(basic_chset& x) -{ rr.swap(x.rr); } - -///////////////////////////////// -template <typename CharT> -inline basic_chset<CharT>& -basic_chset<CharT>::operator|=(basic_chset<CharT> const& x) -{ - typedef typename utility::impl::range_run<CharT>::const_iterator const_iterator; - for (const_iterator iter = x.rr.begin(); iter != x.rr.end(); ++iter) - rr.set(*iter); - return *this; -} - -///////////////////////////////// -template <typename CharT> -inline basic_chset<CharT>& -basic_chset<CharT>::operator&=(basic_chset<CharT> const& x) -{ - basic_chset inv; - inv.set( - (std::numeric_limits<CharT>::min)(), - (std::numeric_limits<CharT>::max)() - ); - inv -= x; - *this -= inv; - return *this; -} - -///////////////////////////////// -template <typename CharT> -inline basic_chset<CharT>& -basic_chset<CharT>::operator-=(basic_chset<CharT> const& x) -{ - typedef typename utility::impl::range_run<CharT>::const_iterator const_iterator; - for (const_iterator iter = x.rr.begin(); iter != x.rr.end(); ++iter) - rr.clear(*iter); - return *this; -} - -///////////////////////////////// -template <typename CharT> -inline basic_chset<CharT>& -basic_chset<CharT>::operator^=(basic_chset<CharT> const& x) -{ - basic_chset bma = x; - bma -= *this; - *this -= x; - *this |= bma; - return *this; -} - -#if (CHAR_BIT == 8) - -/////////////////////////////////////////////////////////////////////////////// -// -// basic_chset: specializations for 8 bit chars using std::bitset -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline basic_chset_8bit<CharT>::basic_chset_8bit() {} - -///////////////////////////////// -template <typename CharT> -inline basic_chset_8bit<CharT>::basic_chset_8bit(basic_chset_8bit const& arg_) -: bset(arg_.bset) {} - -///////////////////////////////// -template <typename CharT> -inline bool -basic_chset_8bit<CharT>::test(CharT v) const -{ return bset.test((unsigned char)v); } - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset_8bit<CharT>::set(CharT from, CharT to) -{ - for (int i = from; i <= to; ++i) - bset.set((unsigned char)i); -} - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset_8bit<CharT>::set(CharT c) -{ bset.set((unsigned char)c); } - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset_8bit<CharT>::clear(CharT from, CharT to) -{ - for (int i = from; i <= to; ++i) - bset.reset((unsigned char)i); -} - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset_8bit<CharT>::clear(CharT c) -{ bset.reset((unsigned char)c); } - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset_8bit<CharT>::clear() -{ bset.reset(); } - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset_8bit<CharT>::inverse() -{ bset.flip(); } - -///////////////////////////////// -template <typename CharT> -inline void -basic_chset_8bit<CharT>::swap(basic_chset_8bit& x) -{ std::swap(bset, x.bset); } - -///////////////////////////////// -template <typename CharT> -inline basic_chset_8bit<CharT>& -basic_chset_8bit<CharT>::operator|=(basic_chset_8bit const& x) -{ - bset |= x.bset; - return *this; -} - -///////////////////////////////// -template <typename CharT> -inline basic_chset_8bit<CharT>& -basic_chset_8bit<CharT>::operator&=(basic_chset_8bit const& x) -{ - bset &= x.bset; - return *this; -} - -///////////////////////////////// -template <typename CharT> -inline basic_chset_8bit<CharT>& -basic_chset_8bit<CharT>::operator-=(basic_chset_8bit const& x) -{ - bset &= ~x.bset; - return *this; -} - -///////////////////////////////// -template <typename CharT> -inline basic_chset_8bit<CharT>& -basic_chset_8bit<CharT>::operator^=(basic_chset_8bit const& x) -{ - bset ^= x.bset; - return *this; -} - -#endif -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/butility/impl/chset/range_run.hpp b/Utilities/BGL/boost/spirit/butility/impl/chset/range_run.hpp deleted file mode 100644 index 55e884dee2be072d86dc7b1cf0d61d0455dd2510..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/chset/range_run.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_RANGE_RUN_HPP -#define BOOST_SPIRIT_RANGE_RUN_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <vector> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { namespace utility { namespace impl { - - /////////////////////////////////////////////////////////////////////////// - // - // range class - // - // Implements a closed range of values. This class is used in - // the implementation of the range_run class. - // - // { Low level implementation detail } - // { Not to be confused with boost::spirit::range } - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT> - struct range { - - range(CharT first, CharT last); - - bool is_valid() const; - bool includes(CharT v) const; - bool includes(range const& r) const; - bool overlaps(range const& r) const; - void merge(range const& r); - - CharT first; - CharT last; - }; - - ////////////////////////////////// - template <typename CharT> - struct range_char_compare { - - bool operator()(range<CharT> const& x, const CharT y) const - { return x.first < y; } - - bool operator()(const CharT x, range<CharT> const& y) const - { return x < y.first; } - - // This additional operator is required for the checked STL shipped - // with VC8 testing the ordering of the iterators passed to the - // std::lower_bound algo this range_char_compare<> predicate is passed - // to. - bool operator()(range<CharT> const& x, range<CharT> const& y) const - { return x.first < y.first; } - }; - - ////////////////////////////////// - template <typename CharT> - struct range_compare { - - bool operator()(range<CharT> const& x, range<CharT> const& y) const - { return x.first < y.first; } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // range_run - // - // An implementation of a sparse bit (boolean) set. The set uses - // a sorted vector of disjoint ranges. This class implements the - // bare minimum essentials from which the full range of set - // operators can be implemented. The set is constructed from - // ranges. Internally, adjacent or overlapping ranges are - // coalesced. - // - // range_runs are very space-economical in situations where there - // are lots of ranges and a few individual disjoint values. - // Searching is O(log n) where n is the number of ranges. - // - // { Low level implementation detail } - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT> - class range_run { - - public: - - typedef range<CharT> range_t; - typedef std::vector<range_t> run_t; - typedef typename run_t::iterator iterator; - typedef typename run_t::const_iterator const_iterator; - - void swap(range_run& rr); - bool test(CharT v) const; - void set(range_t const& r); - void clear(range_t const& r); - void clear(); - - const_iterator begin() const; - const_iterator end() const; - - private: - - void merge(iterator iter, range_t const& r); - - run_t run; - }; - -}}}} // namespace boost::spirit::utility::impl - -#endif - -#include <boost/spirit/butility/impl/chset/range_run.ipp> diff --git a/Utilities/BGL/boost/spirit/butility/impl/chset/range_run.ipp b/Utilities/BGL/boost/spirit/butility/impl/chset/range_run.ipp deleted file mode 100644 index 31ef425c8818b9550608341f57f08462f05824b0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/chset/range_run.ipp +++ /dev/null @@ -1,212 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_RANGE_RUN_IPP -#define BOOST_SPIRIT_RANGE_RUN_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <algorithm> // for std::lower_bound -#include <boost/spirit/core/assert.hpp> // for BOOST_SPIRIT_ASSERT -#include <boost/spirit/butility/impl/chset/range_run.hpp> -#include <boost/spirit/debug.hpp> -#include <boost/limits.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - namespace utility { namespace impl { - - /////////////////////////////////////////////////////////////////////// - // - // range class implementation - // - /////////////////////////////////////////////////////////////////////// - template <typename CharT> - inline range<CharT>::range(CharT first_, CharT last_) - : first(first_), last(last_) {} - - ////////////////////////////////// - template <typename CharT> - inline bool - range<CharT>::is_valid() const - { return first <= last; } - - ////////////////////////////////// - template <typename CharT> - inline bool - range<CharT>::includes(range const& r) const - { return (first <= r.first) && (last >= r.last); } - - ////////////////////////////////// - template <typename CharT> - inline bool - range<CharT>::includes(CharT v) const - { return (first <= v) && (last >= v); } - - ////////////////////////////////// - template <typename CharT> - inline bool - range<CharT>::overlaps(range const& r) const - { - CharT decr_first = - first == (std::numeric_limits<CharT>::min)() ? first : first-1; - CharT incr_last = - last == (std::numeric_limits<CharT>::max)() ? last : last+1; - - return (decr_first <= r.last) && (incr_last >= r.first); - } - - ////////////////////////////////// - template <typename CharT> - inline void - range<CharT>::merge(range const& r) - { - first = (std::min)(first, r.first); - last = (std::max)(last, r.last); - } - - /////////////////////////////////////////////////////////////////////// - // - // range_run class implementation - // - /////////////////////////////////////////////////////////////////////// - template <typename CharT> - inline bool - range_run<CharT>::test(CharT v) const - { - if (!run.empty()) - { - const_iterator iter = - std::lower_bound( - run.begin(), run.end(), v, - range_char_compare<CharT>() - ); - - if (iter != run.end() && iter->includes(v)) - return true; - if (iter != run.begin()) - return (--iter)->includes(v); - } - return false; - } - - ////////////////////////////////// - template <typename CharT> - inline void - range_run<CharT>::swap(range_run& rr) - { run.swap(rr.run); } - - ////////////////////////////////// - template <typename CharT> - void - range_run<CharT>::merge(iterator iter, range<CharT> const& r) - { - iter->merge(r); - iterator i = iter + 1; - - while (i != run.end() && iter->overlaps(*i)) - iter->merge(*i++); - - run.erase(iter+1, i); - } - - ////////////////////////////////// - template <typename CharT> - void - range_run<CharT>::set(range<CharT> const& r) - { - BOOST_SPIRIT_ASSERT(r.is_valid()); - if (!run.empty()) - { - iterator iter = - std::lower_bound( - run.begin(), run.end(), r, - range_compare<CharT>() - ); - - if (iter != run.end() && iter->includes(r) || - ((iter != run.begin()) && (iter - 1)->includes(r))) - return; - - if (iter != run.begin() && (iter - 1)->overlaps(r)) - merge(--iter, r); - - else if (iter != run.end() && iter->overlaps(r)) - merge(iter, r); - - else - run.insert(iter, r); - } - else - { - run.push_back(r); - } - } - - ////////////////////////////////// - template <typename CharT> - void - range_run<CharT>::clear(range<CharT> const& r) - { - BOOST_SPIRIT_ASSERT(r.is_valid()); - if (!run.empty()) - { - iterator iter = - std::lower_bound( - run.begin(), run.end(), r, - range_compare<CharT>() - ); - - iterator left_iter; - - if ((iter != run.begin()) && - (left_iter = (iter - 1))->includes(r.first)) - if (left_iter->last > r.last) - { - CharT save_last = left_iter->last; - left_iter->last = r.first-1; - run.insert(iter, range<CharT>(r.last+1, save_last)); - return; - } - else - { - left_iter->last = r.first-1; - } - - iterator i = iter; - while (i != run.end() && r.includes(*i)) - i++; - if (i != run.end() && i->includes(r.last)) - i->first = r.last+1; - run.erase(iter, i); - } - } - - ////////////////////////////////// - template <typename CharT> - inline void - range_run<CharT>::clear() - { run.clear(); } - - ////////////////////////////////// - template <typename CharT> - inline typename range_run<CharT>::const_iterator - range_run<CharT>::begin() const - { return run.begin(); } - - ////////////////////////////////// - template <typename CharT> - inline typename range_run<CharT>::const_iterator - range_run<CharT>::end() const - { return run.end(); } - - }} // namespace utility::impl - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/butility/impl/chset_operators.ipp b/Utilities/BGL/boost/spirit/butility/impl/chset_operators.ipp deleted file mode 100644 index dddbcea07a3b0e37e9f7e399ca04209dc52ce56c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/chset_operators.ipp +++ /dev/null @@ -1,662 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CHSET_OPERATORS_IPP -#define BOOST_SPIRIT_CHSET_OPERATORS_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/limits.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) |= b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) -= b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator~(chset<CharT> const& a) -{ - return chset<CharT>(a).inverse(); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) &= b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) ^= b; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// range <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const& a, range<CharT> const& b) -{ - chset<CharT> a_(a); - a_.set(b); - return a_; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& a, range<CharT> const& b) -{ - chset<CharT> a_(a); - if(b.first != (std::numeric_limits<CharT>::min)()) { - a_.clear(range<CharT>((std::numeric_limits<CharT>::min)(), b.first - 1)); - } - if(b.last != (std::numeric_limits<CharT>::max)()) { - a_.clear(range<CharT>(b.last + 1, (std::numeric_limits<CharT>::max)())); - } - return a_; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const& a, range<CharT> const& b) -{ - chset<CharT> a_(a); - a_.clear(b); - return a_; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, range<CharT> const& b) -{ - return a ^ chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(range<CharT> const& a, chset<CharT> const& b) -{ - chset<CharT> b_(b); - b_.set(a); - return b_; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(range<CharT> const& a, chset<CharT> const& b) -{ - chset<CharT> b_(b); - if(a.first != (std::numeric_limits<CharT>::min)()) { - b_.clear(range<CharT>((std::numeric_limits<CharT>::min)(), a.first - 1)); - } - if(a.last != (std::numeric_limits<CharT>::max)()) { - b_.clear(range<CharT>(a.last + 1, (std::numeric_limits<CharT>::max)())); - } - return b_; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(range<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) - b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(range<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) ^ b; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// literal primitives <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const& a, CharT b) -{ - return a | chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& a, CharT b) -{ - return a & chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const& a, CharT b) -{ - return a - chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, CharT b) -{ - return a ^ chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(CharT a, chset<CharT> const& b) -{ - return chset<CharT>(a) | b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(CharT a, chset<CharT> const& b) -{ - return chset<CharT>(a) & b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(CharT a, chset<CharT> const& b) -{ - return chset<CharT>(a) - b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(CharT a, chset<CharT> const& b) -{ - return chset<CharT>(a) ^ b; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// chlit <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const& a, chlit<CharT> const& b) -{ - return a | chset<CharT>(b.ch); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& a, chlit<CharT> const& b) -{ - return a & chset<CharT>(b.ch); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const& a, chlit<CharT> const& b) -{ - return a - chset<CharT>(b.ch); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, chlit<CharT> const& b) -{ - return a ^ chset<CharT>(b.ch); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chlit<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a.ch) | b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chlit<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a.ch) & b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chlit<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a.ch) - b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chlit<CharT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a.ch) ^ b; -} - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -/////////////////////////////////////////////////////////////////////////////// -// -// negated_char_parser <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator|(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a | chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator&(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a & chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator-(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a - chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator^(chset<CharT> const& a, negated_char_parser<ParserT> const& b) -{ - return a ^ chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator|(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) | b; -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator&(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) & b; -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator-(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) - b; -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline chset<CharT> -operator^(negated_char_parser<ParserT> const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) ^ b; -} - -#else // BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -/////////////////////////////////////////////////////////////////////////////// -// -// negated_char_parser<range> <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) -{ - return a | chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) -{ - return a & chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) -{ - return a - chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b) -{ - return a ^ chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) | b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) & b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) - b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) ^ b; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// negated_char_parser<chlit> <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) -{ - return a | chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) -{ - return a & chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) -{ - return a - chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b) -{ - return a ^ chset<CharT>(b); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) | b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) & b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) - b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b) -{ - return chset<CharT>(a) ^ b; -} - -#endif // BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -/////////////////////////////////////////////////////////////////////////////// -// -// anychar_parser <--> chset free operators -// -// Where a is chset and b is a anychar_parser, and vice-versa, implements: -// -// a | b, a & b, a - b, a ^ b -// -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - - template <typename CharT> - inline boost::spirit::range<CharT> const& - full() - { - static boost::spirit::range<CharT> full_( - (std::numeric_limits<CharT>::min)(), - (std::numeric_limits<CharT>::max)()); - return full_; - } - - template <typename CharT> - inline boost::spirit::range<CharT> const& - empty() - { - static boost::spirit::range<CharT> empty_; - return empty_; - } -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const&, anychar_parser) -{ - return chset<CharT>(impl::full<CharT>()); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& a, anychar_parser) -{ - return a; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const&, anychar_parser) -{ - return chset<CharT>(); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, anychar_parser) -{ - return ~a; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(anychar_parser, chset<CharT> const& /*b*/) -{ - return chset<CharT>(impl::full<CharT>()); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(anychar_parser, chset<CharT> const& b) -{ - return b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(anychar_parser, chset<CharT> const& b) -{ - return ~b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(anychar_parser, chset<CharT> const& b) -{ - return ~b; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// nothing_parser <--> chset free operators implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(chset<CharT> const& a, nothing_parser) -{ - return a; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(chset<CharT> const& /*a*/, nothing_parser) -{ - return impl::empty<CharT>(); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(chset<CharT> const& a, nothing_parser) -{ - return a; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(chset<CharT> const& a, nothing_parser) -{ - return a; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator|(nothing_parser, chset<CharT> const& b) -{ - return b; -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator&(nothing_parser, chset<CharT> const& /*b*/) -{ - return impl::empty<CharT>(); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator-(nothing_parser, chset<CharT> const& /*b*/) -{ - return impl::empty<CharT>(); -} - -////////////////////////////////// -template <typename CharT> -inline chset<CharT> -operator^(nothing_parser, chset<CharT> const& b) -{ - return b; -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/butility/impl/confix.ipp b/Utilities/BGL/boost/spirit/butility/impl/confix.ipp deleted file mode 100644 index 1b1b5dc21fa12baab10d2dd0e5a731141c5a3099..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/confix.ipp +++ /dev/null @@ -1,217 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CONFIX_IPP -#define BOOST_SPIRIT_CONFIX_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/meta/refactoring.hpp> -#include <boost/spirit/core/composite/impl/directives.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// Types to distinguish nested and non-nested confix parsers -// -/////////////////////////////////////////////////////////////////////////////// -struct is_nested {}; -struct non_nested {}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Types to distinguish between confix parsers, which are implicitly lexems -// and without this behaviour -// -/////////////////////////////////////////////////////////////////////////////// -struct is_lexeme {}; -struct non_lexeme {}; - -/////////////////////////////////////////////////////////////////////////////// -// -// confix_parser_type class implementation -// -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - - /////////////////////////////////////////////////////////////////////////// - // implicitly insert a lexeme_d into the parsing process - - template <typename LexemeT> - struct select_confix_parse_lexeme; - - template <> - struct select_confix_parse_lexeme<is_lexeme> { - - template <typename ParserT, typename ScannerT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const& p, ScannerT const& scan) - { - typedef typename parser_result<ParserT, ScannerT>::type result_t; - return contiguous_parser_parse<result_t>(p, scan, scan); - } - }; - - template <> - struct select_confix_parse_lexeme<non_lexeme> { - - template <typename ParserT, typename ScannerT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const& p, ScannerT const& scan) - { - return p.parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // parse confix sequences with refactoring - - template <typename NestedT> - struct select_confix_parse_refactor; - - template <> - struct select_confix_parse_refactor<is_nested> { - - template < - typename LexemeT, typename ParserT, typename ScannerT, - typename OpenT, typename ExprT, typename CloseT - > - static typename parser_result<ParserT, ScannerT>::type - parse( - LexemeT const &, ParserT const& this_, ScannerT const& scan, - OpenT const& open, ExprT const& expr, CloseT const& close) - { - typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; - const refactor_t refactor_body_d = refactor_t(refactor_unary_d); - - return select_confix_parse_lexeme<LexemeT>::parse(( - open - >> (this_ | refactor_body_d[expr - close]) - >> close - ), scan); - } - }; - - template <> - struct select_confix_parse_refactor<non_nested> { - - template < - typename LexemeT, typename ParserT, typename ScannerT, - typename OpenT, typename ExprT, typename CloseT - > - static typename parser_result<ParserT, ScannerT>::type - parse( - LexemeT const &, ParserT const& /*this_*/, ScannerT const& scan, - OpenT const& open, ExprT const& expr, CloseT const& close) - { - typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; - const refactor_t refactor_body_d = refactor_t(refactor_unary_d); - - return select_confix_parse_lexeme<LexemeT>::parse(( - open - >> refactor_body_d[expr - close] - >> close - ), scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // parse confix sequences without refactoring - - template <typename NestedT> - struct select_confix_parse_no_refactor; - - template <> - struct select_confix_parse_no_refactor<is_nested> { - - template < - typename LexemeT, typename ParserT, typename ScannerT, - typename OpenT, typename ExprT, typename CloseT - > - static typename parser_result<ParserT, ScannerT>::type - parse( - LexemeT const &, ParserT const& this_, ScannerT const& scan, - OpenT const& open, ExprT const& expr, CloseT const& close) - { - return select_confix_parse_lexeme<LexemeT>::parse(( - open - >> (this_ | (expr - close)) - >> close - ), scan); - } - }; - - template <> - struct select_confix_parse_no_refactor<non_nested> { - - template < - typename LexemeT, typename ParserT, typename ScannerT, - typename OpenT, typename ExprT, typename CloseT - > - static typename parser_result<ParserT, ScannerT>::type - parse( - LexemeT const &, ParserT const & /*this_*/, ScannerT const& scan, - OpenT const& open, ExprT const& expr, CloseT const& close) - { - return select_confix_parse_lexeme<LexemeT>::parse(( - open - >> (expr - close) - >> close - ), scan); - } - }; - - // the refactoring is handled by the refactoring parsers, so here there - // is no need to pay attention to these issues. - - template <typename CategoryT> - struct confix_parser_type { - - template < - typename NestedT, typename LexemeT, - typename ParserT, typename ScannerT, - typename OpenT, typename ExprT, typename CloseT - > - static typename parser_result<ParserT, ScannerT>::type - parse( - NestedT const &, LexemeT const &lexeme, - ParserT const& this_, ScannerT const& scan, - OpenT const& open, ExprT const& expr, CloseT const& close) - { - return select_confix_parse_refactor<NestedT>:: - parse(lexeme, this_, scan, open, expr, close); - } - }; - - template <> - struct confix_parser_type<plain_parser_category> { - - template < - typename NestedT, typename LexemeT, - typename ParserT, typename ScannerT, - typename OpenT, typename ExprT, typename CloseT - > - static typename parser_result<ParserT, ScannerT>::type - parse( - NestedT const &, LexemeT const &lexeme, - ParserT const& this_, ScannerT const& scan, - OpenT const& open, ExprT const& expr, CloseT const& close) - { - return select_confix_parse_no_refactor<NestedT>:: - parse(lexeme, this_, scan, open, expr, close); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/butility/impl/escape_char.ipp b/Utilities/BGL/boost/spirit/butility/impl/escape_char.ipp deleted file mode 100644 index 85f27daba79c357240e39ea23c9f6d7c4481aefd..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/escape_char.ipp +++ /dev/null @@ -1,220 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ESCAPE_CHAR_IPP -#define BOOST_SPIRIT_ESCAPE_CHAR_IPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/numerics.hpp> -#include <boost/spirit/core/composite/difference.hpp> -#include <boost/spirit/core/composite/sequence.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// escape_char_parser class -// -/////////////////////////////////////////////////////////////////////////////// - -const unsigned long c_escapes = 1; -const unsigned long lex_escapes = c_escapes << 1; - -////////////////////////////////// -namespace impl { - - ////////////////////////////////// -#if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310)) -#pragma warning(push) -#pragma warning(disable:4127) -#endif - template <unsigned long Flags, typename CharT> - struct escape_char_action_parse { - - template <typename ParserT, typename ScannerT> - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan, ParserT const &p) - { - // Actually decode the escape char. - typedef CharT char_t; - typedef typename ScannerT::iterator_t iterator_t; - typedef typename parser_result<ParserT, ScannerT>::type result_t; - - if (scan.first != scan.last) { - - iterator_t save = scan.first; - if (result_t hit = p.subject().parse(scan)) { - - char_t unescaped; - - scan.first = save; - if (*scan.first == '\\') { - - ++scan.first; - switch (*scan.first) { - case 'b': unescaped = '\b'; ++scan.first; break; - case 't': unescaped = '\t'; ++scan.first; break; - case 'n': unescaped = '\n'; ++scan.first; break; - case 'f': unescaped = '\f'; ++scan.first; break; - case 'r': unescaped = '\r'; ++scan.first; break; - case '"': unescaped = '"'; ++scan.first; break; - case '\'': unescaped = '\''; ++scan.first; break; - case '\\': unescaped = '\\'; ++scan.first; break; - - case 'x': case 'X': - { - char_t hex = 0; - char_t const lim = - (std::numeric_limits<char_t>::max)() >> 4; - - ++scan.first; - while (scan.first != scan.last) - { - char_t c = *scan.first; - if (hex > lim && impl::isxdigit_(c)) - { - // overflow detected - scan.first = save; - return scan.no_match(); - } - if (impl::isdigit_(c)) - { - hex <<= 4; - hex |= c - '0'; - ++scan.first; - } - else if (impl::isxdigit_(c)) - { - hex <<= 4; - c = impl::toupper_(c); - hex |= c - 'A' + 0xA; - ++scan.first; - } - else - { - break; // reached the end of the number - } - } - unescaped = hex; - } - break; - - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - { - char_t oct = 0; - char_t const lim = - (std::numeric_limits<char_t>::max)() >> 3; - while (scan.first != scan.last) - { - char_t c = *scan.first; - if (oct > lim && (c >= '0' && c <= '7')) - { - // overflow detected - scan.first = save; - return scan.no_match(); - } - - if (c >= '0' && c <= '7') - { - oct <<= 3; - oct |= c - '0'; - ++scan.first; - } - else - { - break; // reached end of digits - } - } - unescaped = oct; - } - break; - - default: - if (Flags & c_escapes) - { - // illegal C escape sequence - scan.first = save; - return scan.no_match(); - } - else - { - unescaped = *scan.first; - ++scan.first; - } - break; - } - } - else { - unescaped = *scan.first; - ++scan.first; - } - - scan.do_action(p.predicate(), unescaped, save, scan.first); - return hit; - } - } - return scan.no_match(); // overflow detected - } - }; -#if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310)) -#pragma warning(pop) -#endif - - ////////////////////////////////// - template <typename CharT> - struct escape_char_parse { - - template <typename ScannerT, typename ParserT> - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const &scan, ParserT const &/*p*/) - { - typedef - uint_parser<CharT, 8, 1, - std::numeric_limits<CharT>::digits / 3 + 1 - > - oct_parser_t; - typedef - uint_parser<CharT, 16, 1, - std::numeric_limits<CharT>::digits / 4 + 1 - > - hex_parser_t; - - typedef alternative<difference<anychar_parser, chlit<CharT> >, - sequence<chlit<CharT>, alternative<alternative<oct_parser_t, - sequence<inhibit_case<chlit<CharT> >, hex_parser_t > >, - difference<difference<anychar_parser, - inhibit_case<chlit<CharT> > >, oct_parser_t > > > > - parser_t; - - static parser_t p = - ( (anychar_p - chlit<CharT>(CharT('\\'))) - | (chlit<CharT>(CharT('\\')) >> - ( oct_parser_t() - | as_lower_d[chlit<CharT>(CharT('x'))] >> hex_parser_t() - | (anychar_p - as_lower_d[chlit<CharT>(CharT('x'))] - oct_parser_t()) - ) - )); - - BOOST_SPIRIT_DEBUG_TRACE_NODE(p, - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_ESCAPE_CHAR) != 0); - - return p.parse(scan); - } - }; - -/////////////////////////////////////////////////////////////////////////////// -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/butility/impl/lists.ipp b/Utilities/BGL/boost/spirit/butility/impl/lists.ipp deleted file mode 100644 index 43662fb15d837d8014904e960a5f28fa93e5ed0a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/lists.ipp +++ /dev/null @@ -1,164 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_LISTS_IPP -#define BOOST_SPIRIT_LISTS_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/meta/refactoring.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// list_parser_type class implementation -// -/////////////////////////////////////////////////////////////////////////////// -struct no_list_endtoken { typedef no_list_endtoken embed_t; }; - -namespace impl { - -/////////////////////////////////////////////////////////////////////////////// -// -// Refactor the original list item parser -// -/////////////////////////////////////////////////////////////////////////////// - - // match list with 'extended' syntax - template <typename EndT> - struct select_list_parse_refactor { - - template < - typename ParserT, typename ScannerT, - typename ItemT, typename DelimT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan, ParserT const& /*p*/, - ItemT const &item, DelimT const &delim, EndT const &end) - { - typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; - const refactor_t refactor_item_d = refactor_t(refactor_unary_d); - - return ( - refactor_item_d[item - (end | delim)] - >> *(delim >> refactor_item_d[item - (end | delim)]) - >> !(delim >> end) - ).parse(scan); - } - }; - - // match list with 'normal' syntax (without an 'end' parser) - template <> - struct select_list_parse_refactor<no_list_endtoken> { - - template < - typename ParserT, typename ScannerT, - typename ItemT, typename DelimT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan, ParserT const& /*p*/, - ItemT const &item, DelimT const &delim, no_list_endtoken const&) - { - typedef refactor_action_gen<refactor_unary_gen<> > refactor_t; - const refactor_t refactor_item_d = refactor_t(refactor_unary_d); - - return ( - refactor_item_d[item - delim] - >> *(delim >> refactor_item_d[item - delim]) - ).parse(scan); - } - }; - -/////////////////////////////////////////////////////////////////////////////// -// -// Do not refactor the original list item parser. -// -/////////////////////////////////////////////////////////////////////////////// - - // match list with 'extended' syntax - template <typename EndT> - struct select_list_parse_no_refactor { - - template < - typename ParserT, typename ScannerT, - typename ItemT, typename DelimT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan, ParserT const& /*p*/, - ItemT const &item, DelimT const &delim, EndT const &end) - { - return ( - (item - (end | delim)) - >> *(delim >> (item - (end | delim))) - >> !(delim >> end) - ).parse(scan); - } - }; - - // match list with 'normal' syntax (without an 'end' parser) - template <> - struct select_list_parse_no_refactor<no_list_endtoken> { - - template < - typename ParserT, typename ScannerT, - typename ItemT, typename DelimT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan, ParserT const& /*p*/, - ItemT const &item, DelimT const &delim, no_list_endtoken const&) - { - return ( - (item - delim) - >> *(delim >> (item - delim)) - ).parse(scan); - } - }; - - // the refactoring is handled by the refactoring parsers, so here there - // is no need to pay attention to these issues. - - template <typename CategoryT> - struct list_parser_type { - - template < - typename ParserT, typename ScannerT, - typename ItemT, typename DelimT, typename EndT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan, ParserT const& p, - ItemT const &item, DelimT const &delim, EndT const &end) - { - return select_list_parse_refactor<EndT>:: - parse(scan, p, item, delim, end); - } - }; - - template <> - struct list_parser_type<plain_parser_category> { - - template < - typename ParserT, typename ScannerT, - typename ItemT, typename DelimT, typename EndT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan, ParserT const& p, - ItemT const &item, DelimT const &delim, EndT const &end) - { - return select_list_parse_no_refactor<EndT>:: - parse(scan, p, item, delim, end); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/butility/impl/regex.ipp b/Utilities/BGL/boost/spirit/butility/impl/regex.ipp deleted file mode 100644 index bb054808f1dee91f6ad2f518e1e5ada5fd3fea1e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/impl/regex.ipp +++ /dev/null @@ -1,77 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_REGEX_IPP -#define BOOST_SPIRIT_REGEX_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/primitives/impl/primitives.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -namespace impl { - -/////////////////////////////////////////////////////////////////////////////// -// -inline const char* rx_prefix(char) { return "\\A"; } -inline const wchar_t* rx_prefix(wchar_t) { return L"\\A"; } - -/////////////////////////////////////////////////////////////////////////////// -// -// rx_parser class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CharT = char> -class rx_parser : public parser<rx_parser<CharT> > { - -public: - typedef std::basic_string<CharT> string_t; - typedef rx_parser<CharT> self_t; - - rx_parser(CharT const *first, CharT const *last) - { - rxstr = string_t(rx_prefix(CharT())) + string_t(first, last); - } - - rx_parser(CharT const *first) - { - rxstr = string_t(rx_prefix(CharT())) + - string_t(first, impl::get_last(first)); - } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - boost::match_results<typename ScannerT::iterator_t> what; - boost::regex_search(scan.first, scan.last, what, rxstr, - boost::match_default); - - if (!what[0].matched) - return scan.no_match(); - - scan.first = what[0].second; - return scan.create_match(what[0].length(), nil_t(), - what[0].first, scan.first); - } - -private: -#if BOOST_VERSION >= 013300 - boost::basic_regex<CharT> rxstr; // regular expression to match -#else - boost::reg_expression<CharT> rxstr; // regular expression to match -#endif -}; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_REGEX_IPP diff --git a/Utilities/BGL/boost/spirit/butility/lists.hpp b/Utilities/BGL/boost/spirit/butility/lists.hpp deleted file mode 100644 index 7e7e4c7cf5f643124d38891a42265df1ee1dc694..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/lists.hpp +++ /dev/null @@ -1,335 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_LISTS_HPP -#define BOOST_SPIRIT_LISTS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/config.hpp> -#include <boost/spirit/meta/as_parser.hpp> -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/butility/impl/lists.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// list_parser class -// -// List parsers allow to parse constructs like -// -// item >> *(delim >> item) -// -// where 'item' is an auxiliary expression to parse and 'delim' is an -// auxiliary delimiter to parse. -// -// The list_parser class also can match an optional closing delimiter -// represented by the 'end' parser at the end of the list: -// -// item >> *(delim >> item) >> !end. -// -// If ItemT is an action_parser_category type (parser with an attached -// semantic action) we have to do something special. This happens, if the -// user wrote something like: -// -// list_p(item[f], delim) -// -// where 'item' is the parser matching one item of the list sequence and -// 'f' is a functor to be called after matching one item. If we would do -// nothing, the resulting code would parse the sequence as follows: -// -// (item[f] - delim) >> *(delim >> (item[f] - delim)) -// -// what in most cases is not what the user expects. -// (If this _is_ what you've expected, then please use one of the list_p -// generator functions 'direct()', which will inhibit re-attaching -// the actor to the item parser). -// -// To make the list parser behave as expected: -// -// (item - delim)[f] >> *(delim >> (item - delim)[f]) -// -// the actor attached to the 'item' parser has to be re-attached to the -// *(item - delim) parser construct, which will make the resulting list -// parser 'do the right thing'. -// -// Additionally special care must be taken, if the item parser is a -// unary_parser_category type parser as -// -// list_p(*anychar_p, ',') -// -// which without any refactoring would result in -// -// (*anychar_p - ch_p(',')) -// >> *( ch_p(',') >> (*anychar_p - ch_p(',')) ) -// -// and will not give the expected result (the first *anychar_p will eat up -// all the input up to the end of the input stream). So we have to -// refactor this into: -// -// *(anychar_p - ch_p(',')) -// >> *( ch_p(',') >> *(anychar_p - ch_p(',')) ) -// -// what will give the correct result. -// -// The case, where the item parser is a combination of the two mentioned -// problems (i.e. the item parser is a unary parser with an attached -// action), is handled accordingly too: -// -// list_p((*anychar_p)[f], ',') -// -// will be parsed as expected: -// -// (*(anychar_p - ch_p(',')))[f] -// >> *( ch_p(',') >> (*(anychar_p - ch_p(',')))[f] ). -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename ItemT, typename DelimT, typename EndT = no_list_endtoken, - typename CategoryT = plain_parser_category -> -struct list_parser : - public parser<list_parser<ItemT, DelimT, EndT, CategoryT> > { - - typedef list_parser<ItemT, DelimT, EndT, CategoryT> self_t; - typedef CategoryT parser_category_t; - - list_parser(ItemT const &item_, DelimT const &delim_, - EndT const& end_ = no_list_endtoken()) - : item(item_), delim(delim_), end(end_) - {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return impl::list_parser_type<CategoryT> - ::parse(scan, *this, item, delim, end); - } - -private: - typename as_parser<ItemT>::type::embed_t item; - typename as_parser<DelimT>::type::embed_t delim; - typename as_parser<EndT>::type::embed_t end; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// List parser generator template -// -// This is a helper for generating a correct list_parser<> from -// auxiliary parameters. There are the following types supported as -// parameters yet: parsers, single characters and strings (see -// as_parser<> in meta/as_parser.hpp). -// -// The list_parser_gen by itself can be used for parsing comma separated -// lists without item formatting: -// -// list_p.parse(...) -// matches any comma separated list. -// -// If list_p is used with one parameter, this parameter is used to match -// the delimiter: -// -// list_p(';').parse(...) -// matches any semicolon separated list. -// -// If list_p is used with two parameters, the first parameter is used to -// match the items and the second parameter matches the delimiters: -// -// list_p(uint_p, ',').parse(...) -// matches comma separated unsigned integers. -// -// If list_p is used with three parameters, the first parameter is used -// to match the items, the second one is used to match the delimiters and -// the third one is used to match an optional ending token sequence: -// -// list_p(real_p, ';', eol_p).parse(...) -// matches a semicolon separated list of real numbers optionally -// followed by an end of line. -// -// The list_p in the previous examples denotes the predefined parser -// generator, which should be used to define list parsers (see below). -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename CharT = char> -struct list_parser_gen : - public list_parser<kleene_star<anychar_parser>, chlit<CharT> > -{ - typedef list_parser_gen<CharT> self_t; - -// construct the list_parser_gen object as an list parser for comma separated -// lists without item formatting. - list_parser_gen() - : list_parser<kleene_star<anychar_parser>, chlit<CharT> > - (*anychar_p, chlit<CharT>(',')) - {} - -// The following generator functions should be used under normal circumstances. -// (the operator()(...) functions) - - // Generic generator functions for creation of concrete list parsers, which - // support 'normal' syntax: - // - // item >> *(delim >> item) - // - // If item isn't given, everything between two delimiters is matched. - - template<typename DelimT> - list_parser< - kleene_star<anychar_parser>, - typename as_parser<DelimT>::type, - no_list_endtoken, - unary_parser_category // there is no action to re-attach - > - operator()(DelimT const &delim_) const - { - typedef kleene_star<anychar_parser> item_t; - typedef typename as_parser<DelimT>::type delim_t; - - typedef - list_parser<item_t, delim_t, no_list_endtoken, unary_parser_category> - return_t; - - return return_t(*anychar_p, as_parser<DelimT>::convert(delim_)); - } - - template<typename ItemT, typename DelimT> - list_parser< - typename as_parser<ItemT>::type, - typename as_parser<DelimT>::type, - no_list_endtoken, - typename as_parser<ItemT>::type::parser_category_t - > - operator()(ItemT const &item_, DelimT const &delim_) const - { - typedef typename as_parser<ItemT>::type item_t; - typedef typename as_parser<DelimT>::type delim_t; - typedef list_parser<item_t, delim_t, no_list_endtoken, - BOOST_DEDUCED_TYPENAME item_t::parser_category_t> - return_t; - - return return_t( - as_parser<ItemT>::convert(item_), - as_parser<DelimT>::convert(delim_) - ); - } - - // Generic generator function for creation of concrete list parsers, which - // support 'extended' syntax: - // - // item >> *(delim >> item) >> !end - - template<typename ItemT, typename DelimT, typename EndT> - list_parser< - typename as_parser<ItemT>::type, - typename as_parser<DelimT>::type, - typename as_parser<EndT>::type, - typename as_parser<ItemT>::type::parser_category_t - > - operator()( - ItemT const &item_, DelimT const &delim_, EndT const &end_) const - { - typedef typename as_parser<ItemT>::type item_t; - typedef typename as_parser<DelimT>::type delim_t; - typedef typename as_parser<EndT>::type end_t; - - typedef list_parser<item_t, delim_t, end_t, - BOOST_DEDUCED_TYPENAME item_t::parser_category_t> - return_t; - - return return_t( - as_parser<ItemT>::convert(item_), - as_parser<DelimT>::convert(delim_), - as_parser<EndT>::convert(end_) - ); - } - -// The following functions should be used, if the 'item' parser has an attached -// semantic action or is a unary_parser_category type parser and the structure -// of the resulting list parser should _not_ be refactored during parser -// construction (see comment above). - - // Generic generator function for creation of concrete list parsers, which - // support 'normal' syntax: - // - // item >> *(delim >> item) - - template<typename ItemT, typename DelimT> - list_parser< - typename as_parser<ItemT>::type, - typename as_parser<DelimT>::type, - no_list_endtoken, - plain_parser_category // inhibit action re-attachment - > - direct(ItemT const &item_, DelimT const &delim_) const - { - typedef typename as_parser<ItemT>::type item_t; - typedef typename as_parser<DelimT>::type delim_t; - typedef list_parser<item_t, delim_t, no_list_endtoken, - plain_parser_category> - return_t; - - return return_t( - as_parser<ItemT>::convert(item_), - as_parser<DelimT>::convert(delim_) - ); - } - - // Generic generator function for creation of concrete list parsers, which - // support 'extended' syntax: - // - // item >> *(delim >> item) >> !end - - template<typename ItemT, typename DelimT, typename EndT> - list_parser< - typename as_parser<ItemT>::type, - typename as_parser<DelimT>::type, - typename as_parser<EndT>::type, - plain_parser_category // inhibit action re-attachment - > - direct( - ItemT const &item_, DelimT const &delim_, EndT const &end_) const - { - typedef typename as_parser<ItemT>::type item_t; - typedef typename as_parser<DelimT>::type delim_t; - typedef typename as_parser<EndT>::type end_t; - - typedef - list_parser<item_t, delim_t, end_t, plain_parser_category> - return_t; - - return return_t( - as_parser<ItemT>::convert(item_), - as_parser<DelimT>::convert(delim_), - as_parser<EndT>::convert(end_) - ); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Predefined list parser generator -// -// The list_p parser generator can be used -// - by itself for parsing comma separated lists without item formatting -// or -// - for generating list parsers with auxiliary parser parameters -// for the 'item', 'delim' and 'end' subsequences. -// (see comment above) -// -/////////////////////////////////////////////////////////////////////////////// -const list_parser_gen<> list_p = list_parser_gen<>(); - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/butility/loops.hpp b/Utilities/BGL/boost/spirit/butility/loops.hpp deleted file mode 100644 index f42776a029f0f9a71c647692357a44caac4d9dcb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/loops.hpp +++ /dev/null @@ -1,313 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2002 Raghavendra Satish - Copyright (c) 2002 Jeff Westfahl - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_LOOPS_HPP) -#define BOOST_SPIRIT_LOOPS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // fixed_loop class - // - // This class takes care of the construct: - // - // repeat_p (exact) [p] - // - // where 'p' is a parser and 'exact' is the number of times to - // repeat. The parser iterates over the input exactly 'exact' times. - // The parse function fails if the parser does not match the input - // exactly 'exact' times. - // - // This class is parametizable and can accept constant arguments - // (e.g. repeat_p (5) [p]) as well as references to variables (e.g. - // repeat_p (ref (n)) [p]). - // - /////////////////////////////////////////////////////////////////////////// - template <typename ParserT, typename ExactT> - class fixed_loop - : public unary<ParserT, parser <fixed_loop <ParserT, ExactT> > > - { - public: - - typedef fixed_loop<ParserT, ExactT> self_t; - typedef unary<ParserT, parser<self_t> > base_t; - - fixed_loop (ParserT const & subject, ExactT const & exact) - : base_t(subject), m_exact(exact) {} - - template <typename ScannerT> - typename parser_result <self_t, ScannerT>::type - parse (ScannerT const & scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - result_t hit = scan.empty_match(); - std::size_t n = m_exact; - - for (std::size_t i = 0; i < n; ++i) - { - if (result_t next = this->subject().parse(scan)) - { - scan.concat_match(hit, next); - } - else - { - return scan.no_match(); - } - } - - return hit; - } - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - private: - - ExactT m_exact; - }; - - /////////////////////////////////////////////////////////////////////////////// - // - // finite_loop class - // - // This class takes care of the construct: - // - // repeat_p (min, max) [p] - // - // where 'p' is a parser, 'min' and 'max' specifies the minimum and - // maximum iterations over 'p'. The parser iterates over the input - // at least 'min' times and at most 'max' times. The parse function - // fails if the parser does not match the input at least 'min' times - // and at most 'max' times. - // - // This class is parametizable and can accept constant arguments - // (e.g. repeat_p (5, 10) [p]) as well as references to variables - // (e.g. repeat_p (ref (n1), ref (n2)) [p]). - // - /////////////////////////////////////////////////////////////////////////////// - template <typename ParserT, typename MinT, typename MaxT> - class finite_loop - : public unary<ParserT, parser<finite_loop<ParserT, MinT, MaxT> > > - { - public: - - typedef finite_loop <ParserT, MinT, MaxT> self_t; - typedef unary<ParserT, parser<self_t> > base_t; - - finite_loop (ParserT const & subject, MinT const & min, MaxT const & max) - : base_t(subject), m_min(min), m_max(max) {} - - template <typename ScannerT> - typename parser_result <self_t, ScannerT>::type - parse(ScannerT const & scan) const - { - BOOST_SPIRIT_ASSERT(m_min <= m_max); - typedef typename parser_result<self_t, ScannerT>::type result_t; - result_t hit = scan.empty_match(); - - std::size_t n1 = m_min; - std::size_t n2 = m_max; - - for (std::size_t i = 0; i < n2; ++i) - { - typename ScannerT::iterator_t save = scan.first; - result_t next = this->subject().parse(scan); - - if (!next) - { - if (i >= n1) - { - scan.first = save; - break; - } - else - { - return scan.no_match(); - } - } - - scan.concat_match(hit, next); - } - - return hit; - } - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - private: - - MinT m_min; - MaxT m_max; - }; - - /////////////////////////////////////////////////////////////////////////////// - // - // infinite_loop class - // - // This class takes care of the construct: - // - // repeat_p (min, more) [p] - // - // where 'p' is a parser, 'min' is the minimum iteration over 'p' - // and more specifies that the iteration should proceed - // indefinitely. The parser iterates over the input at least 'min' - // times and continues indefinitely until 'p' fails or all of the - // input is parsed. The parse function fails if the parser does not - // match the input at least 'min' times. - // - // This class is parametizable and can accept constant arguments - // (e.g. repeat_p (5, more) [p]) as well as references to variables - // (e.g. repeat_p (ref (n), more) [p]). - // - /////////////////////////////////////////////////////////////////////////////// - - struct more_t {}; - more_t const more = more_t (); - - template <typename ParserT, typename MinT> - class infinite_loop - : public unary<ParserT, parser<infinite_loop<ParserT, MinT> > > - { - public: - - typedef infinite_loop <ParserT, MinT> self_t; - typedef unary<ParserT, parser<self_t> > base_t; - - infinite_loop ( - ParserT const& subject, - MinT const& min, - more_t const& - ) - : base_t(subject), m_min(min) {} - - template <typename ScannerT> - typename parser_result <self_t, ScannerT>::type - parse(ScannerT const & scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - result_t hit = scan.empty_match(); - std::size_t n = m_min; - - for (std::size_t i = 0; ; ++i) - { - typename ScannerT::iterator_t save = scan.first; - result_t next = this->subject().parse(scan); - - if (!next) - { - if (i >= n) - { - scan.first = save; - break; - } - else - { - return scan.no_match(); - } - } - - scan.concat_match(hit, next); - } - - return hit; - } - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - private: - - MinT m_min; - }; - - template <typename ExactT> - struct fixed_loop_gen - { - fixed_loop_gen (ExactT const & exact) - : m_exact (exact) {} - - template <typename ParserT> - fixed_loop <ParserT, ExactT> - operator[](parser <ParserT> const & subject) const - { - return fixed_loop <ParserT, ExactT> (subject.derived (), m_exact); - } - - ExactT m_exact; - }; - - namespace impl { - - template <typename ParserT, typename MinT, typename MaxT> - struct loop_traits - { - typedef typename mpl::if_< - boost::is_same<MaxT, more_t>, - infinite_loop<ParserT, MinT>, - finite_loop<ParserT, MinT, MaxT> - >::type type; - }; - - } // namespace impl - - template <typename MinT, typename MaxT> - struct nonfixed_loop_gen - { - nonfixed_loop_gen (MinT min, MaxT max) - : m_min (min), m_max (max) {} - - template <typename ParserT> - typename impl::loop_traits<ParserT, MinT, MaxT>::type - operator[](parser <ParserT> const & subject) const - { - typedef typename impl::loop_traits<ParserT, MinT, MaxT>::type ret_t; - return ret_t( - subject.derived(), - m_min, - m_max); - } - - MinT m_min; - MaxT m_max; - }; - - template <typename ExactT> - fixed_loop_gen <ExactT> - repeat_p(ExactT const & exact) - { - return fixed_loop_gen <ExactT> (exact); - } - - template <typename MinT, typename MaxT> - nonfixed_loop_gen <MinT, MaxT> - repeat_p(MinT const & min, MaxT const & max) - { - return nonfixed_loop_gen <MinT, MaxT> (min, max); - } - -}} // namespace boost::spirit - -#endif // #if !defined(BOOST_SPIRIT_LOOPS_HPP) diff --git a/Utilities/BGL/boost/spirit/butility/regex.hpp b/Utilities/BGL/boost/spirit/butility/regex.hpp deleted file mode 100644 index 9066d49020356bfa3fbc4f7f833b96de2fb4df87..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/regex.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_REGEX_HPP -#define BOOST_SPIRIT_REGEX_HPP - -#include <boost/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Include the regular expression library of boost (Boost.Regex) -// -// Note though, that this library is not distributed with Spirit. You have to -// obtain a separate copy from http://www.boost.org. -// -/////////////////////////////////////////////////////////////////////////////// -#if defined(BOOST_SPIRIT_NO_REGEX_LIB) && BOOST_VERSION < 103300 -// -// Include all the Boost.regex library. Please note that this will not work, -// if you are using the boost/spirit/regex.hpp header from more than one -// translation units. -// -#define BOOST_REGEX_NO_LIB -#define BOOST_REGEX_STATIC_LINK -#define BOOST_REGEX_NO_EXTERNAL_TEMPLATES -#include <boost/regex.hpp> -#include <boost/regex/src.cpp> - -#else -// -// Include the Boost.Regex headers only. Note, that you will have to link your -// application against the Boost.Regex library as described in the related -// documentation. -// This is the only way for Boost newer than V1.32.0 -// -#include <boost/regex.hpp> -#endif // defined(BOOST_SPIRIT_NO_REGEX_LIB) - -#include <boost/static_assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/meta/as_parser.hpp> -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/butility/impl/regex.ipp> -#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// rxstrlit class -template <typename CharT = char> -struct rxstrlit : public parser<rxstrlit<CharT> > { - - typedef rxstrlit self_t; - - rxstrlit(CharT const *first, CharT const *last) - : rx(first, last) {} - rxstrlit(CharT const *first) - : rx(first) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - // Due to limitations in the boost::regex library the iterators wrapped in - // the ScannerT object should be at least bidirectional iterators. Plain - // forward iterators do not work here. - typedef typename ScannerT::iterator_t iterator_t; - typedef - typename boost::detail::iterator_traits<iterator_t>::iterator_category - iterator_category; - - BOOST_STATIC_ASSERT(( - boost::is_convertible<iterator_category, - std::bidirectional_iterator_tag>::value - )); - - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::contiguous_parser_parse<result_t>(rx, scan, scan); - } - -private: - impl::rx_parser<CharT> rx; // contains the boost regular expression parser -}; - -/////////////////////////////////////////////////////////////////////////////// -// Generator functions -template <typename CharT> -inline rxstrlit<CharT> -regex_p(CharT const *first) -{ return rxstrlit<CharT>(first); } - -////////////////////////////////// -template <typename CharT> -inline rxstrlit<CharT> -regex_p(CharT const *first, CharT const *last) -{ return rxstrlit<CharT>(first, last); } - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_REGEX_HPP diff --git a/Utilities/BGL/boost/spirit/butility/scoped_lock.hpp b/Utilities/BGL/boost/spirit/butility/scoped_lock.hpp deleted file mode 100644 index a22dd20a068d2206f3a3775aabf7d912c4b1f6f4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/butility/scoped_lock.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) - =============================================================================*/ -#ifndef BOOST_SPIRIT_UTILITY_SCOPED_LOCK_HPP -#define BOOST_SPIRIT_UTILITY_SCOPED_LOCK_HPP - -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_COMPOSITE_HPP) -#include <boost/spirit/core/composite.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // scoped_lock_parser class - // - // implements locking of a mutex during execution of - // the parse method of an embedded parser - // - /////////////////////////////////////////////////////////////////////////// - template <typename MutexT, typename ParserT> - struct scoped_lock_parser - : public unary< ParserT, parser< scoped_lock_parser<MutexT, ParserT> > > - { - typedef scoped_lock_parser<MutexT, ParserT> self_t; - typedef MutexT mutex_t; - typedef ParserT parser_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<parser_t, ScannerT>::type type; - }; - - scoped_lock_parser(mutex_t &m, parser_t const &p) - : unary< ParserT, parser< scoped_lock_parser<MutexT, ParserT> > >(p) - , mutex(m) - {} - - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const &scan) const - { - typedef typename mutex_t::scoped_lock scoped_lock_t; - scoped_lock_t lock(mutex); - return this->subject().parse(scan); - } - - mutex_t &mutex; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // scoped_lock_parser_gen - // - // generator for scoped_lock_parser objects - // operator[] returns scoped_lock_parser according to its argument - // - /////////////////////////////////////////////////////////////////////////// - template <typename MutexT> - struct scoped_lock_parser_gen - { - typedef MutexT mutex_t; - explicit scoped_lock_parser_gen(mutex_t &m) : mutex(m) {} - - template<typename ParserT> - scoped_lock_parser - < - MutexT, - typename as_parser<ParserT>::type - > - operator[](ParserT const &p) const - { - typedef ::boost::spirit::as_parser<ParserT> as_parser_t; - typedef typename as_parser_t::type parser_t; - - return scoped_lock_parser<mutex_t, parser_t> - (mutex, as_parser_t::convert(p)); - } - - mutex_t &mutex; - }; - - - /////////////////////////////////////////////////////////////////////////// - // - // scoped_lock_d parser directive - // - // constructs a scoped_lock_parser generator from its argument - // - /////////////////////////////////////////////////////////////////////////// - template <typename MutexT> - scoped_lock_parser_gen<MutexT> - scoped_lock_d(MutexT &mutex) - { - return scoped_lock_parser_gen<MutexT>(mutex); - } - -}} // namespace boost::spirit -#endif // BOOST_SPIRIT_UTILITY_SCOPED_LOCK_HPP diff --git a/Utilities/BGL/boost/spirit/core.hpp b/Utilities/BGL/boost/spirit/core.hpp deleted file mode 100644 index 2bcba62fc5483f048203a5b034dc8745bff6d5fc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core.hpp +++ /dev/null @@ -1,74 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2001-2003 Hartmut Kaiser - Copyright (c) 2002-2003 Martin Wille - Copyright (c) 2002 Raghavendra Satish - Copyright (c) 2001 Bruce Florman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_CORE_MAIN_HPP) -#define BOOST_SPIRIT_CORE_MAIN_HPP - -#include <boost/spirit/version.hpp> -#include <boost/spirit/debug.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.Core includes -// -/////////////////////////////////////////////////////////////////////////////// - -// Spirit.Core.Kernel -#include <boost/spirit/core/config.hpp> -#include <boost/spirit/core/nil.hpp> -#include <boost/spirit/core/match.hpp> -#include <boost/spirit/core/parser.hpp> - -// Spirit.Core.Primitives -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/primitives/numerics.hpp> - -// Spirit.Core.Scanner -#include <boost/spirit/core/scanner/scanner.hpp> -#include <boost/spirit/core/scanner/skipper.hpp> - -// Spirit.Core.NonTerminal -#include <boost/spirit/core/non_terminal/subrule.hpp> -#include <boost/spirit/core/non_terminal/rule.hpp> -#include <boost/spirit/core/non_terminal/grammar.hpp> - -// Spirit.Core.Composite -#include <boost/spirit/core/composite/actions.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/core/composite/directives.hpp> -#include <boost/spirit/core/composite/epsilon.hpp> -#include <boost/spirit/core/composite/sequence.hpp> -#include <boost/spirit/core/composite/sequential_and.hpp> -#include <boost/spirit/core/composite/sequential_or.hpp> -#include <boost/spirit/core/composite/alternative.hpp> -#include <boost/spirit/core/composite/difference.hpp> -#include <boost/spirit/core/composite/intersection.hpp> -#include <boost/spirit/core/composite/exclusive_or.hpp> -#include <boost/spirit/core/composite/kleene_star.hpp> -#include <boost/spirit/core/composite/positive.hpp> -#include <boost/spirit/core/composite/optional.hpp> -#include <boost/spirit/core/composite/list.hpp> -#include <boost/spirit/core/composite/no_actions.hpp> - -// Deprecated interface includes -#include <boost/spirit/actor/assign_actor.hpp> -#include <boost/spirit/actor/push_back_actor.hpp> - -#if defined(BOOST_SPIRIT_DEBUG) - ////////////////////////////////// - #include <boost/spirit/debug/parser_names.hpp> - -#endif // BOOST_SPIRIT_DEBUG - -#endif // BOOST_SPIRIT_CORE_MAIN_HPP - diff --git a/Utilities/BGL/boost/spirit/core/assert.hpp b/Utilities/BGL/boost/spirit/core/assert.hpp deleted file mode 100644 index 11002442ee434a9c8c9e1e66e94856f8ad7aeca7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/assert.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_ASSERT_HPP) -#define BOOST_SPIRIT_ASSERT_HPP - -#include <boost/config.hpp> -#include <boost/throw_exception.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// BOOST_SPIRIT_ASSERT is used throughout the framework. It can be -// overridden by the user. If BOOST_SPIRIT_ASSERT_EXCEPTION is defined, -// then that will be thrown, otherwise, BOOST_SPIRIT_ASSERT simply turns -// into a plain assert() -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_ASSERT) -#if defined(NDEBUG) - #define BOOST_SPIRIT_ASSERT(x) -#elif defined (BOOST_SPIRIT_ASSERT_EXCEPTION) - #define BOOST_SPIRIT_ASSERT_AUX(f, l, x) BOOST_SPIRIT_ASSERT_AUX2(f, l, x) - #define BOOST_SPIRIT_ASSERT_AUX2(f, l, x) \ - do{ if (!(x)) boost::throw_exception( \ - BOOST_SPIRIT_ASSERT_EXCEPTION(f "(" #l "): " #x)); } while(0) - #define BOOST_SPIRIT_ASSERT(x) BOOST_SPIRIT_ASSERT_AUX(__FILE__, __LINE__, x) -#else - #include <cassert> - #define BOOST_SPIRIT_ASSERT(x) assert(x) -#endif -#endif // !defined(BOOST_SPIRIT_ASSERT) - -#endif // BOOST_SPIRIT_ASSERT_HPP diff --git a/Utilities/BGL/boost/spirit/core/composite/actions.hpp b/Utilities/BGL/boost/spirit/core/composite/actions.hpp deleted file mode 100644 index 543faedc0112369e86f54bd34f4ce7053b4da7f7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/actions.hpp +++ /dev/null @@ -1,123 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ACTIONS_HPP -#define BOOST_SPIRIT_ACTIONS_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // action class - // - // The action class binds a parser with a user defined semantic - // action. Instances of action are never created manually. Instead, - // action objects are typically created indirectly through - // expression templates of the form: - // - // p[f] - // - // where p is a parser and f is a function or functor. The semantic - // action may be a function or a functor. When the parser is - // successful, the actor calls the scanner's action_policy policy - // (see scanner.hpp): - // - // scan.do_action(actor, attribute, first, last); - // - // passing in these information: - // - // actor: The action's function or functor - // attribute: The match (returned by the parser) object's - // attribute (see match.hpp) - // first: Iterator pointing to the start of the matching - // portion of the input - // last: Iterator pointing to one past the end of the - // matching portion of the input - // - // It is the responsibility of the scanner's action_policy policy to - // dispatch the function or functor as it sees fit. The expected - // function or functor signature depends on the parser being - // wrapped. In general, if the attribute type of the parser being - // wrapped is a nil_t, the function or functor expect the signature: - // - // void func(Iterator first, Iterator last); // functions - // - // struct ftor // functors - // { - // void func(Iterator first, Iterator last) const; - // }; - // - // where Iterator is the type of the iterator that is being used and - // first and last are the iterators pointing to the matching portion - // of the input. - // - // If the attribute type of the parser being wrapped is not a nil_t, - // the function or functor usually expect the signature: - // - // void func(T val); // functions - // - // struct ftor // functors - // { - // void func(T val) const; - // }; - // - // where T is the attribute type and val is the attribute value - // returned by the parser being wrapped. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ParserT, typename ActionT> - class action : public unary<ParserT, parser<action<ParserT, ActionT> > > - { - public: - - typedef action<ParserT, ActionT> self_t; - typedef action_parser_category parser_category_t; - typedef unary<ParserT, parser<self_t> > base_t; - typedef ActionT predicate_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - action(ParserT const& p, ActionT const& a) - : base_t(p) - , actor(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename ScannerT::iterator_t iterator_t; - typedef typename parser_result<self_t, ScannerT>::type result_t; - - scan.at_end(); // allow skipper to take effect - iterator_t save = scan.first; - result_t hit = this->subject().parse(scan); - if (hit) - { - typename result_t::return_t val = hit.value(); - scan.do_action(actor, val, save, scan.first); - } - return hit; - } - - ActionT const& predicate() const { return actor; } - - private: - - ActionT actor; - }; - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/alternative.hpp b/Utilities/BGL/boost/spirit/core/composite/alternative.hpp deleted file mode 100644 index a587c20f2fba2c1657e5b12fc429f2efac9302eb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/alternative.hpp +++ /dev/null @@ -1,134 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_ALTERNATIVE_HPP) -#define BOOST_SPIRIT_ALTERNATIVE_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // alternative class - // - // Handles expressions of the form: - // - // a | b - // - // where a and b are parsers. The expression returns a composite - // parser that matches a or b. One (not both) of the operands may - // be a literal char, wchar_t or a primitive string char const*, - // wchar_t const*. - // - // The expression is short circuit evaluated. b is never touched - // when a is returns a successful match. - // - /////////////////////////////////////////////////////////////////////////// - struct alternative_parser_gen; - - template <typename A, typename B> - struct alternative - : public binary<A, B, parser<alternative<A, B> > > - { - typedef alternative<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef alternative_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - alternative(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - { // scope for save - iterator_t save = scan.first; - if (result_t hit = this->left().parse(scan)) - return hit; - scan.first = save; - } - return this->right().parse(scan); - } - }; - - struct alternative_parser_gen - { - template <typename A, typename B> - struct result - { - typedef - alternative< - typename as_parser<A>::type - , typename as_parser<B>::type - > - type; - }; - - template <typename A, typename B> - static alternative< - typename as_parser<A>::type - , typename as_parser<B>::type - > - generate(A const& a, B const& b) - { - return alternative<BOOST_DEDUCED_TYPENAME as_parser<A>::type, - BOOST_DEDUCED_TYPENAME as_parser<B>::type> - (as_parser<A>::convert(a), as_parser<B>::convert(b)); - } - }; - - template <typename A, typename B> - alternative<A, B> - operator|(parser<A> const& a, parser<B> const& b); - - template <typename A> - alternative<A, chlit<char> > - operator|(parser<A> const& a, char b); - - template <typename B> - alternative<chlit<char>, B> - operator|(char a, parser<B> const& b); - - template <typename A> - alternative<A, strlit<char const*> > - operator|(parser<A> const& a, char const* b); - - template <typename B> - alternative<strlit<char const*>, B> - operator|(char const* a, parser<B> const& b); - - template <typename A> - alternative<A, chlit<wchar_t> > - operator|(parser<A> const& a, wchar_t b); - - template <typename B> - alternative<chlit<wchar_t>, B> - operator|(wchar_t a, parser<B> const& b); - - template <typename A> - alternative<A, strlit<wchar_t const*> > - operator|(parser<A> const& a, wchar_t const* b); - - template <typename B> - alternative<strlit<wchar_t const*>, B> - operator|(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/alternative.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/composite.hpp b/Utilities/BGL/boost/spirit/core/composite/composite.hpp deleted file mode 100644 index 8e5ae3d26de03c437e9fc0d92a6f38ba89736d46..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/composite.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_COMPOSITE_HPP) -#define BOOST_SPIRIT_COMPOSITE_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/compressed_pair.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // unary class. - // - // Composite class composed of a single subject. This template class - // is parameterized by the subject type S and a base class to - // inherit from, BaseT. The unary class is meant to be a base class - // to inherit from. The inheritance structure, given the BaseT - // template parameter places the unary class in the middle of a - // linear, single parent hierarchy. For instance, given a class S - // and a base class B, a class D can derive from unary: - // - // struct D : public unary<S, B> {...}; - // - // The inheritance structure is thus: - // - // B - // | - // unary (has S) - // | - // D - // - // The subject can be accessed from the derived class D as: - // this->subject(); - // - // Typically, the subject S is specified as typename S::embed_t. - // embed_t specifies how the subject is embedded in the composite - // (See parser.hpp for details). - // - /////////////////////////////////////////////////////////////////////////// - template <typename S, typename BaseT> - class unary : public BaseT - { - public: - - typedef BaseT base_t; - typedef typename boost::call_traits<S>::param_type param_t; - typedef typename boost::call_traits<S>::const_reference return_t; - typedef S subject_t; - typedef typename S::embed_t subject_embed_t; - - unary(param_t subj_) - : base_t(), subj(subj_) {} - - unary(BaseT const& base, param_t subj_) - : base_t(base), subj(subj_) {} - - return_t - subject() const - { return subj; } - - private: - - subject_embed_t subj; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // binary class. - // - // Composite class composed of a pair (left and right). This - // template class is parameterized by the left and right subject - // types A and B and a base class to inherit from, BaseT. The binary - // class is meant to be a base class to inherit from. The - // inheritance structure, given the BaseT template parameter places - // the binary class in the middle of a linear, single parent - // hierarchy. For instance, given classes X and Y and a base class - // B, a class D can derive from binary: - // - // struct D : public binary<X, Y, B> {...}; - // - // The inheritance structure is thus: - // - // B - // | - // binary (has X and Y) - // | - // D - // - // The left and right subjects can be accessed from the derived - // class D as: this->left(); and this->right(); - // - // Typically, the pairs X and Y are specified as typename X::embed_t - // and typename Y::embed_t. embed_t specifies how the subject is - // embedded in the composite (See parser.hpp for details). - // - /////////////////////////////////////////////////////////////////////////////// - template <typename A, typename B, typename BaseT> - class binary : public BaseT - { - public: - - typedef BaseT base_t; - typedef typename boost::call_traits<A>::param_type left_param_t; - typedef typename boost::call_traits<A>::const_reference left_return_t; - typedef typename boost::call_traits<B>::param_type right_param_t; - typedef typename boost::call_traits<B>::const_reference right_return_t; - typedef A left_t; - typedef typename A::embed_t left_embed_t; - typedef B right_t; - typedef typename B::embed_t right_embed_t; - - binary(left_param_t a, right_param_t b) - : base_t(), subj(a, b) {} - - left_return_t - left() const - { return subj.first(); } - - right_return_t - right() const - { return subj.second(); } - - private: - - boost::compressed_pair<left_embed_t, right_embed_t> subj; - }; - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/difference.hpp b/Utilities/BGL/boost/spirit/core/composite/difference.hpp deleted file mode 100644 index 51ad9e3c14ed7727aef41ec20be4619993c0b763..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/difference.hpp +++ /dev/null @@ -1,137 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_DIFFERENCE_HPP) -#define BOOST_SPIRIT_DIFFERENCE_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // difference: a - b; Matches a but not b - // - // Handles expressions of the form: - // - // a - b - // - // where a and b are parsers. The expression returns a composite - // parser that matches a but not b. One (not both) of the operands - // may be a literal char, wchar_t or a primitive string char const*, - // wchar_t const*. - // - /////////////////////////////////////////////////////////////////////////// - struct difference_parser_gen; - - template <typename A, typename B> - struct difference - : public binary<A, B, parser<difference<A, B> > > - { - typedef difference<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef difference_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - difference(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - iterator_t save = scan.first; - if (result_t hl = this->left().parse(scan)) - { - std::swap(save, scan.first); - result_t hr = this->right().parse(scan); - if (!hr || (hr.length() < hl.length())) - { - scan.first = save; - return hl; - } - } - - return scan.no_match(); - } - }; - - struct difference_parser_gen - { - template <typename A, typename B> - struct result - { - typedef - difference< - typename as_parser<A>::type - , typename as_parser<B>::type - > - type; - }; - - template <typename A, typename B> - static difference< - typename as_parser<A>::type - , typename as_parser<B>::type - > - generate(A const& a, B const& b) - { - return difference<BOOST_DEDUCED_TYPENAME as_parser<A>::type, - BOOST_DEDUCED_TYPENAME as_parser<B>::type> - (as_parser<A>::convert(a), as_parser<B>::convert(b)); - } - }; - - template <typename A, typename B> - difference<A, B> - operator-(parser<A> const& a, parser<B> const& b); - - template <typename A> - difference<A, chlit<char> > - operator-(parser<A> const& a, char b); - - template <typename B> - difference<chlit<char>, B> - operator-(char a, parser<B> const& b); - - template <typename A> - difference<A, strlit<char const*> > - operator-(parser<A> const& a, char const* b); - - template <typename B> - difference<strlit<char const*>, B> - operator-(char const* a, parser<B> const& b); - - template <typename A> - difference<A, chlit<wchar_t> > - operator-(parser<A> const& a, wchar_t b); - - template <typename B> - difference<chlit<wchar_t>, B> - operator-(wchar_t a, parser<B> const& b); - - template <typename A> - difference<A, strlit<wchar_t const*> > - operator-(parser<A> const& a, wchar_t const* b); - - template <typename B> - difference<strlit<wchar_t const*>, B> - operator-(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/difference.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/directives.hpp b/Utilities/BGL/boost/spirit/core/composite/directives.hpp deleted file mode 100644 index 232100933d46d3b52fe0e1c3be13c4e78c3db77d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/directives.hpp +++ /dev/null @@ -1,624 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_DIRECTIVES_HPP) -#define BOOST_SPIRIT_DIRECTIVES_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <algorithm> - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/core/composite/impl/directives.ipp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // no_skipper_iteration_policy class - // - /////////////////////////////////////////////////////////////////////////// - template <typename BaseT> - struct no_skipper_iteration_policy : public BaseT - { - typedef BaseT base_t; - - no_skipper_iteration_policy() - : BaseT() {} - - template <typename PolicyT> - no_skipper_iteration_policy(PolicyT const& other) - : BaseT(other) {} - - template <typename ScannerT> - void - skip(ScannerT const& /*scan*/) const {} - }; - - /////////////////////////////////////////////////////////////////////////// - // - // contiguous class - // - /////////////////////////////////////////////////////////////////////////// - struct lexeme_parser_gen; - - template <typename ParserT> - struct contiguous - : public unary<ParserT, parser<contiguous<ParserT> > > - { - typedef contiguous<ParserT> self_t; - typedef unary_parser_category parser_category_t; - typedef lexeme_parser_gen parser_generator_t; - typedef unary<ParserT, parser<self_t> > base_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - contiguous(ParserT const& p) - : base_t(p) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::contiguous_parser_parse<result_t> - (this->subject(), scan, scan); - } - }; - - struct lexeme_parser_gen - { - template <typename ParserT> - struct result { - - typedef contiguous<ParserT> type; - }; - - template <typename ParserT> - static contiguous<ParserT> - generate(parser<ParserT> const& subject) - { - return contiguous<ParserT>(subject.derived()); - } - - template <typename ParserT> - contiguous<ParserT> - operator[](parser<ParserT> const& subject) const - { - return contiguous<ParserT>(subject.derived()); - } - }; - - ////////////////////////////////// - const lexeme_parser_gen lexeme_d = lexeme_parser_gen(); - - /////////////////////////////////////////////////////////////////////////// - // - // lexeme_scanner - // - // Given a Scanner, return the correct scanner type that - // the lexeme_d uses. Scanner is assumed to be a phrase - // level scanner (see skipper.hpp) - // - /////////////////////////////////////////////////////////////////////////// - template <typename ScannerT> - struct lexeme_scanner - { - typedef scanner_policies< - no_skipper_iteration_policy< - typename ScannerT::iteration_policy_t>, - typename ScannerT::match_policy_t, - typename ScannerT::action_policy_t - > policies_t; - - typedef typename - rebind_scanner_policies<ScannerT, policies_t>::type type; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // inhibit_case_iteration_policy class - // - /////////////////////////////////////////////////////////////////////////// - template <typename BaseT> - struct inhibit_case_iteration_policy : public BaseT - { - typedef BaseT base_t; - - inhibit_case_iteration_policy() - : BaseT() {} - - template <typename PolicyT> - inhibit_case_iteration_policy(PolicyT const& other) - : BaseT(other) {} - - template <typename CharT> - CharT filter(CharT ch) const - { return impl::tolower_(ch); } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // inhibit_case class - // - /////////////////////////////////////////////////////////////////////////// - struct inhibit_case_parser_gen; - - template <typename ParserT> - struct inhibit_case - : public unary<ParserT, parser<inhibit_case<ParserT> > > - { - typedef inhibit_case<ParserT> self_t; - typedef unary_parser_category parser_category_t; - typedef inhibit_case_parser_gen parser_generator_t; - typedef unary<ParserT, parser<self_t> > base_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - inhibit_case(ParserT const& p) - : base_t(p) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::inhibit_case_parser_parse<result_t> - (this->subject(), scan, scan); - } - }; - - template <int N> - struct inhibit_case_parser_gen_base - { - // This hack is needed to make borland happy. - // If these member operators were defined in the - // inhibit_case_parser_gen class, or if this class - // is non-templated, borland ICEs. - - static inhibit_case<strlit<char const*> > - generate(char const* str) - { return inhibit_case<strlit<char const*> >(str); } - - static inhibit_case<strlit<wchar_t const*> > - generate(wchar_t const* str) - { return inhibit_case<strlit<wchar_t const*> >(str); } - - static inhibit_case<chlit<char> > - generate(char ch) - { return inhibit_case<chlit<char> >(ch); } - - static inhibit_case<chlit<wchar_t> > - generate(wchar_t ch) - { return inhibit_case<chlit<wchar_t> >(ch); } - - template <typename ParserT> - static inhibit_case<ParserT> - generate(parser<ParserT> const& subject) - { return inhibit_case<ParserT>(subject.derived()); } - - inhibit_case<strlit<char const*> > - operator[](char const* str) const - { return inhibit_case<strlit<char const*> >(str); } - - inhibit_case<strlit<wchar_t const*> > - operator[](wchar_t const* str) const - { return inhibit_case<strlit<wchar_t const*> >(str); } - - inhibit_case<chlit<char> > - operator[](char ch) const - { return inhibit_case<chlit<char> >(ch); } - - inhibit_case<chlit<wchar_t> > - operator[](wchar_t ch) const - { return inhibit_case<chlit<wchar_t> >(ch); } - - template <typename ParserT> - inhibit_case<ParserT> - operator[](parser<ParserT> const& subject) const - { return inhibit_case<ParserT>(subject.derived()); } - }; - - ////////////////////////////////// - struct inhibit_case_parser_gen : public inhibit_case_parser_gen_base<0> - { - inhibit_case_parser_gen() {} - }; - - ////////////////////////////////// - // Depracated - const inhibit_case_parser_gen nocase_d = inhibit_case_parser_gen(); - - // Preferred syntax - const inhibit_case_parser_gen as_lower_d = inhibit_case_parser_gen(); - - /////////////////////////////////////////////////////////////////////////// - // - // as_lower_scanner - // - // Given a Scanner, return the correct scanner type that - // the as_lower_d uses. Scanner is assumed to be a scanner - // with an inhibit_case_iteration_policy. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ScannerT> - struct as_lower_scanner - { - typedef scanner_policies< - inhibit_case_iteration_policy< - typename ScannerT::iteration_policy_t>, - typename ScannerT::match_policy_t, - typename ScannerT::action_policy_t - > policies_t; - - typedef typename - rebind_scanner_policies<ScannerT, policies_t>::type type; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // longest_alternative class - // - /////////////////////////////////////////////////////////////////////////// - struct longest_parser_gen; - - template <typename A, typename B> - struct longest_alternative - : public binary<A, B, parser<longest_alternative<A, B> > > - { - typedef longest_alternative<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef longest_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - longest_alternative(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typename ScannerT::iterator_t save = scan.first; - result_t l = this->left().parse(scan); - std::swap(scan.first, save); - result_t r = this->right().parse(scan); - - if (l || r) - { - if (l.length() > r.length()) - { - scan.first = save; - return l; - } - return r; - } - - return scan.no_match(); - } - }; - - struct longest_parser_gen - { - template <typename A, typename B> - struct result { - - typedef typename - impl::to_longest_alternative<alternative<A, B> >::result_t - type; - }; - - template <typename A, typename B> - static typename - impl::to_longest_alternative<alternative<A, B> >::result_t - generate(alternative<A, B> const& alt) - { - return impl::to_longest_alternative<alternative<A, B> >:: - convert(alt); - } - - //'generate' for binary composite - template <typename A, typename B> - static - longest_alternative<A, B> - generate(A const &left, B const &right) - { - return longest_alternative<A, B>(left, right); - } - - template <typename A, typename B> - typename impl::to_longest_alternative<alternative<A, B> >::result_t - operator[](alternative<A, B> const& alt) const - { - return impl::to_longest_alternative<alternative<A, B> >:: - convert(alt); - } - }; - - const longest_parser_gen longest_d = longest_parser_gen(); - - /////////////////////////////////////////////////////////////////////////// - // - // shortest_alternative class - // - /////////////////////////////////////////////////////////////////////////// - struct shortest_parser_gen; - - template <typename A, typename B> - struct shortest_alternative - : public binary<A, B, parser<shortest_alternative<A, B> > > - { - typedef shortest_alternative<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef shortest_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - shortest_alternative(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typename ScannerT::iterator_t save = scan.first; - result_t l = this->left().parse(scan); - std::swap(scan.first, save); - result_t r = this->right().parse(scan); - - if (l || r) - { - if (l.length() < r.length() && l || !r) - { - scan.first = save; - return l; - } - return r; - } - - return scan.no_match(); - } - }; - - struct shortest_parser_gen - { - template <typename A, typename B> - struct result { - - typedef typename - impl::to_shortest_alternative<alternative<A, B> >::result_t - type; - }; - - template <typename A, typename B> - static typename - impl::to_shortest_alternative<alternative<A, B> >::result_t - generate(alternative<A, B> const& alt) - { - return impl::to_shortest_alternative<alternative<A, B> >:: - convert(alt); - } - - //'generate' for binary composite - template <typename A, typename B> - static - shortest_alternative<A, B> - generate(A const &left, B const &right) - { - return shortest_alternative<A, B>(left, right); - } - - template <typename A, typename B> - typename impl::to_shortest_alternative<alternative<A, B> >::result_t - operator[](alternative<A, B> const& alt) const - { - return impl::to_shortest_alternative<alternative<A, B> >:: - convert(alt); - } - }; - - const shortest_parser_gen shortest_d = shortest_parser_gen(); - - /////////////////////////////////////////////////////////////////////////// - // - // min_bounded class - // - /////////////////////////////////////////////////////////////////////////// - template <typename BoundsT> - struct min_bounded_gen; - - template <typename ParserT, typename BoundsT> - struct min_bounded - : public unary<ParserT, parser<min_bounded<ParserT, BoundsT> > > - { - typedef min_bounded<ParserT, BoundsT> self_t; - typedef unary_parser_category parser_category_t; - typedef min_bounded_gen<BoundsT> parser_generator_t; - typedef unary<ParserT, parser<self_t> > base_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - min_bounded(ParserT const& p, BoundsT const& min__) - : base_t(p) - , min_(min__) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - result_t hit = this->subject().parse(scan); - if (hit.has_valid_attribute() && hit.value() < min_) - return scan.no_match(); - return hit; - } - - BoundsT min_; - }; - - template <typename BoundsT> - struct min_bounded_gen - { - min_bounded_gen(BoundsT const& min__) - : min_(min__) {} - - template <typename DerivedT> - min_bounded<DerivedT, BoundsT> - operator[](parser<DerivedT> const& p) const - { return min_bounded<DerivedT, BoundsT>(p.derived(), min_); } - - BoundsT min_; - }; - - template <typename BoundsT> - inline min_bounded_gen<BoundsT> - min_limit_d(BoundsT const& min_) - { return min_bounded_gen<BoundsT>(min_); } - - /////////////////////////////////////////////////////////////////////////// - // - // max_bounded class - // - /////////////////////////////////////////////////////////////////////////// - template <typename BoundsT> - struct max_bounded_gen; - - template <typename ParserT, typename BoundsT> - struct max_bounded - : public unary<ParserT, parser<max_bounded<ParserT, BoundsT> > > - { - typedef max_bounded<ParserT, BoundsT> self_t; - typedef unary_parser_category parser_category_t; - typedef max_bounded_gen<BoundsT> parser_generator_t; - typedef unary<ParserT, parser<self_t> > base_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - max_bounded(ParserT const& p, BoundsT const& max__) - : base_t(p) - , max_(max__) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - result_t hit = this->subject().parse(scan); - if (hit.has_valid_attribute() && hit.value() > max_) - return scan.no_match(); - return hit; - } - - BoundsT max_; - }; - - template <typename BoundsT> - struct max_bounded_gen - { - max_bounded_gen(BoundsT const& max__) - : max_(max__) {} - - template <typename DerivedT> - max_bounded<DerivedT, BoundsT> - operator[](parser<DerivedT> const& p) const - { return max_bounded<DerivedT, BoundsT>(p.derived(), max_); } - - BoundsT max_; - }; - - ////////////////////////////////// - template <typename BoundsT> - inline max_bounded_gen<BoundsT> - max_limit_d(BoundsT const& max_) - { return max_bounded_gen<BoundsT>(max_); } - - /////////////////////////////////////////////////////////////////////////// - // - // bounded class - // - /////////////////////////////////////////////////////////////////////////// - template <typename BoundsT> - struct bounded_gen; - - template <typename ParserT, typename BoundsT> - struct bounded - : public unary<ParserT, parser<bounded<ParserT, BoundsT> > > - { - typedef bounded<ParserT, BoundsT> self_t; - typedef unary_parser_category parser_category_t; - typedef bounded_gen<BoundsT> parser_generator_t; - typedef unary<ParserT, parser<self_t> > base_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - bounded(ParserT const& p, BoundsT const& min__, BoundsT const& max__) - : base_t(p) - , min_(min__) - , max_(max__) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - result_t hit = this->subject().parse(scan); - if (hit.has_valid_attribute() && - (hit.value() < min_ || hit.value() > max_)) - return scan.no_match(); - return hit; - } - - BoundsT min_, max_; - }; - - template <typename BoundsT> - struct bounded_gen - { - bounded_gen(BoundsT const& min__, BoundsT const& max__) - : min_(min__) - , max_(max__) {} - - template <typename DerivedT> - bounded<DerivedT, BoundsT> - operator[](parser<DerivedT> const& p) const - { return bounded<DerivedT, BoundsT>(p.derived(), min_, max_); } - - BoundsT min_, max_; - }; - - template <typename BoundsT> - inline bounded_gen<BoundsT> - limit_d(BoundsT const& min_, BoundsT const& max_) - { return bounded_gen<BoundsT>(min_, max_); } - -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/composite/epsilon.hpp b/Utilities/BGL/boost/spirit/core/composite/epsilon.hpp deleted file mode 100644 index b7d4b1b39e0e8a30e700cd85b550f68010ccb3c5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/epsilon.hpp +++ /dev/null @@ -1,270 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2002-2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_EPSILON_HPP -#define BOOST_SPIRIT_EPSILON_HPP - -//////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/meta/parser_traits.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/core/composite/no_actions.hpp> - -//////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// condition_parser class -// -// handles expresions of the form -// -// epsilon_p(cond) -// -// where cond is a function or a functor that returns a value suitable -// to be used in boolean context. The expression returns a parser that -// returns an empty match when the condition evaluates to true. -// -/////////////////////////////////////////////////////////////////////////////// - template <typename CondT, bool positive_ = true> - struct condition_parser : parser<condition_parser<CondT, positive_> > - { - typedef condition_parser<CondT, positive_> self_t; - - // not explicit! (needed for implementation of if_p et al.) - condition_parser(CondT const& cond_) : cond(cond_) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - if (positive_ == bool(cond())) // allow cond to return int - return scan.empty_match(); - else - return scan.no_match(); - } - - condition_parser<CondT, !positive_> - negate() const - { return condition_parser<CondT, !positive_>(cond); } - - private: - - CondT cond; - }; - -#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || \ - BOOST_WORKAROUND(BOOST_MSVC, == 1400) -// VC 7.1 and VC8 - template <typename CondT> - inline condition_parser<CondT, false> - operator~(condition_parser<CondT, true> const& p) - { return p.negate(); } - - template <typename CondT> - inline condition_parser<CondT, true> - operator~(condition_parser<CondT, false> const& p) - { return p.negate(); } -#else // BOOST_WORKAROUND(BOOST_MSVC, == 1310) || == 1400 - template <typename CondT, bool positive> - inline condition_parser<CondT, !positive> - operator~(condition_parser<CondT, positive> const& p) - { return p.negate(); } -#endif // BOOST_WORKAROUND(BOOST_MSVC, == 1310) || == 1400 - -/////////////////////////////////////////////////////////////////////////////// -// -// empty_match_parser class -// -// handles expressions of the form -// epsilon_p(subject) -// where subject is a parser. The expresion returns a composite -// parser that returns an empty match if the subject parser matches. -// -/////////////////////////////////////////////////////////////////////////////// - struct empty_match_parser_gen; - struct negated_empty_match_parser_gen; - - template <typename SubjectT> - struct negated_empty_match_parser; // Forward declaration - - template<typename SubjectT> - struct empty_match_parser - : unary<SubjectT, parser<empty_match_parser<SubjectT> > > - { - typedef empty_match_parser<SubjectT> self_t; - typedef unary<SubjectT, parser<self_t> > base_t; - typedef unary_parser_category parser_category_t; - typedef empty_match_parser_gen parser_genererator_t; - typedef self_t embed_t; - - explicit empty_match_parser(SubjectT const& p) : base_t(p) {} - - template <typename ScannerT> - struct result - { typedef typename match_result<ScannerT, nil_t>::type type; }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typename ScannerT::iterator_t save(scan.first); - - typedef typename no_actions_scanner<ScannerT>::policies_t - policies_t; - - bool matches = this->subject().parse( - scan.change_policies(policies_t(scan))); - if (matches) - { - scan.first = save; // reset the position - return scan.empty_match(); - } - else - { - return scan.no_match(); - } - } - - negated_empty_match_parser<SubjectT> - negate() const - { return negated_empty_match_parser<SubjectT>(this->subject()); } - }; - - template<typename SubjectT> - struct negated_empty_match_parser - : public unary<SubjectT, parser<negated_empty_match_parser<SubjectT> > > - { - typedef negated_empty_match_parser<SubjectT> self_t; - typedef unary<SubjectT, parser<self_t> > base_t; - typedef unary_parser_category parser_category_t; - typedef negated_empty_match_parser_gen parser_genererator_t; - - explicit negated_empty_match_parser(SubjectT const& p) : base_t(p) {} - - template <typename ScannerT> - struct result - { typedef typename match_result<ScannerT, nil_t>::type type; }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typename ScannerT::iterator_t save(scan.first); - - typedef typename no_actions_scanner<ScannerT>::policies_t - policies_t; - - bool matches = this->subject().parse( - scan.change_policies(policies_t(scan))); - if (!matches) - { - scan.first = save; // reset the position - return scan.empty_match(); - } - else - { - return scan.no_match(); - } - } - - empty_match_parser<SubjectT> - negate() const - { return empty_match_parser<SubjectT>(this->subject()); } - }; - - struct empty_match_parser_gen - { - template <typename SubjectT> - struct result - { typedef empty_match_parser<SubjectT> type; }; - - template <typename SubjectT> - static empty_match_parser<SubjectT> - generate(parser<SubjectT> const& subject) - { return empty_match_parser<SubjectT>(subject.derived()); } - }; - - struct negated_empty_match_parser_gen - { - template <typename SubjectT> - struct result - { typedef negated_empty_match_parser<SubjectT> type; }; - - template <typename SubjectT> - static negated_empty_match_parser<SubjectT> - generate(parser<SubjectT> const& subject) - { return negated_empty_match_parser<SubjectT>(subject.derived()); } - }; - - ////////////////////////////// - template <typename SubjectT> - inline negated_empty_match_parser<SubjectT> - operator~(empty_match_parser<SubjectT> const& p) - { return p.negate(); } - - template <typename SubjectT> - inline empty_match_parser<SubjectT> - operator~(negated_empty_match_parser<SubjectT> const& p) - { return p.negate(); } - -/////////////////////////////////////////////////////////////////////////////// -// -// epsilon_ parser and parser generator class -// -// Operates as primitive parser that always matches an empty sequence. -// -// Also operates as a parser generator. According to the type of the -// argument an instance of empty_match_parser<> (when the argument is -// a parser) or condition_parser<> (when the argument is not a parser) -// is returned by operator(). -// -/////////////////////////////////////////////////////////////////////////////// - namespace impl - { - template <typename SubjectT> - struct epsilon_selector - { - typedef typename as_parser<SubjectT>::type subject_t; - typedef typename - mpl::if_< - is_parser<subject_t> - ,empty_match_parser<subject_t> - ,condition_parser<subject_t> - >::type type; - }; - } - - struct epsilon_parser : public parser<epsilon_parser> - { - typedef epsilon_parser self_t; - - epsilon_parser() {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { return scan.empty_match(); } - - template <typename SubjectT> - typename impl::epsilon_selector<SubjectT>::type - operator()(SubjectT const& subject) const - { - typedef typename impl::epsilon_selector<SubjectT>::type result_t; - return result_t(subject); - } - }; - - epsilon_parser const epsilon_p = epsilon_parser(); - epsilon_parser const eps_p = epsilon_parser(); - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/exclusive_or.hpp b/Utilities/BGL/boost/spirit/core/composite/exclusive_or.hpp deleted file mode 100644 index e7af4530d1dda2bc40ad8c1d80b7f2471c6d967c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/exclusive_or.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_EXCLUSIVE_OR_HPP) -#define BOOST_SPIRIT_EXCLUSIVE_OR_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // exclusive_or class - // - // Handles expressions of the form: - // - // a ^ b - // - // where a and b are parsers. The expression returns a composite - // parser that matches a or b but not both. One (not both) of the - // operands may be a literal char, wchar_t or a primitive string - // char const*, wchar_t const*. - // - /////////////////////////////////////////////////////////////////////////// - struct exclusive_or_parser_gen; - - template <typename A, typename B> - struct exclusive_or - : public binary<A, B, parser<exclusive_or<A, B> > > - { - typedef exclusive_or<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef exclusive_or_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - exclusive_or(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - - iterator_t save = scan.first; - result_t l = this->left().parse(scan); - std::swap(save, scan.first); - result_t r = this->right().parse(scan); - - if (l ? !bool(r) : bool(r)) - { - if (l) - scan.first = save; - return l ? l : r; - } - - return scan.no_match(); - } - }; - - struct exclusive_or_parser_gen - { - template <typename A, typename B> - struct result - { - typedef - exclusive_or< - typename as_parser<A>::type - , typename as_parser<B>::type - > - type; - }; - - template <typename A, typename B> - static exclusive_or< - typename as_parser<A>::type - , typename as_parser<B>::type - > - generate(A const& a, B const& b) - { - return exclusive_or<BOOST_DEDUCED_TYPENAME as_parser<A>::type, - BOOST_DEDUCED_TYPENAME as_parser<B>::type> - (as_parser<A>::convert(a), as_parser<B>::convert(b)); - } - }; - - template <typename A, typename B> - exclusive_or<A, B> - operator^(parser<A> const& a, parser<B> const& b); - - template <typename A> - exclusive_or<A, chlit<char> > - operator^(parser<A> const& a, char b); - - template <typename B> - exclusive_or<chlit<char>, B> - operator^(char a, parser<B> const& b); - - template <typename A> - exclusive_or<A, strlit<char const*> > - operator^(parser<A> const& a, char const* b); - - template <typename B> - exclusive_or<strlit<char const*>, B> - operator^(char const* a, parser<B> const& b); - - template <typename A> - exclusive_or<A, chlit<wchar_t> > - operator^(parser<A> const& a, wchar_t b); - - template <typename B> - exclusive_or<chlit<wchar_t>, B> - operator^(wchar_t a, parser<B> const& b); - - template <typename A> - exclusive_or<A, strlit<wchar_t const*> > - operator^(parser<A> const& a, wchar_t const* b); - - template <typename B> - exclusive_or<strlit<wchar_t const*>, B> - operator^(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/exclusive_or.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/alternative.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/alternative.ipp deleted file mode 100644 index d03901cde23f363889c78cfc3a567b2fb0beacb4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/alternative.ipp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_ALTERNATIVE_IPP) -#define BOOST_SPIRIT_ALTERNATIVE_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // alternative class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline alternative<A, B> - operator|(parser<A> const& a, parser<B> const& b) - { - return alternative<A, B>(a.derived(), b.derived()); - } - - template <typename A> - inline alternative<A, chlit<char> > - operator|(parser<A> const& a, char b) - { - return alternative<A, chlit<char> >(a.derived(), b); - } - - template <typename B> - inline alternative<chlit<char>, B> - operator|(char a, parser<B> const& b) - { - return alternative<chlit<char>, B>(a, b.derived()); - } - - template <typename A> - inline alternative<A, strlit<char const*> > - operator|(parser<A> const& a, char const* b) - { - return alternative<A, strlit<char const*> >(a.derived(), b); - } - - template <typename B> - inline alternative<strlit<char const*>, B> - operator|(char const* a, parser<B> const& b) - { - return alternative<strlit<char const*>, B>(a, b.derived()); - } - - template <typename A> - inline alternative<A, chlit<wchar_t> > - operator|(parser<A> const& a, wchar_t b) - { - return alternative<A, chlit<wchar_t> >(a.derived(), b); - } - - template <typename B> - inline alternative<chlit<wchar_t>, B> - operator|(wchar_t a, parser<B> const& b) - { - return alternative<chlit<wchar_t>, B>(a, b.derived()); - } - - template <typename A> - inline alternative<A, strlit<wchar_t const*> > - operator|(parser<A> const& a, wchar_t const* b) - { - return alternative<A, strlit<wchar_t const*> >(a.derived(), b); - } - - template <typename B> - inline alternative<strlit<wchar_t const*>, B> - operator|(wchar_t const* a, parser<B> const& b) - { - return alternative<strlit<wchar_t const*>, B>(a, b.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/difference.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/difference.ipp deleted file mode 100644 index 533ec343e5410be53bbd6d477217f3cf7bf4b000..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/difference.ipp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_DIFFERENCE_IPP) -#define BOOST_SPIRIT_DIFFERENCE_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // difference class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline difference<A, B> - operator-(parser<A> const& a, parser<B> const& b) - { - return difference<A, B>(a.derived(), b.derived()); - } - - template <typename A> - inline difference<A, chlit<char> > - operator-(parser<A> const& a, char b) - { - return difference<A, chlit<char> >(a.derived(), b); - } - - template <typename B> - inline difference<chlit<char>, B> - operator-(char a, parser<B> const& b) - { - return difference<chlit<char>, B>(a, b.derived()); - } - - template <typename A> - inline difference<A, strlit<char const*> > - operator-(parser<A> const& a, char const* b) - { - return difference<A, strlit<char const*> >(a.derived(), b); - } - - template <typename B> - inline difference<strlit<char const*>, B> - operator-(char const* a, parser<B> const& b) - { - return difference<strlit<char const*>, B>(a, b.derived()); - } - - template <typename A> - inline difference<A, chlit<wchar_t> > - operator-(parser<A> const& a, wchar_t b) - { - return difference<A, chlit<wchar_t> >(a.derived(), b); - } - - template <typename B> - inline difference<chlit<wchar_t>, B> - operator-(wchar_t a, parser<B> const& b) - { - return difference<chlit<wchar_t>, B>(a, b.derived()); - } - - template <typename A> - inline difference<A, strlit<wchar_t const*> > - operator-(parser<A> const& a, wchar_t const* b) - { - return difference<A, strlit<wchar_t const*> >(a.derived(), b); - } - - template <typename B> - inline difference<strlit<wchar_t const*>, B> - operator-(wchar_t const* a, parser<B> const& b) - { - return difference<strlit<wchar_t const*>, B>(a, b.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/directives.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/directives.ipp deleted file mode 100644 index 48cc1d10ed599d3d89bd7bd34a3c212a6d2f66a5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/directives.ipp +++ /dev/null @@ -1,370 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2001 Bruce Florman - Copyright (c) 2002 Raghavendra Satish - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_DIRECTIVES_IPP) -#define BOOST_SPIRIT_DIRECTIVES_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/scanner/skipper.hpp> - -namespace boost { namespace spirit { - - template <typename BaseT> - struct no_skipper_iteration_policy; - - template <typename BaseT> - struct inhibit_case_iteration_policy; - - template <typename A, typename B> - struct alternative; - - template <typename A, typename B> - struct longest_alternative; - - template <typename A, typename B> - struct shortest_alternative; - - namespace impl - { - template <typename RT, typename ST, typename ScannerT, typename BaseT> - inline RT - contiguous_parser_parse( - ST const& s, - ScannerT const& scan, - skipper_iteration_policy<BaseT> const&) - { - typedef scanner_policies< - no_skipper_iteration_policy< - BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, - BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, - BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t - > policies_t; - - scan.skip(scan); - RT hit = s.parse(scan.change_policies(policies_t(scan))); - // We will not do a post skip!!! - return hit; - } - - template <typename RT, typename ST, typename ScannerT, typename BaseT> - inline RT - contiguous_parser_parse( - ST const& s, - ScannerT const& scan, - no_skipper_iteration_policy<BaseT> const&) - { - return s.parse(scan); - } - - template <typename RT, typename ST, typename ScannerT> - inline RT - contiguous_parser_parse( - ST const& s, - ScannerT const& scan, - iteration_policy const&) - { - return s.parse(scan); - } - - template < - typename RT, - typename ParserT, - typename ScannerT, - typename BaseT> - inline RT - implicit_lexeme_parse( - ParserT const& p, - ScannerT const& scan, - skipper_iteration_policy<BaseT> const&) - { - typedef scanner_policies< - no_skipper_iteration_policy< - BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, - BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, - BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t - > policies_t; - - scan.skip(scan); - RT hit = p.parse_main(scan.change_policies(policies_t(scan))); - // We will not do a post skip!!! - return hit; - } - - template < - typename RT, - typename ParserT, - typename ScannerT, - typename BaseT> - inline RT - implicit_lexeme_parse( - ParserT const& p, - ScannerT const& scan, - no_skipper_iteration_policy<BaseT> const&) - { - return p.parse_main(scan); - } - - template <typename RT, typename ParserT, typename ScannerT> - inline RT - implicit_lexeme_parse( - ParserT const& p, - ScannerT const& scan, - iteration_policy const&) - { - return p.parse_main(scan); - } - - template <typename RT, typename ST, typename ScannerT> - inline RT - inhibit_case_parser_parse( - ST const& s, - ScannerT const& scan, - iteration_policy const&) - { - typedef scanner_policies< - inhibit_case_iteration_policy< - BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, - BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, - BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t - > policies_t; - - return s.parse(scan.change_policies(policies_t(scan))); - } - - template <typename RT, typename ST, typename ScannerT, typename BaseT> - inline RT - inhibit_case_parser_parse( - ST const& s, - ScannerT const& scan, - inhibit_case_iteration_policy<BaseT> const&) - { - return s.parse(scan); - } - -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - /////////////////////////////////////////////////////////////////////// - // - // from spirit 1.1 (copyright (c) 2001 Bruce Florman) - // various workarounds to support longest and shortest directives - // - /////////////////////////////////////////////////////////////////////// - template <typename T> - struct is_alternative - { - // Determine at compile time (without partial specialization) - // whether a given type is an instance of the alternative<A,B> - - static T t(); - template <typename A, typename B> - static char test_(alternative<A, B> const&); // no implementation - static int test_(...); // no implementation - enum { r = sizeof(char) == sizeof(test_(t())) }; - typedef mpl::bool_<r> value; - }; - - template <typename T> struct select_to_longest; - - template <typename T> - struct to_longest_alternative - { - typedef typename select_to_longest<T>::result_t result_t; - typedef typename select_to_longest<T>::plain_t plain_t; - typedef typename select_to_longest<T>::choose_t choose_t; - static result_t convert(T const& a); - }; - - template <typename T> - struct to_longest_generic - { - typedef T const& result_t; - typedef T plain_t; - typedef mpl::false_ choose_t; - }; - - template <typename T> - inline T const& - to_longest_convert(T const& a, mpl::false_) - { return a; } - - template <typename T> - struct to_longest_recursive - { - typedef typename to_longest_alternative< - typename T::left_t>::plain_t a_t; - typedef typename to_longest_alternative< - typename T::right_t>::plain_t b_t; - - typedef longest_alternative<a_t, b_t> result_t; - - typedef result_t plain_t; - typedef mpl::true_ choose_t; - }; - - template <typename A, typename B> - inline typename to_longest_alternative<alternative<A, B> >::result_t - to_longest_convert(alternative<A, B> const& alt, mpl::true_) - { - typedef typename to_longest_alternative< - alternative<A, B> >::result_t result_t; - return result_t( - to_longest_alternative<A>::convert(alt.left()), - to_longest_alternative<B>::convert(alt.right())); - } - - template <typename T> - inline typename to_longest_alternative<T>::result_t - to_longest_alternative<T>::convert(T const& a) - { - return to_longest_convert( - a, to_longest_alternative<T>::choose_t()); - } - - template <typename T> - struct select_to_longest - { - typedef typename mpl::if_< - is_alternative<T> // IF - , to_longest_recursive<T> // THEN - , to_longest_generic<T> // ELSE - >::type type; - - typedef typename select_to_longest::type::result_t result_t; - typedef typename select_to_longest::type::plain_t plain_t; - typedef typename select_to_longest::type::choose_t choose_t; - }; - - template <typename T> struct select_to_shortest; - - template <typename T> - struct to_shortest_alternative - { - typedef typename select_to_shortest<T>::result_t result_t; - typedef typename select_to_shortest<T>::plain_t plain_t; - typedef typename select_to_shortest<T>::choose_t choose_t; - static result_t convert(T const& a); - }; - - template <typename T> - struct to_shortest_generic - { - typedef T const& result_t; - typedef T plain_t; - typedef mpl::false_ choose_t; - }; - - template <typename T> - inline T const& - to_shortest_convert(T const& a, mpl::false_) { return a; } - - template <typename T> - struct to_shortest_recursive - { - typedef typename to_shortest_alternative< - typename T::left_t>::plain_t a_t; - typedef typename to_shortest_alternative< - typename T::right_t>::plain_t b_t; - - typedef shortest_alternative<a_t, b_t> result_t; - - typedef result_t plain_t; - typedef mpl::true_ choose_t; - }; - - template <typename A, typename B> - inline typename to_shortest_alternative<alternative<A, B> >::result_t - to_shortest_convert(alternative<A, B> const& alt, mpl::true_) - { - typedef typename to_shortest_alternative< - alternative<A, B> >::result_t result_t; - return result_t( - to_shortest_alternative<A>::convert(alt.left()), - to_shortest_alternative<B>::convert(alt.right())); - } - - template <typename T> - inline typename to_shortest_alternative<T>::result_t - to_shortest_alternative<T>::convert(T const& a) - { - return to_shortest_convert( - a, to_shortest_alternative<T>::choose_t()); - } - - template <typename T> - struct select_to_shortest - { - typedef typename mpl::if_< - is_alternative<T> // IF - , to_shortest_recursive<T> // THEN - , to_shortest_generic<T> // ELSE - >::type type; - - typedef typename select_to_shortest::type::result_t result_t; - typedef typename select_to_shortest::type::plain_t plain_t; - typedef typename select_to_shortest::type::choose_t choose_t; - }; -#else - template <typename T> - struct to_longest_alternative - { - typedef T result_t; - static result_t const& - convert(T const& a) // Special (end) case - { return a; } - }; - - template <typename A, typename B> - struct to_longest_alternative<alternative<A, B> > - { - typedef typename to_longest_alternative<A>::result_t a_t; - typedef typename to_longest_alternative<B>::result_t b_t; - typedef longest_alternative<a_t, b_t> result_t; - - static result_t - convert(alternative<A, B> const& alt) // Recursive case - { - return result_t( - to_longest_alternative<A>::convert(alt.left()), - to_longest_alternative<B>::convert(alt.right())); - } - }; - - template <typename T> - struct to_shortest_alternative - { - typedef T result_t; - static result_t const& - convert(T const& a) // Special (end) case - { return a; } - }; - - template <typename A, typename B> - struct to_shortest_alternative<alternative<A, B> > - { - typedef typename to_shortest_alternative<A>::result_t a_t; - typedef typename to_shortest_alternative<B>::result_t b_t; - typedef shortest_alternative<a_t, b_t> result_t; - - static result_t - convert(alternative<A, B> const& alt) // Recursive case - { - return result_t( - to_shortest_alternative<A>::convert(alt.left()), - to_shortest_alternative<B>::convert(alt.right())); - } - }; -#endif - } - -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/exclusive_or.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/exclusive_or.ipp deleted file mode 100644 index 79a607dce1749b10529b9360d57755dde6152771..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/exclusive_or.ipp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_EXCLUSIVE_OR_IPP) -#define BOOST_SPIRIT_EXCLUSIVE_OR_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // exclusive_or class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline exclusive_or<A, B> - operator^(parser<A> const& a, parser<B> const& b) - { - return exclusive_or<A, B>(a.derived(), b.derived()); - } - - template <typename A> - inline exclusive_or<A, chlit<char> > - operator^(parser<A> const& a, char b) - { - return exclusive_or<A, chlit<char> >(a.derived(), b); - } - - template <typename B> - inline exclusive_or<chlit<char>, B> - operator^(char a, parser<B> const& b) - { - return exclusive_or<chlit<char>, B>(a, b.derived()); - } - - template <typename A> - inline exclusive_or<A, strlit<char const*> > - operator^(parser<A> const& a, char const* b) - { - return exclusive_or<A, strlit<char const*> >(a.derived(), b); - } - - template <typename B> - inline exclusive_or<strlit<char const*>, B> - operator^(char const* a, parser<B> const& b) - { - return exclusive_or<strlit<char const*>, B>(a, b.derived()); - } - - template <typename A> - inline exclusive_or<A, chlit<wchar_t> > - operator^(parser<A> const& a, wchar_t b) - { - return exclusive_or<A, chlit<wchar_t> >(a.derived(), b); - } - - template <typename B> - inline exclusive_or<chlit<wchar_t>, B> - operator^(wchar_t a, parser<B> const& b) - { - return exclusive_or<chlit<wchar_t>, B>(a, b.derived()); - } - - template <typename A> - inline exclusive_or<A, strlit<wchar_t const*> > - operator^(parser<A> const& a, wchar_t const* b) - { - return exclusive_or<A, strlit<wchar_t const*> >(a.derived(), b); - } - - template <typename B> - inline exclusive_or<strlit<wchar_t const*>, B> - operator^(wchar_t const* a, parser<B> const& b) - { - return exclusive_or<strlit<wchar_t const*>, B>(a, b.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/intersection.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/intersection.ipp deleted file mode 100644 index 5f1f51b2835ade59a9361dbe3770db2c4e16bb76..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/intersection.ipp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_INTERSECTION_IPP) -#define BOOST_SPIRIT_INTERSECTION_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // intersection class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline intersection<A, B> - operator&(parser<A> const& a, parser<B> const& b) - { - return intersection<A, B>(a.derived(), b.derived()); - } - - template <typename A> - inline intersection<A, chlit<char> > - operator&(parser<A> const& a, char b) - { - return intersection<A, chlit<char> >(a.derived(), b); - } - - template <typename B> - inline intersection<chlit<char>, B> - operator&(char a, parser<B> const& b) - { - return intersection<chlit<char>, B>(a, b.derived()); - } - - template <typename A> - inline intersection<A, strlit<char const*> > - operator&(parser<A> const& a, char const* b) - { - return intersection<A, strlit<char const*> >(a.derived(), b); - } - - template <typename B> - inline intersection<strlit<char const*>, B> - operator&(char const* a, parser<B> const& b) - { - return intersection<strlit<char const*>, B>(a, b.derived()); - } - - template <typename A> - inline intersection<A, chlit<wchar_t> > - operator&(parser<A> const& a, wchar_t b) - { - return intersection<A, chlit<wchar_t> >(a.derived(), b); - } - - template <typename B> - inline intersection<chlit<wchar_t>, B> - operator&(wchar_t a, parser<B> const& b) - { - return intersection<chlit<wchar_t>, B>(a, b.derived()); - } - - template <typename A> - inline intersection<A, strlit<wchar_t const*> > - operator&(parser<A> const& a, wchar_t const* b) - { - return intersection<A, strlit<wchar_t const*> >(a.derived(), b); - } - - template <typename B> - inline intersection<strlit<wchar_t const*>, B> - operator&(wchar_t const* a, parser<B> const& b) - { - return intersection<strlit<wchar_t const*>, B>(a, b.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/kleene_star.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/kleene_star.ipp deleted file mode 100644 index 1ed639fb0c31580f05b8c92197454691cd70801b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/kleene_star.ipp +++ /dev/null @@ -1,30 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_KLEENE_STAR_IPP) -#define BOOST_SPIRIT_KLEENE_STAR_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // kleene_star class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename S> - inline kleene_star<S> - operator*(parser<S> const& a) - { - return kleene_star<S>(a.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/list.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/list.ipp deleted file mode 100644 index 36ecbc56fe0a1e979887cf911776c0b1b3c7563f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/list.ipp +++ /dev/null @@ -1,89 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_LIST_IPP) -#define BOOST_SPIRIT_LIST_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // operator% is defined as: - // a % b ---> a >> *(b >> a) - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline sequence<A, kleene_star<sequence<B, A> > > - operator%(parser<A> const& a, parser<B> const& b) - { - return a.derived() >> *(b.derived() >> a.derived()); - } - - template <typename A> - inline sequence<A, kleene_star<sequence<chlit<char>, A> > > - operator%(parser<A> const& a, char b) - { - return a.derived() >> *(b >> a.derived()); - } - - template <typename B> - inline sequence<chlit<char>, kleene_star<sequence<B, chlit<char> > > > - operator%(char a, parser<B> const& b) - { - return a >> *(b.derived() >> a); - } - - template <typename A> - inline sequence<A, kleene_star<sequence<strlit<char const*>, A> > > - operator%(parser<A> const& a, char const* b) - { - return a.derived() >> *(b >> a.derived()); - } - - template <typename B> - inline sequence<strlit<char const*>, - kleene_star<sequence<B, strlit<char const*> > > > - operator%(char const* a, parser<B> const& b) - { - return a >> *(b.derived() >> a); - } - - template <typename A> - inline sequence<A, kleene_star<sequence<chlit<wchar_t>, A> > > - operator%(parser<A> const& a, wchar_t b) - { - return a.derived() >> *(b >> a.derived()); - } - - template <typename B> - inline sequence<chlit<wchar_t>, kleene_star<sequence<B, chlit<wchar_t> > > > - operator%(wchar_t a, parser<B> const& b) - { - return a >> *(b.derived() >> a); - } - - template <typename A> - inline sequence<A, kleene_star<sequence<strlit<wchar_t const*>, A> > > - operator%(parser<A> const& a, wchar_t const* b) - { - return a.derived() >> *(b >> a.derived()); - } - - template <typename B> - inline sequence<strlit<wchar_t const*>, - kleene_star<sequence<B, strlit<wchar_t const*> > > > - operator%(wchar_t const* a, parser<B> const& b) - { - return a >> *(b.derived() >> a); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/optional.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/optional.ipp deleted file mode 100644 index 7bbe6b406507a0d0860a08c0da8c16fccafb550f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/optional.ipp +++ /dev/null @@ -1,30 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_OPTIONAL_IPP) -#define BOOST_SPIRIT_OPTIONAL_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // optional class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename S> - optional<S> - operator!(parser<S> const& a) - { - return optional<S>(a.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/positive.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/positive.ipp deleted file mode 100644 index cce8dc974685813e23a434258915bb15888e2b1f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/positive.ipp +++ /dev/null @@ -1,30 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_POSITIVE_IPP) -#define BOOST_SPIRIT_POSITIVE_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // positive class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename S> - inline positive<S> - operator+(parser<S> const& a) - { - return positive<S>(a.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/sequence.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/sequence.ipp deleted file mode 100644 index 041dff08886686808ef209a5ba553f824e38cd58..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/sequence.ipp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SEQUENCE_IPP) -#define BOOST_SPIRIT_SEQUENCE_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // sequence class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline sequence<A, B> - operator>>(parser<A> const& a, parser<B> const& b) - { - return sequence<A, B>(a.derived(), b.derived()); - } - - template <typename A> - inline sequence<A, chlit<char> > - operator>>(parser<A> const& a, char b) - { - return sequence<A, chlit<char> >(a.derived(), b); - } - - template <typename B> - inline sequence<chlit<char>, B> - operator>>(char a, parser<B> const& b) - { - return sequence<chlit<char>, B>(a, b.derived()); - } - - template <typename A> - inline sequence<A, strlit<char const*> > - operator>>(parser<A> const& a, char const* b) - { - return sequence<A, strlit<char const*> >(a.derived(), b); - } - - template <typename B> - inline sequence<strlit<char const*>, B> - operator>>(char const* a, parser<B> const& b) - { - return sequence<strlit<char const*>, B>(a, b.derived()); - } - - template <typename A> - inline sequence<A, chlit<wchar_t> > - operator>>(parser<A> const& a, wchar_t b) - { - return sequence<A, chlit<wchar_t> >(a.derived(), b); - } - - template <typename B> - inline sequence<chlit<wchar_t>, B> - operator>>(wchar_t a, parser<B> const& b) - { - return sequence<chlit<wchar_t>, B>(a, b.derived()); - } - - template <typename A> - inline sequence<A, strlit<wchar_t const*> > - operator>>(parser<A> const& a, wchar_t const* b) - { - return sequence<A, strlit<wchar_t const*> >(a.derived(), b); - } - - template <typename B> - inline sequence<strlit<wchar_t const*>, B> - operator>>(wchar_t const* a, parser<B> const& b) - { - return sequence<strlit<wchar_t const*>, B>(a, b.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/sequential_and.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/sequential_and.ipp deleted file mode 100644 index 03b0904ed3f27446297c97dbc8bd8b0fd5298598..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/sequential_and.ipp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SEQUENTIAL_AND_IPP) -#define BOOST_SPIRIT_SEQUENTIAL_AND_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // sequential-and operators implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline sequence<A, B> - operator&&(parser<A> const& a, parser<B> const& b) - { - return sequence<A, B>(a.derived(), b.derived()); - } - - template <typename A> - inline sequence<A, chlit<char> > - operator&&(parser<A> const& a, char b) - { - return sequence<A, chlit<char> >(a.derived(), b); - } - - template <typename B> - inline sequence<chlit<char>, B> - operator&&(char a, parser<B> const& b) - { - return sequence<chlit<char>, B>(a, b.derived()); - } - - template <typename A> - inline sequence<A, strlit<char const*> > - operator&&(parser<A> const& a, char const* b) - { - return sequence<A, strlit<char const*> >(a.derived(), b); - } - - template <typename B> - inline sequence<strlit<char const*>, B> - operator&&(char const* a, parser<B> const& b) - { - return sequence<strlit<char const*>, B>(a, b.derived()); - } - - template <typename A> - inline sequence<A, chlit<wchar_t> > - operator&&(parser<A> const& a, wchar_t b) - { - return sequence<A, chlit<wchar_t> >(a.derived(), b); - } - - template <typename B> - inline sequence<chlit<wchar_t>, B> - operator&&(wchar_t a, parser<B> const& b) - { - return sequence<chlit<wchar_t>, B>(a, b.derived()); - } - - template <typename A> - inline sequence<A, strlit<wchar_t const*> > - operator&&(parser<A> const& a, wchar_t const* b) - { - return sequence<A, strlit<wchar_t const*> >(a.derived(), b); - } - - template <typename B> - inline sequence<strlit<wchar_t const*>, B> - operator&&(wchar_t const* a, parser<B> const& b) - { - return sequence<strlit<wchar_t const*>, B>(a, b.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/impl/sequential_or.ipp b/Utilities/BGL/boost/spirit/core/composite/impl/sequential_or.ipp deleted file mode 100644 index f5a41f3d39da7da7354908f55b203683f5176028..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/impl/sequential_or.ipp +++ /dev/null @@ -1,86 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SEQUENTIAL_OR_IPP) -#define BOOST_SPIRIT_SEQUENTIAL_OR_IPP - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // sequential-or class implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - inline sequential_or<A, B> - operator||(parser<A> const& a, parser<B> const& b) - { - return sequential_or<A, B>(a.derived(), b.derived()); - } - - template <typename A> - inline sequential_or<A, chlit<char> > - operator||(parser<A> const& a, char b) - { - return sequential_or<A, chlit<char> >(a.derived(), b); - } - - template <typename B> - inline sequential_or<chlit<char>, B> - operator||(char a, parser<B> const& b) - { - return sequential_or<chlit<char>, B>(a, b.derived()); - } - - template <typename A> - inline sequential_or<A, strlit<char const*> > - operator||(parser<A> const& a, char const* b) - { - return sequential_or<A, strlit<char const*> >(a.derived(), b); - } - - template <typename B> - inline sequential_or<strlit<char const*>, B> - operator||(char const* a, parser<B> const& b) - { - return sequential_or<strlit<char const*>, B>(a, b.derived()); - } - - template <typename A> - inline sequential_or<A, chlit<wchar_t> > - operator||(parser<A> const& a, wchar_t b) - { - return sequential_or<A, chlit<wchar_t> >(a.derived(), b); - } - - template <typename B> - inline sequential_or<chlit<wchar_t>, B> - operator||(wchar_t a, parser<B> const& b) - { - return sequential_or<chlit<wchar_t>, B>(a, b.derived()); - } - - template <typename A> - inline sequential_or<A, strlit<wchar_t const*> > - operator||(parser<A> const& a, wchar_t const* b) - { - return sequential_or<A, strlit<wchar_t const*> >(a.derived(), b); - } - - template <typename B> - inline sequential_or<strlit<wchar_t const*>, B> - operator||(wchar_t const* a, parser<B> const& b) - { - return sequential_or<strlit<wchar_t const*>, B>(a, b.derived()); - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/intersection.hpp b/Utilities/BGL/boost/spirit/core/composite/intersection.hpp deleted file mode 100644 index 07fb38484c9b57382f8118db9d70dc71d315a535..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/intersection.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_INTERSECTION_HPP) -#define BOOST_SPIRIT_INTERSECTION_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // intersection class - // - // Handles expressions of the form: - // - // a & b - // - // where a and b are parsers. The expression returns a composite - // parser that matches a and b. One (not both) of the operands may - // be a literal char, wchar_t or a primitive string char const*, - // wchar_t const*. - // - // The expression is short circuit evaluated. b is never touched - // when a is returns a no-match. - // - /////////////////////////////////////////////////////////////////////////// - struct intersection_parser_gen; - - template <typename A, typename B> - struct intersection - : public binary<A, B, parser<intersection<A, B> > > - { - typedef intersection<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef intersection_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - intersection(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - iterator_t save = scan.first; - if (result_t hl = this->left().parse(scan)) - { - ScannerT bscan(scan.first, scan.first, scan); - scan.first = save; - result_t hr = this->right().parse(bscan); - if (hl.length() == hr.length()) - return hl; - } - - return scan.no_match(); - } - }; - - struct intersection_parser_gen - { - template <typename A, typename B> - struct result - { - typedef - intersection< - typename as_parser<A>::type - , typename as_parser<B>::type - > - type; - }; - - template <typename A, typename B> - static intersection< - typename as_parser<A>::type - , typename as_parser<B>::type - > - generate(A const& a, B const& b) - { - return intersection<BOOST_DEDUCED_TYPENAME as_parser<A>::type, - BOOST_DEDUCED_TYPENAME as_parser<B>::type> - (as_parser<A>::convert(a), as_parser<B>::convert(b)); - } - }; - - template <typename A, typename B> - intersection<A, B> - operator&(parser<A> const& a, parser<B> const& b); - - template <typename A> - intersection<A, chlit<char> > - operator&(parser<A> const& a, char b); - - template <typename B> - intersection<chlit<char>, B> - operator&(char a, parser<B> const& b); - - template <typename A> - intersection<A, strlit<char const*> > - operator&(parser<A> const& a, char const* b); - - template <typename B> - intersection<strlit<char const*>, B> - operator&(char const* a, parser<B> const& b); - - template <typename A> - intersection<A, chlit<wchar_t> > - operator&(parser<A> const& a, wchar_t b); - - template <typename B> - intersection<chlit<wchar_t>, B> - operator&(wchar_t a, parser<B> const& b); - - template <typename A> - intersection<A, strlit<wchar_t const*> > - operator&(parser<A> const& a, wchar_t const* b); - - template <typename B> - intersection<strlit<wchar_t const*>, B> - operator&(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/intersection.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/kleene_star.hpp b/Utilities/BGL/boost/spirit/core/composite/kleene_star.hpp deleted file mode 100644 index 0dc3ac5a44f1e1db151cbe45890f4d0629c3c887..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/kleene_star.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_KLEENE_STAR_HPP) -#define BOOST_SPIRIT_KLEENE_STAR_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // kleene_star class - // - // Handles expressions of the form: - // - // *a - // - // where a is a parser. The expression returns a composite - // parser that matches its subject zero (0) or more times. - // - /////////////////////////////////////////////////////////////////////////// - struct kleene_star_parser_gen; - - template <typename S> - struct kleene_star - : public unary<S, parser<kleene_star<S> > > - { - typedef kleene_star<S> self_t; - typedef unary_parser_category parser_category_t; - typedef kleene_star_parser_gen parser_generator_t; - typedef unary<S, parser<self_t> > base_t; - - kleene_star(S const& a) - : base_t(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - result_t hit = scan.empty_match(); - - for (;;) - { - iterator_t save = scan.first; - if (result_t next = this->subject().parse(scan)) - { - scan.concat_match(hit, next); - } - else - { - scan.first = save; - return hit; - } - } - } - }; - - struct kleene_star_parser_gen - { - template <typename S> - struct result - { - typedef kleene_star<S> type; - }; - - template <typename S> - static kleene_star<S> - generate(parser<S> const& a) - { - return kleene_star<S>(a.derived()); - } - }; - - ////////////////////////////////// - template <typename S> - kleene_star<S> - operator*(parser<S> const& a); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/kleene_star.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/list.hpp b/Utilities/BGL/boost/spirit/core/composite/list.hpp deleted file mode 100644 index 7e94ea024558dc44a0bde33a3a90e6382b363187..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/list.hpp +++ /dev/null @@ -1,69 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_LIST_HPP) -#define BOOST_SPIRIT_LIST_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // operator% is defined as: - // a % b ---> a >> *(b >> a) - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - sequence<A, kleene_star<sequence<B, A> > > - operator%(parser<A> const& a, parser<B> const& b); - - template <typename A> - sequence<A, kleene_star<sequence<chlit<char>, A> > > - operator%(parser<A> const& a, char b); - - template <typename B> - sequence<chlit<char>, kleene_star<sequence<B, chlit<char> > > > - operator%(char a, parser<B> const& b); - - template <typename A> - sequence<A, kleene_star<sequence<strlit<char const*>, A> > > - operator%(parser<A> const& a, char const* b); - - template <typename B> - sequence<strlit<char const*>, - kleene_star<sequence<B, strlit<char const*> > > > - operator%(char const* a, parser<B> const& b); - - template <typename A> - sequence<A, kleene_star<sequence<chlit<wchar_t>, A> > > - operator%(parser<A> const& a, wchar_t b); - - template <typename B> - sequence<chlit<wchar_t>, kleene_star<sequence<B, chlit<wchar_t> > > > - operator%(wchar_t a, parser<B> const& b); - - template <typename A> - sequence<A, kleene_star<sequence<strlit<wchar_t const*>, A> > > - operator%(parser<A> const& a, wchar_t const* b); - - template <typename B> - sequence<strlit<wchar_t const*>, - kleene_star<sequence<B, strlit<wchar_t const*> > > > - operator%(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/list.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/no_actions.hpp b/Utilities/BGL/boost/spirit/core/composite/no_actions.hpp deleted file mode 100644 index 32a766f4f628865390507707d8e4af7d1a3806f6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/no_actions.hpp +++ /dev/null @@ -1,147 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2003 Vaclav Vesely - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_NO_ACTIONS_HPP) -#define BOOST_SPIRIT_NO_ACTIONS_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/core/non_terminal/rule.hpp> - -namespace boost { -namespace spirit { -//----------------------------------------------------------------------------- -// no_actions_action_policy - -template<typename BaseT = action_policy> -struct no_actions_action_policy: - public BaseT -{ - typedef BaseT base_t; - - no_actions_action_policy(): - BaseT() - {} - - template<typename PolicyT> - no_actions_action_policy(PolicyT const& other): - BaseT(other) - {} - - template<typename ActorT, typename AttrT, typename IteratorT> - void - do_action( - ActorT const& actor, - AttrT& val, - IteratorT const& first, - IteratorT const& last) const - {} -}; - -//----------------------------------------------------------------------------- -// no_actions_scanner - -template<typename ScannerT = scanner<> > -struct no_actions_scanner -{ - typedef scanner_policies< - typename ScannerT::iteration_policy_t, - typename ScannerT::match_policy_t, - no_actions_action_policy<typename ScannerT::action_policy_t> - > policies_t; - - typedef typename - rebind_scanner_policies<ScannerT, policies_t>::type type; -}; - -#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 - -template<typename ScannerT = scanner<> > -struct no_actions_scanner_list -{ - typedef - scanner_list< - ScannerT, - typename no_actions_scanner<ScannerT>::type - > - type; -}; - -#endif // BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 - -//----------------------------------------------------------------------------- -// no_actions_parser - -struct no_actions_parser_gen; - -template<typename ParserT> -struct no_actions_parser: - public unary<ParserT, parser<no_actions_parser<ParserT> > > -{ - typedef no_actions_parser<ParserT> self_t; - typedef unary_parser_category parser_category_t; - typedef no_actions_parser_gen parser_generator_t; - typedef unary<ParserT, parser<self_t> > base_t; - - template<typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - no_actions_parser(ParserT const& p) - : base_t(p) - {} - - template<typename ScannerT> - typename result<ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename no_actions_scanner<ScannerT>::policies_t policies_t; - - return this->subject().parse(scan.change_policies(policies_t(scan))); - } -}; - -//----------------------------------------------------------------------------- -// no_actions_parser_gen - -struct no_actions_parser_gen -{ - template<typename ParserT> - struct result - { - typedef no_actions_parser<ParserT> type; - }; - - template<typename ParserT> - static no_actions_parser<ParserT> - generate(parser<ParserT> const& subject) - { - return no_actions_parser<ParserT>(subject.derived()); - } - - template<typename ParserT> - no_actions_parser<ParserT> - operator[](parser<ParserT> const& subject) const - { - return no_actions_parser<ParserT>(subject.derived()); - } -}; - -//----------------------------------------------------------------------------- -// no_actions_d - -const no_actions_parser_gen no_actions_d = no_actions_parser_gen(); - -//----------------------------------------------------------------------------- -} // namespace spirit -} // namespace boost - -#endif // !defined(BOOST_SPIRIT_NO_ACTIONS_HPP) diff --git a/Utilities/BGL/boost/spirit/core/composite/operators.hpp b/Utilities/BGL/boost/spirit/core/composite/operators.hpp deleted file mode 100644 index a6563fe8e5eb46a689d2b26b235d33ce571e6f4f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/operators.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_OPERATORS_HPP) -#define BOOST_SPIRIT_OPERATORS_HPP - -#include <boost/spirit/core/composite/sequence.hpp> -#include <boost/spirit/core/composite/sequential_and.hpp> -#include <boost/spirit/core/composite/sequential_or.hpp> -#include <boost/spirit/core/composite/alternative.hpp> -#include <boost/spirit/core/composite/difference.hpp> -#include <boost/spirit/core/composite/intersection.hpp> -#include <boost/spirit/core/composite/exclusive_or.hpp> -#include <boost/spirit/core/composite/kleene_star.hpp> -#include <boost/spirit/core/composite/positive.hpp> -#include <boost/spirit/core/composite/optional.hpp> -#include <boost/spirit/core/composite/list.hpp> - -#endif diff --git a/Utilities/BGL/boost/spirit/core/composite/optional.hpp b/Utilities/BGL/boost/spirit/core/composite/optional.hpp deleted file mode 100644 index 5018551a2e905dbc7dafbe225be353c0a1ae7d77..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/optional.hpp +++ /dev/null @@ -1,90 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_OPTIONAL_HPP) -#define BOOST_SPIRIT_OPTIONAL_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // optional class - // - // Handles expressions of the form: - // - // !a - // - // where a is a parser. The expression returns a composite - // parser that matches its subject zero (0) or one (1) time. - // - /////////////////////////////////////////////////////////////////////////// - struct optional_parser_gen; - - template <typename S> - struct optional - : public unary<S, parser<optional<S> > > - { - typedef optional<S> self_t; - typedef unary_parser_category parser_category_t; - typedef optional_parser_gen parser_generator_t; - typedef unary<S, parser<self_t> > base_t; - - optional(S const& a) - : base_t(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - iterator_t save = scan.first; - if (result_t r = this->subject().parse(scan)) - { - return r; - } - else - { - scan.first = save; - return scan.empty_match(); - } - } - }; - - struct optional_parser_gen - { - template <typename S> - struct result - { - typedef optional<S> type; - }; - - template <typename S> - static optional<S> - generate(parser<S> const& a) - { - return optional<S>(a.derived()); - } - }; - - template <typename S> - optional<S> - operator!(parser<S> const& a); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/optional.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/positive.hpp b/Utilities/BGL/boost/spirit/core/composite/positive.hpp deleted file mode 100644 index f108037a1c608e9f4610619bf81e88243d4683d5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/positive.hpp +++ /dev/null @@ -1,99 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_POSITIVE_HPP) -#define BOOST_SPIRIT_POSITIVE_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // positive class - // - // Handles expressions of the form: - // - // +a - // - // where a is a parser. The expression returns a composite - // parser that matches its subject one (1) or more times. - // - /////////////////////////////////////////////////////////////////////////// - struct positive_parser_gen; - - template <typename S> - struct positive - : public unary<S, parser<positive<S> > > - { - typedef positive<S> self_t; - typedef unary_parser_category parser_category_t; - typedef positive_parser_gen parser_generator_t; - typedef unary<S, parser<self_t> > base_t; - - positive(S const& a) - : base_t(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - result_t hit = this->subject().parse(scan); - - if (hit) - { - for (;;) - { - iterator_t save = scan.first; - if (result_t next = this->subject().parse(scan)) - { - scan.concat_match(hit, next); - } - else - { - scan.first = save; - break; - } - } - } - return hit; - } - }; - - struct positive_parser_gen - { - template <typename S> - struct result - { - typedef positive<S> type; - }; - - template <typename S> - static positive<S> - generate(parser<S> const& a) - { - return positive<S>(a.derived()); - } - }; - - template <typename S> - inline positive<S> - operator+(parser<S> const& a); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/positive.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/sequence.hpp b/Utilities/BGL/boost/spirit/core/composite/sequence.hpp deleted file mode 100644 index e600957c79262737cc8e925ef8cb6c5434cf1a32..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/sequence.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SEQUENCE_HPP) -#define BOOST_SPIRIT_SEQUENCE_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // sequence class - // - // Handles expressions of the form: - // - // a >> b - // - // where a and b are parsers. The expression returns a composite - // parser that matches a and b in sequence. One (not both) of the - // operands may be a literal char, wchar_t or a primitive string - // char const*, wchar_t const*. - // - ////////////////////////////////////////////////////////////////////////// - struct sequence_parser_gen; - - template <typename A, typename B> - struct sequence : public binary<A, B, parser<sequence<A, B> > > - { - typedef sequence<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef sequence_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - sequence(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - if (result_t ma = this->left().parse(scan)) - if (result_t mb = this->right().parse(scan)) - { - scan.concat_match(ma, mb); - return ma; - } - return scan.no_match(); - } - }; - - struct sequence_parser_gen - { - template <typename A, typename B> - struct result - { - typedef - sequence< - typename as_parser<A>::type - , typename as_parser<B>::type - > - type; - }; - - template <typename A, typename B> - static sequence< - typename as_parser<A>::type - , typename as_parser<B>::type - > - generate(A const& a, B const& b) - { - return sequence<BOOST_DEDUCED_TYPENAME as_parser<A>::type, - BOOST_DEDUCED_TYPENAME as_parser<B>::type> - (as_parser<A>::convert(a), as_parser<B>::convert(b)); - } - }; - - template <typename A, typename B> - sequence<A, B> - operator>>(parser<A> const& a, parser<B> const& b); - - template <typename A> - sequence<A, chlit<char> > - operator>>(parser<A> const& a, char b); - - template <typename B> - sequence<chlit<char>, B> - operator>>(char a, parser<B> const& b); - - template <typename A> - sequence<A, strlit<char const*> > - operator>>(parser<A> const& a, char const* b); - - template <typename B> - sequence<strlit<char const*>, B> - operator>>(char const* a, parser<B> const& b); - - template <typename A> - sequence<A, chlit<wchar_t> > - operator>>(parser<A> const& a, wchar_t b); - - template <typename B> - sequence<chlit<wchar_t>, B> - operator>>(wchar_t a, parser<B> const& b); - - template <typename A> - sequence<A, strlit<wchar_t const*> > - operator>>(parser<A> const& a, wchar_t const* b); - - template <typename B> - sequence<strlit<wchar_t const*>, B> - operator>>(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/sequence.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/sequential_and.hpp b/Utilities/BGL/boost/spirit/core/composite/sequential_and.hpp deleted file mode 100644 index aa900e00db3c7ad7e8bd40a25108df4c749ac4cc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/sequential_and.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SEQUENTIAL_AND_HPP) -#define BOOST_SPIRIT_SEQUENTIAL_AND_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // sequential-and operators - // - // Handles expressions of the form: - // - // a && b - // - // Same as a >> b. - // - /////////////////////////////////////////////////////////////////////////// - template <typename A, typename B> - sequence<A, B> - operator&&(parser<A> const& a, parser<B> const& b); - - template <typename A> - sequence<A, chlit<char> > - operator&&(parser<A> const& a, char b); - - template <typename B> - sequence<chlit<char>, B> - operator&&(char a, parser<B> const& b); - - template <typename A> - sequence<A, strlit<char const*> > - operator&&(parser<A> const& a, char const* b); - - template <typename B> - sequence<strlit<char const*>, B> - operator&&(char const* a, parser<B> const& b); - - template <typename A> - sequence<A, chlit<wchar_t> > - operator&&(parser<A> const& a, wchar_t b); - - template <typename B> - sequence<chlit<wchar_t>, B> - operator&&(wchar_t a, parser<B> const& b); - - template <typename A> - sequence<A, strlit<wchar_t const*> > - operator&&(parser<A> const& a, wchar_t const* b); - - template <typename B> - sequence<strlit<wchar_t const*>, B> - operator&&(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/sequential_and.ipp> diff --git a/Utilities/BGL/boost/spirit/core/composite/sequential_or.hpp b/Utilities/BGL/boost/spirit/core/composite/sequential_or.hpp deleted file mode 100644 index f4ba9f13d27d5557a0b1e41515bfc283edef9436..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/composite/sequential_or.hpp +++ /dev/null @@ -1,150 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - Copyright (c) 2002 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SEQUENTIAL_OR_HPP) -#define BOOST_SPIRIT_SEQUENTIAL_OR_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // sequential-or class - // - // Handles expressions of the form: - // - // a || b - // - // Equivalent to - // - // a | b | a >> b; - // - // where a and b are parsers. The expression returns a composite - // parser that matches matches a or b in sequence. One (not both) of - // the operands may be a literal char, wchar_t or a primitive string - // char const*, wchar_t const*. - // - /////////////////////////////////////////////////////////////////////////// - struct sequential_or_parser_gen; - - template <typename A, typename B> - struct sequential_or : public binary<A, B, parser<sequential_or<A, B> > > - { - typedef sequential_or<A, B> self_t; - typedef binary_parser_category parser_category_t; - typedef sequential_or_parser_gen parser_generator_t; - typedef binary<A, B, parser<self_t> > base_t; - - sequential_or(A const& a, B const& b) - : base_t(a, b) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - { // scope for save - iterator_t save = scan.first; - if (result_t ma = this->left().parse(scan)) - { - save = scan.first; - if (result_t mb = this->right().parse(scan)) - { - // matched a b - scan.concat_match(ma, mb); - return ma; - } - else - { - // matched a - scan.first = save; - return ma; - } - } - scan.first = save; - } - - // matched b - return this->right().parse(scan); - } - }; - - struct sequential_or_parser_gen - { - template <typename A, typename B> - struct result - { - typedef - sequential_or< - typename as_parser<A>::type - , typename as_parser<B>::type - > - type; - }; - - template <typename A, typename B> - static sequential_or< - typename as_parser<A>::type - , typename as_parser<B>::type - > - generate(A const& a, B const& b) - { - return sequential_or<BOOST_DEDUCED_TYPENAME as_parser<A>::type, - BOOST_DEDUCED_TYPENAME as_parser<B>::type> - (as_parser<A>::convert(a), as_parser<B>::convert(b)); - } - }; - - template <typename A, typename B> - sequential_or<A, B> - operator||(parser<A> const& a, parser<B> const& b); - - template <typename A> - sequential_or<A, chlit<char> > - operator||(parser<A> const& a, char b); - - template <typename B> - sequential_or<chlit<char>, B> - operator||(char a, parser<B> const& b); - - template <typename A> - sequential_or<A, strlit<char const*> > - operator||(parser<A> const& a, char const* b); - - template <typename B> - sequential_or<strlit<char const*>, B> - operator||(char const* a, parser<B> const& b); - - template <typename A> - sequential_or<A, chlit<wchar_t> > - operator||(parser<A> const& a, wchar_t b); - - template <typename B> - sequential_or<chlit<wchar_t>, B> - operator||(wchar_t a, parser<B> const& b); - - template <typename A> - sequential_or<A, strlit<wchar_t const*> > - operator||(parser<A> const& a, wchar_t const* b); - - template <typename B> - sequential_or<strlit<wchar_t const*>, B> - operator||(wchar_t const* a, parser<B> const& b); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/composite/impl/sequential_or.ipp> diff --git a/Utilities/BGL/boost/spirit/core/config.hpp b/Utilities/BGL/boost/spirit/core/config.hpp deleted file mode 100644 index 62a98412e786295c183e1089521817f6e28b8dd0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/config.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_CONFIG_HPP) -#define BOOST_SPIRIT_CONFIG_HPP - -#include <boost/config.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Compiler check: -// -// Historically, Spirit supported a lot of compilers, including (to some -// extent) poorly conforming compilers such as VC6. Spirit v1.6.x will be -// the last release that will support older poorly conforming compilers. -// Starting from Spirit v1.8.0, ill conforming compilers will not be -// supported. If you are still using one of these older compilers, you can -// still use Spirit v1.6.x. -// -// The reason why Spirit v1.6.x worked on old non-conforming compilers is -// that the authors laboriously took the trouble of searching for -// workarounds to make these compilers happy. The process takes a lot of -// time and energy, especially when one encounters the dreaded ICE or -// "Internal Compiler Error". Sometimes searching for a single workaround -// takes days or even weeks. Sometimes, there are no known workarounds. This -// stifles progress a lot. And, as the library gets more progressive and -// takes on more advanced C++ techniques, the difficulty is escalated to -// even new heights. -// -// Spirit v1.6.x will still be supported. Maintenance and bug fixes will -// still be applied. There will still be active development for the back- -// porting of new features introduced in Spirit v1.8.0 (and Spirit 1.9.0) -// to lesser able compilers; hopefully, fueled by contributions from the -// community. For instance, there is already a working AST tree back-port -// for VC6 and VC7 by Peder Holt. -// -// If you got here somehow, your compiler is known to be poorly conforming -// WRT ANSI/ISO C++ standard. Library implementers get a bad reputation when -// someone attempts to compile the code on a non-conforming compiler. She'll -// be confronted with tons of compiler errors when she tries to compile the -// library. Such errors will somehow make less informed users conclude that -// the code is poorly written. It's better for the user to see a message -// "sorry, this code has not been ported to your compiler yet", than to see -// pages and pages of compiler error messages. -// -///////////////////////////////////////////////////////////////////////////////// -#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1310)) \ - || (defined(__BORLANDC__) && (__BORLANDC__ <= 0x570)) \ - || (defined(__GNUC__) && (__GNUC__ < 3)) \ - || (defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) -# error "Compiler not supported. See note in <boost/spirit/core/config.hpp>" -#else -// Pass... Compiler supported. -#endif - -#endif - - diff --git a/Utilities/BGL/boost/spirit/core/impl/match.ipp b/Utilities/BGL/boost/spirit/core/impl/match.ipp deleted file mode 100644 index f30f9f83e9e3755dfe83d877c3d2df86e31adb02..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/impl/match.ipp +++ /dev/null @@ -1,109 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_MATCH_IPP) -#define BOOST_SPIRIT_MATCH_IPP -#include <algorithm> - -namespace boost { namespace spirit -{ - template <typename T> - inline match<T>::match() - : len(-1), val() {} - - template <typename T> - inline match<T>::match(std::size_t length) - : len(length), val() {} - - template <typename T> - inline match<T>::match(std::size_t length, ctor_param_t val_) - : len(length), val(val_) {} - - template <typename T> - inline bool - match<T>::operator!() const - { - return len < 0; - } - - template <typename T> - inline std::ptrdiff_t - match<T>::length() const - { - return len; - } - - template <typename T> - inline bool - match<T>::has_valid_attribute() const - { - return val.is_initialized(); - } - - template <typename T> - inline typename match<T>::return_t - match<T>::value() const - { - BOOST_SPIRIT_ASSERT(val.is_initialized()); - return *val; - } - - template <typename T> - inline void - match<T>::swap(match& other) - { - std::swap(len, other.len); - std::swap(val, other.val); - } - - inline match<nil_t>::match() - : len(-1) {} - - inline match<nil_t>::match(std::size_t length) - : len(length) {} - - inline match<nil_t>::match(std::size_t length, nil_t) - : len(length) {} - - inline bool - match<nil_t>::operator!() const - { - return len < 0; - } - - inline bool - match<nil_t>::has_valid_attribute() const - { - return false; - } - - inline std::ptrdiff_t - match<nil_t>::length() const - { - return len; - } - - inline nil_t - match<nil_t>::value() const - { - return nil_t(); - } - - inline void - match<nil_t>::value(nil_t) {} - - inline void - match<nil_t>::swap(match<nil_t>& other) - { - std::swap(len, other.len); - } - -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/impl/match_attr_traits.ipp b/Utilities/BGL/boost/spirit/core/impl/match_attr_traits.ipp deleted file mode 100644 index c6398b5664287dee7b3758df64f334119566449e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/impl/match_attr_traits.ipp +++ /dev/null @@ -1,94 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_MATCH_ATTR_TRAITS_IPP) -#define BOOST_SPIRIT_MATCH_ATTR_TRAITS_IPP - -#include <boost/optional.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/or.hpp> -#include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/is_same.hpp> - -namespace boost { namespace spirit { namespace impl -{ - template <typename T> - struct match_attr_traits - { - typedef typename - boost::optional<T>::reference_const_type - const_reference; - - // case where src *IS* convertible to T (dest) - template <typename T2> - static void - convert(boost::optional<T>& dest, T2 const& src, mpl::true_) - { - dest.reset(src); - } - - // case where src *IS NOT* convertible to T (dest) - template <typename T2> - static void - convert(boost::optional<T>& dest, T2 const& /*src*/, mpl::false_) - { - dest.reset(); - } - - static void - convert(boost::optional<T>& dest, nil_t/*src*/) - { - dest.reset(); - } - - template <typename T2> - static void - convert(boost::optional<T>& dest, T2 const& src) - { - convert(dest, src, is_convertible<T2, T>()); - } - - template <typename OtherMatchT> - static void - copy(boost::optional<T>& dest, OtherMatchT const& src) - { - if (src.has_valid_attribute()) - convert(dest, src.value()); - } - - template <typename OtherMatchT> - static void - assign(boost::optional<T>& dest, OtherMatchT const& src) - { - if (src.has_valid_attribute()) - convert(dest, src.value()); - else - dest.reset(); - } - - // T is not reference - template <typename ValueT> - static void - set_value(boost::optional<T>& dest, ValueT const& val, mpl::false_) - { - dest.reset(val); - } - - // T is a reference - template <typename ValueT> - static void - set_value(boost::optional<T>& dest, ValueT const& val, mpl::true_) - { - dest.get() = val; - } - }; - -}}} // namespace boost::spirit::impl - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/impl/parser.ipp b/Utilities/BGL/boost/spirit/core/impl/parser.ipp deleted file mode 100644 index 3f5a37224340e1b3f8b36ba0fbb04f89833a6134..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/impl/parser.ipp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_IPP) -#define BOOST_SPIRIT_PARSER_IPP - -namespace boost { namespace spirit -{ - /////////////////////////////////////////////////////////////////////////// - // - // Generic parse function implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename IteratorT, typename DerivedT> - inline parse_info<IteratorT> - parse( - IteratorT const& first_ - , IteratorT const& last - , parser<DerivedT> const& p) - { - IteratorT first = first_; - scanner<IteratorT, scanner_policies<> > scan(first, last); - match<nil_t> hit = p.derived().parse(scan); - return parse_info<IteratorT>( - first, hit, hit && (first == last), hit.length()); - } - - /////////////////////////////////////////////////////////////////////////// - // - // Parse function for null terminated strings implementation - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT, typename DerivedT> - inline parse_info<CharT const*> - parse(CharT const* str, parser<DerivedT> const& p) - { - CharT const* last = str; - while (*last) - last++; - return parse(str, last, p); - } - -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/match.hpp b/Utilities/BGL/boost/spirit/core/match.hpp deleted file mode 100644 index 741cc025d46f80cc4bda6a9ccb0d58127502aead..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/match.hpp +++ /dev/null @@ -1,181 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_MATCH_HPP) -#define BOOST_SPIRIT_MATCH_HPP - -#include <boost/spirit/core/config.hpp> -#include <boost/spirit/core/nil.hpp> -#include <boost/call_traits.hpp> -#include <boost/optional.hpp> -#include <boost/spirit/core/assert.hpp> -#include <boost/spirit/core/safe_bool.hpp> -#include <boost/spirit/core/impl/match_attr_traits.ipp> -#include <boost/type_traits/add_const.hpp> -#include <boost/type_traits/is_reference.hpp> - -namespace boost { namespace spirit -{ - /////////////////////////////////////////////////////////////////////////// - // - // match class - // - // The match holds the result of a parser. A match object evaluates - // to true when a successful match is found, otherwise false. The - // length of the match is the number of characters (or tokens) that - // is successfully matched. This can be queried through its length() - // member function. A negative value means that the match is - // unsucessful. - // - // Each parser may have an associated attribute. This attribute is - // also returned back to the client on a successful parse through - // the match object. The match's value() member function returns the - // match's attribute. - // - // A match attribute is valid: - // - // * on a successful match - // * when its value is set through the value(val) member function - // * if it is assigned or copied from a compatible match object - // (e.g. match<double> from match<int>) with a valid attribute. - // - // The match attribute is undefined: - // - // * on an unsuccessful match - // * when an attempt to copy or assign from another match object - // with an incompatible attribute type (e.g. match<std::string> - // from match<int>). - // - // The member function has_valid_attribute() can be queried to know if - // it is safe to get the match's attribute. The attribute may be set - // through the member function value(v) where v is the new attribute - // value. - // - /////////////////////////////////////////////////////////////////////////// - template <typename T = nil_t> - class match : public safe_bool<match<T> > - { - - public: - - typedef typename boost::optional<T> optional_type; - typedef typename optional_type::argument_type ctor_param_t; - typedef typename optional_type::reference_const_type return_t; - typedef T attr_t; - - match(); - explicit match(std::size_t length); - match(std::size_t length, ctor_param_t val); - - bool operator!() const; - std::ptrdiff_t length() const; - bool has_valid_attribute() const; - return_t value() const; - void swap(match& other); - - template <typename T2> - match(match<T2> const& other) - : len(other.length()), val() - { - impl::match_attr_traits<T>::copy(val, other); - } - - template <typename T2> - match& - operator=(match<T2> const& other) - { - impl::match_attr_traits<T>::assign(val, other); - len = other.length(); - return *this; - } - - template <typename MatchT> - void - concat(MatchT const& other) - { - BOOST_SPIRIT_ASSERT(*this && other); - len += other.length(); - } - - template <typename ValueT> - void - value(ValueT const& val_) - { - impl::match_attr_traits<T>::set_value(val, val_, is_reference<T>()); - } - - bool operator_bool() const - { - return len >= 0; - } - - private: - - std::ptrdiff_t len; - optional_type val; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // match class specialization for nil_t values - // - /////////////////////////////////////////////////////////////////////////// - template <> - class match<nil_t> : public safe_bool<match<nil_t> > - { - public: - - typedef nil_t attr_t; - typedef nil_t return_t; - - match(); - explicit match(std::size_t length); - match(std::size_t length, nil_t); - - bool operator!() const; - bool has_valid_attribute() const; - std::ptrdiff_t length() const; - nil_t value() const; - void value(nil_t); - void swap(match& other); - - template <typename T> - match(match<T> const& other) - : len(other.length()) {} - - template <typename T> - match<>& - operator=(match<T> const& other) - { - len = other.length(); - return *this; - } - - template <typename T> - void - concat(match<T> const& other) - { - BOOST_SPIRIT_ASSERT(*this && other); - len += other.length(); - } - - bool operator_bool() const - { - return len >= 0; - } - - private: - - std::ptrdiff_t len; - }; - -}} // namespace boost::spirit - -#endif -#include <boost/spirit/core/impl/match.ipp> - diff --git a/Utilities/BGL/boost/spirit/core/nil.hpp b/Utilities/BGL/boost/spirit/core/nil.hpp deleted file mode 100644 index 2b61851a1583cd36e09acff0586c03353339f522..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/nil.hpp +++ /dev/null @@ -1,19 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_NIL_HPP) -#define BOOST_SPIRIT_NIL_HPP - -namespace boost { namespace spirit -{ - struct nil_t {}; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/grammar.hpp b/Utilities/BGL/boost/spirit/core/non_terminal/grammar.hpp deleted file mode 100644 index a43382d04dcd88273ec5028d9e1e88ee2683a4ce..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/grammar.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Martin Wille - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_GRAMMAR_HPP) -#define BOOST_SPIRIT_GRAMMAR_HPP - -/////////////////////////////////////////////////////////////////////////////// -#if defined(BOOST_SPIRIT_THREADSAFE) && defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) -#undef BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE -#endif - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/non_terminal/parser_context.hpp> -#include <boost/spirit/core/non_terminal/impl/grammar.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// grammar class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename DerivedT, typename ContextT = parser_context<> > -struct grammar - : public parser<DerivedT> - , public ContextT::base_t - , public context_aux<ContextT, DerivedT> - BOOST_SPIRIT_GRAMMAR_ID -{ - typedef grammar<DerivedT, ContextT> self_t; - typedef DerivedT const& embed_t; - typedef typename ContextT::context_linker_t context_t; - typedef typename context_t::attr_t attr_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, attr_t>::type type; - }; - - grammar() {} - ~grammar() { impl::grammar_destruct(this); } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse_main(ScannerT const& scan) const - { return impl::grammar_parser_parse<0>(this, scan); } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef parser_scanner_linker<ScannerT> scanner_t; - BOOST_SPIRIT_CONTEXT_PARSE(scan, *this, scanner_t, context_t, result_t) - } - - template <int N> - impl::entry_grammar<DerivedT, N, ContextT> - use_parser() const - { return impl::entry_grammar<DerivedT, N, ContextT>( this->derived()); } - - BOOST_SPIRIT_GRAMMAR_STATE -}; - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#undef BOOST_SPIRIT_GRAMMAR_ID -#undef BOOST_SPIRIT_GRAMMAR_ACCESS -#undef BOOST_SPIRIT_GRAMMAR_STATE -#endif - diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/impl/grammar.ipp b/Utilities/BGL/boost/spirit/core/non_terminal/impl/grammar.ipp deleted file mode 100644 index 32a426521943e27e4609d1ea37c6bbd2d4ce45fc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/impl/grammar.ipp +++ /dev/null @@ -1,388 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Martin Wille - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined BOOST_SPIRIT_GRAMMAR_IPP -#define BOOST_SPIRIT_GRAMMAR_IPP - -#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) -#include <boost/spirit/core/non_terminal/impl/object_with_id.ipp> -#include <algorithm> -#include <functional> -#include <memory> // for std::auto_ptr -#include <boost/weak_ptr.hpp> -#endif - -#ifdef BOOST_SPIRIT_THREADSAFE -#include <boost/thread/tss.hpp> -#include <boost/thread/mutex.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -template <typename DerivedT, typename ContextT> -struct grammar; - -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200) - -BOOST_SPIRIT_DEPENDENT_TEMPLATE_WRAPPER(grammar_definition_wrapper, definition); - -////////////////////////////////// -template <typename GrammarT, typename ScannerT> -struct grammar_definition -{ - typedef typename impl::grammar_definition_wrapper<GrammarT> - ::template result_<ScannerT>::param_t type; -}; - -#else - -////////////////////////////////// -template <typename GrammarT, typename ScannerT> -struct grammar_definition -{ - typedef typename GrammarT::template definition<ScannerT> type; -}; - -#endif - - namespace impl - { - -#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) - struct grammar_tag {}; - - ////////////////////////////////// - template <typename GrammarT> - struct grammar_helper_base - { - virtual int undefine(GrammarT *) = 0; - virtual ~grammar_helper_base() {} - }; - - ////////////////////////////////// - template <typename GrammarT> - struct grammar_helper_list - { - typedef GrammarT grammar_t; - typedef grammar_helper_base<GrammarT> helper_t; - typedef std::vector<helper_t*> vector_t; - - grammar_helper_list() {} - grammar_helper_list(grammar_helper_list const& /*x*/) - { // Does _not_ copy the helpers member ! - } - - grammar_helper_list& operator=(grammar_helper_list const& x) - { // Does _not_ copy the helpers member ! - return *this; - } - - void push_back(helper_t *helper) - { helpers.push_back(helper); } - - void pop_back() - { helpers.pop_back(); } - - typename vector_t::size_type - size() const - { return helpers.size(); } - - typename vector_t::reverse_iterator - rbegin() - { return helpers.rbegin(); } - - typename vector_t::reverse_iterator - rend() - { return helpers.rend(); } - -#ifdef BOOST_SPIRIT_THREADSAFE - boost::mutex & mutex() - { return m; } -#endif - - private: - - vector_t helpers; -#ifdef BOOST_SPIRIT_THREADSAFE - boost::mutex m; -#endif - }; - - ////////////////////////////////// - struct grammartract_helper_list; - -#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) \ - && (!defined(__GNUC__) || (__GNUC__ > 2)) - - struct grammartract_helper_list - { - template<typename GrammarT> - static grammar_helper_list<GrammarT>& - do_(GrammarT const* g) - { - return g->helpers; - } - }; - -#endif - - ////////////////////////////////// - template <typename GrammarT, typename DerivedT, typename ScannerT> - struct grammar_helper : private grammar_helper_base<GrammarT> - { - typedef GrammarT grammar_t; - typedef ScannerT scanner_t; - typedef DerivedT derived_t; - typedef typename grammar_definition<DerivedT, ScannerT>::type definition_t; - - typedef grammar_helper<grammar_t, derived_t, scanner_t> helper_t; - typedef boost::shared_ptr<helper_t> helper_ptr_t; - typedef boost::weak_ptr<helper_t> helper_weak_ptr_t; - - grammar_helper* - this_() { return this; } - - grammar_helper(helper_weak_ptr_t& p) - : definitions_cnt(0) - , self(this_()) - { p = self; } - - definition_t& - define(grammar_t const* target_grammar) - { - grammar_helper_list<GrammarT> &helpers = -#if !defined(__GNUC__) || (__GNUC__ > 2) - grammartract_helper_list::do_(target_grammar); -#else - target_grammar->helpers; -#endif - typename grammar_t::object_id id = target_grammar->get_object_id(); - - if (definitions.size()<=id) - definitions.resize(id*3/2+1); - if (definitions[id]!=0) - return *definitions[id]; - - std::auto_ptr<definition_t> - result(new definition_t(target_grammar->derived())); - -#ifdef BOOST_SPIRIT_THREADSAFE - boost::mutex::scoped_lock lock(helpers.mutex()); -#endif - helpers.push_back(this); - - ++definitions_cnt; - definitions[id] = result.get(); - return *(result.release()); - } - - int - undefine(grammar_t* target_grammar) - { - typename grammar_t::object_id id = target_grammar->get_object_id(); - - if (definitions.size()<=id) - return 0; - delete definitions[id]; - definitions[id] = 0; - if (--definitions_cnt==0) - self.reset(); - return 0; - } - - private: - - std::vector<definition_t*> definitions; - unsigned long definitions_cnt; - helper_ptr_t self; - }; - -#endif /* defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) */ - - template<typename DerivedT, typename ContextT, typename ScannerT> - inline typename DerivedT::template definition<ScannerT> & - get_definition(grammar<DerivedT, ContextT> const* self) - { -#if defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) - - typedef typename DerivedT::template definition<ScannerT> definition_t; - static definition_t def(self->derived()); - return def; -#else - typedef grammar<DerivedT, ContextT> self_t; - typedef impl::grammar_helper<self_t, DerivedT, ScannerT> helper_t; - typedef typename helper_t::helper_weak_ptr_t ptr_t; - -# ifdef BOOST_SPIRIT_THREADSAFE - static boost::thread_specific_ptr<ptr_t> tld_helper; - if (!tld_helper.get()) - tld_helper.reset(new ptr_t); - ptr_t &helper = *tld_helper; -# else - static ptr_t helper; -# endif - if (!boost::make_shared(helper).get()) - new helper_t(helper); - return boost::make_shared(helper)->define(self); -#endif - } - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - template <int N> - struct call_helper { - - template <typename RT, typename DefinitionT, typename ScannerT> - static void - do_ (RT &result, DefinitionT &def, ScannerT const &scan) - { - result = def.template get_start_parser<N>()->parse(scan); - } - }; -#else - // The grammar_def stuff isn't supported for compilers, which do not - // support partial template specialization - template <int N> struct call_helper; -#endif - - template <> - struct call_helper<0> { - - template <typename RT, typename DefinitionT, typename ScannerT> - static void - do_ (RT &result, DefinitionT &def, ScannerT const &scan) - { - result = def.start().parse(scan); - } - }; - - ////////////////////////////////// - template<int N, typename DerivedT, typename ContextT, typename ScannerT> - inline typename parser_result<grammar<DerivedT, ContextT>, ScannerT>::type - grammar_parser_parse( - grammar<DerivedT, ContextT> const* self, - ScannerT const &scan) - { - typedef - typename parser_result<grammar<DerivedT, ContextT>, ScannerT>::type - result_t; - typedef typename DerivedT::template definition<ScannerT> definition_t; - - result_t result; - definition_t &def = get_definition<DerivedT, ContextT, ScannerT>(self); - - call_helper<N>::do_(result, def, scan); - return result; - } - - ////////////////////////////////// - template<typename GrammarT> - inline void - grammar_destruct(GrammarT* self) - { -#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) - typedef impl::grammar_helper_base<GrammarT> helper_base_t; - typedef grammar_helper_list<GrammarT> helper_list_t; - typedef typename helper_list_t::vector_t::reverse_iterator iterator_t; - - helper_list_t& helpers = -# if !defined(__GNUC__) || (__GNUC__ > 2) - grammartract_helper_list::do_(self); -# else - self->helpers; -# endif - -# if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1200)) \ - || defined(BOOST_INTEL_CXX_VERSION) - for (iterator_t i = helpers.rbegin(); i != helpers.rend(); ++i) - (*i)->undefine(self); -# else - std::for_each(helpers.rbegin(), helpers.rend(), - std::bind2nd(std::mem_fun(&helper_base_t::undefine), self)); -# endif - -#else - (void)self; -#endif - } - - /////////////////////////////////////////////////////////////////////////// - // - // entry_grammar class - // - /////////////////////////////////////////////////////////////////////////// - template <typename DerivedT, int N, typename ContextT> - class entry_grammar - : public parser<entry_grammar<DerivedT, N, ContextT> > - { - - public: - typedef entry_grammar<DerivedT, N, ContextT> self_t; - typedef self_t embed_t; - typedef typename ContextT::context_linker_t context_t; - typedef typename context_t::attr_t attr_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, attr_t>::type type; - }; - - entry_grammar(DerivedT const &p) : target_grammar(p) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse_main(ScannerT const& scan) const - { return impl::grammar_parser_parse<N>(&target_grammar, scan); } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef parser_scanner_linker<ScannerT> scanner_t; - BOOST_SPIRIT_CONTEXT_PARSE(scan, target_grammar, scanner_t, - context_t, result_t) - } - - private: - DerivedT const &target_grammar; - }; - - } // namespace impl - -/////////////////////////////////////// -#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) -#define BOOST_SPIRIT_GRAMMAR_ID , public impl::object_with_id<impl::grammar_tag> -#else -#define BOOST_SPIRIT_GRAMMAR_ID -#endif - -/////////////////////////////////////// -#if !defined(__GNUC__) || (__GNUC__ > 2) -#define BOOST_SPIRIT_GRAMMAR_ACCESS private: -#else -#define BOOST_SPIRIT_GRAMMAR_ACCESS -#endif - -/////////////////////////////////////// -#if !defined(BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE) -#define BOOST_SPIRIT_GRAMMAR_STATE \ - BOOST_SPIRIT_GRAMMAR_ACCESS \ - friend struct impl::grammartract_helper_list; \ - mutable impl::grammar_helper_list<self_t> helpers; -#else -#define BOOST_SPIRIT_GRAMMAR_STATE -#endif - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/impl/object_with_id.ipp b/Utilities/BGL/boost/spirit/core/non_terminal/impl/object_with_id.ipp deleted file mode 100644 index e3624f0fd08619b4ae59b206d1f6a4aa4f5c34e1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/impl/object_with_id.ipp +++ /dev/null @@ -1,185 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined BOOST_SPIRIT_OBJECT_WITH_ID_IPP -#define BOOST_SPIRIT_OBJECT_WITH_ID_IPP - -#include <vector> -#include <boost/shared_ptr.hpp> - -#ifdef BOOST_SPIRIT_THREADSAFE -#include <boost/thread/mutex.hpp> -#include <boost/thread/once.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - namespace impl { - - ////////////////////////////////// - template <typename IdT = std::size_t> - struct object_with_id_base_supply - { - typedef IdT object_id; - typedef std::vector<object_id> id_vector; - - object_with_id_base_supply() : max_id(object_id()) {} - -#ifdef BOOST_SPIRIT_THREADSAFE - boost::mutex mutex; -#endif - object_id max_id; - id_vector free_ids; - - object_id acquire(); - void release(object_id); - }; - - ////////////////////////////////// - template <typename TagT, typename IdT = std::size_t> - struct object_with_id_base - { - typedef TagT tag_t; - typedef IdT object_id; - - protected: - - object_id acquire_object_id(); - void release_object_id(object_id); - - private: -#ifdef BOOST_SPIRIT_THREADSAFE - static boost::mutex &mutex_instance(); - static void mutex_init(); -#endif - - boost::shared_ptr<object_with_id_base_supply<IdT> > id_supply; - }; - - ////////////////////////////////// - template<class TagT, typename IdT = std::size_t> - struct object_with_id : private object_with_id_base<TagT, IdT> - { - typedef object_with_id<TagT, IdT> self_t; - typedef object_with_id_base<TagT, IdT> base_t; - typedef IdT object_id; - - object_with_id() : id(base_t::acquire_object_id()) {} - object_with_id(self_t const &other) - : base_t(other) - , id(base_t::acquire_object_id()) - {} // don't copy id - self_t &operator = (self_t const &other) - { // don't assign id - base_t::operator=(other); - return *this; - } - ~object_with_id() { base_t::release_object_id(id); } - object_id get_object_id() const { return id; } - - private: - - object_id const id; - }; - - ////////////////////////////////// - template <typename IdT> - inline IdT - object_with_id_base_supply<IdT>::acquire() - { -#ifdef BOOST_SPIRIT_THREADSAFE - boost::mutex::scoped_lock lock(mutex); -#endif - if (free_ids.size()) - { - object_id id = *free_ids.rbegin(); - free_ids.pop_back(); - return id; - } - else - { - if (free_ids.capacity()<=max_id) - free_ids.reserve(max_id*3/2+1); - return ++max_id; - } - } - - ////////////////////////////////// - template <typename IdT> - inline void - object_with_id_base_supply<IdT>::release(IdT id) - { -#ifdef BOOST_SPIRIT_THREADSAFE - boost::mutex::scoped_lock lock(mutex); -#endif - if (max_id == id) - max_id--; - else - free_ids.push_back(id); // doesn't throw - } - - ////////////////////////////////// - template <typename TagT, typename IdT> - inline IdT - object_with_id_base<TagT, IdT>::acquire_object_id() - { - { -#ifdef BOOST_SPIRIT_THREADSAFE - static boost::once_flag been_here = BOOST_ONCE_INIT; - boost::call_once(mutex_init, been_here); - boost::mutex &mutex = mutex_instance(); - boost::mutex::scoped_lock lock(mutex); -#endif - static boost::shared_ptr<object_with_id_base_supply<IdT> > - static_supply; - - if (!static_supply.get()) - static_supply.reset(new object_with_id_base_supply<IdT>()); - id_supply = static_supply; - } - - return id_supply->acquire(); - } - - ////////////////////////////////// - template <typename TagT, typename IdT> - inline void - object_with_id_base<TagT, IdT>::release_object_id(IdT id) - { - id_supply->release(id); - } - - ////////////////////////////////// -#ifdef BOOST_SPIRIT_THREADSAFE - template <typename TagT, typename IdT> - inline boost::mutex & - object_with_id_base<TagT, IdT>::mutex_instance() - { - static boost::mutex mutex; - return mutex; - } -#endif - - ////////////////////////////////// -#ifdef BOOST_SPIRIT_THREADSAFE - template <typename TagT, typename IdT> - inline void - object_with_id_base<TagT, IdT>::mutex_init() - { - mutex_instance(); - } -#endif - - } // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/impl/rule.ipp b/Utilities/BGL/boost/spirit/core/non_terminal/impl/rule.ipp deleted file mode 100644 index ee9ed2c1549981cf1bd3a1b644c7b6ce3244ec6c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/impl/rule.ipp +++ /dev/null @@ -1,407 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_RULE_IPP) -#define BOOST_SPIRIT_RULE_IPP - -#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 -#include <boost/preprocessor/repeat.hpp> -#include <boost/preprocessor/repeat_from_to.hpp> -#include <boost/preprocessor/enum_params.hpp> -#include <boost/preprocessor/enum_params_with_defaults.hpp> -#include <boost/preprocessor/facilities/intercept.hpp> -#include <boost/preprocessor/inc.hpp> -#include <boost/preprocessor/cat.hpp> -#endif - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/scanner/scanner.hpp> -#include <boost/spirit/core/non_terminal/parser_context.hpp> -#include <boost/spirit/core/non_terminal/parser_id.hpp> -#include <boost/type_traits/is_base_and_derived.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 - - template < - BOOST_PP_ENUM_BINARY_PARAMS( - BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, - typename ScannerT, = mpl::void_ BOOST_PP_INTERCEPT - ) - > - struct scanner_list; - -#endif // BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 - - /////////////////////////////////////////////////////////////////////////// - namespace impl - { - template <typename BaseT, typename DefaultT - , typename T0, typename T1, typename T2> - struct get_param - { - typedef typename mpl::if_< - is_base_and_derived<BaseT, T0> - , T0 - , typename mpl::if_< - is_base_and_derived<BaseT, T1> - , T1 - , typename mpl::if_< - is_base_and_derived<BaseT, T2> - , T2 - , DefaultT - >::type - >::type - >::type type; - }; - - template <typename T0, typename T1, typename T2> - struct get_context - { - typedef typename get_param< - parser_context_base, parser_context<>, T0, T1, T2>::type - type; - }; - - template <typename T0, typename T1, typename T2> - struct get_tag - { - typedef typename get_param< - parser_tag_base, parser_address_tag, T0, T1, T2>::type - type; - }; - - template <typename T0, typename T1, typename T2> - struct get_scanner - { - typedef typename get_param< - scanner_base, scanner<>, T0, T1, T2>::type - type; - }; - - /////////////////////////////////////////////////////////////////////// - // - // rule_base class - // - // The rule_base class implements the basic plumbing for rules - // minus the storage mechanism. It is up to the derived class - // to actually store the definition somewhere. The rule_base - // class assumes that the derived class provides a get() function - // that will return a pointer to a parser. The get() function - // may return NULL. See rule below for details. - // - // <<< For framework use only. Not for public consumption. >>> - // - /////////////////////////////////////////////////////////////////////// - template < - typename DerivedT // derived class - , typename EmbedT // how derived class is embedded - , typename T0 = nil_t // see rule class - , typename T1 = nil_t // see rule class - , typename T2 = nil_t // see rule class - > - class rule_base; // forward declaration - - class rule_base_access - { -#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - public: // YUCK! -#else - template < - typename DerivedT - , typename EmbedT - , typename T0 - , typename T1 - , typename T2 - > - friend class rule_base; -#endif - template <typename RuleT> - static typename RuleT::abstract_parser_t* - get(RuleT const& r) - { - return r.get(); - } - }; - - template < - typename DerivedT // derived class - , typename EmbedT // how derived class is embedded - , typename T0 // see rule class - , typename T1 // see rule class - , typename T2 // see rule class - > - class rule_base - : public parser<DerivedT> - , public impl::get_context<T0, T1, T2>::type::base_t - , public context_aux< - typename impl::get_context<T0, T1, T2>::type, DerivedT> - , public impl::get_tag<T0, T1, T2>::type - { - public: - - typedef typename impl::get_scanner<T0, T1, T2>::type scanner_t; - typedef typename impl::get_context<T0, T1, T2>::type context_t; - typedef typename impl::get_tag<T0, T1, T2>::type tag_t; - - typedef EmbedT embed_t; - typedef typename context_t::context_linker_t linked_context_t; - typedef typename linked_context_t::attr_t attr_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, attr_t>::type type; - }; - - template <typename ScannerT> - typename parser_result<DerivedT, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef parser_scanner_linker<ScannerT> linked_scanner_t; - typedef typename parser_result<DerivedT, ScannerT>::type result_t; - BOOST_SPIRIT_CONTEXT_PARSE( - scan, *this, linked_scanner_t, linked_context_t, result_t); - } - - template <typename ScannerT> - typename parser_result<DerivedT, ScannerT>::type - parse_main(ScannerT const& scan) const - { - typename parser_result<DerivedT, ScannerT>::type hit; - - // MWCW 8.3 needs this cast to be done through a pointer, - // not a reference. Otherwise, it will silently construct - // a temporary, causing an infinite runtime recursion. - DerivedT const* derived_this = static_cast<DerivedT const*>(this); - - if (rule_base_access::get(*derived_this)) - { - typename ScannerT::iterator_t s(scan.first); - hit = rule_base_access::get(*derived_this) - ->do_parse_virtual(scan); - scan.group_match(hit, this->id(), s, scan.first); - } - else - { - hit = scan.no_match(); - } - return hit; - } - }; - - /////////////////////////////////////////////////////////////////////// - // - // abstract_parser class - // - /////////////////////////////////////////////////////////////////////// - template <typename ScannerT, typename AttrT> - struct abstract_parser - { - abstract_parser() {} - virtual ~abstract_parser() {} - - virtual typename match_result<ScannerT, AttrT>::type - do_parse_virtual(ScannerT const& scan) const = 0; - - virtual abstract_parser* - clone() const = 0; - }; - - /////////////////////////////////////////////////////////////////////// - // - // concrete_parser class - // - /////////////////////////////////////////////////////////////////////// - template <typename ParserT, typename ScannerT, typename AttrT> - struct concrete_parser : abstract_parser<ScannerT, AttrT> - { - concrete_parser(ParserT const& p) : p(p) {} - virtual ~concrete_parser() {} - - virtual typename match_result<ScannerT, AttrT>::type - do_parse_virtual(ScannerT const& scan) const - { - return p.parse(scan); - } - - virtual abstract_parser<ScannerT, AttrT>* - clone() const - { - return new concrete_parser(p); - } - - typename ParserT::embed_t p; - }; - -#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 - - /////////////////////////////////////////////////////////////////////// - // - // This generates partial specializations for the class - // - // abstract_parser - // - // with an increasing number of different ScannerT template parameters - // and corresponding do_parse_virtual function declarations for each - // of the different required scanner types: - // - // template <typename ScannerT0, ..., typename AttrT> - // struct abstract_parser<scanner_list<ScannerT0, ...>, AttrT> - // { - // abstract_parser() {} - // virtual ~abstract_parser() {} - // - // virtual typename match_result<ScannerT0, AttrT>::type - // do_parse_virtual(ScannerT0 const &scan) const = 0; - // - // virtual abstract_parser* - // clone() const = 0; - // - // ... - // }; - // - /////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_RULE_ENUM_DOPARSE_A(z, N, _) \ - virtual typename match_result< \ - BOOST_PP_CAT(ScannerT, N), AttrT \ - >::type \ - do_parse_virtual( \ - BOOST_PP_CAT(ScannerT, N) const& scan) const = 0; \ - - #define BOOST_SPIRIT_ENUM_ABSTRACT_PARSERS(z, N, _) \ - template < \ - BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), typename ScannerT), \ - typename AttrT \ - > \ - struct abstract_parser< \ - scanner_list< \ - BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ - >, \ - AttrT \ - > \ - { \ - abstract_parser() {} \ - virtual ~abstract_parser() {} \ - \ - BOOST_PP_REPEAT_ ## z( \ - BOOST_PP_INC(N), BOOST_SPIRIT_RULE_ENUM_DOPARSE_A, _) \ - \ - virtual abstract_parser* \ - clone() const = 0; \ - }; \ - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, - BOOST_SPIRIT_ENUM_ABSTRACT_PARSERS, _) - - #undef BOOST_SPIRIT_RULE_ENUM_DOPARSE_A - #undef BOOST_SPIRIT_ENUM_ABSTRACT_PARSERS - /////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////// - // - // This generates partial specializations for the class - // - // concrete_parser - // - // with an increasing number of different ScannerT template parameters - // and corresponding do_parse_virtual function declarations for each - // of the different required scanner types: - // - // template < - // typename ParserT, typename ScannerT0, ..., typename AttrT - // > - // struct concrete_parser< - // ParserT, scanner_list<ScannerT0, ...>, AttrT - // > - // : public abstract_parser<scanner_list<ScannerT0, ...>, AttrT> - // { - // concrete_parser(ParserT const& p_) : p(p_) {} - // virtual ~concrete_parser() {} - // - // virtual typename match_result<ScannerT0, AttrT>::type - // do_parse_virtual(ScannerT0 const &scan) const - // { return p.parse(scan); } - // - // virtual abstract_parser<scanner_list<ScannerT0, ...>, AttrT>* - // clone() const - // { - // return new concrete_parser(p); - // } - // - // ... - // - // typename ParserT::embed_t p; - // }; - // - /////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_RULE_ENUM_DOPARSE_C(z, N, _) \ - virtual typename match_result< \ - BOOST_PP_CAT(ScannerT, N), AttrT \ - >::type \ - do_parse_virtual( \ - BOOST_PP_CAT(ScannerT, N) const& scan) const \ - { return p.parse(scan); } \ - - #define BOOST_SPIRIT_ENUM_CONCRETE_PARSERS(z, N, _) \ - template < \ - typename ParserT, \ - BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), typename ScannerT), \ - typename AttrT \ - > \ - struct concrete_parser< \ - ParserT, \ - scanner_list< \ - BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ - >, \ - AttrT \ - > \ - : abstract_parser< \ - scanner_list< \ - BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ - >, \ - AttrT \ - > \ - { \ - concrete_parser(ParserT const& p_) : p(p_) {} \ - virtual ~concrete_parser() {} \ - \ - BOOST_PP_REPEAT_ ## z( \ - BOOST_PP_INC(N), BOOST_SPIRIT_RULE_ENUM_DOPARSE_C, _) \ - \ - virtual abstract_parser< \ - scanner_list< \ - BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), ScannerT) \ - >, \ - AttrT \ - >* \ - clone() const \ - { \ - return new concrete_parser(p); \ - } \ - \ - typename ParserT::embed_t p; \ - }; \ - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, - BOOST_SPIRIT_ENUM_CONCRETE_PARSERS, _) - - #undef BOOST_SPIRIT_ENUM_CONCRETE_PARSERS - #undef BOOST_SPIRIT_RULE_ENUM_DOPARSE_C - /////////////////////////////////////////////////////////////////////// - -#endif // BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 - - } // namespace impl - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/impl/subrule.ipp b/Utilities/BGL/boost/spirit/core/non_terminal/impl/subrule.ipp deleted file mode 100644 index a194d4fbae0e31d8c77427d4f3de5b252dfde5c2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/impl/subrule.ipp +++ /dev/null @@ -1,205 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SUBRULE_IPP) -#define BOOST_SPIRIT_SUBRULE_IPP - -namespace boost { namespace spirit { - - template <typename FirstT, typename RestT> - struct subrule_list; - - template <int ID, typename DefT, typename ContextT> - struct subrule_parser; - - namespace impl { - - #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - template <int N, typename ListT> - struct get_subrule; - - template <int N, typename ListT> - struct get_subrule_chooser - { - static ListT t(); - static char test(nil_t); - static int test(...); - - // Set value to - // 0: ListT is empty - // 1: ListT's first item has same ID - // 2: ListT's first item has a different ID - - enum - { - id = ListT::first_t::id, - is_same_id = N == id, - is_nil_t = sizeof(char) == sizeof(test(t())), - value = is_nil_t ? 0 : (is_same_id ? 1 : 2) - }; - }; - - template <int N> - struct subrule_chooser; - - template <> - struct subrule_chooser<0> - { - // First case. ListT is empty - - template <int N, typename ListT> - struct result - { typedef nil_t type; }; - }; - - template <> - struct subrule_chooser<1> - { - // Second case. ListT is non-empty and the list's - // first item has the ID we are looking for. - - template <int N, typename ListT> - struct result - { typedef typename ListT::first_t::def_t type; }; - }; - - template <> - struct subrule_chooser<2> - { - // Third case. ListT is non-empty but the list's - // first item does not have the ID we are looking for. - - template <int N, typename ListT> - struct result - { typedef typename get_subrule<N, ListT::rest_t>::type type; }; - }; - - template <int N, typename ListT> - struct get_subrule - { - enum { n = get_subrule_chooser<N, ListT>::value }; - typedef typename subrule_chooser<n>::template - result<N, ListT>::type type; - }; - - #else - - template <int N, typename ListT> - struct get_subrule - { - // First case. ListT is non-empty but the list's - // first item does not have the ID we are looking for. - - typedef typename get_subrule<N, typename ListT::rest_t>::type type; - }; - - template <int ID, typename DefT, typename ContextT, typename RestT> - struct get_subrule< - ID, - subrule_list< - subrule_parser<ID, DefT, ContextT>, - RestT> > - { - // Second case. ListT is non-empty and the list's - // first item has the ID we are looking for. - - typedef DefT type; - }; - - template <int ID> - struct get_subrule<ID, nil_t> - { - // Third case. ListT is empty - typedef nil_t type; - }; - - #endif - - template <typename T1, typename T2> - struct get_result_t { - - // If the result type dictated by the context is nil_t (no closures - // present), then the whole subrule_parser return type is equal to - // the return type of the right hand side of this subrule_parser, - // otherwise it is equal to the dictated return value. - - typedef typename mpl::if_< - boost::is_same<T1, nil_t>, T2, T1 - >::type type; - }; - - template <int ID, typename ScannerT, typename ContextResultT> - struct get_subrule_result - { - typedef typename - impl::get_subrule<ID, typename ScannerT::list_t>::type - parser_t; - - typedef typename parser_result<parser_t, ScannerT>::type - def_result_t; - - typedef typename match_result<ScannerT, ContextResultT>::type - context_result_t; - - typedef typename get_result_t<context_result_t, def_result_t>::type - type; - }; - - template <typename DefT, typename ScannerT, typename ContextResultT> - struct get_subrule_parser_result - { - typedef typename parser_result<DefT, ScannerT>::type - def_result_t; - - typedef typename match_result<ScannerT, ContextResultT>::type - context_result_t; - - typedef typename get_result_t<context_result_t, def_result_t>::type - type; - }; - - template <typename SubruleT, int ID> - struct same_subrule_id - { - BOOST_STATIC_CONSTANT(bool, value = (SubruleT::id == ID)); - }; - - template <typename RT, typename ScannerT, int ID> - struct parse_subrule - { - template <typename ListT> - static void - do_parse(RT& r, ScannerT const& scan, ListT const& list, mpl::true_) - { - r = list.first.rhs.parse(scan); - } - - template <typename ListT> - static void - do_parse(RT& r, ScannerT const& scan, ListT const& list, mpl::false_) - { - typedef typename ListT::rest_t::first_t subrule_t; - mpl::bool_<same_subrule_id<subrule_t, ID>::value> same_id; - do_parse(r, scan, list.rest, same_id); - } - - static void - do_(RT& r, ScannerT const& scan) - { - typedef typename ScannerT::list_t::first_t subrule_t; - mpl::bool_<same_subrule_id<subrule_t, ID>::value> same_id; - do_parse(r, scan, scan.list, same_id); - } - }; - -}}} // namespace boost::spirit::impl - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/parser_context.hpp b/Utilities/BGL/boost/spirit/core/non_terminal/parser_context.hpp deleted file mode 100644 index 4c9662fc77e1d77bf1db349fab116b1a929f4dab..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/parser_context.hpp +++ /dev/null @@ -1,147 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_CONTEXT_HPP) -#define BOOST_SPIRIT_PARSER_CONTEXT_HPP - -/////////////////////////////////////////////////////////////////////////////// -namespace boost -{ - namespace spirit - { - - /////////////////////////////////////////////////////////////////////////// - // - // default_parser_context_base class { default context base } - // - /////////////////////////////////////////////////////////////////////////// - struct default_parser_context_base - { - template <typename DerivedT> - struct aux {}; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // parser_context_base class { base class of all context classes } - // - /////////////////////////////////////////////////////////////////////////// - struct parser_context_base {}; - - /////////////////////////////////////////////////////////////////////////// - // - // parser_context class { default context } - // - /////////////////////////////////////////////////////////////////////////// - struct nil_t; - template<typename ContextT> struct parser_context_linker; - - template<typename AttrT = nil_t> - struct parser_context : parser_context_base - { - typedef AttrT attr_t; - typedef default_parser_context_base base_t; - typedef parser_context_linker<parser_context<AttrT> > context_linker_t; - - template <typename ParserT> - parser_context(ParserT const&) {} - - template <typename ParserT, typename ScannerT> - void - pre_parse(ParserT const&, ScannerT const&) {} - - template <typename ResultT, typename ParserT, typename ScannerT> - ResultT& - post_parse(ResultT& hit, ParserT const&, ScannerT const&) - { return hit; } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // context_aux class - // - // context_aux<ContextT, DerivedT> is a class derived from the - // ContextT's nested base_t::base<DerivedT> template class. (see - // default_parser_context_base::aux for an example). - // - // Basically, this class provides ContextT dependent optional - // functionality to the derived class DerivedT through the CRTP - // idiom (Curiously recurring template pattern). - // - /////////////////////////////////////////////////////////////////////////// - template <typename ContextT, typename DerivedT> - struct context_aux : public ContextT::base_t::template aux<DerivedT> {}; - - /////////////////////////////////////////////////////////////////////////// - // - // parser_scanner_linker and parser_scanner_linker classes - // { helper templates for the rule extensibility } - // - // This classes can be 'overloaded' (defined elsewhere), to plug - // in additional functionality into the non-terminal parsing process. - // - /////////////////////////////////////////////////////////////////////////// - #if !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) - #define BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED - - template<typename ScannerT> - struct parser_scanner_linker : public ScannerT - { - parser_scanner_linker(ScannerT const scan_) : ScannerT(scan_) {} - }; - - #endif // !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) - - ////////////////////////////////// - #if !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) - #define BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED - - template<typename ContextT> - struct parser_context_linker : public ContextT - { - template <typename ParserT> - parser_context_linker(ParserT const& p) - : ContextT(p) {} - - template <typename ParserT, typename ScannerT> - void pre_parse(ParserT const& p, ScannerT const& scan) - { ContextT::pre_parse(p, scan); } - - template <typename ResultT, typename ParserT, typename ScannerT> - ResultT& - post_parse(ResultT& hit, ParserT const& p, ScannerT const& scan) - { return ContextT::post_parse(hit, p, scan); } - }; - - #endif // !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) - - /////////////////////////////////////////////////////////////////////////// - // - // BOOST_SPIRIT_CONTEXT_PARSE helper macro - // - // The original implementation uses a template class. However, we - // need to lessen the template instantiation depth to help inferior - // compilers that sometimes choke on deep template instantiations. - // The objective is to avoid code redundancy. A macro, in this case - // is an obvious solution. Sigh! - // - // WARNING: INTERNAL USE ONLY. NOT FOR PUBLIC CONSUMPTION. - // - /////////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_CONTEXT_PARSE(scan, this_, scanner_t, context_t, result_t) \ - scanner_t scan_wrap(scan); \ - context_t context_wrap(this_); \ - context_wrap.pre_parse(this_, scan_wrap); \ - result_t hit = parse_main(scan); \ - return context_wrap.post_parse(hit, this_, scan_wrap); - - } // namespace spirit -} // namespace boost - -#endif diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/parser_id.hpp b/Utilities/BGL/boost/spirit/core/non_terminal/parser_id.hpp deleted file mode 100644 index 25bccb848ca7d088f738349200c4c4d19f5d48b9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/parser_id.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_ID_HPP) -#define BOOST_SPIRIT_PARSER_ID_HPP - -#if defined(BOOST_SPIRIT_DEBUG) -# include <ostream> -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // parser_id class - // - /////////////////////////////////////////////////////////////////////////// - class parser_id - { - public: - parser_id() : p(0) {} - explicit parser_id(void const* prule) : p(prule) {} - parser_id(std::size_t l_) : l(l_) {} - - bool operator==(parser_id const& x) const { return p == x.p; } - bool operator!=(parser_id const& x) const { return !(*this == x); } - bool operator<(parser_id const& x) const { return p < x.p; } - std::size_t to_long() const { return l; } - - private: - - union - { - void const* p; - std::size_t l; - }; - }; - - #if defined(BOOST_SPIRIT_DEBUG) - inline std::ostream& - operator<<(std::ostream& out, parser_id const& rid) - { - out << rid.to_long(); - return out; - } - #endif - - /////////////////////////////////////////////////////////////////////////// - // - // parser_tag_base class: base class of all parser tags - // - /////////////////////////////////////////////////////////////////////////// - struct parser_tag_base {}; - - /////////////////////////////////////////////////////////////////////////// - // - // parser_address_tag class: tags a parser with its address - // - /////////////////////////////////////////////////////////////////////////// - struct parser_address_tag : parser_tag_base - { - parser_id id() const - { return parser_id(reinterpret_cast<std::size_t>(this)); } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // parser_tag class: tags a parser with an integer ID - // - /////////////////////////////////////////////////////////////////////////// - template <int N> - struct parser_tag : parser_tag_base - { - static parser_id id() - { return parser_id(std::size_t(N)); } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // dynamic_parser_tag class: tags a parser with a dynamically changeable - // integer ID - // - /////////////////////////////////////////////////////////////////////////// - class dynamic_parser_tag : public parser_tag_base - { - public: - - dynamic_parser_tag() - : tag(std::size_t(0)) {} - - parser_id - id() const - { - return - tag.to_long() - ? tag - : parser_id(reinterpret_cast<std::size_t>(this)); - } - - void set_id(parser_id id) { tag = id; } - - private: - - parser_id tag; - }; - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/rule.hpp b/Utilities/BGL/boost/spirit/core/non_terminal/rule.hpp deleted file mode 100644 index 001e5cd3bfdf597f51eb7221c144d2d5d95f0b60..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/rule.hpp +++ /dev/null @@ -1,168 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_RULE_HPP) -#define BOOST_SPIRIT_RULE_HPP - -#include <boost/static_assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit predefined maximum number of simultaneously usable different -// scanner types. -// -// This limit defines the maximum number of of possible different scanner -// types for which a specific rule<> may be used. If this isn't defined, a -// rule<> may be used with one scanner type only (multiple scanner support -// is disabled). -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT) -# define BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT 1 -#endif - -// Ensure a meaningful maximum number of simultaneously usable scanner types -BOOST_STATIC_ASSERT(BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 0); - -#include <boost/scoped_ptr.hpp> -#include <boost/spirit/core/non_terminal/impl/rule.ipp> - -#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 -# include <boost/preprocessor/enum_params.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -#if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1 - - /////////////////////////////////////////////////////////////////////////// - // - // scanner_list (a fake scanner) - // - // Typically, rules are tied to a specific scanner type and - // a particular rule cannot be used with anything else. Sometimes - // there's a need for rules that can accept more than one scanner - // type. The scanner_list<S0, ...SN> can be used as a template - // parameter to the rule class to specify up to the number of - // scanner types defined by the BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT - // constant. Example: - // - // rule<scanner_list<ScannerT0, ScannerT1> > r; - // - // *** This feature is available only to compilers that support - // partial template specialization. *** - // - /////////////////////////////////////////////////////////////////////////// - template < - BOOST_PP_ENUM_PARAMS( - BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT, - typename ScannerT - ) - > - struct scanner_list : scanner_base {}; - -#endif - - /////////////////////////////////////////////////////////////////////////// - // - // rule class - // - // The rule is a polymorphic parser that acts as a named place- - // holder capturing the behavior of an EBNF expression assigned to - // it. - // - // The rule is a template class parameterized by: - // - // 1) scanner (scanner_t, see scanner.hpp), - // 2) the rule's context (context_t, see parser_context.hpp) - // 3) an arbitrary tag (tag_t, see parser_id.hpp) that allows - // a rule to be tagged for identification. - // - // These template parameters may be specified in any order. The - // scanner will default to scanner<> when it is not specified. - // The context will default to parser_context when not specified. - // The tag will default to parser_address_tag when not specified. - // - // The definition of the rule (its right hand side, RHS) held by - // the rule through a scoped_ptr. When a rule is seen in the RHS - // of an assignment or copy construction EBNF expression, the rule - // is held by the LHS rule by reference. - // - /////////////////////////////////////////////////////////////////////////// - template < - typename T0 = nil_t - , typename T1 = nil_t - , typename T2 = nil_t - > - class rule - : public impl::rule_base< - rule<T0, T1, T2> - , rule<T0, T1, T2> const& - , T0, T1, T2> - { - public: - - typedef rule<T0, T1, T2> self_t; - typedef impl::rule_base< - self_t - , self_t const& - , T0, T1, T2> - base_t; - - typedef typename base_t::scanner_t scanner_t; - typedef typename base_t::attr_t attr_t; - typedef impl::abstract_parser<scanner_t, attr_t> abstract_parser_t; - - rule() : ptr() {} - ~rule() {} - - rule(rule const& r) - : ptr(new impl::concrete_parser<rule, scanner_t, attr_t>(r)) {} - - template <typename ParserT> - rule(ParserT const& p) - : ptr(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)) {} - - template <typename ParserT> - rule& operator=(ParserT const& p) - { - ptr.reset(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)); - return *this; - } - - rule& operator=(rule const& r) - { - ptr.reset(new impl::concrete_parser<rule, scanner_t, attr_t>(r)); - return *this; - } - - rule<T0, T1, T2> - copy() const - { - return rule<T0, T1, T2>(ptr.get() ? ptr->clone() : 0); - } - - private: - friend class impl::rule_base_access; - - abstract_parser_t* - get() const - { - return ptr.get(); - } - - rule(abstract_parser_t const* ptr) - : ptr(ptr) {} - - scoped_ptr<abstract_parser_t> ptr; - }; - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/non_terminal/subrule.hpp b/Utilities/BGL/boost/spirit/core/non_terminal/subrule.hpp deleted file mode 100644 index bde2f103db8efbed361a9243498c8a189d570056..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/non_terminal/subrule.hpp +++ /dev/null @@ -1,297 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SUBRULE_HPP) -#define BOOST_SPIRIT_SUBRULE_HPP - -#include <boost/config.hpp> -#include <boost/static_assert.hpp> - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/non_terminal/parser_context.hpp> -#include <boost/spirit/core/non_terminal/impl/subrule.ipp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // subrules_scanner class - // - /////////////////////////////////////////////////////////////////////////// - template <typename ScannerT, typename ListT> - struct subrules_scanner : public ScannerT - { - typedef ScannerT scanner_t; - typedef ListT list_t; - typedef subrules_scanner<ScannerT, ListT> self_t; - - subrules_scanner(ScannerT const& scan, ListT const& list_) - : ScannerT(scan), list(list_) {} - - template <typename PoliciesT> - struct rebind_policies - { - typedef typename rebind_scanner_policies<ScannerT, PoliciesT>::type - rebind_scanner; - typedef subrules_scanner<rebind_scanner, ListT> type; - }; - - template <typename PoliciesT> - subrules_scanner< - typename rebind_scanner_policies<ScannerT, PoliciesT>::type, - ListT> - change_policies(PoliciesT const& policies) const - { - typedef subrules_scanner< - BOOST_DEDUCED_TYPENAME - rebind_scanner_policies<ScannerT, PoliciesT>::type, - ListT> - subrules_scanner_t; - - return subrules_scanner_t( - ScannerT::change_policies(policies), - list); - } - - template <typename IteratorT> - struct rebind_iterator - { - typedef typename rebind_scanner_iterator<ScannerT, IteratorT>::type - rebind_scanner; - typedef subrules_scanner<rebind_scanner, ListT> type; - }; - - template <typename IteratorT> - subrules_scanner< - typename rebind_scanner_iterator<ScannerT, IteratorT>::type, - ListT> - change_iterator(IteratorT const& first, IteratorT const &last) const - { - typedef subrules_scanner< - BOOST_DEDUCED_TYPENAME - rebind_scanner_iterator<ScannerT, IteratorT>::type, - ListT> - subrules_scanner_t; - - return subrules_scanner_t( - ScannerT::change_iterator(first, last), - list); - } - - ListT const& list; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // subrule_scanner type computer class - // - // This computer ensures that the scanner will not be recursively - // instantiated if it's not needed. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ScannerT, typename ListT> - struct subrules_scanner_finder - { - typedef subrules_scanner<ScannerT, ListT> type; - }; - - template <typename ScannerT, typename ListT> - struct subrules_scanner_finder<subrules_scanner<ScannerT, ListT>, ListT> - { - typedef subrules_scanner<ScannerT, ListT> type; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // subrule_list class - // - /////////////////////////////////////////////////////////////////////////// - template <typename FirstT, typename RestT> - struct subrule_list : public parser<subrule_list<FirstT, RestT> > - { - typedef subrule_list<FirstT, RestT> self_t; - typedef FirstT first_t; - typedef RestT rest_t; - - subrule_list(FirstT const& first_, RestT const& rest_) - : first(first_), rest(rest_) {} - - template <typename ScannerT> - struct result - { - typedef typename parser_result<FirstT, ScannerT>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename subrules_scanner_finder<ScannerT, self_t>::type - subrules_scanner_t; - subrules_scanner_t g_arg(scan, *this); - return first.start.parse(g_arg); - } - - template <int ID, typename DefT, typename ContextT> - subrule_list< - FirstT, - subrule_list< - subrule_parser<ID, DefT, ContextT>, - RestT> > - operator,(subrule_parser<ID, DefT, ContextT> const& rhs) - { - return subrule_list< - FirstT, - subrule_list< - subrule_parser<ID, DefT, ContextT>, - RestT> >( - first, - subrule_list< - subrule_parser<ID, DefT, ContextT>, - RestT>(rhs, rest)); - } - - FirstT first; - RestT rest; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // subrule_parser class - // - /////////////////////////////////////////////////////////////////////////// - template <int ID, typename ContextT = parser_context<> > - struct subrule; // Forward declaration - - template <int ID, typename DefT, typename ContextT> - struct subrule_parser - : public parser<subrule_parser<ID, DefT, ContextT> > - { - typedef subrule_parser<ID, DefT, ContextT> self_t; - typedef subrule<ID, ContextT> subrule_t; - typedef DefT def_t; - - BOOST_STATIC_CONSTANT(int, id = ID); - - template <typename ScannerT> - struct result - { - typedef typename - impl::get_subrule_parser_result< - DefT, ScannerT, typename subrule_t::attr_t>::type type; - }; - - subrule_parser(subrule_t const& start_, DefT const& rhs_) - : rhs(rhs_), start(start_) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - // This will only be called when parsing single subrules. - typedef subrule_list<self_t, nil_t> list_t; - typedef subrules_scanner<ScannerT, list_t> scanner_t; - - list_t list(*this, nil_t()); - scanner_t g_arg(scan, list); - return start.parse(g_arg); - } - - template <int ID2, typename DefT2, typename ContextT2> - inline subrule_list< - self_t, - subrule_list< - subrule_parser<ID2, DefT2, ContextT2>, - nil_t> > - operator,(subrule_parser<ID2, DefT2, ContextT2> const& rhs) const - { - return subrule_list< - self_t, - subrule_list< - subrule_parser<ID2, DefT2, ContextT2>, - nil_t> >( - *this, - subrule_list< - subrule_parser<ID2, DefT2, ContextT2>, nil_t>( - rhs, nil_t())); - } - - typename DefT::embed_t rhs; - subrule_t const& start; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // subrule class - // - /////////////////////////////////////////////////////////////////////////// - template <int ID, typename ContextT> - struct subrule - : public parser<subrule<ID, ContextT> > - , public ContextT::base_t - , public context_aux<ContextT, subrule<ID, ContextT> > - { - typedef subrule<ID, ContextT> self_t; - typedef subrule<ID, ContextT> const& embed_t; - - typedef typename ContextT::context_linker_t context_t; - typedef typename context_t::attr_t attr_t; - - BOOST_STATIC_CONSTANT(int, id = ID); - - template <typename ScannerT> - struct result - { - typedef typename - impl::get_subrule_result<ID, ScannerT, attr_t>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse_main(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - result_t result; - impl::parse_subrule<result_t, ScannerT, ID>:: - do_(result, scan); - return result; - } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef parser_scanner_linker<ScannerT> scanner_t; - BOOST_SPIRIT_CONTEXT_PARSE( - scan, *this, scanner_t, context_t, result_t); - } - - template <typename DefT> - subrule_parser<ID, DefT, ContextT> - operator=(parser<DefT> const& rhs) const - { - return subrule_parser<ID, DefT, ContextT>(*this, rhs.derived()); - } - - private: - - // assignment of subrules is not allowed. Use subrules - // with identical IDs if you want to have aliases. - - subrule& operator=(subrule const&); - - template <int ID2, typename ContextT2> - subrule& operator=(subrule<ID2, ContextT2> const&); - }; - -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/parser.hpp b/Utilities/BGL/boost/spirit/core/parser.hpp deleted file mode 100644 index 6b0a616b39cd33353834cc0566c0856a78a62377..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/parser.hpp +++ /dev/null @@ -1,219 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_HPP) -#define BOOST_SPIRIT_PARSER_HPP - -#include <boost/config.hpp> -#include <boost/type_traits.hpp> -#include <boost/spirit/core/scanner/scanner.hpp> -#include <boost/spirit/core/nil.hpp> - -namespace boost { namespace spirit -{ - template <typename ParserT, typename ActionT> - class action; // forward declaration - - /////////////////////////////////////////////////////////////////////////// - // - // Parser categories - // - // Helper template classes to distinguish different types of - // parsers. The following categories are the most generic. More - // specific types may inherit from these. Each parser has a typedef - // parser_category_t that defines its category. By default, if one - // is not specified, it will inherit from the base parser class - // which typedefs its parser_category_t as plain_parser_category. - // - // - plain parser has nothing special - // - binary parser has subject a and b (e.g. alternative) - // - unary parser has single subject (e.g. kleene star) - // - action parser has an attached action parser - // - /////////////////////////////////////////////////////////////////////////// - struct plain_parser_category {}; - struct binary_parser_category : plain_parser_category {}; - struct unary_parser_category : plain_parser_category {}; - struct action_parser_category : unary_parser_category {}; - - /////////////////////////////////////////////////////////////////////////// - // - // parser_result metafunction - // - // Given a scanner type ScannerT and a parser type ParserT, the - // parser_result metafunction provides the actual result of the - // parser. - // - // Usage: - // - // typename parser_result<ParserT, ScannerT>::type - // - /////////////////////////////////////////////////////////////////////////// - template <typename ParserT, typename ScannerT> - struct parser_result - { - typedef typename boost::remove_reference<ParserT>::type parser_type; - typedef typename parser_type::template result<ScannerT>::type type; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // parser class - // - // This class is a protocol base class for all parsers. This is - // essentially an interface contract. The parser class does not - // really know how to parse anything but instead relies on the - // template parameter DerivedT (which obviously is assumed to be a - // subclass) to do the actual parsing. - // - // Concrete sub-classes inheriting from parser must have a - // corresponding member function parse(...) compatible with the - // conceptual Interface: - // - // template <typename ScannerT> - // RT parse(ScannerT const& scan) const; - // - // where RT is the desired return type of the parser and ScannerT - // scan is the scanner (see scanner.hpp). - // - // Concrete sub-classes inheriting from parser in most cases need to - // have a nested meta-function result that returns the result type - // of the parser's parse member function, given a scanner type. The - // meta-function has the form: - // - // template <typename ScannerT> - // struct result - // { - // typedef RT type; - // }; - // - // where RT is the desired return type of the parser. This is - // usually, but not always, dependent on the template parameter - // ScannerT. If a parser does not supply a result metafunction, a - // default is provided by the base parser class. - // - // The parser's derived() member function returns a reference to the - // parser as its derived object. - // - // An operator[] is provided. The operator returns a semantic action - // handler (see actions.hpp). - // - // Each parser has a typedef embed_t. This typedef specifies how a - // parser is embedded in a composite (see composite.hpp). By - // default, if one is not specified, the parser will be embedded by - // value. That is, a copy of the parser is placed as a member - // variable of the composite. Most parsers are embedded by value. In - // certain situations however, this is not desirable or possible. - // - /////////////////////////////////////////////////////////////////////////// - template <typename DerivedT> - struct parser - { - typedef DerivedT embed_t; - typedef DerivedT derived_t; - typedef plain_parser_category parser_category_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - DerivedT& derived() - { - return *static_cast<DerivedT*>(this); - } - - DerivedT const& derived() const - { - return *static_cast<DerivedT const*>(this); - } - - template <typename ActionT> - action<DerivedT, ActionT> - operator[](ActionT const& actor) const - { - return action<DerivedT, ActionT>(derived(), actor); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // parse_info - // - // Results returned by the free parse functions: - // - // stop: points to the final parse position (i.e parsing - // processed the input up to this point). - // - // hit: true if parsing is successful. This may be full: - // the parser consumed all the input, or partial: - // the parser consumed only a portion of the input. - // - // full: true when we have a full hit (i.e the parser - // consumed all the input. - // - // length: The number of characters consumed by the parser. - // This is valid only if we have a successful hit - // (either partial or full). - // - /////////////////////////////////////////////////////////////////////////// - template <typename IteratorT = char const*> - struct parse_info - { - IteratorT stop; - bool hit; - bool full; - std::size_t length; - - parse_info( - IteratorT const& stop_ = IteratorT(), - bool hit_ = false, - bool full_ = false, - std::size_t length_ = 0) - : stop(stop_) - , hit(hit_) - , full(full_) - , length(length_) {} - - template <typename ParseInfoT> - parse_info(ParseInfoT const& pi) - : stop(pi.stop) - , hit(pi.hit) - , full(pi.full) - , length(pi.length) {} - }; - - /////////////////////////////////////////////////////////////////////////// - // - // Generic parse function - // - /////////////////////////////////////////////////////////////////////////// - template <typename IteratorT, typename DerivedT> - parse_info<IteratorT> - parse( - IteratorT const& first, - IteratorT const& last, - parser<DerivedT> const& p); - - /////////////////////////////////////////////////////////////////////////// - // - // Parse function for null terminated strings - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT, typename DerivedT> - parse_info<CharT const*> - parse( - CharT const* str, - parser<DerivedT> const& p); - -}} // namespace boost::spirit - -#endif - -#include <boost/spirit/core/impl/parser.ipp> diff --git a/Utilities/BGL/boost/spirit/core/primitives/impl/numerics.ipp b/Utilities/BGL/boost/spirit/core/primitives/impl/numerics.ipp deleted file mode 100644 index a4800ef23d76b5d1141859d0f2e96876ed8c3912..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/primitives/impl/numerics.ipp +++ /dev/null @@ -1,532 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_NUMERICS_IPP -#define BOOST_SPIRIT_NUMERICS_IPP - -#include <cmath> - -#if defined(BOOST_NO_STDC_NAMESPACE) -# define BOOST_SPIRIT_IMPL_STD_NS -#else -# define BOOST_SPIRIT_IMPL_STD_NS std -#endif - -namespace boost { namespace spirit { - - struct sign_parser; // forward declaration only - - namespace impl - { - /////////////////////////////////////////////////////////////////////// - // - // Extract the prefix sign (- or +) - // - /////////////////////////////////////////////////////////////////////// - template <typename ScannerT> - bool - extract_sign(ScannerT const& scan, std::size_t& count) - { - // Extract the sign - count = 0; - bool neg = *scan == '-'; - if (neg || (*scan == '+')) - { - ++scan; - ++count; - return neg; - } - - return false; - } - - /////////////////////////////////////////////////////////////////////// - // - // Traits class for radix specific number conversion - // - // Test the validity of a single character: - // - // template<typename CharT> static bool is_valid(CharT ch); - // - // Convert a digit from character representation to binary - // representation: - // - // template<typename CharT> static int digit(CharT ch); - // - /////////////////////////////////////////////////////////////////////// - template<const int Radix> - struct radix_traits; - - ////////////////////////////////// Binary - template<> - struct radix_traits<2> - { - template<typename CharT> - static bool is_valid(CharT ch) - { - return ('0' == ch || '1' == ch); - } - - template<typename CharT> - static int digit(CharT ch) - { - return ch - '0'; - } - }; - - ////////////////////////////////// Octal - template<> - struct radix_traits<8> - { - template<typename CharT> - static bool is_valid(CharT ch) - { - return ('0' <= ch && ch <= '7'); - } - - template<typename CharT> - static int digit(CharT ch) - { - return ch - '0'; - } - }; - - ////////////////////////////////// Decimal - template<> - struct radix_traits<10> - { - template<typename CharT> - static bool is_valid(CharT ch) - { - return impl::isdigit_(ch); - } - - template<typename CharT> - static int digit(CharT ch) - { - return ch - '0'; - } - }; - - ////////////////////////////////// Hexadecimal - template<> - struct radix_traits<16> - { - template<typename CharT> - static bool is_valid(CharT ch) - { - return impl::isxdigit_(ch); - } - - template<typename CharT> - static int digit(CharT ch) - { - if (impl::isdigit_(ch)) - return ch - '0'; - return impl::tolower_(ch) - 'a' + 10; - } - }; - - /////////////////////////////////////////////////////////////////////// - // - // Helper templates for encapsulation of radix specific - // conversion of an input string to an integral value. - // - // main entry point: - // - // extract_int<Radix, MinDigits, MaxDigits, Accumulate> - // ::f(first, last, n, count); - // - // The template parameter Radix represents the radix of the - // number contained in the parsed string. The template - // parameter MinDigits specifies the minimum digits to - // accept. The template parameter MaxDigits specifies the - // maximum digits to parse. A -1 value for MaxDigits will - // make it parse an arbitrarilly large number as long as the - // numeric type can hold it. Accumulate is either - // positive_accumulate<Radix> (default) for parsing positive - // numbers or negative_accumulate<Radix> otherwise. - // - // scan.first and scan.last are iterators as usual (i.e. - // first is mutable and is moved forward when a match is - // found), n is a variable that holds the number (passed by - // reference). The number of parsed characters is added to - // count (also passed by reference) - // - // NOTE: - // Returns a non-match, if the number to parse - // overflows (or underflows) the used integral type. - // Overflow (or underflow) is detected when an - // operation wraps a value from its maximum to its - // minimum (or vice-versa). For example, overflow - // occurs when the result of the expression n * x is - // less than n (assuming n is positive and x is - // greater than 1). - // - // BEWARE: - // the parameters 'n' and 'count' should be properly - // initialized before calling this function. - // - /////////////////////////////////////////////////////////////////////// - template <int Radix> - struct positive_accumulate - { - // Use this accumulator if number is positive - - template <typename T> - static bool check(T const& n, T const& prev) - { - return n < prev; - } - - template <typename T, typename CharT> - static void add(T& n, CharT ch) - { - n += radix_traits<Radix>::digit(ch); - } - }; - - template <int Radix> - struct negative_accumulate - { - // Use this accumulator if number is negative - - template <typename T> - static bool check(T const& n, T const& prev) - { - return n > prev; - } - - template <typename T, typename CharT> - static void add(T& n, CharT ch) - { - n -= radix_traits<Radix>::digit(ch); - } - }; - - template <int Radix, typename Accumulate> - struct extract_int_base - { - // Common code for extract_int specializations - template <typename ScannerT, typename T> - static bool - f(ScannerT& scan, T& n) - { - T prev = n; - n *= Radix; - if (Accumulate::check(n, prev)) - return false; // over/underflow! - prev = n; - Accumulate::add(n, *scan); - if (Accumulate::check(n, prev)) - return false; // over/underflow! - return true; - } - }; - - template <bool Bounded> - struct extract_int_ - { - template < - int Radix, - unsigned MinDigits, - int MaxDigits, - typename Accumulate - > - struct apply - { - typedef extract_int_base<Radix, Accumulate> base; - typedef radix_traits<Radix> check; - - template <typename ScannerT, typename T> - static bool - f(ScannerT& scan, T& n, std::size_t& count) - { - std::size_t i = 0; - for (; (i < MaxDigits) && !scan.at_end() - && check::is_valid(*scan); - ++i, ++scan, ++count) - { - if (!base::f(scan, n)) - return false; // over/underflow! - } - return i >= MinDigits; - } - }; - }; - - template <> - struct extract_int_<false> - { - template < - int Radix, - unsigned MinDigits, - int MaxDigits, - typename Accumulate - > - struct apply - { - typedef extract_int_base<Radix, Accumulate> base; - typedef radix_traits<Radix> check; - - template <typename ScannerT, typename T> - static bool - f(ScannerT& scan, T& n, std::size_t& count) - { - std::size_t i = 0; - for (; !scan.at_end() && check::is_valid(*scan); - ++i, ++scan, ++count) - { - if (!base::f(scan, n)) - return false; // over/underflow! - } - return i >= MinDigits; - } - }; - }; - - ////////////////////////////////// - template < - int Radix, unsigned MinDigits, int MaxDigits, - typename Accumulate = positive_accumulate<Radix> - > - struct extract_int - { - template <typename ScannerT, typename T> - static bool - f(ScannerT& scan, T& n, std::size_t& count) - { - typedef typename extract_int_<(MaxDigits >= 0)>::template - apply<Radix, MinDigits, MaxDigits, Accumulate> extractor; - return extractor::f(scan, n, count); - } - }; - - /////////////////////////////////////////////////////////////////////// - // - // uint_parser_impl class - // - /////////////////////////////////////////////////////////////////////// - template < - typename T = unsigned, - int Radix = 10, - unsigned MinDigits = 1, - int MaxDigits = -1 - > - struct uint_parser_impl - : parser<uint_parser_impl<T, Radix, MinDigits, MaxDigits> > - { - typedef uint_parser_impl<T, Radix, MinDigits, MaxDigits> self_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, T>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - if (!scan.at_end()) - { - T n = 0; - std::size_t count = 0; - typename ScannerT::iterator_t save = scan.first; - if (extract_int<Radix, MinDigits, MaxDigits>:: - f(scan, n, count)) - { - return scan.create_match(count, n, save, scan.first); - } - // return no-match if number overflows - } - return scan.no_match(); - } - }; - - /////////////////////////////////////////////////////////////////////// - // - // int_parser_impl class - // - /////////////////////////////////////////////////////////////////////// - template < - typename T = unsigned, - int Radix = 10, - unsigned MinDigits = 1, - int MaxDigits = -1 - > - struct int_parser_impl - : parser<int_parser_impl<T, Radix, MinDigits, MaxDigits> > - { - typedef int_parser_impl<T, Radix, MinDigits, MaxDigits> self_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, T>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef extract_int<Radix, MinDigits, MaxDigits, - negative_accumulate<Radix> > extract_int_neg_t; - typedef extract_int<Radix, MinDigits, MaxDigits> - extract_int_pos_t; - - if (!scan.at_end()) - { - T n = 0; - std::size_t count = 0; - typename ScannerT::iterator_t save = scan.first; - - bool hit = impl::extract_sign(scan, count); - - if (hit) - hit = extract_int_neg_t::f(scan, n, count); - else - hit = extract_int_pos_t::f(scan, n, count); - - if (hit) - return scan.create_match(count, n, save, scan.first); - else - scan.first = save; - // return no-match if number overflows or underflows - } - return scan.no_match(); - } - }; - - /////////////////////////////////////////////////////////////////////// - // - // real_parser_impl class - // - /////////////////////////////////////////////////////////////////////// -#if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310)) -#pragma warning(push) -#pragma warning(disable:4127) -#endif - - template <typename RT, typename T, typename RealPoliciesT> - struct real_parser_impl - { - typedef real_parser_impl<RT, T, RealPoliciesT> self_t; - - template <typename ScannerT> - RT parse_main(ScannerT const& scan) const - { - if (scan.at_end()) - return scan.no_match(); - typename ScannerT::iterator_t save = scan.first; - - typedef typename parser_result<sign_parser, ScannerT>::type - sign_match_t; - typedef typename parser_result<chlit<>, ScannerT>::type - exp_match_t; - - sign_match_t sign_match = RealPoliciesT::parse_sign(scan); - std::size_t count = sign_match ? sign_match.length() : 0; - bool neg = sign_match.has_valid_attribute() ? - sign_match.value() : false; - - RT n_match = RealPoliciesT::parse_n(scan); - T n = n_match.has_valid_attribute() ? - n_match.value() : T(0); - bool got_a_number = n_match; - exp_match_t e_hit; - - if (!got_a_number && !RealPoliciesT::allow_leading_dot) - return scan.no_match(); - else - count += n_match.length(); - - if (neg) - n = -n; - - if (RealPoliciesT::parse_dot(scan)) - { - // We got the decimal point. Now we will try to parse - // the fraction if it is there. If not, it defaults - // to zero (0) only if we already got a number. - - if (RT hit = RealPoliciesT::parse_frac_n(scan)) - { - hit.value(hit.value() - * BOOST_SPIRIT_IMPL_STD_NS:: - pow(T(10), T(-hit.length()))); - if (neg) - n -= hit.value(); - else - n += hit.value(); - count += hit.length() + 1; - - } - - else if (!got_a_number || - !RealPoliciesT::allow_trailing_dot) - return scan.no_match(); - - e_hit = RealPoliciesT::parse_exp(scan); - } - else - { - // We have reached a point where we - // still haven't seen a number at all. - // We return early with a no-match. - if (!got_a_number) - return scan.no_match(); - - // If we must expect a dot and we didn't see - // an exponent, return early with a no-match. - e_hit = RealPoliciesT::parse_exp(scan); - if (RealPoliciesT::expect_dot && !e_hit) - return scan.no_match(); - } - - if (e_hit) - { - // We got the exponent prefix. Now we will try to parse the - // actual exponent. It is an error if it is not there. - if (RT e_n_hit = RealPoliciesT::parse_exp_n(scan)) - { - n *= BOOST_SPIRIT_IMPL_STD_NS:: - pow(T(10), T(e_n_hit.value())); - count += e_n_hit.length() + e_hit.length(); - } - else - { - // Oops, no exponent, return a no-match - return scan.no_match(); - } - } - - return scan.create_match(count, n, save, scan.first); - } - - template <typename ScannerT> - static RT parse(ScannerT const& scan) - { - static self_t this_; - return impl::implicit_lexeme_parse<RT>(this_, scan, scan); - } - }; - -#if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310)) -#pragma warning(pop) -#pragma warning(disable:4127) -#endif - - } // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif -#undef BOOST_SPIRIT_IMPL_STD_NS diff --git a/Utilities/BGL/boost/spirit/core/primitives/impl/primitives.ipp b/Utilities/BGL/boost/spirit/core/primitives/impl/primitives.ipp deleted file mode 100644 index 198770eba9a61d9f85e2dde91d1e09459890551a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/primitives/impl/primitives.ipp +++ /dev/null @@ -1,377 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PRIMITIVES_IPP) -#define BOOST_SPIRIT_PRIMITIVES_IPP - -// This should eventually go to a config file. -#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(_STLPORT_VERSION) -# ifndef BOOST_SPIRIT_NO_CHAR_TRAITS -# define BOOST_SPIRIT_NO_CHAR_TRAITS -# endif -#endif - -#include <cctype> -#if !defined(BOOST_NO_CWCTYPE) -#include <cwctype> -#endif - -#ifndef BOOST_SPIRIT_NO_CHAR_TRAITS -# include <string> // char_traits -#endif - -#if defined(BOOST_MSVC) -# pragma warning(disable:4800) -#endif - -namespace boost { namespace spirit { - - template <typename DrivedT> struct char_parser; - - namespace impl - { - template <typename IteratorT> - inline IteratorT - get_last(IteratorT first) - { - while (*first) - first++; - return first; - } - - template< - typename RT, - typename IteratorT, - typename ScannerT> - inline RT - string_parser_parse( - IteratorT str_first, - IteratorT str_last, - ScannerT& scan) - { - typedef typename ScannerT::iterator_t iterator_t; - iterator_t saved = scan.first; - std::size_t slen = str_last - str_first; - - while (str_first != str_last) - { - if (scan.at_end() || (*str_first != *scan)) - return scan.no_match(); - ++str_first; - ++scan; - } - - return scan.create_match(slen, nil_t(), saved, scan.first); - } - - /////////////////////////////////////////////////////////////////////////// - // - // Conversion from char_type to int_type - // - /////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_SPIRIT_NO_CHAR_TRAITS -# define BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE std -#else - - template <typename CharT> - struct char_traits - { - typedef CharT int_type; - typedef CharT char_type; - }; - - template<> - struct char_traits<char> - { - typedef int int_type; - typedef char char_type; - - static char_type - to_char_type(int_type c) - { - return static_cast<char_type>(c); - } - - static int - to_int_type(char c) - { - return static_cast<unsigned char>(c); - } - }; - - template<> - struct char_traits<unsigned char> - { - typedef int int_type; - typedef unsigned char char_type; - - static char_type - to_char_type(int_type c) - { - return static_cast<char_type>(c); - } - - static int - to_int_type(unsigned char c) - { - return c; - } - }; - -# define BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE impl -# ifndef BOOST_NO_CWCHAR - - template<> - struct char_traits<wchar_t> - { - typedef wint_t int_type; - typedef wchar_t char_type; - - static char_type - to_char_type(int_type c) - { - return static_cast<char_type>(c); - } - - static wint_t - to_int_type(wchar_t c) - { - return c; - } - }; - -# endif -#endif // BOOST_SPIRIT_NO_CHAR_TRAITS - - template <typename CharT> - inline typename - BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE::char_traits<CharT>::int_type - to_int_type(CharT c) - { - return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE - ::char_traits<CharT>::to_int_type(c); - } - - template <typename CharT> - inline CharT - to_char_type(typename - BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE::char_traits<CharT>::int_type c) - { - return BOOST_SPIRIT_CHAR_TRAITS_NAMESPACE - ::char_traits<CharT>::to_char_type(c); - } - - /////////////////////////////////////////////////////////////////////// - // - // Convenience functions - // - /////////////////////////////////////////////////////////////////////// - - inline bool - isalnum_(char c) - { - using namespace std; - return isalnum(to_int_type(c)) ? true : false; - } - - inline bool - isalpha_(char c) - { - using namespace std; - return isalpha(to_int_type(c)) ? true : false; - } - - inline bool - iscntrl_(char c) - { - using namespace std; - return iscntrl(to_int_type(c)) ? true : false; - } - - inline bool - isdigit_(char c) - { - using namespace std; - return isdigit(to_int_type(c)) ? true : false; - } - - inline bool - isgraph_(char c) - { - using namespace std; - return isgraph(to_int_type(c)) ? true : false; - } - - inline bool - islower_(char c) - { - using namespace std; - return islower(to_int_type(c)) ? true : false; - } - - inline bool - isprint_(char c) - { - using namespace std; - return isprint(to_int_type(c)) ? true : false; - } - - inline bool - ispunct_(char c) - { - using namespace std; - return ispunct(to_int_type(c)) ? true : false; - } - - inline bool - isspace_(char c) - { - using namespace std; - return isspace(to_int_type(c)) ? true : false; - } - - inline bool - isupper_(char c) - { - using namespace std; - return isupper(to_int_type(c)) ? true : false; - } - - inline bool - isxdigit_(char c) - { - using namespace std; - return isxdigit(to_int_type(c)) ? true : false; - } - - inline bool - isblank_(char c) - { - return (c == ' ' || c == '\t'); - } - - inline char - tolower_(char c) - { - using namespace std; - return to_char_type<char>(tolower(to_int_type(c))); - } - - inline char - toupper_(char c) - { - using namespace std; - return to_char_type<char>(toupper(to_int_type(c))); - } - -#if !defined(BOOST_NO_CWCTYPE) - - inline bool - isalnum_(wchar_t c) - { - using namespace std; - return iswalnum(to_int_type(c)) ? true : false; - } - - inline bool - isalpha_(wchar_t c) - { - using namespace std; - return iswalpha(to_int_type(c)) ? true : false; - } - - inline bool - iscntrl_(wchar_t c) - { - using namespace std; - return iswcntrl(to_int_type(c)) ? true : false; - } - - inline bool - isdigit_(wchar_t c) - { - using namespace std; - return iswdigit(to_int_type(c)) ? true : false; - } - - inline bool - isgraph_(wchar_t c) - { - using namespace std; - return iswgraph(to_int_type(c)) ? true : false; - } - - inline bool - islower_(wchar_t c) - { - using namespace std; - return iswlower(to_int_type(c)) ? true : false; - } - - inline bool - isprint_(wchar_t c) - { - using namespace std; - return iswprint(to_int_type(c)) ? true : false; - } - - inline bool - ispunct_(wchar_t c) - { - using namespace std; - return iswpunct(to_int_type(c)) ? true : false; - } - - inline bool - isspace_(wchar_t c) - { - using namespace std; - return iswspace(to_int_type(c)) ? true : false; - } - - inline bool - isupper_(wchar_t c) - { - using namespace std; - return iswupper(to_int_type(c)) ? true : false; - } - - inline bool - isxdigit_(wchar_t c) - { - using namespace std; - return iswxdigit(to_int_type(c)) ? true : false; - } - - inline bool - isblank_(wchar_t c) - { - return (c == L' ' || c == L'\t'); - } - - inline wchar_t - tolower_(wchar_t c) - { - using namespace std; - return to_char_type<wchar_t>(towlower(to_int_type(c))); - } - - inline wchar_t - toupper_(wchar_t c) - { - using namespace std; - return to_char_type<wchar_t>(towupper(to_int_type(c))); - } - -#endif // !defined(BOOST_NO_CWCTYPE) - -}}} // namespace boost::spirit::impl - -#endif diff --git a/Utilities/BGL/boost/spirit/core/primitives/numerics.hpp b/Utilities/BGL/boost/spirit/core/primitives/numerics.hpp deleted file mode 100644 index f737549300d4dc96d3af2f6d94c8485e178718e2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/primitives/numerics.hpp +++ /dev/null @@ -1,283 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_NUMERICS_HPP -#define BOOST_SPIRIT_NUMERICS_HPP - -#include <boost/config.hpp> -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/directives.hpp> -#include <boost/spirit/core/primitives/impl/numerics.ipp> - -namespace boost { namespace spirit -{ - /////////////////////////////////////////////////////////////////////////// - // - // uint_parser class - // - /////////////////////////////////////////////////////////////////////////// - template < - typename T = unsigned, - int Radix = 10, - unsigned MinDigits = 1, - int MaxDigits = -1 - > - struct uint_parser : parser<uint_parser<T, Radix, MinDigits, MaxDigits> > - { - typedef uint_parser<T, Radix, MinDigits, MaxDigits> self_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, T>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef impl::uint_parser_impl<T, Radix, MinDigits, MaxDigits> impl_t; - typedef typename parser_result<impl_t, ScannerT>::type result_t; - return impl::contiguous_parser_parse<result_t>(impl_t(), scan, scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // int_parser class - // - /////////////////////////////////////////////////////////////////////////// - template < - typename T = unsigned, - int Radix = 10, - unsigned MinDigits = 1, - int MaxDigits = -1 - > - struct int_parser : parser<int_parser<T, Radix, MinDigits, MaxDigits> > - { - typedef int_parser<T, Radix, MinDigits, MaxDigits> self_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, T>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef impl::int_parser_impl<T, Radix, MinDigits, MaxDigits> impl_t; - typedef typename parser_result<impl_t, ScannerT>::type result_t; - return impl::contiguous_parser_parse<result_t>(impl_t(), scan, scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // uint_parser/int_parser instantiations - // - /////////////////////////////////////////////////////////////////////////// - int_parser<int> const - int_p = int_parser<int>(); - - uint_parser<unsigned> const - uint_p = uint_parser<unsigned>(); - - uint_parser<unsigned, 2> const - bin_p = uint_parser<unsigned, 2>(); - - uint_parser<unsigned, 8> const - oct_p = uint_parser<unsigned, 8>(); - - uint_parser<unsigned, 16> const - hex_p = uint_parser<unsigned, 16>(); - - /////////////////////////////////////////////////////////////////////////// - // - // sign_parser class - // - /////////////////////////////////////////////////////////////////////////// - namespace impl - { - // Utility to extract the prefix sign ('-' | '+') - template <typename ScannerT> - bool extract_sign(ScannerT const& scan, std::size_t& count); - } - - struct sign_parser : public parser<sign_parser> - { - typedef sign_parser self_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, bool>::type type; - }; - - sign_parser() {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - if (!scan.at_end()) - { - std::size_t length; - typename ScannerT::iterator_t save(scan.first); - bool neg = impl::extract_sign(scan, length); - if (length) - return scan.create_match(1, neg, save, scan.first); - } - return scan.no_match(); - } - }; - - sign_parser const sign_p = sign_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // default real number policies - // - /////////////////////////////////////////////////////////////////////////// - template <typename T> - struct ureal_parser_policies - { - // trailing dot policy suggested suggested by Gustavo Guerra - BOOST_STATIC_CONSTANT(bool, allow_leading_dot = true); - BOOST_STATIC_CONSTANT(bool, allow_trailing_dot = true); - BOOST_STATIC_CONSTANT(bool, expect_dot = false); - - typedef uint_parser<T, 10, 1, -1> uint_parser_t; - typedef int_parser<T, 10, 1, -1> int_parser_t; - - template <typename ScannerT> - static typename match_result<ScannerT, nil_t>::type - parse_sign(ScannerT& scan) - { - return scan.no_match(); - } - - template <typename ScannerT> - static typename parser_result<uint_parser_t, ScannerT>::type - parse_n(ScannerT& scan) - { - return uint_parser_t().parse(scan); - } - - template <typename ScannerT> - static typename parser_result<chlit<>, ScannerT>::type - parse_dot(ScannerT& scan) - { - return ch_p('.').parse(scan); - } - - template <typename ScannerT> - static typename parser_result<uint_parser_t, ScannerT>::type - parse_frac_n(ScannerT& scan) - { - return uint_parser_t().parse(scan); - } - - template <typename ScannerT> - static typename parser_result<chlit<>, ScannerT>::type - parse_exp(ScannerT& scan) - { - return as_lower_d['e'].parse(scan); - } - - template <typename ScannerT> - static typename parser_result<int_parser_t, ScannerT>::type - parse_exp_n(ScannerT& scan) - { - return int_parser_t().parse(scan); - } - }; - - template <typename T> - struct real_parser_policies : public ureal_parser_policies<T> - { - template <typename ScannerT> - static typename parser_result<sign_parser, ScannerT>::type - parse_sign(ScannerT& scan) - { - return sign_p.parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // real_parser class - // - /////////////////////////////////////////////////////////////////////////// - template < - typename T = double, - typename RealPoliciesT = ureal_parser_policies<T> - > - struct real_parser - : public parser<real_parser<T, RealPoliciesT> > - { - typedef real_parser<T, RealPoliciesT> self_t; - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, T>::type type; - }; - - real_parser() {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::real_parser_impl<result_t, T, RealPoliciesT>::parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // real_parser instantiations - // - /////////////////////////////////////////////////////////////////////////// - real_parser<double, ureal_parser_policies<double> > const - ureal_p = real_parser<double, ureal_parser_policies<double> >(); - - real_parser<double, real_parser_policies<double> > const - real_p = real_parser<double, real_parser_policies<double> >(); - - /////////////////////////////////////////////////////////////////////////// - // - // strict reals (do not allow plain integers (no decimal point)) - // - /////////////////////////////////////////////////////////////////////////// - template <typename T> - struct strict_ureal_parser_policies : public ureal_parser_policies<T> - { - BOOST_STATIC_CONSTANT(bool, expect_dot = true); - }; - - template <typename T> - struct strict_real_parser_policies : public real_parser_policies<T> - { - BOOST_STATIC_CONSTANT(bool, expect_dot = true); - }; - - real_parser<double, strict_ureal_parser_policies<double> > const - strict_ureal_p - = real_parser<double, strict_ureal_parser_policies<double> >(); - - real_parser<double, strict_real_parser_policies<double> > const - strict_real_p - = real_parser<double, strict_real_parser_policies<double> >(); - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/primitives/primitives.hpp b/Utilities/BGL/boost/spirit/core/primitives/primitives.hpp deleted file mode 100644 index f491028a682ced2f56aafd02b07b0a33527add9a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/primitives/primitives.hpp +++ /dev/null @@ -1,641 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PRIMITIVES_HPP) -#define BOOST_SPIRIT_PRIMITIVES_HPP - -#include <boost/ref.hpp> -#include <boost/spirit/core/assert.hpp> -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/impl/directives.ipp> -#include <boost/spirit/core/primitives/impl/primitives.ipp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // char_parser class - // - /////////////////////////////////////////////////////////////////////////// - template <typename DerivedT> - struct char_parser : public parser<DerivedT> - { - typedef DerivedT self_t; - template <typename ScannerT> - struct result - { - typedef typename match_result< - ScannerT, - typename ScannerT::value_t - >::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - typedef typename ScannerT::value_t value_t; - typedef typename ScannerT::iterator_t iterator_t; - - if (!scan.at_end()) - { - value_t ch = *scan; - if (this->derived().test(ch)) - { - iterator_t save(scan.first); - ++scan.first; - return scan.create_match(1, ch, save, scan.first); - } - } - return scan.no_match(); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // negation of char_parsers - // - /////////////////////////////////////////////////////////////////////////// - template <typename PositiveT> - struct negated_char_parser - : public char_parser<negated_char_parser<PositiveT> > - { - typedef negated_char_parser<PositiveT> self_t; - typedef PositiveT positive_t; - - negated_char_parser(positive_t const& p) - : positive(p.derived()) {} - - template <typename T> - bool test(T ch) const - { - return !positive.test(ch); - } - - positive_t const positive; - }; - - template <typename ParserT> - inline negated_char_parser<ParserT> - operator~(char_parser<ParserT> const& p) - { - return negated_char_parser<ParserT>(p.derived()); - } - - template <typename ParserT> - inline ParserT - operator~(negated_char_parser<ParserT> const& n) - { - return n.positive; - } - - /////////////////////////////////////////////////////////////////////////// - // - // chlit class - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT = char> - struct chlit : public char_parser<chlit<CharT> > - { - chlit(CharT ch_) - : ch(ch_) {} - - template <typename T> - bool test(T ch_) const - { - return ch_ == ch; - } - - CharT ch; - }; - - template <typename CharT> - inline chlit<CharT> - ch_p(CharT ch) - { - return chlit<CharT>(ch); - } - - // This should take care of ch_p("a") "bugs" - template <typename CharT, std::size_t N> - inline chlit<CharT> - ch_p(CharT const (& str)[N]) - { - // ch_p's argument should be a single character or a null-terminated - // string with a single character - BOOST_STATIC_ASSERT(N < 3); - return chlit<CharT>(str[0]); - } - - /////////////////////////////////////////////////////////////////////////// - // - // range class - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT = char> - struct range : public char_parser<range<CharT> > - { - range(CharT first_, CharT last_) - : first(first_), last(last_) - { - BOOST_SPIRIT_ASSERT(!(last < first)); - } - - template <typename T> - bool test(T ch) const - { - return !(CharT(ch) < first) && !(last < CharT(ch)); - } - - CharT first; - CharT last; - }; - - template <typename CharT> - inline range<CharT> - range_p(CharT first, CharT last) - { - return range<CharT>(first, last); - } - - /////////////////////////////////////////////////////////////////////////// - // - // chseq class - // - /////////////////////////////////////////////////////////////////////////// - template <typename IteratorT = char const*> - class chseq : public parser<chseq<IteratorT> > - { - public: - - typedef chseq<IteratorT> self_t; - - chseq(IteratorT first_, IteratorT last_) - : first(first_), last(last_) {} - - chseq(IteratorT first_) - : first(first_), last(impl::get_last(first_)) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename boost::unwrap_reference<IteratorT>::type striter_t; - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::string_parser_parse<result_t>( - striter_t(first), - striter_t(last), - scan); - } - - private: - - IteratorT first; - IteratorT last; - }; - - template <typename CharT> - inline chseq<CharT const*> - chseq_p(CharT const* str) - { - return chseq<CharT const*>(str); - } - - template <typename IteratorT> - inline chseq<IteratorT> - chseq_p(IteratorT first, IteratorT last) - { - return chseq<IteratorT>(first, last); - } - - /////////////////////////////////////////////////////////////////////////// - // - // strlit class - // - /////////////////////////////////////////////////////////////////////////// - template <typename IteratorT = char const*> - class strlit : public parser<strlit<IteratorT> > - { - public: - - typedef strlit<IteratorT> self_t; - - strlit(IteratorT first, IteratorT last) - : seq(first, last) {} - - strlit(IteratorT first) - : seq(first) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::contiguous_parser_parse<result_t> - (seq, scan, scan); - } - - private: - - chseq<IteratorT> seq; - }; - - template <typename CharT> - inline strlit<CharT const*> - str_p(CharT const* str) - { - return strlit<CharT const*>(str); - } - - template <typename CharT> - inline strlit<CharT *> - str_p(CharT * str) - { - return strlit<CharT *>(str); - } - - template <typename IteratorT> - inline strlit<IteratorT> - str_p(IteratorT first, IteratorT last) - { - return strlit<IteratorT>(first, last); - } - - // This should take care of str_p('a') "bugs" - template <typename CharT> - inline chlit<CharT> - str_p(CharT ch) - { - return chlit<CharT>(ch); - } - - /////////////////////////////////////////////////////////////////////////// - // - // nothing_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct nothing_parser : public parser<nothing_parser> - { - typedef nothing_parser self_t; - - nothing_parser() {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return scan.no_match(); - } - }; - - nothing_parser const nothing_p = nothing_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // anychar_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct anychar_parser : public char_parser<anychar_parser> - { - typedef anychar_parser self_t; - - anychar_parser() {} - - template <typename CharT> - bool test(CharT) const - { - return true; - } - }; - - anychar_parser const anychar_p = anychar_parser(); - - inline nothing_parser - operator~(anychar_parser) - { - return nothing_p; - } - - /////////////////////////////////////////////////////////////////////////// - // - // alnum_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct alnum_parser : public char_parser<alnum_parser> - { - typedef alnum_parser self_t; - - alnum_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isalnum_(ch); - } - }; - - alnum_parser const alnum_p = alnum_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // alpha_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct alpha_parser : public char_parser<alpha_parser> - { - typedef alpha_parser self_t; - - alpha_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isalpha_(ch); - } - }; - - alpha_parser const alpha_p = alpha_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // cntrl_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct cntrl_parser : public char_parser<cntrl_parser> - { - typedef cntrl_parser self_t; - - cntrl_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::iscntrl_(ch); - } - }; - - cntrl_parser const cntrl_p = cntrl_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // digit_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct digit_parser : public char_parser<digit_parser> - { - typedef digit_parser self_t; - - digit_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isdigit_(ch); - } - }; - - digit_parser const digit_p = digit_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // graph_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct graph_parser : public char_parser<graph_parser> - { - typedef graph_parser self_t; - - graph_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isgraph_(ch); - } - }; - - graph_parser const graph_p = graph_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // lower_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct lower_parser : public char_parser<lower_parser> - { - typedef lower_parser self_t; - - lower_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::islower_(ch); - } - }; - - lower_parser const lower_p = lower_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // print_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct print_parser : public char_parser<print_parser> - { - typedef print_parser self_t; - - print_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isprint_(ch); - } - }; - - print_parser const print_p = print_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // punct_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct punct_parser : public char_parser<punct_parser> - { - typedef punct_parser self_t; - - punct_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::ispunct_(ch); - } - }; - - punct_parser const punct_p = punct_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // blank_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct blank_parser : public char_parser<blank_parser> - { - typedef blank_parser self_t; - - blank_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isblank_(ch); - } - }; - - blank_parser const blank_p = blank_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // space_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct space_parser : public char_parser<space_parser> - { - typedef space_parser self_t; - - space_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isspace_(ch); - } - }; - - space_parser const space_p = space_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // upper_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct upper_parser : public char_parser<upper_parser> - { - typedef upper_parser self_t; - - upper_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isupper_(ch); - } - }; - - upper_parser const upper_p = upper_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // xdigit_parser class - // - /////////////////////////////////////////////////////////////////////////// - struct xdigit_parser : public char_parser<xdigit_parser> - { - typedef xdigit_parser self_t; - - xdigit_parser() {} - - template <typename CharT> - bool test(CharT ch) const - { - return impl::isxdigit_(ch); - } - }; - - xdigit_parser const xdigit_p = xdigit_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // eol_parser class (contributed by Martin Wille) - // - /////////////////////////////////////////////////////////////////////////// - struct eol_parser : public parser<eol_parser> - { - typedef eol_parser self_t; - - eol_parser() {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typename ScannerT::iterator_t save = scan.first; - std::size_t len = 0; - - if (!scan.at_end() && *scan == '\r') // CR - { - ++scan.first; - ++len; - } - - // Don't call skipper here - if (scan.first != scan.last && *scan == '\n') // LF - { - ++scan.first; - ++len; - } - - if (len) - return scan.create_match(len, nil_t(), save, scan.first); - return scan.no_match(); - } - }; - - eol_parser const eol_p = eol_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // end_parser class (suggested by Markus Sch�pflin) - // - /////////////////////////////////////////////////////////////////////////// - struct end_parser : public parser<end_parser> - { - typedef end_parser self_t; - - end_parser() {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - if (scan.at_end()) - return scan.empty_match(); - return scan.no_match(); - } - }; - - end_parser const end_p = end_parser(); - - /////////////////////////////////////////////////////////////////////////// - // - // the pizza_p parser :-) - // - /////////////////////////////////////////////////////////////////////////// - inline strlit<char const*> const - pizza_p(char const* your_favorite_pizza) - { - return your_favorite_pizza; - } - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/core/safe_bool.hpp b/Utilities/BGL/boost/spirit/core/safe_bool.hpp deleted file mode 100644 index 5a2631aac097a233f6c64fec1229265553d1d930..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/safe_bool.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SAFE_BOOL_HPP) -#define BOOST_SPIRIT_SAFE_BOOL_HPP - -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -namespace boost { namespace spirit -{ - namespace impl - { - template <typename T> - struct no_base {}; - - template <typename T> - struct safe_bool_impl - { -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - void stub(T*) {}; - typedef void (safe_bool_impl::*type)(T*); -#else - typedef T* TP; // workaround to make parsing easier - TP stub; - typedef TP safe_bool_impl::*type; -#endif - }; - } - - template <typename DerivedT, typename BaseT = impl::no_base<DerivedT> > - struct safe_bool : BaseT - { - private: - typedef impl::safe_bool_impl<DerivedT> impl_t; - typedef typename impl_t::type bool_type; - - public: - operator bool_type() const - { - return static_cast<const DerivedT*>(this)->operator_bool() ? - &impl_t::stub : 0; - } - - operator bool_type() - { - return static_cast<DerivedT*>(this)->operator_bool() ? - &impl_t::stub : 0; - } - }; -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/scanner/impl/skipper.ipp b/Utilities/BGL/boost/spirit/core/scanner/impl/skipper.ipp deleted file mode 100644 index 267dadb5330b2ab5232ac0b8fc06da4ea2ff78b0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/scanner/impl/skipper.ipp +++ /dev/null @@ -1,179 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -============================================================================*/ -#if !defined(BOOST_SPIRIT_SKIPPER_IPP) -#define BOOST_SPIRIT_SKIPPER_IPP - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - struct space_parser; - template <typename BaseT> - struct no_skipper_iteration_policy; - - namespace impl - { - template <typename ST, typename ScannerT, typename BaseT> - inline void - skipper_skip( - ST const& s, - ScannerT const& scan, - skipper_iteration_policy<BaseT> const&) - { - typedef scanner_policies< - no_skipper_iteration_policy< - BOOST_DEDUCED_TYPENAME ScannerT::iteration_policy_t>, - BOOST_DEDUCED_TYPENAME ScannerT::match_policy_t, - BOOST_DEDUCED_TYPENAME ScannerT::action_policy_t - > policies_t; - - scanner<BOOST_DEDUCED_TYPENAME ScannerT::iterator_t, policies_t> - scan2(scan.first, scan.last, policies_t(scan)); - typedef typename ScannerT::iterator_t iterator_t; - - for (;;) - { - iterator_t save = scan.first; - if (!s.parse(scan2)) - { - scan.first = save; - break; - } - } - } - - template <typename ST, typename ScannerT, typename BaseT> - inline void - skipper_skip( - ST const& s, - ScannerT const& scan, - no_skipper_iteration_policy<BaseT> const&) - { - for (;;) - { - typedef typename ScannerT::iterator_t iterator_t; - iterator_t save = scan.first; - if (!s.parse(scan)) - { - scan.first = save; - break; - } - } - } - - template <typename ST, typename ScannerT> - inline void - skipper_skip( - ST const& s, - ScannerT const& scan, - iteration_policy const&) - { - for (;;) - { - typedef typename ScannerT::iterator_t iterator_t; - iterator_t save = scan.first; - if (!s.parse(scan)) - { - scan.first = save; - break; - } - } - } - - template <typename SkipT> - struct phrase_parser - { - template <typename IteratorT, typename ParserT> - static parse_info<IteratorT> - parse( - IteratorT const& first_, - IteratorT const& last, - ParserT const& p, - SkipT const& skip) - { - typedef skip_parser_iteration_policy<SkipT> iter_policy_t; - typedef scanner_policies<iter_policy_t> scanner_policies_t; - typedef scanner<IteratorT, scanner_policies_t> scanner_t; - - iter_policy_t iter_policy(skip); - scanner_policies_t policies(iter_policy); - IteratorT first = first_; - scanner_t scan(first, last, policies); - match<nil_t> hit = p.parse(scan); - scan.skip(scan); - return parse_info<IteratorT>( - first, hit, hit && (first == last), - hit.length()); - } - }; - - template <> - struct phrase_parser<space_parser> - { - template <typename IteratorT, typename ParserT> - static parse_info<IteratorT> - parse( - IteratorT const& first_, - IteratorT const& last, - ParserT const& p, - space_parser const&) - { - typedef skipper_iteration_policy<> iter_policy_t; - typedef scanner_policies<iter_policy_t> scanner_policies_t; - typedef scanner<IteratorT, scanner_policies_t> scanner_t; - - IteratorT first = first_; - scanner_t scan(first, last); - match<nil_t> hit = p.parse(scan); - scan.skip(scan); - return parse_info<IteratorT>( - first, hit, hit && (first == last), - hit.length()); - } - }; - } - - /////////////////////////////////////////////////////////////////////////// - // - // Free parse functions using the skippers - // - /////////////////////////////////////////////////////////////////////////// - template <typename IteratorT, typename ParserT, typename SkipT> - inline parse_info<IteratorT> - parse( - IteratorT const& first, - IteratorT const& last, - parser<ParserT> const& p, - parser<SkipT> const& skip) - { - return impl::phrase_parser<SkipT>:: - parse(first, last, p.derived(), skip.derived()); - } - - /////////////////////////////////////////////////////////////////////////// - // - // Parse function for null terminated strings using the skippers - // - /////////////////////////////////////////////////////////////////////////// - template <typename CharT, typename ParserT, typename SkipT> - inline parse_info<CharT const*> - parse( - CharT const* str, - parser<ParserT> const& p, - parser<SkipT> const& skip) - { - CharT const* last = str; - while (*last) - last++; - return parse(str, last, p, skip); - } - -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/core/scanner/scanner.hpp b/Utilities/BGL/boost/spirit/core/scanner/scanner.hpp deleted file mode 100644 index 525949cdaff6d1dd0d346d00faf336dc06ad9357..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/scanner/scanner.hpp +++ /dev/null @@ -1,318 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2002 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SCANNER_HPP) -#define BOOST_SPIRIT_SCANNER_HPP - -#include <iterator> -#include <boost/config.hpp> -#include <boost/spirit/core/match.hpp> -#include <boost/spirit/core/non_terminal/parser_id.hpp> -#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits - -namespace boost { namespace spirit -{ - /////////////////////////////////////////////////////////////////////////// - // - // iteration_policy class - // - /////////////////////////////////////////////////////////////////////////// - struct iteration_policy - { - template <typename ScannerT> - void - advance(ScannerT const& scan) const - { - ++scan.first; - } - - template <typename ScannerT> - bool at_end(ScannerT const& scan) const - { - return scan.first == scan.last; - } - - template <typename T> - T filter(T ch) const - { - return ch; - } - - template <typename ScannerT> - typename ScannerT::ref_t - get(ScannerT const& scan) const - { - return *scan.first; - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // match_policy class - // - /////////////////////////////////////////////////////////////////////////// - struct match_policy - { - template <typename T> - struct result { typedef match<T> type; }; - - const match<nil_t> - no_match() const - { - return match<nil_t>(); - } - - const match<nil_t> - empty_match() const - { - return match<nil_t>(0, nil_t()); - } - - template <typename AttrT, typename IteratorT> - match<AttrT> - create_match( - std::size_t length, - AttrT const& val, - IteratorT const& /*first*/, - IteratorT const& /*last*/) const - { - return match<AttrT>(length, val); - } - - template <typename MatchT, typename IteratorT> - void group_match( - MatchT& /*m*/, - parser_id const& /*id*/, - IteratorT const& /*first*/, - IteratorT const& /*last*/) const {} - - template <typename Match1T, typename Match2T> - void concat_match(Match1T& l, Match2T const& r) const - { - l.concat(r); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // match_result class - // - /////////////////////////////////////////////////////////////////////////// - template <typename MatchPolicyT, typename T> - struct match_result - { - typedef typename MatchPolicyT::template result<T>::type type; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // action_policy class - // - /////////////////////////////////////////////////////////////////////////// - template <typename AttrT> - struct attributed_action_policy - { - template <typename ActorT, typename IteratorT> - static void - call( - ActorT const& actor, - AttrT& val, - IteratorT const&, - IteratorT const&) - { - actor(val); - } - }; - - ////////////////////////////////// - template <> - struct attributed_action_policy<nil_t> - { - template <typename ActorT, typename IteratorT> - static void - call( - ActorT const& actor, - nil_t, - IteratorT const& first, - IteratorT const& last) - { - actor(first, last); - } - }; - - ////////////////////////////////// - struct action_policy - { - template <typename ActorT, typename AttrT, typename IteratorT> - void - do_action( - ActorT const& actor, - AttrT& val, - IteratorT const& first, - IteratorT const& last) const - { - attributed_action_policy<AttrT>::call(actor, val, first, last); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // scanner_policies class - // - /////////////////////////////////////////////////////////////////////////// - template < - typename IterationPolicyT = iteration_policy, - typename MatchPolicyT = match_policy, - typename ActionPolicyT = action_policy> - struct scanner_policies : - public IterationPolicyT, - public MatchPolicyT, - public ActionPolicyT - { - typedef IterationPolicyT iteration_policy_t; - typedef MatchPolicyT match_policy_t; - typedef ActionPolicyT action_policy_t; - - scanner_policies( - IterationPolicyT const& i_policy = IterationPolicyT(), - MatchPolicyT const& m_policy = MatchPolicyT(), - ActionPolicyT const& a_policy = ActionPolicyT()) - : IterationPolicyT(i_policy) - , MatchPolicyT(m_policy) - , ActionPolicyT(a_policy) {} - - template <typename ScannerPoliciesT> - scanner_policies(ScannerPoliciesT const& policies) - : IterationPolicyT(policies) - , MatchPolicyT(policies) - , ActionPolicyT(policies) {} - }; - - /////////////////////////////////////////////////////////////////////////// - // - // scanner_policies_base class: the base class of all scanners - // - /////////////////////////////////////////////////////////////////////////// - struct scanner_base {}; - - /////////////////////////////////////////////////////////////////////////// - // - // scanner class - // - /////////////////////////////////////////////////////////////////////////// - template < - typename IteratorT = char const*, - typename PoliciesT = scanner_policies<> > - class scanner : public PoliciesT, public scanner_base - { - public: - - typedef IteratorT iterator_t; - typedef PoliciesT policies_t; - - typedef typename boost::detail:: - iterator_traits<IteratorT>::value_type value_t; - typedef typename boost::detail:: - iterator_traits<IteratorT>::reference ref_t; - typedef typename boost:: - call_traits<IteratorT>::param_type iter_param_t; - - scanner( - IteratorT& first_, - iter_param_t last_, - PoliciesT const& policies = PoliciesT()) - : PoliciesT(policies), first(first_), last(last_) - { - at_end(); - } - - scanner(scanner const& other) - : PoliciesT(other), first(other.first), last(other.last) {} - - scanner(scanner const& other, IteratorT& first_) - : PoliciesT(other), first(first_), last(other.last) {} - - bool - at_end() const - { - typedef typename PoliciesT::iteration_policy_t iteration_policy_t; - return iteration_policy_t::at_end(*this); - } - - value_t - operator*() const - { - typedef typename PoliciesT::iteration_policy_t iteration_policy_t; - return iteration_policy_t::filter(iteration_policy_t::get(*this)); - } - - scanner const& - operator++() const - { - typedef typename PoliciesT::iteration_policy_t iteration_policy_t; - iteration_policy_t::advance(*this); - return *this; - } - - template <typename PoliciesT2> - struct rebind_policies - { - typedef scanner<IteratorT, PoliciesT2> type; - }; - - template <typename PoliciesT2> - scanner<IteratorT, PoliciesT2> - change_policies(PoliciesT2 const& policies) const - { - return scanner<IteratorT, PoliciesT2>(first, last, policies); - } - - template <typename IteratorT2> - struct rebind_iterator - { - typedef scanner<IteratorT2, PoliciesT> type; - }; - - template <typename IteratorT2> - scanner<IteratorT2, PoliciesT> - change_iterator(IteratorT2 const& first_, IteratorT2 const &last_) const - { - return scanner<IteratorT2, PoliciesT>(first_, last_, *this); - } - - IteratorT& first; - IteratorT const last; - - private: - - scanner& - operator=(scanner const& other); - }; - - /////////////////////////////////////////////////////////////////////////// - // - // rebind_scanner_policies class - // - /////////////////////////////////////////////////////////////////////////// - template <typename ScannerT, typename PoliciesT> - struct rebind_scanner_policies - { - typedef typename ScannerT::template - rebind_policies<PoliciesT>::type type; - }; - - ////////////////////////////////// - template <typename ScannerT, typename IteratorT> - struct rebind_scanner_iterator - { - typedef typename ScannerT::template - rebind_iterator<IteratorT>::type type; - }; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/core/scanner/skipper.hpp b/Utilities/BGL/boost/spirit/core/scanner/skipper.hpp deleted file mode 100644 index 33547bdc20799924d5dffa0824479eb9f6b60a32..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/core/scanner/skipper.hpp +++ /dev/null @@ -1,171 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SKIPPER_HPP) -#define BOOST_SPIRIT_SKIPPER_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <cctype> - -#include <boost/spirit/core/scanner/scanner.hpp> -#include <boost/spirit/core/primitives/impl/primitives.ipp> - -namespace boost { namespace spirit { - - template <typename BaseT> - struct no_skipper_iteration_policy; // forward - - /////////////////////////////////////////////////////////////////////////// - // - // skipper_iteration_policy class - // - /////////////////////////////////////////////////////////////////////////// - template <typename BaseT = iteration_policy> - struct skipper_iteration_policy : public BaseT - { - typedef BaseT base_t; - - skipper_iteration_policy() - : BaseT() {} - - template <typename PolicyT> - skipper_iteration_policy(PolicyT const& other) - : BaseT(other) {} - - template <typename ScannerT> - void - advance(ScannerT const& scan) const - { - BaseT::advance(scan); - scan.skip(scan); - } - - template <typename ScannerT> - bool - at_end(ScannerT const& scan) const - { - scan.skip(scan); - return BaseT::at_end(scan); - } - - template <typename ScannerT> - void - skip(ScannerT const& scan) const - { - while (!BaseT::at_end(scan) && impl::isspace_(BaseT::get(scan))) - BaseT::advance(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // skipper_iteration_policy class - // - /////////////////////////////////////////////////////////////////////////// - namespace impl - { - template <typename ST, typename ScannerT, typename BaseT> - void - skipper_skip( - ST const& s, - ScannerT const& scan, - skipper_iteration_policy<BaseT> const&); - - template <typename ST, typename ScannerT, typename BaseT> - void - skipper_skip( - ST const& s, - ScannerT const& scan, - no_skipper_iteration_policy<BaseT> const&); - - template <typename ST, typename ScannerT> - void - skipper_skip( - ST const& s, - ScannerT const& scan, - iteration_policy const&); - } - - template <typename ParserT, typename BaseT = iteration_policy> - class skip_parser_iteration_policy : public skipper_iteration_policy<BaseT> - { - public: - - typedef skipper_iteration_policy<BaseT> base_t; - - skip_parser_iteration_policy( - ParserT const& skip_parser, - base_t const& base = base_t()) - : base_t(base), subject(skip_parser) {} - - template <typename PolicyT> - skip_parser_iteration_policy(PolicyT const& other) - : base_t(other), subject(other.skipper()) {} - - template <typename ScannerT> - void - skip(ScannerT const& scan) const - { - impl::skipper_skip(subject, scan, scan); - } - - ParserT const& - skipper() const - { - return subject; - } - - private: - - ParserT const& subject; - }; - - /////////////////////////////////////////////////////////////////////////////// - // - // Free parse functions using the skippers - // - /////////////////////////////////////////////////////////////////////////////// - template <typename IteratorT, typename ParserT, typename SkipT> - parse_info<IteratorT> - parse( - IteratorT const& first, - IteratorT const& last, - parser<ParserT> const& p, - parser<SkipT> const& skip); - - /////////////////////////////////////////////////////////////////////////////// - // - // Parse function for null terminated strings using the skippers - // - /////////////////////////////////////////////////////////////////////////////// - template <typename CharT, typename ParserT, typename SkipT> - parse_info<CharT const*> - parse( - CharT const* str, - parser<ParserT> const& p, - parser<SkipT> const& skip); - - /////////////////////////////////////////////////////////////////////////////// - // - // phrase_scanner_t and wide_phrase_scanner_t - // - // The most common scanners. Use these typedefs when you need - // a scanner that skips white spaces. - // - /////////////////////////////////////////////////////////////////////////////// - typedef skipper_iteration_policy<> iter_policy_t; - typedef scanner_policies<iter_policy_t> scanner_policies_t; - typedef scanner<char const*, scanner_policies_t> phrase_scanner_t; - typedef scanner<wchar_t const*, scanner_policies_t> wide_phrase_scanner_t; - - /////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#include <boost/spirit/core/scanner/impl/skipper.ipp> -#endif - diff --git a/Utilities/BGL/boost/spirit/debug.hpp b/Utilities/BGL/boost/spirit/debug.hpp deleted file mode 100644 index 8b97edeadf17986f4cc8adc447fcf654b8d9b80a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/debug.hpp +++ /dev/null @@ -1,146 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP) -#define BOOST_SPIRIT_DEBUG_MAIN_HPP - -/////////////////////////////////////////////////////////////////////////// -#if defined(BOOST_SPIRIT_DEBUG) - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit.Debug includes and defines -// -/////////////////////////////////////////////////////////////////////////////// - - #include <iostream> - - /////////////////////////////////////////////////////////////////////////// - // - // The BOOST_SPIRIT_DEBUG_OUT defines the stream object, which should be used - // for debug diagnostics. This defaults to std::cout. - // - /////////////////////////////////////////////////////////////////////////// - #if !defined(BOOST_SPIRIT_DEBUG_OUT) - #define BOOST_SPIRIT_DEBUG_OUT std::cout - #endif - - /////////////////////////////////////////////////////////////////////////// - // - // The BOOST_SPIRIT_DEBUG_PRINT_SOME constant defines the number of characters - // from the stream to be printed for diagnosis. This defaults to the first - // 20 characters. - // - /////////////////////////////////////////////////////////////////////////// - #if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME) - #define BOOST_SPIRIT_DEBUG_PRINT_SOME 20 - #endif - - /////////////////////////////////////////////////////////////////////////// - // - // Additional BOOST_SPIRIT_DEBUG_FLAGS control the level of diagnostics printed - // Basic constants are defined in debug/minimal.hpp. - // - /////////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_DEBUG_FLAGS_NODES 0x0001 // node diagnostics - #define BOOST_SPIRIT_DEBUG_FLAGS_ESCAPE_CHAR 0x0002 // escape_char_parse diagnostics - #define BOOST_SPIRIT_DEBUG_FLAGS_TREES 0x0004 // parse tree/ast diagnostics - #define BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES 0x0008 // closure diagnostics - #define BOOST_SPIRIT_DEBUG_FLAGS_SLEX 0x8000 // slex diagnostics - - #define BOOST_SPIRIT_DEBUG_FLAGS_MAX 0xFFFF // print maximal diagnostics - - #if !defined(BOOST_SPIRIT_DEBUG_FLAGS) - #define BOOST_SPIRIT_DEBUG_FLAGS BOOST_SPIRIT_DEBUG_FLAGS_MAX - #endif - - /////////////////////////////////////////////////////////////////////////// - // - // By default all nodes are traced (even those, not registered with - // BOOST_SPIRIT_DEBUG_RULE et.al. - see below). The following constant may be - // used to redefine this default. - // - /////////////////////////////////////////////////////////////////////////// - #if !defined(BOOST_SPIRIT_DEBUG_TRACENODE) - #define BOOST_SPIRIT_DEBUG_TRACENODE (true) - #endif // !defined(BOOST_SPIRIT_DEBUG_TRACENODE) - - /////////////////////////////////////////////////////////////////////////// - // - // Helper macros for giving rules and subrules a name accessible through - // parser_name() functions (see parser_names.hpp). - // - // Additionally, the macros BOOST_SPIRIT_DEBUG_RULE, SPIRIT_DEBUG_NODE and - // BOOST_SPIRIT_DEBUG_GRAMMAR enable/disable the tracing of the - // correspondingnode accordingly to the PP constant - // BOOST_SPIRIT_DEBUG_TRACENODE. - // - // The macros BOOST_SPIRIT_DEBUG_TRACE_RULE, BOOST_SPIRIT_DEBUG_TRACE_NODE - // and BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR allow to specify a flag to define, - // whether the corresponding node is to be traced or not. - // - /////////////////////////////////////////////////////////////////////////// - #if !defined(BOOST_SPIRIT_DEBUG_RULE) - #define BOOST_SPIRIT_DEBUG_RULE(r) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) - #endif // !defined(BOOST_SPIRIT_DEBUG_RULE) - - #if !defined(BOOST_SPIRIT_DEBUG_NODE) - #define BOOST_SPIRIT_DEBUG_NODE(r) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) - #endif // !defined(BOOST_SPIRIT_DEBUG_NODE) - - #if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) - #define BOOST_SPIRIT_DEBUG_GRAMMAR(r) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE) - #endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) - - #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE) - #define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t)) - #endif // !defined(BOOST_SPIRIT_TRACE_RULE) - - #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) - #define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t)) - #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) - - #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) - #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, #r, (t)) - #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) - - #if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) - #define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t)) - #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) - - #if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) - #define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t)) - #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) - - #if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) - #define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t) \ - ::boost::spirit::impl::get_node_registry().register_node(&r, (n), (t)) - #endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) - - ////////////////////////////////// - #include <boost/spirit/debug/debug_node.hpp> - -#else - ////////////////////////////////// - #include <boost/spirit/debug/minimal.hpp> - -#endif // BOOST_SPIRIT_DEBUG - -#endif - diff --git a/Utilities/BGL/boost/spirit/debug/debug_node.hpp b/Utilities/BGL/boost/spirit/debug/debug_node.hpp deleted file mode 100644 index a7c5e0f2e6d620e3715014b39757d50688ccbdcc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/debug/debug_node.hpp +++ /dev/null @@ -1,315 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - Copyright (c) 2003 Gustavo Guerra - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_DEBUG_NODE_HPP) -#define BOOST_SPIRIT_DEBUG_NODE_HPP - -#if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP) -#error "You must include boost/spirit/debug.hpp, not boost/spirit/debug/debug_node.hpp" -#endif - -#if defined(BOOST_SPIRIT_DEBUG) - -#include <string> - -#include <boost/type_traits/is_convertible.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/and.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> // for iscntrl_ - -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// Debug helper classes for rules, which ensure maximum non-intrusiveness of -// the Spirit debug support -// -/////////////////////////////////////////////////////////////////////////////// - -namespace impl { - - struct token_printer_aux_for_chars - { - template<typename CharT> - static void print(std::ostream& o, CharT c) - { - if (c == static_cast<CharT>('\a')) - o << "\\a"; - - else if (c == static_cast<CharT>('\b')) - o << "\\b"; - - else if (c == static_cast<CharT>('\f')) - o << "\\f"; - - else if (c == static_cast<CharT>('\n')) - o << "\\n"; - - else if (c == static_cast<CharT>('\r')) - o << "\\r"; - - else if (c == static_cast<CharT>('\t')) - o << "\\t"; - - else if (c == static_cast<CharT>('\v')) - o << "\\v"; - - else if (iscntrl_(c)) - o << "\\" << static_cast<int>(c); - - else - o << static_cast<char>(c); - } - }; - - // for token types where the comparison with char constants wouldn't work - struct token_printer_aux_for_other_types - { - template<typename CharT> - static void print(std::ostream& o, CharT c) - { - o << c; - } - }; - - template <typename CharT> - struct token_printer_aux - : mpl::if_< - mpl::and_< - is_convertible<CharT, char>, - is_convertible<char, CharT> >, - token_printer_aux_for_chars, - token_printer_aux_for_other_types - >::type - { - }; - - template<typename CharT> - inline void token_printer(std::ostream& o, CharT c) - { - #if !defined(BOOST_SPIRIT_DEBUG_TOKEN_PRINTER) - - token_printer_aux<CharT>::print(o, c); - - #else - - BOOST_SPIRIT_DEBUG_TOKEN_PRINTER(o, c); - - #endif - } - -/////////////////////////////////////////////////////////////////////////////// -// -// Dump infos about the parsing state of a rule -// -/////////////////////////////////////////////////////////////////////////////// - -#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES - template <typename IteratorT> - inline void - print_node_info(bool hit, int level, bool close, std::string const& name, - IteratorT first, IteratorT last) - { - if (!name.empty()) - { - for (int i = 0; i < level; ++i) - BOOST_SPIRIT_DEBUG_OUT << " "; - if (close) - { - if (hit) - BOOST_SPIRIT_DEBUG_OUT << "/"; - else - BOOST_SPIRIT_DEBUG_OUT << "#"; - } - BOOST_SPIRIT_DEBUG_OUT << name << ":\t\""; - IteratorT iter = first; - IteratorT ilast = last; - for (int j = 0; j < BOOST_SPIRIT_DEBUG_PRINT_SOME; ++j) - { - if (iter == ilast) - break; - - token_printer(BOOST_SPIRIT_DEBUG_OUT, *iter); - ++iter; - } - BOOST_SPIRIT_DEBUG_OUT << "\"\n"; - } - } -#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES - -#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES - template <typename ResultT> - inline ResultT & - print_closure_info(ResultT &hit, int level, std::string const& name) - { - if (!name.empty()) - { - for (int i = 0; i < level-1; ++i) - BOOST_SPIRIT_DEBUG_OUT << " "; - - // for now, print out the return value only - BOOST_SPIRIT_DEBUG_OUT << "^" << name << ":\t"; - if (hit.has_valid_attribute()) - BOOST_SPIRIT_DEBUG_OUT << hit.value(); - else - BOOST_SPIRIT_DEBUG_OUT << "undefined attribute"; - BOOST_SPIRIT_DEBUG_OUT << "\n"; - } - return hit; - } -#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES - -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Implementation note: The parser_context_linker, parser_scanner_linker and -// closure_context_linker classes are wrapped by a PP constant to allow -// redefinition of this classes outside of Spirit -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) -#define BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED - - /////////////////////////////////////////////////////////////////////////// - // - // parser_context_linker is a debug wrapper for the ContextT template - // parameter of the rule<>, subrule<> and the grammar<> classes - // - /////////////////////////////////////////////////////////////////////////// - template<typename ContextT> - struct parser_context_linker : public ContextT - { - typedef ContextT base_t; - - template <typename ParserT> - parser_context_linker(ParserT const& p) - : ContextT(p) {} - - template <typename ParserT, typename ScannerT> - void pre_parse(ParserT const& p, ScannerT &scan) - { - this->base_t::pre_parse(p, scan); - -#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES - if (trace_parser(p.derived())) { - impl::print_node_info( - false, - scan.get_level(), - false, - parser_name(p.derived()), - scan.first, - scan.last); - } - scan.get_level()++; -#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES - } - - template <typename ResultT, typename ParserT, typename ScannerT> - ResultT& post_parse(ResultT& hit, ParserT const& p, ScannerT &scan) - { -#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES - --scan.get_level(); - if (trace_parser(p.derived())) { - impl::print_node_info( - hit, - scan.get_level(), - true, - parser_name(p.derived()), - scan.first, - scan.last); - } -#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES - - return this->base_t::post_parse(hit, p, scan); - } - }; - -#endif // !defined(BOOST_SPIRIT_PARSER_CONTEXT_LINKER_DEFINED) - -#if !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) -#define BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED - -/////////////////////////////////////////////////////////////////////////////// -// This class is to avoid linker problems and to ensure a real singleton -// 'level' variable - struct debug_support - { - int& get_level() - { - static int level = 0; - return level; - } - }; - - template<typename ScannerT> - struct parser_scanner_linker : public ScannerT - { - parser_scanner_linker(ScannerT const &scan_) : ScannerT(scan_) - {} - - int &get_level() - { return debug.get_level(); } - - private: debug_support debug; - }; - -#endif // !defined(BOOST_SPIRIT_PARSER_SCANNER_LINKER_DEFINED) - -#if !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) -#define BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED - - /////////////////////////////////////////////////////////////////////////// - // - // closure_context_linker is a debug wrapper for the closure template - // parameter of the rule<>, subrule<> and grammar classes - // - /////////////////////////////////////////////////////////////////////////// - - template<typename ContextT> - struct closure_context_linker : public parser_context_linker<ContextT> - { - typedef parser_context_linker<ContextT> base_t; - - template <typename ParserT> - closure_context_linker(ParserT const& p) - : parser_context_linker<ContextT>(p) {} - - template <typename ParserT, typename ScannerT> - void pre_parse(ParserT const& p, ScannerT &scan) - { this->base_t::pre_parse(p, scan); } - - template <typename ResultT, typename ParserT, typename ScannerT> - ResultT& - post_parse(ResultT& hit, ParserT const& p, ScannerT &scan) - { -#if BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES - if (hit && trace_parser(p.derived())) { - // for now, print out the return value only - return impl::print_closure_info( - this->base_t::post_parse(hit, p, scan), - scan.get_level(), - parser_name(p.derived()) - ); - } -#endif // BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES - - return this->base_t::post_parse(hit, p, scan); - } - }; - -#endif // !defined(BOOST_SPIRIT_CLOSURE_CONTEXT_LINKER_DEFINED) - -}} // namespace boost::spirit - -#endif // defined(BOOST_SPIRIT_DEBUG) - -#endif // !defined(BOOST_SPIRIT_DEBUG_NODE_HPP) - diff --git a/Utilities/BGL/boost/spirit/debug/impl/parser_names.ipp b/Utilities/BGL/boost/spirit/debug/impl/parser_names.ipp deleted file mode 100644 index 69c9a57ae3d119aa5218194a8eade1751bb39f7f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/debug/impl/parser_names.ipp +++ /dev/null @@ -1,551 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_NAMES_IPP) -#define BOOST_SPIRIT_PARSER_NAMES_IPP - -#if defined(BOOST_SPIRIT_DEBUG) - -#include <string> -#include <iostream> -#include <map> - -#include <boost/config.hpp> -#ifdef BOOST_NO_STRINGSTREAM -#include <strstream> -#define BOOST_SPIRIT_SSTREAM std::strstream -std::string BOOST_SPIRIT_GETSTRING(std::strstream& ss) -{ - ss << ends; - std::string rval = ss.str(); - ss.freeze(false); - return rval; -} -#else -#include <sstream> -#define BOOST_SPIRIT_GETSTRING(ss) ss.str() -#define BOOST_SPIRIT_SSTREAM std::stringstream -#endif - -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// from actions.hpp - template <typename ParserT, typename ActionT> - inline std::string - parser_name(action<ParserT, ActionT> const& p) - { - return std::string("action") - + std::string("[") - + parser_name(p.subject()) - + std::string("]"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from directives.hpp - template <typename ParserT> - inline std::string - parser_name(contiguous<ParserT> const& p) - { - return std::string("contiguous") - + std::string("[") - + parser_name(p.subject()) - + std::string("]"); - } - - template <typename ParserT> - inline std::string - parser_name(inhibit_case<ParserT> const& p) - { - return std::string("inhibit_case") - + std::string("[") - + parser_name(p.subject()) - + std::string("]"); - } - - template <typename A, typename B> - inline std::string - parser_name(longest_alternative<A, B> const& p) - { - return std::string("longest_alternative") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - - template <typename A, typename B> - inline std::string - parser_name(shortest_alternative<A, B> const& p) - { - return std::string("shortest_alternative") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from numerics.hpp - template <typename T, int Radix, unsigned MinDigits, int MaxDigits> - inline std::string - parser_name(uint_parser<T, Radix, MinDigits, MaxDigits> const& p) - { - BOOST_SPIRIT_SSTREAM stream; - stream << Radix << ", " << MinDigits << ", " << MaxDigits; - return std::string("uint_parser<") - + BOOST_SPIRIT_GETSTRING(stream) - + std::string(">"); - } - - template <typename T, int Radix, unsigned MinDigits, int MaxDigits> - inline std::string - parser_name(int_parser<T, Radix, MinDigits, MaxDigits> const& p) - { - BOOST_SPIRIT_SSTREAM stream; - stream << Radix << ", " << MinDigits << ", " << MaxDigits; - return std::string("int_parser<") - + BOOST_SPIRIT_GETSTRING(stream) - + std::string(">"); - } - - template <typename T, typename RealPoliciesT> - inline std::string - parser_name(real_parser<T, RealPoliciesT> const& p) - { - return std::string("real_parser"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from operators.hpp - template <typename A, typename B> - inline std::string - parser_name(sequence<A, B> const& p) - { - return std::string("sequence") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - - template <typename A, typename B> - inline std::string - parser_name(sequential_or<A, B> const& p) - { - return std::string("sequential_or") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - - template <typename A, typename B> - inline std::string - parser_name(alternative<A, B> const& p) - { - return std::string("alternative") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - - template <typename A, typename B> - inline std::string - parser_name(intersection<A, B> const& p) - { - return std::string("intersection") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - - template <typename A, typename B> - inline std::string - parser_name(difference<A, B> const& p) - { - return std::string("difference") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - - template <typename A, typename B> - inline std::string - parser_name(exclusive_or<A, B> const& p) - { - return std::string("exclusive_or") - + std::string("[") - + parser_name(p.left()) + std::string(", ") + parser_name(p.right()) - + std::string("]"); - } - - template <typename S> - inline std::string - parser_name(optional<S> const& p) - { - return std::string("optional") - + std::string("[") - + parser_name(p.subject()) - + std::string("]"); - } - - template <typename S> - inline std::string - parser_name(kleene_star<S> const& p) - { - return std::string("kleene_star") - + std::string("[") - + parser_name(p.subject()) - + std::string("]"); - } - - template <typename S> - inline std::string - parser_name(positive<S> const& p) - { - return std::string("positive") - + std::string("[") - + parser_name(p.subject()) - + std::string("]"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from parser.hpp - template <typename DerivedT> - inline std::string - parser_name(parser<DerivedT> const& p) - { - return std::string("parser"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from primitives.hpp - template <typename DerivedT> - inline std::string - parser_name(char_parser<DerivedT> const &p) - { - return std::string("char_parser"); - } - - template <typename CharT> - inline std::string - parser_name(chlit<CharT> const &p) - { - return std::string("chlit(\'") - + std::string(1, p.ch) - + std::string("\')"); - } - - template <typename CharT> - inline std::string - parser_name(range<CharT> const &p) - { - return std::string("range(") - + std::string(1, p.first) + std::string(", ") + std::string(1, p.last) - + std::string(")"); - } - - template <typename IteratorT> - inline std::string - parser_name(chseq<IteratorT> const &p) - { - return std::string("chseq(\"") - + std::string(p.first, p.last) - + std::string("\")"); - } - - template <typename IteratorT> - inline std::string - parser_name(strlit<IteratorT> const &p) - { - return std::string("strlit(\"") - + std::string(p.seq.first, p.seq.last) - + std::string("\")"); - } - - inline std::string - parser_name(nothing_parser const&) - { - return std::string("nothing"); - } - - inline std::string - parser_name(epsilon_parser const&) - { - return std::string("epsilon"); - } - - inline std::string - parser_name(anychar_parser const&) - { - return std::string("anychar"); - } - - inline std::string - parser_name(alnum_parser const&) - { - return std::string("alnum"); - } - - inline std::string - parser_name(alpha_parser const&) - { - return std::string("alpha"); - } - - inline std::string - parser_name(cntrl_parser const&) - { - return std::string("cntrl"); - } - - inline std::string - parser_name(digit_parser const&) - { - return std::string("digit"); - } - - inline std::string - parser_name(graph_parser const&) - { - return std::string("graph"); - } - - inline std::string - parser_name(lower_parser const&) - { - return std::string("lower"); - } - - inline std::string - parser_name(print_parser const&) - { - return std::string("print"); - } - - inline std::string - parser_name(punct_parser const&) - { - return std::string("punct"); - } - - inline std::string - parser_name(blank_parser const&) - { - return std::string("blank"); - } - - inline std::string - parser_name(space_parser const&) - { - return std::string("space"); - } - - inline std::string - parser_name(upper_parser const&) - { - return std::string("upper"); - } - - inline std::string - parser_name(xdigit_parser const&) - { - return std::string("xdigit"); - } - - inline std::string - parser_name(eol_parser const&) - { - return std::string("eol"); - } - - inline std::string - parser_name(end_parser const&) - { - return std::string("end"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from rule.hpp - namespace impl { - struct node_registry - { - typedef std::pair<std::string, bool> rule_info; - typedef std::map<void const *, rule_info> rule_infos; - - std::string find_node(void const *r) - { - rule_infos::const_iterator cit = infos.find(r); - if (cit != infos.end()) - return (*cit).second.first; - return std::string("<unknown>"); - } - - bool trace_node(void const *r) - { - rule_infos::const_iterator cit = infos.find(r); - if (cit != infos.end()) - return (*cit).second.second; - return BOOST_SPIRIT_DEBUG_TRACENODE; - } - - bool register_node(void const *r, char const *name_to_register, - bool trace_node) - { - if (infos.find(r) != infos.end()) - return false; - - return infos.insert(rule_infos::value_type(r, - rule_info(std::string(name_to_register), trace_node)) - ).second; - } - - bool unregister_node(void const *r) - { - if (infos.find(r) == infos.end()) - return false; - return (1 == infos.erase(r)); - } - - private: - rule_infos infos; - }; - - inline node_registry & - get_node_registry() - { - static node_registry node_infos; - return node_infos; - } - } // namespace impl - - template< - typename DerivedT, typename EmbedT, - typename T0, typename T1, typename T2 - > - inline std::string - parser_name(impl::rule_base<DerivedT, EmbedT, T0, T1, T2> const& p) - { - return std::string("rule_base") - + std::string("(") - + impl::get_node_registry().find_node(&p) - + std::string(")"); - } - - template<typename T0, typename T1, typename T2> - inline std::string - parser_name(rule<T0, T1, T2> const& p) - { - return std::string("rule") - + std::string("(") - + impl::get_node_registry().find_node(&p) - + std::string(")"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from subrule.hpp - template <typename FirstT, typename RestT> - inline std::string - parser_name(subrule_list<FirstT, RestT> const &p) - { - return std::string("subrule_list") - + std::string("(") - + impl::get_node_registry().find_node(&p) - + std::string(")"); - } - - template <int ID, typename DefT, typename ContextT> - inline std::string - parser_name(subrule_parser<ID, DefT, ContextT> const &p) - { - return std::string("subrule_parser") - + std::string("(") - + impl::get_node_registry().find_node(&p) - + std::string(")"); - } - - template <int ID, typename ContextT> - inline std::string - parser_name(subrule<ID, ContextT> const &p) - { - BOOST_SPIRIT_SSTREAM stream; - stream << ID; - return std::string("subrule<") - + BOOST_SPIRIT_GETSTRING(stream) - + std::string(">(") - + impl::get_node_registry().find_node(&p) - + std::string(")"); - } - -/////////////////////////////////////////////////////////////////////////////// -// from grammar.hpp - template <typename DerivedT, typename ContextT> - inline std::string - parser_name(grammar<DerivedT, ContextT> const& p) - { - return std::string("grammar") - + std::string("(") - + impl::get_node_registry().find_node(&p) - + std::string(")"); - } - -/////////////////////////////////////////////////////////////////////////////// -// decide, if a node is to be traced or not - template< - typename DerivedT, typename EmbedT, - typename T0, typename T1, typename T2 - > - inline bool - trace_parser(impl::rule_base<DerivedT, EmbedT, T0, T1, T2> - const& p) - { - return impl::get_node_registry().trace_node(&p); - } - - template<typename T0, typename T1, typename T2> - inline bool - trace_parser(rule<T0, T1, T2> const& p) - { - return impl::get_node_registry().trace_node(&p); - } - - template <typename DerivedT, typename ContextT> - inline bool - trace_parser(grammar<DerivedT, ContextT> const& p) - { - return impl::get_node_registry().trace_node(&p); - } - - template <typename DerivedT, int N, typename ContextT> - inline bool - trace_parser(impl::entry_grammar<DerivedT, N, ContextT> const& p) - { - return impl::get_node_registry().trace_node(&p); - } - - template <int ID, typename ContextT> - bool - trace_parser(subrule<ID, ContextT> const& p) - { - return impl::get_node_registry().trace_node(&p); - } - - template <typename ParserT, typename ActorTupleT> - bool - trace_parser(init_closure_parser<ParserT, ActorTupleT> const& p) - { - return impl::get_node_registry().trace_node(&p); - } - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#undef BOOST_SPIRIT_SSTREAM -#undef BOOST_SPIRIT_GETSTRING - -#endif // defined(BOOST_SPIRIT_DEBUG) - -#endif // !defined(BOOST_SPIRIT_PARSER_NAMES_IPP) diff --git a/Utilities/BGL/boost/spirit/debug/minimal.hpp b/Utilities/BGL/boost/spirit/debug/minimal.hpp deleted file mode 100644 index 47b6c781ebd1ea0fa75290df4569a1717f8acd0d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/debug/minimal.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_MINIMAL_DEBUG_HPP) -#define BOOST_SPIRIT_MINIMAL_DEBUG_HPP - -#if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP) -#error "You must include boost/spirit/debug.hpp, not boost/spirit/debug/minimal.hpp" -#endif -/////////////////////////////////////////////////////////////////////////////// -// -// Minimum debugging tools support -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_DEBUG_OUT) -#define BOOST_SPIRIT_DEBUG_OUT std::cout -#endif - -/////////////////////////////////////////////////////////////////////////// -// -// BOOST_SPIRIT_DEBUG_FLAGS controls the level of diagnostics printed -// -/////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_DEBUG_FLAGS_NONE) -#define BOOST_SPIRIT_DEBUG_FLAGS_NONE 0x0000 // no diagnostics at all -#endif - -#if !defined(BOOST_SPIRIT_DEBUG_FLAGS_MAX) -#define BOOST_SPIRIT_DEBUG_FLAGS_MAX 0xFFFF // print maximal diagnostics -#endif - -#if !defined(BOOST_SPIRIT_DEBUG_FLAGS) -#define BOOST_SPIRIT_DEBUG_FLAGS SPIRIT_DEBUG_FLAGS_MAX -#endif - -#if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME) -#define BOOST_SPIRIT_DEBUG_PRINT_SOME 20 -#endif - -#if !defined(BOOST_SPIRIT_DEBUG_RULE) -#define BOOST_SPIRIT_DEBUG_RULE(r) -#endif // !defined(BOOST_SPIRIT_DEBUG_RULE) - -#if !defined(BOOST_SPIRIT_DEBUG_NODE) -#define BOOST_SPIRIT_DEBUG_NODE(r) -#endif // !defined(BOOST_SPIRIT_DEBUG_NODE) - -#if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) -#define BOOST_SPIRIT_DEBUG_GRAMMAR(r) -#endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR) - -#if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE) -#define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t) -#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE) - -#if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) -#define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t) -#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE) - -#if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) -#define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t) -#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR) - -#if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) -#define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t) -#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME) - -#if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) -#define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t) -#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME) - -#if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) -#define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t) -#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME) - -#endif // !defined(BOOST_SPIRIT_MINIMAL_DEBUG_HPP) diff --git a/Utilities/BGL/boost/spirit/debug/parser_names.hpp b/Utilities/BGL/boost/spirit/debug/parser_names.hpp deleted file mode 100644 index c2bf3bd11f069aa08301f9a28d0c8791a8f0ec4f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/debug/parser_names.hpp +++ /dev/null @@ -1,250 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_NAMES_HPP) -#define BOOST_SPIRIT_PARSER_NAMES_HPP - -#if defined(BOOST_SPIRIT_DEBUG) - -////////////////////////////////// -#include <boost/spirit/core.hpp> - -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// Declaration of helper functions, which return the name of a concrete -// parser instance. The functions are specialized on the parser types. The -// functions declared in this file are for the predefined parser types from -// the Spirit core library only, so additional functions might be provided as -// needed. -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// from actions.hpp - template <typename ParserT, typename ActionT> - std::string - parser_name(action<ParserT, ActionT> const& p); - -/////////////////////////////////////////////////////////////////////////////// -// from directives.hpp - template <typename ParserT> - std::string - parser_name(contiguous<ParserT> const& p); - - template <typename ParserT> - std::string - parser_name(inhibit_case<ParserT> const& p); - - template <typename A, typename B> - std::string - parser_name(longest_alternative<A, B> const& p); - - template <typename A, typename B> - std::string - parser_name(shortest_alternative<A, B> const& p); - -/////////////////////////////////////////////////////////////////////////////// -// from grammar.hpp - template <typename DerivedT, typename ContextT> - std::string - parser_name(grammar<DerivedT, ContextT> const& p); - -/////////////////////////////////////////////////////////////////////////////// -// from numerics.hpp - template <typename T, int Radix, unsigned MinDigits, int MaxDigits> - std::string - parser_name(uint_parser<T, Radix, MinDigits, MaxDigits> const& p); - - template <typename T, int Radix, unsigned MinDigits, int MaxDigits> - std::string - parser_name(int_parser<T, Radix, MinDigits, MaxDigits> const& p); - - template <typename T, typename RealPoliciesT> - std::string - parser_name(real_parser<T, RealPoliciesT> const& p); - -/////////////////////////////////////////////////////////////////////////////// -// from operators.hpp - template <typename A, typename B> - std::string - parser_name(sequence<A, B> const& p); - - template <typename A, typename B> - std::string - parser_name(sequential_or<A, B> const& p); - - template <typename A, typename B> - std::string - parser_name(alternative<A, B> const& p); - - template <typename A, typename B> - std::string - parser_name(intersection<A, B> const& p); - - template <typename A, typename B> - std::string - parser_name(difference<A, B> const& p); - - template <typename A, typename B> - std::string - parser_name(exclusive_or<A, B> const& p); - - template <typename S> - std::string - parser_name(optional<S> const& p); - - template <typename S> - std::string - parser_name(kleene_star<S> const& p); - - template <typename S> - std::string - parser_name(positive<S> const& p); - -/////////////////////////////////////////////////////////////////////////////// -// from parser.hpp - template <typename DerivedT> - std::string - parser_name(parser<DerivedT> const& p); - -/////////////////////////////////////////////////////////////////////////////// -// from primitives.hpp - template <typename DerivedT> - std::string - parser_name(char_parser<DerivedT> const &p); - - template <typename CharT> - std::string - parser_name(chlit<CharT> const &p); - - template <typename CharT> - std::string - parser_name(range<CharT> const &p); - - template <typename IteratorT> - std::string - parser_name(chseq<IteratorT> const &p); - - template <typename IteratorT> - std::string - parser_name(strlit<IteratorT> const &p); - - std::string - parser_name(nothing_parser const &p); - - std::string - parser_name(epsilon_parser const &p); - - std::string - parser_name(anychar_parser const &p); - - std::string - parser_name(alnum_parser const &p); - - std::string - parser_name(alpha_parser const &p); - - std::string - parser_name(cntrl_parser const &p); - - std::string - parser_name(digit_parser const &p); - - std::string - parser_name(graph_parser const &p); - - std::string - parser_name(lower_parser const &p); - - std::string - parser_name(print_parser const &p); - - std::string - parser_name(punct_parser const &p); - - std::string - parser_name(blank_parser const &p); - - std::string - parser_name(space_parser const &p); - - std::string - parser_name(upper_parser const &p); - - std::string - parser_name(xdigit_parser const &p); - - std::string - parser_name(eol_parser const &p); - - std::string - parser_name(end_parser const &p); - -/////////////////////////////////////////////////////////////////////////////// -// from rule.hpp - template<typename T0, typename T1, typename T2> - std::string - parser_name(rule<T0, T1, T2> const& p); - -/////////////////////////////////////////////////////////////////////////////// -// from subrule.hpp - template <typename FirstT, typename RestT> - std::string - parser_name(subrule_list<FirstT, RestT> const &p); - - template <int ID, typename DefT, typename ContextT> - std::string - parser_name(subrule_parser<ID, DefT, ContextT> const &p); - - template <int ID, typename ContextT> - std::string - parser_name(subrule<ID, ContextT> const &p); - -/////////////////////////////////////////////////////////////////////////////// -// from chset.hpp - -/////////////////////////////////////////////////////////////////////////////// -// -// Decide, if a node is to be traced or not -// -/////////////////////////////////////////////////////////////////////////////// - template< - typename DerivedT, typename EmbedT, - typename T0, typename T1, typename T2 - > - bool - trace_parser(impl::rule_base<DerivedT, EmbedT, T0, T1, T2> - const& p); - - template <typename DerivedT, typename ContextT> - bool - trace_parser(grammar<DerivedT, ContextT> const& p); - - template <int ID, typename ContextT> - bool - trace_parser(subrule<ID, ContextT> const& p); - - template <typename ParserT, typename ActorTupleT> - struct init_closure_parser; - - template <typename ParserT, typename ActorTupleT> - bool - trace_parser(init_closure_parser<ParserT, ActorTupleT> const& p); - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -////////////////////////////////// -#include <boost/spirit/debug/impl/parser_names.ipp> - -#endif // defined(BOOST_SPIRIT_DEBUG) - -#endif // !defined(BOOST_SPIRIT_PARSER_NAMES_HPP) diff --git a/Utilities/BGL/boost/spirit/dynamic.hpp b/Utilities/BGL/boost/spirit/dynamic.hpp deleted file mode 100644 index cf0d024c1c4ae10b77f5b056083b43dc992792a1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002 Juan Carlos Arevalo-Baeza - Copyright (c) 2002-2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_DYNAMIC_HPP -#define BOOST_SPIRIT_DYNAMIC_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Master header for Spirit.Dynamic -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/dynamic/if.hpp> -#include <boost/spirit/dynamic/for.hpp> -#include <boost/spirit/dynamic/while.hpp> -#include <boost/spirit/dynamic/lazy.hpp> -#include <boost/spirit/dynamic/stored_rule.hpp> -#include <boost/spirit/dynamic/rule_alias.hpp> - -//////////////////////////////////////////////////////////////////////////////// -#endif // BOOST_SPIRIT_DYNAMIC_HPP diff --git a/Utilities/BGL/boost/spirit/dynamic/for.hpp b/Utilities/BGL/boost/spirit/dynamic/for.hpp deleted file mode 100644 index 3f1e9c4ce09c5e58b0ba9d19a2a843f8ea425b05..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/for.hpp +++ /dev/null @@ -1,183 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_FOR_HPP -#define BOOST_SPIRIT_FOR_HPP -//////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/dynamic/impl/conditions.ipp> - -//////////////////////////////////////////////////////////////////////////////// - -namespace boost { namespace spirit -{ - namespace impl - { - - template <typename FuncT> - struct for_functor - { - typedef typename boost::call_traits<FuncT>::param_type param_t; - - for_functor(param_t f) : func(f) {} - for_functor() {} - FuncT func; - }; - - template <typename InitF> - struct for_init_functor : for_functor<InitF> - { - typedef for_functor<InitF> base_t; - typedef typename base_t::param_t param_t; - - for_init_functor(param_t f) : base_t(f) {} - for_init_functor() : base_t() {} - void init() const { /*return*/ this->func(); } - }; - - template <typename StepF> - struct for_step_functor : for_functor<StepF> - { - typedef for_functor<StepF> base_t; - typedef typename base_t::param_t param_t; - - for_step_functor(param_t f) : base_t(f) {} - for_step_functor() : base_t() {} - void step() const { /*return*/ this->func(); } - }; - - ////////////////////////////////// - // for_parser - template - < - typename InitF, typename CondT, typename StepF, - typename ParsableT - > - struct for_parser - : private for_init_functor<InitF> - , private for_step_functor<StepF> - , private condition_evaluator<typename as_parser<CondT>::type> - , public unary - < - typename as_parser<ParsableT>::type, - parser< for_parser<InitF, CondT, StepF, ParsableT> > - > - { - typedef for_parser<InitF, CondT, StepF, ParsableT> self_t; - typedef as_parser<CondT> cond_as_parser_t; - typedef typename cond_as_parser_t::type condition_t; - typedef condition_evaluator<condition_t> eval_t; - typedef as_parser<ParsableT> as_parser_t; - typedef typename as_parser_t::type parser_t; - typedef unary< parser_t, parser< self_t > > base_t; - - - ////////////////////////////// - // constructor, saves init, condition and step functors - // for later use the parse member function - for_parser - ( - InitF const &i, CondT const &c, StepF const &s, - ParsableT const &p - ) - : for_init_functor<InitF>(i) - , for_step_functor<StepF>(s) - , eval_t(cond_as_parser_t::convert(c)) - , base_t(as_parser_t::convert(p)) - { } - - for_parser() - : for_init_functor<InitF>() - , for_step_functor<StepF>() - , eval_t() - , base_t() - {} - - ////////////////////////////// - // parse member function - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const &scan) const - { - typedef typename parser_result<self_t, ScannerT>::type - result_t; - typedef typename parser_result<parser_t, ScannerT>::type - body_result_t; - - typename ScannerT::iterator_t save(scan.first); - - std::size_t length = 0; - int eval_length = 0; - - this->init(); - while ((eval_length = this->evaluate(scan))>=0) - { - length += eval_length; - body_result_t tmp(this->subject().parse(scan)); - if (tmp) - { - length+=tmp.length(); - } - else - { - return scan.no_match(); - } - this->step(); - } - - boost::spirit::nil_t attr; - return scan.create_match - (length, attr, save, scan.first); - } - }; - - ////////////////////////////////// - // for_parser_gen generates takes the body parser in brackets - // and returns the for_parser - template <typename InitF, typename CondT, typename StepF> - struct for_parser_gen - { - for_parser_gen(InitF const &i, CondT const &c, StepF const &s) - : init(i) - , condition(c) - , step(s) - {} - - template <typename ParsableT> - for_parser<InitF, CondT, StepF, ParsableT> - operator[](ParsableT const &p) const - { - return for_parser<InitF, CondT, StepF, ParsableT> - (init, condition, step, p); - } - - InitF const &init; - CondT const &condition; - StepF const &step; - }; - } // namespace impl - - ////////////////////////////// - // for_p, returns for-parser generator - // Usage: spirit::for_p(init-ftor, condition, step-ftor)[body] - template - < - typename InitF, typename ConditionT, typename StepF - > - impl::for_parser_gen<InitF, ConditionT, StepF> - for_p(InitF const &init_f, ConditionT const &condition, StepF const &step_f) - { - return impl::for_parser_gen<InitF, ConditionT, StepF> - (init_f, condition, step_f); - } - -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_FOR_HPP diff --git a/Utilities/BGL/boost/spirit/dynamic/if.hpp b/Utilities/BGL/boost/spirit/dynamic/if.hpp deleted file mode 100644 index 81cc4c1b164e2523e782eda1705b84ac8099634a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/if.hpp +++ /dev/null @@ -1,225 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002 Juan Carlos Arevalo-Baeza - Copyright (c) 2002-2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_IF_HPP -#define BOOST_SPIRIT_IF_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/dynamic/impl/conditions.ipp> - -namespace boost { namespace spirit { - - namespace impl { - - ////////////////////////////////// - // if-else-parser, holds two alternative parsers and a conditional functor - // that selects between them. - template <typename ParsableTrueT, typename ParsableFalseT, typename CondT> - struct if_else_parser - : public condition_evaluator<typename as_parser<CondT>::type> - , public binary - < - typename as_parser<ParsableTrueT>::type, - typename as_parser<ParsableFalseT>::type, - parser< if_else_parser<ParsableTrueT, ParsableFalseT, CondT> > - > - { - typedef if_else_parser<ParsableTrueT, ParsableFalseT, CondT> self_t; - - typedef as_parser<ParsableTrueT> as_parser_true_t; - typedef as_parser<ParsableFalseT> as_parser_false_t; - typedef typename as_parser_true_t::type parser_true_t; - typedef typename as_parser_false_t::type parser_false_t; - typedef as_parser<CondT> cond_as_parser_t; - typedef typename cond_as_parser_t::type condition_t; - - typedef binary<parser_true_t, parser_false_t, parser<self_t> > base_t; - typedef condition_evaluator<condition_t> eval_t; - - if_else_parser - ( - ParsableTrueT const& p_true, - ParsableFalseT const& p_false, - CondT const& cond_ - ) - : eval_t(cond_as_parser_t::convert(cond_)) - , base_t - ( - as_parser_true_t::convert(p_true), - as_parser_false_t::convert(p_false) - ) - { } - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result - <parser_true_t, ScannerT>::type then_result_t; - typedef typename parser_result - <parser_false_t, ScannerT>::type else_result_t; - - typename ScannerT::iterator_t const save(scan.first); - - std::ptrdiff_t length = this->evaluate(scan); - if (length >= 0) - { - then_result_t then_result(this->left().parse(scan)); - if (then_result) - { - length += then_result.length(); - return scan.create_match(std::size_t(length), nil_t(), save, scan.first); - } - } - else - { - else_result_t else_result(this->right().parse(scan)); - if (else_result) - { - length = else_result.length(); - return scan.create_match(std::size_t(length), nil_t(), save, scan.first); - } - } - return scan.no_match(); - } - }; - - ////////////////////////////////// - // if-else-parser generator, takes the false-parser in brackets - // and returns the if-else-parser. - template <typename ParsableTrueT, typename CondT> - struct if_else_parser_gen - { - if_else_parser_gen(ParsableTrueT const& p_true_, CondT const& cond_) - : p_true(p_true_) - , cond(cond_) {} - - template <typename ParsableFalseT> - if_else_parser - < - ParsableTrueT, - ParsableFalseT, - CondT - > - operator[](ParsableFalseT const& p_false) const - { - return if_else_parser<ParsableTrueT, ParsableFalseT, CondT> - ( - p_true, - p_false, - cond - ); - } - - ParsableTrueT const &p_true; - CondT const &cond; - }; - - ////////////////////////////////// - // if-parser, conditionally runs a parser is a functor condition is true. - // If the condition is fales, it fails the parse. - // It can optionally become an if-else-parser through the member else_p. - template <typename ParsableT, typename CondT> - struct if_parser - : public condition_evaluator<typename as_parser<CondT>::type> - , public unary - < - typename as_parser<ParsableT>::type, - parser<if_parser<ParsableT, CondT> > > - { - typedef if_parser<ParsableT, CondT> self_t; - typedef as_parser<ParsableT> as_parser_t; - typedef typename as_parser_t::type parser_t; - - typedef as_parser<CondT> cond_as_parser_t; - typedef typename cond_as_parser_t::type condition_t; - typedef condition_evaluator<condition_t> eval_t; - typedef unary<parser_t, parser<self_t> > base_t; - - if_parser(ParsableT const& p, CondT const& cond_) - : eval_t(cond_as_parser_t::convert(cond_)) - , base_t(as_parser_t::convert(p)) - , else_p(p, cond_) - {} - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<parser_t, ScannerT>::type t_result_t; - typename ScannerT::iterator_t const save(scan.first); - - std::ptrdiff_t length = this->evaluate(scan); - if (length >= 0) - { - t_result_t then_result(this->subject().parse(scan)); - if (then_result) - { - length += then_result.length(); - return scan.create_match(std::size_t(length), nil_t(), save, scan.first); - } - return scan.no_match(); - } - return scan.empty_match(); - } - - if_else_parser_gen<ParsableT, CondT> else_p; - }; - - ////////////////////////////////// - // if-parser generator, takes the true-parser in brackets and returns the - // if-parser. - template <typename CondT> - struct if_parser_gen - { - if_parser_gen(CondT const& cond_) : cond(cond_) {} - - template <typename ParsableT> - if_parser - < - ParsableT, - CondT - > - operator[](ParsableT const& subject) const - { - return if_parser<ParsableT, CondT>(subject, cond); - } - - CondT const &cond; - }; - -} // namespace impl - -////////////////////////////////// -// if_p function, returns "if" parser generator - -template <typename CondT> -impl::if_parser_gen<CondT> -if_p(CondT const& cond) -{ - return impl::if_parser_gen<CondT>(cond); -} - -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_IF_HPP diff --git a/Utilities/BGL/boost/spirit/dynamic/impl/conditions.ipp b/Utilities/BGL/boost/spirit/dynamic/impl/conditions.ipp deleted file mode 100644 index a2fd03272882bb182b79fabe093161054ac360f2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/impl/conditions.ipp +++ /dev/null @@ -1,100 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_CONDITIONS_IPP -#define BOOST_SPIRIT_CONDITIONS_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/meta/parser_traits.hpp> -#include <boost/spirit/core/composite/epsilon.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - namespace impl { - -/////////////////////////////////////////////////////////////////////////////// -// -// condition evaluation -// -/////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////// - // condition_parser_selector, decides which parser to use for a condition - // If the template argument is a parser then that parser is used. - // If the template argument is a functor then a condition parser using - // the functor is chosen - - template <typename T> struct embed_t_accessor - { - typedef typename T::embed_t type; - }; - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - template <> struct embed_t_accessor<int> - { - typedef int type; - }; -#endif - - template <typename ConditionT> - struct condition_parser_selector - { - typedef - typename mpl::if_< - is_parser<ConditionT>, - ConditionT, - condition_parser<ConditionT> - >::type - type; - - typedef typename embed_t_accessor<type>::type embed_t; - }; - - ////////////////////////////////// - // condition_evaluator, uses a parser to check wether a condition is met - // takes a parser or a functor that can be evaluated in boolean context - // as template parameter. - - // JDG 4-15-03 refactored - template <typename ConditionT> - struct condition_evaluator - { - typedef condition_parser_selector<ConditionT> selector_t; - typedef typename selector_t::type selected_t; - typedef typename selector_t::embed_t cond_embed_t; - - typedef typename boost::call_traits<cond_embed_t>::param_type - param_t; - - condition_evaluator(param_t s) : cond(s) {} - - ///////////////////////////// - // evaluate, checks wether condition is met - // returns length of a match or a negative number for no-match - template <typename ScannerT> - std::ptrdiff_t - evaluate(ScannerT const &scan) const - { - typedef typename ScannerT::iterator_t iterator_t; - typedef typename parser_result<selected_t, ScannerT>::type cres_t; - iterator_t save(scan.first); - cres_t result = cond.parse(scan); - if (!result) // reset the position if evaluation - scan.first = save; // fails. - return result.length(); - } - - cond_embed_t cond; - }; - -/////////////////////////////////////////////////////////////////////////////// - } // namespace impl - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/dynamic/impl/select.ipp b/Utilities/BGL/boost/spirit/dynamic/impl/select.ipp deleted file mode 100644 index 80cc9c30c4e360d0b5bef5122281f260f845f015..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/impl/select.ipp +++ /dev/null @@ -1,115 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_SELECT_IPP -#define BOOST_SPIRIT_SELECT_IPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - -/////////////////////////////////////////////////////////////////////////////// -template <typename ParserT> -struct as_embedded_parser : public as_parser<ParserT> -{ - typedef typename as_parser<ParserT>::type::derived_t::embed_t type; -}; - -/////////////////////////////////////////////////////////////////////////////// - -// no implementation here to catch unknown BehaviourT template arguments -template <typename ResultT, typename BehaviourT> -struct select_match_gen; - -// implementation for the select_default_no_fail behaviour -template <typename ResultT> -struct select_match_gen<ResultT, select_default_no_fail> { - - template <typename ScannerT> - static ResultT - do_ (ScannerT const &scan) - { - return scan.create_match(0, -1, scan.first, scan.first); - } -}; - -// implementation for the select_default_fail behaviour -template <typename ResultT> -struct select_match_gen<ResultT, select_default_fail> { - - template <typename ScannerT> - static ResultT - do_ (ScannerT const &scan) - { - return scan.no_match(); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -template <int N, typename ResultT, typename TupleT, typename BehaviourT> -struct parse_tuple_element { - - BOOST_STATIC_CONSTANT(int, index = (TupleT::length - N)); - - template <typename ScannerT> - static ResultT - do_(TupleT const &t, ScannerT const &scan) - { - typedef typename phoenix::tuple_element<index, TupleT>::type parser_t; - typedef typename ScannerT::iterator_t iterator_t; - typedef typename parser_result<parser_t, ScannerT>::type result_t; - - iterator_t save(scan.first); - result_t result(t[phoenix::tuple_index<index>()].parse(scan)); - - if (result) { - return scan.create_match(result.length(), TupleT::length - N, - save, scan.first); - } - scan.first = save; // reset the input stream - return parse_tuple_element<N-1, ResultT, TupleT, BehaviourT>:: - do_(t, scan); - } -}; - -template <typename ResultT, typename TupleT, typename BehaviourT> -struct parse_tuple_element<1, ResultT, TupleT, BehaviourT> { - - BOOST_STATIC_CONSTANT(int, index = (TupleT::length - 1)); - - template <typename ScannerT> - static ResultT - do_(TupleT const &t, ScannerT const &scan) - { - typedef typename phoenix::tuple_element<index, TupleT>::type parser_t; - typedef typename ScannerT::iterator_t iterator_t; - typedef typename parser_result<parser_t, ScannerT>::type result_t; - - iterator_t save(scan.first); - result_t result(t[phoenix::tuple_index<index>()].parse(scan)); - - if (result) { - return scan.create_match(result.length(), TupleT::length - 1, - save, scan.first); - } - scan.first = save; // reset the input stream - return select_match_gen<ResultT, BehaviourT>::do_(scan); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -} // namespace impl -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_SELECT_IPP diff --git a/Utilities/BGL/boost/spirit/dynamic/impl/switch.ipp b/Utilities/BGL/boost/spirit/dynamic/impl/switch.ipp deleted file mode 100644 index 59777296099ada5a768ff0a7a5e47eaf90f4d9d1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/impl/switch.ipp +++ /dev/null @@ -1,569 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_SWITCH_IPP -#define BOOST_SPIRIT_SWITCH_IPP - -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/static_assert.hpp> - -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/inc.hpp> -#include <boost/preprocessor/repeat.hpp> -#include <boost/preprocessor/repeat_from_to.hpp> - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/primitives/primitives.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/as_parser.hpp> - -#include <boost/spirit/phoenix/actor.hpp> -#include <boost/spirit/phoenix/tuples.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -// forward declaration -template <int N, typename ParserT, bool IsDefault> struct case_parser; - -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - -/////////////////////////////////////////////////////////////////////////////// -// parse helper functions -template <typename ParserT, typename ScannerT> -inline typename parser_result<ParserT, ScannerT>::type -delegate_parse(ParserT const &p, ScannerT const &scan, - typename ScannerT::iterator_t const save) -{ - typedef typename parser_result<ParserT, ScannerT>::type result_t; - - result_t result (p.subject().parse(scan)); - if (!result) - scan.first = save; - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -// General default case handling (no default_p case branch given). -// First try to match the current parser node (if the condition value is -// matched) and, if that fails, return a no_match -template <int N, bool IsDefault, bool HasDefault> -struct default_delegate_parse { - - template < - typename ParserT, typename DefaultT, - typename ValueT, typename ScannerT - > - static typename parser_result<ParserT, ScannerT>::type - parse (ValueT const &value, ParserT const &p, DefaultT const &, - ScannerT const &scan, typename ScannerT::iterator_t const save) - { - if (value == N) - return delegate_parse(p, scan, save); - return scan.no_match(); - } -}; - -// The current case parser node is the default parser. -// Ignore the given case value and try to match the given default parser. -template <int N, bool HasDefault> -struct default_delegate_parse<N, true, HasDefault> { - - template < - typename ParserT, typename DefaultT, - typename ValueT, typename ScannerT - > - static typename parser_result<ParserT, ScannerT>::type - parse (ValueT const& /*value*/, ParserT const &, DefaultT const &d, - ScannerT const &scan, typename ScannerT::iterator_t const save) - { - // Since there is a default_p case branch defined, the corresponding - // parser shouldn't be the nothing_parser - BOOST_STATIC_ASSERT((!boost::is_same<DefaultT, nothing_parser>::value)); - return delegate_parse(d, scan, save); - } -}; - -// The current case parser node is not the default parser, but there is a -// default_p branch given inside the switch_p parser. -// First try to match the current parser node (if the condition value is -// matched) and, if that fails, match the given default_p parser. -template <int N> -struct default_delegate_parse<N, false, true> { - - template < - typename ParserT, typename DefaultT, - typename ValueT, typename ScannerT - > - static typename parser_result<ParserT, ScannerT>::type - parse (ValueT const &value, ParserT const &p, DefaultT const &d, - ScannerT const &scan, typename ScannerT::iterator_t const save) - { - // Since there is a default_p case branch defined, the corresponding - // parser shouldn't be the nothing_parser - BOOST_STATIC_ASSERT((!boost::is_same<DefaultT, nothing_parser>::value)); - if (value == N) - return delegate_parse(p, scan, save); - - return delegate_parse(d, scan, save); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// Look through the case parser chain to test, if there is a default case -// branch defined (returned by 'value'). -template <typename CaseT, bool IsSimple = CaseT::is_simple> -struct default_case; - -//////////////////////////////////////// -template <typename ResultT, bool IsDefault> -struct get_default_parser { - - template <typename ParserT> - static ResultT - get(parser<ParserT> const &p) - { - return default_case<typename ParserT::derived_t::left_t>:: - get(p.derived().left()); - } -}; - -template <typename ResultT> -struct get_default_parser<ResultT, true> { - - template <typename ParserT> - static ResultT - get(parser<ParserT> const &p) { return p.derived().right(); } -}; - -//////////////////////////////////////// -template <typename CaseT, bool IsSimple> -struct default_case { - - // The 'value' constant is true, if the current case_parser or one of its - // left siblings is a default_p generated case_parser. - BOOST_STATIC_CONSTANT(bool, value = - (CaseT::is_default || default_case<typename CaseT::left_t>::value)); - - // The 'is_epsilon' constant is true, if the current case_parser or one of - // its left siblings is a default_p generated parser with an attached - // epsilon_p (this is generated by the plain default_p). - BOOST_STATIC_CONSTANT(bool, is_epsilon = ( - (CaseT::is_default && CaseT::is_epsilon) || - default_case<typename CaseT::left_t>::is_epsilon - )); - - // The computed 'type' represents the type of the default case branch - // parser (if there is one) or nothing_parser (if there isn't any default - // case branch). - typedef typename boost::mpl::if_c< - CaseT::is_default, typename CaseT::right_embed_t, - typename default_case<typename CaseT::left_t>::type - >::type type; - - // The get function returns the parser attached to the default case branch - // (if there is one) or an instance of a nothing_parser (if there isn't - // any default case branch). - template <typename ParserT> - static type - get(parser<ParserT> const &p) - { return get_default_parser<type, CaseT::is_default>::get(p); } -}; - -//////////////////////////////////////// -template <typename ResultT, bool IsDefault> -struct get_default_parser_simple { - - template <typename ParserT> - static ResultT - get(parser<ParserT> const &p) { return p.derived(); } -}; - -template <typename ResultT> -struct get_default_parser_simple<ResultT, false> { - - template <typename ParserT> - static nothing_parser - get(parser<ParserT> const &) { return nothing_p; } -}; - -//////////////////////////////////////// -// Specialization of the default_case template for the last (leftmost) element -// of the case parser chain. -template <typename CaseT> -struct default_case<CaseT, true> { - - // The 'value' and 'is_epsilon' constant, the 'type' type and the function - // 'get' are described above. - - BOOST_STATIC_CONSTANT(bool, value = CaseT::is_default); - BOOST_STATIC_CONSTANT(bool, is_epsilon = ( - CaseT::is_default && CaseT::is_epsilon - )); - - typedef typename boost::mpl::if_c< - CaseT::is_default, CaseT, nothing_parser - >::type type; - - template <typename ParserT> - static type - get(parser<ParserT> const &p) - { return get_default_parser_simple<type, value>::get(p); } -}; - -/////////////////////////////////////////////////////////////////////////////// -// The case_chain template calculates recursivly the depth of the left -// subchain of the given case branch node. -template <typename CaseT, bool IsSimple = CaseT::is_simple> -struct case_chain { - - BOOST_STATIC_CONSTANT(int, depth = ( - case_chain<typename CaseT::left_t>::depth + 1 - )); -}; - -template <typename CaseT> -struct case_chain<CaseT, true> { - - BOOST_STATIC_CONSTANT(int, depth = 0); -}; - -/////////////////////////////////////////////////////////////////////////////// -// The chain_parser template is used to extract the type and the instance of -// a left or a right parser, burried arbitrary deep inside the case parser -// chain. -template <int Depth, typename CaseT> -struct chain_parser { - - typedef typename CaseT::left_t our_left_t; - - typedef typename chain_parser<Depth-1, our_left_t>::left_t left_t; - typedef typename chain_parser<Depth-1, our_left_t>::right_t right_t; - - static left_t - left(CaseT const &p) - { return chain_parser<Depth-1, our_left_t>::left(p.left()); } - - static right_t - right(CaseT const &p) - { return chain_parser<Depth-1, our_left_t>::right(p.left()); } -}; - -template <typename CaseT> -struct chain_parser<1, CaseT> { - - typedef typename CaseT::left_t left_t; - typedef typename CaseT::right_t right_t; - - static left_t left(CaseT const &p) { return p.left(); } - static right_t right(CaseT const &p) { return p.right(); } -}; - -template <typename CaseT> -struct chain_parser<0, CaseT>; // shouldn't be instantiated - -/////////////////////////////////////////////////////////////////////////////// -// Type computing meta function for calculating the type of the return value -// of the used conditional switch expression -template <typename TargetT, typename ScannerT> -struct condition_result { - - typedef typename TargetT::template result<ScannerT>::type type; -}; - -/////////////////////////////////////////////////////////////////////////////// -template <typename LeftT, typename RightT, bool IsDefault> -struct compound_case_parser -: public binary<LeftT, RightT, - parser<compound_case_parser<LeftT, RightT, IsDefault> > > -{ - typedef compound_case_parser<LeftT, RightT, IsDefault> self_t; - typedef binary_parser_category parser_category_t; - typedef binary<LeftT, RightT, parser<self_t> > base_t; - - BOOST_STATIC_CONSTANT(int, value = RightT::value); - BOOST_STATIC_CONSTANT(bool, is_default = IsDefault); - BOOST_STATIC_CONSTANT(bool, is_simple = false); - BOOST_STATIC_CONSTANT(bool, is_epsilon = ( - is_default && - boost::is_same<typename RightT::subject_t, epsilon_parser>::value - )); - - compound_case_parser(parser<LeftT> const &lhs, parser<RightT> const &rhs) - : base_t(lhs.derived(), rhs.derived()) - {} - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - template <typename ScannerT, typename CondT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan, CondT const &cond) const; - - template <int N1, typename ParserT1, bool IsDefault1> - compound_case_parser< - self_t, case_parser<N1, ParserT1, IsDefault1>, IsDefault1 - > - operator, (case_parser<N1, ParserT1, IsDefault1> const &p) const - { - // If the following compile time assertion fires, you've probably used - // more than one default_p case inside the switch_p parser construct. - BOOST_STATIC_ASSERT(!default_case<self_t>::value || !IsDefault1); - - // If this compile time assertion fires, you've probably want to use - // more case_p/default_p case branches, than possible. - BOOST_STATIC_ASSERT( - case_chain<self_t>::depth < BOOST_SPIRIT_SWITCH_CASE_LIMIT - ); - - typedef case_parser<N1, ParserT1, IsDefault1> right_t; - return compound_case_parser<self_t, right_t, IsDefault1>(*this, p); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// The parse_switch::do_ functions dispatch to the correct parser, which is -// selected through the given conditional switch value. -template <int Value, int Depth, bool IsDefault> -struct parse_switch; - -/////////////////////////////////////////////////////////////////////////////// -// -// The following generates a couple of parse_switch template specializations -// with an increasing number of handled case branches (for 1..N). -// -// template <int Value, bool IsDefault> -// struct parse_switch<Value, N, IsDefault> { -// -// template <typename ParserT, typename ScannerT> -// static typename parser_result<ParserT, ScannerT>::type -// do_(ParserT const &p, ScannerT const &scan, long cond_value, -// typename ScannerT::iterator_t const &save) -// { -// typedef ParserT left_t0; -// typedef typename left_t0::left left_t1; -// ... -// -// switch (cond_value) { -// case left_tN::value: -// return delegate_parse(chain_parser< -// case_chain<ParserT>::depth, ParserT -// >::left(p), scan, save); -// ... -// case left_t1::value: -// return delegate_parse(chain_parser< -// 1, left_t1 -// >::right(p.left()), scan, save); -// -// case left_t0::value: -// default: -// typedef default_case<ParserT> default_t; -// typedef default_delegate_parse< -// Value, IsDefault, default_t::value> -// default_parse_t; -// -// return default_parse_t::parse(cond_value, p.right(), -// default_t::get(p), scan, save); -// } -// } -// }; -// -/////////////////////////////////////////////////////////////////////////////// -#define BOOST_SPIRIT_PARSE_SWITCH_TYPEDEFS(z, N, _) \ - typedef typename BOOST_PP_CAT(left_t, N)::left_t \ - BOOST_PP_CAT(left_t, BOOST_PP_INC(N)); \ - /**/ - -#define BOOST_SPIRIT_PARSE_SWITCH_CASES(z, N, _) \ - case (long)(BOOST_PP_CAT(left_t, N)::value): \ - return delegate_parse(chain_parser<N, left_t1>::right(p.left()), \ - scan, save); \ - /**/ - -#define BOOST_SPIRIT_PARSE_SWITCHES(z, N, _) \ - template <int Value, bool IsDefault> \ - struct parse_switch<Value, BOOST_PP_INC(N), IsDefault> { \ - \ - template <typename ParserT, typename ScannerT> \ - static typename parser_result<ParserT, ScannerT>::type \ - do_(ParserT const &p, ScannerT const &scan, long cond_value, \ - typename ScannerT::iterator_t const &save) \ - { \ - typedef ParserT left_t0; \ - BOOST_PP_REPEAT_FROM_TO_ ## z(0, BOOST_PP_INC(N), \ - BOOST_SPIRIT_PARSE_SWITCH_TYPEDEFS, _) \ - \ - switch (cond_value) { \ - case (long)(BOOST_PP_CAT(left_t, BOOST_PP_INC(N))::value): \ - return delegate_parse( \ - chain_parser< \ - case_chain<ParserT>::depth, ParserT \ - >::left(p), scan, save); \ - \ - BOOST_PP_REPEAT_FROM_TO_ ## z(1, BOOST_PP_INC(N), \ - BOOST_SPIRIT_PARSE_SWITCH_CASES, _) \ - \ - case (long)(left_t0::value): \ - default: \ - typedef default_case<ParserT> default_t; \ - typedef \ - default_delegate_parse<Value, IsDefault, default_t::value> \ - default_parse_t; \ - \ - return default_parse_t::parse(cond_value, p.right(), \ - default_t::get(p), scan, save); \ - } \ - } \ - }; \ - /**/ - -BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_SPIRIT_SWITCH_CASE_LIMIT), - BOOST_SPIRIT_PARSE_SWITCHES, _) - -#undef BOOST_SPIRIT_PARSE_SWITCH_TYPEDEFS -#undef BOOST_SPIRIT_PARSE_SWITCH_CASES -#undef BOOST_SPIRIT_PARSE_SWITCHES -/////////////////////////////////////////////////////////////////////////////// - -template <typename LeftT, typename RightT, bool IsDefault> -template <typename ScannerT, typename CondT> -inline typename parser_result< - compound_case_parser<LeftT, RightT, IsDefault>, ScannerT ->::type -compound_case_parser<LeftT, RightT, IsDefault>:: - parse(ScannerT const& scan, CondT const &cond) const -{ - scan.at_end(); // allow skipper to take effect - return parse_switch<value, case_chain<self_t>::depth, is_default>:: - do_(*this, scan, cond(scan), scan.first); -} - -/////////////////////////////////////////////////////////////////////////////// -// The switch condition is to be evaluated from a parser result value. -template <typename ParserT> -struct cond_functor { - - typedef cond_functor<ParserT> self_t; - - cond_functor(ParserT const &p_) - : p(p_) - {} - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type::attr_t type; - }; - - template <typename ScannerT> - typename condition_result<self_t, ScannerT>::type - operator()(ScannerT const &scan) const - { - typedef typename parser_result<ParserT, ScannerT>::type result_t; - typedef typename result_t::attr_t attr_t; - - result_t result(p.parse(scan)); - return !result ? attr_t() : result.value(); - } - - typename ParserT::embed_t p; -}; - -template <typename ParserT> -struct make_cond_functor { - - typedef as_parser<ParserT> as_parser_t; - - static cond_functor<typename as_parser_t::type> - do_(ParserT const &cond) - { - return cond_functor<typename as_parser_t::type>( - as_parser_t::convert(cond)); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// The switch condition is to be evaluated from a phoenix actor -template <typename ActorT> -struct cond_actor { - - typedef cond_actor<ActorT> self_t; - - cond_actor(ActorT const &actor_) - : actor(actor_) - {} - - template <typename ScannerT> - struct result - { - typedef typename phoenix::actor_result<ActorT, phoenix::tuple<> >::type - type; - }; - - template <typename ScannerT> - typename condition_result<self_t, ScannerT>::type - operator()(ScannerT const& /*scan*/) const - { - return actor(); - } - - ActorT const &actor; -}; - -template <typename ActorT> -struct make_cond_functor<phoenix::actor<ActorT> > { - - static cond_actor<phoenix::actor<ActorT> > - do_(phoenix::actor<ActorT> const &actor) - { - return cond_actor<phoenix::actor<ActorT> >(actor); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// The switch condition is to be taken directly from the input stream -struct get_next_token_cond { - - typedef get_next_token_cond self_t; - - template <typename ScannerT> - struct result - { - typedef typename ScannerT::value_t type; - }; - - template <typename ScannerT> - typename condition_result<self_t, ScannerT>::type - operator()(ScannerT const &scan) const - { - typename ScannerT::value_t val(*scan); - ++scan.first; - return val; - } -}; - -template <> -struct make_cond_functor<get_next_token_cond> { - - static get_next_token_cond - do_(get_next_token_cond const &cond) - { - return cond; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -} // namespace impl -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_SWITCH_IPP diff --git a/Utilities/BGL/boost/spirit/dynamic/lazy.hpp b/Utilities/BGL/boost/spirit/dynamic/lazy.hpp deleted file mode 100644 index e6d64ba61eeb654140e534194a7fa97110f99272..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/lazy.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2003 Vaclav Vesely - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_LAZY_HPP -#define BOOST_SPIRIT_LAZY_HPP - -//////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/phoenix/actor.hpp> - -//////////////////////////////////////////////////////////////////////////////// - -namespace boost { namespace spirit -{ - //////////////////////////////////////////////////////////////////////////// - // - // lazy_parser, holds phoenix actor which returns a spirit parser. - // - //////////////////////////////////////////////////////////////////////////// - - template<class ActorT> - struct lazy_parser : parser<lazy_parser<ActorT> > - { - typedef lazy_parser<ActorT> self_t; - typedef typename phoenix::actor_result< - ActorT, phoenix::tuple<> >::plain_type actor_result_t; - - template<typename ScannerT> - struct result - { - typedef typename - parser_result<actor_result_t, ScannerT>::type - type; - }; - - lazy_parser(ActorT const& actor_) - : actor(actor_) {} - - template<typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { return actor().parse(scan); } - - ActorT actor; - }; - - ////////////////////////////// - // lazy_p, returns lazy_parser - // Usage: lazy_p(actor) - template<class ActorT> - lazy_parser<ActorT> lazy_p(ActorT const& actor) - { return lazy_parser<ActorT>(actor); } - -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_LAZY_HPP diff --git a/Utilities/BGL/boost/spirit/dynamic/rule_alias.hpp b/Utilities/BGL/boost/spirit/dynamic/rule_alias.hpp deleted file mode 100644 index 7a15a1f9e79d1414f4a0727e1cef76019aa532f2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/rule_alias.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_RULE_ALIAS_HPP) -#define BOOST_SPIRIT_RULE_ALIAS_HPP - -#include <boost/spirit/core/parser.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // rule_alias class - // - /////////////////////////////////////////////////////////////////////////// - template <typename ParserT> - class rule_alias : - public parser<rule_alias<ParserT> > - { - public: - - typedef rule_alias<ParserT> self_t; - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - rule_alias() - : ptr(0) {} - - rule_alias(ParserT const& p) - : ptr(&p) {} - - rule_alias& - operator=(ParserT const& p) - { - ptr = &p; - return *this; - } - - template <typename ScannerT> - typename parser_result<ParserT, ScannerT>::type - parse(ScannerT const& scan) const - { - if (ptr) - return ptr->parse(scan); - else - return scan.no_match(); - } - - ParserT const& - get() const - { - assert(ptr != 0); - return *ptr; - } - - private: - - ParserT const* ptr; // hold it by pointer - }; - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/dynamic/select.hpp b/Utilities/BGL/boost/spirit/dynamic/select.hpp deleted file mode 100644 index b54cefafac57ddfa5faf70e4955cef20fe01f81c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/select.hpp +++ /dev/null @@ -1,237 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_SELECT_HPP -#define BOOST_SPIRIT_SELECT_HPP - -#include <boost/preprocessor/repeat.hpp> -#include <boost/preprocessor/enum.hpp> -#include <boost/preprocessor/enum_params.hpp> -#include <boost/preprocessor/enum_params_with_defaults.hpp> -#include <boost/preprocessor/inc.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/facilities/intercept.hpp> - -#include <boost/spirit/core/parser.hpp> - -#include <boost/spirit/phoenix/tuples.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit predefined maximum number of possible embedded select_p parsers. -// It should NOT be greater than PHOENIX_LIMIT! -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_SELECT_LIMIT) -#define BOOST_SPIRIT_SELECT_LIMIT PHOENIX_LIMIT -#endif // !defined(BOOST_SPIRIT_SELECT_LIMIT) - -/////////////////////////////////////////////////////////////////////////////// -// -// ensure BOOST_SPIRIT_SELECT_LIMIT <= PHOENIX_LIMIT and -// BOOST_SPIRIT_SELECT_LIMIT > 0 -// BOOST_SPIRIT_SELECT_LIMIT <= 15 -// -// [Pushed this down a little to make CW happy with BOOST_STATIC_ASSERT] -// [Otherwise, it complains: 'boost_static_assert_test_42' redefined] -// -/////////////////////////////////////////////////////////////////////////////// -BOOST_STATIC_ASSERT(BOOST_SPIRIT_SELECT_LIMIT <= PHOENIX_LIMIT); -BOOST_STATIC_ASSERT(BOOST_SPIRIT_SELECT_LIMIT > 0); -BOOST_STATIC_ASSERT(BOOST_SPIRIT_SELECT_LIMIT <= 15); - -/////////////////////////////////////////////////////////////////////////////// -// -// Calculate the required amount of tuple members rounded up to the nearest -// integer dividable by 3 -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_SPIRIT_SELECT_LIMIT > 12 -#define BOOST_SPIRIT_SELECT_LIMIT_A 15 -#elif BOOST_SPIRIT_SELECT_LIMIT > 9 -#define BOOST_SPIRIT_SELECT_LIMIT_A 12 -#elif BOOST_SPIRIT_SELECT_LIMIT > 6 -#define BOOST_SPIRIT_SELECT_LIMIT_A 9 -#elif BOOST_SPIRIT_SELECT_LIMIT > 3 -#define BOOST_SPIRIT_SELECT_LIMIT_A 6 -#else -#define BOOST_SPIRIT_SELECT_LIMIT_A 3 -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// The select_default_no_fail and select_default_fail structs are used to -// distinguish two different behaviours for the select_parser in case that not -// any of the given sub-parsers match. -// -// If the select_parser is used with the select_default_no_fail behaviour, -// then in case of no matching sub-parser the whole select_parser returns an -// empty match and the value -1. -// -// If the select_parser is used with the select_default_fail behaviour, then -// in case of no matching sub-parser the whole select_parser fails to match at -// all. -// -/////////////////////////////////////////////////////////////////////////////// -struct select_default_no_fail {}; -struct select_default_fail {}; - -}} // namespace boost::spirit - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/dynamic/impl/select.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -template <typename TupleT, typename BehaviourT, typename T> -struct select_parser -: public parser<select_parser<TupleT, BehaviourT, T> > -{ - typedef select_parser<TupleT, BehaviourT, T> self_t; - - select_parser(TupleT const &t_) - : t(t_) - {} - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, T>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - - if (!scan.at_end()) { - return impl::parse_tuple_element< - TupleT::length, result_t, TupleT, BehaviourT>::do_(t, scan); - } - return impl::select_match_gen<result_t, BehaviourT>::do_(scan); - } - - TupleT const t; -}; - -/////////////////////////////////////////////////////////////////////////////// -template <typename BehaviourT, typename T = int> -struct select_parser_gen { - - /////////////////////////////////////////////////////////////////////////// - // - // This generates different select_parser_gen::operator()() functions with - // an increasing number of parser parameters: - // - // template <typename ParserT0, ...> - // select_parser< - // phoenix::tuple< - // typename impl::as_embedded_parser<ParserT0>::type, - // ... - // >, - // BehaviourT, - // T - // > - // operator()(ParserT0 const &p0, ...) const - // { - // typedef impl::as_embedded_parser<ParserT0> parser_t0; - // ... - // - // typedef phoenix::tuple< - // parser_t0::type, - // ... - // > tuple_t; - // typedef select_parser<tuple_t, BehaviourT, T> result_t; - // - // return result_t(tuple_t( - // parser_t0::convert(p0), - // ... - // )); - // } - // - // The number of generated functions depends on the maximum tuple member - // limit defined by the PHOENIX_LIMIT pp constant. - // - /////////////////////////////////////////////////////////////////////////// - #define BOOST_SPIRIT_SELECT_EMBEDDED(z, N, _) \ - typename impl::as_embedded_parser<BOOST_PP_CAT(ParserT, N)>::type \ - /**/ - #define BOOST_SPIRIT_SELECT_EMBEDDED_TYPEDEF(z, N, _) \ - typedef impl::as_embedded_parser<BOOST_PP_CAT(ParserT, N)> \ - BOOST_PP_CAT(parser_t, N); \ - /**/ - #define BOOST_SPIRIT_SELECT_CONVERT(z, N, _) \ - BOOST_PP_CAT(parser_t, N)::convert(BOOST_PP_CAT(p, N)) \ - /**/ - - #define BOOST_SPIRIT_SELECT_PARSER(z, N, _) \ - template < \ - BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(N), typename ParserT) \ - > \ - select_parser< \ - phoenix::tuple< \ - BOOST_PP_ENUM_ ## z(BOOST_PP_INC(N), \ - BOOST_SPIRIT_SELECT_EMBEDDED, _) \ - >, \ - BehaviourT, \ - T \ - > \ - operator()( \ - BOOST_PP_ENUM_BINARY_PARAMS_Z(z, BOOST_PP_INC(N), \ - ParserT, const &p) \ - ) const \ - { \ - BOOST_PP_REPEAT_ ## z(BOOST_PP_INC(N), \ - BOOST_SPIRIT_SELECT_EMBEDDED_TYPEDEF, _) \ - \ - typedef phoenix::tuple< \ - BOOST_PP_ENUM_BINARY_PARAMS_Z(z, BOOST_PP_INC(N), \ - typename parser_t, ::type BOOST_PP_INTERCEPT) \ - > tuple_t; \ - typedef select_parser<tuple_t, BehaviourT, T> result_t; \ - \ - return result_t(tuple_t( \ - BOOST_PP_ENUM_ ## z(BOOST_PP_INC(N), \ - BOOST_SPIRIT_SELECT_CONVERT, _) \ - )); \ - } \ - /**/ - - BOOST_PP_REPEAT(BOOST_SPIRIT_SELECT_LIMIT_A, - BOOST_SPIRIT_SELECT_PARSER, _) - - #undef BOOST_SPIRIT_SELECT_PARSER - #undef BOOST_SPIRIT_SELECT_CONVERT - #undef BOOST_SPIRIT_SELECT_EMBEDDED_TYPEDEF - #undef BOOST_SPIRIT_SELECT_EMBEDDED - /////////////////////////////////////////////////////////////////////////// -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Predefined parser generator helper objects -// -/////////////////////////////////////////////////////////////////////////////// -select_parser_gen<select_default_no_fail> const select_p = - select_parser_gen<select_default_no_fail>(); - -select_parser_gen<select_default_fail> const select_fail_p = - select_parser_gen<select_default_fail>(); - -#undef BOOST_SPIRIT_SELECT_LIMIT_A - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_SELECT_HPP diff --git a/Utilities/BGL/boost/spirit/dynamic/stored_rule.hpp b/Utilities/BGL/boost/spirit/dynamic/stored_rule.hpp deleted file mode 100644 index 42641fb937d295aa5c8cd27eeaa6d28127cd6821..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/stored_rule.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_STORED_RULE_HPP) -#define BOOST_SPIRIT_STORED_RULE_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/core/non_terminal/impl/rule.ipp> -#include <boost/spirit/dynamic/rule_alias.hpp> -#include <boost/shared_ptr.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // stored_rule class - // - /////////////////////////////////////////////////////////////////////////// - template < - typename T0 = nil_t - , typename T1 = nil_t - , typename T2 = nil_t - , bool EmbedByValue = false - > - class stored_rule - : public impl::rule_base< - stored_rule<T0, T1, T2, EmbedByValue> - , typename mpl::if_c< - EmbedByValue - , stored_rule<T0, T1, T2, true> - , stored_rule<T0, T1, T2> const&>::type - , T0, T1, T2> - { - public: - - typedef stored_rule<T0, T1, T2, EmbedByValue> self_t; - typedef impl::rule_base< - self_t - , typename mpl::if_c< - EmbedByValue - , stored_rule<T0, T1, T2, true> - , self_t const&>::type - , T0, T1, T2> - base_t; - - typedef typename base_t::scanner_t scanner_t; - typedef typename base_t::attr_t attr_t; - typedef impl::abstract_parser<scanner_t, attr_t> abstract_parser_t; - typedef rule_alias<self_t> alias_t; - - stored_rule() : ptr() {} - ~stored_rule() {} - - stored_rule(stored_rule const& r) - : ptr(r.ptr) {} - - template <typename ParserT> - stored_rule(ParserT const& p) - : ptr(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)) {} - - template <typename ParserT> - stored_rule& operator=(ParserT const& p) - { - ptr.reset(new impl::concrete_parser<ParserT, scanner_t, attr_t>(p)); - return *this; - } - - stored_rule& operator=(stored_rule const& r) - { - // If this is placed above the templatized assignment - // operator, VC6 incorrectly complains ambiguity with - // r1 = r2, where r1 and r2 are both rules. - ptr = r.ptr; - return *this; - } - - stored_rule<T0, T1, T2, true> - copy() const - { - return stored_rule<T0, T1, T2, true>(ptr); - } - - alias_t - alias() const - { - return alias_t(*this); - } - - private: - - friend class impl::rule_base_access; - friend class stored_rule<T0, T1, T2, !EmbedByValue>; - -#if defined(__GNUC__) && (__GNUC__ < 3) - public: -#endif - abstract_parser_t* - get() const - { - return ptr.get(); - } -#if defined(__GNUC__) && (__GNUC__ < 3) - private: -#endif - - stored_rule(shared_ptr<abstract_parser_t> const& ptr) - : ptr(ptr) {} - - shared_ptr<abstract_parser_t> ptr; - }; - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/dynamic/switch.hpp b/Utilities/BGL/boost/spirit/dynamic/switch.hpp deleted file mode 100644 index 3395a9305e482493d01c63caa7d2dbbbd8c5af8e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/switch.hpp +++ /dev/null @@ -1,255 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_SWITCH_HPP -#define BOOST_SPIRIT_SWITCH_HPP - -/////////////////////////////////////////////////////////////////////////////// -// -// The default_p parser generator template uses the following magic number -// as the corresponding case label value inside the generated switch() -// statements. If this number conflicts with your code, please pick a -// different one. -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_DEFAULTCASE_MAGIC) -#define BOOST_SPIRIT_DEFAULTCASE_MAGIC 0x15F97A7 -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// Spirit predefined maximum number of possible case_p/default_p case branch -// parsers. -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_SPIRIT_SWITCH_CASE_LIMIT) -#define BOOST_SPIRIT_SWITCH_CASE_LIMIT 3 -#endif // !defined(BOOST_SPIRIT_SWITCH_CASE_LIMIT) - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/static_assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Ensure BOOST_SPIRIT_SELECT_LIMIT > 0 -// -/////////////////////////////////////////////////////////////////////////////// -BOOST_STATIC_ASSERT(BOOST_SPIRIT_SWITCH_CASE_LIMIT > 0); - -#include <boost/spirit/core/config.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/epsilon.hpp> -#include <boost/spirit/dynamic/impl/switch.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// The switch_parser allows to build switch like parsing constructs, which -// will have much better perfomance as comparable straight solutions. -// -// Input stream driven syntax: -// -// switch_p -// [ -// case_p<'a'> -// (...parser to use, if the next character is 'a'...), -// case_p<'b'> -// (...parser to use, if the next character is 'b'...), -// default_p -// (...parser to use, if nothing was matched before...) -// ] -// -// General syntax: -// -// switch_p(...lazy expression returning the switch condition value...) -// [ -// case_p<1> -// (...parser to use, if the switch condition value is 1...), -// case_p<2> -// (...parser to use, if the switch condition value is 2...), -// default_p -// (...parser to use, if nothing was matched before...) -// ] -// -// The maximum number of possible case_p branches is defined by the p constant -// BOOST_SPIRIT_SWITCH_CASE_LIMIT (this value defaults to 3 if not otherwise -// defined). -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CaseT, typename CondT = impl::get_next_token_cond> -struct switch_parser -: public unary<CaseT, parser<switch_parser<CaseT, CondT> > > -{ - typedef switch_parser<CaseT, CondT> self_t; - typedef unary_parser_category parser_category_t; - typedef unary<CaseT, parser<self_t> > base_t; - - switch_parser(CaseT const &case_) - : base_t(case_), cond(CondT()) - {} - - switch_parser(CaseT const &case_, CondT const &cond_) - : base_t(case_), cond(cond_) - {} - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return this->subject().parse(scan, - impl::make_cond_functor<CondT>::do_(cond)); - } - - CondT cond; -}; - -/////////////////////////////////////////////////////////////////////////////// -template <typename CondT> -struct switch_cond_parser -{ - switch_cond_parser(CondT const &cond_) - : cond(cond_) - {} - - template <typename ParserT> - switch_parser<ParserT, CondT> - operator[](parser<ParserT> const &p) const - { - return switch_parser<ParserT, CondT>(p.derived(), cond); - } - - CondT const &cond; -}; - -/////////////////////////////////////////////////////////////////////////////// -template <int N, typename ParserT, bool IsDefault> -struct case_parser -: public unary<ParserT, parser<case_parser<N, ParserT, IsDefault> > > -{ - typedef case_parser<N, ParserT, IsDefault> self_t; - typedef unary_parser_category parser_category_t; - typedef unary<ParserT, parser<self_t> > base_t; - - typedef typename base_t::subject_t self_subject_t; - - BOOST_STATIC_CONSTANT(int, value = N); - BOOST_STATIC_CONSTANT(bool, is_default = IsDefault); - BOOST_STATIC_CONSTANT(bool, is_simple = true); - BOOST_STATIC_CONSTANT(bool, is_epsilon = ( - is_default && boost::is_same<self_subject_t, epsilon_parser>::value - )); - - case_parser(parser<ParserT> const &p) - : base_t(p.derived()) - {} - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, nil_t>::type type; - }; - - template <typename ScannerT, typename CondT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan, CondT const &cond) const - { - typedef impl::default_case<self_t> default_t; - - if (!scan.at_end()) { - typedef impl::default_delegate_parse< - value, is_default, default_t::value> default_parse_t; - - typename ScannerT::iterator_t const save(scan.first); - return default_parse_t::parse(cond(scan), *this, - *this, scan, save); - } - - return default_t::is_epsilon ? scan.empty_match() : scan.no_match(); - } - - template <int N1, typename ParserT1, bool IsDefault1> - impl::compound_case_parser< - self_t, case_parser<N1, ParserT1, IsDefault1>, IsDefault1 - > - operator, (case_parser<N1, ParserT1, IsDefault1> const &p) const - { - // If the following compile time assertion fires, you've probably used - // more than one default_p case inside the switch_p parser construct. - BOOST_STATIC_ASSERT(!is_default || !IsDefault1); - - typedef case_parser<N1, ParserT1, IsDefault1> right_t; - return impl::compound_case_parser<self_t, right_t, IsDefault1>(*this, p); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -struct switch_parser_gen { - -// This generates a switch parser, which is driven by the condition value -// returned by the lazy parameter expression 'cond'. This may be a parser, -// which result is used or a phoenix actor, which will be dereferenced to -// obtain the switch condition value. - template <typename CondT> - switch_cond_parser<CondT> - operator()(CondT const &cond) const - { - return switch_cond_parser<CondT>(cond); - } - -// This generates a switch parser, which is driven by the next character/token -// found in the input stream. - template <typename CaseT> - switch_parser<CaseT> - operator[](parser<CaseT> const &p) const - { - return switch_parser<CaseT>(p.derived()); - } -}; - -switch_parser_gen const switch_p = switch_parser_gen(); - -/////////////////////////////////////////////////////////////////////////////// -template <int N, typename ParserT> -inline case_parser<N, ParserT, false> -case_p(parser<ParserT> const &p) -{ - return case_parser<N, ParserT, false>(p); -} - -/////////////////////////////////////////////////////////////////////////////// -struct default_parser_gen -: public case_parser<BOOST_SPIRIT_DEFAULTCASE_MAGIC, epsilon_parser, true> -{ - default_parser_gen() - : case_parser<BOOST_SPIRIT_DEFAULTCASE_MAGIC, epsilon_parser, true> - (epsilon_p) - {} - - template <typename ParserT> - case_parser<BOOST_SPIRIT_DEFAULTCASE_MAGIC, ParserT, true> - operator()(parser<ParserT> const &p) const - { - return case_parser<BOOST_SPIRIT_DEFAULTCASE_MAGIC, ParserT, true>(p); - } -}; - -default_parser_gen const default_p = default_parser_gen(); - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_SWITCH_HPP diff --git a/Utilities/BGL/boost/spirit/dynamic/while.hpp b/Utilities/BGL/boost/spirit/dynamic/while.hpp deleted file mode 100644 index 750d3787d820e3254548df66565d958ab58d89d2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/dynamic/while.hpp +++ /dev/null @@ -1,185 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_WHILE_HPP -#define BOOST_SPIRIT_WHILE_HPP - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/dynamic/impl/conditions.ipp> - -//////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - namespace impl { - - ////////////////////////////////// - // while parser - // object are created by while_parser_gen and do_parser_gen - template <typename ParsableT, typename CondT, bool is_do_parser> - struct while_parser - : public condition_evaluator< typename as_parser<CondT>::type > - , public unary // the parent stores a copy of the body parser - < - typename as_parser<ParsableT>::type, - parser<while_parser<ParsableT, CondT, is_do_parser> > - > - { - typedef while_parser<ParsableT, CondT, is_do_parser> self_t; - - typedef as_parser<ParsableT> as_parser_t; - typedef typename as_parser_t::type parser_t; - typedef as_parser<CondT> cond_as_parser_t; - typedef typename cond_as_parser_t::type condition_t; - - typedef unary<parser_t, parser<self_t> > base_t; - typedef condition_evaluator<condition_t> eval_t; - - - ////////////////////////////// - // constructor, saves condition and body parser - while_parser(ParsableT const &body, CondT const &cond) - : eval_t(cond_as_parser_t::convert(cond)) - , base_t(as_parser_t::convert(body)) - {} - - ////////////////////////////// - // result type computer. - template <typename ScannerT> - struct result - { - typedef typename match_result - <ScannerT, nil_t>::type type; - }; - - ////////////////////////////// - // parse member function - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<parser_t, ScannerT>::type sresult_t; - typedef typename ScannerT::iterator_t iterator_t; - - iterator_t save(scan.first); - std::size_t length = 0; - int eval_length = 0; - - bool dont_check_condition = is_do_parser; - - while (dont_check_condition || (eval_length=this->evaluate(scan))>=0) - { - dont_check_condition = false; - length += eval_length; - sresult_t tmp(this->subject().parse(scan)); - if (tmp) - { - length+=tmp.length(); - } - else - { - return scan.no_match(); - } - } - return scan.create_match(length, nil_t(), save, scan.first); - } - }; - - ////////////////////////////////// - // while-parser generator, takes the body-parser in brackets - // and returns the actual while-parser. - template <typename CondT> - struct while_parser_gen - { - ////////////////////////////// - // constructor, saves the condition for use by operator[] - while_parser_gen(CondT const& cond_) : cond(cond_) {} - - ////////////////////////////// - // operator[] returns the actual while-parser object - template <typename ParsableT> - while_parser<ParsableT, CondT, false> - operator[](ParsableT const &subject) const - { - return while_parser<ParsableT, CondT, false>(subject, cond); - } - private: - - ////////////////////////////// - // the condition is stored by reference here. - // this should not cause any harm since object of type - // while_parser_gen<> are only used as temporaries - // the while-parser object constructed by the operator[] - // stores a copy of the condition. - CondT const &cond; - }; - - ////////////////////////////////// - // do-while-parser generator, takes the condition as - // parameter to while_p member function and returns the - // actual do-while-parser. - template <typename ParsableT> - struct do_while_parser_gen - { - ////////////////////////////// - // constructor. saves the body parser for use by while_p. - explicit do_while_parser_gen(ParsableT const &body_parser) - : body(body_parser) - {} - - ////////////////////////////// - // while_p returns the actual while-parser object - template <typename CondT> - while_parser<ParsableT, CondT, true> - while_p(CondT cond) const - { - return while_parser<ParsableT, CondT, true>(body, cond); - } - private: - - ////////////////////////////// - // the body is stored by reference here - // this should not cause any harm since object of type - // do_while_parser_gen<> are only used as temporaries - // the while-parser object constructed by the while_p - // member function stores a copy of the body parser. - ParsableT const &body; - }; - - struct do_parser_gen - { - inline do_parser_gen() {} - - template <typename ParsableT> - impl::do_while_parser_gen<ParsableT> - operator[](ParsableT const& body) const - { - return impl::do_while_parser_gen<ParsableT>(body); - } - }; -} // namespace impl - -////////////////////////////////// -// while_p function, while-parser generator -// Usage: spirit::while_p(Condition)[Body] -template <typename CondT> -impl::while_parser_gen<CondT> -while_p(CondT const& cond) -{ - return impl::while_parser_gen<CondT>(cond); -} - -////////////////////////////////// -// do_p functor, do-while-parser generator -// Usage: spirit::do_p[Body].while_p(Condition) -impl::do_parser_gen const do_p = impl::do_parser_gen(); - -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_WHILE_HPP diff --git a/Utilities/BGL/boost/spirit/error_handling.hpp b/Utilities/BGL/boost/spirit/error_handling.hpp deleted file mode 100644 index 3d94ca40b28e3613e302912585a0b426d7f372fe..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/error_handling.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_ERROR_HANDLING_MAIN_HPP) -#define BOOST_SPIRIT_ERROR_HANDLING_MAIN_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Master header for Spirit.ErrorHandling -// -/////////////////////////////////////////////////////////////////////////////// - -#include <boost/spirit/error_handling/exceptions.hpp> - -#endif // !defined(BOOST_SPIRIT_ERROR_HANDLING_MAIN_HPP) diff --git a/Utilities/BGL/boost/spirit/error_handling/exceptions.hpp b/Utilities/BGL/boost/spirit/error_handling/exceptions.hpp deleted file mode 100644 index 0186a3ac6d875596bce54dcac623540b790bf48b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/error_handling/exceptions.hpp +++ /dev/null @@ -1,362 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_EXCEPTIONS_HPP -#define BOOST_SPIRIT_EXCEPTIONS_HPP - -#include <boost/config.hpp> -#include <boost/throw_exception.hpp> -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <exception> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // parser_error_base class - // - // This is the base class of parser_error (see below). This may be - // used to catch any type of parser error. - // - // This exception shouldn't propagate outside the parser. However to - // avoid quirks of many platforms/implementations which fall outside - // the C++ standard, we derive parser_error_base from std::exception - // to allow a single catch handler to catch all exceptions. - // - /////////////////////////////////////////////////////////////////////////// - class parser_error_base : public std::exception - { - protected: - - parser_error_base() {} - virtual ~parser_error_base() throw() {} - - public: - - parser_error_base(parser_error_base const& rhs) - : std::exception(rhs) {} - parser_error_base& operator=(parser_error_base const&) - { - return *this; - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // parser_error class - // - // Generic parser exception class. This is the base class for all - // parser exceptions. The exception holds the iterator position - // where the error was encountered in its member variable "where". - // The parser_error also holds information regarding the error - // (error descriptor) in its member variable "descriptor". - // - // The throw_ function creates and throws a parser_error given - // an iterator and an error descriptor. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ErrorDescrT, typename IteratorT = char const*> - struct parser_error : public parser_error_base - { - typedef ErrorDescrT error_descr_t; - typedef IteratorT iterator_t; - - parser_error(IteratorT where_, ErrorDescrT descriptor_) - : where(where_), descriptor(descriptor_) {} - - parser_error(parser_error const& rhs) - : parser_error_base(rhs) - , where(rhs.where), descriptor(rhs.descriptor) {} - - parser_error& - operator=(parser_error const& rhs) - { - where = rhs.where; - descriptor = rhs.descriptor; - return *this; - } - - virtual - ~parser_error() throw() {} - - virtual const char* - what() const throw() - { - return "boost::spirit::parser_error"; - } - - IteratorT where; - ErrorDescrT descriptor; - }; - - ////////////////////////////////// - template <typename ErrorDescrT, typename IteratorT> - inline void - throw_(IteratorT where, ErrorDescrT descriptor) - { - boost::throw_exception( - parser_error<ErrorDescrT, IteratorT>(where, descriptor)); - } - - /////////////////////////////////////////////////////////////////////////// - // - // assertive_parser class - // - // An assertive_parser class is a parser that throws an exception - // in response to a parsing failure. The assertive_parser throws a - // parser_error exception rather than returning an unsuccessful - // match to signal that the parser failed to match the input. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ErrorDescrT, typename ParserT> - struct assertive_parser - : public unary<ParserT, parser<assertive_parser<ErrorDescrT, ParserT> > > - { - typedef assertive_parser<ErrorDescrT, ParserT> self_t; - typedef unary<ParserT, parser<self_t> > base_t; - typedef unary_parser_category parser_category_t; - - assertive_parser(ParserT const& parser, ErrorDescrT descriptor) - : base_t(parser), descriptor(descriptor) {} - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<ParserT, ScannerT>::type result_t; - typedef typename ScannerT::iterator_t iterator_t; - - result_t hit = this->subject().parse(scan); - if (!hit) - { - throw_(scan.first, descriptor); - } - return hit; - } - - ErrorDescrT descriptor; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // assertion class - // - // assertive_parsers are never instantiated directly. The assertion - // class is used to indirectly create an assertive_parser object. - // Before declaring the grammar, we declare some assertion objects. - // Examples: - // - // enum Errors - // { - // program_expected, begin_expected, end_expected - // }; - // - // assertion<Errors> expect_program(program_expected); - // assertion<Errors> expect_begin(begin_expected); - // assertion<Errors> expect_end(end_expected); - // - // Now, we can use these assertions as wrappers around parsers: - // - // expect_end(str_p("end")) - // - // Take note that although the example uses enums to hold the - // information regarding the error (error desccriptor), we are free - // to use other types such as integers and strings. Enums are - // convenient for error handlers to easily catch since C++ treats - // enums as unique types. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ErrorDescrT> - struct assertion - { - assertion(ErrorDescrT descriptor_) - : descriptor(descriptor_) {} - - template <typename ParserT> - assertive_parser<ErrorDescrT, ParserT> - operator()(ParserT const& parser) const - { - return assertive_parser<ErrorDescrT, ParserT>(parser, descriptor); - } - - ErrorDescrT descriptor; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // error_status<T> - // - // Where T is an attribute type compatible with the match attribute - // of the fallback_parser's subject (defaults to nil_t). The class - // error_status reports the result of an error handler (see - // fallback_parser). result can be one of: - // - // fail: quit and fail (return a no_match) - // retry: attempt error recovery, possibly moving the scanner - // accept: force success returning a matching length, moving - // the scanner appropriately and returning an attribute - // value - // rethrow: rethrows the error. - // - /////////////////////////////////////////////////////////////////////////// - template <typename T = nil_t> - struct error_status - { - enum result_t { fail, retry, accept, rethrow }; - - error_status( - result_t result_ = fail, - std::ptrdiff_t length = -1, - T const& value_ = T()) - : result(result_), length(length), value(value_) {} - - result_t result; - std::ptrdiff_t length; - T value; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // fallback_parser class - // - // Handles exceptions of type parser_error<ErrorDescrT, IteratorT> - // thrown somewhere inside its embedded ParserT object. The class - // sets up a try block before delegating parsing to its subject. - // When an exception is caught, the catch block then calls the - // HandlerT object. HandlerT may be a function or a functor (with - // an operator() member function) compatible with the interface: - // - // error_status<T> - // handler(ScannerT const& scan, ErrorT error); - // - // Where scan points to the scanner state prior to parsing and error - // is the error that arose (see parser_error). The handler must - // return an error_status<T> object (see above). - // - /////////////////////////////////////////////////////////////////////////// - namespace impl - { - template <typename RT, typename ParserT, typename ScannerT> - RT fallback_parser_parse(ParserT const& p, ScannerT const& scan); - } - - template <typename ErrorDescrT, typename ParserT, typename HandlerT> - struct fallback_parser - : public unary<ParserT, - parser<fallback_parser<ErrorDescrT, ParserT, HandlerT> > > - { - typedef fallback_parser<ErrorDescrT, ParserT, HandlerT> - self_t; - typedef ErrorDescrT - error_descr_t; - typedef unary<ParserT, parser<self_t> > - base_t; - typedef unary_parser_category - parser_category_t; - - fallback_parser(ParserT const& parser, HandlerT const& handler_) - : base_t(parser), handler(handler_) {} - - template <typename ScannerT> - struct result - { - typedef typename parser_result<ParserT, ScannerT>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::fallback_parser_parse<result_t>(*this, scan); - } - - HandlerT handler; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // guard class - // - // fallback_parser objects are not instantiated directly. The guard - // class is used to indirectly create a fallback_parser object. - // guards are typically predeclared just like assertions (see the - // assertion class above; the example extends the previous example - // introduced in the assertion class above): - // - // guard<Errors> my_guard; - // - // Errors, in this example is the error descriptor type we want to - // detect; This is essentially the ErrorDescrT template parameter - // of the fallback_parser class. - // - // my_guard may now be used in a grammar declaration as: - // - // my_guard(p)[h] - // - // where p is a parser, h is a function or functor compatible with - // fallback_parser's HandlerT (see above). - // - /////////////////////////////////////////////////////////////////////////// - template <typename ErrorDescrT> - struct guard; - - template <typename ErrorDescrT, typename ParserT> - struct guard_gen : public unary<ParserT, nil_t> - { - typedef guard<ErrorDescrT> parser_generator_t; - typedef unary_parser_category parser_category_t; - - guard_gen(ParserT const& p) - : unary<ParserT, nil_t>(p) {} - - template <typename HandlerT> - fallback_parser<ErrorDescrT, ParserT, HandlerT> - operator[](HandlerT const& handler) const - { - return fallback_parser<ErrorDescrT, ParserT, HandlerT> - (this->subject(), handler); - } - }; - - template <typename ErrorDescrT> - struct guard - { - template <typename ParserT> - struct result - { - typedef guard_gen<ErrorDescrT, ParserT> type; - }; - - template <typename ParserT> - static guard_gen<ErrorDescrT, ParserT> - generate(ParserT const& parser) - { - return guard_gen<ErrorDescrT, ParserT>(parser); - } - - template <typename ParserT> - guard_gen<ErrorDescrT, ParserT> - operator()(ParserT const& parser) const - { - return guard_gen<ErrorDescrT, ParserT>(parser); - } - }; - -}} // namespace boost::spirit - -#include <boost/spirit/error_handling/impl/exceptions.ipp> -#endif - diff --git a/Utilities/BGL/boost/spirit/error_handling/impl/exceptions.ipp b/Utilities/BGL/boost/spirit/error_handling/impl/exceptions.ipp deleted file mode 100644 index e1a871b0c9cfc105c7f58be7ea32a65cd952c75e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/error_handling/impl/exceptions.ipp +++ /dev/null @@ -1,85 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_EXCEPTIONS_IPP -#define BOOST_SPIRIT_EXCEPTIONS_IPP - -namespace boost { namespace spirit { namespace impl { - -#ifdef __BORLANDC__ - template <typename ParserT, typename ScannerT> - typename parser_result<ParserT, ScannerT>::type - fallback_parser_helper(ParserT const& subject, ScannerT const& scan); -#endif - - template <typename RT, typename ParserT, typename ScannerT> - RT fallback_parser_parse(ParserT const& p, ScannerT const& scan) - { - typedef typename ScannerT::iterator_t iterator_t; - typedef typename RT::attr_t attr_t; - typedef error_status<attr_t> error_status_t; - typedef typename ParserT::error_descr_t error_descr_t; - - iterator_t save = scan.first; - error_status_t hr(error_status_t::retry); - - while (hr.result == error_status_t::retry) - { - try - { - #ifndef __BORLANDC__ - return p.subject().parse(scan); - #else - return impl::fallback_parser_helper(p, scan); - #endif - } - - catch (parser_error<error_descr_t, iterator_t>& error) - { - scan.first = save; - hr = p.handler(scan, error); - switch (hr.result) - { - case error_status_t::fail: - return scan.no_match(); - case error_status_t::accept: - return scan.create_match - (std::size_t(hr.length), hr.value, save, scan.first); - case error_status_t::rethrow: - boost::throw_exception(error); - default: - continue; - } - } - } - return scan.no_match(); - } - -/////////////////////////////////////////////////////////////////////////// -// -// Borland does not like calling the subject directly in the try block. -// Removing the #ifdef __BORLANDC__ code makes Borland complain that -// some variables and types cannot be found in the catch block. Weird! -// -/////////////////////////////////////////////////////////////////////////// -#ifdef __BORLANDC__ - - template <typename ParserT, typename ScannerT> - typename parser_result<ParserT, ScannerT>::type - fallback_parser_helper(ParserT const& p, ScannerT const& scan) - { - return p.subject().parse(scan); - } - -#endif - -}}} // namespace boost::spirit::impl - -/////////////////////////////////////////////////////////////////////////////// -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/any.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/any.hpp deleted file mode 100644 index 0a13d236c64db2645b832e220e879dd3fab7eef4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/any.hpp +++ /dev/null @@ -1,71 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_ANY_HPP) -#define FUSION_ALGORITHM_ANY_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/spirit/fusion/algorithm/detail/any.ipp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename F> - struct any - { - typedef bool type; - }; - } - - namespace function - { - struct any - { - template <typename Sequence, typename F> - struct apply - { - typedef bool type; - }; - - template <typename Sequence, typename F> - inline bool - operator()(Sequence const& seq, F const& f) const - { - return detail::any( - fusion::begin(seq) - , fusion::end(seq) - , f - , meta::equal_to< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>()); - } - - template <typename Sequence, typename F> - inline bool - operator()(Sequence& seq, F const& f) const - { - return detail::any( - fusion::begin(seq) - , fusion::end(seq) - , f - , meta::equal_to< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>()); - } - }; - } - - function::any const any = function::any(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/any.ipp b/Utilities/BGL/boost/spirit/fusion/algorithm/detail/any.ipp deleted file mode 100644 index 5da0dfaf5432e19a89719d123448cedcf62339e8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/any.ipp +++ /dev/null @@ -1,39 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_DETAIL_ANY_IPP) -#define FUSION_ALGORITHM_DETAIL_ANY_IPP - -#include <boost/mpl/bool.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> - -namespace boost { namespace fusion { namespace detail -{ - template <typename First, typename Last, typename F> - inline bool - any(First const&, Last const&, F const&, mpl::true_) - { - return false; - } - - template <typename First, typename Last, typename F> - inline bool - any(First const& first, Last const& last, F const& f, mpl::false_) - { - if(f(*first)) - return true; - return detail::any(fusion::next(first), last, f - , meta::equal_to<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>()); - } -}}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/find_if.ipp b/Utilities/BGL/boost/spirit/fusion/algorithm/detail/find_if.ipp deleted file mode 100644 index 930da51a91c66ced0b98cda918bf558891505fa6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/find_if.ipp +++ /dev/null @@ -1,118 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_DETAIL_FIND_IF_HPP) -#define FUSION_ALGORITHM_DETAIL_FIND_IF_HPP - -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/apply.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/lambda.hpp> -#include <boost/spirit/fusion/iterator/value_of.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> - -namespace boost { namespace fusion { namespace detail -{ - template <typename Iterator, typename Pred> - struct apply_filter - { - typedef typename - mpl::apply1< - Pred - , typename meta::value_of<Iterator>::type - >::type - type; - }; - - template <typename First, typename Last, typename Pred> - struct main_find_if; - - template <typename First, typename Last, typename Pred> - struct recursive_find_if - { - typedef typename - main_find_if< - typename meta::next<First>::type, Last, Pred - >::type - type; - }; - - template <typename First, typename Last, typename Pred> - struct main_find_if - { - typedef mpl::or_< - meta::equal_to<First, Last> - , apply_filter<First, Pred> > - filter; - - typedef typename - mpl::eval_if< - filter - , mpl::identity<First> - , recursive_find_if<First, Last, Pred> - >::type - type; - }; - - template <typename First, typename Last, typename Pred> - struct static_find_if; - - namespace static_find_if_detail { - template <typename First,typename Last,typename Pred,typename Iterator> - typename main_find_if<First,Last,typename mpl::lambda<Pred>::type>::type - call(static_find_if<First,Last,Pred> const& obj,Iterator const& iter); - } - - template <typename First, typename Last, typename Pred> - struct static_find_if - { - typedef typename - main_find_if< - First - , Last - , typename mpl::lambda<Pred>::type - >::type - type; - - //Workaround to please MSVC - template<typename Iterator> - static type - call(Iterator const& iter) - { - return static_find_if_detail::call(static_find_if<First,Last,Pred>(),iter); - } - }; - - namespace static_find_if_detail { - template <typename First,typename Last,typename Pred,typename Iterator> - typename static_find_if<First,Last,Pred>::type - call(static_find_if<First,Last,Pred> const&, Iterator const& iter, mpl::true_) - { - return iter; - }; - - template <typename First,typename Last,typename Pred,typename Iterator> - typename static_find_if<First,Last,Pred>::type - call(static_find_if<First,Last,Pred> const& obj,Iterator const& iter, mpl::false_) - { - return call(obj,fusion::next(iter)); - }; - - template <typename First,typename Last,typename Pred,typename Iterator> - typename main_find_if<First,Last,typename mpl::lambda<Pred>::type>::type - call(static_find_if<First,Last,Pred> const& obj,Iterator const& iter) - { - typedef meta::equal_to<Iterator, BOOST_DEDUCED_TYPENAME static_find_if<First,Last,Pred>::type> found; - return call(obj,iter, found()); - }; - } - -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/fold.ipp b/Utilities/BGL/boost/spirit/fusion/algorithm/detail/fold.ipp deleted file mode 100644 index 93580421e88c0352a2de9c2d23d6303410247326..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/fold.ipp +++ /dev/null @@ -1,88 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_DETAIL_FOLD_IPP) -#define FUSION_ALGORITHM_DETAIL_FOLD_IPP - -#include <boost/mpl/bool.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/value_of.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> - -namespace boost { namespace fusion { namespace detail -{ - template <typename Iterator, typename State, typename F> - struct fold_apply - { - typedef typename fusion_apply2<F, - typename meta::value_of<Iterator>::type, State - >::type type; - }; - - template <typename First, typename Last, typename State, typename F> - struct static_fold; - - template <typename First, typename Last, typename State, typename F> - struct next_result_of_fold - { - typedef typename - static_fold< - typename meta::next<First>::type - , Last - , typename fold_apply<First, State, F>::type - , F - >::type - type; - }; - - template <typename First, typename Last, typename State, typename F> - struct static_fold - { - typedef typename - mpl::if_< - is_same<First, Last> - , mpl::identity<State> - , next_result_of_fold<First, Last, State, F> - >::type - result; - - typedef typename result::type type; - }; - - // terminal case - template <typename First, typename Last, typename State, typename F> - inline State const& - fold(First const&, Last const&, State const& state, F const&, mpl::true_) - { - return state; - } - - // non-terminal case - template <typename First, typename Last, typename State, typename F> - inline typename static_fold<First, Last, State, F>::type - fold( - First const& first - , Last const& last - , State const& state - , F const& f - , mpl::false_) - { - return detail::fold( - fusion::next(first) - , last - , f(*first, state) - , f - , is_same<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>() - ); - } -}}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/for_each.ipp b/Utilities/BGL/boost/spirit/fusion/algorithm/detail/for_each.ipp deleted file mode 100644 index 19a7561ca6c14a68ebffd71366b35382230007e4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/detail/for_each.ipp +++ /dev/null @@ -1,36 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_DETAIL_FOR_EACH_IPP) -#define FUSION_ALGORITHM_DETAIL_FOR_EACH_IPP - -#include <boost/mpl/bool.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> - -namespace boost { namespace fusion { namespace detail -{ - template <typename First, typename Last, typename F> - inline void - for_each(First const&, Last const&, F const&, mpl::true_) - { - } - - template <typename First, typename Last, typename F> - inline void - for_each(First const& first, Last const& last, F const& f, mpl::false_) - { - f(*first); - detail::for_each(fusion::next(first), last, f - , meta::equal_to<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>()); - } -}}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/erase.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/erase.hpp deleted file mode 100644 index b8558bdf0f99fc43b5068efac37c02eeac13861b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/erase.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_ERASE_HPP) -#define FUSION_ALGORITHM_ERASE_HPP - -#include <boost/spirit/fusion/sequence/single_view.hpp> -#include <boost/spirit/fusion/sequence/joint_view.hpp> -#include <boost/spirit/fusion/sequence/range.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename Position> - struct erase - { - typedef typename meta::begin<Sequence>::type first_type; - typedef typename meta::end<Sequence>::type last_type; -#if! BOOST_WORKAROUND(BOOST_MSVC,<=1300) - BOOST_STATIC_ASSERT((!meta::equal_to<Position, last_type>::value)); -#endif - - typedef typename meta::next<Position>::type next_type; - typedef range<first_type, Position> left_type; - typedef range<next_type, last_type> right_type; - typedef joint_view<left_type, right_type> type; - }; - } - - namespace function - { - struct erase - { - template <typename Sequence, typename Position> - struct apply : meta::erase<Sequence, Position> {}; - - template <typename Sequence, typename Position> - typename apply<Sequence const, Position>::type - operator()(Sequence const& seq, Position const& pos) const - { - typedef apply<Sequence const, Position> meta_type; - typedef typename meta_type::left_type left_type; - typedef typename meta_type::right_type right_type; - typedef typename meta_type::type result_type; - - left_type left(fusion::begin(seq), pos); - right_type right(fusion::next(pos), fusion::end(seq)); - return result_type(left, right); - } - -// template <typename Sequence, typename Position> -// typename apply<Sequence, Position>::type -// operator()(Sequence& seq, Position const& pos) const -// { -// typedef apply<Sequence, Position> meta; -// typedef typename meta::left_type left_type; -// typedef typename meta::right_type right_type; -// typedef typename meta::type result_type; -// -// left_type left(fusion::begin(seq), pos); -// right_type right(fusion::next(pos), fusion::end(seq)); -// return result_type(left, right); -// } - }; - } - - function::erase const erase = function::erase(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/filter.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/filter.hpp deleted file mode 100644 index cf1faeefa44cf99e4ca34a53f87636ddef6839b6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/filter.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_FILTER_HPP) -#define FUSION_ALGORITHM_FILTER_HPP - -#include <boost/spirit/fusion/sequence/filter_view.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename Pred> - struct filter - { - typedef filter_view<Sequence, Pred> type; - }; - } - - namespace function - { - struct filter - { - template <typename Sequence, typename Pred> - struct apply : meta::filter<Sequence, Pred> {}; - - template <typename Sequence, typename Pred> - typename apply<Sequence const, Pred>::type - operator()(Sequence const& seq, Pred) const - { - return filter_view<Sequence const, Pred>(seq); - } - - template <typename Sequence, typename Pred> - typename apply<Sequence, Pred>::type - operator()(Sequence& seq, Pred) const - { - return filter_view<Sequence, Pred>(seq); - } - }; - } - - function::filter const filter = function::filter(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/find.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/find.hpp deleted file mode 100644 index a95cd3e9cf95b6b734bdf956d5f67b76516647e3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/find.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_FIND_HPP) -#define FUSION_ALGORITHM_FIND_HPP - -#include <boost/spirit/fusion/algorithm/detail/find_if.ipp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/type_traits/is_same.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename T> - struct find - { - typedef typename - detail::static_find_if< - typename meta::begin<Sequence>::type - , typename meta::end<Sequence>::type - , is_same<mpl::_, T> - >::type - type; - }; - } - - namespace function - { - struct find - { - template <typename Sequence, typename T> - struct apply : meta::find<Sequence, T> {}; - - template <typename Sequence, typename T> - typename apply<Sequence const, typename T::type>::type - operator()(Sequence const& seq, T) const - { - typedef - detail::static_find_if< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence const>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence const>::type - , is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type> - > - filter; - - return filter::call(fusion::begin(seq)); - } - - template <typename Sequence, typename T> - typename apply<Sequence, typename T::type>::type - operator()(Sequence& seq, T) const - { - typedef - detail::static_find_if< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type - , is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type> - > - filter; - - return filter::call(fusion::begin(seq)); - } - }; - } - - function::find const find = function::find(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/find_if.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/find_if.hpp deleted file mode 100644 index e134a8c2cbc8f53ad6040579dab1d89cd1a2cab4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/find_if.hpp +++ /dev/null @@ -1,76 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_FIND_IF_HPP) -#define FUSION_ALGORITHM_FIND_IF_HPP - -#include <boost/spirit/fusion/algorithm/detail/find_if.ipp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename Pred> - struct find_if - { - typedef typename - detail::static_find_if< - typename meta::begin<Sequence>::type - , typename meta::end<Sequence>::type - , Pred - >::type - type; - }; - } - - namespace function - { - struct find_if - { - template <typename Sequence, typename Pred> - struct apply : meta::find_if<Sequence, Pred> {}; - - template <typename Sequence, typename Pred> - inline typename apply<Sequence const, Pred>::type - operator()(Sequence const& seq, Pred) const - { - typedef - detail::static_find_if< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence const>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence const>::type - , Pred - > - filter; - - return filter::call(fusion::begin(seq)); - } - - template <typename Sequence, typename Pred> - inline typename apply<Sequence, Pred>::type - operator()(Sequence& seq, Pred) const - { - typedef - detail::static_find_if< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type - , Pred - > - filter; - - return filter::call(fusion::begin(seq)); - } - }; - } - - function::find_if const find_if = function::find_if(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/fold.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/fold.hpp deleted file mode 100644 index 59bb0b87749ef81c08ae6f1f09762894f034315d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/fold.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_FOLD_HPP) -#define FUSION_ALGORITHM_FOLD_HPP - -#include <boost/spirit/fusion/algorithm/detail/fold.ipp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename State, typename F> - struct fold - { - typedef typename - detail::static_fold< - typename meta::begin<Sequence>::type - , typename meta::end<Sequence>::type - , State - , F - >::type - type; - }; - } - - namespace function - { - struct fold - { - template <typename Sequence, typename State, typename F> - struct apply : meta::fold<Sequence, State, F> {}; - - template <typename Sequence, typename State, typename F> - inline typename apply<Sequence const, State, F>::type - operator()(Sequence const& seq, State const& state, F const& f) const - { - return detail::fold( - fusion::begin(seq) - , fusion::end(seq) - , state - , f - , is_same< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence const>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence const>::type>() - ); - } - - template <typename Sequence, typename State, typename F> - inline typename apply<Sequence, State, F>::type - operator()(Sequence& seq, State const& state, F const& f) const - { - return detail::fold( - fusion::begin(seq) - , fusion::end(seq) - , state - , f - , is_same< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>() - ); - } - }; - } - - function::fold const fold = function::fold(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/for_each.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/for_each.hpp deleted file mode 100644 index a8b7aa7967a541fae5c548b7918f6d87103ec75b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/for_each.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_FOR_EACH_HPP) -#define FUSION_ALGORITHM_FOR_EACH_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/spirit/fusion/algorithm/detail/for_each.ipp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename F> - struct for_each - { - typedef void type; - }; - } - - namespace function - { - struct for_each - { - template <typename Sequence, typename F> - struct apply - { - typedef void type; - }; - - template <typename Sequence, typename F> - inline void - operator()(Sequence const& seq, F const& f) const - { - detail::for_each( - fusion::begin(seq) - , fusion::end(seq) - , f - , meta::equal_to< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>()); - } - - template <typename Sequence, typename F> - inline void - operator()(Sequence& seq, F const& f) const - { - detail::for_each( - fusion::begin(seq) - , fusion::end(seq) - , f - , meta::equal_to< - BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type - , BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>()); - } - }; - } - - function::for_each const for_each = function::for_each(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/insert.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/insert.hpp deleted file mode 100644 index 568da421009de0eeb9d77ddf5c9c664b80103676..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/insert.hpp +++ /dev/null @@ -1,85 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_INSERT_HPP) -#define FUSION_ALGORITHM_INSERT_HPP - -#include <boost/spirit/fusion/sequence/single_view.hpp> -#include <boost/spirit/fusion/sequence/joint_view.hpp> -#include <boost/spirit/fusion/sequence/range.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename Position, typename T> - struct insert - { - typedef typename meta::begin<Sequence>::type first_type; - typedef typename meta::end<Sequence>::type last_type; - - typedef single_view<T> insert_type; - typedef range<first_type, Position> left_type; - typedef range<Position, last_type> right_type; - typedef joint_view<left_type, insert_type> left_insert_type; - typedef joint_view<left_insert_type, right_type> type; - }; - } - - namespace function - { - struct insert - { - template <typename Sequence, typename Position, typename T> - struct apply : meta::insert<Sequence, Position, T> {}; - - template <typename Sequence, typename Position, typename T> - inline typename apply<Sequence const, Position, T>::type - operator()(Sequence const& seq, Position const& pos, T const& x) const - { - typedef apply<Sequence const, Position, T> meta; - typedef typename meta::left_type left_type; - typedef typename meta::right_type right_type; - typedef typename meta::left_insert_type left_insert_type; - typedef typename meta::insert_type insert_type; - typedef typename meta::type result; - - left_type left(fusion::begin(seq), pos); - right_type right(pos, fusion::end(seq)); - insert_type ins(x); - left_insert_type left_insert(left, ins); - return result(left_insert, right); - } - - template <typename Sequence, typename Position, typename T> - inline typename apply<Sequence, Position, T>::type - operator()(Sequence& seq, Position const& pos, T const& x) const - { - typedef apply<Sequence, Position, T> meta_type; - typedef typename meta_type::left_type left_type; - typedef typename meta_type::right_type right_type; - typedef typename meta_type::left_insert_type left_insert_type; - typedef typename meta_type::insert_type insert_type; - typedef typename meta_type::type result; - - left_type left(fusion::begin(seq), pos); - right_type right(pos, fusion::end(seq)); - insert_type ins(x); - left_insert_type left_insert(left, ins); - return result(left_insert, right); - } - }; - } - - function::insert const insert = function::insert(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/push_back.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/push_back.hpp deleted file mode 100644 index 92efff45af06bf1bed1a91757e5f53fc46cbf1c6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/push_back.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_PUSH_BACK_HPP) -#define FUSION_ALGORITHM_PUSH_BACK_HPP - -#include <boost/spirit/fusion/sequence/append_view.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename T> - struct push_back - { - typedef append_view<Sequence, T> type; - }; - } - - namespace function - { - struct push_back - { - template <typename Sequence, typename T> - struct apply : meta::push_back<Sequence, T> {}; - - template <typename Sequence, typename T> - inline typename apply<Sequence const, T>::type - operator()(Sequence const& seq, T const& x) const - { - typedef append_view<Sequence const, T> result; - return result(seq, x); - } - - template <typename Sequence, typename T> - inline typename apply<Sequence, T>::type - operator()(Sequence& seq, T const& x) const - { - typedef append_view<Sequence, T> result; - return result(seq, x); - } - }; - } - - function::push_back const push_back = function::push_back(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/push_front.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/push_front.hpp deleted file mode 100644 index 08e9dcf476bbcfefa84725467973802397c48406..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/push_front.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_PUSH_FRONT_HPP) -#define FUSION_ALGORITHM_PUSH_FRONT_HPP - -#include <boost/spirit/fusion/sequence/prepend_view.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename T> - struct push_front - { - typedef prepend_view<Sequence, T> type; - }; - } - - namespace function - { - struct push_front - { - template <typename Sequence, typename T> - struct apply : meta::push_front<Sequence, T> {}; - - template <typename Sequence, typename T> - inline typename apply<Sequence const, T>::type - operator()(Sequence const& seq, T const& x) const - { - typedef prepend_view<Sequence const, T> result; - return result(seq, x); - } - - template <typename Sequence, typename T> - inline typename apply<Sequence, T>::type - operator()(Sequence& seq, T const& x) const - { - typedef prepend_view<Sequence, T> result; - return result(seq, x); - } - }; - } - - function::push_front const push_front = function::push_front(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/remove.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/remove.hpp deleted file mode 100644 index f01082c13d6f4db81ed12dc8f52feae02cf2ca60..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/remove.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_REMOVE_HPP) -#define FUSION_ALGORITHM_REMOVE_HPP - -#include <boost/spirit/fusion/sequence/filter_view.hpp> -#include <boost/mpl/not.hpp> -#include <boost/type_traits/is_same.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename T> - struct remove - { - typedef filter_view<Sequence, mpl::not_<is_same<mpl::_, T> > > type; - }; - } - - namespace function - { - struct remove - { - template <typename Sequence, typename T> - struct apply : meta::remove<Sequence, T> {}; - - template <typename Sequence, typename T> - inline filter_view< - Sequence const - , mpl::not_<is_same<mpl::_, typename T::type> > > - operator()(Sequence const& seq, T) const - { - return filter_view< - Sequence const - , mpl::not_<is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type> - > >(seq); - } - - template <typename Sequence, typename T> - inline filter_view< - Sequence - , mpl::not_<is_same<mpl::_, typename T::type> > > - operator()(Sequence& seq, T) const - { - return filter_view< - Sequence - , mpl::not_<is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type> - > >(seq); - } - }; - } - - function::remove const remove = function::remove(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/remove_if.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/remove_if.hpp deleted file mode 100644 index 211d8867419b9984afeab9eba27829ea05ea451b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/remove_if.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_REMOVE_IF_HPP) -#define FUSION_ALGORITHM_REMOVE_IF_HPP - -#include <boost/spirit/fusion/sequence/filter_view.hpp> -#include <boost/mpl/not.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename Pred> - struct remove_if - { - typedef filter_view<Sequence, mpl::not_<Pred> > type; - }; - } - - namespace function - { - struct remove_if - { - template <typename Sequence, typename Pred> - struct apply : meta::remove_if<Sequence, Pred> {}; - - template <typename Sequence, typename Pred> - inline typename apply<Sequence const, Pred>::type - operator()(Sequence const& seq, Pred) const - { - return filter_view<Sequence const, mpl::not_<Pred> >(seq); - } - - template <typename Sequence, typename Pred> - inline typename apply<Sequence, Pred>::type - operator()(Sequence& seq, Pred) const - { - return filter_view<Sequence, mpl::not_<Pred> >(seq); - } - }; - } - - function::remove_if const remove_if = function::remove_if(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/replace.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/replace.hpp deleted file mode 100644 index 48dc9134a0ad07aa25fb9e79828e916ec2fbec7c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/replace.hpp +++ /dev/null @@ -1,91 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_REPLACE_HPP) -#define FUSION_ALGORITHM_REPLACE_HPP - -#include <boost/spirit/fusion/sequence/single_view.hpp> -#include <boost/spirit/fusion/sequence/joint_view.hpp> -#include <boost/spirit/fusion/sequence/range.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename Position, typename T> - struct replace - { - typedef typename meta::begin<Sequence>::type first_type; - typedef typename meta::end<Sequence>::type last_type; - typedef typename meta::next<Position>::type next_type; -#if! BOOST_WORKAROUND(BOOST_MSVC,<=1300) - BOOST_STATIC_ASSERT((!meta::equal_to<Position, last_type>::value)); -#endif - typedef single_view<T> insert_type; - typedef range<first_type, Position> left_type; - typedef range<next_type, last_type> right_type; - typedef joint_view<left_type, insert_type> left_replace_type; - typedef joint_view<left_replace_type, right_type> type; - }; - } - - namespace function - { - struct replace - { - template <typename Sequence, typename Position, typename T> - struct apply : meta::replace<Sequence, Position, T> {}; - - template <typename Sequence, typename Position, typename T> - typename apply<Sequence const, Position, T>::type - operator()(Sequence const& seq, Position const& pos, T const& x) const - { - typedef apply<Sequence const, Position, T> replacer; - - typedef typename replacer::left_type left_type; - typedef typename replacer::right_type right_type; - typedef typename replacer::left_replace_type left_replace_type; - typedef typename replacer::insert_type insert_type; - typedef typename replacer::type result; - - left_type left(fusion::begin(seq), pos); - right_type right(fusion::next(pos), fusion::end(seq)); - insert_type ins(x); - left_replace_type left_replace(left, ins); - return result(left_replace, right); - } - - template <typename Sequence, typename Position, typename T> - typename apply<Sequence, Position, T>::type - operator()(Sequence& seq, Position const& pos, T const& x) const - { - typedef apply<Sequence, Position, T> replacer; - - typedef typename replacer::left_type left_type; - typedef typename replacer::right_type right_type; - typedef typename replacer::left_replace_type left_replace_type; - typedef typename replacer::insert_type insert_type; - typedef typename replacer::type result; - - left_type left(fusion::begin(seq), pos); - right_type right(fusion::next(pos), fusion::end(seq)); - insert_type ins(x); - left_replace_type left_replace(left, ins); - return result(left_replace, right); - } - }; - } - - function::replace const replace = function::replace(); -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/algorithm/transform.hpp b/Utilities/BGL/boost/spirit/fusion/algorithm/transform.hpp deleted file mode 100644 index b5c5c5fcceb9d9dc5a675ec9905e92f5aaf457f7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/algorithm/transform.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ALGORITHM_TRANSFORM_HPP) -#define FUSION_ALGORITHM_TRANSFORM_HPP - -#include <boost/spirit/fusion/sequence/transform_view.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence, typename F> - struct transform - { - typedef transform_view<Sequence, F> type; - }; - } - - namespace function - { - struct transform - { - template <typename Sequence, typename F> - struct apply : meta::transform<Sequence, F> {}; - - template <typename Sequence, typename F> - typename apply<Sequence const, F>::type - operator()(Sequence const& seq, F const& f) const - { - return transform_view<Sequence const, F>(seq, f); - } - - template <typename Sequence, typename F> - typename apply<Sequence, F>::type - operator()(Sequence& seq, F const& f) const - { - return transform_view<Sequence, F>(seq, f); - } - }; - } - - function::transform const transform = function::transform(); - -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/detail/access.hpp b/Utilities/BGL/boost/spirit/fusion/detail/access.hpp deleted file mode 100644 index 4b3561d5edca5d76460a5e340c840c88cdd1d9c6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/detail/access.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_DETAIL_ACCESS_HPP) -#define FUSION_DETAIL_ACCESS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/type_traits/add_const.hpp> -#include <boost/type_traits/add_reference.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/type_traits/remove_cv.hpp> - -namespace boost { namespace fusion { namespace detail -{ - template <typename T> - struct ref_result - { - typedef typename add_reference<FUSION_GET_TYPE(T)>::type type; - }; - - template <typename T> - struct cref_result - { - typedef typename add_reference< - typename add_const<FUSION_GET_TYPE(T)>::type - >::type type; - }; - - template <typename T> - struct non_ref_parameter - { - typedef typename boost::remove_cv<T>::type const& type; - }; - - template <typename T> - struct call_param - { - typedef - typename mpl::eval_if< - is_reference<T> - , mpl::identity<T> - , non_ref_parameter<T> - >::type - type; - }; -}}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/detail/config.hpp b/Utilities/BGL/boost/spirit/fusion/detail/config.hpp deleted file mode 100644 index 0113729102221e19212fdb84b9c7dd8e7e1a6c00..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/detail/config.hpp +++ /dev/null @@ -1,442 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_DETAIL_CONFIG_HPP) -#define FUSION_DETAIL_CONFIG_HPP - -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/preprocessor/cat.hpp> -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -#include <boost/mpl/bool.hpp> -#endif - -#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1310)) \ - || (defined(__BORLANDC__) && (__BORLANDC__ <= 0x570)) \ - || (defined(__GNUC__) && (__GNUC__ < 3)) \ - || (defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) -#else -# define FUSION_COMFORMING_COMPILER -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// BOOST_NO_TEMPLATED_STREAMS macro. This ought to be in boost.config -// -/////////////////////////////////////////////////////////////////////////////// -#if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ <= 97 -#define BOOST_NO_TEMPLATED_STREAMS -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// Before including MPL, we define these dummy template functions. Borland -// complains when a template class has the same name as a template function, -// regardless if they are in different namespaces. This is a workaround to -// this Borland quirk. -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) -namespace boost { namespace fusion { namespace borland_only { - - template <typename T> void begin(T) {} - template <typename T> void end(T) {} - template <typename T> void next(T) {} - template <typename T> void prior(T) {} - template <typename T> void find(T) {} - template <typename T> void find_if(T) {} - -}}} -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// MSVC, even with VC7.1 has problems with returning a default constructed -// value of a given type: return type(); This only happens on debug builds. -// It seems to be a return value optimization bug. -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1301) && !defined(NDEBUG) -# define FUSION_RETURN_DEFAULT_CONSTRUCTED type r=type(); return r -#else -# define FUSION_RETURN_DEFAULT_CONSTRUCTED return type() -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// Borland does not like the T::value syntax. Instead, we use a metafunction -// get_value<T>::value. The explicit qualification (::boost::fusion::detail::) -// also makes Borland happy. -// -// VC6/7 on the other hand chokes with ETI (early instantiation bug). So we -// forward the call to get_value<T>::value and fix the ETI bug there (see -// get_value below). -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) \ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) -namespace boost { namespace fusion { namespace detail -{ - template <typename T> - struct get_value - { - BOOST_STATIC_CONSTANT(int, value = T::value); - }; - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - - // VC6 ETI (early template instantiation) bug workaround. - template <> - struct get_value<int> - { - BOOST_STATIC_CONSTANT(int, value = 0); - }; -#endif -}}} -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) \ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) -# define FUSION_GET_VALUE(T) ::boost::fusion::detail::get_value<T>::value -#else -# define FUSION_GET_VALUE(T) T::value -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// Borland does not like returning a const reference from a tuple member. -// We do the cast explicitly. -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) -# define FUSION_RETURN_TUPLE_MEMBER(n) \ - typedef typename tuple_access_result<n, Tuple>::type type; \ - return type(t.BOOST_PP_CAT(m, n)) -#else -# define FUSION_RETURN_TUPLE_MEMBER(n) \ - return t.BOOST_PP_CAT(m, n) -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// See get.hpp. In function get<N>(t), mpl::int_<N>* = 0 is a function -// parameter that defaults to 0. This is a hack to make VC6 happy, otherwise, -// VC6 will return the wrong result from a wrong index! -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# define FUSION_GET_MSVC_WORKAROUND , mpl::int_<N>* = 0 -#else -# define FUSION_GET_MSVC_WORKAROUND -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// FUSION_MSVC_ETI_WRAPPER (VC6 and VC7) -// -// VC6/VC7 chokes with ETI (early instantiation bug) with typename T::name. -// So, we forward the call to get_name<T>::type and fix the ETI bug. -// -/////////////////////////////////////////////////////////////////////////////// - -// VC6 ETI (early template instantiation) bug workaround. -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -#define FUSION_MSVC_ETI_WRAPPER(name) \ -namespace boost { namespace fusion { namespace detail \ -{ \ - template <typename T> \ - struct BOOST_PP_CAT(get_, name) \ - { \ - typedef typename T::name type; \ - }; \ - \ - template <> \ - struct BOOST_PP_CAT(get_, name)<int> \ - { \ - typedef int type; \ - }; \ -}}} -#endif -/* -// is_msvc_70_ETI_arg: Detect a VC7 ETI arg -#if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -namespace boost { namespace fusion { namespace detail -{ - struct int_convertible_ - { - int_convertible_(int); - }; - - template< typename T > - struct is_msvc_70_ETI_arg - { - typedef char (&no_tag)[1]; - typedef char (&yes_tag)[2]; - - static no_tag test(...); - static yes_tag test(int_convertible_); - static T get(); - - BOOST_STATIC_CONSTANT(bool, value = - sizeof(test(get())) == sizeof(yes_tag) - ); - }; -}}} -#endif - -// VC7 ETI (early template instantiation) bug workaround. -#if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -#define FUSION_MSVC_ETI_WRAPPER(name) \ -namespace boost { namespace fusion { namespace detail \ -{ \ - template <bool> \ - struct BOOST_PP_CAT(get_impl_, name) \ - { \ - template <typename T> \ - struct result \ - { \ - typedef int type; \ - }; \ - }; \ - \ - struct BOOST_PP_CAT(get_impl_, name)<false> \ - { \ - template <typename T> \ - struct result \ - { \ - typedef typename T::name type; \ - }; \ - }; \ - \ - template <typename T> \ - struct BOOST_PP_CAT(get_, name) \ - : BOOST_PP_CAT(get_impl_, name)<is_msvc_70_ETI_arg<T>::value> \ - ::template result<T> {}; \ -}}} -#endif -*/ -/////////////////////////////////////////////////////////////////////////////// -// -// T::tag wrapper -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -FUSION_MSVC_ETI_WRAPPER(tag) -# define FUSION_GET_TAG(T) ::boost::fusion::detail::get_tag<T>::type -#else -# define FUSION_GET_TAG(T) typename T::tag -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// T::type wrapper -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -FUSION_MSVC_ETI_WRAPPER(type) -# define FUSION_GET_TYPE(T) ::boost::fusion::detail::get_type<T>::type -#else -# define FUSION_GET_TYPE(T) typename T::type -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// T::types wrapper -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -FUSION_MSVC_ETI_WRAPPER(types) -# define FUSION_GET_TYPES(T) ::boost::fusion::detail::get_types<T>::type -#else -# define FUSION_GET_TYPES(T) typename T::types -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// T::index wrapper -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -FUSION_MSVC_ETI_WRAPPER(index) -# define FUSION_GET_INDEX(T) ::boost::fusion::detail::get_index<T>::type -#else -# define FUSION_GET_INDEX(T) typename T::index -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// T::tuple wrapper -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -FUSION_MSVC_ETI_WRAPPER(tuple) -# define FUSION_GET_TUPLE(T) ::boost::fusion::detail::get_tuple<T>::type -#else -# define FUSION_GET_TUPLE(T) typename T::tuple -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// T::size wrapper -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -FUSION_MSVC_ETI_WRAPPER(size) -# define FUSION_GET_SIZE(T) ::boost::fusion::detail::get_size<T>::type -#else -# define FUSION_GET_SIZE(T) typename T::size -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// T::value_type wrapper -// -/////////////////////////////////////////////////////////////////////////////// -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -FUSION_MSVC_ETI_WRAPPER(value_type) -# define FUSION_GET_VALUE_TYPE(T) ::boost::fusion::detail::get_value_type<T>::type -#else -# define FUSION_GET_VALUE_TYPE(T) typename T::value_type -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - -namespace boost {namespace fusion { namespace aux { -template< typename T > -struct msvc_never_true -{ - enum { value = false }; -}; -}}} //namespace boost::fusion::aux - -#endif - -namespace boost {namespace fusion { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - -namespace aux { - // msvc_apply -#define AUX778076_MSVC_DTW_NAME msvc_apply1 -#define AUX778076_MSVC_DTW_ORIGINAL_NAME apply -#define AUX778076_MSVC_DTW_ARITY 1 -#include "boost/mpl/aux_/msvc_dtw.hpp" - -#define AUX778076_MSVC_DTW_NAME msvc_apply2 -#define AUX778076_MSVC_DTW_ORIGINAL_NAME apply -#define AUX778076_MSVC_DTW_ARITY 2 -#include "boost/mpl/aux_/msvc_dtw.hpp" - -} //namespace aux - -template<typename A,typename B> -struct fusion_apply1 -{ - typedef typename aux::msvc_apply1<A>::template result_<B>::type type; -}; - -template<typename A,typename B,typename C> -struct fusion_apply2 -{ - typedef typename aux::msvc_apply2<A>::template result_<B,C>::type type; -}; - -#else -template<typename A,typename B> -struct fusion_apply1 -{ - typedef typename A::template apply<B>::type type; -}; -template<typename A,typename B,typename C> -struct fusion_apply2 -{ - typedef typename A::template apply<B,C>::type type; -}; -#endif -}} //namespace boost::fusion - -namespace boost {namespace fusion {namespace detail { -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template<typename T> - struct bool_base {}; - template<> - struct bool_base<mpl::bool_<true> > : boost::mpl::bool_<true>{}; - template<> - struct bool_base<mpl::bool_<false> > : boost::mpl::bool_<false>{}; -#else - template<typename T> - struct bool_base : T {}; -#endif -}}} - -//VC 6 has serious problems with mpl::int_ in tuple_iterator_base. -//It ICEs because operator int() const on mpl::int_ is inlined. -//At the same time, another test using integral_c<T,N> ICEs because operator int() is not inlined. -//Only solution seems to be to define a special msvc_fusion_int for VC 6 to be used in tuple_iterator_base -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -namespace boost {namespace fusion {namespace detail{ - -template<int N> -struct msvc_fusion_int -{ - BOOST_STATIC_CONSTANT(int, value = N); - typedef msvc_fusion_int<N> type; - typedef int value_type; - typedef boost::mpl::integral_c_tag tag; - - typedef msvc_fusion_int<value + 1> next; - typedef msvc_fusion_int<value - 1> prior; - - operator int() const; -}; - -template<int N> -msvc_fusion_int<N>::operator int() const -{ - return static_cast<int>(this->value); -} - -}}} -#define FUSION_INT(N) boost::fusion::detail::msvc_fusion_int<N> -#else -#define FUSION_INT(N) boost::mpl::int_<N> -#endif - - - -/////////////////////////////////////////////////////////////////////////////// -// -// Borland is so flaky with const correctness of iterators. It's getting -// confused with tuple_iterator<N, T> where T is a const tuple. We cast -// what Borland thinks is a const reference to a true reference. -// -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace fusion { namespace detail -{ -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) - - template <typename T> - T& ref(T const& r) - { - return const_cast<T&>(r); - } - -#else - - template <typename T> - T& ref(T& r) - { - return r; - } - -#endif - -}}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/as_fusion_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/as_fusion_iterator.hpp deleted file mode 100644 index 28c00a2c9aaabd1f7f25ed86d514337e3514758e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/as_fusion_iterator.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_AS_FUSION_ITERATOR_HPP) -#define FUSION_SEQUENCE_AS_FUSION_ITERATOR_HPP - -#include <boost/spirit/fusion/iterator/is_iterator.hpp> -#include <boost/spirit/fusion/iterator/type_sequence_iterator.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/bool.hpp> - -namespace boost { namespace fusion -{ - // Test T. If it is a fusion iterator, return a reference to it. - // else, assume it is an mpl iterator. - - namespace as_fusion_iterator_detail { - template <typename T> - static T const& - convert(T const& x, mpl::true_) - { - return x; - } - - template <typename T> - static type_sequence_iterator<T> - convert(T const& x, mpl::false_) - { - return type_sequence_iterator<T>(); - } - } - - template <typename T> - struct as_fusion_iterator - { - typedef typename - mpl::if_< - fusion::is_iterator<T> - , T - , type_sequence_iterator<T> - >::type - type; - - static typename - mpl::if_< - fusion::is_iterator<T> - , T const& - , type_sequence_iterator<T> - >::type - convert(T const& x); - }; - - template <typename T> - typename - mpl::if_< - fusion::is_iterator<T> - , T const& - , type_sequence_iterator<T> - >::type - as_fusion_iterator<T>::convert(T const& x) - { - return as_fusion_iterator_detail::convert(x, fusion::is_iterator<T>()); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/cons_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/cons_iterator.hpp deleted file mode 100644 index 9df62d5ca84254590aeb280d3df796c8c7b695e2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/cons_iterator.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_CONS_ITERATOR_HPP) -#define FUSION_ITERATOR_CONS_ITERATOR_HPP - -#include <boost/mpl/aux_/na_fwd.hpp> -#include <boost/mpl/iterator_tags.hpp> -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/iterator/detail/cons_iterator/deref_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/cons_iterator/next_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/cons_iterator/value_traits.hpp> - -namespace boost { namespace fusion -{ - struct nil; - - struct cons_iterator_tag; - - template <typename Cons = nil> - struct cons_iterator : iterator_base<cons_iterator<Cons> > - { - typedef cons_iterator_tag tag; - typedef Cons cons_type; - typedef mpl::forward_iterator_tag category; - - #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - typedef typename cons_detail::next_traits_impl<cons_iterator>::type next; - typedef typename cons_detail::value_traits_impl<cons_iterator>::type type; - #endif - - explicit cons_iterator(cons_type& cons_) - : cons(cons_) {} - - cons_type& cons; - private: - cons_iterator& operator=(cons_iterator const&); - }; - - template <> - struct cons_iterator<nil> : iterator_base<cons_iterator<nil> > - { - typedef cons_iterator_tag tag; - typedef nil cons_type; - typedef mpl::forward_iterator_tag category; - - #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - typedef cons_iterator next; - typedef mpl::na type; - #endif - - cons_iterator() {} - explicit cons_iterator(nil const&) {} - }; - - template <> - struct cons_iterator<nil const> : iterator_base<cons_iterator<nil const> > - { - typedef cons_iterator_tag tag; - typedef nil const cons_type; - typedef mpl::forward_iterator_tag category; - - #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - typedef cons_iterator next; - typedef mpl::na type; - #endif - - cons_iterator() {} - explicit cons_iterator(nil const&) {} - }; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/deref.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/deref.hpp deleted file mode 100644 index e1db673275d40234616fd2c4ab2066f701c8a393..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/deref.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DEREF_HPP) -#define FUSION_ITERATOR_DEREF_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> -#include <boost/butility/enable_if.hpp> -#include <boost/type_traits/is_const.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct deref_impl - { - template <typename Iterator> - struct apply {}; - }; - - template <typename Iterator> - struct deref - { - typedef as_fusion_iterator<Iterator> converter; - typedef typename converter::type iter; - - typedef typename - deref_impl<FUSION_GET_TAG(iter)>:: - template apply<iter>::type - type; - }; - } - - namespace deref_detail { - template <typename Iterator> - typename meta::deref<Iterator>::type - deref(Iterator const& i,mpl::true_) - { - typedef as_fusion_iterator<Iterator> converter; - typedef typename converter::type iter; - - typename meta::deref<iter>::type result = - meta::deref_impl<FUSION_GET_TAG(iter)>:: - template apply<iter>::call(converter::convert(i)); - return result; - } - - template <typename Iterator> - inline typename meta::deref<Iterator>::type - deref(Iterator& i,mpl::false_) - { - typedef as_fusion_iterator<Iterator> converter; - typedef typename converter::type iter; - - typename meta::deref<iter>::type result = - meta::deref_impl<FUSION_GET_TAG(iter)>:: - template apply<iter>::call(converter::convert(i)); - return result; - } - } - - template <typename Iterator> - typename meta::deref<Iterator>::type - deref(Iterator& i) { - return deref_detail::deref(i,is_const<Iterator>()); - } - - template <typename Iterator> - typename meta::deref<Iterator>::type - deref(Iterator const & i) { - return deref_detail::deref(i,is_const<Iterator const>()); - } - - template <typename Iterator> - typename meta::deref<Iterator>::type - operator*(iterator_base<Iterator> const& i) - { - return fusion::deref(i.cast()); - } - - template <typename Iterator> - inline typename meta::deref<Iterator>::type - operator*(iterator_base<Iterator>& i) - { - return fusion::deref(i.cast()); - } - - // Note: VC7.1 has a problem when we pass the return value directly. - // Try removing the named temporary. This only happens on debug builds. - // It seems to be a return value optimization bug. -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/adapt_deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/adapt_deref_traits.hpp deleted file mode 100644 index d0231411c50b54a6058c83bcc633ff1ed0025d39..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/adapt_deref_traits.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ADAPT_DEREF_TRAITS_HPP) -#define FUSION_ADAPT_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/iterator/deref.hpp> - -namespace boost { namespace fusion { namespace detail -{ - namespace adapt_deref_detail { - template<typename Iterator> - struct deref_traits_impl - { - typedef typename - meta::deref<typename Iterator::first_type>::type - type; - - static type - call(Iterator const& i); - }; - - template<typename Iterator> - typename deref_traits_impl<Iterator>::type - deref_traits_impl<Iterator>::call(Iterator const& i) - { - return *i.first; - } - } - struct adapt_deref_traits { - template<typename Iterator> - struct apply : adapt_deref_detail::deref_traits_impl<Iterator> - {}; - }; - -}}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/adapt_value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/adapt_value_traits.hpp deleted file mode 100644 index 6a0001b0632dd95b2cdb5fe624c37bc42b014d4c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/adapt_value_traits.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ADAPT_VALUE_TRAITS_HPP) -#define FUSION_ADAPT_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/iterator/value_of.hpp> - -namespace boost { namespace fusion { namespace detail -{ - struct adapt_value_traits - { - template <typename Iterator> - struct apply - { - typedef typename - meta::value_of<typename Iterator::first_type>::type - type; - }; - }; -}}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/deref_traits.hpp deleted file mode 100644 index b182bf5103a7621e15103b65b419a697211b8328..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/deref_traits.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_CONS_ITERATOR_DEREF_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_CONS_ITERATOR_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/type_traits/is_const.hpp> -#include <boost/type_traits/add_const.hpp> -#include <boost/type_traits/add_reference.hpp> - -namespace boost { namespace fusion -{ - struct cons_iterator_tag; - - namespace cons_detail - { - template <typename Iterator> - struct deref_traits_impl - { - typedef typename Iterator::cons_type cons_type; - typedef typename cons_type::car_type value_type; - - typedef typename mpl::eval_if< - is_const<cons_type> - , add_reference<typename add_const<value_type>::type> - , add_reference<value_type> >::type - type; - - static type - call(Iterator const& i) - { - return detail::ref(i.cons.car); - } - }; - } - - namespace meta - { - template <typename Tag> - struct deref_impl; - - template <> - struct deref_impl<cons_iterator_tag> - { - template <typename Iterator> - struct apply : cons_detail::deref_traits_impl<Iterator> {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/next_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/next_traits.hpp deleted file mode 100644 index 353f4b2147f517152ed7e150f1960a71775d04bb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/next_traits.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_CONS_ITERATOR_NEXT_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_CONS_ITERATOR_NEXT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/type_traits/is_const.hpp> -#include <boost/type_traits/add_const.hpp> - -namespace boost { namespace fusion -{ - struct cons_iterator_tag; - - template <typename Cons> - struct cons_iterator; - - namespace cons_detail - { - template <typename Iterator> - struct next_traits_impl - { - typedef typename Iterator::cons_type cons_type; - typedef typename cons_type::cdr_type cdr_type; - - typedef cons_iterator< - typename mpl::eval_if< - is_const<cons_type> - , add_const<cdr_type> - , mpl::identity<cdr_type> - >::type> - type; - - static type - call(Iterator const& i) - { - return type(detail::ref(i.cons.cdr)); - } - }; - } - - namespace meta - { - template <typename Tag> - struct next_impl; - - template <> - struct next_impl<cons_iterator_tag> - { - template <typename Iterator> - struct apply : cons_detail::next_traits_impl<Iterator> {}; - }; - } -}} - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -namespace boost { namespace mpl -{ - template <typename Iterator> - struct next; - - template <typename Cons> - struct next<fusion::cons_iterator<Cons> > - : fusion::cons_detail::next_traits_impl<fusion::cons_iterator<Cons> > - { - }; -}} - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/value_traits.hpp deleted file mode 100644 index 33bd27ddb332e8be2ffc2bbb42b6dd4876269337..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/cons_iterator/value_traits.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_CONS_ITERATOR_VALUE_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_CONS_ITERATOR_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct cons_iterator_tag; - - namespace cons_detail - { - template <typename Iterator> - struct value_traits_impl - { - typedef typename Iterator::cons_type cons_type; - typedef typename cons_type::car_type type; - }; - } - - namespace meta - { - template <typename Tag> - struct value_impl; - - template <> - struct value_impl<cons_iterator_tag> - { - template <typename Iterator> - struct apply : cons_detail::value_traits_impl<Iterator> {}; - }; - } - -}} - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -namespace boost { namespace mpl -{ - template <typename Iterator> - struct deref; - - template <typename Cons> - struct deref<fusion::cons_iterator<Cons> > - : fusion::cons_detail::value_traits_impl<fusion::cons_iterator<Cons> > - { - }; -}} - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/deref_traits.hpp deleted file mode 100644 index 7205162b02c75c3f5a8896affa05f33acd8a7ffb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/deref_traits.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_FILTER_VIEW_ITERATOR_DEREF_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_FILTER_VIEW_ITERATOR_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/detail/adapt_deref_traits.hpp> - -namespace boost { namespace fusion -{ - struct filter_view_iterator_tag; - - namespace meta - { - template <typename Tag> - struct deref_impl; - - template <> - struct deref_impl<filter_view_iterator_tag> : detail::adapt_deref_traits - {}; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/next_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/next_traits.hpp deleted file mode 100644 index 8e26b89aaa45d5c05206234e0e4ec57ae8ece451..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/next_traits.hpp +++ /dev/null @@ -1,77 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_FILTER_VIEW_ITERATOR_NEXT_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_FILTER_VIEW_ITERATOR_NEXT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/algorithm/detail/find_if.ipp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> - -namespace boost { namespace fusion -{ - struct filter_view_iterator_tag; - - template <typename First, typename Last, typename Pred> - struct filter_iterator; - - namespace filter_view_detail { - template<typename Iterator> - struct next_traits_impl { - typedef typename Iterator::first_type first_type; - typedef typename Iterator::last_type last_type; - typedef typename Iterator::pred_type pred_type; - - typedef typename - mpl::eval_if< - meta::equal_to<first_type, last_type> - , mpl::identity<last_type> - , meta::next<first_type> - >::type - next_type; - - typedef typename detail::static_find_if< - next_type, last_type, pred_type> - filter; - - typedef filter_iterator< - typename filter::type, last_type, pred_type> - type; - - static type - call(Iterator const& i); - }; - template<typename Iterator> - typename next_traits_impl<Iterator>::type - next_traits_impl<Iterator>::call(Iterator const& i) - { - return type(filter::call(i.first)); - } - } - - namespace meta - { - template <typename Tag> - struct next_impl; - - template <> - struct next_impl<filter_view_iterator_tag> - { - template <typename Iterator> - struct apply : filter_view_detail::next_traits_impl<Iterator> - {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/value_traits.hpp deleted file mode 100644 index 94e1d27f494912f715d28768d119d5c1d1555ce2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/filter_view_iterator/value_traits.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_FILTER_VIEW_ITERATOR_VALUE_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_FILTER_VIEW_ITERATOR_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/detail/adapt_value_traits.hpp> - -namespace boost { namespace fusion -{ - struct filter_view_iterator_tag; - - namespace meta - { - template <typename Tag> - struct value_impl; - - template <> - struct value_impl<filter_view_iterator_tag> - : detail::adapt_value_traits {}; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/iterator_base.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/iterator_base.hpp deleted file mode 100644 index 7ab9301ce8570be6451bf7d337b3dc670de476b1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/iterator_base.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_ITERATOR_BASE_HPP) -#define FUSION_ITERATOR_DETAIL_ITERATOR_BASE_HPP - -namespace boost { namespace fusion -{ - struct iterator_root {}; - - template <typename Iterator> - struct iterator_base : iterator_root - { - Iterator const& - cast() const; - - Iterator& - cast(); - }; - - template <typename Iterator> - Iterator const& - iterator_base<Iterator>::cast() const - { - return static_cast<Iterator const&>(*this); - } - - template <typename Iterator> - Iterator& - iterator_base<Iterator>::cast() - { - return static_cast<Iterator&>(*this); - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/deref_traits.hpp deleted file mode 100644 index 8738365a7302f23db308e128270cd7ed3e2ab78f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/deref_traits.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_JOINT_VIEW_ITERATOR_DEREF_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_JOINT_VIEW_ITERATOR_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/detail/adapt_deref_traits.hpp> - -namespace boost { namespace fusion -{ - struct joint_view_iterator_tag; - - namespace meta - { - template <typename Tag> - struct deref_impl; - - template <> - struct deref_impl<joint_view_iterator_tag> - : detail::adapt_deref_traits {}; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/next_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/next_traits.hpp deleted file mode 100644 index 339c40ac3c00ad9e0f587523b41cbb5c03e99f9f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/next_traits.hpp +++ /dev/null @@ -1,88 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_JOINT_VIEW_ITERATOR_NEXT_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_JOINT_VIEW_ITERATOR_NEXT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/mpl/if.hpp> - -namespace boost { namespace fusion -{ - struct joint_view_iterator_tag; - - template <typename View1, typename View2> - struct joint_view; - - template <typename First, typename Last, typename Concat> - struct joint_view_iterator; - - namespace join_view_detail { - template<typename Iterator> - struct next_traits_impl { - typedef typename Iterator::first_type first_type; - typedef typename Iterator::last_type last_type; - typedef typename Iterator::concat_type concat_type; - typedef typename meta::next<first_type>::type next_type; - typedef meta::equal_to<next_type, last_type> equal_to; - - typedef typename - mpl::if_< - equal_to - , concat_type - , joint_view_iterator<next_type, last_type, concat_type> - >::type - type; - - static type - call(Iterator const& i); - }; - - template<typename Iterator> - typename next_traits_impl<Iterator>::type - call(Iterator const& i, mpl::true_) - { - return i.concat; - } - - template<typename Iterator> - typename next_traits_impl<Iterator>::type - call(Iterator const& i, mpl::false_) - { - typedef typename next_traits_impl<Iterator>::type type; - return type(fusion::next(i.first), i.concat); - } - - template<typename Iterator> - typename next_traits_impl<Iterator>::type - next_traits_impl<Iterator>::call(Iterator const& i) - { - return join_view_detail::call(i, equal_to()); - } - } - - namespace meta - { - template <typename Tag> - struct next_impl; - - template <> - struct next_impl<joint_view_iterator_tag> - { - template <typename Iterator> - struct apply : join_view_detail::next_traits_impl<Iterator> - {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/value_traits.hpp deleted file mode 100644 index ed6431efd0f7df58bde339bc4e740db4bf950220..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/joint_view_iterator/value_traits.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_JOINT_VIEW_ITERATOR_VALUE_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_JOINT_VIEW_ITERATOR_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/detail/adapt_value_traits.hpp> - -namespace boost { namespace fusion -{ - struct joint_view_iterator_tag; - - namespace meta - { - template <typename Tag> - struct value_impl; - - template <> - struct value_impl<joint_view_iterator_tag> - : detail::adapt_value_traits {}; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/deref_traits.hpp deleted file mode 100644 index ac5b69b2255378a334df521ec2a2454eede03dc9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/deref_traits.hpp +++ /dev/null @@ -1,72 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_SINGLE_VIEW_ITERATOR_DEREF_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_SINGLE_VIEW_ITERATOR_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/mpl/identity.hpp> - -namespace boost { namespace fusion -{ - namespace detail - { - template <typename SingleView> - struct single_view_access_result - { - typedef typename - mpl::eval_if< - is_const<SingleView> - , cref_result<mpl::identity<FUSION_GET_VALUE_TYPE(SingleView)> > - , ref_result<mpl::identity<FUSION_GET_VALUE_TYPE(SingleView)> > - >::type - type; - }; - } - - namespace single_view_iterator_detail - { - template <typename Iterator> - struct deref_traits_impl - { - typedef typename Iterator::single_view_type single_view_type; - typedef typename detail::single_view_access_result< - single_view_type>::type - type; - - static type - call(Iterator const& i); - }; - - template <typename Iterator> - inline typename deref_traits_impl<Iterator>::type - deref_traits_impl<Iterator>::call(Iterator const& i) - { - return detail::ref(i.view.val); - } - } - - struct single_view_iterator_tag; - - namespace meta - { - template <typename Tag> - struct deref_impl; - - template <> - struct deref_impl<single_view_iterator_tag> - { - template <typename Iterator> - struct apply : single_view_iterator_detail::deref_traits_impl<Iterator> {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/next_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/next_traits.hpp deleted file mode 100644 index 46521b456fc554e0a8a2e40a7cfdc401e8bfba17..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/next_traits.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_SINGLE_VIEW_ITERATOR_NEXT_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_SINGLE_VIEW_ITERATOR_NEXT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct single_view_iterator_tag; - - template <typename SingleView> - struct single_view_iterator_end; - - template <typename SingleView> - struct single_view_iterator; - - namespace single_view_detail - { - template<typename Iterator> - struct next_traits_impl - { - typedef single_view_iterator_end< - typename Iterator::single_view_type> - type; - - static type - call(Iterator); - }; - - template<typename Iterator> - typename next_traits_impl<Iterator>::type - next_traits_impl<Iterator>::call(Iterator) - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - } - - namespace meta - { - template <typename Tag> - struct next_impl; - - template <> - struct next_impl<single_view_iterator_tag> - { - template <typename Iterator> - struct apply : single_view_detail::next_traits_impl<Iterator> - {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/value_traits.hpp deleted file mode 100644 index 86520cd9f8aebb636b1a7ee2a696880240ce9450..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/single_view_iterator/value_traits.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_SINGLE_VIEW_ITERATOR_VALUE_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_SINGLE_VIEW_ITERATOR_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct single_view_iterator_tag; - - namespace meta - { - template <typename Tag> - struct value_impl; - - template <> - struct value_impl<single_view_iterator_tag> - { - template <typename Iterator> - struct apply - { - typedef typename Iterator::single_view_type single_view_type; - typedef FUSION_GET_VALUE_TYPE(single_view_type) type; - }; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/deref_traits.hpp deleted file mode 100644 index e481cf13fc96bc5ad1a9187732f55b7ce2504e16..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/deref_traits.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_DEREF_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/value_of.hpp> - -namespace boost { namespace fusion -{ - struct transform_view_iterator_tag; - - namespace transform_view_detail { - template<typename Iterator> - struct deref_traits_impl { - typedef typename - meta::value_of<typename Iterator::first_type>::type - value_type; - - typedef typename Iterator::transform_type transform_type; - typedef typename fusion_apply1<transform_type, value_type>::type type; - - static type - call(Iterator const& i); - }; - - template<typename Iterator> - BOOST_DEDUCED_TYPENAME deref_traits_impl<Iterator>::type - deref_traits_impl<Iterator>::call(Iterator const& i) - { - return i.f(*i.first); - } - } - - namespace meta - { - template <typename Tag> - struct deref_impl; - - template <> - struct deref_impl<transform_view_iterator_tag> - { - template <typename Iterator> - struct apply : transform_view_detail::deref_traits_impl<Iterator> - {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/next_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/next_traits.hpp deleted file mode 100644 index cdf1b0a5ba65f2f6a1c44fc227963c18f100f914..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/next_traits.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_NEXT_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_NEXT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> - -namespace boost { namespace fusion -{ - struct transform_view_iterator_tag; - - template <typename First, typename F> - struct transform_view_iterator; - - namespace transform_view_detail { - template <typename Iterator> - struct next_traits_impl - { - typedef typename Iterator::first_type first_type; - typedef typename meta::next<first_type>::type next_type; - typedef typename Iterator::transform_type transform_type; - typedef transform_view_iterator<next_type, transform_type> type; - - static type - call(Iterator const& i); - }; - template <typename Iterator> - typename next_traits_impl<Iterator>::type - next_traits_impl<Iterator>::call(Iterator const& i) - { - return type(fusion::next(i.first), i.f); - } - } - - namespace meta - { - template <typename Tag> - struct next_impl; - - template <> - struct next_impl<transform_view_iterator_tag> - { - template <typename Iterator> - struct apply : transform_view_detail::next_traits_impl<Iterator> - {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/value_traits.hpp deleted file mode 100644 index 94e959b886391bfe68ec82a891c077926208b6aa..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/transform_view_iterator/value_traits.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_VALUE_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TRANSFORM_VIEW_ITERATOR_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/detail/adapt_value_traits.hpp> -#include <boost/spirit/fusion/iterator/value_of.hpp> - -namespace boost { namespace fusion -{ - struct transform_view_iterator_tag; - - namespace meta - { - template <typename Tag> - struct value_impl; - - template <> - struct value_impl<transform_view_iterator_tag> - { - template <typename Iterator> - struct apply - { - typedef typename - meta::value_of<typename Iterator::first_type>::type - value_type; - - typedef typename Iterator::transform_type transform_type; - typedef typename fusion_apply1<transform_type,value_type>::type type; - }; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/deref_traits.hpp deleted file mode 100644 index 5002c9ee04c484f43b29da95e597c5ca4ad151af..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/deref_traits.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_DEREF_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp> - -namespace boost { namespace fusion -{ - struct tuple_iterator_tag; - - namespace detail - { - template <int N> - struct tuple_access; - } - - namespace tuple_iterator_detail - { - template <typename Iterator> - struct deref_traits_impl - { - typedef FUSION_GET_INDEX(Iterator) index; - typedef FUSION_GET_TUPLE(Iterator) tuple_; - - typedef BOOST_DEDUCED_TYPENAME - boost::fusion::detail::tuple_access_result< - tuple_, FUSION_GET_VALUE(index)>::type - type; - - static type - call(Iterator const& i); - }; - - template <typename Iterator> - inline typename deref_traits_impl<Iterator>::type - deref_traits_impl<Iterator>::call(Iterator const& i) - { - return detail::tuple_access<FUSION_GET_VALUE(index)> - ::get(detail::ref(i.get_tuple())); - } - } - - namespace meta - { - template <typename Tag> - struct deref_impl; - - template <> - struct deref_impl<tuple_iterator_tag> - { - template <typename Iterator> - struct apply : - tuple_iterator_detail::deref_traits_impl<Iterator> {}; - }; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/equal_to_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/equal_to_traits.hpp deleted file mode 100644 index 27dfc3434e4b86a4dceef2d9316a4b19eb9d4b5b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/equal_to_traits.hpp +++ /dev/null @@ -1,71 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_EQUAL_TO_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_EQUAL_TO_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/mpl/equal_to.hpp> -#include <boost/mpl/and.hpp> - -namespace boost { namespace fusion -{ - struct tuple_iterator_tag; - - namespace detail - { - template <typename I1, typename I2> - struct has_same_tags - : is_same<FUSION_GET_TAG(I1), FUSION_GET_TAG(I2)> {}; - - template <typename I1, typename I2> - struct has_same_index - : mpl::equal_to<FUSION_GET_INDEX(I1), FUSION_GET_INDEX(I2)>::type {}; - - template <typename I> - struct tuple_identity - { - typedef typename I::tuple tuple_type; - typedef typename tuple_type::identity_type type; - }; - - template <typename I1, typename I2> - struct has_same_tuple_identity - : is_same< - typename tuple_identity<I1>::type - , typename tuple_identity<I2>::type - > - {}; - - template <typename I1, typename I2> - struct tuple_iterator_equal_to - : mpl::and_< - has_same_index<I1, I2> - , has_same_tuple_identity<I1, I2> - > - { - BOOST_STATIC_ASSERT((has_same_tags<I1, I2>::value)); - }; - } - - namespace meta - { - template <typename Tag> - struct equal_to_impl; - - template <> - struct equal_to_impl<tuple_iterator_tag> - { - template <typename I1, typename I2> - struct apply : detail::tuple_iterator_equal_to<I1, I2> {}; - }; - } -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/next_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/next_traits.hpp deleted file mode 100644 index ead1e624767c5d7d7b862d829f7e23a5111773d2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/next_traits.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_NEXT_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_NEXT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/static_assert.hpp> -#include <boost/mpl/next.hpp> -#include <boost/mpl/less.hpp> - -namespace boost { namespace fusion -{ - struct tuple_iterator_tag; - - template <int N, typename Tuple> - struct tuple_iterator; - - namespace detail - { - template <typename Iterator> - struct tuple_iterator_next_traits_impl - { - typedef FUSION_GET_INDEX(Iterator) index; - typedef FUSION_GET_TUPLE(Iterator) tuple_; - typedef FUSION_GET_SIZE(tuple_) size; -#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) - BOOST_STATIC_ASSERT((::boost::mpl::less<index, size>::value)); -#endif - typedef typename mpl::next<index>::type next; - typedef tuple_iterator<FUSION_GET_VALUE(next), tuple_> type; - - static type - call(Iterator const& i); - }; - - template <typename Iterator> - inline typename tuple_iterator_next_traits_impl<Iterator>::type - tuple_iterator_next_traits_impl<Iterator>::call(Iterator const& i) - { - return type(detail::ref(i.get_tuple())); - } - } - - namespace meta - { - template <typename Tag> - struct next_impl; - - template <> - struct next_impl<tuple_iterator_tag> - { - template <typename Iterator> - struct apply : detail::tuple_iterator_next_traits_impl<Iterator> {}; - }; - } -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/prior_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/prior_traits.hpp deleted file mode 100644 index ac1ca17dbcd7aa5eed6bf82b509d9de29a6c6f0c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/prior_traits.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_PRIOR_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_PRIOR_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/static_assert.hpp> -#include <boost/mpl/prior.hpp> -#include <boost/mpl/greater_equal.hpp> -#include <boost/mpl/int.hpp> - -namespace boost { namespace fusion -{ - struct tuple_iterator_tag; - - template <int N, typename Tuple> - struct tuple_iterator; - - namespace detail - { - template <typename Iterator> - struct tuple_iterator_prior_traits_impl - { - typedef FUSION_GET_INDEX(Iterator) index; - typedef FUSION_GET_TUPLE(Iterator) tuple_; - typedef FUSION_INT(0) other_index; -#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) - BOOST_STATIC_ASSERT(( - ::boost::mpl::greater_equal<index, other_index >::value)); -#endif - typedef typename mpl::prior<index>::type prior; - typedef tuple_iterator<FUSION_GET_VALUE(prior), tuple_> type; - - static type - call(Iterator const& i); - }; - - template <typename Iterator> - inline typename tuple_iterator_prior_traits_impl<Iterator>::type - tuple_iterator_prior_traits_impl<Iterator>::call(Iterator const& i) - { - return type(detail::ref(i.get_tuple())); - } - } - - namespace meta - { - template <typename Tag> - struct prior_impl; - - template <> - struct prior_impl<tuple_iterator_tag> - { - template <typename Iterator> - struct apply : detail::tuple_iterator_prior_traits_impl<Iterator> {}; - }; - } -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/value_traits.hpp deleted file mode 100644 index 1b5fca4d482ce5b24e0f49167b1de107c094d3cc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/tuple_iterator/value_traits.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_VALUE_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/tuple_element.hpp> - -namespace boost { namespace fusion -{ - struct tuple_iterator_tag; - - namespace detail - { - template <int N> - struct tuple_access; - } - - namespace detail - { - template <typename Iterator> - struct tuple_iterator_value_traits_impl - { - typedef FUSION_GET_INDEX(Iterator) index; - typedef FUSION_GET_TUPLE(Iterator) tuple_; - - typedef BOOST_DEDUCED_TYPENAME - tuple_element< - FUSION_GET_VALUE(index), tuple_>::type - type; - }; - } - - namespace meta - { - template <typename Tag> - struct value_impl; - - template <> - struct value_impl<tuple_iterator_tag> - { - template <typename Iterator> - struct apply : detail::tuple_iterator_value_traits_impl<Iterator> {}; - }; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/deref_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/deref_traits.hpp deleted file mode 100644 index 3f43ecaf48ce57e49761868a29842479c98806d3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/deref_traits.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TYPE_SEQUENCE_ITERATOR_DEREF_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TYPE_SEQUENCE_ITERATOR_DEREF_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/mpl/deref.hpp> - -namespace boost { namespace fusion -{ - namespace type_sequence_iterator_detail - { - template <typename Iterator> - struct deref_traits_impl - { - typedef typename mpl::deref< - typename Iterator::iterator_type>::type - type; - - static type - call(Iterator); - }; - - template <typename Iterator> - inline typename deref_traits_impl<Iterator>::type - deref_traits_impl<Iterator>::call(Iterator) - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - } - - struct type_sequence_iterator_tag; - - namespace meta - { - template <typename Tag> - struct deref_impl; - - template <> - struct deref_impl<type_sequence_iterator_tag> - { - template <typename Iterator> - struct apply - : type_sequence_iterator_detail::deref_traits_impl<Iterator> {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/next_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/next_traits.hpp deleted file mode 100644 index 66e60ea41886d7cd003dcc28e61503703716ec24..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/next_traits.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TYPE_SEQUENCE_ITERATOR_NEXT_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TYPE_SEQUENCE_ITERATOR_NEXT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/mpl/next.hpp> - -namespace boost { namespace fusion -{ - struct type_sequence_iterator_tag; - - template <typename Iterator> - struct type_sequence_iterator; - - namespace type_sequence_detail { - template <typename Iterator> - struct next_traits_impl - { - typedef type_sequence_iterator< - typename mpl::next<typename Iterator::iterator_type>::type - > type; - - static type - call(Iterator); - }; - - template <typename Iterator> - typename next_traits_impl<Iterator>::type - next_traits_impl<Iterator>::call(Iterator) - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - } - - namespace meta - { - template <typename Tag> - struct next_impl; - - template <> - struct next_impl<type_sequence_iterator_tag> - { - template <typename Iterator> - struct apply : type_sequence_detail::next_traits_impl<Iterator> - {}; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/value_traits.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/value_traits.hpp deleted file mode 100644 index 4268b19cf65976e9a0251c2c4932243100537fc0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/detail/type_sequence_iterator/value_traits.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_DETAIL_TYPE_SEQUENCE_ITERATOR_VALUE_TRAITS_HPP) -#define FUSION_ITERATOR_DETAIL_TYPE_SEQUENCE_ITERATOR_VALUE_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/mpl/deref.hpp> - -namespace boost { namespace fusion -{ - struct type_sequence_iterator_tag; - - namespace meta - { - template <typename Tag> - struct value_impl; - - template <> - struct value_impl<type_sequence_iterator_tag> - { - template <typename Iterator> - struct apply - { - typedef typename mpl::deref< - typename Iterator::iterator_type>::type - type; - }; - }; - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/equal_to.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/equal_to.hpp deleted file mode 100644 index 5daf835c4b5c1ebadf023cd623d17bfec4765f98..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/equal_to.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_EQUAL_TO_HPP) -#define FUSION_ITERATOR_EQUAL_TO_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/add_const.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct equal_to_impl - { - template <typename I1, typename I2> - struct apply - { - typedef typename - is_same< - typename add_const<I1>::type - , typename add_const<I2>::type - >::type - type; - BOOST_STATIC_CONSTANT(bool, value = FUSION_GET_VALUE(type)); - }; - }; - - template <typename I1, typename I2> - struct equal_to - : detail::bool_base< - typename equal_to_impl<typename as_fusion_iterator<I1>::type::tag>:: - template apply< - typename as_fusion_iterator<I1>::type - , typename as_fusion_iterator<I2>::type - >::type - > {}; - } -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/filter_view_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/filter_view_iterator.hpp deleted file mode 100644 index 6b73bed7dd7e75c417d92342ff4e855a6ee39c0b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/filter_view_iterator.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_FILTER_VIEW_ITERATOR_HPP) -#define FUSION_ITERATOR_FILTER_VIEW_ITERATOR_HPP - -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/iterator/detail/filter_view_iterator/deref_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/filter_view_iterator/next_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/filter_view_iterator/value_traits.hpp> -#include <boost/spirit/fusion/algorithm/detail/find_if.ipp> - -namespace boost { namespace fusion -{ - struct filter_view_iterator_tag; - - template <typename First, typename Last, typename Pred> - struct filter_iterator : iterator_base<filter_iterator<First, Last, Pred> > - { - typedef as_fusion_iterator<First> first_converter; - typedef typename first_converter::type first_iter; - typedef as_fusion_iterator<Last> last_converter; - typedef typename last_converter::type last_iter; - - typedef filter_view_iterator_tag tag; - typedef detail::static_find_if<first_iter, last_iter, Pred> filter; - typedef typename filter::type first_type; - typedef last_iter last_type; - typedef Pred pred_type; - - filter_iterator(First const& first); - - first_type first; - }; - - template <typename First, typename Last, typename Pred> - filter_iterator<First,Last,Pred>::filter_iterator(First const& first) - : first(filter::call(first_converter::convert(first))) - {} -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/is_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/is_iterator.hpp deleted file mode 100644 index b0376efe4773ce0e2f7e26a9b9a3ca71641c3c18..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/is_iterator.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_IS_ITERATOR_HPP) -#define FUSION_ITERATOR_IS_ITERATOR_HPP - -#include <boost/type_traits/is_base_and_derived.hpp> - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // - // is_iterator metafunction - // - // Given a type T, returns a value true or false if T is a - // fusion iterator or not. Usage: - // - // is_iterator<T>::value - // - /////////////////////////////////////////////////////////////////////////// - struct iterator_root; - - template <typename T> - struct is_iterator : is_base_and_derived<iterator_root, T> {}; - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/joint_view_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/joint_view_iterator.hpp deleted file mode 100644 index 031e2c3107c844eca1580b3a8dd23512ef6e9b9c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/joint_view_iterator.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_JOINT_VIEW_ITERATOR_HPP) -#define FUSION_ITERATOR_JOINT_VIEW_ITERATOR_HPP - -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/iterator/detail/joint_view_iterator/deref_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/joint_view_iterator/next_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/joint_view_iterator/value_traits.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion -{ - struct joint_view_iterator_tag; - - template <typename First, typename Last, typename Concat> - struct joint_view_iterator - : iterator_base<joint_view_iterator<First, Last, Concat> > - { - typedef as_fusion_iterator<First> first_converter; - typedef as_fusion_iterator<Last> last_converter; - typedef as_fusion_iterator<Concat> concat_converter; - - typedef typename first_converter::type first_type; - typedef typename last_converter::type last_type; - typedef typename concat_converter::type concat_type; - - typedef joint_view_iterator_tag tag; -#if! BOOST_WORKAROUND(BOOST_MSVC,<=1300) - BOOST_STATIC_ASSERT((!meta::equal_to<first_type, last_type>::value)); -#endif - joint_view_iterator(First const& first, Concat const& concat); - - first_type first; - concat_type concat; - }; - template <typename First, typename Last, typename Concat> - joint_view_iterator<First,Last,Concat>::joint_view_iterator(First const& first, Concat const& concat) - : first(first_converter::convert(first)) - , concat(concat_converter::convert(concat)) - {} - - -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/next.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/next.hpp deleted file mode 100644 index 676257816cadf29c0707321f76341ef24a50a3db..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/next.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_NEXT_HPP) -#define FUSION_ITERATOR_NEXT_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct next_impl - { - template <typename Iterator> - struct apply - { - // VC6 needs this - typedef int type; - }; - }; - - template <typename Iterator> - struct next - { - typedef as_fusion_iterator<Iterator> converter; - typedef typename converter::type iter; - - typedef typename - next_impl<FUSION_GET_TAG(iter)>:: - template apply<iter>::type - type; - }; - } - - template <typename Iterator> - inline typename meta::next<Iterator>::type - next(Iterator const& i) - { - typedef as_fusion_iterator<Iterator> converter; - typedef typename converter::type iter; - - return meta::next_impl<FUSION_GET_TAG(iter)>:: - template apply<iter>::call(converter::convert(i)); - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/prior.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/prior.hpp deleted file mode 100644 index 9ac539aebdf83562a03ef03352c937b4c8b93e00..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/prior.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_PRIOR_HPP) -#define FUSION_ITERATOR_PRIOR_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct prior_impl - { - template <typename Iterator> - struct apply {}; - }; - - template <typename Iterator> - struct prior - { - typedef as_fusion_iterator<Iterator> converter; - typedef typename converter::type iter; - - typedef typename - prior_impl<FUSION_GET_TAG(iter)>:: - template apply<iter>::type - type; - }; - } - - template <typename Iterator> - inline typename meta::prior<Iterator>::type - prior(Iterator const& i) - { - typedef as_fusion_iterator<Iterator> converter; - typedef typename converter::type iter; - - return meta::prior_impl<FUSION_GET_TAG(iter)>:: - template apply<iter>::call(converter::convert(i)); - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/single_view_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/single_view_iterator.hpp deleted file mode 100644 index 4762ea7ff1bb007f5658bac773385188a843da8d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/single_view_iterator.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_SINGLE_VIEW_ITERATOR_HPP) -#define FUSION_ITERATOR_SINGLE_VIEW_ITERATOR_HPP - -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/detail/as_tuple_element.hpp> -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/iterator/detail/single_view_iterator/deref_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/single_view_iterator/next_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/single_view_iterator/value_traits.hpp> - -namespace boost { namespace fusion -{ - struct single_view_iterator_tag; - - template <typename SingleView> - struct single_view_iterator_end - : iterator_base<single_view_iterator_end<SingleView> > - { - typedef single_view_iterator_tag tag; - }; - - template <typename SingleView> - struct single_view_iterator - : iterator_base<single_view_iterator<SingleView> > - { - typedef single_view_iterator_tag tag; - typedef SingleView single_view_type; - typedef typename add_reference<SingleView>::type reference_type; - - explicit single_view_iterator(reference_type view) - : view(view) {} - - reference_type view; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/transform_view_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/transform_view_iterator.hpp deleted file mode 100644 index f98f7bc564ed95199ee29841f6fae25935d61323..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/transform_view_iterator.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_TRANSFORM_VIEW_ITERATOR_HPP) -#define FUSION_ITERATOR_TRANSFORM_VIEW_ITERATOR_HPP - -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/iterator/detail/transform_view_iterator/deref_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/transform_view_iterator/next_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/transform_view_iterator/value_traits.hpp> - -namespace boost { namespace fusion -{ - struct transform_view_iterator_tag; - - template <typename First, typename F> - struct transform_view_iterator - : iterator_base<transform_view_iterator<First, F> > - { - typedef transform_view_iterator_tag tag; - typedef as_fusion_iterator<First> converter; - typedef typename converter::type first_type; - typedef F transform_type; - - transform_view_iterator(First const& first, F f); - - first_type first; - transform_type f; - }; - - template <typename First, typename F> - transform_view_iterator<First,F>::transform_view_iterator(First const& first, F f) - : first(converter::convert(first)), f(f) {} - -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/tuple_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/tuple_iterator.hpp deleted file mode 100644 index 58cd58368492465c4c9e64fa36d239deb278baf3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/tuple_iterator.hpp +++ /dev/null @@ -1,97 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_TUPLE_ITERATOR_HPP) -#define FUSION_ITERATOR_TUPLE_ITERATOR_HPP - -#include <boost/mpl/int.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/iterator/detail/tuple_iterator/deref_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/tuple_iterator/value_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/tuple_iterator/next_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/tuple_iterator/prior_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/tuple_iterator/equal_to_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/less.hpp> -#include <boost/mpl/identity.hpp> - -namespace boost { namespace fusion -{ - struct tuple_iterator_tag; - struct void_t; - - template <int N, typename Tuple> - struct tuple_iterator; - - template <int N, typename Tuple> - struct tuple_iterator_base : iterator_base<tuple_iterator<N, Tuple> > - { - typedef FUSION_INT(N) index; - typedef Tuple tuple; - typedef tuple_iterator_tag tag; - typedef tuple_iterator<N, Tuple> self_type; - }; - - template <int N, typename Tuple> - struct tuple_iterator : tuple_iterator_base<N,Tuple> - { - typedef typename tuple_iterator_base<N,Tuple>::tuple tuple; - typedef typename tuple_iterator_base<N,Tuple>::index index; - typedef typename - mpl::eval_if< - mpl::less<index, typename Tuple::size> - , detail::tuple_iterator_next_traits_impl<tuple_iterator_base<N,Tuple> > - , mpl::identity<void_t> - >::type - next; - - typedef typename - mpl::eval_if< - mpl::less<index, typename Tuple::size> - , detail::tuple_iterator_value_traits_impl<tuple_iterator_base<N,Tuple> > - , mpl::identity<void_t> - >::type - type; - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - tuple_iterator(tuple_iterator const& i); -#else - template <int N2, typename Tuple2> - tuple_iterator(tuple_iterator<N2, Tuple2> const& i) - : t(static_cast<tuple&>(i.get_tuple())) {} -#endif - tuple_iterator(tuple& t); - - tuple& - get_tuple() const; - private: - - tuple& t; - }; - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <int N, typename Tuple> - tuple_iterator<N,Tuple>::tuple_iterator(tuple_iterator const& i) - : t(static_cast<tuple&>(i.get_tuple())) {} -#endif - - template <int N, typename Tuple> - tuple_iterator<N,Tuple>::tuple_iterator(tuple& t) - : t(t) {} - - template <int N, typename Tuple> - typename tuple_iterator<N,Tuple>::tuple& - tuple_iterator<N,Tuple>::get_tuple() const - { - return t; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/type_sequence_iterator.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/type_sequence_iterator.hpp deleted file mode 100644 index afd9c2d1543c6fc2b0ac9e2b8695cd542b334875..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/type_sequence_iterator.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_ITERATOR_TYPE_SEQUENCE_ITERATOR_HPP) -#define FUSION_ITERATOR_TYPE_SEQUENCE_ITERATOR_HPP - -#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp> -#include <boost/spirit/fusion/iterator/detail/type_sequence_iterator/deref_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/type_sequence_iterator/next_traits.hpp> -#include <boost/spirit/fusion/iterator/detail/type_sequence_iterator/value_traits.hpp> -#include <boost/type_traits/remove_const.hpp> - -namespace boost { namespace fusion -{ - struct type_sequence_iterator_tag; - - template <typename Iterator> - struct type_sequence_iterator - : iterator_base<type_sequence_iterator<Iterator> > - { - typedef type_sequence_iterator_tag tag; - typedef typename remove_const<Iterator>::type iterator_type; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/iterator/value_of.hpp b/Utilities/BGL/boost/spirit/fusion/iterator/value_of.hpp deleted file mode 100644 index 9a5a6e51c604640a85097b2ab0ee79102f540bf0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/iterator/value_of.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_VALUE_OF_HPP) -#define FUSION_VALUE_OF_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct value_impl - { - template <typename Iterator> - struct apply - { - // VC6 needs this - typedef int type; - }; - }; - - template <typename Iterator> - struct value_of - { - typedef typename - value_impl<FUSION_GET_TAG(Iterator)>:: - template apply<Iterator>::type - type; - }; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/append_view.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/append_view.hpp deleted file mode 100644 index 3c84418afdf4f15f8c7933c2f9422ab769cce985..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/append_view.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_APPEND_VIEW_HPP) -#define FUSION_SEQUENCE_APPEND_VIEW_HPP - -#include <boost/spirit/fusion/sequence/joint_view.hpp> -#include <boost/spirit/fusion/sequence/single_view.hpp> - -namespace boost { namespace fusion -{ - template <typename View, typename T> - struct append_view : joint_view<View, single_view<T> > - { - append_view(View& view, T const& val) - : joint_view<View, single_view<T> >(view, held) - , held(val) {} - single_view<T> held; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/as_fusion_sequence.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/as_fusion_sequence.hpp deleted file mode 100644 index 2b6312b99d8b4827d37a57931241445afb1f6f05..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/as_fusion_sequence.hpp +++ /dev/null @@ -1,99 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_AS_FUSION_SEQUENCE_HPP) -#define FUSION_SEQUENCE_AS_FUSION_SEQUENCE_HPP - -#include <boost/spirit/fusion/sequence/is_sequence.hpp> -#include <boost/spirit/fusion/sequence/type_sequence.hpp> -#include <boost/mpl/is_sequence.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/static_assert.hpp> - -namespace boost { namespace fusion -{ - // Test T. If it is a fusion sequence, return a reference to it. - // else, assume it is an mpl sequence. Fail if it is not. - - namespace fusion_sequence_detail { - template<typename T> - static T const& convert_const(T const& x, mpl::true_) { - return x; - } - template<typename T> - static type_sequence<T const> convert_const(T const& x, mpl::false_) { - BOOST_STATIC_ASSERT(mpl::is_sequence<T>::value); - return type_sequence<T const>(); - } - template<typename T> - static T& convert(T& x, mpl::true_) - { - return x; - } - - template<typename T> - static type_sequence<T> convert(T& x, mpl::false_) - { - BOOST_STATIC_ASSERT(mpl::is_sequence<T>::value); - return type_sequence<T>(); - } - } - - template <typename T> - struct as_fusion_sequence { - typedef typename - mpl::if_< - fusion::is_sequence<T> - , T - , type_sequence<T> - >::type - type; - - static typename - mpl::if_< - fusion::is_sequence<T> - , T const& - , type_sequence<T const> - >::type - convert_const(T const& x); - - static typename - mpl::if_< - fusion::is_sequence<T> - , T & - , type_sequence<T> - >::type - convert(T& x); - }; - - template<typename T> - typename - mpl::if_< - fusion::is_sequence<T> - , T const& - , type_sequence<T const> - >::type - as_fusion_sequence<T>::convert_const(T const& x) { - return fusion_sequence_detail::convert_const(x,fusion::is_sequence<T>()); - } - - template<typename T> - typename - mpl::if_< - fusion::is_sequence<T> - , T& - , type_sequence<T> - >::type - as_fusion_sequence<T>::convert(T& x) { - return fusion_sequence_detail::convert(x,fusion::is_sequence<T>()); - } -}} - - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/at.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/at.hpp deleted file mode 100644 index c651737d8213b8accdde9ed2c7b94155838b6a01..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/at.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_AT_HPP) -#define FUSION_SEQUENCE_AT_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct at_impl - { - template <typename Sequence, int N> - struct apply; - }; - - template <typename Sequence, int N> - struct at_c - { - typedef as_fusion_sequence<Sequence> seq_converter; - typedef typename seq_converter::type seq; - - typedef typename - at_impl<FUSION_GET_TAG(seq)>:: - template apply<seq, N>::type - type; - }; - - template <typename Sequence, typename N> - struct at : at_c<Sequence, N::value> {}; - } -#if! BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template <int N, typename Sequence> - inline typename meta::at_c<Sequence const, N>::type - at(sequence_base<Sequence> const& seq FUSION_GET_MSVC_WORKAROUND) - { - typedef meta::at_c<Sequence const, N> at_meta; - return meta::at_impl<typename at_meta::seq::tag>:: - template apply<typename at_meta::seq const, N>::call( - at_meta::seq_converter::convert_const(seq.cast())); - } - - template <int N, typename Sequence> - inline typename meta::at_c<Sequence, N>::type - at(sequence_base<Sequence>& seq FUSION_GET_MSVC_WORKAROUND) - { - typedef meta::at_c<Sequence, N> at_meta; - return meta::at_impl<typename at_meta::seq::tag>:: - template apply<typename at_meta::seq, N>::call( - at_meta::seq_converter::convert(seq.cast())); - } -#endif -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/begin.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/begin.hpp deleted file mode 100644 index 6e1ff1fed2135d7a501724e68d55f786f9ff5db1..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/begin.hpp +++ /dev/null @@ -1,93 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_BEGIN_HPP) -#define FUSION_SEQUENCE_BEGIN_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#include <boost/type_traits/is_const.hpp> -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct begin_impl - { - template <typename Sequence> - struct apply { - typedef int type; - }; - }; - - template <typename Sequence> - struct begin - { - typedef as_fusion_sequence<Sequence> seq_converter; - typedef typename seq_converter::type seq; - - typedef typename - begin_impl<typename seq::tag>:: - template apply<seq>::type - type; - }; - } - -#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) - namespace detail { - template <typename Sequence> - inline typename meta::begin<Sequence const>::type - begin(Sequence const& seq,mpl::bool_<true>) - { - typedef meta::begin<Sequence const> begin_meta; - return meta::begin_impl<BOOST_DEDUCED_TYPENAME begin_meta::seq::tag>:: - template apply<BOOST_DEDUCED_TYPENAME begin_meta::seq const>::call( - begin_meta::seq_converter::convert_const(seq)); - } - - template <typename Sequence> - inline typename meta::begin<Sequence>::type - begin(Sequence& seq,mpl::bool_<false>) - { - typedef meta::begin<Sequence> begin_meta; - return meta::begin_impl<BOOST_DEDUCED_TYPENAME begin_meta::seq::tag>:: - template apply<BOOST_DEDUCED_TYPENAME begin_meta::seq>::call( - begin_meta::seq_converter::convert(seq)); - } - } - - template <typename Sequence> - inline typename meta::begin<Sequence>::type - begin(Sequence& seq) - { - return detail::begin(seq,is_const<Sequence>()); - } -#else - template <typename Sequence> - inline typename meta::begin<Sequence const>::type - begin(Sequence const& seq) - { - typedef meta::begin<Sequence const> begin_meta; - return meta::begin_impl<typename begin_meta::seq::tag>:: - template apply<typename begin_meta::seq const>::call( - begin_meta::seq_converter::convert_const(seq)); - } - - template <typename Sequence> - inline typename meta::begin<Sequence>::type - begin(Sequence& seq) - { - typedef meta::begin<Sequence> begin_meta; - return meta::begin_impl<typename begin_meta::seq::tag>:: - template apply<typename begin_meta::seq>::call( - begin_meta::seq_converter::convert(seq)); - } -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/cons.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/cons.hpp deleted file mode 100644 index ad0e84a6507a7816945aeabc7ba79db7b7ff603b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/cons.hpp +++ /dev/null @@ -1,69 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_CONS_HPP) -#define FUSION_SEQUENCE_CONS_HPP - -#include <boost/call_traits.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/cons_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> - -namespace boost { namespace fusion -{ - struct void_t; - - struct cons_tag; - - struct nil : sequence_base<nil> - { - typedef cons_tag tag; - typedef void_t car_type; - typedef void_t cdr_type; - }; - - template <typename Car, typename Cdr = nil> - struct cons : sequence_base<cons<Car,Cdr> > - { - typedef cons_tag tag; - typedef typename call_traits<Car>::value_type car_type; - typedef Cdr cdr_type; - - cons() - : car(), cdr() {} - - explicit cons( - typename call_traits<Car>::param_type car_ - , typename call_traits<Cdr>::param_type cdr_ = Cdr()) - : car(car_), cdr(cdr_) {} - - car_type car; - cdr_type cdr; - }; - - template <typename Car> - inline cons<Car> - make_cons(Car const& car) - { - return cons<Car>(car); - } - - template <typename Car, typename Cdr> - inline cons<Car, Cdr> - make_cons(Car const& car, Cdr const& cdr) - { - return cons<Car, Cdr>(car, cdr); - } -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/as_tuple_element.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/as_tuple_element.hpp deleted file mode 100644 index 426a6840788065da7666d4175adce8ea3ddff0da..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/as_tuple_element.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_AS_TUPLE_ELEMENT_HPP) -#define FUSION_SEQUENCE_DETAIL_AS_TUPLE_ELEMENT_HPP - -#include <boost/ref.hpp> - -#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include <boost/mpl/eval_if.hpp> -# include <boost/mpl/identity.hpp> -# include <boost/type_traits/is_array.hpp> -# include <boost/type_traits/is_convertible.hpp> -#endif - -namespace boost { namespace fusion { namespace detail -{ -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - template <typename T> - struct as_tuple_element - { - typedef T type; - }; - - template <typename T> - struct as_tuple_element<reference_wrapper<T> > - { - typedef T& type; - }; - -#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - - template <typename T> - struct as_tuple_element<reference_wrapper<T> const> - { - typedef T& type; - }; - -#endif - - template <typename T, int N> - struct as_tuple_element<T[N]> - { - typedef const T(&type)[N]; - }; - - template <typename T, int N> - struct as_tuple_element<volatile T[N]> - { - typedef const volatile T(&type)[N]; - }; - - template <typename T, int N> - struct as_tuple_element<const volatile T[N]> - { - typedef const volatile T(&type)[N]; - }; - -#else - - // The Non-PTS version cannot accept arrays since there is no way to - // get the element type of an array T[N]. However, we shall provide - // the most common case where the array is a char[N] or wchar_t[N]. - // Doing so will allow literal string argument types. - - template <typename T> - struct maybe_string - { - typedef typename - mpl::eval_if< - is_array<T> - , mpl::eval_if< - is_convertible<T, char const*> - , mpl::identity<char const*> - , mpl::eval_if< - is_convertible<T, wchar_t const*> - , mpl::identity<wchar_t const*> - , mpl::identity<T> - > - > - , mpl::identity<T> - >::type - type; - }; - - template <typename T> - struct as_tuple_element - { - typedef typename - mpl::eval_if< - is_reference_wrapper<T> - , add_reference<typename unwrap_reference<T>::type> - , maybe_string<T> - >::type - type; - }; - -#endif - -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp deleted file mode 100644 index 53a2055fed8b374cf1c99ec2c58b12412a4a4a51..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/cons_begin_end_traits.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - Copyright (c) 2005 Eric Niebler - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_CONS_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_CONS_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_const.hpp> - -namespace boost { namespace fusion -{ - struct nil; - - struct cons_tag; - - template <typename Car, typename Cdr> - struct cons; - - template <typename Cons> - struct cons_iterator; - - namespace cons_detail - { - template <typename Cons> - struct begin_traits_impl - { - typedef cons_iterator<Cons> type; - - static type - call(Cons& t) - { - return type(t); - } - }; - - template <typename Cons> - struct end_traits_impl - { - typedef cons_iterator< - typename mpl::if_<is_const<Cons>, nil const, nil>::type> - type; - - static type - call(Cons&) - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - }; - } - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<cons_tag> - { - template <typename Sequence> - struct apply : cons_detail::begin_traits_impl<Sequence> - {}; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<cons_tag> - { - template <typename Sequence> - struct apply : cons_detail::end_traits_impl<Sequence> - {}; - }; - } -}} - -namespace boost { namespace mpl -{ - template <typename Tag> - struct begin_impl; - - template <typename Tag> - struct end_impl; - - template <> - struct begin_impl<fusion::cons_tag> - : fusion::meta::begin_impl<fusion::cons_tag> {}; - - template <> - struct end_impl<fusion::cons_tag> - : fusion::meta::end_impl<fusion::cons_tag> {}; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/filter_view_begin_end_trts.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/filter_view_begin_end_trts.hpp deleted file mode 100644 index 630dab5ffec227f972dbbf87c5562733ac07af7d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/filter_view_begin_end_trts.hpp +++ /dev/null @@ -1,89 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_FILTER_VIEW_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_FILTER_VIEW_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct filter_view_tag; - - template <typename View, typename Pred> - struct filter_view; - - template <typename First, typename Last, typename Pred> - struct filter_iterator; - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<filter_view_tag> - { - template <typename Sequence> - struct apply - { - typedef typename Sequence::first_type first_type; - typedef typename Sequence::last_type last_type; - typedef typename Sequence::pred_type pred_type; - typedef filter_iterator<first_type, last_type, pred_type> type; - - static type - call(Sequence& s) - { - return type(s.first); - } - }; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<filter_view_tag> - { - template <typename Sequence> - struct apply - { - typedef typename Sequence::last_type last_type; - typedef typename Sequence::pred_type pred_type; - typedef filter_iterator<last_type, last_type, pred_type> type; - - static type - call(Sequence& s) - { - return type(s.last); - } - }; - }; - } -}} - -namespace boost { namespace mpl -{ - template <typename Tag> - struct begin_impl; - - template <typename Tag> - struct end_impl; - - template <> - struct begin_impl<fusion::filter_view_tag> - : fusion::meta::begin_impl<fusion::filter_view_tag> {}; - - template <> - struct end_impl<fusion::filter_view_tag> - : fusion::meta::end_impl<fusion::filter_view_tag> {}; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/generate.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/generate.hpp deleted file mode 100644 index 7e41b00cb96e571d5a361ee5e909c95e66bda0fd..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/generate.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_GENERATE_HPP) -#define FUSION_SEQUENCE_DETAIL_GENERATE_HPP - -#include <boost/spirit/fusion/sequence/tuple.hpp> -#include <boost/spirit/fusion/iterator/value_of.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/arithmetic/dec.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> - -#define FUSION_DEREF_ITERATOR(z, n, data) \ - typename checked_deref_iterator< \ - BOOST_PP_CAT(T, n), Last>::type - -#define FUSION_NEXT_ITERATOR(z, n, data) \ - typedef typename checked_next_iterator< \ - BOOST_PP_CAT(T, n), Last>::type \ - BOOST_PP_CAT(T, BOOST_PP_INC(n)); - -namespace boost { namespace fusion { namespace detail -{ - template <typename First, typename Last> - struct checked_deref_iterator - { - typedef typename - mpl::eval_if< - meta::equal_to<First, Last> - , mpl::identity<void_t> - , meta::value_of<First> - >::type - type; - }; - - template <typename First, typename Last> - struct checked_next_iterator - { - typedef typename - mpl::eval_if< - meta::equal_to<First, Last> - , mpl::identity<Last> - , meta::next<First> - >::type - type; - }; - - template <typename First, typename Last> - struct result_of_generate - { - typedef First T0; - BOOST_PP_REPEAT( - BOOST_PP_DEC(FUSION_MAX_TUPLE_SIZE), FUSION_NEXT_ITERATOR, _) - typedef tuple<BOOST_PP_ENUM(FUSION_MAX_TUPLE_SIZE - , FUSION_DEREF_ITERATOR, _)> type; - }; - - template <typename First, typename Last> - inline typename result_of_generate<First, Last>::type - generate(First const& first, Last const&) - { - typedef typename result_of_generate<First, Last>::type result; - return result(first); - } -}}} - -#undef FUSION_DEREF_ITERATOR -#undef FUSION_NEXT_ITERATOR -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/io.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/io.hpp deleted file mode 100644 index c12889bafe3dba0f538e82f0872394da51a257bb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/io.hpp +++ /dev/null @@ -1,142 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 1999-2003 Jeremiah Willcock - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_IO_HPP) -#define FUSION_SEQUENCE_DETAIL_IO_HPP - -#include <iostream> -#include <boost/spirit/fusion/sequence/detail/manip.hpp> - -#include <boost/mpl/bool.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion { namespace detail -{ - template <typename Tag> - struct delimiter_io - { - // print a delimiter - template <typename OS> - static void - print(OS& os, char const* delim, mpl::false_ = mpl::false_()) - { - detail::string_ios_manip<Tag, OS> manip(os); - manip.print(delim); - } - - template <typename OS> - static void - print(OS& os, char const* delim, mpl::true_) - { - } - - // read a delimiter - template <typename IS> - static void - read(IS& is, char const* delim, mpl::false_ = mpl::false_()) - { - detail::string_ios_manip<Tag, IS> manip(is); - manip.read(delim); - } - - template <typename IS> - static void - read(IS& is, char const* delim, mpl::true_) - { - } - }; - - struct print_sequence_loop - { - template <typename OS, typename First, typename Last> - static void - call(OS& os, First const&, Last const&, mpl::true_) - { - } - - template <typename OS, typename First, typename Last> - static void - call(OS& os, First const& first, Last const& last, mpl::false_) - { - meta::equal_to< - BOOST_DEDUCED_TYPENAME meta::next<First>::type - , Last - > - is_last; - - os << *first; - delimiter_io<tuple_delimiter_tag>::print(os, " ", is_last); - call(os, fusion::next(first), last, is_last); - } - - template <typename OS, typename First, typename Last> - static void - call(OS& os, First const& first, Last const& last) - { - meta::equal_to<First, Last> eq; - call(os, first, last, eq); - } - }; - - struct read_sequence_loop - { - template <typename IS, typename First, typename Last> - static void - call(IS& is, First const&, Last const&, mpl::true_) - { - } - - template <typename IS, typename First, typename Last> - static void - call(IS& is, First const& first, Last const& last, mpl::false_) - { - meta::equal_to< - BOOST_DEDUCED_TYPENAME meta::next<First>::type - , Last - > - is_last; - - is >> *first; - delimiter_io<tuple_delimiter_tag>::read(is, " ", is_last); - call(is, fusion::next(first), last, is_last); - } - - template <typename IS, typename First, typename Last> - static void - call(IS& is, First const& first, Last const& last) - { - meta::equal_to<First, Last> eq; - call(is, first, last, eq); - } - }; - - template <typename OS, typename Sequence> - inline void - print_sequence(OS& os, Sequence const& seq) - { - delimiter_io<tuple_open_tag>::print(os, "("); - print_sequence_loop::call(os, fusion::begin(seq), fusion::end(seq)); - delimiter_io<tuple_close_tag>::print(os, ")"); - } - - template <typename IS, typename Sequence> - inline void - read_sequence(IS& is, Sequence& seq) - { - delimiter_io<tuple_open_tag>::read(is, "("); - read_sequence_loop::call(is, fusion::begin(seq), fusion::end(seq)); - delimiter_io<tuple_close_tag>::read(is, ")"); - } -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/joint_view_begin_end_traits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/joint_view_begin_end_traits.hpp deleted file mode 100644 index 0605841867c74416e3c0c0693243f3f5cacfb29a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/joint_view_begin_end_traits.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_JOINT_VIEW_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_JOINT_VIEW_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> -#include <boost/mpl/if.hpp> - -namespace boost { namespace fusion -{ - struct joint_view_tag; - - template <typename View1, typename View2> - struct joint_view; - - template <typename First, typename Last, typename Concat> - struct joint_view_iterator; - - namespace joint_view_detail { - template <typename Sequence> - struct begin_traits_impl - { - typedef typename Sequence::first_type first_type; - typedef typename Sequence::last_type last_type; - typedef typename Sequence::concat_type concat_type; - typedef boost::fusion::meta::equal_to<first_type, last_type> equal_to; - - typedef typename - boost::mpl::if_< - equal_to - , concat_type - , boost::fusion::joint_view_iterator<first_type, last_type, concat_type> - >::type - type; - - static type - call(Sequence& s); - }; - - template<typename Sequence> - typename begin_traits_impl<Sequence>::type - call(Sequence& s, boost::mpl::true_) { - return s.concat; - } - - template<typename Sequence> - typename begin_traits_impl<Sequence>::type - call(Sequence& s, boost::mpl::false_) { - typedef BOOST_DEDUCED_TYPENAME begin_traits_impl<Sequence>::type type; - return type(s.first, s.concat); - } - - template<typename Sequence> - typename begin_traits_impl<Sequence>::type - begin_traits_impl<Sequence>::call(Sequence& s) - { - return joint_view_detail::call(s, equal_to()); - } - - template <typename Sequence> - struct end_traits_impl - { - typedef typename Sequence::concat_last_type type; - - static type - call(Sequence& s); - }; - - template<typename Sequence> - typename end_traits_impl<Sequence>::type - end_traits_impl<Sequence>::call(Sequence& s) - { - return s.concat_last; - } - } - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<joint_view_tag> - { - template <typename Sequence> - struct apply : joint_view_detail::begin_traits_impl<Sequence> - {}; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<joint_view_tag> - { - template <typename Sequence> - struct apply : joint_view_detail::end_traits_impl<Sequence> - {}; - }; - } -}} - -namespace boost { namespace mpl -{ - template <typename Tag> - struct begin_impl; - - template <typename Tag> - struct end_impl; - - template <> - struct begin_impl<fusion::joint_view_tag> - : fusion::meta::begin_impl<fusion::joint_view_tag> {}; - - template <> - struct end_impl<fusion::joint_view_tag> - : fusion::meta::end_impl<fusion::joint_view_tag> {}; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/manip.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/manip.hpp deleted file mode 100644 index a402469af5d0bb365743c2422677d406f5d72b27..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/manip.hpp +++ /dev/null @@ -1,336 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jeremiah Willcock - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#ifndef FUSION_SEQUENCE_DETAIL_MANIP_HPP -#define FUSION_SEQUENCE_DETAIL_MANIP_HPP - -#include <boost/config.hpp> -#include <iostream> -#include <string> -#include <vector> -#include <cctype> - -// Tuple I/O manipulators - -#include <boost/spirit/fusion/detail/config.hpp> - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -FUSION_MSVC_ETI_WRAPPER(char_type) -FUSION_MSVC_ETI_WRAPPER(traits_type) -# define FUSION_GET_CHAR_TYPE(T) get_char_type<T>::type -# define FUSION_GET_TRAITS_TYPE(T) get_traits_type<T>::type -#else -# define FUSION_GET_CHAR_TYPE(T) typename T::char_type -# define FUSION_GET_TRAITS_TYPE(T) typename T::traits_type -#endif - -#if defined (BOOST_NO_TEMPLATED_STREAMS) -#define FUSION_STRING_OF_STREAM(Stream) std::string -#else -#define FUSION_STRING_OF_STREAM(Stream) \ - std::basic_string< \ - FUSION_GET_CHAR_TYPE(Stream) \ - , FUSION_GET_TRAITS_TYPE(Stream) \ - > -#endif - -namespace boost { namespace fusion -{ - namespace detail - { - template <typename Tag> - int get_xalloc_index(Tag* = 0) - { - // each Tag will have a unique index - static int index = std::ios::xalloc(); - return index; - } - - template <typename Stream, typename Tag, typename T> - struct stream_data - { - struct arena - { - ~arena() - { - for ( - typename std::vector<T*>::iterator i = data.begin() - ; i != data.end() - ; ++i) - { - delete *i; - } - } - - std::vector<T*> data; - }; - - static void attach(Stream& stream, T const& data); - static T const* get(Stream& stream); - }; - - template <typename Stream, typename Tag, typename T> - void stream_data<Stream,Tag,T>::attach(Stream& stream, T const& data) - { - static arena ar; // our arena - ar.data.push_back(new T(data)); - stream.pword(get_xalloc_index<Tag>()) = ar.data.back(); - } - - template <typename Stream, typename Tag, typename T> - T const* stream_data<Stream,Tag,T>::get(Stream& stream) - { - return (T const*)stream.pword(get_xalloc_index<Tag>()); - } - - template <class Tag, class Stream> - class string_ios_manip - { - public: - - typedef FUSION_STRING_OF_STREAM(Stream) string_type; - - typedef stream_data<Stream, Tag, string_type> stream_data_t; - - string_ios_manip(Stream& str_); - void set(string_type const& s); - void print(char const* default_) const; - void read(char const* default_) const; - private: - - template <typename Char> - void - check_delim(Char c) const - { - if (!isspace(c)) - { - if (stream.get() != c) - { - stream.unget(); - stream.setstate(std::ios::failbit); - } - } - } - - Stream& stream; - }; - - template <class Tag, class Stream> - string_ios_manip<Tag,Stream>::string_ios_manip(Stream& str_) - : stream(str_) - {} - - template <class Tag, class Stream> - void - string_ios_manip<Tag,Stream>::set(string_type const& s) - { - stream_data_t::attach(stream, s); - } - - template <class Tag, class Stream> - void - string_ios_manip<Tag,Stream>::print(char const* default_) const - { - // print a delimiter - string_type const* p = stream_data_t::get(stream); - if (p) - stream << *p; - else - stream << default_; - } - - template <class Tag, class Stream> - void - string_ios_manip<Tag,Stream>::read(char const* default_) const - { - // read a delimiter - string_type const* p = stream_data_t::get(stream); - using namespace std; - ws(stream); - - if (p) - { - typedef typename string_type::const_iterator iterator; - for (iterator i = p->begin(); i != p->end(); ++i) - check_delim(*i); - } - else - { - while (*default_) - check_delim(*default_++); - } - } - - } // detail - -#if defined (BOOST_NO_TEMPLATED_STREAMS) - -#define STD_TUPLE_DEFINE_MANIPULATOR(name) \ - namespace detail \ - { \ - struct name##_tag; \ - \ - struct name##_type \ - { \ - typedef std::string string_type; \ - string_type data; \ - name##_type(const string_type& d): data(d) {} \ - }; \ - \ - template <class Stream> \ - Stream& operator>>(Stream& s, const name##_type& m) \ - { \ - string_ios_manip<name##_tag, Stream>(s).set(m.data); \ - return s; \ - } \ - \ - template <class Stream> \ - Stream& operator<<(Stream& s, const name##_type& m) \ - { \ - string_ios_manip<name##_tag, Stream>(s).set(m.data); \ - return s; \ - } \ - } - -#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \ - inline detail::name##_type \ - name(const std::string& s) \ - { \ - return detail::name##_type(s); \ - } \ - \ - inline detail::name##_type \ - name(const char* s) \ - { \ - return detail::name##_type(std::string(s)); \ - } \ - \ - inline detail::name##_type \ - name(char c) \ - { \ - return detail::name##_type(std::string(1, c)); \ - } - -#else // defined(BOOST_NO_TEMPLATED_STREAMS) - -#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \ - template <class Char, class Traits> \ - inline detail::name##_type<Char, Traits> \ - name(const std::basic_string<Char, Traits>& s) \ - { \ - return detail::name##_type<Char, Traits>(s); \ - } \ - \ - inline detail::name##_type<char> \ - name(char const* s) \ - { \ - return detail::name##_type<char>(std::basic_string<char>(s)); \ - } \ - \ - inline detail::name##_type<wchar_t> \ - name(wchar_t const* s) \ - { \ - return detail::name##_type<wchar_t>(std::basic_string<wchar_t>(s)); \ - } \ - \ - inline detail::name##_type<char> \ - name(char c) \ - { \ - return detail::name##_type<char>(std::basic_string<char>(1, c)); \ - } \ - \ - inline detail::name##_type<wchar_t> \ - name(wchar_t c) \ - { \ - return detail::name##_type<wchar_t>(std::basic_string<wchar_t>(1, c)); \ - } - -#else // defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -#define STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(name) \ - template <class Char, class Traits> \ - inline detail::name##_type<Char, Traits> \ - name(const std::basic_string<Char, Traits>& s) \ - { \ - return detail::name##_type<Char, Traits>(s); \ - } \ - \ - template <class Char> \ - inline detail::name##_type<Char> \ - name(Char s[]) \ - { \ - return detail::name##_type<Char>(std::basic_string<Char>(s)); \ - } \ - \ - template <class Char> \ - inline detail::name##_type<Char> \ - name(Char const s[]) \ - { \ - return detail::name##_type<Char>(std::basic_string<Char>(s)); \ - } \ - \ - template <class Char> \ - inline detail::name##_type<Char> \ - name(Char c) \ - { \ - return detail::name##_type<Char>(std::basic_string<Char>(1, c)); \ - } - -#endif - -#define STD_TUPLE_DEFINE_MANIPULATOR(name) \ - namespace detail \ - { \ - struct name##_tag; \ - \ - template <class Char, class Traits = std::char_traits<Char> > \ - struct name##_type \ - { \ - typedef std::basic_string<Char, Traits> string_type; \ - string_type data; \ - name##_type(const string_type& d): data(d) {} \ - }; \ - \ - template <class Stream, class Char, class Traits> \ - Stream& operator>>(Stream& s, const name##_type<Char,Traits>& m) \ - { \ - string_ios_manip<name##_tag, Stream>(s).set(m.data); \ - return s; \ - } \ - \ - template <class Stream, class Char, class Traits> \ - Stream& operator<<(Stream& s, const name##_type<Char,Traits>& m) \ - { \ - string_ios_manip<name##_tag, Stream>(s).set(m.data); \ - return s; \ - } \ - } \ - -#endif // defined(BOOST_NO_TEMPLATED_STREAMS) - - STD_TUPLE_DEFINE_MANIPULATOR(tuple_open) - STD_TUPLE_DEFINE_MANIPULATOR(tuple_close) - STD_TUPLE_DEFINE_MANIPULATOR(tuple_delimiter) - - STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(tuple_open) - STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(tuple_close) - STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS(tuple_delimiter) - -#undef STD_TUPLE_DEFINE_MANIPULATOR -#undef STD_TUPLE_DEFINE_MANIPULATOR_FUNCTIONS -#undef FUSION_STRING_OF_STREAM -#undef FUSION_GET_CHAR_TYPE -#undef FUSION_GET_TRAITS_TYPE - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/range_begin_end_traits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/range_begin_end_traits.hpp deleted file mode 100644 index 2bdae7bbbbbe0c556b02c29bdf5f6c4632e3c9d6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/range_begin_end_traits.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_RANGE_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_RANGE_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct range_tag; - - template <typename First, typename Last> - struct range; - - template <typename Tag> - struct begin_impl; - - namespace range_detail - { - template <typename Sequence> - struct begin_traits_impl - { - typedef typename Sequence::begin_type type; - - static type - call(Sequence const& s); - }; - - template <typename Sequence> - inline typename begin_traits_impl<Sequence>::type - begin_traits_impl<Sequence>::call(Sequence const& s) - { - return s.first; - } - - template <typename Sequence> - struct end_traits_impl - { - typedef typename Sequence::end_type type; - - static type - call(Sequence const& s); - }; - - template <typename Sequence> - inline typename end_traits_impl<Sequence>::type - end_traits_impl<Sequence>::call(Sequence const& s) - { - return s.last; - } - } - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<range_tag> - { - template <typename Sequence> - struct apply : range_detail::begin_traits_impl<Sequence> - {}; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<range_tag> - { - template <typename Sequence> - struct apply : range_detail::end_traits_impl<Sequence> - {}; - }; - } -}} - -namespace boost { namespace mpl -{ - template <typename Tag> - struct begin_impl; - - template <typename Tag> - struct end_impl; - - template <> - struct begin_impl<fusion::range_tag> - : fusion::meta::begin_impl<fusion::range_tag> {}; - - template <> - struct end_impl<fusion::range_tag> - : fusion::meta::end_impl<fusion::range_tag> {}; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_base.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_base.hpp deleted file mode 100644 index 782c3fdf3b0b3b4f222c70db6f1b2ed3d6741f77..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_base.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_BASE_HPP) -#define FUSION_SEQUENCE_DETAIL_SEQUENCE_BASE_HPP - -namespace boost { namespace fusion -{ - struct sequence_root {}; - - template <typename Sequence> - struct sequence_base : sequence_root - { - Sequence const& - cast() const; - - Sequence& - cast(); - }; - - template <typename Sequence> - Sequence const& - sequence_base<Sequence>::cast() const - { - return static_cast<Sequence const&>(*this); - } - - template <typename Sequence> - Sequence& - sequence_base<Sequence>::cast() - { - return static_cast<Sequence&>(*this); - } - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_equal_to.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_equal_to.hpp deleted file mode 100644 index 6daf3eefced8d443aeed98ac250dde65a2a02d2c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_equal_to.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_EQUAL_TO_HPP) -#define FUSION_SEQUENCE_DETAIL_SEQUENCE_EQUAL_TO_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/static_assert.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion { namespace detail -{ - namespace sequence_equal_to_detail { - template<typename T,typename I1,typename I2> - bool call(T const& self,I1 const& a, I2 const& b) { - return fusion::deref(a) == fusion::deref(b) - && T::call(fusion::next(a), fusion::next(b)); - } - } - - template <typename Seq1, typename Seq2> - struct sequence_equal_to - { - typedef typename meta::end<Seq1>::type end1_type; - typedef typename meta::end<Seq2>::type end2_type; - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b) - { - typename meta::equal_to<I1, end1_type>::type eq; - return call(a, b, eq); - } - - template <typename I1, typename I2> - static bool - call(I1 const&, I2 const&, mpl::true_) - { - BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value)); - return true; - } - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b, mpl::false_) - { - return sequence_equal_to_detail::call(sequence_equal_to<Seq1,Seq2>(),a,b); - } - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_greater.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_greater.hpp deleted file mode 100644 index 12fed678f2969eb250c10dd38e3a8dea463a65db..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_greater.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_GREATER_HPP) -#define FUSION_SEQUENCE_DETAIL_SEQUENCE_GREATER_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/static_assert.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion { namespace detail -{ - namespace sequence_greater_detail { - template <typename T,typename I1, typename I2> - bool call(T const& self,I1 const& a, I2 const& b) { - return *a > *b - || !(*b > *a) - && T::call(fusion::next(a), fusion::next(b)); - } - } - - template <typename Seq1, typename Seq2> - struct sequence_greater - { - typedef typename meta::end<Seq1>::type end1_type; - typedef typename meta::end<Seq2>::type end2_type; - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b) - { - typename meta::equal_to<I1, end1_type>::type eq; - return call(a, b, eq); - } - - template <typename I1, typename I2> - static bool - call(I1 const&, I2 const&, mpl::true_) - { - BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value)); - return false; - } - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b, mpl::false_) - { - return sequence_greater_detail::call(sequence_greater<Seq1,Seq2>(),a,b); - } - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_greater_equal.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_greater_equal.hpp deleted file mode 100644 index 2d72e8be8b3c59e60207d69fb91725bb72ea019a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_greater_equal.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_GREATER_EQUAL_HPP) -#define FUSION_SEQUENCE_DETAIL_SEQUENCE_GREATER_EQUAL_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/static_assert.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion { namespace detail -{ - namespace sequence_greater_equal_detail { - template <typename T,typename I1, typename I2> - bool call(T const& self,I1 const& a, I2 const& b) { - return *a >= *b - && (!(*b >= *a) || T::call(fusion::next(a), fusion::next(b)));; - } - } - - template <typename Seq1, typename Seq2> - struct sequence_greater_equal - { - typedef typename meta::end<Seq1>::type end1_type; - typedef typename meta::end<Seq2>::type end2_type; - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b) - { - typename meta::equal_to<I1, end1_type>::type eq; - return call(a, b, eq); - } - - template <typename I1, typename I2> - static bool - call(I1 const&, I2 const&, mpl::true_) - { - BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value)); - return true; - } - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b, mpl::false_) - { - return sequence_greater_equal_detail::call(sequence_greater_equal<Seq1,Seq2>(),a,b); - } - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_less.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_less.hpp deleted file mode 100644 index 583543b48eec0640f8c6b8927c20b68a33049823..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_less.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_LESS_HPP) -#define FUSION_SEQUENCE_DETAIL_SEQUENCE_LESS_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/static_assert.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion { namespace detail -{ - namespace sequence_less_detail { - template <typename T,typename I1, typename I2> - bool call(T const& self,I1 const& a, I2 const& b) { - return *a < *b - || !(*b < *a) - && T::call(fusion::next(a), fusion::next(b)); - } - } - - template <typename Seq1, typename Seq2> - struct sequence_less - { - typedef typename meta::end<Seq1>::type end1_type; - typedef typename meta::end<Seq2>::type end2_type; - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b) - { - typename meta::equal_to<I1, end1_type>::type eq; - return call(a, b, eq); - } - - template <typename I1, typename I2> - static bool - call(I1 const&, I2 const&, mpl::true_) - { - BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value)); - return false; - } - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b, mpl::false_) - { - return sequence_less_detail::call(sequence_less<Seq1,Seq2>(),a,b); - } - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_less_equal.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_less_equal.hpp deleted file mode 100644 index 3a37c3ab194e3a467e70be3ff233208718075955..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_less_equal.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_LESS_EQUAL_HPP) -#define FUSION_SEQUENCE_DETAIL_SEQUENCE_LESS_EQUAL_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/static_assert.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion { namespace detail -{ - namespace sequence_less_equal_detail { - template <typename T,typename I1, typename I2> - bool call(T const& self,I1 const& a, I2 const& b) { - return *a <= *b - && (!(*b <= *a) || T::call(fusion::next(a), fusion::next(b))); - } - } - - template <typename Seq1, typename Seq2> - struct sequence_less_equal - { - typedef typename meta::end<Seq1>::type end1_type; - typedef typename meta::end<Seq2>::type end2_type; - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b) - { - typename meta::equal_to<I1, end1_type>::type eq; - return call(a, b, eq); - } - - template <typename I1, typename I2> - static bool - call(I1 const&, I2 const&, mpl::true_) - { - BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value)); - return true; - } - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b, mpl::false_) - { - return sequence_less_equal_detail::call(sequence_less_equal<Seq1,Seq2>(),a,b); - } - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_not_equal_to.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_not_equal_to.hpp deleted file mode 100644 index 070d12623f8dd0354083149b521902afd57126ff..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/sequence_not_equal_to.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SEQUENCE_NOT_EQUAL_TO_HPP) -#define FUSION_SEQUENCE_DETAIL_SEQUENCE_NOT_EQUAL_TO_HPP - -#include <boost/mpl/bool.hpp> -#include <boost/static_assert.hpp> -#include <boost/spirit/fusion/iterator/deref.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/spirit/fusion/iterator/equal_to.hpp> - -namespace boost { namespace fusion { namespace detail -{ - namespace sequence_not_equal_to_detail { - template <typename T,typename I1, typename I2> - bool call(T const& self,I1 const& a, I2 const& b) { - return *a != *b - || T::call(fusion::next(a), fusion::next(b)); - } - } - template <typename Seq1, typename Seq2> - struct sequence_not_equal_to - { - typedef typename meta::end<Seq1>::type end1_type; - typedef typename meta::end<Seq2>::type end2_type; - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b) - { - typename meta::equal_to<I1, end1_type>::type eq; - return call(a, b, eq); - } - - template <typename I1, typename I2> - static bool - call(I1 const&, I2 const&, mpl::true_) - { - BOOST_STATIC_ASSERT((meta::equal_to<I2, end2_type>::value)); - return false; - } - - template <typename I1, typename I2> - static bool - call(I1 const& a, I2 const& b, mpl::false_) - { - return sequence_not_equal_to_detail::call(sequence_not_equal_to<Seq1,Seq2>(),a,b); - } - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/single_view_begin_end_trts.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/single_view_begin_end_trts.hpp deleted file mode 100644 index 86173e28eb4cbe790966c61b703337f6918c76af..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/single_view_begin_end_trts.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_SINGLE_VIEW_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_SINGLE_VIEW_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct single_view_tag; - - template <typename T> - struct single_view_iterator_end; - - template <typename T> - struct single_view_iterator; - - namespace single_view_detail - { - template <typename Sequence> - struct begin_traits_impl - { - typedef single_view_iterator<Sequence> type; - - static type - call(Sequence& s); - }; - - template <typename Sequence> - inline typename begin_traits_impl<Sequence>::type - begin_traits_impl<Sequence>::call(Sequence& s) - { - return type(s); - } - - template <typename Sequence> - struct end_traits_impl - { - typedef single_view_iterator_end<Sequence> type; - - static type - call(Sequence&); - }; - - template <typename Sequence> - inline typename end_traits_impl<Sequence>::type - end_traits_impl<Sequence>::call(Sequence&) - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - } - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<single_view_tag> - { - template <typename Sequence> - struct apply : single_view_detail::begin_traits_impl<Sequence> {}; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<single_view_tag> - { - template <typename Sequence> - struct apply : single_view_detail::end_traits_impl<Sequence> {}; - }; - } -}} - -namespace boost { namespace mpl -{ - template <typename Tag> - struct begin_impl; - - template <typename Tag> - struct end_impl; - - template <> - struct begin_impl<fusion::single_view_tag> - : fusion::meta::begin_impl<fusion::single_view_tag> {}; - - template <> - struct end_impl<fusion::single_view_tag> - : fusion::meta::end_impl<fusion::single_view_tag> {}; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/trsfrm_view_begin_end_trts.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/trsfrm_view_begin_end_trts.hpp deleted file mode 100644 index 19e513c9c45f7a862f57b42f8be86a3b0510d06a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/trsfrm_view_begin_end_trts.hpp +++ /dev/null @@ -1,88 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TRANSFORM_VIEW_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_TRANSFORM_VIEW_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct transform_view_tag; - - template <typename Sequence, typename F> - struct transform_view; - - template <typename First, typename F> - struct transform_view_iterator; - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<transform_view_tag> - { - template <typename Sequence> - struct apply - { - typedef typename Sequence::first_type first_type; - typedef typename Sequence::transform_type transform_type; - typedef transform_view_iterator<first_type, transform_type> type; - - static type - call(Sequence& s) - { - return type(s.first, s.f); - } - }; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<transform_view_tag> - { - template <typename Sequence> - struct apply - { - typedef typename Sequence::last_type last_type; - typedef typename Sequence::transform_type transform_type; - typedef transform_view_iterator<last_type, transform_type> type; - - static type - call(Sequence& s) - { - return type(s.last, s.f); - } - }; - }; - } -}} - -namespace boost { namespace mpl -{ - template <typename Tag> - struct begin_impl; - - template <typename Tag> - struct end_impl; - - template <> - struct begin_impl<fusion::transform_view_tag> - : fusion::meta::begin_impl<fusion::transform_view_tag> {}; - - template <> - struct end_impl<fusion::transform_view_tag> - : fusion::meta::end_impl<fusion::transform_view_tag> {}; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple10.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple10.hpp deleted file mode 100644 index c24f196f1295712864523fc936b4aa62a9948428..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple10.hpp +++ /dev/null @@ -1,123 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE10_HPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE10_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/tuple_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/vector/vector10.hpp> -#include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/is_base_and_derived.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include <boost/spirit/fusion/iterator/next.hpp> -#endif - -namespace boost { namespace fusion -{ - namespace detail - { - struct disambiguate_as_tuple {}; - struct disambiguate_as_data {}; - struct disambiguate_as_iterator {}; - - template <typename X, typename T0> - struct disambiguate - { - typedef typename - mpl::if_< - is_convertible<X, T0> - , disambiguate_as_data - , typename mpl::if_< - is_base_and_derived<sequence_root, X> - , disambiguate_as_tuple - , disambiguate_as_iterator - >::type - >::type - type; - - static type - call() - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - }; - - template <int N> - struct tuple_access; - - template <> - struct tuple_access<0> - { - template <typename Tuple> - static typename tuple_access_result<Tuple, 0>::type - get(Tuple& t) - { - FUSION_RETURN_TUPLE_MEMBER(0); - } - }; - - template <> - struct tuple_access<1> - { - template <typename Tuple> - static typename tuple_access_result<Tuple, 1>::type - get(Tuple& t) - { - FUSION_RETURN_TUPLE_MEMBER(1); - } - }; - - template <> - struct tuple_access<2> - { - template <typename Tuple> - static typename tuple_access_result<Tuple, 2>::type - get(Tuple& t) - { - FUSION_RETURN_TUPLE_MEMBER(2); - } - }; - -}}} // namespace boost::fusion::detail - -/////////////////////////////////////////////////////////////////////////////// -// -// Bring in the rest of the fixed-tuples using the pre-processor. Generate -// expansions for the tuple_access<N> and tupleN+1 classes for N = 3..10. -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/fusion/sequence/detail/tuple_macro.hpp> - -namespace boost { namespace fusion -{ - namespace detail - { - BOOST_PP_REPEAT_FROM_TO(3, 10, FUSION_TUPLE_N_ACCESS, _) - } - - struct tuple_tag; - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (4, 10, <boost/spirit/fusion/sequence/detail/tuple_body.hpp>)) -# include BOOST_PP_ITERATE() -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_access_result.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_access_result.hpp deleted file mode 100644 index eb18b88711f62de36ceef069dae6cac1aeb3d4fa..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_access_result.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE_ACCESS_RESULT_HPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE_ACCESS_RESULT_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/type_traits/is_const.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/eval_if.hpp> - -namespace boost { namespace fusion { namespace detail -{ - template <typename Tuple, int N> - struct tuple_access_result - { - typedef mpl::at_c<FUSION_GET_TYPES(Tuple), N> element; - typedef typename - mpl::eval_if< - is_const<Tuple> - , cref_result<element> - , ref_result<element> - >::type - type; - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp deleted file mode 100644 index f1be6119d2ef1618f817ec2b136d373f49afad4a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp +++ /dev/null @@ -1,60 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE_AT_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE_AT_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp> - -namespace boost { namespace fusion -{ - struct tuple_tag; - - namespace detail - { - template <int N> - struct tuple_access; - } - - namespace detail - { - template <typename Sequence, int N> - struct tuple_at_impl - { - typedef BOOST_DEDUCED_TYPENAME - boost::fusion::detail::tuple_access_result<Sequence, N>::type - type; - - static type - call(Sequence& t); - }; - - template <typename Sequence, int N> - inline typename tuple_at_impl<Sequence, N>::type - tuple_at_impl<Sequence, N>::call(Sequence& t) - { - return detail::tuple_access<N>::get(t); - } - } - - namespace meta - { - template <typename Tag> - struct at_impl; - - template <> - struct at_impl<tuple_tag> - { - template <typename Sequence, int N> - struct apply : detail::tuple_at_impl<Sequence, N> {}; - }; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp deleted file mode 100644 index e8155162650c3efe713204ae23b2baeb79f7b634..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp +++ /dev/null @@ -1,143 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> - -namespace boost { namespace fusion -{ - struct tuple_tag; - - template <int N, typename Tuple> - struct tuple_iterator; - - namespace tuple_detail - { - template <typename Tuple> - struct begin_traits_impl - { - typedef tuple_iterator<0, Tuple> type; - - static type - call(Tuple& t); - }; - - template <typename Tuple> - inline typename begin_traits_impl<Tuple>::type - begin_traits_impl<Tuple>::call(Tuple& t) - { - return type(t); - } - - template <typename Tuple> - struct end_traits_impl - { - typedef typename Tuple::size size; - typedef tuple_iterator<FUSION_GET_VALUE(size), Tuple> type; - - static type - call(Tuple& t); - }; - - template <typename Tuple> - inline typename end_traits_impl<Tuple>::type - end_traits_impl<Tuple>::call(Tuple& t) - { - return type(t); - } - } - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<tuple_tag> - { - template <typename Tuple> - struct apply : tuple_detail::begin_traits_impl<Tuple> {}; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<tuple_tag> - { - template <typename Tuple> - struct apply : tuple_detail::end_traits_impl<Tuple> {}; - }; - } -}} - -#include <boost/mpl/begin_end.hpp> -#include <boost/mpl/clear.hpp> -#include <boost/mpl/insert.hpp> -#include <boost/mpl/empty.hpp> -#include <boost/spirit/fusion/sequence/tuple_forward.hpp> - -namespace boost { namespace fusion { namespace meta -{ - template <typename Sequence> - struct generate; - - template <typename Sequence, typename T> - struct push_front; -}}} - -namespace boost { namespace mpl -{ - // these mpl traits really ought to be placed somewhere else - - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<fusion::tuple_tag> - : fusion::meta::begin_impl<fusion::tuple_tag> {}; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<fusion::tuple_tag> - : fusion::meta::end_impl<fusion::tuple_tag> {}; - - template <typename Tag> - struct clear_impl; - - template <> - struct clear_impl<fusion::tuple_tag> - { - template <typename Tuple> - struct apply - { - typedef fusion::tuple<> type; - }; - }; - - template <typename Tag> - struct push_front_impl; - - template <> - struct push_front_impl<fusion::tuple_tag> - { - template <typename Tuple, typename T> - struct apply - { - typedef typename fusion::meta::push_front<Tuple, T> func1_; - typedef typename fusion::meta::generate<FUSION_GET_TYPE(func1_)>::type - type; - }; - }; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_body.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_body.hpp deleted file mode 100644 index 81aa65c52195e8bc0034f9426c804911c46054c0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_body.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright David Abrahams 2003. 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) - -// !!No include guards, intentionally!! - -#define N BOOST_PP_ITERATION() - -template <BOOST_PP_ENUM_PARAMS(N, typename T)> -struct BOOST_PP_CAT(tuple, N); - -template <BOOST_PP_ENUM_PARAMS(N, typename T)> -struct BOOST_PP_CAT(tuple_data, N) - : sequence_base<BOOST_PP_CAT(tuple, N) - <BOOST_PP_ENUM_PARAMS(N, T)> > -{ - typedef mpl::BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> types; - typedef tuple_tag tag; - typedef mpl::int_<N> size; - typedef BOOST_PP_CAT(tuple_data, N) identity_type; - - BOOST_PP_CAT(tuple_data, N)() - : BOOST_PP_ENUM(N, FUSION_TUPLE_MEMBER_DEFAULT_INIT, _) {} - - BOOST_PP_CAT(tuple_data, N)(BOOST_PP_ENUM_BINARY_PARAMS( - N, typename detail::call_param<T, >::type _)) - : BOOST_PP_ENUM(N, FUSION_TUPLE_MEMBER_INIT, _) {} - - template <BOOST_PP_ENUM_PARAMS(N, typename A)> - BOOST_PP_CAT(tuple_data, N)(detail::disambiguate_as_iterator, - BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _)) - : BOOST_PP_ENUM(N, FUSION_TUPLE_MEMBER_ITERATOR_INIT, _) {} - - BOOST_PP_REPEAT(N, FUSION_TUPLE_MEMBER, _) -}; - -template <BOOST_PP_ENUM_PARAMS(N, typename T)> -struct BOOST_PP_CAT(tuple, N) - : BOOST_PP_CAT(tuple_data, N)<BOOST_PP_ENUM_PARAMS(N, T)> -{ - typedef BOOST_PP_CAT(tuple_data, N)< - BOOST_PP_ENUM_PARAMS(N, T)> base_type; - - BOOST_PP_CAT(tuple, N)() - : base_type() - {} - - BOOST_PP_CAT(tuple, N)(BOOST_PP_ENUM_BINARY_PARAMS( - N, typename detail::call_param<T, >::type _)) - : base_type(BOOST_PP_ENUM_PARAMS(N, _)) - {} - - template <typename X> - explicit BOOST_PP_CAT(tuple, N)(X const& x) - : base_type(construct(x, &x)) - {} - - template <BOOST_PP_ENUM_PARAMS(N, typename U)> - BOOST_PP_CAT(tuple, N)& - operator=(BOOST_PP_CAT(tuple, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& t) - { - BOOST_PP_REPEAT(N, FUSION_TUPLE_MEMBER_ASSIGN, _) - return *this; - } - -private: - - template <typename i0_type> - static base_type - construct(i0_type const& i0, void const*) - { - FUSION_TUPLE_CONSTRUCT_FROM_ITER(N) - return base_type( - detail::disambiguate_as_iterator(), BOOST_PP_ENUM_PARAMS(N, i)); - } - - template <typename Tuple> - static base_type - construct(Tuple const& t, sequence_root const*) - { - return base_type(BOOST_PP_ENUM_PARAMS(N, t.m)); - } -}; - -#undef N - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_builder.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_builder.hpp deleted file mode 100644 index 53602455d3af3e37a3d6d34ab0677fb1ce87cb3d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_builder.hpp +++ /dev/null @@ -1,89 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE_BUILDER_HPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE_BUILDER_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/sequence/limits.hpp> - -// include tuple0..N where N is FUSION_MAX_TUPLE_SIZE -#include <boost/spirit/fusion/sequence/tuple10.hpp> -#if (FUSION_MAX_TUPLE_SIZE > 10) -#include <boost/spirit/fusion/sequence/tuple20.hpp> -#endif -#if (FUSION_MAX_TUPLE_SIZE > 20) -#include <boost/spirit/fusion/sequence/tuple30.hpp> -#endif -#if (FUSION_MAX_TUPLE_SIZE > 30) -#include <boost/spirit/fusion/sequence/tuple40.hpp> -#endif -#if (FUSION_MAX_TUPLE_SIZE > 40) -#include <boost/spirit/fusion/sequence/tuple50.hpp> -#endif - -#include <boost/mpl/not.hpp> -#include <boost/mpl/distance.hpp> -#include <boost/mpl/find.hpp> -#include <boost/mpl/begin_end.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> - -namespace boost { namespace fusion -{ - struct void_t; -}} - -namespace boost { namespace fusion { namespace detail -{ - template <int N> - struct get_tuple_n; - - template <> - struct get_tuple_n<0> - { - template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, typename T)> - struct call - { - typedef tuple0 type; - }; - }; - -#define FUSION_GET_TUPLE_N(z, n, _) \ - template <> \ - struct get_tuple_n<n> \ - { \ - template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, typename T)> \ - struct call \ - { \ - typedef BOOST_PP_CAT(tuple, n)<BOOST_PP_ENUM_PARAMS(n, T)> type; \ - }; \ - }; - - BOOST_PP_REPEAT_FROM_TO(1, FUSION_MAX_TUPLE_SIZE, FUSION_GET_TUPLE_N, _) -#undef FUSION_GET_TUPLE_N - - template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, typename T)> - struct tuple_builder - { - typedef - mpl::BOOST_PP_CAT(vector, FUSION_MAX_TUPLE_SIZE) - <BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, T)> - input; - - typedef typename mpl::begin<input>::type begin; - typedef typename mpl::find<input, void_t>::type end; - typedef typename mpl::distance<begin, end>::type size; - - typedef typename get_tuple_n<FUSION_GET_VALUE(size)>::template - call<BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, T)>::type - type; - }; -}}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_macro.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_macro.hpp deleted file mode 100644 index 8192b7b7673fb52cd5dff6f501570a6ea1db9d0e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_macro.hpp +++ /dev/null @@ -1,97 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE_MACRO_HPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE_MACRO_HPP - -/////////////////////////////////////////////////////////////////////////////// -// -// Pre-processor gunk. See tuple10.hpp and detail/tuple10.hpp. The -// following code is the preprocessor version of the code found in -// those files, plus/minus a few specific details (specifically, -// the tuple_access<N> and tupleN+1 classes). -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/arithmetic/dec.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> -#include <boost/preprocessor/repetition/enum.hpp> - -#define FUSION_TUPLE_N_ACCESS(z, n, _) \ - \ - template <> \ - struct tuple_access<n> \ - { \ - template <typename Tuple> \ - static typename tuple_access_result<Tuple, n>::type \ - get(Tuple& t) \ - { \ - FUSION_RETURN_TUPLE_MEMBER(n); \ - } \ - }; - -#define FUSION_TUPLE_MEMBER_DEFAULT_INIT(z, n, _) \ - BOOST_PP_CAT(m, n)(BOOST_PP_CAT(T, n)()) - -#define FUSION_TUPLE_MEMBER_INIT(z, n, _) \ - BOOST_PP_CAT(m, n)(BOOST_PP_CAT(_, n)) - -#define FUSION_TUPLE_MEMBER_ITERATOR_INIT(z, n, _) \ - BOOST_PP_CAT(m, n)(*BOOST_PP_CAT(_, n)) - -#define FUSION_TUPLE_MEMBER(z, n, _) \ - BOOST_PP_CAT(T, n) BOOST_PP_CAT(m, n); - -#define FUSION_TUPLE_MEMBER_ASSIGN(z, n, _) \ - this->BOOST_PP_CAT(m, n) = t.BOOST_PP_CAT(m, n); - -#define FUSION_TUPLE_RESULT_OF_NEXT_TYPE(z, n, _) \ - typedef typename meta::next< \ - BOOST_PP_CAT(BOOST_PP_CAT(i, n), _type)>::type \ - BOOST_PP_CAT(BOOST_PP_CAT(i, BOOST_PP_INC(n)), _type); - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) -# define FUSION_TUPLE_RESULT_OF_NEXT(z, n, _) \ - next_iter::BOOST_PP_CAT(BOOST_PP_CAT(i, BOOST_PP_INC(n)), _type) \ - BOOST_PP_CAT(i, BOOST_PP_INC(n))(fusion::next(BOOST_PP_CAT(i, n))); -#else -# define FUSION_TUPLE_RESULT_OF_NEXT(z, n, _) \ - FUSION_TUPLE_RESULT_OF_NEXT_TYPE(z, n, _) \ - BOOST_PP_CAT(BOOST_PP_CAT(i, BOOST_PP_INC(n)), _type) \ - BOOST_PP_CAT(i, BOOST_PP_INC(n))(fusion::next(BOOST_PP_CAT(i, n))); -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) -# define FUSION_TUPLE_NEXT_ITER_N(z, n, _) \ - namespace detail \ - { \ - template <typename i0_type> \ - struct BOOST_PP_CAT(next_iter, n) \ - { \ - BOOST_PP_REPEAT( \ - BOOST_PP_DEC(n), FUSION_TUPLE_RESULT_OF_NEXT_TYPE, _) \ - }; \ - } - -#else -# define FUSION_TUPLE_NEXT_ITER_N(z, n, _) -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) -# define FUSION_TUPLE_CONSTRUCT_FROM_ITER(n) \ - typedef detail::BOOST_PP_CAT(next_iter, n)<i0_type> next_iter; \ - BOOST_PP_REPEAT(BOOST_PP_DEC(n), FUSION_TUPLE_RESULT_OF_NEXT, _) -#else -# define FUSION_TUPLE_CONSTRUCT_FROM_ITER(n) \ - BOOST_PP_REPEAT(BOOST_PP_DEC(n), FUSION_TUPLE_RESULT_OF_NEXT, _) -#endif - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp deleted file mode 100644 index dc1e86d06f1a040e4e82f1f2808cf78f5bf1406e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE_SIZE_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE_SIZE_TRAITS_HPP - -namespace boost { namespace fusion -{ - struct tuple_tag; - - namespace meta - { - template <typename Tag> - struct size_impl; - - template <> - struct size_impl<tuple_tag> - { - template <typename Sequence> - struct apply : Sequence::size {}; - }; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp deleted file mode 100644 index 9c5e7d910f3177af0cbec462088a2c0e4b7bd627..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE_VALUE_AT_TRAITS_IPP) -#define FUSION_SEQUENCE_DETAIL_TUPLE_VALUE_AT_TRAITS_IPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/mpl/at.hpp> - -namespace boost { namespace fusion -{ - struct tuple_tag; - - namespace meta - { - template <typename Tag> - struct value_at_impl; - - template <> - struct value_at_impl<tuple_tag> - { - template <typename Tuple, int N> - struct apply - { - typedef typename - mpl::at_c<FUSION_GET_TYPES(Tuple), N>::type - type; - }; - }; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/detail/type_seq_begin_end_trts.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/detail/type_seq_begin_end_trts.hpp deleted file mode 100644 index 86352cd53f63bfc8cf2d0c49c0ab4efa92bebd4f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/detail/type_seq_begin_end_trts.hpp +++ /dev/null @@ -1,89 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_DETAIL_TYPE_SEQUENCE_BEGIN_END_TRAITS_HPP) -#define FUSION_SEQUENCE_DETAIL_TYPE_SEQUENCE_BEGIN_END_TRAITS_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/mpl/begin_end.hpp> - -namespace boost { namespace fusion -{ - template <typename Iterator> - struct type_sequence_iterator; - - struct type_sequence_tag; - - template <typename SequenceT> - struct type_sequence; - - namespace meta - { - template <typename Tag> - struct begin_impl; - - template <> - struct begin_impl<type_sequence_tag> - { - template <typename Sequence> - struct apply - { - typedef type_sequence_iterator< - typename mpl::begin<typename Sequence::sequence_type>::type> - type; - - static type - call(Sequence) - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - }; - }; - - template <typename Tag> - struct end_impl; - - template <> - struct end_impl<type_sequence_tag> - { - template <typename Sequence> - struct apply - { - typedef type_sequence_iterator< - typename mpl::end<typename Sequence::sequence_type>::type> - type; - - static type - call(Sequence) - { - FUSION_RETURN_DEFAULT_CONSTRUCTED; - } - }; - }; - } -}} - -namespace boost { namespace mpl -{ - template <typename Tag> - struct begin_impl; - - template <typename Tag> - struct end_impl; - - template <> - struct begin_impl<fusion::type_sequence_tag> - : fusion::meta::begin_impl<fusion::type_sequence_tag> {}; - - template <> - struct end_impl<fusion::type_sequence_tag> - : fusion::meta::end_impl<fusion::type_sequence_tag> {}; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/end.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/end.hpp deleted file mode 100644 index 82fdfc6cebab608007442fd58d0d555407366f42..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/end.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_END_HPP) -#define FUSION_SEQUENCE_END_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#include <boost/type_traits/is_const.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct end_impl - { - template <typename Sequence> - struct apply { - typedef int type; - }; - }; - - template <typename Sequence> - struct end - { - typedef as_fusion_sequence<Sequence> seq_converter; - typedef typename seq_converter::type seq; - - typedef typename - end_impl<typename seq::tag>:: - template apply<seq>::type - type; - }; - } - -#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) - namespace detail { - template <typename Sequence> - inline typename meta::end<Sequence const>::type - end(Sequence const& seq,mpl::true_) - { - typedef meta::end<Sequence const> end_meta; - return meta::end_impl<BOOST_DEDUCED_TYPENAME end_meta::seq::tag>:: - template apply<BOOST_DEDUCED_TYPENAME end_meta::seq const>::call( - end_meta::seq_converter::convert_const(seq)); - } - - template <typename Sequence> - inline typename meta::end<Sequence>::type - end(Sequence& seq,mpl::false_) - { - typedef meta::end<Sequence> end_meta; - return meta::end_impl<BOOST_DEDUCED_TYPENAME end_meta::seq::tag>:: - template apply<BOOST_DEDUCED_TYPENAME end_meta::seq>::call( - end_meta::seq_converter::convert(seq)); - } - - } - template <typename Sequence> - inline typename meta::end<Sequence>::type - end(Sequence& seq) - { - return detail::end(seq,is_const<Sequence>()); - } -#else - template <typename Sequence> - inline typename meta::end<Sequence const>::type - end(Sequence const& seq) - { - typedef meta::end<Sequence const> end_meta; - return meta::end_impl<typename end_meta::seq::tag>:: - template apply<typename end_meta::seq const>::call( - end_meta::seq_converter::convert_const(seq)); - } - - template <typename Sequence> - inline typename meta::end<Sequence>::type - end(Sequence& seq) - { - typedef meta::end<Sequence> end_meta; - return meta::end_impl<typename end_meta::seq::tag>:: - template apply<typename end_meta::seq>::call( - end_meta::seq_converter::convert(seq)); - } -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/equal_to.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/equal_to.hpp deleted file mode 100644 index 608f70287b56f5884cf675b17403b1fcbb1963f7..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/equal_to.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_EQUAL_TO_HPP) -#define FUSION_SEQUENCE_EQUAL_TO_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_equal_to.hpp> - -#ifdef FUSION_COMFORMING_COMPILER -#include <boost/butility/enable_if.hpp> -#include <boost/spirit/fusion/sequence/is_sequence.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#endif - -namespace boost { namespace fusion -{ - template <typename Seq1, typename Seq2> - inline bool - operator==(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b) - { - return detail::sequence_equal_to<Seq1 const, Seq2 const>:: - call( - fusion::begin(a.cast()) - , fusion::begin(b.cast()) - ); - } - -#ifdef FUSION_COMFORMING_COMPILER - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq2>, bool>::type - operator==(sequence_base<Seq1> const& a, Seq2 const& b) - { - return a == as_fusion_sequence<Seq2>::convert_const(b); - } - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq1>, bool>::type - operator==(Seq1 const& a, sequence_base<Seq2> const& b) - { - return as_fusion_sequence<Seq1>::convert_const(a) == b; - } - -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/filter_view.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/filter_view.hpp deleted file mode 100644 index ea5f9907069ea8c7ae223c46af225f23b6205dab..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/filter_view.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_FILTER_VIEW_HPP) -#define FUSION_SEQUENCE_FILTER_VIEW_HPP - -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/filter_view_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/filter_view_begin_end_trts.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> - -namespace boost { namespace fusion -{ - struct filter_view_tag; - - template <typename Sequence, typename Pred> - struct filter_view : sequence_base<filter_view<Sequence, Pred> > - { - typedef as_fusion_sequence<Sequence> seq_converter; - typedef typename seq_converter::type seq; - - typedef filter_view_tag tag; - typedef typename meta::begin<seq>::type first_type; - typedef typename meta::end<seq>::type last_type; - typedef Pred pred_type; - - filter_view(Sequence& seq) - : first(fusion::begin(seq)) - , last(fusion::end(seq)) - {} - - first_type first; - last_type last; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/generate.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/generate.hpp deleted file mode 100644 index 903909c395497c651a23cf39c9b307fc19871a18..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/generate.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_GENERATE_HPP) -#define FUSION_SEQUENCE_GENERATE_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/sequence/detail/generate.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Sequence> - struct generate - { - typedef typename as_fusion_sequence<Sequence>::type seq; - typedef typename - detail::result_of_generate< - typename meta::begin<seq const>::type - , typename meta::end<seq const>::type - >::type - type; - }; - } - - template <typename Sequence> - inline typename meta::generate<Sequence>::type - generate(Sequence const& seq) - { - typedef as_fusion_sequence<Sequence> converter; - return detail::generate( - fusion::begin(converter::convert_const(seq)) - , fusion::end(converter::convert_const(seq))); - } -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/get.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/get.hpp deleted file mode 100644 index 1a6d2c37b7753d1b79b05af951514eb097bdf2b3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/get.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_GET_HPP) -#define FUSION_SEQUENCE_GET_HPP - -#include <boost/spirit/fusion/sequence/at.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // - // get function - // - // Given a constant integer N and a sequence, returns a reference to - // the Nth element of the sequence. (N is a zero based index). Usage: - // - // get<N>(seq) - // - // This function is provided here for compatibility with the tuples TR1 - // specification. This function forwards to at<N>(seq). - // - /////////////////////////////////////////////////////////////////////////// - template <int N, typename Sequence> - inline typename meta::at_c<Sequence const, N>::type - get(sequence_base<Sequence> const& seq FUSION_GET_MSVC_WORKAROUND) - { - typedef meta::at_c<Sequence const, N> at_meta; - return meta::at_impl<BOOST_DEDUCED_TYPENAME at_meta::seq::tag>:: - template apply<BOOST_DEDUCED_TYPENAME at_meta::seq const, N>::call( - at_meta::seq_converter::convert_const(seq.cast())); - -// return at<N>(seq.cast()); - } - - template <int N, typename Sequence> - inline typename meta::at_c<Sequence, N>::type - get(sequence_base<Sequence>& seq FUSION_GET_MSVC_WORKAROUND) - { - typedef meta::at_c<Sequence, N> at_meta; - return meta::at_impl<BOOST_DEDUCED_TYPENAME at_meta::seq::tag>:: - template apply<BOOST_DEDUCED_TYPENAME at_meta::seq, N>::call( - at_meta::seq_converter::convert(seq.cast())); -// return at<N>(seq.cast()); - } -}} - -#endif - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/greater.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/greater.hpp deleted file mode 100644 index 799efb532f59dfb44877b3c622952038abefecda..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/greater.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_GREATER_HPP) -#define FUSION_SEQUENCE_GREATER_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_greater.hpp> - -#ifdef FUSION_COMFORMING_COMPILER -#include <boost/butility/enable_if.hpp> -#include <boost/spirit/fusion/sequence/is_sequence.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#endif - -namespace boost { namespace fusion -{ - template <typename Seq1, typename Seq2> - inline bool - operator>(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b) - { - return detail::sequence_greater<Seq1 const, Seq2 const>:: - call( - fusion::begin(a.cast()) - , fusion::begin(b.cast()) - ); - } - -#ifdef FUSION_COMFORMING_COMPILER - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq2>, bool>::type - operator>(sequence_base<Seq1> const& a, Seq2 const& b) - { - return a > as_fusion_sequence<Seq2>::convert_const(b); - } - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq1>, bool>::type - operator>(Seq1 const& a, sequence_base<Seq2> const& b) - { - return as_fusion_sequence<Seq1>::convert_const(a) > b; - } - -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/greater_equal.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/greater_equal.hpp deleted file mode 100644 index c3fbdd7f08040db7ded9741ccd4a6ec3ef66ae16..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/greater_equal.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_GREATER_EQUAL_HPP) -#define FUSION_SEQUENCE_GREATER_EQUAL_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_greater_equal.hpp> - -#ifdef FUSION_COMFORMING_COMPILER -#include <boost/butility/enable_if.hpp> -#include <boost/spirit/fusion/sequence/is_sequence.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#endif - -namespace boost { namespace fusion -{ - template <typename Seq1, typename Seq2> - inline bool - operator>=(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b) - { - return detail::sequence_greater_equal<Seq1 const, Seq2 const>:: - call( - fusion::begin(a.cast()) - , fusion::begin(b.cast()) - ); - } - -#ifdef FUSION_COMFORMING_COMPILER - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq2>, bool>::type - operator>=(sequence_base<Seq1> const& a, Seq2 const& b) - { - return a >= as_fusion_sequence<Seq2>::convert_const(b); - } - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq1>, bool>::type - operator>=(Seq1 const& a, sequence_base<Seq2> const& b) - { - return as_fusion_sequence<Seq1>::convert_const(a) >= b; - } - -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/io.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/io.hpp deleted file mode 100644 index cceadc6dc5fbe5559292ad3023e863d191a68045..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/io.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 1999-2003 Jeremiah Willcock - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(BOOST_IO_HPP) -#define BOOST_IO_HPP - -#include <iostream> -#include <boost/spirit/fusion/sequence/detail/io.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // - // Sequence I/O (<< and >> operators) - // - /////////////////////////////////////////////////////////////////////////// - - template <typename OStream, typename Sequence> - inline OStream& - operator<<(OStream& os, sequence_base<Sequence> const& seq) - { - detail::print_sequence(os, - as_fusion_sequence<Sequence const>::convert(seq.cast())); - return os; - } - - template <typename IStream, typename Sequence> - inline IStream& - operator>>(IStream& is, sequence_base<Sequence>& seq) - { - detail::read_sequence(is, - as_fusion_sequence<Sequence>::convert(seq.cast())); - return is; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/is_sequence.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/is_sequence.hpp deleted file mode 100644 index 40615d7fd6f65c0cb7767fc3e16ef52d812a5f9c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/is_sequence.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_IS_SEQUENCE_HPP) -#define FUSION_SEQUENCE_IS_SEQUENCE_HPP - -#include <boost/type_traits/is_base_and_derived.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // - // is_sequence metafunction - // - // Given a type T, returns a value true or false if T is a - // fusion sequence or not. Usage: - // - // is_sequence<T>::value - // - /////////////////////////////////////////////////////////////////////////// - template <typename T> - struct is_sequence : is_base_and_derived<sequence_root, T> {}; - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/joint_view.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/joint_view.hpp deleted file mode 100644 index 128c82a096f306429b7b46acf009c071fb21263c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/joint_view.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_JOINT_VIEW_HPP) -#define FUSION_SEQUENCE_JOINT_VIEW_HPP - -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/iterator/joint_view_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/joint_view_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> - -namespace boost { namespace fusion -{ - struct joint_view_tag; - - template <typename View1, typename View2> - struct joint_view : sequence_base<joint_view<View1, View2> > - { - typedef as_fusion_sequence<View1> view1_converter; - typedef typename view1_converter::type view1; - typedef as_fusion_sequence<View2> view2_converter; - typedef typename view2_converter::type view2; - - typedef joint_view_tag tag; - typedef typename meta::begin<view1>::type first_type; - typedef typename meta::end<view1>::type last_type; - typedef typename meta::begin<view2>::type concat_type; - typedef typename meta::end<view2>::type concat_last_type; - - joint_view(View1& view1, View2& view2); - - first_type first; - concat_type concat; - concat_last_type concat_last; - }; - - template <typename View1, typename View2> - joint_view<View1,View2>::joint_view(View1& view1, View2& view2) - : first(fusion::begin(view1)) - , concat(fusion::begin(view2)) - , concat_last(fusion::end(view2)) - {} - -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/less.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/less.hpp deleted file mode 100644 index 26809677c6f746c1146f8e564ff9123a8014f868..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/less.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_LESS_HPP) -#define FUSION_SEQUENCE_LESS_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_less.hpp> - -#ifdef FUSION_COMFORMING_COMPILER -#include <boost/butility/enable_if.hpp> -#include <boost/spirit/fusion/sequence/is_sequence.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#endif - -namespace boost { namespace fusion -{ - template <typename Seq1, typename Seq2> - inline bool - operator<(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b) - { - return detail::sequence_less<Seq1 const, Seq2 const>:: - call( - fusion::begin(a.cast()) - , fusion::begin(b.cast()) - ); - } - -#ifdef FUSION_COMFORMING_COMPILER - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq2>, bool>::type - operator<(sequence_base<Seq1> const& a, Seq2 const& b) - { - return a < as_fusion_sequence<Seq2>::convert_const(b); - } - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq1>, bool>::type - operator<(Seq1 const& a, sequence_base<Seq2> const& b) - { - return as_fusion_sequence<Seq1>::convert_const(a) < b; - } - -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/less_equal.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/less_equal.hpp deleted file mode 100644 index 2c03c60f26629f7eab6673378b0d070a37168f0b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/less_equal.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_LESS_EQUAL_HPP) -#define FUSION_SEQUENCE_LESS_EQUAL_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_less_equal.hpp> - -#ifdef FUSION_COMFORMING_COMPILER -#include <boost/butility/enable_if.hpp> -#include <boost/spirit/fusion/sequence/is_sequence.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#endif - -namespace boost { namespace fusion -{ - template <typename Seq1, typename Seq2> - inline bool - operator<=(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b) - { - return detail::sequence_less_equal<Seq1 const, Seq2 const>:: - call( - fusion::begin(a.cast()) - , fusion::begin(b.cast()) - ); - } - -#ifdef FUSION_COMFORMING_COMPILER - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq2>, bool>::type - operator<=(sequence_base<Seq1> const& a, Seq2 const& b) - { - return a <= as_fusion_sequence<Seq2>::convert_const(b); - } - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq1>, bool>::type - operator<=(Seq1 const& a, sequence_base<Seq2> const& b) - { - return as_fusion_sequence<Seq1>::convert_const(a) <= b; - } - -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/limits.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/limits.hpp deleted file mode 100644 index 5c817973d0cf48c3c733cc1e42c9b2c670e6ae74..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/limits.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_LIMITS_HPP) -#define FUSION_SEQUENCE_LIMITS_HPP - -#if !defined(FUSION_MAX_TUPLE_SIZE) -# define FUSION_MAX_TUPLE_SIZE 10 -#else -# if FUSION_MAX_TUPLE_SIZE < 3 -# undef FUSION_MAX_TUPLE_SIZE -# define FUSION_MAX_TUPLE_SIZE 10 -# endif -#endif - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/make_tuple.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/make_tuple.hpp deleted file mode 100644 index 6b73bd0182a9cd64b30cb349f085a2d020c2f060..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/make_tuple.hpp +++ /dev/null @@ -1,47 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_MAKE_TUPLE_HPP) -#define FUSION_SEQUENCE_MAKE_TUPLE_HPP - -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> -#include <boost/spirit/fusion/sequence/tuple.hpp> -#include <boost/spirit/fusion/sequence/detail/as_tuple_element.hpp> - -namespace boost { namespace fusion -{ - inline tuple<> - make_tuple() - { - return tuple<>(); - } - -#define BOOST_FUSION_AS_TUPLE_ELEMENT(z, n, data) \ - BOOST_DEDUCED_TYPENAME detail::as_tuple_element<BOOST_PP_CAT(T, n)>::type - -#define FUSION_MAKE_TUPLE(z, n, _) \ - \ - template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ - inline tuple<BOOST_PP_ENUM(n, BOOST_FUSION_AS_TUPLE_ELEMENT, _)> \ - make_tuple(BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& _)) \ - { \ - return tuple<BOOST_PP_ENUM(n, BOOST_FUSION_AS_TUPLE_ELEMENT, _)>( \ - BOOST_PP_ENUM_PARAMS(n, _)); \ - } - - BOOST_PP_REPEAT_FROM_TO(1, FUSION_MAX_TUPLE_SIZE, FUSION_MAKE_TUPLE, _) - -#undef BOOST_FUSION_AS_TUPLE_ELEMENT -#undef FUSION_MAKE_TUPLE - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/not_equal_to.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/not_equal_to.hpp deleted file mode 100644 index 9db395f585f9f461a9c1d96145fb106071c8a1fc..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/not_equal_to.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_NOT_EQUAL_TO_HPP) -#define FUSION_SEQUENCE_NOT_EQUAL_TO_HPP - -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_not_equal_to.hpp> - -#ifdef FUSION_COMFORMING_COMPILER -#include <boost/butility/enable_if.hpp> -#include <boost/spirit/fusion/sequence/is_sequence.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> -#endif - -namespace boost { namespace fusion -{ - template <typename Seq1, typename Seq2> - inline bool - operator!=(sequence_base<Seq1> const& a, sequence_base<Seq2> const& b) - { - return detail::sequence_not_equal_to<Seq1 const, Seq2 const>:: - call( - fusion::begin(a.cast()) - , fusion::begin(b.cast()) - ); - } - -#ifdef FUSION_COMFORMING_COMPILER - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq2>, bool>::type - operator!=(sequence_base<Seq1> const& a, Seq2 const& b) - { - return a != as_fusion_sequence<Seq2>::convert_const(b); - } - - template <typename Seq1, typename Seq2> - inline typename disable_if<fusion::is_sequence<Seq1>, bool>::type - operator!=(Seq1 const& a, sequence_base<Seq2> const& b) - { - return as_fusion_sequence<Seq1>::convert_const(a) != b; - } - -#endif -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/prepend_view.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/prepend_view.hpp deleted file mode 100644 index d4828e754822ae68a1d3671116a3c0fb53039c26..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/prepend_view.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_PREPEND_VIEW_HPP) -#define FUSION_SEQUENCE_PREPEND_VIEW_HPP - -#include <boost/spirit/fusion/sequence/joint_view.hpp> -#include <boost/spirit/fusion/sequence/single_view.hpp> - -namespace boost { namespace fusion -{ - template <typename View, typename T> - struct prepend_view : joint_view<single_view<T>, View> - { - prepend_view(View& view, T const& val) - : joint_view<single_view<T>, View>(held, view) - , held(val) {} - single_view<T> held; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/range.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/range.hpp deleted file mode 100644 index ff7db2ac3c8ab932a212d279dccb4e32493adfc9..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/range.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_RANGE_HPP) -#define FUSION_SEQUENCE_RANGE_HPP - -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/detail/range_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp> - -namespace boost { namespace fusion -{ - struct range_tag; - - template <typename First, typename Last> - struct range : sequence_base<range<First, Last> > - { - typedef typename as_fusion_iterator<First>::type begin_type; - typedef typename as_fusion_iterator<Last>::type end_type; - typedef range_tag tag; - - range(First const& first, Last const& last) - : first(as_fusion_iterator<First>::convert(first)) - , last(as_fusion_iterator<Last>::convert(last)) {} - - begin_type first; - end_type last; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/single_view.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/single_view.hpp deleted file mode 100644 index 55a81a8ac705f6b176247099a1fa3aa14cf0bfde..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/single_view.hpp +++ /dev/null @@ -1,39 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_SINGLE_VIEW_HPP) -#define FUSION_SEQUENCE_SINGLE_VIEW_HPP - -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/detail/as_tuple_element.hpp> -#include <boost/spirit/fusion/iterator/single_view_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/single_view_begin_end_trts.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> - -namespace boost { namespace fusion -{ - struct single_view_tag; - - template <typename T> - struct single_view : sequence_base<single_view<T> > - { - typedef single_view_tag tag; - typedef typename detail::as_tuple_element<T>::type value_type; - - single_view() - : val() {} - - explicit single_view(typename detail::call_param<T>::type val) - : val(val) {} - - value_type val; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/size.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/size.hpp deleted file mode 100644 index 1fdc5b9b50c06fc7d8fb2c0824e2d46c3cfec80e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/size.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_SIZE_HPP) -#define FUSION_SEQUENCE_SIZE_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // - // size metafunction - // - // Get the size of a Sequence. Usage: - // - // size<Sequence>::value - // - /////////////////////////////////////////////////////////////////////////// - namespace meta - { - template <typename Tag> - struct size_impl - { - template <typename Sequence> - struct apply {}; - }; - - template <typename Sequence> - struct size - : size_impl<typename as_fusion_sequence<Sequence>::type::tag>:: - template apply<typename as_fusion_sequence<Sequence>::type> - {}; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tie.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tie.hpp deleted file mode 100644 index 68e180300e0915911e2c386da98d2896485893b8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tie.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TIE_HPP) -#define FUSION_SEQUENCE_TIE_HPP - -#include <boost/ref.hpp> -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> -#include <boost/spirit/fusion/sequence/tuple.hpp> - -namespace boost { namespace fusion -{ - // Swallows any assignment (by Doug Gregor) - namespace detail - { - struct swallow_assign - { - template<typename T> - swallow_assign const& - operator=(const T&) const - { - return *this; - } - }; - } - - // "ignore" allows tuple positions to be ignored when using "tie". - detail::swallow_assign const ignore = detail::swallow_assign(); - -#define FUSION_REFERENCE_TYPE(z, n, data) \ - BOOST_PP_CAT(T, n)& - -#define FUSION_TIE(z, n, _) \ - \ - template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ - inline tuple<BOOST_PP_ENUM(n, FUSION_REFERENCE_TYPE, _)> \ - tie(BOOST_PP_ENUM_BINARY_PARAMS(n, T, & _)) \ - { \ - return tuple<BOOST_PP_ENUM(n, FUSION_REFERENCE_TYPE, _)>( \ - BOOST_PP_ENUM_PARAMS(n, _)); \ - } - - BOOST_PP_REPEAT_FROM_TO(1, FUSION_MAX_TUPLE_SIZE, FUSION_TIE, _) - -#undef FUSION_REFERENCE_TYPE -#undef FUSION_TIE - -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/transform_view.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/transform_view.hpp deleted file mode 100644 index d1815b80a400c94f8e3115940af2fa059aaff574..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/transform_view.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TRANSFORM_VIEW_HPP) -#define FUSION_SEQUENCE_TRANSFORM_VIEW_HPP - -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/transform_view_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/trsfrm_view_begin_end_trts.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/sequence/begin.hpp> -#include <boost/spirit/fusion/sequence/end.hpp> - -namespace boost { namespace fusion -{ - struct transform_view_tag; - - template <typename Sequence, typename F> - struct transform_view : sequence_base<transform_view<Sequence, F> > - { - typedef as_fusion_sequence<Sequence> seq_converter; - typedef typename seq_converter::type seq; - - typedef transform_view_tag tag; - typedef typename meta::begin<seq>::type first_type; - typedef typename meta::end<seq>::type last_type; - typedef F transform_type; - - transform_view(Sequence& seq, F f); - - first_type first; - last_type last; - transform_type f; - }; - - template <typename Sequence, typename F> - transform_view<Sequence,F>::transform_view(Sequence& seq, F f) - : first(fusion::begin(seq)) - , last(fusion::end(seq)) - , f(f) - {} -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple.hpp deleted file mode 100644 index 5d27572ed3ae2e0e802741f32aa4ac8bccbe410b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple.hpp +++ /dev/null @@ -1,74 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE_HPP) -#define FUSION_SEQUENCE_TUPLE_HPP - -#include <utility> // for std::pair -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_builder.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> -#include <boost/spirit/fusion/sequence/tuple_forward.hpp> - -#define FUSION_TUPLE_CONSTRUCTOR(z, n, _) \ - tuple(BOOST_PP_ENUM_BINARY_PARAMS( \ - n, typename detail::call_param<T, >::type _)) \ - : base_type(BOOST_PP_ENUM_PARAMS(n, _)) \ - {} - -namespace boost { namespace fusion -{ - struct void_t; - - template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, typename T)> - struct tuple : - detail::tuple_builder< - BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, T) - >::type - { - typedef - typename detail::tuple_builder< - BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, T) - >::type - base_type; - - tuple() - : base_type() {} - - template <typename X> - /*explicit*/ tuple(X const& x) - : base_type(x) {} - - explicit tuple(typename detail::call_param<T0>::type _0) - : base_type(_0) {} - - BOOST_PP_REPEAT_FROM_TO( - 2, FUSION_MAX_TUPLE_SIZE, FUSION_TUPLE_CONSTRUCTOR, _) - - template <typename X> - tuple& operator=(X const& other) - { - base() = other; - return *this; - } - - typedef detail::tuple_builder<BOOST_PP_ENUM_PARAMS(FUSION_MAX_TUPLE_SIZE, T)> builder; - - typedef typename builder::begin begin; - typedef typename builder::end end; - typedef typename builder::size size; - - base_type& base() { return *this; } - base_type const& base() const { return *this; } - }; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple10.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple10.hpp deleted file mode 100644 index a22682cd3bb086f43ad5de48fdeed62702e8f10c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple10.hpp +++ /dev/null @@ -1,301 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE10_HPP) -#define FUSION_SEQUENCE_TUPLE10_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple10.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <utility> // for std::pair -#include <boost/mpl/int.hpp> -#include <boost/mpl/vector/vector10.hpp> -#include <boost/mpl/if.hpp> -#include <boost/butility/addressof.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Iterator> - struct next; - } - - struct tuple_tag; - - struct tuple0 : sequence_base<tuple0> - { - typedef mpl::void_ types; - typedef tuple_tag tag; - typedef mpl::int_<0> size; - typedef tuple0 identity_type; - - tuple0() {} - - template <typename Iterator> - tuple0(Iterator const& i) {} - }; - - template <typename T0> - struct tuple1 : sequence_base<tuple1<T0> > - { - typedef mpl::vector1<T0> types; - typedef tuple_tag tag; - typedef mpl::int_<1> size; - typedef tuple1 identity_type; - - tuple1() - : m0(T0()) - {} - - template <typename X> - explicit tuple1(X const& x) - : m0(construct(x, detail::disambiguate<X, T0>::call())) - {} - - tuple1(typename detail::call_param<T0>::type _0) - : m0(_0) - {} - - template <typename U0> - tuple1& operator=(tuple1<U0> const& t) - { - m0 = t.m0; - return *this; - } - - T0 m0; - - private: - - template <typename Iterator> - static T0 - construct(Iterator const& i, detail::disambiguate_as_iterator) - { - return *i; - } - - template <typename Tuple> - static T0 - construct(Tuple const& t, detail::disambiguate_as_tuple) - { - return t.m0; - } - - template <typename X> - static T0 - construct(X const& v, detail::disambiguate_as_data) - { - return v; - } - }; - - template <typename T0, typename T1> - struct tuple2; - - template <typename T0, typename T1> - struct tuple_data2 : sequence_base<tuple2<T0, T1> > - { - typedef mpl::vector2<T0, T1> types; - typedef tuple_tag tag; - typedef mpl::int_<2> size; - typedef tuple_data2 identity_type; - - tuple_data2() - : m0(T0()) - , m1(T1()) - {} - - tuple_data2( - typename detail::call_param<T0>::type _0 - , typename detail::call_param<T1>::type _1 - ) - : m0(_0) - , m1(_1) - {} - - template <typename A0, typename A1> - tuple_data2(detail::disambiguate_as_iterator, A0& _0, A1& _1) - : m0(*_0) - , m1(*_1) - {} - - T0 m0; - T1 m1; - }; - - template <typename T0, typename T1, typename T2> - struct tuple3; - - template <typename T0, typename T1, typename T2> - struct tuple_data3 : sequence_base<tuple3<T0, T1, T2> > - { - typedef mpl::vector3<T0, T1, T2> types; - typedef tuple_tag tag; - typedef mpl::int_<3> size; - typedef tuple_data3 identity_type; - - tuple_data3() - : m0(T0()) - , m1(T1()) - , m2(T2()) - {} - - tuple_data3( - typename detail::call_param<T0>::type _0 - , typename detail::call_param<T1>::type _1 - , typename detail::call_param<T2>::type _2 - ) - : m0(_0) - , m1(_1) - , m2(_2) - {} - - template <typename A0, typename A1, typename A2> - tuple_data3(detail::disambiguate_as_iterator, A0& _0, A1& _1, A2& _2) - : m0(*_0) - , m1(*_1) - , m2(*_2) - {} - - T0 m0; - T1 m1; - T2 m2; - }; - - template <typename T0, typename T1> - struct tuple2 : tuple_data2<T0, T1> - { - tuple2() - : tuple_data2<T0, T1>() - {} - - tuple2( - typename detail::call_param<T0>::type _0 - , typename detail::call_param<T1>::type _1 - ) - : tuple_data2<T0, T1>(_0, _1) - {} - - template <typename X> - explicit tuple2(X const& x) - : tuple_data2<T0, T1>(construct(x, addressof(x))) - {} - - template <typename U0, typename U1> - tuple2& operator=(tuple2<U0, U1> const& t) - { - this->m0 = t.m0; - this->m1 = t.m1; - return *this; - } - - template <typename First, typename Second> - tuple2& operator=(std::pair<First, Second> const& p) - { - this->m0 = p.first; - this->m1 = p.second; - return *this; - } - - private: - - template <typename Iterator> - static tuple_data2<T0, T1> - construct(Iterator const& i, void const*) - { - typedef typename meta::next<Iterator>::type i1_type; - i1_type i1(fusion::next(i)); - return tuple_data2<T0, T1>(detail::disambiguate_as_iterator(), i, i1); - } - - template <typename Tuple> - static tuple_data2<T0, T1> - construct(Tuple const& t, sequence_root const*) - { - return tuple_data2<T0, T1>(t.m0, t.m1); - } - - template <typename U0, typename U1> - static tuple_data2<T0, T1> - construct(std::pair<U0, U1> const& p, std::pair<U0, U1> const*) - { - return tuple_data2<T0, T1>(p.first, p.second); - } - }; - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) - namespace detail - { - template <typename Iterator> - struct next_iter3 - { - typedef typename meta::next<Iterator>::type i1_type; - typedef typename meta::next<i1_type>::type i2_type; - }; - } -#endif - - template <typename T0, typename T1, typename T2> - struct tuple3 : tuple_data3<T0, T1, T2> - { - tuple3() - : tuple_data3<T0, T1, T2>() - {} - - tuple3( - typename detail::call_param<T0>::type _0 - , typename detail::call_param<T1>::type _1 - , typename detail::call_param<T2>::type _2 - ) - : tuple_data3<T0, T1, T2>(_0, _1, _2) - {} - - template <typename X> - explicit tuple3(X const& x) - : tuple_data3<T0, T1, T2>(construct(x, &x)) - {} - - template <typename U0, typename U1, typename U2> - tuple3& operator=(tuple3<U0, U1, U2> const& t) - { - this->m0 = t.m0; - this->m1 = t.m1; - this->m2 = t.m2; - return *this; - } - - private: - - template <typename Iterator> - static tuple_data3<T0, T1, T2> - construct(Iterator const& i, void const*) - { -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) - typedef detail::next_iter3<Iterator> next_iter; - next_iter::i1_type i1(fusion::next(i)); - next_iter::i2_type i2(fusion::next(i1)); -#else - typedef typename meta::next<Iterator>::type i1_type; - typedef typename meta::next<i1_type>::type i2_type; - i1_type i1(fusion::next(i)); - i2_type i2(fusion::next(i1)); -#endif - return tuple_data3<T0, T1, T2>(detail::disambiguate_as_iterator(), i, i1, i2); - } - - template <typename Tuple> - static tuple_data3<T0, T1, T2> - construct(Tuple const& t, sequence_root const*) - { - return tuple_data3<T0, T1, T2>(t.m0, t.m1, t.m2); - } - }; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple20.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple20.hpp deleted file mode 100644 index 5dac6e93f3d8f9235049086a1c49eb05a8559524..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple20.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE20_HPP) -#define FUSION_SEQUENCE_TUPLE20_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/tuple_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_macro.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/vector/vector20.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include <boost/spirit/fusion/iterator/next.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// See tuple10.hpp and detail/tuple10.ipp. The following code are -// expansions of the tuple_access<N> and tupleN+1 classes for N = 10..20. -// -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace fusion -{ - namespace detail - { - BOOST_PP_REPEAT_FROM_TO(10, 20, FUSION_TUPLE_N_ACCESS, _) - } - - struct tuple_tag; - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (11, 20, <boost/spirit/fusion/sequence/detail/tuple_body.hpp>)) -# include BOOST_PP_ITERATE() -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple30.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple30.hpp deleted file mode 100644 index bf7abebcec99e4a661528feaac446aa1d51cfed5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple30.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE30_HPP) -#define FUSION_SEQUENCE_TUPLE30_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/tuple_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_macro.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/vector/vector30.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include <boost/spirit/fusion/iterator/next.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// See tuple10.hpp and detail/tuple10.ipp. The following code are -// expansions of the tuple_access<N> and tupleN+1 classes for N = 20..30. -// -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace fusion -{ - namespace detail - { - BOOST_PP_REPEAT_FROM_TO(20, 30, FUSION_TUPLE_N_ACCESS, _) - } - - struct tuple_tag; - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (21, 30, <boost/spirit/fusion/sequence/detail/tuple_body.hpp>)) -# include BOOST_PP_ITERATE() -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple40.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple40.hpp deleted file mode 100644 index fb0d135637fd9b56d32e64eb6c6bdbb9240b50d5..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple40.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE40_HPP) -#define FUSION_SEQUENCE_TUPLE40_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/tuple_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_macro.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/vector/vector40.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include <boost/spirit/fusion/iterator/next.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// See tuple10.hpp and detail/tuple10.ipp. The following code are -// expansions of the tuple_access<N> and tupleN+1 classes for N = 30..40. -// -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace fusion -{ - namespace detail - { - BOOST_PP_REPEAT_FROM_TO(30, 40, FUSION_TUPLE_N_ACCESS, _) - } - - struct tuple_tag; - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (31, 40, <boost/spirit/fusion/sequence/detail/tuple_body.hpp>)) -# include BOOST_PP_ITERATE() -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple50.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple50.hpp deleted file mode 100644 index 301b53d8008fe058cf96afa3dd207e8101304048..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple50.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE50_HPP) -#define FUSION_SEQUENCE_TUPLE50_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/tuple_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_macro.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/spirit/fusion/iterator/next.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/vector/vector50.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include <boost/spirit/fusion/iterator/next.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// See tuple10.hpp and detail/tuple10.hpp. The following code are -// expansions of the tuple_access<N> and tupleN+1 classes for N = 40..50. -// -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace fusion -{ - namespace detail - { - BOOST_PP_REPEAT_FROM_TO(40, 50, FUSION_TUPLE_N_ACCESS, _) - } - - struct tuple_tag; - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (41, 50, <boost/spirit/fusion/sequence/detail/tuple_body.hpp>)) -# include BOOST_PP_ITERATE() -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple_element.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple_element.hpp deleted file mode 100644 index 1b668a56e805f9c6c457713941507bc2d31aaa4b..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple_element.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE_ELEMENT_HPP) -#define FUSION_SEQUENCE_TUPLE_ELEMENT_HPP - -#include <boost/spirit/fusion/sequence/value_at.hpp> - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // - // tuple_element metafunction - // - // Given a constant integer N and a Sequence, returns the - // tuple element type at slot N. (N is a zero based index). Usage: - // - // tuple_element<N, Sequence>::type - // - // This metafunction is provided here for compatibility with the - // tuples TR1 specification. This metafunction forwards to - // meta::value_at_c<Sequence>. - // - /////////////////////////////////////////////////////////////////////////// - template <int N, typename Sequence> - struct tuple_element : meta::value_at_c<Sequence, N> {}; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple_forward.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple_forward.hpp deleted file mode 100644 index 4b44a437f0ae12c2ad69685b9672df1d53f27856..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple_forward.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/*============================================================================= - Copyright (c) 1999-2003 Jaakko J�rvi - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE_FORWARD_HPP) -#define FUSION_SEQUENCE_TUPLE_FORWARD_HPP - -#include <boost/spirit/fusion/sequence/limits.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> - -namespace boost { namespace fusion -{ - struct void_t; - - template < - BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( - FUSION_MAX_TUPLE_SIZE, typename T, void_t) - > - struct tuple; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/tuple_size.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/tuple_size.hpp deleted file mode 100644 index 9f82e50022128532685646f7cd03538de1a76899..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/tuple_size.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TUPLE_SIZE_HPP) -#define FUSION_SEQUENCE_TUPLE_SIZE_HPP - -#include <boost/spirit/fusion/sequence/size.hpp> - -namespace boost { namespace fusion -{ - /////////////////////////////////////////////////////////////////////////// - // - // tuple_size metafunction - // - // Get the size of Sequence. Usage: - // - // tuple_size<Sequence>::value - // - // This metafunction is provided here for compatibility with the - // tuples TR1 specification. This metafunction forwards to - // meta::size<Sequence>. - // - /////////////////////////////////////////////////////////////////////////// - template <typename Sequence> - struct tuple_size : meta::size<Sequence> {}; -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/type_sequence.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/type_sequence.hpp deleted file mode 100644 index 6df8891ccfe35531e67d88a919de9913f628e193..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/type_sequence.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_TYPE_SEQUENCE_HPP) -#define FUSION_SEQUENCE_TYPE_SEQUENCE_HPP - -#include <boost/spirit/fusion/detail/access.hpp> -#include <boost/spirit/fusion/iterator/type_sequence_iterator.hpp> -#include <boost/spirit/fusion/sequence/detail/type_seq_begin_end_trts.hpp> -#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp> -#include <boost/type_traits/remove_const.hpp> - -namespace boost { namespace fusion -{ - struct type_sequence_tag; - - template <typename Sequence> - struct type_sequence : sequence_base<type_sequence<Sequence> > - { - typedef type_sequence_tag tag; - typedef typename remove_const<Sequence>::type sequence_type; - }; -}} - -#endif - - diff --git a/Utilities/BGL/boost/spirit/fusion/sequence/value_at.hpp b/Utilities/BGL/boost/spirit/fusion/sequence/value_at.hpp deleted file mode 100644 index 5cebad33e78d959d484e9ff29da6cfab107b8bcd..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/fusion/sequence/value_at.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2004 Peder Holt - - 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) -==============================================================================*/ -#if !defined(FUSION_SEQUENCE_VALUE_AT_HPP) -#define FUSION_SEQUENCE_VALUE_AT_HPP - -#include <boost/spirit/fusion/detail/config.hpp> -#include <boost/spirit/fusion/sequence/as_fusion_sequence.hpp> - -namespace boost { namespace fusion -{ - namespace meta - { - template <typename Tag> - struct value_at_impl - { - template <typename Sequence, int N> - struct apply { - typedef int type; - }; - }; - - template <typename Sequence, int N> - struct value_at_c - { - typedef as_fusion_sequence<Sequence> seq_converter; - typedef typename seq_converter::type seq; - - typedef typename - value_at_impl<FUSION_GET_TAG(seq)>:: - template apply<seq, N>::type - type; - }; - - template <typename Sequence, typename N> - struct value_at : value_at_c<Sequence, N::value> {}; - } -}} - -#endif diff --git a/Utilities/BGL/boost/spirit/iterator.hpp b/Utilities/BGL/boost/spirit/iterator.hpp deleted file mode 100644 index b0719c13b0d2724ceeef239b3920ce4fdb081df6..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/iterator.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2003 Giovanni Bajo - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_ITERATOR_MAIN_HPP) -#define BOOST_SPIRIT_ITERATOR_MAIN_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Master header for Spirit.Iterators -// -/////////////////////////////////////////////////////////////////////////////// - -#include <boost/spirit/iterator/file_iterator.hpp> -#include <boost/spirit/iterator/fixed_size_queue.hpp> -#include <boost/spirit/iterator/position_iterator.hpp> -#include <boost/spirit/iterator/multi_pass.hpp> - -#endif // !defined(BOOST_SPIRIT_ITERATOR_MAIN_HPP) diff --git a/Utilities/BGL/boost/spirit/iterator/file_iterator.hpp b/Utilities/BGL/boost/spirit/iterator/file_iterator.hpp deleted file mode 100644 index 8d79629d6b9a442906c947d0e5c30d9b64f1afdb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/iterator/file_iterator.hpp +++ /dev/null @@ -1,238 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Giovanni Bajo - Copyright (c) 2003 Thomas Witt - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -/////////////////////////////////////////////////////////////////////////////// -// -// File Iterator structure -// -// The new structure is designed on layers. The top class (used by the user) -// is file_iterator, which implements a full random access iterator through -// the file, and some specific member functions (constructor that opens -// the file, make_end() to generate the end iterator, operator bool to check -// if the file was opened correctly). -// -// file_iterator implements the random access iterator interface by the means -// of boost::iterator_adaptor, that is inhering an object created with it. -// iterator_adaptor gets a low-level file iterator implementation (with just -// a few member functions) and a policy (that basically describes to it how -// the low-level file iterator interface is). The advantage is that -// with boost::iterator_adaptor only 5 functions are needed to implement -// a fully conformant random access iterator, instead of dozens of functions -// and operators. -// -// There are two low-level file iterators implemented in this module. The -// first (std_file_iterator) uses cstdio stream functions (fopen/fread), which -// support full buffering, and is available everywhere (it's standard C++). -// The second (mmap_file_iterator) is currently available only on Windows -// platforms, and uses memory mapped files, which gives a decent speed boost. -// -/////////////////////////////////////////////////////////////////////////////// -// -// TODO LIST: -// -// - In the Win32 mmap iterator, we could check if keeping a handle to the -// opened file is really required. If it's not, we can just store the file -// length (for make_end()) and save performance. Notice that this should be -// tested under different Windows versions, the behaviour might change. -// - Add some error support (by the means of some exceptions) in case of -// low-level I/O failure. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_SPIRIT_FILE_ITERATOR_HPP -#define BOOST_SPIRIT_FILE_ITERATOR_HPP - -#include <string> -#include <boost/config.hpp> -#include <boost/iterator_adaptors.hpp> -#include <boost/spirit/core/safe_bool.hpp> - -#if !defined(BOOST_SPIRIT_FILEITERATOR_STD) -# if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) \ - && !defined(BOOST_DISABLE_WIN32) -# define BOOST_SPIRIT_FILEITERATOR_WINDOWS -# elif defined(BOOST_HAS_UNISTD_H) -extern "C" -{ -# include <unistd.h> -} -# ifdef _POSIX_MAPPED_FILES -# define BOOST_SPIRIT_FILEITERATOR_POSIX -# endif // _POSIX_MAPPED_FILES -# endif // BOOST_HAS_UNISTD_H - -# if !defined(BOOST_SPIRIT_FILEITERATOR_WINDOWS) && \ - !defined(BOOST_SPIRIT_FILEITERATOR_POSIX) -# define BOOST_SPIRIT_FILEITERATOR_STD -# endif -#endif // BOOST_SPIRIT_FILEITERATOR_STD - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -namespace fileiter_impl { - - // Forward declarations - template <typename CharT = char> - class std_file_iterator; - -#if !defined(BOOST_SPIRIT_FILEITERATOR_STD) - template <typename CharT = char> - class mmap_file_iterator; -#endif - -/////////////////////////////////////////////////////////////////////////////// -} // namespace fileiter_impl - -template < - typename CharT = char, - typename BaseIterator = -#ifdef BOOST_SPIRIT_FILEITERATOR_STD - fileiter_impl::std_file_iterator<CharT> -#else - fileiter_impl::mmap_file_iterator<CharT> -#endif -> class file_iterator; - -/////////////////////////////////////////////////////////////////////////////// -namespace fileiter_impl { - - ///////////////////////////////////////////////////////////////////////// - // - // file_iter_generator - // - // Template meta-function to invoke boost::iterator_adaptor - // NOTE: This cannot be moved into the implementation file because of - // a bug of MSVC 7.0 and previous versions (base classes types are - // looked up at compilation time, not instantion types, and - // file_iterator would break). - // - ///////////////////////////////////////////////////////////////////////// - -#if !defined(BOOST_ITERATOR_ADAPTORS_VERSION) || \ - BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 -#error "Please use at least Boost V1.31.0 while compiling the file_iterator class!" -#else // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 - - template <typename CharT, typename BaseIteratorT> - struct file_iter_generator - { - public: - typedef BaseIteratorT adapted_t; - typedef typename adapted_t::value_type value_type; - - typedef boost::iterator_adaptor < - file_iterator<CharT, BaseIteratorT>, - adapted_t, - value_type const, - std::random_access_iterator_tag, - boost::use_default, - signed long - > type; - }; - -#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 - -/////////////////////////////////////////////////////////////////////////////// -} /* namespace impl */ - - -/////////////////////////////////////////////////////////////////////////////// -// -// file_iterator -// -// Iterates through an opened file. -// -// The main iterator interface is implemented by the iterator_adaptors -// library, which wraps a conforming iterator interface around the -// impl::BaseIterator class. This class merely derives the iterator_adaptors -// generated class to implement the custom constructors and make_end() -// member function. -// -/////////////////////////////////////////////////////////////////////////////// - -template<typename CharT, typename BaseIteratorT> -class file_iterator - : public fileiter_impl::file_iter_generator<CharT, BaseIteratorT>::type, - public safe_bool<file_iterator<CharT, BaseIteratorT> > -{ -private: - typedef typename - fileiter_impl::file_iter_generator<CharT, BaseIteratorT>::type - base_t; - typedef typename - fileiter_impl::file_iter_generator<CharT, BaseIteratorT>::adapted_t - adapted_t; - -public: - file_iterator() - {} - - file_iterator(std::string fileName) - : base_t(adapted_t(fileName)) - {} - - file_iterator(const base_t& iter) - : base_t(iter) - {} - - inline file_iterator& operator=(const base_t& iter); - file_iterator make_end(void); - - // operator bool. This borrows a trick from boost::shared_ptr to avoid - // to interfere with arithmetic operations. - bool operator_bool(void) const - { return this->base(); } - -private: - friend class ::boost::iterator_core_access; - - typename base_t::reference dereference() const - { - return this->base_reference().get_cur_char(); - } - - void increment() - { - this->base_reference().next_char(); - } - - void decrement() - { - this->base_reference().prev_char(); - } - - void advance(typename base_t::difference_type n) - { - this->base_reference().advance(n); - } - - template < - typename OtherDerivedT, typename OtherIteratorT, - typename V, typename C, typename R, typename D - > - typename base_t::difference_type distance_to( - iterator_adaptor<OtherDerivedT, OtherIteratorT, V, C, R, D> - const &x) const - { - return x.base().distance(this->base_reference()); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -}} /* namespace boost::spirit */ - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/iterator/impl/file_iterator.ipp> /* implementation */ - -#endif /* BOOST_SPIRIT_FILE_ITERATOR_HPP */ - diff --git a/Utilities/BGL/boost/spirit/iterator/fixed_size_queue.hpp b/Utilities/BGL/boost/spirit/iterator/fixed_size_queue.hpp deleted file mode 100644 index 9f18b42288077098a158abc27fea6e75472d29ab..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/iterator/fixed_size_queue.hpp +++ /dev/null @@ -1,398 +0,0 @@ -/*============================================================================= - Copyright (c) 2001, Daniel C. Nuffer - Copyright (c) 2003, Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef FIXED_SIZE_QUEUE -#define FIXED_SIZE_QUEUE - -#include <cstdlib> -#include <iterator> -#include <cstddef> - -#include <boost/spirit/core/assert.hpp> // for BOOST_SPIRIT_ASSERT - -// FIXES for broken compilers -#include <boost/config.hpp> -#include <boost/iterator_adaptors.hpp> - -#define BOOST_SPIRIT_ASSERT_FSQ_SIZE \ - BOOST_SPIRIT_ASSERT(((m_tail + N + 1) - m_head) % (N+1) == m_size % (N+1)) \ - /**/ - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - -#if !defined(BOOST_ITERATOR_ADAPTORS_VERSION) || \ - BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 -#error "Please use at least Boost V1.31.0 while compiling the fixed_size_queue class!" -#else // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 - -template <typename QueueT, typename T, typename PointerT> -class fsq_iterator -: public boost::iterator_adaptor< - fsq_iterator<QueueT, T, PointerT>, - PointerT, - T, - std::random_access_iterator_tag - > -{ -public: - typedef typename QueueT::position_t position; - typedef boost::iterator_adaptor< - fsq_iterator<QueueT, T, PointerT>, PointerT, T, - std::random_access_iterator_tag - > base_t; - - fsq_iterator() {} - fsq_iterator(position const &p_) : p(p_) {} - - position const &get_position() const { return p; } - -private: - friend class boost::iterator_core_access; - - typename base_t::reference dereference() const - { - return p.self->m_queue[p.pos]; - } - - void increment() - { - ++p.pos; - if (p.pos == QueueT::MAX_SIZE+1) - p.pos = 0; - } - - void decrement() - { - if (p.pos == 0) - p.pos = QueueT::MAX_SIZE; - else - --p.pos; - } - - template < - typename OtherDerivedT, typename OtherIteratorT, - typename V, typename C, typename R, typename D - > - bool equal(iterator_adaptor<OtherDerivedT, OtherIteratorT, V, C, R, D> - const &x) const - { - position const &rhs_pos = - static_cast<OtherDerivedT const &>(x).get_position(); - return (p.self == rhs_pos.self) && (p.pos == rhs_pos.pos); - } - - template < - typename OtherDerivedT, typename OtherIteratorT, - typename V, typename C, typename R, typename D - > - typename base_t::difference_type distance_to( - iterator_adaptor<OtherDerivedT, OtherIteratorT, V, C, R, D> - const &x) const - { - typedef typename base_t::difference_type diff_t; - - position const &p2 = - static_cast<OtherDerivedT const &>(x).get_position(); - std::size_t pos1 = p.pos; - std::size_t pos2 = p2.pos; - - // Undefined behaviour if the iterators come from different - // containers - BOOST_SPIRIT_ASSERT(p.self == p2.self); - - if (pos1 < p.self->m_head) - pos1 += QueueT::MAX_SIZE; - if (pos2 < p2.self->m_head) - pos2 += QueueT::MAX_SIZE; - - if (pos2 > pos1) - return diff_t(pos2 - pos1); - else - return -diff_t(pos1 - pos2); - } - - void advance(typename base_t::difference_type n) - { - // Notice that we don't care values of n that can - // wrap around more than one time, since it would - // be undefined behaviour anyway (going outside - // the begin/end range). Negative wrapping is a bit - // cumbersome because we don't want to case p.pos - // to signed. - if (n < 0) - { - n = -n; - if (p.pos < (std::size_t)n) - p.pos = QueueT::MAX_SIZE+1 - (n - p.pos); - else - p.pos -= n; - } - else - { - p.pos += n; - if (p.pos >= QueueT::MAX_SIZE+1) - p.pos -= QueueT::MAX_SIZE+1; - } - } - -private: - position p; -}; - -#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 - -/////////////////////////////////////////////////////////////////////////////// -} /* namespace impl */ - -template <typename T, std::size_t N> -class fixed_size_queue -{ -private: - struct position - { - fixed_size_queue* self; - std::size_t pos; - - position() : self(0), pos(0) {} - - // The const_cast here is just to avoid to have two different - // position structures for the const and non-const case. - // The const semantic is guaranteed by the iterator itself - position(const fixed_size_queue* s, std::size_t p) - : self(const_cast<fixed_size_queue*>(s)), pos(p) - {} - }; - -public: - // Declare the iterators - typedef impl::fsq_iterator<fixed_size_queue<T, N>, T, T*> iterator; - typedef impl::fsq_iterator<fixed_size_queue<T, N>, T const, T const*> - const_iterator; - typedef position position_t; - - friend class impl::fsq_iterator<fixed_size_queue<T, N>, T, T*>; - friend class impl::fsq_iterator<fixed_size_queue<T, N>, T const, T const*>; - - fixed_size_queue(); - fixed_size_queue(const fixed_size_queue& x); - fixed_size_queue& operator=(const fixed_size_queue& x); - ~fixed_size_queue(); - - void push_back(const T& e); - void push_front(const T& e); - void serve(T& e); - void pop_front(); - - bool empty() const - { - return m_size == 0; - } - - bool full() const - { - return m_size == N; - } - - iterator begin() - { - return iterator(position(this, m_head)); - } - - const_iterator begin() const - { - return const_iterator(position(this, m_head)); - } - - iterator end() - { - return iterator(position(this, m_tail)); - } - - const_iterator end() const - { - return const_iterator(position(this, m_tail)); - } - - std::size_t size() const - { - return m_size; - } - - T& front() - { - return m_queue[m_head]; - } - - const T& front() const - { - return m_queue[m_head]; - } - -private: - // Redefine the template parameters to avoid using partial template - // specialization on the iterator policy to extract N. - BOOST_STATIC_CONSTANT(std::size_t, MAX_SIZE = N); - - std::size_t m_head; - std::size_t m_tail; - std::size_t m_size; - T m_queue[N+1]; -}; - -template <typename T, std::size_t N> -inline -fixed_size_queue<T, N>::fixed_size_queue() - : m_head(0) - , m_tail(0) - , m_size(0) -{ - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); -} - -template <typename T, std::size_t N> -inline -fixed_size_queue<T, N>::fixed_size_queue(const fixed_size_queue& x) - : m_head(x.m_head) - , m_tail(x.m_tail) - , m_size(x.m_size) -{ - copy(x.begin(), x.end(), begin()); - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); -} - -template <typename T, std::size_t N> -inline fixed_size_queue<T, N>& -fixed_size_queue<T, N>::operator=(const fixed_size_queue& x) -{ - if (this != &x) - { - m_head = x.m_head; - m_tail = x.m_tail; - m_size = x.m_size; - copy(x.begin(), x.end(), begin()); - } - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); - - return *this; -} - -template <typename T, std::size_t N> -inline -fixed_size_queue<T, N>::~fixed_size_queue() -{ - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); -} - -template <typename T, std::size_t N> -inline void -fixed_size_queue<T, N>::push_back(const T& e) -{ - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); - - BOOST_SPIRIT_ASSERT(!full()); - - m_queue[m_tail] = e; - ++m_size; - ++m_tail; - if (m_tail == N+1) - m_tail = 0; - - - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); -} - -template <typename T, std::size_t N> -inline void -fixed_size_queue<T, N>::push_front(const T& e) -{ - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); - - BOOST_SPIRIT_ASSERT(!full()); - - if (m_head == 0) - m_head = N; - else - --m_head; - - m_queue[m_head] = e; - ++m_size; - - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); -} - - -template <typename T, std::size_t N> -inline void -fixed_size_queue<T, N>::serve(T& e) -{ - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); - - e = m_queue[m_head]; - pop_front(); -} - - - -template <typename T, std::size_t N> -inline void -fixed_size_queue<T, N>::pop_front() -{ - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); - - ++m_head; - if (m_head == N+1) - m_head = 0; - --m_size; - - BOOST_SPIRIT_ASSERT(m_size <= N+1); - BOOST_SPIRIT_ASSERT_FSQ_SIZE; - BOOST_SPIRIT_ASSERT(m_head <= N+1); - BOOST_SPIRIT_ASSERT(m_tail <= N+1); -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#undef BOOST_SPIRIT_ASSERT_FSQ_SIZE - -#endif diff --git a/Utilities/BGL/boost/spirit/iterator/impl/file_iterator.ipp b/Utilities/BGL/boost/spirit/iterator/impl/file_iterator.ipp deleted file mode 100644 index 385067698e556f7e237e22872d957c196a520c74..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/iterator/impl/file_iterator.ipp +++ /dev/null @@ -1,459 +0,0 @@ -/*============================================================================= - Copyright (c) 2003 Giovanni Bajo - Copyright (c) 2003 Martin Wille - Copyright (c) 2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -#ifndef BOOST_SPIRIT_FILE_ITERATOR_IPP -#define BOOST_SPIRIT_FILE_ITERATOR_IPP - -#ifdef BOOST_SPIRIT_FILEITERATOR_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -#endif - -#include <cstdio> -#include <boost/shared_ptr.hpp> - -#ifdef BOOST_SPIRIT_FILEITERATOR_WINDOWS -# include <boost/type_traits/remove_pointer.hpp> -#endif - -#ifdef BOOST_SPIRIT_FILEITERATOR_POSIX -# include <sys/types.h> // open, stat, mmap, munmap -# include <sys/stat.h> // stat -# include <fcntl.h> // open -# include <unistd.h> // stat, mmap, munmap -# include <sys/mman.h> // mmap, mmunmap -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -namespace fileiter_impl { - -using namespace std; - -/////////////////////////////////////////////////////////////////////////////// -// -// std_file_iterator -// -// Base class that implements iteration through a file using standard C -// stream library (fopen and friends). This class and the following are -// the base components on which the iterator is built (through the -// iterator adaptor library). -// -// The opened file stream (FILE) is held with a shared_ptr<>, whose -// custom deleter invokes fcose(). This makes the syntax of the class -// very easy, especially everything related to copying. -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename CharT> -class std_file_iterator -{ -public: - typedef CharT value_type; - - std_file_iterator() - {} - - explicit std_file_iterator(std::string fileName) - { - FILE* f = fopen(fileName.c_str(), "rb"); - - // If the file was opened, store it into - // the smart pointer. - if (f) - { - m_file.reset(f, fclose); - m_pos = 0; - m_eof = false; - update_char(); - } - } - - std_file_iterator(const std_file_iterator& iter) - { *this = iter; } - - std_file_iterator& operator=(const std_file_iterator& iter) - { - m_file = iter.m_file; - m_curChar = iter.m_curChar; - m_eof = iter.m_eof; - m_pos = iter.m_pos; - - return *this; - } - - // Nasty bug in Comeau up to 4.3.0.1, we need explicit boolean context - // for shared_ptr to evaluate correctly - operator bool() const - { return m_file ? true : false; } - - bool operator==(const std_file_iterator& iter) const - { - return (m_file == iter.m_file) && (m_eof == iter.m_eof) && - (m_pos == iter.m_pos); - } - - const CharT& get_cur_char(void) const - { - return m_curChar; - } - - void prev_char(void) - { - m_pos -= sizeof(CharT); - update_char(); - } - - void next_char(void) - { - m_pos += sizeof(CharT); - update_char(); - } - - void seek_end(void) - { - fseek(m_file.get(), 0, SEEK_END); - m_pos = ftell(m_file.get()) / sizeof(CharT); - m_eof = true; - } - - void advance(signed long n) - { - m_pos += n * sizeof(CharT); - update_char(); - } - - long distance(const std_file_iterator& iter) const - { - return (long)(m_pos - iter.m_pos) / sizeof(CharT); - } - -private: - boost::shared_ptr<FILE> m_file; - std::size_t m_pos; - CharT m_curChar; - bool m_eof; - - void update_char(void) - { - if ((std::size_t)ftell(m_file.get()) != m_pos) - fseek(m_file.get(), m_pos, SEEK_SET); - - m_eof = (fread(&m_curChar, sizeof(CharT), 1, m_file.get()) < 1); - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// -// mmap_file_iterator -// -// File iterator for memory mapped files, for now implemented on Windows and -// POSIX platforms. This class has the same interface of std_file_iterator, -// and can be used in its place (in fact, it's the default for Windows and -// POSIX). -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// mmap_file_iterator, Windows version -#ifdef BOOST_SPIRIT_FILEITERATOR_WINDOWS -template <typename CharT> -class mmap_file_iterator -{ -public: - typedef CharT value_type; - - mmap_file_iterator() - {} - - explicit mmap_file_iterator(std::string fileName) - { - HANDLE hFile = ::CreateFileA( - fileName.c_str(), - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_FLAG_SEQUENTIAL_SCAN, - NULL - ); - - if (hFile == INVALID_HANDLE_VALUE) - return; - - // Store the size of the file, it's used to construct - // the end iterator - m_filesize = ::GetFileSize(hFile, NULL); - - HANDLE hMap = ::CreateFileMapping( - hFile, - NULL, - PAGE_READONLY, - 0, 0, - NULL - ); - - if (hMap == NULL) - { - ::CloseHandle(hFile); - return; - } - - LPVOID pMem = ::MapViewOfFile( - hMap, - FILE_MAP_READ, - 0, 0, 0 - ); - - if (pMem == NULL) - { - ::CloseHandle(hMap); - ::CloseHandle(hFile); - return; - } - - // We hold both the file handle and the memory pointer. - // We can close the hMap handle now because Windows holds internally - // a reference to it since there is a view mapped. - ::CloseHandle(hMap); - - // It seems like we can close the file handle as well (because - // a reference is hold by the filemap object). - ::CloseHandle(hFile); - - // Store the handles inside the shared_ptr (with the custom destructors) - m_mem.reset(static_cast<CharT*>(pMem), ::UnmapViewOfFile); - - // Start of the file - m_curChar = m_mem.get(); - } - - mmap_file_iterator(const mmap_file_iterator& iter) - { *this = iter; } - - mmap_file_iterator& operator=(const mmap_file_iterator& iter) - { - m_curChar = iter.m_curChar; - m_mem = iter.m_mem; - m_filesize = iter.m_filesize; - - return *this; - } - - // Nasty bug in Comeau up to 4.3.0.1, we need explicit boolean context - // for shared_ptr to evaluate correctly - operator bool() const - { return m_mem ? true : false; } - - bool operator==(const mmap_file_iterator& iter) const - { return m_curChar == iter.m_curChar; } - - const CharT& get_cur_char(void) const - { return *m_curChar; } - - void next_char(void) - { m_curChar++; } - - void prev_char(void) - { m_curChar--; } - - void advance(signed long n) - { m_curChar += n; } - - long distance(const mmap_file_iterator& iter) const - { return m_curChar - iter.m_curChar; } - - void seek_end(void) - { - m_curChar = m_mem.get() + - (m_filesize / sizeof(CharT)); - } - -private: -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - typedef boost::remove_pointer<HANDLE>::type handle_t; -#else - typedef void handle_t; -#endif - - boost::shared_ptr<CharT> m_mem; - std::size_t m_filesize; - CharT* m_curChar; -}; - -#endif // BOOST_SPIRIT_FILEITERATOR_WINDOWS - -/////////////////////////////////////////////////////////////////////////////// -// mmap_file_iterator, POSIX version -#ifdef BOOST_SPIRIT_FILEITERATOR_POSIX -template <typename CharT> -class mmap_file_iterator -{ -private: - struct mapping - { - mapping(void *p, off_t len) - : data(p) - , size(len) - { } - - CharT const *begin() const - { - return static_cast<CharT *>(data); - } - - CharT const *end() const - { - return static_cast<CharT *>(data) + size/sizeof(CharT); - } - - ~mapping() - { - munmap(data, size); - } - - private: - void *data; - off_t size; - }; - -public: - typedef CharT value_type; - - mmap_file_iterator() - {} - - explicit mmap_file_iterator(std::string file_name) - { - // open the file - int fd = open(file_name.c_str(), -#ifdef O_NOCTTY - O_NOCTTY | // if stdin was closed then opening a file - // would cause the file to become the controlling - // terminal if the filename refers to a tty. Setting - // O_NOCTTY inhibits this. -#endif - O_RDONLY); - - if (fd == -1) - return; - - // call fstat to find get information about the file just - // opened (size and file type) - struct stat stat_buf; - if ((fstat(fd, &stat_buf) != 0) || !S_ISREG(stat_buf.st_mode)) - { // if fstat returns an error or if the file isn't a - // regular file we give up. - close(fd); - return; - } - - // perform the actual mapping - void *p = mmap(0, stat_buf.st_size, PROT_READ, MAP_SHARED, fd, 0); - // it is safe to close() here. POSIX requires that the OS keeps a - // second handle to the file while the file is mmapped. - close(fd); - - if (p == MAP_FAILED) - return; - - mapping *m = 0; - try - { - m = new mapping(p, stat_buf.st_size); - } - catch(...) - { - munmap(p, stat_buf.st_size); - throw; - } - - m_mem.reset(m); - - // Start of the file - m_curChar = m_mem->begin(); - } - - mmap_file_iterator(const mmap_file_iterator& iter) - { *this = iter; } - - mmap_file_iterator& operator=(const mmap_file_iterator& iter) - { - m_curChar = iter.m_curChar; - m_mem = iter.m_mem; - - return *this; - } - - // Nasty bug in Comeau up to 4.3.0.1, we need explicit boolean context - // for shared_ptr to evaluate correctly - operator bool() const - { return m_mem ? true : false; } - - bool operator==(const mmap_file_iterator& iter) const - { return m_curChar == iter.m_curChar; } - - const CharT& get_cur_char(void) const - { return *m_curChar; } - - void next_char(void) - { m_curChar++; } - - void prev_char(void) - { m_curChar--; } - - void advance(signed long n) - { m_curChar += n; } - - long distance(const mmap_file_iterator& iter) const - { return m_curChar - iter.m_curChar; } - - void seek_end(void) - { - m_curChar = m_mem->end(); - } - -private: - - boost::shared_ptr<mapping> m_mem; - CharT const* m_curChar; -}; - -#endif // BOOST_SPIRIT_FILEITERATOR_POSIX - -/////////////////////////////////////////////////////////////////////////////// -} /* namespace boost::spirit::fileiter_impl */ - -template <typename CharT, typename BaseIteratorT> -file_iterator<CharT,BaseIteratorT> -file_iterator<CharT,BaseIteratorT>::make_end(void) -{ - file_iterator iter(*this); - iter.base_reference().seek_end(); - return iter; -} - -template <typename CharT, typename BaseIteratorT> -file_iterator<CharT,BaseIteratorT>& -file_iterator<CharT,BaseIteratorT>::operator=(const base_t& iter) -{ - base_t::operator=(iter); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -}} /* namespace boost::spirit */ - - -#endif /* BOOST_SPIRIT_FILE_ITERATOR_IPP */ diff --git a/Utilities/BGL/boost/spirit/iterator/impl/position_iterator.ipp b/Utilities/BGL/boost/spirit/iterator/impl/position_iterator.ipp deleted file mode 100644 index 37e1d7d986952046eaabd783fd865dea1c80905e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/iterator/impl/position_iterator.ipp +++ /dev/null @@ -1,131 +0,0 @@ -/*============================================================================= - Copyright (c) 2002 Juan Carlos Arevalo-Baeza - Copyright (c) 2002-2003 Hartmut Kaiser - Copyright (c) 2003 Giovanni Bajo - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef POSITION_ITERATOR_IPP -#define POSITION_ITERATOR_IPP - -#include <boost/config.hpp> -#include <boost/iterator_adaptors.hpp> -#include <boost/type_traits/add_const.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/spirit/core/nil.hpp> // for nil_t -#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits - -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// position_policy<file_position_without_column> -// -// Specialization to handle file_position_without_column. Only take care of -// newlines since no column tracking is needed. -// -/////////////////////////////////////////////////////////////////////////////// -template <> -class position_policy<file_position_without_column> { - -public: - void next_line(file_position_without_column& pos) - { - ++pos.line; - } - - void set_tab_chars(unsigned int /*chars*/){} - void next_char(file_position_without_column& /*pos*/) {} - void tabulation(file_position_without_column& /*pos*/) {} -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// position_policy<file_position> -// -// Specialization to handle file_position. Track characters and tabulation -// to compute the current column correctly. -// -// Default tab size is 4. You can change this with the set_tabchars member -// of position_iterator. -// -/////////////////////////////////////////////////////////////////////////////// -template <> -class position_policy<file_position> { - -public: - position_policy() - : m_CharsPerTab(4) - {} - - void next_line(file_position& pos) - { - ++pos.line; - pos.column = 1; - } - - void set_tab_chars(unsigned int chars) - { - m_CharsPerTab = chars; - } - - void next_char(file_position& pos) - { - ++pos.column; - } - - void tabulation(file_position& pos) - { - pos.column += m_CharsPerTab - (pos.column - 1) % m_CharsPerTab; - } - -private: - unsigned int m_CharsPerTab; -}; - -/* namespace boost::spirit { */ namespace iterator_ { namespace impl { - -/////////////////////////////////////////////////////////////////////////////// -// -// position_iterator_base_generator -// -// Metafunction to generate the iterator type using boost::iterator_adaptors, -// hiding all the metaprogramming thunking code in it. It is used -// mainly to keep the public interface (position_iterator) cleanear. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename MainIterT, typename ForwardIterT, typename PositionT> -struct position_iterator_base_generator -{ -private: - typedef boost::detail::iterator_traits<ForwardIterT> traits; - typedef typename traits::value_type value_type; - typedef typename traits::iterator_category iter_category_t; - - // Position iterator is always a non-mutable iterator - typedef typename boost::add_const<value_type>::type const_value_type; - -public: - // Check if the MainIterT is nil. If it's nil, it means that the actual - // self type is position_iterator. Otherwise, it's a real type we - // must use - typedef typename boost::mpl::if_< - typename boost::is_same<MainIterT, nil_t>::type, - position_iterator<ForwardIterT, PositionT, nil_t>, - MainIterT - >::type main_iter_t; - - typedef boost::iterator_adaptor< - main_iter_t, - ForwardIterT, - const_value_type - > type; -}; - -}}}} /* namespace boost::spirit::iterator_::impl */ - -#endif diff --git a/Utilities/BGL/boost/spirit/iterator/multi_pass.hpp b/Utilities/BGL/boost/spirit/iterator/multi_pass.hpp deleted file mode 100644 index 591b9075da9495bf0ae1a57f3e0f3055818ab026..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/iterator/multi_pass.hpp +++ /dev/null @@ -1,1308 +0,0 @@ -/*============================================================================= - Copyright (c) 2001, Daniel C. Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_ITERATOR_MULTI_PASS_HPP -#define BOOST_SPIRIT_ITERATOR_MULTI_PASS_HPP - -#include <boost/config.hpp> -#include <boost/throw_exception.hpp> -#include <deque> -#include <iterator> -#include <iostream> -#include <algorithm> // for std::swap -#include <exception> // for std::exception -#include <boost/limits.hpp> -#include <boost/iterator.hpp> - -#include <boost/spirit/core/assert.hpp> // for BOOST_SPIRIT_ASSERT -#include <boost/spirit/iterator/fixed_size_queue.hpp> -#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits - -namespace boost { namespace spirit { - -namespace impl { - template <typename T> - inline void mp_swap(T& t1, T& t2); -} - -namespace multi_pass_policies -{ - -/////////////////////////////////////////////////////////////////////////////// -// class ref_counted -// Implementation of an OwnershipPolicy used by multi_pass. -// -// Implementation modified from RefCounted class from the Loki library by -// Andrei Alexandrescu -/////////////////////////////////////////////////////////////////////////////// -class ref_counted -{ - protected: - ref_counted() - : count(new std::size_t(1)) - {} - - ref_counted(ref_counted const& x) - : count(x.count) - {} - - // clone is called when a copy of the iterator is made, so increment - // the ref-count. - void clone() - { - ++*count; - } - - // called when a copy is deleted. Decrement the ref-count. Return - // value of true indicates that the last copy has been released. - bool release() - { - if (!--*count) - { - delete count; - count = 0; - return true; - } - return false; - } - - void swap(ref_counted& x) - { - impl::mp_swap(count, x.count); - } - - public: - // returns true if there is only one iterator in existence. - // std_deque StoragePolicy will free it's buffered data if this - // returns true. - bool unique() const - { - return *count == 1; - } - - private: - std::size_t* count; -}; - -/////////////////////////////////////////////////////////////////////////////// -// class first_owner -// Implementation of an OwnershipPolicy used by multi_pass -// This ownership policy dictates that the first iterator created will -// determine the lifespan of the shared components. This works well for -// spirit, since no dynamic allocation of iterators is done, and all copies -// are make on the stack. -// -// There is a caveat about using this policy together with the std_deque -// StoragePolicy. Since first_owner always returns false from unique(), -// std_deque will only release the queued data if clear_queue() is called. -/////////////////////////////////////////////////////////////////////////////// -class first_owner -{ - protected: - first_owner() - : first(true) - {} - - first_owner(first_owner const&) - : first(false) - {} - - void clone() - { - } - - // return true to indicate deletion of resources - bool release() - { - return first; - } - - void swap(first_owner&) - { - // if we're the first, we still remain the first, even if assigned - // to, so don't swap first_. swap is only called from operator= - } - - public: - bool unique() const - { - return false; // no way to know, so always return false - } - - private: - bool first; -}; - -/////////////////////////////////////////////////////////////////////////////// -// class illegal_backtracking -// thrown by buf_id_check CheckingPolicy if an instance of an iterator is -// used after another one has invalidated the queue -/////////////////////////////////////////////////////////////////////////////// -class illegal_backtracking : public std::exception -{ -public: - - illegal_backtracking() throw() {} - ~illegal_backtracking() throw() {} - - virtual const char* - what() const throw() - { return "boost::spirit::illegal_backtracking"; } -}; - -/////////////////////////////////////////////////////////////////////////////// -// class buf_id_check -// Implementation of the CheckingPolicy used by multi_pass -// This policy is most effective when used together with the std_deque -// StoragePolicy. -// If used with the fixed_size_queue StoragePolicy, it will not detect -// iterator derefereces that are out of the range of the queue. -/////////////////////////////////////////////////////////////////////////////// -class buf_id_check -{ - protected: - buf_id_check() - : shared_buf_id(new unsigned long(0)) - , buf_id(0) - {} - - buf_id_check(buf_id_check const& x) - : shared_buf_id(x.shared_buf_id) - , buf_id(x.buf_id) - {} - - // will be called from the destructor of the last iterator. - void destroy() - { - delete shared_buf_id; - shared_buf_id = 0; - } - - void swap(buf_id_check& x) - { - impl::mp_swap(shared_buf_id, x.shared_buf_id); - impl::mp_swap(buf_id, x.buf_id); - } - - // called to verify that everything is okay. - void check() const - { - if (buf_id != *shared_buf_id) - { - boost::throw_exception(illegal_backtracking()); - } - } - - // called from multi_pass::clear_queue, so we can increment the count - void clear_queue() - { - ++*shared_buf_id; - ++buf_id; - } - - private: - unsigned long* shared_buf_id; - unsigned long buf_id; -}; - -/////////////////////////////////////////////////////////////////////////////// -// class no_check -// Implementation of the CheckingPolicy used by multi_pass -// It does not do anything :-) -/////////////////////////////////////////////////////////////////////////////// -class no_check -{ - protected: - no_check() {} - no_check(no_check const&) {} - void destroy() {} - void swap(no_check&) {} - void check() const {} - void clear_queue() {} -}; - -/////////////////////////////////////////////////////////////////////////////// -// class std_deque -// Implementation of the StoragePolicy used by multi_pass -// This stores all data in a std::deque, and keeps an offset to the current -// position. It stores all the data unless there is only one -// iterator using the queue. -// Note: a position is used instead of an iterator, because a push_back on -// a deque can invalidate any iterators. -/////////////////////////////////////////////////////////////////////////////// -class std_deque -{ - public: - -template <typename ValueT> -class inner -{ - private: - - typedef std::deque<ValueT> queue_type; - queue_type* queuedElements; - mutable typename queue_type::size_type queuePosition; - - protected: - inner() - : queuedElements(new queue_type) - , queuePosition(0) - {} - - inner(inner const& x) - : queuedElements(x.queuedElements) - , queuePosition(x.queuePosition) - {} - - // will be called from the destructor of the last iterator. - void destroy() - { - BOOST_SPIRIT_ASSERT(NULL != queuedElements); - delete queuedElements; - queuedElements = 0; - } - - void swap(inner& x) - { - impl::mp_swap(queuedElements, x.queuedElements); - impl::mp_swap(queuePosition, x.queuePosition); - } - - // This is called when the iterator is dereferenced. It's a template - // method so we can recover the type of the multi_pass iterator - // and call unique and access the m_input data member. - template <typename MultiPassT> - static typename MultiPassT::reference dereference(MultiPassT const& mp) - { - if (mp.queuePosition == mp.queuedElements->size()) - { - // check if this is the only iterator - if (mp.unique()) - { - // free up the memory used by the queue. - if (mp.queuedElements->size() > 0) - { - mp.queuedElements->clear(); - mp.queuePosition = 0; - } - } - return mp.get_input(); - } - else - { - return (*mp.queuedElements)[mp.queuePosition]; - } - } - - // This is called when the iterator is incremented. It's a template - // method so we can recover the type of the multi_pass iterator - // and call unique and access the m_input data member. - template <typename MultiPassT> - static void increment(MultiPassT& mp) - { - if (mp.queuePosition == mp.queuedElements->size()) - { - // check if this is the only iterator - if (mp.unique()) - { - // free up the memory used by the queue. - if (mp.queuedElements->size() > 0) - { - mp.queuedElements->clear(); - mp.queuePosition = 0; - } - } - else - { - mp.queuedElements->push_back(mp.get_input()); - ++mp.queuePosition; - } - mp.advance_input(); - } - else - { - ++mp.queuePosition; - } - - } - - // called to forcibly clear the queue - void clear_queue() - { - queuedElements->clear(); - queuePosition = 0; - } - - // called to determine whether the iterator is an eof iterator - template <typename MultiPassT> - static bool is_eof(MultiPassT const& mp) - { - return mp.queuePosition == mp.queuedElements->size() && - mp.input_at_eof(); - } - - // called by operator== - bool equal_to(inner const& x) const - { - return queuePosition == x.queuePosition; - } - - // called by operator< - bool less_than(inner const& x) const - { - return queuePosition < x.queuePosition; - } -}; // class inner - -}; // class std_deque - - -/////////////////////////////////////////////////////////////////////////////// -// class fixed_size_queue -// Implementation of the StoragePolicy used by multi_pass -// fixed_size_queue keeps a circular buffer (implemented by -// boost::spirit::fixed_size_queue class) that is size N+1 and stores N elements. -// It is up to the user to ensure that there is enough look ahead for their -// grammar. Currently there is no way to tell if an iterator is pointing -// to forgotten data. The leading iterator will put an item in the queue -// and remove one when it is incremented. No dynamic allocation is done, -// except on creation of the queue (fixed_size_queue constructor). -/////////////////////////////////////////////////////////////////////////////// -template < std::size_t N> -class fixed_size_queue -{ - public: - -template <typename ValueT> -class inner -{ - private: - - typedef boost::spirit::fixed_size_queue<ValueT, N> queue_type; - queue_type * queuedElements; - mutable typename queue_type::iterator queuePosition; - - protected: - inner() - : queuedElements(new queue_type) - , queuePosition(queuedElements->begin()) - {} - - inner(inner const& x) - : queuedElements(x.queuedElements) - , queuePosition(x.queuePosition) - {} - - // will be called from the destructor of the last iterator. - void destroy() - { - BOOST_SPIRIT_ASSERT(NULL != queuedElements); - delete queuedElements; - queuedElements = 0; - } - - void swap(inner& x) - { - impl::mp_swap(queuedElements, x.queuedElements); - impl::mp_swap(queuePosition, x.queuePosition); - } - - // This is called when the iterator is dereferenced. It's a template - // method so we can recover the type of the multi_pass iterator - // and access the m_input data member. - template <typename MultiPassT> - static typename MultiPassT::reference dereference(MultiPassT const& mp) - { - if (mp.queuePosition == mp.queuedElements->end()) - { - return mp.get_input(); - } - else - { - return *mp.queuePosition; - } - } - - // This is called when the iterator is incremented. It's a template - // method so we can recover the type of the multi_pass iterator - // and access the m_input data member. - template <typename MultiPassT> - static void increment(MultiPassT& mp) - { - if (mp.queuePosition == mp.queuedElements->end()) - { - // don't let the queue get larger than N - if (mp.queuedElements->size() >= N) - mp.queuedElements->pop_front(); - - mp.queuedElements->push_back(mp.get_input()); - mp.advance_input(); - } - ++mp.queuePosition; - } - - // no-op - void clear_queue() - {} - - // called to determine whether the iterator is an eof iterator - template <typename MultiPassT> - static bool is_eof(MultiPassT const& mp) - { - return mp.queuePosition == mp.queuedElements->end() && - mp.input_at_eof(); - } - - // called by operator== - bool equal_to(inner const& x) const - { - return queuePosition == x.queuePosition; - } - - // called by operator< - bool less_than(inner const& x) const - { - return queuePosition < x.queuePosition; - } -}; // class inner - -}; // class fixed_size_queue - - -/////////////////////////////////////////////////////////////////////////////// -// class input_iterator -// Implementation of the InputPolicy used by multi_pass -// input_iterator encapsulates an input iterator of type InputT -/////////////////////////////////////////////////////////////////////////////// -class input_iterator -{ - public: - -template <typename InputT> -class inner -{ - typedef - typename boost::detail::iterator_traits<InputT>::value_type - result_type; - - struct Data { - Data(InputT const &input_) - : input(input_), was_initialized(false) - {} - - InputT input; - result_type curtok; - bool was_initialized; - }; - - // Needed by compilers not implementing the resolution to DR45. For - // reference, see - // http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45. - - friend struct Data; - - public: - typedef result_type value_type; - typedef - typename boost::detail::iterator_traits<InputT>::difference_type - difference_type; - typedef - typename boost::detail::iterator_traits<InputT>::pointer - pointer; - typedef - typename boost::detail::iterator_traits<InputT>::reference - reference; - - protected: - inner() - : data(0) - {} - - inner(InputT x) - : data(new Data(x)) - {} - - inner(inner const& x) - : data(x.data) - {} - - void destroy() - { - delete data; - data = 0; - } - - bool same_input(inner const& x) const - { - return data == x.data; - } - - typedef - typename boost::detail::iterator_traits<InputT>::value_type - value_t; - void swap(inner& x) - { - impl::mp_swap(data, x.data); - } - - void ensure_initialized() const - { - if (data && !data->was_initialized) { - data->curtok = *data->input; // get the first token - data->was_initialized = true; - } - } - - public: - reference get_input() const - { - BOOST_SPIRIT_ASSERT(NULL != data); - ensure_initialized(); - return data->curtok; - } - - void advance_input() - { - BOOST_SPIRIT_ASSERT(NULL != data); - data->was_initialized = false; // should get the next token - ++data->input; - } - - bool input_at_eof() const - { - return !data || data->input == InputT(); - } - - private: - Data *data; -}; - -}; - -/////////////////////////////////////////////////////////////////////////////// -// class lex_input -// Implementation of the InputPolicy used by multi_pass -// lex_input gets tokens (ints) from yylex() -/////////////////////////////////////////////////////////////////////////////// -class lex_input -{ - public: - -template <typename InputT> -class inner -{ - public: - typedef int value_type; - typedef std::ptrdiff_t difference_type; - typedef int* pointer; - typedef int& reference; - - protected: - inner() - : curtok(new int(0)) - {} - - inner(InputT x) - : curtok(new int(x)) - {} - - inner(inner const& x) - : curtok(x.curtok) - {} - - void destroy() - { - delete curtok; - curtok = 0; - } - - bool same_input(inner const& x) const - { - return curtok == x.curtok; - } - - void swap(inner& x) - { - impl::mp_swap(curtok, x.curtok); - } - - public: - reference get_input() const - { - return *curtok; - } - - void advance_input() - { - extern int yylex(); - *curtok = yylex(); - } - - bool input_at_eof() const - { - return *curtok == 0; - } - - private: - int* curtok; - -}; - -}; - -/////////////////////////////////////////////////////////////////////////////// -// class functor_input -// Implementation of the InputPolicy used by multi_pass -// functor_input gets tokens from a functor -// Note: the functor must have a typedef for result_type -// It also must have a static variable of type result_type defined to -// represent eof that is called eof. -/////////////////////////////////////////////////////////////////////////////// -class functor_input -{ - public: - -template <typename FunctorT> -class inner -{ - typedef typename FunctorT::result_type result_type; - public: - typedef result_type value_type; - typedef std::ptrdiff_t difference_type; - typedef result_type* pointer; - typedef result_type& reference; - - protected: - inner() - : ftor(0) - , curtok(0) - {} - - inner(FunctorT const& x) - : ftor(new FunctorT(x)) - , curtok(new result_type((*ftor)())) - {} - - inner(inner const& x) - : ftor(x.ftor) - , curtok(x.curtok) - {} - - void destroy() - { - delete ftor; - ftor = 0; - delete curtok; - curtok = 0; - } - - bool same_input(inner const& x) const - { - return ftor == x.ftor; - } - - void swap(inner& x) - { - impl::mp_swap(curtok, x.curtok); - impl::mp_swap(ftor, x.ftor); - } - - public: - reference get_input() const - { - return *curtok; - } - - void advance_input() - { - if (curtok) { - *curtok = (*ftor)(); - } - } - - bool input_at_eof() const - { - return !curtok || *curtok == ftor->eof; - } - - FunctorT& get_functor() const - { - return *ftor; - } - - - private: - FunctorT* ftor; - result_type* curtok; - -}; - -}; - -} // namespace multi_pass_policies - -/////////////////////////////////////////////////////////////////////////////// -// iterator_base_creator -/////////////////////////////////////////////////////////////////////////////// - -namespace iterator_ { namespace impl { - -// Meta-function to generate a std::iterator<> base class for multi_pass. This -// is used mainly to improve conformance of compilers not supporting PTS -// and thus relying on inheritance to recognize an iterator. -// We are using boost::iterator<> because it offers an automatic workaround -// for broken std::iterator<> implementations. -template <typename InputPolicyT, typename InputT> -struct iterator_base_creator -{ - typedef typename InputPolicyT::BOOST_NESTED_TEMPLATE inner<InputT> input_t; - - typedef boost::iterator - < - std::forward_iterator_tag, - typename input_t::value_type, - typename input_t::difference_type, - typename input_t::pointer, - typename input_t::reference - > type; -}; - -}} - - - -/////////////////////////////////////////////////////////////////////////////// -// class template multi_pass (declaration) -/////////////////////////////////////////////////////////////////////////////// -template -< - typename InputT, - typename InputPolicy = multi_pass_policies::input_iterator, - typename OwnershipPolicy = multi_pass_policies::ref_counted, - typename CheckingPolicy = multi_pass_policies::buf_id_check, - typename StoragePolicy = multi_pass_policies::std_deque -> -class multi_pass; - -// The default multi_pass instantiation uses a ref-counted std_deque scheme. - -/////////////////////////////////////////////////////////////////////////////// -// class template multi_pass (definition) -/////////////////////////////////////////////////////////////////////////////// -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -class multi_pass - : public OwnershipPolicy - , public CheckingPolicy - , public StoragePolicy::template inner< - typename InputPolicy::template inner<InputT>::value_type> - , public InputPolicy::template inner<InputT> - , public iterator_::impl::iterator_base_creator<InputPolicy, InputT>::type -{ - typedef OwnershipPolicy OP; - typedef CheckingPolicy CHP; - typedef typename StoragePolicy::template inner< - typename InputPolicy::template inner<InputT>::value_type> SP; - typedef typename InputPolicy::template inner<InputT> IP; - typedef typename - iterator_::impl::iterator_base_creator<InputPolicy, InputT>::type - IB; - - public: - typedef typename IB::value_type value_type; - typedef typename IB::difference_type difference_type; - typedef typename IB::reference reference; - typedef typename IB::pointer pointer; - typedef InputT iterator_type; - - multi_pass(); - explicit multi_pass(InputT input); - -#if BOOST_WORKAROUND(__GLIBCPP__, == 20020514) - multi_pass(int); -#endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514) - - ~multi_pass(); - - multi_pass(multi_pass const&); - multi_pass& operator=(multi_pass const&); - - void swap(multi_pass& x); - - reference operator*() const; - pointer operator->() const; - multi_pass& operator++(); - multi_pass operator++(int); - - void clear_queue(); - - bool operator==(const multi_pass& y) const; - bool operator<(const multi_pass& y) const; - - private: // helper functions - bool is_eof() const; -}; - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -multi_pass() - : OP() - , CHP() - , SP() - , IP() -{ -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -multi_pass(InputT input) - : OP() - , CHP() - , SP() - , IP(input) -{ -} - -#if BOOST_WORKAROUND(__GLIBCPP__, == 20020514) - // The standard library shipped with gcc-3.1 has a bug in - // bits/basic_string.tcc. It tries to use iter::iter(0) to - // construct an iterator. Ironically, this happens in sanity - // checking code that isn't required by the standard. - // The workaround is to provide an additional constructor that - // ignores its int argument and behaves like the default constructor. -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -multi_pass(int) - : OP() - , CHP() - , SP() - , IP() -{ -} -#endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514) - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -~multi_pass() -{ - if (OP::release()) - { - CHP::destroy(); - SP::destroy(); - IP::destroy(); - } -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -multi_pass( - multi_pass const& x) - : OP(x) - , CHP(x) - , SP(x) - , IP(x) -{ - OP::clone(); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>& -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -operator=( - multi_pass const& x) -{ - multi_pass temp(x); - temp.swap(*this); - return *this; -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline void -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -swap(multi_pass& x) -{ - OP::swap(x); - CHP::swap(x); - SP::swap(x); - IP::swap(x); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -typename multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -reference -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -operator*() const -{ - CHP::check(); - return SP::dereference(*this); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -typename multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -pointer -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -operator->() const -{ - return &(operator*()); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>& -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -operator++() -{ - CHP::check(); - SP::increment(*this); - return *this; -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy> -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -operator++(int) -{ - multi_pass - < - InputT, - InputPolicy, - OwnershipPolicy, - CheckingPolicy, - StoragePolicy - > tmp(*this); - - ++*this; - - return tmp; -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline void -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -clear_queue() -{ - SP::clear_queue(); - CHP::clear_queue(); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline bool -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -is_eof() const -{ - return SP::is_eof(*this); -} - -///// Comparisons -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline bool -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -operator==(const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& y) const -{ - bool is_eof_ = SP::is_eof(*this); - bool y_is_eof_ = SP::is_eof(y); - - if (is_eof_ && y_is_eof_) - { - return true; // both are EOF - } - else if (is_eof_ ^ y_is_eof_) - { - return false; // one is EOF, one isn't - } - else if (!IP::same_input(y)) - { - return false; - } - else - { - return SP::equal_to(y); - } -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline bool -multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy>:: -operator<(const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& y) const -{ - return SP::less_than(y); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -bool operator!=( - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& x, - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& y) -{ - return !(x == y); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -bool operator>( - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& x, - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& y) -{ - return y < x; -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -bool operator>=( - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& x, - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& y) -{ - return !(x < y); -} - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -inline -bool operator<=( - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& x, - const multi_pass<InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, - StoragePolicy>& y) -{ - return !(y < x); -} - -///// Generator function -template <typename InputT> -inline multi_pass<InputT> -make_multi_pass(InputT i) -{ - return multi_pass<InputT>(i); -} - -// this could be a template typedef, since such a thing doesn't -// exist in C++, we'll use inheritance to accomplish the same thing. - -template <typename InputT, std::size_t N> -class look_ahead : - public multi_pass< - InputT, - multi_pass_policies::input_iterator, - multi_pass_policies::first_owner, - multi_pass_policies::no_check, - multi_pass_policies::fixed_size_queue<N> > -{ - typedef multi_pass< - InputT, - multi_pass_policies::input_iterator, - multi_pass_policies::first_owner, - multi_pass_policies::no_check, - multi_pass_policies::fixed_size_queue<N> > base_t; - public: - look_ahead() - : base_t() {} - - explicit look_ahead(InputT x) - : base_t(x) {} - - look_ahead(look_ahead const& x) - : base_t(x) {} - -#if BOOST_WORKAROUND(__GLIBCPP__, == 20020514) - look_ahead(int) // workaround for a bug in the library - : base_t() {} // shipped with gcc 3.1 -#endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514) - - // default generated operators destructor and assignment operator are okay. -}; - -template -< - typename InputT, - typename InputPolicy, - typename OwnershipPolicy, - typename CheckingPolicy, - typename StoragePolicy -> -void swap( - multi_pass< - InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy - > &x, - multi_pass< - InputT, InputPolicy, OwnershipPolicy, CheckingPolicy, StoragePolicy - > &y) -{ - x.swap(y); -} - -namespace impl { - - template <typename T> - inline void mp_swap(T& t1, T& t2) - { - using std::swap; - using boost::spirit::swap; - swap(t1, t2); - } -} - -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_ITERATOR_MULTI_PASS_HPP - - diff --git a/Utilities/BGL/boost/spirit/iterator/position_iterator.hpp b/Utilities/BGL/boost/spirit/iterator/position_iterator.hpp deleted file mode 100644 index d9c29615417519d049197cbbad08d906cf84266d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/iterator/position_iterator.hpp +++ /dev/null @@ -1,432 +0,0 @@ -/*============================================================================= - Copyright (c) 2002 Juan Carlos Arevalo-Baeza - Copyright (c) 2002-2003 Hartmut Kaiser - Copyright (c) 2003 Giovanni Bajo - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_POSITION_ITERATOR_HPP -#define BOOST_SPIRIT_POSITION_ITERATOR_HPP - -#include <string> -#include <boost/config.hpp> -#include <boost/concept_check.hpp> - -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// file_position_without_column -// -// A structure to hold positional information. This includes the file, -// and the line number -// -/////////////////////////////////////////////////////////////////////////////// -struct file_position_without_column { - std::string file; - int line; - - file_position_without_column(std::string const& file_ = std::string(), - int line_ = 1): - file (file_), - line (line_) - {} - - bool operator==(const file_position_without_column& fp) const - { return line == fp.line && file == fp.file; } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// file_position -// -// This structure holds complete file position, including file name, -// line and column number -// -/////////////////////////////////////////////////////////////////////////////// -struct file_position : public file_position_without_column { - int column; - - file_position(std::string const& file_ = std::string(), - int line_ = 1, int column_ = 1): - file_position_without_column (file_, line_), - column (column_) - {} - - bool operator==(const file_position& fp) const - { return column == fp.column && line == fp.line && file == fp.file; } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// -// position_policy<> -// -// This template is the policy to handle the file position. It is specialized -// on the position type. Providing a custom file_position also requires -// providing a specialization of this class. -// -// Policy interface: -// -// Default constructor of the custom position class must be accessible. -// set_tab_chars(unsigned int chars) - Set the tabstop width -// next_char(PositionT& pos) - Notify that a new character has been -// processed -// tabulation(PositionT& pos) - Notify that a tab character has been -// processed -// next_line(PositionT& pos) - Notify that a new line delimiter has -// been reached. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename PositionT> -class position_policy; - - -// Forward declaration -template <typename ForwardIteratorT, typename PositionT, typename SelfT> -class position_iterator; - -/////////////////////////////////////////////////////////////////////////////// -}} /* namespace boost::spirit */ - - -// This must be included here for full compatibility with old MSVC -#include "boost/spirit/iterator/impl/position_iterator.ipp" - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// position_iterator -// -// It wraps an iterator, and keeps track of the current position in the input, -// as it gets incremented. -// -// The wrapped iterator must be at least a Forward iterator. The position -// iterator itself will always be a non-mutable Forward iterator. -// -// In order to have begin/end iterators constructed, the end iterator must be -// empty constructed. Similar to what happens with stream iterators. The begin -// iterator must be constructed from both, the begin and end iterators of the -// wrapped iterator type. This is necessary to implement the lookahead of -// characters necessary to parse CRLF sequences. -// -// In order to extract the current positional data from the iterator, you may -// use the get_position member function. -// -// You can also use the set_position member function to reset the current -// position to something new. -// -// The structure that holds the current position can be customized through a -// template parameter, and the class position_policy must be specialized -// on the new type to define how to handle it. Currently, it's possible -// to choose between the file_position and file_position_without_column -// (which saves some overhead if managing current column is not required). -// -/////////////////////////////////////////////////////////////////////////////// - -#if !defined(BOOST_ITERATOR_ADAPTORS_VERSION) || \ - BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 -#error "Please use at least Boost V1.31.0 while compiling the position_iterator class!" -#else // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 - -/////////////////////////////////////////////////////////////////////////////// -// -// Uses the newer iterator_adaptor version (should be released with -// Boost V1.31.0) -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename ForwardIteratorT, - typename PositionT = file_position, - typename SelfT = nil_t -> -class position_iterator -: public iterator_::impl::position_iterator_base_generator< - SelfT, - ForwardIteratorT, - PositionT - >::type, - public position_policy<PositionT> -{ -private: - - typedef position_policy<PositionT> position_policy_t; - typedef typename iterator_::impl::position_iterator_base_generator< - SelfT, - ForwardIteratorT, - PositionT - >::type base_t; - typedef typename iterator_::impl::position_iterator_base_generator< - SelfT, - ForwardIteratorT, - PositionT - >::main_iter_t main_iter_t; - -public: - - typedef PositionT position_t; - - position_iterator() - : _isend(true) - {} - - position_iterator( - const ForwardIteratorT& begin, - const ForwardIteratorT& end) - : base_t(begin), _end(end), _pos(PositionT()), _isend(begin == end) - {} - - template <typename FileNameT> - position_iterator( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - FileNameT fileName) - : base_t(begin), _end(end), _pos(PositionT(fileName)), - _isend(begin == end) - {} - - template <typename FileNameT, typename LineT> - position_iterator( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - FileNameT fileName, LineT line) - : base_t(begin), _end(end), _pos(PositionT(fileName, line)), - _isend(begin == end) - {} - - template <typename FileNameT, typename LineT, typename ColumnT> - position_iterator( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - FileNameT fileName, LineT line, ColumnT column) - : base_t(begin), _end(end), _pos(PositionT(fileName, line, column)), - _isend(begin == end) - {} - - position_iterator( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - const PositionT& pos) - : base_t(begin), _end(end), _pos(pos), _isend(begin == end) - {} - - position_iterator(const position_iterator& iter) - : base_t(iter.base()), position_policy_t(iter), - _end(iter._end), _pos(iter._pos), _isend(iter._isend) - {} - - position_iterator& operator=(const position_iterator& iter) - { - base_t::operator=(iter); - position_policy_t::operator=(iter); - _end = iter._end; - _pos = iter._pos; - _isend = iter._isend; - return *this; - } - - void set_position(PositionT const& newpos) { _pos = newpos; } - PositionT& get_position() { return _pos; } - PositionT const& get_position() const { return _pos; } - - void set_tabchars(unsigned int chars) - { - // This function (which comes from the position_policy) has a - // different name on purpose, to avoid messing with using - // declarations or qualified calls to access the base template - // function, which might break some compilers. - this->position_policy_t::set_tab_chars(chars); - } - -private: - friend class boost::iterator_core_access; - - void increment() - { - typename base_t::reference val = *(this->base()); - if (val == '\n' || val == '\r') { - ++this->base_reference(); - if (this->base_reference() != _end) { - typename base_t::reference val2 = *(this->base()); - if ((val == '\n' && val2 == '\r') - || (val == '\r' && val2 == '\n')) - { - ++this->base_reference(); - } - } - this->next_line(_pos); - static_cast<main_iter_t &>(*this).newline(); - } - else if (val == '\t') { - this->tabulation(_pos); - ++this->base_reference(); - } - else { - this->next_char(_pos); - ++this->base_reference(); - } - - // The iterator is at the end only if it's the same - // of the - _isend = (this->base_reference() == _end); - } - - template < - typename OtherDerivedT, typename OtherIteratorT, - typename V, typename C, typename R, typename D - > - bool equal(iterator_adaptor<OtherDerivedT, OtherIteratorT, V, C, R, D> - const &x) const - { - OtherDerivedT const &rhs = static_cast<OtherDerivedT const &>(x); - bool x_is_end = rhs._isend; - - return (_isend && x_is_end) || - (!_isend && !x_is_end && this->base() == rhs.base()); - } - -protected: - - void newline(void) - {} - - ForwardIteratorT _end; - PositionT _pos; - bool _isend; -}; - -#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 - -/////////////////////////////////////////////////////////////////////////////// -// -// position_iterator2 -// -// Equivalent to position_iterator, but it is able to extract the current -// line into a string. This is very handy for error reports. -// -// Notice that the footprint of this class is higher than position_iterator, -// (how much depends on how bulky the underlying iterator is), so it should -// be used only if necessary. -// -/////////////////////////////////////////////////////////////////////////////// - -template -< - typename ForwardIteratorT, - typename PositionT = file_position -> -class position_iterator2 - : public position_iterator - < - ForwardIteratorT, - PositionT, - position_iterator2<ForwardIteratorT, PositionT> - > -{ - typedef position_iterator - < - ForwardIteratorT, - PositionT, - position_iterator2<ForwardIteratorT, PositionT> // JDG 4-15-03 - > base_t; - -public: - typedef typename base_t::value_type value_type; - typedef PositionT position_t; - - position_iterator2() - {} - - position_iterator2( - const ForwardIteratorT& begin, - const ForwardIteratorT& end): - base_t(begin, end), - _startline(begin) - {} - - template <typename FileNameT> - position_iterator2( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - FileNameT file): - base_t(begin, end, file), - _startline(begin) - {} - - template <typename FileNameT, typename LineT> - position_iterator2( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - FileNameT file, LineT line): - base_t(begin, end, file, line), - _startline(begin) - {} - - template <typename FileNameT, typename LineT, typename ColumnT> - position_iterator2( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - FileNameT file, LineT line, ColumnT column): - base_t(begin, end, file, line, column), - _startline(begin) - {} - - position_iterator2( - const ForwardIteratorT& begin, - const ForwardIteratorT& end, - const PositionT& pos): - base_t(begin, end, pos), - _startline(begin) - {} - - position_iterator2(const position_iterator2& iter) - : base_t(iter), _startline(iter._startline) - {} - - position_iterator2& operator=(const position_iterator2& iter) - { - base_t::operator=(iter); - _startline = iter._startline; - return *this; - } - - ForwardIteratorT get_currentline_begin(void) const - { return _startline; } - - ForwardIteratorT get_currentline_end(void) const - { return get_endline(); } - - std::basic_string<value_type> get_currentline(void) const - { - return std::basic_string<value_type> - (get_currentline_begin(), get_currentline_end()); - } - -protected: - ForwardIteratorT _startline; - - friend class position_iterator<ForwardIteratorT, PositionT, - position_iterator2<ForwardIteratorT, PositionT> >; - - ForwardIteratorT get_endline() const - { - ForwardIteratorT endline = _startline; - while (endline != this->_end && *endline != '\r' && *endline != '\n') - { - ++endline; - } - return endline; - } - - void newline(void) - { _startline = this->base(); } -}; - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/meta.hpp b/Utilities/BGL/boost/spirit/meta.hpp deleted file mode 100644 index 85876f39b592b6377e221f0239c5c74d2a264441..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_META_MAIN_HPP) -#define BOOST_SPIRIT_META_MAIN_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Master header for Spirit.Meta -// -/////////////////////////////////////////////////////////////////////////////// - -#include <boost/spirit/meta/fundamental.hpp> -#include <boost/spirit/meta/parser_traits.hpp> -#include <boost/spirit/meta/as_parser.hpp> -#include <boost/spirit/meta/traverse.hpp> - -#endif // BOOST_SPIRIT_CORE_MAIN_HPP - diff --git a/Utilities/BGL/boost/spirit/meta/as_parser.hpp b/Utilities/BGL/boost/spirit/meta/as_parser.hpp deleted file mode 100644 index 53d58775cabd9af3243052d764285f317da424fb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/as_parser.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_AS_PARSER_HPP) -#define BOOST_SPIRIT_AS_PARSER_HPP - -#include <boost/spirit/core/primitives/primitives.hpp> - -namespace boost { namespace spirit { - - /////////////////////////////////////////////////////////////////////////// - // - // Helper templates to derive the parser type from an auxilliary type - // and to generate an object of the required parser type given an - // auxilliary object. Supported types to convert are parsers, - // single characters and character strings. - // - /////////////////////////////////////////////////////////////////////////// - namespace impl - { - template<typename T> - struct default_as_parser - { - typedef T type; - static type const& convert(type const& p) - { - return p; - } - }; - - struct char_as_parser - { - typedef chlit<char> type; - static type convert(char ch) - { - return type(ch); - } - }; - - struct wchar_as_parser - { - typedef chlit<wchar_t> type; - static type convert(wchar_t ch) - { - return type(ch); - } - }; - - struct string_as_parser - { - typedef strlit<char const*> type; - static type convert(char const* str) - { - return type(str); - } - }; - - struct wstring_as_parser - { - typedef strlit<wchar_t const*> type; - static type convert(wchar_t const* str) - { - return type(str); - } - }; - } - - template<typename T> - struct as_parser : impl::default_as_parser<T> {}; - - template<> - struct as_parser<char> : impl::char_as_parser {}; - - template<> - struct as_parser<wchar_t> : impl::wchar_as_parser {}; - - template<> - struct as_parser<char*> : impl::string_as_parser {}; - - template<> - struct as_parser<char const*> : impl::string_as_parser {}; - - template<> - struct as_parser<wchar_t*> : impl::wstring_as_parser {}; - - template<> - struct as_parser<wchar_t const*> : impl::wstring_as_parser {}; - - template<int N> - struct as_parser<char[N]> : impl::string_as_parser {}; - - template<int N> - struct as_parser<wchar_t[N]> : impl::wstring_as_parser {}; - - template<int N> - struct as_parser<char const[N]> : impl::string_as_parser {}; - - template<int N> - struct as_parser<wchar_t const[N]> : impl::wstring_as_parser {}; - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/meta/fundamental.hpp b/Utilities/BGL/boost/spirit/meta/fundamental.hpp deleted file mode 100644 index cb0986cbc0ae84200486ab6fee3c8cb66bb24937..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/fundamental.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP) -#define BOOST_SPIRIT_FUNDAMENTAL_HPP - -#include <boost/spirit/meta/impl/fundamental.ipp> - -namespace boost { namespace spirit -{ - /////////////////////////////////////////////////////////////////////////// - // - // Helper template for counting the number of nodes contained in a - // given parser type. - // All parser_category type parsers are counted as nodes. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ParserT> - struct node_count { - - typedef typename ParserT::parser_category_t parser_category_t; - typedef typename impl::nodes<parser_category_t> - ::template count<ParserT, mpl::int_<0> > count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value); - }; - - /////////////////////////////////////////////////////////////////////////// - // - // Helper template for counting the number of leaf nodes contained in a - // given parser type. - // Only plain_parser_category type parsers are counted as leaf nodes. - // - /////////////////////////////////////////////////////////////////////////// - template <typename ParserT> - struct leaf_count { - - typedef typename ParserT::parser_category_t parser_category_t; - typedef typename impl::leafs<parser_category_t> - ::template count<ParserT, mpl::int_<0> > count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value); - }; - -}} // namespace boost::spirit - -#endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_HPP) diff --git a/Utilities/BGL/boost/spirit/meta/impl/fundamental.ipp b/Utilities/BGL/boost/spirit/meta/impl/fundamental.ipp deleted file mode 100644 index f0b16ca45a93442fea2945d5dbf08fa43eef998a..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/impl/fundamental.ipp +++ /dev/null @@ -1,305 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_FUNDAMENTAL_IPP) -#define BOOST_SPIRIT_FUNDAMENTAL_IPP - -#include <boost/mpl/int.hpp> - -namespace boost { namespace spirit { - -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - BOOST_SPIRIT_DEPENDENT_TEMPLATE_WRAPPER2(count_wrapper, count); -#endif // defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - -namespace impl -{ - /////////////////////////////////////////////////////////////////////////// - // - // Helper template for counting the number of nodes contained in a - // given parser type. - // All parser_category type parsers are counted as nodes. - // - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct nodes; - - template <> - struct nodes<plain_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { value = (LeafCountT::value + 1) }; - }; - }; - -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - - template <> - struct nodes<unary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef nodes<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value + 1); - }; - }; - - template <> - struct nodes<action_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef nodes<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value + 1); - }; - }; - - template <> - struct nodes<binary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::left_t left_t; - typedef typename ParserT::right_t right_t; - typedef typename left_t::parser_category_t left_category_t; - typedef typename right_t::parser_category_t right_category_t; - - typedef nodes<left_category_t> left_nodes_t; - typedef typename count_wrapper<left_nodes_t> - ::template result_<left_t, LeafCountT> left_count_t; - - typedef nodes<right_category_t> right_nodes_t; - typedef typename count_wrapper<right_nodes_t> - ::template result_<right_t, LeafCountT> right_count_t; - - BOOST_STATIC_CONSTANT(int, - value = (left_count_t::value + right_count_t::value + 1)); - }; - }; - -#else - - template <> - struct nodes<unary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { value = (nodes<subject_category_t> - ::template count<subject_t, LeafCountT>::value + 1) }; - }; - }; - - template <> - struct nodes<action_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { value = (nodes<subject_category_t> - ::template count<subject_t, LeafCountT>::value + 1) }; - }; - }; - - template <> - struct nodes<binary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::left_t left_t; - typedef typename ParserT::right_t right_t; - typedef typename left_t::parser_category_t left_category_t; - typedef typename right_t::parser_category_t right_category_t; - - typedef count self_t; - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { - leftcount = (nodes<left_category_t> - ::template count<left_t, LeafCountT>::value), - rightcount = (nodes<right_category_t> - ::template count<right_t, LeafCountT>::value), - value = ((self_t::leftcount) + (self_t::rightcount) + 1) - }; - }; - }; - -#endif - - /////////////////////////////////////////////////////////////////////////// - // - // Helper template for counting the number of leaf nodes contained in a - // given parser type. - // Only plain_parser_category type parsers are counted as leaf nodes. - // - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct leafs; - - template <> - struct leafs<plain_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { value = (LeafCountT::value + 1) }; - }; - }; - -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) - - template <> - struct leafs<unary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef leafs<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value); - }; - }; - - template <> - struct leafs<action_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - typedef leafs<subject_category_t> nodes_t; - typedef typename count_wrapper<nodes_t> - ::template result_<subject_t, LeafCountT> count_t; - - BOOST_STATIC_CONSTANT(int, value = count_t::value); - }; - }; - - template <> - struct leafs<binary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::left_t left_t; - typedef typename ParserT::right_t right_t; - typedef typename left_t::parser_category_t left_category_t; - typedef typename right_t::parser_category_t right_category_t; - - typedef leafs<left_category_t> left_nodes_t; - typedef typename count_wrapper<left_nodes_t> - ::template result_<left_t, LeafCountT> left_count_t; - - typedef leafs<right_category_t> right_nodes_t; - typedef typename count_wrapper<right_nodes_t> - ::template result_<right_t, LeafCountT> right_count_t; - - BOOST_STATIC_CONSTANT(int, - value = (left_count_t::value + right_count_t::value)); - }; - }; - -#else - - template <> - struct leafs<unary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { value = (leafs<subject_category_t> - ::template count<subject_t, LeafCountT>::value) }; - }; - }; - - template <> - struct leafs<action_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { value = (leafs<subject_category_t> - ::template count<subject_t, LeafCountT>::value) }; - }; - }; - - template <> - struct leafs<binary_parser_category> { - - template <typename ParserT, typename LeafCountT> - struct count { - - typedef typename ParserT::left_t left_t; - typedef typename ParserT::right_t right_t; - typedef typename left_t::parser_category_t left_category_t; - typedef typename right_t::parser_category_t right_category_t; - - typedef count self_t; - - // __BORLANDC__ == 0x0561 isn't happy with BOOST_STATIC_CONSTANT - enum { - leftcount = (leafs<left_category_t> - ::template count<left_t, LeafCountT>::value), - rightcount = (leafs<right_category_t> - ::template count<right_t, LeafCountT>::value), - value = (self_t::leftcount + self_t::rightcount) - }; - }; - }; - -#endif - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // !defined(BOOST_SPIRIT_FUNDAMENTAL_IPP) diff --git a/Utilities/BGL/boost/spirit/meta/impl/parser_traits.ipp b/Utilities/BGL/boost/spirit/meta/impl/parser_traits.ipp deleted file mode 100644 index af210f177a87e876854bc1e7b8758b23bb9f3bbe..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/impl/parser_traits.ipp +++ /dev/null @@ -1,187 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - Copyright (c) 2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_TRAITS_IPP) -#define BOOST_SPIRIT_PARSER_TRAITS_IPP - -#include <boost/spirit/core/composite/operators.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -namespace impl -{ - -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - /////////////////////////////////////////////////////////////////////////// - // - // from spirit 1.1 (copyright (c) 2001 Bruce Florman) - // various workarounds to support compile time decisions without partial - // template specialization whether a given type is an instance of a - // concrete parser type. - // - /////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - template <typename T> - struct parser_type_traits - { - // Determine at compile time (without partial specialization) - // whether a given type is an instance of the alternative<A,B> - - static T t(); - - typedef struct { char dummy[1]; } size1_t; - typedef struct { char dummy[2]; } size2_t; - typedef struct { char dummy[3]; } size3_t; - typedef struct { char dummy[4]; } size4_t; - typedef struct { char dummy[5]; } size5_t; - typedef struct { char dummy[6]; } size6_t; - typedef struct { char dummy[7]; } size7_t; - typedef struct { char dummy[8]; } size8_t; - typedef struct { char dummy[9]; } size9_t; - typedef struct { char dummy[10]; } size10_t; - - // the following functions need no implementation - template <typename A, typename B> - static size1_t test_(alternative<A, B> const&); - template <typename A, typename B> - static size2_t test_(sequence<A, B> const&); - template <typename A, typename B> - static size3_t test_(sequential_or<A, B> const&); - template <typename A, typename B> - static size4_t test_(intersection<A, B> const&); - template <typename A, typename B> - static size5_t test_(difference<A, B> const&); - template <typename A, typename B> - static size6_t test_(exclusive_or<A, B> const&); - template <typename S> - static size7_t test_(optional<S> const&); - template <typename S> - static size8_t test_(kleene_star<S> const&); - template <typename S> - static size9_t test_(positive<S> const&); - - static size10_t test_(...); - - BOOST_STATIC_CONSTANT(bool, - is_alternative = (sizeof(size1_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_sequence = (sizeof(size2_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_sequential_or = (sizeof(size3_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_intersection = (sizeof(size4_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_difference = (sizeof(size5_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_exclusive_or = (sizeof(size6_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_optional = (sizeof(size7_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_kleene_star = (sizeof(size8_t) == sizeof(test_(t()))) ); - BOOST_STATIC_CONSTANT(bool, - is_positive = (sizeof(size9_t) == sizeof(test_(t()))) ); - }; - -#else - - /////////////////////////////////////////////////////////////////////////// - struct parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_alternative = false); - BOOST_STATIC_CONSTANT(bool, is_sequence = false); - BOOST_STATIC_CONSTANT(bool, is_sequential_or = false); - BOOST_STATIC_CONSTANT(bool, is_intersection = false); - BOOST_STATIC_CONSTANT(bool, is_difference = false); - BOOST_STATIC_CONSTANT(bool, is_exclusive_or = false); - BOOST_STATIC_CONSTANT(bool, is_optional = false); - BOOST_STATIC_CONSTANT(bool, is_kleene_star = false); - BOOST_STATIC_CONSTANT(bool, is_positive = false); - }; - - template <typename ParserT> - struct parser_type_traits : public parser_type_traits_base { - - // no definition here, fallback for all not explicitly mentioned parser - // types - }; - - template <typename A, typename B> - struct parser_type_traits<alternative<A, B> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_alternative = true); - }; - - template <typename A, typename B> - struct parser_type_traits<sequence<A, B> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_sequence = true); - }; - - template <typename A, typename B> - struct parser_type_traits<sequential_or<A, B> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_sequential_or = true); - }; - - template <typename A, typename B> - struct parser_type_traits<intersection<A, B> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_intersection = true); - }; - - template <typename A, typename B> - struct parser_type_traits<difference<A, B> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_difference = true); - }; - - template <typename A, typename B> - struct parser_type_traits<exclusive_or<A, B> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_exclusive_or = true); - }; - - template <typename S> - struct parser_type_traits<optional<S> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_optional = true); - }; - - template <typename S> - struct parser_type_traits<kleene_star<S> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_kleene_star = true); - }; - - template <typename S> - struct parser_type_traits<positive<S> > - : public parser_type_traits_base { - - BOOST_STATIC_CONSTANT(bool, is_positive = true); - }; - -#endif // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // !defined(BOOST_SPIRIT_PARSER_TRAITS_IPP) diff --git a/Utilities/BGL/boost/spirit/meta/impl/refactoring.ipp b/Utilities/BGL/boost/spirit/meta/impl/refactoring.ipp deleted file mode 100644 index c63a8c07c3285f900f081acf3360492b3c0e5424..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/impl/refactoring.ipp +++ /dev/null @@ -1,447 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_REFACTORING_IPP -#define BOOST_SPIRIT_REFACTORING_IPP - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// The struct 'self_nested_refactoring' is used to indicate, that the -// refactoring algorithm should be 'self-nested'. -// -// The struct 'non_nested_refactoring' is used to indicate, that no nesting -// of refactoring algorithms is reqired. -// -/////////////////////////////////////////////////////////////////////////////// - -struct non_nested_refactoring { typedef non_nested_refactoring embed_t; }; -struct self_nested_refactoring { typedef self_nested_refactoring embed_t; }; - -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - -/////////////////////////////////////////////////////////////////////////////// -// -// Helper templates for refactoring parsers -// -/////////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - // - // refactor the left unary operand of a binary parser - // - // The refactoring should be done only if the left operand is an - // unary_parser_category parser. - // - /////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct refactor_unary_nested { - - template < - typename ParserT, typename NestedT, - typename ScannerT, typename BinaryT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, - NestedT const& /*nested_d*/) - { - return binary.parse(scan); - } - }; - - template <> - struct refactor_unary_nested<unary_parser_category> { - - template < - typename ParserT, typename ScannerT, typename BinaryT, - typename NestedT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, - NestedT const& nested_d) - { - typedef typename BinaryT::parser_generator_t op_t; - typedef - typename BinaryT::left_t::parser_generator_t - unary_t; - - return - unary_t::generate( - nested_d[ - op_t::generate(binary.left().subject(), binary.right()) - ] - ).parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct refactor_unary_non_nested { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) - { - return binary.parse(scan); - } - }; - - template <> - struct refactor_unary_non_nested<unary_parser_category> { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) - { - typedef typename BinaryT::parser_generator_t op_t; - typedef - typename BinaryT::left_t::parser_generator_t - unary_t; - - return unary_t::generate( - op_t::generate(binary.left().subject(), binary.right()) - ).parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - template <typename NestedT> - struct refactor_unary_type { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, - NestedT const& nested_d) - { - typedef - typename BinaryT::left_t::parser_category_t - parser_category_t; - - return refactor_unary_nested<parser_category_t>:: - parse(p, scan, binary, nested_d); - } - }; - - template <> - struct refactor_unary_type<non_nested_refactoring> { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, - non_nested_refactoring const&) - { - typedef - typename BinaryT::left_t::parser_category_t - parser_category_t; - - return refactor_unary_non_nested<parser_category_t>:: - parse(p, scan, binary); - } - - }; - - template <> - struct refactor_unary_type<self_nested_refactoring> { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, - self_nested_refactoring const &nested_tag) - { - typedef - typename BinaryT::left_t::parser_category_t - parser_category_t; - typedef typename ParserT::parser_generator_t parser_generator_t; - - parser_generator_t nested_d(nested_tag); - return refactor_unary_nested<parser_category_t>:: - parse(p, scan, binary, nested_d); - } - - }; - - /////////////////////////////////////////////////////////////////////////// - // - // refactor the action on the left operand of a binary parser - // - // The refactoring should be done only if the left operand is an - // action_parser_category parser. - // - /////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct refactor_action_nested { - - template < - typename ParserT, typename ScannerT, typename BinaryT, - typename NestedT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, - NestedT const& nested_d) - { - return nested_d[binary].parse(scan); - } - }; - - template <> - struct refactor_action_nested<action_parser_category> { - - template < - typename ParserT, typename ScannerT, typename BinaryT, - typename NestedT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary, - NestedT const& nested_d) - { - typedef typename BinaryT::parser_generator_t binary_gen_t; - - return ( - nested_d[ - binary_gen_t::generate( - binary.left().subject(), - binary.right() - ) - ][binary.left().predicate()] - ).parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct refactor_action_non_nested { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) - { - return binary.parse(scan); - } - }; - - template <> - struct refactor_action_non_nested<action_parser_category> { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, BinaryT const& binary) - { - typedef typename BinaryT::parser_generator_t binary_gen_t; - - return ( - binary_gen_t::generate( - binary.left().subject(), - binary.right() - )[binary.left().predicate()] - ).parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - template <typename NestedT> - struct refactor_action_type { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, - NestedT const& nested_d) - { - typedef - typename BinaryT::left_t::parser_category_t - parser_category_t; - - return refactor_action_nested<parser_category_t>:: - parse(p, scan, binary, nested_d); - } - }; - - template <> - struct refactor_action_type<non_nested_refactoring> { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, - non_nested_refactoring const&) - { - typedef - typename BinaryT::left_t::parser_category_t - parser_category_t; - - return refactor_action_non_nested<parser_category_t>:: - parse(p, scan, binary); - } - }; - - template <> - struct refactor_action_type<self_nested_refactoring> { - - template <typename ParserT, typename ScannerT, typename BinaryT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, BinaryT const& binary, - self_nested_refactoring const &nested_tag) - { - typedef typename ParserT::parser_generator_t parser_generator_t; - typedef - typename BinaryT::left_t::parser_category_t - parser_category_t; - - parser_generator_t nested_d(nested_tag); - return refactor_action_nested<parser_category_t>:: - parse(p, scan, binary, nested_d); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // refactor the action attached to a binary parser - // - // The refactoring should be done only if the given parser is an - // binary_parser_category parser. - // - /////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct attach_action_nested { - - template < - typename ParserT, typename ScannerT, typename ActionT, - typename NestedT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, ActionT const &action, - NestedT const& nested_d) - { - return action.parse(scan); - } - }; - - template <> - struct attach_action_nested<binary_parser_category> { - - template < - typename ParserT, typename ScannerT, typename ActionT, - typename NestedT - > - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, ActionT const &action, - NestedT const& nested_d) - { - typedef - typename ActionT::subject_t::parser_generator_t - binary_gen_t; - - return ( - binary_gen_t::generate( - nested_d[action.subject().left()[action.predicate()]], - nested_d[action.subject().right()[action.predicate()]] - ) - ).parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - template <typename CategoryT> - struct attach_action_non_nested { - - template <typename ParserT, typename ScannerT, typename ActionT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, ActionT const &action) - { - return action.parse(scan); - } - }; - - template <> - struct attach_action_non_nested<binary_parser_category> { - - template <typename ParserT, typename ScannerT, typename ActionT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &, ScannerT const& scan, ActionT const &action) - { - typedef - typename ActionT::subject_t::parser_generator_t - binary_gen_t; - - return ( - binary_gen_t::generate( - action.subject().left()[action.predicate()], - action.subject().right()[action.predicate()] - ) - ).parse(scan); - } - }; - - /////////////////////////////////////////////////////////////////////////// - template <typename NestedT> - struct attach_action_type { - - template <typename ParserT, typename ScannerT, typename ActionT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, ActionT const& action, - NestedT const& nested_d) - { - typedef - typename ActionT::subject_t::parser_category_t - parser_category_t; - - return attach_action_nested<parser_category_t>:: - parse(p, scan, action, nested_d); - } - }; - - template <> - struct attach_action_type<non_nested_refactoring> { - - template <typename ParserT, typename ScannerT, typename ActionT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, ActionT const &action, - non_nested_refactoring const&) - { - typedef - typename ActionT::subject_t::parser_category_t - parser_category_t; - - return attach_action_non_nested<parser_category_t>:: - parse(p, scan, action); - } - }; - - template <> - struct attach_action_type<self_nested_refactoring> { - - template <typename ParserT, typename ScannerT, typename ActionT> - static typename parser_result<ParserT, ScannerT>::type - parse(ParserT const &p, ScannerT const& scan, ActionT const &action, - self_nested_refactoring const& nested_tag) - { - typedef typename ParserT::parser_generator_t parser_generator_t; - typedef - typename ActionT::subject_t::parser_category_t - parser_category_t; - - parser_generator_t nested_d(nested_tag); - return attach_action_nested<parser_category_t>:: - parse(p, scan, action, nested_d); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/meta/impl/traverse.ipp b/Utilities/BGL/boost/spirit/meta/impl/traverse.ipp deleted file mode 100644 index 71c9a9fa8083f1f6307842f6b3038c59a5b2c360..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/impl/traverse.ipp +++ /dev/null @@ -1,389 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_TRAVERSE_IPP) -#define BOOST_SPIRIT_TRAVERSE_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/meta/fundamental.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -namespace impl -{ - - template <typename CategoryT> - struct traverse_post_order_return_category; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -// -// Environment class for post_order_traversal -// -/////////////////////////////////////////////////////////////////////////////// - -template <int Level, int Node, int Index, int LastLeft> -struct traverse_post_order_env { - - BOOST_STATIC_CONSTANT(int, level = Level); - BOOST_STATIC_CONSTANT(int, node = Node); - BOOST_STATIC_CONSTANT(int, index = Index); - BOOST_STATIC_CONSTANT(int, lastleft = LastLeft); -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// traverse_post_order_return template -// -// This template is a helper for dispatching the calculation of a parser -// type result for a traversal level to the corresponding parser_category -// based specialization. -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename MetaT, typename ParserT, typename EnvT> -struct traverse_post_order_return { - - typedef typename ParserT::parser_category_t parser_category_t; - typedef typename impl::traverse_post_order_return_category<parser_category_t> - ::template result<MetaT, ParserT, EnvT>::type type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// parser_traversal_..._result templates -// -// These are metafunctions, which calculate the resulting parser type -// for all subparsers and feed these types to the user supplied -// metafunctions to get back the resulting parser type of this traversal -// level. -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename MetaT, typename ParserT, typename EnvT> -struct parser_traversal_plain_result { - - typedef typename MetaT::template plain_result<ParserT, EnvT>::type type; -}; - -/////////////////////////////////////////////////////////////////////////////// -template <typename MetaT, typename UnaryT, typename SubjectT, typename EnvT> -struct parser_traversal_unary_result { - - typedef typename MetaT - ::template unary_result<UnaryT, SubjectT, EnvT>::type type; -}; - -/////////////////////////////////////////////////////////////////////////////// -template <typename MetaT, typename ActionT, typename SubjectT, typename EnvT> -struct parser_traversal_action_result { - - typedef typename MetaT - ::template action_result<ActionT, SubjectT, EnvT>::type type; -}; - -/////////////////////////////////////////////////////////////////////////////// -template < - typename MetaT, typename BinaryT, typename LeftT, - typename RightT, typename EnvT -> -struct parser_traversal_binary_result { - - BOOST_STATIC_CONSTANT(int, - thisnum = (node_count<BinaryT>::value + EnvT::lastleft-1)); - BOOST_STATIC_CONSTANT(int, - leftnum = (node_count<LeftT>::value + EnvT::lastleft-1)); - BOOST_STATIC_CONSTANT(int, - leafnum = (leaf_count<LeftT>::value + EnvT::index)); - - typedef parser_traversal_binary_result self_t; - - // left traversal environment and resulting parser type - typedef traverse_post_order_env< - (EnvT::level+1), (self_t::leftnum), (EnvT::index), (EnvT::lastleft) - > left_sub_env_t; - typedef typename traverse_post_order_return< - MetaT, LeftT, left_sub_env_t - >::type - left_t; - - // right traversal environment and resulting parser type - typedef traverse_post_order_env< - (EnvT::level+1), (self_t::thisnum-1), (self_t::leafnum), (self_t::leftnum+1) - > right_sub_env_t; - typedef typename traverse_post_order_return< - MetaT, RightT, right_sub_env_t - >::type - right_t; - - typedef typename MetaT::template binary_result< - BinaryT, left_t, right_t, EnvT - >::type - type; -}; - -/////////////////////////////////////////////////////////////////////////////// -namespace impl -{ - /////////////////////////////////////////////////////////////////////////// - // - // Meta functions, which dispatch the calculation of the return type of - // of the post_order traverse function to the result template of the - // corresponding parser_category based metafunction template. - // - /////////////////////////////////////////////////////////////////////////// - - template <typename CategoryT> - struct traverse_post_order_return_category; - - template <> - struct traverse_post_order_return_category<plain_parser_category> { - - template <typename MetaT, typename ParserT, typename EnvT> - struct result { - - typedef typename parser_traversal_plain_result< - MetaT, ParserT, EnvT - >::type - type; - }; - }; - - template <> - struct traverse_post_order_return_category<unary_parser_category> { - - template <typename MetaT, typename ParserT, typename EnvT> - struct result { - - typedef typename parser_traversal_unary_result< - MetaT, ParserT, typename ParserT::subject_t, EnvT - >::type - type; - }; - }; - - template <> - struct traverse_post_order_return_category<action_parser_category> { - - template <typename MetaT, typename ParserT, typename EnvT> - struct result { - - typedef typename parser_traversal_action_result< - MetaT, ParserT, typename ParserT::subject_t, EnvT - >::type - type; - }; - }; - - template <> - struct traverse_post_order_return_category<binary_parser_category> { - - template <typename MetaT, typename ParserT, typename EnvT> - struct result { - - typedef typename parser_traversal_binary_result< - MetaT, ParserT, typename ParserT::left_t, - typename ParserT::right_t, EnvT - >::type - type; - }; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // Post-order parser traversal - // - // The following templates contain the parser_category based code for - // - // - calculating the type of the resulting parser, which is to be - // returned from a level of traversal - // - traversing down the composite parser structure, this traversal - // returnes a new parser object - // - // Both tasks are delegated to the MetaT metafunction supplied by the - // user. - // - /////////////////////////////////////////////////////////////////////////// - - template <typename CategoryT> - struct traverse_post_order; - - template <> - struct traverse_post_order<plain_parser_category> { - - template <typename MetaT, typename ParserT, typename EnvT> - struct result { - - typedef - typename parser_traversal_plain_result<MetaT, ParserT, EnvT>::type - type; - }; - - template <typename MetaT, typename ParserT, typename EnvT> - static - typename parser_traversal_plain_result<MetaT, ParserT, EnvT>::type - generate(MetaT const &meta_, ParserT const &parser_, EnvT const &env) - { - return meta_.generate_plain(parser_, env); - } - }; - - template <> - struct traverse_post_order<unary_parser_category> { - - template < - typename MetaT, typename ParserT, typename SubjectT, typename EnvT - > - struct result { - - typedef typename parser_traversal_unary_result< - MetaT, ParserT, SubjectT, EnvT - >::type - type; - }; - - template <typename MetaT, typename ParserT, typename EnvT> - static - typename parser_traversal_unary_result< - MetaT, ParserT, - typename traverse_post_order_return< - MetaT, typename ParserT::subject_t, EnvT - >::type, - EnvT - >::type - generate(MetaT const &meta_, ParserT const &unary_, EnvT const &env) - { - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - return meta_.generate_unary( - unary_, - traverse_post_order<subject_category_t>::generate(meta_, - unary_.subject(), - traverse_post_order_env< - EnvT::level+1, EnvT::node-1, EnvT::index, EnvT::lastleft - >() - ), - env - ); - } - }; - - template <> - struct traverse_post_order<action_parser_category> { - - template < - typename MetaT, typename ParserT, typename SubjectT, typename EnvT - > - struct result { - - typedef typename parser_traversal_action_result< - MetaT, ParserT, SubjectT, EnvT - >::type - type; - }; - - template <typename MetaT, typename ParserT, typename EnvT> - static - typename parser_traversal_action_result< - MetaT, ParserT, - typename traverse_post_order_return< - MetaT, typename ParserT::subject_t, EnvT - >::type, - EnvT - >::type - generate(MetaT const &meta_, ParserT const &action_, EnvT const &env) - { - typedef typename ParserT::subject_t subject_t; - typedef typename subject_t::parser_category_t subject_category_t; - - return meta_.generate_action( - action_, - traverse_post_order<subject_category_t>::generate(meta_, - action_.subject(), - traverse_post_order_env< - EnvT::level+1, EnvT::node-1, EnvT::index, EnvT::lastleft - >() - ), - env - ); - } - }; - - template <> - struct traverse_post_order<binary_parser_category> { - - template < - typename MetaT, typename ParserT, typename LeftT, - typename RightT, typename EnvT - > - struct result { - - typedef typename parser_traversal_binary_result< - MetaT, ParserT, LeftT, RightT, EnvT - >::type - type; - }; - - template <typename MetaT, typename ParserT, typename EnvT> - static - typename parser_traversal_binary_result< - MetaT, ParserT, - typename traverse_post_order_return< - MetaT, typename ParserT::left_t, EnvT - >::type, - typename traverse_post_order_return< - MetaT, typename ParserT::right_t, EnvT - >::type, - EnvT - >::type - generate(MetaT const &meta_, ParserT const &binary_, EnvT const& /*env*/) - { - typedef typename ParserT::left_t left_t; - typedef typename ParserT::right_t right_t; - typedef typename left_t::parser_category_t left_category_t; - typedef typename right_t::parser_category_t right_category_t; - - enum { - leftnum = (node_count<left_t>::value + EnvT::lastleft-1), - thisnum = (node_count<ParserT>::value + EnvT::lastleft-1), - rightnum = (thisnum-1), - leafnum = (leaf_count<left_t>::value + EnvT::index) - }; - - return meta_.generate_binary( - binary_, - traverse_post_order<left_category_t>::generate( - meta_, binary_.left(), - traverse_post_order_env< - EnvT::level+1, leftnum, EnvT::index, EnvT::lastleft - >() - ), - traverse_post_order<right_category_t>::generate( - meta_, binary_.right(), - traverse_post_order_env< - EnvT::level+1, rightnum, leafnum, leftnum+1 - >() - ), - traverse_post_order_env< - EnvT::level, thisnum, EnvT::index, EnvT::lastleft - >() - ); - } - }; - -} // namespace impl - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // !defined(BOOST_SPIRIT_TRAVERSE_IPP) diff --git a/Utilities/BGL/boost/spirit/meta/parser_traits.hpp b/Utilities/BGL/boost/spirit/meta/parser_traits.hpp deleted file mode 100644 index 3a967415e9144bb2c246118c1c59079cfdaed4e2..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/parser_traits.hpp +++ /dev/null @@ -1,316 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - Copyright (c) 2003 Martin Wille - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_PARSER_TRAITS_HPP) -#define BOOST_SPIRIT_PARSER_TRAITS_HPP - -#include <boost/type_traits/is_base_and_derived.hpp> -#include <boost/static_assert.hpp> - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/meta/impl/parser_traits.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// Parser traits templates -// -// Used to determine the type and several other characteristics of a given -// parser type. -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// The is_parser traits template can be used to tell wether a given -// class is a parser. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -struct is_parser -{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::is_base_and_derived<parser<T>, T>::value)); - -// [JDG 2/3/03] simplified implementation by -// using boost::is_base_and_derived -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The is_unary_composite traits template can be used to tell if a given -// parser is a unary parser as for instance kleene_star or optional. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename UnaryT> -struct is_unary_composite { - - BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible< - typename UnaryT::parser_category_t, unary_parser_category>::value)); -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The is_acction_parser traits template can be used to tell if a given -// parser is a action parser, i.e. it is a composite consisting of a -// auxilliary parser and an attached semantic action. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ActionT> -struct is_action_parser { - - BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible< - typename ActionT::parser_category_t, action_parser_category>::value)); -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The is_binary_composite traits template can be used to tell if a given -// parser is a binary parser as for instance sequence or difference. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename BinaryT> -struct is_binary_composite { - - BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible< - typename BinaryT::parser_category_t, binary_parser_category>::value)); -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The is_composite_parser traits template can be used to tell if a given -// parser is a unary or a binary parser composite type. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CompositeT> -struct is_composite_parser { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::is_unary_composite<CompositeT>::value || - ::boost::spirit::is_binary_composite<CompositeT>::value)); -}; - -/////////////////////////////////////////////////////////////////////////////// -template <typename ParserT> -struct is_alternative { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_alternative)); -}; - -template <typename ParserT> -struct is_sequence { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_sequence)); -}; - -template <typename ParserT> -struct is_sequential_or { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_sequential_or)); -}; - -template <typename ParserT> -struct is_intersection { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_intersection)); -}; - -template <typename ParserT> -struct is_difference { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_difference)); -}; - -template <typename ParserT> -struct is_exclusive_or { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_exclusive_or)); -}; - -template <typename ParserT> -struct is_optional { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_optional)); -}; - -template <typename ParserT> -struct is_kleene_star { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_kleene_star)); -}; - -template <typename ParserT> -struct is_positive { - - BOOST_STATIC_CONSTANT(bool, value = ( - ::boost::spirit::impl::parser_type_traits<ParserT>::is_positive)); -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Parser extraction templates -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// The unary_subject template can be used to return the type of the -// parser used as the subject of an unary parser. -// If the parser under inspection is not an unary type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename UnaryT> -struct unary_subject { - - BOOST_STATIC_ASSERT(::boost::spirit::is_unary_composite<UnaryT>::value); - typedef typename UnaryT::subject_t type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The get_unary_subject template function returns the parser object, which -// is used as the subject of an unary parser. -// If the parser under inspection is not an unary type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename UnaryT> -inline typename unary_subject<UnaryT>::type const & -get_unary_subject(UnaryT const &unary_) -{ - BOOST_STATIC_ASSERT(::boost::spirit::is_unary_composite<UnaryT>::value); - return unary_.subject(); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// The binary_left_subject and binary_right_subject templates can be used to -// return the types of the parsers used as the left and right subject of an -// binary parser. -// If the parser under inspection is not a binary type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename BinaryT> -struct binary_left_subject { - - BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite<BinaryT>::value); - typedef typename BinaryT::left_t type; -}; - -template <typename BinaryT> -struct binary_right_subject { - - BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite<BinaryT>::value); - typedef typename BinaryT::right_t type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The get_binary_left_subject and get_binary_right_subject template functions -// return the parser object, which is used as the left or right subject of a -// binary parser. -// If the parser under inspection is not a binary type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename BinaryT> -inline typename binary_left_subject<BinaryT>::type const & -get_binary_left_subject(BinaryT const &binary_) -{ - BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite<BinaryT>::value); - return binary_.left(); -} - -template <typename BinaryT> -inline typename binary_right_subject<BinaryT>::type const & -get_binary_right_subject(BinaryT const &binary_) -{ - BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite<BinaryT>::value); - return binary_.right(); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// The action_subject template can be used to return the type of the -// parser used as the subject of an action parser. -// If the parser under inspection is not an action type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ActionT> -struct action_subject { - - BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser<ActionT>::value); - typedef typename ActionT::subject_t type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The get_action_subject template function returns the parser object, which -// is used as the subject of an action parser. -// If the parser under inspection is not an action type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ActionT> -inline typename action_subject<ActionT>::type const & -get_action_subject(ActionT const &action_) -{ - BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser<ActionT>::value); - return action_.subject(); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// The semantic_action template can be used to return the type of the -// attached semantic action of an action parser. -// If the parser under inspection is not an action type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ActionT> -struct semantic_action { - - BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser<ActionT>::value); - typedef typename ActionT::predicate_t type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// The get_semantic_action template function returns the attached semantic -// action of an action parser. -// If the parser under inspection is not an action type parser the compilation -// will fail. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ActionT> -inline typename semantic_action<ActionT>::type const & -get_semantic_action(ActionT const &action_) -{ - BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser<ActionT>::value); - return action_.predicate(); -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // !defined(BOOST_SPIRIT_PARSER_TRAITS_HPP) diff --git a/Utilities/BGL/boost/spirit/meta/refactoring.hpp b/Utilities/BGL/boost/spirit/meta/refactoring.hpp deleted file mode 100644 index 6e92683b70d04b9c5c14cd5825264690ee08f6f8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/refactoring.hpp +++ /dev/null @@ -1,274 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_REFACTORING_HPP -#define BOOST_SPIRIT_REFACTORING_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/static_assert.hpp> -#include <boost/spirit/meta/as_parser.hpp> -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/composite.hpp> -#include <boost/spirit/meta/impl/refactoring.ipp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// refactor_unary_parser class -// -// This helper template allows to attach an unary operation to a newly -// constructed parser, which combines the subject of the left operand of -// the original given parser (BinaryT) with the right operand of the -// original binary parser through the original binary operation and -// rewraps the resulting parser with the original unary operator. -// -// For instance given the parser: -// *some_parser - another_parser -// -// will be refactored to: -// *(some_parser - another_parser) -// -// If the parser to refactor is not a unary parser, no refactoring is done -// at all. -// -// The original parser should be a binary_parser_category parser, -// else the compilation will fail -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename NestedT = non_nested_refactoring> -class refactor_unary_gen; - -template <typename BinaryT, typename NestedT = non_nested_refactoring> -class refactor_unary_parser : - public parser<refactor_unary_parser<BinaryT, NestedT> > { - -public: - // the parser to refactor has to be at least a binary_parser_category - // parser - BOOST_STATIC_ASSERT(( - boost::is_convertible<typename BinaryT::parser_category_t, - binary_parser_category>::value - )); - - refactor_unary_parser(BinaryT const& binary_, NestedT const& nested_) - : binary(binary_), nested(nested_) {} - - typedef refactor_unary_parser<BinaryT, NestedT> self_t; - typedef refactor_unary_gen<NestedT> parser_generator_t; - typedef typename BinaryT::left_t::parser_category_t parser_category_t; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return impl::refactor_unary_type<NestedT>:: - parse(*this, scan, binary, nested); - } - -private: - typename as_parser<BinaryT>::type::embed_t binary; - typename NestedT::embed_t nested; -}; - -////////////////////////////////// -template <typename NestedT> -class refactor_unary_gen { - -public: - typedef refactor_unary_gen<NestedT> embed_t; - - refactor_unary_gen(NestedT const& nested_ = non_nested_refactoring()) - : nested(nested_) {} - - template <typename ParserT> - refactor_unary_parser<ParserT, NestedT> - operator[](parser<ParserT> const& subject) const - { - return refactor_unary_parser<ParserT, NestedT> - (subject.derived(), nested); - } - -private: - typename NestedT::embed_t nested; -}; - -const refactor_unary_gen<> refactor_unary_d = refactor_unary_gen<>(); - -/////////////////////////////////////////////////////////////////////////////// -// -// refactor_action_parser class -// -// This helper template allows to attach an action taken from the left -// operand of the given binary parser to a newly constructed parser, -// which combines the subject of the left operand of the original binary -// parser with the right operand of the original binary parser by means of -// the original binary operator parser. -// -// For instance the parser: -// some_parser[some_attached_functor] - another_parser -// -// will be refactored to: -// (some_parser - another_parser)[some_attached_functor] -// -// If the left operand to refactor is not an action parser, no refactoring -// is done at all. -// -// The original parser should be a binary_parser_category parser, -// else the compilation will fail -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename NestedT = non_nested_refactoring> -class refactor_action_gen; - -template <typename BinaryT, typename NestedT = non_nested_refactoring> -class refactor_action_parser : - public parser<refactor_action_parser<BinaryT, NestedT> > { - -public: - // the parser to refactor has to be at least a binary_parser_category - // parser - BOOST_STATIC_ASSERT(( - boost::is_convertible<typename BinaryT::parser_category_t, - binary_parser_category>::value - )); - - refactor_action_parser(BinaryT const& binary_, NestedT const& nested_) - : binary(binary_), nested(nested_) {} - - typedef refactor_action_parser<BinaryT, NestedT> self_t; - typedef refactor_action_gen<NestedT> parser_generator_t; - typedef typename BinaryT::left_t::parser_category_t parser_category_t; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return impl::refactor_action_type<NestedT>:: - parse(*this, scan, binary, nested); - } - -private: - typename as_parser<BinaryT>::type::embed_t binary; - typename NestedT::embed_t nested; -}; - -////////////////////////////////// -template <typename NestedT> -class refactor_action_gen { - -public: - typedef refactor_action_gen<NestedT> embed_t; - - refactor_action_gen(NestedT const& nested_ = non_nested_refactoring()) - : nested(nested_) {} - - template <typename ParserT> - refactor_action_parser<ParserT, NestedT> - operator[](parser<ParserT> const& subject) const - { - return refactor_action_parser<ParserT, NestedT> - (subject.derived(), nested); - } - -private: - typename NestedT::embed_t nested; -}; - -const refactor_action_gen<> refactor_action_d = refactor_action_gen<>(); - -/////////////////////////////////////////////////////////////////////////////// -// -// attach_action_parser class -// -// This helper template allows to attach an action given separately -// to to all parsers, out of which the given parser is constructed and -// reconstructs a new parser having the same structure. -// -// For instance the parser: -// (some_parser >> another_parser)[some_attached_functor] -// -// will be refactored to: -// some_parser[some_attached_functor] -// >> another_parser[some_attached_functor] -// -// The original parser should be a action_parser_category parser, -// else the compilation will fail -// -// If the parser, to which the action is attached is not an binary parser, -// no refactoring is done at all. -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename NestedT = non_nested_refactoring> -class attach_action_gen; - -template <typename ActionT, typename NestedT = non_nested_refactoring> -class attach_action_parser : - public parser<attach_action_parser<ActionT, NestedT> > { - -public: - // the parser to refactor has to be at least a action_parser_category - // parser - BOOST_STATIC_ASSERT(( - boost::is_convertible<typename ActionT::parser_category_t, - action_parser_category>::value - )); - - attach_action_parser(ActionT const& actor_, NestedT const& nested_) - : actor(actor_), nested(nested_) {} - - typedef attach_action_parser<ActionT, NestedT> self_t; - typedef attach_action_gen<NestedT> parser_generator_t; - typedef typename ActionT::parser_category_t parser_category_t; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - return impl::attach_action_type<NestedT>:: - parse(*this, scan, actor, nested); - } - -private: - typename as_parser<ActionT>::type::embed_t actor; - typename NestedT::embed_t nested; -}; - -////////////////////////////////// -template <typename NestedT> -class attach_action_gen { - -public: - typedef attach_action_gen<NestedT> embed_t; - - attach_action_gen(NestedT const& nested_ = non_nested_refactoring()) - : nested(nested_) {} - - template <typename ParserT, typename ActionT> - attach_action_parser<action<ParserT, ActionT>, NestedT> - operator[](action<ParserT, ActionT> const& actor) const - { - return attach_action_parser<action<ParserT, ActionT>, NestedT> - (actor, nested); - } - -private: - typename NestedT::embed_t nested; -}; - -const attach_action_gen<> attach_action_d = attach_action_gen<>(); - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif // BOOST_SPIRIT_REFACTORING_HPP - diff --git a/Utilities/BGL/boost/spirit/meta/traverse.hpp b/Utilities/BGL/boost/spirit/meta/traverse.hpp deleted file mode 100644 index 0151412c1c13747636f7608b4bdfead17cc94af0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/meta/traverse.hpp +++ /dev/null @@ -1,218 +0,0 @@ -/*============================================================================= - Copyright (c) 2002-2003 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_TRAVERSE_HPP) -#define BOOST_SPIRIT_TRAVERSE_HPP - -#include <boost/spirit/meta/impl/traverse.ipp> - -namespace boost { namespace spirit -{ - /////////////////////////////////////////////////////////////////////////// - // - // Post-order traversal of auxilliary parsers. - // - /////////////////////////////////////////////////////////////////////////// - struct post_order - { - // Return the parser type, which is generated as the result of the - // traverse function below. - - template <typename MetaT, typename ParserT> - struct result - { - typedef typename - traverse_post_order_return< - MetaT - , ParserT - , traverse_post_order_env<0, 0, 0, 0> - >::type - type; - }; - - // Traverse a given parser and refactor it with the help of the given - // MetaT metafunction template. - - template <typename MetaT, typename ParserT> - static typename result<MetaT, ParserT>::type - traverse(MetaT const &meta_, ParserT const &parser_) - { - typedef typename ParserT::parser_category_t parser_category_t; - return impl::traverse_post_order<parser_category_t>::generate( - meta_, parser_, traverse_post_order_env<0, 0, 0, 0>()); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // Transform policies - // - // The following policy classes could be used to assemble some new - // transformation metafunction which uses identity transformations - // for some parser_category type parsers. - // - /////////////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////////// - // transform plain parsers - template <typename TransformT> - struct plain_identity_policy - { - template <typename ParserT, typename EnvT> - struct plain_result - { - // plain parsers should be embedded and returned correctly - typedef typename ParserT::embed_t type; - }; - - template <typename ParserT, typename EnvT> - typename parser_traversal_plain_result<TransformT, ParserT, EnvT>::type - generate_plain(ParserT const &parser_, EnvT const& /*env*/) const - { - return parser_; - } - }; - - ////////////////////////////////// - // transform unary parsers - template <typename UnaryT, typename SubjectT> - struct unary_identity_policy_return - { - typedef typename UnaryT::parser_generator_t parser_generator_t; - typedef typename parser_generator_t - ::template result<SubjectT>::type type; - }; - - template <typename TransformT> - struct unary_identity_policy - { - template <typename UnaryT, typename SubjectT, typename EnvT> - struct unary_result - { - typedef - typename unary_identity_policy_return<UnaryT, SubjectT>::type - type; - }; - - template <typename UnaryT, typename SubjectT, typename EnvT> - typename parser_traversal_unary_result< - TransformT, UnaryT, SubjectT, EnvT>::type - generate_unary( - UnaryT const &, SubjectT const &subject_, EnvT const& /*env*/) const - { - typedef typename UnaryT::parser_generator_t parser_generator_t; - return parser_generator_t::template generate<SubjectT>(subject_); - } - }; - - ////////////////////////////////// - // transform action parsers - template <typename TransformT> - struct action_identity_policy - { - template <typename ActionT, typename SubjectT, typename EnvT> - struct action_result - { - typedef action<SubjectT, typename ActionT::predicate_t> type; - }; - - template <typename ActionT, typename SubjectT, typename EnvT> - typename parser_traversal_action_result< - TransformT, ActionT, SubjectT, EnvT - >::type - generate_action(ActionT const &action_, SubjectT const &subject_, - EnvT const& /*env*/) const - { - return subject_[action_.predicate()]; - } - }; - - ////////////////////////////////// - // transform binary parsers - template <typename BinaryT, typename LeftT, typename RightT> - struct binary_identity_policy_return - { - typedef typename BinaryT::parser_generator_t parser_generator_t; - typedef typename parser_generator_t - ::template result<LeftT, RightT>::type type; - }; - - template <typename TransformT> - struct binary_identity_policy - { - template <typename BinaryT, typename LeftT - , typename RightT, typename EnvT> - struct binary_result { - - typedef typename - binary_identity_policy_return<BinaryT, LeftT, RightT>::type - type; - }; - - template <typename BinaryT, typename LeftT - , typename RightT, typename EnvT> - typename parser_traversal_binary_result< - TransformT, BinaryT, LeftT, RightT, EnvT - >::type - generate_binary( - BinaryT const &, LeftT const& left_ - , RightT const& right_, EnvT const& /*env*/) const - { - typedef typename BinaryT::parser_generator_t parser_generator_t; - return parser_generator_t:: - template generate<LeftT, RightT>(left_, right_); - } - }; - - /////////////////////////////////////////////////////////////////////////// - // - // transform_policies template - // - // The transform_policies template metafunction could serve as a - // base class for new metafunctions to be passed to the traverse meta - // template (see above), where only minimal parts have to be - // overwritten. - // - /////////////////////////////////////////////////////////////////////////// - - template < - typename TransformT, - typename PlainPolicyT = plain_identity_policy<TransformT>, - typename UnaryPolicyT = unary_identity_policy<TransformT>, - typename ActionPolicyT = action_identity_policy<TransformT>, - typename BinaryPolicyT = binary_identity_policy<TransformT> - > - struct transform_policies : - public PlainPolicyT, - public UnaryPolicyT, - public ActionPolicyT, - public BinaryPolicyT - { - }; - - /////////////////////////////////////////////////////////////////////////// - // - // Identity transformation - // - // The identity_transform metafunction supplied to the traverse - // template will generate a new parser, which will be exactly - // identical to the parser given as the parameter to the traverse - // metafunction. I.e. the following conceptual 'equation' will be - // always true: - // - // some_parser == - // post_order::traverse(identity_transform(), some_parser) - // - /////////////////////////////////////////////////////////////////////////// - - struct identity_transform : transform_policies<identity_transform> {}; - -}} // namespace boost::spirit - -#endif // !defined(BOOST_SPIRIT_TRAVERSE_HPP) diff --git a/Utilities/BGL/boost/spirit/phoenix.hpp b/Utilities/BGL/boost/spirit/phoenix.hpp deleted file mode 100644 index f3655b2cb95f0927486f494185814b1b3607438c..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#if !defined(BOOST_SPIRIT_PHOENIX_HPP) -#define BOOST_SPIRIT_PHOENIX_HPP - -#include <boost/spirit/phoenix/tuples.hpp> -#include <boost/spirit/phoenix/tuple_helpers.hpp> -#include <boost/spirit/phoenix/actor.hpp> -#include <boost/spirit/phoenix/primitives.hpp> -#include <boost/spirit/phoenix/composite.hpp> -#include <boost/spirit/phoenix/functions.hpp> -#include <boost/spirit/phoenix/operators.hpp> -#include <boost/spirit/phoenix/special_ops.hpp> -#include <boost/spirit/phoenix/statements.hpp> -#include <boost/spirit/phoenix/binders.hpp> -#include <boost/spirit/phoenix/closures.hpp> -#include <boost/spirit/phoenix/casts.hpp> -#include <boost/spirit/phoenix/new.hpp> - -#endif // !defined(BOOST_SPIRIT_PHOENIX_HPP) diff --git a/Utilities/BGL/boost/spirit/phoenix/actor.hpp b/Utilities/BGL/boost/spirit/phoenix/actor.hpp deleted file mode 100644 index 9398bc1a66e949347b99fac0b2c71eae7f3c7f95..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/actor.hpp +++ /dev/null @@ -1,596 +0,0 @@ -/*============================================================================= - Phoenix v1.2 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_ACTOR_HPP -#define PHOENIX_ACTOR_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/tuples.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -// These are forward declared here because we cannot include impl.hpp -// or operators.hpp yet but the actor's assignment operator and index -// operator are required to be members. - -////////////////////////////////// -struct assign_op; -struct index_op; - -////////////////////////////////// -namespace impl { - - template <typename OperationT, typename BaseT, typename B> - struct make_binary1; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// unpack_tuple class -// -// This class is used to unpack a supplied tuple such, that the members of -// this tuple will be handled as if they would be supplied separately. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename TupleT> -struct unpack_tuple : public TupleT { - - typedef TupleT tuple_t; - - unpack_tuple() {} - unpack_tuple(tuple_t const &tuple_) : TupleT(tuple_) {} -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// actor class -// -// This class is a protocol class for all actors. This class is -// essentially an interface contract. The actor class does not -// really know how how to act on anything but instead relies on the -// template parameter BaseT (from which the actor will derive from) -// to do the actual action. -// -// An actor is a functor that is capable of accepting arguments up -// to a predefined maximum. It is up to the base class to do the -// actual processing or possibly to limit the arity (no. of -// arguments) passed in. Upon invocation of the functor through a -// supplied operator(), the actor funnels the arguments passed in -// by the client into a tuple and calls the base eval member -// function. -// -// Schematically: -// -// arg0 ---------| -// arg1 ---------| -// arg2 ---------|---> tupled_args ---> base.eval -// ... | -// argN ---------| -// -// actor::operator()(arg0, arg1... argN) -// ---> BaseT::eval(tupled_args); -// -// Actor base classes from which this class inherits from are -// expected to have a corresponding member function eval compatible -// with the conceptual Interface: -// -// template <typename TupleT> -// actor_return_type -// eval(TupleT const& args) const; -// -// where args are the actual arguments passed in by the client -// funneled into a tuple (see tuple.hpp for details). -// -// The actor_return_type can be anything. Base classes are free to -// return any type, even argument dependent types (types that are -// deduced from the types of the arguments). After evaluating the -// parameters and doing some computations or actions, the eval -// member function concludes by returning something back to the -// client. To do this, the forwarding function (the actor's -// operator()) needs to know the return type of the eval member -// function that it is calling. For this purpose, actor base -// classes are required to provide a nested template class: -// -// template <typename TupleT> -// struct result; -// -// This auxiliary class provides the result type information -// returned by the eval member function of a base actor class. The -// nested template class result should have a typedef 'type' that -// reflects the return type of its member function eval. It is -// basically a type computer that answers the question "given -// arguments packed into a TupleT type, what will be the result -// type of the eval member function of ActorT?". The template class -// actor_result queries this to extract the return type of an -// actor. Example: -// -// typedef typename actor_result<ActorT, TupleT>::type -// actor_return_type; -// -// where actor_return_type is the actual type returned by ActorT's -// eval member function given some arguments in a TupleT. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ActorT, typename TupleT> -struct actor_result { - - typedef typename ActorT::template result<TupleT>::type type; - typedef typename remove_reference<type>::type plain_type; -}; - -////////////////////////////////// -template <typename BaseT> -struct actor : public BaseT { - - actor(); - actor(BaseT const& base); - - typename actor_result<BaseT, tuple<> >::type - operator()() const; - - template <typename A> - typename actor_result<BaseT, tuple<A&> >::type - operator()(A& a) const; - - template <typename A, typename B> - typename actor_result<BaseT, tuple<A&, B&> >::type - operator()(A& a, B& b) const; - - template <typename A, typename B, typename C> - typename actor_result<BaseT, tuple<A&, B&, C&> >::type - operator()(A& a, B& b, C& c) const; - -#if PHOENIX_LIMIT > 3 - template <typename A, typename B, typename C, typename D> - typename actor_result<BaseT, tuple<A&, B&, C&, D&> >::type - operator()(A& a, B& b, C& c, D& d) const; - - template <typename A, typename B, typename C, typename D, typename E> - typename actor_result<BaseT, tuple<A&, B&, C&, D&, E&> >::type - operator()(A& a, B& b, C& c, D& d, E& e) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F> - typename actor_result<BaseT, tuple<A&, B&, C&, D&, E&, F&> >::type - operator()(A& a, B& b, C& c, D& d, E& e, F& f) const; - -#if PHOENIX_LIMIT > 6 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> - typename actor_result<BaseT, tuple<A&, B&, C&, D&, E&, F&, G&> >::type - operator()(A& a, B& b, C& c, D& d, E& e, F& f, G& g) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&> - >::type - operator()(A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&> - >::type - operator()(A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i) const; - -#if PHOENIX_LIMIT > 9 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&> - >::type - operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&> - >::type - operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&> - >::type - operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l) const; - -#if PHOENIX_LIMIT > 12 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&> - >::type - operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l, M& m) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&, N&> - >::type - operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l, M& m, N& n) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> - typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&, N&, O&> - >::type - operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l, M& m, N& n, O& o) const; - -#endif -#endif -#endif -#endif - - template <typename TupleT> - typename actor_result<BaseT, unpack_tuple<TupleT> >::type - operator()(unpack_tuple<TupleT> const &t) const; - - template <typename B> - typename impl::make_binary1<assign_op, BaseT, B>::type - operator=(B const& b) const; - - template <typename B> - typename impl::make_binary1<index_op, BaseT, B>::type - operator[](B const& b) const; -}; - -/////////////////////////////////////////////////////////////////////////// -// -// as_actor -// -// as_actor is a meta-program that converts an arbitrary type into -// an actor. All participants in the framework must be first-class -// actors. This meta-program is used all throughout the framework -// whenever an unknown type needs to be converted to an actor. -// as_actor specializations are expected to have a typedef 'type'. -// This is the destination actor type. A static member function -// 'convert' converts an object to this target type. -// -// The meta-program does no conversion if the object to be -// converted is already an actor. -// -/////////////////////////////////////////////////////////////////////////// -template <typename T> -struct as_actor; - -////////////////////////////////// -template <typename BaseT> -struct as_actor<actor<BaseT> > { - - typedef actor<BaseT> type; - static type convert(actor<BaseT> const& x) { return x; } -}; - -////////////////////////////////// -template <> -struct as_actor<nil_t> { - - typedef nil_t type; - static nil_t convert(nil_t /*x*/) - { return nil_t(); } -}; - -////////////////////////////////// -template <> -struct as_actor<void> { - - typedef void type; - // ERROR!!! -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// actor class implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename BaseT> -actor<BaseT>::actor() -: BaseT() {} - -////////////////////////////////// -template <typename BaseT> -actor<BaseT>::actor(BaseT const& base) -: BaseT(base) {} - -////////////////////////////////// -template <typename BaseT> -inline typename actor_result<BaseT, tuple<> >::type -actor<BaseT>::operator()() const -{ - return BaseT::eval(tuple<>()); -} - -////////////////////////////////// -template <typename BaseT> -template <typename A> -inline typename actor_result<BaseT, tuple<A&> >::type -actor<BaseT>::operator()(A& a) const -{ - return BaseT::eval(tuple<A&>(a)); -} - -////////////////////////////////// -template <typename BaseT> -template <typename A, typename B> -inline typename actor_result<BaseT, tuple<A&, B&> >::type -actor<BaseT>::operator()(A& a, B& b) const -{ - return BaseT::eval(tuple<A&, B&>(a, b)); -} - -////////////////////////////////// -template <typename BaseT> -template <typename A, typename B, typename C> -inline typename actor_result<BaseT, tuple<A&, B&, C&> >::type -actor<BaseT>::operator()(A& a, B& b, C& c) const -{ - return BaseT::eval(tuple<A&, B&, C&>(a, b, c)); -} - -#if PHOENIX_LIMIT > 3 -////////////////////////////////// -template <typename BaseT> -template <typename A, typename B, typename C, typename D> -inline typename actor_result<BaseT, tuple<A&, B&, C&, D&> >::type -actor<BaseT>::operator()(A& a, B& b, C& c, D& d) const -{ - return BaseT::eval(tuple<A&, B&, C&, D&>(a, b, c, d)); -} - -////////////////////////////////// -template <typename BaseT> -template <typename A, typename B, typename C, typename D, typename E> -inline typename actor_result<BaseT, tuple<A&, B&, C&, D&, E&> >::type -actor<BaseT>::operator()(A& a, B& b, C& c, D& d, E& e) const -{ - return BaseT::eval(tuple<A&, B&, C&, D&, E&>(a, b, c, d, e)); -} - -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&> - (a, b, c, d, e, f) - ); -} - -#if PHOENIX_LIMIT > 6 -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&> - (a, b, c, d, e, f, g) - ); -} - -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&> - (a, b, c, d, e, f, g, h) - ); -} - -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&> - (a, b, c, d, e, f, g, h, i) - ); -} - -#if PHOENIX_LIMIT > 9 -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&> - (a, b, c, d, e, f, g, h, i, j) - ); -} - -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&> - (a, b, c, d, e, f, g, h, i, j, k) - ); -} - -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&> - (a, b, c, d, e, f, g, h, i, j, k, l) - ); -} - -#if PHOENIX_LIMIT > 12 -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l, M& m -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&> - (a, b, c, d, e, f, g, h, i, j, k, l, m) - ); -} - -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&, N&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l, M& m, N& n -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&, N&> - (a, b, c, d, e, f, g, h, i, j, k, l, m, n) - ); -} - -////////////////////////////////// -template <typename BaseT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> -inline typename actor_result<BaseT, - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&, N&, O&> ->::type -actor<BaseT>::operator()( - A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h, I& i, J& j, - K& k, L& l, M& m, N& n, O& o -) const -{ - return BaseT::eval( - tuple<A&, B&, C&, D&, E&, F&, G&, H&, I&, J&, K&, L&, M&, N&, O&> - (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) - ); -} - -#endif -#endif -#endif -#endif - -////////////////////////////////// -template <typename BaseT> -template <typename TupleT> -typename actor_result<BaseT, unpack_tuple<TupleT> >::type -actor<BaseT>::operator()(unpack_tuple<TupleT> const &t) const -{ - return BaseT::eval(t); -} - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/binders.hpp b/Utilities/BGL/boost/spirit/phoenix/binders.hpp deleted file mode 100644 index 4b2ca57e8f16b532262db3c3a5a980610b6a05c4..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/binders.hpp +++ /dev/null @@ -1,4067 +0,0 @@ -/*============================================================================= - Phoenix v1.2 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_BINDERS_HPP -#define PHOENIX_BINDERS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/functions.hpp> -#include <boost/type_traits/is_const.hpp> -#include <boost/mpl/if.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// Binders -// -// There are times when it is desireable to bind a simple functor, -// function, member function or member variable for deferred -// evaluation. This can be done through the binding facilities -// provided below. There are template classes: -// -// 1) function_ptr ( function pointer binder ) -// 2) functor ( functor pointer binder ) -// 3) member_function_ptr ( member function pointer binder ) -// 4) member_var_ptr ( member variable pointer binder ) -// -// These template classes are specialized lazy function classes for -// functors, function pointers, member function pointers and member -// variable pointers, respectively. These are subclasses of the -// lazy-function class (see functions.hpp). Each of these has a -// corresponding overloaded bind(x) function. Each bind(x) function -// generates a suitable binder object. -// -// Example, given a function foo: -// -// void foo_(int n) { std::cout << n << std::endl; } -// -// Here's how the function foo is bound: -// -// bind(&foo_) -// -// This bind expression results to a lazy-function (see -// functions.hpp) that is lazily evaluated. This bind expression is -// also equivalent to: -// -// function_ptr<void, int> foo = &foo_; -// -// The template parameter of the function_ptr is the return and -// argument types of actual signature of the function to be bound -// read from left to right: -// -// void foo_(int); ---> function_ptr<void, int> -// -// Either bind(&foo_) and its equivalent foo can now be used in the -// same way a lazy function (see functions.hpp) is used: -// -// bind(&foo_)(arg1) -// -// or -// -// foo(arg1) -// -// The latter, of course, being much easier to understand. This is -// now a full-fledged lazy function that can finally be evaluated -// by another function call invocation. A second function call will -// invoke the actual foo function: -// -// int i = 4; -// foo(arg1)(i); -// -// will print out "4". -// -// Binding functors and member functions can be done similarly. -// Here's how to bind a functor (e.g. std::plus<int>): -// -// bind(std::plus<int>()) -// -// or -// -// functor<std::plus<int> > plus; -// -// Again, these are full-fledged lazy functions. In this case, -// unlike the first example, expect 2 arguments (std::plus<int> -// needs two arguments lhs and rhs). Either or both of which can be -// lazily bound: -// -// plus(arg1, arg2) // arg1 + arg2 -// plus(100, arg1) // 100 + arg1 -// plus(100, 200) // 300 -// -// A bound member function takes in a pointer or reference to an -// object as the first argument. For instance, given: -// -// struct xyz { void foo(int) const; }; -// -// xyz's foo member function can be bound as: -// -// bind(&xyz::foo) -// -// or -// -// member_function_ptr<void, xyz, int> xyz_foo = &xyz::foo; -// -// The template parameter of the member_function_ptr is the return, -// class and argument types of actual signature of the function to -// be bound read from left to right: -// -// void xyz::foo_(int); ---> member_function_ptr<void, xyz, int> -// -// Take note that a member_function_ptr lazy-function expects the -// first argument to be a pointer or reference to an object. Both -// the object (reference or pointer) and the arguments can be -// lazily bound. Examples: -// -// xyz obj; -// xyz_foo(arg1, arg2) // arg1.foo(arg2) -// xyz_foo(obj, arg1) // obj.foo(arg1) -// xyz_foo(obj, 100) // obj.foo(100) -// -// Be reminded that var(obj) must be used to call non-const member -// functions. For example, if xyz was declared as: -// -// struct xyz { void foo(int); }; -// -// the pointer or reference to the object must also be non-const. -// Lazily bound arguments are stored as const value by default (see -// variable class in primitives.hpp). -// -// xyz_foo(var(obj), 100) // obj.foo(100) -// -// Finally, member variables can be bound much like member -// functions. For instance, given: -// -// struct xyz { int v; }; -// -// xyz::v can be bound as: -// -// bind(&xyz::v) -// or -// -// member_var_ptr<int, xyz> xyz_v = &xyz::v; -// -// The template parameter of the member_var_ptr is the type of the -// variable followed by the class: -// -// int xyz::v; ---> member_var_ptr<int, xyz> -// -// Just like the member_function_ptr, member_var_ptr also expects -// the first argument to be a pointer or reference to an object. -// Both the object (reference or pointer) and the arguments can be -// lazily bound. Examples: -// -// xyz obj; -// xyz_v(arg1) // arg1.v -// xyz_v(obj) // obj.v -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Functor binder -// -/////////////////////////////////////////////////////////////////////////////// -template <typename FuncT> -struct functor_action : public FuncT { - -#if !defined(__BORLANDC__) && (!defined(__MWERKS__) || (__MWERKS__ > 0x3002)) - - template < - typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif - > - struct result { typedef typename FuncT::result_type type; }; -#endif - - functor_action(FuncT fptr_ = FuncT()) - : FuncT(fptr_) {} -}; - -#if defined(__BORLANDC__) || (defined(__MWERKS__) && (__MWERKS__ <= 0x3002)) - -/////////////////////////////////////////////////////////////////////////////// -// -// The following specializations are needed because Borland and CodeWarrior -// does not accept default template arguments in nested template classes in -// classes (i.e functor_action::result) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename FuncT, typename TupleT> -struct composite0_result<functor_action<FuncT>, TupleT> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A> -struct composite1_result<functor_action<FuncT>, TupleT, A> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B> -struct composite2_result<functor_action<FuncT>, TupleT, A, B> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C> -struct composite3_result<functor_action<FuncT>, TupleT, A, B, C> { - - typedef typename FuncT::result_type type; -}; - -#if PHOENIX_LIMIT > 3 -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D> -struct composite4_result<functor_action<FuncT>, TupleT, - A, B, C, D> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E> -struct composite5_result<functor_action<FuncT>, TupleT, - A, B, C, D, E> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F> -struct composite6_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F> { - - typedef typename FuncT::result_type type; -}; - -#if PHOENIX_LIMIT > 6 -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> -struct composite7_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> -struct composite8_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> -struct composite9_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H, I> { - - typedef typename FuncT::result_type type; -}; - -#if PHOENIX_LIMIT > 9 -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> -struct composite10_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H, I, J> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> -struct composite11_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H, I, J, K> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> -struct composite12_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L> { - - typedef typename FuncT::result_type type; -}; - -#if PHOENIX_LIMIT > 12 -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> -struct composite13_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> -struct composite14_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N> { - - typedef typename FuncT::result_type type; -}; - -////////////////////////////////// -template <typename FuncT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> -struct composite15_result<functor_action<FuncT>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> { - - typedef typename FuncT::result_type type; -}; - -#endif -#endif -#endif -#endif -#endif - -////////////////////////////////// -template <typename FuncT> -struct functor : public function<functor_action<FuncT> > { - - functor(FuncT func) - : function<functor_action<FuncT> >(functor_action<FuncT>(func)) {}; -}; - -////////////////////////////////// -template <typename FuncT> -inline functor<FuncT> -bind(FuncT func) -{ - return functor<FuncT>(func); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member variable pointer binder -// -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - - ////////////////////////////////// - template <typename T> - struct as_ptr { - - typedef T* pointer_type; - - static T* get(T& ref) - { return &ref; } - }; - - ////////////////////////////////// - template <typename T> - struct as_ptr<T*> { - - typedef T* pointer_type; - - static T* get(T* ptr) - { return ptr; } - }; -} - -////////////////////////////////// -template <typename ActionT, typename ClassT> -struct member_var_ptr_action_result { - - typedef typename ActionT::template result<ClassT>::type type; -}; - -////////////////////////////////// -template <typename T, typename ClassT> -struct member_var_ptr_action { - - typedef member_var_ptr_action<T, ClassT> self_t; - - template <typename CT> - struct result { - typedef typename boost::mpl::if_<boost::is_const<CT>, T const&, T& - >::type type; - }; - - typedef T ClassT::*mem_var_ptr_t; - - member_var_ptr_action(mem_var_ptr_t ptr_) - : ptr(ptr_) {} - - template <typename CT> - typename member_var_ptr_action_result<self_t, CT>::type - operator()(CT& obj) const - { return impl::as_ptr<CT>::get(obj)->*ptr; } - - mem_var_ptr_t ptr; -}; - -////////////////////////////////// -template <typename T, typename ClassT> -struct member_var_ptr -: public function<member_var_ptr_action<T, ClassT> > { - - member_var_ptr(T ClassT::*mp) - : function<member_var_ptr_action<T, ClassT> > - (member_var_ptr_action<T, ClassT>(mp)) {} -}; - -////////////////////////////////// -template <typename T, typename ClassT> -inline member_var_ptr<T, ClassT> -bind(T ClassT::*mp) -{ - return member_var_ptr<T, ClassT>(mp); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (main class) -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename RT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif - - , typename NU = nil_t // Not used -> -struct function_ptr_action; - -////////////////////////////////// -template < - typename RT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif -> -struct function_ptr -: public function<function_ptr_action<RT - , A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > > { - - typedef function_ptr_action<RT - , A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > action_t; - - template <typename FPT> - function_ptr(FPT fp) - : function<action_t>(action_t(fp)) {} -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 0 arg) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT> -struct function_ptr_action<RT, - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(); - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()() const - { return fptr(); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT> -inline function_ptr<RT> -bind(RT(*fptr)()) -{ - return function_ptr<RT>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 1 arg) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename A> -struct function_ptr_action<RT, - A, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A); - - template <typename A_> - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()(A a) const - { return fptr(a); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename A> -inline function_ptr<RT, A> -bind(RT(*fptr)(A)) -{ - return function_ptr<RT, A>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 2 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename A, typename B> -struct function_ptr_action<RT, - A, B, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B); - - template <typename A_, typename B_> - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()(A a, B b) const - { return fptr(a, b); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename A, typename B> -inline function_ptr<RT, A, B> -bind(RT(*fptr)(A, B)) -{ - return function_ptr<RT, A, B>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 3 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename A, typename B, typename C> -struct function_ptr_action<RT, - A, B, C, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C); - - template <typename A_, typename B_, typename C_> - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()(A a, B b, C c) const - { return fptr(a, b, c); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename A, typename B, typename C> -inline function_ptr<RT, A, B, C> -bind(RT(*fptr)(A, B, C)) -{ - return function_ptr<RT, A, B, C>(fptr); -} - -#if PHOENIX_LIMIT > 3 -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 4 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename A, typename B, typename C, typename D> -struct function_ptr_action<RT, - A, B, C, D, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D); - - template <typename A_, typename B_, typename C_, typename D_> - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()(A a, B b, C c, D d) const - { return fptr(a, b, c, d); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename A, typename B, typename C, typename D> -inline function_ptr<RT, A, B, C, D> -bind(RT(*fptr)(A, B, C, D)) -{ - return function_ptr<RT, A, B, C, D>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 5 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E -> -struct function_ptr_action<RT, - A, B, C, D, E, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e - ) const - { return fptr(a, b, c, d, e); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E -> -inline function_ptr<RT, A, B, C, D, E> -bind(RT(*fptr)(A, B, C, D, E)) -{ - return function_ptr<RT, A, B, C, D, E>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 6 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F -> -struct function_ptr_action<RT, - A, B, C, D, E, F, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f - ) const - { return fptr(a, b, c, d, e, f); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F -> -inline function_ptr<RT, A, B, C, D, E, F> -bind(RT(*fptr)(A, B, C, D, E, F)) -{ - return function_ptr<RT, A, B, C, D, E, F>(fptr); -} - -#if PHOENIX_LIMIT > 6 -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 7 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g - ) const - { return fptr(a, b, c, d, e, f, g); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G -> -inline function_ptr<RT, A, B, C, D, E, F, G> -bind(RT(*fptr)(A, B, C, D, E, F, G)) -{ - return function_ptr<RT, A, B, C, D, E, F, G>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 8 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h - ) const - { return fptr(a, b, c, d, e, f, g, h); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H -> -inline function_ptr<RT, A, B, C, D, E, F, G, H> -bind(RT(*fptr)(A, B, C, D, E, F, G, H)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 9 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, I, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_, typename I_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h, I i - ) const - { return fptr(a, b, c, d, e, f, g, h, i); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I -> -inline function_ptr<RT, A, B, C, D, E, F, G, H, I> -bind(RT(*fptr)(A, B, C, D, E, F, G, H, I)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H, I>(fptr); -} - -#if PHOENIX_LIMIT > 9 -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 10 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, I, J, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_, typename I_, typename J_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h, I i, J j - ) const - { return fptr(a, b, c, d, e, f, g, h, i, j); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J -> -inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J> -bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H, I, J>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 11 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, I, J, K, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_, typename I_, typename J_, - typename K_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h, I i, J j, - K k - ) const - { return fptr(a, b, c, d, e, f, g, h, i, j, k); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K -> -inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K> -bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 12 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, I, J, K, L, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_, typename I_, typename J_, - typename K_, typename L_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h, I i, J j, - K k, L l - ) const - { return fptr(a, b, c, d, e, f, g, h, i, j, k, l); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L -> -inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L> -bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L>(fptr); -} - -#if PHOENIX_LIMIT > 12 -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 13 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L, M); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_, typename I_, typename J_, - typename K_, typename L_, typename M_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h, I i, J j, - K k, L l, M m - ) const - { return fptr(a, b, c, d, e, f, g, h, i, j, k, l, m); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M -> -inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M> -bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 14 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L, M, N); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_, typename I_, typename J_, - typename K_, typename L_, typename M_, typename N_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h, I i, J j, - K k, L l, M m, N n - ) const - { return fptr(a, b, c, d, e, f, g, h, i, j, k, l, m, n); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N -> -inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N> -bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Function pointer binder (specialization for 15 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O -> -struct function_ptr_action<RT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t> { - - typedef RT result_type; - typedef RT(*func_ptr_t)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O); - - template < - typename A_, typename B_, typename C_, typename D_, typename E_, - typename F_, typename G_, typename H_, typename I_, typename J_, - typename K_, typename L_, typename M_, typename N_, typename O_ - > - struct result { typedef result_type type; }; - - function_ptr_action(func_ptr_t fptr_) - : fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, - F f, G g, H h, I i, J j, - K k, L l, M m, N n, O o - ) const - { return fptr(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); } - - func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O -> -inline function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> -bind(RT(*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)) -{ - return function_ptr<RT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(fptr); -} - -#endif -#endif -#endif -#endif -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (main class) -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename RT, - typename ClassT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif - - , typename NU = nil_t // Not used -> -struct member_function_ptr_action; - -////////////////////////////////// -template < - typename RT, - typename ClassT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif -> -struct member_function_ptr -: public function<member_function_ptr_action<RT, ClassT - , A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > > { - - typedef member_function_ptr_action<RT, ClassT - , A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > action_t; - - template <typename FPT> - member_function_ptr(FPT fp) - : function<action_t>(action_t(fp)) {} -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 0 arg) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT> -struct member_function_ptr_action<RT, ClassT, - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(); - typedef RT(ClassT::*cmf)() const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT> - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT> -inline member_function_ptr<RT, ClassT> -bind(RT(ClassT::*fptr)()) -{ - return member_function_ptr<RT, ClassT>(fptr); -} - -template <typename RT, typename ClassT> -inline member_function_ptr<RT, ClassT const> -bind(RT(ClassT::*fptr)() const) -{ - return member_function_ptr<RT, ClassT const>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 1 arg) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, typename A> -struct member_function_ptr_action<RT, ClassT, - A, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A); - typedef RT(ClassT::*cmf)(A) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, typename A_> - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, A a) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, typename A> -inline member_function_ptr<RT, ClassT, A> -bind(RT(ClassT::*fptr)(A)) -{ - return member_function_ptr<RT, ClassT, A>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, typename A> -inline member_function_ptr<RT, ClassT const, A> -bind(RT(ClassT::*fptr)(A) const) -{ - return member_function_ptr<RT, ClassT const, A>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 2 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B> -struct member_function_ptr_action<RT, ClassT, - A, B, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B); - typedef RT(ClassT::*cmf)(A, B) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, typename A_, typename B_> - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, A a, B b) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B> -inline member_function_ptr<RT, ClassT, A, B> -bind(RT(ClassT::*fptr)(A, B)) -{ - return member_function_ptr<RT, ClassT, A, B>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B> -inline member_function_ptr<RT, ClassT const, A, B> -bind(RT(ClassT::*fptr)(A, B) const) -{ - return member_function_ptr<RT, ClassT const, A, B>(fptr); -} - -#if PHOENIX_LIMIT > 3 -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 3 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B, typename C> -struct member_function_ptr_action<RT, ClassT, - A, B, C, nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C); - typedef RT(ClassT::*cmf)(A, B, C) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, typename A_, typename B_, typename C_> - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, A a, B b, C c) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B, typename C> -inline member_function_ptr<RT, ClassT, A, B, C> -bind(RT(ClassT::*fptr)(A, B, C)) -{ - return member_function_ptr<RT, ClassT, A, B, C>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B, typename C> -inline member_function_ptr<RT, ClassT const, A, B, C> -bind(RT(ClassT::*fptr)(A, B, C) const) -{ - return member_function_ptr<RT, ClassT const, A, B, C>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 4 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D); - typedef RT(ClassT::*cmf)(A, B, C, D) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d - ) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -inline member_function_ptr<RT, ClassT, A, B, C, D> -bind(RT(ClassT::*fptr)(A, B, C, D)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -inline member_function_ptr<RT, ClassT const, A, B, C, D> -bind(RT(ClassT::*fptr)(A, B, C, D) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 5 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E); - typedef RT(ClassT::*cmf)(A, B, C, D, E) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e - ) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E> -bind(RT(ClassT::*fptr)(A, B, C, D, E)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E> -bind(RT(ClassT::*fptr)(A, B, C, D, E) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E>(fptr); -} - -#if PHOENIX_LIMIT > 6 -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 6 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f - ) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 7 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g - ) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f, g); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 8 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h - ) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f, g, h); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H>(fptr); -} - -#if PHOENIX_LIMIT > 9 -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 9 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h, I i - ) const - { return (impl::as_ptr<CT>::get(obj)->*fptr)(a, b, c, d, e, f, g, h, i); } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H, I>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H, I>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 10 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j - ) const - { - return (impl::as_ptr<CT>::get(obj)->*fptr) - (a, b, c, d, e, f, g, h, i, j); - } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H, I, J>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 11 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k - ) const - { - return (impl::as_ptr<CT>::get(obj)->*fptr) - (a, b, c, d, e, f, g, h, i, j, k); - } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>(fptr); -} - -#if PHOENIX_LIMIT > 12 -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 12 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, nil_t, nil_t, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l - ) const - { - return (impl::as_ptr<CT>::get(obj)->*fptr) - (a, b, c, d, e, f, g, h, i, j, k, l); - } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 13 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_, typename M_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m - ) const - { - return (impl::as_ptr<CT>::get(obj)->*fptr) - (a, b, c, d, e, f, g, h, i, j, k, l, m); - } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 14 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_, typename M_, typename N_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n - ) const - { - return (impl::as_ptr<CT>::get(obj)->*fptr) - (a, b, c, d, e, f, g, h, i, j, k, l, m, n); - } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Member function pointer binder (specialization for 15 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -struct member_function_ptr_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT, - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_, typename M_, typename N_, - typename O_ - > - struct result { typedef result_type type; }; - - member_function_ptr_action(mem_func_ptr_t fptr_) - : fptr(fptr_) {} - - template <typename CT> - result_type operator()(CT& obj, - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o - ) const - { - return (impl::as_ptr<CT>::get(obj)->*fptr) - (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); - } - - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -inline member_function_ptr<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)) -{ - return member_function_ptr< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -inline member_function_ptr<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> -bind(RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const) -{ - return member_function_ptr< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(fptr); -} - -#endif -#endif -#endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (main class) -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename RT, - typename ClassT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif - - , typename NU = nil_t // Not used -> -struct bound_member_action; - -////////////////////////////////// -template < - typename RT, - typename ClassT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif -> -struct bound_member -: public function<bound_member_action<RT, ClassT - , A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > > { - - typedef bound_member_action<RT, ClassT - , A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > action_t; - - template <typename CT, typename FPT> - bound_member(CT & c, FPT fp) - : function<action_t>(action_t(c,fp)) {} - -#if !defined(__BORLANDC__) - template <typename CT, typename FPT> - bound_member(CT * c, FPT fp) - : function<action_t>(action_t(c,fp)) {} -#endif -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 0 arg) -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename RT, typename ClassT> -struct bound_member_action<RT, ClassT, - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(); - typedef RT(ClassT::*cmf)() const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename CT> - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()() const - { return (obj->*fptr)(); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// - -template <typename RT, typename ClassT> -inline bound_member<RT,ClassT> -bind(ClassT & obj, RT(ClassT::*fptr)()) -{ - return bound_member<RT,ClassT>(obj, fptr); -} - -template <typename RT, typename ClassT> -inline bound_member<RT,ClassT> -bind(ClassT * obj, RT(ClassT::*fptr)()) -{ -#if defined(__MWERKS__) && (__MWERKS__ < 0x3003) - return bound_member<RT,ClassT>(*obj, fptr); -#else - return bound_member<RT,ClassT>(obj, fptr); -#endif -} - -template <typename RT, typename ClassT> -inline bound_member<RT,ClassT const> -bind(ClassT const& obj, RT(ClassT::*fptr)()) -{ - return bound_member<RT,ClassT const>(obj, fptr); -} - -template <typename RT, typename ClassT> -inline bound_member<RT,ClassT const> -bind(ClassT const* obj, RT(ClassT::*fptr)() const) -{ -#if defined(__MWERKS__) && (__MWERKS__ < 0x3003) - return bound_member<RT,ClassT const>(*obj, fptr); -#else - return bound_member<RT,ClassT const>(obj, fptr); -#endif -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 1 arg) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, typename A> -struct bound_member_action<RT, ClassT, - A, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A); - typedef RT(ClassT::*cmf)(A) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename A_> - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()(A a) const - { return (obj->*fptr)(a); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, typename A> -inline bound_member<RT, ClassT, A> -bind(ClassT & obj, RT(ClassT::*fptr)(A)) -{ - return bound_member<RT, ClassT, A>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A> -inline bound_member<RT, ClassT, A> -bind(ClassT * obj, RT(ClassT::*fptr)(A)) -{ - return bound_member<RT, ClassT, A>(obj,fptr); -} - -////////////////////////////////// -template <typename RT, typename ClassT, typename A> -inline bound_member<RT, ClassT const, A> -bind(ClassT const& obj, RT(ClassT::*fptr)(A) const) -{ - return bound_member<RT, ClassT const, A>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A> -inline bound_member<RT, ClassT const, A> -bind(ClassT const* obj, RT(ClassT::*fptr)(A) const) -{ - return bound_member<RT, ClassT const, A>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 2 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B> -struct bound_member_action<RT, ClassT, - A, B, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B); - typedef RT(ClassT::*cmf)(A, B) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename A_, typename B_> - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()(A a, B b) const - { return (obj->*fptr)(a, b); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B> -inline bound_member<RT, ClassT, A, B> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B)) -{ - return bound_member<RT, ClassT, A, B>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A, typename B> -inline bound_member<RT, ClassT, A, B> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B)) -{ - return bound_member<RT, ClassT, A, B>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A, typename B> -inline bound_member<RT, ClassT const, A, B> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B) const) -{ - return bound_member<RT, ClassT const, A, B>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A, typename B> -inline bound_member<RT, ClassT const, A, B> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B) const) -{ - return bound_member<RT, ClassT const, A, B>(obj,fptr); -} - -#if PHOENIX_LIMIT > 3 -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 3 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B, typename C> -struct bound_member_action<RT, ClassT, - A, B, C, nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C); - typedef RT(ClassT::*cmf)(A, B, C) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename A_, typename B_, typename C_> - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()(A a, B b, C c) const - { return (obj->*fptr)(a, b, c); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, typename A, typename B, typename C> -inline bound_member<RT, ClassT, A, B, C> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C)) -{ - return bound_member<RT, ClassT, A, B, C>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A, typename B, typename C> -inline bound_member<RT, ClassT, A, B, C> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C)) -{ - return bound_member<RT, ClassT, A, B, C>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A, typename B, typename C> -inline bound_member<RT, ClassT const, A, B, C> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C) const) -{ - return bound_member<RT, ClassT const, A, B, C>(obj,fptr); -} - -template <typename RT, typename ClassT, typename A, typename B, typename C> -inline bound_member<RT, ClassT const, A, B, C> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C) const) -{ - return bound_member<RT, ClassT const, A, B, C>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 4 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -struct bound_member_action<RT, ClassT, - A, B, C, D, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D); - typedef RT(ClassT::*cmf)(A, B, C, D) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename A_, typename B_, typename C_, typename D_> - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()(A a, B b, C c, D d) const - { return (obj->*fptr)(a, b, c, d); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -inline bound_member<RT, ClassT, A, B, C, D> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D)) -{ - return bound_member< - RT, ClassT, A, B, C, D>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -inline bound_member<RT, ClassT, A, B, C, D> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D)) -{ - return bound_member< - RT, ClassT, A, B, C, D>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -inline bound_member<RT, ClassT const, A, B, C, D> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D -> -inline bound_member<RT, ClassT const, A, B, C, D> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 5 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E); - typedef RT(ClassT::*cmf)(A, B, C, D, E) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template <typename A_, typename B_, typename C_, typename D_, - typename E_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e - ) const - { return (obj->*fptr)(a, b, c, d, e); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -inline bound_member<RT, ClassT, A, B, C, D, E> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -inline bound_member<RT, ClassT, A, B, C, D, E> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -inline bound_member<RT, ClassT const, A, B, C, D, E> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E -> -inline bound_member<RT, ClassT const, A, B, C, D, E> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E>(obj,fptr); -} - -#if PHOENIX_LIMIT > 6 -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 6 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f - ) const - { return (obj->*fptr)(a, b, c, d, e, f); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -inline bound_member<RT, ClassT, A, B, C, D, E, F> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -inline bound_member<RT, ClassT, A, B, C, D, E, F> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 7 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g - ) const - { return (obj->*fptr)(a, b, c, d, e, f, g); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 8 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h - ) const - { return (obj->*fptr)(a, b, c, d, e, f, g, h); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H>(obj,fptr); -} - -#if PHOENIX_LIMIT > 9 -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 9 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h, I i - ) const - { return (obj->*fptr)(a, b, c, d, e, f, g, h, i); } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 10 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j - ) const - { - return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j); - } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 11 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k - ) const - { - return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k); - } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K>(obj,fptr); -} - -#if PHOENIX_LIMIT > 12 -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 12 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, nil_t, nil_t, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l - ) const - { - return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l); - } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 13 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_, typename M_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m - ) const - { - return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l, m); - } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 14 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_, typename M_, typename N_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n - ) const - { - return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l, m, n); - } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N>(obj,fptr); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Bound member function binder (specialization for 15 args) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -struct bound_member_action<RT, ClassT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t> { - - typedef RT result_type; - typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O); - typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const; - typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type - mem_func_ptr_t; - - template < - typename A_, typename B_, typename C_, typename D_, - typename E_, typename F_, typename G_, typename H_, typename I_, - typename J_, typename K_, typename L_, typename M_, typename N_, - typename O_ - > - struct result { typedef result_type type; }; - - template <typename CT> - bound_member_action(CT & obj_, mem_func_ptr_t fptr_) - : obj(impl::as_ptr<CT>::get(obj_)), fptr(fptr_) {} - - result_type operator()( - A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o - ) const - { - return (obj->*fptr)(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); - } - - typename impl::as_ptr<ClassT>::pointer_type obj; - mem_func_ptr_t fptr; -}; - -////////////////////////////////// -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> -bind(ClassT & obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -inline bound_member<RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> -bind(ClassT * obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)) -{ - return bound_member< - RT, ClassT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> -bind(ClassT const& obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr); -} - -template <typename RT, typename ClassT, - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, typename I, - typename J, typename K, typename L, typename M, typename N, - typename O -> -inline bound_member<RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> -bind(ClassT const* obj,RT(ClassT::*fptr)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const) -{ - return bound_member< - RT, ClassT const, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(obj,fptr); -} - -#endif -#endif -#endif -#endif - -} // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/casts.hpp b/Utilities/BGL/boost/spirit/phoenix/casts.hpp deleted file mode 100644 index 3782e9f8b4e53eea75ba09dbee336376bf579764..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/casts.hpp +++ /dev/null @@ -1,1471 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001-2003 Hartmut Kaiser - - 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) -==============================================================================*/ - -#ifndef PHOENIX_CASTS_HPP -#define PHOENIX_CASTS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/actor.hpp> -#include <boost/spirit/phoenix/composite.hpp> -#include <boost/static_assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// Phoenix predefined maximum construct_ limit. This limit defines the maximum -// number of parameters supported for calles to the set of construct_ template -// functions (lazy object construction, see below). This number defaults to 3. -// The actual maximum is rounded up in multiples of 3. Thus, if this value -// is 4, the actual limit is 6. The ultimate maximum limit in this -// implementation is 15. -// PHOENIX_CONSTRUCT_LIMIT should NOT be greater than PHOENIX_LIMIT! - -#if !defined(PHOENIX_CONSTRUCT_LIMIT) -#define PHOENIX_CONSTRUCT_LIMIT PHOENIX_LIMIT -#endif - -// ensure PHOENIX_CONSTRUCT_LIMIT <= PHOENIX_LIMIT -BOOST_STATIC_ASSERT(PHOENIX_CONSTRUCT_LIMIT <= PHOENIX_LIMIT); - -// ensure PHOENIX_CONSTRUCT_LIMIT <= 15 -BOOST_STATIC_ASSERT(PHOENIX_CONSTRUCT_LIMIT <= 15); - -/////////////////////////////////////////////////////////////////////////////// -// -// Lazy C++ casts -// -// The set of lazy C++ cast template classes and functions provide a way -// of lazily casting certain type to another during parsing. -// The lazy C++ templates are (syntactically) used very much like -// the well known C++ casts: -// -// A *a = static_cast_<A *>(...actor returning a convertible type...); -// -// where the given parameter should be an actor, which eval() function -// returns a convertible type. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T, typename A> -struct static_cast_l { - - template <typename TupleT> - struct result { typedef T type; }; - - static_cast_l(A const& a_) - : a(a_) {} - - template <typename TupleT> - T - eval(TupleT const& args) const - { - return static_cast<T>(a.eval(args)); - } - - A a; -}; - -////////////////////////////////// -template <typename T, typename BaseAT> -inline actor<static_cast_l<T, BaseAT> > -static_cast_(actor<BaseAT> const& a) -{ - typedef static_cast_l<T, BaseAT> cast_t; - return actor<cast_t>(cast_t(a)); -} - -////////////////////////////////// -template <typename T, typename A> -struct dynamic_cast_l { - - template <typename TupleT> - struct result { typedef T type; }; - - dynamic_cast_l(A const& a_) - : a(a_) {} - - template <typename TupleT> - T - eval(TupleT const& args) const - { - return dynamic_cast<T>(a.eval(args)); - } - - A a; -}; - -////////////////////////////////// -template <typename T, typename BaseAT> -inline actor<dynamic_cast_l<T, BaseAT> > -dynamic_cast_(actor<BaseAT> const& a) -{ - typedef dynamic_cast_l<T, BaseAT> cast_t; - return actor<cast_t>(cast_t(a)); -} - -////////////////////////////////// -template <typename T, typename A> -struct reinterpret_cast_l { - - template <typename TupleT> - struct result { typedef T type; }; - - reinterpret_cast_l(A const& a_) - : a(a_) {} - - template <typename TupleT> - T - eval(TupleT const& args) const - { - return reinterpret_cast<T>(a.eval(args)); - } - - A a; -}; - -////////////////////////////////// -template <typename T, typename BaseAT> -inline actor<reinterpret_cast_l<T, BaseAT> > -reinterpret_cast_(actor<BaseAT> const& a) -{ - typedef reinterpret_cast_l<T, BaseAT> cast_t; - return actor<cast_t>(cast_t(a)); -} - -////////////////////////////////// -template <typename T, typename A> -struct const_cast_l { - - template <typename TupleT> - struct result { typedef T type; }; - - const_cast_l(A const& a_) - : a(a_) {} - - template <typename TupleT> - T - eval(TupleT const& args) const - { - return const_cast<T>(a.eval(args)); - } - - A a; -}; - -////////////////////////////////// -template <typename T, typename BaseAT> -inline actor<const_cast_l<T, BaseAT> > -const_cast_(actor<BaseAT> const& a) -{ - typedef const_cast_l<T, BaseAT> cast_t; - return actor<cast_t>(cast_t(a)); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// construct_ -// -// Lazy object construction -// -// The set of construct_<> template classes and functions provide a way -// of lazily constructing certain object from a arbitrary set of -// actors during parsing. -// The construct_ templates are (syntactically) used very much like -// the well known C++ casts: -// -// A a = construct_<A>(...arbitrary list of actors...); -// -// where the given parameters are submitted as parameters to the -// contructor of the object of type A. (This certainly implies, that -// type A has a constructor with a fitting set of parameter types -// defined.) -// -// The maximum number of needed parameters is controlled through the -// preprocessor constant PHOENIX_CONSTRUCT_LIMIT. Note though, that this -// limit should not be greater than PHOENIX_LIMIT. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -struct construct_l_0 { - typedef T result_type; - - T operator()() const { - return T(); - } -}; - - -template <typename T> -struct construct_l { - - template < - typename A - , typename B - , typename C - -#if PHOENIX_CONSTRUCT_LIMIT > 3 - , typename D - , typename E - , typename F - -#if PHOENIX_CONSTRUCT_LIMIT > 6 - , typename G - , typename H - , typename I - -#if PHOENIX_CONSTRUCT_LIMIT > 9 - , typename J - , typename K - , typename L - -#if PHOENIX_CONSTRUCT_LIMIT > 12 - , typename M - , typename N - , typename O -#endif -#endif -#endif -#endif - > - struct result { typedef T type; }; - - T operator()() const - { - return T(); - } - - template <typename A> - T operator()(A const& a) const - { - T t(a); - return t; - } - - template <typename A, typename B> - T operator()(A const& a, B const& b) const - { - T t(a, b); - return t; - } - - template <typename A, typename B, typename C> - T operator()(A const& a, B const& b, C const& c) const - { - T t(a, b, c); - return t; - } - -#if PHOENIX_CONSTRUCT_LIMIT > 3 - template < - typename A, typename B, typename C, typename D - > - T operator()( - A const& a, B const& b, C const& c, D const& d) const - { - T t(a, b, c, d); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e) const - { - T t(a, b, c, d, e); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f) const - { - T t(a, b, c, d, e, f); - return t; - } - -#if PHOENIX_CONSTRUCT_LIMIT > 6 - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g) const - { - T t(a, b, c, d, e, f, g); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h) const - { - T t(a, b, c, d, e, f, g, h); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i) const - { - T t(a, b, c, d, e, f, g, h, i); - return t; - } - -#if PHOENIX_CONSTRUCT_LIMIT > 9 - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j) const - { - T t(a, b, c, d, e, f, g, h, i, j); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k) const - { - T t(a, b, c, d, e, f, g, h, i, j, k); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l) const - { - T t(a, b, c, d, e, f, g, h, i, j, k, l); - return t; - } - -#if PHOENIX_CONSTRUCT_LIMIT > 12 - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m) const - { - T t(a, b, c, d, e, f, g, h, i, j, k, l, m); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n) const - { - T t(a, b, c, d, e, f, g, h, i, j, k, l, m, n); - return t; - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o) const - { - T t(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); - return t; - } - -#endif -#endif -#endif -#endif -}; - - -template <typename T> -struct construct_1 { - - template < - typename A - > - struct result { typedef T type; }; - - template <typename A> - T operator()(A const& a) const - { - T t(a); - return t; - } - -}; - -template <typename T> -struct construct_2 { - - template < - typename A - , typename B - > - struct result { typedef T type; }; - - template <typename A, typename B> - T operator()(A const& a, B const& b) const - { - T t(a, b); - return t; - } - -}; - -template <typename T> -struct construct_3 { - - template < - typename A - , typename B - , typename C - > - struct result { typedef T type; }; - - template <typename A, typename B, typename C> - T operator()(A const& a, B const& b, C const& c) const - { - T t(a, b, c); - return t; - } -}; - -#if PHOENIX_CONSTRUCT_LIMIT > 3 -template <typename T> -struct construct_4 { - - template < - typename A - , typename B - , typename C - , typename D - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D - > - T operator()( - A const& a, B const& b, C const& c, D const& d) const - { - T t(a, b, c, d); - return t; - } -}; - - -template <typename T> -struct construct_5 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e) const - { - T t(a, b, c, d, e); - return t; - } -}; - - -template <typename T> -struct construct_6 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f) const - { - T t(a, b, c, d, e, f); - return t; - } -}; -#endif - - -#if PHOENIX_CONSTRUCT_LIMIT > 6 -template <typename T> -struct construct_7 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g) const - { - T t(a, b, c, d, e, f, g); - return t; - } -}; - -template <typename T> -struct construct_8 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h) const - { - T t(a, b, c, d, e, f, g, h); - return t; - } -}; - -template <typename T> -struct construct_9 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i) const - { - T t(a, b, c, d, e, f, g, h, i); - return t; - } -}; -#endif - - -#if PHOENIX_CONSTRUCT_LIMIT > 9 -template <typename T> -struct construct_10 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j) const - { - T t(a, b, c, d, e, f, g, h, i, j); - return t; - } -}; - -template <typename T> -struct construct_11 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k) const - { - T t(a, b, c, d, e, f, g, h, i, j, k); - return t; - } -}; - -template <typename T> -struct construct_12 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l) const - { - T t(a, b, c, d, f, e, g, h, i, j, k, l); - return t; - } -}; -#endif - -#if PHOENIX_CONSTRUCT_LIMIT > 12 -template <typename T> -struct construct_13 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - , typename M - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m) const - { - T t(a, b, c, d, e, f, g, h, i, j, k, l, m); - return t; - } -}; - -template <typename T> -struct construct_14 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - , typename M - , typename N - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n) const - { - T t(a, b, c, d, e, f, g, h, i, j, k, l, m, n); - return t; - } -}; - -template <typename T> -struct construct_15 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - , typename M - , typename N - , typename O - > - struct result { typedef T type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O - > - T operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o) const - { - T t(a, b, c, d, f, e, g, h, i, j, k, l, m, n, o); - return t; - } -}; -#endif - - -#if defined(__BORLANDC__) || (defined(__MWERKS__) && (__MWERKS__ <= 0x3002)) - -/////////////////////////////////////////////////////////////////////////////// -// -// The following specializations are needed because Borland and CodeWarrior -// does not accept default template arguments in nested template classes in -// classes (i.e construct_l::result) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T, typename TupleT> -struct composite0_result<construct_l_0<T>, TupleT> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A> -struct composite1_result<construct_l<T>, TupleT, A> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B> -struct composite2_result<construct_l<T>, TupleT, A, B> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C> -struct composite3_result<construct_l<T>, TupleT, A, B, C> { - - typedef T type; -}; - -#if PHOENIX_LIMIT > 3 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D> -struct composite4_result<construct_l<T>, TupleT, - A, B, C, D> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E> -struct composite5_result<construct_l<T>, TupleT, - A, B, C, D, E> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F> -struct composite6_result<construct_l<T>, TupleT, - A, B, C, D, E, F> { - - typedef T type; -}; - -#if PHOENIX_LIMIT > 6 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> -struct composite7_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> -struct composite8_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> -struct composite9_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H, I> { - - typedef T type; -}; - -#if PHOENIX_LIMIT > 9 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> -struct composite10_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> -struct composite11_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> -struct composite12_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L> { - - typedef T type; -}; - -#if PHOENIX_LIMIT > 12 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> -struct composite13_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> -struct composite14_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N> { - - typedef T type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> -struct composite15_result<construct_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> { - - typedef T type; -}; - -#endif -#endif -#endif -#endif -#endif - -////////////////////////////////// -template <typename T> -inline typename impl::make_composite<construct_l_0<T> >::type -construct_() -{ - typedef impl::make_composite<construct_l_0<T> > make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_l_0<T>())); -} - -////////////////////////////////// -template <typename T, typename A> -inline typename impl::make_composite<construct_1<T>, A>::type -construct_(A const& a) -{ - typedef impl::make_composite<construct_1<T>, A> make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_1<T>(), - as_actor<A>::convert(a) - )); -} - -////////////////////////////////// -template <typename T, typename A, typename B> -inline typename impl::make_composite<construct_2<T>, A, B>::type -construct_(A const& a, B const& b) -{ - typedef impl::make_composite<construct_2<T>, A, B> make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_2<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b) - )); -} - -////////////////////////////////// -template <typename T, typename A, typename B, typename C> -inline typename impl::make_composite<construct_3<T>, A, B, C>::type -construct_(A const& a, B const& b, C const& c) -{ - typedef impl::make_composite<construct_3<T>, A, B, C> make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_3<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 3 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D -> -inline typename impl::make_composite<construct_4<T>, A, B, C, D>::type -construct_( - A const& a, B const& b, C const& c, D const& d) -{ - typedef - impl::make_composite<construct_4<T>, A, B, C, D> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_4<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E -> -inline typename impl::make_composite<construct_5<T>, A, B, C, D, E>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e) -{ - typedef - impl::make_composite<construct_5<T>, A, B, C, D, E> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_5<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F -> -inline typename impl::make_composite<construct_6<T>, A, B, C, D, E, F>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f) -{ - typedef - impl::make_composite<construct_6<T>, A, B, C, D, E, F> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_6<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 6 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G -> -inline typename impl::make_composite<construct_7<T>, A, B, C, D, E, F, G>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g) -{ - typedef - impl::make_composite<construct_7<T>, A, B, C, D, E, F, G> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_7<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H -> -inline typename impl::make_composite<construct_8<T>, A, B, C, D, E, F, G, H>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h) -{ - typedef - impl::make_composite<construct_8<T>, A, B, C, D, E, F, G, H> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_8<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I -> -inline typename impl::make_composite<construct_9<T>, A, B, C, D, E, F, G, H, I>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i) -{ - typedef - impl::make_composite<construct_9<T>, A, B, C, D, E, F, G, H, I> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_9<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 9 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J -> -inline typename impl::make_composite< - construct_10<T>, A, B, C, D, E, F, G, H, I, J>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j) -{ - typedef - impl::make_composite< - construct_10<T>, A, B, C, D, E, F, G, H, I, J - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_10<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K -> -inline typename impl::make_composite< - construct_11<T>, A, B, C, D, E, F, G, H, I, J, K>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k) -{ - typedef - impl::make_composite< - construct_11<T>, A, B, C, D, E, F, G, H, I, J, K - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_11<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L -> -inline typename impl::make_composite< - construct_12<T>, A, B, C, D, E, F, G, H, I, J, K, L>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l) -{ - typedef - impl::make_composite< - construct_12<T>, A, B, C, D, E, F, G, H, I, J, K, L - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_12<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 12 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L, typename M -> -inline typename impl::make_composite< - construct_13<T>, A, B, C, D, E, F, G, H, I, J, K, L, M>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m) -{ - typedef - impl::make_composite< - construct_13<T>, A, B, C, D, E, F, G, H, I, J, K, L, M - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_13<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L, typename M, typename N -> -inline typename impl::make_composite< - construct_14<T>, A, B, C, D, E, F, G, H, I, J, K, L, M>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n) -{ - typedef - impl::make_composite< - construct_14<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, N - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_14<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m), - as_actor<N>::convert(n) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L, typename M, typename N, typename O -> -inline typename impl::make_composite< - construct_15<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, O>::type -construct_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o) -{ - typedef - impl::make_composite< - construct_15<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(construct_15<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m), - as_actor<N>::convert(n), - as_actor<O>::convert(o) - )); -} - -#endif -#endif -#endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#endif // PHOENIX_CASTS_HPP diff --git a/Utilities/BGL/boost/spirit/phoenix/closures.hpp b/Utilities/BGL/boost/spirit/phoenix/closures.hpp deleted file mode 100644 index fb707ba4698ab0df16c47bc68a512facc0e11375..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/closures.hpp +++ /dev/null @@ -1,440 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - MT code Copyright (c) 2002-2003 Martin Wille - - 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) -==============================================================================*/ -#ifndef PHOENIX_CLOSURES_HPP -#define PHOENIX_CLOSURES_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/actor.hpp> -#include <cassert> - -#ifdef PHOENIX_THREADSAFE -#include <boost/thread/tss.hpp> -#include <boost/thread/once.hpp> -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// Adaptable closures -// -// The framework will not be complete without some form of closures -// support. Closures encapsulate a stack frame where local -// variables are created upon entering a function and destructed -// upon exiting. Closures provide an environment for local -// variables to reside. Closures can hold heterogeneous types. -// -// Phoenix closures are true hardware stack based closures. At the -// very least, closures enable true reentrancy in lambda functions. -// A closure provides access to a function stack frame where local -// variables reside. Modeled after Pascal nested stack frames, -// closures can be nested just like nested functions where code in -// inner closures may access local variables from in-scope outer -// closures (accessing inner scopes from outer scopes is an error -// and will cause a run-time assertion failure). -// -// There are three (3) interacting classes: -// -// 1) closure: -// -// At the point of declaration, a closure does not yet create a -// stack frame nor instantiate any variables. A closure declaration -// declares the types and names[note] of the local variables. The -// closure class is meant to be subclassed. It is the -// responsibility of a closure subclass to supply the names for -// each of the local variable in the closure. Example: -// -// struct my_closure : closure<int, string, double> { -// -// member1 num; // names the 1st (int) local variable -// member2 message; // names the 2nd (string) local variable -// member3 real; // names the 3rd (double) local variable -// }; -// -// my_closure clos; -// -// Now that we have a closure 'clos', its local variables can be -// accessed lazily using the dot notation. Each qualified local -// variable can be used just like any primitive actor (see -// primitives.hpp). Examples: -// -// clos.num = 30 -// clos.message = arg1 -// clos.real = clos.num * 1e6 -// -// The examples above are lazily evaluated. As usual, these -// expressions return composite actors that will be evaluated -// through a second function call invocation (see operators.hpp). -// Each of the members (clos.xxx) is an actor. As such, applying -// the operator() will reveal its identity: -// -// clos.num() // will return the current value of clos.num -// -// *** [note] Acknowledgement: Juan Carlos Arevalo-Baeza (JCAB) -// introduced and initilally implemented the closure member names -// that uses the dot notation. -// -// 2) closure_member -// -// The named local variables of closure 'clos' above are actually -// closure members. The closure_member class is an actor and -// conforms to its conceptual interface. member1..memberN are -// predefined typedefs that correspond to each of the listed types -// in the closure template parameters. -// -// 3) closure_frame -// -// When a closure member is finally evaluated, it should refer to -// an actual instance of the variable in the hardware stack. -// Without doing so, the process is not complete and the evaluated -// member will result to an assertion failure. Remember that the -// closure is just a declaration. The local variables that a -// closure refers to must still be instantiated. -// -// The closure_frame class does the actual instantiation of the -// local variables and links these variables with the closure and -// all its members. There can be multiple instances of -// closure_frames typically situated in the stack inside a -// function. Each closure_frame instance initiates a stack frame -// with a new set of closure local variables. Example: -// -// void foo() -// { -// closure_frame<my_closure> frame(clos); -// /* do something */ -// } -// -// where 'clos' is an instance of our closure 'my_closure' above. -// Take note that the usage above precludes locally declared -// classes. If my_closure is a locally declared type, we can still -// use its self_type as a paramater to closure_frame: -// -// closure_frame<my_closure::self_type> frame(clos); -// -// Upon instantiation, the closure_frame links the local variables -// to the closure. The previous link to another closure_frame -// instance created before is saved. Upon destruction, the -// closure_frame unlinks itself from the closure and relinks the -// preceding closure_frame prior to this instance. -// -// The local variables in the closure 'clos' above is default -// constructed in the stack inside function 'foo'. Once 'foo' is -// exited, all of these local variables are destructed. In some -// cases, default construction is not desirable and we need to -// initialize the local closure variables with some values. This -// can be done by passing in the initializers in a compatible -// tuple. A compatible tuple is one with the same number of -// elements as the destination and where each element from the -// destination can be constructed from each corresponding element -// in the source. Example: -// -// tuple<int, char const*, int> init(123, "Hello", 1000); -// closure_frame<my_closure> frame(clos, init); -// -// Here now, our closure_frame's variables are initialized with -// int: 123, char const*: "Hello" and int: 1000. -// -/////////////////////////////////////////////////////////////////////////////// - -namespace impl -{ - /////////////////////////////////////////////////////////////////////// - // closure_frame_holder is a simple class that encapsulates the - // storage for a frame pointer. It uses thread specific data in - // case when multithreading is enabled, an ordinary pointer otherwise - // - // it has get() and set() member functions. set() has to be used - // _after_ get(). get() contains intialisation code in the multi - // threading case - // - // closure_frame_holder is used by the closure<> class to store - // the pointer to the current frame. - // -#ifndef PHOENIX_THREADSAFE - template <typename FrameT> - struct closure_frame_holder - { - typedef FrameT frame_t; - typedef frame_t *frame_ptr; - - closure_frame_holder() : frame(0) {} - - frame_ptr &get() { return frame; } - void set(frame_t *f) { frame = f; } - - private: - frame_ptr frame; - - // no copies, no assignments - closure_frame_holder(closure_frame_holder const &); - closure_frame_holder &operator=(closure_frame_holder const &); - }; -#else - template <typename FrameT> - struct closure_frame_holder - { - typedef FrameT frame_t; - typedef frame_t *frame_ptr; - - closure_frame_holder() : tsp_frame() {} - - frame_ptr &get() - { - if (!tsp_frame.get()) - tsp_frame.reset(new frame_ptr(0)); - return *tsp_frame; - } - void set(frame_ptr f) - { - *tsp_frame = f; - } - - private: - boost::thread_specific_ptr<frame_ptr> tsp_frame; - - // no copies, no assignments - closure_frame_holder(closure_frame_holder const &); - closure_frame_holder &operator=(closure_frame_holder const &); - }; -#endif -} // namespace phoenix::impl - -/////////////////////////////////////////////////////////////////////////////// -// -// closure_frame class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ClosureT> -class closure_frame : public ClosureT::tuple_t { - -public: - - closure_frame(ClosureT const& clos) - : ClosureT::tuple_t(), save(clos.frame.get()), frame(clos.frame) - { clos.frame.set(this); } - - template <typename TupleT> - closure_frame(ClosureT const& clos, TupleT const& init) - : ClosureT::tuple_t(init), save(clos.frame.get()), frame(clos.frame) - { clos.frame.set(this); } - - ~closure_frame() - { frame.set(save); } - -private: - - closure_frame(closure_frame const&); // no copy - closure_frame& operator=(closure_frame const&); // no assign - - closure_frame* save; - impl::closure_frame_holder<closure_frame>& frame; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// closure_member class -// -/////////////////////////////////////////////////////////////////////////////// -template <int N, typename ClosureT> -class closure_member { - -public: - - typedef typename ClosureT::tuple_t tuple_t; - - closure_member() - : frame(ClosureT::closure_frame_holder_ref()) {} - - template <typename TupleT> - struct result { - - typedef typename tuple_element< - N, typename ClosureT::tuple_t - >::rtype type; - }; - - template <typename TupleT> - typename tuple_element<N, typename ClosureT::tuple_t>::rtype - eval(TupleT const& /*args*/) const - { - using namespace std; - assert(frame.get() != 0); - return (*frame.get())[tuple_index<N>()]; - } - -private: - impl::closure_frame_holder<typename ClosureT::closure_frame_t> &frame; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// closure class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename T0 = nil_t - , typename T1 = nil_t - , typename T2 = nil_t - -#if PHOENIX_LIMIT > 3 - , typename T3 = nil_t - , typename T4 = nil_t - , typename T5 = nil_t - -#if PHOENIX_LIMIT > 6 - , typename T6 = nil_t - , typename T7 = nil_t - , typename T8 = nil_t - -#if PHOENIX_LIMIT > 9 - , typename T9 = nil_t - , typename T10 = nil_t - , typename T11 = nil_t - -#if PHOENIX_LIMIT > 12 - , typename T12 = nil_t - , typename T13 = nil_t - , typename T14 = nil_t - -#endif -#endif -#endif -#endif -> -class closure { - -public: - - typedef tuple< - T0, T1, T2 -#if PHOENIX_LIMIT > 3 - , T3, T4, T5 -#if PHOENIX_LIMIT > 6 - , T6, T7, T8 -#if PHOENIX_LIMIT > 9 - , T9, T10, T11 -#if PHOENIX_LIMIT > 12 - , T12, T13, T14 -#endif -#endif -#endif -#endif - > tuple_t; - - typedef closure< - T0, T1, T2 -#if PHOENIX_LIMIT > 3 - , T3, T4, T5 -#if PHOENIX_LIMIT > 6 - , T6, T7, T8 -#if PHOENIX_LIMIT > 9 - , T9, T10, T11 -#if PHOENIX_LIMIT > 12 - , T12, T13, T14 -#endif -#endif -#endif -#endif - > self_t; - - typedef closure_frame<self_t> closure_frame_t; - - closure() - : frame() { closure_frame_holder_ref(&frame); } - closure_frame_t& context() { assert(frame!=0); return frame.get(); } - closure_frame_t const& context() const { assert(frame!=0); return frame.get(); } - - typedef actor<closure_member<0, self_t> > member1; - typedef actor<closure_member<1, self_t> > member2; - typedef actor<closure_member<2, self_t> > member3; - -#if PHOENIX_LIMIT > 3 - typedef actor<closure_member<3, self_t> > member4; - typedef actor<closure_member<4, self_t> > member5; - typedef actor<closure_member<5, self_t> > member6; - -#if PHOENIX_LIMIT > 6 - typedef actor<closure_member<6, self_t> > member7; - typedef actor<closure_member<7, self_t> > member8; - typedef actor<closure_member<8, self_t> > member9; - -#if PHOENIX_LIMIT > 9 - typedef actor<closure_member<9, self_t> > member10; - typedef actor<closure_member<10, self_t> > member11; - typedef actor<closure_member<11, self_t> > member12; - -#if PHOENIX_LIMIT > 12 - typedef actor<closure_member<12, self_t> > member13; - typedef actor<closure_member<13, self_t> > member14; - typedef actor<closure_member<14, self_t> > member15; - -#endif -#endif -#endif -#endif - -#if !defined(__MWERKS__) || (__MWERKS__ > 0x3002) -private: -#endif - - closure(closure const&); // no copy - closure& operator=(closure const&); // no assign - -#if !defined(__MWERKS__) || (__MWERKS__ > 0x3002) - template <int N, typename ClosureT> - friend class closure_member; - - template <typename ClosureT> - friend class closure_frame; -#endif - - typedef impl::closure_frame_holder<closure_frame_t> holder_t; - -#ifdef PHOENIX_THREADSAFE - static boost::thread_specific_ptr<holder_t*> & - tsp_frame_instance() - { - static boost::thread_specific_ptr<holder_t*> the_instance; - return the_instance; - } - - static void - tsp_frame_instance_init() - { - tsp_frame_instance(); - } -#endif - - static holder_t & - closure_frame_holder_ref(holder_t* holder_ = 0) - { -#ifdef PHOENIX_THREADSAFE - static boost::once_flag been_here = BOOST_ONCE_INIT; - boost::call_once(tsp_frame_instance_init, been_here); - boost::thread_specific_ptr<holder_t*> &tsp_frame = tsp_frame_instance(); - if (!tsp_frame.get()) - tsp_frame.reset(new holder_t *(0)); - holder_t *& holder = *tsp_frame; -#else - static holder_t* holder = 0; -#endif - if (holder_ != 0) - holder = holder_; - return *holder; - } - - mutable holder_t frame; -}; - -} - // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/composite.hpp b/Utilities/BGL/boost/spirit/phoenix/composite.hpp deleted file mode 100644 index 903d31935ecb459c9a692332f8af168de0bb681f..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/composite.hpp +++ /dev/null @@ -1,1423 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_COMPOSITE_HPP -#define PHOENIX_COMPOSITE_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/actor.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// composite class -// -// A composite is an actor base class composed of zero or more -// actors (see actor.hpp) and an operation. A composite is itself -// an actor superclass and conforms to its conceptual interface. -// Its eval member function un-funnels the tupled actual arguments -// from the tuple by invoking each of the actors' eval member -// function. The results of each are then passed on as arguments to -// the operation. Specializations are provided to handle different -// numbers of actors. -// -// Schematically: -// -// actor0.eval(tupled_args) --> arg0 --> | -// actor1.eval(tupled_args) --> arg1 --> | -// actor2.eval(tupled_args) --> arg3 --> | --> operation(arg0...argN) -// ... | -// actorN.eval(tupled_args) --> argN --> | -// -// The operation can be any suitable functor that can accept the -// arguments passed in by the composite. The operation is expected -// to have a member operator() that carries out the actual -// operation. There should be a one to one correspondence between -// actors of the composite and the arguments of the operation's -// member operator(). -// -// The operation is also expected to have a nested template class -// result<T0...TN>. The nested template class result should have a -// typedef 'type' that reflects the return type of its member -// operator(). This is essentially a type computer that answers the -// metaprogramming question "Given arguments of type T0...TN, what -// will be its operator()'s return type?". -// -// There is a special case for operations that accept no arguments. -// Such nullary operations are only required to define a typedef -// result_type that reflects the return type of its operator(). -// -// Here's an example of a simple operation that squares a number: -// -// struct square { -// -// template <typename ArgT> -// struct result { typedef ArgT type; }; -// -// template <typename ArgT> -// ArgT operator()(ArgT n) const { return n * n; } -// }; -// -// As can be seen, operations can be polymorphic. Its arguments and -// return type are not fixed to a particular type. The example -// above for example, can handle any ArgT type as long as it has a -// multiplication operator. -// -// Composites are not created directly. Instead, there are meta- -// programs provided that indirectly create composites. See -// operators.hpp, binders.hpp and functions.hpp for examples. -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename OperationT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif - - , typename NU = nil_t // Not used -> -struct composite; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <0 actor> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT> -struct composite0_result { - - typedef typename OperationT::result_type type; -}; - -////////////////////////////////// -template <typename OperationT> -struct composite<OperationT, - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite0_result< - OperationT, TupleT - >::type type; - }; - - composite(OperationT const& op_) - : op(op_) {} - - template <typename TupleT> - typename OperationT::result_type - eval(TupleT const& /*args*/) const - { - return op(); - } - - mutable OperationT op; // operation -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <1 actor> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A> -struct composite1_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A> -struct composite<OperationT, - A, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite1_result< - OperationT, TupleT, A - >::type type; - }; - - composite(OperationT const& op_, - A const& a_) - : op(op_), a(a_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - return op(ra); - } - - mutable OperationT op; // operation - A a; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <2 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B> -struct composite2_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B> -struct composite<OperationT, - A, B, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite2_result< - OperationT, TupleT, A, B - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_) - : op(op_), a(a_), b(b_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - return op(ra, rb); - } - - mutable OperationT op; // operation - A a; B b; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <3 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C> -struct composite3_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C> -struct composite<OperationT, - A, B, C, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite3_result< - OperationT, TupleT, A, B, C - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_) - : op(op_), a(a_), b(b_), c(c_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - return op(ra, rb, rc); - } - - mutable OperationT op; // operation - A a; B b; C c; // actors -}; - -#if PHOENIX_LIMIT > 3 -/////////////////////////////////////////////////////////////////////////////// -// -// composite <4 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D> -struct composite4_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D> -struct composite<OperationT, - A, B, C, D, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C, D> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite4_result< - OperationT, TupleT, A, B, C, D - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_) - : op(op_), a(a_), b(b_), c(c_), d(d_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - return op(ra, rb, rc, rd); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <5 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E> -struct composite5_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E> -struct composite<OperationT, - A, B, C, D, E, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C, D, E> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite5_result< - OperationT, TupleT, A, B, C, D, E - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - return op(ra, rb, rc, rd, re); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <6 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F> -struct composite6_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F> -struct composite<OperationT, - A, B, C, D, E, F, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C, D, E, F> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite6_result< - OperationT, TupleT, A, B, C, D, E, F - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - return op(ra, rb, rc, rd, re, rf); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; // actors -}; - -#if PHOENIX_LIMIT > 6 -/////////////////////////////////////////////////////////////////////////////// -// -// composite <7 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> -struct composite7_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> -struct composite<OperationT, - A, B, C, D, E, F, G, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C, D, E, F, G> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite7_result< - OperationT, TupleT, A, B, C, D, E, F, G - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - return op(ra, rb, rc, rd, re, rf, rg); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <8 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> -struct composite8_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> -struct composite<OperationT, - A, B, C, D, E, F, G, H, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C, D, E, F, G, H> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite8_result< - OperationT, TupleT, A, B, C, D, E, F, G, H - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <9 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> -struct composite9_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type, - typename actor_result<I, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> -struct composite<OperationT, - A, B, C, D, E, F, G, H, I, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C, D, E, F, G, H, I> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite9_result< - OperationT, TupleT, A, B, C, D, E, F, G, H, I - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_, I const& i_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - typename actor_result<I, TupleT>::type ri = i.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh, ri); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; I i; // actors -}; - -#if PHOENIX_LIMIT > 9 -/////////////////////////////////////////////////////////////////////////////// -// -// composite <10 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> -struct composite10_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type, - typename actor_result<I, TupleT>::plain_type, - typename actor_result<J, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> -struct composite<OperationT, - A, B, C, D, E, F, G, H, I, J, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef composite<OperationT, A, B, C, D, E, F, G, H, I, J> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite10_result< - OperationT, TupleT, A, B, C, D, E, F, G, H, I, J - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_, I const& i_, J const& j_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - typename actor_result<I, TupleT>::type ri = i.eval(args); - typename actor_result<J, TupleT>::type rj = j.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <11 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> -struct composite11_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type, - typename actor_result<I, TupleT>::plain_type, - typename actor_result<J, TupleT>::plain_type, - typename actor_result<K, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> -struct composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite11_result< - OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_, I const& i_, J const& j_, - K const& k_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - typename actor_result<I, TupleT>::type ri = i.eval(args); - typename actor_result<J, TupleT>::type rj = j.eval(args); - typename actor_result<K, TupleT>::type rk = k.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; - K k;// actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <12 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> -struct composite12_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type, - typename actor_result<I, TupleT>::plain_type, - typename actor_result<J, TupleT>::plain_type, - typename actor_result<K, TupleT>::plain_type, - typename actor_result<L, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> -struct composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> { - - typedef composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite12_result< - OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_, I const& i_, J const& j_, - K const& k_, L const& l_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - typename actor_result<I, TupleT>::type ri = i.eval(args); - typename actor_result<J, TupleT>::type rj = j.eval(args); - typename actor_result<K, TupleT>::type rk = k.eval(args); - typename actor_result<L, TupleT>::type rl = l.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; - K k; L l;// actors -}; - -#if PHOENIX_LIMIT > 12 -/////////////////////////////////////////////////////////////////////////////// -// -// composite <13 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> -struct composite13_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type, - typename actor_result<I, TupleT>::plain_type, - typename actor_result<J, TupleT>::plain_type, - typename actor_result<K, TupleT>::plain_type, - typename actor_result<L, TupleT>::plain_type, - typename actor_result<M, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> -struct composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t -> { - - typedef composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L, M> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite13_result< - OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L, M - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_, I const& i_, J const& j_, - K const& k_, L const& l_, M const& m_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_), m(m_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - typename actor_result<I, TupleT>::type ri = i.eval(args); - typename actor_result<J, TupleT>::type rj = j.eval(args); - typename actor_result<K, TupleT>::type rk = k.eval(args); - typename actor_result<L, TupleT>::type rl = l.eval(args); - typename actor_result<M, TupleT>::type rm = m.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; - K k; L l; M m; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <14 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> -struct composite14_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type, - typename actor_result<I, TupleT>::plain_type, - typename actor_result<J, TupleT>::plain_type, - typename actor_result<K, TupleT>::plain_type, - typename actor_result<L, TupleT>::plain_type, - typename actor_result<M, TupleT>::plain_type, - typename actor_result<N, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> -struct composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t -> { - - typedef composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite14_result< - OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L, M, N - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_, I const& i_, J const& j_, - K const& k_, L const& l_, M const& m_, N const& n_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_), m(m_), n(n_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - typename actor_result<I, TupleT>::type ri = i.eval(args); - typename actor_result<J, TupleT>::type rj = j.eval(args); - typename actor_result<K, TupleT>::type rk = k.eval(args); - typename actor_result<L, TupleT>::type rl = l.eval(args); - typename actor_result<M, TupleT>::type rm = m.eval(args); - typename actor_result<N, TupleT>::type rn = n.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; - K k; L l; M m; N n; // actors -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// composite <15 actors> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> -struct composite15_result { - - typedef typename OperationT::template result< - typename actor_result<A, TupleT>::plain_type, - typename actor_result<B, TupleT>::plain_type, - typename actor_result<C, TupleT>::plain_type, - typename actor_result<D, TupleT>::plain_type, - typename actor_result<E, TupleT>::plain_type, - typename actor_result<F, TupleT>::plain_type, - typename actor_result<G, TupleT>::plain_type, - typename actor_result<H, TupleT>::plain_type, - typename actor_result<I, TupleT>::plain_type, - typename actor_result<J, TupleT>::plain_type, - typename actor_result<K, TupleT>::plain_type, - typename actor_result<L, TupleT>::plain_type, - typename actor_result<M, TupleT>::plain_type, - typename actor_result<N, TupleT>::plain_type, - typename actor_result<O, TupleT>::plain_type - >::type type; -}; - -////////////////////////////////// -template <typename OperationT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> -struct composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t -> { - - typedef composite<OperationT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> self_t; - - template <typename TupleT> - struct result { - - typedef typename composite15_result< - OperationT, TupleT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O - >::type type; - }; - - composite(OperationT const& op_, - A const& a_, B const& b_, C const& c_, D const& d_, E const& e_, - F const& f_, G const& g_, H const& h_, I const& i_, J const& j_, - K const& k_, L const& l_, M const& m_, N const& n_, O const& o_) - : op(op_), a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_), m(m_), n(n_), o(o_) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - typename actor_result<A, TupleT>::type ra = a.eval(args); - typename actor_result<B, TupleT>::type rb = b.eval(args); - typename actor_result<C, TupleT>::type rc = c.eval(args); - typename actor_result<D, TupleT>::type rd = d.eval(args); - typename actor_result<E, TupleT>::type re = e.eval(args); - typename actor_result<F, TupleT>::type rf = f.eval(args); - typename actor_result<G, TupleT>::type rg = g.eval(args); - typename actor_result<H, TupleT>::type rh = h.eval(args); - typename actor_result<I, TupleT>::type ri = i.eval(args); - typename actor_result<J, TupleT>::type rj = j.eval(args); - typename actor_result<K, TupleT>::type rk = k.eval(args); - typename actor_result<L, TupleT>::type rl = l.eval(args); - typename actor_result<M, TupleT>::type rm = m.eval(args); - typename actor_result<N, TupleT>::type rn = n.eval(args); - typename actor_result<O, TupleT>::type ro = o.eval(args); - return op(ra, rb, rc, rd, re, rf, rg, rh, ri, rj, rk, rl, rm, rn, ro); - } - - mutable OperationT op; // operation - A a; B b; C c; D d; E e; F f; G g; H h; I i; J j; - K k; L l; M m; N n; O o; // actors -}; - -#endif -#endif -#endif -#endif - -namespace impl { - - /////////////////////////////////////////////////////////////////////////// - // - // make_composite is basically a type computer that answers the - // question "Given types T0..TN, what composite type should I - // create <composite_type> and if I were to generate an actual - // composite, what type <type> should I return?" - // - /////////////////////////////////////////////////////////////////////////// - template < - typename OperationT - , typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif - > - struct make_composite { - - typedef composite<OperationT - , typename as_actor<A>::type - , typename as_actor<B>::type - , typename as_actor<C>::type - -#if PHOENIX_LIMIT > 3 - , typename as_actor<D>::type - , typename as_actor<E>::type - , typename as_actor<F>::type - -#if PHOENIX_LIMIT > 6 - , typename as_actor<G>::type - , typename as_actor<H>::type - , typename as_actor<I>::type - -#if PHOENIX_LIMIT > 9 - , typename as_actor<J>::type - , typename as_actor<K>::type - , typename as_actor<L>::type - -#if PHOENIX_LIMIT > 12 - , typename as_actor<M>::type - , typename as_actor<N>::type - , typename as_actor<O>::type - -#endif -#endif -#endif -#endif - > composite_type; - - typedef actor<composite_type> type; - }; - - /////////////////////////////////////////////////////////////////////////// - // - // make_unary, make_binary, make_binary1, make_binary2 and - // make_binary3 utilities are provided here for easy creation of - // unary and binary composites. - // - /////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////// input is an actor - template <typename OperationT, typename BaseT> - struct make_unary { - - typedef typename make_composite - <OperationT, actor<BaseT> >::type type; - - static type - construct(actor<BaseT> const& _0) - { - typedef typename make_composite - <OperationT, actor<BaseT> >::composite_type - ret_t; - - return ret_t(OperationT(), _0); - } - }; - - ////////////////////////////////// LHS is an actor, RHS is unknown - template <typename OperationT, typename BaseT, typename B> - struct make_binary1 { - - typedef typename make_composite - <OperationT, actor<BaseT>, B>::type type; - - static type - construct(actor<BaseT> const& _0, B const& _1) - { - typedef typename make_composite - <OperationT, actor<BaseT>, B>::composite_type - ret_t; - - return ret_t(OperationT(), _0, as_actor<B>::convert(_1)); - } - }; - - ////////////////////////////////// LHS is unknown, RHS is an actor - template <typename OperationT, typename A, typename BaseT> - struct make_binary2 { - - typedef typename make_composite - <OperationT, A, actor<BaseT> >::type type; - - static type - construct(A const& _0, actor<BaseT> const& _1) - { - typedef typename make_composite - <OperationT, A, actor<BaseT> >::composite_type - ret_t; - - return ret_t(OperationT(), as_actor<A>::convert(_0), _1); - } - }; - - ////////////////////////////////// Both LHS and RHS are actors - template <typename OperationT, typename BaseA, typename BaseB> - struct make_binary3 { - - typedef typename make_composite - <OperationT, actor<BaseA>, actor<BaseB> >::type type; - - static type - construct(actor<BaseA> const& _0, actor<BaseB> const& _1) - { - typedef typename make_composite - <OperationT, actor<BaseA>, actor<BaseB> >::composite_type - ret_t; - - return ret_t(OperationT(), _0, _1); - } - }; - -} // namespace impl - -} // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/functions.hpp b/Utilities/BGL/boost/spirit/phoenix/functions.hpp deleted file mode 100644 index dc134858574cd9ca8a3a9a1d6778ef03f66a8d45..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/functions.hpp +++ /dev/null @@ -1,761 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_FUNCTIONS_HPP -#define PHOENIX_FUNCTIONS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/actor.hpp> -#include <boost/spirit/phoenix/composite.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// function class -// -// Lazy functions -// -// This class provides a mechanism for lazily evaluating functions. -// Syntactically, a lazy function looks like an ordinary C/C++ -// function. The function call looks the same. However, unlike -// ordinary functions, the actual function execution is deferred. -// (see actor.hpp, primitives.hpp and composite.hpp for an -// overview). For example here are sample factorial function calls: -// -// factorial(4) -// factorial(arg1) -// factorial(arg1 * 6) -// -// These functions are automatically lazily bound unlike ordinary -// function pointers or functor objects that need to be explicitly -// bound through the bind function (see binders.hpp). -// -// A lazy function works in conjunction with a user defined functor -// (as usual with a member operator()). Only special forms of -// functor objects are allowed. This is required to enable true -// polymorphism (STL style monomorphic functors and function -// pointers can still be used through the bind facility in -// binders.hpp). -// -// This special functor is expected to have a nested template class -// result<A...TN> (where N is the number of arguments of its -// member operator()). The nested template class result should have -// a typedef 'type' that reflects the return type of its member -// operator(). This is essentially a type computer that answers the -// metaprogramming question "Given arguments of type A...TN, what -// will be the operator()'s return type?". -// -// There is a special case for functors that accept no arguments. -// Such nullary functors are only required to define a typedef -// result_type that reflects the return type of its operator(). -// -// Here's an example of a simple functor that computes the -// factorial of a number: -// -// struct factorial_impl { -// -// template <typename Arg> -// struct result { typedef Arg type; }; -// -// template <typename Arg> -// Arg operator()(Arg n) const -// { return (n <= 0) ? 1 : n * this->operator()(n-1); } -// }; -// -// As can be seen, the functor can be polymorphic. Its arguments -// and return type are not fixed to a particular type. The example -// above for example, can handle any type as long as it can carry -// out the required operations (i.e. <=, * and -). -// -// We can now declare and instantiate a lazy 'factorial' function: -// -// function<factorial_impl> factorial; -// -// Invoking a lazy function 'factorial' does not immediately -// execute the functor factorial_impl. Instead, a composite (see -// composite.hpp) object is created and returned to the caller. -// Example: -// -// factorial(arg1) -// -// does nothing more than return a composite. A second function -// call will invoke the actual factorial function. Example: -// -// int i = 4; -// cout << factorial(arg1)(i); -// -// will print out "24". -// -// Take note that in certain cases (e.g. for functors with state), -// an instance may be passed on to the constructor. Example: -// -// function<factorial_impl> factorial(ftor); -// -// where ftor is an instance of factorial_impl (this is not -// necessary in this case since factorial is a simple stateless -// functor). Take care though when using functors with state -// because the functors are taken in by value. It is best to keep -// the data manipulated by a functor outside the functor itself and -// keep a reference to this data inside the functor. Also, it is -// best to keep functors as small as possible. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT> -struct function { - - function() : op() {} - function(OperationT const& op_) : op(op_) {} - - actor<composite<OperationT> > - operator()() const; - - template <typename A> - typename impl::make_composite<OperationT, A>::type - operator()(A const& a) const; - - template <typename A, typename B> - typename impl::make_composite<OperationT, A, B>::type - operator()(A const& a, B const& b) const; - - template <typename A, typename B, typename C> - typename impl::make_composite<OperationT, A, B, C>::type - operator()(A const& a, B const& b, C const& c) const; - -#if PHOENIX_LIMIT > 3 - - template <typename A, typename B, typename C, typename D> - typename impl::make_composite<OperationT, A, B, C, D>::type - operator()(A const& a, B const& b, C const& c, D const& d) const; - - template <typename A, typename B, typename C, typename D, typename E> - typename impl::make_composite< - OperationT, A, B, C, D, E - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e - ) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f - ) const; - -#if PHOENIX_LIMIT > 6 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g - ) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h - ) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i - ) const; - -#if PHOENIX_LIMIT > 9 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j - ) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k - ) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l - ) const; - -#if PHOENIX_LIMIT > 12 - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m - ) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n - ) const; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O - > - typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O - >::type - operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o - ) const; - -#endif -#endif -#endif -#endif - - OperationT op; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// function class implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename OperationT> -inline actor<composite<OperationT> > -function<OperationT>::operator()() const -{ - return actor<composite<OperationT> >(op); -} - -////////////////////////////////// -template <typename OperationT> -template <typename A> -inline typename impl::make_composite<OperationT, A>::type -function<OperationT>::operator()(A const& a) const -{ - typedef typename impl::make_composite<OperationT, A>::composite_type ret_t; - return ret_t - ( - op, - as_actor<A>::convert(a) - ); -} - -////////////////////////////////// -template <typename OperationT> -template <typename A, typename B> -inline typename impl::make_composite<OperationT, A, B>::type -function<OperationT>::operator()(A const& a, B const& b) const -{ - typedef - typename impl::make_composite<OperationT, A, B>::composite_type - ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b) - ); -} - -////////////////////////////////// -template <typename OperationT> -template <typename A, typename B, typename C> -inline typename impl::make_composite<OperationT, A, B, C>::type -function<OperationT>::operator()(A const& a, B const& b, C const& c) const -{ - typedef - typename impl::make_composite<OperationT, A, B, C>::composite_type - ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c) - ); -} - -#if PHOENIX_LIMIT > 3 -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D -> -inline typename impl::make_composite< - OperationT, A, B, C, D ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f) - ); -} - -#if PHOENIX_LIMIT > 6 - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i) - ); -} - -#if PHOENIX_LIMIT > 9 - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l) - ); -} - -#if PHOENIX_LIMIT > 12 - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m), - as_actor<N>::convert(n) - ); -} - -////////////////////////////////// -template <typename OperationT> -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O -> -inline typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O ->::type -function<OperationT>::operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o -) const -{ - typedef typename impl::make_composite< - OperationT, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O - >::composite_type ret_t; - - return ret_t( - op, - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m), - as_actor<N>::convert(n), - as_actor<O>::convert(o) - ); -} - -#endif -#endif -#endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/new.hpp b/Utilities/BGL/boost/spirit/phoenix/new.hpp deleted file mode 100644 index acd3255c945d396b3116cd41a3864791a1956035..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/new.hpp +++ /dev/null @@ -1,1316 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2003 Joel de Guzman - Copyright (c) 2001-2003 Hartmut Kaiser - Copyright (c) 2003 Vaclav Vesely - - 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) -==============================================================================*/ - -#ifndef PHOENIX_NEW_HPP -#define PHOENIX_NEW_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/actor.hpp> -#include <boost/spirit/phoenix/composite.hpp> -#include <boost/static_assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// Phoenix predefined maximum new_ limit. This limit defines the maximum -// number of parameters supported for calles to the set of new_ template -// functions (lazy object construction, see below). This number defaults to 3. -// The actual maximum is rounded up in multiples of 3. Thus, if this value -// is 4, the actual limit is 6. The ultimate maximum limit in this -// implementation is 15. -// PHOENIX_CONSTRUCT_LIMIT should NOT be greater than PHOENIX_LIMIT! - -#if !defined(PHOENIX_CONSTRUCT_LIMIT) -#define PHOENIX_CONSTRUCT_LIMIT PHOENIX_LIMIT -#endif - -// ensure PHOENIX_CONSTRUCT_LIMIT <= PHOENIX_LIMIT -BOOST_STATIC_ASSERT(PHOENIX_CONSTRUCT_LIMIT <= PHOENIX_LIMIT); - -// ensure PHOENIX_CONSTRUCT_LIMIT <= 15 -BOOST_STATIC_ASSERT(PHOENIX_CONSTRUCT_LIMIT <= 15); - -/////////////////////////////////////////////////////////////////////////////// -// -// new_ -// -// Lazy object construction -// -// The set of new_<> template classes and functions provide a way -// of lazily constructing certain object from a arbitrary set of -// actors during parsing. -// The new_ templates are (syntactically) used very much like -// the well known C++ casts: -// -// A *a = new_<A>(...arbitrary list of actors...); -// -// where the given parameters are submitted as parameters to the -// contructor of the object of type A. (This certainly implies, that -// type A has a constructor with a fitting set of parameter types -// defined.) -// -// The maximum number of needed parameters is controlled through the -// preprocessor constant PHOENIX_CONSTRUCT_LIMIT. Note though, that this -// limit should not be greater than PHOENIX_LIMIT. -// -/////////////////////////////////////////////////////////////////////////////// - -template <typename T> -struct new_l_0 -{ - typedef T* result_type; - - T* operator()() const - { - return new T(); - } -}; - -template <typename T> -struct new_l { - - template < - typename A - , typename B - , typename C - -#if PHOENIX_CONSTRUCT_LIMIT > 3 - , typename D - , typename E - , typename F - -#if PHOENIX_CONSTRUCT_LIMIT > 6 - , typename G - , typename H - , typename I - -#if PHOENIX_CONSTRUCT_LIMIT > 9 - , typename J - , typename K - , typename L - -#if PHOENIX_CONSTRUCT_LIMIT > 12 - , typename M - , typename N - , typename O -#endif -#endif -#endif -#endif - > - struct result { typedef T* type; }; - - T* operator()() const { - return new T(); - } - - template <typename A> - T* operator()(A const& a) const { - return new T(a); - } - - template <typename A, typename B> - T* operator()(A const& a, B const& b) const { - return new T(a, b); - } - - template <typename A, typename B, typename C> - T* operator()(A const& a, B const& b, C const& c) const { - return new T(a, b, c); - } - -#if PHOENIX_CONSTRUCT_LIMIT > 3 - template < - typename A, typename B, typename C, typename D - > - T* operator()( - A const& a, B const& b, C const& c, D const& d) const - { - return new T(a, b, c, d); - } - - template < - typename A, typename B, typename C, typename D, typename E - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e) const - { - return new T(a, b, c, d, e); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f) const - { - return new T(a, b, c, d, e, f); - } - -#if PHOENIX_CONSTRUCT_LIMIT > 6 - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g) const - { - return new T(a, b, c, d, e, f, g); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h) const - { - return new T(a, b, c, d, e, f, g, h); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i) const - { - return new T(a, b, c, d, e, f, g, h, i); - } - -#if PHOENIX_CONSTRUCT_LIMIT > 9 - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j) const - { - return new T(a, b, c, d, e, f, g, h, i, j); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k, l); - } - -#if PHOENIX_CONSTRUCT_LIMIT > 12 - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k, l, m); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k, l, m, n); - } - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); - } - -#endif -#endif -#endif -#endif -}; - -template <typename T> -struct new_1 { - - template < - typename A - > - struct result { typedef T* type; }; - - template <typename A> - T* operator()(A const& a) const { - return new T(a); - } - -}; - -template <typename T> -struct new_2 { - - template < - typename A - , typename B - > - struct result { typedef T* type; }; - - template <typename A, typename B> - T* operator()(A const& a, B const& b) const { - return new T(a, b); - } - -}; - -template <typename T> -struct new_3 { - - template < - typename A - , typename B - , typename C - > - struct result { typedef T* type; }; - - template <typename A, typename B, typename C> - T* operator()(A const& a, B const& b, C const& c) const { - return new T(a, b, c); - } -}; - -#if PHOENIX_CONSTRUCT_LIMIT > 3 -template <typename T> -struct new_4 { - - template < - typename A - , typename B - , typename C - , typename D - > - struct result { typedef T* type; }; - - - template < - typename A, typename B, typename C, typename D - > - T* operator()( - A const& a, B const& b, C const& c, D const& d) const - { - return new T(a, b, c, d); - } -}; - - -template <typename T> -struct new_5 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - > - struct result { typedef T* type; }; - - template < - typename A, typename B, typename C, typename D, typename E - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e) const - { - return new T(a, b, c, d, e); - } -}; - - -template <typename T> -struct new_6 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - > - struct result { typedef T* type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f) const - { - return new T(a, b, c, d, e, f); - } -}; -#endif - - -#if PHOENIX_CONSTRUCT_LIMIT > 6 -template <typename T> -struct new_7 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - > - struct result { typedef T* type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g) const - { - return new T(a, b, c, d, e, f, g); - } -}; - -template <typename T> -struct new_8 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - > - struct result { typedef T* type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h) const - { - return new T(a, b, c, d, e, f, g, h); - } -}; - -template <typename T> -struct new_9 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - > - struct result { typedef T* type; }; - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i) const - { - return new T(a, b, c, d, e, f, g, h, i); - } -}; -#endif - - -#if PHOENIX_CONSTRUCT_LIMIT > 9 -template <typename T> -struct new_10 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - > - struct result { typedef T* type; }; - - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j) const - { - return new T(a, b, c, d, e, f, g, h, i, j); - } -}; - -template <typename T> -struct new_11 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - > - struct result { typedef T* type; }; - - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k); - } - -}; - -template <typename T> -struct new_12 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - > - struct result { typedef T* type; }; - - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l) const - { - return new T(a, b, c, d, f, e, g, h, i, j, k, l); - } -}; -#endif - -#if PHOENIX_CONSTRUCT_LIMIT > 12 -template <typename T> -struct new_13 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - , typename M - > - struct result { typedef T* type; }; - - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k, l, m); - } -}; - -template <typename T> -struct new_14 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - , typename M - , typename N - > - struct result { typedef T* type; }; - - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n) const - { - return new T(a, b, c, d, e, f, g, h, i, j, k, l, m, n); - } - -}; - -template <typename T> -struct new_15 { - - template < - typename A - , typename B - , typename C - , typename D - , typename E - , typename F - , typename G - , typename H - , typename I - , typename J - , typename K - , typename L - , typename M - , typename N - , typename O - > - struct result { typedef T* type; }; - - - template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O - > - T* operator()( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o) const - { - return new T(a, b, c, d, f, e, g, h, i, j, k, l, m, n, o); - } - -}; -#endif - - -#if defined(__BORLANDC__) || (defined(__MWERKS__) && (__MWERKS__ <= 0x3002)) - -/////////////////////////////////////////////////////////////////////////////// -// -// The following specializations are needed because Borland and CodeWarrior -// does not accept default template arguments in nested template classes in -// classes (i.e new_l::result) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T, typename TupleT> -struct composite0_result<new_l_0<T>, TupleT> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A> -struct composite1_result<new_l<T>, TupleT, A> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B> -struct composite2_result<new_l<T>, TupleT, A, B> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C> -struct composite3_result<new_l<T>, TupleT, A, B, C> { - - typedef T* type; -}; - -#if PHOENIX_LIMIT > 3 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D> -struct composite4_result<new_l<T>, TupleT, - A, B, C, D> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E> -struct composite5_result<new_l<T>, TupleT, - A, B, C, D, E> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F> -struct composite6_result<new_l<T>, TupleT, - A, B, C, D, E, F> { - - typedef T* type; -}; - -#if PHOENIX_LIMIT > 6 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> -struct composite7_result<new_l<T>, TupleT, - A, B, C, D, E, F, G> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> -struct composite8_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> -struct composite9_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H, I> { - - typedef T* type; -}; - -#if PHOENIX_LIMIT > 9 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> -struct composite10_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> -struct composite11_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> -struct composite12_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L> { - - typedef T* type; -}; - -#if PHOENIX_LIMIT > 12 -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> -struct composite13_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> -struct composite14_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N> { - - typedef T* type; -}; - -////////////////////////////////// -template <typename T, typename TupleT, - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> -struct composite15_result<new_l<T>, TupleT, - A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> { - - typedef T* type; -}; - -#endif -#endif -#endif -#endif -#endif - -////////////////////////////////// -template <typename T> -inline typename impl::make_composite<new_l_0<T> >::type -new_() -{ - typedef impl::make_composite<new_l_0<T> > make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_l_0<T>())); -} - -////////////////////////////////// -template <typename T, typename A> -inline typename impl::make_composite<new_1<T>, A>::type -new_(A const& a) -{ - typedef impl::make_composite<new_1<T>, A> make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_1<T>(), - as_actor<A>::convert(a) - )); -} - -////////////////////////////////// -template <typename T, typename A, typename B> -inline typename impl::make_composite<new_2<T>, A, B>::type -new_(A const& a, B const& b) -{ - typedef impl::make_composite<new_2<T>, A, B> make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_2<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b) - )); -} - -////////////////////////////////// -template <typename T, typename A, typename B, typename C> -inline typename impl::make_composite<new_3<T>, A, B, C>::type -new_(A const& a, B const& b, C const& c) -{ - typedef impl::make_composite<new_3<T>, A, B, C> make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_3<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 3 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D -> -inline typename impl::make_composite<new_4<T>, A, B, C, D>::type -new_( - A const& a, B const& b, C const& c, D const& d) -{ - typedef - impl::make_composite<new_4<T>, A, B, C, D> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_4<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E -> -inline typename impl::make_composite<new_5<T>, A, B, C, D, E>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e) -{ - typedef - impl::make_composite<new_5<T>, A, B, C, D, E> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_5<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F -> -inline typename impl::make_composite<new_6<T>, A, B, C, D, E, F>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f) -{ - typedef - impl::make_composite<new_6<T>, A, B, C, D, E, F> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_6<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 6 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G -> -inline typename impl::make_composite<new_7<T>, A, B, C, D, E, F, G>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g) -{ - typedef - impl::make_composite<new_7<T>, A, B, C, D, E, F, G> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_7<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H -> -inline typename impl::make_composite<new_8<T>, A, B, C, D, E, F, G, H>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h) -{ - typedef - impl::make_composite<new_8<T>, A, B, C, D, E, F, G, H> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_8<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I -> -inline typename impl::make_composite<new_9<T>, A, B, C, D, E, F, G, H, I>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i) -{ - typedef - impl::make_composite<new_9<T>, A, B, C, D, E, F, G, H, I> - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_9<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 9 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J -> -inline typename impl::make_composite< - new_10<T>, A, B, C, D, E, F, G, H, I, J>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j) -{ - typedef - impl::make_composite< - new_10<T>, A, B, C, D, E, F, G, H, I, J - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_10<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K -> -inline typename impl::make_composite< - new_11<T>, A, B, C, D, E, F, G, H, I, J, K>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k) -{ - typedef - impl::make_composite< - new_11<T>, A, B, C, D, E, F, G, H, I, J, K - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_11<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L -> -inline typename impl::make_composite< - new_12<T>, A, B, C, D, E, F, G, H, I, J, K, L>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l) -{ - typedef - impl::make_composite< - new_12<T>, A, B, C, D, E, F, G, H, I, J, K, L - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_12<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l) - )); -} - -#if PHOENIX_CONSTRUCT_LIMIT > 12 -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L, typename M -> -inline typename impl::make_composite< - new_13<T>, A, B, C, D, E, F, G, H, I, J, K, L, M>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m) -{ - typedef - impl::make_composite< - new_13<T>, A, B, C, D, E, F, G, H, I, J, K, L, M - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_13<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L, typename M, typename N -> -inline typename impl::make_composite< - new_14<T>, A, B, C, D, E, F, G, H, I, J, K, L, M>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n) -{ - typedef - impl::make_composite< - new_14<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, N - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_14<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m), - as_actor<N>::convert(n) - )); -} - -////////////////////////////////// -template < - typename T, typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, typename K, - typename L, typename M, typename N, typename O -> -inline typename impl::make_composite< - new_15<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, O>::type -new_( - A const& a, B const& b, C const& c, D const& d, E const& e, - F const& f, G const& g, H const& h, I const& i, J const& j, - K const& k, L const& l, M const& m, N const& n, O const& o) -{ - typedef - impl::make_composite< - new_15<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O - > - make_composite_t; - typedef typename make_composite_t::type type_t; - typedef typename make_composite_t::composite_type composite_type_t; - - return type_t(composite_type_t(new_15<T>(), - as_actor<A>::convert(a), - as_actor<B>::convert(b), - as_actor<C>::convert(c), - as_actor<D>::convert(d), - as_actor<E>::convert(e), - as_actor<F>::convert(f), - as_actor<G>::convert(g), - as_actor<H>::convert(h), - as_actor<I>::convert(i), - as_actor<J>::convert(j), - as_actor<K>::convert(k), - as_actor<L>::convert(l), - as_actor<M>::convert(m), - as_actor<N>::convert(n), - as_actor<O>::convert(o) - )); -} - -#endif -#endif -#endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#endif // PHOENIX_NEW_HPP diff --git a/Utilities/BGL/boost/spirit/phoenix/operators.hpp b/Utilities/BGL/boost/spirit/phoenix/operators.hpp deleted file mode 100644 index a50cfd34204311479a8baf6e6addbfd71add7664..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/operators.hpp +++ /dev/null @@ -1,2203 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_OPERATORS_HPP -#define PHOENIX_OPERATORS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_NO_CWCTYPE) - #include <cwctype> -#endif - -#if defined(__BORLANDC__) || (defined(__ICL) && __ICL >= 700) -#define CREF const& -#else -#define CREF -#endif - -#include <boost/spirit/phoenix/actor.hpp> -#include <boost/spirit/phoenix/composite.hpp> -#include <boost/config.hpp> -#include <boost/mpl/if.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// Operators -// -// Lazy operators -// -// This class provides a mechanism for lazily evaluating operators. -// Syntactically, a lazy operator looks like an ordinary C/C++ -// infix, prefix or postfix operator. The operator application -// looks the same. However, unlike ordinary operators, the actual -// operator execution is deferred. (see actor.hpp, primitives.hpp -// and composite.hpp for an overview). Samples: -// -// arg1 + arg2 -// 1 + arg1 * arg2 -// 1 / -arg1 -// arg1 < 150 -// -// T1 set of classes implement all the C++ free operators. Like -// lazy functions (see functions.hpp), lazy operators are not -// immediately executed when invoked. Instead, a composite (see -// composite.hpp) object is created and returned to the caller. -// Example: -// -// (arg1 + arg2) * arg3 -// -// does nothing more than return a composite. T1 second function -// call will evaluate the actual operators. Example: -// -// int i = 4, j = 5, k = 6; -// cout << ((arg1 + arg2) * arg3)(i, j, k); -// -// will print out "54". -// -// Arbitrarily complex expressions can be lazily evaluated -// following three simple rules: -// -// 1) Lazy evaluated binary operators apply when at least one -// of the operands is an actor object (see actor.hpp and -// primitives.hpp). Consequently, if an operand is not an actor -// object, it is implicitly converted to an object of type -// actor<value<T> > (where T is the original type of the -// operand). -// -// 2) Lazy evaluated unary operators apply only to operands -// which are actor objects. -// -// 3) The result of a lazy operator is a composite actor object -// that can in turn apply to rule 1. -// -// Example: -// -// arg1 + 3 -// -// is a lazy expression involving the operator+. Following rule 1, -// lazy evaluation is triggered since arg1 is an instance of an -// actor<argument<N> > class (see primitives.hpp). The right -// operand <3> is implicitly converted to an actor<value<int> >. -// The result of this binary + expression is a composite object, -// following rule 3. -// -// Take note that although at least one of the operands must be a -// valid actor class in order for lazy evaluation to take effect, -// if this is not the case and we still want to lazily evaluate an -// expression, we can use var(x), val(x) or cref(x) to transform -// the operand into a valid action object (see primitives.hpp). -// Example: -// -// val(1) << 3; -// -// Supported operators: -// -// Unary operators: -// -// prefix: ~, !, -, +, ++, --, & (reference), * (dereference) -// postfix: ++, -- -// -// Binary operators: -// -// =, [], +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>= -// +, -, *, /, %, &, |, ^, <<, >> -// ==, !=, <, >, <=, >= -// &&, || -// -// Each operator has a special tag type associated with it. For -// example the binary + operator has a plus_op tag type associated -// with it. This is used to specialize either the unary_operator or -// binary_operator template classes (see unary_operator and -// binary_operator below). Specializations of these unary_operator -// and binary_operator are the actual workhorses that implement the -// operations. The behavior of each lazy operator depends on these -// unary_operator and binary_operator specializations. 'preset' -// specializations conform to the canonical operator rules modeled -// by the behavior of integers and pointers: -// -// Prefix -, + and ~ accept constant arguments and return an -// object by value. -// -// The ! accept constant arguments and returns a boolean -// result. -// -// The & (address-of), * (dereference) both return a reference -// to an object. -// -// Prefix ++ returns a reference to its mutable argument after -// it is incremented. -// -// Postfix ++ returns the mutable argument by value before it -// is incremented. -// -// The += and its family accept mutable right hand side (rhs) -// operand and return a reference to the rhs operand. -// -// Infix + and its family accept constant arguments and return -// an object by value. -// -// The == and its family accept constant arguments and return a -// boolean result. -// -// Operators && and || accept constant arguments and return a -// boolean result and are short circuit evaluated as expected. -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Operator tags -// -// Each C++ operator has a corresponding tag type. This is -// used as a means for specializing the unary_operator and -// binary_operator (see below). The tag also serves as the -// lazy operator type compatible as a composite operation -// see (composite.hpp). -// -/////////////////////////////////////////////////////////////////////////////// - -// Unary operator tags - -struct negative_op; struct positive_op; -struct logical_not_op; struct invert_op; -struct reference_op; struct dereference_op; -struct pre_incr_op; struct pre_decr_op; -struct post_incr_op; struct post_decr_op; - -// Binary operator tags - -struct assign_op; struct index_op; -struct plus_assign_op; struct minus_assign_op; -struct times_assign_op; struct divide_assign_op; struct mod_assign_op; -struct and_assign_op; struct or_assign_op; struct xor_assign_op; -struct shift_l_assign_op; struct shift_r_assign_op; - -struct plus_op; struct minus_op; -struct times_op; struct divide_op; struct mod_op; -struct and_op; struct or_op; struct xor_op; -struct shift_l_op; struct shift_r_op; - -struct eq_op; struct not_eq_op; -struct lt_op; struct lt_eq_op; -struct gt_op; struct gt_eq_op; -struct logical_and_op; struct logical_or_op; - -/////////////////////////////////////////////////////////////////////////////// -// -// unary_operator<TagT, T> -// -// The unary_operator class implements most of the C++ unary -// operators. Each specialization is basically a simple static eval -// function plus a result_type typedef that determines the return -// type of the eval function. -// -// TagT is one of the unary operator tags above and T is the data -// type (argument) involved in the operation. -// -// Only the behavior of C/C++ built-in types are taken into account -// in the specializations provided below. For user-defined types, -// these specializations may still be used provided that the -// operator overloads of such types adhere to the standard behavior -// of built-in types. -// -// T1 separate special_ops.hpp file implements more stl savvy -// specializations. Other more specialized unary_operator -// implementations may be defined by the client for specific -// unary operator tags/data types. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename TagT, typename T> -struct unary_operator; - -////////////////////////////////// -template <typename T> -struct unary_operator<negative_op, T> { - - typedef T const result_type; - static result_type eval(T const& v) - { return -v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<positive_op, T> { - - typedef T const result_type; - static result_type eval(T const& v) - { return +v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<logical_not_op, T> { - - typedef bool result_type; - static result_type eval(T const& v) - { return !v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<invert_op, T> { - - typedef T const result_type; - static result_type eval(T const& v) - { return ~v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<reference_op, T> { - - typedef T* result_type; - static result_type eval(T& v) - { return &v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<dereference_op, T*> { - - typedef T& result_type; - static result_type eval(T* v) - { return *v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<dereference_op, T* const> { - - typedef T& result_type; - static result_type eval(T* const v) - { return *v; } -}; - -////////////////////////////////// -template <> -struct unary_operator<dereference_op, nil_t> { - - // G++ eager template instantiation - // somehow requires this. - typedef nil_t result_type; -}; - -////////////////////////////////// -#ifndef __BORLANDC__ -template <> -struct unary_operator<dereference_op, nil_t const> { - - // G++ eager template instantiation - // somehow requires this. - typedef nil_t result_type; -}; -#endif - -////////////////////////////////// -template <typename T> -struct unary_operator<pre_incr_op, T> { - - typedef T& result_type; - static result_type eval(T& v) - { return ++v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<pre_decr_op, T> { - - typedef T& result_type; - static result_type eval(T& v) - { return --v; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<post_incr_op, T> { - - typedef T const result_type; - static result_type eval(T& v) - { T t(v); ++v; return t; } -}; - -////////////////////////////////// -template <typename T> -struct unary_operator<post_decr_op, T> { - - typedef T const result_type; - static result_type eval(T& v) - { T t(v); --v; return t; } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// rank<T> -// -// rank<T> class has a static int constant 'value' that defines the -// absolute rank of a type. rank<T> is used to choose the result -// type of binary operators such as +. The type with the higher -// rank wins and is used as the operator's return type. T1 generic -// user defined type has a very high rank and always wins when -// compared against a user defined type. If this is not desireable, -// one can write a rank specialization for the type. -// -// Take note that ranks 0..9999 are reserved for the framework. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -struct rank { static int const value = INT_MAX; }; - -template <> struct rank<void> { static int const value = 0; }; -template <> struct rank<bool> { static int const value = 10; }; - -template <> struct rank<char> { static int const value = 20; }; -template <> struct rank<signed char> { static int const value = 20; }; -template <> struct rank<unsigned char> { static int const value = 30; }; -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) -template <> struct rank<wchar_t> { static int const value = 40; }; -#endif // !defined(BOOST_NO_INTRINSIC_WCHAR_T) - -template <> struct rank<short> { static int const value = 50; }; -template <> struct rank<unsigned short> { static int const value = 60; }; - -template <> struct rank<int> { static int const value = 70; }; -template <> struct rank<unsigned int> { static int const value = 80; }; - -template <> struct rank<long> { static int const value = 90; }; -template <> struct rank<unsigned long> { static int const value = 100; }; - -#ifdef BOOST_HAS_LONG_LONG -template <> struct rank< ::boost::long_long_type> { static int const value = 110; }; -template <> struct rank< ::boost::ulong_long_type> { static int const value = 120; }; -#endif - -template <> struct rank<float> { static int const value = 130; }; -template <> struct rank<double> { static int const value = 140; }; -template <> struct rank<long double> { static int const value = 150; }; - -template <typename T> struct rank<T*> -{ static int const value = 160; }; - -template <typename T> struct rank<T* const> -{ static int const value = 160; }; - -template <typename T, int N> struct rank<T[N]> -{ static int const value = 160; }; - -/////////////////////////////////////////////////////////////////////////////// -// -// higher_rank<T0, T1> -// -// Chooses the type (T0 or T1) with the higher rank. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T0, typename T1> -struct higher_rank { - typedef typename boost::mpl::if_c< - rank<T0>::value < rank<T1>::value, - T1, T0>::type type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// binary_operator<TagT, T0, T1> -// -// The binary_operator class implements most of the C++ binary -// operators. Each specialization is basically a simple static eval -// function plus a result_type typedef that determines the return -// type of the eval function. -// -// TagT is one of the binary operator tags above T0 and T1 are the -// (arguments') data types involved in the operation. -// -// Only the behavior of C/C++ built-in types are taken into account -// in the specializations provided below. For user-defined types, -// these specializations may still be used provided that the -// operator overloads of such types adhere to the standard behavior -// of built-in types. -// -// T1 separate special_ops.hpp file implements more stl savvy -// specializations. Other more specialized unary_operator -// implementations may be defined by the client for specific -// unary operator tags/data types. -// -// All binary_operator except the logical_and_op and logical_or_op -// have an eval static function that carries out the actual operation. -// The logical_and_op and logical_or_op d are special because these -// two operators are short-circuit evaluated. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename TagT, typename T0, typename T1> -struct binary_operator; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs = rhs; } -}; - -////////////////////////////////// -template <typename T1> -struct binary_operator<index_op, nil_t, T1> { - - // G++ eager template instantiation - // somehow requires this. - typedef nil_t result_type; -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<index_op, T0*, T1> { - - typedef T0& result_type; - static result_type eval(T0* ptr, T1 const& index) - { return ptr[index]; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<index_op, T0* const, T1> { - - typedef T0& result_type; - static result_type eval(T0* const ptr, T1 const& index) - { return ptr[index]; } -}; - -////////////////////////////////// -template <typename T0, int N, typename T1> -struct binary_operator<index_op, T0[N], T1> { - - typedef T0& result_type; - static result_type eval(T0* ptr, T1 const& index) - { return ptr[index]; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<plus_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs += rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<minus_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs -= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<times_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs *= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<divide_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs /= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<mod_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs %= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<and_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs &= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<or_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs |= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<xor_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs ^= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<shift_l_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs <<= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<shift_r_assign_op, T0, T1> { - - typedef T0& result_type; - static result_type eval(T0& lhs, T1 const& rhs) - { return lhs >>= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<plus_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs + rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<minus_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs - rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<times_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs * rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<divide_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs / rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<mod_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs % rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<and_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs & rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<or_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs | rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<xor_op, T0, T1> { - - typedef typename higher_rank<T0, T1>::type const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs ^ rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<shift_l_op, T0, T1> { - - typedef T0 const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs << rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<shift_r_op, T0, T1> { - - typedef T0 const result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs >> rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<eq_op, T0, T1> { - - typedef bool result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs == rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<not_eq_op, T0, T1> { - - typedef bool result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs != rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<lt_op, T0, T1> { - - typedef bool result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs < rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<lt_eq_op, T0, T1> { - - typedef bool result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs <= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<gt_op, T0, T1> { - - typedef bool result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs > rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<gt_eq_op, T0, T1> { - - typedef bool result_type; - static result_type eval(T0 const& lhs, T1 const& rhs) - { return lhs >= rhs; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<logical_and_op, T0, T1> { - - typedef bool result_type; - // no eval function, see comment above. -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<logical_or_op, T0, T1> { - - typedef bool result_type; - // no eval function, see comment above. -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// negative lazy operator (prefix -) -// -/////////////////////////////////////////////////////////////////////////////// -struct negative_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<negative_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<negative_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<negative_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<negative_op, BaseT>::type -operator-(actor<BaseT> const& _0) -{ - return impl::make_unary<negative_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// positive lazy operator (prefix +) -// -/////////////////////////////////////////////////////////////////////////////// -struct positive_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<positive_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<positive_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<positive_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<positive_op, BaseT>::type -operator+(actor<BaseT> const& _0) -{ - return impl::make_unary<positive_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// logical not lazy operator (prefix !) -// -/////////////////////////////////////////////////////////////////////////////// -struct logical_not_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<logical_not_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<logical_not_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<logical_not_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<logical_not_op, BaseT>::type -operator!(actor<BaseT> const& _0) -{ - return impl::make_unary<logical_not_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// invert lazy operator (prefix ~) -// -/////////////////////////////////////////////////////////////////////////////// -struct invert_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<invert_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<invert_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<invert_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<invert_op, BaseT>::type -operator~(actor<BaseT> const& _0) -{ - return impl::make_unary<invert_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// reference lazy operator (prefix &) -// -/////////////////////////////////////////////////////////////////////////////// -struct reference_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<reference_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<reference_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<reference_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<reference_op, BaseT>::type -operator&(actor<BaseT> const& _0) -{ - return impl::make_unary<reference_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// dereference lazy operator (prefix *) -// -/////////////////////////////////////////////////////////////////////////////// -struct dereference_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<dereference_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<dereference_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<dereference_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<dereference_op, BaseT>::type -operator*(actor<BaseT> const& _0) -{ - return impl::make_unary<dereference_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// pre increment lazy operator (prefix ++) -// -/////////////////////////////////////////////////////////////////////////////// -struct pre_incr_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<pre_incr_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<pre_incr_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<pre_incr_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<pre_incr_op, BaseT>::type -operator++(actor<BaseT> const& _0) -{ - return impl::make_unary<pre_incr_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// pre decrement lazy operator (prefix --) -// -/////////////////////////////////////////////////////////////////////////////// -struct pre_decr_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<pre_decr_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<pre_decr_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<pre_decr_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<pre_decr_op, BaseT>::type -operator--(actor<BaseT> const& _0) -{ - return impl::make_unary<pre_decr_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// post increment lazy operator (postfix ++) -// -/////////////////////////////////////////////////////////////////////////////// -struct post_incr_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<post_incr_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<post_incr_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<post_incr_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<post_incr_op, BaseT>::type -operator++(actor<BaseT> const& _0, int) -{ - return impl::make_unary<post_incr_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// post decrement lazy operator (postfix --) -// -/////////////////////////////////////////////////////////////////////////////// -struct post_decr_op { - - template <typename T0> - struct result { - - typedef typename unary_operator<post_decr_op, T0>::result_type type; - }; - - template <typename T0> - typename unary_operator<post_decr_op, T0>::result_type - operator()(T0& _0) const - { return unary_operator<post_decr_op, T0>::eval(_0); } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_unary<post_decr_op, BaseT>::type -operator--(actor<BaseT> const& _0, int) -{ - return impl::make_unary<post_decr_op, BaseT>::construct(_0); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// assignment lazy operator (infix =) -// The acual lazy operator is a member of the actor class. -// -/////////////////////////////////////////////////////////////////////////////// -struct assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT> -template <typename B> -inline typename impl::make_binary1<assign_op, BaseT, B>::type -actor<BaseT>::operator=(B const& _1) const -{ - return impl::make_binary1<assign_op, BaseT, B>::construct(*this, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// index lazy operator (array index []) -// The acual lazy operator is a member of the actor class. -// -/////////////////////////////////////////////////////////////////////////////// -struct index_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<index_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<index_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<index_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT> -template <typename B> -inline typename impl::make_binary1<index_op, BaseT, B>::type -actor<BaseT>::operator[](B const& _1) const -{ - return impl::make_binary1<index_op, BaseT, B>::construct(*this, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// plus assign lazy operator (infix +=) -// -/////////////////////////////////////////////////////////////////////////////// -struct plus_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<plus_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<plus_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<plus_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<plus_assign_op, BaseT, T1>::type -operator+=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<plus_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// minus assign lazy operator (infix -=) -// -/////////////////////////////////////////////////////////////////////////////// -struct minus_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<minus_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<minus_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<minus_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<minus_assign_op, BaseT, T1>::type -operator-=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<minus_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// times assign lazy operator (infix *=) -// -/////////////////////////////////////////////////////////////////////////////// -struct times_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<times_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<times_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<times_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<times_assign_op, BaseT, T1>::type -operator*=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<times_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// divide assign lazy operator (infix /=) -// -/////////////////////////////////////////////////////////////////////////////// -struct divide_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<divide_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<divide_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<divide_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<divide_assign_op, BaseT, T1>::type -operator/=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<divide_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// mod assign lazy operator (infix %=) -// -/////////////////////////////////////////////////////////////////////////////// -struct mod_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<mod_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<mod_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<mod_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<mod_assign_op, BaseT, T1>::type -operator%=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<mod_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// and assign lazy operator (infix &=) -// -/////////////////////////////////////////////////////////////////////////////// -struct and_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<and_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<and_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<and_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<and_assign_op, BaseT, T1>::type -operator&=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<and_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// or assign lazy operator (infix |=) -// -/////////////////////////////////////////////////////////////////////////////// -struct or_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<or_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<or_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<or_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<or_assign_op, BaseT, T1>::type -operator|=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<or_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// xor assign lazy operator (infix ^=) -// -/////////////////////////////////////////////////////////////////////////////// -struct xor_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<xor_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<xor_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<xor_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<xor_assign_op, BaseT, T1>::type -operator^=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<xor_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// shift left assign lazy operator (infix <<=) -// -/////////////////////////////////////////////////////////////////////////////// -struct shift_l_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<shift_l_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<shift_l_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<shift_l_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<shift_l_assign_op, BaseT, T1>::type -operator<<=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<shift_l_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// shift right assign lazy operator (infix >>=) -// -/////////////////////////////////////////////////////////////////////////////// -struct shift_r_assign_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<shift_r_assign_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<shift_r_assign_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<shift_r_assign_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<shift_r_assign_op, BaseT, T1>::type -operator>>=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<shift_r_assign_op, BaseT, T1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// plus lazy operator (infix +) -// -/////////////////////////////////////////////////////////////////////////////// -struct plus_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<plus_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<plus_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<plus_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<plus_op, BaseT, T1>::type -operator+(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<plus_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<plus_op, T0, BaseT>::type -operator+(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<plus_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<plus_op, BaseT0, BaseT1>::type -operator+(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<plus_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// minus lazy operator (infix -) -// -/////////////////////////////////////////////////////////////////////////////// -struct minus_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<minus_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<minus_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<minus_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<minus_op, BaseT, T1>::type -operator-(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<minus_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<minus_op, T0, BaseT>::type -operator-(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<minus_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<minus_op, BaseT0, BaseT1>::type -operator-(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<minus_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// times lazy operator (infix *) -// -/////////////////////////////////////////////////////////////////////////////// -struct times_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<times_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<times_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<times_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<times_op, BaseT, T1>::type -operator*(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<times_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<times_op, T0, BaseT>::type -operator*(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<times_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<times_op, BaseT0, BaseT1>::type -operator*(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<times_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// divide lazy operator (infix /) -// -/////////////////////////////////////////////////////////////////////////////// -struct divide_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<divide_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<divide_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<divide_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<divide_op, BaseT, T1>::type -operator/(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<divide_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<divide_op, T0, BaseT>::type -operator/(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<divide_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<divide_op, BaseT0, BaseT1>::type -operator/(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<divide_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// mod lazy operator (infix %) -// -/////////////////////////////////////////////////////////////////////////////// -struct mod_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<mod_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<mod_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<mod_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<mod_op, BaseT, T1>::type -operator%(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<mod_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<mod_op, T0, BaseT>::type -operator%(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<mod_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<mod_op, BaseT0, BaseT1>::type -operator%(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<mod_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// and lazy operator (infix &) -// -/////////////////////////////////////////////////////////////////////////////// -struct and_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<and_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<and_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<and_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<and_op, BaseT, T1>::type -operator&(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<and_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<and_op, T0, BaseT>::type -operator&(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<and_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<and_op, BaseT0, BaseT1>::type -operator&(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<and_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// or lazy operator (infix |) -// -/////////////////////////////////////////////////////////////////////////////// -struct or_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<or_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<or_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<or_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<or_op, BaseT, T1>::type -operator|(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<or_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<or_op, T0, BaseT>::type -operator|(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<or_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<or_op, BaseT0, BaseT1>::type -operator|(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<or_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// xor lazy operator (infix ^) -// -/////////////////////////////////////////////////////////////////////////////// -struct xor_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<xor_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<xor_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<xor_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<xor_op, BaseT, T1>::type -operator^(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<xor_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<xor_op, T0, BaseT>::type -operator^(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<xor_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<xor_op, BaseT0, BaseT1>::type -operator^(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<xor_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// shift left lazy operator (infix <<) -// -/////////////////////////////////////////////////////////////////////////////// -struct shift_l_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<shift_l_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<shift_l_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<shift_l_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<shift_l_op, BaseT, T1>::type -operator<<(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<shift_l_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<shift_l_op, T0, BaseT>::type -operator<<(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<shift_l_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<shift_l_op, BaseT0, BaseT1>::type -operator<<(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<shift_l_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// shift right lazy operator (infix >>) -// -/////////////////////////////////////////////////////////////////////////////// -struct shift_r_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<shift_r_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<shift_r_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<shift_r_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<shift_r_op, BaseT, T1>::type -operator>>(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<shift_r_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<shift_r_op, T0, BaseT>::type -operator>>(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<shift_r_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<shift_r_op, BaseT0, BaseT1>::type -operator>>(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<shift_r_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// equal lazy operator (infix ==) -// -/////////////////////////////////////////////////////////////////////////////// -struct eq_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<eq_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<eq_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<eq_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<eq_op, BaseT, T1>::type -operator==(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<eq_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<eq_op, T0, BaseT>::type -operator==(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<eq_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<eq_op, BaseT0, BaseT1>::type -operator==(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<eq_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// not equal lazy operator (infix !=) -// -/////////////////////////////////////////////////////////////////////////////// -struct not_eq_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<not_eq_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<not_eq_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<not_eq_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<not_eq_op, BaseT, T1>::type -operator!=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<not_eq_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<not_eq_op, T0, BaseT>::type -operator!=(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<not_eq_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<not_eq_op, BaseT0, BaseT1>::type -operator!=(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<not_eq_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// less than lazy operator (infix <) -// -/////////////////////////////////////////////////////////////////////////////// -struct lt_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<lt_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<lt_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<lt_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<lt_op, BaseT, T1>::type -operator<(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<lt_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<lt_op, T0, BaseT>::type -operator<(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<lt_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<lt_op, BaseT0, BaseT1>::type -operator<(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<lt_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// less than equal lazy operator (infix <=) -// -/////////////////////////////////////////////////////////////////////////////// -struct lt_eq_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<lt_eq_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<lt_eq_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<lt_eq_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<lt_eq_op, BaseT, T1>::type -operator<=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<lt_eq_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<lt_eq_op, T0, BaseT>::type -operator<=(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<lt_eq_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<lt_eq_op, BaseT0, BaseT1>::type -operator<=(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<lt_eq_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// greater than lazy operator (infix >) -// -/////////////////////////////////////////////////////////////////////////////// -struct gt_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<gt_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<gt_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<gt_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<gt_op, BaseT, T1>::type -operator>(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<gt_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<gt_op, T0, BaseT>::type -operator>(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<gt_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<gt_op, BaseT0, BaseT1>::type -operator>(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<gt_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// greater than equal lazy operator (infix >=) -// -/////////////////////////////////////////////////////////////////////////////// -struct gt_eq_op { - - template <typename T0, typename T1> - struct result { - - typedef typename binary_operator<gt_eq_op, T0, T1> - ::result_type type; - }; - - template <typename T0, typename T1> - typename binary_operator<gt_eq_op, T0, T1>::result_type - operator()(T0& _0, T1& _1) const - { return binary_operator<gt_eq_op, T0, T1>::eval(_0, _1); } -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline typename impl::make_binary1<gt_eq_op, BaseT, T1>::type -operator>=(actor<BaseT> const& _0, T1 CREF _1) -{ - return impl::make_binary1<gt_eq_op, BaseT, T1>::construct(_0, _1); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline typename impl::make_binary2<gt_eq_op, T0, BaseT>::type -operator>=(T0 CREF _0, actor<BaseT> const& _1) -{ - return impl::make_binary2<gt_eq_op, T0, BaseT>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline typename impl::make_binary3<gt_eq_op, BaseT0, BaseT1>::type -operator>=(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return impl::make_binary3<gt_eq_op, BaseT0, BaseT1>::construct(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// logical and lazy operator (infix &&) -// -// The logical_and_composite class and its corresponding generators are -// provided to allow short-circuit evaluation of the operator's -// operands. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A0, typename A1> -struct logical_and_composite { - - typedef logical_and_composite<A0, A1> self_t; - - template <typename TupleT> - struct result { - - typedef typename binary_operator<logical_and_op, - typename actor_result<A0, TupleT>::plain_type, - typename actor_result<A1, TupleT>::plain_type - >::result_type type; - }; - - logical_and_composite(A0 const& _0, A1 const& _1) - : a0(_0), a1(_1) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - return a0.eval(args) && a1.eval(args); - } - - A0 a0; A1 a1; // actors -}; - -#if !(defined(__ICL) && __ICL <= 500) -////////////////////////////////// -template <typename BaseT, typename T1> -inline actor<logical_and_composite -<actor<BaseT>, typename as_actor<T1>::type> > -operator&&(actor<BaseT> const& _0, T1 CREF _1) -{ - return logical_and_composite - <actor<BaseT>, typename as_actor<T1>::type> - (_0, as_actor<T1>::convert(_1)); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline actor<logical_and_composite -<typename as_actor<T0>::type, actor<BaseT> > > -operator&&(T0 CREF _0, actor<BaseT> const& _1) -{ - return logical_and_composite - <typename as_actor<T0>::type, actor<BaseT> > - (as_actor<T0>::convert(_0), _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline actor<logical_and_composite -<actor<BaseT0>, actor<BaseT1> > > -operator&&(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return logical_and_composite - <actor<BaseT0>, actor<BaseT1> > - (_0, _1); -} -#else -////////////////////////////////// -template <typename T0, typename T1> -inline actor<logical_and_composite -<typename as_actor<T0>::type, typename as_actor<T1>::type> > -operator&&(T0 CREF _0, T1 CREF _1) -{ - return logical_and_composite - <typename as_actor<T0>::type, typename as_actor<T1>::type> - (as_actor<T0>::convert(_0), as_actor<T1>::convert(_1)); -} -#endif // !(__ICL && __ICL <= 500) - -/////////////////////////////////////////////////////////////////////////////// -// -// logical or lazy operator (infix ||) -// -// The logical_or_composite class and its corresponding generators are -// provided to allow short-circuit evaluation of the operator's -// operands. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A0, typename A1> -struct logical_or_composite { - - typedef logical_or_composite<A0, A1> self_t; - - template <typename TupleT> - struct result { - - typedef typename binary_operator<logical_or_op, - typename actor_result<A0, TupleT>::plain_type, - typename actor_result<A1, TupleT>::plain_type - >::result_type type; - }; - - logical_or_composite(A0 const& _0, A1 const& _1) - : a0(_0), a1(_1) {} - - template <typename TupleT> - typename actor_result<self_t, TupleT>::type - eval(TupleT const& args) const - { - return a0.eval(args) || a1.eval(args); - } - - A0 a0; A1 a1; // actors -}; - -////////////////////////////////// -template <typename BaseT, typename T1> -inline actor<logical_or_composite -<actor<BaseT>, typename as_actor<T1>::type> > -operator||(actor<BaseT> const& _0, T1 CREF _1) -{ - return logical_or_composite - <actor<BaseT>, typename as_actor<T1>::type> - (_0, as_actor<T1>::convert(_1)); -} - -////////////////////////////////// -template <typename T0, typename BaseT> -inline actor<logical_or_composite -<typename as_actor<T0>::type, actor<BaseT> > > -operator||(T0 CREF _0, actor<BaseT> const& _1) -{ - return logical_or_composite - <typename as_actor<T0>::type, actor<BaseT> > - (as_actor<T0>::convert(_0), _1); -} - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline actor<logical_or_composite -<actor<BaseT0>, actor<BaseT1> > > -operator||(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return logical_or_composite - <actor<BaseT0>, actor<BaseT1> > - (_0, _1); -} - -} // namespace phoenix - -#undef CREF -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/primitives.hpp b/Utilities/BGL/boost/spirit/phoenix/primitives.hpp deleted file mode 100644 index 16d5925ea7c4c3165387df1e055d18be2e3677ad..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/primitives.hpp +++ /dev/null @@ -1,248 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_PRIMITIVES_HPP -#define PHOENIX_PRIMITIVES_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/actor.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// argument class -// -// Lazy arguments -// -// An actor base class that extracts and returns the Nth argument -// from the argument list passed in the 'args' tuple in the eval -// member function (see actor.hpp). There are some predefined -// argument constants that can be used as actors (arg1..argN). -// -// The argument actor is a place-holder for the actual arguments -// passed by the client. For example, wherever arg1 is seen placed -// in a lazy function (see functions.hpp) or lazy operator (see -// operators.hpp), this will be replaced by the actual first -// argument in the actual function evaluation. Argument actors are -// essentially lazy arguments. A lazy argument is a full actor in -// its own right and can be evaluated through the actor's operator(). -// -// Example: -// -// char c = 'A'; -// int i = 123; -// const char* s = "Hello World"; -// -// cout << arg1(c) << ' '; -// cout << arg1(i, s) << ' '; -// cout << arg2(i, s) << ' '; -// -// will print out "A 123 Hello World" -// -/////////////////////////////////////////////////////////////////////////////// -template <int N> -struct argument { - - template <typename TupleT> - struct result { typedef typename tuple_element<N, TupleT>::type type; }; - - template <typename TupleT> - typename tuple_element<N, TupleT>::type - eval(TupleT const& args) const - { - return args[tuple_index<N>()]; - } -}; - -////////////////////////////////// -actor<argument<0> > const arg1 = argument<0>(); -actor<argument<1> > const arg2 = argument<1>(); -actor<argument<2> > const arg3 = argument<2>(); - -#if PHOENIX_LIMIT > 3 -actor<argument<3> > const arg4 = argument<3>(); -actor<argument<4> > const arg5 = argument<4>(); -actor<argument<5> > const arg6 = argument<5>(); - -#if PHOENIX_LIMIT > 6 -actor<argument<6> > const arg7 = argument<6>(); -actor<argument<7> > const arg8 = argument<7>(); -actor<argument<8> > const arg9 = argument<8>(); - -#if PHOENIX_LIMIT > 9 -actor<argument<9> > const arg10 = argument<9>(); -actor<argument<10> > const arg11 = argument<10>(); -actor<argument<11> > const arg12 = argument<11>(); - -#if PHOENIX_LIMIT > 12 -actor<argument<12> > const arg13 = argument<12>(); -actor<argument<13> > const arg14 = argument<13>(); -actor<argument<14> > const arg15 = argument<14>(); - -#endif -#endif -#endif -#endif -/////////////////////////////////////////////////////////////////////////////// -// -// value class -// -// Lazy values -// -// A bound actual parameter is kept in a value class for deferred -// access later when needed. A value object is immutable. Value -// objects are typically created through the val(x) free function -// which returns a value<T> with T deduced from the type of x. x is -// held in the value<T> object by value. -// -// Lazy values are actors. As such, lazy values can be evaluated -// through the actor's operator(). Such invocation gives the value's -// identity. Example: -// -// cout << val(3)() << val("Hello World")(); -// -// prints out "3 Hello World" -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -struct value { - - typedef typename boost::remove_reference<T>::type plain_t; - - template <typename TupleT> - struct result { typedef plain_t const type; }; - - value(plain_t val_) - : val(val_) {} - - template <typename TupleT> - plain_t const - eval(TupleT const& /*args*/) const - { - return val; - } - - plain_t val; -}; - -////////////////////////////////// -template <typename T> -inline actor<value<T> > const -val(T v) -{ - return value<T>(v); -} - -////////////////////////////////// -template <typename BaseT> -void -val(actor<BaseT> const& v); // This is undefined and not allowed. - -/////////////////////////////////////////////////////////////////////////// -// -// Arbitrary types T are typically converted to a actor<value<T> > -// (see as_actor<T> in actor.hpp). A specialization is also provided -// for arrays. T[N] arrays are converted to actor<value<T const*> >. -// -/////////////////////////////////////////////////////////////////////////// -template <typename T> -struct as_actor { - - typedef actor<value<T> > type; - static type convert(T const& x) - { return value<T>(x); } -}; - -////////////////////////////////// -template <typename T, int N> -struct as_actor<T[N]> { - - typedef actor<value<T const*> > type; - static type convert(T const x[N]) - { return value<T const*>(x); } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// variable class -// -// Lazy variables -// -// A bound actual parameter may also be held by non-const reference -// in a variable class for deferred access later when needed. A -// variable object is mutable, i.e. its referenced variable can be -// modified. Variable objects are typically created through the -// var(x) free function which returns a variable<T> with T deduced -// from the type of x. x is held in the value<T> object by -// reference. -// -// Lazy variables are actors. As such, lazy variables can be -// evaluated through the actor's operator(). Such invocation gives -// the variables's identity. Example: -// -// int i = 3; -// char const* s = "Hello World"; -// cout << var(i)() << var(s)(); -// -// prints out "3 Hello World" -// -// Another free function const_(x) may also be used. const_(x) creates -// a variable<T const&> object using a constant reference. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -struct variable { - - template <typename TupleT> - struct result { typedef T& type; }; - - variable(T& var_) - : var(var_) {} - - template <typename TupleT> - T& - eval(TupleT const& /*args*/) const - { - return var; - } - - T& var; -}; - -////////////////////////////////// -template <typename T> -inline actor<variable<T> > const -var(T& v) -{ - return variable<T>(v); -} - -////////////////////////////////// -template <typename T> -inline actor<variable<T const> > const -const_(T const& v) -{ - return variable<T const>(v); -} - -////////////////////////////////// -template <typename BaseT> -void -var(actor<BaseT> const& v); // This is undefined and not allowed. - -////////////////////////////////// -template <typename BaseT> -void -const_(actor<BaseT> const& v); // This is undefined and not allowed. - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/special_ops.hpp b/Utilities/BGL/boost/spirit/phoenix/special_ops.hpp deleted file mode 100644 index 47cd9470b7a70eb2602b8d114c095502ea3230de..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/special_ops.hpp +++ /dev/null @@ -1,342 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_SPECIAL_OPS_HPP -#define PHOENIX_SPECIAL_OPS_HPP - -#include <boost/config.hpp> -#ifdef BOOST_NO_STRINGSTREAM -#include <strstream> -#define PHOENIX_SSTREAM strstream -#else -#include <sstream> -#define PHOENIX_SSTREAM stringstream -#endif - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/operators.hpp> -#include <iosfwd> - -/////////////////////////////////////////////////////////////////////////////// -#if defined(_STLPORT_VERSION) && defined(__STL_USE_OWN_NAMESPACE) -#define PHOENIX_STD _STLP_STD -#define PHOENIX_NO_STD_NAMESPACE -#else -#define PHOENIX_STD std -#endif - -/////////////////////////////////////////////////////////////////////////////// -//#if !defined(PHOENIX_NO_STD_NAMESPACE) -namespace PHOENIX_STD -{ -//#endif - - template<typename T> class complex; - -//#if !defined(PHOENIX_NO_STD_NAMESPACE) -} -//#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix -{ - -/////////////////////////////////////////////////////////////////////////////// -// -// The following specializations take into account the C++ standard -// library components. There are a couple of issues that have to be -// dealt with to enable lazy operator overloads for the standard -// library classes. -// -// *iostream (e.g. cout, cin, strstream/ stringstream) uses non- -// canonical shift operator overloads where the lhs is taken in -// by reference. -// -// *I/O manipulators overloads for the RHS of the << and >> -// operators. -// -// *STL iterators can be objects that conform to pointer semantics. -// Some operators need to be specialized for these. -// -// *std::complex is given a rank (see rank class in operators.hpp) -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// specialization for rank<std::complex> -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> struct rank<PHOENIX_STD::complex<T> > -{ static int const value = 170 + rank<T>::value; }; - -/////////////////////////////////////////////////////////////////////////////// -// -// specializations for std::istream -// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) - #if defined(_STLPORT_VERSION) - #define PHOENIX_ISTREAM _IO_istream_withassign - #else - #define PHOENIX_ISTREAM PHOENIX_STD::_IO_istream_withassign - #endif -#else -// #if (defined(__ICL) && defined(_STLPORT_VERSION)) -// #define PHOENIX_ISTREAM istream_withassign -// #else - #define PHOENIX_ISTREAM PHOENIX_STD::istream -// #endif -#endif - -////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) -// || (defined(__ICL) && defined(_STLPORT_VERSION)) -template <typename T1> -struct binary_operator<shift_r_op, PHOENIX_ISTREAM, T1> -{ - typedef PHOENIX_STD::istream& result_type; - static result_type eval(PHOENIX_STD::istream& out, T1& rhs) - { return out >> rhs; } -}; -#endif - -////////////////////////////////// -template <typename T1> -struct binary_operator<shift_r_op, PHOENIX_STD::istream, T1> -{ - typedef PHOENIX_STD::istream& result_type; - static result_type eval(PHOENIX_STD::istream& out, T1& rhs) - { return out >> rhs; } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary3 - <shift_r_op, variable<PHOENIX_ISTREAM>, BaseT>::type -operator>>(PHOENIX_ISTREAM& _0, actor<BaseT> const& _1) -{ - return impl::make_binary3 - <shift_r_op, variable<PHOENIX_ISTREAM>, BaseT> - ::construct(var(_0), _1); -} - -#undef PHOENIX_ISTREAM -/////////////////////////////////////////////////////////////////////////////// -// -// specializations for std::ostream -// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) - #if defined(_STLPORT_VERSION) - #define PHOENIX_OSTREAM _IO_ostream_withassign - #else - #define PHOENIX_OSTREAM PHOENIX_STD::_IO_ostream_withassign - #endif -#else -// #if (defined(__ICL) && defined(_STLPORT_VERSION)) -// #define PHOENIX_OSTREAM ostream_withassign -// #else - #define PHOENIX_OSTREAM PHOENIX_STD::ostream -// #endif -#endif - -////////////////////////////////// -#if defined(__GNUC__) && (__GNUC__ < 3) -// || (defined(__ICL) && defined(_STLPORT_VERSION)) -template <typename T1> -struct binary_operator<shift_l_op, PHOENIX_OSTREAM, T1> -{ - typedef PHOENIX_STD::ostream& result_type; - static result_type eval(PHOENIX_STD::ostream& out, T1 const& rhs) - { return out << rhs; } -}; -#endif - -////////////////////////////////// -template <typename T1> -struct binary_operator<shift_l_op, PHOENIX_STD::ostream, T1> -{ - typedef PHOENIX_STD::ostream& result_type; - static result_type eval(PHOENIX_STD::ostream& out, T1 const& rhs) - { return out << rhs; } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary3 - <shift_l_op, variable<PHOENIX_OSTREAM>, BaseT>::type -operator<<(PHOENIX_OSTREAM& _0, actor<BaseT> const& _1) -{ - return impl::make_binary3 - <shift_l_op, variable<PHOENIX_OSTREAM>, BaseT> - ::construct(var(_0), _1); -} - -#undef PHOENIX_OSTREAM - -/////////////////////////////////////////////////////////////////////////////// -// -// specializations for std::strstream / stringstream -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T1> -struct binary_operator<shift_r_op, PHOENIX_STD::PHOENIX_SSTREAM, T1> -{ - typedef PHOENIX_STD::istream& result_type; - static result_type eval(PHOENIX_STD::istream& out, T1& rhs) - { return out >> rhs; } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary3 - <shift_r_op, variable<PHOENIX_STD::PHOENIX_SSTREAM>, BaseT>::type -operator>>(PHOENIX_STD::PHOENIX_SSTREAM& _0, actor<BaseT> const& _1) -{ - return impl::make_binary3 - <shift_r_op, variable<PHOENIX_STD::PHOENIX_SSTREAM>, BaseT> - ::construct(var(_0), _1); -} - -////////////////////////////////// -template <typename T1> -struct binary_operator<shift_l_op, PHOENIX_STD::PHOENIX_SSTREAM, T1> -{ - typedef PHOENIX_STD::ostream& result_type; - static result_type eval(PHOENIX_STD::ostream& out, T1 const& rhs) - { return out << rhs; } -}; - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary3 - <shift_l_op, variable<PHOENIX_STD::PHOENIX_SSTREAM>, BaseT>::type -operator<<(PHOENIX_STD::PHOENIX_SSTREAM& _0, actor<BaseT> const& _1) -{ - return impl::make_binary3 - <shift_l_op, variable<PHOENIX_STD::PHOENIX_SSTREAM>, BaseT> - ::construct(var(_0), _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// I/O manipulator specializations -// -/////////////////////////////////////////////////////////////////////////////// -#if (!defined(__GNUC__) || (__GNUC__ > 2)) -// && !(defined(__ICL) && defined(_STLPORT_VERSION)) - -typedef PHOENIX_STD::ios_base& (*iomanip_t)(PHOENIX_STD::ios_base&); -typedef PHOENIX_STD::istream& (*imanip_t)(PHOENIX_STD::istream&); -typedef PHOENIX_STD::ostream& (*omanip_t)(PHOENIX_STD::ostream&); - -#if defined(__BORLANDC__) - -/////////////////////////////////////////////////////////////////////////////// -// -// Borland does not like i/o manipulators functions such as endl to -// be the rhs of a lazy << operator (Borland incorrectly reports -// ambiguity). To get around the problem, we provide function -// pointer versions of the same name with a single trailing -// underscore. -// -// You can use the same trick for other i/o manipulators. -// Alternatively, you can prefix the manipulator with a '&' -// operator. Example: -// -// cout << arg1 << &endl -// -/////////////////////////////////////////////////////////////////////////////// - -imanip_t ws_ = &PHOENIX_STD::ws; -iomanip_t dec_ = &PHOENIX_STD::dec; -iomanip_t hex_ = &PHOENIX_STD::hex; -iomanip_t oct_ = &PHOENIX_STD::oct; -omanip_t endl_ = &PHOENIX_STD::endl; -omanip_t ends_ = &PHOENIX_STD::ends; -omanip_t flush_ = &PHOENIX_STD::flush; - -#else // __BORLANDC__ - -/////////////////////////////////////////////////////////////////////////////// -// -// The following are overloads for I/O manipulators. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary1<shift_l_op, BaseT, imanip_t>::type -operator>>(actor<BaseT> const& _0, imanip_t _1) -{ - return impl::make_binary1<shift_l_op, BaseT, imanip_t>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary1<shift_l_op, BaseT, iomanip_t>::type -operator>>(actor<BaseT> const& _0, iomanip_t _1) -{ - return impl::make_binary1<shift_l_op, BaseT, iomanip_t>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary1<shift_l_op, BaseT, omanip_t>::type -operator<<(actor<BaseT> const& _0, omanip_t _1) -{ - return impl::make_binary1<shift_l_op, BaseT, omanip_t>::construct(_0, _1); -} - -////////////////////////////////// -template <typename BaseT> -inline typename impl::make_binary1<shift_l_op, BaseT, iomanip_t>::type -operator<<(actor<BaseT> const& _0, iomanip_t _1) -{ - return impl::make_binary1<shift_l_op, BaseT, iomanip_t>::construct(_0, _1); -} - -#endif // __BORLANDC__ -#endif // !defined(__GNUC__) || (__GNUC__ > 2) - -/////////////////////////////////////////////////////////////////////////////// -// -// specializations for stl iterators and containers -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -struct unary_operator<dereference_op, T> -{ - typedef typename T::reference result_type; - static result_type eval(T const& iter) - { return *iter; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<index_op, T0, T1> -{ - typedef typename T0::reference result_type; - static result_type eval(T0& container, T1 const& index) - { return container[index]; } -}; - -////////////////////////////////// -template <typename T0, typename T1> -struct binary_operator<index_op, T0 const, T1> -{ - typedef typename T0::const_reference result_type; - static result_type eval(T0 const& container, T1 const& index) - { return container[index]; } -}; - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#undef PHOENIX_SSTREAM -#undef PHOENIX_STD -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/statements.hpp b/Utilities/BGL/boost/spirit/phoenix/statements.hpp deleted file mode 100644 index d20d199818a4e26ae38a86eee9ad8171d7384e55..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/statements.hpp +++ /dev/null @@ -1,444 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_STATEMENTS_HPP -#define PHOENIX_STATEMENTS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/phoenix/composite.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// sequential_composite -// -// Two or more actors separated by the comma generates a -// sequential_composite which is a composite actor. Example: -// -// actor, -// actor, -// actor -// -// The actors are evaluated sequentially. The result type of this -// is void. Note that the last actor should not have a trailing -// comma. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A0, typename A1> -struct sequential_composite { - - typedef sequential_composite<A0, A1> self_t; - - template <typename TupleT> - struct result { typedef void type; }; - - sequential_composite(A0 const& _0, A1 const& _1) - : a0(_0), a1(_1) {} - - template <typename TupleT> - void - eval(TupleT const& args) const - { - a0.eval(args); - a1.eval(args); - } - - A0 a0; A1 a1; // actors -}; - -////////////////////////////////// -template <typename BaseT0, typename BaseT1> -inline actor<sequential_composite<actor<BaseT0>, actor<BaseT1> > > -operator,(actor<BaseT0> const& _0, actor<BaseT1> const& _1) -{ - return sequential_composite<actor<BaseT0>, actor<BaseT1> >(_0, _1); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// if_then_else_composite -// -// This composite has two (2) forms: -// -// if_(condition) -// [ -// statement -// ] -// -// and -// -// if_(condition) -// [ -// true_statement -// ] -// .else_ -// [ -// false_statement -// ] -// -// where condition is an actor that evaluates to bool. If condition -// is true, the true_statement (again an actor) is executed -// otherwise, the false_statement (another actor) is executed. The -// result type of this is void. Note the trailing underscore after -// if_ and the the leading dot and the trailing underscore before -// and after .else_. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CondT, typename ThenT, typename ElseT> -struct if_then_else_composite { - - typedef if_then_else_composite<CondT, ThenT, ElseT> self_t; - - template <typename TupleT> - struct result { - - typedef void type; - }; - - if_then_else_composite( - CondT const& cond_, - ThenT const& then_, - ElseT const& else__) - : cond(cond_), then(then_), else_(else__) {} - - template <typename TupleT> - void eval(TupleT const& args) const - { - if (cond.eval(args)) - then.eval(args); - else - else_.eval(args); - } - - CondT cond; ThenT then; ElseT else_; // actors -}; - -////////////////////////////////// -template <typename CondT, typename ThenT> -struct else_gen { - - else_gen(CondT const& cond_, ThenT const& then_) - : cond(cond_), then(then_) {} - - template <typename ElseT> - actor<if_then_else_composite<CondT, ThenT, - typename as_actor<ElseT>::type> > - operator[](ElseT const& else_) - { - typedef if_then_else_composite<CondT, ThenT, - typename as_actor<ElseT>::type> - result; - - return result(cond, then, as_actor<ElseT>::convert(else_)); - } - - CondT cond; ThenT then; -}; - -////////////////////////////////// -template <typename CondT, typename ThenT> -struct if_then_composite { - - typedef if_then_composite<CondT, ThenT> self_t; - - template <typename TupleT> - struct result { typedef void type; }; - - if_then_composite(CondT const& cond_, ThenT const& then_) - : cond(cond_), then(then_), else_(cond, then) {} - - template <typename TupleT> - void eval(TupleT const& args) const - { - if (cond.eval(args)) - then.eval(args); - } - - CondT cond; ThenT then; // actors - else_gen<CondT, ThenT> else_; -}; - -////////////////////////////////// -template <typename CondT> -struct if_gen { - - if_gen(CondT const& cond_) - : cond(cond_) {} - - template <typename ThenT> - actor<if_then_composite< - typename as_actor<CondT>::type, - typename as_actor<ThenT>::type> > - operator[](ThenT const& then) const - { - typedef if_then_composite< - typename as_actor<CondT>::type, - typename as_actor<ThenT>::type> - result; - - return result( - as_actor<CondT>::convert(cond), - as_actor<ThenT>::convert(then)); - } - - CondT cond; -}; - -////////////////////////////////// -template <typename CondT> -inline if_gen<CondT> -if_(CondT const& cond) -{ - return if_gen<CondT>(cond); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// while_composite -// -// This composite has the form: -// -// while_(condition) -// [ -// statement -// ] -// -// While the condition (an actor) evaluates to true, statement -// (another actor) is executed. The result type of this is void. -// Note the trailing underscore after while_. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename CondT, typename DoT> -struct while_composite { - - typedef while_composite<CondT, DoT> self_t; - - template <typename TupleT> - struct result { typedef void type; }; - - while_composite(CondT const& cond_, DoT const& do__) - : cond(cond_), do_(do__) {} - - template <typename TupleT> - void eval(TupleT const& args) const - { - while (cond.eval(args)) - do_.eval(args); - } - - CondT cond; - DoT do_; -}; - -////////////////////////////////// -template <typename CondT> -struct while_gen { - - while_gen(CondT const& cond_) - : cond(cond_) {} - - template <typename DoT> - actor<while_composite< - typename as_actor<CondT>::type, - typename as_actor<DoT>::type> > - operator[](DoT const& do_) const - { - typedef while_composite< - typename as_actor<CondT>::type, - typename as_actor<DoT>::type> - result; - - return result( - as_actor<CondT>::convert(cond), - as_actor<DoT>::convert(do_)); - } - - CondT cond; -}; - -////////////////////////////////// -template <typename CondT> -inline while_gen<CondT> -while_(CondT const& cond) -{ - return while_gen<CondT>(cond); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// do_composite -// -// This composite has the form: -// -// do_ -// [ -// statement -// ] -// .while_(condition) -// -// While the condition (an actor) evaluates to true, statement -// (another actor) is executed. The statement is executed at least -// once. The result type of this is void. Note the trailing -// underscore after do_ and the the leading dot and the trailing -// underscore before and after .while_. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename DoT, typename CondT> -struct do_composite { - - typedef do_composite<DoT, CondT> self_t; - - template <typename TupleT> - struct result { typedef void type; }; - - do_composite(DoT const& do__, CondT const& cond_) - : do_(do__), cond(cond_) {} - - template <typename TupleT> - void eval(TupleT const& args) const - { - do - do_.eval(args); - while (cond.eval(args)); - } - - DoT do_; - CondT cond; -}; - -//////////////////////////////////// -template <typename DoT> -struct do_gen2 { - - do_gen2(DoT const& do__) - : do_(do__) {} - - template <typename CondT> - actor<do_composite< - typename as_actor<DoT>::type, - typename as_actor<CondT>::type> > - while_(CondT const& cond) const - { - typedef do_composite< - typename as_actor<DoT>::type, - typename as_actor<CondT>::type> - result; - - return result( - as_actor<DoT>::convert(do_), - as_actor<CondT>::convert(cond)); - } - - DoT do_; -}; - -//////////////////////////////////// -struct do_gen { - - template <typename DoT> - do_gen2<DoT> - operator[](DoT const& do_) const - { - return do_gen2<DoT>(do_); - } -}; - -do_gen const do_ = do_gen(); - -/////////////////////////////////////////////////////////////////////////////// -// -// for_composite -// -// This statement has the form: -// -// for_(init, condition, step) -// [ -// statement -// ] -// -// Where init, condition, step and statement are all actors. init -// is executed once before entering the for-loop. The for-loop -// exits once condition evaluates to false. At each loop iteration, -// step and statement is called. The result of this statement is -// void. Note the trailing underscore after for_. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename InitT, typename CondT, typename StepT, typename DoT> -struct for_composite { - - typedef composite<InitT, CondT, StepT, DoT> self_t; - - template <typename TupleT> - struct result { typedef void type; }; - - for_composite( - InitT const& init_, - CondT const& cond_, - StepT const& step_, - DoT const& do__) - : init(init_), cond(cond_), step(step_), do_(do__) {} - - template <typename TupleT> - void - eval(TupleT const& args) const - { - for (init.eval(args); cond.eval(args); step.eval(args)) - do_.eval(args); - } - - InitT init; CondT cond; StepT step; DoT do_; // actors -}; - -////////////////////////////////// -template <typename InitT, typename CondT, typename StepT> -struct for_gen { - - for_gen( - InitT const& init_, - CondT const& cond_, - StepT const& step_) - : init(init_), cond(cond_), step(step_) {} - - template <typename DoT> - actor<for_composite< - typename as_actor<InitT>::type, - typename as_actor<CondT>::type, - typename as_actor<StepT>::type, - typename as_actor<DoT>::type> > - operator[](DoT const& do_) const - { - typedef for_composite< - typename as_actor<InitT>::type, - typename as_actor<CondT>::type, - typename as_actor<StepT>::type, - typename as_actor<DoT>::type> - result; - - return result( - as_actor<InitT>::convert(init), - as_actor<CondT>::convert(cond), - as_actor<StepT>::convert(step), - as_actor<DoT>::convert(do_)); - } - - InitT init; CondT cond; StepT step; -}; - -////////////////////////////////// -template <typename InitT, typename CondT, typename StepT> -inline for_gen<InitT, CondT, StepT> -for_(InitT const& init, CondT const& cond, StepT const& step) -{ - return for_gen<InitT, CondT, StepT>(init, cond, step); -} - -} // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/phoenix/tuple_helpers.hpp b/Utilities/BGL/boost/spirit/phoenix/tuple_helpers.hpp deleted file mode 100644 index f8875e0c791826ca426a11583b3ec768132a161e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/tuple_helpers.hpp +++ /dev/null @@ -1,1076 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2002 Joel de Guzman - Copyright (c) 2002-2003 Hartmut Kaiser - - 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) -==============================================================================*/ -#ifndef PHOENIX_TUPLEHELPERS_HPP -#define PHOENIX_TUPLEHELPERS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <cassert> -#include <boost/spirit/phoenix/tuples.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix -{ - -/////////////////////////////////////////////////////////////////////////////// -// -// make_tuple template class -// -// This template class is used to calculate a tuple type required to hold -// the given template parameter type -// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// normal (non-tuple types are wrapped into a tuple) -template <typename ResultT> -struct make_tuple { - - typedef tuple<ResultT> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// nil_t is converted to an empty tuple type -template <> -struct make_tuple<nil_t> { - - typedef tuple<> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// tuple types are left alone without any refactoring -template < - typename A, typename B, typename C -#if PHOENIX_LIMIT > 3 - , typename D, typename E, typename F -#if PHOENIX_LIMIT > 6 - , typename G, typename H, typename I -#if PHOENIX_LIMIT > 9 - , typename J, typename K, typename L -#if PHOENIX_LIMIT > 12 - , typename M, typename N, typename O -#endif -#endif -#endif -#endif -> -struct make_tuple<tuple<A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > > { - -// the tuple parameter itself is the required tuple type - typedef tuple<A, B, C -#if PHOENIX_LIMIT > 3 - , D, E, F -#if PHOENIX_LIMIT > 6 - , G, H, I -#if PHOENIX_LIMIT > 9 - , J, K, L -#if PHOENIX_LIMIT > 12 - , M, N, O -#endif -#endif -#endif -#endif - > type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat_tuple type computer -// -// This class returns the type of a tuple, which is constructed by -// concatenating a tuple with a given type -// -/////////////////////////////////////////////////////////////////////////////// -template <typename TupleT, typename AppendT> -struct concat_tuple; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <0 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename AppendT> -struct concat_tuple<tuple<>, AppendT> { - - typedef tuple<AppendT> type; -}; - -template <> -struct concat_tuple<tuple<>, nil_t> { - - typedef tuple<> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <1 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A, typename AppendT> -struct concat_tuple<tuple<A>, AppendT> { - - typedef tuple<A, AppendT> type; -}; - -template <typename A> -struct concat_tuple<tuple<A>, nil_t> { - - typedef tuple<A> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <2 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A, typename B, typename AppendT> -struct concat_tuple<tuple<A, B>, AppendT> { - - typedef tuple<A, B, AppendT> type; -}; - -template <typename A, typename B> -struct concat_tuple<tuple<A, B>, nil_t> { - - typedef tuple<A, B> type; -}; - -#if PHOENIX_LIMIT > 3 -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <3 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, - typename AppendT -> -struct concat_tuple<tuple<A, B, C>, AppendT> { - - typedef tuple<A, B, C, AppendT> type; -}; - -template < - typename A, typename B, typename C -> -struct concat_tuple<tuple<A, B, C>, nil_t> { - - typedef tuple<A, B, C> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <4 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D>, AppendT> { - - typedef tuple<A, B, C, D, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D -> -struct concat_tuple<tuple<A, B, C, D>, nil_t> { - - typedef tuple<A, B, C, D> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <5 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E>, AppendT> { - - typedef tuple<A, B, C, D, E, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E -> -struct concat_tuple<tuple<A, B, C, D, E>, nil_t> { - - typedef tuple<A, B, C, D, E> type; -}; - -#if PHOENIX_LIMIT > 6 -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <6 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F>, AppendT> { - - typedef tuple<A, B, C, D, E, F, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F -> -struct concat_tuple<tuple<A, B, C, D, E, F>, nil_t> { - - typedef tuple<A, B, C, D, E, F> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <7 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G -> -struct concat_tuple<tuple<A, B, C, D, E, F, G>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <8 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, H, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G, H> type; -}; - -#if PHOENIX_LIMIT > 9 -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <9 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, H, I, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G, H, I> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <10 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <11 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K> type; -}; - -#if PHOENIX_LIMIT > 12 -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <12 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K, typename L, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K, L>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K, L, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K, typename L -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K, L>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K, L> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <13 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K, typename L, - typename M, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K, L, M>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K, typename L, - typename M -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K, L, M>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K, L, M> type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// concat tuple <14 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K, typename L, - typename M, typename N, - typename AppendT -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N>, AppendT> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N, AppendT> type; -}; - -template < - typename A, typename B, typename C, typename D, typename E, typename F, - typename G, typename H, typename I, typename J, typename K, typename L, - typename M, typename N -> -struct concat_tuple<tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N>, nil_t> { - - typedef tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N> type; -}; - -#endif -#endif -#endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// concat_tuples type computer -// -// This template class returns the type of a tuple built from the -// concatenation of two given tuples. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename TupleT1, typename TupleT2, int N, typename AppendT> -struct concat_tuple_element { - - typedef - typename concat_tuple_element< - typename concat_tuple<TupleT1, AppendT>::type, TupleT2, N+1, - typename tuple_element<N+1, TupleT2>::type - >::type - type; -}; - -template <typename TupleT1, typename TupleT2, int N> -struct concat_tuple_element<TupleT1, TupleT2, N, nil_t> { - - typedef TupleT1 type; -}; - -template <typename TupleT1, typename TupleT2> -struct concat_tuples { - - typedef - typename concat_tuple_element< - TupleT1, TupleT2, 0, - typename tuple_element<0, TupleT2>::type - >::type - type; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// convert_actors template function -// -// The convert_actors template functions constructs a new tuple object -// composed of the elements returned by the actors contained in the -// input tuple. (i.e. the given tuple type 'actor_tuple' contains a set -// of actors to evaluate and the resulting tuple contains the results of -// evaluating the actors.) -// -/////////////////////////////////////////////////////////////////////////////// -template <typename ActorT, typename TupleT> -struct actor_result; // forward declaration - -namespace impl -{ - template <unsigned N> - struct convert_actors_ {}; -} - -template <typename TupleResultT, typename ActorTupleT> -TupleResultT -convert_actors(ActorTupleT const& actor_tuple) -{ - BOOST_STATIC_ASSERT(ActorTupleT::length <= TupleResultT::length); - BOOST_STATIC_CONSTANT(int, length = TupleResultT::length); - return impl::convert_actors_<length> - ::template apply<TupleResultT, ActorTupleT>::do_(actor_tuple); -} - -namespace impl -{ - template <int N, typename TupleResultT, typename ActorTupleT> - struct convert_actor - { - typedef typename tuple_element<N, TupleResultT>::type type; - - template <bool C> - struct is_default_t {}; - typedef is_default_t<true> is_default; - typedef is_default_t<false> is_not_default; - - static type - actor_element(ActorTupleT const& /*actor_tuple*/, is_default) - { - return type(); // default construct - } - - static type - actor_element(ActorTupleT const& actor_tuple, is_not_default) - { - BOOST_STATIC_ASSERT(ActorTupleT::length <= TupleResultT::length); - return actor_tuple[tuple_index<N>()](); // apply the actor - } - - static type - do_(ActorTupleT const& actor_tuple) - { - return actor_element( - actor_tuple, is_default_t<(N >= ActorTupleT::length)>()); - } - }; - - /////////////////////////////////////// - template <> - struct convert_actors_<1> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - - return TupleResultT( - converter0::do_(actor_tuple) - ); - } - }; - }; - - /////////////////////////////////////// - template <> - struct convert_actors_<2> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - ); - } - }; - }; - - /////////////////////////////////////// - template <> - struct convert_actors_<3> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - ); - } - }; - }; - - #if PHOENIX_LIMIT > 3 - - ///////////////////////////////////// - template <> - struct convert_actors_<4> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - ); - } - }; - }; - - ///////////////////////////////////// - template <> - struct convert_actors_<5> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - ); - } - }; - }; - - ///////////////////////////////////// - template <> - struct convert_actors_<6> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - ); - } - }; - }; - - #if PHOENIX_LIMIT > 6 - - ///////////////////////////////////// - template <> - struct convert_actors_<7> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - ); - } - }; - }; - - ///////////////////////////////////// - template <> - struct convert_actors_<8> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - ); - } - }; - }; - - ///////////////////////////////////// - template <> - struct convert_actors_<9> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - typedef impl::convert_actor<8, TupleResultT, ActorTupleT> converter8; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - , converter8::do_(actor_tuple) - ); - } - }; - }; - - #if PHOENIX_LIMIT > 9 - - ///////////////////////////////////// - template <> - struct convert_actors_<10> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - typedef impl::convert_actor<8, TupleResultT, ActorTupleT> converter8; - typedef impl::convert_actor<9, TupleResultT, ActorTupleT> converter9; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - , converter8::do_(actor_tuple) - , converter9::do_(actor_tuple) - ); - } - }; - }; - - ///////////////////////////////////// - template <> - struct convert_actors_<11> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - typedef impl::convert_actor<8, TupleResultT, ActorTupleT> converter8; - typedef impl::convert_actor<9, TupleResultT, ActorTupleT> converter9; - typedef impl::convert_actor<10, TupleResultT, ActorTupleT> converter10; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - , converter8::do_(actor_tuple) - , converter9::do_(actor_tuple) - , converter10::do_(actor_tuple) - ); - } - }; - }; - - ///////////////////////////////////// - template <> - struct convert_actors_<12> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - typedef impl::convert_actor<8, TupleResultT, ActorTupleT> converter8; - typedef impl::convert_actor<9, TupleResultT, ActorTupleT> converter9; - typedef impl::convert_actor<10, TupleResultT, ActorTupleT> converter10; - typedef impl::convert_actor<11, TupleResultT, ActorTupleT> converter11; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - , converter8::do_(actor_tuple) - , converter9::do_(actor_tuple) - , converter10::do_(actor_tuple) - , converter11::do_(actor_tuple) - ); - } - }; - }; - - #if PHOENIX_LIMIT > 12 - - ///////////////////////////////////// - template <> - struct convert_actors_<13> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - typedef impl::convert_actor<8, TupleResultT, ActorTupleT> converter8; - typedef impl::convert_actor<9, TupleResultT, ActorTupleT> converter9; - typedef impl::convert_actor<10, TupleResultT, ActorTupleT> converter10; - typedef impl::convert_actor<11, TupleResultT, ActorTupleT> converter11; - typedef impl::convert_actor<12, TupleResultT, ActorTupleT> converter12; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - , converter8::do_(actor_tuple) - , converter9::do_(actor_tuple) - , converter10::do_(actor_tuple) - , converter11::do_(actor_tuple) - , converter12::do_(actor_tuple) - ); - } - }; - }; - - /////////////////////////////////////// - template <> - struct convert_actors_<14> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - typedef impl::convert_actor<8, TupleResultT, ActorTupleT> converter8; - typedef impl::convert_actor<9, TupleResultT, ActorTupleT> converter9; - typedef impl::convert_actor<10, TupleResultT, ActorTupleT> converter10; - typedef impl::convert_actor<11, TupleResultT, ActorTupleT> converter11; - typedef impl::convert_actor<12, TupleResultT, ActorTupleT> converter12; - typedef impl::convert_actor<13, TupleResultT, ActorTupleT> converter13; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - , converter8::do_(actor_tuple) - , converter9::do_(actor_tuple) - , converter10::do_(actor_tuple) - , converter11::do_(actor_tuple) - , converter12::do_(actor_tuple) - , converter13::do_(actor_tuple) - ); - } - }; - }; - - /////////////////////////////////////// - template <> - struct convert_actors_<15> - { - template <typename TupleResultT, typename ActorTupleT> - struct apply - { - static TupleResultT - do_(ActorTupleT const& actor_tuple) - { - typedef impl::convert_actor<0, TupleResultT, ActorTupleT> converter0; - typedef impl::convert_actor<1, TupleResultT, ActorTupleT> converter1; - typedef impl::convert_actor<2, TupleResultT, ActorTupleT> converter2; - typedef impl::convert_actor<3, TupleResultT, ActorTupleT> converter3; - typedef impl::convert_actor<4, TupleResultT, ActorTupleT> converter4; - typedef impl::convert_actor<5, TupleResultT, ActorTupleT> converter5; - typedef impl::convert_actor<6, TupleResultT, ActorTupleT> converter6; - typedef impl::convert_actor<7, TupleResultT, ActorTupleT> converter7; - typedef impl::convert_actor<8, TupleResultT, ActorTupleT> converter8; - typedef impl::convert_actor<9, TupleResultT, ActorTupleT> converter9; - typedef impl::convert_actor<10, TupleResultT, ActorTupleT> converter10; - typedef impl::convert_actor<11, TupleResultT, ActorTupleT> converter11; - typedef impl::convert_actor<12, TupleResultT, ActorTupleT> converter12; - typedef impl::convert_actor<13, TupleResultT, ActorTupleT> converter13; - typedef impl::convert_actor<14, TupleResultT, ActorTupleT> converter14; - - using namespace tuple_index_names; - return TupleResultT( - converter0::do_(actor_tuple) - , converter1::do_(actor_tuple) - , converter2::do_(actor_tuple) - , converter3::do_(actor_tuple) - , converter4::do_(actor_tuple) - , converter5::do_(actor_tuple) - , converter6::do_(actor_tuple) - , converter7::do_(actor_tuple) - , converter8::do_(actor_tuple) - , converter9::do_(actor_tuple) - , converter10::do_(actor_tuple) - , converter11::do_(actor_tuple) - , converter12::do_(actor_tuple) - , converter13::do_(actor_tuple) - , converter14::do_(actor_tuple) - ); - } - }; - }; - - #endif - #endif - #endif - #endif -} // namespace impl - - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#endif // PHOENIX_TUPLEHELPERS_HPP diff --git a/Utilities/BGL/boost/spirit/phoenix/tuples.hpp b/Utilities/BGL/boost/spirit/phoenix/tuples.hpp deleted file mode 100644 index 0cde04127f247f75538adefd1acf406a941233e8..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/phoenix/tuples.hpp +++ /dev/null @@ -1,1330 +0,0 @@ -/*============================================================================= - Phoenix V1.2.1 - Copyright (c) 2001-2002 Joel de Guzman - - 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) -==============================================================================*/ -#ifndef PHOENIX_TUPLES_HPP -#define PHOENIX_TUPLES_HPP - -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) -#error "Sorry, Phoenix does not support VC6 and VC7. Please upgrade to at least VC7.1" -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// Phoenix predefined maximum limit. This limit defines the maximum -// number of elements a tuple can hold. This number defaults to 3. The -// actual maximum is rounded up in multiples of 3. Thus, if this value -// is 4, the actual limit is 6. The ultimate maximum limit in this -// implementation is 15. -// -/////////////////////////////////////////////////////////////////////////////// -#ifndef PHOENIX_LIMIT -#define PHOENIX_LIMIT 3 -#endif - -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x561) -namespace phoenix { namespace borland_only -{ - namespace ftors - { - // We define these dummy template functions. Borland complains when - // a template class has the same name as a template function, - // regardless if they are in different namespaces. - - template <typename T> void if_(T) {} - template <typename T> void for_(T) {} - template <typename T> void while_(T) {} - template <typename T> void do_(T) {} - } - - namespace tmpls - { - // We define these dummy template functions. Borland complains when - // a template class has the same name as a template function, - // regardless if they are in different namespaces. - - template <typename T> struct if_ {}; - template <typename T> struct for_ {}; - template <typename T> struct while_ {}; - template <typename T> struct do_ {}; - } - -}} // namespace phoenix::borland_only -#endif - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/static_assert.hpp> -#include <boost/call_traits.hpp> -#include <boost/type_traits/remove_reference.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace phoenix { - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple -// -// Tuples hold heterogeneous types up to a predefined maximum. Only -// the most basic functionality needed is provided. Unlike other -// recursive list-like tuple implementations, this tuple -// implementation uses simple structs similar to std::pair with -// specialization for 0 to N tuple elements. -// -// 1) Construction -// Here are examples on how to construct tuples: -// -// typedef tuple<int, char> t1_t; -// typedef tuple<int, std::string, double> t2_t; -// -// // this tuple has an int and char members -// t1_t t1(3, 'c'); -// -// // this tuple has an int, std::string and double members -// t2_t t2(3, "hello", 3.14); -// -// Tuples can also be constructed from other tuples. The -// source and destination tuples need not have exactly the -// same element types. The only requirement is that the -// source tuple have the same number of elements as the -// destination and that each element slot in the -// destination can be copy constructed from the source -// element. For example: -// -// tuple<double, double> t3(t1); // OK. Compatible tuples -// tuple<double, double> t4(t2); // Error! Incompatible tuples -// -// 2) Member access -// A member in a tuple can be accessed using the -// tuple's [] operator by specifying the Nth -// tuple_index. Here are some examples: -// -// tuple_index<0> ix0; // 0th index == 1st item -// tuple_index<1> ix1; // 1st index == 2nd item -// tuple_index<2> ix2; // 2nd index == 3rd item -// -// t1[ix0] = 33; // sets the int member of the tuple t1 -// t2[ix2] = 6e6; // sets the double member of the tuple t2 -// t1[ix1] = 'a'; // sets the char member of the tuple t1 -// -// There are some predefined names are provided in sub- -// namespace tuple_index_names: -// -// tuple_index<0> _1; -// tuple_index<1> _2; -// ... -// tuple_index<N> _N; -// -// These indexes may be used by 'using' namespace -// phoenix::tuple_index_names. -// -// Access to out of bound indexes returns a nil_t value. -// -// 3) Member type inquiry -// The type of an individual member can be queried. -// Example: -// -// tuple_element<1, t2_t>::type -// -// Refers to the type of the second member (note zero based, -// thus 0 = 1st item, 1 = 2nd item) of the tuple. -// -// Aside from tuple_element<N, T>::type, there are two -// more types that tuple_element provides: rtype and -// crtype. While 'type' is the plain underlying type, -// 'rtype' is the reference type, or type& and 'crtype' -// is the constant reference type or type const&. The -// latter two are provided to make it easy for the -// client in dealing with the possibility of reference -// to reference when type is already a reference, which -// is illegal in C++. -// -// Access to out of bound indexes returns a nil_t type. -// -// 4) Tuple length -// The number of elements in a tuple can be queried. -// Example: -// -// int n = t1.length; -// -// gets the number of elements in tuple t1. -// -// length is a static constant. Thus, TupleT::length -// also works. Example: -// -// int n = t1_t::length; -// -/////////////////////////////////////////////////////////////////////////////// -struct nil_t {}; -using boost::remove_reference; -using boost::call_traits; - -////////////////////////////////// -namespace impl { - - template <typename T> - struct access { - - typedef const T& ctype; - typedef T& type; - }; - - template <typename T> - struct access<T&> { - - typedef T& ctype; - typedef T& type; - }; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple_element -// -// A query class that gets the Nth element inside a tuple. -// Examples: -// -// tuple_element<1, tuple<int, char, void*> >::type // plain -// tuple_element<1, tuple<int, char, void*> >::rtype // ref -// tuple_element<1, tuple<int, char, void*> >::crtype // const ref -// -// Has type char which is the 2nd type in the tuple -// (note zero based, thus 0 = 1st item, 1 = 2nd item). -// -// Given a tuple object, the static function tuple_element<N, -// TupleT>::get(tuple) gets the Nth element in the tuple. The -// tuple class' tuple::operator[] uses this to get its Nth -// element. -// -/////////////////////////////////////////////////////////////////////////////// -template <int N, typename TupleT> -struct tuple_element -{ - typedef nil_t type; - typedef nil_t& rtype; - typedef nil_t const& crtype; - - static nil_t get(TupleT const& t) { return nil_t(); } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<0, TupleT> -{ - typedef typename TupleT::a_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.a; } - static crtype get(TupleT const& t) { return t.a; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<1, TupleT> -{ - typedef typename TupleT::b_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.b; } - static crtype get(TupleT const& t) { return t.b; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<2, TupleT> -{ - typedef typename TupleT::c_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.c; } - static crtype get(TupleT const& t) { return t.c; } -}; - -#if PHOENIX_LIMIT > 3 -////////////////////////////////// -template <typename TupleT> -struct tuple_element<3, TupleT> -{ - typedef typename TupleT::d_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.d; } - static crtype get(TupleT const& t) { return t.d; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<4, TupleT> -{ - typedef typename TupleT::e_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.e; } - static crtype get(TupleT const& t) { return t.e; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<5, TupleT> -{ - typedef typename TupleT::f_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.f; } - static crtype get(TupleT const& t) { return t.f; } -}; - -#if PHOENIX_LIMIT > 6 -////////////////////////////////// -template <typename TupleT> -struct tuple_element<6, TupleT> -{ - typedef typename TupleT::g_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.g; } - static crtype get(TupleT const& t) { return t.g; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<7, TupleT> -{ - typedef typename TupleT::h_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.h; } - static crtype get(TupleT const& t) { return t.h; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<8, TupleT> -{ - typedef typename TupleT::i_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.i; } - static crtype get(TupleT const& t) { return t.i; } -}; - -#if PHOENIX_LIMIT > 9 -////////////////////////////////// -template <typename TupleT> -struct tuple_element<9, TupleT> -{ - typedef typename TupleT::j_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.j; } - static crtype get(TupleT const& t) { return t.j; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<10, TupleT> -{ - typedef typename TupleT::k_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.k; } - static crtype get(TupleT const& t) { return t.k; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<11, TupleT> -{ - typedef typename TupleT::l_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.l; } - static crtype get(TupleT const& t) { return t.l; } -}; - -#if PHOENIX_LIMIT > 12 -////////////////////////////////// -template <typename TupleT> -struct tuple_element<12, TupleT> -{ - typedef typename TupleT::m_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.m; } - static crtype get(TupleT const& t) { return t.m; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<13, TupleT> -{ - typedef typename TupleT::n_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.n; } - static crtype get(TupleT const& t) { return t.n; } -}; - -////////////////////////////////// -template <typename TupleT> -struct tuple_element<14, TupleT> -{ - typedef typename TupleT::o_type type; - typedef typename impl::access<type>::type rtype; - typedef typename impl::access<type>::ctype crtype; - - static rtype get(TupleT& t) { return t.o; } - static crtype get(TupleT const& t) { return t.o; } -}; - -#endif -#endif -#endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple forward declaration. -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A = nil_t - , typename B = nil_t - , typename C = nil_t - -#if PHOENIX_LIMIT > 3 - , typename D = nil_t - , typename E = nil_t - , typename F = nil_t - -#if PHOENIX_LIMIT > 6 - , typename G = nil_t - , typename H = nil_t - , typename I = nil_t - -#if PHOENIX_LIMIT > 9 - , typename J = nil_t - , typename K = nil_t - , typename L = nil_t - -#if PHOENIX_LIMIT > 12 - , typename M = nil_t - , typename N = nil_t - , typename O = nil_t - -#endif -#endif -#endif -#endif - - , typename NU = nil_t // Not used -> -struct tuple; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple_index -// -// This class wraps an integer in a type to be used for indexing -// the Nth element in a tuple. See tuple operator[]. Some -// predefined names are provided in sub-namespace -// tuple_index_names. -// -/////////////////////////////////////////////////////////////////////////////// -template <int N> -struct tuple_index {}; - -////////////////////////////////// -namespace tuple_index_names { - - tuple_index<0> const _1 = tuple_index<0>(); - tuple_index<1> const _2 = tuple_index<1>(); - tuple_index<2> const _3 = tuple_index<2>(); - -#if PHOENIX_LIMIT > 3 - tuple_index<3> const _4 = tuple_index<3>(); - tuple_index<4> const _5 = tuple_index<4>(); - tuple_index<5> const _6 = tuple_index<5>(); - -#if PHOENIX_LIMIT > 6 - tuple_index<6> const _7 = tuple_index<6>(); - tuple_index<7> const _8 = tuple_index<7>(); - tuple_index<8> const _9 = tuple_index<8>(); - -#if PHOENIX_LIMIT > 9 - tuple_index<9> const _10 = tuple_index<9>(); - tuple_index<10> const _11 = tuple_index<10>(); - tuple_index<11> const _12 = tuple_index<11>(); - -#if PHOENIX_LIMIT > 12 - tuple_index<12> const _13 = tuple_index<12>(); - tuple_index<13> const _14 = tuple_index<13>(); - tuple_index<14> const _15 = tuple_index<14>(); - -#endif -#endif -#endif -#endif -} - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple_common class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename DerivedT> -struct tuple_base { - - typedef nil_t a_type; - typedef nil_t b_type; - typedef nil_t c_type; - -#if PHOENIX_LIMIT > 3 - typedef nil_t d_type; - typedef nil_t e_type; - typedef nil_t f_type; - -#if PHOENIX_LIMIT > 6 - typedef nil_t g_type; - typedef nil_t h_type; - typedef nil_t i_type; - -#if PHOENIX_LIMIT > 9 - typedef nil_t j_type; - typedef nil_t k_type; - typedef nil_t l_type; - -#if PHOENIX_LIMIT > 12 - typedef nil_t m_type; - typedef nil_t n_type; - typedef nil_t o_type; - -#endif -#endif -#endif -#endif - - template <int N> - typename tuple_element<N, DerivedT>::crtype - operator[](tuple_index<N>) const - { - return tuple_element<N, DerivedT> - ::get(*static_cast<DerivedT const*>(this)); - } - - template <int N> - typename tuple_element<N, DerivedT>::rtype - operator[](tuple_index<N>) - { - return tuple_element<N, DerivedT> - ::get(*static_cast<DerivedT*>(this)); - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <0 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <> -struct tuple<> -: public tuple_base<tuple<> > { - - BOOST_STATIC_CONSTANT(int, length = 0); -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <1 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A> -struct tuple<A, nil_t, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A> > { - - BOOST_STATIC_CONSTANT(int, length = 1); - typedef A a_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_ - ): a(a_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <2 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A, typename B> -struct tuple<A, B, nil_t, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B> > { - - BOOST_STATIC_CONSTANT(int, length = 2); - typedef A a_type; typedef B b_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_ - ): a(a_), b(b_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <3 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A, typename B, typename C> -struct tuple<A, B, C, -#if PHOENIX_LIMIT > 3 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C> > { - - BOOST_STATIC_CONSTANT(int, length = 3); - typedef A a_type; typedef B b_type; - typedef C c_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_ - ): a(a_), b(b_), c(c_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; -}; - -#if PHOENIX_LIMIT > 3 -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <4 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A, typename B, typename C, typename D> -struct tuple<A, B, C, D, nil_t, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D> > { - - BOOST_STATIC_CONSTANT(int, length = 4); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_ - ): a(a_), b(b_), c(c_), d(d_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <5 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template <typename A, typename B, typename C, typename D, typename E> -struct tuple<A, B, C, D, E, nil_t, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E> > { - - BOOST_STATIC_CONSTANT(int, length = 5); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_ - ): a(a_), b(b_), c(c_), d(d_), e(e_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <6 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F> -struct tuple<A, B, C, D, E, F, -#if PHOENIX_LIMIT > 6 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E, F> > { - - BOOST_STATIC_CONSTANT(int, length = 6); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; -}; - -#if PHOENIX_LIMIT > 6 -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <7 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G> -struct tuple<A, B, C, D, E, F, G, nil_t, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E, F, G> > { - - BOOST_STATIC_CONSTANT(int, length = 7); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <8 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H> -struct tuple<A, B, C, D, E, F, G, H, nil_t, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E, F, G, H> > { - - BOOST_STATIC_CONSTANT(int, length = 8); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <9 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I> -struct tuple<A, B, C, D, E, F, G, H, I, -#if PHOENIX_LIMIT > 9 - nil_t, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E, F, G, H, I> > { - - BOOST_STATIC_CONSTANT(int, length = 9); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - typedef I i_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_, - typename call_traits<I>::param_type i_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]), - i(init[tuple_index<8>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; I i; -}; - -#if PHOENIX_LIMIT > 9 -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <10 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J> -struct tuple<A, B, C, D, E, F, G, H, I, J, nil_t, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E, F, G, H, I, J> > { - - BOOST_STATIC_CONSTANT(int, length = 10); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - typedef I i_type; typedef J j_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_, - typename call_traits<I>::param_type i_, - typename call_traits<J>::param_type j_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]), - i(init[tuple_index<8>()]), j(init[tuple_index<9>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; I i; J j; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <11 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K> -struct tuple<A, B, C, D, E, F, G, H, I, J, K, nil_t, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E, F, G, H, I, J, K> > { - - BOOST_STATIC_CONSTANT(int, length = 11); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - typedef I i_type; typedef J j_type; - typedef K k_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_, - typename call_traits<I>::param_type i_, - typename call_traits<J>::param_type j_, - typename call_traits<K>::param_type k_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]), - i(init[tuple_index<8>()]), j(init[tuple_index<9>()]), - k(init[tuple_index<10>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; I i; J j; - K k; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <12 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L> -struct tuple<A, B, C, D, E, F, G, H, I, J, K, L, -#if PHOENIX_LIMIT > 12 - nil_t, nil_t, nil_t, -#endif - nil_t // Unused -> -: public tuple_base<tuple<A, B, C, D, E, F, G, H, I, J, K, L> > { - - BOOST_STATIC_CONSTANT(int, length = 12); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - typedef I i_type; typedef J j_type; - typedef K k_type; typedef L l_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_, - typename call_traits<I>::param_type i_, - typename call_traits<J>::param_type j_, - typename call_traits<K>::param_type k_, - typename call_traits<L>::param_type l_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]), - i(init[tuple_index<8>()]), j(init[tuple_index<9>()]), - k(init[tuple_index<10>()]), l(init[tuple_index<11>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; I i; J j; - K k; L l; -}; - -#if PHOENIX_LIMIT > 12 -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <13 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M> -struct tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, nil_t, nil_t, nil_t> -: public tuple_base< - tuple<A, B, C, D, E, F, G, H, I, J, K, L, M> > { - - BOOST_STATIC_CONSTANT(int, length = 13); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - typedef I i_type; typedef J j_type; - typedef K k_type; typedef L l_type; - typedef M m_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_, - typename call_traits<I>::param_type i_, - typename call_traits<J>::param_type j_, - typename call_traits<K>::param_type k_, - typename call_traits<L>::param_type l_, - typename call_traits<M>::param_type m_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_), m(m_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]), - i(init[tuple_index<8>()]), j(init[tuple_index<9>()]), - k(init[tuple_index<10>()]), l(init[tuple_index<11>()]), - m(init[tuple_index<12>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; I i; J j; - K k; L l; M m; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <14 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N> -struct tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N, nil_t, nil_t> -: public tuple_base< - tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N> > { - - BOOST_STATIC_CONSTANT(int, length = 14); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - typedef I i_type; typedef J j_type; - typedef K k_type; typedef L l_type; - typedef M m_type; typedef N n_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_, - typename call_traits<I>::param_type i_, - typename call_traits<J>::param_type j_, - typename call_traits<K>::param_type k_, - typename call_traits<L>::param_type l_, - typename call_traits<M>::param_type m_, - typename call_traits<N>::param_type n_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_), m(m_), n(n_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]), - i(init[tuple_index<8>()]), j(init[tuple_index<9>()]), - k(init[tuple_index<10>()]), l(init[tuple_index<11>()]), - m(init[tuple_index<12>()]), n(init[tuple_index<13>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; I i; J j; - K k; L l; M m; N n; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// tuple <15 member> class -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename A, typename B, typename C, typename D, typename E, - typename F, typename G, typename H, typename I, typename J, - typename K, typename L, typename M, typename N, typename O> -struct tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, nil_t> -: public tuple_base< - tuple<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> > { - - BOOST_STATIC_CONSTANT(int, length = 15); - typedef A a_type; typedef B b_type; - typedef C c_type; typedef D d_type; - typedef E e_type; typedef F f_type; - typedef G g_type; typedef H h_type; - typedef I i_type; typedef J j_type; - typedef K k_type; typedef L l_type; - typedef M m_type; typedef N n_type; - typedef O o_type; - - tuple() {} - - tuple( - typename call_traits<A>::param_type a_, - typename call_traits<B>::param_type b_, - typename call_traits<C>::param_type c_, - typename call_traits<D>::param_type d_, - typename call_traits<E>::param_type e_, - typename call_traits<F>::param_type f_, - typename call_traits<G>::param_type g_, - typename call_traits<H>::param_type h_, - typename call_traits<I>::param_type i_, - typename call_traits<J>::param_type j_, - typename call_traits<K>::param_type k_, - typename call_traits<L>::param_type l_, - typename call_traits<M>::param_type m_, - typename call_traits<N>::param_type n_, - typename call_traits<O>::param_type o_ - ): a(a_), b(b_), c(c_), d(d_), e(e_), - f(f_), g(g_), h(h_), i(i_), j(j_), - k(k_), l(l_), m(m_), n(n_), o(o_) {} - - template <typename TupleT> - tuple(TupleT const& init) - : a(init[tuple_index<0>()]), b(init[tuple_index<1>()]), - c(init[tuple_index<2>()]), d(init[tuple_index<3>()]), - e(init[tuple_index<4>()]), f(init[tuple_index<5>()]), - g(init[tuple_index<6>()]), h(init[tuple_index<7>()]), - i(init[tuple_index<8>()]), j(init[tuple_index<9>()]), - k(init[tuple_index<10>()]), l(init[tuple_index<11>()]), - m(init[tuple_index<12>()]), n(init[tuple_index<13>()]), - o(init[tuple_index<14>()]) - { BOOST_STATIC_ASSERT(TupleT::length == length); } - - A a; B b; C c; D d; E e; - F f; G g; H h; I i; J j; - K k; L l; M m; N n; O o; -}; - -#endif -#endif -#endif -#endif - -/////////////////////////////////////////////////////////////////////////////// -} // namespace phoenix - -#endif diff --git a/Utilities/BGL/boost/spirit/symbols.hpp b/Utilities/BGL/boost/spirit/symbols.hpp deleted file mode 100644 index 24d913acfffde14b81a1905c64ee6d062758fbf3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/symbols.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_SYMBOLS_MAIN_HPP) -#define BOOST_SPIRIT_SYMBOLS_MAIN_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Master header for Spirit.Symbols -// -/////////////////////////////////////////////////////////////////////////////// - -#include <boost/spirit/symbols/symbols.hpp> - -#endif // !defined(BOOST_SPIRIT_SYMBOLS_MAIN_HPP) diff --git a/Utilities/BGL/boost/spirit/symbols/impl/symbols.ipp b/Utilities/BGL/boost/spirit/symbols/impl/symbols.ipp deleted file mode 100644 index 20d746cb7bc0b4c55cbff255ead9cfbc1079916e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/symbols/impl/symbols.ipp +++ /dev/null @@ -1,113 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_SYMBOLS_IPP -#define BOOST_SPIRIT_SYMBOLS_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <boost/spirit/symbols/impl/tst.ipp> -#include <boost/detail/workaround.hpp> - -// MSVC: void warning about the use of 'this' pointer in constructors -#if defined(BOOST_MSVC) -#pragma warning(disable : 4355) -#endif - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// symbols class implementation -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T, typename CharT, typename SetT> -inline symbols<T, CharT, SetT>::symbols() -: SetT() -, add(*this) -{ -} - -////////////////////////////////// -template <typename T, typename CharT, typename SetT> -symbols<T, CharT, SetT>::symbols(symbols const& other) -: SetT(other) -// Tru64 CXX seems to be confused by the explicit call of the default -// constructor and generates wrong code which invalidates the just contructed -// first base class in the line above. -#if !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590041)) -, parser<symbols<T, CharT, SetT> >() -#endif -, add(*this) -{ -} - -////////////////////////////////// -template <typename T, typename CharT, typename SetT> -inline symbols<T, CharT, SetT>::~symbols() -{} - -////////////////////////////////// -template <typename T, typename CharT, typename SetT> -inline symbols<T, CharT, SetT>& -symbols<T, CharT, SetT>::operator=(symbols const& other) -{ - SetT::operator=(other); - return *this; -} - -////////////////////////////////// -template <typename T, typename CharT, typename SetT> -inline symbol_inserter<T, SetT> const& -symbols<T, CharT, SetT>::operator=(CharT const* str) -{ - return add, str; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Symbol table utilities -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T, typename CharT, typename SetT> -inline T* -find(symbols<T, CharT, SetT> const& table, CharT const* sym) -{ - CharT const* last = sym; - while (*last) - last++; - scanner<CharT const *> scan(sym, last); - T* result = table.find(scan); - return scan.at_end()? result: 0; -} - -////////////////////////////////// -template <typename T, typename CharT, typename SetT> -inline T* -add(symbols<T, CharT, SetT>& table, CharT const* sym, T const& data) -{ - CharT const* first = sym; - CharT const* last = sym; - while (*last) - last++; - scanner<CharT const *> scan(first, last); - if (table.find(scan) && scan.at_end()) - return 0; // symbol already contained in symbol table - table.add(sym, last, data); - first = sym; - return table.find(scan); // refind the inserted symbol -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#if defined(BOOST_MSVC) -#pragma warning(default : 4355) -#endif - -#endif diff --git a/Utilities/BGL/boost/spirit/symbols/impl/tst.ipp b/Utilities/BGL/boost/spirit/symbols/impl/tst.ipp deleted file mode 100644 index 47169cf8770bb9c1234e6c6e9a509b2b8593ea34..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/symbols/impl/tst.ipp +++ /dev/null @@ -1,277 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_TST_IPP -#define BOOST_SPIRIT_TST_IPP - -/////////////////////////////////////////////////////////////////////////////// -#include <memory> // for std::auto_ptr -#include <boost/spirit/core/assert.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - - namespace impl - { - -/////////////////////////////////////////////////////////////////////////////// -// -// tst class -// -// Ternary Search Tree implementation. The data structure is faster than -// hashing for many typical search problems especially when the search -// interface is iterator based. Searching for a string of length k in a -// ternary search tree with n strings will require at most O(log n+k) -// character comparisons. TSTs are many times faster than hash tables -// for unsuccessful searches since mismatches are discovered earlier -// after examining only a few characters. Hash tables always examine an -// entire key when searching. -// -// For details see http://www.cs.princeton.edu/~rs/strings/. -// -// *** This is a low level class and is -// not meant for public consumption *** -// -/////////////////////////////////////////////////////////////////////////////// - template <typename T, typename CharT> - struct tst_node - { - tst_node(CharT value_) - : value(value_) - , left(0) - , right(0) - { middle.link = 0; } - - ~tst_node() - { - delete left; - delete right; - if (value) - delete middle.link; - else - delete middle.data; - } - - tst_node* - clone() const - { - std::auto_ptr<tst_node> copy(new tst_node(value)); - - if (left) - copy->left = left->clone(); - if (right) - copy->right = right->clone(); - - if (value && middle.link) - { - copy->middle.link = middle.link->clone(); - } - else - { - std::auto_ptr<T> mid_data(new T(*middle.data)); - copy->middle.data = mid_data.release(); - } - - return copy.release(); - } - - union center { - - tst_node* link; - T* data; - }; - - CharT value; - tst_node* left; - center middle; - tst_node* right; - }; - - /////////////////////////////////////////////////////////////////////////// - template <typename T, typename CharT> - class tst - { - public: - - struct search_info - { - T* data; - std::size_t length; - }; - - tst() - : root(0) {} - - tst(tst const& other) - : root(other.root ? other.root->clone() : 0) {} - - ~tst() - { delete root; } - - tst& - operator=(tst const& other) - { - if (this != &other) - { - node_t* new_root = other.root ? other.root->clone() : 0; - delete root; - root = new_root; - } - return *this; - } - - template <typename IteratorT> - T* add(IteratorT first, IteratorT const& last, T const& data) - { - if (first == last) - return 0; - - node_t** np = &root; - CharT ch = *first; - - BOOST_SPIRIT_ASSERT(first == last || ch != 0 - && "Won't add string containing null character"); - - for (;;) - { - if (*np == 0 || ch == 0) - { - node_t* right = 0; - if (np != 0) - right = *np; - *np = new node_t(ch); - if (right) - (**np).right = right; - } - - if (ch < (**np).value) - { - np = &(**np).left; - } - else - { - if (ch == (**np).value) - { - if (ch == 0) - { - if ((**np).middle.data == 0) - { - (**np).middle.data = new T(data); - return (**np).middle.data; - } - else - { - // re-addition is disallowed - return 0; - } - } - ++first; - ch = (first == last) ? CharT(0) : *first; - BOOST_SPIRIT_ASSERT(first == last || ch != 0 - && "Won't add string containing null character"); - np = &(**np).middle.link; - } - else - { - np = &(**np).right; - } - } - } - } - - template <typename ScannerT> - search_info find(ScannerT const& scan) const - { - search_info result = { 0, 0 }; - if (scan.at_end()) { - return result; - } - - typedef typename ScannerT::iterator_t iterator_t; - node_t* np = root; - CharT ch = *scan; - iterator_t save = scan.first; - iterator_t latest = scan.first; - std::size_t latest_len = 0; - - while (np) - { - - if (ch < np->value) // => go left! - { - if (np->value == 0) - { - result.data = np->middle.data; - if (result.data) - { - latest = scan.first; - latest_len = result.length; - } - } - - np = np->left; - } - else if (ch == np->value) // => go middle! - { - // Matching the null character is not allowed. - if (np->value == 0) - { - result.data = np->middle.data; - if (result.data) - { - latest = scan.first; - latest_len = result.length; - } - break; - } - - ++scan; - ch = scan.at_end() ? CharT(0) : *scan; - np = np->middle.link; - ++result.length; - } - else // (ch > np->value) => go right! - { - if (np->value == 0) - { - result.data = np->middle.data; - if (result.data) - { - latest = scan.first; - latest_len = result.length; - } - } - - np = np->right; - } - } - - if (result.data == 0) - { - scan.first = save; - } - else - { - scan.first = latest; - result.length = latest_len; - } - return result; - } - - private: - - typedef tst_node<T, CharT> node_t; - node_t* root; - }; - -/////////////////////////////////////////////////////////////////////////////// - } // namespace impl - -}} // namespace boost::spirit - -#endif diff --git a/Utilities/BGL/boost/spirit/symbols/symbols.hpp b/Utilities/BGL/boost/spirit/symbols/symbols.hpp deleted file mode 100644 index 789661155008a3ef0ec1801de04bca23e47870d0..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/symbols/symbols.hpp +++ /dev/null @@ -1,237 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Joel de Guzman - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_SYMBOLS_HPP -#define BOOST_SPIRIT_SYMBOLS_HPP - -/////////////////////////////////////////////////////////////////////////////// -#include <string> - -#include <boost/ref.hpp> - -#include <boost/spirit/core/parser.hpp> -#include <boost/spirit/core/composite/directives.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// Forward Declarations - -namespace impl -{ - template <typename CharT, typename T> - class tst; -} - -template <typename T, typename SetT> -class symbol_inserter; - -/////////////////////////////////////////////////////////////////////////////// -// -// symbols class -// -// This class implements a symbol table. The symbol table holds a -// dictionary of symbols where each symbol is a sequence of CharTs. -// The template class can work efficiently with 8, 16 and 32 bit -// characters. Mutable data of type T is associated with each -// symbol. -// -// The class is a parser. The parse member function returns -// additional information in the symbol_match class (see below). -// The additional data is a pointer to some data associated with -// the matching symbol. -// -// The actual set implementation is supplied by the SetT template -// parameter. By default, this uses the tst class (see tst.ipp). -// -// Symbols are added into the symbol table statically using the -// construct: -// -// sym = a, b, c, d ...; -// -// where sym is a symbol table and a..d are strings. Example: -// -// sym = "pineapple", "orange", "banana", "apple"; -// -// Alternatively, symbols may be added dynamically through the -// member functor 'add' (see symbol_inserter below). The member -// functor 'add' may be attached to a parser as a semantic action -// taking in a begin/end pair: -// -// p[sym.add] -// -// where p is a parser (and sym is a symbol table). On success, -// the matching portion of the input is added to the symbol table. -// -// 'add' may also be used to directly initialize data. Examples: -// -// sym.add("hello", 1)("crazy", 2)("world", 3); -// -/////////////////////////////////////////////////////////////////////////////// -template -< - typename T = int, - typename CharT = char, - typename SetT = impl::tst<T, CharT> -> -class symbols -: private SetT -, public parser<symbols<T, CharT, SetT> > -{ -public: - - typedef parser<symbols<T, CharT, SetT> > parser_base_t; - typedef symbols<T, CharT, SetT> self_t; - typedef self_t const& embed_t; - typedef T symbol_data_t; - typedef boost::reference_wrapper<T> symbol_ref_t; - - symbols(); - symbols(symbols const& other); - ~symbols(); - - symbols& - operator=(symbols const& other); - - symbol_inserter<T, SetT> const& - operator=(CharT const* str); - - template <typename ScannerT> - struct result - { - typedef typename match_result<ScannerT, symbol_ref_t>::type type; - }; - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse_main(ScannerT const& scan) const - { - typedef typename ScannerT::iterator_t iterator_t; - iterator_t first = scan.first; - typename SetT::search_info result = SetT::find(scan); - - if (result.data) - return scan. - create_match( - result.length, - symbol_ref_t(*result.data), - first, - scan.first); - else - return scan.no_match(); - } - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename parser_result<self_t, ScannerT>::type result_t; - return impl::implicit_lexeme_parse<result_t> - (*this, scan, scan); - } - - template < typename ScannerT > - T* find(ScannerT const& scan) const - { return SetT::find(scan).data; } - - symbol_inserter<T, SetT> const add; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// Symbol table utilities -// -// add -// -// adds a symbol 'sym' (string) to a symbol table 'table' plus an -// optional data 'data' associated with the symbol. Returns a pointer to -// the data associated with the symbol or NULL if add failed (e.g. when -// the symbol is already added before). -// -// find -// -// finds a symbol 'sym' (string) from a symbol table 'table'. Returns a -// pointer to the data associated with the symbol or NULL if not found -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T, typename CharT, typename SetT> -T* add(symbols<T, CharT, SetT>& table, CharT const* sym, T const& data = T()); - -template <typename T, typename CharT, typename SetT> -T* find(symbols<T, CharT, SetT> const& table, CharT const* sym); - -/////////////////////////////////////////////////////////////////////////////// -// -// symbol_inserter class -// -// The symbols class holds an instance of this class named 'add'. -// This can be called directly just like a member function, -// passing in a first/last iterator and optional data: -// -// sym.add(first, last, data); -// -// Or, passing in a C string and optional data: -// -// sym.add(c_string, data); -// -// where sym is a symbol table. The 'data' argument is optional. -// This may also be used as a semantic action since it conforms -// to the action interface (see action.hpp): -// -// p[sym.add] -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T, typename SetT> -class symbol_inserter -{ -public: - - symbol_inserter(SetT& set_) - : set(set_) {} - - template <typename IteratorT> - symbol_inserter const& - operator()(IteratorT first, IteratorT const& last, T const& data = T()) const - { - set.add(first, last, data); - return *this; - } - - template <typename CharT> - symbol_inserter const& - operator()(CharT const* str, T const& data = T()) const - { - CharT const* last = str; - while (*last) - last++; - set.add(str, last, data); - return *this; - } - - template <typename CharT> - symbol_inserter const& - operator,(CharT const* str) const - { - CharT const* last = str; - while (*last) - last++; - set.add(str, last, T()); - return *this; - } - -private: - - SetT& set; -}; - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#include <boost/spirit/symbols/impl/symbols.ipp> -#endif diff --git a/Utilities/BGL/boost/spirit/tree/ast.hpp b/Utilities/BGL/boost/spirit/tree/ast.hpp deleted file mode 100644 index d1e28970c72a9fa22d123b61e8c9cfc031f3f30d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/ast.hpp +++ /dev/null @@ -1,353 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_TREE_AST_HPP -#define BOOST_SPIRIT_TREE_AST_HPP - -#include <boost/spirit/tree/common.hpp> -#include <boost/spirit/core/scanner/scanner.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -template <typename MatchPolicyT, typename NodeFactoryT> -struct ast_tree_policy; - -////////////////////////////////// -// ast_match_policy is simply an id so the correct specialization of -// tree_policy can be found. -template < - typename IteratorT, - typename NodeFactoryT = node_val_data_factory<nil_t> -> -struct ast_match_policy : - public common_tree_match_policy< - ast_match_policy<IteratorT, NodeFactoryT>, - IteratorT, - NodeFactoryT, - ast_tree_policy< - ast_match_policy<IteratorT, NodeFactoryT>, - NodeFactoryT - > - > -{ -}; - -////////////////////////////////// -template <typename MatchPolicyT, typename NodeFactoryT> -struct ast_tree_policy : - public common_tree_tree_policy<MatchPolicyT, NodeFactoryT> -{ - typedef - typename common_tree_tree_policy<MatchPolicyT, NodeFactoryT>::match_t - match_t; - typedef typename MatchPolicyT::iterator_t iterator_t; - - static void concat(match_t& a, match_t const& b) - { - BOOST_SPIRIT_ASSERT(a && b); - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) - BOOST_SPIRIT_DEBUG_OUT << "\n>>>AST concat. a = " << a << - "\n\tb = " << b << "<<<\n"; -#endif - typedef typename tree_match<iterator_t, NodeFactoryT>::container_t - container_t; - - // test for size() is nessecary, because no_tree_gen_node leaves a.trees - // and/or b.trees empty - if (0 != b.trees.size() && b.trees.begin()->value.is_root()) - { - BOOST_SPIRIT_ASSERT(b.trees.size() == 1); - - container_t tmp; - std::swap(a.trees, tmp); // save a into tmp - std::swap(b.trees, a.trees); // make b.trees[0] be new root (a.trees[0]) - container_t* pnon_root_trees = &a.trees; - while (pnon_root_trees->size() > 0 && - pnon_root_trees->begin()->value.is_root()) - { - pnon_root_trees = & pnon_root_trees->begin()->children; - } - pnon_root_trees->insert(pnon_root_trees->begin(), - tmp.begin(), tmp.end()); - } - else if (0 != a.trees.size() && a.trees.begin()->value.is_root()) - { - BOOST_SPIRIT_ASSERT(a.trees.size() == 1); - - a.trees.begin()->children.reserve(a.trees.begin()->children.size() + b.trees.size()); - std::copy(b.trees.begin(), - b.trees.end(), - std::back_insert_iterator<container_t>( - a.trees.begin()->children)); - } - else - { - a.trees.reserve(a.trees.size() + b.trees.size()); - std::copy(b.trees.begin(), - b.trees.end(), - std::back_insert_iterator<container_t>(a.trees)); - } - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) - BOOST_SPIRIT_DEBUG_OUT << ">>>after AST concat. a = " << a << "<<<\n\n"; -#endif - - return; - } - - template <typename MatchT, typename Iterator1T, typename Iterator2T> - static void group_match(MatchT& m, parser_id const& id, - Iterator1T const& first, Iterator2T const& last) - { - if (!m) - return; - - typedef typename tree_match<iterator_t, NodeFactoryT>::container_t - container_t; - typedef typename container_t::iterator cont_iterator_t; - typedef typename NodeFactoryT::template factory<iterator_t> factory_t; - - if (m.trees.size() == 1 -#ifdef BOOST_SPIRIT_NO_TREE_NODE_COLLAPSING - && !(id.to_long() && m.trees.begin()->value.id().to_long()) -#endif - ) - { - // set rule_id's. There may have been multiple nodes created. - // Because of root_node[] they may be left-most children of the top - // node. - container_t* punset_id = &m.trees; - while (punset_id->size() > 0 && - punset_id->begin()->value.id() == 0) - { - punset_id->begin()->value.id(id); - punset_id = &punset_id->begin()->children; - } - - m.trees.begin()->value.is_root(false); - } - else - { - match_t newmatch(m.length(), - m.trees.empty() ? - factory_t::empty_node() : - factory_t::create_node(first, last, false)); - - std::swap(newmatch.trees.begin()->children, m.trees); - // set this node and all it's unset children's rule_id - newmatch.trees.begin()->value.id(id); - for (cont_iterator_t i = newmatch.trees.begin(); - i != newmatch.trees.end(); - ++i) - { - if (i->value.id() == 0) - i->value.id(id); - } - m = newmatch; - } - } - - template <typename FunctorT> - static void apply_op_to_match(FunctorT const& op, match_t& m) - { - op(m); - } -}; - -namespace impl { - - template <typename IteratorT, typename NodeFactoryT> - struct tree_policy_selector<ast_match_policy<IteratorT, NodeFactoryT> > - { - typedef ast_tree_policy< - ast_match_policy<IteratorT, NodeFactoryT>, NodeFactoryT> type; - }; - -} // namespace impl - - -////////////////////////////////// -struct gen_ast_node_parser_gen; - -template <typename T> -struct gen_ast_node_parser -: public unary<T, parser<gen_ast_node_parser<T> > > -{ - typedef gen_ast_node_parser<T> self_t; - typedef gen_ast_node_parser_gen parser_generator_t; - typedef unary_parser_category parser_category_t; -// typedef gen_ast_node_parser<T> const &embed_t; - - gen_ast_node_parser(T const& a) - : unary<T, parser<gen_ast_node_parser<T> > >(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename ScannerT::iteration_policy_t iteration_policy_t; - typedef typename ScannerT::match_policy_t::iterator_t iterator_t; - typedef typename ScannerT::match_policy_t::factory_t factory_t; - typedef ast_match_policy<iterator_t, factory_t> match_policy_t; - typedef typename ScannerT::action_policy_t action_policy_t; - typedef scanner_policies< - iteration_policy_t, - match_policy_t, - action_policy_t - > policies_t; - - return this->subject().parse(scan.change_policies(policies_t(scan))); - } -}; - -////////////////////////////////// -struct gen_ast_node_parser_gen -{ - template <typename T> - struct result { - - typedef gen_ast_node_parser<T> type; - }; - - template <typename T> - static gen_ast_node_parser<T> - generate(parser<T> const& s) - { - return gen_ast_node_parser<T>(s.derived()); - } - - template <typename T> - gen_ast_node_parser<T> - operator[](parser<T> const& s) const - { - return gen_ast_node_parser<T>(s.derived()); - } -}; - -////////////////////////////////// -const gen_ast_node_parser_gen gen_ast_node_d = gen_ast_node_parser_gen(); - - -////////////////////////////////// -struct root_node_op -{ - template <typename MatchT> - void operator()(MatchT& m) const - { - BOOST_SPIRIT_ASSERT(m.trees.size() > 0); - m.trees.begin()->value.is_root(true); - } -}; - -const node_parser_gen<root_node_op> root_node_d = - node_parser_gen<root_node_op>(); - -/////////////////////////////////////////////////////////////////////////////// -// -// Parse functions for ASTs -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename AstFactoryT, typename IteratorT, typename ParserT, - typename SkipT -> -inline tree_parse_info<IteratorT, AstFactoryT> -ast_parse( - IteratorT const& first_, - IteratorT const& last_, - parser<ParserT> const& parser, - SkipT const& skip_, - AstFactoryT const & /*dummy_*/ = AstFactoryT()) -{ - typedef skip_parser_iteration_policy<SkipT> iter_policy_t; - typedef ast_match_policy<IteratorT, AstFactoryT> ast_match_policy_t; - typedef - scanner_policies<iter_policy_t, ast_match_policy_t> - scanner_policies_t; - typedef scanner<IteratorT, scanner_policies_t> scanner_t; - - iter_policy_t iter_policy(skip_); - scanner_policies_t policies(iter_policy); - IteratorT first = first_; - scanner_t scan(first, last_, policies); - tree_match<IteratorT, AstFactoryT> hit = parser.derived().parse(scan); - scan.skip(scan); - return tree_parse_info<IteratorT, AstFactoryT>( - first, hit, hit && (first == last_), hit.length(), hit.trees); -} - -////////////////////////////////// -template <typename IteratorT, typename ParserT, typename SkipT> -inline tree_parse_info<IteratorT> -ast_parse( - IteratorT const& first_, - IteratorT const& last_, - parser<ParserT> const& parser, - SkipT const& skip_) -{ - typedef node_val_data_factory<nil_t> default_factory_t; - return ast_parse(first_, last_, parser, skip_, default_factory_t()); -} - -////////////////////////////////// -template <typename IteratorT, typename ParserT> -inline tree_parse_info<IteratorT> -ast_parse( - IteratorT const& first_, - IteratorT const& last, - parser<ParserT> const& parser) -{ - typedef ast_match_policy<IteratorT> ast_match_policy_t; - IteratorT first = first_; - scanner< - IteratorT, - scanner_policies<iteration_policy, ast_match_policy_t> - > scan(first, last); - tree_match<IteratorT> hit = parser.derived().parse(scan); - return tree_parse_info<IteratorT>( - first, hit, hit && (first == last), hit.length(), hit.trees); -} - -////////////////////////////////// -template <typename CharT, typename ParserT, typename SkipT> -inline tree_parse_info<CharT const*> -ast_parse( - CharT const* str, - parser<ParserT> const& parser, - SkipT const& skip) -{ - CharT const* last = str; - while (*last) - last++; - return ast_parse(str, last, parser, skip); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline tree_parse_info<CharT const*> -ast_parse( - CharT const* str, - parser<ParserT> const& parser) -{ - CharT const* last = str; - while (*last) - { - last++; - } - return ast_parse(str, last, parser); -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/tree/common.hpp b/Utilities/BGL/boost/spirit/tree/common.hpp deleted file mode 100644 index e58772ff34585e1185844f18dc788e33f397037d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/common.hpp +++ /dev/null @@ -1,1472 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_TREE_COMMON_HPP -#define BOOST_SPIRIT_TREE_COMMON_HPP - -#include <vector> -#include <algorithm> - -#include <boost/ref.hpp> -#include <boost/call_traits.hpp> -#include <boost/spirit/core.hpp> -#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) -#include <iostream> -#include <boost/spirit/debug/debug_node.hpp> -#endif - -namespace boost { namespace spirit { - -template <typename T> -struct tree_node; - -template <typename IteratorT = char const*, typename ValueT = nil_t> -struct node_iter_data; - -template <typename T> -void swap(tree_node<T>& a, tree_node<T>& b); - -template <typename T, typename V> -void swap(node_iter_data<T, V>& a, node_iter_data<T, V>& b); - -namespace impl { - template <typename T> - inline void cp_swap(T& t1, T& t2); -} - -template <typename T> -struct tree_node -{ - typedef T parse_node_t; - typedef std::vector<tree_node<T> > children_t; - typedef typename children_t::iterator tree_iterator; - typedef typename children_t::const_iterator const_tree_iterator; - - T value; - children_t children; - - tree_node() - : value() - , children() - {} - - explicit tree_node(T const& v) - : value(v) - , children() - {} - - tree_node(T const& v, children_t const& c) - : value(v) - , children(c) - {} - - void swap(tree_node<T>& x) - { - impl::cp_swap(value, x.value); - impl::cp_swap(children, x.children); - } - -// Intel V5.0.1 has a problem without this explicit operator= - tree_node &operator= (tree_node const &rhs) - { - tree_node(rhs).swap(*this); - return *this; - } -}; - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) -template <typename T> -inline std::ostream& -operator<<(std::ostream& o, tree_node<T> const& n) -{ - static int depth = 0; - o << "\n"; - for (int i = 0; i <= depth; ++i) - { - o << "\t"; - } - o << "(depth = " << depth++ << " value = " << n.value; - int c = 0; - for (typename tree_node<T>::children_t::const_iterator it = n.children.begin(); - it != n.children.end(); ++it) - { - o << " children[" << c++ << "] = " << *it; - } - o << ")"; - --depth; - return o; -} -#endif - -////////////////////////////////// -template <typename IteratorT, typename ValueT> -struct node_iter_data -{ - typedef IteratorT iterator_t; - typedef IteratorT /*const*/ const_iterator_t; - - node_iter_data() - : first(), last(), is_root_(false), parser_id_(), value_() - {} - - node_iter_data(IteratorT const& _first, IteratorT const& _last) - : first(_first), last(_last), is_root_(false), parser_id_(), value_() - {} - - void swap(node_iter_data& x) - { - impl::cp_swap(first, x.first); - impl::cp_swap(last, x.last); - impl::cp_swap(parser_id_, x.parser_id_); - impl::cp_swap(is_root_, x.is_root_); - impl::cp_swap(value_, x.value_); - } - - IteratorT begin() - { - return first; - } - - IteratorT const& begin() const - { - return first; - } - - IteratorT end() - { - return last; - } - - IteratorT const& end() const - { - return last; - } - - bool is_root() const - { - return is_root_; - } - - void is_root(bool b) - { - is_root_ = b; - } - - parser_id id() const - { - return parser_id_; - } - - void id(parser_id r) - { - parser_id_ = r; - } - - ValueT const& value() const - { - return value_; - } - - void value(ValueT const& v) - { - value_ = v; - } -private: - IteratorT first, last; - bool is_root_; - parser_id parser_id_; - ValueT value_; - -public: -}; - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) -// value is default nil_t, so provide an operator<< for nil_t -inline std::ostream& -operator<<(std::ostream& o, nil_t const&) -{ - return o; -} - -template <typename IteratorT, typename ValueT> -inline std::ostream& -operator<<(std::ostream& o, node_iter_data<IteratorT, ValueT> const& n) -{ - o << "(id = " << n.id() << " text = \""; - typedef typename node_iter_data<IteratorT, ValueT>::const_iterator_t - iterator_t; - for (iterator_t it = n.begin(); it != n.end(); ++it) - impl::token_printer(o, *it); - o << "\" is_root = " << n.is_root() - << /*" value = " << n.value() << */")"; - return o; -} -#endif - -////////////////////////////////// -template <typename IteratorT = char const*, typename ValueT = nil_t> -struct node_val_data -{ - typedef - typename boost::detail::iterator_traits<IteratorT>::value_type - value_type; - typedef std::vector<value_type> container_t; - typedef typename container_t::iterator iterator_t; - typedef typename container_t::const_iterator const_iterator_t; - - node_val_data() - : text(), is_root_(false), parser_id_(), value_() - {} - -#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) - node_val_data(IteratorT const& _first, IteratorT const& _last) - : text(), is_root_(false), parser_id_(), value_() - { - std::copy(_first, _last, std::inserter(text, text.end())); - } - - // This constructor is for building text out of vector iterators - template <typename IteratorT2> - node_val_data(IteratorT2 const& _first, IteratorT2 const& _last) - : text(), is_root_(false), parser_id_(), value_() - { - std::copy(_first, _last, std::inserter(text, text.end())); - } -#else - node_val_data(IteratorT const& _first, IteratorT const& _last) - : text(_first, _last), is_root_(false), parser_id_(), value_() - {} - - // This constructor is for building text out of vector iterators - template <typename IteratorT2> - node_val_data(IteratorT2 const& _first, IteratorT2 const& _last) - : text(_first, _last), is_root_(false), parser_id_(), value_() - {} -#endif - - void swap(node_val_data& x) - { - impl::cp_swap(text, x.text); - impl::cp_swap(is_root_, x.is_root_); - impl::cp_swap(parser_id_, x.parser_id_); - impl::cp_swap(value_, x.value_); - } - - typename container_t::iterator begin() - { - return text.begin(); - } - - typename container_t::const_iterator begin() const - { - return text.begin(); - } - - typename container_t::iterator end() - { - return text.end(); - } - - typename container_t::const_iterator end() const - { - return text.end(); - } - - bool is_root() const - { - return is_root_; - } - - void is_root(bool b) - { - is_root_ = b; - } - - parser_id id() const - { - return parser_id_; - } - - void id(parser_id r) - { - parser_id_ = r; - } - - ValueT const& value() const - { - return value_; - } - - void value(ValueT const& v) - { - value_ = v; - } - -private: - container_t text; - bool is_root_; - parser_id parser_id_; - ValueT value_; -}; - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) -template <typename IteratorT, typename ValueT> -inline std::ostream& -operator<<(std::ostream& o, node_val_data<IteratorT, ValueT> const& n) -{ - o << "(id = " << n.id() << " text = \""; - typedef typename node_val_data<IteratorT, ValueT>::const_iterator_t - iterator_t; - for (iterator_t it = n.begin(); it != n.end(); ++it) - impl::token_printer(o, *it); - o << "\" is_root = " << n.is_root() - << " value = " << n.value() << ")"; - return o; -} -#endif - -template <typename T> -inline void -swap(tree_node<T>& a, tree_node<T>& b) -{ - a.swap(b); -} - -template <typename T, typename V> -inline void -swap(node_iter_data<T, V>& a, node_iter_data<T, V>& b) -{ - a.swap(b); -} - -////////////////////////////////// -template <typename ValueT = nil_t> -class node_iter_data_factory; - -////////////////////////////////// -template <typename ValueT> -class node_iter_data_factory -{ -public: - // This inner class is so that node_iter_data_factory can simluate - // a template template parameter - template <typename IteratorT> - class factory - { - public: - typedef IteratorT iterator_t; - typedef node_iter_data<iterator_t, ValueT> node_t; - - static node_t create_node(iterator_t const& first, iterator_t const& last, - bool /*is_leaf_node*/) - { - return node_t(first, last); - } - - static node_t empty_node() - { - return node_t(); - } - - // precondition: ContainerT contains a tree_node<node_t>. And all - // iterators in the container point to the same sequence. - template <typename ContainerT> - static node_t group_nodes(ContainerT const& nodes) - { - return node_t(nodes.begin()->value.begin(), - nodes.back().value.end()); - } - }; -}; - -////////////////////////////////// -template <typename ValueT = nil_t> -class node_val_data_factory; - -////////////////////////////////// -template <typename ValueT> -class node_val_data_factory -{ -public: - // This inner class is so that node_val_data_factory can simluate - // a template template parameter - template <typename IteratorT> - class factory - { - public: - typedef IteratorT iterator_t; - typedef node_val_data<iterator_t, ValueT> node_t; - - static node_t create_node(iterator_t const& first, iterator_t const& last, - bool is_leaf_node) - { - if (is_leaf_node) - return node_t(first, last); - else - return node_t(); - } - - static node_t empty_node() - { - return node_t(); - } - - template <typename ContainerT> - static node_t group_nodes(ContainerT const& nodes) - { - typename node_t::container_t c; - typename ContainerT::const_iterator i_end = nodes.end(); - // copy all the nodes text into a new one - for (typename ContainerT::const_iterator i = nodes.begin(); - i != i_end; ++i) - { - // See docs: token_node_d or leaf_node_d cannot be used with a - // rule inside the []. - assert(i->children.size() == 0); - c.insert(c.end(), i->value.begin(), i->value.end()); - } - return node_t(c.begin(), c.end()); - } - }; -}; - - -////////////////////////////////// -template <typename ValueT = nil_t> -class node_all_val_data_factory; - -////////////////////////////////// -template <typename ValueT> -class node_all_val_data_factory -{ -public: - // This inner class is so that node_all_val_data_factory can simluate - // a template template parameter - template <typename IteratorT> - class factory - { - public: - typedef IteratorT iterator_t; - typedef node_val_data<iterator_t, ValueT> node_t; - - static node_t create_node(iterator_t const& first, iterator_t const& last, - bool /*is_leaf_node*/) - { - return node_t(first, last); - } - - static node_t empty_node() - { - return node_t(); - } - - template <typename ContainerT> - static node_t group_nodes(ContainerT const& nodes) - { - typename node_t::container_t c; - typename ContainerT::const_iterator i_end = nodes.end(); - // copy all the nodes text into a new one - for (typename ContainerT::const_iterator i = nodes.begin(); - i != i_end; ++i) - { - // See docs: token_node_d or leaf_node_d cannot be used with a - // rule inside the []. - assert(i->children.size() == 0); - c.insert(c.end(), i->value.begin(), i->value.end()); - } - return node_t(c.begin(), c.end()); - } - }; -}; - -// forward declaration -template < - typename IteratorT, - typename NodeFactoryT = node_val_data_factory<nil_t>, - typename T = nil_t -> -class tree_match; - -namespace impl { - - /////////////////////////////////////////////////////////////////////////// - // can't call unqualified swap from within classname::swap - // as Koenig lookup rules will find only the classname::swap - // member function not the global declaration, so use cp_swap - // as a forwarding function (JM): -#if __GNUC__ == 2 - using ::std::swap; -#endif - template <typename T> - inline void cp_swap(T& t1, T& t2) - { - using std::swap; - using boost::spirit::swap; - using boost::swap; - swap(t1, t2); - } -} - -////////////////////////////////// -template <typename IteratorT, typename NodeFactoryT, typename T> -class tree_match : public match<T> -{ -public: - - typedef typename NodeFactoryT::template factory<IteratorT> node_factory_t; - typedef typename node_factory_t::node_t parse_node_t; - typedef tree_node<parse_node_t> node_t; - typedef typename node_t::children_t container_t; - typedef typename container_t::iterator tree_iterator; - typedef typename container_t::const_iterator const_tree_iterator; - - typedef T attr_t; - typedef typename boost::call_traits<T>::param_type param_type; - typedef typename boost::call_traits<T>::reference reference; - typedef typename boost::call_traits<T>::const_reference const_reference; - - tree_match() - : match<T>(), trees() - {} - - explicit - tree_match(std::size_t length) - : match<T>(length), trees() - {} - - tree_match(std::size_t length, parse_node_t const& n) - : match<T>(length), trees() - { - trees.reserve(10); // this is more or less an arbitraty number... - trees.push_back(node_t(n)); - } - - tree_match(std::size_t length, param_type val, parse_node_t const& n) - : match<T>(length, val), trees() - { - trees.reserve(10); // this is more or less an arbitraty number... - trees.push_back(node_t(n)); - } - - // attention, these constructors will change the second parameter! - tree_match(std::size_t length, container_t& c) - : match<T>(length), trees() - { - impl::cp_swap(trees, c); - } - - tree_match(std::size_t length, param_type val, container_t& c) - : match<T>(length, val), trees() - { - impl::cp_swap(trees, c); - } - - template <typename T2> - tree_match(match<T2> const& other) - : match<T>(other), trees() - {} - - template <typename T2, typename T3, typename T4> - tree_match(tree_match<T2, T3, T4> const& other) - : match<T>(other), trees() - { impl::cp_swap(trees, other.trees); } - - template <typename T2> - tree_match& - operator=(match<T2> const& other) - { - match<T>::operator=(other); - return *this; - } - - template <typename T2, typename T3, typename T4> - tree_match& - operator=(tree_match<T2, T3, T4> const& other) - { - match<T>::operator=(other); - impl::cp_swap(trees, other.trees); - return *this; - } - - tree_match(tree_match const& x) - : match<T>(x), trees() - { - // use auto_ptr like ownership for the trees data member - impl::cp_swap(trees, x.trees); - } - - tree_match& operator=(tree_match const& x) - { - tree_match tmp(x); - this->swap(tmp); - return *this; - } - - void swap(tree_match& x) - { - match<T>::swap(x); - impl::cp_swap(trees, x.trees); - } - - mutable container_t trees; -}; - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) -template <typename IteratorT, typename NodeFactoryT, typename T> -inline std::ostream& -operator<<(std::ostream& o, tree_match<IteratorT, NodeFactoryT, T> const& m) -{ - typedef - typename tree_match<IteratorT, NodeFactoryT, T>::container_t::iterator - iterator; - - o << "(length = " << (int)m.length(); - int c = 0; - for (iterator i = m.trees.begin(); i != m.trees.end(); ++i) - { - o << " trees[" << c++ << "] = " << *i; - } - o << "\n)"; - return o; -} -#endif - -////////////////////////////////// -struct tree_policy -{ - template <typename FunctorT, typename MatchT> - static void apply_op_to_match(FunctorT const& /*op*/, MatchT& /*m*/) - {} - - template <typename MatchT, typename Iterator1T, typename Iterator2T> - static void group_match(MatchT& /*m*/, parser_id const& /*id*/, - Iterator1T const& /*first*/, Iterator2T const& /*last*/) - {} - - template <typename MatchT> - static void concat(MatchT& /*a*/, MatchT const& /*b*/) - {} -}; - -////////////////////////////////// -template < - typename MatchPolicyT, - typename IteratorT, - typename NodeFactoryT, - typename TreePolicyT -> -struct common_tree_match_policy : public match_policy -{ - template <typename T> - struct result { typedef tree_match<IteratorT, NodeFactoryT, T> type; }; - - typedef tree_match<IteratorT, NodeFactoryT> match_t; - typedef IteratorT iterator_t; - typedef TreePolicyT tree_policy_t; - typedef NodeFactoryT factory_t; - - static const match_t no_match() { return match_t(); } - static const match_t empty_match() - { return match_t(0, tree_policy_t::empty_node()); } - - template <typename AttrT, typename Iterator1T, typename Iterator2T> - static tree_match<IteratorT, NodeFactoryT, AttrT> create_match( - std::size_t length, - AttrT const& val, - Iterator1T const& first, - Iterator2T const& last) - { -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) - - BOOST_SPIRIT_DEBUG_OUT << "\n>>> create_node(begin) <<<\n" - "creating node text: \""; - for (Iterator1T it = first; it != last; ++it) - impl::token_printer(BOOST_SPIRIT_DEBUG_OUT, *it); - BOOST_SPIRIT_DEBUG_OUT << "\"\n"; - BOOST_SPIRIT_DEBUG_OUT << ">>> create_node(end) <<<\n\n"; -#endif - return tree_match<IteratorT, NodeFactoryT, AttrT>(length, val, - tree_policy_t::create_node(length, first, last, true)); - } - - template <typename Match1T, typename Match2T> - static void concat_match(Match1T& a, Match2T const& b) - { -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_NODES) - - BOOST_SPIRIT_DEBUG_OUT << "\n>>> concat_match(begin) <<<\n"; - BOOST_SPIRIT_DEBUG_OUT << "tree a:\n" << a << "\n"; - BOOST_SPIRIT_DEBUG_OUT << "tree b:\n" << b << "\n"; - BOOST_SPIRIT_DEBUG_OUT << ">>> concat_match(end) <<<\n\n"; -#endif - BOOST_SPIRIT_ASSERT(a && b); - if (a.length() == 0) - { - a = b; - return; - } - else if (b.length() == 0 -#ifdef BOOST_SPIRIT_NO_TREE_NODE_COLLAPSING - && !b.trees.begin()->value.id().to_long() -#endif - ) - { - return; - } - a.concat(b); - tree_policy_t::concat(a, b); - } - - template <typename MatchT, typename IteratorT2> - void - group_match( - MatchT& m, - parser_id const& id, - IteratorT2 const& first, - IteratorT2 const& last) const - { - if (!m) return; - -#if defined(BOOST_SPIRIT_DEBUG) && \ - (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_TREES) - - BOOST_SPIRIT_DEBUG_OUT << "\n>>> group_match(begin) <<<\n" - "new node(" << id << ") \""; - for (IteratorT2 it = first; it != last; ++it) - impl::token_printer(BOOST_SPIRIT_DEBUG_OUT, *it); - BOOST_SPIRIT_DEBUG_OUT << "\"\n"; - BOOST_SPIRIT_DEBUG_OUT << "new child tree (before grouping):\n" << m << "\n"; - - tree_policy_t::group_match(m, id, first, last); - - BOOST_SPIRIT_DEBUG_OUT << "new child tree (after grouping):\n" << m << "\n"; - BOOST_SPIRIT_DEBUG_OUT << ">>> group_match(end) <<<\n\n"; -#else - tree_policy_t::group_match(m, id, first, last); -#endif - } -}; - -////////////////////////////////// -template <typename MatchPolicyT, typename NodeFactoryT> -struct common_tree_tree_policy -{ - typedef typename MatchPolicyT::iterator_t iterator_t; - typedef typename MatchPolicyT::match_t match_t; - typedef typename NodeFactoryT::template factory<iterator_t> factory_t; - typedef typename factory_t::node_t node_t; - - template <typename Iterator1T, typename Iterator2T> - static node_t - create_node(std::size_t /*length*/, Iterator1T const& first, - Iterator2T const& last, bool leaf_node) - { - return factory_t::create_node(first, last, leaf_node); - } - - static node_t - empty_node() - { - return factory_t::empty_node(); - } - - template <typename FunctorT> - static void apply_op_to_match(FunctorT const& op, match_t& m) - { - op(m); - } -}; - -////////////////////////////////// -// directives to modify how the parse tree is generated - -struct no_tree_gen_node_parser_gen; - -template <typename T> -struct no_tree_gen_node_parser -: public unary<T, parser<no_tree_gen_node_parser<T> > > -{ - typedef no_tree_gen_node_parser<T> self_t; - typedef no_tree_gen_node_parser_gen parser_generator_t; - typedef unary_parser_category parser_category_t; -// typedef no_tree_gen_node_parser<T> const &embed_t; - - no_tree_gen_node_parser(T const& a) - : unary<T, parser<no_tree_gen_node_parser<T> > >(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scanner) const - { - typedef typename ScannerT::iteration_policy_t iteration_policy_t; - typedef match_policy match_policy_t; - typedef typename ScannerT::action_policy_t action_policy_t; - typedef scanner_policies< - iteration_policy_t, - match_policy_t, - action_policy_t - > policies_t; - - return this->subject().parse(scanner.change_policies(policies_t(scanner))); - } -}; - -////////////////////////////////// -struct no_tree_gen_node_parser_gen -{ - template <typename T> - struct result { - - typedef no_tree_gen_node_parser<T> type; - }; - - template <typename T> - static no_tree_gen_node_parser<T> - generate(parser<T> const& s) - { - return no_tree_gen_node_parser<T>(s.derived()); - } - - template <typename T> - no_tree_gen_node_parser<T> - operator[](parser<T> const& s) const - { - return no_tree_gen_node_parser<T>(s.derived()); - } -}; - -////////////////////////////////// -const no_tree_gen_node_parser_gen no_node_d = no_tree_gen_node_parser_gen(); - - -////////////////////////////////// -namespace impl { - - template <typename MatchPolicyT> - struct tree_policy_selector - { - typedef tree_policy type; - }; - -} // namespace impl - -////////////////////////////////// -template <typename NodeParserT> -struct node_parser_gen; - -template <typename T, typename NodeParserT> -struct node_parser -: public unary<T, parser<node_parser<T, NodeParserT> > > -{ - typedef node_parser<T, NodeParserT> self_t; - typedef node_parser_gen<NodeParserT> parser_generator_t; - typedef unary_parser_category parser_category_t; -// typedef node_parser<T, NodeParserT> const &embed_t; - - node_parser(T const& a) - : unary<T, parser<node_parser<T, NodeParserT> > >(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scanner) const - { - typename parser_result<self_t, ScannerT>::type hit = this->subject().parse(scanner); - if (hit) - { - impl::tree_policy_selector<typename ScannerT::match_policy_t>::type::apply_op_to_match(NodeParserT(), hit); - } - return hit; - } -}; - -////////////////////////////////// -template <typename NodeParserT> -struct node_parser_gen -{ - template <typename T> - struct result { - - typedef node_parser<T, NodeParserT> type; - }; - - template <typename T> - static node_parser<T, NodeParserT> - generate(parser<T> const& s) - { - return node_parser<T, NodeParserT>(s.derived()); - } - - template <typename T> - node_parser<T, NodeParserT> - operator[](parser<T> const& s) const - { - return node_parser<T, NodeParserT>(s.derived()); - } -}; - -struct discard_node_op -{ - template <typename MatchT> - void operator()(MatchT& m) const - { - m.trees.clear(); - } -}; - -const node_parser_gen<discard_node_op> discard_node_d = - node_parser_gen<discard_node_op>(); - -struct leaf_node_op -{ - template <typename MatchT> - void operator()(MatchT& m) const - { - if (m.trees.size() == 1) - { - m.trees.begin()->children.clear(); - } - else if (m.trees.size() > 1) - { - typedef typename MatchT::node_factory_t node_factory_t; - m = MatchT(m.length(), node_factory_t::group_nodes(m.trees)); - } - } -}; - -const node_parser_gen<leaf_node_op> leaf_node_d = - node_parser_gen<leaf_node_op>(); -const node_parser_gen<leaf_node_op> token_node_d = - node_parser_gen<leaf_node_op>(); - -struct infix_node_op -{ - template <typename MatchT> - void operator()(MatchT& m) const - { - typedef typename MatchT::container_t container_t; - typedef typename MatchT::container_t::iterator iter_t; - typedef typename MatchT::container_t::value_type value_t; - - using std::swap; - using boost::swap; - using boost::spirit::swap; - - // copying the tree nodes is expensive, since it may copy a whole - // tree. swapping them is cheap, so swap the nodes we want into - // a new container of children. - container_t new_children; - std::size_t length = 0; - std::size_t tree_size = m.trees.size(); - - // the infix_node_d[] make no sense for nodes with no subnodes - BOOST_SPIRIT_ASSERT(tree_size >= 1); - - bool keep = true; - new_children.reserve((tree_size+1)/2); - iter_t i_end = m.trees.end(); - for (iter_t i = m.trees.begin(); i != i_end; ++i) - { - if (keep) { - // adjust the length - length += std::distance((*i).value.begin(), (*i).value.end()); - - // move the child node - new_children.push_back(value_t()); - swap(new_children.back(), *i); - keep = false; - } - else { - // ignore this child node - keep = true; - } - } - - m = MatchT(length, new_children); - } -}; - -const node_parser_gen<infix_node_op> infix_node_d = - node_parser_gen<infix_node_op>(); - -struct discard_first_node_op -{ - template <typename MatchT> - void operator()(MatchT& m) const - { - typedef typename MatchT::container_t container_t; - typedef typename MatchT::container_t::iterator iter_t; - typedef typename MatchT::container_t::value_type value_t; - - using std::swap; - using boost::swap; - using boost::spirit::swap; - - // copying the tree nodes is expensive, since it may copy a whole - // tree. swapping them is cheap, so swap the nodes we want into - // a new container of children, instead of saying - // m.trees.erase(m.trees.begin()) because, on a vector that will cause - // all the nodes afterwards to be copied into the previous position. - container_t new_children; - std::size_t length = 0; - std::size_t tree_size = m.trees.size(); - - // the discard_first_node_d[] make no sense for nodes with no subnodes - BOOST_SPIRIT_ASSERT(tree_size >= 1); - - if (tree_size > 1) { - new_children.reserve(tree_size - 1); - iter_t i = m.trees.begin(), i_end = m.trees.end(); - for (++i; i != i_end; ++i) - { - // adjust the length - length += std::distance((*i).value.begin(), (*i).value.end()); - - // move the child node - new_children.push_back(value_t()); - swap(new_children.back(), *i); - } - } - else { - // if there was a tree and now there isn't any, insert an empty node - iter_t i = m.trees.begin(); - - // This isn't entirely correct, since the empty node will reference - // the end of the discarded node, but I currently don't see any way to - // get at the begin of the node following this subnode. - // This should be safe anyway because the it shouldn't get dereferenced - // under any circumstances. - typedef typename value_t::parse_node_t::iterator_t iterator_type; - iterator_type it = (*i).value.end(); - - new_children.push_back( - value_t(typename value_t::parse_node_t(it, it))); - } - - m = MatchT(length, new_children); - } -}; - -const node_parser_gen<discard_first_node_op> discard_first_node_d = - node_parser_gen<discard_first_node_op>(); - -struct discard_last_node_op -{ - template <typename MatchT> - void operator()(MatchT& m) const - { - typedef typename MatchT::container_t container_t; - typedef typename MatchT::container_t::iterator iter_t; - typedef typename MatchT::container_t::value_type value_t; - - using std::swap; - using boost::swap; - using boost::spirit::swap; - - // copying the tree nodes is expensive, since it may copy a whole - // tree. swapping them is cheap, so swap the nodes we want into - // a new container of children, instead of saying - // m.trees.erase(m.trees.begin()) because, on a vector that will cause - // all the nodes afterwards to be copied into the previous position. - container_t new_children; - std::size_t length = 0; - std::size_t tree_size = m.trees.size(); - - // the discard_last_node_d[] make no sense for nodes with no subnodes - BOOST_SPIRIT_ASSERT(tree_size >= 1); - - if (tree_size > 1) { - m.trees.pop_back(); - new_children.reserve(tree_size - 1); - - iter_t i_end = m.trees.end(); - for (iter_t i = m.trees.begin(); i != i_end; ++i) - { - // adjust the length - length += std::distance((*i).value.begin(), (*i).value.end()); - - // move the child node - new_children.push_back(value_t()); - swap(new_children.back(), *i); - } - } - else { - // if there was a tree and now there isn't any, insert an empty node - iter_t i = m.trees.begin(); - - typedef typename value_t::parse_node_t::iterator_t iterator_type; - iterator_type it = (*i).value.begin(); - - new_children.push_back( - value_t(typename value_t::parse_node_t(it, it))); - } - - m = MatchT(length, new_children); - } -}; - -const node_parser_gen<discard_last_node_op> discard_last_node_d = - node_parser_gen<discard_last_node_op>(); - -struct inner_node_op -{ - template <typename MatchT> - void operator()(MatchT& m) const - { - typedef typename MatchT::container_t container_t; - typedef typename MatchT::container_t::iterator iter_t; - typedef typename MatchT::container_t::value_type value_t; - - using std::swap; - using boost::swap; - using boost::spirit::swap; - - // copying the tree nodes is expensive, since it may copy a whole - // tree. swapping them is cheap, so swap the nodes we want into - // a new container of children, instead of saying - // m.trees.erase(m.trees.begin()) because, on a vector that will cause - // all the nodes afterwards to be copied into the previous position. - container_t new_children; - std::size_t length = 0; - std::size_t tree_size = m.trees.size(); - - // the inner_node_d[] make no sense for nodes with less then 2 subnodes - BOOST_SPIRIT_ASSERT(tree_size >= 2); - - if (tree_size > 2) { - m.trees.pop_back(); // erase the last element - new_children.reserve(tree_size - 1); - iter_t i = m.trees.begin(); // skip over the first element - iter_t i_end = m.trees.end(); - for (++i; i != i_end; ++i) - { - // adjust the length - length += std::distance((*i).value.begin(), (*i).value.end()); - - // move the child node - new_children.push_back(value_t()); - swap(new_children.back(), *i); - } - } - else { - // if there was a tree and now there isn't any, insert an empty node - iter_t i = m.trees.begin(); // skip over the first element - - typedef typename value_t::parse_node_t::iterator_t iterator_type; - iterator_type it = (*++i).value.begin(); - - new_children.push_back( - value_t(typename value_t::parse_node_t(it, it))); - } - - m = MatchT(length, new_children); - } -}; - -const node_parser_gen<inner_node_op> inner_node_d = - node_parser_gen<inner_node_op>(); - - -////////////////////////////////// -// action_directive_parser and action_directive_parser_gen -// are meant to be used as a template to create directives that -// generate action classes. For example access_match and -// access_node. The ActionParserT template parameter must be -// a class that has an innter class called action that is templated -// on the parser type and the action type. -template <typename ActionParserT> -struct action_directive_parser_gen; - -template <typename T, typename ActionParserT> -struct action_directive_parser -: public unary<T, parser<action_directive_parser<T, ActionParserT> > > -{ - typedef action_directive_parser<T, ActionParserT> self_t; - typedef action_directive_parser_gen<ActionParserT> parser_generator_t; - typedef unary_parser_category parser_category_t; -// typedef action_directive_parser<T, ActionParserT> const &embed_t; - - action_directive_parser(T const& a) - : unary<T, parser<action_directive_parser<T, ActionParserT> > >(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scanner) const - { - return this->subject().parse(scanner); - } - - template <typename ActionT> - typename ActionParserT::template action<action_directive_parser<T, ActionParserT>, ActionT> - operator[](ActionT const& actor) const - { - typedef typename - ActionParserT::template action<action_directive_parser, ActionT> - action_t; - return action_t(*this, actor); - } -}; - -////////////////////////////////// -template <typename ActionParserT> -struct action_directive_parser_gen -{ - template <typename T> - struct result { - - typedef action_directive_parser<T, ActionParserT> type; - }; - - template <typename T> - static action_directive_parser<T, ActionParserT> - generate(parser<T> const& s) - { - return action_directive_parser<T, ActionParserT>(s.derived()); - } - - template <typename T> - action_directive_parser<T, ActionParserT> - operator[](parser<T> const& s) const - { - return action_directive_parser<T, ActionParserT>(s.derived()); - } -}; - -////////////////////////////////// -// Calls the attached action passing it the match from the parser -// and the first and last iterators -struct access_match_action -{ - // inner template class to simulate template-template parameters - template <typename ParserT, typename ActionT> - struct action - : public unary<ParserT, parser<access_match_action::action<ParserT, ActionT> > > - { - typedef action_parser_category parser_category; - typedef action<ParserT, ActionT> self_t; - - action( ParserT const& subject, - ActionT const& actor_); - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scanner) const; - - ActionT const &predicate() const; - - private: - ActionT actor; - }; -}; - -////////////////////////////////// -template <typename ParserT, typename ActionT> -access_match_action::action<ParserT, ActionT>::action( - ParserT const& subject, - ActionT const& actor_) -: unary<ParserT, parser<access_match_action::action<ParserT, ActionT> > >(subject) -, actor(actor_) -{} - -////////////////////////////////// -template <typename ParserT, typename ActionT> -template <typename ScannerT> -typename parser_result<access_match_action::action<ParserT, ActionT>, ScannerT>::type -access_match_action::action<ParserT, ActionT>:: -parse(ScannerT const& scan) const -{ - typedef typename ScannerT::iterator_t iterator_t; - typedef typename parser_result<self_t, ScannerT>::type result_t; - if (!scan.at_end()) - { - iterator_t save = scan.first; - result_t hit = this->subject().parse(scan); - actor(hit, save, scan.first); - return hit; - } - return scan.no_match(); -} - -////////////////////////////////// -template <typename ParserT, typename ActionT> -ActionT const &access_match_action::action<ParserT, ActionT>::predicate() const -{ - return actor; -} - -////////////////////////////////// -const action_directive_parser_gen<access_match_action> access_match_d - = action_directive_parser_gen<access_match_action>(); - - - -////////////////////////////////// -// Calls the attached action passing it the node from the parser -// and the first and last iterators -struct access_node_action -{ - // inner template class to simulate template-template parameters - template <typename ParserT, typename ActionT> - struct action - : public unary<ParserT, parser<access_node_action::action<ParserT, ActionT> > > - { - typedef action_parser_category parser_category; - typedef action<ParserT, ActionT> self_t; - - action( ParserT const& subject, - ActionT const& actor_); - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scanner) const; - - ActionT const &predicate() const; - - private: - ActionT actor; - }; -}; - -////////////////////////////////// -template <typename ParserT, typename ActionT> -access_node_action::action<ParserT, ActionT>::action( - ParserT const& subject, - ActionT const& actor_) -: unary<ParserT, parser<access_node_action::action<ParserT, ActionT> > >(subject) -, actor(actor_) -{} - -////////////////////////////////// -template <typename ParserT, typename ActionT> -template <typename ScannerT> -typename parser_result<access_node_action::action<ParserT, ActionT>, ScannerT>::type -access_node_action::action<ParserT, ActionT>:: -parse(ScannerT const& scan) const -{ - typedef typename ScannerT::iterator_t iterator_t; - typedef typename parser_result<self_t, ScannerT>::type result_t; - if (!scan.at_end()) - { - iterator_t save = scan.first; - result_t hit = this->subject().parse(scan); - if (hit && hit.trees.size() > 0) - actor(*hit.trees.begin(), save, scan.first); - return hit; - } - return scan.no_match(); -} - -////////////////////////////////// -template <typename ParserT, typename ActionT> -ActionT const &access_node_action::action<ParserT, ActionT>::predicate() const -{ - return actor; -} - -////////////////////////////////// -const action_directive_parser_gen<access_node_action> access_node_d - = action_directive_parser_gen<access_node_action>(); - - - -////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// tree_parse_info -// -// Results returned by the tree parse functions: -// -// stop: points to the final parse position (i.e parsing -// processed the input up to this point). -// -// match: true if parsing is successful. This may be full: -// the parser consumed all the input, or partial: -// the parser consumed only a portion of the input. -// -// full: true when we have a full match (i.e the parser -// consumed all the input. -// -// length: The number of characters consumed by the parser. -// This is valid only if we have a successful match -// (either partial or full). A negative value means -// that the match is unsucessful. -// -// trees: Contains the root node(s) of the tree. -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename IteratorT = char const *, - typename NodeFactoryT = node_val_data_factory<nil_t>, - typename T = nil_t -> -struct tree_parse_info { - - IteratorT stop; - bool match; - bool full; - std::size_t length; - typename tree_match<IteratorT, NodeFactoryT, T>::container_t trees; - - tree_parse_info() - : stop() - , match(false) - , full(false) - , length(0) - , trees() - {} - - template <typename IteratorT2> - tree_parse_info(tree_parse_info<IteratorT2> const& pi) - : stop(pi.stop) - , match(pi.match) - , full(pi.full) - , length(pi.length) - , trees() - { - using std::swap; - using boost::swap; - using boost::spirit::swap; - - // use auto_ptr like ownership for the trees data member - swap(trees, pi.trees); - } - - tree_parse_info( - IteratorT stop_, - bool match_, - bool full_, - std::size_t length_, - typename tree_match<IteratorT, NodeFactoryT, T>::container_t trees_) - : stop(stop_) - , match(match_) - , full(full_) - , length(length_) - , trees() - { - using std::swap; - using boost::swap; - using boost::spirit::swap; - - // use auto_ptr like ownership for the trees data member - swap(trees, trees_); - } -}; - -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/tree/impl/parse_tree_utils.ipp b/Utilities/BGL/boost/spirit/tree/impl/parse_tree_utils.ipp deleted file mode 100644 index 0d988eea1296c77b9094b83d98cb2f95e9750222..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/impl/parse_tree_utils.ipp +++ /dev/null @@ -1,131 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2001-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -#if !defined(PARSE_TREE_UTILS_IPP) -#define PARSE_TREE_UTILS_IPP - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { -namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// Returnes the first leaf node of the given parsetree. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -inline tree_node<T> const & -get_first_leaf (tree_node<T> const &node) -{ - if (node.children.size() > 0) - return get_first_leaf(*node.children.begin()); - return node; -} - -/////////////////////////////////////////////////////////////////////////////// -// -// Find a specified node through recursive search. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -inline bool -find_node (tree_node<T> const &node, parser_id node_to_search, - tree_node<T> const **found_node) -{ - if (node.value.id() == node_to_search) { - *found_node = &node; - return true; - } - if (node.children.size() > 0) { - typedef typename tree_node<T>::const_tree_iterator const_tree_iterator; - - const_tree_iterator end = node.children.end(); - for (const_tree_iterator it = node.children.begin(); it != end; ++it) - { - if (find_node (*it, node_to_search, found_node)) - return true; - } - } - return false; // not found here -} - -/////////////////////////////////////////////////////////////////////////////// -// -// The functions 'get_node_range' return a pair of iterators pointing at the -// range, which containes the elements of a specified node. -// -/////////////////////////////////////////////////////////////////////////////// -namespace impl { - -template <typename T> -inline bool -get_node_range (typename tree_node<T>::const_tree_iterator const &start, - parser_id node_to_search, - std::pair<typename tree_node<T>::const_tree_iterator, - typename tree_node<T>::const_tree_iterator> &nodes) -{ -// look at this node first -tree_node<T> const &node = *start; - - if (node.value.id() == node_to_search) { - if (node.children.size() > 0) { - // full subrange - nodes.first = node.children.begin(); - nodes.second = node.children.end(); - } - else { - // only this node - nodes.first = start; - nodes.second = start; - std::advance(nodes.second, 1); - } - return true; - } - -// look at subnodes now - if (node.children.size() > 0) { - typedef typename tree_node<T>::const_tree_iterator const_tree_iterator; - - const_tree_iterator end = node.children.end(); - for (const_tree_iterator it = node.children.begin(); it != end; ++it) - { - if (impl::get_node_range<T>(it, node_to_search, nodes)) - return true; - } - } - return false; -} - -} // end of namespace impl - -template <typename T> -inline bool -get_node_range (tree_node<T> const &node, parser_id node_to_search, - std::pair<typename tree_node<T>::const_tree_iterator, - typename tree_node<T>::const_tree_iterator> &nodes) -{ - if (node.children.size() > 0) { - typedef typename tree_node<T>::const_tree_iterator const_tree_iterator; - - const_tree_iterator end = node.children.end(); - for (const_tree_iterator it = node.children.begin(); it != end; ++it) - { - if (impl::get_node_range<T>(it, node_to_search, nodes)) - return true; - } - } - return false; -} - -/////////////////////////////////////////////////////////////////////////////// -} // namespace spirit -} // namespace boost - -#endif // !defined(PARSE_TREE_UTILS_IPP) diff --git a/Utilities/BGL/boost/spirit/tree/impl/tree_to_xml.ipp b/Utilities/BGL/boost/spirit/tree/impl/tree_to_xml.ipp deleted file mode 100644 index bf08b918fa271eb8efbec9fcab64637ee70eb741..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/impl/tree_to_xml.ipp +++ /dev/null @@ -1,401 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Hartmut Kaiser - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -#if !defined(TREE_TO_XML_IPP) -#define TREE_TO_XML_IPP - -#include <cstdio> -#include <cstdarg> - -#include <map> -#include <iostream> -#include <boost/config.hpp> -#ifdef BOOST_NO_STRINGSTREAM -#include <strstream> -#define BOOST_SPIRIT_OSSTREAM std::ostrstream -inline std::string BOOST_SPIRIT_GETSTRING(std::ostrstream& ss) -{ - ss << ends; - std::string rval = ss.str(); - ss.freeze(false); - return rval; -} -#else -#include <sstream> -#define BOOST_SPIRIT_GETSTRING(ss) ss.str() -#define BOOST_SPIRIT_OSSTREAM std::ostringstream -#endif - -namespace boost { namespace spirit { - -// xml formatting helper classes -namespace xml { - - inline void - encode (std::string &str, char s, char const *r, int len) - { - std::string::size_type pos = 0; - while ((pos = str.find_first_of (s, pos)) != - std::string::size_type(std::string::npos)) - { - str.replace (pos, 1, r); - pos += len; - } - } - - inline std::string - encode (std::string str) - { - encode(str, '&', "&", 3); - encode(str, '<', "<", 2); - encode(str, '>', ">", 2); - encode(str, '\r', "\\r", 1); - encode(str, '\n', "\\n", 1); - return str; - } - - inline std::string - encode (char const *text) - { - return encode (std::string(text)); - } - - // format a xml attribute - struct attribute - { - attribute() - { - } - - attribute (char const *key_, char const *value_) : - key (key_), value(value_) - { - } - - bool has_value() - { - return value.size() > 0; - } - - std::string key; - std::string value; - }; - - inline std::ostream& - operator<< (std::ostream &ostrm, attribute const &attr) - { - if (0 == attr.key.size()) - return ostrm; - ostrm << " " << encode(attr.key) << "=\"" << encode(attr.value) << "\""; - return ostrm; - } - - // output a xml element (base class, not used directly) - class element - { - protected: - element(std::ostream &ostrm_, bool incr_indent_ = true) : - ostrm(ostrm_), incr_indent(incr_indent_) - { - if (incr_indent) ++get_indent(); - } - ~element() - { - if (incr_indent) --get_indent(); - } - - public: - void output_space () - { - for (int i = 0; i < get_indent(); i++) - ostrm << " "; - } - - protected: - int &get_indent() - { - static int indent; - - return indent; - } - - std::ostream &ostrm; - bool incr_indent; - }; - - // a xml node - class node : public element - { - public: - node (std::ostream &ostrm_, char const *tag_, attribute &attr) : - element(ostrm_), tag(tag_) - { - output_space(); - ostrm << "<" << tag_ << attr << ">\n"; - } - node (std::ostream &ostrm_, char const *tag_) : - element(ostrm_), tag(tag_) - { - output_space(); - ostrm << "<" << tag_ << ">\n"; - } - ~node() - { - output_space(); - ostrm << "</" << tag << ">\n"; - } - - private: - std::string tag; - }; - - class text : public element - { - public: - text (std::ostream &ostrm, char const *tag, char const *text) : - element(ostrm) - { - output_space(); - ostrm << "<" << tag << ">" << encode(text) - << "</" << tag << ">\n"; - } - - text (std::ostream &ostrm, char const *tag, char const *text, - attribute &attr) : - element(ostrm) - { - output_space(); - ostrm << "<" << tag << attr << ">" << encode(text) - << "</" << tag << ">\n"; - } - - text (std::ostream &ostrm, char const *tag, char const *text, - attribute &attr1, attribute &attr2) : - element(ostrm) - { - output_space(); - ostrm << "<" << tag << attr1 << attr2 << ">" << encode(text) - << "</" << tag << ">\n"; - } - }; - - // a xml comment - class comment : public element - { - public: - comment (std::ostream &ostrm, char const *comment) : - element(ostrm, false) - { - if ('\0' != comment[0]) - { - output_space(); - ostrm << "<!-- " << encode(comment) << " -->\n"; - } - } - }; - - // a xml document - class document : public element - { - public: - document (std::ostream &ostrm) : element(ostrm) - { - get_indent() = -1; - ostrm << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; - } - - document (std::ostream &ostrm, char const *mainnode, char const *dtd) : - element(ostrm) - { - get_indent() = -1; - ostrm << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; - - output_space(); - ostrm << "<!DOCTYPE " << mainnode << " SYSTEM \"" << dtd - << "\">\n"; - } - ~document() - { - BOOST_SPIRIT_ASSERT(-1 == get_indent()); - } - }; - -} // end of namespace xml - -namespace impl { - - // look up the rule name from the given parser_id - template <typename AssocContainerT> - inline typename AssocContainerT::value_type::second_type - get_rulename (AssocContainerT const &id_to_name_map, - boost::spirit::parser_id const &id) - { - typename AssocContainerT::const_iterator it = id_to_name_map.find(id); - if (it != id_to_name_map.end()) - return (*it).second; - typedef typename AssocContainerT::value_type::second_type second_t; - return second_t(); - } - - // dump a parse tree as xml - template <typename IteratorT, typename GetIdT, typename GetValueT> - inline void - token_to_xml (std::ostream &ostrm, IteratorT const &it, bool is_root, - GetIdT const &get_token_id, GetValueT const &get_token_value) - { - BOOST_SPIRIT_OSSTREAM stream; - - stream << get_token_id(*it) << std::ends; - xml::attribute token_id ("id", BOOST_SPIRIT_GETSTRING(stream).c_str()); - xml::attribute is_root_attr ("is_root", is_root ? "1" : ""); - xml::attribute nil; - xml::text(ostrm, "token", get_token_value(*it).c_str(), - token_id, is_root_attr.has_value() ? is_root_attr : nil); - } - - template < - typename TreeNodeT, typename AssocContainerT, - typename GetIdT, typename GetValueT - > - inline void - tree_node_to_xml (std::ostream &ostrm, TreeNodeT const &node, - AssocContainerT const& id_to_name_map, GetIdT const &get_token_id, - GetValueT const &get_token_value) - { - typedef typename TreeNodeT::const_iterator node_iter_t; - typedef - typename TreeNodeT::value_type::parse_node_t::const_iterator_t - value_iter_t; - - xml::attribute nil; - node_iter_t end = node.end(); - for (node_iter_t it = node.begin(); it != end; ++it) - { - // output a node - xml::attribute id ("rule", - get_rulename(id_to_name_map, (*it).value.id()).c_str()); - xml::node currnode (ostrm, "parsenode", - (*it).value.id() != 0 && id.has_value() ? id : nil); - - // first dump the value - std::size_t cnt = std::distance((*it).value.begin(), (*it).value.end()); - - if (1 == cnt) - { - token_to_xml (ostrm, (*it).value.begin(), - (*it).value.is_root(), get_token_id, get_token_value); - } - else if (cnt > 1) - { - xml::node value (ostrm, "value"); - bool is_root = (*it).value.is_root(); - - value_iter_t val_end = (*it).value.end(); - for (value_iter_t val_it = (*it).value.begin(); - val_it != val_end; ++val_it) - { - token_to_xml (ostrm, val_it, is_root, get_token_id, - get_token_value); - } - } - tree_node_to_xml(ostrm, (*it).children, id_to_name_map, - get_token_id, get_token_value); // dump all subnodes - } - } - - template <typename TreeNodeT, typename AssocContainerT> - inline void - tree_node_to_xml (std::ostream &ostrm, TreeNodeT const &node, - AssocContainerT const& id_to_name_map) - { - typedef typename TreeNodeT::const_iterator node_iter_t; - - xml::attribute nil; - node_iter_t end = node.end(); - for (node_iter_t it = node.begin(); it != end; ++it) - { - // output a node - xml::attribute id ("rule", - get_rulename(id_to_name_map, (*it).value.id()).c_str()); - xml::node currnode (ostrm, "parsenode", - (*it).value.id() != parser_id() && id.has_value() ? id : nil); - - // first dump the value - if ((*it).value.begin() != (*it).value.end()) - { - std::string tokens ((*it).value.begin(), (*it).value.end()); - - if (tokens.size() > 0) - { - // output all subtokens as one string (for better readability) - xml::attribute is_root ("is_root", - (*it).value.is_root() ? "1" : ""); - xml::text(ostrm, "value", tokens.c_str(), - is_root.has_value() ? is_root : nil); - } - - } - // dump all subnodes - tree_node_to_xml(ostrm, (*it).children, id_to_name_map); - } - } - -} // namespace impl - -// dump a parse tree as a xml stream (generic variant) -template < - typename TreeNodeT, typename AssocContainerT, - typename GetIdT, typename GetValueT -> -inline void -tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree, -std::string const &input_line, AssocContainerT const& id_to_name, - GetIdT const &get_token_id, GetValueT const &get_token_value) -{ - // generate xml dump - xml::document doc (ostrm, "parsetree", "parsetree.dtd"); - xml::comment input (ostrm, input_line.c_str()); - xml::attribute ver ("version", "1.0"); - xml::node mainnode (ostrm, "parsetree", ver); - - impl::tree_node_to_xml (ostrm, tree, id_to_name, get_token_id, - get_token_value); -} - -// dump a parse tree as a xml steam (for character based parsers) -template <typename TreeNodeT, typename AssocContainerT> -inline void -tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree, - std::string const &input_line, AssocContainerT const& id_to_name) -{ - // generate xml dump - xml::document doc (ostrm, "parsetree", "parsetree.dtd"); - xml::comment input (ostrm, input_line.c_str()); - xml::attribute ver ("version", "1.0"); - xml::node mainnode (ostrm, "parsetree", ver); - - impl::tree_node_to_xml (ostrm, tree, id_to_name); -} - -template <typename TreeNodeT> -inline void -tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree, - std::string const &input_line) -{ - return tree_to_xml(ostrm, tree, input_line, - std::map<boost::spirit::parser_id, std::string>()); -} - -}} // namespace boost::spirit - -#undef BOOST_SPIRIT_OSSTREAM -#undef BOOST_SPIRIT_GETSTRING - -#endif // !defined(PARSE_TREE_XML_HPP) diff --git a/Utilities/BGL/boost/spirit/tree/parse_tree.hpp b/Utilities/BGL/boost/spirit/tree/parse_tree.hpp deleted file mode 100644 index 00aa9490d0ea220ad26b7c1488263c62a4cb50b3..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/parse_tree.hpp +++ /dev/null @@ -1,266 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#ifndef BOOST_SPIRIT_TREE_PARSE_TREE_HPP -#define BOOST_SPIRIT_TREE_PARSE_TREE_HPP - -#include <boost/spirit/tree/common.hpp> -#include <boost/spirit/core/scanner/scanner.hpp> - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace spirit { - -template <typename MatchPolicyT, typename NodeFactoryT> -struct pt_tree_policy; - -////////////////////////////////// -// pt_match_policy is simply an id so the correct specialization of tree_policy can be found. -template < - typename IteratorT, - typename NodeFactoryT = node_val_data_factory<nil_t> -> -struct pt_match_policy : - public common_tree_match_policy< - pt_match_policy<IteratorT, NodeFactoryT>, - IteratorT, - NodeFactoryT, - pt_tree_policy< - pt_match_policy<IteratorT, NodeFactoryT>, - NodeFactoryT - > - > -{ -}; - -////////////////////////////////// -template <typename MatchPolicyT, typename NodeFactoryT> -struct pt_tree_policy : - public common_tree_tree_policy<MatchPolicyT, NodeFactoryT> -{ - typedef - typename common_tree_tree_policy<MatchPolicyT, NodeFactoryT>::match_t - match_t; - typedef typename MatchPolicyT::iterator_t iterator_t; - - static void concat(match_t& a, match_t const& b) - { - typedef typename match_t::attr_t attr_t; - BOOST_SPIRIT_ASSERT(a && b); - - std::copy(b.trees.begin(), b.trees.end(), - std::back_insert_iterator<typename match_t::container_t>(a.trees)); - } - - template <typename MatchT, typename Iterator1T, typename Iterator2T> - static void group_match(MatchT& m, parser_id const& id, - Iterator1T const& first, Iterator2T const& last) - { - if (!m) - return; - - typedef typename NodeFactoryT::template factory<iterator_t> factory_t; - typedef typename tree_match<iterator_t, NodeFactoryT>::container_t - container_t; - typedef typename container_t::iterator cont_iterator_t; - - match_t newmatch(m.length(), - factory_t::create_node(first, last, false)); - - std::swap(newmatch.trees.begin()->children, m.trees); - // set this node and all it's unset children's rule_id - newmatch.trees.begin()->value.id(id); - for (cont_iterator_t i = newmatch.trees.begin()->children.begin(); - i != newmatch.trees.begin()->children.end(); - ++i) - { - if (i->value.id() == 0) - i->value.id(id); - } - m = newmatch; - } - - template <typename FunctorT> - static void apply_op_to_match(FunctorT const& op, match_t& m) - { - op(m); - } -}; - -namespace impl { - - template <typename IteratorT, typename NodeFactoryT> - struct tree_policy_selector<pt_match_policy<IteratorT, NodeFactoryT> > - { - typedef pt_tree_policy< - pt_match_policy<IteratorT, NodeFactoryT>, NodeFactoryT> type; - }; - -} // namespace impl - - -////////////////////////////////// -struct gen_pt_node_parser_gen; - -template <typename T> -struct gen_pt_node_parser -: public unary<T, parser<gen_pt_node_parser<T> > > -{ - typedef gen_pt_node_parser<T> self_t; - typedef gen_pt_node_parser_gen parser_generator_t; - typedef unary_parser_category parser_category_t; -// typedef gen_pt_node_parser<T> const &embed_t; - - gen_pt_node_parser(T const& a) - : unary<T, parser<gen_pt_node_parser<T> > >(a) {} - - template <typename ScannerT> - typename parser_result<self_t, ScannerT>::type - parse(ScannerT const& scan) const - { - typedef typename ScannerT::iteration_policy_t iteration_policy_t; - typedef typename ScannerT::match_policy_t::iterator_t iterator_t; - typedef typename ScannerT::match_policy_t::factory_t factory_t; - typedef pt_match_policy<iterator_t, factory_t> match_policy_t; - typedef typename ScannerT::action_policy_t action_policy_t; - typedef scanner_policies< - iteration_policy_t, - match_policy_t, - action_policy_t - > policies_t; - - return this->subject().parse(scan.change_policies(policies_t(scan))); - } -}; - -////////////////////////////////// -struct gen_pt_node_parser_gen -{ - template <typename T> - struct result { - - typedef gen_pt_node_parser<T> type; - }; - - template <typename T> - static gen_pt_node_parser<T> - generate(parser<T> const& s) - { - return gen_pt_node_parser<T>(s.derived()); - } - - template <typename T> - gen_pt_node_parser<T> - operator[](parser<T> const& s) const - { - return gen_pt_node_parser<T>(s.derived()); - } -}; - -////////////////////////////////// -const gen_pt_node_parser_gen gen_pt_node_d = gen_pt_node_parser_gen(); - - -/////////////////////////////////////////////////////////////////////////////// -// -// Parse functions for parse trees -// -/////////////////////////////////////////////////////////////////////////////// -template < - typename NodeFactoryT, typename IteratorT, typename ParserT, - typename SkipT -> -inline tree_parse_info<IteratorT, NodeFactoryT> -pt_parse( - IteratorT const& first_, - IteratorT const& last, - parser<ParserT> const& p, - SkipT const& skip, - NodeFactoryT const& /*dummy_*/ = NodeFactoryT()) -{ - typedef skip_parser_iteration_policy<SkipT> iter_policy_t; - typedef pt_match_policy<IteratorT, NodeFactoryT> pt_match_policy_t; - typedef - scanner_policies<iter_policy_t, pt_match_policy_t> - scanner_policies_t; - typedef scanner<IteratorT, scanner_policies_t> scanner_t; - - iter_policy_t iter_policy(skip); - scanner_policies_t policies(iter_policy); - IteratorT first = first_; - scanner_t scan(first, last, policies); - tree_match<IteratorT, NodeFactoryT> hit = p.derived().parse(scan); - scan.skip(scan); - return tree_parse_info<IteratorT, NodeFactoryT>( - first, hit, hit && (first == last), hit.length(), hit.trees); -} - -template <typename IteratorT, typename ParserT, typename SkipT> -inline tree_parse_info<IteratorT> -pt_parse( - IteratorT const& first, - IteratorT const& last, - parser<ParserT> const& p, - SkipT const& skip) -{ - typedef node_val_data_factory<nil_t> default_node_factory_t; - return pt_parse(first, last, p, skip, default_node_factory_t()); -} - -////////////////////////////////// -template <typename IteratorT, typename ParserT> -inline tree_parse_info<IteratorT> -pt_parse( - IteratorT const& first_, - IteratorT const& last, - parser<ParserT> const& parser) -{ - typedef pt_match_policy<IteratorT> pt_match_policy_t; - IteratorT first = first_; - scanner< - IteratorT, - scanner_policies<iteration_policy, pt_match_policy_t> - > scan(first, last); - tree_match<IteratorT> hit = parser.derived().parse(scan); - return tree_parse_info<IteratorT>( - first, hit, hit && (first == last), hit.length(), hit.trees); -} - -////////////////////////////////// -template <typename CharT, typename ParserT, typename SkipT> -inline tree_parse_info<CharT const*> -pt_parse( - CharT const* str, - parser<ParserT> const& p, - SkipT const& skip) -{ - CharT const* last = str; - while (*last) - last++; - return pt_parse(str, last, p, skip); -} - -////////////////////////////////// -template <typename CharT, typename ParserT> -inline tree_parse_info<CharT const*> -pt_parse( - CharT const* str, - parser<ParserT> const& parser) -{ - CharT const* last = str; - while (*last) - { - last++; - } - return pt_parse(str, last, parser); -} - -/////////////////////////////////////////////////////////////////////////////// -}} // namespace boost::spirit - -#endif - diff --git a/Utilities/BGL/boost/spirit/tree/parse_tree_utils.hpp b/Utilities/BGL/boost/spirit/tree/parse_tree_utils.hpp deleted file mode 100644 index 36cff3d59835538ad4dccf1e6bd80d25fdfe05fb..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/parse_tree_utils.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2001-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -#if !defined(PARSE_TREE_UTILS_HPP) -#define PARSE_TREE_UTILS_HPP - -#include <utility> // for std::pair - -#include <boost/spirit/tree/parse_tree.hpp> // needed for parse tree generation - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { -namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// The function 'get_first_leaf' returnes a reference to the first leaf node -// of the given parsetree. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -tree_node<T> const & -get_first_leaf (tree_node<T> const &node); - -/////////////////////////////////////////////////////////////////////////////// -// -// The function 'find_node' finds a specified node through recursive search. -// If the return value is true, the variable to which points the parameter -// 'found_node' will contain the address of the node with the given rule_id. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -bool -find_node (tree_node<T> const &node, parser_id node_to_search, - tree_node<T> const **found_node); - -/////////////////////////////////////////////////////////////////////////////// -// -// The function 'get_node_range' return a pair of iterators pointing at the -// range, which containes the elements of a specified node. It's very useful -// for locating all information related with a specified node. -// -/////////////////////////////////////////////////////////////////////////////// -template <typename T> -bool -get_node_range (tree_node<T> const &node, parser_id node_to_search, - std::pair<typename tree_node<T>::const_tree_iterator, - typename tree_node<T>::const_tree_iterator> &nodes); - -/////////////////////////////////////////////////////////////////////////////// -} // namespace spirit -} // namespace boost - -#include "boost/spirit/tree/impl/parse_tree_utils.ipp" - -#endif // !defined(PARSE_TREE_UTILS_HPP) diff --git a/Utilities/BGL/boost/spirit/tree/parsetree.dtd b/Utilities/BGL/boost/spirit/tree/parsetree.dtd deleted file mode 100644 index 9f4728285cb911cf88a1f3173a77c21c07207953..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/parsetree.dtd +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- This DTD is used for the output of Spirit parse tree's through --> -<!-- the boost::spirit::tree_to_xml functions. --> -<!ELEMENT parsetree (parsenode)> -<!ATTLIST parsetree - version CDATA "1.0" -> -<!ELEMENT parsenode ((value | token)?, parsenode*)> -<!ATTLIST parsenode - rule CDATA #IMPLIED -> -<!ELEMENT value (#PCDATA | token)*> -<!ELEMENT token (#PCDATA)> -<!ATTLIST token - id CDATA #REQUIRED - is_root CDATA "0" -> diff --git a/Utilities/BGL/boost/spirit/tree/tree_to_xml.hpp b/Utilities/BGL/boost/spirit/tree/tree_to_xml.hpp deleted file mode 100644 index acab196471c4325e7da5dd960e8b04c7e180033e..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/tree/tree_to_xml.hpp +++ /dev/null @@ -1,71 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2001-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ - -#if !defined(TREE_TO_XML_HPP) -#define TREE_TO_XML_HPP - -namespace boost { namespace spirit { - -/////////////////////////////////////////////////////////////////////////////// -// -// Dump a parse tree as a xml stream -// -// The functions 'tree_to_xml' can be used to output a parse tree as a xml -// stream into the given ostream. The parameters have the following -// meaning: -// -// mandatory parameters: -// ostrm The output stream used for streaming the parse tree. -// tree The parse tree to output. -// -// optional parameters: -// input_line The input line from which the parse tree was -// generated (if given, it is used to output a comment -// containing this line). -// id_to_name A map, which is used for converting the rule id's contained -// in the parse tree to readable strings. Here a auxiliary -// associative container can be used, which maps a rule_id to -// a std::string (i.e. a std::map<rule_id, std::string>). -// get_token_id -// A function or functor, which takes an instance of a token -// and which should return a token id (i.e. something like -// 'int f(char const c)'). -// get_token_value -// A function or functor, which takes an instance of a token -// and which should return a readable representation of this -// token (i.e. something like 'std::string f(char const c)'). -// -// The structure of the generated xml stream conforms to the DTD given in the -// file 'parsetree.dtd'. This file is located in the spirit/tree directory. -// -/////////////////////////////////////////////////////////////////////////////// - - template < - typename TreeNodeT, typename AssocContainerT, - typename GetIdT, typename GetValueT - > - void tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree, - std::string const &input_line, AssocContainerT const& id_to_name, - GetIdT const &get_token_id, GetValueT const &get_token_value); - - template <typename TreeNodeT, typename AssocContainerT> - void tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree, - std::string const &input_line, AssocContainerT const& id_to_name); - - template <typename TreeNodeT> - void tree_to_xml (std::ostream &ostrm, TreeNodeT const &tree, - std::string const &input_line = ""); - -}} // namespace boost::spirit - -#include <boost/spirit/tree/impl/tree_to_xml.ipp> - -#endif // !defined(TREE_TO_XML_HPP) - diff --git a/Utilities/BGL/boost/spirit/utility.hpp b/Utilities/BGL/boost/spirit/utility.hpp deleted file mode 100644 index e1018da2cc09d29f749bb310358d4fc7e1e7ec00..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/utility.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/*============================================================================= - Copyright (c) 1998-2003 Joel de Guzman - Copyright (c) 2001-2003 Daniel Nuffer - Copyright (c) 2001-2003 Hartmut Kaiser - Copyright (c) 2002-2003 Martin Wille - Copyright (c) 2002 Juan Carlos Arevalo-Baeza - Copyright (c) 2002 Raghavendra Satish - Copyright (c) 2002 Jeff Westfahl - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(BOOST_SPIRIT_UTILITY_MAIN_HPP) -#define BOOST_SPIRIT_UTILITY_MAIN_HPP - -#include <boost/spirit/version.hpp> - -/////////////////////////////////////////////////////////////////////////////// -// -// Master header for Spirit.Utilities -// -/////////////////////////////////////////////////////////////////////////////// - -// Utility.Parsers -#include <boost/spirit/butility/chset.hpp> -#include <boost/spirit/butility/chset_operators.hpp> -#include <boost/spirit/butility/escape_char.hpp> -#include <boost/spirit/butility/functor_parser.hpp> -#include <boost/spirit/butility/loops.hpp> -#include <boost/spirit/butility/confix.hpp> -#include <boost/spirit/butility/lists.hpp> -#include <boost/spirit/butility/distinct.hpp> - -// Utility.Support -#include <boost/spirit/butility/flush_multi_pass.hpp> -#include <boost/spirit/butility/scoped_lock.hpp> - - -#endif // !defined(BOOST_SPIRIT_UTILITY_MAIN_HPP) diff --git a/Utilities/BGL/boost/spirit/version.hpp b/Utilities/BGL/boost/spirit/version.hpp deleted file mode 100644 index 91bad02bf3b80f6d8d610f04595c46817a2f9660..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/spirit/version.hpp +++ /dev/null @@ -1,31 +0,0 @@ -/*============================================================================= - Copyright (c) 2001-2003 Hartmut Kaiser - http://spirit.sourceforge.net/ - - 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) -=============================================================================*/ -#if !defined(SPIRIT_VERSION_HPP) -#define SPIRIT_VERSION_HPP - -/////////////////////////////////////////////////////////////////////////////// -// -// This checks, whether the used Boost library is at least V1.32.0 -// -/////////////////////////////////////////////////////////////////////////////// -#include <boost/version.hpp> - -#if BOOST_VERSION < 103200 -#error "Spirit v1.8.x needs at least Boost V1.32.0 to compile successfully." -#endif - -/////////////////////////////////////////////////////////////////////////////// -// -// This is the version of the current Spirit distribution -// -/////////////////////////////////////////////////////////////////////////////// -#define SPIRIT_VERSION 0x1803 -#define SPIRIT_PIZZA_VERSION SPIRIT_DOUBLE_CHEESE // :-) - -#endif // defined(SPIRIT_VERSION_HPP) diff --git a/Utilities/BGL/boost/static_assert.hpp b/Utilities/BGL/boost/static_assert.hpp index 9d24c0564782d81eb2cffcee66cb8ee8602c8677..5bded5ea28452ca527c4c2bbe6dab36bac8fb90f 100644 --- a/Utilities/BGL/boost/static_assert.hpp +++ b/Utilities/BGL/boost/static_assert.hpp @@ -28,6 +28,20 @@ # define BOOST_SA_GCC_WORKAROUND #endif +// +// If the compiler issues warnings about old C style casts, +// then enable this: +// +#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))) +# define BOOST_STATIC_ASSERT_BOOL_CAST( x ) ((x) == 0 ? false : true) +#else +# define BOOST_STATIC_ASSERT_BOOL_CAST(x) (bool)(x) +#endif + +#ifdef BOOST_HAS_STATIC_ASSERT +# define BOOST_STATIC_ASSERT( B ) static_assert(B, #B) +#else + namespace boost{ // HP aCC cannot deal with missing names for template value parameters @@ -74,14 +88,14 @@ template<int x> struct static_assert_test{}; #elif defined(BOOST_MSVC) #define BOOST_STATIC_ASSERT( B ) \ typedef ::boost::static_assert_test<\ - sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST ( B ) >)>\ BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__) #elif defined(BOOST_INTEL_CXX_VERSION) || defined(BOOST_SA_GCC_WORKAROUND) // agurt 15/sep/02: a special care is needed to force Intel C++ issue an error // instead of warning in case of failure # define BOOST_STATIC_ASSERT( B ) \ typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \ - [ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ] + [ ::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >::value ] #elif defined(__sgi) // special version for SGI MIPSpro compiler #define BOOST_STATIC_ASSERT( B ) \ @@ -96,12 +110,12 @@ template<int x> struct static_assert_test{}; #define BOOST_STATIC_ASSERT( B ) \ BOOST_STATIC_CONSTANT(int, \ BOOST_JOIN(boost_static_assert_test_, __LINE__) = \ - sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) ) + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >) ) #else // generic version #define BOOST_STATIC_ASSERT( B ) \ typedef ::boost::static_assert_test<\ - sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\ + sizeof(::boost::STATIC_ASSERTION_FAILURE< BOOST_STATIC_ASSERT_BOOL_CAST( B ) >)>\ BOOST_JOIN(boost_static_assert_typedef_, __LINE__) #endif @@ -111,7 +125,7 @@ template<int x> struct static_assert_test{}; enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \ = sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) } #endif - +#endif // ndef BOOST_HAS_STATIC_ASSERT #endif // BOOST_STATIC_ASSERT_HPP diff --git a/Utilities/BGL/boost/throw_exception.hpp b/Utilities/BGL/boost/throw_exception.hpp index 85a36454a08d9798aa0a4a51167c801d1ea8e8b2..656b8de31e23a90c65b926243128ccbd9767f42a 100644 --- a/Utilities/BGL/boost/throw_exception.hpp +++ b/Utilities/BGL/boost/throw_exception.hpp @@ -11,18 +11,37 @@ // boost/throw_exception.hpp // // Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008-2009 Emil Dotchevski and Reverge Studios, Inc. // -// 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) +// 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) // -// http://www.boost.org/libs/butility/throw_exception.html +// http://www.boost.org/libs/utility/throw_exception.html // +#include <boost/exception/detail/attribute_noreturn.hpp> +#include <boost/detail/workaround.hpp> #include <boost/config.hpp> +#include <exception> -#ifdef BOOST_NO_EXCEPTIONS -# include <exception> +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) +# include <boost/exception/exception.hpp> +# include <boost/current_function.hpp> +# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\ + ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\ + ::boost::throw_file(__FILE__) <<\ + ::boost::throw_line(__LINE__)) +#else +# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x) #endif namespace boost @@ -30,13 +49,23 @@ namespace boost #ifdef BOOST_NO_EXCEPTIONS -void throw_exception(std::exception const & e); // user defined +void throw_exception( std::exception const & e ); // user defined #else -template<class E> inline void throw_exception(E const & e) +inline void throw_exception_assert_compatibility( std::exception const & ) { } + +template<class E> BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const & e ) { + //All boost exceptions are required to derive from std::exception, + //to ensure compatibility with BOOST_NO_EXCEPTIONS. + throw_exception_assert_compatibility(e); + +#ifndef BOOST_EXCEPTION_DISABLE + throw enable_current_exception(enable_error_info(e)); +#else throw e; +#endif } #endif diff --git a/Utilities/BGL/boost/tuple/detail/tuple_basic.hpp b/Utilities/BGL/boost/tuple/detail/tuple_basic.hpp index a1d3284d64230310417acdecca099d0f437a0899..348fd80894edd5d05ea602a0a9aa0e9f09f89920 100644 --- a/Utilities/BGL/boost/tuple/detail/tuple_basic.hpp +++ b/Utilities/BGL/boost/tuple/detail/tuple_basic.hpp @@ -1,6 +1,6 @@ // tuple_basic.hpp ----------------------------------------------------- -// Copyright (C) 1999, 2000 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -213,7 +213,7 @@ struct element_impl<0, T, true /* IsConst */> template<int N, class T> -struct element: +struct element: public detail::element_impl<N, T, ::boost::is_const<T>::value> { }; @@ -362,7 +362,7 @@ struct cons { template <class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10> - cons( const null_type& t1, T2& t2, T3& t3, T4& t4, T5& t5, + cons( const null_type& /*t1*/, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6, T7& t7, T8& t8, T9& t9, T10& t10 ) : head (), tail (t2, t3, t4, t5, t6, t7, t8, t9, t10, detail::cnull()) @@ -488,11 +488,20 @@ struct length<tuple<> > { BOOST_STATIC_CONSTANT(int, value = 0); }; +template<> +struct length<tuple<> const> { + BOOST_STATIC_CONSTANT(int, value = 0); +}; + template<> struct length<null_type> { BOOST_STATIC_CONSTANT(int, value = 0); }; +template<> +struct length<null_type const> { + BOOST_STATIC_CONSTANT(int, value = 0); +}; namespace detail { diff --git a/Utilities/BGL/boost/tuple/detail/tuple_basic_no_partial_spec.hpp b/Utilities/BGL/boost/tuple/detail/tuple_basic_no_partial_spec.hpp index c4f65c47632c89ed9eca5649e9a19498788423de..bb38662c4a6d916b539c76a49545bc23ea79a18a 100644 --- a/Utilities/BGL/boost/tuple/detail/tuple_basic_no_partial_spec.hpp +++ b/Utilities/BGL/boost/tuple/detail/tuple_basic_no_partial_spec.hpp @@ -1,6 +1,6 @@ // - tuple_basic_no_partial_spec.hpp ----------------------------------------- -// Copyright (C) 1999, 2000 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // Copyright (C) 2001 Douglas Gregor (gregod@rpi.edu) // Copyright (C) 2001 Gary Powell (gary.powell@sierra.com) // @@ -105,7 +105,7 @@ namespace tuples { // Each of vc6 and vc7 seem to require a different formulation // of this return type template <class H, class T> -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) static typename add_reference<typename add_const<T>::type>::type #else static typename add_const_reference<T>::type diff --git a/Utilities/BGL/boost/tuple/tuple.hpp b/Utilities/BGL/boost/tuple/tuple.hpp index ee7fbc47cac2c9573784ef22fdecf7fded0e978d..7703597e10ce1a53abb0ed35bec3d24482941fb9 100644 --- a/Utilities/BGL/boost/tuple/tuple.hpp +++ b/Utilities/BGL/boost/tuple/tuple.hpp @@ -1,6 +1,6 @@ // tuple.hpp - Boost Tuple Library -------------------------------------- -// Copyright (C) 1999, 2000 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/Utilities/BGL/boost/tuple/tuple_comparison.hpp b/Utilities/BGL/boost/tuple/tuple_comparison.hpp index 00ddd14d6c29dc940230e1f79d69b94cc9e9ae7f..73723a15bc9b0a1c8da3f5b0718c8289e5a643d4 100644 --- a/Utilities/BGL/boost/tuple/tuple_comparison.hpp +++ b/Utilities/BGL/boost/tuple/tuple_comparison.hpp @@ -1,6 +1,6 @@ // tuple_comparison.hpp ----------------------------------------------------- // -// Copyright (C) 2001 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // Copyright (C) 2001 Gary Powell (gary.powell@sierra.com) // // Distributed under the Boost Software License, Version 1.0. (See @@ -69,8 +69,8 @@ inline bool neq<null_type,null_type>(const null_type&, const null_type&) { retur template<class T1, class T2> inline bool lt(const T1& lhs, const T2& rhs) { return lhs.get_head() < rhs.get_head() || - !(rhs.get_head() < lhs.get_head()) && - lt(lhs.get_tail(), rhs.get_tail()); + ( !(rhs.get_head() < lhs.get_head()) && + lt(lhs.get_tail(), rhs.get_tail())); } template<> inline bool lt<null_type,null_type>(const null_type&, const null_type&) { return false; } @@ -78,8 +78,8 @@ inline bool lt<null_type,null_type>(const null_type&, const null_type&) { return template<class T1, class T2> inline bool gt(const T1& lhs, const T2& rhs) { return lhs.get_head() > rhs.get_head() || - !(rhs.get_head() > lhs.get_head()) && - gt(lhs.get_tail(), rhs.get_tail()); + ( !(rhs.get_head() > lhs.get_head()) && + gt(lhs.get_tail(), rhs.get_tail())); } template<> inline bool gt<null_type,null_type>(const null_type&, const null_type&) { return false; } diff --git a/Utilities/BGL/boost/tuple/tuple_io.hpp b/Utilities/BGL/boost/tuple/tuple_io.hpp index 467ab0ab8a49ca0b9248f7ea7cdb7c9eb14d1280..10cdb1cc26394b020c11121f5f85e72322800dfb 100644 --- a/Utilities/BGL/boost/tuple/tuple_io.hpp +++ b/Utilities/BGL/boost/tuple/tuple_io.hpp @@ -1,6 +1,6 @@ // tuple_io.hpp -------------------------------------------------------------- -// Copyright (C) 2001 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // 2001 Gary Powell (gary.powell@sierra.com) // // Distributed under the Boost Software License, Version 1.0. (See @@ -285,6 +285,21 @@ print(std::basic_ostream<CharType, CharTrait>& o, const cons<T1, T2>& t) { } // namespace detail #if defined (BOOST_NO_TEMPLATED_STREAMS) + +inline std::ostream& operator<<(std::ostream& o, const null_type& t) { + if (!o.good() ) return o; + + const char l = + detail::format_info::get_manipulator(o, detail::format_info::open); + const char r = + detail::format_info::get_manipulator(o, detail::format_info::close); + + o << l; + o << r; + + return o; +} + template<class T1, class T2> inline std::ostream& operator<<(std::ostream& o, const cons<T1, T2>& t) { if (!o.good() ) return o; @@ -305,6 +320,23 @@ inline std::ostream& operator<<(std::ostream& o, const cons<T1, T2>& t) { #else +template<class CharType, class CharTrait> +inline std::basic_ostream<CharType, CharTrait>& +operator<<(std::basic_ostream<CharType, CharTrait>& o, + const null_type& t) { + if (!o.good() ) return o; + + const CharType l = + detail::format_info::get_manipulator(o, detail::format_info::open); + const CharType r = + detail::format_info::get_manipulator(o, detail::format_info::close); + + o << l; + o << r; + + return o; +} + template<class CharType, class CharTrait, class T1, class T2> inline std::basic_ostream<CharType, CharTrait>& operator<<(std::basic_ostream<CharType, CharTrait>& o, @@ -349,7 +381,7 @@ extract_and_check_delimiter( char c; if (is_delimiter) { is >> c; - if (c!=d) { + if (is.good() && c!=d) { is.setstate(std::ios::failbit); } } @@ -443,7 +475,7 @@ extract_and_check_delimiter( CharType c; if (is_delimiter) { is >> c; - if (c!=d) { + if (is.good() && c!=d) { is.setstate(std::ios::failbit); } } diff --git a/Utilities/BGL/boost/type_traits.hpp b/Utilities/BGL/boost/type_traits.hpp index 08bb5a1e01dbf133e2a283e8bbb09e38ec8f144f..0c313b81c548c65900eb72a75330f52876ca3e9c 100644 --- a/Utilities/BGL/boost/type_traits.hpp +++ b/Utilities/BGL/boost/type_traits.hpp @@ -70,6 +70,15 @@ #include "boost/type_traits/type_with_alignment.hpp" #include "boost/type_traits/function_traits.hpp" #include "boost/type_traits/aligned_storage.hpp" +#include "boost/type_traits/floating_point_promotion.hpp" +#if !(defined(__sgi) && defined(__EDG_VERSION__) && (__EDG_VERSION__ == 238)) +#include "boost/type_traits/integral_promotion.hpp" +#include "boost/type_traits/promote.hpp" +#endif +#include <boost/type_traits/make_unsigned.hpp> +#include <boost/type_traits/make_signed.hpp> +#include <boost/type_traits/decay.hpp> +#include <boost/type_traits/is_complex.hpp> #include "boost/type_traits/ice.hpp" diff --git a/Utilities/BGL/boost/type_traits/add_const.hpp b/Utilities/BGL/boost/type_traits/add_const.hpp index 2d0fae0197c27c3f62311c44a4d2fb06e4291ddd..29f0bd95bc8fb733f2281dd3884981f72edda0f3 100644 --- a/Utilities/BGL/boost/type_traits/add_const.hpp +++ b/Utilities/BGL/boost/type_traits/add_const.hpp @@ -10,10 +10,10 @@ #ifndef BOOST_TT_ADD_CONST_HPP_INCLUDED #define BOOST_TT_ADD_CONST_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -42,6 +42,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_const,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_ADD_CONST_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/add_cv.hpp b/Utilities/BGL/boost/type_traits/add_cv.hpp index 381f17c228ab605cdb1e6a0b064a38856ef54b6f..bfde76a623f9fc8c4f1f128c6f9968d1b320e985 100644 --- a/Utilities/BGL/boost/type_traits/add_cv.hpp +++ b/Utilities/BGL/boost/type_traits/add_cv.hpp @@ -11,10 +11,10 @@ #ifndef BOOST_TT_ADD_CV_HPP_INCLUDED #define BOOST_TT_ADD_CV_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -43,6 +43,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_cv,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_ADD_CV_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/add_pointer.hpp b/Utilities/BGL/boost/type_traits/add_pointer.hpp index 0f36a2e678c84f839b24987903e4200a29d152db..3e0e48189474057258c781b80f52c40e511ae821 100644 --- a/Utilities/BGL/boost/type_traits/add_pointer.hpp +++ b/Utilities/BGL/boost/type_traits/add_pointer.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_ADD_POINTER_HPP_INCLUDED #define BOOST_TT_ADD_POINTER_HPP_INCLUDED -#include "boost/type_traits/remove_reference.hpp" +#include <boost/type_traits/remove_reference.hpp> // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { namespace detail { -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x5A0) // // For some reason this implementation stops Borlands compiler // from dropping cv-qualifiers, it still fails with references @@ -63,10 +63,10 @@ struct add_pointer_impl } // namespace detail -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_pointer,T,typename detail::add_pointer_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_pointer,T,typename boost::detail::add_pointer_impl<T>::type) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/add_reference.hpp b/Utilities/BGL/boost/type_traits/add_reference.hpp index 8915b768679ad903e7f5a03ec093e440e1cf694d..7dfb4bed89e7dea8414775593595b68fc13e2379 100644 --- a/Utilities/BGL/boost/type_traits/add_reference.hpp +++ b/Utilities/BGL/boost/type_traits/add_reference.hpp @@ -9,12 +9,12 @@ #ifndef BOOST_TT_ADD_REFERENCE_HPP_INCLUDED #define BOOST_TT_ADD_REFERENCE_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/is_reference.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -74,7 +74,7 @@ BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const volatile,void const } // namespace detail -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename detail::add_reference_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename boost::detail::add_reference_impl<T>::type) // agurt, 07/mar/03: workaround Borland's ill-formed sensitivity to an additional // level of indirection, here @@ -84,6 +84,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/add_volatile.hpp b/Utilities/BGL/boost/type_traits/add_volatile.hpp index c575e28a38c7b9bd0f0170f4b44732cb3dc229e5..491f1c2dd38d4eee6e4a0171a1732b37c92c3122 100644 --- a/Utilities/BGL/boost/type_traits/add_volatile.hpp +++ b/Utilities/BGL/boost/type_traits/add_volatile.hpp @@ -10,10 +10,10 @@ #ifndef BOOST_TT_ADD_VOLATILE_HPP_INCLUDED #define BOOST_TT_ADD_VOLATILE_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -42,6 +42,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_volatile,T&,T&) } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_ADD_VOLATILE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/aligned_storage.hpp b/Utilities/BGL/boost/type_traits/aligned_storage.hpp index 634fa7454ac09d50376fa043d052a53dc0ed6825..5420f26738db73142c715f97d38e0632945e1bc8 100644 --- a/Utilities/BGL/boost/type_traits/aligned_storage.hpp +++ b/Utilities/BGL/boost/type_traits/aligned_storage.hpp @@ -1,5 +1,5 @@ -// (C) John Maddock 2005. +// Copyright (C) John Maddock 2005. // 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). @@ -10,3 +10,4 @@ # define BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED # include <boost/aligned_storage.hpp> #endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED + diff --git a/Utilities/BGL/boost/type_traits/alignment_of.hpp b/Utilities/BGL/boost/type_traits/alignment_of.hpp index 8672cca17ec004cc67b610b30a9f8a30cd1cea21..51357ce5608211e1d43d1e5c4e385ec530302a86 100644 --- a/Utilities/BGL/boost/type_traits/alignment_of.hpp +++ b/Utilities/BGL/boost/type_traits/alignment_of.hpp @@ -9,15 +9,16 @@ #ifndef BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED #define BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> #include <cstddef> +#include <boost/type_traits/intrinsics.hpp> // should be the last #include -#include "boost/type_traits/detail/size_t_trait_def.hpp" +#include <boost/type_traits/detail/size_t_trait_def.hpp> #ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable: 4121) // alignment is sensitive to packing +# pragma warning(disable: 4121 4512) // alignment is sensitive to packing #endif #if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) #pragma option push -Vx- -Ve- @@ -30,6 +31,10 @@ template <typename T> struct alignment_of; // get the alignment of some arbitrary type: namespace detail { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4324) // structure was padded due to __declspec(align()) +#endif template <typename T> struct alignment_of_hack { @@ -37,7 +42,9 @@ struct alignment_of_hack T t; alignment_of_hack(); }; - +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif template <unsigned A, unsigned S> struct alignment_logic @@ -49,11 +56,32 @@ struct alignment_logic template< typename T > struct alignment_of_impl { +#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) + // + // With MSVC both the native __alignof operator + // and our own logic gets things wrong from time to time :-( + // Using a combination of the two seems to make the most of a bad job: + // BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::alignment_logic< - sizeof(detail::alignment_of_hack<T>) - sizeof(T), + sizeof(::boost::detail::alignment_of_hack<T>) - sizeof(T), + __alignof(T) + >::value)); +#elif !defined(BOOST_ALIGNMENT_OF) + BOOST_STATIC_CONSTANT(std::size_t, value = + (::boost::detail::alignment_logic< + sizeof(::boost::detail::alignment_of_hack<T>) - sizeof(T), sizeof(T) >::value)); +#else + // + // We put this here, rather than in the definition of + // alignment_of below, because MSVC's __alignof doesn't + // always work in that context for some unexplained reason. + // (See type_with_alignment tests for test cases). + // + BOOST_STATIC_CONSTANT(std::size_t, value = BOOST_ALIGNMENT_OF(T)); +#endif }; } // namespace detail @@ -94,7 +122,7 @@ BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(alignment_of,void const volatile,0) # pragma warning(pop) #endif -#include "boost/type_traits/detail/size_t_trait_undef.hpp" +#include <boost/type_traits/detail/size_t_trait_undef.hpp> #endif // BOOST_TT_ALIGNMENT_OF_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/alignment_traits.hpp b/Utilities/BGL/boost/type_traits/alignment_traits.hpp index 108b06b667cdd88f3771e4b66b155095190d9a70..2ed6934dad4b5a5795625ef330d5dea7ab1a7ff7 100644 --- a/Utilities/BGL/boost/type_traits/alignment_traits.hpp +++ b/Utilities/BGL/boost/type_traits/alignment_traits.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED #define BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED -#include "boost/type_traits/alignment_of.hpp" -#include "boost/type_traits/type_with_alignment.hpp" +#include <boost/type_traits/alignment_of.hpp> +#include <boost/type_traits/type_with_alignment.hpp> #endif // BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/arithmetic_traits.hpp b/Utilities/BGL/boost/type_traits/arithmetic_traits.hpp index 156e5b677dfe71c09bafc6d5c1880e19239ce50b..e4670e6b38d4eec87686851bfe1b84989369f7f4 100644 --- a/Utilities/BGL/boost/type_traits/arithmetic_traits.hpp +++ b/Utilities/BGL/boost/type_traits/arithmetic_traits.hpp @@ -11,10 +11,10 @@ #ifndef BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED #define BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_float.hpp" -#include "boost/type_traits/is_fundamental.hpp" -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_void.hpp" +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_float.hpp> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_void.hpp> #endif // BOOST_TT_ARITHMETIC_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/array_traits.hpp b/Utilities/BGL/boost/type_traits/array_traits.hpp index d09dd0b2c6909ad0cc3ed4d3e91abe50ae1104bc..a68ae73176791b70c5368de893e315a26975ff5d 100644 --- a/Utilities/BGL/boost/type_traits/array_traits.hpp +++ b/Utilities/BGL/boost/type_traits/array_traits.hpp @@ -10,6 +10,6 @@ #ifndef BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED #define BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_array.hpp" +#include <boost/type_traits/is_array.hpp> #endif // BOOST_TT_ARRAY_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/broken_compiler_spec.hpp b/Utilities/BGL/boost/type_traits/broken_compiler_spec.hpp index 16e324f7993864caaa6da9c3251102e7120247e9..fb51769d9d4e70223a533968b4be14efdab262c7 100644 --- a/Utilities/BGL/boost/type_traits/broken_compiler_spec.hpp +++ b/Utilities/BGL/boost/type_traits/broken_compiler_spec.hpp @@ -9,8 +9,8 @@ #ifndef BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED #define BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED -#include "boost/mpl/aux_/lambda_support.hpp" -#include "boost/config.hpp" +#include <boost/mpl/aux_/lambda_support.hpp> +#include <boost/config.hpp> // these are needed regardless of BOOST_TT_NO_BROKEN_COMPILER_SPEC #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) @@ -88,7 +88,7 @@ template<> struct trait##_impl<spec> \ }} \ /**/ -# include "boost/type_traits/detail/type_trait_undef.hpp" +# include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/Utilities/BGL/boost/type_traits/composite_traits.hpp b/Utilities/BGL/boost/type_traits/composite_traits.hpp index 0ed3ac76f2b153e8cf23bd9c948495fff7ebdd02..985a4c51d32bafaf4b87bfa504ae9457e8450f06 100644 --- a/Utilities/BGL/boost/type_traits/composite_traits.hpp +++ b/Utilities/BGL/boost/type_traits/composite_traits.hpp @@ -13,13 +13,13 @@ #ifndef BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED #define BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_array.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/is_member_function_pointer.hpp" -#include "boost/type_traits/is_pointer.hpp" -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_union.hpp" +#include <boost/type_traits/is_array.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/is_member_function_pointer.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_union.hpp> #endif // BOOST_TT_COMPOSITE_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/config.hpp b/Utilities/BGL/boost/type_traits/config.hpp index cdb4ac64c9cc602c8d7f90122ea5e213fb160b68..94f13769a4ca7dc546cff1cedff51a9a07b0d98f 100644 --- a/Utilities/BGL/boost/type_traits/config.hpp +++ b/Utilities/BGL/boost/type_traits/config.hpp @@ -10,9 +10,11 @@ #define BOOST_TT_CONFIG_HPP_INCLUDED #ifndef BOOST_CONFIG_HPP -#include "boost/config.hpp" +#include <boost/config.hpp> #endif +#include <boost/detail/workaround.hpp> + // // whenever we have a conversion function with elipses // it needs to be declared __cdecl to suppress compiler @@ -24,15 +26,30 @@ # define BOOST_TT_DECL /**/ #endif -# if (defined(__MWERKS__) && __MWERKS__ >= 0x3000) || (defined(BOOST_MSVC) && (BOOST_MSVC > 1301)) || defined(__EDG_VERSION__) || (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__DMC__) || ( defined(__IBMCPP__) && (__IBMCPP__ >= 600 ) ) || defined(BOOST_NO_COMPILER_CONFIG) -# define BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION +# if (BOOST_WORKAROUND(__MWERKS__, < 0x3000) \ + || BOOST_WORKAROUND(BOOST_MSVC, <= 1301) \ + || !defined(__EDG_VERSION__) && BOOST_WORKAROUND(__GNUC__, < 3) \ + || BOOST_WORKAROUND(__IBMCPP__, < 600 ) \ + || BOOST_WORKAROUND(__BORLANDC__, < 0x5A0) \ + || defined(__ghs) \ + || BOOST_WORKAROUND(__HP_aCC, < 60700) \ + || BOOST_WORKAROUND(MPW_CPLUS, BOOST_TESTED_AT(0x890)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))) \ + && defined(BOOST_NO_IS_ABSTRACT) + +# define BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION 1 + +#endif + +#ifndef BOOST_TT_NO_CONFORMING_IS_CLASS_IMPLEMENTATION +# define BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION 1 #endif // // Define BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING // when we can't test for function types with elipsis: // -#if defined(__GNUC__) && (__GNUC__ < 3) +#if BOOST_WORKAROUND(__GNUC__, < 3) # define BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING #endif @@ -50,7 +67,7 @@ // if tests for cv-qualified member functions don't // work in is_member_function_pointer // -#if (defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600) +#if BOOST_WORKAROUND(__MWERKS__, < 0x3000) || BOOST_WORKAROUND(__IBMCPP__, <= 600) # define BOOST_TT_NO_CV_FUNC_TEST #endif diff --git a/Utilities/BGL/boost/type_traits/conversion_traits.hpp b/Utilities/BGL/boost/type_traits/conversion_traits.hpp index 82785315ecedafb43f1c2be719fe742a6fe4a5cf..c8e5139b30d2974ebff3e21310d53e0706202850 100644 --- a/Utilities/BGL/boost/type_traits/conversion_traits.hpp +++ b/Utilities/BGL/boost/type_traits/conversion_traits.hpp @@ -1,7 +1,7 @@ // Copyright 2000 John Maddock (john@johnmaddock.co.uk) // Copyright 2000 Jeremy Siek (jsiek@lsc.nd.edu) -// Copyright 1999, 2000 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -12,6 +12,6 @@ #ifndef BOOST_TT_CONVERSION_TRAITS_HPP_INCLUDED #define BOOST_TT_CONVERSION_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_convertible.hpp" +#include <boost/type_traits/is_convertible.hpp> #endif // BOOST_TT_CONVERSION_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/cv_traits.hpp b/Utilities/BGL/boost/type_traits/cv_traits.hpp index aac5054ba6435edb088947f04d95fed96f75b110..5bd6c4f0666137d156549cff127bdf9bdf843d7f 100644 --- a/Utilities/BGL/boost/type_traits/cv_traits.hpp +++ b/Utilities/BGL/boost/type_traits/cv_traits.hpp @@ -12,13 +12,13 @@ #ifndef BOOST_TT_CV_TRAITS_HPP_INCLUDED #define BOOST_TT_CV_TRAITS_HPP_INCLUDED -#include "boost/type_traits/add_const.hpp" -#include "boost/type_traits/add_volatile.hpp" -#include "boost/type_traits/add_cv.hpp" -#include "boost/type_traits/is_const.hpp" -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/remove_const.hpp" -#include "boost/type_traits/remove_volatile.hpp" -#include "boost/type_traits/remove_cv.hpp" +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/add_volatile.hpp> +#include <boost/type_traits/add_cv.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/type_traits/remove_volatile.hpp> +#include <boost/type_traits/remove_cv.hpp> #endif // BOOST_TT_CV_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/decay.hpp b/Utilities/BGL/boost/type_traits/decay.hpp index 81f53030adfb4c3e9f89c0ee912227064cb63fa3..c23a9b0f15a63b023265b462396446158107cc03 100644 --- a/Utilities/BGL/boost/type_traits/decay.hpp +++ b/Utilities/BGL/boost/type_traits/decay.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_DECAY_HPP_INCLUDED #define BOOST_TT_DECAY_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/config.hpp> #include <boost/type_traits/is_array.hpp> #include <boost/type_traits/is_function.hpp> #include <boost/type_traits/remove_bounds.hpp> diff --git a/Utilities/BGL/boost/type_traits/detail/bool_trait_def.hpp b/Utilities/BGL/boost/type_traits/detail/bool_trait_def.hpp index 40ec5e201b8052ad06e3fcfe7f04d37575bbb54a..19bb18cec701feec562c8289541200cfc55cbda4 100644 --- a/Utilities/BGL/boost/type_traits/detail/bool_trait_def.hpp +++ b/Utilities/BGL/boost/type_traits/detail/bool_trait_def.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// $Source: /cvsroot/boost/boost/boost/type_traits/detail/bool_trait_def.hpp,v $ -// $Date: 2005/03/16 12:22:22 $ -// $Revision: 1.18 $ +// $Source$ +// $Date: 2006-07-12 07:10:22 -0400 (Wed, 12 Jul 2006) $ +// $Revision: 34511 $ #include <boost/type_traits/detail/template_arity_spec.hpp> #include <boost/type_traits/integral_constant.hpp> @@ -17,6 +17,28 @@ #include <boost/mpl/aux_/lambda_support.hpp> #include <boost/config.hpp> +// +// Unfortunately some libraries have started using this header without +// cleaning up afterwards: so we'd better undef the macros just in case +// they've been defined already.... +// +#ifdef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL +#undef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL +#undef BOOST_TT_AUX_BOOL_C_BASE +#undef BOOST_TT_AUX_BOOL_TRAIT_DEF1 +#undef BOOST_TT_AUX_BOOL_TRAIT_DEF2 +#undef BOOST_TT_AUX_BOOL_TRAIT_SPEC1 +#undef BOOST_TT_AUX_BOOL_TRAIT_SPEC2 +#undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1 +#undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2 +#undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1 +#undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2 +#undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1 +#undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2 +#undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1 +#undef BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1 +#endif + #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x570) # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ typedef ::boost::integral_constant<bool,C> type; \ @@ -24,7 +46,7 @@ /**/ # define BOOST_TT_AUX_BOOL_C_BASE(C) -#elif defined(BOOST_MSVC) && BOOST_MSVC <= 1200 +#elif defined(BOOST_MSVC) && BOOST_MSVC < 1300 # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ typedef ::boost::integral_constant<bool,C> base_; \ diff --git a/Utilities/BGL/boost/type_traits/detail/bool_trait_undef.hpp b/Utilities/BGL/boost/type_traits/detail/bool_trait_undef.hpp index 84a8a7b8cdd93284ff040e71115464ab2cdbf76d..2259c644f2d61a42fb9cd515123cf7c61e5e0824 100644 --- a/Utilities/BGL/boost/type_traits/detail/bool_trait_undef.hpp +++ b/Utilities/BGL/boost/type_traits/detail/bool_trait_undef.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// $Source: /cvsroot/boost/boost/boost/type_traits/detail/bool_trait_undef.hpp,v $ -// $Date: 2004/09/02 15:41:27 $ -// $Revision: 1.6 $ +// $Source$ +// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ +// $Revision: 24874 $ #undef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL #undef BOOST_TT_AUX_BOOL_C_BASE diff --git a/Utilities/BGL/boost/type_traits/detail/cv_traits_impl.hpp b/Utilities/BGL/boost/type_traits/detail/cv_traits_impl.hpp index eee7c7d2a2ae2427ed48d8df67ff2e73b8578776..b3fa59505e5925312ca734fc79cb6a5ad3518479 100644 --- a/Utilities/BGL/boost/type_traits/detail/cv_traits_impl.hpp +++ b/Utilities/BGL/boost/type_traits/detail/cv_traits_impl.hpp @@ -11,19 +11,19 @@ #ifndef BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED #define BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // implementation helper: -#if !(BOOST_WORKAROUND(__GNUC__,== 3) && (__GNUC_MINOR__ <= 2)) +#if !(BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2)) namespace boost { namespace detail { #else -#include "boost/type_traits/detail/yes_no_type.hpp" +#include <boost/type_traits/detail/yes_no_type.hpp> namespace boost { namespace type_traits { namespace gcc8503 { diff --git a/Utilities/BGL/boost/type_traits/detail/false_result.hpp b/Utilities/BGL/boost/type_traits/detail/false_result.hpp index b7ea18476e5ef0eba9fb3fa66ed80b77b6c3571c..e65e8bc257c3ddbc7fba2a9446938db45e5a2c9d 100644 --- a/Utilities/BGL/boost/type_traits/detail/false_result.hpp +++ b/Utilities/BGL/boost/type_traits/detail/false_result.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_DETAIL_FALSE_RESULT_HPP_INCLUDED #define BOOST_TT_DETAIL_FALSE_RESULT_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> namespace boost { namespace type_traits { diff --git a/Utilities/BGL/boost/type_traits/detail/ice_and.hpp b/Utilities/BGL/boost/type_traits/detail/ice_and.hpp index 92645b5625e914fa3759cec6be47c3963cbb2d13..8b461b9fffb8f0f6e929e5c46d8bf98131625352 100644 --- a/Utilities/BGL/boost/type_traits/detail/ice_and.hpp +++ b/Utilities/BGL/boost/type_traits/detail/ice_and.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_TT_DETAIL_ICE_AND_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_AND_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> namespace boost { namespace type_traits { diff --git a/Utilities/BGL/boost/type_traits/detail/ice_eq.hpp b/Utilities/BGL/boost/type_traits/detail/ice_eq.hpp index 4c177f33d5ee66a6ae1854b1eadfe407af8c7a10..ea42a60b66f258cf8a66aa8149bfae2014404589 100644 --- a/Utilities/BGL/boost/type_traits/detail/ice_eq.hpp +++ b/Utilities/BGL/boost/type_traits/detail/ice_eq.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_TT_DETAIL_ICE_EQ_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_EQ_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> namespace boost { namespace type_traits { diff --git a/Utilities/BGL/boost/type_traits/detail/ice_not.hpp b/Utilities/BGL/boost/type_traits/detail/ice_not.hpp index 6cac8408caf515e9a41de777f116923d83e7bea4..ee1dca0ecd5405ffbcbeddb50168730083f95b52 100644 --- a/Utilities/BGL/boost/type_traits/detail/ice_not.hpp +++ b/Utilities/BGL/boost/type_traits/detail/ice_not.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_TT_DETAIL_ICE_NOT_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_NOT_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> namespace boost { namespace type_traits { diff --git a/Utilities/BGL/boost/type_traits/detail/ice_or.hpp b/Utilities/BGL/boost/type_traits/detail/ice_or.hpp index e116e642668226077d872c0a22cf6d41669f2d3b..f88d9f6aec0661aa9ff978e98e566e867995b055 100644 --- a/Utilities/BGL/boost/type_traits/detail/ice_or.hpp +++ b/Utilities/BGL/boost/type_traits/detail/ice_or.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_TT_DETAIL_ICE_OR_HPP_INCLUDED #define BOOST_TT_DETAIL_ICE_OR_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> namespace boost { namespace type_traits { diff --git a/Utilities/BGL/boost/type_traits/detail/is_function_ptr_helper.hpp b/Utilities/BGL/boost/type_traits/detail/is_function_ptr_helper.hpp index 7a6fdda761a343c0dfd88f986a4d962519a8865a..605d0bc2ef2c1cde43659ae39f2c2200766f3942 100644 --- a/Utilities/BGL/boost/type_traits/detail/is_function_ptr_helper.hpp +++ b/Utilities/BGL/boost/type_traits/detail/is_function_ptr_helper.hpp @@ -15,12 +15,12 @@ #ifndef BOOST_TT_DETAIL_IS_FUNCTION_PTR_HELPER_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_FUNCTION_PTR_HELPER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/config.hpp> #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include <boost/preprocessor/iterate.hpp> +# include <boost/preprocessor/enum_params.hpp> +# include <boost/preprocessor/comma_if.hpp> #endif namespace boost { diff --git a/Utilities/BGL/boost/type_traits/detail/is_function_ptr_tester.hpp b/Utilities/BGL/boost/type_traits/detail/is_function_ptr_tester.hpp index 8ccda3074593b0c9751e00489e3aa09425df6964..c1a3c6a5f831ffdd468e1de384a1cd062fc17f02 100644 --- a/Utilities/BGL/boost/type_traits/detail/is_function_ptr_tester.hpp +++ b/Utilities/BGL/boost/type_traits/detail/is_function_ptr_tester.hpp @@ -14,13 +14,13 @@ #ifndef BOOST_TT_DETAIL_IS_FUNCTION_PTR_TESTER_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_FUNCTION_PTR_TESTER_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/config.hpp> #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include <boost/preprocessor/iterate.hpp> +# include <boost/preprocessor/enum_params.hpp> +# include <boost/preprocessor/comma_if.hpp> #endif namespace boost { @@ -45,10 +45,12 @@ template <class R > yes_type is_function_ptr_tester(R (__stdcall*)()); template <class R > yes_type is_function_ptr_tester(R (__stdcall*)( ...)); +#ifndef _MANAGED template <class R > yes_type is_function_ptr_tester(R (__fastcall*)()); template <class R > yes_type is_function_ptr_tester(R (__fastcall*)( ...)); +#endif template <class R > yes_type is_function_ptr_tester(R (__cdecl*)()); template <class R > @@ -65,10 +67,12 @@ template <class R , class T0 > yes_type is_function_ptr_tester(R (__stdcall*)( T0)); template <class R , class T0 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 ...)); +#ifndef _MANAGED template <class R , class T0 > yes_type is_function_ptr_tester(R (__fastcall*)( T0)); template <class R , class T0 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 ...)); +#endif template <class R , class T0 > yes_type is_function_ptr_tester(R (__cdecl*)( T0)); template <class R , class T0 > @@ -85,10 +89,12 @@ template <class R , class T0 , class T1 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1)); template <class R , class T0 , class T1 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1)); template <class R , class T0 , class T1 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 ...)); +#endif template <class R , class T0 , class T1 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1)); template <class R , class T0 , class T1 > @@ -105,10 +111,12 @@ template <class R , class T0 , class T1 , class T2 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2)); template <class R , class T0 , class T1 , class T2 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2)); template <class R , class T0 , class T1 , class T2 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 ...)); +#endif template <class R , class T0 , class T1 , class T2 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2)); template <class R , class T0 , class T1 , class T2 > @@ -125,10 +133,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3)); template <class R , class T0 , class T1 , class T2 , class T3 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3)); template <class R , class T0 , class T1 , class T2 , class T3 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3)); template <class R , class T0 , class T1 , class T2 , class T3 > @@ -145,10 +155,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 > @@ -165,10 +177,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > @@ -185,10 +199,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > @@ -205,10 +221,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > @@ -225,10 +243,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > @@ -245,10 +265,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > @@ -265,10 +287,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > @@ -285,10 +309,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > @@ -305,10 +331,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > @@ -325,10 +353,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > @@ -345,10 +375,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > @@ -365,10 +397,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > @@ -385,10 +419,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > @@ -405,10 +441,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > @@ -425,10 +463,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > @@ -445,10 +485,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > @@ -465,10 +507,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > @@ -485,10 +529,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > @@ -505,10 +551,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > @@ -525,10 +573,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > @@ -545,10 +595,12 @@ template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_function_ptr_tester(R (__stdcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...)); +#ifndef _MANAGED template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_function_ptr_tester(R (__fastcall*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...)); +#endif template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_function_ptr_tester(R (__cdecl*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > @@ -586,10 +638,12 @@ template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST yes_type is_function_ptr_tester(R (__stdcall*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_function_ptr_tester(R (__stdcall*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...)); +@#ifndef _MANAGED template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_function_ptr_tester(R (__fastcall*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_function_ptr_tester(R (__fastcall*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...)); +@#endif template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_function_ptr_tester(R (__cdecl*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > diff --git a/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp b/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp index a9f0f5ec14a7639795d36ad1ab5feea355328751..4f75f14d0a4a6c96531aa5fd690334ec0eea5026 100644 --- a/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +++ b/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp @@ -14,12 +14,12 @@ #ifndef BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_IMPL_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_IMPL_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include <boost/preprocessor/iterate.hpp> +# include <boost/preprocessor/enum_params.hpp> +# include <boost/preprocessor/comma_if.hpp> #endif namespace boost { diff --git a/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp b/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp index 5ce25fa701f6976887deb4686f63653a7456abb1..e6532d39db9fb32179ae4714a5b299965cccf3a3 100644 --- a/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp +++ b/Utilities/BGL/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp @@ -14,13 +14,13 @@ #ifndef BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_TESTER_HPP_INCLUDED #define BOOST_TT_DETAIL_IS_MEM_FUN_POINTER_TESTER_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/config.hpp> #if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" +# include <boost/preprocessor/iterate.hpp> +# include <boost/preprocessor/enum_params.hpp> +# include <boost/preprocessor/comma_if.hpp> #endif namespace boost { @@ -29,7 +29,8 @@ namespace type_traits { no_type BOOST_TT_DECL is_mem_fun_pointer_tester(...); #if !defined(BOOST_TT_PREPROCESSING_MODE) -// preprocessor-generated part, don't edit by hand! +// pre-processed code, don't edit, try GNU cpp with +// cpp -I../../../ -DBOOST_TT_PREPROCESSING_MODE -x c++ -P filename template <class R, class T > yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)()); @@ -81,6 +82,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( ...) volat template <class R, class T > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( ...) const volatile); +#ifndef _MANAGED template <class R, class T > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)()); @@ -104,6 +106,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( ...) vola template <class R, class T > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( ...) const volatile); +#endif template <class R, class T > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)()); @@ -179,6 +182,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 ...) vo template <class R, class T , class T0 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0)); @@ -202,6 +206,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 ...) v template <class R, class T , class T0 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 ...) const volatile); +#endif template <class R, class T , class T0 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0)); @@ -277,6 +282,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 .. template <class R, class T , class T0 , class T1 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1)); @@ -300,6 +306,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 . template <class R, class T , class T0 , class T1 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1)); @@ -375,6 +382,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2)); @@ -398,6 +406,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2)); @@ -473,6 +482,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3)); @@ -496,6 +506,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3)); @@ -571,6 +582,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4)); @@ -594,6 +606,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4)); @@ -669,6 +682,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5)); @@ -692,6 +706,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5)); @@ -767,6 +782,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); @@ -790,6 +806,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)); @@ -865,6 +882,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); @@ -888,6 +906,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)); @@ -963,6 +982,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); @@ -986,6 +1006,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)); @@ -1061,6 +1082,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); @@ -1084,6 +1106,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)); @@ -1159,6 +1182,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); @@ -1182,6 +1206,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)); @@ -1257,6 +1282,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); @@ -1280,6 +1306,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)); @@ -1355,6 +1382,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); @@ -1378,6 +1406,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)); @@ -1453,6 +1482,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); @@ -1476,6 +1506,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)); @@ -1551,6 +1582,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); @@ -1574,6 +1606,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)); @@ -1649,6 +1682,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); @@ -1672,6 +1706,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)); @@ -1747,6 +1782,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); @@ -1770,6 +1806,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)); @@ -1845,6 +1882,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); @@ -1868,6 +1906,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)); @@ -1943,6 +1982,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); @@ -1966,6 +2006,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)); @@ -2041,6 +2082,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); @@ -2064,6 +2106,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)); @@ -2139,6 +2182,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); @@ -2162,6 +2206,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)); @@ -2237,6 +2282,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); @@ -2260,6 +2306,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)); @@ -2335,6 +2382,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); @@ -2358,6 +2406,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)); @@ -2433,6 +2482,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); @@ -2456,6 +2506,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)); @@ -2531,6 +2582,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) const volatile); +#ifndef _MANAGED template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); @@ -2554,6 +2606,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) const volatile); +#endif template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24 > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)); @@ -2613,7 +2666,7 @@ yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS( template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T)) const volatile); -#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING +@#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...)); @@ -2625,8 +2678,8 @@ yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS( template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); -#endif -#ifdef BOOST_TT_TEST_MS_FUNC_SIGS // Other calling conventions used by MS compatible compilers: +@#endif +@#ifdef BOOST_TT_TEST_MS_FUNC_SIGS // Other calling conventions used by MS compatible compilers: template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); @@ -2651,6 +2704,7 @@ yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)(BOOST_PP_EN template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (__stdcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); +@#ifndef _MANAGED template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); @@ -2674,6 +2728,7 @@ yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)(BOOST_PP_E template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (__fastcall T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); +@#endif template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))); @@ -2698,7 +2753,7 @@ yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)(BOOST_PP_ENUM template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T) > yes_type is_mem_fun_pointer_tester(R (__cdecl T::*const volatile*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile); -#endif +@#endif #undef BOOST_PP_COUNTER #endif // BOOST_PP_IS_ITERATING diff --git a/Utilities/BGL/boost/type_traits/detail/size_t_trait_def.hpp b/Utilities/BGL/boost/type_traits/detail/size_t_trait_def.hpp index ec169b9306f8d76284a9932122a08b77830d1cb1..472c6ac1651b05c61d2bdd66d141961313a3e19d 100644 --- a/Utilities/BGL/boost/type_traits/detail/size_t_trait_def.hpp +++ b/Utilities/BGL/boost/type_traits/detail/size_t_trait_def.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// $Source: /cvsroot/boost/boost/boost/type_traits/detail/size_t_trait_def.hpp,v $ -// $Date: 2005/01/30 15:47:45 $ -// $Revision: 1.8 $ +// $Source$ +// $Date: 2005-08-25 12:27:28 -0400 (Thu, 25 Aug 2005) $ +// $Revision: 30670 $ #include <boost/type_traits/detail/template_arity_spec.hpp> #include <boost/type_traits/integral_constant.hpp> @@ -18,7 +18,7 @@ #include <cstddef> -#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 +#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 # define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::integral_constant<std::size_t,C> # define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/ #else diff --git a/Utilities/BGL/boost/type_traits/detail/size_t_trait_undef.hpp b/Utilities/BGL/boost/type_traits/detail/size_t_trait_undef.hpp index 027927e84e073c14b5ccea00660ecc2bbfeaaf05..06a176dc8eeada5f2b15dda6e5c8536292614d96 100644 --- a/Utilities/BGL/boost/type_traits/detail/size_t_trait_undef.hpp +++ b/Utilities/BGL/boost/type_traits/detail/size_t_trait_undef.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// $Source: /cvsroot/boost/boost/boost/type_traits/detail/size_t_trait_undef.hpp,v $ -// $Date: 2004/09/02 15:41:27 $ -// $Revision: 1.4 $ +// $Source$ +// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ +// $Revision: 24874 $ #undef BOOST_TT_AUX_SIZE_T_TRAIT_DEF1 #undef BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1 diff --git a/Utilities/BGL/boost/type_traits/detail/type_trait_def.hpp b/Utilities/BGL/boost/type_traits/detail/type_trait_def.hpp index 32e17464909c877a1fcddd63ea2f6b4c805ba5e0..644c7ac90952f33687be6a315786ef34a5441f2a 100644 --- a/Utilities/BGL/boost/type_traits/detail/type_trait_def.hpp +++ b/Utilities/BGL/boost/type_traits/detail/type_trait_def.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// $Source: /cvsroot/boost/boost/boost/type_traits/detail/type_trait_def.hpp,v $ -// $Date: 2004/09/02 15:41:27 $ -// $Revision: 1.7 $ +// $Source$ +// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ +// $Revision: 24874 $ #include <boost/type_traits/detail/template_arity_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> diff --git a/Utilities/BGL/boost/type_traits/detail/type_trait_undef.hpp b/Utilities/BGL/boost/type_traits/detail/type_trait_undef.hpp index c12e659ebdbd3438eee4aa3dfe9cd4694a89e531..9403b9bde1709d9c69ddf49b307c0f4b37a58d33 100644 --- a/Utilities/BGL/boost/type_traits/detail/type_trait_undef.hpp +++ b/Utilities/BGL/boost/type_traits/detail/type_trait_undef.hpp @@ -7,9 +7,9 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// $Source: /cvsroot/boost/boost/boost/type_traits/detail/type_trait_undef.hpp,v $ -// $Date: 2004/09/02 15:41:27 $ -// $Revision: 1.6 $ +// $Source$ +// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ +// $Revision: 24874 $ #undef BOOST_TT_AUX_TYPE_TRAIT_DEF1 #undef BOOST_TT_AUX_TYPE_TRAIT_SPEC1 diff --git a/Utilities/BGL/boost/type_traits/extent.hpp b/Utilities/BGL/boost/type_traits/extent.hpp index 88f98dd2de1b3487aea7c40b1692ee46b953ddae..27e8a670fc04c197ed97e7a463f61588cd621419 100644 --- a/Utilities/BGL/boost/type_traits/extent.hpp +++ b/Utilities/BGL/boost/type_traits/extent.hpp @@ -11,12 +11,21 @@ #define BOOST_TT_EXTENT_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/size_t_trait_def.hpp" +#include <boost/type_traits/detail/size_t_trait_def.hpp> namespace boost { namespace detail{ +#if defined( __CODEGEARC__ ) + // wrap the impl as main trait provides additional MPL lambda support + template < typename T, std::size_t N > + struct extent_imp { + static const std::size_t value = __array_extent(T, N); + }; + +#else + template <class T, std::size_t N> struct extent_imp { @@ -114,13 +123,15 @@ struct extent_imp<T const volatile[], 0> }; #endif #endif -} + +#endif // non-CodeGear implementation +} // ::boost::detail template <class T, std::size_t N = 0> struct extent : public ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value> { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) typedef ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value> base_; using base_::value; #endif @@ -129,6 +140,6 @@ struct extent } // namespace boost -#include "boost/type_traits/detail/size_t_trait_undef.hpp" +#include <boost/type_traits/detail/size_t_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/floating_point_promotion.hpp b/Utilities/BGL/boost/type_traits/floating_point_promotion.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8b6ae3a32a98c24408290789317ab3c792896dc7 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/floating_point_promotion.hpp @@ -0,0 +1,91 @@ +// Copyright 2005 Alexander Nasonov. +// 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 FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED +#define FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED + +#include <boost/config.hpp> + +#ifdef BOOST_NO_CV_SPECIALIZATIONS +#include <boost/mpl/at.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/multiplies.hpp> +#include <boost/mpl/plus.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/type_traits/is_same.hpp> +#endif + +// Should be the last #include +#include <boost/type_traits/detail/type_trait_def.hpp> + +namespace boost { + +namespace type_traits { namespace detail { + +#ifndef BOOST_NO_CV_SPECIALIZATIONS + +template<class T> +struct floating_point_promotion +{ + typedef T type; +}; + +template<> +struct floating_point_promotion<float> +{ + typedef double type; +}; + +template<> +struct floating_point_promotion<float const> +{ + typedef double const type; +}; + +template<> +struct floating_point_promotion<float volatile> +{ + typedef double volatile type; +}; + +template<> +struct floating_point_promotion<float const volatile> +{ + typedef double const volatile type; +}; + +#else + +template<class T> +struct floating_point_promotion + : mpl::at< + mpl::vector< T, double, double const, double volatile, + double const volatile > + , mpl::plus< + is_same<T, float> + , mpl::multiplies< is_same<T, float const> , mpl::int_<2> > + , mpl::multiplies< is_same<T, float volatile> , mpl::int_<3> > + , mpl::multiplies< is_same<T, float const volatile>, mpl::int_<4> > + > + > +{ +}; + +#endif + +} } + +BOOST_TT_AUX_TYPE_TRAIT_DEF1( + floating_point_promotion + , T + , BOOST_DEDUCED_TYPENAME + boost::type_traits::detail::floating_point_promotion<T>::type + ) +} + +#include <boost/type_traits/detail/type_trait_undef.hpp> + +#endif // #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED + diff --git a/Utilities/BGL/boost/type_traits/function_traits.hpp b/Utilities/BGL/boost/type_traits/function_traits.hpp index 36efaecdee6100715b0078f78362d8ff2a226410..bfc3f7e53b2d5fb03d2aa1650555d401265f734d 100644 --- a/Utilities/BGL/boost/type_traits/function_traits.hpp +++ b/Utilities/BGL/boost/type_traits/function_traits.hpp @@ -23,14 +23,14 @@ template<typename Function> struct function_traits_helper; template<typename R> struct function_traits_helper<R (*)(void)> { - BOOST_STATIC_CONSTANT(int, arity = 0); + BOOST_STATIC_CONSTANT(unsigned, arity = 0); typedef R result_type; }; template<typename R, typename T1> struct function_traits_helper<R (*)(T1)> { - BOOST_STATIC_CONSTANT(int, arity = 1); + BOOST_STATIC_CONSTANT(unsigned, arity = 1); typedef R result_type; typedef T1 arg1_type; typedef T1 argument_type; @@ -39,7 +39,7 @@ struct function_traits_helper<R (*)(T1)> template<typename R, typename T1, typename T2> struct function_traits_helper<R (*)(T1, T2)> { - BOOST_STATIC_CONSTANT(int, arity = 2); + BOOST_STATIC_CONSTANT(unsigned, arity = 2); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -50,7 +50,7 @@ struct function_traits_helper<R (*)(T1, T2)> template<typename R, typename T1, typename T2, typename T3> struct function_traits_helper<R (*)(T1, T2, T3)> { - BOOST_STATIC_CONSTANT(int, arity = 3); + BOOST_STATIC_CONSTANT(unsigned, arity = 3); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -60,7 +60,7 @@ struct function_traits_helper<R (*)(T1, T2, T3)> template<typename R, typename T1, typename T2, typename T3, typename T4> struct function_traits_helper<R (*)(T1, T2, T3, T4)> { - BOOST_STATIC_CONSTANT(int, arity = 4); + BOOST_STATIC_CONSTANT(unsigned, arity = 4); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -72,7 +72,7 @@ template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5> struct function_traits_helper<R (*)(T1, T2, T3, T4, T5)> { - BOOST_STATIC_CONSTANT(int, arity = 5); + BOOST_STATIC_CONSTANT(unsigned, arity = 5); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -85,7 +85,7 @@ template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6)> { - BOOST_STATIC_CONSTANT(int, arity = 6); + BOOST_STATIC_CONSTANT(unsigned, arity = 6); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -99,7 +99,7 @@ template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7)> { - BOOST_STATIC_CONSTANT(int, arity = 7); + BOOST_STATIC_CONSTANT(unsigned, arity = 7); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -114,7 +114,7 @@ template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8)> { - BOOST_STATIC_CONSTANT(int, arity = 8); + BOOST_STATIC_CONSTANT(unsigned, arity = 8); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -130,7 +130,7 @@ template<typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9)> { - BOOST_STATIC_CONSTANT(int, arity = 9); + BOOST_STATIC_CONSTANT(unsigned, arity = 9); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -148,7 +148,7 @@ template<typename R, typename T1, typename T2, typename T3, typename T4, typename T10> struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> { - BOOST_STATIC_CONSTANT(int, arity = 10); + BOOST_STATIC_CONSTANT(unsigned, arity = 10); typedef R result_type; typedef T1 arg1_type; typedef T2 arg2_type; @@ -166,7 +166,7 @@ struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> template<typename Function> struct function_traits : - public detail::function_traits_helper<typename add_pointer<Function>::type> + public detail::function_traits_helper<typename boost::add_pointer<Function>::type> { }; @@ -174,7 +174,7 @@ struct function_traits : namespace detail { -template<int N> +template<unsigned N> struct type_of_size { char elements[N]; @@ -227,7 +227,7 @@ type_of_size<11> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, template<typename Function> struct function_traits { - BOOST_STATIC_CONSTANT(int, arity = (sizeof(detail::function_arity_helper((Function*)0))-1)); + BOOST_STATIC_CONSTANT(unsigned, arity = (sizeof(detail::function_arity_helper((Function*)0))-1)); }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/Utilities/BGL/boost/type_traits/has_new_operator.hpp b/Utilities/BGL/boost/type_traits/has_new_operator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2c2c32228f26682ebf708aa46deec1a220151b5b --- /dev/null +++ b/Utilities/BGL/boost/type_traits/has_new_operator.hpp @@ -0,0 +1,140 @@ + +// (C) Copyright Runar Undheim, Robert Ramey & John Maddock 2008. +// 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/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED +#define BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED + +#include <new> // std::nothrow_t +#include <cstddef> // std::size_t +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/detail/ice_or.hpp> + +// should be the last #include +#include <boost/type_traits/detail/bool_trait_def.hpp> + +namespace boost { +namespace detail { + template <class U, U x> + struct test; + + template <typename T> + struct has_new_operator_impl { + template<class U> + static type_traits::yes_type check_sig1( + U*, + test< + void *(*)(std::size_t), + &U::operator new + >* = NULL + ); + template<class U> + static type_traits::no_type check_sig1(...); + + template<class U> + static type_traits::yes_type check_sig2( + U*, + test< + void *(*)(std::size_t, const std::nothrow_t&), + &U::operator new + >* = NULL + ); + template<class U> + static type_traits::no_type check_sig2(...); + + template<class U> + static type_traits::yes_type check_sig3( + U*, + test< + void *(*)(std::size_t, void*), + &U::operator new + >* = NULL + ); + template<class U> + static type_traits::no_type check_sig3(...); + + + template<class U> + static type_traits::yes_type check_sig4( + U*, + test< + void *(*)(std::size_t), + &U::operator new[] + >* = NULL + ); + template<class U> + static type_traits::no_type check_sig4(...); + + template<class U> + static type_traits::yes_type check_sig5( + U*, + test< + void *(*)(std::size_t, const std::nothrow_t&), + &U::operator new[] + >* = NULL + ); + template<class U> + static type_traits::no_type check_sig5(...); + + template<class U> + static type_traits::yes_type check_sig6( + U*, + test< + void *(*)(std::size_t, void*), + &U::operator new[] + >* = NULL + ); + template<class U> + static type_traits::no_type check_sig6(...); + + // GCC2 won't even parse this template if we embed the computation + // of s1 in the computation of value. + #ifdef __GNUC__ + BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl<T>::template check_sig1<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl<T>::template check_sig2<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(has_new_operator_impl<T>::template check_sig3<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(has_new_operator_impl<T>::template check_sig4<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(has_new_operator_impl<T>::template check_sig5<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(has_new_operator_impl<T>::template check_sig6<T>(0))); + #else + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) + #pragma warning(push) + #pragma warning(disable:6334) + #endif + + BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig1<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(check_sig3<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(check_sig4<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(check_sig5<T>(0))); + BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(check_sig6<T>(0))); + + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) + #pragma warning(pop) + #endif + #endif + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + (s1 == sizeof(type_traits::yes_type)), + (s2 == sizeof(type_traits::yes_type)), + (s3 == sizeof(type_traits::yes_type)), + (s4 == sizeof(type_traits::yes_type)), + (s5 == sizeof(type_traits::yes_type)), + (s6 == sizeof(type_traits::yes_type)) + >::value) + ); + }; +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_new_operator,T,::boost::detail::has_new_operator_impl<T>::value) + +} // namespace boost + +#include <boost/type_traits/detail/bool_trait_undef.hpp> + +#endif // BOOST_TT_HAS_NEW_OPERATOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_nothrow_assign.hpp b/Utilities/BGL/boost/type_traits/has_nothrow_assign.hpp index 2f529245651384a550d93071e610a43be20145d0..3cef7357d596c1f32869cb6508b7415e9510f2d5 100644 --- a/Utilities/BGL/boost/type_traits/has_nothrow_assign.hpp +++ b/Utilities/BGL/boost/type_traits/has_nothrow_assign.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED -#include "boost/type_traits/has_trivial_assign.hpp" +#include <boost/type_traits/has_trivial_assign.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -33,6 +33,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_assign,T,::boost::detail::has_nothrow_a } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_NOTHROW_ASSIGN_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_nothrow_constructor.hpp b/Utilities/BGL/boost/type_traits/has_nothrow_constructor.hpp index f3c7ce764bb09b7a7d156d75893f574e559aac4e..e807fd4385e249ce64aae733a4054371d1fa9ca5 100644 --- a/Utilities/BGL/boost/type_traits/has_nothrow_constructor.hpp +++ b/Utilities/BGL/boost/type_traits/has_nothrow_constructor.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/has_trivial_constructor.hpp" +#include <boost/type_traits/has_trivial_constructor.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -30,9 +30,10 @@ struct has_nothrow_constructor_imp{ } BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_constructor,T,::boost::detail::has_nothrow_constructor_imp<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_default_constructor,T,::boost::detail::has_nothrow_constructor_imp<T>::value) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_NOTHROW_CONSTRUCTOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_nothrow_copy.hpp b/Utilities/BGL/boost/type_traits/has_nothrow_copy.hpp index 5c83412e0eef2ac8c4a163207583569cc19ac38b..c06b4a3d0bb15aac67cc06ebb5899449134556a2 100644 --- a/Utilities/BGL/boost/type_traits/has_nothrow_copy.hpp +++ b/Utilities/BGL/boost/type_traits/has_nothrow_copy.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED -#include "boost/type_traits/has_trivial_copy.hpp" +#include <boost/type_traits/has_trivial_copy.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -30,9 +30,10 @@ struct has_nothrow_copy_imp{ } BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::detail::has_nothrow_copy_imp<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy_constructor,T,::boost::detail::has_nothrow_copy_imp<T>::value) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_NOTHROW_COPY_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_nothrow_destructor.hpp b/Utilities/BGL/boost/type_traits/has_nothrow_destructor.hpp index 8df6315e3b89a018aa623609a7e3cd8c8370df5b..4f5882afc00a4e7152e32b4b38b477384a24a87a 100644 --- a/Utilities/BGL/boost/type_traits/has_nothrow_destructor.hpp +++ b/Utilities/BGL/boost/type_traits/has_nothrow_destructor.hpp @@ -9,10 +9,10 @@ #ifndef BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/has_trivial_destructor.hpp" +#include <boost/type_traits/has_trivial_destructor.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -20,6 +20,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_destructor,T,::boost::has_trivial_destr } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_trivial_assign.hpp b/Utilities/BGL/boost/type_traits/has_trivial_assign.hpp index d3ed0ff8d7b614dfcdcdc5da66e55eb11a6f562b..4179e8d747321847671c6e346c60b177bee98a07 100644 --- a/Utilities/BGL/boost/type_traits/has_trivial_assign.hpp +++ b/Utilities/BGL/boost/type_traits/has_trivial_assign.hpp @@ -9,17 +9,17 @@ #ifndef BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/is_const.hpp" -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/detail/ice_not.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -45,6 +45,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_assign,T,::boost::detail::has_trivial_a } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_TRIVIAL_ASSIGN_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_trivial_constructor.hpp b/Utilities/BGL/boost/type_traits/has_trivial_constructor.hpp index 5d1c3b6043633672c31dd9f69d25c0336bd3f5bd..f9ade5d1d42cb8b2b1c5563689f009fea78ad89a 100644 --- a/Utilities/BGL/boost/type_traits/has_trivial_constructor.hpp +++ b/Utilities/BGL/boost/type_traits/has_trivial_constructor.hpp @@ -9,13 +9,13 @@ #ifndef BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/detail/ice_or.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -34,9 +34,10 @@ struct has_trivial_ctor_impl } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_constructor,T,::boost::detail::has_trivial_ctor_impl<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_default_constructor,T,::boost::detail::has_trivial_ctor_impl<T>::value) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_TRIVIAL_CONSTRUCTOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_trivial_copy.hpp b/Utilities/BGL/boost/type_traits/has_trivial_copy.hpp index 76ebfcf7641baf917e4b0dcc37245b37dcee9708..8c753615d4c73e3bfe845f157b6d3406469a4298 100644 --- a/Utilities/BGL/boost/type_traits/has_trivial_copy.hpp +++ b/Utilities/BGL/boost/type_traits/has_trivial_copy.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/detail/ice_not.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -40,9 +40,10 @@ struct has_trivial_copy_impl } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy_constructor,T,::boost::detail::has_trivial_copy_impl<T>::value) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_trivial_destructor.hpp b/Utilities/BGL/boost/type_traits/has_trivial_destructor.hpp index 257b327f52f1e14fbeda991f1e405aae90a858e6..f2a8ce681b1736bf3174d2de7e014a2b8ea5bb0c 100644 --- a/Utilities/BGL/boost/type_traits/has_trivial_destructor.hpp +++ b/Utilities/BGL/boost/type_traits/has_trivial_destructor.hpp @@ -9,13 +9,13 @@ #ifndef BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED #define BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/detail/ice_or.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -37,6 +37,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_destructor,T,::boost::detail::has_trivi } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_HAS_TRIVIAL_DESTRUCTOR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/has_virtual_destructor.hpp b/Utilities/BGL/boost/type_traits/has_virtual_destructor.hpp index 4d15704d9d98892f6b065c382ec6f56d64c617a6..8f99ff420f39b4eeabd05db0f70e807ffabd64ee 100644 --- a/Utilities/BGL/boost/type_traits/has_virtual_destructor.hpp +++ b/Utilities/BGL/boost/type_traits/has_virtual_destructor.hpp @@ -12,7 +12,7 @@ #include <boost/type_traits/intrinsics.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -20,6 +20,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,BOOST_HAS_VIRTUAL_DESTRUCT } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/ice.hpp b/Utilities/BGL/boost/type_traits/ice.hpp index 2ba08160bf3d5d7c5cd9e7ea393c9bce06cf2256..134bc4bb76423514c20eb5d09d9742893245d5f0 100644 --- a/Utilities/BGL/boost/type_traits/ice.hpp +++ b/Utilities/BGL/boost/type_traits/ice.hpp @@ -11,10 +11,10 @@ #ifndef BOOST_TT_ICE_HPP_INCLUDED #define BOOST_TT_ICE_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" -#include "boost/type_traits/detail/ice_eq.hpp" +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_not.hpp> +#include <boost/type_traits/detail/ice_eq.hpp> #endif // BOOST_TT_ICE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/integral_constant.hpp b/Utilities/BGL/boost/type_traits/integral_constant.hpp index 26f952a497dda15f48b057c776c1203962d010ed..4ed1bb058fc80f3acf83d2d3bbff1b730fb44a6d 100644 --- a/Utilities/BGL/boost/type_traits/integral_constant.hpp +++ b/Utilities/BGL/boost/type_traits/integral_constant.hpp @@ -19,57 +19,28 @@ template <class T, T val> #endif struct integral_constant : public mpl::integral_c<T, val> { - //BOOST_STATIC_CONSTANT(T, value = val); - //typedef T value_type; typedef integral_constant<T,val> type; - -#if 0 - // - // everything that follows now, is MPL-compatibility code: - // - typedef ::boost::mpl::integral_c_tag tag; - - // have to #ifdef here: some compilers don't like the 'val + 1' form (MSVC), - // while some other don't like 'value + 1' (Borland), and some don't like - // either -#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) -private: - BOOST_STATIC_CONSTANT(T, next_value = BOOST_MPL_AUX_STATIC_CAST(T, (val + 1))); - BOOST_STATIC_CONSTANT(T, prior_value = BOOST_MPL_AUX_STATIC_CAST(T, (val - 1))); -public: - typedef integral_constant<T,next_value> next; - typedef integral_constant<T,prior_value> prior; -#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ - || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ - || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) - typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)) )> next; - typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)) )> prior; -#else - typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value + 1)) )> next; - typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value - 1)) )> prior; -#endif - - // enables uniform function call syntax for families of overloaded - // functions that return objects of both arithmetic ('int', 'long', - // 'double', etc.) and wrapped integral types (for an example, see - // "mpl/example/power.cpp") - operator T() const { return static_cast<T>(this->value); } -#endif }; template<> struct integral_constant<bool,true> : public mpl::true_ { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +# pragma warning(push) +# pragma warning(disable:4097) typedef mpl::true_ base_; using base_::value; +# pragma warning(pop) #endif typedef integral_constant<bool,true> type; }; template<> struct integral_constant<bool,false> : public mpl::false_ { -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +# pragma warning(push) +# pragma warning(disable:4097) typedef mpl::false_ base_; using base_::value; +# pragma warning(pop) #endif typedef integral_constant<bool,false> type; }; diff --git a/Utilities/BGL/boost/type_traits/integral_promotion.hpp b/Utilities/BGL/boost/type_traits/integral_promotion.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a85e243b857e1ec850af3045c9c1cf9a09e547fa --- /dev/null +++ b/Utilities/BGL/boost/type_traits/integral_promotion.hpp @@ -0,0 +1,195 @@ +// Copyright 2005 Alexander Nasonov. +// 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 FILE_boost_type_traits_integral_promotion_hpp_INCLUDED +#define FILE_boost_type_traits_integral_promotion_hpp_INCLUDED + +#include <boost/config.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/remove_cv.hpp> + +// Should be the last #include +#include <boost/type_traits/detail/type_trait_def.hpp> + +namespace boost { + +namespace type_traits { namespace detail { + +// 4.5/2 +template <class T> struct need_promotion : boost::is_enum<T> {}; + +// 4.5/1 +template<> struct need_promotion<char > : true_type {}; +template<> struct need_promotion<signed char > : true_type {}; +template<> struct need_promotion<unsigned char > : true_type {}; +template<> struct need_promotion<signed short int > : true_type {}; +template<> struct need_promotion<unsigned short int> : true_type {}; + + +// Specializations for non-standard types. +// Type is promoted if it's smaller then int. + +#define BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(T) \ + template<> struct need_promotion<T> \ + : integral_constant<bool, (sizeof(T) < sizeof(int))> {}; + +// Same set of integral types as in boost/type_traits/is_integral.hpp. +// Please, keep in sync. +#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1300)) \ + || (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \ + || (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER < 1300)) +// TODO: common macro for this #if. Or better yet, PP SEQ of non-standard types. +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(__int8 ) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int8 ) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(__int16 ) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int16) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(__int32 ) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int32) +#ifdef __BORLANDC__ +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int64) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE( __int64) +#endif +#endif + +#if defined(BOOST_HAS_LONG_LONG) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(boost::ulong_long_type) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(boost::long_long_type ) +#elif defined(BOOST_HAS_MS_INT64) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(unsigned __int64) +BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE( __int64) +#endif + +#undef BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE + + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +// 4.5/2 +template<> struct need_promotion<wchar_t> : true_type {}; +#endif + +// 4.5/3 (integral bit-field) is not supported. + +// 4.5/4 +template<> struct need_promotion<bool> : true_type {}; + + +// Get promoted type by index and cv qualifiers. + +template<int Index, int IsConst, int IsVolatile> struct promote_from_index; + +#define BOOST_TT_AUX_PROMOTE_FROM_INDEX(N,T) \ + template<> struct promote_from_index<N,0,0> { typedef T type; }; \ + template<> struct promote_from_index<N,0,1> { typedef T volatile type; }; \ + template<> struct promote_from_index<N,1,0> { typedef T const type; }; \ + template<> struct promote_from_index<N,1,1> { typedef T const volatile type; }; + + +BOOST_TT_AUX_PROMOTE_FROM_INDEX(1, int ) +BOOST_TT_AUX_PROMOTE_FROM_INDEX(2, unsigned int ) +BOOST_TT_AUX_PROMOTE_FROM_INDEX(3, long ) +BOOST_TT_AUX_PROMOTE_FROM_INDEX(4, unsigned long) + + +// WARNING: integral promotions to non-standard types +// long long and __int64 are not defined by the standard. +// Additional specialisations and overloads shouldn't +// introduce ambiguity, though. + +#if defined(BOOST_HAS_LONG_LONG) +BOOST_TT_AUX_PROMOTE_FROM_INDEX(5, boost::long_long_type ) +BOOST_TT_AUX_PROMOTE_FROM_INDEX(6, boost::ulong_long_type) +#elif defined(BOOST_HAS_MS_INT64) +BOOST_TT_AUX_PROMOTE_FROM_INDEX(7, __int64 ) +BOOST_TT_AUX_PROMOTE_FROM_INDEX(8, unsigned __int64) +#endif + +#undef BOOST_TT_AUX_PROMOTE_FROM_INDEX + + +// Define BOOST_TT_AUX_PROMOTED_INDEX_TESTER: +#if !defined(BOOST_MSVC) + +template<int N> +struct sized_type_for_promotion +{ + typedef char (&type)[N]; +}; + +#define BOOST_TT_AUX_PROMOTED_INDEX_TESTER(I,T) \ + sized_type_for_promotion<I>::type promoted_index_tester(T); + +#else + +#define BOOST_TT_AUX_PROMOTED_INDEX_TESTER(I,T) \ + char (&promoted_index_tester(T))[I]; + +#endif + +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(1, int ) +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(2, unsigned int ) +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(3, long ) +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(4, unsigned long) + +#if defined(BOOST_HAS_LONG_LONG) +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(5, boost::long_long_type ) +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(6, boost::ulong_long_type) +#elif defined(BOOST_HAS_MS_INT64) +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(7, __int64 ) +BOOST_TT_AUX_PROMOTED_INDEX_TESTER(8, unsigned __int64) +#endif + +#undef BOOST_TT_AUX_PROMOTED_INDEX_TESTER + + +// Get an index of promoted type for type T. +// Precondition: need_promotion<T> +template<class T> +struct promoted_index +{ + static T testee; // undefined + BOOST_STATIC_CONSTANT(int, value = sizeof(promoted_index_tester(+testee)) ); + // Unary plus promotes testee LOOK HERE ---> ^ +}; + +template<class T> +struct integral_promotion_impl +{ + typedef BOOST_DEDUCED_TYPENAME promote_from_index< + (boost::type_traits::detail::promoted_index<T>::value) + , (boost::is_const<T>::value) + , (boost::is_volatile<T>::value) + >::type type; +}; + +template<class T> +struct integral_promotion + : boost::mpl::eval_if< + need_promotion<BOOST_DEDUCED_TYPENAME remove_cv<T>::type> + , integral_promotion_impl<T> + , boost::mpl::identity<T> + > +{ +}; + +} } + +BOOST_TT_AUX_TYPE_TRAIT_DEF1( + integral_promotion + , T + , BOOST_DEDUCED_TYPENAME + boost::type_traits::detail::integral_promotion<T>::type + ) +} + +#include <boost/type_traits/detail/type_trait_undef.hpp> + +#endif // #ifndef FILE_boost_type_traits_integral_promotion_hpp_INCLUDED + diff --git a/Utilities/BGL/boost/type_traits/intrinsics.hpp b/Utilities/BGL/boost/type_traits/intrinsics.hpp index f993613a91310390d5ea18dd03485635acb4dbc5..8f88036e20294005835611c2782df89a6f005104 100644 --- a/Utilities/BGL/boost/type_traits/intrinsics.hpp +++ b/Utilities/BGL/boost/type_traits/intrinsics.hpp @@ -10,7 +10,7 @@ #define BOOST_TT_INTRINSICS_HPP_INCLUDED #ifndef BOOST_TT_CONFIG_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/config.hpp> #endif // @@ -31,12 +31,31 @@ // BOOST_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw // BOOST_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw // BOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor +// +// The following can also be defined: when detected our implementation is greatly simplified. +// Note that unlike the macros above these do not have default definitions, so we can use +// #ifdef MACRONAME to detect when these are available. +// +// BOOST_IS_ABSTRACT(T) true if T is an abstract type +// BOOST_IS_BASE_OF(T,U) true if T is a base class of U +// BOOST_IS_CLASS(T) true if T is a class type +// BOOST_IS_CONVERTIBLE(T,U) true if T is convertible to U +// BOOST_IS_ENUM(T) true is T is an enum +// BOOST_IS_POLYMORPHIC(T) true if T is a polymorphic type +// BOOST_ALIGNMENT_OF(T) should evaluate to the alignment requirements of type T. #ifdef BOOST_HAS_SGI_TYPE_TRAITS // Hook into SGI's __type_traits class, this will pick up user supplied // specializations as well as SGI - compiler supplied specializations. -# include "boost/type_traits/is_same.hpp" -# include <type_traits.h> +# include <boost/type_traits/is_same.hpp> +# ifdef __NetBSD__ + // There are two different versions of type_traits.h on NetBSD on Spark + // use an implicit include via algorithm instead, to make sure we get + // the same version as the std lib: +# include <algorithm> +# else +# include <type_traits.h> +# endif # define BOOST_IS_POD(T) ::boost::is_same< typename ::__type_traits<T>::is_POD_type, ::__true_type>::value # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_default_constructor, ::__true_type>::value # define BOOST_HAS_TRIVIAL_COPY(T) ::boost::is_same< typename ::__type_traits<T>::has_trivial_copy_constructor, ::__true_type>::value @@ -63,9 +82,11 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif -#if defined(BOOST_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215) +#if defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215) +# include <boost/type_traits/is_same.hpp> + # define BOOST_IS_UNION(T) __is_union(T) -# define BOOST_IS_POD(T) __is_pod(T) +# define BOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T)) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # define BOOST_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T) @@ -75,9 +96,97 @@ # define BOOST_HAS_NOTHROW_COPY(T) __has_nothrow_copy(T) # define BOOST_HAS_NOTHROW_ASSIGN(T) __has_nothrow_assign(T) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) + +# define BOOST_IS_ABSTRACT(T) __is_abstract(T) +# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) +# define BOOST_IS_CLASS(T) __is_class(T) +// This one doesn't quite always do the right thing: +// # define BOOST_IS_CONVERTIBLE(T,U) __is_convertible_to(T,U) +# define BOOST_IS_ENUM(T) __is_enum(T) +// This one doesn't quite always do the right thing: +// # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) +// This one fails if the default alignment has been changed with /Zp: +// # define BOOST_ALIGNMENT_OF(T) __alignof(T) + +# define BOOST_HAS_TYPE_TRAITS_INTRINSICS +#endif + +#if defined(__DMC__) && (__DMC__ >= 0x848) +// For Digital Mars C++, www.digitalmars.com +# define BOOST_IS_UNION(T) (__typeinfo(T) & 0x400) +# define BOOST_IS_POD(T) (__typeinfo(T) & 0x800) +# define BOOST_IS_EMPTY(T) (__typeinfo(T) & 0x1000) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__typeinfo(T) & 0x10) +# define BOOST_HAS_TRIVIAL_COPY(T) (__typeinfo(T) & 0x20) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__typeinfo(T) & 0x40) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__typeinfo(T) & 0x8) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__typeinfo(T) & 0x80) +# define BOOST_HAS_NOTHROW_COPY(T) (__typeinfo(T) & 0x100) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__typeinfo(T) & 0x200) +# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) (__typeinfo(T) & 0x4) # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) +# include <boost/type_traits/is_same.hpp> +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_volatile.hpp> + +# define BOOST_IS_UNION(T) __is_union(T) +# define BOOST_IS_POD(T) __is_pod(T) +# define BOOST_IS_EMPTY(T) __is_empty(T) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) +# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) +# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) + +# define BOOST_IS_ABSTRACT(T) __is_abstract(T) +# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) +# define BOOST_IS_CLASS(T) __is_class(T) +# define BOOST_IS_ENUM(T) __is_enum(T) +# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) +# if (!defined(unix) && !defined(__unix__)) || defined(__LP64__) + // GCC sometimes lies about alignment requirements + // of type double on 32-bit unix platforms, use the + // old implementation instead in that case: +# define BOOST_ALIGNMENT_OF(T) __alignof__(T) +# endif + +# define BOOST_HAS_TYPE_TRAITS_INTRINSICS +#endif + +# if defined(__CODEGEARC__) +# include <boost/type_traits/is_same.hpp> +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_volatile.hpp> +# include <boost/type_traits/is_void.hpp> + +# define BOOST_IS_UNION(T) __is_union(T) +# define BOOST_IS_POD(T) __is_pod(T) +# define BOOST_IS_EMPTY(T) __is_empty(T) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T) || is_void<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value || is_void<T>::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value || is_void<T>::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || is_void<T>::value) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T) || is_void<T>::value) +# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value || is_void<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value || is_void<T>::value) +# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) + +# define BOOST_IS_ABSTRACT(T) __is_abstract(T) +# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_void<T>::value && !is_void<U>::value) +# define BOOST_IS_CLASS(T) __is_class(T) +# define BOOST_IS_CONVERTIBLE(T,U) (__is_convertible(T,U) || is_void<U>::value) +# define BOOST_IS_ENUM(T) __is_enum(T) +# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) +# define BOOST_ALIGNMENT_OF(T) alignof(T) + +# define BOOST_HAS_TYPE_TRAITS_INTRINSICS +#endif #ifndef BOOST_IS_UNION # define BOOST_IS_UNION(T) false @@ -128,3 +237,4 @@ + diff --git a/Utilities/BGL/boost/type_traits/is_abstract.hpp b/Utilities/BGL/boost/type_traits/is_abstract.hpp index 4f9b79128a0487d84fa08821d26fbdebeb127ab3..09fdf33c457500934e310b05f0e056ff09848016 100644 --- a/Utilities/BGL/boost/type_traits/is_abstract.hpp +++ b/Utilities/BGL/boost/type_traits/is_abstract.hpp @@ -48,21 +48,30 @@ // to degrade gracefully, rather than trash the compiler (John Maddock). // +#include <boost/type_traits/intrinsics.hpp> +#ifndef BOOST_IS_ABSTRACT #include <boost/static_assert.hpp> #include <boost/type_traits/detail/yes_no_type.hpp> #include <boost/type_traits/is_class.hpp> -#include "boost/type_traits/detail/ice_and.hpp" +#include <boost/type_traits/detail/ice_and.hpp> #ifdef BOOST_NO_IS_ABSTRACT #include <boost/type_traits/is_polymorphic.hpp> #endif +#endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { namespace detail{ -#ifndef BOOST_NO_IS_ABSTRACT +#ifdef BOOST_IS_ABSTRACT +template <class T> +struct is_abstract_imp +{ + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_ABSTRACT(T)); +}; +#elif !defined(BOOST_NO_IS_ABSTRACT) template<class T> struct is_abstract_imp2 { @@ -83,9 +92,16 @@ struct is_abstract_imp2 // GCC2 won't even parse this template if we embed the computation // of s1 in the computation of value. #ifdef __GNUC__ - BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(is_abstract_imp2<T>::template check_sig<T>(0))); + BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(is_abstract_imp2<T>::template check_sig<T>(0))); #else - BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig<T>(0))); +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(push) +#pragma warning(disable:6334) +#endif + BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(check_sig<T>(0))); +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(pop) +#endif #endif BOOST_STATIC_CONSTANT(bool, value = @@ -132,6 +148,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_polymorphic_imp<T } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif //BOOST_TT_IS_ABSTRACT_CLASS_HPP diff --git a/Utilities/BGL/boost/type_traits/is_arithmetic.hpp b/Utilities/BGL/boost/type_traits/is_arithmetic.hpp index ec5766185525f80a58022af251758d0b657e5a46..a1d8c46d5f0b4816b221754b50229034e4391ac0 100644 --- a/Utilities/BGL/boost/type_traits/is_arithmetic.hpp +++ b/Utilities/BGL/boost/type_traits/is_arithmetic.hpp @@ -9,16 +9,19 @@ #ifndef BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED #define BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_float.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/config.hpp" +#if !defined( __CODEGEARC__ ) +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_float.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/config.hpp> +#endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { +#if !defined(__CODEGEARC__) namespace detail { template< typename T > @@ -32,12 +35,17 @@ struct is_arithmetic_impl }; } // namespace detail +#endif //* is a type T an arithmetic type described in the standard (3.9.1p8) +#if defined(__CODEGEARC__) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_arithmetic,T,__is_arithmetic(T)) +#else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_arithmetic,T,::boost::detail::is_arithmetic_impl<T>::value) +#endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_ARITHMETIC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_array.hpp b/Utilities/BGL/boost/type_traits/is_array.hpp index a3ec8e478406cb8bafed2ba3b700f70326dcd921..e9e820a3d62d913fcd28f93f6aedeb4b8b1bcd65 100644 --- a/Utilities/BGL/boost/type_traits/is_array.hpp +++ b/Utilities/BGL/boost/type_traits/is_array.hpp @@ -14,22 +14,23 @@ #ifndef BOOST_TT_IS_ARRAY_HPP_INCLUDED #define BOOST_TT_IS_ARRAY_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/config.hpp> #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/wrap.hpp" +# include <boost/type_traits/detail/yes_no_type.hpp> +# include <boost/type_traits/detail/wrap.hpp> #endif #include <cstddef> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,__is_array(T)) +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,false) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,is_array,T[N],true) @@ -85,6 +86,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,::boost::detail::is_array_impl<T>::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_ARRAY_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_base_and_derived.hpp b/Utilities/BGL/boost/type_traits/is_base_and_derived.hpp index cf420d8bcb7192588bd002c1de26903f10cf1b03..d6a99911823d36d992f2434dd74febe4ff2ff762 100644 --- a/Utilities/BGL/boost/type_traits/is_base_and_derived.hpp +++ b/Utilities/BGL/boost/type_traits/is_base_and_derived.hpp @@ -9,22 +9,27 @@ #ifndef BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED #define BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED -#include "boost/type_traits/is_class.hpp" -#include "boost/type_traits/is_same.hpp" -#include "boost/type_traits/is_convertible.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/remove_cv.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/intrinsics.hpp> +#ifndef BOOST_IS_BASE_OF +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/config.hpp> +#include <boost/static_assert.hpp> +#endif +#include <boost/type_traits/remove_cv.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { namespace detail { -#if !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \ - && !BOOST_WORKAROUND(__SUNPRO_CC , BOOST_TESTED_AT(0x540)) \ +#ifndef BOOST_IS_BASE_OF +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) \ + && !BOOST_WORKAROUND(__SUNPRO_CC , <= 0x540) \ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \ && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) @@ -37,7 +42,7 @@ namespace detail { This version detects ambiguous base classes and private base classes correctly, and was devised by Rani Sharoni. -Explanation by Terje Sletteb� and Rani Sharoni. +Explanation by Terje Slettebo and Rani Sharoni. Let's take the multiple base class below as an example, and the following will also show why there's not a problem with private or ambiguous base @@ -128,6 +133,17 @@ struct bd_helper template<typename B, typename D> struct is_base_and_derived_impl2 { +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(push) +#pragma warning(disable:6334) +#endif + // + // May silently do the wrong thing with incomplete types + // unless we trap them here: + // + BOOST_STATIC_ASSERT(sizeof(B) != 0); + BOOST_STATIC_ASSERT(sizeof(D) != 0); + struct Host { #if !BOOST_WORKAROUND(BOOST_MSVC, == 1310) @@ -140,6 +156,9 @@ struct is_base_and_derived_impl2 BOOST_STATIC_CONSTANT(bool, value = sizeof(bd_helper<B,D>::check_sig(Host(), 0)) == sizeof(type_traits::yes_type)); +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(pop) +#endif }; #else @@ -193,13 +212,22 @@ struct is_base_and_derived_impl typedef is_base_and_derived_select< ::boost::is_class<B>::value, ::boost::is_class<D>::value, - ::boost::is_same<B,D>::value> selector; + ::boost::is_same<ncvB,ncvD>::value> selector; typedef typename selector::template rebind<ncvB,ncvD> binder; typedef typename binder::type bound_type; BOOST_STATIC_CONSTANT(bool, value = bound_type::value); }; +#else +template <typename B, typename D> +struct is_base_and_derived_impl +{ + typedef typename remove_cv<B>::type ncvB; + typedef typename remove_cv<D>::type ncvD; + BOOST_STATIC_CONSTANT(bool, value = (BOOST_IS_BASE_OF(B,D) && ! ::boost::is_same<ncvB,ncvD>::value)); +}; +#endif } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF2( @@ -215,8 +243,12 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_a BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_and_derived,Base&,Derived&,false) #endif +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename Base,is_base_and_derived,Base,Base,false) +#endif + } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_base_of.hpp b/Utilities/BGL/boost/type_traits/is_base_of.hpp index a02a15ffd286274ef8f5566c57c6f40291721cbf..0cc7a32fc97819350f5811e747ad58f82263cec0 100644 --- a/Utilities/BGL/boost/type_traits/is_base_of.hpp +++ b/Utilities/BGL/boost/type_traits/is_base_of.hpp @@ -9,19 +9,34 @@ #ifndef BOOST_TT_IS_BASE_OF_HPP_INCLUDED #define BOOST_TT_IS_BASE_OF_HPP_INCLUDED -#include "boost/type_traits/is_base_and_derived.hpp" +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/detail/ice_and.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { + namespace detail{ + template <class B, class D> + struct is_base_of_imp + { + typedef typename remove_cv<B>::type ncvB; + typedef typename remove_cv<D>::type ncvD; + BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< + (::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value), + (::boost::type_traits::ice_and< ::boost::is_same<ncvB,ncvD>::value, ::boost::is_class<ncvB>::value>::value)>::value)); + }; + } + BOOST_TT_AUX_BOOL_TRAIT_DEF2( is_base_of , Base , Derived - , (::boost::detail::is_base_and_derived_impl<Base,Derived>::value) - ) + , (::boost::detail::is_base_of_imp<Base, Derived>::value)) #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) @@ -31,6 +46,6 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_o } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_base_of_tr1.hpp b/Utilities/BGL/boost/type_traits/is_base_of_tr1.hpp new file mode 100644 index 0000000000000000000000000000000000000000..177e62b0f96615bc61e8bf8e6edbfcb3d8b0832e --- /dev/null +++ b/Utilities/BGL/boost/type_traits/is_base_of_tr1.hpp @@ -0,0 +1,50 @@ + +// (C) Copyright Rani Sharoni 2003-2005. +// 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/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED +#define BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED + +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/detail/ice_or.hpp> + +// should be the last #include +#include <boost/type_traits/detail/bool_trait_def.hpp> + +namespace boost { namespace tr1{ + + namespace detail{ + template <class B, class D> + struct is_base_of_imp + { + typedef typename remove_cv<B>::type ncvB; + typedef typename remove_cv<D>::type ncvD; + BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< + (::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value), + (::boost::is_same<ncvB,ncvD>::value)>::value)); + }; + } + +BOOST_TT_AUX_BOOL_TRAIT_DEF2( + is_base_of + , Base + , Derived + , (::boost::tr1::detail::is_base_of_imp<Base, Derived>::value)) + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false) +#endif + +} } // namespace boost + +#include <boost/type_traits/detail/bool_trait_undef.hpp> + +#endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_class.hpp b/Utilities/BGL/boost/type_traits/is_class.hpp index 038c6662e23bcd26cc21d68a30c43ed40a9541f0..1a2cd20157c254de641247e527a3af58cb3941ae 100644 --- a/Utilities/BGL/boost/type_traits/is_class.hpp +++ b/Utilities/BGL/boost/type_traits/is_class.hpp @@ -10,32 +10,37 @@ #ifndef BOOST_TT_IS_CLASS_HPP_INCLUDED #define BOOST_TT_IS_CLASS_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -# include "boost/type_traits/is_union.hpp" -# include "boost/type_traits/detail/ice_and.hpp" -# include "boost/type_traits/detail/ice_not.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> +#ifndef BOOST_IS_CLASS +# include <boost/type_traits/is_union.hpp> +# include <boost/type_traits/detail/ice_and.hpp> +# include <boost/type_traits/detail/ice_not.hpp> #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION -# include "boost/type_traits/detail/yes_no_type.hpp" +# include <boost/type_traits/detail/yes_no_type.hpp> #else -# include "boost/type_traits/is_scalar.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_void.hpp" -# include "boost/type_traits/is_function.hpp" +# include <boost/type_traits/is_scalar.hpp> +# include <boost/type_traits/is_array.hpp> +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_void.hpp> +# include <boost/type_traits/is_function.hpp> #endif +#endif // BOOST_IS_CLASS + #ifdef __EDG_VERSION__ -# include "boost/type_traits/remove_cv.hpp" +# include <boost/type_traits/remove_cv.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { namespace detail { +#ifndef BOOST_IS_CLASS #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION // This is actually the conforming implementation which works with @@ -111,18 +116,25 @@ struct is_class_impl }; # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION +# else // BOOST_IS_CLASS +template <typename T> +struct is_class_impl +{ + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_CLASS(T)); +}; +# endif // BOOST_IS_CLASS } // namespace detail # ifdef __EDG_VERSION__ BOOST_TT_AUX_BOOL_TRAIT_DEF1( - is_class,T, detail::is_class_impl<typename remove_cv<T>::type>::value) + is_class,T, boost::detail::is_class_impl<typename boost::remove_cv<T>::type>::value) # else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_class,T,::boost::detail::is_class_impl<T>::value) # endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_CLASS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_complex.hpp b/Utilities/BGL/boost/type_traits/is_complex.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9ccc333cb2ba4fa5be13fd6f6c7013631e47e890 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/is_complex.hpp @@ -0,0 +1,34 @@ +// (C) Copyright John Maddock 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/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_COMPLEX_HPP +#define BOOST_TT_IS_COMPLEX_HPP + +#include <boost/type_traits/is_convertible.hpp> +#include <complex> +// should be the last #include +#include <boost/type_traits/detail/bool_trait_def.hpp> + + +namespace boost { +namespace detail{ + +struct is_convertible_from_tester +{ + template <class T> + is_convertible_from_tester(const std::complex<T>&); +}; + +} + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_complex,T,(::boost::is_convertible<T, detail::is_convertible_from_tester>::value)) + +} // namespace boost + +#include <boost/type_traits/detail/bool_trait_undef.hpp> + +#endif //BOOST_TT_IS_COMPLEX_HPP diff --git a/Utilities/BGL/boost/type_traits/is_compound.hpp b/Utilities/BGL/boost/type_traits/is_compound.hpp index 7d562fc59f74893d242dace023a6d593434cbf61..bbaaa42cd7ec9130515d07786b38895b0ce1b0dd 100644 --- a/Utilities/BGL/boost/type_traits/is_compound.hpp +++ b/Utilities/BGL/boost/type_traits/is_compound.hpp @@ -9,15 +9,16 @@ #ifndef BOOST_TT_IS_COMPOUND_HPP_INCLUDED #define BOOST_TT_IS_COMPOUND_HPP_INCLUDED -#include "boost/config.hpp" -#include "boost/type_traits/is_fundamental.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include <boost/config.hpp> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/detail/ice_not.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { +#if !defined( __CODEGEARC__ ) namespace detail { template <typename T> @@ -30,11 +31,16 @@ struct is_compound_impl }; } // namespace detail +#endif // !defined( __CODEGEARC__ ) +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_compound,T,__is_compound(T)) +#else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_compound,T,::boost::detail::is_compound_impl<T>::value) +#endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_COMPOUND_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_const.hpp b/Utilities/BGL/boost/type_traits/is_const.hpp index 9e571aae66ff50b59210338474ac32595606b36a..e66d18a3162402e22b754e4752e9b78f11f1d78c 100644 --- a/Utilities/BGL/boost/type_traits/is_const.hpp +++ b/Utilities/BGL/boost/type_traits/is_const.hpp @@ -21,32 +21,44 @@ #ifndef BOOST_TT_IS_CONST_HPP_INCLUDED #define BOOST_TT_IS_CONST_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/cv_traits_impl.hpp" +# include <boost/type_traits/detail/cv_traits_impl.hpp> # ifdef __GNUC__ # include <boost/type_traits/is_reference.hpp> # endif +# if BOOST_WORKAROUND(BOOST_MSVC, < 1400) +# include <boost/type_traits/remove_bounds.hpp> +# endif #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_array.hpp> +# include <boost/type_traits/detail/yes_no_type.hpp> +# include <boost/type_traits/detail/false_result.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#if defined( __CODEGEARC__ ) + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,__is_const(T)) + +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) //* is a type T declared const - is_const<T> -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp<T*>::is_const) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp<typename remove_bounds<T>::type*>::is_const) +#else + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::cv_traits_imp<T*>::is_const) +#endif BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_const,T&,false) -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#if defined(BOOST_ILLEGAL_CV_REFERENCES) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified @@ -128,7 +140,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::is_const_impl<T>::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_CONST_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_convertible.hpp b/Utilities/BGL/boost/type_traits/is_convertible.hpp index 5b62877f3fcdc9fb385d230c83ae6cce859d924a..a31a930faed4d5186934f34feee064d41328ef08 100644 --- a/Utilities/BGL/boost/type_traits/is_convertible.hpp +++ b/Utilities/BGL/boost/type_traits/is_convertible.hpp @@ -1,7 +1,7 @@ // Copyright 2000 John Maddock (john@johnmaddock.co.uk) // Copyright 2000 Jeremy Siek (jsiek@lsc.nd.edu) -// Copyright 1999, 2000 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) +// Copyright 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -12,25 +12,33 @@ #ifndef BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED #define BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/is_array.hpp" -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/ice.hpp" -#include "boost/type_traits/is_arithmetic.hpp" +#include <boost/type_traits/intrinsics.hpp> +#ifndef BOOST_IS_CONVERTIBLE +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/is_array.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/ice.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_void.hpp> #ifndef BOOST_NO_IS_ABSTRACT -#include "boost/type_traits/is_abstract.hpp" +#include <boost/type_traits/is_abstract.hpp> #endif -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) -# include "boost/type_traits/is_void.hpp" +#if defined(__MWERKS__) +#include <boost/type_traits/is_function.hpp> +#include <boost/type_traits/remove_reference.hpp> #endif +#endif // BOOST_IS_CONVERTIBLE + // should be always the last #include directive -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { +#ifndef BOOST_IS_CONVERTIBLE + // is one type convertable to another? // // there are multiple versions of the is_convertible @@ -186,6 +194,53 @@ struct is_convertible_basic_impl }; }; +#elif defined(__MWERKS__) +// +// CW works with the technique implemented above for EDG, except when From +// is a function type (or a reference to such a type), in which case +// any_conversion won't be accepted as a valid conversion. We detect this +// exceptional situation and channel it through an alternative algorithm. +// + +template <typename From, typename To,bool FromIsFunctionRef> +struct is_convertible_basic_impl_aux; + +struct any_conversion +{ + template <typename T> any_conversion(const volatile T&); +}; + +template <typename From, typename To> +struct is_convertible_basic_impl_aux<From,To,false /*FromIsFunctionRef*/> +{ + static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...); + static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int); + static From _m_from; + + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) + ); +}; + +template <typename From, typename To> +struct is_convertible_basic_impl_aux<From,To,true /*FromIsFunctionRef*/> +{ + static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); + static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); + static From _m_from; + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) + ); +}; + +template <typename From, typename To> +struct is_convertible_basic_impl: + is_convertible_basic_impl_aux< + From,To, + ::boost::is_function<typename ::boost::remove_reference<From>::type>::value + > +{}; + #else // @@ -198,10 +253,19 @@ struct is_convertible_basic_impl static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); static From _m_from; - +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4244) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(disable:6334) +#endif +#endif BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) ); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif }; #endif // is_convertible_impl @@ -213,12 +277,15 @@ struct is_convertible_impl { typedef typename add_reference<From>::type ref_type; enum { value = - ::boost::type_traits::ice_and< - ::boost::detail::is_convertible_basic_impl<ref_type, To>::value, - ::boost::type_traits::ice_not< - ::boost::is_array<To>::value + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::detail::is_convertible_basic_impl<ref_type,To>::value, + ::boost::is_void<To>::value >::value, - >::value }; + ::boost::type_traits::ice_not< + ::boost::is_array<To>::value + >::value + >::value) }; }; #elif !defined(__BORLANDC__) || __BORLANDC__ > 0x551 template <typename From, typename To> @@ -227,7 +294,10 @@ struct is_convertible_impl typedef typename add_reference<From>::type ref_type; BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< - ::boost::detail::is_convertible_basic_impl<ref_type,To>::value, + ::boost::type_traits::ice_or< + ::boost::detail::is_convertible_basic_impl<ref_type,To>::value, + ::boost::is_void<To>::value + >::value, ::boost::type_traits::ice_not< ::boost::is_array<To>::value >::value @@ -279,7 +349,7 @@ struct is_convertible_impl_select<true, false, true> template <typename From, typename To> struct is_convertible_impl_dispatch_base { -#ifndef __HP_aCC +#if !BOOST_WORKAROUND(__HP_aCC, < 60700) typedef is_convertible_impl_select< ::boost::is_arithmetic<From>::value, ::boost::is_arithmetic<To>::value, @@ -332,14 +402,14 @@ struct is_convertible_impl_dispatch #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,true) #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const,To,false) BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void volatile,To,false) BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const volatile,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,true) #endif #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -347,8 +417,14 @@ BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,v BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl_dispatch<From,To>::value)) +#else + +BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,BOOST_IS_CONVERTIBLE(From,To)) + +#endif + } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_empty.hpp b/Utilities/BGL/boost/type_traits/is_empty.hpp index 7d2f3645a0a7decb5813328a497aaa370d71a084..c8eb7912da05177feed8c6ee340c4859d50921de 100644 --- a/Utilities/BGL/boost/type_traits/is_empty.hpp +++ b/Utilities/BGL/boost/type_traits/is_empty.hpp @@ -9,27 +9,27 @@ #ifndef BOOST_TT_IS_EMPTY_HPP_INCLUDED #define BOOST_TT_IS_EMPTY_HPP_INCLUDED -#include "boost/type_traits/is_convertible.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/remove_cv.hpp" -# include "boost/type_traits/is_class.hpp" -# include "boost/type_traits/add_reference.hpp" +# include <boost/type_traits/remove_cv.hpp> +# include <boost/type_traits/is_class.hpp> +# include <boost/type_traits/add_reference.hpp> #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_pointer.hpp" -# include "boost/type_traits/is_member_pointer.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/is_void.hpp" -# include "boost/type_traits/detail/ice_and.hpp" -# include "boost/type_traits/detail/ice_not.hpp" +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_pointer.hpp> +# include <boost/type_traits/is_member_pointer.hpp> +# include <boost/type_traits/is_array.hpp> +# include <boost/type_traits/is_void.hpp> +# include <boost/type_traits/detail/ice_and.hpp> +# include <boost/type_traits/detail/ice_not.hpp> #endif // should be always the last #include directive -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -41,6 +41,10 @@ struct empty_helper_t1 : public T { empty_helper_t1(); // hh compiler bug workaround int i[256]; +private: + // suppress compiler warnings: + empty_helper_t1(const empty_helper_t1&); + empty_helper_t1& operator=(const empty_helper_t1&); }; struct empty_helper_t2 { int i[256]; }; @@ -201,7 +205,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_empty,T,::boost::detail::is_empty_impl<T>::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_EMPTY_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_enum.hpp b/Utilities/BGL/boost/type_traits/is_enum.hpp index 3b81b7f74a6e0aabdfd34b3f196cfd719048e7c3..86fa66d998b969a64f7594f360b32284aaf7b2b3 100644 --- a/Utilities/BGL/boost/type_traits/is_enum.hpp +++ b/Utilities/BGL/boost/type_traits/is_enum.hpp @@ -11,26 +11,29 @@ #ifndef BOOST_TT_IS_ENUM_HPP_INCLUDED #define BOOST_TT_IS_ENUM_HPP_INCLUDED -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_convertible.hpp" -#include "boost/type_traits/is_array.hpp" +#include <boost/type_traits/intrinsics.hpp> +#ifndef BOOST_IS_ENUM +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_array.hpp> #ifdef __GNUC__ #include <boost/type_traits/is_function.hpp> #endif -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/config.hpp> #if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) # include <boost/type_traits/is_class.hpp> # include <boost/type_traits/is_union.hpp> #endif - +#endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { +#ifndef BOOST_IS_ENUM #if !(defined(__BORLANDC__) && (__BORLANDC__ <= 0x551)) namespace detail { @@ -52,7 +55,7 @@ struct is_class_or_union template <typename T> struct is_class_or_union { -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) || BOOST_WORKAROUND(__BORLANDC__, <= 0x570)// we simply can't detect it this way. +# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))// we simply can't detect it this way. BOOST_STATIC_CONSTANT(bool, value = false); # else template <class U> static ::boost::type_traits::yes_type is_class_or_union_tester(void(U::*)(void)); @@ -173,8 +176,14 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,false) #endif +#else // BOOST_IS_ENUM + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,BOOST_IS_ENUM(T)) + +#endif + } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_ENUM_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_float.hpp b/Utilities/BGL/boost/type_traits/is_float.hpp index 349608ee285088f5e1fd4a3259bd818496e0ba60..25d16f180030f676980146689da5029125b51134 100644 --- a/Utilities/BGL/boost/type_traits/is_float.hpp +++ b/Utilities/BGL/boost/type_traits/is_float.hpp @@ -10,7 +10,7 @@ #define BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -22,6 +22,6 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_float,long double,true) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_floating_point.hpp b/Utilities/BGL/boost/type_traits/is_floating_point.hpp index eec7c85070c0fb0d5c7b2e19d2abf93407c38a15..2224453054f5330d18fa1eb437d841bbb061b2a1 100644 --- a/Utilities/BGL/boost/type_traits/is_floating_point.hpp +++ b/Utilities/BGL/boost/type_traits/is_floating_point.hpp @@ -10,7 +10,7 @@ #define BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -22,6 +22,6 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,long double,true) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_function.hpp b/Utilities/BGL/boost/type_traits/is_function.hpp index ecb0b5d6657757f95253c9333e7a7448510f8e98..95dba0dab05d001a96b0697b653a2502930b2ae7 100644 --- a/Utilities/BGL/boost/type_traits/is_function.hpp +++ b/Utilities/BGL/boost/type_traits/is_function.hpp @@ -11,19 +11,19 @@ #ifndef BOOST_TT_IS_FUNCTION_HPP_INCLUDED #define BOOST_TT_IS_FUNCTION_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/detail/false_result.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/detail/false_result.hpp> +#include <boost/config.hpp> #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) -# include "boost/type_traits/detail/is_function_ptr_helper.hpp" +# include <boost/type_traits/detail/is_function_ptr_helper.hpp> #else -# include "boost/type_traits/detail/is_function_ptr_tester.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" +# include <boost/type_traits/detail/is_function_ptr_tester.hpp> +# include <boost/type_traits/detail/yes_no_type.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> // is a type a function? // Please note that this implementation is unnecessarily complex: @@ -32,6 +32,9 @@ // function pointers to void*. namespace boost { + +#if !defined( __CODEGEARC__ ) + namespace detail { #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) @@ -62,11 +65,18 @@ struct is_function_impl template <typename T> struct is_function_impl { +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(push) +#pragma warning(disable:6334) +#endif static T* t; BOOST_STATIC_CONSTANT( bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type) ); +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(pop) +#endif }; #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) @@ -79,10 +89,15 @@ struct is_function_impl<T&> : public false_type } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::boost::detail::is_function_impl<T>::value) +#endif // !defined( __CODEGEARC__ ) +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,__is_function(T)) +#else +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_function,T,::boost::detail::is_function_impl<T>::value) +#endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_fundamental.hpp b/Utilities/BGL/boost/type_traits/is_fundamental.hpp index e21e8a6a74825ac004e492044f6686a3c3c794f3..6aff7dd19c44dd3ad6d1ce168f55807c80334391 100644 --- a/Utilities/BGL/boost/type_traits/is_fundamental.hpp +++ b/Utilities/BGL/boost/type_traits/is_fundamental.hpp @@ -9,12 +9,12 @@ #ifndef BOOST_TT_IS_FUNDAMENTAL_HPP_INCLUDED #define BOOST_TT_IS_FUNDAMENTAL_HPP_INCLUDED -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_void.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_void.hpp> +#include <boost/type_traits/detail/ice_or.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -32,10 +32,14 @@ struct is_fundamental_impl } // namespace detail //* is a type T a fundamental type described in the standard (3.9.1) +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_fundamental,T,__is_fundamental(T)) +#else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_fundamental,T,::boost::detail::is_fundamental_impl<T>::value) +#endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_FUNDAMENTAL_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_integral.hpp b/Utilities/BGL/boost/type_traits/is_integral.hpp index 62ef83b16e35ee8a662592f90d1f9d212f5e8c4b..99420a9912002bc35a3b27c499e97f1a292ecb88 100644 --- a/Utilities/BGL/boost/type_traits/is_integral.hpp +++ b/Utilities/BGL/boost/type_traits/is_integral.hpp @@ -9,16 +9,19 @@ #ifndef BOOST_TT_IS_INTEGRAL_HPP_INCLUDED #define BOOST_TT_IS_INTEGRAL_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { //* is a type T an [cv-qualified-] integral type described in the standard (3.9.1p3) // as an extention we include long long, as this is likely to be added to the // standard at a later date +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_integral,T,__is_integral(T)) +#else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_integral,T,false) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned char,true) @@ -41,9 +44,11 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,char,true) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,wchar_t,true) #endif -#if (defined(BOOST_MSVC) && (BOOST_MSVC == 1200)) \ +// Same set of integral types as in boost/type_traits/integral_promotion.hpp. +// Please, keep in sync. -- Alexander Nasonov +#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1300)) \ || (defined(BOOST_INTEL_CXX_VERSION) && defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 600)) \ - || (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER == 1200)) + || (defined(__BORLANDC__) && (__BORLANDC__ == 0x600) && (_MSC_VER < 1300)) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int8,true) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int8,true) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int16,true) @@ -64,8 +69,10 @@ BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,unsigned __int64,true) BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_integral,__int64,true) #endif +#endif // non-CodeGear implementation + } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_INTEGRAL_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_member_function_pointer.hpp b/Utilities/BGL/boost/type_traits/is_member_function_pointer.hpp index 1cba5bf76c44d06bf53d0264cf893782e8aaa7df..81f1eacc9cdd1f632a2a19a8f35babfbaecc30f9 100644 --- a/Utilities/BGL/boost/type_traits/is_member_function_pointer.hpp +++ b/Utilities/BGL/boost/type_traits/is_member_function_pointer.hpp @@ -11,8 +11,8 @@ #ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/detail/workaround.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/detail/workaround.hpp> #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) @@ -21,27 +21,30 @@ // __stdcall etc function types, where as the partial specialisation // version does not do so. // -# include "boost/type_traits/detail/is_mem_fun_pointer_impl.hpp" +# include <boost/type_traits/detail/is_mem_fun_pointer_impl.hpp> +# include <boost/type_traits/remove_cv.hpp> #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" -# include "boost/type_traits/detail/ice_or.hpp" -# include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp" +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_array.hpp> +# include <boost/type_traits/detail/yes_no_type.hpp> +# include <boost/type_traits/detail/false_result.hpp> +# include <boost/type_traits/detail/ice_or.hpp> +# include <boost/type_traits/detail/is_mem_fun_pointer_tester.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,__is_member_function_pointer( T )) +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) BOOST_TT_AUX_BOOL_TRAIT_DEF1( is_member_function_pointer , T - , ::boost::type_traits::is_mem_fun_pointer_impl<T>::value + , ::boost::type_traits::is_mem_fun_pointer_impl<typename remove_cv<T>::type>::value ) #else @@ -61,6 +64,10 @@ struct is_mem_fun_pointer_select<false> { template <typename T> struct result_ { +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(push) +#pragma warning(disable:6334) +#endif static T* make_t; typedef result_<T> self_type; @@ -68,6 +75,9 @@ struct is_mem_fun_pointer_select<false> bool, value = ( 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t)) )); +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +#pragma warning(pop) +#endif }; }; @@ -121,6 +131,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::boost::detail::is_me } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_member_object_pointer.hpp b/Utilities/BGL/boost/type_traits/is_member_object_pointer.hpp index b1e8bf2817956f257f9dda198dec0b04375a9a8b..66b76c90b378abe3b9f6a988b7a912f6766a7d82 100644 --- a/Utilities/BGL/boost/type_traits/is_member_object_pointer.hpp +++ b/Utilities/BGL/boost/type_traits/is_member_object_pointer.hpp @@ -10,14 +10,14 @@ #ifndef BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/is_member_function_pointer.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/is_member_function_pointer.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_not.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -41,6 +41,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_object_pointer,T,::boost::detail::is_memb } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_member_pointer.hpp b/Utilities/BGL/boost/type_traits/is_member_pointer.hpp index 2a77c6dde2675bc57f13e9daecbd4f70aba9d41b..ba02b89ba27ef1ec64c8ac9f2de408d5a1691d80 100644 --- a/Utilities/BGL/boost/type_traits/is_member_pointer.hpp +++ b/Utilities/BGL/boost/type_traits/is_member_pointer.hpp @@ -21,26 +21,28 @@ #ifndef BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED #define BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/detail/workaround.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/detail/workaround.hpp> #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) -# include "boost/type_traits/is_member_function_pointer.hpp" +# include <boost/type_traits/is_member_function_pointer.hpp> #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" -# include "boost/type_traits/detail/ice_or.hpp" +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_array.hpp> +# include <boost/type_traits/detail/is_mem_fun_pointer_tester.hpp> +# include <boost/type_traits/detail/yes_no_type.hpp> +# include <boost/type_traits/detail/false_result.hpp> +# include <boost/type_traits/detail/ice_or.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,__is_member_pointer(T)) +#elif BOOST_WORKAROUND(__BORLANDC__, < 0x600) BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,false) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true) @@ -48,6 +50,12 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer, BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::is_member_function_pointer<T>::value) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true) +#if !BOOST_WORKAROUND(__MWERKS__,<=0x3003) && !BOOST_WORKAROUND(__IBMCPP__, <=600) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const,true) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const volatile,true) +#endif + #else // no partial template specialization namespace detail { @@ -103,6 +111,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::detail::is_member_poin } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_object.hpp b/Utilities/BGL/boost/type_traits/is_object.hpp index 59079a54971e6fca42eef931d1a77d74d0ab61f0..3decbf8d1997d298f06667b947e46dfa37cce02f 100644 --- a/Utilities/BGL/boost/type_traits/is_object.hpp +++ b/Utilities/BGL/boost/type_traits/is_object.hpp @@ -9,15 +9,15 @@ #ifndef BOOST_TT_IS_OBJECT_HPP_INCLUDED #define BOOST_TT_IS_OBJECT_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_void.hpp" -#include "boost/type_traits/is_function.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_void.hpp> +#include <boost/type_traits/is_function.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_not.hpp> +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -48,6 +48,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_object,T,::boost::detail::is_object_impl<T>::val } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_OBJECT_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_pod.hpp b/Utilities/BGL/boost/type_traits/is_pod.hpp index e674367270ccb28048c65bd4f6b653f6702d0bc1..af2c3c4aeb05b9117c4c723890c10f2c079fa082 100644 --- a/Utilities/BGL/boost/type_traits/is_pod.hpp +++ b/Utilities/BGL/boost/type_traits/is_pod.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_IS_POD_HPP_INCLUDED #define BOOST_TT_IS_POD_HPP_INCLUDED -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/is_void.hpp" -#include "boost/type_traits/is_scalar.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/type_traits/intrinsics.hpp" +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/is_void.hpp> +#include <boost/type_traits/is_scalar.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/intrinsics.hpp> #include <cstddef> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -130,6 +130,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::detail::is_pod_impl<T>::value) } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_POD_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_pointer.hpp b/Utilities/BGL/boost/type_traits/is_pointer.hpp index 0f981c06c647a77631787e5c2a40eaef64aceec2..f6ecf336f0205c73b19c3409c7f0d2d0bd7f9481 100644 --- a/Utilities/BGL/boost/type_traits/is_pointer.hpp +++ b/Utilities/BGL/boost/type_traits/is_pointer.hpp @@ -21,25 +21,30 @@ #ifndef BOOST_TT_IS_POINTER_HPP_INCLUDED #define BOOST_TT_IS_POINTER_HPP_INCLUDED -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/detail/ice_not.hpp" -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_not.hpp> +#include <boost/type_traits/config.hpp> +#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/remove_cv.hpp> +#endif #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/is_function_ptr_tester.hpp" -# include "boost/type_traits/detail/false_result.hpp" -# include "boost/type_traits/detail/ice_or.hpp" +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_array.hpp> +# include <boost/type_traits/detail/is_function_ptr_tester.hpp> +# include <boost/type_traits/detail/false_result.hpp> +# include <boost/type_traits/detail/ice_or.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,__is_pointer(T)) +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) namespace detail { @@ -56,15 +61,13 @@ template< typename T > struct helper<sp> \ /**/ TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(is_pointer_helper,T*,true) -TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(is_pointer_helper,T* const,true) -TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(is_pointer_helper,T* volatile,true) -TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC(is_pointer_helper,T* const volatile,true) # undef TT_AUX_BOOL_TRAIT_HELPER_PARTIAL_SPEC template< typename T > struct is_pointer_impl { +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< ::boost::detail::is_pointer_helper<T>::value @@ -73,6 +76,16 @@ struct is_pointer_impl >::value >::value) ); +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_and< + ::boost::detail::is_pointer_helper<typename remove_cv<T>::type>::value + , ::boost::type_traits::ice_not< + ::boost::is_member_pointer<T>::value + >::value + >::value) + ); +#endif }; } // namespace detail @@ -144,6 +157,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl<T>::v } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_polymorphic.hpp b/Utilities/BGL/boost/type_traits/is_polymorphic.hpp index afba32b886b72a6d554b3caa7f9c8269ea0562ba..8fcc69eb27985948fb0819f878c6ae6c79f59335 100644 --- a/Utilities/BGL/boost/type_traits/is_polymorphic.hpp +++ b/Utilities/BGL/boost/type_traits/is_polymorphic.hpp @@ -8,13 +8,19 @@ #ifndef BOOST_TT_IS_POLYMORPHIC_HPP #define BOOST_TT_IS_POLYMORPHIC_HPP +#include <boost/type_traits/intrinsics.hpp> +#ifndef BOOST_IS_POLYMORPHIC #include <boost/type_traits/is_class.hpp> #include <boost/type_traits/remove_cv.hpp> +#endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> #include <boost/detail/workaround.hpp> namespace boost{ + +#ifndef BOOST_IS_POLYMORPHIC + namespace detail{ template <class T> @@ -31,6 +37,10 @@ struct is_polymorphic_imp1 ~d1()throw(); # endif char padding[256]; + private: + // keep some picky compilers happy: + d1(const d1&); + d1& operator=(const d1&); }; struct d2 : public ncvT { @@ -43,6 +53,10 @@ struct is_polymorphic_imp1 virtual void unique_name_to_boost5487629(unique*); # endif char padding[256]; + private: + // keep some picky compilers happy: + d2(const d2&); + d2& operator=(const d2&); }; # endif BOOST_STATIC_CONSTANT(bool, value = (sizeof(d2) == sizeof(d1))); @@ -87,8 +101,14 @@ struct is_polymorphic_imp BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_polymorphic,T,::boost::detail::is_polymorphic_imp<T>::value) +#else // BOOST_IS_POLYMORPHIC + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_polymorphic,T,BOOST_IS_POLYMORPHIC(T)) + +#endif + } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif diff --git a/Utilities/BGL/boost/type_traits/is_reference.hpp b/Utilities/BGL/boost/type_traits/is_reference.hpp index 3655373a4fad18d9b13c99b0b2a698a841733929..dcf84db70936dc7cd5a88588595468f267498a3d 100644 --- a/Utilities/BGL/boost/type_traits/is_reference.hpp +++ b/Utilities/BGL/boost/type_traits/is_reference.hpp @@ -21,24 +21,26 @@ #ifndef BOOST_TT_IS_REFERENCE_HPP_INCLUDED #define BOOST_TT_IS_REFERENCE_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/config.hpp> #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/wrap.hpp" +# include <boost/type_traits/detail/yes_no_type.hpp> +# include <boost/type_traits/detail/wrap.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,__is_reference(T)) +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,false) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T&,true) -#if defined(__BORLANDC__) && !defined(__COMO__) && (__BORLANDC__ < 0x600) +#if defined(BOOST_ILLEGAL_CV_REFERENCES) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified @@ -66,7 +68,7 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,unsigned long N,is_reference, #ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable: 4181) +# pragma warning(disable: 4181 4097) #endif namespace detail { @@ -110,7 +112,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl<T } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_REFERENCE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_same.hpp b/Utilities/BGL/boost/type_traits/is_same.hpp index ae5e51e2f66d083418af24f34752a3600456b3fa..e0d1808b4d1def169ed354091b095c9bf7a40cd8 100644 --- a/Utilities/BGL/boost/type_traits/is_same.hpp +++ b/Utilities/BGL/boost/type_traits/is_same.hpp @@ -21,14 +21,14 @@ #ifndef BOOST_TT_IS_SAME_HPP_INCLUDED #define BOOST_TT_IS_SAME_HPP_INCLUDED -#include "boost/type_traits/config.hpp" +#include <boost/type_traits/config.hpp> #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/type_traits/is_reference.hpp" +#include <boost/type_traits/detail/yes_no_type.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/is_reference.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -97,7 +97,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,(::boost::detail::is_same_impl<T,U>::va } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_SAME_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_scalar.hpp b/Utilities/BGL/boost/type_traits/is_scalar.hpp index 24f42a0d6e24e5f7c54c0222c56cedee858d12f4..4af3def14c76a4852e8455dd343c3461e3d98277 100644 --- a/Utilities/BGL/boost/type_traits/is_scalar.hpp +++ b/Utilities/BGL/boost/type_traits/is_scalar.hpp @@ -9,15 +9,15 @@ #ifndef BOOST_TT_IS_SCALAR_HPP_INCLUDED #define BOOST_TT_IS_SCALAR_HPP_INCLUDED -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/is_pointer.hpp" -#include "boost/type_traits/is_member_pointer.hpp" -#include "boost/type_traits/detail/ice_or.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -50,6 +50,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_scalar,T,::boost::detail::is_scalar_impl<T>::val } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_SCALAR_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_signed.hpp b/Utilities/BGL/boost/type_traits/is_signed.hpp index 2b35dccc1ff9e587e818b0333ea4b7f14db09fd9..bf7bbfdb7686c7ead861ecf0aae62d9f0e7c2acd 100644 --- a/Utilities/BGL/boost/type_traits/is_signed.hpp +++ b/Utilities/BGL/boost/type_traits/is_signed.hpp @@ -10,23 +10,35 @@ #ifndef BOOST_TT_IS_SIGNED_HPP_INCLUDED #define BOOST_TT_IS_SIGNED_HPP_INCLUDED -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/detail/ice_or.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { +#if !defined( __CODEGEARC__ ) + namespace detail{ #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) +template <class T> +struct is_signed_values +{ + typedef typename remove_cv<T>::type no_cv_t; + BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1))); + BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0))); +}; + template <class T> struct is_signed_helper { - BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) < 0)); + typedef typename remove_cv<T>::type no_cv_t; + BOOST_STATIC_CONSTANT(bool, value = (!(::boost::detail::is_signed_values<T>::minus_one > boost::detail::is_signed_values<T>::zero))); }; template <bool integral_type> @@ -59,7 +71,7 @@ struct is_signed_imp > selector; typedef typename selector::template rebind<T> binder; typedef typename binder::type type; -#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200) +#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) BOOST_STATIC_CONSTANT(bool, value = is_signed_imp<T>::type::value); #else BOOST_STATIC_CONSTANT(bool, value = type::value); @@ -108,10 +120,16 @@ template <> struct is_signed_imp<const volatile wchar_t> : public true_type{}; } +#endif // !defined( __CODEGEARC__ ) + +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,__is_signed(T)) +#else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp<T>::value) +#endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_stateless.hpp b/Utilities/BGL/boost/type_traits/is_stateless.hpp index 30f603233bdffe4630ea65a96b057c39e9ba8fe6..d8d40635fe220d3bb9a1dde2bf3666a50923b01b 100644 --- a/Utilities/BGL/boost/type_traits/is_stateless.hpp +++ b/Utilities/BGL/boost/type_traits/is_stateless.hpp @@ -9,16 +9,16 @@ #ifndef BOOST_TT_IS_STATELESS_HPP_INCLUDED #define BOOST_TT_IS_STATELESS_HPP_INCLUDED -#include "boost/type_traits/has_trivial_constructor.hpp" -#include "boost/type_traits/has_trivial_copy.hpp" -#include "boost/type_traits/has_trivial_destructor.hpp" -#include "boost/type_traits/is_class.hpp" -#include "boost/type_traits/is_empty.hpp" -#include "boost/type_traits/detail/ice_and.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/has_trivial_constructor.hpp> +#include <boost/type_traits/has_trivial_copy.hpp> +#include <boost/type_traits/has_trivial_destructor.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_empty.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -43,6 +43,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_stateless,T,::boost::detail::is_stateless_impl<T } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_STATELESS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_union.hpp b/Utilities/BGL/boost/type_traits/is_union.hpp index 4a444ec3a4d4b3eb9aee89320264c41de1c4b3f1..25bddccfe1a7fcbf20caac47ca2190c9640d41a4 100644 --- a/Utilities/BGL/boost/type_traits/is_union.hpp +++ b/Utilities/BGL/boost/type_traits/is_union.hpp @@ -11,12 +11,12 @@ #ifndef BOOST_TT_IS_UNION_HPP_INCLUDED #define BOOST_TT_IS_UNION_HPP_INCLUDED -#include "boost/type_traits/remove_cv.hpp" -#include "boost/type_traits/config.hpp" -#include "boost/type_traits/intrinsics.hpp" +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/config.hpp> +#include <boost/type_traits/intrinsics.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { @@ -44,6 +44,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_union,T,::boost::detail::is_union_impl<T>::value } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_UNION_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_unsigned.hpp b/Utilities/BGL/boost/type_traits/is_unsigned.hpp index 68fb230fdd78dab60c0880f3f2893193acc22e38..98baf4e94e38130b825720c20b639fc516d4f14e 100644 --- a/Utilities/BGL/boost/type_traits/is_unsigned.hpp +++ b/Utilities/BGL/boost/type_traits/is_unsigned.hpp @@ -10,23 +10,34 @@ #ifndef BOOST_TT_IS_UNSIGNED_HPP_INCLUDED #define BOOST_TT_IS_UNSIGNED_HPP_INCLUDED -#include "boost/type_traits/is_integral.hpp" -#include "boost/type_traits/is_enum.hpp" -#include "boost/type_traits/detail/ice_or.hpp" +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/detail/ice_or.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { +#if !defined( __CODEGEARC__ ) + namespace detail{ #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) +template <class T> +struct is_unsigned_values +{ + typedef typename remove_cv<T>::type no_cv_t; + BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1))); + BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0))); +}; + template <class T> struct is_ununsigned_helper { - BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) > 0)); + BOOST_STATIC_CONSTANT(bool, value = (::boost::detail::is_unsigned_values<T>::minus_one > ::boost::detail::is_unsigned_values<T>::zero)); }; template <bool integral_type> @@ -102,13 +113,18 @@ template <> struct is_unsigned_imp<const volatile wchar_t> : public true_type{}; #endif - } +#endif // !defined( __CODEGEARC__ ) + +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,__is_unsigned(T)) +#else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp<T>::value) +#endif } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_virtual_base_of.hpp b/Utilities/BGL/boost/type_traits/is_virtual_base_of.hpp new file mode 100644 index 0000000000000000000000000000000000000000..30b34f6ccbde239d27e181c593098fe4c97da08f --- /dev/null +++ b/Utilities/BGL/boost/type_traits/is_virtual_base_of.hpp @@ -0,0 +1,104 @@ +// (C) Copyright Daniel Frey and Robert Ramey 2009. +// 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/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED +#define BOOST_TT_IS_VIRTUAL_BASE_OF_HPP_INCLUDED + +#include <boost/type_traits/is_base_of.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/not.hpp> + +// should be the last #include +#include <boost/type_traits/detail/bool_trait_def.hpp> + +namespace boost { +namespace detail { + + +#ifdef BOOST_MSVC +#pragma warning( push ) +#pragma warning( disable : 4584 ) +#elif defined __GNUC__ +#pragma GCC system_header +#endif + +template<typename Base, typename Derived, typename tag> +struct is_virtual_base_of_impl +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template<typename Base, typename Derived> +struct is_virtual_base_of_impl<Base, Derived, mpl::true_> +{ +#ifdef __BORLANDC__ + struct X : public virtual Derived, public virtual Base + { + X(); + X(const X&); + X& operator=(const X&); + ~X()throw(); + }; + struct Y : public virtual Derived + { + Y(); + Y(const Y&); + Y& operator=(const Y&); + ~Y()throw(); + }; +#else + struct X : Derived, virtual Base + { + X(); + X(const X&); + X& operator=(const X&); + ~X()throw(); + }; + struct Y : Derived + { + Y(); + Y(const Y&); + Y& operator=(const Y&); + ~Y()throw(); + }; +#endif + BOOST_STATIC_CONSTANT(bool, value = (sizeof(X)==sizeof(Y))); +}; + +template<typename Base, typename Derived> +struct is_virtual_base_of_impl2 +{ + typedef typename mpl::and_<is_base_of<Base, Derived>, mpl::not_<is_same<Base, Derived> > >::type tag_type; + typedef is_virtual_base_of_impl<Base, Derived, tag_type> imp; + BOOST_STATIC_CONSTANT(bool, value = imp::value); +}; + +#ifdef BOOST_MSVC +#pragma warning( pop ) +#endif + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF2( + is_virtual_base_of + , Base + , Derived + , (::boost::detail::is_virtual_base_of_impl2<Base,Derived>::value) +) + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base,Derived&,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_virtual_base_of,Base&,Derived&,false) +#endif + +} // namespace boost + +#include <boost/type_traits/detail/bool_trait_undef.hpp> + +#endif diff --git a/Utilities/BGL/boost/type_traits/is_void.hpp b/Utilities/BGL/boost/type_traits/is_void.hpp index 00abd0ab0a923cfbcf88b3ecdf26eb65f67d571f..6f6fbff6d995ed4d37841485703cd74d62497788 100644 --- a/Utilities/BGL/boost/type_traits/is_void.hpp +++ b/Utilities/BGL/boost/type_traits/is_void.hpp @@ -9,14 +9,17 @@ #ifndef BOOST_TT_IS_VOID_HPP_INCLUDED #define BOOST_TT_IS_VOID_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { //* is a type T void - is_void<T> +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_void,T,__is_void(T)) +#else BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_void,T,false) BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void,true) @@ -26,8 +29,10 @@ BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void volatile,true) BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_void,void const volatile,true) #endif +#endif // non-CodeGear implementation + } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_VOID_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/is_volatile.hpp b/Utilities/BGL/boost/type_traits/is_volatile.hpp index 1d2b1fe015fa77b7c657491af445ae942b075713..7ab253a6915f78471132751c266144629fca4020 100644 --- a/Utilities/BGL/boost/type_traits/is_volatile.hpp +++ b/Utilities/BGL/boost/type_traits/is_volatile.hpp @@ -21,29 +21,39 @@ #ifndef BOOST_TT_IS_VOLATILE_HPP_INCLUDED #define BOOST_TT_IS_VOLATILE_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include "boost/type_traits/detail/cv_traits_impl.hpp" +# include <boost/type_traits/detail/cv_traits_impl.hpp> +# if BOOST_WORKAROUND(BOOST_MSVC, < 1400) +# include <boost/type_traits/remove_bounds.hpp> +# endif #else -# include "boost/type_traits/is_reference.hpp" -# include "boost/type_traits/is_array.hpp" -# include "boost/type_traits/detail/yes_no_type.hpp" -# include "boost/type_traits/detail/false_result.hpp" +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_array.hpp> +# include <boost/type_traits/detail/yes_no_type.hpp> +# include <boost/type_traits/detail/false_result.hpp> #endif // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,__is_volatile(T)) +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) //* is a type T declared volatile - is_volatile<T> -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp<T*>::is_volatile) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp<typename boost::remove_bounds<T>::type*>::is_volatile) +#else + BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::cv_traits_imp<T*>::is_volatile) +#endif BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_volatile,T&,false) -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#if defined(BOOST_ILLEGAL_CV_REFERENCES) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified @@ -118,6 +128,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_impl<T>: } // namespace boost -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_IS_VOLATILE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/make_signed.hpp b/Utilities/BGL/boost/type_traits/make_signed.hpp new file mode 100644 index 0000000000000000000000000000000000000000..51cfd95ca1b692bd8d7b031857e2f70c8727adb0 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/make_signed.hpp @@ -0,0 +1,137 @@ + +// (C) Copyright John Maddock 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/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_MAKE_SIGNED_HPP_INCLUDED +#define BOOST_TT_MAKE_SIGNED_HPP_INCLUDED + +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/is_unsigned.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/add_volatile.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_not.hpp> +#include <boost/static_assert.hpp> + +// should be the last #include +#include <boost/type_traits/detail/type_trait_def.hpp> + +namespace boost { + +namespace detail { + +template <class T> +struct make_signed_imp +{ + BOOST_STATIC_ASSERT( + (::boost::type_traits::ice_or< ::boost::is_integral<T>::value, ::boost::is_enum<T>::value>::value)); +#if !BOOST_WORKAROUND(BOOST_MSVC, <=1300) + BOOST_STATIC_ASSERT( + (::boost::type_traits::ice_not< ::boost::is_same< + typename remove_cv<T>::type, bool>::value>::value)); +#endif + + typedef typename remove_cv<T>::type t_no_cv; + typedef typename mpl::if_c< + (::boost::type_traits::ice_and< + ::boost::is_signed<T>::value, + ::boost::is_integral<T>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value >::value), + T, + typename mpl::if_c< + (::boost::type_traits::ice_and< + ::boost::is_integral<T>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value> + ::value), + typename mpl::if_< + is_same<t_no_cv, unsigned char>, + signed char, + typename mpl::if_< + is_same<t_no_cv, unsigned short>, + signed short, + typename mpl::if_< + is_same<t_no_cv, unsigned int>, + int, + typename mpl::if_< + is_same<t_no_cv, unsigned long>, + long, +#if defined(BOOST_HAS_LONG_LONG) + boost::long_long_type +#elif defined(BOOST_HAS_MS_INT64) + __int64 +#else + long +#endif + >::type + >::type + >::type + >::type, + // Not a regular integer type: + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned char), + signed char, + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned short), + signed short, + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned int), + int, + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned long), + long, +#if defined(BOOST_HAS_LONG_LONG) + boost::long_long_type +#elif defined(BOOST_HAS_MS_INT64) + __int64 +#else + long +#endif + >::type + >::type + >::type + >::type + >::type + >::type base_integer_type; + + // Add back any const qualifier: + typedef typename mpl::if_< + is_const<T>, + typename add_const<base_integer_type>::type, + base_integer_type + >::type const_base_integer_type; + + // Add back any volatile qualifier: + typedef typename mpl::if_< + is_volatile<T>, + typename add_volatile<const_base_integer_type>::type, + const_base_integer_type + >::type type; +}; + + +} // namespace detail + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(make_signed,T,typename boost::detail::make_signed_imp<T>::type) + +} // namespace boost + +#include <boost/type_traits/detail/type_trait_undef.hpp> + +#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED + diff --git a/Utilities/BGL/boost/type_traits/make_unsigned.hpp b/Utilities/BGL/boost/type_traits/make_unsigned.hpp new file mode 100644 index 0000000000000000000000000000000000000000..54f9f665b33b14c61ba527e2917f7c57f226f565 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/make_unsigned.hpp @@ -0,0 +1,137 @@ + +// (C) Copyright John Maddock 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/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_MAKE_UNSIGNED_HPP_INCLUDED +#define BOOST_TT_MAKE_UNSIGNED_HPP_INCLUDED + +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/is_unsigned.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/add_volatile.hpp> +#include <boost/type_traits/detail/ice_or.hpp> +#include <boost/type_traits/detail/ice_and.hpp> +#include <boost/type_traits/detail/ice_not.hpp> +#include <boost/static_assert.hpp> + +// should be the last #include +#include <boost/type_traits/detail/type_trait_def.hpp> + +namespace boost { + +namespace detail { + +template <class T> +struct make_unsigned_imp +{ + BOOST_STATIC_ASSERT( + (::boost::type_traits::ice_or< ::boost::is_integral<T>::value, ::boost::is_enum<T>::value>::value)); +#if !BOOST_WORKAROUND(BOOST_MSVC, <=1300) + BOOST_STATIC_ASSERT( + (::boost::type_traits::ice_not< ::boost::is_same< + typename remove_cv<T>::type, bool>::value>::value)); +#endif + + typedef typename remove_cv<T>::type t_no_cv; + typedef typename mpl::if_c< + (::boost::type_traits::ice_and< + ::boost::is_unsigned<T>::value, + ::boost::is_integral<T>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value >::value), + T, + typename mpl::if_c< + (::boost::type_traits::ice_and< + ::boost::is_integral<T>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, char>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, wchar_t>::value>::value, + ::boost::type_traits::ice_not< ::boost::is_same<t_no_cv, bool>::value>::value> + ::value), + typename mpl::if_< + is_same<t_no_cv, signed char>, + unsigned char, + typename mpl::if_< + is_same<t_no_cv, short>, + unsigned short, + typename mpl::if_< + is_same<t_no_cv, int>, + unsigned int, + typename mpl::if_< + is_same<t_no_cv, long>, + unsigned long, +#if defined(BOOST_HAS_LONG_LONG) + boost::ulong_long_type +#elif defined(BOOST_HAS_MS_INT64) + unsigned __int64 +#else + unsigned long +#endif + >::type + >::type + >::type + >::type, + // Not a regular integer type: + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned char), + unsigned char, + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned short), + unsigned short, + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned int), + unsigned int, + typename mpl::if_c< + sizeof(t_no_cv) == sizeof(unsigned long), + unsigned long, +#if defined(BOOST_HAS_LONG_LONG) + boost::ulong_long_type +#elif defined(BOOST_HAS_MS_INT64) + unsigned __int64 +#else + unsigned long +#endif + >::type + >::type + >::type + >::type + >::type + >::type base_integer_type; + + // Add back any const qualifier: + typedef typename mpl::if_< + is_const<T>, + typename add_const<base_integer_type>::type, + base_integer_type + >::type const_base_integer_type; + + // Add back any volatile qualifier: + typedef typename mpl::if_< + is_volatile<T>, + typename add_volatile<const_base_integer_type>::type, + const_base_integer_type + >::type type; +}; + + +} // namespace detail + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(make_unsigned,T,typename boost::detail::make_unsigned_imp<T>::type) + +} // namespace boost + +#include <boost/type_traits/detail/type_trait_undef.hpp> + +#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED + diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_all_extents.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_all_extents.hpp new file mode 100644 index 0000000000000000000000000000000000000000..351713223281463c68db38f4c04506ae87eac5ba --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_all_extents.hpp @@ -0,0 +1,47 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_ALL_EXTENT_HOLT_2004_0827 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_ALL_EXTENT_HOLT_2004_0827 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_array.hpp> + +namespace boost { + template<typename T> + struct remove_all_extents; + + namespace detail { + template<bool IsArray> + struct remove_all_extents_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + }; + template<> + struct remove_all_extents_impl_typeof<true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U[]); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( *((T*)NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type reduced_type; + typedef typename remove_all_extents<reduced_type>::type type; + }; + }; + } //namespace detail + + template<typename T> + struct remove_all_extents { + typedef typename detail::remove_all_extents_impl_typeof< + boost::is_array<T>::value + >::template inner<T,remove_all_extents<T> >::type type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_all_extents,T) + }; +} //namespace boost + +#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_BOUNDS_HOLT_2004_0827 + diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_bounds.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_bounds.hpp new file mode 100644 index 0000000000000000000000000000000000000000..12a9b0533569ac111bb3bdaf596ceebaccb0196d --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_bounds.hpp @@ -0,0 +1,43 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_BOUNDS_HOLT_2004_0827 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_BOUNDS_HOLT_2004_0827 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_array.hpp> + +namespace boost { + namespace detail { + template<bool IsArray> + struct remove_bounds_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + }; + template<> + struct remove_bounds_impl_typeof<true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U[]); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( *((T*)NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + }; + } //namespace detail + + template<typename T> + struct remove_bounds { + typedef typename detail::remove_bounds_impl_typeof< + boost::is_array<T>::value + >::template inner<T,remove_bounds<T> >::type type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_bounds,T) + }; +} //namespace boost + +#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_BOUNDS_HOLT_2004_0827 + diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_const.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_const.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5395e80022c03965934b6cdb39e9428f69f9d920 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_const.hpp @@ -0,0 +1,143 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_CONST_HOLT_2004_0828 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_CONST_HOLT_2004_0828 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_array.hpp> + +namespace boost { + namespace detail { + template<bool IsPointer,bool IsArray,bool IsConst,bool IsVolatile> + struct remove_const_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + template<> //Const + struct remove_const_impl_typeof<false,false,true,false> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U const&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T& type; + }; + }; + template<> //CV + struct remove_const_impl_typeof<false,false,true,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U volatile,ID> test(U const volatile&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T& type; + }; + }; + template<> //Const Pointer + struct remove_const_impl_typeof<true,false,true,false> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(void(*)(U const[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type[]; + }; + }; + template<> //CV Pointer + struct remove_const_impl_typeof<true,false,true,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U volatile,ID> test(void(*)(U const volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type[]; + }; + }; + template<> //Const Array + struct remove_const_impl_typeof<false,true,true,false> { + template<typename T,typename ID> + struct inner { + BOOST_STATIC_CONSTANT(unsigned,value=(sizeof(T)/sizeof((*((T*)NULL))[0]))); + + template<typename U> + static msvc_register_type<U[value],ID> test(void(*)(U const[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + + template<> //CV Array + struct remove_const_impl_typeof<false,true,true,true> { + template<typename T,typename ID> + struct inner { + BOOST_STATIC_CONSTANT(unsigned,value=(sizeof(T)/sizeof((*((T*)NULL))[0]))); + + template<typename U> + static msvc_register_type<U volatile[value],ID> test(void(*)(U const volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + + } //namespace detail + + template<typename T> + struct remove_const { + typedef detail::remove_const_impl_typeof< + boost::is_pointer<T>::value, + boost::is_array<T>::value, + boost::is_const<T>::value, + boost::is_volatile<T>::value + > remove_const_type; + typedef typename + remove_const_type::template inner< + typename remove_const_type::template transform_type<T>::type, + remove_const<T> + >::type + type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_const,T) + }; +}//namespace boost + +#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_CONST_HOLT_2004_0828 diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_cv.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_cv.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c7b0379c43229128037b0f7a51618428ceb44206 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_cv.hpp @@ -0,0 +1,190 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_CV_HOLT_2004_0901 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_CV_HOLT_2004_0901 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_array.hpp> + +namespace boost { + namespace detail { + template<bool IsPointer,bool IsArray,bool IsConst,bool IsVolatile> + struct remove_cv_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + template<> //Volatile + struct remove_cv_impl_typeof<false,false,false,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U volatile&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T& type; + }; + }; + template<> //Const + struct remove_cv_impl_typeof<false,false,true,false> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U const&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T& type; + }; + }; + template<> //CV + struct remove_cv_impl_typeof<false,false,true,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U const volatile&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T& type; + }; + }; + template<> //Volatile Pointer + struct remove_cv_impl_typeof<true,false,false,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(void(*)(U volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type[]; + }; + }; + template<> //Const Pointer + struct remove_cv_impl_typeof<true,false,true,false> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(void(*)(U const[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type[]; + }; + }; + template<> //CV Pointer + struct remove_cv_impl_typeof<true,false,true,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(void(*)(U const volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type[]; + }; + }; + template<> //Volatile Array + struct remove_cv_impl_typeof<false,true,false,true> { + template<typename T,typename ID> + struct inner { + BOOST_STATIC_CONSTANT(unsigned,value=(sizeof(T)/sizeof((*((T*)NULL))[0]))); + + template<typename U> + static msvc_register_type<U[value],ID> test(void(*)(U volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + template<> //Const Array + struct remove_cv_impl_typeof<false,true,true,false> { + template<typename T,typename ID> + struct inner { + BOOST_STATIC_CONSTANT(unsigned,value=(sizeof(T)/sizeof((*((T*)NULL))[0]))); + + template<typename U> + static msvc_register_type<U[value],ID> test(void(*)(U const[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + + template<> //CV Array + struct remove_cv_impl_typeof<false,true,true,true> { + template<typename T,typename ID> + struct inner { + BOOST_STATIC_CONSTANT(unsigned,value=(sizeof(T)/sizeof((*((T*)NULL))[0]))); + + template<typename U> + static msvc_register_type<U[value],ID> test(void(*)(U const volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + + } //namespace detail + + template<typename T> + struct remove_cv { + typedef detail::remove_cv_impl_typeof< + boost::is_pointer<T>::value, + boost::is_array<T>::value, + boost::is_const<T>::value, + boost::is_volatile<T>::value + > remove_cv_type; + typedef typename + remove_cv_type::template inner< + typename remove_cv_type::template transform_type<T>::type, + remove_cv<T> + >::type + type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_cv,T) + }; +}//namespace boost + +#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_CV_HOLT_2004_0901 diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_extent.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_extent.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f87ec416da1579d242e05d86f687e1359d17b78a --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_extent.hpp @@ -0,0 +1,43 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_EXTENT_HOLT_2004_0827 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_EXTENT_HOLT_2004_0827 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_array.hpp> + +namespace boost { + namespace detail { + template<bool IsArray> + struct remove_extent_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + }; + template<> + struct remove_extent_impl_typeof<true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U[]); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( *((T*)NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + }; + } //namespace detail + + template<typename T> + struct remove_extent { + typedef typename detail::remove_extent_impl_typeof< + boost::is_array<T>::value + >::template inner<T,remove_extent<T> >::type type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_extent,T) + }; +} //namespace boost + +#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_BOUNDS_HOLT_2004_0827 + diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_pointer.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_pointer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8b9b0d4e112adb2335bf72242a49d37e616adf91 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_pointer.hpp @@ -0,0 +1,42 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_POINTER_HOLT_2004_0827 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_POINTER_HOLT_2004_0827 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_pointer.hpp> + +namespace boost { + namespace detail { + template<int IsPointer> + struct remove_pointer_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + }; + template<> + struct remove_pointer_impl_typeof<true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U*); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( *((T*)NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + }; + } //namespace detail + + template<typename T> + struct remove_pointer { + typedef typename detail::remove_pointer_impl_typeof< + boost::is_pointer<T>::value + >::template inner<T,remove_pointer<T> >::type type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_pointer,T) + }; +} //namespace boost + +#endif //BOOST_TYPE_TRAITS_REMOVE_POINTER_HOLT_2004_0827 diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_reference.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_reference.hpp new file mode 100644 index 0000000000000000000000000000000000000000..367d352eddcd73a54f977b8d25d8dc981054c2ba --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_reference.hpp @@ -0,0 +1,42 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_REFERENCE_HOLT_2004_0827 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_REFERENCE_HOLT_2004_0827 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_reference.hpp> + +namespace boost { + namespace detail { + template<bool IsReference> + struct remove_reference_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + }; + template<> + struct remove_reference_impl_typeof<true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + }; + } //namespace detail + + template<typename T> + struct remove_reference { + typedef typename detail::remove_reference_impl_typeof< + boost::is_reference<T>::value + >::template inner<T,remove_reference<T> >::type type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_reference,T) + }; +} //namespace boost + +#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_REFERENCE_HOLT_2004_0827 diff --git a/Utilities/BGL/boost/type_traits/msvc/remove_volatile.hpp b/Utilities/BGL/boost/type_traits/msvc/remove_volatile.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3759f2a378889bb709705917ef2602891069d2ca --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/remove_volatile.hpp @@ -0,0 +1,143 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_VOLATILE_HOLT_2004_0828 +#define BOOST_TYPE_TRAITS_MSVC_REMOVE_VOLATILE_HOLT_2004_0828 + +#include <boost/type_traits/msvc/typeof.hpp> +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_array.hpp> + +namespace boost { + namespace detail { + template<bool IsPointer,bool IsArray,bool IsConst,bool IsVolatile> + struct remove_volatile_impl_typeof { + template<typename T,typename ID> + struct inner { + typedef T type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + template<> //Volatile + struct remove_volatile_impl_typeof<false,false,false,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(U volatile&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T& type; + }; + }; + template<> //CV + struct remove_volatile_impl_typeof<false,false,true,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U const,ID> test(U const volatile&(*)()); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T& type; + }; + }; + template<> //Volatile Pointer + struct remove_volatile_impl_typeof<true,false,false,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U,ID> test(void(*)(U volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type[]; + }; + }; + template<> //CV Pointer + struct remove_volatile_impl_typeof<true,false,true,true> { + template<typename T,typename ID> + struct inner { + template<typename U> + static msvc_register_type<U const,ID> test(void(*)(U const volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type[]; + }; + }; + template<> //Volatile Array + struct remove_volatile_impl_typeof<false,true,false,true> { + template<typename T,typename ID> + struct inner { + BOOST_STATIC_CONSTANT(unsigned,value=(sizeof(T)/sizeof((*((T*)NULL))[0]))); + + template<typename U> + static msvc_register_type<U[value],ID> test(void(*)(U volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + + template<> //CV Array + struct remove_volatile_impl_typeof<false,true,true,true> { + template<typename T,typename ID> + struct inner { + BOOST_STATIC_CONSTANT(unsigned,value=(sizeof(T)/sizeof((*((T*)NULL))[0]))); + + template<typename U> + static msvc_register_type<U const[value],ID> test(void(*)(U const volatile[])); + static msvc_register_type<T,ID> test(...); + BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (void(*)(T))(NULL) ) )); + typedef typename msvc_extract_type<ID>::id2type::type type; + }; + template<typename T> + struct transform_type { + typedef T type; + }; + }; + + } //namespace detail + + template<typename T> + struct remove_volatile { + typedef detail::remove_volatile_impl_typeof< + boost::is_pointer<T>::value, + boost::is_array<T>::value, + boost::is_const<T>::value, + boost::is_volatile<T>::value + > remove_volatile_type; + typedef typename + remove_volatile_type::template inner< + typename remove_volatile_type::template transform_type<T>::type, + remove_volatile<T> + >::type + type; + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_volatile,T) + }; +}//namespace boost + +#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_VOLATILE_HOLT_2004_0828 diff --git a/Utilities/BGL/boost/type_traits/msvc/typeof.hpp b/Utilities/BGL/boost/type_traits/msvc/typeof.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ebb0e803f600bf8dd15f3241f823979a6944bbed --- /dev/null +++ b/Utilities/BGL/boost/type_traits/msvc/typeof.hpp @@ -0,0 +1,50 @@ +// Copyright (C) 2004 Peder Holt +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPETRAITS_MSVC_TYPEOF_HPP +#define BOOST_TYPETRAITS_MSVC_TYPEOF_HPP + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +namespace boost { namespace detail { +# if BOOST_WORKAROUND(BOOST_MSVC,==1300) + template<typename ID> + struct msvc_extract_type + { + template<bool> + struct id2type_impl; + + typedef id2type_impl<true> id2type; + }; + + template<typename T, typename ID> + struct msvc_register_type : msvc_extract_type<ID> + { + template<> + struct id2type_impl<true> //VC7.0 specific bugfeature + { + typedef T type; + }; + }; +# else + template<typename ID> + struct msvc_extract_type + { + struct id2type; + }; + + template<typename T, typename ID> + struct msvc_register_type : msvc_extract_type<ID> + { + typedef msvc_extract_type<ID> base_type; + struct base_type::id2type // This uses nice VC6.5 and VC7.1 bugfeature + { + typedef T type; + }; + }; +# endif +}} + +#endif //BOOST_TYPETRAITS_MSVC_TYPEOF_IMPL_HPP diff --git a/Utilities/BGL/boost/type_traits/object_traits.hpp b/Utilities/BGL/boost/type_traits/object_traits.hpp index cefdd3941146db7bbee228047676c9370a6ee2ca..c812a62e25bc0e08088dc2884ca6c5f8840bf98c 100644 --- a/Utilities/BGL/boost/type_traits/object_traits.hpp +++ b/Utilities/BGL/boost/type_traits/object_traits.hpp @@ -14,20 +14,20 @@ #ifndef BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED #define BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED -#include "boost/type_traits/has_trivial_assign.hpp" -#include "boost/type_traits/has_trivial_constructor.hpp" -#include "boost/type_traits/has_trivial_copy.hpp" -#include "boost/type_traits/has_trivial_destructor.hpp" -#include "boost/type_traits/has_nothrow_constructor.hpp" -#include "boost/type_traits/has_nothrow_copy.hpp" -#include "boost/type_traits/has_nothrow_assign.hpp" -#include "boost/type_traits/is_base_and_derived.hpp" -#include "boost/type_traits/is_class.hpp" -#include "boost/type_traits/is_compound.hpp" -#include "boost/type_traits/is_empty.hpp" -#include "boost/type_traits/is_object.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/type_traits/is_scalar.hpp" -#include "boost/type_traits/is_stateless.hpp" +#include <boost/type_traits/has_trivial_assign.hpp> +#include <boost/type_traits/has_trivial_constructor.hpp> +#include <boost/type_traits/has_trivial_copy.hpp> +#include <boost/type_traits/has_trivial_destructor.hpp> +#include <boost/type_traits/has_nothrow_constructor.hpp> +#include <boost/type_traits/has_nothrow_copy.hpp> +#include <boost/type_traits/has_nothrow_assign.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_compound.hpp> +#include <boost/type_traits/is_empty.hpp> +#include <boost/type_traits/is_object.hpp> +#include <boost/type_traits/is_pod.hpp> +#include <boost/type_traits/is_scalar.hpp> +#include <boost/type_traits/is_stateless.hpp> #endif // BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED diff --git a/Utilities/BGL/boost/type_traits/promote.hpp b/Utilities/BGL/boost/type_traits/promote.hpp new file mode 100644 index 0000000000000000000000000000000000000000..14efad47eefd0b3d61560b3d0ed8391ea63ca1e5 --- /dev/null +++ b/Utilities/BGL/boost/type_traits/promote.hpp @@ -0,0 +1,40 @@ +// Copyright 2005 Alexander Nasonov. +// 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 FILE_boost_type_traits_promote_hpp_INCLUDED +#define FILE_boost_type_traits_promote_hpp_INCLUDED + +#include <boost/config.hpp> +#include <boost/type_traits/integral_promotion.hpp> +#include <boost/type_traits/floating_point_promotion.hpp> + +// Should be the last #include +#include <boost/type_traits/detail/type_trait_def.hpp> + +namespace boost { + +namespace detail { + +template<class T> +struct promote_impl + : integral_promotion< + BOOST_DEDUCED_TYPENAME floating_point_promotion<T>::type + > +{ +}; + +} + +BOOST_TT_AUX_TYPE_TRAIT_DEF1( + promote + , T + , BOOST_DEDUCED_TYPENAME boost::detail::promote_impl<T>::type + ) +} + +#include <boost/type_traits/detail/type_trait_undef.hpp> + +#endif // #ifndef FILE_boost_type_traits_promote_hpp_INCLUDED + diff --git a/Utilities/BGL/boost/type_traits/rank.hpp b/Utilities/BGL/boost/type_traits/rank.hpp index 43b428db2bb9f3f029265857f169c749c1ce382e..77df41e84c40fe2deaadb4345a63b7337e549b55 100644 --- a/Utilities/BGL/boost/type_traits/rank.hpp +++ b/Utilities/BGL/boost/type_traits/rank.hpp @@ -11,10 +11,12 @@ #define BOOST_TT_RANK_HPP_INCLUDED // should be the last #include -#include "boost/type_traits/detail/size_t_trait_def.hpp" +#include <boost/type_traits/detail/size_t_trait_def.hpp> namespace boost { +#if !defined( __CODEGEARC__ ) + namespace detail{ template <class T, std::size_t N> @@ -72,10 +74,16 @@ struct rank_imp<T const volatile[], N> #endif } +#endif // !defined( __CODEGEARC__ ) + +#if defined( __CODEGEARC__ ) +BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,__array_rank(T)) +#else BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,(::boost::detail::rank_imp<T,0>::value)) +#endif } // namespace boost -#include "boost/type_traits/detail/size_t_trait_undef.hpp" +#include <boost/type_traits/detail/size_t_trait_undef.hpp> #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/reference_traits.hpp b/Utilities/BGL/boost/type_traits/reference_traits.hpp index 85894924ca74b0a461e657595d2b1c82900c6136..1607b3d0dbfa205e3e1c559f26eed6939d7dc182 100644 --- a/Utilities/BGL/boost/type_traits/reference_traits.hpp +++ b/Utilities/BGL/boost/type_traits/reference_traits.hpp @@ -10,6 +10,6 @@ #ifndef BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED #define BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_reference.hpp" +#include <boost/type_traits/is_reference.hpp> #endif // BOOST_TT_REFERENCE_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_all_extents.hpp b/Utilities/BGL/boost/type_traits/remove_all_extents.hpp index b64112b51f766717259ba2829f25a023958034aa..64876e19a119c81824d597be42bf089f93227425 100644 --- a/Utilities/BGL/boost/type_traits/remove_all_extents.hpp +++ b/Utilities/BGL/boost/type_traits/remove_all_extents.hpp @@ -9,11 +9,18 @@ #ifndef BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED #define BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> #include <cstddef> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_all_extents.hpp> +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> + +#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace boost { @@ -24,7 +31,7 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_exte BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const[N],typename boost::remove_all_extents<T const>::type type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T volatile[N],typename boost::remove_all_extents<T volatile>::type type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const volatile[N],typename boost::remove_all_extents<T const volatile>::type type) -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T[],typename boost::remove_all_extents<T>::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const[],typename boost::remove_all_extents<T const>::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T volatile[],typename boost::remove_all_extents<T volatile>::type) @@ -34,6 +41,8 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const vo } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#endif + +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_bounds.hpp b/Utilities/BGL/boost/type_traits/remove_bounds.hpp index 32f7dd8c24edfad3a63d8de31e2eadd89950e9a8..ce129787334497fade5cdebe8724a60dace6fe49 100644 --- a/Utilities/BGL/boost/type_traits/remove_bounds.hpp +++ b/Utilities/BGL/boost/type_traits/remove_bounds.hpp @@ -9,11 +9,18 @@ #ifndef BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED #define BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> #include <cstddef> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_bounds.hpp> +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> + +#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace boost { @@ -24,7 +31,7 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T const[N],T const type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T volatile[N],T volatile type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_bounds,T const volatile[N],T const volatile type) -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T[],T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T const[],T const) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T volatile[],T volatile) @@ -34,6 +41,8 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_bounds,T const volatil } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#endif + +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_const.hpp b/Utilities/BGL/boost/type_traits/remove_const.hpp index 2ec8d6caf04d912120af400dfeb9adb8ddc4251d..7e18d88b1a0ddba85328b3b32bdb8289d7b599db 100644 --- a/Utilities/BGL/boost/type_traits/remove_const.hpp +++ b/Utilities/BGL/boost/type_traits/remove_const.hpp @@ -11,15 +11,20 @@ #ifndef BOOST_TT_REMOVE_CONST_HPP_INCLUDED #define BOOST_TT_REMOVE_CONST_HPP_INCLUDED -#include "boost/type_traits/is_volatile.hpp" -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/type_traits/detail/cv_traits_impl.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/is_volatile.hpp> +#include <boost/type_traits/broken_compiler_spec.hpp> +#include <boost/type_traits/detail/cv_traits_impl.hpp> +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #include <cstddef> +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_const.hpp> +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -53,21 +58,21 @@ struct remove_const_impl // * convert a type T to non-const type - remove_const<T> -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename detail::remove_const_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost::detail::remove_const_impl<T>::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_const,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const[N],T type[N]) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const volatile[N],T volatile type[N]) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename detail::remove_const_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost::detail::remove_const_impl<T>::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_CONST_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_cv.hpp b/Utilities/BGL/boost/type_traits/remove_cv.hpp index 910ee9597c51f2563a7532c994c33575647b13c7..09f8ff103cec90b87c9158b9fb429638fbb5f291 100644 --- a/Utilities/BGL/boost/type_traits/remove_cv.hpp +++ b/Utilities/BGL/boost/type_traits/remove_cv.hpp @@ -11,21 +11,26 @@ #ifndef BOOST_TT_REMOVE_CV_HPP_INCLUDED #define BOOST_TT_REMOVE_CV_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/type_traits/detail/cv_traits_impl.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/broken_compiler_spec.hpp> +#include <boost/type_traits/detail/cv_traits_impl.hpp> +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #include <cstddef> +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_cv.hpp> +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // convert a type T to a non-cv-qualified type - remove_cv<T> -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename detail::cv_traits_imp<T*>::unqualified_type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::cv_traits_imp<T*>::unqualified_type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_cv,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const[N],T type[N]) @@ -33,7 +38,7 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T vol BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const volatile[N],T type[N]) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace detail { template <typename T> @@ -45,12 +50,12 @@ struct remove_cv_impl }; } -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename detail::remove_cv_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::remove_cv_impl<T>::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_CV_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_extent.hpp b/Utilities/BGL/boost/type_traits/remove_extent.hpp index 693f1afe88ba862691f7489070aca32a89805564..b4c7d41368015bb3a16cd8e4f082682d8b009633 100644 --- a/Utilities/BGL/boost/type_traits/remove_extent.hpp +++ b/Utilities/BGL/boost/type_traits/remove_extent.hpp @@ -9,11 +9,18 @@ #ifndef BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED #define BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED -#include "boost/config.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #include <cstddef> +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_extent.hpp> +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> + +#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300) namespace boost { @@ -24,7 +31,7 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const[N],T const type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T volatile[N],T volatile type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const volatile[N],T const volatile type) -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T[],T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const[],T const) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T volatile[],T volatile) @@ -34,6 +41,8 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const volatil } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#endif + +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_pointer.hpp b/Utilities/BGL/boost/type_traits/remove_pointer.hpp index 01b27120ad28c28ebe8aae8e800c153ef8ea1c85..53599928c1018063a891a35a445f285df7ff2970 100644 --- a/Utilities/BGL/boost/type_traits/remove_pointer.hpp +++ b/Utilities/BGL/boost/type_traits/remove_pointer.hpp @@ -9,11 +9,16 @@ #ifndef BOOST_TT_REMOVE_POINTER_HPP_INCLUDED #define BOOST_TT_REMOVE_POINTER_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/broken_compiler_spec.hpp> +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_pointer.hpp> +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -25,14 +30,14 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* volatile,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const volatile,T) -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename detail::remove_pointer_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename boost::detail::remove_pointer_impl<T>::type) #endif } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_POINTER_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_reference.hpp b/Utilities/BGL/boost/type_traits/remove_reference.hpp index 9986a03462725eb3e1383a9a06cb8f85e58fa01c..8fddc46722a533f008bc910054b5fdfcae835af6 100644 --- a/Utilities/BGL/boost/type_traits/remove_reference.hpp +++ b/Utilities/BGL/boost/type_traits/remove_reference.hpp @@ -9,11 +9,16 @@ #ifndef BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED #define BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/broken_compiler_spec.hpp> +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_reference.hpp> +#endif // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -22,7 +27,7 @@ namespace boost { BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T&,T) -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600) +#if defined(BOOST_ILLEGAL_CV_REFERENCES) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified @@ -32,14 +37,14 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& volatile, BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& const volatile,T) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename detail::remove_reference_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename boost::detail::remove_reference_impl<T>::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_REFERENCE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/remove_volatile.hpp b/Utilities/BGL/boost/type_traits/remove_volatile.hpp index 443ce739edabb8ec382dd316157db329bfdefec3..723ebe35af40b0f9053d0e2649908a7510b9e632 100644 --- a/Utilities/BGL/boost/type_traits/remove_volatile.hpp +++ b/Utilities/BGL/boost/type_traits/remove_volatile.hpp @@ -11,15 +11,20 @@ #ifndef BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED #define BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED -#include "boost/type_traits/is_const.hpp" -#include "boost/type_traits/broken_compiler_spec.hpp" -#include "boost/type_traits/detail/cv_traits_impl.hpp" -#include "boost/config.hpp" +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/broken_compiler_spec.hpp> +#include <boost/type_traits/detail/cv_traits_impl.hpp> +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #include <cstddef> +#if BOOST_WORKAROUND(BOOST_MSVC,<=1300) +#include <boost/type_traits/msvc/remove_volatile.hpp> +#endif + // should be the last #include -#include "boost/type_traits/detail/type_trait_def.hpp" +#include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { @@ -52,21 +57,21 @@ struct remove_volatile_impl // * convert a type T to a non-volatile type - remove_volatile<T> -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename detail::remove_volatile_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl<T>::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_volatile,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T volatile[N],T type[N]) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N]) #endif -#else +#elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename detail::remove_volatile_impl<T>::type) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl<T>::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost -#include "boost/type_traits/detail/type_trait_undef.hpp" +#include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/same_traits.hpp b/Utilities/BGL/boost/type_traits/same_traits.hpp index 899193cbd734136cb374c06d307cf584988ca5cf..dab7dac7830cb6cbb0e1820b9907f338d484db33 100644 --- a/Utilities/BGL/boost/type_traits/same_traits.hpp +++ b/Utilities/BGL/boost/type_traits/same_traits.hpp @@ -10,6 +10,6 @@ #ifndef BOOST_TT_SAME_TRAITS_HPP_INCLUDED #define BOOST_TT_SAME_TRAITS_HPP_INCLUDED -#include "boost/type_traits/is_same.hpp" +#include <boost/type_traits/is_same.hpp> #endif // BOOST_TT_SAME_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/transform_traits.hpp b/Utilities/BGL/boost/type_traits/transform_traits.hpp index 6c2d7a304f66d54eb7dd6793287aa6b6db723ee0..7a82f1ca919e75421ff275a37c254670c81dfe03 100644 --- a/Utilities/BGL/boost/type_traits/transform_traits.hpp +++ b/Utilities/BGL/boost/type_traits/transform_traits.hpp @@ -12,10 +12,10 @@ #ifndef BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED #define BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED -#include "boost/type_traits/add_pointer.hpp" -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/remove_bounds.hpp" -#include "boost/type_traits/remove_pointer.hpp" -#include "boost/type_traits/remove_reference.hpp" +#include <boost/type_traits/add_pointer.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/remove_bounds.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/type_traits/remove_reference.hpp> #endif // BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/transform_traits_spec.hpp b/Utilities/BGL/boost/type_traits/transform_traits_spec.hpp index 4ab6e77cafe863bcd35840ccf676758b99cafb94..851af3d39f197a11584db16321fbbb95b60819a7 100644 --- a/Utilities/BGL/boost/type_traits/transform_traits_spec.hpp +++ b/Utilities/BGL/boost/type_traits/transform_traits_spec.hpp @@ -9,6 +9,6 @@ #ifndef BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP_INCLUDED #define BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP_INCLUDED -#include "boost/type_traits/broken_compiler_spec.hpp" +#include <boost/type_traits/broken_compiler_spec.hpp> #endif // BOOST_TT_TRANSFORM_TRAITS_SPEC_HPP_INCLUDED diff --git a/Utilities/BGL/boost/type_traits/type_with_alignment.hpp b/Utilities/BGL/boost/type_traits/type_with_alignment.hpp index b6d9a1cf2d7a6179fdb8f91d93da49a6a59f20a0..d790ee1ef11a796c4f4e86643c6e2ec7dd8fe95e 100644 --- a/Utilities/BGL/boost/type_traits/type_with_alignment.hpp +++ b/Utilities/BGL/boost/type_traits/type_with_alignment.hpp @@ -8,19 +8,19 @@ #ifndef BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED #define BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED -#include "boost/mpl/if.hpp" -#include "boost/preprocessor/list/for_each_i.hpp" -#include "boost/preprocessor/tuple/to_list.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/list/transform.hpp" -#include "boost/preprocessor/list/append.hpp" -#include "boost/type_traits/alignment_of.hpp" -#include "boost/type_traits/is_pod.hpp" -#include "boost/static_assert.hpp" -#include "boost/config.hpp" +#include <boost/mpl/if.hpp> +#include <boost/preprocessor/list/for_each_i.hpp> +#include <boost/preprocessor/tuple/to_list.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/list/transform.hpp> +#include <boost/preprocessor/list/append.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <boost/type_traits/is_pod.hpp> +#include <boost/static_assert.hpp> +#include <boost/config.hpp> // should be the last #include -#include "boost/type_traits/detail/bool_trait_def.hpp" +#include <boost/type_traits/detail/bool_trait_def.hpp> #include <cstddef> @@ -189,14 +189,16 @@ struct is_pod< ::boost::detail::lower_alignment<Align> > // This alignment method originally due to Brian Parker, implemented by David // Abrahams, and then ported here by Doug Gregor. +namespace detail{ + template <std::size_t Align> -class type_with_alignment +class type_with_alignment_imp { - typedef detail::lower_alignment<Align> t1; + typedef ::boost::detail::lower_alignment<Align> t1; typedef typename mpl::if_c< ::boost::detail::is_aligned< ::boost::alignment_of<t1>::value,Align >::value , t1 - , detail::max_align + , ::boost::detail::max_align >::type align_t; BOOST_STATIC_CONSTANT(std::size_t, found = alignment_of<align_t>::value); @@ -208,6 +210,14 @@ class type_with_alignment typedef align_t type; }; +} + +template <std::size_t Align> +class type_with_alignment + : public ::boost::detail::type_with_alignment_imp<Align> +{ +}; + #if defined(__GNUC__) namespace align { struct __attribute__((__aligned__(2))) a2 {}; @@ -232,6 +242,99 @@ BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a32,true) } #endif +#if (defined(BOOST_MSVC) || (defined(BOOST_INTEL) && defined(_MSC_VER))) && _MSC_VER >= 1300 +// +// MSVC supports types which have alignments greater than the normal +// maximum: these are used for example in the types __m64 and __m128 +// to provide types with alignment requirements which match the SSE +// registers. Therefore we extend type_with_alignment<> to support +// such types, however, we have to be careful to use a builtin type +// whenever possible otherwise we break previously working code: +// see http://article.gmane.org/gmane.comp.lib.boost.devel/173011 +// for an example and test case. Thus types like a8 below will +// be used *only* if the existing implementation can't provide a type +// with suitable alignment. This does mean however, that type_with_alignment<> +// may return a type which cannot be passed through a function call +// by value (and neither can any type containing such a type like +// Boost.Optional). However, this only happens when we have no choice +// in the matter because no other "ordinary" type is available. +// +namespace align { +struct __declspec(align(8)) a8 { + char m[8]; + typedef a8 type; +}; +struct __declspec(align(16)) a16 { + char m[16]; + typedef a16 type; +}; +struct __declspec(align(32)) a32 { + char m[32]; + typedef a32 type; +}; +struct __declspec(align(64)) a64 +{ + char m[64]; + typedef a64 type; +}; +struct __declspec(align(128)) a128 { + char m[128]; + typedef a128 type; +}; +} + +template<> class type_with_alignment<8> +{ + typedef mpl::if_c< + ::boost::alignment_of<detail::max_align>::value < 8, + align::a8, + detail::type_with_alignment_imp<8> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<16> +{ + typedef mpl::if_c< + ::boost::alignment_of<detail::max_align>::value < 16, + align::a16, + detail::type_with_alignment_imp<16> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<32> +{ + typedef mpl::if_c< + ::boost::alignment_of<detail::max_align>::value < 32, + align::a32, + detail::type_with_alignment_imp<32> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<64> { + typedef mpl::if_c< + ::boost::alignment_of<detail::max_align>::value < 64, + align::a64, + detail::type_with_alignment_imp<64> >::type t1; +public: + typedef t1::type type; +}; +template<> class type_with_alignment<128> { + typedef mpl::if_c< + ::boost::alignment_of<detail::max_align>::value < 128, + align::a128, + detail::type_with_alignment_imp<128> >::type t1; +public: + typedef t1::type type; +}; + +namespace detail { +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a8,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a32,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a64,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a128,true) +} +#endif #else @@ -254,10 +357,12 @@ namespace detail { typedef ::boost::align::a16 max_align; +//#if ! BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a2,true) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a4,true) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a8,true) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true) +//#endif } template <std::size_t N> struct type_with_alignment @@ -281,7 +386,7 @@ template <> struct type_with_alignment<16>{ typedef align::a16 type; }; # pragma warning(pop) #endif -#include "boost/type_traits/detail/bool_trait_undef.hpp" +#include <boost/type_traits/detail/bool_trait_undef.hpp> #endif // BOOST_TT_TYPE_WITH_ALIGNMENT_INCLUDED diff --git a/Utilities/BGL/boost/unordered/detail/allocator_helpers.hpp b/Utilities/BGL/boost/unordered/detail/allocator_helpers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2c642231b69fd8866b62e187ff2d8266a52ed532 --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/allocator_helpers.hpp @@ -0,0 +1,111 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// A couple of templates to make using allocators easier. + +#ifndef BOOST_UNORDERED_DETAIL_ALLOCATOR_UTILITIES_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_ALLOCATOR_UTILITIES_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/config.hpp> + +#if (defined(BOOST_NO_STD_ALLOCATOR) || defined(BOOST_DINKUMWARE_STDLIB)) \ + && !defined(__BORLANDC__) +# define BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES +#endif + +#if defined(BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES) +# include <boost/detail/allocator_utilities.hpp> +#endif + +namespace boost { namespace unordered_detail { + + // rebind_wrap + // + // Rebind allocators. For some problematic libraries, use rebind_to + // from <boost/detail/allocator_utilities.hpp>. + +#if defined(BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES) + template <class Alloc, class T> + struct rebind_wrap : ::boost::detail::allocator::rebind_to<Alloc, T> {}; +#else + template <class Alloc, class T> + struct rebind_wrap + { + typedef BOOST_DEDUCED_TYPENAME + Alloc::BOOST_NESTED_TEMPLATE rebind<T>::other + type; + }; +#endif + + // allocator_array_constructor + // + // Allocate and construct an array in an exception safe manner, and + // clean up if an exception is thrown before the container takes charge + // of it. + + template <class Allocator> + struct allocator_array_constructor + { + typedef BOOST_DEDUCED_TYPENAME Allocator::pointer pointer; + + Allocator& alloc_; + pointer ptr_; + pointer constructed_; + std::size_t length_; + + allocator_array_constructor(Allocator& a) + : alloc_(a), ptr_(), constructed_(), length_(0) + { + constructed_ = pointer(); + ptr_ = pointer(); + } + + ~allocator_array_constructor() { + if (ptr_) { + for(pointer p = ptr_; p != constructed_; ++p) + alloc_.destroy(p); + + alloc_.deallocate(ptr_, length_); + } + } + + template <class V> + void construct(V const& v, std::size_t l) + { + BOOST_ASSERT(!ptr_); + length_ = l; + ptr_ = alloc_.allocate(length_); + pointer end = ptr_ + static_cast<std::ptrdiff_t>(length_); + for(constructed_ = ptr_; constructed_ != end; ++constructed_) + alloc_.construct(constructed_, v); + } + + pointer get() const + { + return ptr_; + } + + pointer release() + { + pointer p(ptr_); + ptr_ = pointer(); + return p; + } + private: + allocator_array_constructor(allocator_array_constructor const&); + allocator_array_constructor& operator=( + allocator_array_constructor const&); + }; +}} + +#if defined(BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES) +# undef BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES +#endif + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/buckets.hpp b/Utilities/BGL/boost/unordered/detail/buckets.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b1dee5cfa59be0257a83ddc9ecd55134ac404895 --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/buckets.hpp @@ -0,0 +1,183 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James +// 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_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED + +#include <boost/config.hpp> +#include <boost/assert.hpp> +#include <boost/unordered/detail/node.hpp> +#include <boost/unordered/detail/util.hpp> + +namespace boost { namespace unordered_detail { + + //////////////////////////////////////////////////////////////////////////// + // Buckets + + template <class A, class G> + inline std::size_t hash_buckets<A, G>::max_bucket_count() const { + // -1 to account for the sentinel. + return prev_prime(this->bucket_alloc().max_size() - 1); + } + + template <class A, class G> + inline BOOST_DEDUCED_TYPENAME hash_buckets<A, G>::bucket_ptr + hash_buckets<A, G>::get_bucket(std::size_t num) const + { + return buckets_ + static_cast<std::ptrdiff_t>(num); + } + + template <class A, class G> + inline BOOST_DEDUCED_TYPENAME hash_buckets<A, G>::bucket_ptr + hash_buckets<A, G>::bucket_ptr_from_hash(std::size_t hashed) const + { + return get_bucket(hashed % bucket_count_); + } + + template <class A, class G> + std::size_t hash_buckets<A, G>::bucket_size(std::size_t index) const + { + if(!buckets_) return 0; + bucket_ptr ptr = get_bucket(index)->next_; + std::size_t count = 0; + while(ptr) { + ++count; + ptr = ptr->next_; + } + return count; + } + + template <class A, class G> + inline BOOST_DEDUCED_TYPENAME hash_buckets<A, G>::node_ptr + hash_buckets<A, G>::bucket_begin(std::size_t num) const + { + return buckets_ ? get_bucket(num)->next_ : node_ptr(); + } + + //////////////////////////////////////////////////////////////////////////// + // Delete + + template <class A, class G> + inline void hash_buckets<A, G>::delete_node(node_ptr b) + { + node* raw_ptr = static_cast<node*>(&*b); + boost::unordered_detail::destroy(&raw_ptr->value()); + real_node_ptr n(node_alloc().address(*raw_ptr)); + node_alloc().destroy(n); + node_alloc().deallocate(n, 1); + } + + template <class A, class G> + inline void hash_buckets<A, G>::clear_bucket(bucket_ptr b) + { + node_ptr node_it = b->next_; + b->next_ = node_ptr(); + + while(node_it) { + node_ptr node_to_delete = node_it; + node_it = node_it->next_; + delete_node(node_to_delete); + } + } + + template <class A, class G> + inline void hash_buckets<A, G>::delete_buckets() + { + bucket_ptr end = this->get_bucket(this->bucket_count_); + + for(bucket_ptr begin = this->buckets_; begin != end; ++begin) { + clear_bucket(begin); + } + + // Destroy the buckets (including the sentinel bucket). + ++end; + for(bucket_ptr begin = this->buckets_; begin != end; ++begin) { + bucket_alloc().destroy(begin); + } + + bucket_alloc().deallocate(this->buckets_, this->bucket_count_ + 1); + + this->buckets_ = bucket_ptr(); + } + + template <class A, class G> + inline std::size_t hash_buckets<A, G>::delete_nodes( + node_ptr begin, node_ptr end) + { + std::size_t count = 0; + while(begin != end) { + node_ptr n = begin; + begin = begin->next_; + delete_node(n); + ++count; + } + return count; + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors and Destructors + + template <class A, class G> + inline hash_buckets<A, G>::hash_buckets( + node_allocator const& a, std::size_t bucket_count) + : buckets_(), + bucket_count_(bucket_count), + allocators_(a,a) + { + } + + template <class A, class G> + inline hash_buckets<A, G>::~hash_buckets() + { + if(this->buckets_) { this->delete_buckets(); } + } + + template <class A, class G> + inline void hash_buckets<A, G>::create_buckets() + { + // The array constructor will clean up in the event of an + // exception. + allocator_array_constructor<bucket_allocator> + constructor(bucket_alloc()); + + // Creates an extra bucket to act as a sentinel. + constructor.construct(bucket(), this->bucket_count_ + 1); + + // Set up the sentinel (node_ptr cast) + bucket_ptr sentinel = constructor.get() + + static_cast<std::ptrdiff_t>(this->bucket_count_); + sentinel->next_ = sentinel; + + // Only release the buckets once everything is successfully + // done. + this->buckets_ = constructor.release(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors and Destructors + + // no throw + template <class A, class G> + inline void hash_buckets<A, G>::move(hash_buckets& other) + { + BOOST_ASSERT(node_alloc() == other.node_alloc()); + if(this->buckets_) { this->delete_buckets(); } + this->buckets_ = other.buckets_; + this->bucket_count_ = other.bucket_count_; + other.buckets_ = bucket_ptr(); + other.bucket_count_ = 0; + } + + template <class A, class G> + inline void hash_buckets<A, G>::swap(hash_buckets<A, G>& other) + { + BOOST_ASSERT(node_alloc() == other.node_alloc()); + std::swap(buckets_, other.buckets_); + std::swap(bucket_count_, other.bucket_count_); + } +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/equivalent.hpp b/Utilities/BGL/boost/unordered/detail/equivalent.hpp new file mode 100644 index 0000000000000000000000000000000000000000..639dd5ef7713de5b49c5a027967241e5bc3badab --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/equivalent.hpp @@ -0,0 +1,209 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James +// 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_UNORDERED_DETAIL_EQUIVALENT_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_EQUIVALENT_HPP_INCLUDED + +#include <boost/unordered/detail/table.hpp> +#include <boost/unordered/detail/extract_key.hpp> + +namespace boost { namespace unordered_detail { + + //////////////////////////////////////////////////////////////////////////// + // Equality + + template <class T> + bool hash_equivalent_table<T> + ::equals(hash_equivalent_table<T> const& other) const + { + if(this->size_ != other.size_) return false; + if(!this->size_) return true; + + bucket_ptr end = this->get_bucket(this->bucket_count_); + for(bucket_ptr i = this->cached_begin_bucket_; i != end; ++i) + { + node_ptr it1 = i->next_; + while(BOOST_UNORDERED_BORLAND_BOOL(it1)) + { + node_ptr it2 = other.find_iterator(this->get_key_from_ptr(it1)); + if(!BOOST_UNORDERED_BORLAND_BOOL(it2)) return false; + + node_ptr end1 = node::next_group(it1); + node_ptr end2 = node::next_group(it2); + + do { + if(!extractor::compare_mapped( + node::get_value(it1), node::get_value(it2))) + return false; + it1 = it1->next_; + it2 = it2->next_; + } while(it1 != end1 && it2 != end2); + if(it1 != end1 || it2 != end2) return false; + } + } + + return true; + } + + //////////////////////////////////////////////////////////////////////////// + // A convenience method for adding nodes. + + template <class T> + inline BOOST_DEDUCED_TYPENAME hash_equivalent_table<T>::node_ptr + hash_equivalent_table<T> + ::add_node(node_constructor& a, bucket_ptr bucket, node_ptr pos) + { + node_ptr n = a.release(); + if(BOOST_UNORDERED_BORLAND_BOOL(pos)) { + node::add_after_node(n, pos); + } + else { + node::add_to_bucket(n, *bucket); + if(bucket < this->cached_begin_bucket_) + this->cached_begin_bucket_ = bucket; + } + ++this->size_; + return n; + } + + //////////////////////////////////////////////////////////////////////////// + // Insert methods + + template <class T> + inline BOOST_DEDUCED_TYPENAME + hash_equivalent_table<T>::iterator_base + hash_equivalent_table<T>::emplace_impl(node_constructor& a) + { + key_type const& k = this->get_key(a.value()); + std::size_t hash_value = this->hash_function()(k); + + if(!this->size_) { + return this->emplace_empty_impl_with_node(a, 1); + } + else { + bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); + node_ptr position = this->find_iterator(bucket, k); + + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + if(this->reserve_for_insert(this->size_ + 1)) + bucket = this->bucket_ptr_from_hash(hash_value); + + return iterator_base(bucket, add_node(a, bucket, position)); + } + } + + template <class T> + inline void hash_equivalent_table<T> + ::emplace_impl_no_rehash(node_constructor& a) + { + key_type const& k = this->get_key(a.value()); + bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); + add_node(a, bucket, this->find_iterator(bucket, k)); + } + +#if defined(BOOST_UNORDERED_STD_FORWARD) + + // Emplace (equivalent key containers) + // (I'm using an overloaded emplace for both 'insert' and 'emplace') + + // if hash function throws, basic exception safety + // strong otherwise + template <class T> + template <class... Args> + BOOST_DEDUCED_TYPENAME hash_equivalent_table<T>::iterator_base + hash_equivalent_table<T> + ::emplace(Args&&... args) + { + // Create the node before rehashing in case it throws an + // exception (need strong safety in such a case). + node_constructor a(*this); + a.construct(std::forward<Args>(args)...); + + return emplace_impl(a); + } + +#else + +#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \ + template <class T> \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ + BOOST_DEDUCED_TYPENAME hash_equivalent_table<T>::iterator_base \ + hash_equivalent_table<T> \ + ::emplace(BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ + { \ + node_constructor a(*this); \ + a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ + return emplace_impl(a); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_INSERT_IMPL, _) + +#undef BOOST_UNORDERED_INSERT_IMPL +#endif + + //////////////////////////////////////////////////////////////////////////// + // Insert range methods + + // if hash function throws, or inserting > 1 element, basic exception safety + // strong otherwise + template <class T> + template <class I> + inline void hash_equivalent_table<T> + ::insert_for_range(I i, I j, forward_traversal_tag) + { + if(i == j) return; + std::size_t distance = unordered_detail::distance(i, j); + if(distance == 1) { + emplace(*i); + } + else { + node_constructor a(*this); + + // Only require basic exception safety here + if(this->size_) { + this->reserve_for_insert(this->size_ + distance); + } + else { + a.construct(*i++); + this->emplace_empty_impl_with_node(a, distance); + } + + for (; i != j; ++i) { + a.construct(*i); + emplace_impl_no_rehash(a); + } + } + } + + // if hash function throws, or inserting > 1 element, basic exception safety + // strong otherwise + template <class T> + template <class I> + inline void hash_equivalent_table<T> + ::insert_for_range(I i, I j, boost::incrementable_traversal_tag) + { + node_constructor a(*this); + for (; i != j; ++i) { + a.construct(*i); + emplace_impl(a); + } + } + + // if hash function throws, or inserting > 1 element, basic exception safety + // strong otherwise + template <class T> + template <class I> + void hash_equivalent_table<T>::insert_range(I i, I j) + { + BOOST_DEDUCED_TYPENAME boost::iterator_traversal<I>::type + iterator_traversal_tag; + insert_for_range(i, j, iterator_traversal_tag); + } +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/extract_key.hpp b/Utilities/BGL/boost/unordered/detail/extract_key.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bedb175fc2eaee8118cf720af8a54c96957febe8 --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/extract_key.hpp @@ -0,0 +1,148 @@ + +// Copyright (C) 2005-2009 Daniel James +// 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_UNORDERED_DETAIL_EXTRACT_KEY_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_EXTRACT_KEY_HPP_INCLUDED + +#include <boost/config.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/unordered/detail/fwd.hpp> + +namespace boost { +namespace unordered_detail { + + // key extractors + // + // no throw + // + // 'extract_key' is called with the emplace parameters to return a + // key if available or 'no_key' is one isn't and will need to be + // constructed. This could be done by overloading the emplace implementation + // for the different cases, but that's a bit tricky on compilers without + // variadic templates. + + struct no_key { + no_key() {} + template <class T> no_key(T const&) {} + }; + + template <class ValueType> + struct set_extractor + { + typedef ValueType value_type; + typedef ValueType key_type; + + static key_type const& extract(key_type const& v) + { + return v; + } + + static no_key extract() + { + return no_key(); + } + +#if defined(BOOST_UNORDERED_STD_FORWARD) + template <class... Args> + static no_key extract(Args const&...) + { + return no_key(); + } + +#else + template <class Arg> + static no_key extract(Arg const&) + { + return no_key(); + } + + template <class Arg> + static no_key extract(Arg const&, Arg const&) + { + return no_key(); + } +#endif + + static bool compare_mapped(value_type const&, value_type const&) + { + return true; + } + }; + + template <class Key, class ValueType> + struct map_extractor + { + typedef ValueType value_type; + typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Key>::type key_type; + + static key_type const& extract(value_type const& v) + { + return v.first; + } + + static key_type const& extract(key_type const& v) + { + return v; + } + + template <class Second> + static key_type const& extract(std::pair<key_type, Second> const& v) + { + return v.first; + } + + template <class Second> + static key_type const& extract( + std::pair<key_type const, Second> const& v) + { + return v.first; + } + +#if defined(BOOST_UNORDERED_STD_FORWARD) + template <class Arg1, class... Args> + static key_type const& extract(key_type const& k, + Arg1 const&, Args const&...) + { + return k; + } + + template <class... Args> + static no_key extract(Args const&...) + { + return no_key(); + } +#else + template <class Arg1> + static key_type const& extract(key_type const& k, Arg1 const&) + { + return k; + } + + static no_key extract() + { + return no_key(); + } + + template <class Arg> + static no_key extract(Arg const&) + { + return no_key(); + } + + template <class Arg, class Arg1> + static no_key extract(Arg const&, Arg1 const&) + { + return no_key(); + } +#endif + + static bool compare_mapped(value_type const& x, value_type const& y) + { + return x.second == y.second; + } + }; +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/fwd.hpp b/Utilities/BGL/boost/unordered/detail/fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1598cdb077aa7ea398469cdee3e8d3d358347047 --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/fwd.hpp @@ -0,0 +1,1039 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James +// 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) + +// This contains the basic data structure, apart from the actual values. There's +// no construction or deconstruction here. So this only depends on the pointer +// type. + +#ifndef BOOST_UNORDERED_DETAIL_FWD_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_FWD_HPP_INCLUDED + +#include <boost/config.hpp> +#include <boost/iterator.hpp> +#include <boost/compressed_pair.hpp> +#include <boost/type_traits/aligned_storage.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <boost/unordered/detail/allocator_helpers.hpp> +#include <algorithm> + +// This header defines most of the classes used to implement the unordered +// containers. It doesn't include the insert methods as they require a lot +// of preprocessor metaprogramming - they are in insert.hpp + +// Template parameters: +// +// H = Hash Function +// P = Predicate +// A = Value Allocator +// G = Grouped/Ungrouped +// E = Key Extractor + +#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL) +# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) + // STLport doesn't have std::forward. +# else +# define BOOST_UNORDERED_STD_FORWARD +# endif +#endif + +#if !defined(BOOST_UNORDERED_EMPLACE_LIMIT) +#define BOOST_UNORDERED_EMPLACE_LIMIT 10 +#endif + +#if !defined(BOOST_UNORDERED_STD_FORWARD) + +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_binary_params.hpp> +#include <boost/preprocessor/repetition/repeat_from_to.hpp> + +#define BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, class Arg) +#define BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params) \ + BOOST_PP_ENUM_BINARY_PARAMS_Z(z, num_params, Arg, const& arg) +#define BOOST_UNORDERED_CALL_PARAMS(z, num_params) \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, arg) + +#endif + +namespace boost { namespace unordered_detail { + + static const float minimum_max_load_factor = 1e-3f; + static const std::size_t default_bucket_count = 11; + struct move_tag {}; + + template <class Alloc, class Grouped> + class hash_node_constructor; + template <class ValueType> + struct set_extractor; + template <class Key, class ValueType> + struct map_extractor; + struct no_key; + + // Explicitly call a destructor + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4100) // unreferenced formal parameter +#endif + + template <class T> + inline void destroy(T* x) { + x->~T(); + } + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + + // hash_bucket + + template <class A> + class hash_bucket + { + hash_bucket& operator=(hash_bucket const&); + public: + typedef hash_bucket<A> bucket; + typedef BOOST_DEDUCED_TYPENAME + boost::unordered_detail::rebind_wrap<A, bucket>::type + bucket_allocator; + typedef BOOST_DEDUCED_TYPENAME bucket_allocator::pointer bucket_ptr; + typedef bucket_ptr node_ptr; + + node_ptr next_; + + hash_bucket() : next_() {} + }; + + template <class A> + struct ungrouped_node_base : hash_bucket<A> { + typedef hash_bucket<A> bucket; + typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; + + ungrouped_node_base() : bucket() {} + static inline node_ptr& next_group(node_ptr ptr); + static inline std::size_t group_count(node_ptr ptr); + static inline void add_to_bucket(node_ptr n, bucket& b); + static inline void add_after_node(node_ptr n, node_ptr position); + static void unlink_node(bucket& b, node_ptr n); + static void unlink_nodes(bucket& b, node_ptr begin, node_ptr end); + static void unlink_nodes(bucket& b, node_ptr end); + }; + + template <class A> + struct grouped_node_base : hash_bucket<A> + { + typedef hash_bucket<A> bucket; + typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; + + node_ptr group_prev_; + + grouped_node_base() : bucket(), group_prev_() {} + static inline node_ptr& next_group(node_ptr ptr); + static inline node_ptr first_in_group(node_ptr n); + static inline std::size_t group_count(node_ptr ptr); + static inline void add_to_bucket(node_ptr n, bucket& b); + static inline void add_after_node(node_ptr n, node_ptr position); + static void unlink_node(bucket& b, node_ptr n); + static void unlink_nodes(bucket& b, node_ptr begin, node_ptr end); + static void unlink_nodes(bucket& b, node_ptr end); + + private: + static inline node_ptr split_group(node_ptr split); + static inline grouped_node_base& get(node_ptr ptr) { + return static_cast<grouped_node_base&>(*ptr); + } + }; + + struct ungrouped + { + template <class A> + struct base { + typedef ungrouped_node_base<A> type; + }; + }; + + struct grouped + { + template <class A> + struct base { + typedef grouped_node_base<A> type; + }; + }; + + template <class ValueType> + struct value_base + { + typedef ValueType value_type; + BOOST_DEDUCED_TYPENAME boost::aligned_storage< + sizeof(value_type), + ::boost::alignment_of<value_type>::value>::type data_; + + void* address() { + return this; + } + value_type& value() { + return *(ValueType*) this; + } + private: + value_base& operator=(value_base const&); + }; + + // Node + + template <class A, class G> + class hash_node : + public G::BOOST_NESTED_TEMPLATE base<A>::type, + public value_base<BOOST_DEDUCED_TYPENAME A::value_type> + { + public: + typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME hash_bucket<A>::node_ptr node_ptr; + + static value_type& get_value(node_ptr p) { + return static_cast<hash_node&>(*p).value(); + } + private: + hash_node& operator=(hash_node const&); + }; + + // Iterator Base + + template <class A, class G> + class hash_iterator_base + { + public: + typedef A value_allocator; + typedef hash_bucket<A> bucket; + typedef hash_node<A, G> node; + typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; + + bucket_ptr bucket_; + node_ptr node_; + + hash_iterator_base() : bucket_(), node_() {} + explicit hash_iterator_base(bucket_ptr b) + : bucket_(b), + node_(b ? b->next_ : node_ptr()) {} + hash_iterator_base(bucket_ptr b, node_ptr n) + : bucket_(b), + node_(n) {} + + bool operator==(hash_iterator_base const& x) const { + return node_ == x.node_; } + bool operator!=(hash_iterator_base const& x) const { + return node_ != x.node_; } + value_type& operator*() const { + return node::get_value(node_); + } + + void increment_bucket(node_ptr n) { + while(!n) { + ++bucket_; + n = bucket_->next_; + } + node_ = bucket_ == n ? node_ptr() : n; + } + + void increment() { + increment_bucket(node_->next_); + } + }; + + // hash_buckets + // + // This is responsible for allocating and deallocating buckets and nodes. + // + // Notes: + // 1. For the sake exception safety the allocators themselves don't allocate + // anything. + // 2. It's the callers responsibility to allocate the buckets before calling + // any of the methods (other than getters and setters). + + template <class A, class G> + class hash_buckets + { + hash_buckets(hash_buckets const&); + hash_buckets& operator=(hash_buckets const&); + public: + // Types + + typedef A value_allocator; + typedef hash_bucket<A> bucket; + typedef hash_iterator_base<A, G> iterator_base; + typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME iterator_base::node node; + + typedef BOOST_DEDUCED_TYPENAME bucket::bucket_allocator + bucket_allocator; + typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; + + typedef BOOST_DEDUCED_TYPENAME rebind_wrap<value_allocator, node>::type + node_allocator; + typedef BOOST_DEDUCED_TYPENAME node_allocator::pointer real_node_ptr; + + // Members + + bucket_ptr buckets_; + std::size_t bucket_count_; + boost::compressed_pair<bucket_allocator, node_allocator> allocators_; + + // Data access + + bucket_allocator const& bucket_alloc() const { + return allocators_.first(); } + node_allocator const& node_alloc() const { + return allocators_.second(); } + bucket_allocator& bucket_alloc() { + return allocators_.first(); } + node_allocator& node_alloc() { + return allocators_.second(); } + std::size_t max_bucket_count() const; + + // Constructors + + hash_buckets(node_allocator const& a, std::size_t n); + void create_buckets(); + ~hash_buckets(); + + // no throw + void swap(hash_buckets& other); + void move(hash_buckets& other); + + // For the remaining functions, buckets_ must not be null. + + bucket_ptr get_bucket(std::size_t n) const; + bucket_ptr bucket_ptr_from_hash(std::size_t hashed) const; + std::size_t bucket_size(std::size_t index) const; + node_ptr bucket_begin(std::size_t n) const; + + // Alloc/Dealloc + + void delete_node(node_ptr); + + // + void delete_buckets(); + void clear_bucket(bucket_ptr); + std::size_t delete_nodes(node_ptr begin, node_ptr end); + std::size_t delete_to_bucket_end(node_ptr begin); + }; + + template <class H, class P> class set_hash_functions; + + template <class H, class P> + class hash_buffered_functions + { + friend class set_hash_functions<H, P>; + hash_buffered_functions& operator=(hash_buffered_functions const&); + + typedef boost::compressed_pair<H, P> function_pair; + typedef BOOST_DEDUCED_TYPENAME boost::aligned_storage< + sizeof(function_pair), + ::boost::alignment_of<function_pair>::value>::type aligned_function; + + bool current_; // The currently active functions. + aligned_function funcs_[2]; + + function_pair const& current() const { + return *static_cast<function_pair const*>( + static_cast<void const*>(&funcs_[current_])); + } + + void construct(bool which, H const& hf, P const& eq) + { + new((void*) &funcs_[which]) function_pair(hf, eq); + } + + void construct(bool which, function_pair const& f) + { + new((void*) &funcs_[which]) function_pair(f); + } + + void destroy(bool which) + { + boost::unordered_detail::destroy((function_pair*)(&funcs_[which])); + } + + public: + + hash_buffered_functions(H const& hf, P const& eq) + : current_(false) + { + construct(current_, hf, eq); + } + + hash_buffered_functions(hash_buffered_functions const& bf) + : current_(false) + { + construct(current_, bf.current()); + } + + ~hash_buffered_functions() { + destroy(current_); + } + + H const& hash_function() const { + return current().first(); + } + + P const& key_eq() const { + return current().second(); + } + }; + + template <class H, class P> + class set_hash_functions + { + set_hash_functions(set_hash_functions const&); + set_hash_functions& operator=(set_hash_functions const&); + + typedef hash_buffered_functions<H, P> buffered_functions; + buffered_functions& buffered_functions_; + bool tmp_functions_; + + public: + + set_hash_functions(buffered_functions& f, H const& h, P const& p) + : buffered_functions_(f), + tmp_functions_(!f.current_) + { + f.construct(tmp_functions_, h, p); + } + + set_hash_functions(buffered_functions& f, + buffered_functions const& other) + : buffered_functions_(f), + tmp_functions_(!f.current_) + { + f.construct(tmp_functions_, other.current()); + } + + ~set_hash_functions() + { + buffered_functions_.destroy(tmp_functions_); + } + + void commit() + { + buffered_functions_.current_ = tmp_functions_; + tmp_functions_ = !tmp_functions_; + } + }; + + template <class T> + class hash_table : public T::buckets, public T::buffered_functions + { + hash_table(hash_table const&); + public: + typedef BOOST_DEDUCED_TYPENAME T::hasher hasher; + typedef BOOST_DEDUCED_TYPENAME T::key_equal key_equal; + typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator; + typedef BOOST_DEDUCED_TYPENAME T::key_type key_type; + typedef BOOST_DEDUCED_TYPENAME T::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME T::buffered_functions base; + typedef BOOST_DEDUCED_TYPENAME T::buckets buckets; + typedef BOOST_DEDUCED_TYPENAME T::extractor extractor; + typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor; + + typedef BOOST_DEDUCED_TYPENAME T::node node; + typedef BOOST_DEDUCED_TYPENAME T::bucket bucket; + typedef BOOST_DEDUCED_TYPENAME T::node_ptr node_ptr; + typedef BOOST_DEDUCED_TYPENAME T::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME T::iterator_base iterator_base; + typedef BOOST_DEDUCED_TYPENAME T::node_allocator node_allocator; + typedef BOOST_DEDUCED_TYPENAME T::iterator_pair iterator_pair; + + // Members + + std::size_t size_; + float mlf_; + // Cached data - invalid if !this->buckets_ + bucket_ptr cached_begin_bucket_; + std::size_t max_load_; + + // Helper methods + + key_type const& get_key(value_type const& v) const { + return extractor::extract(v); + } + key_type const& get_key_from_ptr(node_ptr n) const { + return extractor::extract(node::get_value(n)); + } + bool equal(key_type const& k, value_type const& v) const; + template <class Key, class Pred> + node_ptr find_iterator(bucket_ptr bucket, Key const& k, + Pred const&) const; + node_ptr find_iterator(bucket_ptr bucket, key_type const& k) const; + node_ptr find_iterator(key_type const& k) const; + node_ptr* find_for_erase(bucket_ptr bucket, key_type const& k) const; + + // Load methods + + std::size_t max_size() const; + std::size_t bucket_index(key_type const& k) const; + void max_load_factor(float z); + std::size_t min_buckets_for_size(std::size_t n) const; + std::size_t calculate_max_load(); + + // Constructors + + hash_table(std::size_t n, hasher const& hf, key_equal const& eq, + node_allocator const& a); + hash_table(hash_table const& x, node_allocator const& a); + hash_table(hash_table& x, move_tag m); + hash_table(hash_table& x, node_allocator const& a, move_tag m); + ~hash_table() {} + hash_table& operator=(hash_table const&); + + // Iterators + + iterator_base begin() const { + return this->size_ ? + iterator_base(this->cached_begin_bucket_) : + iterator_base(); + } + iterator_base end() const { + return iterator_base(); + } + + // Swap & Move + + void swap(hash_table& x); + void fast_swap(hash_table& other); + void slow_swap(hash_table& other); + void partial_swap(hash_table& other); + void move(hash_table& x); + + // Reserve and rehash + + void create_for_insert(std::size_t n); + bool reserve_for_insert(std::size_t n); + void rehash(std::size_t n); + void rehash_impl(std::size_t n); + + // Move/copy buckets + + void move_buckets_to(buckets& dst); + void copy_buckets_to(buckets& dst) const; + + // Misc. key methods + + std::size_t count(key_type const& k) const; + iterator_base find(key_type const& k) const; + template <class Key, class Hash, class Pred> + iterator_base find(Key const& k, Hash const& h, Pred const& eq) const; + value_type& at(key_type const& k) const; + iterator_pair equal_range(key_type const& k) const; + + // Erase + // + // no throw + + void clear(); + std::size_t erase_key(key_type const& k); + iterator_base erase_return_iterator(iterator_base r); + void erase(iterator_base r); + std::size_t erase_group(node_ptr* it, bucket_ptr bucket); + iterator_base erase_range(iterator_base r1, iterator_base r2); + + // recompute_begin_bucket + + void init_buckets(); + + // After an erase cached_begin_bucket_ might be left pointing to + // an empty bucket, so this is called to update it + // + // no throw + + void recompute_begin_bucket(bucket_ptr b); + + // This is called when a range has been erased + // + // no throw + + void recompute_begin_bucket(bucket_ptr b1, bucket_ptr b2); + + // no throw + float load_factor() const; + + iterator_base emplace_empty_impl_with_node( + node_constructor&, std::size_t); + }; + + template <class T> + class hash_unique_table : public T::table + { + public: + typedef BOOST_DEDUCED_TYPENAME T::hasher hasher; + typedef BOOST_DEDUCED_TYPENAME T::key_equal key_equal; + typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator; + typedef BOOST_DEDUCED_TYPENAME T::key_type key_type; + typedef BOOST_DEDUCED_TYPENAME T::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME T::table table; + typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor; + + typedef BOOST_DEDUCED_TYPENAME T::node node; + typedef BOOST_DEDUCED_TYPENAME T::node_ptr node_ptr; + typedef BOOST_DEDUCED_TYPENAME T::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME T::iterator_base iterator_base; + typedef BOOST_DEDUCED_TYPENAME T::extractor extractor; + + typedef std::pair<iterator_base, bool> emplace_return; + + // Constructors + + hash_unique_table(std::size_t n, hasher const& hf, key_equal const& eq, + value_allocator const& a) + : table(n, hf, eq, a) {} + hash_unique_table(hash_unique_table const& x) + : table(x, x.node_alloc()) {} + hash_unique_table(hash_unique_table const& x, value_allocator const& a) + : table(x, a) {} + hash_unique_table(hash_unique_table& x, move_tag m) + : table(x, m) {} + hash_unique_table(hash_unique_table& x, value_allocator const& a, + move_tag m) + : table(x, a, m) {} + ~hash_unique_table() {} + + // Insert methods + + emplace_return emplace_impl_with_node(node_constructor& a); + value_type& operator[](key_type const& k); + + // equals + + bool equals(hash_unique_table const&) const; + + node_ptr add_node(node_constructor& a, bucket_ptr bucket); + +#if defined(BOOST_UNORDERED_STD_FORWARD) + + template<class... Args> + emplace_return emplace(Args&&... args); + template<class... Args> + emplace_return emplace_impl(key_type const& k, Args&&... args); + template<class... Args> + emplace_return emplace_impl(no_key, Args&&... args); + template<class... Args> + emplace_return emplace_empty_impl(Args&&... args); +#else + +#define BOOST_UNORDERED_INSERT_IMPL(z, n, _) \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ + emplace_return emplace( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ + emplace_return emplace_impl(key_type const& k, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ + emplace_return emplace_impl(no_key, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ + emplace_return emplace_empty_impl( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_INSERT_IMPL, _) + +#undef BOOST_UNORDERED_INSERT_IMPL + +#endif + + // if hash function throws, or inserting > 1 element, basic exception + // safety strong otherwise + template <class InputIt> + void insert_range(InputIt i, InputIt j); + template <class InputIt> + void insert_range_impl(key_type const&, InputIt i, InputIt j); + template <class InputIt> + void insert_range_impl(no_key, InputIt i, InputIt j); + }; + + template <class T> + class hash_equivalent_table : public T::table + { + public: + typedef BOOST_DEDUCED_TYPENAME T::hasher hasher; + typedef BOOST_DEDUCED_TYPENAME T::key_equal key_equal; + typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator; + typedef BOOST_DEDUCED_TYPENAME T::key_type key_type; + typedef BOOST_DEDUCED_TYPENAME T::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME T::table table; + typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor; + + typedef BOOST_DEDUCED_TYPENAME T::node node; + typedef BOOST_DEDUCED_TYPENAME T::node_ptr node_ptr; + typedef BOOST_DEDUCED_TYPENAME T::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME T::iterator_base iterator_base; + typedef BOOST_DEDUCED_TYPENAME T::extractor extractor; + + // Constructors + + hash_equivalent_table(std::size_t n, + hasher const& hf, key_equal const& eq, value_allocator const& a) + : table(n, hf, eq, a) {} + hash_equivalent_table(hash_equivalent_table const& x) + : table(x, x.node_alloc()) {} + hash_equivalent_table(hash_equivalent_table const& x, + value_allocator const& a) + : table(x, a) {} + hash_equivalent_table(hash_equivalent_table& x, move_tag m) + : table(x, m) {} + hash_equivalent_table(hash_equivalent_table& x, + value_allocator const& a, move_tag m) + : table(x, a, m) {} + ~hash_equivalent_table() {} + + // Insert methods + + iterator_base emplace_impl(node_constructor& a); + void emplace_impl_no_rehash(node_constructor& a); + + // equals + + bool equals(hash_equivalent_table const&) const; + + inline node_ptr add_node(node_constructor& a, + bucket_ptr bucket, node_ptr pos); + +#if defined(BOOST_UNORDERED_STD_FORWARD) + + template <class... Args> + iterator_base emplace(Args&&... args); + +#else + +#define BOOST_UNORDERED_INSERT_IMPL(z, n, _) \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ + iterator_base emplace(BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_INSERT_IMPL, _) + +#undef BOOST_UNORDERED_INSERT_IMPL +#endif + + template <class I> + void insert_for_range(I i, I j, forward_traversal_tag); + template <class I> + void insert_for_range(I i, I j, boost::incrementable_traversal_tag); + template <class I> + void insert_range(I i, I j); + }; + + // Iterator Access + + class iterator_access + { + public: + template <class Iterator> + static BOOST_DEDUCED_TYPENAME Iterator::base const& + get(Iterator const& it) + { + return it.base_; + } + }; + + // Iterators + + template <class A, class G> class hash_iterator; + template <class A, class G> class hash_const_iterator; + template <class A, class G> class hash_local_iterator; + template <class A, class G> class hash_const_local_iterator; + + // Local Iterators + // + // all no throw + + template <class A, class G> + class hash_local_iterator + : public boost::iterator < + std::forward_iterator_tag, + BOOST_DEDUCED_TYPENAME A::value_type, + std::ptrdiff_t, + BOOST_DEDUCED_TYPENAME A::pointer, + BOOST_DEDUCED_TYPENAME A::reference> + { + public: + typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; + + private: + typedef hash_buckets<A, G> buckets; + typedef BOOST_DEDUCED_TYPENAME buckets::node_ptr node_ptr; + typedef BOOST_DEDUCED_TYPENAME buckets::node node; + typedef hash_const_local_iterator<A, G> const_local_iterator; + + friend class hash_const_local_iterator<A, G>; + node_ptr ptr_; + + public: + hash_local_iterator() : ptr_() {} + explicit hash_local_iterator(node_ptr x) : ptr_(x) {} + BOOST_DEDUCED_TYPENAME A::reference operator*() const { + return node::get_value(ptr_); + } + value_type* operator->() const { + return &node::get_value(ptr_); + } + hash_local_iterator& operator++() { + ptr_ = ptr_->next_; return *this; + } + hash_local_iterator operator++(int) { + hash_local_iterator tmp(ptr_); ptr_ = ptr_->next_; return tmp; } + bool operator==(hash_local_iterator x) const { + return ptr_ == x.ptr_; + } + bool operator==(const_local_iterator x) const { + return ptr_ == x.ptr_; + } + bool operator!=(hash_local_iterator x) const { + return ptr_ != x.ptr_; + } + bool operator!=(const_local_iterator x) const { + return ptr_ != x.ptr_; + } + }; + + template <class A, class G> + class hash_const_local_iterator + : public boost::iterator < + std::forward_iterator_tag, + BOOST_DEDUCED_TYPENAME A::value_type, + std::ptrdiff_t, + BOOST_DEDUCED_TYPENAME A::const_pointer, + BOOST_DEDUCED_TYPENAME A::const_reference > + { + public: + typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; + + private: + typedef hash_buckets<A, G> buckets; + typedef BOOST_DEDUCED_TYPENAME buckets::node_ptr ptr; + typedef BOOST_DEDUCED_TYPENAME buckets::node node; + typedef hash_local_iterator<A, G> local_iterator; + friend class hash_local_iterator<A, G>; + ptr ptr_; + + public: + hash_const_local_iterator() : ptr_() {} + explicit hash_const_local_iterator(ptr x) : ptr_(x) {} + hash_const_local_iterator(local_iterator x) : ptr_(x.ptr_) {} + BOOST_DEDUCED_TYPENAME A::const_reference + operator*() const { + return node::get_value(ptr_); + } + value_type const* operator->() const { + return &node::get_value(ptr_); + } + hash_const_local_iterator& operator++() { + ptr_ = ptr_->next_; return *this; + } + hash_const_local_iterator operator++(int) { + hash_const_local_iterator tmp(ptr_); ptr_ = ptr_->next_; return tmp; + } + bool operator==(local_iterator x) const { + return ptr_ == x.ptr_; + } + bool operator==(hash_const_local_iterator x) const { + return ptr_ == x.ptr_; + } + bool operator!=(local_iterator x) const { + return ptr_ != x.ptr_; + } + bool operator!=(hash_const_local_iterator x) const { + return ptr_ != x.ptr_; + } + }; + + // iterators + // + // all no throw + + + template <class A, class G> + class hash_iterator + : public boost::iterator < + std::forward_iterator_tag, + BOOST_DEDUCED_TYPENAME A::value_type, + std::ptrdiff_t, + BOOST_DEDUCED_TYPENAME A::pointer, + BOOST_DEDUCED_TYPENAME A::reference > + { + public: + typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; + + private: + typedef hash_buckets<A, G> buckets; + typedef BOOST_DEDUCED_TYPENAME buckets::node node; + typedef BOOST_DEDUCED_TYPENAME buckets::iterator_base base; + typedef hash_const_iterator<A, G> const_iterator; + friend class hash_const_iterator<A, G>; + base base_; + + public: + + hash_iterator() : base_() {} + explicit hash_iterator(base const& x) : base_(x) {} + BOOST_DEDUCED_TYPENAME A::reference operator*() const { + return *base_; + } + value_type* operator->() const { + return &*base_; + } + hash_iterator& operator++() { + base_.increment(); return *this; + } + hash_iterator operator++(int) { + hash_iterator tmp(base_); base_.increment(); return tmp; + } + bool operator==(hash_iterator const& x) const { + return base_ == x.base_; + } + bool operator==(const_iterator const& x) const { + return base_ == x.base_; + } + bool operator!=(hash_iterator const& x) const { + return base_ != x.base_; + } + bool operator!=(const_iterator const& x) const { + return base_ != x.base_; + } + }; + + template <class A, class G> + class hash_const_iterator + : public boost::iterator < + std::forward_iterator_tag, + BOOST_DEDUCED_TYPENAME A::value_type, + std::ptrdiff_t, + BOOST_DEDUCED_TYPENAME A::const_pointer, + BOOST_DEDUCED_TYPENAME A::const_reference > + { + public: + typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; + + private: + typedef hash_buckets<A, G> buckets; + typedef BOOST_DEDUCED_TYPENAME buckets::node node; + typedef BOOST_DEDUCED_TYPENAME buckets::iterator_base base; + typedef hash_iterator<A, G> iterator; + friend class hash_iterator<A, G>; + friend class iterator_access; + base base_; + + public: + + hash_const_iterator() : base_() {} + explicit hash_const_iterator(base const& x) : base_(x) {} + hash_const_iterator(iterator const& x) : base_(x.base_) {} + BOOST_DEDUCED_TYPENAME A::const_reference operator*() const { + return *base_; + } + value_type const* operator->() const { + return &*base_; + } + hash_const_iterator& operator++() { + base_.increment(); return *this; + } + hash_const_iterator operator++(int) { + hash_const_iterator tmp(base_); base_.increment(); return tmp; + } + bool operator==(iterator const& x) const { + return base_ == x.base_; + } + bool operator==(hash_const_iterator const& x) const { + return base_ == x.base_; + } + bool operator!=(iterator const& x) const { + return base_ != x.base_; + } + bool operator!=(hash_const_iterator const& x) const { + return base_ != x.base_; + } + }; + + // types + + template <class K, class V, class H, class P, class A, class E, class G> + struct types + { + public: + typedef K key_type; + typedef V value_type; + typedef H hasher; + typedef P key_equal; + typedef A value_allocator; + typedef E extractor; + typedef G group_type; + + typedef hash_node_constructor<value_allocator, group_type> + node_constructor; + typedef hash_buckets<value_allocator, group_type> buckets; + typedef hash_buffered_functions<hasher, key_equal> buffered_functions; + + typedef BOOST_DEDUCED_TYPENAME buckets::node node; + typedef BOOST_DEDUCED_TYPENAME buckets::bucket bucket; + typedef BOOST_DEDUCED_TYPENAME buckets::node_ptr node_ptr; + typedef BOOST_DEDUCED_TYPENAME buckets::bucket_ptr bucket_ptr; + typedef BOOST_DEDUCED_TYPENAME buckets::iterator_base iterator_base; + typedef BOOST_DEDUCED_TYPENAME buckets::node_allocator node_allocator; + + typedef std::pair<iterator_base, iterator_base> iterator_pair; + }; + + template <class H, class P, class A> + struct set : public types< + BOOST_DEDUCED_TYPENAME A::value_type, + BOOST_DEDUCED_TYPENAME A::value_type, + H, P, A, + set_extractor<BOOST_DEDUCED_TYPENAME A::value_type>, + ungrouped> + { + typedef hash_unique_table<set<H, P, A> > impl; + typedef hash_table<set<H, P, A> > table; + }; + + template <class H, class P, class A> + struct multiset : public types< + BOOST_DEDUCED_TYPENAME A::value_type, + BOOST_DEDUCED_TYPENAME A::value_type, + H, P, A, + set_extractor<BOOST_DEDUCED_TYPENAME A::value_type>, + grouped> + { + typedef hash_equivalent_table<multiset<H, P, A> > impl; + typedef hash_table<multiset<H, P, A> > table; + }; + + template <class K, class H, class P, class A> + struct map : public types< + K, BOOST_DEDUCED_TYPENAME A::value_type, + H, P, A, + map_extractor<K, BOOST_DEDUCED_TYPENAME A::value_type>, + ungrouped> + { + typedef hash_unique_table<map<K, H, P, A> > impl; + typedef hash_table<map<K, H, P, A> > table; + }; + + template <class K, class H, class P, class A> + struct multimap : public types< + K, BOOST_DEDUCED_TYPENAME A::value_type, + H, P, A, + map_extractor<K, BOOST_DEDUCED_TYPENAME A::value_type>, + grouped> + { + typedef hash_equivalent_table<multimap<K, H, P, A> > impl; + typedef hash_table<multimap<K, H, P, A> > table; + }; +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/move.hpp b/Utilities/BGL/boost/unordered/detail/move.hpp new file mode 100644 index 0000000000000000000000000000000000000000..16fd92120818025abd53c85b4be64a35f0288346 --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/move.hpp @@ -0,0 +1,243 @@ +/* + Copyright 2005-2007 Adobe Systems Incorporated + + 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_UNORDERED_DETAIL_MOVE_HEADER +#define BOOST_UNORDERED_DETAIL_MOVE_HEADER + +#include <boost/config.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/or.hpp> +#include <boost/mpl/not.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/detail/workaround.hpp> + +/*************************************************************************************************/ + +#if defined(BOOST_NO_SFINAE) +# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN +#elif defined(__GNUC__) && \ + (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 3) +# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN +#elif BOOST_WORKAROUND(BOOST_INTEL, < 900) || \ + BOOST_WORKAROUND(__EDG_VERSION__, < 304) || \ + BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0593)) +# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN +#endif + +/*************************************************************************************************/ + +namespace boost { +namespace unordered_detail { + +/*************************************************************************************************/ + +namespace move_detail { + +/*************************************************************************************************/ + +#if !defined(BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN) + +/*************************************************************************************************/ + +template <typename T> +struct class_has_move_assign { + class type { + typedef T& (T::*E)(T t); + typedef char (&no_type)[1]; + typedef char (&yes_type)[2]; + template <E e> struct sfinae { typedef yes_type type; }; + template <class U> + static typename sfinae<&U::operator=>::type test(int); + template <class U> + static no_type test(...); + public: + enum {value = sizeof(test<T>(1)) == sizeof(yes_type)}; + }; + }; + +/*************************************************************************************************/ + +template<typename T> +struct has_move_assign : boost::mpl::and_<boost::is_class<T>, class_has_move_assign<T> > {}; + +/*************************************************************************************************/ + +class test_can_convert_anything { }; + +/*************************************************************************************************/ + +#endif // BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN + +/*************************************************************************************************/ + +/* + REVISIT (sparent@adobe.com): This is a work around for Boost 1.34.1 and VC++ 2008 where + boost::is_convertible<T, T> fails to compile. +*/ + +template <typename T, typename U> +struct is_convertible : boost::mpl::or_< + boost::is_same<T, U>, + boost::is_convertible<T, U> +> { }; + +/*************************************************************************************************/ + +} //namespace move_detail + + +/*************************************************************************************************/ + +/*! +\ingroup move_related +\brief move_from is used for move_ctors. +*/ + +template <typename T> +struct move_from +{ + explicit move_from(T& x) : source(x) { } + T& source; +private: + move_from& operator=(move_from const&); +}; + +/*************************************************************************************************/ + +#if !defined(BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN) + +/*************************************************************************************************/ + +/*! +\ingroup move_related +\brief The is_movable trait can be used to identify movable types. +*/ +template <typename T> +struct is_movable : boost::mpl::and_< + boost::is_convertible<move_from<T>, T>, + move_detail::has_move_assign<T>, + boost::mpl::not_<boost::is_convertible<move_detail::test_can_convert_anything, T> > + > { }; + +/*************************************************************************************************/ + +#else // BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN + +// On compilers which don't have adequate SFINAE support, treat most types as unmovable, +// unless the trait is specialized. + +template <typename T> +struct is_movable : boost::mpl::false_ { }; + +#endif + +/*************************************************************************************************/ + +#if !defined(BOOST_NO_SFINAE) + +/*************************************************************************************************/ + +/*! +\ingroup move_related +\brief copy_sink and move_sink are used to select between overloaded operations according to + whether type T is movable and convertible to type U. +\sa move +*/ + +template <typename T, + typename U = T, + typename R = void*> +struct copy_sink : boost::enable_if< + boost::mpl::and_< + boost::unordered_detail::move_detail::is_convertible<T, U>, + boost::mpl::not_<is_movable<T> > + >, + R + > +{ }; + +/*************************************************************************************************/ + +/*! +\ingroup move_related +\brief move_sink and copy_sink are used to select between overloaded operations according to + whether type T is movable and convertible to type U. + \sa move +*/ + +template <typename T, + typename U = T, + typename R = void*> +struct move_sink : boost::enable_if< + boost::mpl::and_< + boost::unordered_detail::move_detail::is_convertible<T, U>, + is_movable<T> + >, + R + > +{ }; + +/*************************************************************************************************/ + +/*! +\ingroup move_related +\brief This version of move is selected when T is_movable . It in turn calls the move +constructor. This call, with the help of the return value optimization, will cause x to be moved +instead of copied to its destination. See adobe/test/move/main.cpp for examples. + +*/ +template <typename T> +T move(T& x, typename move_sink<T>::type = 0) { return T(move_from<T>(x)); } + +/*************************************************************************************************/ + +/*! +\ingroup move_related +\brief This version of move is selected when T is not movable . The net result will be that +x gets copied. +*/ +template <typename T> +T& move(T& x, typename copy_sink<T>::type = 0) { return x; } + +/*************************************************************************************************/ + +#else // BOOST_NO_SFINAE + +// On compilers without SFINAE, define copy_sink to always use the copy function. + +template <typename T, + typename U = T, + typename R = void*> +struct copy_sink +{ + typedef R type; +}; + +// Always copy the element unless this is overloaded. + +template <typename T> +T& move(T& x) { + return x; +} + +#endif // BOOST_NO_SFINAE + +} // namespace unordered_detail +} // namespace boost + +/*************************************************************************************************/ + +#endif + +/*************************************************************************************************/ diff --git a/Utilities/BGL/boost/unordered/detail/node.hpp b/Utilities/BGL/boost/unordered/detail/node.hpp new file mode 100644 index 0000000000000000000000000000000000000000..85a3141026e7279f951bcfe6f4f65a76a3c9d7f2 --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/node.hpp @@ -0,0 +1,226 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James +// 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) + +// This contains the basic data structure, apart from the actual values. There's +// no construction or deconstruction here. So this only depends on the pointer +// type. + +#ifndef BOOST_UNORDERED_DETAIL_NODE_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_NODE_HPP_INCLUDED + +#include <boost/config.hpp> +#include <boost/assert.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/unordered/detail/fwd.hpp> + +#if BOOST_WORKAROUND(__BORLANDC__, <= 0X0582) +#define BOOST_UNORDERED_BORLAND_BOOL(x) (bool)(x) +#else +#define BOOST_UNORDERED_BORLAND_BOOL(x) x +#endif + +namespace boost { namespace unordered_detail { + + //////////////////////////////////////////////////////////////////////////// + // ungrouped node implementation + + template <class A> + inline BOOST_DEDUCED_TYPENAME ungrouped_node_base<A>::node_ptr& + ungrouped_node_base<A>::next_group(node_ptr ptr) + { + return ptr->next_; + } + + template <class A> + inline std::size_t ungrouped_node_base<A>::group_count(node_ptr) + { + return 1; + } + + template <class A> + inline void ungrouped_node_base<A>::add_to_bucket(node_ptr n, bucket& b) + { + n->next_ = b.next_; + b.next_ = n; + } + + template <class A> + inline void ungrouped_node_base<A>::add_after_node(node_ptr n, + node_ptr position) + { + n->next_ = position->next_; + position->next_ = position; + } + + template <class A> + inline void ungrouped_node_base<A>::unlink_nodes(bucket& b, + node_ptr begin, node_ptr end) + { + node_ptr* pos = &b.next_; + while(*pos != begin) pos = &(*pos)->next_; + *pos = end; + } + + template <class A> + inline void ungrouped_node_base<A>::unlink_nodes(bucket& b, node_ptr end) + { + b.next_ = end; + } + + template <class A> + inline void ungrouped_node_base<A>::unlink_node(bucket& b, node_ptr n) + { + unlink_nodes(b, n, n->next_); + } + + //////////////////////////////////////////////////////////////////////////// + // grouped node implementation + + // If ptr is the first element in a group, return pointer to next group. + // Otherwise returns a pointer to ptr. + template <class A> + inline BOOST_DEDUCED_TYPENAME grouped_node_base<A>::node_ptr& + grouped_node_base<A>::next_group(node_ptr ptr) + { + return get(ptr).group_prev_->next_; + } + + template <class A> + inline BOOST_DEDUCED_TYPENAME grouped_node_base<A>::node_ptr + grouped_node_base<A>::first_in_group(node_ptr ptr) + { + while(next_group(ptr) == ptr) + ptr = get(ptr).group_prev_; + return ptr; + } + + template <class A> + inline std::size_t grouped_node_base<A>::group_count(node_ptr ptr) + { + node_ptr start = ptr; + std::size_t size = 0; + do { + ++size; + ptr = get(ptr).group_prev_; + } while(ptr != start); + return size; + } + + template <class A> + inline void grouped_node_base<A>::add_to_bucket(node_ptr n, bucket& b) + { + n->next_ = b.next_; + get(n).group_prev_ = n; + b.next_ = n; + } + + template <class A> + inline void grouped_node_base<A>::add_after_node(node_ptr n, node_ptr pos) + { + n->next_ = next_group(pos); + get(n).group_prev_ = get(pos).group_prev_; + next_group(pos) = n; + get(pos).group_prev_ = n; + } + + // Break a ciruclar list into two, with split as the beginning + // of the second group (if split is at the beginning then don't + // split). + template <class A> + inline BOOST_DEDUCED_TYPENAME grouped_node_base<A>::node_ptr + grouped_node_base<A>::split_group(node_ptr split) + { + node_ptr first = first_in_group(split); + if(first == split) return split; + + node_ptr last = get(first).group_prev_; + get(first).group_prev_ = get(split).group_prev_; + get(split).group_prev_ = last; + + return first; + } + + template <class A> + void grouped_node_base<A>::unlink_node(bucket& b, node_ptr n) + { + node_ptr next = n->next_; + node_ptr* pos = &next_group(n); + + if(*pos != n) { + // The node is at the beginning of a group. + + // Find the previous node pointer: + pos = &b.next_; + while(*pos != n) pos = &next_group(*pos); + + // Remove from group + if(BOOST_UNORDERED_BORLAND_BOOL(next) && + get(next).group_prev_ == n) + { + get(next).group_prev_ = get(n).group_prev_; + } + } + else if(BOOST_UNORDERED_BORLAND_BOOL(next) && + get(next).group_prev_ == n) + { + // The deleted node is not at the end of the group, so + // change the link from the next node. + get(next).group_prev_ = get(n).group_prev_; + } + else { + // The deleted node is at the end of the group, so the + // first node in the group is pointing to it. + // Find that to change its pointer. + node_ptr x = get(n).group_prev_; + while(get(x).group_prev_ != n) { + x = get(x).group_prev_; + } + get(x).group_prev_ = get(n).group_prev_; + } + *pos = next; + } + + template <class A> + void grouped_node_base<A>::unlink_nodes(bucket& b, + node_ptr begin, node_ptr end) + { + node_ptr* pos = &next_group(begin); + + if(*pos != begin) { + // The node is at the beginning of a group. + + // Find the previous node pointer: + pos = &b.next_; + while(*pos != begin) pos = &next_group(*pos); + + // Remove from group + if(BOOST_UNORDERED_BORLAND_BOOL(end)) split_group(end); + } + else { + node_ptr group1 = split_group(begin); + if(BOOST_UNORDERED_BORLAND_BOOL(end)) { + node_ptr group2 = split_group(end); + + if(begin == group2) { + node_ptr end1 = get(group1).group_prev_; + node_ptr end2 = get(group2).group_prev_; + get(group1).group_prev_ = end2; + get(group2).group_prev_ = end1; + } + } + } + *pos = end; + } + + template <class A> + void grouped_node_base<A>::unlink_nodes(bucket& b, node_ptr end) + { + split_group(end); + b.next_ = end; + } +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/table.hpp b/Utilities/BGL/boost/unordered/detail/table.hpp new file mode 100644 index 0000000000000000000000000000000000000000..198548d3df2b037295fb23bbda03428292a3ccd3 --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/table.hpp @@ -0,0 +1,777 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James +// 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_UNORDERED_DETAIL_ALL_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_ALL_HPP_INCLUDED + +#include <cstddef> +#include <stdexcept> +#include <algorithm> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/iterator/iterator_categories.hpp> + +#include <boost/unordered/detail/buckets.hpp> + +namespace boost { namespace unordered_detail { + + //////////////////////////////////////////////////////////////////////////// + // Helper methods + + // strong exception safety, no side effects + template <class T> + inline bool hash_table<T>::equal( + key_type const& k, value_type const& v) const + { + return this->key_eq()(k, get_key(v)); + } + + // strong exception safety, no side effects + template <class T> + template <class Key, class Pred> + inline BOOST_DEDUCED_TYPENAME T::node_ptr + hash_table<T>::find_iterator(bucket_ptr bucket, Key const& k, + Pred const& eq) const + { + node_ptr it = bucket->next_; + while (BOOST_UNORDERED_BORLAND_BOOL(it) && + !eq(k, get_key(node::get_value(it)))) + { + it = node::next_group(it); + } + + return it; + } + + // strong exception safety, no side effects + template <class T> + inline BOOST_DEDUCED_TYPENAME T::node_ptr + hash_table<T>::find_iterator( + bucket_ptr bucket, key_type const& k) const + { + node_ptr it = bucket->next_; + while (BOOST_UNORDERED_BORLAND_BOOL(it) && + !equal(k, node::get_value(it))) + { + it = node::next_group(it); + } + + return it; + } + + // strong exception safety, no side effects + // pre: this->buckets_ + template <class T> + inline BOOST_DEDUCED_TYPENAME T::node_ptr + hash_table<T>::find_iterator(key_type const& k) const + { + return find_iterator(this->get_bucket(this->bucket_index(k)), k); + } + + // strong exception safety, no side effects + template <class T> + inline BOOST_DEDUCED_TYPENAME T::node_ptr* + hash_table<T>::find_for_erase( + bucket_ptr bucket, key_type const& k) const + { + node_ptr* it = &bucket->next_; + while(BOOST_UNORDERED_BORLAND_BOOL(*it) && + !equal(k, node::get_value(*it))) + { + it = &node::next_group(*it); + } + + return it; + } + + //////////////////////////////////////////////////////////////////////////// + // Load methods + + // no throw + template <class T> + std::size_t hash_table<T>::max_size() const + { + using namespace std; + + // size < mlf_ * count + return double_to_size_t(ceil( + (double) this->mlf_ * this->max_bucket_count())) - 1; + } + + // strong safety + template <class T> + inline std::size_t hash_table<T>::bucket_index( + key_type const& k) const + { + // hash_function can throw: + return this->hash_function()(k) % this->bucket_count_; + } + + + // no throw + template <class T> + inline std::size_t hash_table<T>::calculate_max_load() + { + using namespace std; + + // From 6.3.1/13: + // Only resize when size >= mlf_ * count + return double_to_size_t(ceil((double) mlf_ * this->bucket_count_)); + } + + template <class T> + void hash_table<T>::max_load_factor(float z) + { + BOOST_ASSERT(z > 0); + mlf_ = (std::max)(z, minimum_max_load_factor); + this->max_load_ = this->calculate_max_load(); + } + + // no throw + template <class T> + inline std::size_t hash_table<T>::min_buckets_for_size( + std::size_t size) const + { + BOOST_ASSERT(this->mlf_ != 0); + + using namespace std; + + // From 6.3.1/13: + // size < mlf_ * count + // => count > size / mlf_ + // + // Or from rehash post-condition: + // count > size / mlf_ + return next_prime(double_to_size_t(floor(size / (double) mlf_)) + 1); + } + + //////////////////////////////////////////////////////////////////////////// + // recompute_begin_bucket + + // init_buckets + + template <class T> + inline void hash_table<T>::init_buckets() + { + if (this->size_) { + this->cached_begin_bucket_ = this->buckets_; + while (!this->cached_begin_bucket_->next_) + ++this->cached_begin_bucket_; + } else { + this->cached_begin_bucket_ = this->get_bucket(this->bucket_count_); + } + this->max_load_ = calculate_max_load(); + } + + // After an erase cached_begin_bucket_ might be left pointing to + // an empty bucket, so this is called to update it + // + // no throw + + template <class T> + inline void hash_table<T>::recompute_begin_bucket(bucket_ptr b) + { + BOOST_ASSERT(!(b < this->cached_begin_bucket_)); + + if(b == this->cached_begin_bucket_) + { + if (this->size_ != 0) { + while (!this->cached_begin_bucket_->next_) + ++this->cached_begin_bucket_; + } else { + this->cached_begin_bucket_ = + this->get_bucket(this->bucket_count_); + } + } + } + + // This is called when a range has been erased + // + // no throw + + template <class T> + inline void hash_table<T>::recompute_begin_bucket( + bucket_ptr b1, bucket_ptr b2) + { + BOOST_ASSERT(!(b1 < this->cached_begin_bucket_) && !(b2 < b1)); + BOOST_ASSERT(BOOST_UNORDERED_BORLAND_BOOL(b2->next_)); + + if(b1 == this->cached_begin_bucket_ && !b1->next_) + this->cached_begin_bucket_ = b2; + } + + // no throw + template <class T> + inline float hash_table<T>::load_factor() const + { + BOOST_ASSERT(this->bucket_count_ != 0); + return static_cast<float>(this->size_) + / static_cast<float>(this->bucket_count_); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors + + template <class T> + hash_table<T>::hash_table(std::size_t num_buckets, + hasher const& hf, key_equal const& eq, node_allocator const& a) + : buckets(a, next_prime(num_buckets)), + base(hf, eq), + size_(), + mlf_(1.0f), + cached_begin_bucket_(), + max_load_(0) + { + } + + // Copy Construct with allocator + + template <class T> + hash_table<T>::hash_table(hash_table const& x, + node_allocator const& a) + : buckets(a, x.min_buckets_for_size(x.size_)), + base(x), + size_(x.size_), + mlf_(x.mlf_), + cached_begin_bucket_(), + max_load_(0) + { + if(x.size_) { + x.copy_buckets_to(*this); + this->init_buckets(); + } + } + + // Move Construct + + template <class T> + hash_table<T>::hash_table(hash_table& x, move_tag) + : buckets(x.node_alloc(), x.bucket_count_), + base(x), + size_(0), + mlf_(1.0f), + cached_begin_bucket_(), + max_load_(0) + { + this->partial_swap(x); + } + + template <class T> + hash_table<T>::hash_table(hash_table& x, + node_allocator const& a, move_tag) + : buckets(a, x.bucket_count_), + base(x), + size_(0), + mlf_(x.mlf_), + cached_begin_bucket_(), + max_load_(0) + { + if(a == x.node_alloc()) { + this->partial_swap(x); + } + else if(x.size_) { + x.copy_buckets_to(*this); + this->size_ = x.size_; + this->init_buckets(); + } + } + + template <class T> + hash_table<T>& hash_table<T>::operator=( + hash_table const& x) + { + hash_table tmp(x, this->node_alloc()); + this->fast_swap(tmp); + return *this; + } + + //////////////////////////////////////////////////////////////////////////// + // Swap & Move + + // Swap + // + // Strong exception safety + // + // Can throw if hash or predicate object's copy constructor throws + // or if allocators are unequal. + + template <class T> + inline void hash_table<T>::partial_swap(hash_table& x) + { + this->buckets::swap(x); // No throw + std::swap(this->size_, x.size_); + std::swap(this->mlf_, x.mlf_); + std::swap(this->cached_begin_bucket_, x.cached_begin_bucket_); + std::swap(this->max_load_, x.max_load_); + } + + template <class T> + inline void hash_table<T>::fast_swap(hash_table& x) + { + // These can throw, but they only affect the function objects + // that aren't in use so it is strongly exception safe, via. + // double buffering. + { + set_hash_functions<hasher, key_equal> op1(*this, x); + set_hash_functions<hasher, key_equal> op2(x, *this); + op1.commit(); + op2.commit(); + } + this->buckets::swap(x); // No throw + std::swap(this->size_, x.size_); + std::swap(this->mlf_, x.mlf_); + std::swap(this->cached_begin_bucket_, x.cached_begin_bucket_); + std::swap(this->max_load_, x.max_load_); + } + + template <class T> + inline void hash_table<T>::slow_swap(hash_table& x) + { + if(this == &x) return; + + { + // These can throw, but they only affect the function objects + // that aren't in use so it is strongly exception safe, via. + // double buffering. + set_hash_functions<hasher, key_equal> op1(*this, x); + set_hash_functions<hasher, key_equal> op2(x, *this); + + // Create new buckets in separate hash_buckets objects + // which will clean up if anything throws an exception. + // (all can throw, but with no effect as these are new objects). + + buckets b1(this->node_alloc(), x.min_buckets_for_size(x.size_)); + if(x.size_) x.copy_buckets_to(b1); + + buckets b2(x.node_alloc(), this->min_buckets_for_size(this->size_)); + if(this->size_) copy_buckets_to(b2); + + // Modifying the data, so no throw from now on. + + b1.swap(*this); + b2.swap(x); + op1.commit(); + op2.commit(); + } + + std::swap(this->size_, x.size_); + + if(this->buckets_) this->init_buckets(); + if(x.buckets_) x.init_buckets(); + } + + template <class T> + void hash_table<T>::swap(hash_table& x) + { + if(this->node_alloc() == x.node_alloc()) { + if(this != &x) this->fast_swap(x); + } + else { + this->slow_swap(x); + } + } + + + // Move + // + // Strong exception safety (might change unused function objects) + // + // Can throw if hash or predicate object's copy constructor throws + // or if allocators are unequal. + + template <class T> + void hash_table<T>::move(hash_table& x) + { + // This can throw, but it only affects the function objects + // that aren't in use so it is strongly exception safe, via. + // double buffering. + set_hash_functions<hasher, key_equal> new_func_this(*this, x); + + if(this->node_alloc() == x.node_alloc()) { + this->buckets::move(x); // no throw + this->size_ = x.size_; + this->cached_begin_bucket_ = x.cached_begin_bucket_; + this->max_load_ = x.max_load_; + x.size_ = 0; + } + else { + // Create new buckets in separate HASH_TABLE_DATA objects + // which will clean up if anything throws an exception. + // (all can throw, but with no effect as these are new objects). + + buckets b(this->node_alloc(), x.min_buckets_for_size(x.size_)); + if(x.size_) x.copy_buckets_to(b); + + // Start updating the data here, no throw from now on. + this->size_ = x.size_; + b.swap(*this); + this->init_buckets(); + } + + // We've made it, the rest is no throw. + this->mlf_ = x.mlf_; + new_func_this.commit(); + } + + //////////////////////////////////////////////////////////////////////////// + // Reserve & Rehash + + // basic exception safety + template <class T> + inline void hash_table<T>::create_for_insert(std::size_t size) + { + this->bucket_count_ = (std::max)(this->bucket_count_, + this->min_buckets_for_size(size)); + this->create_buckets(); + this->init_buckets(); + } + + // basic exception safety + template <class T> + inline bool hash_table<T>::reserve_for_insert(std::size_t size) + { + if(size >= max_load_) { + std::size_t num_buckets + = this->min_buckets_for_size((std::max)(size, + this->size_ + (this->size_ >> 1))); + if(num_buckets != this->bucket_count_) { + rehash_impl(num_buckets); + return true; + } + } + + return false; + } + + // if hash function throws, basic exception safety + // strong otherwise. + + template <class T> + inline void hash_table<T>::rehash(std::size_t min_buckets) + { + using namespace std; + + if(!this->size_) { + if(this->buckets_) this->delete_buckets(); + this->bucket_count_ = next_prime(min_buckets); + } + else { + // no throw: + min_buckets = next_prime((std::max)(min_buckets, + double_to_size_t(floor(this->size_ / (double) mlf_)) + 1)); + if(min_buckets != this->bucket_count_) rehash_impl(min_buckets); + } + } + + // if hash function throws, basic exception safety + // strong otherwise + + template <class T> + void hash_table<T> + ::rehash_impl(std::size_t num_buckets) + { + hasher const& hf = this->hash_function(); + std::size_t size = this->size_; + bucket_ptr end = this->get_bucket(this->bucket_count_); + + buckets dst(this->node_alloc(), num_buckets); + dst.create_buckets(); + + buckets src(this->node_alloc(), this->bucket_count_); + src.swap(*this); + this->size_ = 0; + + for(bucket_ptr bucket = this->cached_begin_bucket_; + bucket != end; ++bucket) + { + node_ptr group = bucket->next_; + while(group) { + // Move the first group of equivalent nodes in bucket to dst. + + // This next line throws iff the hash function throws. + bucket_ptr dst_bucket = dst.bucket_ptr_from_hash( + hf(get_key_from_ptr(group))); + + node_ptr& next_group = node::next_group(group); + bucket->next_ = next_group; + next_group = dst_bucket->next_; + dst_bucket->next_ = group; + group = bucket->next_; + } + } + + // Swap the new nodes back into the container and setup the local + // variables. + this->size_ = size; + dst.swap(*this); // no throw + this->init_buckets(); + } + + //////////////////////////////////////////////////////////////////////////// + // copy_buckets_to + + // copy_buckets_to + // + // basic excpetion safety. If an exception is thrown this will + // leave dst partially filled. + + template <class T> + void hash_table<T> + ::copy_buckets_to(buckets& dst) const + { + BOOST_ASSERT(this->buckets_ && !dst.buckets_); + + hasher const& hf = this->hash_function(); + bucket_ptr end = this->get_bucket(this->bucket_count_); + + node_constructor a(dst); + dst.create_buckets(); + + // no throw: + for(bucket_ptr i = this->cached_begin_bucket_; i != end; ++i) { + // no throw: + for(node_ptr it = i->next_; it;) { + // hash function can throw. + bucket_ptr dst_bucket = dst.bucket_ptr_from_hash( + hf(get_key_from_ptr(it))); + // throws, strong + + node_ptr group_end = node::next_group(it); + + a.construct(node::get_value(it)); + node_ptr n = a.release(); + node::add_to_bucket(n, *dst_bucket); + + for(it = it->next_; it != group_end; it = it->next_) { + a.construct(node::get_value(it)); + node::add_after_node(a.release(), n); + } + } + } + } + + //////////////////////////////////////////////////////////////////////////// + // Misc. key methods + + // strong exception safety + + // count + // + // strong exception safety, no side effects + + template <class T> + std::size_t hash_table<T>::count(key_type const& k) const + { + if(!this->size_) return 0; + node_ptr it = find_iterator(k); // throws, strong + return BOOST_UNORDERED_BORLAND_BOOL(it) ? node::group_count(it) : 0; + } + + // find + // + // strong exception safety, no side effects + template <class T> + BOOST_DEDUCED_TYPENAME T::iterator_base + hash_table<T>::find(key_type const& k) const + { + if(!this->size_) return this->end(); + + bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); + node_ptr it = find_iterator(bucket, k); + + if (BOOST_UNORDERED_BORLAND_BOOL(it)) + return iterator_base(bucket, it); + else + return this->end(); + } + + template <class T> + template <class Key, class Hash, class Pred> + BOOST_DEDUCED_TYPENAME T::iterator_base hash_table<T>::find(Key const& k, + Hash const& h, Pred const& eq) const + { + if(!this->size_) return this->end(); + + bucket_ptr bucket = this->get_bucket(h(k) % this->bucket_count_); + node_ptr it = find_iterator(bucket, k, eq); + + if (BOOST_UNORDERED_BORLAND_BOOL(it)) + return iterator_base(bucket, it); + else + return this->end(); + } + + template <class T> + BOOST_DEDUCED_TYPENAME T::value_type& + hash_table<T>::at(key_type const& k) const + { + if(!this->size_) + throw std::out_of_range("Unable to find key in unordered_map."); + + bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); + node_ptr it = find_iterator(bucket, k); + + if (BOOST_UNORDERED_BORLAND_BOOL(it)) + return node::get_value(it); + else + throw std::out_of_range("Unable to find key in unordered_map."); + } + + // equal_range + // + // strong exception safety, no side effects + template <class T> + BOOST_DEDUCED_TYPENAME T::iterator_pair + hash_table<T>::equal_range(key_type const& k) const + { + if(!this->size_) + return iterator_pair(this->end(), this->end()); + + bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); + node_ptr it = find_iterator(bucket, k); + if (BOOST_UNORDERED_BORLAND_BOOL(it)) { + iterator_base first(iterator_base(bucket, it)); + iterator_base second(first); + second.increment_bucket(node::next_group(second.node_)); + return iterator_pair(first, second); + } + else { + return iterator_pair(this->end(), this->end()); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Erase methods + + template <class T> + void hash_table<T>::clear() + { + if(!this->size_) return; + + bucket_ptr end = this->get_bucket(this->bucket_count_); + for(bucket_ptr begin = this->buckets_; begin != end; ++begin) { + this->clear_bucket(begin); + } + + this->size_ = 0; + this->cached_begin_bucket_ = end; + } + + template <class T> + inline std::size_t hash_table<T>::erase_group( + node_ptr* it, bucket_ptr bucket) + { + node_ptr pos = *it; + node_ptr end = node::next_group(pos); + *it = end; + std::size_t count = this->delete_nodes(pos, end); + this->size_ -= count; + this->recompute_begin_bucket(bucket); + return count; + } + + template <class T> + std::size_t hash_table<T>::erase_key(key_type const& k) + { + if(!this->size_) return 0; + + // No side effects in initial section + bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); + node_ptr* it = this->find_for_erase(bucket, k); + + // No throw. + return *it ? this->erase_group(it, bucket) : 0; + } + + template <class T> + void hash_table<T>::erase(iterator_base r) + { + BOOST_ASSERT(r.node_); + --this->size_; + node::unlink_node(*r.bucket_, r.node_); + this->delete_node(r.node_); + // r has been invalidated but its bucket is still valid + this->recompute_begin_bucket(r.bucket_); + } + + template <class T> + BOOST_DEDUCED_TYPENAME T::iterator_base + hash_table<T>::erase_return_iterator(iterator_base r) + { + BOOST_ASSERT(r.node_); + iterator_base next = r; + next.increment(); + --this->size_; + node::unlink_node(*r.bucket_, r.node_); + this->delete_node(r.node_); + // r has been invalidated but its bucket is still valid + this->recompute_begin_bucket(r.bucket_, next.bucket_); + return next; + } + + template <class T> + BOOST_DEDUCED_TYPENAME T::iterator_base + hash_table<T>::erase_range( + iterator_base r1, iterator_base r2) + { + if(r1 != r2) + { + BOOST_ASSERT(r1.node_); + if (r1.bucket_ == r2.bucket_) { + node::unlink_nodes(*r1.bucket_, r1.node_, r2.node_); + this->size_ -= this->delete_nodes(r1.node_, r2.node_); + + // No need to call recompute_begin_bucket because + // the nodes are only deleted from one bucket, which + // still contains r2 after the erase. + BOOST_ASSERT(r1.bucket_->next_); + } + else { + bucket_ptr end_bucket = r2.node_ ? + r2.bucket_ : this->get_bucket(this->bucket_count_); + BOOST_ASSERT(r1.bucket_ < end_bucket); + node::unlink_nodes(*r1.bucket_, r1.node_, node_ptr()); + this->size_ -= this->delete_nodes(r1.node_, node_ptr()); + + bucket_ptr i = r1.bucket_; + for(++i; i != end_bucket; ++i) { + this->size_ -= this->delete_nodes(i->next_, node_ptr()); + i->next_ = node_ptr(); + } + + if(r2.node_) { + node_ptr first = r2.bucket_->next_; + node::unlink_nodes(*r2.bucket_, r2.node_); + this->size_ -= this->delete_nodes(first, r2.node_); + } + + // r1 has been invalidated but its bucket is still + // valid. + this->recompute_begin_bucket(r1.bucket_, end_bucket); + } + } + + return r2; + } + + template <class T> + BOOST_DEDUCED_TYPENAME hash_table<T>::iterator_base + hash_table<T>::emplace_empty_impl_with_node( + node_constructor& a, std::size_t size) + { + key_type const& k = get_key(a.value()); + std::size_t hash_value = this->hash_function()(k); + if(this->buckets_) this->reserve_for_insert(size); + else this->create_for_insert(size); + bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); + node_ptr n = a.release(); + node::add_to_bucket(n, *bucket); + ++this->size_; + this->cached_begin_bucket_ = bucket; + return iterator_base(bucket, n); + } +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/unique.hpp b/Utilities/BGL/boost/unordered/detail/unique.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59920d007b18de56043ed774326f487aaa1ad91b --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/unique.hpp @@ -0,0 +1,387 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James +// 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_UNORDERED_DETAIL_UNIQUE_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_UNIQUE_HPP_INCLUDED + +#include <boost/unordered/detail/table.hpp> +#include <boost/unordered/detail/extract_key.hpp> + +namespace boost { namespace unordered_detail { + + //////////////////////////////////////////////////////////////////////////// + // Equality + + template <class T> + bool hash_unique_table<T> + ::equals(hash_unique_table<T> const& other) const + { + if(this->size_ != other.size_) return false; + if(!this->size_) return true; + + bucket_ptr end = this->get_bucket(this->bucket_count_); + for(bucket_ptr i = this->cached_begin_bucket_; i != end; ++i) + { + node_ptr it1 = i->next_; + while(BOOST_UNORDERED_BORLAND_BOOL(it1)) + { + node_ptr it2 = other.find_iterator(this->get_key_from_ptr(it1)); + if(!BOOST_UNORDERED_BORLAND_BOOL(it2)) return false; + if(!extractor::compare_mapped( + node::get_value(it1), node::get_value(it2))) + return false; + it1 = it1->next_; + } + } + + return true; + } + + //////////////////////////////////////////////////////////////////////////// + // A convenience method for adding nodes. + + template <class T> + inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::node_ptr + hash_unique_table<T>::add_node(node_constructor& a, + bucket_ptr bucket) + { + node_ptr n = a.release(); + node::add_to_bucket(n, *bucket); + ++this->size_; + if(bucket < this->cached_begin_bucket_) + this->cached_begin_bucket_ = bucket; + return n; + } + + //////////////////////////////////////////////////////////////////////////// + // Insert methods + + // if hash function throws, basic exception safety + // strong otherwise + template <class T> + BOOST_DEDUCED_TYPENAME hash_unique_table<T>::value_type& + hash_unique_table<T>::operator[](key_type const& k) + { + typedef BOOST_DEDUCED_TYPENAME value_type::second_type mapped_type; + + std::size_t hash_value = this->hash_function()(k); + bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); + + if(!this->buckets_) { + node_constructor a(*this); + a.construct_pair(k, (mapped_type*) 0); + return *this->emplace_empty_impl_with_node(a, 1); + } + + node_ptr pos = this->find_iterator(bucket, k); + + if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { + return node::get_value(pos); + } + else { + // Side effects only in this block. + + // Create the node before rehashing in case it throws an + // exception (need strong safety in such a case). + node_constructor a(*this); + a.construct_pair(k, (mapped_type*) 0); + + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + if(this->reserve_for_insert(this->size_ + 1)) + bucket = this->bucket_ptr_from_hash(hash_value); + + // Nothing after this point can throw. + + return node::get_value(add_node(a, bucket)); + } + } + + template <class T> + inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return + hash_unique_table<T>::emplace_impl_with_node(node_constructor& a) + { + // No side effects in this initial code + key_type const& k = this->get_key(a.value()); + std::size_t hash_value = this->hash_function()(k); + bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); + node_ptr pos = this->find_iterator(bucket, k); + + if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { + // Found an existing key, return it (no throw). + return emplace_return(iterator_base(bucket, pos), false); + } else { + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + if(this->reserve_for_insert(this->size_ + 1)) + bucket = this->bucket_ptr_from_hash(hash_value); + + // Nothing after this point can throw. + + return emplace_return( + iterator_base(bucket, add_node(a, bucket)), + true); + } + } + +#if defined(BOOST_UNORDERED_STD_FORWARD) + + template <class T> + template<class... Args> + inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return + hash_unique_table<T>::emplace_impl(key_type const& k, + Args&&... args) + { + // No side effects in this initial code + std::size_t hash_value = this->hash_function()(k); + bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); + node_ptr pos = this->find_iterator(bucket, k); + + if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { + // Found an existing key, return it (no throw). + return emplace_return(iterator_base(bucket, pos), false); + + } else { + // Doesn't already exist, add to bucket. + // Side effects only in this block. + + // Create the node before rehashing in case it throws an + // exception (need strong safety in such a case). + node_constructor a(*this); + a.construct(std::forward<Args>(args)...); + + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + if(this->reserve_for_insert(this->size_ + 1)) + bucket = this->bucket_ptr_from_hash(hash_value); + + // Nothing after this point can throw. + + return emplace_return( + iterator_base(bucket, add_node(a, bucket)), + true); + } + } + + template <class T> + template<class... Args> + inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return + hash_unique_table<T>::emplace_impl(no_key, Args&&... args) + { + // Construct the node regardless - in order to get the key. + // It will be discarded if it isn't used + node_constructor a(*this); + a.construct(std::forward<Args>(args)...); + return emplace_impl_with_node(a); + } + + template <class T> + template<class... Args> + inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return + hash_unique_table<T>::emplace_empty_impl(Args&&... args) + { + node_constructor a(*this); + a.construct(std::forward<Args>(args)...); + return emplace_return(this->emplace_empty_impl_with_node(a, 1), true); + } + +#else + +#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \ + template <class T> \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ + inline BOOST_DEDUCED_TYPENAME \ + hash_unique_table<T>::emplace_return \ + hash_unique_table<T>::emplace_impl( \ + key_type const& k, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ + { \ + std::size_t hash_value = this->hash_function()(k); \ + bucket_ptr bucket \ + = this->bucket_ptr_from_hash(hash_value); \ + node_ptr pos = this->find_iterator(bucket, k); \ + \ + if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { \ + return emplace_return(iterator_base(bucket, pos), false); \ + } else { \ + node_constructor a(*this); \ + a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ + \ + if(this->reserve_for_insert(this->size_ + 1)) \ + bucket = this->bucket_ptr_from_hash(hash_value); \ + \ + return emplace_return(iterator_base(bucket, \ + add_node(a, bucket)), true); \ + } \ + } \ + \ + template <class T> \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ + inline BOOST_DEDUCED_TYPENAME \ + hash_unique_table<T>::emplace_return \ + hash_unique_table<T>:: \ + emplace_impl(no_key, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ + { \ + node_constructor a(*this); \ + a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ + return emplace_impl_with_node(a); \ + } \ + \ + template <class T> \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ + inline BOOST_DEDUCED_TYPENAME \ + hash_unique_table<T>::emplace_return \ + hash_unique_table<T>:: \ + emplace_empty_impl( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ + { \ + node_constructor a(*this); \ + a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ + return emplace_return(this->emplace_empty_impl_with_node(a, 1), true); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_INSERT_IMPL, _) + +#undef BOOST_UNORDERED_INSERT_IMPL + +#endif + +#if defined(BOOST_UNORDERED_STD_FORWARD) + + // Emplace (unique keys) + // (I'm using an overloaded emplace for both 'insert' and 'emplace') + + // if hash function throws, basic exception safety + // strong otherwise + + template <class T> + template<class... Args> + BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return + hash_unique_table<T>::emplace(Args&&... args) + { + return this->size_ ? + emplace_impl( + extractor::extract(std::forward<Args>(args)...), + std::forward<Args>(args)...) : + emplace_empty_impl(std::forward<Args>(args)...); + } + +#else + + template <class T> + template <class Arg0> + BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return + hash_unique_table<T>::emplace(Arg0 const& arg0) + { + return this->size_ ? + emplace_impl(extractor::extract(arg0), arg0) : + emplace_empty_impl(arg0); + } + +#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \ + template <class T> \ + template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ + BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return \ + hash_unique_table<T>::emplace( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ + { \ + return this->size_ ? \ + emplace_impl(extractor::extract(arg0, arg1), \ + BOOST_UNORDERED_CALL_PARAMS(z, num_params)) : \ + emplace_empty_impl( \ + BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ + } + + BOOST_PP_REPEAT_FROM_TO(2, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_INSERT_IMPL, _) + +#undef BOOST_UNORDERED_INSERT_IMPL + +#endif + + //////////////////////////////////////////////////////////////////////////// + // Insert range methods + + template <class T> + template <class InputIt> + inline void hash_unique_table<T>::insert_range_impl( + key_type const&, InputIt i, InputIt j) + { + node_constructor a(*this); + + if(!this->size_) { + a.construct(*i); + this->emplace_empty_impl_with_node(a, 1); + ++i; + if(i == j) return; + } + + do { + // No side effects in this initial code + // Note: can't use get_key as '*i' might not be value_type - it + // could be a pair with first_types as key_type without const or a + // different second_type. + key_type const& k = extractor::extract(*i); + std::size_t hash_value = this->hash_function()(k); + bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); + node_ptr pos = this->find_iterator(bucket, k); + + if (!BOOST_UNORDERED_BORLAND_BOOL(pos)) { + // Doesn't already exist, add to bucket. + // Side effects only in this block. + + // Create the node before rehashing in case it throws an + // exception (need strong safety in such a case). + a.construct(*i); + + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + if(this->size_ + 1 >= this->max_load_) { + this->reserve_for_insert(this->size_ + insert_size(i, j)); + bucket = this->bucket_ptr_from_hash(hash_value); + } + + // Nothing after this point can throw. + add_node(a, bucket); + } + } while(++i != j); + } + + template <class T> + template <class InputIt> + inline void hash_unique_table<T>::insert_range_impl( + no_key, InputIt i, InputIt j) + { + node_constructor a(*this); + + if(!this->size_) { + a.construct(*i); + this->emplace_empty_impl_with_node(a, 1); + ++i; + if(i == j) return; + } + + do { + // No side effects in this initial code + a.construct(*i); + emplace_impl_with_node(a); + } while(++i != j); + } + + // if hash function throws, or inserting > 1 element, basic exception safety + // strong otherwise + template <class T> + template <class InputIt> + void hash_unique_table<T>::insert_range(InputIt i, InputIt j) + { + if(i != j) + return insert_range_impl(extractor::extract(*i), i, j); + } +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/detail/util.hpp b/Utilities/BGL/boost/unordered/detail/util.hpp new file mode 100644 index 0000000000000000000000000000000000000000..22b41583f7abdd21885b5941c06ae8eac96ca26f --- /dev/null +++ b/Utilities/BGL/boost/unordered/detail/util.hpp @@ -0,0 +1,323 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James +// 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_UNORDERED_DETAIL_UTIL_HPP_INCLUDED +#define BOOST_UNORDERED_DETAIL_UTIL_HPP_INCLUDED + +#include <cstddef> +#include <utility> +#include <algorithm> +#include <boost/limits.hpp> +#include <boost/iterator/iterator_categories.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/preprocessor/seq/enum.hpp> +#include <boost/unordered/detail/fwd.hpp> + +namespace boost { namespace unordered_detail { + + //////////////////////////////////////////////////////////////////////////// + // convert double to std::size_t + + inline std::size_t double_to_size_t(double f) + { + return f >= static_cast<double>( + (std::numeric_limits<std::size_t>::max)()) ? + (std::numeric_limits<std::size_t>::max)() : + static_cast<std::size_t>(f); + } + + //////////////////////////////////////////////////////////////////////////// + // primes + + template<class T> struct prime_list_template + { + static std::size_t const value[]; + static std::ptrdiff_t const length; + }; + +#define BOOST_UNORDERED_PRIMES \ + (5ul)(11ul)(17ul)(29ul)(37ul)(53ul)(67ul)(79ul) \ + (97ul)(131ul)(193ul)(257ul)(389ul)(521ul)(769ul) \ + (1031ul)(1543ul)(2053ul)(3079ul)(6151ul)(12289ul)(24593ul) \ + (49157ul)(98317ul)(196613ul)(393241ul)(786433ul) \ + (1572869ul)(3145739ul)(6291469ul)(12582917ul)(25165843ul) \ + (50331653ul)(100663319ul)(201326611ul)(402653189ul)(805306457ul) \ + (1610612741ul)(3221225473ul)(4294967291ul) + + template<class T> + std::size_t const prime_list_template<T>::value[] = { + BOOST_PP_SEQ_ENUM(BOOST_UNORDERED_PRIMES) + }; + + template<class T> + std::ptrdiff_t const prime_list_template<T>::length + = BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES); + +#undef BOOST_UNORDERED_PRIMES + + typedef prime_list_template<std::size_t> prime_list; + + // no throw + inline std::size_t next_prime(std::size_t num) { + std::size_t const* const prime_list_begin = prime_list::value; + std::size_t const* const prime_list_end = prime_list_begin + + prime_list::length; + std::size_t const* bound = + std::lower_bound(prime_list_begin, prime_list_end, num); + if(bound == prime_list_end) + bound--; + return *bound; + } + + // no throw + inline std::size_t prev_prime(std::size_t num) { + std::size_t const* const prime_list_begin = prime_list::value; + std::size_t const* const prime_list_end = prime_list_begin + + prime_list::length; + std::size_t const* bound = + std::upper_bound(prime_list_begin,prime_list_end, num); + if(bound != prime_list_begin) + bound--; + return *bound; + } + + //////////////////////////////////////////////////////////////////////////// + // pair_cast - because some libraries don't have the full pair constructors. + + template <class Dst1, class Dst2, class Src1, class Src2> + inline std::pair<Dst1, Dst2> pair_cast(std::pair<Src1, Src2> const& x) + { + return std::pair<Dst1, Dst2>(Dst1(x.first), Dst2(x.second)); + } + + //////////////////////////////////////////////////////////////////////////// + // insert_size/initial_size + +#if !defined(BOOST_NO_STD_DISTANCE) + using ::std::distance; +#else + template <class ForwardIterator> + inline std::size_t distance(ForwardIterator i, ForwardIterator j) { + std::size_t x; + std::distance(i, j, x); + return x; + } +#endif + + template <class I> + inline std::size_t insert_size(I i, I j, boost::forward_traversal_tag) + { + return std::distance(i, j); + } + + template <class I> + inline std::size_t insert_size(I, I, boost::incrementable_traversal_tag) + { + return 1; + } + + template <class I> + inline std::size_t insert_size(I i, I j) + { + BOOST_DEDUCED_TYPENAME boost::iterator_traversal<I>::type + iterator_traversal_tag; + return insert_size(i, j, iterator_traversal_tag); + } + + template <class I> + inline std::size_t initial_size(I i, I j, + std::size_t num_buckets = boost::unordered_detail::default_bucket_count) + { + return (std::max)(static_cast<std::size_t>(insert_size(i, j)) + 1, + num_buckets); + } + + //////////////////////////////////////////////////////////////////////////// + // Node Constructors + +#if defined(BOOST_UNORDERED_STD_FORWARD) + + template <class T, class... Args> + inline void construct_impl(T*, void* address, Args&&... args) + { + new(address) T(std::forward<Args>(args)...); + } + +#if defined(BOOST_UNORDERED_CPP0X_PAIR) + template <class First, class Second, class Key, class Arg0, class... Args> + inline void construct_impl(std::pair<First, Second>*, void* address, + Key&& k, Arg0&& arg0, Args&&... args) + ) + { + new(address) std::pair<First, Second>(k, + Second(arg0, std::forward<Args>(args)...); + } +#endif + +#else + +#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ + template < \ + class T, \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ + > \ + inline void construct_impl( \ + T*, void* address, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params) \ + ) \ + { \ + new(address) T( \ + BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ + } \ + \ + template <class First, class Second, class Key, \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ + > \ + inline void construct_impl( \ + std::pair<First, Second>*, void* address, \ + Key const& k, BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ + { \ + new(address) std::pair<First, Second>(k, \ + Second(BOOST_UNORDERED_CALL_PARAMS(z, num_params))); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_CONSTRUCT_IMPL, _) + +#undef BOOST_UNORDERED_CONSTRUCT_IMPL +#endif + + // hash_node_constructor + // + // Used to construct nodes in an exception safe manner. + + template <class Alloc, class Grouped> + class hash_node_constructor + { + typedef hash_buckets<Alloc, Grouped> buckets; + typedef BOOST_DEDUCED_TYPENAME buckets::node node; + typedef BOOST_DEDUCED_TYPENAME buckets::real_node_ptr real_node_ptr; + typedef BOOST_DEDUCED_TYPENAME buckets::value_type value_type; + + buckets& buckets_; + real_node_ptr node_; + bool node_constructed_; + bool value_constructed_; + + public: + + hash_node_constructor(buckets& m) : + buckets_(m), + node_(), + node_constructed_(false), + value_constructed_(false) + { + } + + ~hash_node_constructor(); + void construct_preamble(); + +#if defined(BOOST_UNORDERED_STD_FORWARD) + template <class... Args> + void construct(Args&&... args) + { + construct_preamble(); + construct_impl((value_type*) 0, node_->address(), + std::forward<Args>(args)...); + value_constructed_ = true; + } +#else + +#define BOOST_UNORDERED_CONSTRUCT(z, num_params, _) \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ + > \ + void construct( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params) \ + ) \ + { \ + construct_preamble(); \ + construct_impl( \ + (value_type*) 0, node_->address(), \ + BOOST_UNORDERED_CALL_PARAMS(z, num_params) \ + ); \ + value_constructed_ = true; \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_CONSTRUCT, _) + +#undef BOOST_UNORDERED_CONSTRUCT + +#endif + template <class K, class M> + void construct_pair(K const& k, M*) + { + construct_preamble(); + new(node_->address()) value_type(k, M()); + value_constructed_ = true; + } + + value_type& value() const + { + BOOST_ASSERT(node_); + return node_->value(); + } + + // no throw + BOOST_DEDUCED_TYPENAME buckets::node_ptr release() + { + real_node_ptr p = node_; + node_ = real_node_ptr(); + // node_ptr cast + return buckets_.bucket_alloc().address(*p); + } + + private: + hash_node_constructor(hash_node_constructor const&); + hash_node_constructor& operator=(hash_node_constructor const&); + }; + + // hash_node_constructor + + template <class Alloc, class Grouped> + inline hash_node_constructor<Alloc, Grouped>::~hash_node_constructor() + { + if (node_) { + if (value_constructed_) { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { hash_node<Alloc, Grouped> x; }; +#endif + boost::unordered_detail::destroy(&node_->value()); + } + + if (node_constructed_) + buckets_.node_alloc().destroy(node_); + + buckets_.node_alloc().deallocate(node_, 1); + } + } + + template <class Alloc, class Grouped> + inline void hash_node_constructor<Alloc, Grouped>::construct_preamble() + { + if(!node_) { + node_constructed_ = false; + value_constructed_ = false; + + node_ = buckets_.node_alloc().allocate(1); + buckets_.node_alloc().construct(node_, node()); + node_constructed_ = true; + } + else { + BOOST_ASSERT(node_constructed_ && value_constructed_); + boost::unordered_detail::destroy(&node_->value()); + value_constructed_ = false; + } + } +}} + +#endif diff --git a/Utilities/BGL/boost/unordered/unordered_map.hpp b/Utilities/BGL/boost/unordered/unordered_map.hpp new file mode 100644 index 0000000000000000000000000000000000000000..93e197893a99a3078e85296c14a339a95f7bc1d6 --- /dev/null +++ b/Utilities/BGL/boost/unordered/unordered_map.hpp @@ -0,0 +1,1108 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James. +// 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/unordered for documentation + +#ifndef BOOST_UNORDERED_UNORDERED_MAP_HPP_INCLUDED +#define BOOST_UNORDERED_UNORDERED_MAP_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/unordered/unordered_map_fwd.hpp> +#include <boost/functional/hash.hpp> +#include <boost/unordered/detail/allocator_helpers.hpp> +#include <boost/unordered/detail/equivalent.hpp> +#include <boost/unordered/detail/unique.hpp> + +#if !defined(BOOST_HAS_RVALUE_REFS) +#include <boost/unordered/detail/move.hpp> +#endif + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) +#include <initializer_list> +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC >= 1400 +#pragma warning(disable:4396) //the inline specifier cannot be used when a + // friend declaration refers to a specialization + // of a function template +#endif +#endif + +namespace boost +{ + template <class K, class T, class H, class P, class A> + class unordered_map + { + public: + typedef K key_type; + typedef std::pair<const K, T> value_type; + typedef T mapped_type; + typedef H hasher; + typedef P key_equal; + typedef A allocator_type; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + typedef BOOST_DEDUCED_TYPENAME + boost::unordered_detail::rebind_wrap< + allocator_type, value_type>::type + value_allocator; + + typedef boost::unordered_detail::map<K, H, P, + value_allocator> types; + typedef BOOST_DEDUCED_TYPENAME types::impl table; + + typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base; + + public: + + typedef BOOST_DEDUCED_TYPENAME + value_allocator::pointer pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_pointer const_pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::reference reference; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_reference const_reference; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + typedef boost::unordered_detail::hash_const_local_iterator< + value_allocator, boost::unordered_detail::ungrouped> + const_local_iterator; + typedef boost::unordered_detail::hash_local_iterator< + value_allocator, boost::unordered_detail::ungrouped> + local_iterator; + typedef boost::unordered_detail::hash_const_iterator< + value_allocator, boost::unordered_detail::ungrouped> + const_iterator; + typedef boost::unordered_detail::hash_iterator< + value_allocator, boost::unordered_detail::ungrouped> + iterator; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + table table_; + + BOOST_DEDUCED_TYPENAME types::iterator_base const& + get(const_iterator const& it) + { + return boost::unordered_detail::iterator_access::get(it); + } + + public: + + // construct/destroy/copy + + explicit unordered_map( + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(n, hf, eql, a) + { + } + + explicit unordered_map(allocator_type const& a) + : table_(boost::unordered_detail::default_bucket_count, + hasher(), key_equal(), a) + { + } + + unordered_map(unordered_map const& other, allocator_type const& a) + : table_(other.table_, a) + { + } + + template <class InputIt> + unordered_map(InputIt f, InputIt l) + : table_(boost::unordered_detail::initial_size(f, l), + hasher(), key_equal(), allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_map(InputIt f, InputIt l, + size_type n, + const hasher &hf = hasher(), + const key_equal &eql = key_equal()) + : table_(boost::unordered_detail::initial_size(f, l, n), + hf, eql, allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_map(InputIt f, InputIt l, + size_type n, + const hasher &hf, + const key_equal &eql, + const allocator_type &a) + : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a) + { + table_.insert_range(f, l); + } + + ~unordered_map() {} + +#if defined(BOOST_HAS_RVALUE_REFS) + unordered_map(unordered_map&& other) + : table_(other.table_, boost::unordered_detail::move_tag()) + { + } + + unordered_map(unordered_map&& other, allocator_type const& a) + : table_(other.table_, a, boost::unordered_detail::move_tag()) + { + } + + unordered_map& operator=(unordered_map&& x) + { + table_.move(x.table_); + return *this; + } +#else + unordered_map(boost::unordered_detail::move_from< + unordered_map<K, T, H, P, A> + > other) + : table_(other.source.table_, boost::unordered_detail::move_tag()) + { + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593) + unordered_map& operator=(unordered_map x) + { + table_.move(x.table_); + return *this; + } +#endif +#endif + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + unordered_map(std::initializer_list<value_type> list, + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(boost::unordered_detail::initial_size( + list.begin(), list.end(), n), + hf, eql, a) + { + table_.insert_range(list.begin(), list.end()); + } + + unordered_map& operator=(std::initializer_list<value_type> list) + { + table_.clear(); + table_.insert_range(list.begin(), list.end()); + return *this; + } +#endif + + allocator_type get_allocator() const + { + return table_.node_alloc(); + } + + // size and capacity + + bool empty() const + { + return table_.size_ == 0; + } + + size_type size() const + { + return table_.size_; + } + + size_type max_size() const + { + return table_.max_size(); + } + + // iterators + + iterator begin() + { + return iterator(table_.begin()); + } + + const_iterator begin() const + { + return const_iterator(table_.begin()); + } + + iterator end() + { + return iterator(table_.end()); + } + + const_iterator end() const + { + return const_iterator(table_.end()); + } + + const_iterator cbegin() const + { + return const_iterator(table_.begin()); + } + + const_iterator cend() const + { + return const_iterator(table_.end()); + } + + // modifiers + +#if defined(BOOST_UNORDERED_STD_FORWARD) + template <class... Args> + std::pair<iterator, bool> emplace(Args&&... args) + { + return boost::unordered_detail::pair_cast<iterator, bool>( + table_.emplace(std::forward<Args>(args)...)); + } + + template <class... Args> + iterator emplace_hint(const_iterator, Args&&... args) + { + return iterator(table_.emplace(std::forward<Args>(args)...).first); + } +#else + + #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) + std::pair<iterator, bool> emplace(value_type const& v = value_type()) + { + return boost::unordered_detail::pair_cast<iterator, bool>( + table_.emplace(v)); + } + + iterator emplace_hint(const_iterator, + value_type const& v = value_type()) + { + return iterator(table_.emplace(v).first); + } + #endif + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + std::pair<iterator, bool> emplace( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return boost::unordered_detail::pair_cast<iterator, bool>( \ + table_.emplace( \ + BOOST_UNORDERED_CALL_PARAMS(z, n) \ + )); \ + } \ + \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + iterator emplace_hint(const_iterator, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return iterator(table_.emplace( \ + BOOST_UNORDERED_CALL_PARAMS(z, n)).first); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_EMPLACE, _) + +#undef BOOST_UNORDERED_EMPLACE + +#endif + + std::pair<iterator, bool> insert(const value_type& obj) + { + return boost::unordered_detail::pair_cast<iterator, bool>( + table_.emplace(obj)); + } + + iterator insert(const_iterator, const value_type& obj) + { + return iterator(table_.emplace(obj).first); + } + + template <class InputIt> + void insert(InputIt first, InputIt last) + { + table_.insert_range(first, last); + } + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type> list) + { + table_.insert_range(list.begin(), list.end()); + } +#endif + + iterator erase(const_iterator position) + { + return iterator(table_.erase_return_iterator(get(position))); + } + + size_type erase(const key_type& k) + { + return table_.erase_key(k); + } + + iterator erase(const_iterator first, const_iterator last) + { + return iterator(table_.erase_range(get(first), get(last))); + } + + void erase_return_void(const_iterator position) + { + table_.erase(get(position)); + } + + void clear() + { + table_.clear(); + } + + void swap(unordered_map& other) + { + table_.swap(other.table_); + } + + // observers + + hasher hash_function() const + { + return table_.hash_function(); + } + + key_equal key_eq() const + { + return table_.key_eq(); + } + + mapped_type& operator[](const key_type &k) + { + return table_[k].second; + } + + mapped_type& at(const key_type& k) + { + return table_.at(k).second; + } + + mapped_type const& at(const key_type& k) const + { + return table_.at(k).second; + } + + // lookup + + iterator find(const key_type& k) + { + return iterator(table_.find(k)); + } + + const_iterator find(const key_type& k) const + { + return const_iterator(table_.find(k)); + } + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + iterator find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) + { + return iterator(table_.find(k, hash, eq)); + } + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + const_iterator find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) const + { + return iterator(table_.find(k, hash, eq)); + } + + size_type count(const key_type& k) const + { + return table_.count(k); + } + + std::pair<iterator, iterator> + equal_range(const key_type& k) + { + return boost::unordered_detail::pair_cast< + iterator, iterator>( + table_.equal_range(k)); + } + + std::pair<const_iterator, const_iterator> + equal_range(const key_type& k) const + { + return boost::unordered_detail::pair_cast< + const_iterator, const_iterator>( + table_.equal_range(k)); + } + + // bucket interface + + size_type bucket_count() const + { + return table_.bucket_count_; + } + + size_type max_bucket_count() const + { + return table_.max_bucket_count(); + } + + size_type bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + size_type bucket(const key_type& k) const + { + return table_.bucket_index(k); + } + + local_iterator begin(size_type n) + { + return local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator begin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + local_iterator end(size_type) + { + return local_iterator(); + } + + const_local_iterator end(size_type) const + { + return const_local_iterator(); + } + + const_local_iterator cbegin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator cend(size_type) const + { + return const_local_iterator(); + } + + // hash policy + + float load_factor() const + { + return table_.load_factor(); + } + + float max_load_factor() const + { + return table_.mlf_; + } + + void max_load_factor(float m) + { + table_.max_load_factor(m); + } + + void rehash(size_type n) + { + table_.rehash(n); + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + friend bool operator==<K, T, H, P, A>( + unordered_map const&, unordered_map const&); + friend bool operator!=<K, T, H, P, A>( + unordered_map const&, unordered_map const&); +#endif + }; // class template unordered_map + + template <class K, class T, class H, class P, class A> + inline bool operator==(unordered_map<K, T, H, P, A> const& m1, + unordered_map<K, T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map<K,T,H,P,A> x; }; +#endif + return m1.table_.equals(m2.table_); + } + + template <class K, class T, class H, class P, class A> + inline bool operator!=(unordered_map<K, T, H, P, A> const& m1, + unordered_map<K, T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map<K,T,H,P,A> x; }; +#endif + return !m1.table_.equals(m2.table_); + } + + template <class K, class T, class H, class P, class A> + inline void swap(unordered_map<K, T, H, P, A> &m1, + unordered_map<K, T, H, P, A> &m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map<K,T,H,P,A> x; }; +#endif + m1.swap(m2); + } + + template <class K, class T, class H, class P, class A> + class unordered_multimap + { + public: + + typedef K key_type; + typedef std::pair<const K, T> value_type; + typedef T mapped_type; + typedef H hasher; + typedef P key_equal; + typedef A allocator_type; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + typedef BOOST_DEDUCED_TYPENAME + boost::unordered_detail::rebind_wrap< + allocator_type, value_type>::type + value_allocator; + + typedef boost::unordered_detail::multimap<K, H, P, + value_allocator> types; + typedef BOOST_DEDUCED_TYPENAME types::impl table; + + typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base; + + public: + + typedef BOOST_DEDUCED_TYPENAME + value_allocator::pointer pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_pointer const_pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::reference reference; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_reference const_reference; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + typedef boost::unordered_detail::hash_const_local_iterator< + value_allocator, boost::unordered_detail::grouped> + const_local_iterator; + typedef boost::unordered_detail::hash_local_iterator< + value_allocator, boost::unordered_detail::grouped> + local_iterator; + typedef boost::unordered_detail::hash_const_iterator< + value_allocator, boost::unordered_detail::grouped> + const_iterator; + typedef boost::unordered_detail::hash_iterator< + value_allocator, boost::unordered_detail::grouped> + iterator; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + table table_; + + BOOST_DEDUCED_TYPENAME types::iterator_base const& + get(const_iterator const& it) + { + return boost::unordered_detail::iterator_access::get(it); + } + + public: + + // construct/destroy/copy + + explicit unordered_multimap( + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(n, hf, eql, a) + { + } + + explicit unordered_multimap(allocator_type const& a) + : table_(boost::unordered_detail::default_bucket_count, + hasher(), key_equal(), a) + { + } + + unordered_multimap(unordered_multimap const& other, + allocator_type const& a) + : table_(other.table_, a) + { + } + + template <class InputIt> + unordered_multimap(InputIt f, InputIt l) + : table_(boost::unordered_detail::initial_size(f, l), + hasher(), key_equal(), allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_multimap(InputIt f, InputIt l, + size_type n, + const hasher &hf = hasher(), + const key_equal &eql = key_equal()) + : table_(boost::unordered_detail::initial_size(f, l, n), + hf, eql, allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_multimap(InputIt f, InputIt l, + size_type n, + const hasher &hf, + const key_equal &eql, + const allocator_type &a) + : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a) + { + table_.insert_range(f, l); + } + + ~unordered_multimap() {} + +#if defined(BOOST_HAS_RVALUE_REFS) + unordered_multimap(unordered_multimap&& other) + : table_(other.table_, boost::unordered_detail::move_tag()) + { + } + + unordered_multimap(unordered_multimap&& other, allocator_type const& a) + : table_(other.table_, a, boost::unordered_detail::move_tag()) + { + } + + unordered_multimap& operator=(unordered_multimap&& x) + { + table_.move(x.table_); + return *this; + } +#else + unordered_multimap(boost::unordered_detail::move_from< + unordered_multimap<K, T, H, P, A> + > other) + : table_(other.source.table_, boost::unordered_detail::move_tag()) + { + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593) + unordered_multimap& operator=(unordered_multimap x) + { + table_.move(x.table_); + return *this; + } +#endif +#endif + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + unordered_multimap(std::initializer_list<value_type> list, + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(boost::unordered_detail::initial_size( + list.begin(), list.end(), n), + hf, eql, a) + { + table_.insert_range(list.begin(), list.end()); + } + + unordered_multimap& operator=(std::initializer_list<value_type> list) + { + table_.clear(); + table_.insert_range(list.begin(), list.end()); + return *this; + } +#endif + + allocator_type get_allocator() const + { + return table_.node_alloc(); + } + + // size and capacity + + bool empty() const + { + return table_.size_ == 0; + } + + size_type size() const + { + return table_.size_; + } + + size_type max_size() const + { + return table_.max_size(); + } + + // iterators + + iterator begin() + { + return iterator(table_.begin()); + } + + const_iterator begin() const + { + return const_iterator(table_.begin()); + } + + iterator end() + { + return iterator(table_.end()); + } + + const_iterator end() const + { + return const_iterator(table_.end()); + } + + const_iterator cbegin() const + { + return const_iterator(table_.begin()); + } + + const_iterator cend() const + { + return const_iterator(table_.end()); + } + + // modifiers + +#if defined(BOOST_UNORDERED_STD_FORWARD) + template <class... Args> + iterator emplace(Args&&... args) + { + return iterator(table_.emplace(std::forward<Args>(args)...)); + } + + template <class... Args> + iterator emplace_hint(const_iterator, Args&&... args) + { + return iterator(table_.emplace(std::forward<Args>(args)...)); + } +#else + + #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) + iterator emplace(value_type const& v = value_type()) + { + return iterator(table_.emplace(v)); + } + + iterator emplace_hint(const_iterator, + value_type const& v = value_type()) + { + return iterator(table_.emplace(v)); + } + #endif + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + iterator emplace( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return iterator( \ + table_.emplace( \ + BOOST_UNORDERED_CALL_PARAMS(z, n) \ + )); \ + } \ + \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + iterator emplace_hint(const_iterator, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return iterator(table_.emplace( \ + BOOST_UNORDERED_CALL_PARAMS(z, n) \ + )); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_EMPLACE, _) + +#undef BOOST_UNORDERED_EMPLACE + +#endif + + iterator insert(const value_type& obj) + { + return iterator(table_.emplace(obj)); + } + + iterator insert(const_iterator, const value_type& obj) + { + return iterator(table_.emplace(obj)); + } + + template <class InputIt> + void insert(InputIt first, InputIt last) + { + table_.insert_range(first, last); + } + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type> list) + { + table_.insert_range(list.begin(), list.end()); + } +#endif + + iterator erase(const_iterator position) + { + return iterator(table_.erase_return_iterator(get(position))); + } + + size_type erase(const key_type& k) + { + return table_.erase_key(k); + } + + iterator erase(const_iterator first, const_iterator last) + { + return iterator(table_.erase_range(get(first), get(last))); + } + + void erase_return_void(const_iterator position) + { + table_.erase(get(position)); + } + + void clear() + { + table_.clear(); + } + + void swap(unordered_multimap& other) + { + table_.swap(other.table_); + } + + // observers + + hasher hash_function() const + { + return table_.hash_function(); + } + + key_equal key_eq() const + { + return table_.key_eq(); + } + + // lookup + + iterator find(const key_type& k) + { + return iterator(table_.find(k)); + } + + const_iterator find(const key_type& k) const + { + return const_iterator(table_.find(k)); + } + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + iterator find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) + { + return iterator(table_.find(k, hash, eq)); + } + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + const_iterator find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) const + { + return iterator(table_.find(k, hash, eq)); + } + + size_type count(const key_type& k) const + { + return table_.count(k); + } + + std::pair<iterator, iterator> + equal_range(const key_type& k) + { + return boost::unordered_detail::pair_cast< + iterator, iterator>( + table_.equal_range(k)); + } + + std::pair<const_iterator, const_iterator> + equal_range(const key_type& k) const + { + return boost::unordered_detail::pair_cast< + const_iterator, const_iterator>( + table_.equal_range(k)); + } + + // bucket interface + + size_type bucket_count() const + { + return table_.bucket_count_; + } + + size_type max_bucket_count() const + { + return table_.max_bucket_count(); + } + + size_type bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + size_type bucket(const key_type& k) const + { + return table_.bucket_index(k); + } + + local_iterator begin(size_type n) + { + return local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator begin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + local_iterator end(size_type) + { + return local_iterator(); + } + + const_local_iterator end(size_type) const + { + return const_local_iterator(); + } + + const_local_iterator cbegin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator cend(size_type) const + { + return const_local_iterator(); + } + + // hash policy + + float load_factor() const + { + return table_.load_factor(); + } + + float max_load_factor() const + { + return table_.mlf_; + } + + void max_load_factor(float m) + { + table_.max_load_factor(m); + } + + void rehash(size_type n) + { + table_.rehash(n); + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + friend bool operator==<K, T, H, P, A>( + unordered_multimap const&, unordered_multimap const&); + friend bool operator!=<K, T, H, P, A>( + unordered_multimap const&, unordered_multimap const&); +#endif + }; // class template unordered_multimap + + template <class K, class T, class H, class P, class A> + inline bool operator==(unordered_multimap<K, T, H, P, A> const& m1, + unordered_multimap<K, T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multimap<K,T,H,P,A> x; }; +#endif + return m1.table_.equals(m2.table_); + } + + template <class K, class T, class H, class P, class A> + inline bool operator!=(unordered_multimap<K, T, H, P, A> const& m1, + unordered_multimap<K, T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multimap<K,T,H,P,A> x; }; +#endif + return !m1.table_.equals(m2.table_); + } + + template <class K, class T, class H, class P, class A> + inline void swap(unordered_multimap<K, T, H, P, A> &m1, + unordered_multimap<K, T, H, P, A> &m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multimap<K,T,H,P,A> x; }; +#endif + m1.swap(m2); + } + +} // namespace boost + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif // BOOST_UNORDERED_UNORDERED_MAP_HPP_INCLUDED diff --git a/Utilities/BGL/boost/unordered/unordered_map_fwd.hpp b/Utilities/BGL/boost/unordered/unordered_map_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5e9bb0764520986d8e5c08726f2e1fd7388a75bf --- /dev/null +++ b/Utilities/BGL/boost/unordered/unordered_map_fwd.hpp @@ -0,0 +1,53 @@ + +// Copyright (C) 2008-2009 Daniel James. +// 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_UNORDERED_MAP_FWD_HPP_INCLUDED +#define BOOST_UNORDERED_MAP_FWD_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/config.hpp> +#include <memory> +#include <functional> +#include <boost/functional/hash_fwd.hpp> + +namespace boost +{ + template <class K, + class T, + class H = hash<K>, + class P = std::equal_to<K>, + class A = std::allocator<std::pair<const K, T> > > + class unordered_map; + template <class K, class T, class H, class P, class A> + bool operator==(unordered_map<K, T, H, P, A> const&, + unordered_map<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + bool operator!=(unordered_map<K, T, H, P, A> const&, + unordered_map<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + void swap(unordered_map<K, T, H, P, A>&, + unordered_map<K, T, H, P, A>&); + + template <class K, + class T, + class H = hash<K>, + class P = std::equal_to<K>, + class A = std::allocator<std::pair<const K, T> > > + class unordered_multimap; + template <class K, class T, class H, class P, class A> + bool operator==(unordered_multimap<K, T, H, P, A> const&, + unordered_multimap<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + bool operator!=(unordered_multimap<K, T, H, P, A> const&, + unordered_multimap<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + void swap(unordered_multimap<K, T, H, P, A>&, + unordered_multimap<K, T, H, P, A>&); +} + +#endif diff --git a/Utilities/BGL/boost/unordered/unordered_set.hpp b/Utilities/BGL/boost/unordered/unordered_set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..87c1011b6debcd4a120adeaad7381cbeab79838c --- /dev/null +++ b/Utilities/BGL/boost/unordered/unordered_set.hpp @@ -0,0 +1,1027 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2009 Daniel James. +// 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/unordered for documentation + +#ifndef BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED +#define BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/unordered/unordered_set_fwd.hpp> +#include <boost/functional/hash.hpp> +#include <boost/unordered/detail/allocator_helpers.hpp> +#include <boost/unordered/detail/equivalent.hpp> +#include <boost/unordered/detail/unique.hpp> + +#if !defined(BOOST_HAS_RVALUE_REFS) +#include <boost/unordered/detail/move.hpp> +#endif + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) +#include <initializer_list> +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC >= 1400 +#pragma warning(disable:4396) //the inline specifier cannot be used when a + // friend declaration refers to a specialization + // of a function template +#endif +#endif + +namespace boost +{ + template <class T, class H, class P, class A> + class unordered_set + { + public: + + typedef T key_type; + typedef T value_type; + typedef H hasher; + typedef P key_equal; + typedef A allocator_type; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + typedef BOOST_DEDUCED_TYPENAME + boost::unordered_detail::rebind_wrap< + allocator_type, value_type>::type + value_allocator; + + typedef boost::unordered_detail::set<H, P, + value_allocator> types; + typedef BOOST_DEDUCED_TYPENAME types::impl table; + + typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base; + + public: + + typedef BOOST_DEDUCED_TYPENAME + value_allocator::pointer pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_pointer const_pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::reference reference; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_reference const_reference; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + typedef boost::unordered_detail::hash_const_local_iterator< + value_allocator, boost::unordered_detail::ungrouped> + const_local_iterator; + typedef boost::unordered_detail::hash_const_iterator< + value_allocator, boost::unordered_detail::ungrouped> + const_iterator; + typedef const_local_iterator local_iterator; + typedef const_iterator iterator; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + table table_; + + BOOST_DEDUCED_TYPENAME types::iterator_base const& + get(const_iterator const& it) + { + return boost::unordered_detail::iterator_access::get(it); + } + + public: + + // construct/destroy/copy + + explicit unordered_set( + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(n, hf, eql, a) + { + } + + explicit unordered_set(allocator_type const& a) + : table_(boost::unordered_detail::default_bucket_count, + hasher(), key_equal(), a) + { + } + + unordered_set(unordered_set const& other, allocator_type const& a) + : table_(other.table_, a) + { + } + + template <class InputIt> + unordered_set(InputIt f, InputIt l) + : table_(boost::unordered_detail::initial_size(f, l), + hasher(), key_equal(), allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_set(InputIt f, InputIt l, size_type n, + const hasher &hf = hasher(), + const key_equal &eql = key_equal()) + : table_(boost::unordered_detail::initial_size(f, l, n), + hf, eql, allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_set(InputIt f, InputIt l, size_type n, + const hasher &hf, + const key_equal &eql, + const allocator_type &a) + : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a) + { + table_.insert_range(f, l); + } + + ~unordered_set() {} + +#if defined(BOOST_HAS_RVALUE_REFS) + unordered_set(unordered_set&& other) + : table_(other.table_, boost::unordered_detail::move_tag()) + { + } + + unordered_set(unordered_set&& other, allocator_type const& a) + : table_(other.table_, a, boost::unordered_detail::move_tag()) + { + } + + unordered_set& operator=(unordered_set&& x) + { + table_.move(x.table_); + return *this; + } +#else + unordered_set(boost::unordered_detail::move_from< + unordered_set<T, H, P, A> + > other) + : table_(other.source.table_, boost::unordered_detail::move_tag()) + { + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593) + unordered_set& operator=(unordered_set x) + { + table_.move(x.table_); + return *this; + } +#endif +#endif + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + unordered_set(std::initializer_list<value_type> list, + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(boost::unordered_detail::initial_size( + list.begin(), list.end(), n), + hf, eql, a) + { + table_.insert_range(list.begin(), list.end()); + } + + unordered_set& operator=(std::initializer_list<value_type> list) + { + table_.clear(); + table_.insert_range(list.begin(), list.end()); + return *this; + } +#endif + + allocator_type get_allocator() const + { + return table_.node_alloc(); + } + + // size and capacity + + bool empty() const + { + return table_.size_ == 0; + } + + size_type size() const + { + return table_.size_; + } + + size_type max_size() const + { + return table_.max_size(); + } + + // iterators + + iterator begin() + { + return iterator(table_.begin()); + } + + const_iterator begin() const + { + return const_iterator(table_.begin()); + } + + iterator end() + { + return iterator(table_.end()); + } + + const_iterator end() const + { + return const_iterator(table_.end()); + } + + const_iterator cbegin() const + { + return const_iterator(table_.begin()); + } + + const_iterator cend() const + { + return const_iterator(table_.end()); + } + + // modifiers + +#if defined(BOOST_UNORDERED_STD_FORWARD) + template <class... Args> + std::pair<iterator, bool> emplace(Args&&... args) + { + return boost::unordered_detail::pair_cast<iterator, bool>( + table_.emplace(std::forward<Args>(args)...)); + } + + template <class... Args> + iterator emplace_hint(const_iterator, Args&&... args) + { + return iterator(table_.emplace(std::forward<Args>(args)...).first); + } +#else + + std::pair<iterator, bool> emplace(value_type const& v = value_type()) + { + return boost::unordered_detail::pair_cast<iterator, bool>( + table_.emplace(v)); + } + + iterator emplace_hint(const_iterator, + value_type const& v = value_type()) + { + return iterator(table_.emplace(v).first); + } + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + std::pair<iterator, bool> emplace( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return boost::unordered_detail::pair_cast<iterator, bool>( \ + table_.emplace( \ + BOOST_UNORDERED_CALL_PARAMS(z, n) \ + )); \ + } \ + \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + iterator emplace_hint(const_iterator, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return iterator(table_.emplace( \ + BOOST_UNORDERED_CALL_PARAMS(z, n)).first); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_EMPLACE, _) + +#undef BOOST_UNORDERED_EMPLACE + +#endif + + std::pair<iterator, bool> insert(const value_type& obj) + { + return boost::unordered_detail::pair_cast<iterator, bool>( + table_.emplace(obj)); + } + + iterator insert(const_iterator, const value_type& obj) + { + return iterator(table_.emplace(obj).first); + } + + template <class InputIt> + void insert(InputIt first, InputIt last) + { + table_.insert_range(first, last); + } + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type> list) + { + table_.insert_range(list.begin(), list.end()); + } +#endif + + iterator erase(const_iterator position) + { + return iterator(table_.erase_return_iterator(get(position))); + } + + size_type erase(const key_type& k) + { + return table_.erase_key(k); + } + + iterator erase(const_iterator first, const_iterator last) + { + return iterator(table_.erase_range(get(first), get(last))); + } + + void erase_return_void(const_iterator position) + { + table_.erase(get(position)); + } + + void clear() + { + table_.clear(); + } + + void swap(unordered_set& other) + { + table_.swap(other.table_); + } + + // observers + + hasher hash_function() const + { + return table_.hash_function(); + } + + key_equal key_eq() const + { + return table_.key_eq(); + } + + // lookup + + const_iterator find(const key_type& k) const + { + return const_iterator(table_.find(k)); + } + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + const_iterator find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) const + { + return iterator(table_.find(k, hash, eq)); + } + size_type count(const key_type& k) const + { + return table_.count(k); + } + + std::pair<const_iterator, const_iterator> + equal_range(const key_type& k) const + { + return boost::unordered_detail::pair_cast< + const_iterator, const_iterator>( + table_.equal_range(k)); + } + + // bucket interface + + size_type bucket_count() const + { + return table_.bucket_count_; + } + + size_type max_bucket_count() const + { + return table_.max_bucket_count(); + } + + size_type bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + size_type bucket(const key_type& k) const + { + return table_.bucket_index(k); + } + + local_iterator begin(size_type n) + { + return local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator begin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + local_iterator end(size_type) + { + return local_iterator(); + } + + const_local_iterator end(size_type) const + { + return const_local_iterator(); + } + + const_local_iterator cbegin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator cend(size_type) const + { + return const_local_iterator(); + } + + // hash policy + + float load_factor() const + { + return table_.load_factor(); + } + + float max_load_factor() const + { + return table_.mlf_; + } + + void max_load_factor(float m) + { + table_.max_load_factor(m); + } + + void rehash(size_type n) + { + table_.rehash(n); + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + friend bool operator==<T, H, P, A>( + unordered_set const&, unordered_set const&); + friend bool operator!=<T, H, P, A>( + unordered_set const&, unordered_set const&); +#endif + }; // class template unordered_set + + template <class T, class H, class P, class A> + inline bool operator==(unordered_set<T, H, P, A> const& m1, + unordered_set<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_set<T,H,P,A> x; }; +#endif + return m1.table_.equals(m2.table_); + } + + template <class T, class H, class P, class A> + inline bool operator!=(unordered_set<T, H, P, A> const& m1, + unordered_set<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_set<T,H,P,A> x; }; +#endif + return !m1.table_.equals(m2.table_); + } + + template <class T, class H, class P, class A> + inline void swap(unordered_set<T, H, P, A> &m1, + unordered_set<T, H, P, A> &m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_set<T,H,P,A> x; }; +#endif + m1.swap(m2); + } + + template <class T, class H, class P, class A> + class unordered_multiset + { + public: + + typedef T key_type; + typedef T value_type; + typedef H hasher; + typedef P key_equal; + typedef A allocator_type; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + typedef BOOST_DEDUCED_TYPENAME + boost::unordered_detail::rebind_wrap< + allocator_type, value_type>::type + value_allocator; + + typedef boost::unordered_detail::multiset<H, P, + value_allocator> types; + typedef BOOST_DEDUCED_TYPENAME types::impl table; + + typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base; + + public: + + typedef BOOST_DEDUCED_TYPENAME + value_allocator::pointer pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_pointer const_pointer; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::reference reference; + typedef BOOST_DEDUCED_TYPENAME + value_allocator::const_reference const_reference; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + typedef boost::unordered_detail::hash_const_local_iterator< + value_allocator, boost::unordered_detail::grouped> + const_local_iterator; + typedef boost::unordered_detail::hash_const_iterator< + value_allocator, boost::unordered_detail::grouped> + const_iterator; + typedef const_local_iterator local_iterator; + typedef const_iterator iterator; + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + private: +#endif + + table table_; + + BOOST_DEDUCED_TYPENAME types::iterator_base const& + get(const_iterator const& it) + { + return boost::unordered_detail::iterator_access::get(it); + } + + public: + + // construct/destroy/copy + + explicit unordered_multiset( + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(n, hf, eql, a) + { + } + + explicit unordered_multiset(allocator_type const& a) + : table_(boost::unordered_detail::default_bucket_count, + hasher(), key_equal(), a) + { + } + + unordered_multiset(unordered_multiset const& other, + allocator_type const& a) + : table_(other.table_, a) + { + } + + template <class InputIt> + unordered_multiset(InputIt f, InputIt l) + : table_(boost::unordered_detail::initial_size(f, l), + hasher(), key_equal(), allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_multiset(InputIt f, InputIt l, size_type n, + const hasher &hf = hasher(), + const key_equal &eql = key_equal()) + : table_(boost::unordered_detail::initial_size(f, l, n), + hf, eql, allocator_type()) + { + table_.insert_range(f, l); + } + + template <class InputIt> + unordered_multiset(InputIt f, InputIt l, size_type n, + const hasher &hf, + const key_equal &eql, + const allocator_type &a) + : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a) + { + table_.insert_range(f, l); + } + + ~unordered_multiset() {} + +#if defined(BOOST_HAS_RVALUE_REFS) + unordered_multiset(unordered_multiset&& other) + : table_(other.table_, boost::unordered_detail::move_tag()) + { + } + + unordered_multiset(unordered_multiset&& other, allocator_type const& a) + : table_(other.table_, a, boost::unordered_detail::move_tag()) + { + } + + unordered_multiset& operator=(unordered_multiset&& x) + { + table_.move(x.table_); + return *this; + } +#else + unordered_multiset(boost::unordered_detail::move_from< + unordered_multiset<T, H, P, A> + > other) + : table_(other.source.table_, boost::unordered_detail::move_tag()) + { + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593) + unordered_multiset& operator=(unordered_multiset x) + { + table_.move(x.table_); + return *this; + } +#endif +#endif + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + unordered_multiset(std::initializer_list<value_type> list, + size_type n = boost::unordered_detail::default_bucket_count, + const hasher &hf = hasher(), + const key_equal &eql = key_equal(), + const allocator_type &a = allocator_type()) + : table_(boost::unordered_detail::initial_size( + list.begin(), list.end(), n), + hf, eql, a) + { + table_.insert_range(list.begin(), list.end()); + } + + unordered_multiset& operator=(std::initializer_list<value_type> list) + { + table_.clear(); + table_.insert_range(list.begin(), list.end()); + return *this; + } +#endif + + allocator_type get_allocator() const + { + return table_.node_alloc(); + } + + // size and capacity + + bool empty() const + { + return table_.size_ == 0; + } + + size_type size() const + { + return table_.size_; + } + + size_type max_size() const + { + return table_.max_size(); + } + + // iterators + + iterator begin() + { + return iterator(table_.begin()); + } + + const_iterator begin() const + { + return const_iterator(table_.begin()); + } + + iterator end() + { + return iterator(table_.end()); + } + + const_iterator end() const + { + return const_iterator(table_.end()); + } + + const_iterator cbegin() const + { + return const_iterator(table_.begin()); + } + + const_iterator cend() const + { + return const_iterator(table_.end()); + } + + // modifiers + +#if defined(BOOST_UNORDERED_STD_FORWARD) + template <class... Args> + iterator emplace(Args&&... args) + { + return iterator(table_.emplace(std::forward<Args>(args)...)); + } + + template <class... Args> + iterator emplace_hint(const_iterator, Args&&... args) + { + return iterator(table_.emplace(std::forward<Args>(args)...)); + } +#else + + iterator emplace(value_type const& v = value_type()) + { + return iterator(table_.emplace(v)); + } + + iterator emplace_hint(const_iterator, + value_type const& v = value_type()) + { + return iterator(table_.emplace(v)); + } + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + iterator emplace( \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return iterator( \ + table_.emplace(BOOST_UNORDERED_CALL_PARAMS(z, n))); \ + } \ + \ + template < \ + BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ + > \ + iterator emplace_hint(const_iterator, \ + BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ + ) \ + { \ + return iterator(table_.emplace( \ + BOOST_UNORDERED_CALL_PARAMS(z, n) \ + )); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_EMPLACE, _) + +#undef BOOST_UNORDERED_EMPLACE + +#endif + + iterator insert(const value_type& obj) + { + return iterator(table_.emplace(obj)); + } + + iterator insert(const_iterator, const value_type& obj) + { + return iterator(table_.emplace(obj)); + } + + template <class InputIt> + void insert(InputIt first, InputIt last) + { + table_.insert_range(first, last); + } + +#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type> list) + { + table_.insert_range(list.begin(), list.end()); + } +#endif + + iterator erase(const_iterator position) + { + return iterator(table_.erase_return_iterator(get(position))); + } + + size_type erase(const key_type& k) + { + return table_.erase_key(k); + } + + iterator erase(const_iterator first, const_iterator last) + { + return iterator(table_.erase_range(get(first), get(last))); + } + + void erase_return_void(const_iterator position) + { + table_.erase(get(position)); + } + + void clear() + { + table_.clear(); + } + + void swap(unordered_multiset& other) + { + table_.swap(other.table_); + } + + // observers + + hasher hash_function() const + { + return table_.hash_function(); + } + + key_equal key_eq() const + { + return table_.key_eq(); + } + + // lookup + + const_iterator find(const key_type& k) const + { + return const_iterator(table_.find(k)); + } + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + const_iterator find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) const + { + return iterator(table_.find(k, hash, eq)); + } + + size_type count(const key_type& k) const + { + return table_.count(k); + } + + std::pair<const_iterator, const_iterator> + equal_range(const key_type& k) const + { + return boost::unordered_detail::pair_cast< + const_iterator, const_iterator>( + table_.equal_range(k)); + } + + // bucket interface + + size_type bucket_count() const + { + return table_.bucket_count_; + } + + size_type max_bucket_count() const + { + return table_.max_bucket_count(); + } + + size_type bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + size_type bucket(const key_type& k) const + { + return table_.bucket_index(k); + } + + local_iterator begin(size_type n) + { + return local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator begin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + local_iterator end(size_type) + { + return local_iterator(); + } + + const_local_iterator end(size_type) const + { + return const_local_iterator(); + } + + const_local_iterator cbegin(size_type n) const + { + return const_local_iterator(table_.bucket_begin(n)); + } + + const_local_iterator cend(size_type) const + { + return const_local_iterator(); + } + + // hash policy + + float load_factor() const + { + return table_.load_factor(); + } + + float max_load_factor() const + { + return table_.mlf_; + } + + void max_load_factor(float m) + { + table_.max_load_factor(m); + } + + void rehash(size_type n) + { + table_.rehash(n); + } + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + friend bool operator==<T, H, P, A>( + unordered_multiset const&, unordered_multiset const&); + friend bool operator!=<T, H, P, A>( + unordered_multiset const&, unordered_multiset const&); +#endif + }; // class template unordered_multiset + + template <class T, class H, class P, class A> + inline bool operator==(unordered_multiset<T, H, P, A> const& m1, + unordered_multiset<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multiset<T,H,P,A> x; }; +#endif + return m1.table_.equals(m2.table_); + } + + template <class T, class H, class P, class A> + inline bool operator!=(unordered_multiset<T, H, P, A> const& m1, + unordered_multiset<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multiset<T,H,P,A> x; }; +#endif + return !m1.table_.equals(m2.table_); + } + + template <class T, class H, class P, class A> + inline void swap(unordered_multiset<T, H, P, A> &m1, + unordered_multiset<T, H, P, A> &m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_multiset<T,H,P,A> x; }; +#endif + m1.swap(m2); + } + +} // namespace boost + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif // BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED diff --git a/Utilities/BGL/boost/unordered/unordered_set_fwd.hpp b/Utilities/BGL/boost/unordered/unordered_set_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8000eb1420a26375457207627c57cec661021d6d --- /dev/null +++ b/Utilities/BGL/boost/unordered/unordered_set_fwd.hpp @@ -0,0 +1,51 @@ + +// Copyright (C) 2008-2009 Daniel James. +// 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_UNORDERED_SET_FWD_HPP_INCLUDED +#define BOOST_UNORDERED_SET_FWD_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/config.hpp> +#include <memory> +#include <functional> +#include <boost/functional/hash_fwd.hpp> + +namespace boost +{ + template <class T, + class H = hash<T>, + class P = std::equal_to<T>, + class A = std::allocator<T> > + class unordered_set; + template <class T, class H, class P, class A> + bool operator==(unordered_set<T, H, P, A> const&, + unordered_set<T, H, P, A> const&); + template <class T, class H, class P, class A> + bool operator!=(unordered_set<T, H, P, A> const&, + unordered_set<T, H, P, A> const&); + template <class T, class H, class P, class A> + void swap(unordered_set<T, H, P, A> &m1, + unordered_set<T, H, P, A> &m2); + + template <class T, + class H = hash<T>, + class P = std::equal_to<T>, + class A = std::allocator<T> > + class unordered_multiset; + template <class T, class H, class P, class A> + bool operator==(unordered_multiset<T, H, P, A> const&, + unordered_multiset<T, H, P, A> const&); + template <class T, class H, class P, class A> + bool operator!=(unordered_multiset<T, H, P, A> const&, + unordered_multiset<T, H, P, A> const&); + template <class T, class H, class P, class A> + void swap(unordered_multiset<T, H, P, A> &m1, + unordered_multiset<T, H, P, A> &m2); +} + +#endif diff --git a/Utilities/BGL/boost/unordered_set.hpp b/Utilities/BGL/boost/unordered_set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..98c3ce1d7dd15636d9ff84547ab7942a6a0f0a4f --- /dev/null +++ b/Utilities/BGL/boost/unordered_set.hpp @@ -0,0 +1,18 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2008 Daniel James. +// 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/unordered for documentation + +#ifndef BOOST_UNORDERED_SET_HPP_INCLUDED +#define BOOST_UNORDERED_SET_HPP_INCLUDED + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/unordered/unordered_set.hpp> + +#endif // BOOST_UNORDERED_SET_HPP_INCLUDED diff --git a/Utilities/BGL/boost/utility.hpp b/Utilities/BGL/boost/utility.hpp deleted file mode 100644 index 02ca546ed9d376ac648d42eef7b8233f1bf20d4d..0000000000000000000000000000000000000000 --- a/Utilities/BGL/boost/utility.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Boost utility.hpp header file -------------------------------------------// - -// Copyright 1999-2003 Aleksey Gurtovoy. Use, modification, and distribution are -// subject to the Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.) - -// See <http://www.boost.org/libs/butility/> for the library's home page. - -#ifndef BOOST_UTILITY_HPP -#define BOOST_UTILITY_HPP - -#include <boost/butility/addressof.hpp> -#include <boost/butility/base_from_member.hpp> -#include <boost/butility/enable_if.hpp> -#include <boost/checked_delete.hpp> -#include <boost/next_prior.hpp> -#include <boost/noncopyable.hpp> - -#endif // BOOST_UTILITY_HPP diff --git a/Utilities/BGL/boost/utility/addressof.hpp b/Utilities/BGL/boost/utility/addressof.hpp new file mode 100644 index 0000000000000000000000000000000000000000..95cd92fca9bb940ae0f9a289268a0fe4a9305b68 --- /dev/null +++ b/Utilities/BGL/boost/utility/addressof.hpp @@ -0,0 +1,102 @@ +// Copyright (C) 2002 Brad King (brad.king@kitware.com) +// Douglas Gregor (gregod@cs.rpi.edu) +// +// Copyright (C) 2002, 2008 Peter Dimov +// +// 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) + +// For more information, see http://www.boost.org + +#ifndef BOOST_UTILITY_ADDRESSOF_HPP +# define BOOST_UTILITY_ADDRESSOF_HPP + +# include <boost/config.hpp> +# include <boost/detail/workaround.hpp> + +namespace boost +{ + +namespace detail +{ + +template<class T> struct addr_impl_ref +{ + T & v_; + + inline addr_impl_ref( T & v ): v_( v ) {} + inline operator T& () const { return v_; } + +private: + addr_impl_ref & operator=(const addr_impl_ref &); +}; + +template<class T> struct addressof_impl +{ + static inline T * f( T & v, long ) + { + return reinterpret_cast<T*>( + &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); + } + + static inline T * f( T * v, int ) + { + return v; + } +}; + +} // namespace detail + +template<class T> T * addressof( T & v ) +{ +#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) + + return boost::detail::addressof_impl<T>::f( v, 0 ); + +#else + + return boost::detail::addressof_impl<T>::f( boost::detail::addr_impl_ref<T>( v ), 0 ); + +#endif +} + +#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) ) + +namespace detail +{ + +template<class T> struct addressof_addp +{ + typedef T * type; +}; + +} // namespace detail + +template< class T, std::size_t N > +typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] ) +{ + return &t; +} + +#endif + +// Borland doesn't like casting an array reference to a char reference +// but these overloads work around the problem. +#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +template<typename T,std::size_t N> +T (*addressof(T (&t)[N]))[N] +{ + return reinterpret_cast<T(*)[N]>(&t); +} + +template<typename T,std::size_t N> +const T (*addressof(const T (&t)[N]))[N] +{ + return reinterpret_cast<const T(*)[N]>(&t); +} +#endif + +} // namespace boost + +#endif // BOOST_UTILITY_ADDRESSOF_HPP diff --git a/Utilities/BGL/boost/butility/base_from_member.hpp b/Utilities/BGL/boost/utility/base_from_member.hpp similarity index 97% rename from Utilities/BGL/boost/butility/base_from_member.hpp rename to Utilities/BGL/boost/utility/base_from_member.hpp index 893133e6b51ab7292ff2c9322280ff8a5744cea4..04aabb59e26ee92a21bfdfe53adb2a28198a4520 100644 --- a/Utilities/BGL/boost/butility/base_from_member.hpp +++ b/Utilities/BGL/boost/utility/base_from_member.hpp @@ -5,7 +5,7 @@ // accompanying file LICENSE_1_0.txt or a copy at // <http://www.boost.org/LICENSE_1_0.txt>.) -// See <http://www.boost.org/libs/butility/> for the library's home page. +// See <http://www.boost.org/libs/utility/> for the library's home page. #ifndef BOOST_UTILITY_BASE_FROM_MEMBER_HPP #define BOOST_UTILITY_BASE_FROM_MEMBER_HPP diff --git a/Utilities/BGL/boost/utility/binary.hpp b/Utilities/BGL/boost/utility/binary.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8cef1468e5b56ae99d5d1d14bded5ac957105263 --- /dev/null +++ b/Utilities/BGL/boost/utility/binary.hpp @@ -0,0 +1,708 @@ +/*============================================================================= + Copyright (c) 2005 Matthew Calabrese + + 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) +==============================================================================*/ + +#ifndef BOOST_UTILITY_BINARY_HPP +#define BOOST_UTILITY_BINARY_HPP + +/*============================================================================= + + Binary Literal Utility + ______________________ + + + The following code works by converting the input bit pattern into a + Boost.Preprocessor sequence, then converting groupings of 3 bits each into + the corresponding octal digit, and finally concatenating all of the digits + together along with a leading zero. This yields a standard octal literal + with the desired value as specified in bits. + +==============================================================================*/ + +#include <boost/preprocessor/control/deduce_d.hpp> +#include <boost/preprocessor/facilities/identity.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/seq/cat.hpp> +#include <boost/preprocessor/seq/transform.hpp> +#include <boost/preprocessor/arithmetic/mod.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/control/while.hpp> + +#define BOOST_BINARY( bit_groupings ) \ + BOOST_BINARY_LITERAL_D( BOOST_PP_DEDUCE_D(), bit_groupings ) + +#define BOOST_BINARY_U( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, U ) + +#define BOOST_BINARY_L( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, L ) + +#define BOOST_BINARY_UL( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, UL ) + +#define BOOST_BINARY_LU( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LU ) + +#define BOOST_BINARY_LL( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LL ) + +#define BOOST_BINARY_ULL( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, ULL ) + +#define BOOST_BINARY_LLU( bit_groupings ) \ + BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, LLU ) + +#define BOOST_SUFFIXED_BINARY_LITERAL( bit_groupings, suffix ) \ + BOOST_SUFFIXED_BINARY_LITERAL_D( BOOST_PP_DEDUCE_D(), bit_groupings, suffix ) + +#define BOOST_SUFFIXED_BINARY_LITERAL_D( d, bit_groupings, suffix ) \ + BOOST_PP_CAT( BOOST_BINARY_LITERAL_D( d, bit_groupings ), suffix ) + +#define BOOST_BINARY_LITERAL_D( d, bit_groupings ) \ + BOOST_PP_SEQ_CAT \ + ( (0) BOOST_DETAIL_CREATE_BINARY_LITERAL_OCTAL_SEQUENCE( d, bit_groupings ) \ + ) + +#define BOOST_DETAIL_CREATE_BINARY_LITERAL_OCTAL_SEQUENCE( d, bit_groupings ) \ + BOOST_PP_SEQ_TRANSFORM \ + ( BOOST_DETAIL_TRIPLE_TO_OCTAL_OPERATION \ + , BOOST_PP_NIL \ + , BOOST_PP_IDENTITY( BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_TRIPLE_SEQUENCE )()\ + ( BOOST_DETAIL_COMPLETE_TRIPLE_SEQUENCE \ + ( \ + d \ + , BOOST_DETAIL_CREATE_BINARY_LITERAL_BIT_SEQUENCE( d, bit_groupings ) \ + ) \ + ) \ + ) + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_TRIPLE_SEQUENCE( bit_sequence ) \ + BOOST_PP_CAT \ + ( BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1 bit_sequence \ + , END_BIT \ + ) + +#define BOOST_DETAIL_BITS_PER_OCTIT 3 + +#define BOOST_DETAIL_COMPLETE_TRIPLE_SEQUENCE( d, incomplete_nibble_sequence ) \ + BOOST_PP_CAT \ + ( BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_ \ + , BOOST_PP_MOD_D( d \ + , BOOST_PP_SEQ_SIZE( incomplete_nibble_sequence ) \ + , BOOST_DETAIL_BITS_PER_OCTIT \ + ) \ + ) \ + incomplete_nibble_sequence + +#define BOOST_DETAIL_FIXED_COMPL( bit ) \ + BOOST_PP_CAT( BOOST_DETAIL_FIXED_COMPL_, bit ) + +#define BOOST_DETAIL_FIXED_COMPL_0 1 + +#define BOOST_DETAIL_FIXED_COMPL_1 0 + +#define BOOST_DETAIL_CREATE_BINARY_LITERAL_BIT_SEQUENCE( d, bit_groupings ) \ + BOOST_PP_EMPTY \ + BOOST_PP_CAT( BOOST_PP_WHILE_, d ) \ + ( BOOST_DETAIL_BINARY_LITERAL_PREDICATE \ + , BOOST_DETAIL_BINARY_LITERAL_OPERATION \ + , bit_groupings () \ + ) + +#define BOOST_DETAIL_BINARY_LITERAL_PREDICATE( d, state ) \ + BOOST_DETAIL_FIXED_COMPL( BOOST_DETAIL_IS_NULLARY_ARGS( state ) ) + +#define BOOST_DETAIL_BINARY_LITERAL_OPERATION( d, state ) \ + BOOST_DETAIL_SPLIT_AND_SWAP \ + ( BOOST_PP_CAT( BOOST_DETAIL_BINARY_LITERAL_ELEMENT_, state ) ) + +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_OPERATION( s, dummy_param, tuple ) \ + BOOST_DETAIL_TERNARY_TRIPLE_TO_OCTAL tuple + +#define BOOST_DETAIL_TERNARY_TRIPLE_TO_OCTAL( bit2, bit1, bit0 ) \ + BOOST_DETAIL_TRIPLE_TO_OCTAL_ ## bit2 ## bit1 ## bit0 + +#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_1 (0)(0) +#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_2 (0) +#define BOOST_DETAIL_CREATE_TRIPLE_COMPLETION_SEQUENCE_0 + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1END_BIT + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1( bit ) \ + ( ( bit, BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_2 + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_2( bit ) \ + bit, BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_3 + +#define BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_3( bit ) \ + bit ) ) BOOST_DETAIL_CONVERT_BIT_SEQUENCE_TO_PARENTHETIC_TUPLE_1 + +#define BOOST_DETAIL_SPLIT_AND_SWAP( params ) \ + BOOST_PP_IDENTITY( BOOST_DETAIL_SPLIT_AND_SWAP_PARAMS )()( params ) + +#define BOOST_DETAIL_SPLIT_AND_SWAP_PARAMS( first_param, second_param ) \ + second_param first_param + +#define BOOST_DETAIL_LEFT_OF_COMMA( params ) \ + BOOST_PP_IDENTITY( BOOST_DETAIL_FIRST_MACRO_PARAM )()( params ) + +#define BOOST_DETAIL_FIRST_MACRO_PARAM( first_param, second_param ) \ + first_param + +/* Begin derived concepts from Chaos by Paul Mensonides */ + +#define BOOST_DETAIL_IS_NULLARY_ARGS( param ) \ + BOOST_DETAIL_LEFT_OF_COMMA \ + ( BOOST_PP_CAT( BOOST_DETAIL_IS_NULLARY_ARGS_R_ \ + , BOOST_DETAIL_IS_NULLARY_ARGS_C param \ + ) \ + ) + +#define BOOST_DETAIL_IS_NULLARY_ARGS_C() \ + 1 + +#define BOOST_DETAIL_IS_NULLARY_ARGS_R_1 \ + 1, BOOST_PP_NIL + +#define BOOST_DETAIL_IS_NULLARY_ARGS_R_BOOST_DETAIL_IS_NULLARY_ARGS_C \ + 0, BOOST_PP_NIL + +/* End derived concepts from Chaos by Paul Mensonides */ + +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_000 0 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_001 1 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_010 2 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_011 3 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_100 4 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_101 5 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_110 6 +#define BOOST_DETAIL_TRIPLE_TO_OCTAL_111 7 + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0 (0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1 (1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00 (0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01 (0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10 (1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11 (1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00 (0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01 (0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10 (1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11 (1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000 (0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001 (0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010 (0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011 (0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100 (1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101 (1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110 (1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111 (1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000 (0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001 (0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010 (0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011 (0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100 (0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101 (0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110 (0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111 (0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000 (1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001 (1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010 (1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011 (1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100 (1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101 (1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110 (1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111 (1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000 (0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001 (0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010 (0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011 (0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100 (0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101 (0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110 (0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111 (0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000 (0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001 (0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010 (0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011 (0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100 (0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101 (0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110 (0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111 (0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000 (1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001 (1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010 (1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011 (1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100 (1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101 (1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110 (1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111 (1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000 (1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001 (1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010 (1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011 (1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100 (1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101 (1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110 (1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111 (1)(1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000000 (0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000001 (0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000010 (0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000011 (0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000100 (0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000101 (0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000110 (0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_000111 (0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001000 (0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001001 (0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001010 (0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001011 (0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001100 (0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001101 (0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001110 (0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_001111 (0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010000 (0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010001 (0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010010 (0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010011 (0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010100 (0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010101 (0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010110 (0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_010111 (0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011000 (0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011001 (0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011010 (0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011011 (0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011100 (0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011101 (0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011110 (0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_011111 (0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100000 (1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100001 (1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100010 (1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100011 (1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100100 (1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100101 (1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100110 (1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_100111 (1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101000 (1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101001 (1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101010 (1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101011 (1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101100 (1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101101 (1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101110 (1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_101111 (1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110000 (1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110001 (1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110010 (1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110011 (1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110100 (1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110101 (1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110110 (1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_110111 (1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111000 (1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111001 (1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111010 (1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111011 (1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111100 (1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111101 (1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111110 (1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_111111 (1)(1)(1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000000 (0)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000001 (0)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000010 (0)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000011 (0)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000100 (0)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000101 (0)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000110 (0)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0000111 (0)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001000 (0)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001001 (0)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001010 (0)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001011 (0)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001100 (0)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001101 (0)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001110 (0)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0001111 (0)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010000 (0)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010001 (0)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010010 (0)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010011 (0)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010100 (0)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010101 (0)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010110 (0)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0010111 (0)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011000 (0)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011001 (0)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011010 (0)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011011 (0)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011100 (0)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011101 (0)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011110 (0)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0011111 (0)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100000 (0)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100001 (0)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100010 (0)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100011 (0)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100100 (0)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100101 (0)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100110 (0)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0100111 (0)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101000 (0)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101001 (0)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101010 (0)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101011 (0)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101100 (0)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101101 (0)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101110 (0)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0101111 (0)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110000 (0)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110001 (0)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110010 (0)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110011 (0)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110100 (0)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110101 (0)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110110 (0)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0110111 (0)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111000 (0)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111001 (0)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111010 (0)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111011 (0)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111100 (0)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111101 (0)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111110 (0)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_0111111 (0)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000000 (1)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000001 (1)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000010 (1)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000011 (1)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000100 (1)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000101 (1)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000110 (1)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1000111 (1)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001000 (1)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001001 (1)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001010 (1)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001011 (1)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001100 (1)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001101 (1)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001110 (1)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1001111 (1)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010000 (1)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010001 (1)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010010 (1)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010011 (1)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010100 (1)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010101 (1)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010110 (1)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1010111 (1)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011000 (1)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011001 (1)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011010 (1)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011011 (1)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011100 (1)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011101 (1)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011110 (1)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1011111 (1)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100000 (1)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100001 (1)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100010 (1)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100011 (1)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100100 (1)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100101 (1)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100110 (1)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1100111 (1)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101000 (1)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101001 (1)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101010 (1)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101011 (1)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101100 (1)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101101 (1)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101110 (1)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1101111 (1)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110000 (1)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110001 (1)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110010 (1)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110011 (1)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110100 (1)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110101 (1)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110110 (1)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1110111 (1)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111000 (1)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111001 (1)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111010 (1)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111011 (1)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111100 (1)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111101 (1)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111110 (1)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_1111111 (1)(1)(1)(1)(1)(1)(1), + +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000000 (0)(0)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000001 (0)(0)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000010 (0)(0)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000011 (0)(0)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000100 (0)(0)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000101 (0)(0)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000110 (0)(0)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00000111 (0)(0)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001000 (0)(0)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001001 (0)(0)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001010 (0)(0)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001011 (0)(0)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001100 (0)(0)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001101 (0)(0)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001110 (0)(0)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00001111 (0)(0)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010000 (0)(0)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010001 (0)(0)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010010 (0)(0)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010011 (0)(0)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010100 (0)(0)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010101 (0)(0)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010110 (0)(0)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00010111 (0)(0)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011000 (0)(0)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011001 (0)(0)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011010 (0)(0)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011011 (0)(0)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011100 (0)(0)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011101 (0)(0)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011110 (0)(0)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00011111 (0)(0)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100000 (0)(0)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100001 (0)(0)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100010 (0)(0)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100011 (0)(0)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100100 (0)(0)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100101 (0)(0)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100110 (0)(0)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00100111 (0)(0)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101000 (0)(0)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101001 (0)(0)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101010 (0)(0)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101011 (0)(0)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101100 (0)(0)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101101 (0)(0)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101110 (0)(0)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00101111 (0)(0)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110000 (0)(0)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110001 (0)(0)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110010 (0)(0)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110011 (0)(0)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110100 (0)(0)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110101 (0)(0)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110110 (0)(0)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00110111 (0)(0)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111000 (0)(0)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111001 (0)(0)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111010 (0)(0)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111011 (0)(0)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111100 (0)(0)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111101 (0)(0)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111110 (0)(0)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_00111111 (0)(0)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000000 (0)(1)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000001 (0)(1)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000010 (0)(1)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000011 (0)(1)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000100 (0)(1)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000101 (0)(1)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000110 (0)(1)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01000111 (0)(1)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001000 (0)(1)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001001 (0)(1)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001010 (0)(1)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001011 (0)(1)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001100 (0)(1)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001101 (0)(1)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001110 (0)(1)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01001111 (0)(1)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010000 (0)(1)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010001 (0)(1)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010010 (0)(1)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010011 (0)(1)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010100 (0)(1)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010101 (0)(1)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010110 (0)(1)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01010111 (0)(1)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011000 (0)(1)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011001 (0)(1)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011010 (0)(1)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011011 (0)(1)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011100 (0)(1)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011101 (0)(1)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011110 (0)(1)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01011111 (0)(1)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100000 (0)(1)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100001 (0)(1)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100010 (0)(1)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100011 (0)(1)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100100 (0)(1)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100101 (0)(1)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100110 (0)(1)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01100111 (0)(1)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101000 (0)(1)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101001 (0)(1)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101010 (0)(1)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101011 (0)(1)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101100 (0)(1)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101101 (0)(1)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101110 (0)(1)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01101111 (0)(1)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110000 (0)(1)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110001 (0)(1)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110010 (0)(1)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110011 (0)(1)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110100 (0)(1)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110101 (0)(1)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110110 (0)(1)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01110111 (0)(1)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111000 (0)(1)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111001 (0)(1)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111010 (0)(1)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111011 (0)(1)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111100 (0)(1)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111101 (0)(1)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111110 (0)(1)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_01111111 (0)(1)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000000 (1)(0)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000001 (1)(0)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000010 (1)(0)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000011 (1)(0)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000100 (1)(0)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000101 (1)(0)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000110 (1)(0)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10000111 (1)(0)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001000 (1)(0)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001001 (1)(0)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001010 (1)(0)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001011 (1)(0)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001100 (1)(0)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001101 (1)(0)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001110 (1)(0)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10001111 (1)(0)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010000 (1)(0)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010001 (1)(0)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010010 (1)(0)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010011 (1)(0)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010100 (1)(0)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010101 (1)(0)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010110 (1)(0)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10010111 (1)(0)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011000 (1)(0)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011001 (1)(0)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011010 (1)(0)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011011 (1)(0)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011100 (1)(0)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011101 (1)(0)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011110 (1)(0)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10011111 (1)(0)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100000 (1)(0)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100001 (1)(0)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100010 (1)(0)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100011 (1)(0)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100100 (1)(0)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100101 (1)(0)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100110 (1)(0)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10100111 (1)(0)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101000 (1)(0)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101001 (1)(0)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101010 (1)(0)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101011 (1)(0)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101100 (1)(0)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101101 (1)(0)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101110 (1)(0)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10101111 (1)(0)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110000 (1)(0)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110001 (1)(0)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110010 (1)(0)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110011 (1)(0)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110100 (1)(0)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110101 (1)(0)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110110 (1)(0)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10110111 (1)(0)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111000 (1)(0)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111001 (1)(0)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111010 (1)(0)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111011 (1)(0)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111100 (1)(0)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111101 (1)(0)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111110 (1)(0)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_10111111 (1)(0)(1)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000000 (1)(1)(0)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000001 (1)(1)(0)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000010 (1)(1)(0)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000011 (1)(1)(0)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000100 (1)(1)(0)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000101 (1)(1)(0)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000110 (1)(1)(0)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11000111 (1)(1)(0)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001000 (1)(1)(0)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001001 (1)(1)(0)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001010 (1)(1)(0)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001011 (1)(1)(0)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001100 (1)(1)(0)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001101 (1)(1)(0)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001110 (1)(1)(0)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11001111 (1)(1)(0)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010000 (1)(1)(0)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010001 (1)(1)(0)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010010 (1)(1)(0)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010011 (1)(1)(0)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010100 (1)(1)(0)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010101 (1)(1)(0)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010110 (1)(1)(0)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11010111 (1)(1)(0)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011000 (1)(1)(0)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011001 (1)(1)(0)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011010 (1)(1)(0)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011011 (1)(1)(0)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011100 (1)(1)(0)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011101 (1)(1)(0)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011110 (1)(1)(0)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11011111 (1)(1)(0)(1)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100000 (1)(1)(1)(0)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100001 (1)(1)(1)(0)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100010 (1)(1)(1)(0)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100011 (1)(1)(1)(0)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100100 (1)(1)(1)(0)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100101 (1)(1)(1)(0)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100110 (1)(1)(1)(0)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11100111 (1)(1)(1)(0)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101000 (1)(1)(1)(0)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101001 (1)(1)(1)(0)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101010 (1)(1)(1)(0)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101011 (1)(1)(1)(0)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101100 (1)(1)(1)(0)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101101 (1)(1)(1)(0)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101110 (1)(1)(1)(0)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11101111 (1)(1)(1)(0)(1)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110000 (1)(1)(1)(1)(0)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110001 (1)(1)(1)(1)(0)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110010 (1)(1)(1)(1)(0)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110011 (1)(1)(1)(1)(0)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110100 (1)(1)(1)(1)(0)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110101 (1)(1)(1)(1)(0)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110110 (1)(1)(1)(1)(0)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11110111 (1)(1)(1)(1)(0)(1)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111000 (1)(1)(1)(1)(1)(0)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111001 (1)(1)(1)(1)(1)(0)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111010 (1)(1)(1)(1)(1)(0)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111011 (1)(1)(1)(1)(1)(0)(1)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111100 (1)(1)(1)(1)(1)(1)(0)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111101 (1)(1)(1)(1)(1)(1)(0)(1), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111110 (1)(1)(1)(1)(1)(1)(1)(0), +#define BOOST_DETAIL_BINARY_LITERAL_ELEMENT_11111111 (1)(1)(1)(1)(1)(1)(1)(1), + +#endif diff --git a/Utilities/BGL/boost/butility/compare_pointees.hpp b/Utilities/BGL/boost/utility/compare_pointees.hpp similarity index 100% rename from Utilities/BGL/boost/butility/compare_pointees.hpp rename to Utilities/BGL/boost/utility/compare_pointees.hpp diff --git a/Utilities/BGL/boost/butility/detail/in_place_factory_prefix.hpp b/Utilities/BGL/boost/utility/detail/in_place_factory_prefix.hpp similarity index 69% rename from Utilities/BGL/boost/butility/detail/in_place_factory_prefix.hpp rename to Utilities/BGL/boost/utility/detail/in_place_factory_prefix.hpp index 092083e8f8436ecf66080f87c6f954e6f2bfbe62..6ce724781896817dd0797996b1ec3a906a5aa1eb 100644 --- a/Utilities/BGL/boost/butility/detail/in_place_factory_prefix.hpp +++ b/Utilities/BGL/boost/utility/detail/in_place_factory_prefix.hpp @@ -1,4 +1,5 @@ // Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,25 +10,27 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // -#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP -#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP +#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_04APR2007_HPP +#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_04APR2007_HPP +#include <new> +#include <cstddef> #include <boost/config.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/punctuation/paren.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> #include <boost/preprocessor/repetition/enum.hpp> #include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/punctuation/paren.hpp> -#include <boost/preprocessor/facilities/empty.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> #define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT(z,n,_) BOOST_PP_CAT(m_a,n) BOOST_PP_LPAREN() BOOST_PP_CAT(a,n) BOOST_PP_RPAREN() #define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL(z,n,_) BOOST_PP_CAT(A,n) const& BOOST_PP_CAT(m_a,n); -#define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_ARG(z,n,_) BOOST_PP_CAT(m_a,n) #define BOOST_MAX_INPLACE_FACTORY_ARITY 10 -#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP +#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_04APR2007_HPP #endif diff --git a/Utilities/BGL/boost/butility/detail/in_place_factory_suffix.hpp b/Utilities/BGL/boost/utility/detail/in_place_factory_suffix.hpp similarity index 69% rename from Utilities/BGL/boost/butility/detail/in_place_factory_suffix.hpp rename to Utilities/BGL/boost/utility/detail/in_place_factory_suffix.hpp index 3efe221e74adfbb852db8651b56e4ba5a47c4eb4..b1fc4d3dcf8f66871fc37e811d96e601c2c1878a 100644 --- a/Utilities/BGL/boost/butility/detail/in_place_factory_suffix.hpp +++ b/Utilities/BGL/boost/utility/detail/in_place_factory_suffix.hpp @@ -1,4 +1,5 @@ // Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. // // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -9,15 +10,14 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // -#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP -#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_25AGO2003_HPP +#ifndef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_04APR2007_HPP +#define BOOST_UTILITY_DETAIL_INPLACE_FACTORY_SUFFIX_04APR2007_HPP #undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT #undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL -#undef BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_ARG #undef BOOST_MAX_INPLACE_FACTORY_ARITY -#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_25AGO2003_HPP +#undef BOOST_UTILITY_DETAIL_INPLACE_FACTORY_PREFIX_04APR2007_HPP #endif diff --git a/Utilities/BGL/boost/butility/detail/result_of_iterate.hpp b/Utilities/BGL/boost/utility/detail/result_of_iterate.hpp similarity index 76% rename from Utilities/BGL/boost/butility/detail/result_of_iterate.hpp rename to Utilities/BGL/boost/utility/detail/result_of_iterate.hpp index b2031e49a7b6d1b8ab5e46a93f6c9508d7c5d0e7..41616c3f301363eb286c257adc2d31c61e820076 100644 --- a/Utilities/BGL/boost/butility/detail/result_of_iterate.hpp +++ b/Utilities/BGL/boost/utility/detail/result_of_iterate.hpp @@ -5,7 +5,7 @@ // 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/butility +// For more information, see http://www.boost.org/libs/utility #if !defined(BOOST_PP_IS_ITERATING) # error Boost result_of - do not include this file! #endif @@ -21,66 +21,69 @@ template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> struct result_of<F(BOOST_RESULT_OF_ARGS)> - : detail::result_of<F, F(BOOST_RESULT_OF_ARGS)> {}; + : boost::detail::result_of_impl<F, F(BOOST_RESULT_OF_ARGS), (boost::detail::has_result_type<F>::value)> {}; #endif +#undef BOOST_RESULT_OF_ARGS + +#if BOOST_PP_ITERATION() >= 1 + namespace detail { template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> -struct result_of<R (*)(BOOST_RESULT_OF_ARGS), FArgs> +struct result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false> { typedef R type; }; template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> -struct result_of<R (&)(BOOST_RESULT_OF_ARGS), FArgs> +struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false> { typedef R type; }; -#undef BOOST_RESULT_OF_ARGS - -#if BOOST_PP_ITERATION() > 1 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> -struct result_of<R (T0::*) +struct result_of_impl<R (T0::*) (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)), - FArgs> + FArgs, false> { typedef R type; }; template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> -struct result_of<R (T0::*) +struct result_of_impl<R (T0::*) (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) const, - FArgs> + FArgs, false> { typedef R type; }; template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> -struct result_of<R (T0::*) +struct result_of_impl<R (T0::*) (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) volatile, - FArgs> + FArgs, false> { typedef R type; }; template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> -struct result_of<R (T0::*) +struct result_of_impl<R (T0::*) (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) const volatile, - FArgs> + FArgs, false> { typedef R type; }; #endif } +#endif diff --git a/Utilities/BGL/boost/butility/enable_if.hpp b/Utilities/BGL/boost/utility/enable_if.hpp similarity index 96% rename from Utilities/BGL/boost/butility/enable_if.hpp rename to Utilities/BGL/boost/utility/enable_if.hpp index c8b54c4cffd940213d562f20613f1b31bfe64bc3..d292c6a7b00b273ccc2e8a7cb051586367fee2dd 100644 --- a/Utilities/BGL/boost/butility/enable_if.hpp +++ b/Utilities/BGL/boost/utility/enable_if.hpp @@ -1,12 +1,12 @@ // Boost enable_if library -// Copyright 2003 � The Trustees of Indiana University. +// Copyright 2003 (c) The Trustees of Indiana University. // 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: Jaakko J�rvi (jajarvi at osl.iu.edu) +// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu) // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) diff --git a/Utilities/BGL/boost/utility/in_place_factory.hpp b/Utilities/BGL/boost/utility/in_place_factory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..16eaacf2ad33cf0115e69d8b3c228289ccd2c105 --- /dev/null +++ b/Utilities/BGL/boost/utility/in_place_factory.hpp @@ -0,0 +1,88 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. +// +// 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/lib/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP +#ifndef BOOST_PP_IS_ITERATING + +#include <boost/utility/detail/in_place_factory_prefix.hpp> + +namespace boost { + +class in_place_factory_base {} ; + +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_MAX_INPLACE_FACTORY_ARITY) +#define BOOST_PP_FILENAME_1 <boost/utility/in_place_factory.hpp> +#include BOOST_PP_ITERATE() + +} // namespace boost + +#include <boost/utility/detail/in_place_factory_suffix.hpp> + +#define BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP +#else +#define N BOOST_PP_ITERATION() + +#if N +template< BOOST_PP_ENUM_PARAMS(N, class A) > +#endif +class BOOST_PP_CAT(in_place_factory,N) + : + public in_place_factory_base +{ +public: + + explicit BOOST_PP_CAT(in_place_factory,N) + ( BOOST_PP_ENUM_BINARY_PARAMS(N,A,const& a) ) +#if N > 0 + : BOOST_PP_ENUM(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _) +#endif + {} + + template<class T> + void* apply(void* address + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) const + { + return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) ); + } + + template<class T> + void* apply(void* address, std::size_t n + BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) const + { + for(char* next = address = this->BOOST_NESTED_TEMPLATE apply<T>(address); + !! --n;) + this->BOOST_NESTED_TEMPLATE apply<T>(next = next+sizeof(T)); + return address; + } + + BOOST_PP_REPEAT(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) +}; + +#if N > 0 +template< BOOST_PP_ENUM_PARAMS(N, class A) > +inline BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) > +in_place( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) ) +{ + return BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) > + ( BOOST_PP_ENUM_PARAMS(N, a) ); +} +#else +inline in_place_factory0 in_place() +{ + return in_place_factory0(); +} +#endif + +#undef N +#endif +#endif + diff --git a/Utilities/BGL/boost/butility/result_of.hpp b/Utilities/BGL/boost/utility/result_of.hpp similarity index 60% rename from Utilities/BGL/boost/butility/result_of.hpp rename to Utilities/BGL/boost/utility/result_of.hpp index 4199a2743629a8c60349bbbd65937317aac67c7f..e35e0980bb1ea6ddb4d4b9d5b79564650a9c2b66 100644 --- a/Utilities/BGL/boost/butility/result_of.hpp +++ b/Utilities/BGL/boost/utility/result_of.hpp @@ -5,7 +5,7 @@ // 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/butility +// For more information, see http://www.boost.org/libs/utility #ifndef BOOST_RESULT_OF_HPP #define BOOST_RESULT_OF_HPP @@ -15,6 +15,8 @@ #include <boost/preprocessor.hpp> #include <boost/detail/workaround.hpp> #include <boost/mpl/has_xxx.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/bool.hpp> #ifndef BOOST_RESULT_OF_NUM_ARGS # define BOOST_RESULT_OF_NUM_ARGS 10 @@ -29,32 +31,52 @@ namespace detail { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) -template<typename F, typename FArgs, bool HasResultType> struct get_result_of; +template<typename F, typename FArgs, bool HasResultType> struct result_of_impl; -template<typename F, typename FArgs> -struct get_result_of<F, FArgs, true> +template<typename F> +struct result_of_void_impl { - typedef typename F::result_type type; + typedef void type; }; -template<typename F, typename FArgs> -struct get_result_of<F, FArgs, false> +template<typename R> +struct result_of_void_impl<R (*)(void)> { - typedef typename F::template result<FArgs>::type type; + typedef R type; }; -template<typename F> -struct get_result_of<F, F(void), false> +template<typename R> +struct result_of_void_impl<R (&)(void)> { - typedef void type; + typedef R type; }; template<typename F, typename FArgs> -struct result_of : get_result_of<F, FArgs, (has_result_type<F>::value)> {}; +struct result_of_impl<F, FArgs, true> +{ + typedef typename F::result_type type; +}; + +template<typename FArgs> +struct is_function_with_no_args : mpl::false_ {}; + +template<typename F> +struct is_function_with_no_args<F(void)> : mpl::true_ {}; + +template<typename F, typename FArgs> +struct result_of_nested_result : F::template result<FArgs> +{}; + +template<typename F, typename FArgs> +struct result_of_impl<F, FArgs, false> + : mpl::if_<is_function_with_no_args<FArgs>, + result_of_void_impl<F>, + result_of_nested_result<F, FArgs> >::type +{}; } // end namespace detail -#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/butility/detail/result_of_iterate.hpp>)) +#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>)) #include BOOST_PP_ITERATE() #else diff --git a/Utilities/BGL/boost/utility/swap.hpp b/Utilities/BGL/boost/utility/swap.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6845e7965b72c7e9dc9ffae09ffdb9b0032bd21d --- /dev/null +++ b/Utilities/BGL/boost/utility/swap.hpp @@ -0,0 +1,55 @@ +// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker +// +// 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) +// For more information, see http://www.boost.org + + +#ifndef BOOST_UTILITY_SWAP_HPP +#define BOOST_UTILITY_SWAP_HPP + +// Note: the implementation of this utility contains various workarounds: +// - swap_impl is put outside the boost namespace, to avoid infinite +// recursion (causing stack overflow) when swapping objects of a primitive +// type. +// - swap_impl has a using-directive, rather than a using-declaration, +// because some compilers (including MSVC 7.1, Borland 5.9.3, and +// Intel 8.1) don't do argument-dependent lookup when it has a +// using-declaration instead. +// - boost::swap has two template arguments, instead of one, to +// avoid ambiguity when swapping objects of a Boost type that does +// not have its own boost::swap overload. + +#include <algorithm> //for std::swap +#include <cstddef> //for std::size_t + +namespace boost_swap_impl +{ + template<class T> + void swap_impl(T& left, T& right) + { + using namespace std;//use std::swap if argument dependent lookup fails + swap(left,right); + } + + template<class T, std::size_t N> + void swap_impl(T (& left)[N], T (& right)[N]) + { + for (std::size_t i = 0; i < N; ++i) + { + ::boost_swap_impl::swap_impl(left[i], right[i]); + } + } +} + +namespace boost +{ + template<class T1, class T2> + void swap(T1& left, T2& right) + { + ::boost_swap_impl::swap_impl(left, right); + } +} + +#endif diff --git a/Utilities/BGL/boost/utility/typed_in_place_factory.hpp b/Utilities/BGL/boost/utility/typed_in_place_factory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..347b7f459a44209ff7afdc0eeb19395b243a45ab --- /dev/null +++ b/Utilities/BGL/boost/utility/typed_in_place_factory.hpp @@ -0,0 +1,77 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2007, Tobias Schwinger. +// +// 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/lib/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_UTILITY_TYPED_INPLACE_FACTORY_04APR2007_HPP +#ifndef BOOST_PP_IS_ITERATING + +#include <boost/utility/detail/in_place_factory_prefix.hpp> + +namespace boost { + +class typed_in_place_factory_base {} ; + +#define BOOST_PP_ITERATION_LIMITS (0, BOOST_MAX_INPLACE_FACTORY_ARITY) +#define BOOST_PP_FILENAME_1 <boost/utility/typed_in_place_factory.hpp> +#include BOOST_PP_ITERATE() + +} // namespace boost + +#include <boost/utility/detail/in_place_factory_suffix.hpp> + +#define BOOST_UTILITY_TYPED_INPLACE_FACTORY_04APR2007_HPP +#else +#define N BOOST_PP_ITERATION() + +template< class T BOOST_PP_ENUM_TRAILING_PARAMS(N,class A) > +class BOOST_PP_CAT(typed_in_place_factory,N) + : + public typed_in_place_factory_base +{ +public: + + typedef T value_type; + + explicit BOOST_PP_CAT(typed_in_place_factory,N) + ( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) ) +#if N > 0 + : BOOST_PP_ENUM(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT, _) +#endif + {} + + void* apply (void* address) const + { + return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) ); + } + + void* apply (void* address, std::size_t n) const + { + for(void* next = address = this->apply(address); !! --n;) + this->apply(next = static_cast<char *>(next) + sizeof(T)); + return address; + } + + BOOST_PP_REPEAT(N, BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL, _) +}; + +template< class T BOOST_PP_ENUM_TRAILING_PARAMS(N, class A) > +inline BOOST_PP_CAT(typed_in_place_factory,N)< + T BOOST_PP_ENUM_TRAILING_PARAMS(N, A) > +in_place( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) ) +{ + return BOOST_PP_CAT(typed_in_place_factory,N)< + T BOOST_PP_ENUM_TRAILING_PARAMS(N, A) >( BOOST_PP_ENUM_PARAMS(N, a) ); +} + +#undef N +#endif +#endif + diff --git a/Utilities/BGL/boost/utility/value_init.hpp b/Utilities/BGL/boost/utility/value_init.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5aefac928d94e65af05dc18b9410d47e26047a8e --- /dev/null +++ b/Utilities/BGL/boost/utility/value_init.hpp @@ -0,0 +1,151 @@ +// (C) Copyright 2002-2008, Fernando Luis Cacciola Carballal. +// +// 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) +// +// 21 Ago 2002 (Created) Fernando Cacciola +// 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker +// 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola +// 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola +// 20 Feb 2009 (Fixed logical const-ness issues) Niels Dekker, Fernando Cacciola +// +#ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP +#define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP + +// Note: The implementation of boost::value_initialized had to deal with the +// fact that various compilers haven't fully implemented value-initialization. +// The constructor of boost::value_initialized<T> works around these compiler +// issues, by clearing the bytes of T, before constructing the T object it +// contains. More details on these issues are at libs/utility/value_init.htm + +#include <boost/aligned_storage.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/cv_traits.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <boost/swap.hpp> +#include <cstring> +#include <new> + +namespace boost { + +template<class T> +class value_initialized +{ + private : + struct wrapper + { +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + typename +#endif + remove_const<T>::type data; + }; + + mutable +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) + typename +#endif + aligned_storage<sizeof(wrapper), alignment_of<wrapper>::value>::type x; + + wrapper * wrapper_address() const + { + return static_cast<wrapper *>( static_cast<void*>(&x)); + } + + public : + + value_initialized() + { + std::memset(&x, 0, sizeof(x)); +#ifdef BOOST_MSVC +#pragma warning(push) +#if _MSC_VER >= 1310 +// When using MSVC 7.1 or higher, the following placement new expression may trigger warning C4345: +// "behavior change: an object of POD type constructed with an initializer of the form () +// will be default-initialized". It is safe to ignore this warning when using value_initialized. +#pragma warning(disable: 4345) +#endif +#endif + new (wrapper_address()) wrapper(); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } + + value_initialized(value_initialized const & arg) + { + new (wrapper_address()) wrapper( static_cast<wrapper const &>(*(arg.wrapper_address()))); + } + + value_initialized & operator=(value_initialized const & arg) + { + // Assignment is only allowed when T is non-const. + BOOST_STATIC_ASSERT( ! is_const<T>::value ); + *wrapper_address() = static_cast<wrapper const &>(*(arg.wrapper_address())); + return *this; + } + + ~value_initialized() + { + wrapper_address()->wrapper::~wrapper(); + } + + T const & data() const + { + return wrapper_address()->data; + } + + T& data() + { + return wrapper_address()->data; + } + + void swap(value_initialized & arg) + { + ::boost::swap( this->data(), arg.data() ); + } + + operator T const &() const { return this->data(); } + + operator T&() { return this->data(); } + +} ; + + + +template<class T> +T const& get ( value_initialized<T> const& x ) +{ + return x.data() ; +} +template<class T> +T& get ( value_initialized<T>& x ) +{ + return x.data() ; +} + +template<class T> +void swap ( value_initialized<T> & lhs, value_initialized<T> & rhs ) +{ + lhs.swap(rhs) ; +} + + +class initialized_value_t +{ + public : + + template <class T> operator T() const + { + return get( value_initialized<T>() ); + } +}; + +initialized_value_t const initialized_value = {} ; + + +} // namespace boost + + +#endif diff --git a/Utilities/BGL/boost/version.hpp b/Utilities/BGL/boost/version.hpp index 37519ef328ec7392ebb69794666c668ae29241fe..e95ff85e710b0ce21c7a4534f16206e1c3f1d5ff 100644 --- a/Utilities/BGL/boost/version.hpp +++ b/Utilities/BGL/boost/version.hpp @@ -15,19 +15,19 @@ // will cause a recompile every time a new boost version is // released. // -// BOOST_VERSION % 100 is the sub-minor version +// BOOST_VERSION % 100 is the patch level // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version -#define BOOST_VERSION 103301 +#define BOOST_VERSION 104200 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION -// but as a *string* in the form "x_y" where x is the major version -// number and y is the minor version number. This is used by -// <config/auto_link.hpp> to select which library version to link to. +// but as a *string* in the form "x_y[_z]" where x is the major version +// number, y is the minor version number, and z is the patch level if not 0. +// This is used by <config/auto_link.hpp> to select which library version to link to. -#define BOOST_LIB_VERSION "1_33_1" +#define BOOST_LIB_VERSION "1_42" #endif