From 3652a1110fcebecb2f4ceaa27fb9c834562058a1 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 12 Nov 2014 22:23:12 -0800 Subject: [PATCH 001/140] Adding an "expect" string manipulator --- autowiring/expect.h | 40 +++++++++++++++++++++++++++++++++++ src/autowiring/CMakeLists.txt | 1 + 2 files changed, 41 insertions(+) create mode 100644 autowiring/expect.h diff --git a/autowiring/expect.h b/autowiring/expect.h new file mode 100644 index 000000000..eb51d230c --- /dev/null +++ b/autowiring/expect.h @@ -0,0 +1,40 @@ +#pragma once +#include + +namespace autowiring { +/// +/// Expectation type, used in utility processing +/// +template +class _expect { +public: + typedef std::basic_istream> stream; + + _expect(const ch* expected) : + m_expected(expected) + { + } + +private: + const ch* m_expected; + +public: + stream& operator()(stream& lhs) const { + ch c; + for(size_t i = 0; m_expected[i] && (lhs >> c); i++) + if(toupper(m_expected[i]) != toupper(c)) + lhs.setstate(std::ios::failbit); + return lhs; + } +}; + +template +static typename _expect::stream& operator>>(typename _expect::stream& lhs, const _expect& rhs) { + return rhs(lhs); +} + +template +_expect expect(const ch* str) { + return _expect(str); +} +} \ No newline at end of file diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index a1f127855..c337fa3a5 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -86,6 +86,7 @@ set(Autowiring_SRCS DispatchQueue.h DispatchQueue.cpp DispatchThunk.h + expect.h EventInputStream.h EventOutputStream.h EventOutputStream.cpp From d698e4f2291bf4caf57546f7ea3b3dc6fd432acc Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 12 Nov 2014 17:30:06 -0800 Subject: [PATCH 002/140] Adding an AutoConfig concept and corresponding tests --- autowiring/AutoConfig.h | 34 ++++++++++++++++++++++++++ autowiring/SlotInformation.h | 10 +++++++- src/autowiring/AutoConfigUnix.cpp | 11 +++++++++ src/autowiring/AutoConfigWin.cpp | 30 +++++++++++++++++++++++ src/autowiring/CMakeLists.txt | 3 +++ src/autowiring/test/AutoConfigTest.cpp | 18 ++++++++++++++ src/autowiring/test/CMakeLists.txt | 1 + 7 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 autowiring/AutoConfig.h create mode 100644 src/autowiring/AutoConfigUnix.cpp create mode 100644 src/autowiring/AutoConfigWin.cpp create mode 100644 src/autowiring/test/AutoConfigTest.cpp diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h new file mode 100644 index 000000000..e2c7bc106 --- /dev/null +++ b/autowiring/AutoConfig.h @@ -0,0 +1,34 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#pragma once +#include +#include + +/// +/// Utility base type for configuration members +/// +class AutoConfigBase +{ +public: + template + struct ConfigTypeExtractor {}; + + AutoConfigBase(const std::type_info& tiMemberName); + + // Name of the class enclosing this configuration field + const std::string Class; + + // Name of the type proper + const std::string Name; +}; + +template +class AutoConfig: + public AutoConfigBase +{ +public: + AutoConfig(void) : + AutoConfigBase(typeid(ConfigTypeExtractor)) + {} + + T value; +}; \ No newline at end of file diff --git a/autowiring/SlotInformation.h b/autowiring/SlotInformation.h index 91a6679d8..e27a594f3 100644 --- a/autowiring/SlotInformation.h +++ b/autowiring/SlotInformation.h @@ -45,12 +45,16 @@ struct SlotInformation { /// Stump entry, used to anchor a chain of slot information entries /// struct SlotInformationStumpBase { - SlotInformationStumpBase(void) : + SlotInformationStumpBase(const std::type_info& ti) : + ti(ti), bInitialized(false), pHead(nullptr), pFirstAutoFilter(nullptr) {} + // RTTI to which this stump pertains + const std::type_info& ti; + // Initialization flag, used to indicate that this stump has valid data bool bInitialized; @@ -82,6 +86,10 @@ template struct SlotInformationStump: SlotInformationStumpBase { + SlotInformationStump(void): + SlotInformationStumpBase(typeid(T)) + {} + static SlotInformationStump s_stump; }; diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp new file mode 100644 index 000000000..c3dbd524d --- /dev/null +++ b/src/autowiring/AutoConfigUnix.cpp @@ -0,0 +1,11 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include "AutoConfig.h" +#include "SlotInformation.h" + +AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): + Class(nullptr), + Name(nullptr) +{ + const char* name = tiMemberName.name(); +} \ No newline at end of file diff --git a/src/autowiring/AutoConfigWin.cpp b/src/autowiring/AutoConfigWin.cpp new file mode 100644 index 000000000..a8b92ae1e --- /dev/null +++ b/src/autowiring/AutoConfigWin.cpp @@ -0,0 +1,30 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include "AutoConfig.h" +#include "SlotInformation.h" +#include "demangle.h" +#include "expect.h" +#include + +static std::string CurrentStumpName(void) { + const auto* cs = SlotInformationStackLocation::CurrentStump(); + return cs ? autowiring::demangle(cs->ti) : std::string(); +} + +static std::string ExtractFieldName(const std::type_info& ti) { + // Name will be of the form "struct AutoConfigBase::ConfigTypeExtractor" + std::stringstream ss(ti.name()); + + std::string retVal; + if(ss >> autowiring::expect("struct") + >> autowiring::expect("AutoConfigBase::ConfigTypeExtractor> retVal; + return retVal; +} + +AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): + Class(CurrentStumpName()), + Name(ExtractFieldName(tiMemberName)) +{ +} \ No newline at end of file diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index c337fa3a5..2957a52c8 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -18,6 +18,7 @@ set(Autowiring_SRCS AnySharedPointer.h AnySharedPointer.cpp AutoCheckout.h + AutoConfig.h AutoRestarter.h AutoFuture.h AutoFuture.cpp @@ -157,12 +158,14 @@ endif() set(Autowiring_Win_SRCS CoreThreadWin.cpp + AutoConfigWin.cpp InterlockedExchangeWin.cpp thread_specific_ptr_win.h ) set(Autowiring_Unix_SRCS InterlockedExchangeUnix.cpp + AutoConfigUnix.cpp thread_specific_ptr_unix.h ) diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp new file mode 100644 index 000000000..e5b940177 --- /dev/null +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -0,0 +1,18 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include + +class AutoConfigTest: + public testing::Test +{}; + +struct MyConfigurableClass { + AutoConfig m_myName; +}; + +TEST_F(AutoConfigTest, VerifyCorrectDeconstruction) { + MyConfigurableClass mcc; + + ASSERT_STREQ("MyConfigurableClass", mcc.m_myName.Class.c_str()) << "Configuration variable enclosing class was not correctly extracted"; + ASSERT_STREQ("XYZ", mcc.m_myName.Name.c_str()) << "Configuration variable name was not correctly extracted"; +} \ No newline at end of file diff --git a/src/autowiring/test/CMakeLists.txt b/src/autowiring/test/CMakeLists.txt index 86d78610c..653c534cd 100644 --- a/src/autowiring/test/CMakeLists.txt +++ b/src/autowiring/test/CMakeLists.txt @@ -1,6 +1,7 @@ set(AutowiringTest_SRCS AnySharedPointerTest.cpp ArgumentTypeTest.cpp + AutoConfigTest.cpp AutoConstructTest.cpp AutoInjectableTest.cpp AutoPacketFactoryTest.cpp From fbae0bd3004aa4a921bb35b994e8fa5ed160642a Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 20 Nov 2014 13:47:19 -0800 Subject: [PATCH 003/140] Correctly get AutoConfig attribute name --- autowiring/AutoConfig.h | 2 +- autowiring/expect.h | 1 + src/autowiring/AutoConfigUnix.cpp | 21 ++++++++++++++++----- src/autowiring/test/AutoConfigTest.cpp | 4 ++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index e2c7bc106..092efffe9 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -12,7 +12,7 @@ class AutoConfigBase template struct ConfigTypeExtractor {}; - AutoConfigBase(const std::type_info& tiMemberName); + AutoConfigBase(const std::type_info& tiName); // Name of the class enclosing this configuration field const std::string Class; diff --git a/autowiring/expect.h b/autowiring/expect.h index eb51d230c..b0ed72c28 100644 --- a/autowiring/expect.h +++ b/autowiring/expect.h @@ -1,3 +1,4 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once #include diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index c3dbd524d..351f1ae81 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -2,10 +2,21 @@ #include "stdafx.h" #include "AutoConfig.h" #include "SlotInformation.h" +#include "demangle.h" +#include +#include + +using namespace autowiring; + +static const std::regex namePattern("AutoConfigBase::ConfigTypeExtractor<(\\w*)>"); + +static std::string getName(const std::type_info& ti) { + std::smatch sm; + std::regex_match(demangle(ti), sm, namePattern); + assert(sm.size() == 2 && "Regex couldn't find type name"); + return sm.str(1); +} AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): - Class(nullptr), - Name(nullptr) -{ - const char* name = tiMemberName.name(); -} \ No newline at end of file + Name(getName(tiMemberName)) +{} \ No newline at end of file diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index e5b940177..2055e96e5 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -13,6 +13,6 @@ struct MyConfigurableClass { TEST_F(AutoConfigTest, VerifyCorrectDeconstruction) { MyConfigurableClass mcc; - ASSERT_STREQ("MyConfigurableClass", mcc.m_myName.Class.c_str()) << "Configuration variable enclosing class was not correctly extracted"; - ASSERT_STREQ("XYZ", mcc.m_myName.Name.c_str()) << "Configuration variable name was not correctly extracted"; + EXPECT_STREQ("MyConfigurableClass", mcc.m_myName.Class.c_str()) << "Configuration variable enclosing class was not correctly extracted"; + EXPECT_STREQ("XYZ", mcc.m_myName.Name.c_str()) << "Configuration variable name was not correctly extracted"; } \ No newline at end of file From 3cf351d463450fe761841c2ca34fd71d135b83b2 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 20 Nov 2014 17:27:25 -0800 Subject: [PATCH 004/140] Implement class lookup in autoconfig --- src/autowiring/AutoConfigUnix.cpp | 19 ++++++++++++++++--- src/autowiring/test/AutoConfigTest.cpp | 6 +++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index 351f1ae81..d6c739423 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -8,15 +8,28 @@ using namespace autowiring; -static const std::regex namePattern("AutoConfigBase::ConfigTypeExtractor<(\\w*)>"); +static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)>"); +static const std::regex classPattern("TypeUnifierComplex<(\\w*)>"); -static std::string getName(const std::type_info& ti) { +static std::string ExtractFieldName(const std::type_info& ti) { std::smatch sm; std::regex_match(demangle(ti), sm, namePattern); assert(sm.size() == 2 && "Regex couldn't find type name"); return sm.str(1); } +static std::string CurrentStumpName(void) { + const auto* cs = SlotInformationStackLocation::CurrentStump(); + if (!cs) + return std::string(); + + std::smatch sm; + std::regex_match(demangle(cs->ti), sm, classPattern); + assert(sm.size() == 2 && "Regex couldn't find class name"); + return sm.str(1); +} + AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): - Name(getName(tiMemberName)) + Class(CurrentStumpName()), + Name(ExtractFieldName(tiMemberName)) {} \ No newline at end of file diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 2055e96e5..d0760ec25 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -11,8 +11,8 @@ struct MyConfigurableClass { }; TEST_F(AutoConfigTest, VerifyCorrectDeconstruction) { - MyConfigurableClass mcc; + AutoRequired mcc; - EXPECT_STREQ("MyConfigurableClass", mcc.m_myName.Class.c_str()) << "Configuration variable enclosing class was not correctly extracted"; - EXPECT_STREQ("XYZ", mcc.m_myName.Name.c_str()) << "Configuration variable name was not correctly extracted"; + EXPECT_STREQ("MyConfigurableClass", mcc->m_myName.Class.c_str()) << "Configuration variable enclosing class was not correctly extracted"; + EXPECT_STREQ("XYZ", mcc->m_myName.Name.c_str()) << "Configuration variable name was not correctly extracted"; } \ No newline at end of file From 82fa9eb5ef4db84b2f20875c7b7729d18493c51f Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 20 Nov 2014 17:40:50 -0800 Subject: [PATCH 005/140] Add AutoConfigManager --- autowiring/AutoConfig.h | 17 +++++++++++++++-- autowiring/AutoConfigManager.h | 12 ++++++++++++ src/autowiring/AutoConfigManager.cpp | 6 ++++++ src/autowiring/AutoConfigUnix.cpp | 4 ++-- src/autowiring/CMakeLists.txt | 2 ++ 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 autowiring/AutoConfigManager.h create mode 100644 src/autowiring/AutoConfigManager.cpp diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 092efffe9..0af4539b5 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -1,5 +1,8 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once +#include "Autowired.h" +#include "AutoConfigManager.h" + #include #include @@ -29,6 +32,16 @@ class AutoConfig: AutoConfig(void) : AutoConfigBase(typeid(ConfigTypeExtractor)) {} - - T value; + + operator T(void){ + return *value; + } + + operator const T&(void){ + return *value; + } + +private: + T* value; + AutoRequired m_manager; }; \ No newline at end of file diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h new file mode 100644 index 000000000..e022eea13 --- /dev/null +++ b/autowiring/AutoConfigManager.h @@ -0,0 +1,12 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#pragma once +#include +#include STL_UNORDERED_MAP + +struct AnySharedPointer; + +class AutoConfigManager { + +private: + std::unordered_map m_attributes; +}; \ No newline at end of file diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp new file mode 100644 index 000000000..b10fed7df --- /dev/null +++ b/src/autowiring/AutoConfigManager.cpp @@ -0,0 +1,6 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include "AutoConfig.h" +#include "AnySharedPointer.h" + + diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index d6c739423..9deb41eab 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -9,7 +9,7 @@ using namespace autowiring; static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)>"); -static const std::regex classPattern("TypeUnifierComplex<(\\w*)>"); +static const std::regex classPattern(".*TypeUnifierComplex<(?:class |struct )?(\\w*)>"); static std::string ExtractFieldName(const std::type_info& ti) { std::smatch sm; @@ -32,4 +32,4 @@ static std::string CurrentStumpName(void) { AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): Class(CurrentStumpName()), Name(ExtractFieldName(tiMemberName)) -{} \ No newline at end of file +{} diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 2957a52c8..74307c583 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -19,6 +19,8 @@ set(Autowiring_SRCS AnySharedPointer.cpp AutoCheckout.h AutoConfig.h + AutoConfigManager.h + AutoConfigManager.cpp AutoRestarter.h AutoFuture.h AutoFuture.cpp From 9abaf86856da2c6c3b07f92ae86d3c367605344d Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Thu, 20 Nov 2014 17:51:47 -0800 Subject: [PATCH 006/140] Extending configuration unit tests --- autowiring/AutoConfig.h | 22 +++++++--- autowiring/AutoConfigManager.h | 19 +++++++++ src/autowiring/test/AutoConfigTest.cpp | 57 ++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 5 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 0af4539b5..2480b70a6 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -32,7 +32,12 @@ class AutoConfig: AutoConfig(void) : AutoConfigBase(typeid(ConfigTypeExtractor)) {} - + +private: + T* value; + AutoRequired m_manager; + +public: operator T(void){ return *value; } @@ -40,8 +45,15 @@ class AutoConfig: operator const T&(void){ return *value; } - -private: - T* value; - AutoRequired m_manager; + + /// + /// True if this configurable field has been satisfied with a value + /// + bool IsConfigured(void) const { + return false; + } + + const T& operator*(void) const { + return value; + } }; \ No newline at end of file diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index e022eea13..6b5ac0c09 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -9,4 +9,23 @@ class AutoConfigManager { private: std::unordered_map m_attributes; + +public: + /// + /// Assigns the specified value to an AnySharedPointer slot + /// + /// + /// This method will throw an exception if the specified name cannot be found as a configurable value + /// in the application, or if the specified value type does not match the type expected by this field + /// + template + void Set(const char* name, const T& value) {} + + /// + /// Coerces the string representation of the specified field to the correct value type + /// + /// + /// This method will throw an exception if there is no string converter available on this type + /// + void SetParsed(const char* name, const char* value) {} }; \ No newline at end of file diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index d0760ec25..756c7f46f 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include +#include class AutoConfigTest: public testing::Test @@ -15,4 +16,60 @@ TEST_F(AutoConfigTest, VerifyCorrectDeconstruction) { EXPECT_STREQ("MyConfigurableClass", mcc->m_myName.Class.c_str()) << "Configuration variable enclosing class was not correctly extracted"; EXPECT_STREQ("XYZ", mcc->m_myName.Name.c_str()) << "Configuration variable name was not correctly extracted"; +} + +TEST_F(AutoConfigTest, VerifySimpleAssignment) { + // Set an attribute in the manager before injecting anything: + AutoRequired acm; + acm->Set("MyConfigurableClass.XYZ", 323); + + // Now inject the type which expects this value to be assigned: + AutoRequired mcc; + ASSERT_EQ(323, *mcc->m_myName) << "Configurable type did not receive a value as expected"; +} + +TEST_F(AutoConfigTest, VerifyPostHocAssignment) { + // Inject the configurable type first + AutoRequired mcc; + + // Configuration manager must exist at this point as a consequence of the earlier construction + Autowired acm; + ASSERT_TRUE(acm.IsAutowired()) << "AutoConfig field did not inject a configuration manager into this context as expected"; + + // + acm->Set("MyConfigurableClass.XYZ", 323); + + // Now inject the type which expects this value to be assigned: + ASSERT_EQ(323, *mcc->m_myName) << "Configurable type did not receive a value as expected"; +} + +TEST_F(AutoConfigTest, VerifyRecursiveSearch) { + AutoRequired mcc; + acm->Set("MyConfigurableClass.XYZ", 1001); + + { + AutoCreateContext ctxt; + CurrentContextPusher pshr(ctxt); + + // Now inject an element here, and verify that it was wired up as expected: + AutoRequired mcc; + ASSERT_TRUE(mcc->m_myName.IsConfigured()) << "A configurable value was not configured as expected"; + ASSERT_EQ(1001, *mcc->m_myName) << "Configurable value obtained from a parent scope did not have the correct value"; + + // This must work as expected--a local context override will rewrite configuration values in the local scope + AutoRequired sub_mcc; + sub_mcc->Set("MyConfigurableClass.XYZ", 1002); + ASSERT_EQ(1002, *mcc->m_myName) << "Override of a configurable value in a derived class did not take place as expected"; + } +} + +TEST_F(AutoConfigTest, VerifyParsedAssignment) { + // We must also be able to support implicit string-to-type conversion via the shift operator for this type + AutoRequired acm; + + // Direct assignment to a string should not work, the type isn't a string it's an int + ASSERT_ANY_THROW(acm->Set("MyConfigurableClass.XYZ", "327")) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; + + // Assignment to a string type should result in an appropriate coercion to the right value + acm->SetParsed("MyConfigurableClass.XYZ", "324"); } \ No newline at end of file From eabc3451dcd17d54a9b6705542d9f750acc75ded Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Thu, 20 Nov 2014 17:56:37 -0800 Subject: [PATCH 007/140] Eliminating apparently removed header --- autowiring/autowiring.h | 1 - 1 file changed, 1 deletion(-) diff --git a/autowiring/autowiring.h b/autowiring/autowiring.h index 98d0266c4..d58075e1e 100644 --- a/autowiring/autowiring.h +++ b/autowiring/autowiring.h @@ -1,6 +1,5 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once -#include "AutowiringConfig.h" #include "Autowired.h" #include "AutoNetServer.h" From 9c561d7643909d92680c723bf9d32bc51756c6c7 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 20 Nov 2014 18:06:06 -0800 Subject: [PATCH 008/140] Fill in AutoConfigManager with basics and make test compile --- autowiring/AutoConfig.h | 9 +++++---- autowiring/AutoConfigManager.h | 13 ++++++++++--- src/autowiring/AutoConfigManager.cpp | 6 ++++++ src/autowiring/AutoConfigUnix.cpp | 6 ++++-- src/autowiring/test/AutoConfigTest.cpp | 2 +- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 2480b70a6..656497a6b 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -45,6 +45,10 @@ class AutoConfig: operator const T&(void){ return *value; } + + const T& operator*(void) const { + return *value; + } /// /// True if this configurable field has been satisfied with a value @@ -52,8 +56,5 @@ class AutoConfig: bool IsConfigured(void) const { return false; } +}; - const T& operator*(void) const { - return value; - } -}; \ No newline at end of file diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 6b5ac0c09..cba88e599 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -2,11 +2,11 @@ #pragma once #include #include STL_UNORDERED_MAP +#include MEMORY_HEADER struct AnySharedPointer; class AutoConfigManager { - private: std::unordered_map m_attributes; @@ -19,7 +19,14 @@ class AutoConfigManager { /// in the application, or if the specified value type does not match the type expected by this field /// template - void Set(const char* name, const T& value) {} + void Set(const char* name, const T& value) { + // Check if field is used in program + // not implemented + + m_attributes[name] = AnySharedPointer(std::make_shared(value)); + } + + void Set(const char* name, const char* value); /// /// Coerces the string representation of the specified field to the correct value type @@ -27,5 +34,5 @@ class AutoConfigManager { /// /// This method will throw an exception if there is no string converter available on this type /// - void SetParsed(const char* name, const char* value) {} + void SetParsed(const char* name, const char* value); }; \ No newline at end of file diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index b10fed7df..ccec89614 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -3,4 +3,10 @@ #include "AutoConfig.h" #include "AnySharedPointer.h" +void AutoConfigManager::Set(const char* name, const char* value) { + Set(name, std::string(value)); +} +void AutoConfigManager::SetParsed(const char *name, const char *value) { + +} diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index 9deb41eab..8b7c24599 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -19,7 +19,7 @@ static std::string ExtractFieldName(const std::type_info& ti) { } static std::string CurrentStumpName(void) { - const auto* cs = SlotInformationStackLocation::CurrentStump(); + const SlotInformationStumpBase* cs = SlotInformationStackLocation::CurrentStump(); if (!cs) return std::string(); @@ -32,4 +32,6 @@ static std::string CurrentStumpName(void) { AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): Class(CurrentStumpName()), Name(ExtractFieldName(tiMemberName)) -{} +{ + +} diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 756c7f46f..23f523f9f 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -44,7 +44,7 @@ TEST_F(AutoConfigTest, VerifyPostHocAssignment) { } TEST_F(AutoConfigTest, VerifyRecursiveSearch) { - AutoRequired mcc; + AutoRequired acm; acm->Set("MyConfigurableClass.XYZ", 1001); { From 8f52209d0fcc74680d2ee5776e0bfb03cce06c2f Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 21 Nov 2014 12:57:32 -0800 Subject: [PATCH 009/140] Now can set simplate attributes --- autowiring/AutoConfig.h | 16 +++++++++++----- autowiring/AutoConfigManager.h | 2 +- src/autowiring/AutoConfigUnix.cpp | 14 ++++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 656497a6b..13740368d 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -6,6 +6,8 @@ #include #include +struct AnySharedPointer; + /// /// Utility base type for configuration members /// @@ -22,6 +24,9 @@ class AutoConfigBase // Name of the type proper const std::string Name; + + // Concatinated field name + const std::string Field; }; template @@ -30,24 +35,25 @@ class AutoConfig: { public: AutoConfig(void) : - AutoConfigBase(typeid(ConfigTypeExtractor)) + AutoConfigBase(typeid(ConfigTypeExtractor)), + value(m_manager->m_attributes[Field]) {} private: - T* value; AutoRequired m_manager; + AnySharedPointer& value; public: operator T(void){ - return *value; + return value; } operator const T&(void){ - return *value; + return value; } const T& operator*(void) const { - return *value; + return *value.as(); } /// diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index cba88e599..3d66a2a01 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -7,7 +7,7 @@ struct AnySharedPointer; class AutoConfigManager { -private: +public: std::unordered_map m_attributes; public: diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index 8b7c24599..884466d61 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -5,6 +5,7 @@ #include "demangle.h" #include #include +#include using namespace autowiring; @@ -29,9 +30,14 @@ static std::string CurrentStumpName(void) { return sm.str(1); } +static std::string FormatFieldName(const std::string& cls, const std::string& name) { + std::stringstream ss; + ss << cls << "." << name; + return ss.str(); +} + AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): Class(CurrentStumpName()), - Name(ExtractFieldName(tiMemberName)) -{ - -} + Name(ExtractFieldName(tiMemberName)), + Field(FormatFieldName(Class, Name)) +{} From 811d85d914aa7fe89208b94fcc47a52e177eaf18 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 21 Nov 2014 14:59:54 -0800 Subject: [PATCH 010/140] Add ConfigRegistry --- autowiring/AutoConfig.h | 20 +++++---- autowiring/AutoConfigManager.h | 6 ++- autowiring/ConfigRegistry.h | 61 ++++++++++++++++++++++++++++ src/autowiring/AutoConfigManager.cpp | 8 ++++ src/autowiring/CMakeLists.txt | 2 + src/autowiring/ConfigRegistry.cpp | 15 +++++++ 6 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 autowiring/ConfigRegistry.h create mode 100644 src/autowiring/ConfigRegistry.cpp diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 13740368d..a415e2670 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -2,6 +2,7 @@ #pragma once #include "Autowired.h" #include "AutoConfigManager.h" +#include "ConfigRegistry.h" #include #include @@ -36,31 +37,36 @@ class AutoConfig: public: AutoConfig(void) : AutoConfigBase(typeid(ConfigTypeExtractor)), - value(m_manager->m_attributes[Field]) - {} + m_isConfigured(m_manager->m_attributes.count(Field)), + m_value(m_manager->m_attributes[Field]) + { + // Register with config registry + (void)RegConfig>::r; + } private: AutoRequired m_manager; - AnySharedPointer& value; + bool m_isConfigured; + AnySharedPointer& m_value; public: operator T(void){ - return value; + return m_value; } operator const T&(void){ - return value; + return m_value; } const T& operator*(void) const { - return *value.as(); + return *m_value.as(); } /// /// True if this configurable field has been satisfied with a value /// bool IsConfigured(void) const { - return false; + return m_isConfigured; } }; diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 3d66a2a01..3f51c44e6 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -7,6 +7,10 @@ struct AnySharedPointer; class AutoConfigManager { +public: + AutoConfigManager(); + virtual ~AutoConfigManager(); + public: std::unordered_map m_attributes; @@ -35,4 +39,4 @@ class AutoConfigManager { /// This method will throw an exception if there is no string converter available on this type /// void SetParsed(const char* name, const char* value); -}; \ No newline at end of file +}; diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h new file mode 100644 index 000000000..7735b14fe --- /dev/null +++ b/autowiring/ConfigRegistry.h @@ -0,0 +1,61 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#pragma once +#include "TypeIdentifier.h" +#include MEMORY_HEADER + +struct ConfigRegistryEntry { + ConfigRegistryEntry(const std::type_info& ti); + + // Next entry in the list: + const ConfigRegistryEntry* const pFlink; + + // Type of this entry: + const std::type_info& ti; + + /// + /// The runtime type information corresponding to this entry + /// + virtual const std::type_info& GetTypeInfo(void) const = 0; + + /// + /// Used to create a type identifier value, for use with AutoNet + /// + virtual std::shared_ptr NewTypeIdentifier(void) const = 0; +}; + +template +struct ConfigRegistryEntryT: + public ConfigRegistryEntry +{ + ConfigRegistryEntryT(void): + ConfigRegistryEntry(typeid(T)) + {} + + virtual const std::type_info& GetTypeInfo(void) const override { return typeid(T); } + + std::shared_ptr NewTypeIdentifier(void) const override { + return std::static_pointer_cast( + std::make_shared>() + ); + } +}; + +extern const ConfigRegistryEntry* g_pFirstConfigEntry; +extern size_t g_confgiEntryCount; + +/// +/// Adds the specified type to the universal type registry +/// +/// +/// Any instance of this type registry parameterized on type T will be added to the +/// global static type registry, and this registry is computed at link time. +/// +template +class RegConfig +{ +public: + static const ConfigRegistryEntryT r; +}; + +template +const ConfigRegistryEntryT RegConfig::r; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index ccec89614..4c5effe04 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -2,6 +2,14 @@ #include "stdafx.h" #include "AutoConfig.h" #include "AnySharedPointer.h" +#include "demangle.h" +#include + +using namespace autowiring; + +AutoConfigManager::AutoConfigManager(void){} + +AutoConfigManager::~AutoConfigManager(void){} void AutoConfigManager::Set(const char* name, const char* value) { Set(name, std::string(value)); diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 74307c583..1c4d233fd 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -58,6 +58,8 @@ set(Autowiring_SRCS BoltBase.h BoltBase.cpp CallExtractor.h + ConfigRegistry.h + ConfigRegistry.cpp ContextCreator.h ContextCreatorBase.h ContextCreatorBase.cpp diff --git a/src/autowiring/ConfigRegistry.cpp b/src/autowiring/ConfigRegistry.cpp new file mode 100644 index 000000000..26f70aacc --- /dev/null +++ b/src/autowiring/ConfigRegistry.cpp @@ -0,0 +1,15 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include "ConfigRegistry.h" + +// Head of a linked list which will have node for every event type +const ConfigRegistryEntry* g_pFirstConfigEntry = nullptr; +size_t g_configEntryCount = 0; + +ConfigRegistryEntry::ConfigRegistryEntry(const std::type_info& ti) : + pFlink(g_pFirstConfigEntry), + ti(ti) +{ + g_configEntryCount++; + g_pFirstConfigEntry = this; +} From ce5dac9eb947ec575c20f4750b629ae4b535aad2 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 21 Nov 2014 16:54:36 -0800 Subject: [PATCH 011/140] Add basic ConfigRegistry functionality --- autowiring/AutoConfig.h | 6 ++---- autowiring/AutoConfigManager.h | 30 +++++++++++++++++++++++----- autowiring/ConfigRegistry.h | 24 ++++++---------------- src/autowiring/AutoConfigManager.cpp | 8 ++++++-- src/autowiring/AutoConfigUnix.cpp | 11 ++++------ src/autowiring/ConfigRegistry.cpp | 20 +++++++++++++++++-- 6 files changed, 61 insertions(+), 38 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index a415e2670..eaaf9aa83 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -37,8 +37,7 @@ class AutoConfig: public: AutoConfig(void) : AutoConfigBase(typeid(ConfigTypeExtractor)), - m_isConfigured(m_manager->m_attributes.count(Field)), - m_value(m_manager->m_attributes[Field]) + m_value(m_manager->Get(Field)) { // Register with config registry (void)RegConfig>::r; @@ -46,7 +45,6 @@ class AutoConfig: private: AutoRequired m_manager; - bool m_isConfigured; AnySharedPointer& m_value; public: @@ -66,7 +64,7 @@ class AutoConfig: /// True if this configurable field has been satisfied with a value /// bool IsConfigured(void) const { - return m_isConfigured; + return !m_value->empty(); } }; diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 3f51c44e6..5cbb9780e 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -1,5 +1,7 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once +#include "ConfigRegistry.h" +#include "autowiring_error.h" #include #include STL_UNORDERED_MAP #include MEMORY_HEADER @@ -11,10 +13,19 @@ class AutoConfigManager { AutoConfigManager(); virtual ~AutoConfigManager(); -public: +private: std::unordered_map m_attributes; public: + /// + /// Get a reference to where the config value is stored + /// + /// + /// This method will throw an exception if the specified name cannot be found as a configurable value + /// in the application, or if the specified value type does not match the type expected by this field + /// + AnySharedPointer& Get(const std::string& name); + /// /// Assigns the specified value to an AnySharedPointer slot /// @@ -23,14 +34,23 @@ class AutoConfigManager { /// in the application, or if the specified value type does not match the type expected by this field /// template - void Set(const char* name, const T& value) { + void Set(const std::string& name, const T& value) { // Check if field is used in program - // not implemented + bool match = false; + for(auto entry = g_pFirstConfigEntry; entry; entry = entry->pFlink) { + if (entry->is(typeid(T))) { + match = true; + break; + } + } + + if (!match) + throw autowiring_error("Config not used in program"); m_attributes[name] = AnySharedPointer(std::make_shared(value)); } - void Set(const char* name, const char* value); + void Set(const std::string& name, const char* value); /// /// Coerces the string representation of the specified field to the correct value type @@ -38,5 +58,5 @@ class AutoConfigManager { /// /// This method will throw an exception if there is no string converter available on this type /// - void SetParsed(const char* name, const char* value); + void SetParsed(const std::string& name, const std::string& value); }; diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 7735b14fe..a27eb7ab3 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -1,7 +1,7 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once -#include "TypeIdentifier.h" #include MEMORY_HEADER +#include struct ConfigRegistryEntry { ConfigRegistryEntry(const std::type_info& ti); @@ -11,16 +11,11 @@ struct ConfigRegistryEntry { // Type of this entry: const std::type_info& ti; - - /// - /// The runtime type information corresponding to this entry - /// - virtual const std::type_info& GetTypeInfo(void) const = 0; - - /// - /// Used to create a type identifier value, for use with AutoNet - /// - virtual std::shared_ptr NewTypeIdentifier(void) const = 0; + + // Configuration name + const std::string name; + + bool is(const std::type_info& ti) const; }; template @@ -31,13 +26,6 @@ struct ConfigRegistryEntryT: ConfigRegistryEntry(typeid(T)) {} - virtual const std::type_info& GetTypeInfo(void) const override { return typeid(T); } - - std::shared_ptr NewTypeIdentifier(void) const override { - return std::static_pointer_cast( - std::make_shared>() - ); - } }; extern const ConfigRegistryEntry* g_pFirstConfigEntry; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 4c5effe04..82633e3bf 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -11,10 +11,14 @@ AutoConfigManager::AutoConfigManager(void){} AutoConfigManager::~AutoConfigManager(void){} -void AutoConfigManager::Set(const char* name, const char* value) { +AnySharedPointer& AutoConfigManager::Get(const std::string& name) { + return m_attributes[name]; +} + +void AutoConfigManager::Set(const std::string& name, const char* value) { Set(name, std::string(value)); } -void AutoConfigManager::SetParsed(const char *name, const char *value) { +void AutoConfigManager::SetParsed(const std::string& name, const std::string& value) { } diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index 884466d61..8c8810399 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -1,20 +1,17 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "AutoConfig.h" -#include "SlotInformation.h" #include "demangle.h" +#include "SlotInformation.h" #include -#include #include -using namespace autowiring; - static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)>"); static const std::regex classPattern(".*TypeUnifierComplex<(?:class |struct )?(\\w*)>"); static std::string ExtractFieldName(const std::type_info& ti) { std::smatch sm; - std::regex_match(demangle(ti), sm, namePattern); + std::regex_match(autowiring::demangle(ti), sm, namePattern); assert(sm.size() == 2 && "Regex couldn't find type name"); return sm.str(1); } @@ -23,9 +20,9 @@ static std::string CurrentStumpName(void) { const SlotInformationStumpBase* cs = SlotInformationStackLocation::CurrentStump(); if (!cs) return std::string(); - + std::smatch sm; - std::regex_match(demangle(cs->ti), sm, classPattern); + std::regex_match(autowiring::demangle(cs->ti), sm, classPattern); assert(sm.size() == 2 && "Regex couldn't find class name"); return sm.str(1); } diff --git a/src/autowiring/ConfigRegistry.cpp b/src/autowiring/ConfigRegistry.cpp index 26f70aacc..d19212a7a 100644 --- a/src/autowiring/ConfigRegistry.cpp +++ b/src/autowiring/ConfigRegistry.cpp @@ -1,15 +1,31 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "ConfigRegistry.h" +#include "demangle.h" +#include +#include + +static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)>"); + +static std::string ExtractFieldName(const std::type_info& ti) { + std::smatch sm; + std::regex_match(autowiring::demangle(ti), sm, namePattern); + return sm.str(1); +} // Head of a linked list which will have node for every event type const ConfigRegistryEntry* g_pFirstConfigEntry = nullptr; size_t g_configEntryCount = 0; -ConfigRegistryEntry::ConfigRegistryEntry(const std::type_info& ti) : +ConfigRegistryEntry::ConfigRegistryEntry(const std::type_info& tinfo) : pFlink(g_pFirstConfigEntry), - ti(ti) + ti(tinfo), + name(ExtractFieldName(tinfo)) { g_configEntryCount++; g_pFirstConfigEntry = this; } + +bool ConfigRegistryEntry::is(const std::type_info& tinfo) const { + return name == ExtractFieldName(tinfo); +} From cd7f1208a4a5419c90dcc6c36eae1ab25fe88e45 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 21 Nov 2014 17:16:00 -0800 Subject: [PATCH 012/140] Recursivly add configs when constructing an AutoConfigManager --- autowiring/AutoConfigManager.h | 3 ++- src/autowiring/AutoConfigManager.cpp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 5cbb9780e..f09ffab9f 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -44,12 +44,13 @@ class AutoConfigManager { } } + // Throw exception if config field not used in program. if (!match) throw autowiring_error("Config not used in program"); m_attributes[name] = AnySharedPointer(std::make_shared(value)); } - + void Set(const std::string& name, const char* value); /// diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 82633e3bf..96e3aa02e 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -4,10 +4,25 @@ #include "AnySharedPointer.h" #include "demangle.h" #include +#include using namespace autowiring; -AutoConfigManager::AutoConfigManager(void){} +AutoConfigManager::AutoConfigManager(void){ + std::shared_ptr ctxt = AutoCurrentContext()->GetParentContext(); + + // iterate ancestor contexts, filling any configs + while (ctxt) { + Autowired mgmt(ctxt); + + if (mgmt) + for (const auto& entry : mgmt->m_attributes) + if (!m_attributes.count(entry.first)) + m_attributes.insert(entry); + + ctxt = ctxt->GetParentContext(); + } +} AutoConfigManager::~AutoConfigManager(void){} From e17ac1f8cd78684ae670dee6e96b957b7e74bb7b Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 21 Nov 2014 17:34:30 -0800 Subject: [PATCH 013/140] Recursivly set configs on children contexts --- autowiring/AutoConfigManager.h | 22 ++++++++-------------- src/autowiring/AutoConfigManager.cpp | 7 +++---- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index f09ffab9f..c885a9905 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -8,7 +8,9 @@ struct AnySharedPointer; -class AutoConfigManager { +class AutoConfigManager: + public ContextMember +{ public: AutoConfigManager(); virtual ~AutoConfigManager(); @@ -35,20 +37,12 @@ class AutoConfigManager { /// template void Set(const std::string& name, const T& value) { - // Check if field is used in program - bool match = false; - for(auto entry = g_pFirstConfigEntry; entry; entry = entry->pFlink) { - if (entry->is(typeid(T))) { - match = true; - break; - } - } - - // Throw exception if config field not used in program. - if (!match) - throw autowiring_error("Config not used in program"); - m_attributes[name] = AnySharedPointer(std::make_shared(value)); + for(const auto& ctxt : ContextEnumerator(GetContext())) { + AutowiredFast mgmt(ctxt); + if(mgmt) + mgmt->m_attributes[name] = AnySharedPointer(std::make_shared(value)); + } } void Set(const std::string& name, const char* value); diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 96e3aa02e..8270d6aa7 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -9,16 +9,15 @@ using namespace autowiring; AutoConfigManager::AutoConfigManager(void){ - std::shared_ptr ctxt = AutoCurrentContext()->GetParentContext(); + std::shared_ptr ctxt = GetContext()->GetParentContext(); // iterate ancestor contexts, filling any configs while (ctxt) { - Autowired mgmt(ctxt); + AutowiredFast mgmt(ctxt); if (mgmt) for (const auto& entry : mgmt->m_attributes) - if (!m_attributes.count(entry.first)) - m_attributes.insert(entry); + m_attributes.insert(entry); ctxt = ctxt->GetParentContext(); } From 458a2e712a0efd76033ac77e72270e07ff1fc296 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 21 Nov 2014 17:47:15 -0800 Subject: [PATCH 014/140] Make AutoConfigManager thread safe --- autowiring/AutoConfigManager.h | 5 ++++- src/autowiring/AutoConfigManager.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index c885a9905..d6950bb86 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -16,6 +16,7 @@ class AutoConfigManager: virtual ~AutoConfigManager(); private: + std::mutex m_lock; std::unordered_map m_attributes; public: @@ -40,8 +41,10 @@ class AutoConfigManager: for(const auto& ctxt : ContextEnumerator(GetContext())) { AutowiredFast mgmt(ctxt); - if(mgmt) + if(mgmt) { + std::lock_guard lk(mgmt->m_lock); mgmt->m_attributes[name] = AnySharedPointer(std::make_shared(value)); + } } } diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 8270d6aa7..f97872473 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -16,6 +16,7 @@ AutoConfigManager::AutoConfigManager(void){ AutowiredFast mgmt(ctxt); if (mgmt) + std::lock_guard lk(mgmt->m_lock); for (const auto& entry : mgmt->m_attributes) m_attributes.insert(entry); @@ -26,6 +27,7 @@ AutoConfigManager::AutoConfigManager(void){ AutoConfigManager::~AutoConfigManager(void){} AnySharedPointer& AutoConfigManager::Get(const std::string& name) { + std::lock_guard lk(m_lock); return m_attributes[name]; } From 8139e9597853f1a67c545ebf6b3b3c28857c08d3 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 21 Nov 2014 18:40:25 -0800 Subject: [PATCH 015/140] Make Set not set child context configs if they have already been set --- autowiring/AutoConfigManager.h | 10 +++++++++- src/autowiring/AutoConfigManager.cpp | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index d6950bb86..e894ffe81 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -38,12 +38,20 @@ class AutoConfigManager: /// template void Set(const std::string& name, const T& value) { + // Set value in this AutoConfigManager + std::lock_guard lk(m_lock); + m_attributes[name] = AnySharedPointer(std::make_shared(value)); + // Recurse through child contexts and set if value hasn't already been set for(const auto& ctxt : ContextEnumerator(GetContext())) { + if (ctxt == GetContext()) + continue; + AutowiredFast mgmt(ctxt); if(mgmt) { std::lock_guard lk(mgmt->m_lock); - mgmt->m_attributes[name] = AnySharedPointer(std::make_shared(value)); + if (mgmt->m_attributes[name]->empty()) + mgmt->m_attributes[name] = m_attributes[name]; } } } diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index f97872473..b3ed720fe 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -15,8 +15,9 @@ AutoConfigManager::AutoConfigManager(void){ while (ctxt) { AutowiredFast mgmt(ctxt); - if (mgmt) - std::lock_guard lk(mgmt->m_lock); + if (mgmt.IsAutowired()) + //FIXME: This lock causes a segfault + //std::lock_guard lk(mgmt->m_lock); for (const auto& entry : mgmt->m_attributes) m_attributes.insert(entry); From 7c3a9daa5c2b068a097bef5dc35e4059e111d57b Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Mon, 24 Nov 2014 13:47:23 -0800 Subject: [PATCH 016/140] Add value type to config registry --- autowiring/AutoConfig.h | 2 +- autowiring/AutoConfigManager.h | 5 +++++ autowiring/ConfigRegistry.h | 27 +++++++++++++++++++-------- src/autowiring/AutoConfigManager.cpp | 2 +- src/autowiring/ConfigRegistry.cpp | 2 +- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index eaaf9aa83..49a752288 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -40,7 +40,7 @@ class AutoConfig: m_value(m_manager->Get(Field)) { // Register with config registry - (void)RegConfig>::r; + (void)RegConfig>::r; } private: diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index e894ffe81..f69989b2e 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -38,6 +38,8 @@ class AutoConfigManager: /// template void Set(const std::string& name, const T& value) { + + // Set value in this AutoConfigManager std::lock_guard lk(m_lock); m_attributes[name] = AnySharedPointer(std::make_shared(value)); @@ -56,6 +58,9 @@ class AutoConfigManager: } } + /// + /// Overload for c-style string. Converts to std::string + /// void Set(const std::string& name, const char* value); /// diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index a27eb7ab3..489d22acc 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -2,6 +2,8 @@ #pragma once #include MEMORY_HEADER #include +#include +#include "AnySharedPointer.h" struct ConfigRegistryEntry { ConfigRegistryEntry(const std::type_info& ti); @@ -15,17 +17,26 @@ struct ConfigRegistryEntry { // Configuration name const std::string name; - bool is(const std::type_info& ti) const; + bool validName(const std::type_info& ti) const; + + virtual AnySharedPointer& parse(const std::string&) const = 0; }; -template +template struct ConfigRegistryEntryT: public ConfigRegistryEntry { ConfigRegistryEntryT(void): - ConfigRegistryEntry(typeid(T)) + ConfigRegistryEntry(typeid(NAME)) {} - + + AnySharedPointer& parse(const std::string& str) const { + std::istringstream ss(str); + T val; + ss >> val; + AnySharedPointer retval(std::make_shared(val)); + return retval; + } }; extern const ConfigRegistryEntry* g_pFirstConfigEntry; @@ -38,12 +49,12 @@ extern size_t g_confgiEntryCount; /// Any instance of this type registry parameterized on type T will be added to the /// global static type registry, and this registry is computed at link time. /// -template +template class RegConfig { public: - static const ConfigRegistryEntryT r; + static const ConfigRegistryEntryT r; }; -template -const ConfigRegistryEntryT RegConfig::r; +template +const ConfigRegistryEntryT RegConfig::r; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index b3ed720fe..345269864 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -15,7 +15,7 @@ AutoConfigManager::AutoConfigManager(void){ while (ctxt) { AutowiredFast mgmt(ctxt); - if (mgmt.IsAutowired()) + if (mgmt) //FIXME: This lock causes a segfault //std::lock_guard lk(mgmt->m_lock); for (const auto& entry : mgmt->m_attributes) diff --git a/src/autowiring/ConfigRegistry.cpp b/src/autowiring/ConfigRegistry.cpp index d19212a7a..d5224f2e3 100644 --- a/src/autowiring/ConfigRegistry.cpp +++ b/src/autowiring/ConfigRegistry.cpp @@ -26,6 +26,6 @@ ConfigRegistryEntry::ConfigRegistryEntry(const std::type_info& tinfo) : g_pFirstConfigEntry = this; } -bool ConfigRegistryEntry::is(const std::type_info& tinfo) const { +bool ConfigRegistryEntry::validName(const std::type_info& tinfo) const { return name == ExtractFieldName(tinfo); } From 0309571dc1c7d653d0583ce7df3f48ad6bfc7cea Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Mon, 24 Nov 2014 14:00:25 -0800 Subject: [PATCH 017/140] Fixed a mysterious error of mystery --- src/autowiring/AutoConfigManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 345269864..eccceb556 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -15,11 +15,11 @@ AutoConfigManager::AutoConfigManager(void){ while (ctxt) { AutowiredFast mgmt(ctxt); - if (mgmt) - //FIXME: This lock causes a segfault - //std::lock_guard lk(mgmt->m_lock); + if(mgmt) { + std::lock_guard lk(mgmt->m_lock); for (const auto& entry : mgmt->m_attributes) m_attributes.insert(entry); + } ctxt = ctxt->GetParentContext(); } From 9ee9d42cb7f610753ae3c65631a1575e88724cfb Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Mon, 24 Nov 2014 14:15:38 -0800 Subject: [PATCH 018/140] Corrected r-value return --- autowiring/ConfigRegistry.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 489d22acc..71651efb3 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -19,7 +19,7 @@ struct ConfigRegistryEntry { bool validName(const std::type_info& ti) const; - virtual AnySharedPointer& parse(const std::string&) const = 0; + virtual AnySharedPointer parse(const std::string&) const = 0; }; template @@ -30,12 +30,11 @@ struct ConfigRegistryEntryT: ConfigRegistryEntry(typeid(NAME)) {} - AnySharedPointer& parse(const std::string& str) const { + AnySharedPointer parse(const std::string& str) const { std::istringstream ss(str); T val; ss >> val; - AnySharedPointer retval(std::make_shared(val)); - return retval; + return AnySharedPointer(std::make_shared(val)); } }; From f1bfa3b5d798cb56d44b22ecc95b0ed7d3eca1fa Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Mon, 24 Nov 2014 14:16:28 -0800 Subject: [PATCH 019/140] Adding a name collision resolution test --- src/autowiring/test/AutoConfigTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 23f523f9f..5b43de602 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -11,6 +11,10 @@ struct MyConfigurableClass { AutoConfig m_myName; }; +struct MyConfigurableClass2 { + AutoConfig m_myName; +}; + TEST_F(AutoConfigTest, VerifyCorrectDeconstruction) { AutoRequired mcc; @@ -72,4 +76,16 @@ TEST_F(AutoConfigTest, VerifyParsedAssignment) { // Assignment to a string type should result in an appropriate coercion to the right value acm->SetParsed("MyConfigurableClass.XYZ", "324"); +} + +TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { + AutoRequired acm; + acm->SetParsed("MyConfigurableClass.XYZ", "324"); + acm->SetParsed("MyConfigurableClass2.XYZ", "1111"); + + AutoRequired clz1; + AutoRequired clz2; + + ASSERT_EQ(324, *clz1->m_myName); + ASSERT_EQ(1111, *clz2->m_myName); } \ No newline at end of file From 0c5be4757510d0c78aa589315865424e3625247b Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Mon, 24 Nov 2014 14:22:16 -0800 Subject: [PATCH 020/140] Adding a nested namespace check --- src/autowiring/test/AutoConfigTest.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 5b43de602..c413c968a 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -88,4 +88,19 @@ TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { ASSERT_EQ(324, *clz1->m_myName); ASSERT_EQ(1111, *clz2->m_myName); -} \ No newline at end of file +} + +namespace Outer { + class Inner { + public: + AutoConfig zzz; + }; +} + +TEST_F(AutoConfigTest, NestedNamespaceTest) { + AutoRequired acm; + acm->SetParsed("Outer.Inner.ZZZ", "222"); + + AutoRequired inner; + ASSERT_EQ(222, inner->zzz) << "Nested namespace type did not have the correct value"; +} From ce5baef46f9ba6045edb3c9323227b15fc4dc2f4 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 16:05:15 -0800 Subject: [PATCH 021/140] Squashed 'cmake-modules/' content from commit 29bed22 git-subtree-dir: cmake-modules git-subtree-split: 29bed2226f33a6c2987f3e1bd309e6fdb6c8850f --- AddPCH.cmake | 18 ++ ConditionalSources.cmake | 71 +++++ CreateImportTargetHelpers.cmake | 126 ++++++++ DefinePostBuildResourceCopyRules.cmake | 85 ++++++ FindAssimp.cmake | 43 +++ FindBreakpad.cmake | 36 +++ FindBullet.cmake | 61 ++++ FindCURL.cmake | 42 +++ FindCinder.cmake | 95 ++++++ FindEigen.cmake | 32 ++ FindFbxSdk.cmake | 56 ++++ FindFreeImage.cmake | 47 +++ FindGlew.cmake | 47 +++ FindInf2Cat.cmake | 28 ++ FindIrrklang.cmake | 48 +++ FindLeap.cmake | 61 ++++ FindNanoSVG.cmake | 31 ++ FindOculusSDK.cmake | 47 +++ FindOpenGL.cmake | 96 ++++++ FindOpenSSL.cmake | 43 +++ FindPackageHandleStandardArgs.cmake | 357 ++++++++++++++++++++++ FindPolyPartition.cmake | 38 +++ FindSDL.cmake | 407 +++++++++++++++++++++++++ FindSFML.cmake | 326 ++++++++++++++++++++ FindThreads.cmake | 187 ++++++++++++ FindWDK.cmake | 58 ++++ LeapCMakeTemplates.cmake | 48 +++ PrintTargetProperties.cmake | 198 ++++++++++++ README.md | 149 +++++++++ SelectConfigurations.cmake | 85 ++++++ TargetImportedLibraries.cmake | 120 ++++++++ TargetStrip.cmake | 15 + VerboseMessage.cmake | 21 ++ 33 files changed, 3122 insertions(+) create mode 100644 AddPCH.cmake create mode 100644 ConditionalSources.cmake create mode 100644 CreateImportTargetHelpers.cmake create mode 100644 DefinePostBuildResourceCopyRules.cmake create mode 100644 FindAssimp.cmake create mode 100644 FindBreakpad.cmake create mode 100644 FindBullet.cmake create mode 100644 FindCURL.cmake create mode 100644 FindCinder.cmake create mode 100644 FindEigen.cmake create mode 100644 FindFbxSdk.cmake create mode 100644 FindFreeImage.cmake create mode 100644 FindGlew.cmake create mode 100644 FindInf2Cat.cmake create mode 100644 FindIrrklang.cmake create mode 100644 FindLeap.cmake create mode 100644 FindNanoSVG.cmake create mode 100644 FindOculusSDK.cmake create mode 100644 FindOpenGL.cmake create mode 100644 FindOpenSSL.cmake create mode 100644 FindPackageHandleStandardArgs.cmake create mode 100644 FindPolyPartition.cmake create mode 100644 FindSDL.cmake create mode 100644 FindSFML.cmake create mode 100644 FindThreads.cmake create mode 100644 FindWDK.cmake create mode 100644 LeapCMakeTemplates.cmake create mode 100644 PrintTargetProperties.cmake create mode 100644 README.md create mode 100644 SelectConfigurations.cmake create mode 100644 TargetImportedLibraries.cmake create mode 100644 TargetStrip.cmake create mode 100644 VerboseMessage.cmake diff --git a/AddPCH.cmake b/AddPCH.cmake new file mode 100644 index 000000000..8a6122024 --- /dev/null +++ b/AddPCH.cmake @@ -0,0 +1,18 @@ +#MSVC pch macro. Copied from http://pastebin.com/84dm5rXZ and modified by Walter Gray +macro(add_pch SourcesVar PrecompiledHeader PrecompiledSource) + if(MSVC) + set_source_files_properties(${PrecompiledSource} + PROPERTIES + COMPILE_FLAGS "/Yc${PrecompiledHeader}" + ) + foreach( src_file ${${SourcesVar}} ) + set_source_files_properties( + ${src_file} + PROPERTIES + COMPILE_FLAGS "/Yu${PrecompiledHeader}" + ) + endforeach( src_file ${${SourcesVar}} ) + list(APPEND ${SourcesVar} ${PrecompiledHeader} ${PrecompiledSource}) + add_compile_options(/Yu) + endif(MSVC) +endmacro(add_pch) \ No newline at end of file diff --git a/ConditionalSources.cmake b/ConditionalSources.cmake new file mode 100644 index 000000000..fa3ec5b95 --- /dev/null +++ b/ConditionalSources.cmake @@ -0,0 +1,71 @@ +#.rst +#ConditionalSources +#--------------- +# Created by Walter Gray +# +# This module defines a set of functions for specifying conditionally compiled source files, +# generally platform specific ones. Files that are listed but whose condition is not met will +# still be visible in any IDE generated projects, but will not be compiled and will be isolated in +# a named filter group. This is particularly useful for find and replace operations in multi-platform +# codebases. +# +# There are two groups of functions +# conditional_sources is sufficient for setting all the flags on a list of files so that they will be grouped +# and only compiled under the given conditions. +# add_conditional_sources will first call conditional_sources, and will then append the list of sources to the given +# variable. +# +# add_named_conditional_functions is used for defining shorthand functions. Examples are at the bottom, and cover the most common +# platform-specific use cases. +# +# It is also worth noting that this is the only example I'm aware of showing cmake macro for defining functions. +# The trick was realising that referencing ${ARGV} in a macro references the ARGV of the *macro*, but you can +# access the defined function's ARGV by putting "ARGV" in a variable, then double-dereferincing it - this prevents +# the ${ARGV} from being parsed by cmake's macro preprocessor. +include(VerboseMessage) + +function(conditional_sources condition_var ...) + include(CMakeParseArguments) + cmake_parse_arguments(conditional_sources "" "GROUP_NAME" "FILES" ${ARGV}) + + source_group(${conditional_sources_GROUP_NAME} FILES ${conditional_sources_FILES}) + + if(NOT (${condition_var})) + set_source_files_properties( ${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + verbose_message("Setting INACTIVE source group \"${conditional_sources_GROUP_NAME}\" with files ${conditional_sources_FILES}") + else() + verbose_message("Setting source group \"${conditional_sources_GROUP_NAME}\" with files ${conditional_sources_FILES}") + endif() +endfunction() + +#as conditional_sources, but also appends the soruces to the source_list_var +function(add_conditional_sources source_list_var condition_var ...) + list(REMOVE_AT ARGV 0) + conditional_sources(${ARGV}) + + include(CMakeParseArguments) + cmake_parse_arguments(add_conditional_sources "" "" "FILES" ${ARGV}) + set(${source_list_var} ${${source_list_var}} ${add_conditional_sources_FILES} PARENT_SCOPE) +endfunction() + +#defines 'func_name' and add_'func_name' shorthands for add_conditional_sources with pre-set conditions. +macro(add_named_conditional_functions func_name group_name condition) + function(${func_name} ...) + set(my_argv ARGV) + conditional_sources("${condition}" GROUP_NAME "${group_name}" FILES ${${my_argv}}) + endfunction() + + function(add_${func_name} source_list_var ...) + set(my_argv ARGV) + + list(REMOVE_AT ARGV 0) + add_conditional_sources(${source_list_var} "${condition}" GROUP_NAME "${group_name}" FILES ${${my_argv}}) + set(${source_list_var} ${${source_list_var}} PARENT_SCOPE) + endfunction() +endmacro() + +#Some good defaults +add_named_conditional_functions("windows_sources" "Windows Source" WIN32) +add_named_conditional_functions("mac_sources" "Mac Source" APPLE) +add_named_conditional_functions("unix_sources" "Unix Source" "UNIX AND NOT APPLE AND NOT WIN32") +add_named_conditional_functions("resource_files" "Resource Files" FALSE) diff --git a/CreateImportTargetHelpers.cmake b/CreateImportTargetHelpers.cmake new file mode 100644 index 000000000..e376d075b --- /dev/null +++ b/CreateImportTargetHelpers.cmake @@ -0,0 +1,126 @@ +#.rst +# CreateImportTargetHelpers +# ------------------------- +# +# Created by Walter Gray +# A suite of functions helpful for writing Find modules that make use of the +# INTERFACE targets and Usage Requirements concepts introduced in cmake 3.0.0. +# +# The following functions are provided by this module: +# :: +# map_var_to_prop +# generate_import_target +# +# :: +# GENERATE_IMPORT_TARGET( []) +# +# namespace - The namespace of the library +# type - The type of target. Allowed values are SHARED, STATIC, INTERFACE and UNKNOWN +# target - Optional parameter allowing you to specify the generated target name +# +# Generates an import target of the specified type with the default name +# ::. +# +# The values for the resulting library are read from the standard variables below. +# Any variable which is found is marked as advanced. +# _LIBRARY<_DEBUG/_RELEASE> +# The file to use as the IMPORTED_LOCATION. If is SHARED, this should +# be a .dll, .dylib, or .so. If is STATIC or UNKNOWN, this should be +# a .lib, or .a file. This is unused for INTERFACE libraries +# _SHARED_LIB<_DEBUG/_RELEASE> +# The file to use as the IMPORTED_LOCATION if is SHARED. This is helpful +# for backwards compatilbility where projects expect _LIBRARY to be the import_lib. +# _IMPORT_LIB<_DEBUG/_RELEASE> +# The import library corresponding to the .dll. Only used on Windows. +# This may not use generator expressions. +# _INTERFACE_LIBS<_DEBUG/_RELEASE> +# Additional link libraries, *excluding* the _LIBRARY and +# _IMPORT_LIB values, if any. Generator expressions OK. +# _INCLUDE_DIR +# Interface include directories. Generator expressions OK. +# +# :: +# MAP_VAR_TO_PROP(target property variable [REQUIRED]) +# +# target - The name of the target we're changing. +# property - The property to append to. +# variable - The root name of the variable we're appending to target::property +# REQUIRED - Optional arg, if specified will throw a fatal error if no matching variable is found +# +# Primarily used by GENERATE_IMPORT_TARGET, but perhaps helpful externally when dealing +# with tricky libraries. Searches for as well as _ values, +# and appends any value found to the matching property (_DEBUG goes to _DEBUG) + +include(CMakeParseArguments) +include(VerboseMessage) + +function(map_var_to_prop target property var ) + set(options REQUIRED) + cmake_parse_arguments(map_var_to_prop ${options} "" "" ${ARGN}) + # message("Searching for ${var}") + foreach(_config _DEBUG _RELEASE "") + if(${var}${_config}) + verbose_message("Appending to ${target} ${property}${_config}: ${${var}${_config}}") + set(_found TRUE) + #mark_as_advanced(${property}${_config}) #anything that gets passed in here is an advanced variable + set_property(TARGET ${target} APPEND + PROPERTY ${property}${_config} "${${var}${_config}}") + endif() + endforeach() + + #set the default to a nice generator expression if it is not in the blacklist + set(_genexpr_unsupported_properties "IMPORTED_LOCATION") + list(FIND _genexpr_unsupported_properties _find_result ${property}) + if(NOT ${var} AND (_find_result EQUAL -1)) + set(_defaultprop) + foreach(_config DEBUG RELEASE) + if(${var}_${_config}) + set(_defaultprop ${_defaultprop}$<$:${${var}_${_config}}>) + endif() + endforeach() + set_property(TARGET ${target} PROPERTY ${property} ${_defaultprop}) + endif() + + if(map_var_to_prop_REQUIRED AND NOT _found) + message(FATAL_ERROR "${target}: required variable ${var}${var_suffix} is undefined.") + endif() + + get_target_property(_fullprop ${target} ${property}) + verbose_message("${target}:${property} = ${_fullprop}") +endfunction() + +#acceptable libtypes are SHARED, STATIC, INTERFACE, and UNKNOWN +function(generate_import_target namespace libtype) + set(_target ${namespace}::${namespace}) + cmake_parse_arguments(generate_import_target "LOCAL" "TARGET" "" ${ARGN}) + + if(generate_import_target_TARGET) + set(_target ${generate_import_target_TARGET}) + endif() + + if(${namespace}_FOUND) + verbose_message("Generating ${libtype} lib: ${_target} with namespace ${namespace}") + + set(_global GLOBAL) + if(generate_import_target_LOCAL) + unset(_global) + endif() + + add_library(${_target} ${libtype} IMPORTED ${_global}) + + if(MSVC AND ${libtype} STREQUAL SHARED) + map_var_to_prop(${_target} IMPORTED_IMPLIB ${namespace}_IMPORT_LIB REQUIRED) + endif() + + if(NOT ${libtype} STREQUAL INTERFACE) + if(${libtype} STREQUAL SHARED AND (${namespace}_SHARED_LIB OR (${namespace}_SHARED_LIB_DEBUG AND ${namespace}_SHARED_LIB_RELEASE))) + map_var_to_prop(${_target} IMPORTED_LOCATION ${namespace}_SHARED_LIB REQUIRED) + else() + map_var_to_prop(${_target} IMPORTED_LOCATION ${namespace}_LIBRARY REQUIRED) + endif() + endif() + + map_var_to_prop(${_target} INTERFACE_LINK_LIBRARIES ${namespace}_INTERFACE_LIBS) + map_var_to_prop(${_target} INTERFACE_INCLUDE_DIRECTORIES ${namespace}_INCLUDE_DIR) + endif() +endfunction() \ No newline at end of file diff --git a/DefinePostBuildResourceCopyRules.cmake b/DefinePostBuildResourceCopyRules.cmake new file mode 100644 index 000000000..3fdb454fd --- /dev/null +++ b/DefinePostBuildResourceCopyRules.cmake @@ -0,0 +1,85 @@ +#.rst +# +# DefinePostBuildResourceCopyRules +# -------------- +# +# Created by Victor Dods. +# Hides the nastiness of defining platform-specific rules for installing +# resource files post-build. + +# The RELATIVE_PATH_BASE option can be used to specify an (absolute) path which +# will be used as the base path for determining where the resource directory is +# located. The resource directory will depend on the platform and other options, +# such as if the target has MACOSX_BUNDLE specified. +function(define_post_build_resource_copy_rules) + # Do the fancy map-style parsing of the arguments + set(_options "") + set(_one_value_args + TARGET + RELATIVE_PATH_BASE + ) + set(_multi_value_args + RELATIVE_PATH_RESOURCES + ABSOLUTE_PATH_RESOURCES + TARGETS + ) + cmake_parse_arguments(_arg "${_options}" "${_one_value_args}" "${_multi_value_args}" ${ARGN}) + + if(NOT _arg_TARGET) + message(SEND_ERROR "must specify a value for TARGET in define_post_build_resource_copy_rules") + return() + endif() + + # The "base" resources dir which may be appended to, depending on the platform and other conditions. + set(_resources_dir "${PROJECT_BINARY_DIR}") + # Override it with the RELATIVE_PATH_BASE value if specified. + if(_arg_RELATIVE_PATH_BASE) + set(_resources_dir "${_arg_RELATIVE_PATH_BASE}") + endif() + # Decide where the resources directory is on each platform. + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # This is the correct way to detect Mac OS X operating system -- see http://www.openguru.com/2009/04/cmake-detecting-platformoperating.html + # TODO: apparently there is a different "correct" way to install files on Mac; + # see: http://www.cmake.org/cmake/help/v3.0/prop_sf/MACOSX_PACKAGE_LOCATION.html + # Though this seems unnecessary. Maybe we'll do this later. + if(${CMAKE_GENERATOR} MATCHES "Xcode") + # CMAKE_BUILD_TYPE will be one of Release, Debug, etc. + set(_resources_dir "${_resources_dir}/${CMAKE_BUILD_TYPE}") + endif() + + + # Check to see if the target is a Mac OS X bundle. If so, set the resources dir to the appropriate + # directory in the bundle + get_property(_mac_bundle TARGET ${_arg_TARGET} PROPERTY MACOSX_BUNDLE SET) + if (_mac_bundle) + set(_resources_dir "${_resources_dir}/${_arg_TARGET}.app/Contents/Resources") + endif() + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + # CMAKE_CFG_INTDIR will be one of Release, Debug, etc. + set(_resources_dir "${_resources_dir}/${CMAKE_CFG_INTDIR}") + endif() + + # Add post-build rules for copying the resources into the correct place. + # This should happen at the end of the build. + foreach(_resource ${_arg_RELATIVE_PATH_RESOURCES}) + # Add the post-build command for copying files (if different) + add_custom_command( + TARGET ${_arg_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${_resource}" "${_resources_dir}/${_resource}" + ) + endforeach() + foreach(_resource ${_arg_ABSOLUTE_PATH_RESOURCES}) + # Add the post-build command for copying files (if different) + get_filename_component(_resource_filename_component "${_resource}" NAME) + add_custom_command( + TARGET ${_arg_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_resource}" "${_resources_dir}/${_resource_filename_component}" + ) + endforeach() + + # Also add install rules for Linux + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + install(FILES ${_arg_RESOURCES} DESTINATION ${CMAKE_INSTALL_PREFIX}) + endif() +endfunction() diff --git a/FindAssimp.cmake b/FindAssimp.cmake new file mode 100644 index 000000000..eb11b194e --- /dev/null +++ b/FindAssimp.cmake @@ -0,0 +1,43 @@ +#.rst +# FindAssimp +# ------------ +# +# Created by Raffi Bedikian. +# Locate and configure Assimp +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# Assimp::Assimp +# +# Variables +# ^^^^^^^^^ +# Assimp_ROOT_DIR +# Assimp_FOUND +# Assimp_INCLUDE_DIR +# Assimp_LIBRARIES +# + +find_path(Assimp_ROOT_DIR + NAMES include/assimp/scene.h + PATH_SUFFIXES assimp-${Assimp_FIND_VERSION} + assimp) + +set(Assimp_INCLUDE_DIR ${Assimp_ROOT_DIR}/include) + +if(MSVC) + find_library(Assimp_LIBRARY_RELEASE "assimp.lib" HINTS "${Assimp_ROOT_DIR}" PATH_SUFFIXES lib) + find_library(Assimp_LIBRARY_DEBUG "assimpd.lib" HINTS "${Assimp_ROOT_DIR}" PATH_SUFFIXES lib) +else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + find_library(Assimp_LIBRARY_RELEASE "libassimp.a" HINTS "${Assimp_ROOT_DIR}" PATH_SUFFIXES lib) + find_library(Assimp_LIBRARY_DEBUG "libassimp.a" HINTS "${Assimp_ROOT_DIR}" PATH_SUFFIXES lib) +endif() +include(SelectConfigurations) +select_configurations(Assimp LIBRARY LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Assimp DEFAULT_MSG Assimp_ROOT_DIR Assimp_INCLUDE_DIR Assimp_LIBRARY_RELEASE Assimp_LIBRARY_DEBUG) + +include(CreateImportTargetHelpers) + +generate_import_target(Assimp STATIC) + diff --git a/FindBreakpad.cmake b/FindBreakpad.cmake new file mode 100644 index 000000000..4dc96d20d --- /dev/null +++ b/FindBreakpad.cmake @@ -0,0 +1,36 @@ +#.rst +# FindBreakpad +# ------------ +# +# Created by Walter Gray. +# Locate and configure Breakpad +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# Breakpad::Breakpad +# +# Variables +# ^^^^^^^^^ +# Breakpad_FOUND +# Breakpad_INCLUDE_DIR +# Breakpad_LIBRARY_DIR +# Breakpad_ROOT_DIR + +find_path(Breakpad_ROOT_DIR + NAMES include/google_breakpad/common/breakpad_types.h + PATH_SUFFIXES breakpad-${Breakpad_FIND_VERSION} + breakpad) + +set(Breakpad_INCLUDE_DIR "${Breakpad_ROOT_DIR}/include") +set(Breakpad_LIBRARY_DIR "${Breakpad_ROOT_DIR}/lib") +foreach(_lib IN ITEMS common.lib exception_handler.lib crash_generation_client.lib) + list(APPEND Breakpad_LIBRARIES "${Breakpad_LIBRARY_DIR}/${_lib}") +endforeach() + +set(Breakpad_LIBRARY ${Breakpad_LIBRARIES}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Breakpad DEFAULT_MSG Breakpad_ROOT_DIR Breakpad_INCLUDE_DIR Breakpad_LIBRARY_DIR Breakpad_LIBRARIES) + +include(CreateImportTargetHelpers) +generate_import_target(Breakpad STATIC) diff --git a/FindBullet.cmake b/FindBullet.cmake new file mode 100644 index 000000000..550c254e2 --- /dev/null +++ b/FindBullet.cmake @@ -0,0 +1,61 @@ +#.rst +# FindBullet +# ------------ +# +# Locate and configure Bullet Physics +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# FindBullet::FindBullet +# +# Variables +# ^^^^^^^^^ +# Bullet_ROOT_DIR +# Bullet_FOUND +# Bullet_INCLUDE_DIR +# Bullet_LIBRARIES +# + + +find_path(Bullet_ROOT_DIR NAMES "src/btBulletDynamicsCommon.h" PATH_SUFFIXES bullet-2.82-r2704) + +set(Bullet_INCLUDE_DIR ${Bullet_ROOT_DIR}/src) + +if(MSVC) + find_library(Bullet_COLLISION_LIBRARY_RELEASE NAMES "BulletCollision.lib" HINTS "${Bullet_ROOT_DIR}/lib/Win32/VS2013/Release" PATH_SUFFIXES lib) + find_library(Bullet_DYNAMICS_LIBRARY_RELEASE NAMES "BulletDynamics.lib" HINTS "${Bullet_ROOT_DIR}/lib/Win32/VS2013/Release" PATH_SUFFIXES lib) + find_library(Bullet_LINEAR_MATH_LIBRARY_RELEASE NAMES "LinearMath.lib" HINTS "${Bullet_ROOT_DIR}/lib/Win32/VS2013/Release" PATH_SUFFIXES lib) + + find_library(Bullet_COLLISION_LIBRARY_DEBUG NAMES "BulletCollision_Debug.lib" HINTS "${Bullet_ROOT_DIR}/lib/Win32/VS2013/Debug" PATH_SUFFIXES lib) + find_library(Bullet_DYNAMICS_LIBRARY_DEBUG NAMES "BulletDynamics_Debug.lib" HINTS "${Bullet_ROOT_DIR}/lib/Win32/VS2013/Debug" PATH_SUFFIXES lib) + find_library(Bullet_LINEAR_MATH_LIBRARY_DEBUG NAMES "LinearMath_Debug.lib" HINTS "${Bullet_ROOT_DIR}/lib/Win32/VS2013/Debug" PATH_SUFFIXES lib) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Mac + find_library(Bullet_COLLISION_LIBRARY_RELEASE NAMES "BulletCollision.a" HINTS "${Bullet_ROOT_DIR}/lib/Mac/Release" PATH_SUFFIXES lib) + find_library(Bullet_DYNAMICS_LIBRARY_RELEASE NAMES "BulletDynamics.a" HINTS "${Bullet_ROOT_DIR}/lib/Mac/Release" PATH_SUFFIXES lib) + find_library(Bullet_LINEAR_MATH_LIBRARY_RELEASE NAMES "LinearMath.a" HINTS "${Bullet_ROOT_DIR}/lib/Mac/Release" PATH_SUFFIXES lib) + + find_library(Bullet_COLLISION_LIBRARY_DEBUG NAMES "BulletCollision_Debug.a" HINTS "${Bullet_ROOT_DIR}/lib/Mac/Debug" PATH_SUFFIXES lib) + find_library(Bullet_DYNAMICS_LIBRARY_DEBUG NAMES "BulletDynamics_Debug.a" HINTS "${Bullet_ROOT_DIR}/lib/Mac/Debug" PATH_SUFFIXES lib) + find_library(Bullet_LINEAR_MATH_LIBRARY_DEBUG NAMES "LinearMath_Debug.a" HINTS "${Bullet_ROOT_DIR}/lib/Mac/Debug" PATH_SUFFIXES lib) +else() + # No linux support from Bullet! +endif() + +set(Bullet_LIBRARY_RELEASE "${Bullet_COLLISION_LIBRARY_RELEASE}" "${Bullet_DYNAMICS_LIBRARY_RELEASE}" "${Bullet_LINEAR_MATH_LIBRARY_RELEASE}") +set(Bullet_LIBRARY_DEBUG "${Bullet_COLLISION_LIBRARY_DEBUG}" "${Bullet_DYNAMICS_LIBRARY_DEBUG}" "${Bullet_LINEAR_MATH_LIBRARY_DEBUG}") +mark_as_advanced(Bullet_COLLISION_LIBRARY_RELEASE) +mark_as_advanced(Bullet_DYNAMICS_LIBRARY_RELEASE) +mark_as_advanced(Bullet_LINEAR_MATH_LIBRARY_RELEASE) +mark_as_advanced(Bullet_COLLISION_LIBRARY_DEBUG) +mark_as_advanced(Bullet_DYNAMICS_LIBRARY_DEBUG) +mark_as_advanced(Bullet_LINEAR_MATH_LIBRARY_DEBUG) + +include(SelectConfigurations) +select_configurations(Bullet LIBRARY LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Bullet DEFAULT_MSG Bullet_ROOT_DIR Bullet_INCLUDE_DIR Bullet_LIBRARY_RELEASE Bullet_LIBRARY_DEBUG) + +include(CreateImportTargetHelpers) + +generate_import_target(Bullet STATIC) diff --git a/FindCURL.cmake b/FindCURL.cmake new file mode 100644 index 000000000..a17c5cca4 --- /dev/null +++ b/FindCURL.cmake @@ -0,0 +1,42 @@ +#.rst +# FindCURL +# ------------ +# +# Created by Walter Gray. +# Locate and configure CURL +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# CURL::CURL +# +# Variables +# ^^^^^^^^^ +# CURL_ROOT_DIR +# CURL_FOUND +# CURL_INCLUDE_DIR +# CURL_LIBRARIES +# CURL_LIBRARY_RELEASE +# CURL_LIBRARY_DEBUG + +find_path(CURL_ROOT_DIR + NAMES include/curl/curl.h + PATH_SUFFIXES curl-${CURL_FIND_VERSION} + curl) + +set(CURL_INCLUDE_DIR ${CURL_ROOT_DIR}/include) + +if(MSVC) + find_library(CURL_LIBRARY_RELEASE "libcurl.lib" HINTS "${CURL_ROOT_DIR}/lib/release") + find_library(CURL_LIBRARY_DEBUG "libcurl.lib" HINTS "${CURL_ROOT_DIR}/lib/debug") +else() + find_library(CURL_LIBRARY_RELEASE "libcurl.a" HINTS "${CURL_ROOT_DIR}/lib") + find_library(CURL_LIBRARY_DEBUG "libcurl.a" HINTS "${CURL_ROOT_DIR}/lib") +endif() +include(SelectConfigurations) +select_configurations(CURL LIBRARY LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CURL DEFAULT_MSG CURL_INCLUDE_DIR CURL_LIBRARIES) + +include(CreateImportTargetHelpers) +generate_import_target(CURL STATIC) \ No newline at end of file diff --git a/FindCinder.cmake b/FindCinder.cmake new file mode 100644 index 000000000..8f9db999a --- /dev/null +++ b/FindCinder.cmake @@ -0,0 +1,95 @@ +#.rst +# FindCinder +# ---------- +# +# Created by Walter Gray +# Locate and configure cinder 0.8.5 for vc2010. Untested with other versions. +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# Cinder::Cinder +# Interface target. references Cinder::Core and all +# required boost libraries with the required ordering. +# +# Cinder::Core +# Static import target. Does not include cinder's dependencies. +# Typically not referenced outside of Cinder::Cinder +# +# Variables +# ^^^^^^^^^ +# Cinder_ROOT_DIR +# Root of the cinder package +# Cinder_FOUND +# If false, do not link to Cinder +# Cinder_LIBRARIES +# The names of the libraries to feed into target_link_libraries +# Cinder_INCLUDE_DIR +# Where to find the root of the cinder includes +# Cinder_LIBRARY_ +# The location of the main cinder library +# +# This module will also find and add the Boost package which is included with Cinder, +# create a master Boost::Boost interface library which links to a series of +# Boost:: static import libraries. + +if(MSVC10) + set(_compiler_SUFFIX "vc2010") +endif() + +find_path(Cinder_ROOT_DIR + NAMES include/cinder/Cinder.h + PATH_SUFFIXES cinder_${Cinder_FIND_VERSION}_${_compiler_SUFFIX} + cinder_${Cinder_FIND_VERSION} + cinder) + + +find_path(Cinder_INCLUDE_DIR + NAMES "cinder/Cinder.h" + HINTS "${Cinder_ROOT_DIR}" + PATH_SUFFIXES "include") + +find_library(Cinder_LIBRARY_RELEASE "cinder.lib" HINTS "${Cinder_ROOT_DIR}/lib") +find_library(Cinder_LIBRARY_DEBUG "cinder_d.lib" HINTS "${Cinder_ROOT_DIR}/lib") + +include(SelectConfigurations) +select_configurations(Cinder LIBRARY LIBRARIES) + +#Find Boost +if(MSVC) + set(BOOST_LIBRARYDIR "${Cinder_ROOT_DIR}/lib/msw") + set(_boost_components chrono date_time filesystem regex system thread) +else() + set(BOOST_LIBRARYDIR "${Cinder_ROOT_DIR}/lib/macosx") + set(_boost_components date_time filesystem system) +endif() + + +set(BOOST_ROOT ${Cinder_ROOT_DIR}/boost) +set(Boost_USE_STATIC_RUNTIME ON) +set(Boost_USE_MULTITHREADED ON) +set(Boost_USE_STATIC_LIBS ON) + +find_package(Boost REQUIRED QUIET COMPONENTS ${_boost_components} ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Cinder DEFAULT_MSG Cinder_ROOT_DIR Cinder_LIBRARIES Cinder_INCLUDE_DIR) + +#Setup the interface targets + +#Thanks to cinder's custom boost layout, we have to first create import targets +#for all of the boost components, then link them with the Cinder master interface library +#BEFORE linking in the actual cinder import target +include(CreateImportTargetHelpers) + +if(Cinder_FOUND AND NOT TARGET Cinder::Cinder) + generate_import_target(Boost INTERFACE) + foreach(_component ${_boost_components}) + string(TOUPPER ${_component} _componentUPPER) + generate_import_target(Boost_${_componentUPPER} STATIC TARGET Boost::${_component}) + target_link_libraries(Boost::Boost INTERFACE Boost::${_component}) + endforeach() + + generate_import_target(Cinder STATIC TARGET Cinder::Core) + add_library(Cinder::Cinder INTERFACE IMPORTED GLOBAL) + target_link_libraries(Cinder::Cinder INTERFACE Boost::Boost Cinder::Core) +endif() \ No newline at end of file diff --git a/FindEigen.cmake b/FindEigen.cmake new file mode 100644 index 000000000..0caefe4a0 --- /dev/null +++ b/FindEigen.cmake @@ -0,0 +1,32 @@ +#.rst +# FindEigen +# ---------- +# +# Created by Walter Gray +# Locate and configure Eigen +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# Eigen::Eigen +# +# Variables +# ^^^^^^^^^ +# Eigen_ROOT_DIR +# Eigen_FOUND +# Eigen_INCLUDE_DIR + +find_path(Eigen_ROOT_DIR + NAMES Eigen/Eigen + PATH_SUFFIXES eigen-${Eigen_FIND_VERSION} + eigen) + +set(Eigen_INCLUDE_DIR "${Eigen_ROOT_DIR}") +if(EXISTS ${Eigen_INCLUDE_DIR}) + set(Eigen_FOUND) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Eigen DEFAULT_MSG Eigen_INCLUDE_DIR) + +include(CreateImportTargetHelpers) +generate_import_target(Eigen INTERFACE) \ No newline at end of file diff --git a/FindFbxSdk.cmake b/FindFbxSdk.cmake new file mode 100644 index 000000000..63b1c5797 --- /dev/null +++ b/FindFbxSdk.cmake @@ -0,0 +1,56 @@ +#.rst +# FindFbxSdk +# ------------ +# +# Created by Walter Gray. +# Locate and configure FbxSdk +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# FbxSdk::FbxSdk +# +# Variables +# ^^^^^^^^^ +# FbxSdk_ROOT_DIR +# FbxSdk_FOUND +# FbxSdk_INCLUDE_DIR +# FbxSdk_LIBRARIES + +find_path(FbxSdk_ROOT_DIR + NAMES include/fbxsdk.h + HINTS ${EXTERNAL_LIBRARY_DIR} + PATH_SUFFIXES fbx-sdk-${FbxSdk_FIND_VERSION} + fbx-sdk + # NOTE: 2014.2 does not compile with VS2012 + # fbx-sdk/2014.2 + # TODO: we should make this folder structure more consistent, most likely fbx-sdk/2015.1 + fbx-sdk/2015.1 + fbx2015/2015.1) + +set(FbxSdk_INCLUDE_DIR "${FbxSdk_ROOT_DIR}/include") + +if (CMAKE_SIZEOF_VOID_P EQUAL 8) # 64bit + set(BUILD_BIT_TYPE "x64") +else() # 32bit + set(BUILD_BIT_TYPE "x86") +endif() + +if(MSVC) + find_library(FbxSdk_LIBRARY_RELEASE "libfbxsdk-md.lib" HINTS "${FbxSdk_ROOT_DIR}/lib/vs2013/${BUILD_BIT_TYPE}/release") + find_library(FbxSdk_LIBRARY_DEBUG "libfbxsdk-md.lib" HINTS "${FbxSdk_ROOT_DIR}/lib/vs2013/${BUILD_BIT_TYPE}/debug") +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # This is the correct way to detect Linux operating system -- see http://www.openguru.com/2009/04/cmake-detecting-platformoperating.html + find_library(FbxSdk_LIBRARY_RELEASE "libfbxsdk.a" HINTS "${FbxSdk_ROOT_DIR}/lib/gcc4/${BUILD_BIT_TYPE}/release") + find_library(FbxSdk_LIBRARY_DEBUG "libfbxsdk.a" HINTS "${FbxSdk_ROOT_DIR}/lib/gcc4/${BUILD_BIT_TYPE}/debug") +else() + find_library(FbxSdk_LIBRARY_RELEASE "libfbxsdk.a" HINTS "${FbxSdk_ROOT_DIR}/lib/clang/ub/release") + find_library(FbxSdk_LIBRARY_DEBUG "libfbxsdk.a" HINTS "${FbxSdk_ROOT_DIR}/lib/clang/ub/debug") +endif() +include(SelectConfigurations) +select_configurations(FbxSdk LIBRARY LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FbxSdk DEFAULT_MSG FbxSdk_INCLUDE_DIR FbxSdk_LIBRARIES) + +include(CreateImportTargetHelpers) +generate_import_target(FbxSdk STATIC) + diff --git a/FindFreeImage.cmake b/FindFreeImage.cmake new file mode 100644 index 000000000..2d559b710 --- /dev/null +++ b/FindFreeImage.cmake @@ -0,0 +1,47 @@ +#.rst +# FindFreeImage +# ------------ +# +# Created by Walter Gray. +# Locate and configure FreeImage +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# FreeImage::FreeImage +# +# Variables +# ^^^^^^^^^ +# FreeImage_ROOT_DIR +# FreeImage_FOUND +# FreeImage_INCLUDE_DIR +# FreeImage_LIBRARIES +# +find_path(FreeImage_ROOT_DIR + NAMES Dist/FreeImage.h + include/FreeImage.h + PATH_SUFFIXES FreeImage-${FreeImage_FIND_VERSION} + FreeImage) + +find_path(FreeImage_INCLUDE_DIR "FreeImage.h" + HINTS "${FreeImage_ROOT_DIR}" + PATH_SUFFIXES Dist include) + + +#Todo: add the ability to select between shared and dynamic versions +if(MSVC) + find_library(FreeImage_LIBRARY_RELEASE "FreeImage.lib" HINTS "${FreeImage_ROOT_DIR}" PATH_SUFFIXES lib Dist) + find_library(FreeImage_LIBRARY_DEBUG "FreeImaged.lib" HINTS "${FreeImage_ROOT_DIR}" PATH_SUFFIXES lib Dist) +else() + find_library(FreeImage_LIBRARY_RELEASE "libfreeimage.a" HINTS "${FreeImage_ROOT_DIR}" PATH_SUFFIXES lib Dist) + find_library(FreeImage_LIBRARY_DEBUG "libfreeimage.a" HINTS "${FreeImage_ROOT_DIR}" PATH_SUFFIXES lib Dist) +endif() + +include(SelectConfigurations) +select_configurations(FreeImage LIBRARY LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FreeImage DEFAULT_MSG FreeImage_ROOT_DIR FreeImage_INCLUDE_DIR FreeImage_LIBRARY_RELEASE FreeImage_LIBRARY_DEBUG) + +include(CreateImportTargetHelpers) + +generate_import_target(FreeImage STATIC) diff --git a/FindGlew.cmake b/FindGlew.cmake new file mode 100644 index 000000000..8e80ad594 --- /dev/null +++ b/FindGlew.cmake @@ -0,0 +1,47 @@ +#.rst +# FindGlew +# ------------ +# +# Created by Raffi Bedikian. +# Locate and configure Glew +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# FindGlew::FindGlew +# +# Variables +# ^^^^^^^^^ +# Glew_ROOT_DIR +# Glew_FOUND +# Glew_INCLUDE_DIR +# Glew_LIBRARIES +# +find_path(Glew_ROOT_DIR + NAMES include/GL/glew.h + PATH_SUFFIXES glew-${Glew_FIND_VERSION} + Glew) +find_path( + Glew_INCLUDE_DIR + NAMES GL/glew.h + HINTS ${Glew_ROOT_DIR} + PATH_SUFFIXES include + NO_DEFAULT_PATH + ) + +if(MSVC) + find_library(Glew_LIBRARY_RELEASE "glew32s.lib" HINTS "${Glew_ROOT_DIR}" PATH_SUFFIXES lib) + find_library(Glew_LIBRARY_DEBUG "glew32s.lib" HINTS "${Glew_ROOT_DIR}" PATH_SUFFIXES lib) +else() + # Linux's glew-1.9.0 package's libs are in lib64 + find_library(Glew_LIBRARY_RELEASE "libGLEW.a" HINTS "${Glew_ROOT_DIR}" PATH_SUFFIXES lib lib64) + find_library(Glew_LIBRARY_DEBUG "libGLEW.a" HINTS "${Glew_ROOT_DIR}" PATH_SUFFIXES lib lib64) +endif() +include(SelectConfigurations) +select_configurations(Glew LIBRARY LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Glew DEFAULT_MSG Glew_ROOT_DIR Glew_INCLUDE_DIR Glew_LIBRARY_RELEASE Glew_LIBRARY_DEBUG) + +include(CreateImportTargetHelpers) + +generate_import_target(Glew STATIC) diff --git a/FindInf2Cat.cmake b/FindInf2Cat.cmake new file mode 100644 index 000000000..b6089581a --- /dev/null +++ b/FindInf2Cat.cmake @@ -0,0 +1,28 @@ +# - Try to find Inf2Cat +# Once done this will define +# Inf2Cat_FOUND - System has Inf2Cat +# Inf2Cat_BIN - The path to Inf2Cat + +set(wdkregpath80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]") +get_filename_component(wdkpath80 ${wdkregpath80} ABSOLUTE) + +set(wdkregpath81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]") +get_filename_component(wdkpath81 ${wdkregpath81} ABSOLUTE) + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(WDK_ARCH "x64") +else() + set(WDK_ARCH "x86") +endif() + +# Directly locate inf2cat: +find_program( + Inf2Cat_BIN Inf2Cat + PATHS ${wdkpath81} ${wdkpath80} ${WDK_ROOT_ALTERNATE} + PATH_SUFFIXES bin/${WDK_ARCH} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Inf2Cat DEFAULT_MSG Inf2Cat_BIN) + + diff --git a/FindIrrklang.cmake b/FindIrrklang.cmake new file mode 100644 index 000000000..a94f8db55 --- /dev/null +++ b/FindIrrklang.cmake @@ -0,0 +1,48 @@ +#.rst +# FindIrrklang +# ------------ +# +# Created by Walter Gray. +# Locate and configure Irrklang +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# Irrklang::Irrklang +# +# Variables +# ^^^^^^^^^ +# Irrklang_ROOT_DIR +# Irrklang_FOUND +# Irrklang_INCLUDE_DIR +# Irrklang_LIBRARY +# Irrklang_IMPORT_LIB + +find_path(Irrklang_ROOT_DIR + NAMES include/irrKlang.h + HINTS ${EXTERNAL_LIBRARY_DIR} + PATH_SUFFIXES irrKlang-${Irrklang_FIND_VERSION} + irrKlang) + +find_path(Irrklang_INCLUDE_DIR + NAMES irrKlang.h + HINTS "${Irrklang_ROOT_DIR}/include") + +if(MSVC) + find_file(Irrklang_LIBRARY + NAMES irrKlang.dll + HINTS "${Irrklang_ROOT_DIR}/bin/win32-visualStudio/") + find_library(Irrklang_IMPORT_LIB + NAMES irrKlang.lib + HINTS "${Irrklang_ROOT_DIR}/lib/win32-visualStudio/") + mark_as_advanced(Irrklang_IMPORT_LIB) +else() + find_library(Irrklang_LIBRARY + NAMES libirrklang.dylib + HINTS "${Irrklang_ROOT_DIR}/bin/macosx-gcc/") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Irrklang DEFAULT_MSG Irrklang_INCLUDE_DIR Irrklang_LIBRARY) + +include(CreateImportTargetHelpers) +generate_import_target(Irrklang SHARED) \ No newline at end of file diff --git a/FindLeap.cmake b/FindLeap.cmake new file mode 100644 index 000000000..d4e480831 --- /dev/null +++ b/FindLeap.cmake @@ -0,0 +1,61 @@ +#.rst +# FindLeap +# ------------ +# +# Created by Walter Gray. +# Locate and configure Leap +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# Leap::Leap +# +# Variables +# ^^^^^^^^^ +# Leap_ROOT_DIR +# Leap_FOUND +# Leap_INCLUDE_DIR +# Leap_LIBRARY +# Leap_IMPORT_LIB + +find_path(Leap_ROOT_DIR + NAMES include/Leap.h + HINTS ${EXTERNAL_LIBRARY_DIR} + PATH_SUFFIXES LeapSDK-${Leap_FIND_VERSION} + LeapSDK) +#we should check the version.txt file here... + +set(Leap_INCLUDE_DIR "${Leap_ROOT_DIR}/include") +if(MSVC) + find_library(Leap_IMPORT_LIB_RELEASE "Leap.lib" HINTS "${Leap_ROOT_DIR}/lib/x86") + find_library(Leap_IMPORT_LIB_DEBUG "Leapd.lib" HINTS "${Leap_ROOT_DIR}/lib/x86") + + find_file(Leap_LIBRARY_RELEASE + NAMES Leap.dll + HINTS "${Leap_ROOT_DIR}/lib/x86") + find_file(Leap_LIBRARY_DEBUG + NAMES Leapd.dll + Leap.dll #fallback on the release library if we must + HINTS "${Leap_ROOT_DIR}/lib/x86") + mark_as_advanced(Leap_IMPORT_LIB_RELEASE Leap_IMPORT_LIB_DEBUG) +else() + if(USE_LIBCXX) + set(_libdir ${Leap_ROOT_DIR}/lib/libc++) + else() + set(_libdir ${Leap_ROOT_DIR}/lib) + endif() + + find_library(Leap_LIBRARY_RELEASE + NAMES libLeap.dylib + HINTS "${_libdir}") + find_library(Leap_LIBRARY_DEBUG + NAMES libLeapd.dylib + libLeap.dylib #fallback on the release library + HINTS "${_libdir}") +endif() + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Leap DEFAULT_MSG Leap_ROOT_DIR Leap_INCLUDE_DIR Leap_LIBRARY_RELEASE Leap_LIBRARY_DEBUG) + +include(CreateImportTargetHelpers) +generate_import_target(Leap SHARED) diff --git a/FindNanoSVG.cmake b/FindNanoSVG.cmake new file mode 100644 index 000000000..d06860b31 --- /dev/null +++ b/FindNanoSVG.cmake @@ -0,0 +1,31 @@ +#.rst +# FindNanoSVG +# ---------- +# +# Created by Jonathan Marsden +# Locate and configure nanosvg +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# NanoSVG::NanoSVG +# +# Variables +# ^^^^^^^^^ +# NanoSVG_ROOT_DIR +# NanoSVG_FOUND +# NanoSVG_INCLUDE_DIR + +find_path(NanoSVG_ROOT_DIR + NAMES include/nanosvg.h + PATH_SUFFIXES nanosvg) + +set(NanoSVG_INCLUDE_DIR "${NanoSVG_ROOT_DIR}/include") +if(EXISTS ${NanoSVG_INCLUDE_DIR}) + set(NanoSVG_FOUND) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NanoSVG DEFAULT_MSG NanoSVG_INCLUDE_DIR) + +include(CreateImportTargetHelpers) +generate_import_target(NanoSVG INTERFACE) diff --git a/FindOculusSDK.cmake b/FindOculusSDK.cmake new file mode 100644 index 000000000..49540ca51 --- /dev/null +++ b/FindOculusSDK.cmake @@ -0,0 +1,47 @@ +#.rst +# FindOculusSDK +# ------------ +# +# Locate and configure Oculus +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# FindOculusSDK::FindOculusSDK +# +# Variables +# ^^^^^^^^^ +# OculusSDK_ROOT_DIR +# OculusSDK_INCLUDE_DIR +# OculusSDK_LIBRARIES_RELEASE +# OculusSDK_LIBRARIES_DEBUG +# + + +find_path(OculusSDK_ROOT_DIR NAMES "LibOVR/Include/OVR.h" PATH_SUFFIXES OculusSDK) + +#We include the src directory as well since we need OVR_CAPI_GL/D3D +set(OculusSDK_INCLUDE_DIR "${OculusSDK_ROOT_DIR}/LibOVR/Include" "${OculusSDK_ROOT_DIR}/LibOVR/Src") + +if(MSVC) + find_library(OculusSDK_LIBRARY_RELEASE "libovr.lib" HINTS "${OculusSDK_ROOT_DIR}/LibOVR/Lib/Win32/VS2013" PATH_SUFFIXES lib) + find_library(OculusSDK_LIBRARY_DEBUG "libovrd.lib" HINTS "${OculusSDK_ROOT_DIR}/LibOVR/Lib/Win32/VS2013" PATH_SUFFIXES lib) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Mac + find_library(OculusSDK_LIBRARY_RELEASE "libovr.a" HINTS "${OculusSDK_ROOT_DIR}/LibOVR/Lib/Mac/Release" PATH_SUFFIXES lib) + find_library(OculusSDK_LIBRARY_DEBUG "libovr.a" HINTS "${OculusSDK_ROOT_DIR}/LibOVR/Lib/Mac/Debug" PATH_SUFFIXES lib) +else() + # No linux support from Oculus Rift! +endif() +include(SelectConfigurations) +select_configurations(OculusSDK LIBRARY LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OculusSDK DEFAULT_MSG OculusSDK_ROOT_DIR OculusSDK_INCLUDE_DIR OculusSDK_LIBRARY_RELEASE OculusSDK_LIBRARY_DEBUG) + +include(CreateImportTargetHelpers) + +generate_import_target(OculusSDK STATIC) + +if(WIN32) + #Oculus dev kit relies on winmm and winsock2 + target_link_libraries(OculusSDK::OculusSDK INTERFACE winmm Ws2_32) +endif() \ No newline at end of file diff --git a/FindOpenGL.cmake b/FindOpenGL.cmake new file mode 100644 index 000000000..fc2984c21 --- /dev/null +++ b/FindOpenGL.cmake @@ -0,0 +1,96 @@ +#.rst: +# FindOpenGL +# ---------- +# +# Total refactor of the cmake-supplied FindOpenGL.cmake module to be +# more in-line with the generate_import_target command. + +set(_OpenGL_REQUIRED_VARS "") + +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + list(APPEND _OpenGL_REQUIRED_VARS OpenGL_LIBRARY) + + #opengl32.lib lives in the windows sdk, which means we can't use find_library since windows + #doesn't add the wdk directory to any path variable that I could find. + set(OpenGL_LIBRARY opengl32.lib CACHE STRING "OpenGL library for win32") + set(OpenGL_INTERFACE_LIBS glu32.lib CACHE STRING "GLU library for win32") +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Mac + list(APPEND _OpenGL_REQUIRED_VARS OpenGL_INCLUDE_DIR) + find_path(OpenGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX") + set(OpenGL_INTERFACE_LIBS "-framework OpenGL;-framework AGL") +else() + # The first line below is to make sure that the proper headers + # are used on a Linux machine with the NVidia drivers installed. + # They replace Mesa with NVidia's own library but normally do not + # install headers and that causes the linking to + # fail since the compiler finds the Mesa headers but NVidia's library. + # Make sure the NVIDIA directory comes BEFORE the others. + # - Atanas Georgiev + + list(APPEND _OpenGL_REQUIRED_VARS OpenGL_INCLUDE_DIR) + list(APPEND _OpenGL_REQUIRED_VARS OpenGL_LIBRARY) + find_path( + OpenGL_INCLUDE_DIR + NAMES + GL/gl.h + PATHS + /usr/share/doc/NVIDIA_GLX-1.0/include + /usr/openwin/share/include + /opt/graphics/OpenGL/include + /usr/X11R6/include + ) + + find_library( + OpenGL_LIBRARY + NAMES + GL + MesaGL + PATHS + /opt/graphics/OpenGL/lib + /usr/openwin/lib + /usr/shlib /usr/X11R6/lib + ) + find_library( + OpenGL_INTERFACE_LIBS + NAMES + GLU + MesaGLU + PATHS + ${OpenGL_gl_LIBRARY} + /opt/graphics/OpenGL/lib + /usr/openwin/lib + /usr/shlib /usr/X11R6/lib + ) + + # # On Unix OpenGL most certainly always requires X11. + # # Feel free to tighten up these conditions if you don't + # # think this is always true. + + # if (OpenGL_gl_LIBRARY) + # if(NOT X11_FOUND) + # include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake) + # endif() + # if (X11_FOUND) + # set (OPENGL_LIBRARIES ${X11_LIBRARIES}) + # endif () + # endif () +endif () + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS}) +unset(_OpenGL_REQUIRED_VARS) + +mark_as_advanced( + OpenGL_LIBRARY + OpenGL_INCLUDE_DIR +) + +include(CreateImportTargetHelpers) +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + generate_import_target(OpenGL INTERFACE) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + #technically not true, but we don't have to do anything with the dll so... + generate_import_target(OpenGL STATIC) +else() + generate_import_target(OpenGL SHARED) +endif() diff --git a/FindOpenSSL.cmake b/FindOpenSSL.cmake new file mode 100644 index 000000000..4253b5bdf --- /dev/null +++ b/FindOpenSSL.cmake @@ -0,0 +1,43 @@ +#Our OpenSSL setup is non-standard, so set these variables up beforehand + +find_path(OPENSSL_ROOT_DIR + NAMES include/openssl/opensslconf.h + PATH_SUFFIXES openssl +) + +include(CreateImportTargetHelpers) + +if(MSVC) + find_library(LIB_EAY_DEBUG NAMES libeay32.lib HINTS ${OPENSSL_ROOT_DIR}/lib/debug) + find_library(LIB_EAY_RELEASE NAMES libeay32.lib HINTS ${OPENSSL_ROOT_DIR}/lib/release) + find_library(SSL_EAY_DEBUG NAMES ssleay32.lib HINTS ${OPENSSL_ROOT_DIR}/lib/debug) + find_library(SSL_EAY_RELEASE NAMES ssleay32.lib HINTS ${OPENSSL_ROOT_DIR}/lib/release) + mark_as_advanced(LIB_EAY_DEBUG LIB_EAY_RELEASE SSL_EAY_DEBUG SSL_EAY_RELEASE) + + include(${CMAKE_ROOT}/Modules/FindOpenSSL.cmake) + + #override the bad OPENSSL_LIBRARIES value + include(SelectConfigurations) + select_configurations(LIB_EAY LIBRARY) + select_configurations(SSL_EAY LIBRARY) + + set(OPENSSL_LIBRARIES "${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY}") + set(OPENSSL_LIBRARY_DEBUG "${LIB_EAY_DEBUG};${SSL_EAY_DEBUG}") + set(OPENSSL_LIBRARY_RELEASE "${LIB_EAY_RELEASE};${SSL_EAY_RELEASE}") + generate_import_target(OPENSSL STATIC) + +else() + include(${CMAKE_ROOT}/Modules/FindOpenSSL.cmake) + if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}") + set(OPENSSL_CRYPTO_FOUND TRUE) + endif() + if(EXISTS "${OPENSSL_SSL_LIBRARY}") + set(OPENSSL_SSL_FOUND TRUE) + endif() + generate_import_target(OPENSSL_CRYPTO STATIC TARGET OPENSSL::Crypto) + generate_import_target(OPENSSL_SSL STATIC TARGET OPENSSL::SSL) + generate_import_target(OPENSSL INTERFACE) + target_link_libraries(OPENSSL::OPENSSL INTERFACE OPENSSL::Crypto OPENSSL::SSL) +endif() + + diff --git a/FindPackageHandleStandardArgs.cmake b/FindPackageHandleStandardArgs.cmake new file mode 100644 index 000000000..5dd4c376d --- /dev/null +++ b/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,357 @@ +#.rst: +# FindPackageHandleStandardArgs +# ----------------------------- +# +# Changed By Walter Gray to make the default FOUND_VAR use +# the OriginalCase_Name instead of UPPERCASE_NAME. It also +# will now mark all find_vars as advanced. +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( ... ) +# +# This function is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED, QUIET and version-related arguments to +# find_package(). It also sets the _FOUND variable. The +# package is considered found if all variables ... listed contain +# valid results, e.g. valid filepaths. +# +# There are two modes of this function. The first argument in both +# modes is the name of the Find-module where it is called (in original +# casing). +# +# The first simple mode looks like this: +# +# :: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( (DEFAULT_MSG|"Custom failure message") ... ) +# +# If the variables to are all valid, then +# _FOUND will be set to TRUE. If DEFAULT_MSG is given +# as second argument, then the function will generate itself useful +# success and error messages. You can also supply a custom error +# message for the failure case. This is not recommended. +# +# The second mode is more powerful and also supports version checking: +# +# :: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [FOUND_VAR ] +# [REQUIRED_VARS ...] +# [VERSION_VAR ] +# [HANDLE_COMPONENTS] +# [CONFIG_MODE] +# [FAIL_MESSAGE "Custom failure message"] ) +# +# +# +# In this mode, the name of the result-variable can be set either to +# either _FOUND or _FOUND using the +# FOUND_VAR option. Other names for the result-variable are not +# allowed. So for a Find-module named FindFooBar.cmake, the two +# possible names are FooBar_FOUND and FOOBAR_FOUND. It is recommended +# to use the original case version. If the FOUND_VAR option is not +# used, the default is _FOUND. +# +# As in the simple mode, if through are all valid, +# _FOUND will be set to TRUE. After REQUIRED_VARS the +# variables which are required for this package are listed. Following +# VERSION_VAR the name of the variable can be specified which holds the +# version of the package which has been found. If this is done, this +# version will be checked against the (potentially) specified required +# version used in the find_package() call. The EXACT keyword is also +# handled. The default messages include information about the required +# version and the version which has been actually found, both if the +# version is ok or not. If the package supports components, use the +# HANDLE_COMPONENTS option to enable handling them. In this case, +# find_package_handle_standard_args() will report which components have +# been found and which are missing, and the _FOUND variable +# will be set to FALSE if any of the required components (i.e. not the +# ones listed after OPTIONAL_COMPONENTS) are missing. Use the option +# CONFIG_MODE if your FindXXX.cmake module is a wrapper for a +# find_package(... NO_MODULE) call. In this case VERSION_VAR will be +# set to _VERSION and the macro will automatically check whether +# the Config module was found. Via FAIL_MESSAGE a custom failure +# message can be specified, if this is not used, the default message +# will be displayed. +# +# Example for mode 1: +# +# :: +# +# find_package_handle_standard_args(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) +# +# +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to +# TRUE. If it is not found and REQUIRED was used, it fails with +# FATAL_ERROR, independent whether QUIET was used or not. If it is +# found, success will be reported, including the content of . On +# repeated Cmake runs, the same message won't be printed again. +# +# Example for mode 2: +# +# :: +# +# find_package_handle_standard_args(LibXslt FOUND_VAR LibXslt_FOUND +# REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS +# VERSION_VAR LibXslt_VERSION_STRING) +# +# In this case, LibXslt is considered to be found if the variable(s) +# listed after REQUIRED_VAR are all valid, i.e. LibXslt_LIBRARIES and +# LibXslt_INCLUDE_DIRS in this case. The result will then be stored in +# LibXslt_FOUND . Also the version of LibXslt will be checked by using +# the version contained in LibXslt_VERSION_STRING. Since no +# FAIL_MESSAGE is given, the default messages will be printed. +# +# Another example for mode 2: +# +# :: +# +# find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) +# find_package_handle_standard_args(Automoc4 CONFIG_MODE) +# +# In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4 +# NO_MODULE) and adds an additional search directory for automoc4. Here +# the result will be stored in AUTOMOC4_FOUND. The following +# FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# success/error message. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(FindPackageMessage) +include(CMakeParseArguments) + +# internal helper macro +macro(_FPHSA_FAILURE_MESSAGE _msg) + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${_msg}") + else () + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${_msg}") + endif () + endif () +endmacro() + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + if(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + else() + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + if(${_NAME}_CONSIDERED_CONFIGS) + set(configsText "") + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + math(EXPR configsCount "${configsCount} - 1") + foreach(currentConfigIndex RANGE ${configsCount}) + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + set(configsText "${configsText} ${filename} (version ${version})\n") + endforeach() + if (${_NAME}_NOT_FOUND_MESSAGE) + set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + else() + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + endif() + endif() +endmacro() + + +function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + +# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in +# new extended or in the "old" mode: + set(options CONFIG_MODE HANDLE_COMPONENTS) + set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR) + set(multiValueArgs REQUIRED_VARS) + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + if(${INDEX} EQUAL -1) + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + set(FPHSA_REQUIRED_VARS ${ARGN}) + set(FPHSA_VERSION_VAR) + else() + + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + if(FPHSA_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT FPHSA_FAIL_MESSAGE) + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + endif() + endif() + +# now that we collected all arguments, process them + + if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + endif() + + # In config-mode, we rely on the variable _CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + if(FPHSA_CONFIG_MODE) + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) + endif() + + if(NOT FPHSA_REQUIRED_VARS) + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + endif() + + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + string(TOUPPER ${_NAME} _NAME_UPPER) + string(TOLOWER ${_NAME} _NAME_LOWER) + + if(FPHSA_FOUND_VAR) + if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$") + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME}_FOUND) + endif() + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + set(MISSING_VARS "") + set(DETAILS "") + # check if all passed variables are valid + unset(${_FOUND_VAR}) + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + if(NOT ${_CURRENT_VAR}) + set(${_FOUND_VAR} FALSE) + set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") + else() + if(NOT _CURRENT_VAR MATCHES ".*_ROOT_DIR") + mark_as_advanced(${_CURRENT_VAR}) + endif() + + set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") + endif() + endforeach() + if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE") + set(${_FOUND_VAR} TRUE) + endif() + + # component handling + unset(FOUND_COMPONENTS_MSG) + unset(MISSING_COMPONENTS_MSG) + + if(FPHSA_HANDLE_COMPONENTS) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(${_NAME}_${comp}_FOUND) + + if(NOT DEFINED FOUND_COMPONENTS_MSG) + set(FOUND_COMPONENTS_MSG "found components: ") + endif() + set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") + + else() + + if(NOT DEFINED MISSING_COMPONENTS_MSG) + set(MISSING_COMPONENTS_MSG "missing components: ") + endif() + set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") + + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_FOUND_VAR} FALSE) + set(MISSING_VARS "${MISSING_VARS} ${comp}") + endif() + + endif() + endforeach() + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") + set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") + endif() + + # version handling: + set(VERSION_MSG "") + set(VERSION_OK TRUE) + set(VERSION ${${FPHSA_VERSION_VAR}} ) + if (${_NAME}_FIND_VERSION) + + if(VERSION) + + if(${_NAME}_FIND_VERSION_EXACT) # exact version required + if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + endif () + + else() # minimum version specified: + if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable version \"${VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") + endif () + endif() + + else() + + # if the package was not found, but a version was given, add that to the output: + if(${_NAME}_FIND_VERSION_EXACT) + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + else() + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + endif() + + endif() + else () + if(VERSION) + set(VERSION_MSG "(found version \"${VERSION}\")") + endif() + endif () + + if(VERSION_OK) + set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") + else() + set(${_FOUND_VAR} FALSE) + endif() + + + # print the result: + if (${_FOUND_VAR}) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") + else () + + if(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + else() + if(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + else() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + endif() + endif() + + endif () + + set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE) + +endfunction() diff --git a/FindPolyPartition.cmake b/FindPolyPartition.cmake new file mode 100644 index 000000000..e54be6fd4 --- /dev/null +++ b/FindPolyPartition.cmake @@ -0,0 +1,38 @@ +#.rst +# FindPolyPartition +# ------------ +# +# Created by Jonathan Marsden +# Locate and configure PolyPartition +# +# Interface Targets +# ^^^^^^^^^^^^^^^^^ +# PolyPartition::PolyPartition +# +# Variables +# ^^^^^^^^^ +# PolyPartition_ROOT_DIR +# PolyPartition_FOUND +# PolyPartition_INCLUDE_DIR +# PolyPartition_LIBRARY +# PolyPartition_IMPORT_LIB + +find_path(PolyPartition_ROOT_DIR + NAMES include/polypartition.h + HINTS ${EXTERNAL_LIBRARY_DIR} + PATH_SUFFIXES polypartition) + +set(PolyPartition_INCLUDE_DIR "${PolyPartition_ROOT_DIR}/include") +if(MSVC) + find_library(PolyPartition_LIBRARY_RELEASE "polypartition.lib" HINTS "${PolyPartition_ROOT_DIR}/lib/release") + find_library(PolyPartition_LIBRARY_DEBUG "polypartition.lib" HINTS "${PolyPartition_ROOT_DIR}/lib/debug") +else() + find_library(PolyPartition_LIBRARY_RELEASE "libpolypartition.a" HINTS "${PolyPartition_ROOT_DIR}/lib") + find_library(PolyPartition_LIBRARY_DEBUG "libpolypartition.a" HINTS "${PolyPartition_ROOT_DIR}/lib") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PolyPartition DEFAULT_MSG PolyPartition_ROOT_DIR PolyPartition_INCLUDE_DIR PolyPartition_LIBRARY_RELEASE PolyPartition_LIBRARY_DEBUG) + +include(CreateImportTargetHelpers) +generate_import_target(PolyPartition STATIC) diff --git a/FindSDL.cmake b/FindSDL.cmake new file mode 100644 index 000000000..74ccb6f2e --- /dev/null +++ b/FindSDL.cmake @@ -0,0 +1,407 @@ +#.rst: +# FindSDL +# ------- +# +# Locate SDL library. Modified by Walter Gray to be compatible with SDL 2.x and +# provide import library pseudo targets. Untested with SDL 1.x. Then modified +# by Victor Dods to forget SDL 1.x, and only look for SDL 2.x. This find module +# should be renamed to FindSDL2.cmake -- it is useful to note that the developers +# of SDL have actually changed the name of the library, not just the version. It +# is actually "SDL2", not "SDL" anymore. Thus a fully-qualified lib directory name +# would be something like "SDL2-2.0.3", and not "SDL-2.0.3" as one would expect. +# +# Imported Targets +# ^^^^^^^^^^^^^^^^ +# SDL::SDL +# Basic import target. Use to build an application +# SDL::Library +# Advanced import target. Does not link with SDLmain, for use when building libraries +# SDL::Main +# Advanced import target. contains only SDLMain.lib +# Result Variables +# ^^^^^^^^^^^^^^^^ +# This module defines the following variables +# +# SDL_ROOT_DIR +# +# SDL_FOUND +# +# SDL_INCLUDE_DIR +# +# SDL_LIBRARY +# Where to find SDL.dll/dylib if linking dynamically, or .lib/.a statically +# SDL_SHARED_LIB +# Where to find the SDL.dll/dylib if it exists +# SDL_STATIC_LIB +# Where to find the SDL.lib/.a if it exists +# SDL_IMPORT_LIB +# Where to find SDL.lib (Windows only) if it exists +# SDL_MAIN_LIBRARY +# Where to find SDLmain.lib/.a +# SDL_LINK_TYPE +# Either STATIC or SHARED depending on if SDL.dll/dylib is found. If both are available, +# defaults to SHARED. Setting this in the cache will attempt to force one or the other +# SDL_VERSION_STRING +# A human-readable string containing the version of SDL +# SDL_LIBRARIES +# A legacy string - contains a list of all .lib files used by SDL, modified by SDL_BUILDING_LIBRARY. +# +# This module responds to the flag: +# +# :: +# +# SDL_BUILDING_LIBRARY +# If this is defined, then no SDL_main will be linked in because +# only applications need main(). +# Otherwise, it is assumed you are building an application and this +# module will attempt to locate and set the proper link flags +# as part of the returned SDL_LIBRARY variable. +# +# +# +# Don't forget to include SDLmain.h and SDLmain.m your project for the +# OS X framework based version. (Other versions link to -lSDLmain which +# this module will try to find on your behalf.) Also for OS X, this +# module will automatically add the -framework Cocoa on your behalf. +# +# +# +# Additional Note: If you see an empty SDL_LIBRARY_TEMP in your +# configuration and no SDL_LIBRARY, it means CMake did not find your SDL +# library (SDL.dll, libsdl.so, SDL.framework, etc). Set +# SDL_LIBRARY_TEMP to point to your SDL library, and configure again. +# Similarly, if you see an empty SDL_MAIN_LIBRARY, you should set this +# value as appropriate. These values are used to generate the final +# SDL_LIBRARY variable, but when these values are unset, SDL_LIBRARY +# does not get created. +# +# +# +# $SDLDIR is an environment variable that would correspond to the +# ./configure --prefix=$SDLDIR used in building SDL. l.e.galup 9-20-02 +# +# Modified by Eric Wing. Added code to assist with automated building +# by using environmental variables and providing a more +# controlled/consistent search behavior. Added new modifications to +# recognize OS X frameworks and additional Unix paths (FreeBSD, etc). +# Also corrected the header search path to follow "proper" SDL +# guidelines. Added a search for SDLmain which is needed by some +# platforms. Added a search for threads which is needed by some +# platforms. Added needed compile switches for MinGW. +# +# Modified by Walter Gray. Added code to find SDL2, and create an import +# target. +# +# On OSX, this will prefer the Framework version (if found) over others. +# People will have to manually change the cache values of SDL_LIBRARY to +# override this selection or set the CMake environment +# CMAKE_INCLUDE_PATH to modify the search paths. +# +# Note that the header path has changed from SDL/SDL.h to just SDL.h +# This needed to change because "proper" SDL convention is #include +# "SDL.h", not . This is done for portability reasons +# because not all systems place things in SDL/ (see FreeBSD). + +#============================================================================= +# Copyright 2003-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(VerboseMessage) + +function(find_multitype_library shared_out static_out import_out) + list(REMOVE_AT ARGV 0) #remove shared_out + list(REMOVE_AT ARGV 0) #remove static_out + list(REMOVE_AT ARGV 0) #remove import_out + + set(_oldlibsuffixes "${CMAKE_FIND_LIBRARY_SUFFIXES}") + set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") + find_library(${shared_out} ${ARGV}) + set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}") + find_library(${static_out} ${ARGV}) + set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_IMPORT_LIBRARY_SUFFIX}") + find_library(${import_out} ${ARGV}) + set(CMAKE_FIND_LIBRARY_SUFFIXES "${_oldlibsuffixes}") + + #TODO:verify the types of the static & import libraries + if(MSVC) + #file(READ ${static_out}) + endif() + +endfunction() + +#Checks _SHARED_LIB, _STATIC_LIB and _IMPORT_LIB +#And fills _LIBRARY with the appropriate lib type depending on which is found +#If both are found, it will default to shared. We may, at a later time, also add verification +#of if the static library is actually a static lib and not an import lib on windows. +#It will then fill _LIBRARY_TYPE with either SHARED or STATIC +function(select_library_type namespace) + #select the primary library type + if(${namespace}_SHARED_LIB AND EXISTS "${${namespace}_SHARED_LIB}") + #add either the .lib or the .dylib to the libraries list + if(${namespace}_IMPORT_LIB AND EXISTS "${${namespace}_IMPORT_LIB}") + set(${namespace}_LIBRARIES "${${namespace}_LIBRARIES}" "${${namespace}_IMPORT_LIB}" PARENT_SCOPE) + else() + set(${namespace}_LIBRARIES "${${namespace}_LIBRARIES}" "${${namespace}_SHARED_LIB}" PARENT_SCOPE) + endif() + + set(${namespace}_LIBRARY "${${namespace}_SHARED_LIB}" PARENT_SCOPE) + set(${namespace}_LIBRARY_TYPE "SHARED" PARENT_SCOPE) + elseif(${namespace}_STATIC_LIB AND EXISTS "${${namespace}_STATIC_LIB}") + set(${namespace}_LIBRARIES "${${namespace}_LIBRARIES}" "${${namespace}_STATIC_LIB}" PARENT_SCOPE) + set(${namespace}_LIBRARY "${${namespace}_STATIC_LIB}" PARENT_SCOPE) + set(${namespace}_LIBRARY_TYPE "STATIC" PARENT_SCOPE) + endif() + +endfunction() + +function(find_likely_dirs package dir_list_var path_list ) + list(REMOVE_AT ARGV 0) #pop package name + list(REMOVE_AT ARGV 0) #pop dir_list_var + + set(_dirs ${${dir_list_var}}) #make sure we're appending + + foreach(_path ${ARGV}) + file(GLOB _subdirs RELATIVE ${_path} ${_path}/*) + foreach(_subdir ${_subdirs}) + if(IS_DIRECTORY ${_path}/${_subdir} AND _subdir MATCHES "^${package}*") + list(APPEND _dirs ${_path}/${_subdir}) + endif() + endforeach() + endforeach() + + set(${dir_list_var} "${_dirs}" PARENT_SCOPE) +endfunction() + +function(sdl_parse_version_file filename major minor patch version_string) + file(STRINGS "${filename}" _major_line REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${filename}" _minor_line REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${filename}" _patch_line REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" sdl_major "${_major_line}") + string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" sdl_minor "${_minor_line}") + string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" sdl_patch "${_patch_line}") + unset(_major_line) + unset(_minor_line) + unset(_patch_line) + + set(${major} ${sdl_major} PARENT_SCOPE) + set(${minor} ${sdl_minor} PARENT_SCOPE) + set(${patch} ${sdl_patch} PARENT_SCOPE) + set(${version_string} "${sdl_major}.${sdl_minor}.${sdl_patch}" PARENT_SCOPE) +endfunction() + +############################# +# The actual find module begins here +############################# +if(NOT EXISTS SDL_ROOT_DIR) + + set(_likely_dirs "") + + # NOTE: this could be done much more cleanly if we write a multiple-return-value find_file and find_path. + # As it stands, cmake's find_file and find_path functions return at most one value, even if there are + # multiple matches, and which one it returns depends on a rather complicated prioritized list of dirs. + + #Find any dirs in the prefix path matching SDL* and add them to the list of candidates + find_likely_dirs(SDL _likely_dirs "${CMAKE_PREFIX_PATH}") + + set(_best_version "") + + #TODO: create a filter function that takes a function(to determine version given a path) + #and filters dirs based on the package version & if EXACT has been set. + foreach(_dir ${_likely_dirs}) + find_path( + _candidate_sdl2_root_dir + NAMES include/SDL_version.h + include/SDL2/SDL_version.h + include/SDL/SDL_version.h + HINTS $ENV{SDLDIR} ${_likely_dirs} + ) + if(_candidate_sdl2_root_dir AND EXISTS ${_candidate_sdl2_root_dir}) + find_file( + _version_file + NAMES SDL_version.h + PATHS ${_candidate_sdl2_root_dir} + PATH_SUFFIXES include include/SDL2 include/SDL + NO_DEFAULT_PATH + ) + verbose_message("found SDL_version.h file in dir ${_candidate_sdl2_root_dir}") + if(_version_file AND EXISTS ${_version_file}) + sdl_parse_version_file("${_version_file}" _major _minor _patch _version_string) + verbose_message(" version string = ${_version_string}") + + #exact matches in front + set(_version_matches FALSE) + if(_version_string STREQUAL SDL_FIND_VERSION) + set(_version_matches TRUE) + endif() + if(_major EQUAL SDL_FIND_VERSION_MAJOR AND + _minor EQUAL SDL_FIND_VERSION_MINOR AND + _patch EQUAL SDL_FIND_VERSION_PATCH) + set(_version_matches TRUE) + endif() + if(NOT SDL_FIND_VERSION_EXACT AND + _major EQUAL SDL_FIND_VERSION_MAJOR AND + _version_string VERSION_GREATER SDL_FIND_VERSION) + set(_version_matches TRUE) + endif() + + if(_version_matches) + verbose_message(" version ${_version_string} matches") + if(NOT _best_version OR _version_string VERSION_GREATER _best_version) + verbose_message(" setting best version") + set(_best_version ${_version_string}) + set(SDL_ROOT_DIR ${_candidate_sdl2_root_dir}) + set(SDL_VERSION_STRING ${_version_string}) + set(SDL_VERSION_MAJOR ${_major}) + set(SDL_VERSION_MINOR ${_minor}) + set(SDL_VERSION_PATCH ${_patch}) + endif() + endif() + endif() + endif() + endforeach() + verbose_message("SDL_ROOT_DIR = ${SDL_ROOT_DIR}") + verbose_message("SDL_VERSION_STRING = ${SDL_VERSION_STRING}") + verbose_message("SDL_VERSION_MAJOR = ${SDL_VERSION_MAJOR}") + verbose_message("SDL_VERSION_MINOR = ${SDL_VERSION_MINOR}") + verbose_message("SDL_VERSION_PATCH = ${SDL_VERSION_PATCH}") + unset(_version_file CACHE) + unset(_candidate_sdl2_root_dir CACHE) +endif() + +### Find SDL version by using predefined SDL root directory ### + find_file( + _version_file + NAMES SDL_version.h + PATHS ${SDL_ROOT_DIR} + PATH_SUFFIXES include include/SDL2 include/SDL + NO_DEFAULT_PATH + ) +sdl_parse_version_file("${_version_file}" _major _minor _patch _version_string) +set(SDL_VERSION_MAJOR ${_major}) + +# A find_path command analogous to the one used to derived SDL_ROOT_DIR is used here. +find_path( + SDL_INCLUDE_DIR + NAMES SDL_version.h + HINTS ${SDL_ROOT_DIR} + PATH_SUFFIXES + include/SDL2 + include + include/SDL + NO_DEFAULT_PATH +) +verbose_message("SDL_INCLUDE_DIR = ${SDL_INCLUDE_DIR}") + +find_multitype_library( + SDL_SHARED_LIB + SDL_STATIC_LIB + SDL_IMPORT_LIB + NAMES + SDL${SDL_VERSION_MAJOR} + HINTS + $ENV{SDLDIR} ${SDL_ROOT_DIR} + PATH_SUFFIXES + lib ${VC_LIB_PATH_SUFFIX} + NO_DEFAULT_PATH +) + +select_library_type(SDL) + +find_library(SDL_MAIN_LIBRARY + NAMES + SDL${SDL_VERSION_MAJOR}main + SDLmain + HINTS + ENV{SDLDIR} ${SDL_ROOT_DIR} + PATH_SUFFIXES + lib ${VC_LIB_PATH_SUFFIX} + PATHS + /sw /opt/local /opt/csw /opt +) + +if(NOT SDL_BUILDING_LIBRARY) + list(APPEND SDL_LIBRARIES ${SDL_MAIN_LIBRARY}) +endif() + +# MinGW needs an additional library, mwindows +# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows +# (Actually on second look, I think it only needs one of the m* libraries.) +if(MINGW) + set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW") +endif() + +# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa (as +# well as the dependencies of Cocoa (the frameworks: Carbon, IOKit, +# and the library: iconv)). CMake doesn't display the -framework Cocoa +# string in the UI even though it actually is there if I modify a +# pre-used variable. I think it has something to do with the CACHE +# STRING. So I use a temporary variable until the end so I can set +# the "real" variable in one-shot. +if(APPLE) + list(APPEND SDL_INTERFACE_LIBS "-framework Cocoa" "-framework IOKit" "-framework Carbon" "iconv") +endif() + +# For threads, as mentioned Apple doesn't need this. +# In fact, there seems to be a problem if I used the Threads package +# and try using this line, so I'm just skipping it entirely for OS X. +if(NOT APPLE) + list(APPEND SDL_INTERFACE_LIBS ${CMAKE_THREAD_LIBS_INIT}) +endif() + +# For MinGW library +if(MINGW) + list(APPEND SDL_INTERFACE_LIBS ${MINGW32_LIBRARY}) +endif() + +# Set the final string here so the GUI reflects the final state. +list(APPEND SDL_LIBRARIES ${SDL_INTERFACE_LIBS} CACHE STRING "Where the SDL Library can be found") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SDL + REQUIRED_VARS SDL_LIBRARY SDL_MAIN_LIBRARY SDL_INCLUDE_DIR + VERSION_VAR SDL_VERSION_STRING) + +mark_as_advanced(SDL_INCLUDE_DIR SDL_LIBRARIES SDL_MAIN_LIBRARY SDL_IMPORT_LIB SDL_SHARED_LIB SDL_STATIC_LIB) + +if(SDL_MAIN_LIBRARY AND EXISTS "${SDL_MAIN_LIBRARY}") + set(SDL_MAIN_FOUND TRUE) +endif() + +include(CreateImportTargetHelpers) + +if(SDL_FOUND AND NOT TARGET SDL::SDL) + generate_import_target(SDL_MAIN STATIC TARGET SDL::Main) + + include(CreateImportTargetHelpers) + if(SDL_LIBRARY MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$") + generate_import_target(SDL SHARED TARGET SDL::Library) + elseif(SDL_LIBRARY MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") + generate_import_target(SDL STATIC TARGET SDL::Library) + else() + message(FATAL_ERROR "Unable to determine library type of file ${SDL_LIBRARY}") + endif() + + add_library(SDL::SDL INTERFACE IMPORTED GLOBAL) + set_property(TARGET SDL::SDL APPEND PROPERTY INTERFACE_LINK_LIBRARIES SDL::Library SDL::Main) + + # NOTE: this is commented out because SDL does not in principle need to depend + # on X11 (it should be using Cocoa), and thus the SDL library we use should be + # configured to not use X11. Jon has rolled an SDL build with X11 disabled, and + # that build should be making it into our external libraries. + # # HACK FOR MAC X11 DEPENDENCY + # # TODO - Create a modernized FindX11.cmake module, make SDL depend on it on macs + # if(APPLE) + # find_package(X11 REQUIRED) + # set_property(TARGET SDL::SDL APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${X11_INCLUDE_DIR}) + # endif() +endif() \ No newline at end of file diff --git a/FindSFML.cmake b/FindSFML.cmake new file mode 100644 index 000000000..cd152b62a --- /dev/null +++ b/FindSFML.cmake @@ -0,0 +1,326 @@ +# This script locates the SFML library +# ------------------------------------ +# +# Usage +# ----- +# +# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main). +# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing. +# example: +# find_package(SFML COMPONENTS graphics window system) // find the graphics, window and system modules +# +# You can enforce a specific version, either MAJOR.MINOR or only MAJOR. +# If nothing is specified, the version won't be checked (ie. any version will be accepted). +# example: +# find_package(SFML COMPONENTS ...) // no specific version required +# find_package(SFML 2 COMPONENTS ...) // any 2.x version +# find_package(SFML 2.4 COMPONENTS ...) // version 2.4 or greater +# +# By default, the dynamic libraries of SFML will be found. To find the static ones instead, +# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...). +# In case of static linking, the SFML_STATIC macro will also be defined by this script. +# example: +# set(SFML_STATIC_LIBRARIES TRUE) +# find_package(SFML 2 COMPONENTS network system) +# +# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless +# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details. +# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which +# are available for both release and debug modes. +# +# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable +# to tell CMake where SFML is. +# +# Output +# ------ +# +# This script defines the following interface targets: +# SFML:: +# SFML - Meta-target. Links to all targets below. +# Main - The minimum required core target. +# Audio +# Graphics +# Network +# System +# Window +# +# Targets for different components will only defined for modules in the COMPONENTS list passed to find_package. +# If no components are listed, it is assumed that all components are requested. +# +# This script also defines the following variables: +# - For each specified module XXX (system, window, graphics, network, audio, main): +# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found) +# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found) +# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary) +# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found +# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules +# - SFML_DEFINITIONS: thie list of compiler flags required. +# - SFML_FOUND: true if all the required modules are found +# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file) +# +# example: +# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED) +# include_directories(${SFML_INCLUDE_DIR}) +# add_executable(myapp ...) +# target_link_libraries(myapp ${SFML_LIBRARIES}) + +# define the SFML_STATIC macro if static build was chosen +set(SFML_DEFINITIONS "") + +if(SFML_STATIC_LIBRARIES) + set(SFML_DEFINITIONS SFML_STATIC) +endif() + +find_path(SFML_ROOT_DIR + NAMES include/SFML/Config.hpp + PATH_SUFFIXES SFML_${SFML_FIND_VERSION}_${_compiler_SUFFIX} + SFML_${SFML_FIND_VERSION} + SFML-${SFML_FIND_VERSION}-${_compiler_SUFFIX} + SFML-${SFML_FIND_VERSION} + SFML) + +# deduce the libraries suffix from the options +set(FIND_SFML_LIB_SUFFIX "") +if(SFML_STATIC_LIBRARIES) + set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-s") +endif() + +# find the SFML include directory +find_path(SFML_INCLUDE_DIR SFML/Config.hpp + PATH_SUFFIXES include + PATHS + ${SFML_ROOT} + $ENV{SFML_ROOT} + ${SFML_ROOT_DIR} + ~/Library/Frameworks + /Library/Frameworks + /usr/local/ + /usr/ + /sw # Fink + /opt/local/ # DarwinPorts + /opt/csw/ # Blastwave + /opt/) +mark_as_advanced(SFML_INCLUDE_DIR) + +# check the version number +set(SFML_VERSION_OK TRUE) +if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR) + # extract the major and minor version numbers from SFML/Config.hpp + # we have to handle framework a little bit differently : + if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework") + set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp") + else() + set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp") + endif() + FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS) + STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}") + STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}") + STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}") + math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10 + ${SFML_FIND_VERSION_MINOR}") + + # if we could extract them, compare with the requested version number + if (SFML_VERSION_MAJOR) + # transform version numbers to an integer + math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10 + ${SFML_VERSION_MINOR}") + + # compare them + if(SFML_VERSION LESS SFML_REQUESTED_VERSION) + set(SFML_VERSION_OK FALSE) + endif() + else() + # SFML version is < 2.0 + if (SFML_REQUESTED_VERSION GREATER 19) + set(SFML_VERSION_OK FALSE) + set(SFML_VERSION_MAJOR 1) + set(SFML_VERSION_MINOR x) + endif() + endif() +endif() + +# find the requested modules +set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found +set(FIND_SFML_LIB_PATHS + ${SFML_ROOT} + $ENV{SFML_ROOT} + ${SFML_ROOT_DIR} + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt) + +if(NOT SFML_FIND_COMPONENTS) + set(SFML_FIND_COMPONENTS audio graphics network system window) + if(WIN32) + list(APPEND SFML_FIND_COMPONENTS main) + endif() +endif() + +foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS}) + string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER) + string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER) + set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}${FIND_SFML_LIB_SUFFIX}) + + # no suffix for sfml-main, it is always a static library + if(FIND_SFML_COMPONENT_LOWER STREQUAL "main") + set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}) + endif() + + # debug library + find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG + NAMES ${FIND_SFML_COMPONENT_NAME}-d + PATH_SUFFIXES lib64 lib + PATHS ${FIND_SFML_LIB_PATHS}) + + # release library + find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE + NAMES ${FIND_SFML_COMPONENT_NAME} + PATH_SUFFIXES lib64 lib + PATHS ${FIND_SFML_LIB_PATHS}) + + if(NOT SFML_STATIC_LIBRARIES) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_IMPORT_LIB_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_IMPORT_LIB_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) + + set(_old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") + find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_SHARED_LIB_DEBUG + NAMES ${FIND_SFML_COMPONENT_NAME}-d ${FIND_SFML_COMPONENT_NAME}-d-2 + PATH_SUFFIXES bin64 bin + PATHS ${FIND_SFML_LIB_PATHS}) + + find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_SHARED_LIB_RELEASE + NAMES ${FIND_SFML_COMPONENT_NAME} ${FIND_SFML_COMPONENT_NAME}-2 + PATH_SUFFIXES bin64 bin + PATHS ${FIND_SFML_LIB_PATHS}) + + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_old_suffixes}) + mark_as_advanced(SFML_${FIND_SFML_COMPONENT_UPPER}_SHARED_LIB_DEBUG SFML_${FIND_SFML_COMPONENT_UPPER}_SHARED_LIB_RELEASE) + endif() + + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) + # library found + set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE) + + # if both are found, set SFML_XXX_LIBRARY to contain both + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG} + optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) + endif() + + # if only one debug/release variant is found, set the other to be equal to the found one + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) + # debug and not release + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) + endif() + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG) + # release and not debug + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) + endif() + + else() + # library not found + set(SFML_FOUND FALSE) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "") + set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY") + endif() + + # mark as advanced + MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY + SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE + SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG) + + # add to the global list of libraries + set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}") +endforeach() + +# handle errors +if(NOT SFML_VERSION_OK) + # SFML version not ok + set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR})") + set(SFML_FOUND FALSE) +elseif(NOT SFML_FOUND) + # include directory or library not found + set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})") +endif() +if (NOT SFML_FOUND) + if(SFML_FIND_REQUIRED) + # fatal error + message(FATAL_ERROR ${FIND_SFML_ERROR}) + elseif(NOT SFML_FIND_QUIETLY) + # error but continue + message("${FIND_SFML_ERROR}") + endif() +endif() + +# handle success +#if(SFML_FOUND) + #message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR} in ${SFML_INCLUDE_DIR}") +#endif() + +include(CreateImportTargetHelpers) + +if( SFML_FOUND AND NOT TARGET SFML::SFML) + + set(_libtype SHARED) + if(SFML_STATIC_LIBRARIES) + set(_libtype STATIC) + endif() + + + add_library(SFML::SFML INTERFACE IMPORTED GLOBAL) + + if(APPLE) + find_library(SFML_GLEW + NAMES GLEW + PATH_SUFFIXES lib64 lib + PATHS ${FIND_SFML_LIB_PATHS} + NO_DEFAULT_PATH) + find_library(SFML_JPEG + NAMES jpeg + PATH_SUFFIXES lib64 lib + PATHS ${FIND_SFML_LIB_PATHS} + NO_DEFAULT_PATH) + mark_as_advanced(SFML_GLEW SFML_JPEG) + endif() + + foreach(_component ${SFML_FIND_COMPONENTS}) + string(TOUPPER ${_component} _componentUPPER) + string(TOLOWER ${_component} _componentLOWER) + + string(SUBSTRING ${_componentLOWER} 0 1 _first_letter) + string(TOUPPER ${_first_letter} _first_letter) + string(REGEX REPLACE "^.(.*)" "${_first_letter}\\1" _componentCap "${_componentLOWER}") + + if(_componentLOWER STREQUAL "main") #main is always a static lib + generate_import_target(SFML_MAIN STATIC TARGET SFML::Main) + + else() + generate_import_target(SFML_${_componentUPPER} ${_libtype} TARGET SFML::${_componentCap}) + endif() + + map_var_to_prop(SFML::${_componentCap} INTERFACE_COMPILE_DEFINITIONS SFML_DEFINITIONS) + map_var_to_prop(SFML::${_componentCap} INTERFACE_INCLUDE_DIRECTORIES SFML_INCLUDE_DIR REQUIRED) + + if(APPLE) + if(SFML_STATIC_LIBRARIES) + if(_componentLOWER STREQUAL "audio") + set_property(TARGET SFML::${_componentCap} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-framework OpenAL") + endif() + if(_componentLOWER STREQUAL "graphics") + set_property(TARGET SFML::${_componentCap} APPEND PROPERTY + INTERFACE_LINK_LIBRARIES "-framework OpenGL" "-framework AppKit" "-framework IOKit" "-framework Carbon" + "${SFML_GLEW}" "${SFML_JPEG}") + endif() + endif() + endif() + + set_property(TARGET SFML::SFML APPEND PROPERTY INTERFACE_LINK_LIBRARIES SFML::${_componentCap}) + endforeach() +endif() \ No newline at end of file diff --git a/FindThreads.cmake b/FindThreads.cmake new file mode 100644 index 000000000..24c401ec8 --- /dev/null +++ b/FindThreads.cmake @@ -0,0 +1,187 @@ +#.rst: +# FindThreads +# ----------- +# +# Modified by Victor Dods to use the generate_import_target function to define +# the library correctly as a target under the new cmake usage requirements rules. +# +# This module determines the thread library of the system. +# +# The following variables are set +# +# :: +# +# CMAKE_THREAD_LIBS_INIT - the thread library +# CMAKE_USE_SPROC_INIT - are we using sproc? +# CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads? +# CMAKE_USE_PTHREADS_INIT - are we using pthreads +# CMAKE_HP_PTHREADS_INIT - are we using hp pthreads +# +# For systems with multiple thread libraries, caller can set +# +# :: +# +# CMAKE_THREAD_PREFER_PTHREAD + +#============================================================================= +# Copyright 2002-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include (CheckIncludeFiles) +include (CheckLibraryExists) +include (CheckSymbolExists) +include (VerboseMessage) +set(Threads_FOUND FALSE) + +# Do we have sproc? +if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) + CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) +endif() + +if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD) + # We have sproc + set(CMAKE_USE_SPROC_INIT 1) +else() + # Do we have pthreads? + CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H) + if(CMAKE_HAVE_PTHREAD_H) + # + # We have pthread.h + # Let's check for the library now. + # + set(CMAKE_HAVE_THREADS_LIBRARY) + if(NOT THREADS_HAVE_PTHREAD_ARG) + # Check if pthread functions are in normal C library + CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE) + if(CMAKE_HAVE_LIBC_CREATE) + set(CMAKE_THREAD_LIBS_INIT "") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() + + if(NOT CMAKE_HAVE_THREADS_LIBRARY) + # Do we have -lpthreads + CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) + if(CMAKE_HAVE_PTHREADS_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lpthreads") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() + + # Ok, how about -lpthread + CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) + if(CMAKE_HAVE_PTHREAD_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lpthread") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() + + if(CMAKE_SYSTEM MATCHES "SunOS.*") + # On sun also check for -lthread + CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) + if(CMAKE_HAVE_THR_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lthread") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() + endif() + endif() + endif() + + if(NOT CMAKE_HAVE_THREADS_LIBRARY) + # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread + if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") + message(STATUS "Check if compiler accepts -pthread") + try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG + ${CMAKE_BINARY_DIR} + ${CMAKE_ROOT}/Modules/CheckForPthreads.c + CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread + COMPILE_OUTPUT_VARIABLE OUTPUT) + + if(THREADS_HAVE_PTHREAD_ARG) + if(THREADS_PTHREAD_ARG STREQUAL "2") + set(Threads_FOUND TRUE) + message(STATUS "Check if compiler accepts -pthread - yes") + else() + message(STATUS "Check if compiler accepts -pthread - no") + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n") + endif() + else() + message(STATUS "Check if compiler accepts -pthread - no") + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n") + endif() + + endif() + + if(THREADS_HAVE_PTHREAD_ARG) + set(Threads_FOUND TRUE) + set(CMAKE_THREAD_LIBS_INIT "-pthread") + endif() + + endif() + endif() +endif() + +if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) + set(CMAKE_USE_PTHREADS_INIT 1) + set(Threads_FOUND TRUE) +endif() + +if(CMAKE_SYSTEM MATCHES "Windows") + set(CMAKE_USE_WIN32_THREADS_INIT 1) + set(Threads_FOUND TRUE) +endif() + +if(CMAKE_USE_PTHREADS_INIT) + if(CMAKE_SYSTEM MATCHES "HP-UX-*") + # Use libcma if it exists and can be used. It provides more + # symbols than the plain pthread library. CMA threads + # have actually been deprecated: + # http://docs.hp.com/en/B3920-90091/ch12s03.html#d0e11395 + # http://docs.hp.com/en/947/d8.html + # but we need to maintain compatibility here. + # The CMAKE_HP_PTHREADS setting actually indicates whether CMA threads + # are available. + CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA) + if(CMAKE_HAVE_HP_CMA) + set(CMAKE_THREAD_LIBS_INIT "-lcma") + set(CMAKE_HP_PTHREADS_INIT 1) + set(Threads_FOUND TRUE) + endif() + set(CMAKE_USE_PTHREADS_INIT 1) + endif() + + if(CMAKE_SYSTEM MATCHES "OSF1-V*") + set(CMAKE_USE_PTHREADS_INIT 0) + set(CMAKE_THREAD_LIBS_INIT ) + endif() + + if(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") + set(CMAKE_USE_PTHREADS_INIT 1) + set(Threads_FOUND TRUE) + set(CMAKE_THREAD_LIBS_INIT ) + set(CMAKE_USE_WIN32_THREADS_INIT 0) + endif() +endif() + +include(CreateImportTargetHelpers) +include(FindPackageHandleStandardArgs) + +verbose_message("Threads library was found -- CMAKE_THREAD_LIBS_INIT = \"${CMAKE_THREAD_LIBS_INIT}\"") + +set(Threads_LIBRARY ${CMAKE_THREAD_LIBS_INIT}) +find_package_handle_standard_args(Threads REQUIRED_VARS Threads_LIBRARY) +generate_import_target(Threads STATIC) diff --git a/FindWDK.cmake b/FindWDK.cmake new file mode 100644 index 000000000..f30b22713 --- /dev/null +++ b/FindWDK.cmake @@ -0,0 +1,58 @@ +# - Try to find WDK +# This module takes as inputs +# WDK_ROOT_ALTERNATE - An alternate possible location for the wdk +# +# Once done this will define +# WDK_FOUND - System has WDK +# WDK_INCLUDE_DIRS - The WDK include directory +# WDK_LIBRARIES - The libraries needed to use WDK +# WDK_BIN - The path to the WDK binaries folder + +set(wdkregpath80 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]") +get_filename_component(wdkpath80 ${wdkregpath80} ABSOLUTE) + +set(wdkregpath81 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]") +get_filename_component(wdkpath81 ${wdkregpath81} ABSOLUTE) + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(WDK_ARCH "x64") +else() + set(WDK_ARCH "x86") +endif() + +# Select a root path first: +find_path( + WDK_ROOT_DIR Include/um/UPnP.h + HINTS ${wdkpath81} ${wdkpath80} ${WDK_ROOT_ALTERNATE} +) + +# Generate include directories variable from the root path +set(WDK_INCLUDE_DIRS ${WDK_ROOT_DIR}/Include/um ${WDK_ROOT_DIR}/Include/Shared) + +# Also generate the binaries directory: +find_path( + WDK_BIN_DIR makecat.exe + HINTS ${WDK_ROOT_DIR}/bin/${WDK_ARCH} +) + +# Now we scan for all components: +foreach(COMPONENT ${WDK_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + + find_library( + WDK_${UPPERCOMPONENT} ${COMPONENT} + PATHS ${WDK_ROOT_DIR} + PATH_SUFFIXES /Lib/win8/um/${WDK_ARCH} /Lib/winv6.3/um/${WDK_ARCH} + ) + mark_as_advanced(CLEAR WDK_${UPPERCOMPONENT}) + list(APPEND WDK_LIBRARIES ${WDK_${UPPERCOMPONENT}}) +endforeach() + +include(FindPackageHandleStandardArgs) +if(WDK_FIND_COMPONENTS) + find_package_handle_standard_args(WDK DEFAULT_MSG WDK_LIBRARIES WDK_INCLUDE_DIRS) +else() + find_package_handle_standard_args(WDK DEFAULT_MSG WDK_INCLUDE_DIRS) +endif() + + diff --git a/LeapCMakeTemplates.cmake b/LeapCMakeTemplates.cmake new file mode 100644 index 000000000..e35cb806d --- /dev/null +++ b/LeapCMakeTemplates.cmake @@ -0,0 +1,48 @@ +#.rst +#LeapTemplates +#------------- +# Created by Walter Gray +# +# Some Leap Motion specific boilderplate code. +# Not reccomended for use outside of the Leap Motion engineering group, +# though you're welcome to define your own. + +macro(leap_find_external_libraries pc_variant) + find_path(EXTERNAL_LIBRARY_DIR "eigen-3.2.1/Eigen/CmakeLists.txt" + PATHS + "$ENV{EXTERNAL_LIBRARY_DIR}" + "$ENV{LIBRARIES_PATH}" + "$ENV{PATH}" + "/opt/local/Libraries" + ) + + list(INSERT CMAKE_PREFIX_PATH 0 "${EXTERNAL_LIBRARY_DIR}") +endmacro() + +macro(leap_use_standard_platform_settings) + + if(NOT (MSVC OR CMAKE_BUILD_TYPE)) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release." FORCE) + endif() + + # Disable MinSizeRel & MaxSpeedRel + set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "" FORCE) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + + if(APPLE) + if(NOT CMAKE_OSX_ARCHITECTURES) + set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Mac OS X build architectures" FORCE) + endif() + if(NOT CMAKE_OSX_SYSROOT) + set(CMAKE_OSX_SYSROOT "macosx10.9" CACHE STRING "Mac OS X build environment" FORCE) + endif() + + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "Mac OS X deployment target" FORCE) + mark_as_advanced(CMAKE_OSX_DEPLOYMENT_TARGET) + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") + set(USE_LIBCXX ON) + endif() + +endmacro() diff --git a/PrintTargetProperties.cmake b/PrintTargetProperties.cmake new file mode 100644 index 000000000..338d6221c --- /dev/null +++ b/PrintTargetProperties.cmake @@ -0,0 +1,198 @@ +# This useful script was taken from http://www.kitware.com/blog/home/post/390 and slightly modified. +function(echo_target_property tgt prop) + # message("echo_target_property -- tgt = ${tgt}, prop = ${prop}") + # v for value, d for defined, s for set + get_property(v TARGET ${tgt} PROPERTY ${prop}) + get_property(d TARGET ${tgt} PROPERTY ${prop} DEFINED) + get_property(s TARGET ${tgt} PROPERTY ${prop} SET) + + # only produce output for values that are set + if(s) + message("tgt='${tgt}' prop='${prop}'") + message(" value='${v}'") + message(" defined='${d}'") + message(" set='${s}'") + message("") + endif() +endfunction() + +function(echo_target tgt) + if(NOT TARGET ${tgt}) + message("There is no target named '${tgt}'") + return() + endif() + + set(props + DEBUG_OUTPUT_NAME + DEBUG_POSTFIX + RELEASE_OUTPUT_NAME + RELEASE_POSTFIX + ARCHIVE_OUTPUT_DIRECTORY + ARCHIVE_OUTPUT_DIRECTORY_DEBUG + ARCHIVE_OUTPUT_DIRECTORY_RELEASE + ARCHIVE_OUTPUT_NAME + ARCHIVE_OUTPUT_NAME_DEBUG + ARCHIVE_OUTPUT_NAME_RELEASE + AUTOMOC + AUTOMOC_MOC_OPTIONS + BUILD_WITH_INSTALL_RPATH + BUNDLE + BUNDLE_EXTENSION + COMPILE_DEFINITIONS + COMPILE_DEFINITIONS_DEBUG + COMPILE_DEFINITIONS_RELEASE + COMPILE_FLAGS + COMPILE_OPTIONS + DEBUG_POSTFIX + RELEASE_POSTFIX + DEFINE_SYMBOL + ENABLE_EXPORTS + EXCLUDE_FROM_ALL + EchoString + FOLDER + FRAMEWORK + Fortran_FORMAT + Fortran_MODULE_DIRECTORY + GENERATOR_FILE_NAME + GNUtoMS + HAS_CXX + IMPLICIT_DEPENDS_INCLUDE_TRANSFORM + IMPORTED + IMPORTED_CONFIGURATIONS + IMPORTED_IMPLIB + IMPORTED_IMPLIB_DEBUG + IMPORTED_IMPLIB_RELEASE + IMPORTED_LINK_DEPENDENT_LIBRARIES + IMPORTED_LINK_DEPENDENT_LIBRARIES_DEBUG + IMPORTED_LINK_DEPENDENT_LIBRARIES_RELEASE + IMPORTED_LINK_INTERFACE_LANGUAGES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE + IMPORTED_LINK_INTERFACE_LIBRARIES + IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG + IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE + IMPORTED_LINK_INTERFACE_MULTIPLICITY + IMPORTED_LINK_INTERFACE_MULTIPLICITY_DEBUG + IMPORTED_LINK_INTERFACE_MULTIPLICITY_RELEASE + IMPORTED_LOCATION + IMPORTED_LOCATION_DEBUG + IMPORTED_LOCATION_RELEASE + IMPORTED_NO_SONAME + IMPORTED_NO_SONAME_DEBUG + IMPORTED_NO_SONAME_RELEASE + IMPORTED_SONAME + IMPORTED_SONAME_DEBUG + IMPORTED_SONAME_RELEASE + IMPORT_PREFIX + IMPORT_SUFFIX + INCLUDE_DIRECTORIES + INSTALL_NAME_DIR + INSTALL_RPATH + INSTALL_RPATH_USE_LINK_PATH + INTERFACE_COMPILE_DEFINITIONS + INTERFACE_COMPILE_OPTIONS + INTERFACE_INCLUDE_DIRECTORIES + INTERFACE_LINK_LIBRARIES + INTERPROCEDURAL_OPTIMIZATION + INTERPROCEDURAL_OPTIMIZATION_DEBUG + INTERPROCEDURAL_OPTIMIZATION_RELEASE + LABELS + LIBRARY_OUTPUT_DIRECTORY + LIBRARY_OUTPUT_DIRECTORY_DEBUG + LIBRARY_OUTPUT_DIRECTORY_RELEASE + LIBRARY_OUTPUT_NAME + LIBRARY_OUTPUT_NAME_DEBUG + LIBRARY_OUTPUT_NAME_RELEASE + LINKER_LANGUAGE + LINK_DEPENDS + LINK_FLAGS + LINK_FLAGS_DEBUG + LINK_FLAGS_RELEASE + LINK_INTERFACE_LIBRARIES + LINK_INTERFACE_LIBRARIES_DEBUG + LINK_INTERFACE_LIBRARIES_RELEASE + LINK_INTERFACE_MULTIPLICITY + LINK_INTERFACE_MULTIPLICITY_DEBUG + LINK_INTERFACE_MULTIPLICITY_RELEASE + LINK_LIBRARIES + LINK_SEARCH_END_STATIC + LINK_SEARCH_START_STATIC + # LOCATION + # LOCATION_DEBUG + # LOCATION_RELEASE + MACOSX_BUNDLE + MACOSX_BUNDLE_INFO_PLIST + MACOSX_FRAMEWORK_INFO_PLIST + MAP_IMPORTED_CONFIG_DEBUG + MAP_IMPORTED_CONFIG_RELEASE + OSX_ARCHITECTURES + OSX_ARCHITECTURES_DEBUG + OSX_ARCHITECTURES_RELEASE + OUTPUT_NAME + OUTPUT_NAME_DEBUG + OUTPUT_NAME_RELEASE + POST_INSTALL_SCRIPT + PREFIX + PRE_INSTALL_SCRIPT + PRIVATE_HEADER + PROJECT_LABEL + PUBLIC_HEADER + RESOURCE + RULE_LAUNCH_COMPILE + RULE_LAUNCH_CUSTOM + RULE_LAUNCH_LINK + RUNTIME_OUTPUT_DIRECTORY + RUNTIME_OUTPUT_DIRECTORY_DEBUG + RUNTIME_OUTPUT_DIRECTORY_RELEASE + RUNTIME_OUTPUT_NAME + RUNTIME_OUTPUT_NAME_DEBUG + RUNTIME_OUTPUT_NAME_RELEASE + SKIP_BUILD_RPATH + SOURCES + SOVERSION + STATIC_LIBRARY_FLAGS + STATIC_LIBRARY_FLAGS_DEBUG + STATIC_LIBRARY_FLAGS_RELEASE + SUFFIX + TYPE + VERSION + VS_DOTNET_REFERENCES + VS_GLOBAL_WHATEVER + VS_GLOBAL_KEYWORD + VS_GLOBAL_PROJECT_TYPES + VS_KEYWORD + VS_SCC_AUXPATH + VS_SCC_LOCALPATH + VS_SCC_PROJECTNAME + VS_SCC_PROVIDER + VS_WINRT_EXTENSIONS + VS_WINRT_REFERENCES + WIN32_EXECUTABLE + XCODE_ATTRIBUTE_WHATEVER + ) + + message("======================== ${tgt} ========================") + foreach(p ${props}) + echo_target_property("${tgt}" "${p}") + endforeach() + message("") +endfunction() + + +function(echo_targets) + set(tgts ${ARGV}) + foreach(t ${tgts}) + echo_target("${t}") + endforeach() +endfunction() + + +# set(targets +# CMakeLib +# cmake-gui +# MathFunctions +# Tutorial +# vtkCommonCore +# ) + +# echo_targets(${targets}) diff --git a/README.md b/README.md new file mode 100644 index 000000000..8ac666c23 --- /dev/null +++ b/README.md @@ -0,0 +1,149 @@ +#### CMake-Modules +This repo is a common place to store useful cmake modules, including customized +Find files and utility modules. It is intended to be incorporated into projects +as a subtree. + +##### Usage +First add the cmake-module repo as a remote, so you can more easily reference it +``` + git remote add -f cmake-modules-repo git@sf-github.leap.corp:leapmotion/cmake-module.git +``` + +To setup cmake-modules in your repository (only run once as a setup step): +``` + git subtree add --prefix cmake-modules cmake-modules-repo develop +``` + +To update the copy of cmake-modules in your repository from the latest code in the cmake-modules repo: +``` + git fetch cmake-modules-repo develop + git subtree pull --prefix cmake-modules cmake-modules-repo develop +``` + +To push changes from your repository upstream into the cmake-module repo: +``` + git subtree push --prefix cmake-modules cmake-modules-repo + Open a pull request to merge to develop +``` + + +For more information on subtrees see Atlassian's [Git Subtree Tutorial](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/) + +#### Best Practices +##### Rule 1: Always check the docs & existing modules for examples +Documentation for CMake is rapidly improving. See if you can find answers in the links below. + +* [CMake 3.0.0 Documentation](http://www.cmake.org/cmake/help/v3.0/index.html) +* [CMake git-master Documentation](http://www.cmake.org/cmake/help/git-master/) + +##### Naming conventions +* UPPER_CASE identifiers are public +* Mixed_CASE identifiers are also public assuming the first word is a namespace, as with package find modules +* _lower_idents with preceding underscores should be used for private, temporary variables +* lower_idents should also be used for function calls +* UPPER_CASE should be used for naming arguments to functions (see [CMakeParseArguments](http://www.cmake.org/cmake/help/git-master/module/CMakeParseArguments.html)) + +##### General Guidelines +1. Prefer setting target properties over global or directory properties, eg. use target_include_directories over include_directories. +2. Prefer Generator expressions over PROPERTY_ variants wherever allowed. see [Generator Expressions Manual](http://www.cmake.org/cmake/help/v3.0/manual/cmake-generator-expressions.7.html) +3. install() is meant to define a step to package the build products of a library, and install them on the host system for use by cmake by adding it to the [Package Registry](http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html#package-registry). For steps such as copying .DLLs or resource files to the appropriate location so a build can be run and debugged at all, use add_custom_command( POST_BUILD ...) +4. Never manually add a library directly in a CMakeLists.txt file (eg, via find_library or find_path). Instead, write a Find.cmake module that does that instead. See the guidelines for writing find modules further down, as well as the official [Module Developer Docs](http://www.cmake.org/cmake/help/v3.0/manual/cmake-developer.7.html#modules) +5. Avoid the target_link_libraries signatures which use[debug|optimized|general]. Use Generator Expressions instead. +6. Make use of INTERFACE targets and other pseudo targets to specify usage requirements. See + + * [Pseudo Targets](http://www.cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#pseudo-targets) for information on what Pseudo Targets and Usage Requirements in general are. + * [Packages](http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html) for information on what packages are and how to write Config.cmake files that provide IMPORT targets. + +##### Creating New Projects +This assumes that you have added cmake-modules as a subtree in a folder at the root of your project. + +##### Directory Structure +Root: A global CMakeLists.txt file containing global settings for all sub-projects. +If you have only one sub project, you may add and configure it at the end of the root cmakelists file. +Don't call find_package at the global level - use target_package (Defined in TargetImportedLibraries) instead. +This has the additional benifit of setting up the appropriate post-build steps to handle copying shared libraries + +##### Handling Resources in OS X Bundles +See [CMake: Bundles and Frameworks](http://www.cmake.org/Wiki/CMake:Bundles_And_Frameworks) +as well as documentation for the [MACOSX_PACKAGE_LOCATION](http://www.cmake.org/cmake/help/v3.0/prop_sf/MACOSX_PACKAGE_LOCATION.html) + +##### Root CMakeLists.txt +``` +cmake_minimum_required(VERSION 3.0) +project() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") +set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "" FORCE) #Disables MinSizeRel & MaxSpeedRel +set(CMAKE_INCLUDE_CURRENT_DIR ON) #essentially the same as include_directories(.) in every subdir +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +#Leap-Specific: We package any external libraries we're using in a single place, so add it to the default +#Search path. SDL-2.0.1 is used as a marker of something to look for. +find_path(EXTERNAL_LIBRARY_DIR "SDL-2.0.1" + PATHS + "$ENV{EXTERNAL_LIBRARY_DIR}" + "$ENV{LIBRARIES_PATH}" + "$ENV{PATH}" + "/opt/local/Libraries" + NO_DEFAULT_PATH) +list(INSERT CMAKE_PREFIX_PATH 0 "${EXTERNAL_LIBRARY_DIR}") + +#Set any global flags for the project here, such as compiler settings you want used universally +#if(MSVC) #Uncomment this if you want to use use /MT instead of /MD on Windows +# add_compile_options($<$:/MTd> $<$:/MT>) +#endif() + +#Call add_subdirectory on relevant sub-directories + +``` + +##### Project's CMakeLists.txt +``` +set(_SRC ) +set(_HEADERS ) + +add_( ${_SRC} ${_HEADERS}) +target_include_directories( PUBLIC .) +target_package( REQUIRED) #Repeat as nessecary + +#set target's custom build settings here + +#define install steps here + +``` + +##### Writing Find Modules +For packages which do not provide Package.cmake commands, or ones that do not yet support import targets, +you will have to author your own find module. This may be as simple as +``` +include(${CMAKE_ROOT}/Modules/Find.cmake) +include(CreateImportTargetHelpers) +generate_import_target( ) +``` +but may also be much more complicated. See the existing Find modules in this repo for examples, and +CreateImportTargetHelpers.cmake's documentation on how it works. + +All Import targets generated by a Find module should use the +:: naming convention where :: is an import target which will include +all components specified as arguments to find_package. Private import targets should use +::_ + +#### Notes & TODOs + +- Better helpers and handling for modules which may be either SHARED or STATIC. + +- Proposed solution is to define SHARED_LIBRARY and STATIC_LIBRARY separately, then set + LIBRARY to whichever one exists, and if both are defined then create an option so the + user can choose. Alternatively, we could detect which are available, default to SHARED + if both are, and expose an Xxx_IMPORT_TYPE cache variable that the user could override. + This would also let us throw errors if the files for the desired type are unavailable. + +- Make a cmake module for installing executables/resources in a platform-agnostic way + (e.g. Mac has a particular "bundle" format it follows). + +- The organization of the Components (with its component and library dependencies) should + be implemented using a cmake module, so little redundant boilerplate is necessary. + +- Write variants of find_file and find_path which actually return ALL matches, instead of + an ill-defined single match. This functionality is distinctly lacking in cmake, and + causes nontrivial problems when trying to find files/paths. + diff --git a/SelectConfigurations.cmake b/SelectConfigurations.cmake new file mode 100644 index 000000000..b0e4f33d8 --- /dev/null +++ b/SelectConfigurations.cmake @@ -0,0 +1,85 @@ +#.rst: +# SelectConfigurations +# --------------------------- +# +# Originally SelectConfigurations +# Modified by Walter gray to create generator expressions instead of +# using the optimized and debug keywords. This makes the output +# suitable for use with the INTERFACE_LINK_LIBRARIES property. +# +# select_configurations( basename ) +# +# This macro takes a library base name as an argument, and will choose +# good values for basename_LIBRARY, basename_LIBRARIES, +# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what +# has been found and set. If only basename_LIBRARY_RELEASE is defined, +# basename_LIBRARY will be set to the release value, and +# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND. +# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will +# take the debug value, and basename_LIBRARY_RELEASE will be set to +# basename_LIBRARY_RELEASE-NOTFOUND. +# +# If the generator supports configuration types, then basename_LIBRARY +# and basename_LIBRARIES will be set with debug and optimized flags +# specifying the library to be used for the given configuration. If no +# build type has been set or the generator in use does not support +# configuration types, then basename_LIBRARY and basename_LIBRARIES will +# take only the release value, or the debug value if the release one is +# not set. + +#============================================================================= +# Copyright 2009 Will Dicharry +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry . + +function(select_configurations basename suffix) + if(ARGC GREATER 2) #checking argv2 directly is bad, since the argvX variables are not reset between function calls + set(_outvar ${ARGV2}) + else() + set(_outvar ${suffix}) + endif() + + if(NOT ${basename}_${suffix}_RELEASE) + set(${basename}_${suffix}_RELEASE "${basename}_${suffix}_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + if(NOT ${basename}_${suffix}_DEBUG) + set(${basename}_${suffix}_DEBUG "${basename}_${suffix}_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + + if( ${basename}_${suffix}_DEBUG AND ${basename}_${suffix}_RELEASE AND + NOT ${basename}_${suffix}_DEBUG STREQUAL ${basename}_${suffix}_RELEASE AND + ( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) ) + # if the generator supports configuration types or CMAKE_BUILD_TYPE + # is set, then set optimized and debug options. + set( ${basename}_${_outvar} "" ) + foreach( _libname IN LISTS ${basename}_${suffix}_RELEASE ) + list( APPEND ${basename}_${_outvar} $<$:"${_libname}"> ) + endforeach() + foreach( _libname IN LISTS ${basename}_${suffix}_DEBUG ) + list( APPEND ${basename}_${_outvar} $<$:"${_libname}"> ) + endforeach() + elseif( ${basename}_${suffix}_RELEASE ) + set( ${basename}_${_outvar} ${${basename}_${suffix}_RELEASE} ) + elseif( ${basename}_${suffix}_DEBUG ) + set( ${basename}_${_outvar} ${${basename}_${suffix}_DEBUG} ) + else() + set( ${basename}_${_outvar} "${basename}_${suffix}-NOTFOUND") + endif() + + #break out of local scope + set(${basename}_${_outvar} ${${basename}_${_outvar}} PARENT_SCOPE) + + mark_as_advanced( ${basename}_${suffix}_RELEASE ${basename}_${suffix}_DEBUG ) +endfunction() \ No newline at end of file diff --git a/TargetImportedLibraries.cmake b/TargetImportedLibraries.cmake new file mode 100644 index 000000000..8fc252b30 --- /dev/null +++ b/TargetImportedLibraries.cmake @@ -0,0 +1,120 @@ +#.rst: +# ImportTargetLibraries +# --------------------- +# +# Created by Walter Gray +# See CreateImportTargetHelpers.cmake for a suite of functions suitable for writing Find +# modules compatible with this approach. +# +# ======================== +# TARGET_IMPORTED_LIBRARIES( ) +# Takes the same arguments as target_link_libraries, but for any listed library where +# is a valid target with a TYPE property of SHARED_LIBRARY, it will +# read from the IMPORTED_LOCATION and IMPORTED_LOCATION_ parameters and generate +# a custom post-build step to copy the shared library files to the appropriate location. +# On windows, this is the TARGET_FILE_DIR of . link_type should be one of +# PUBLIC, PRIVATE, or INTERFACE +# +# TARGET_PACKAGE( ...) +# Takes the same arguments as find_package, with the addition of the target you're +# linking to as the first parameter. Upon successfully finding the package, it +# attempts to call TARGET_IMPORTED_LIBRARIES( ::) + +include(CMakeParseArguments) +function(target_imported_libraries target) + list(REMOVE_AT ARGV 0) #pop the target + cmake_parse_arguments(target_imported_libraries "" "LINK_TYPE" "" ${ARGV}) + + set(_library_list ${target_imported_libraries_UNPARSED_ARGUMENTS}) + target_link_libraries(${target} ${target_imported_libraries_LINK_TYPE} ${_library_list}) + + #early out if the target isn't an EXECUTABLE + get_target_property(_target_type ${target} TYPE) + if(NOT ${_target_type} STREQUAL EXECUTABLE) + return() + endif() + + #setup custom commands to copy .dll/dylib files for all dependencies + set(_lib_index 0 ) + list(LENGTH _library_list _lib_length) + + #foreach doesn't allow you to append to the list from within the loop. + while(_lib_index LESS _lib_length) + list(GET _library_list ${_lib_index} _import_lib) + + if(TARGET ${_import_lib}) + get_target_property(_depends ${_import_lib} INTERFACE_LINK_LIBRARIES) + foreach(_depend ${_depends}) + if(TARGET ${_depend}) + list(FIND _library_list ${_depend} _found_lib) + if(_found_lib EQUAL -1) #make sure we don't do duplicate adds. + verbose_message("${target}:Adding nested dependency ${_depend}") + list(APPEND _library_list ${_depend}) + else() + verbose_message("${target}:skipping duplicate nested dependency ${_depend}") + endif() + + endif() + endforeach() + + get_target_property(_type ${_import_lib} TYPE) + get_target_property(_imported ${_import_lib} IMPORTED) + if(${_type} STREQUAL SHARED_LIBRARY AND ${_imported}) + + set(_found_configs_expr) + set(_imported_location) + + #if only the _ variants are set, create a generator expression. + get_target_property(_imported_location ${_import_lib} IMPORTED_LOCATION) + if(NOT _imported_location) + get_target_property(_imported_location_debug ${_import_lib} IMPORTED_LOCATION_DEBUG) + get_target_property(_imported_location_release ${_import_lib} IMPORTED_LOCATION_RELEASE) + if(NOT _imported_location_debug AND NOT _imported_location_release) + message(FATAL_ERROR "No IMPORTED_LOCATION specified for SHARED import target ${_import_lib}") + endif() + set(_imported_location "$<$:${_imported_location_debug}>$<$:${_imported_location_release}>") + endif() + + verbose_message("Adding copy command for ${_import_lib}: ${_imported_location}") + + if(MSVC) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${_imported_location}\" \"$\") + elseif(APPLE) + get_target_property(_is_bundle ${target} MACOSX_BUNDLE) + if(_is_bundle) + add_custom_command(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "$/../Frameworks/" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_imported_location}" "$/../Frameworks/" + COMMAND install_name_tool -change @loader_path/libLeap.dylib @loader_path/../Frameworks/libLeap.dylib "$") + #call install_name_tool and fixup the dylib paths here: + endif() + else() + message(WARNING "Automatic handling of shared libraries is unimplemented on this platform") + endif() + endif() + endif() + + math(EXPR _lib_index "${_lib_index} + 1") #an extremely verbose i++... + #if this is expensive, simply increment it when adding to the list. + list(LENGTH _library_list _lib_length) #this is likely to have changed + endwhile() +endfunction() + +#This function wraps find_package, then calls target_imported_libraries on the generated package) +function(target_package target package ) + list(REMOVE_AT ARGV 0) # pop the target + cmake_parse_arguments(target_package "" "LINK_TYPE" "" ${ARGV}) + + if(TARGET ${package}::${package}) + verbose_message("${package}::${package} already exists, skipping find op") + else() + find_package(${target_package_UNPARSED_ARGUMENTS}) + endif() + + if(target_package_LINK_TYPE) + target_imported_libraries(${target} ${package}::${package} LINK_TYPE ${target_package_LINK_TYPE}) + else() + target_imported_libraries(${target} ${package}::${package}) + endif() +endfunction() diff --git a/TargetStrip.cmake b/TargetStrip.cmake new file mode 100644 index 000000000..65c941295 --- /dev/null +++ b/TargetStrip.cmake @@ -0,0 +1,15 @@ +# primary function of this macro: strip symbols at link time on Mac and Linux +# secondary function: avoid MSVC warnings in Debug by specifying /nodefaultlib +# tertiary function: avoid MSVC warnings about combining /incremental with /ltcg +function(target_strip Target) + if(MSVC) + if(CMAKE_CXX_FLAGS_RELEASE) + set_target_properties(${Target} PROPERTIES LINK_FLAGS_DEBUG "/INCREMENTAL:NO /NODEFAULTLIB:MSVCRT") + else() + set_target_properties(${Target} PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB:MSVCRT") + endif() + else() + set_target_properties(${Target} PROPERTIES LINK_FLAGS_RELEASE + "-Xlinker -unexported_symbol -Xlinker \"*\" -Xlinker -dead_strip -Xlinker -dead_strip_dylibs") + endif() +endfunction() diff --git a/VerboseMessage.cmake b/VerboseMessage.cmake new file mode 100644 index 000000000..982c419c6 --- /dev/null +++ b/VerboseMessage.cmake @@ -0,0 +1,21 @@ +#.rst +# +# VerboseMessage +# -------------- +# +# Handy function for printing debug info +function(verbose_message ...) + if(CMAKE_VERBOSE_MAKEFILE OR VERBOSE) + message(STATUS "${ARGV}") + endif() +endfunction() + +# Prints a list of vars in the format +# varname1 = "${varname1}", varname2 = "${varname2}", etc. +function(verbose_message_print_vars ...) + set(_output_string "") + foreach(_var_name ${ARGV}) + set(_output_string "${_output_string}${_var_name} = \"${${_var_name}}\", ") + endforeach() + verbose_message("${_output_string}") +endfunction() From d0be36d832887d0d77cc0769569205acd62c0b35 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Wed, 19 Nov 2014 16:11:53 -0800 Subject: [PATCH 022/140] Removed old CMakeModules folder --- CMakeModules/pch.cmake | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 CMakeModules/pch.cmake diff --git a/CMakeModules/pch.cmake b/CMakeModules/pch.cmake deleted file mode 100644 index 0fcf7767b..000000000 --- a/CMakeModules/pch.cmake +++ /dev/null @@ -1,27 +0,0 @@ - - -# Adds a precompiled header -MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar) - if(MSVC) - set_source_files_properties(${PrecompiledSource} - PROPERTIES - COMPILE_FLAGS "/Yc${PrecompiledHeader}" - ) - foreach( src_file ${${SourcesVar}} ) - set_source_files_properties( - ${src_file} - PROPERTIES - COMPILE_FLAGS "/Yu${PrecompiledHeader}" - ) - endforeach( src_file ${${SourcesVar}} ) - list(APPEND ${SourcesVar} ${PrecompiledHeader} ${PrecompiledSource}) - endif(MSVC) -ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER) - -function(ADD_MSVC_DISABLED_FILES SourceGroupName SourcesVar ...) - if(WIN32) - set_source_files_properties( ${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE ) - source_group(${SourceGroupName} FILES ${ARGN}) - set(${SourcesVar} ${${SourcesVar}} ${ARGN} PARENT_SCOPE) - endif(WIN32) -endfunction(ADD_MSVC_DISABLED_FILES) \ No newline at end of file From 84c221a9670df16992826c5bb7c0c0dd9306d44e Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Wed, 19 Nov 2014 16:14:00 -0800 Subject: [PATCH 023/140] replaced ADD_MSVC_PRECOMPILED_HEADER with add_pch --- src/autonet/CMakeLists.txt | 2 +- src/autonet/test/CMakeLists.txt | 2 +- src/autowiring/CMakeLists.txt | 2 +- src/autowiring/benchmark/CMakeLists.txt | 2 +- src/autowiring/test/CMakeLists.txt | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/autonet/CMakeLists.txt b/src/autonet/CMakeLists.txt index 0ecf6c193..c66e5aa05 100644 --- a/src/autonet/CMakeLists.txt +++ b/src/autonet/CMakeLists.txt @@ -36,7 +36,7 @@ set(AutoNet_SRCS # All include files are located in /autowiring from here, so prepend that to all sources rewrite_header_paths(AutoNet_SRCS) -ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" AutoNet_SRCS) +add_pch(AutoNet_SRCS "stdafx.h" "stdafx.cpp") add_library(AutoNet SHARED ${AutoNet_SRCS}) target_link_libraries(AutoNet PRIVATE ${Boost_LIBRARIES} Autowiring) diff --git a/src/autonet/test/CMakeLists.txt b/src/autonet/test/CMakeLists.txt index ba45a7b1b..46d4b8cc7 100644 --- a/src/autonet/test/CMakeLists.txt +++ b/src/autonet/test/CMakeLists.txt @@ -9,7 +9,7 @@ set(AutoNetTest_SRCS WebsocketTest.cpp ) -ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" AutoNetTest_SRCS) +add_pch(AutoNetTest_SRCS "stdafx.h" "stdafx.cpp") add_executable(AutoNetTest ${AutoNetTest_SRCS}) target_link_libraries(AutoNetTest AutoTesting AutoNet Autowiring) diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index a1f127855..ccbfda3e2 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -193,7 +193,7 @@ else() endif() rewrite_header_paths(Autowiring_SRCS) -ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" Autowiring_SRCS) +add_pch(Autowiring_SRCS "stdafx.h" "stdafx.cpp") # # Configure library diff --git a/src/autowiring/benchmark/CMakeLists.txt b/src/autowiring/benchmark/CMakeLists.txt index 85fe6b680..04c6e486a 100644 --- a/src/autowiring/benchmark/CMakeLists.txt +++ b/src/autowiring/benchmark/CMakeLists.txt @@ -7,7 +7,7 @@ set(AutowiringBenchmarkTest_SRCS CanBoostPriorityTest.cpp ) -ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" AutowiringBenchmarkTest_SRCS) +add_pch(AutowiringBenchmarkTest_SRCS "stdafx.h" "stdafx.cpp") add_executable(AutowiringBenchmarkTest ${AutowiringBenchmarkTest_SRCS}) target_link_libraries(AutowiringBenchmarkTest Autowiring AutowiringFixture AutoTesting) set_property(TARGET AutowiringBenchmarkTest PROPERTY FOLDER "Autowiring") diff --git a/src/autowiring/test/CMakeLists.txt b/src/autowiring/test/CMakeLists.txt index 86d78610c..5eb62817a 100644 --- a/src/autowiring/test/CMakeLists.txt +++ b/src/autowiring/test/CMakeLists.txt @@ -75,14 +75,14 @@ set(AutowiringFixture_SRCS SelfSelectingFixture.cpp ) -ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" AutowiringFixture_SRCS) +add_pch(AutowiringFixture_SRCS "stdafx.h" "stdafx.cpp") add_library(AutowiringFixture ${AutowiringFixture_SRCS}) set_property(TARGET AutowiringFixture PROPERTY FOLDER "Autowiring") if(NOT WIN32) set_target_properties(AutowiringFixture PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") endif() -ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" AutowiringTest_SRCS) +add_pch(AutowiringTest_SRCS "stdafx.h" "stdafx.cpp") add_executable(AutowiringTest ${AutowiringTest_SRCS}) target_link_libraries(AutowiringTest Autowiring AutowiringFixture AutoTesting) if(NOT WIN32 AND NOT autowiring_USE_LIBCXX) From f442c6de7090352498e6260a40893e06a1372950 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Wed, 19 Nov 2014 16:44:15 -0800 Subject: [PATCH 024/140] added the new cmake-modules folder to the cmake modules path, included AddPch and ConditionalSources at the root level. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5900244f2..05d358fe7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,10 @@ if(NOT WIN32 AND autowiring_BUILD_64) endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) -include(CMakeModules/pch.cmake) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") +include(AddPCH) +include(ConditionalSources) + if(autowiring_BUILD_ARM) # Currently cannot build Autonet for ARM, so default this off on that platform From 3e85a313f73689a5e3130bca963b042606f4ad6a Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Mon, 24 Nov 2014 17:25:35 -0800 Subject: [PATCH 025/140] Change how the namespace of AutoConfig values is specified Instead of using the containing class as the namespace, the namespace type is provided manually. Namespaces are now optional. --- autowiring/AutoConfig.h | 28 ++++++++-------- src/autowiring/AutoConfigManager.cpp | 2 +- src/autowiring/AutoConfigUnix.cpp | 46 +++++++++++--------------- src/autowiring/test/AutoConfigTest.cpp | 23 +++---------- 4 files changed, 39 insertions(+), 60 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 49a752288..22e6f51e7 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -3,6 +3,7 @@ #include "Autowired.h" #include "AutoConfigManager.h" #include "ConfigRegistry.h" +#include "is_any.h" #include #include @@ -15,32 +16,32 @@ struct AnySharedPointer; class AutoConfigBase { public: - template + // Template paramaters reversed so optional namespace is last + template struct ConfigTypeExtractor {}; AutoConfigBase(const std::type_info& tiName); - // Name of the class enclosing this configuration field - const std::string Class; - - // Name of the type proper - const std::string Name; - - // Concatinated field name - const std::string Field; + // Key used to identify this config value + const std::string m_key; }; -template +template class AutoConfig: public AutoConfigBase { public: + static_assert(!is_any...>::value, "void can't be used as a config name"); + static_assert(sizeof...(TField)==1 || sizeof...(TField)==2, "must provide a field and optional namespace"); + + typedef ConfigTypeExtractor t_field; + AutoConfig(void) : - AutoConfigBase(typeid(ConfigTypeExtractor)), - m_value(m_manager->Get(Field)) + AutoConfigBase(typeid(t_field)), + m_value(m_manager->Get(m_key)) { // Register with config registry - (void)RegConfig>::r; + (void)RegConfig::r; } private: @@ -67,4 +68,3 @@ class AutoConfig: return !m_value->empty(); } }; - diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index eccceb556..dd9a9952c 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -37,5 +37,5 @@ void AutoConfigManager::Set(const std::string& name, const char* value) { } void AutoConfigManager::SetParsed(const std::string& name, const std::string& value) { - + throw autowiring_error("Can't parse value"); } diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index 8c8810399..5f6a3c709 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -2,39 +2,33 @@ #include "stdafx.h" #include "AutoConfig.h" #include "demangle.h" -#include "SlotInformation.h" #include #include +#include -static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)>"); -static const std::regex classPattern(".*TypeUnifierComplex<(?:class |struct )?(\\w*)>"); +static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))>$"); -static std::string ExtractFieldName(const std::type_info& ti) { - std::smatch sm; - std::regex_match(autowiring::demangle(ti), sm, namePattern); - assert(sm.size() == 2 && "Regex couldn't find type name"); - return sm.str(1); -} - -static std::string CurrentStumpName(void) { - const SlotInformationStumpBase* cs = SlotInformationStackLocation::CurrentStump(); - if (!cs) - return std::string(); +static std::string FormatKey(const std::smatch& match) { + // If no namespace, just return match + if (match.size() == 2) { + return match.str(1); + } - std::smatch sm; - std::regex_match(autowiring::demangle(cs->ti), sm, classPattern); - assert(sm.size() == 2 && "Regex couldn't find class name"); - return sm.str(1); -} - -static std::string FormatFieldName(const std::string& cls, const std::string& name) { std::stringstream ss; - ss << cls << "." << name; + ss << match.str(1) << "." << match.str(2); return ss.str(); } -AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): - Class(CurrentStumpName()), - Name(ExtractFieldName(tiMemberName)), - Field(FormatFieldName(Class, Name)) +static std::string ExtractKey(const std::type_info& ti) { + std::smatch sm; + std::cout << autowiring::demangle(ti) << std::endl; + std::regex_match(autowiring::demangle(ti), sm, namePattern); + + assert(sm.size() == 2 || sm.size() == 3 && "Regex couldn't find type name"); + + return FormatKey(sm); +} + +AutoConfigBase::AutoConfigBase(const std::type_info& ti): + m_key(ExtractKey(ti)) {} diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index c413c968a..759faf021 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -8,18 +8,18 @@ class AutoConfigTest: {}; struct MyConfigurableClass { - AutoConfig m_myName; + AutoConfig m_myName; }; struct MyConfigurableClass2 { - AutoConfig m_myName; + AutoConfig m_myName; }; TEST_F(AutoConfigTest, VerifyCorrectDeconstruction) { AutoRequired mcc; - EXPECT_STREQ("MyConfigurableClass", mcc->m_myName.Class.c_str()) << "Configuration variable enclosing class was not correctly extracted"; - EXPECT_STREQ("XYZ", mcc->m_myName.Name.c_str()) << "Configuration variable name was not correctly extracted"; + EXPECT_STREQ("MyConfigurableClass.XYZ", mcc->m_myName.m_key.c_str()) + << "Configuration variable name was not correctly extracted"; } TEST_F(AutoConfigTest, VerifySimpleAssignment) { @@ -89,18 +89,3 @@ TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { ASSERT_EQ(324, *clz1->m_myName); ASSERT_EQ(1111, *clz2->m_myName); } - -namespace Outer { - class Inner { - public: - AutoConfig zzz; - }; -} - -TEST_F(AutoConfigTest, NestedNamespaceTest) { - AutoRequired acm; - acm->SetParsed("Outer.Inner.ZZZ", "222"); - - AutoRequired inner; - ASSERT_EQ(222, inner->zzz) << "Nested namespace type did not have the correct value"; -} From 153e28fa1ee71b1618917e31710ec2cde4ae9348 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Mon, 24 Nov 2014 18:11:06 -0800 Subject: [PATCH 026/140] Default namespace now works --- autowiring/AutoConfig.h | 2 +- src/autowiring/AutoConfigUnix.cpp | 16 +++++++++------- src/autowiring/test/AutoConfigTest.cpp | 13 +++++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 22e6f51e7..266ead79b 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -17,7 +17,7 @@ class AutoConfigBase { public: // Template paramaters reversed so optional namespace is last - template + template struct ConfigTypeExtractor {}; AutoConfigBase(const std::type_info& tiName); diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index 5f6a3c709..5f8276513 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -6,25 +6,27 @@ #include #include -static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))>$"); +static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))?>$"); +static const int NAMESPACE_INDEX = 1; +static const int FIELD_INDEX = 2; static std::string FormatKey(const std::smatch& match) { - // If no namespace, just return match - if (match.size() == 2) { - return match.str(1); + // If no namespace, then field will be empty + if (match.str(FIELD_INDEX).empty()) { + return match.str(NAMESPACE_INDEX); } std::stringstream ss; - ss << match.str(1) << "." << match.str(2); + ss << match.str(NAMESPACE_INDEX) << "." << match.str(FIELD_INDEX); + std::cout << "KEY: " << ss.str() << std::endl; return ss.str(); } static std::string ExtractKey(const std::type_info& ti) { std::smatch sm; - std::cout << autowiring::demangle(ti) << std::endl; std::regex_match(autowiring::demangle(ti), sm, namePattern); - assert(sm.size() == 2 || sm.size() == 3 && "Regex couldn't find type name"); + assert(sm.size() == 3 && "Regex couldn't properly parse type name"); return FormatKey(sm); } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 759faf021..e5da79f39 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -67,6 +67,19 @@ TEST_F(AutoConfigTest, VerifyRecursiveSearch) { } } +struct DefaultName { + AutoConfig m_def; +}; + +TEST_F(AutoConfigTest, DefaultNamespace) { + AutoRequired acm; + acm->Set("defaultname1", 123); + + AutoRequired def; + + ASSERT_EQ(123, *def->m_def); +} + TEST_F(AutoConfigTest, VerifyParsedAssignment) { // We must also be able to support implicit string-to-type conversion via the shift operator for this type AutoRequired acm; From 46cd2daa6b968dca5baabc5196178dadb4a92fb9 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 18:28:59 -0800 Subject: [PATCH 027/140] temporary measure - moved ADD_MSVC_DISABLED_FILES to root cmake lists file --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05d358fe7..1851fe216 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") include(AddPCH) include(ConditionalSources) +function(ADD_MSVC_DISABLED_FILES SourceGroupName SourcesVar ...) + if(WIN32) + set_source_files_properties( ${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE ) + source_group(${SourceGroupName} FILES ${ARGN}) + set(${SourcesVar} ${${SourcesVar}} ${ARGN} PARENT_SCOPE) + endif(WIN32) +endfunction(ADD_MSVC_DISABLED_FILES) if(autowiring_BUILD_ARM) From b5385a95d0a2bf7f0c7b2bc537aeaecfb866f789 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 18:29:15 -0800 Subject: [PATCH 028/140] Updated FindThreads --- cmake-modules/FindThreads.cmake | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmake-modules/FindThreads.cmake b/cmake-modules/FindThreads.cmake index 24c401ec8..39b5a78b9 100644 --- a/cmake-modules/FindThreads.cmake +++ b/cmake-modules/FindThreads.cmake @@ -39,7 +39,6 @@ include (CheckIncludeFiles) include (CheckLibraryExists) include (CheckSymbolExists) -include (VerboseMessage) set(Threads_FOUND FALSE) # Do we have sproc? @@ -177,11 +176,13 @@ if(CMAKE_USE_PTHREADS_INIT) endif() endif() -include(CreateImportTargetHelpers) -include(FindPackageHandleStandardArgs) +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(Threads DEFAULT_MSG Threads_FOUND) -verbose_message("Threads library was found -- CMAKE_THREAD_LIBS_INIT = \"${CMAKE_THREAD_LIBS_INIT}\"") - -set(Threads_LIBRARY ${CMAKE_THREAD_LIBS_INIT}) -find_package_handle_standard_args(Threads REQUIRED_VARS Threads_LIBRARY) -generate_import_target(Threads STATIC) +if(${CMAKE_THREAD_LIBS_INIT}) + include(CreateImportTargetHelpers) + set(Threads_LIBRARY ${CMAKE_THREAD_LIBS_INIT}) + generate_import_target(Threads STATIC) +else() + add_library(Threads::Threads INTERFACE IMPORTED) +endif() From 0927a908e471a65e21cbca9b59351f64abb6707d Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 25 Nov 2014 11:08:02 -0800 Subject: [PATCH 029/140] Move AutoConfig key parsing to its own private header file --- autowiring/ConfigRegistry.h | 19 ++++++-------- src/autowiring/AutoConfigManager.cpp | 9 ++++++- src/autowiring/AutoConfigParser.hpp | 37 ++++++++++++++++++++++++++++ src/autowiring/AutoConfigUnix.cpp | 32 ++---------------------- src/autowiring/CMakeLists.txt | 1 + src/autowiring/ConfigRegistry.cpp | 19 +++----------- 6 files changed, 60 insertions(+), 57 deletions(-) create mode 100644 src/autowiring/AutoConfigParser.hpp diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 71651efb3..e74557c4c 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -10,24 +10,21 @@ struct ConfigRegistryEntry { // Next entry in the list: const ConfigRegistryEntry* const pFlink; - - // Type of this entry: - const std::type_info& ti; // Configuration name - const std::string name; + const std::string m_key; - bool validName(const std::type_info& ti) const; + bool is(const std::string& key) const; virtual AnySharedPointer parse(const std::string&) const = 0; }; -template +template struct ConfigRegistryEntryT: public ConfigRegistryEntry { ConfigRegistryEntryT(void): - ConfigRegistryEntry(typeid(NAME)) + ConfigRegistryEntry(typeid(Key)) {} AnySharedPointer parse(const std::string& str) const { @@ -48,12 +45,12 @@ extern size_t g_confgiEntryCount; /// Any instance of this type registry parameterized on type T will be added to the /// global static type registry, and this registry is computed at link time. /// -template +template class RegConfig { public: - static const ConfigRegistryEntryT r; + static const ConfigRegistryEntryT r; }; -template -const ConfigRegistryEntryT RegConfig::r; +template +const ConfigRegistryEntryT RegConfig::r; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index dd9a9952c..8fe128403 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -5,6 +5,7 @@ #include "demangle.h" #include #include +#include using namespace autowiring; @@ -37,5 +38,11 @@ void AutoConfigManager::Set(const std::string& name, const char* value) { } void AutoConfigManager::SetParsed(const std::string& name, const std::string& value) { - throw autowiring_error("Can't parse value"); + //for(auto config = g_pFirstConfigEntry; config; config = config->pFlink) { + // + //} + + std::stringstream ss; + ss << "Cant parse '" << value <<"' for key '" << name << "'."; + throw autowiring_error(ss.str().c_str()); } diff --git a/src/autowiring/AutoConfigParser.hpp b/src/autowiring/AutoConfigParser.hpp new file mode 100644 index 000000000..2d340ed10 --- /dev/null +++ b/src/autowiring/AutoConfigParser.hpp @@ -0,0 +1,37 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#pragma once +#include "demangle.h" +#include +#include +#include + +namespace autowiring { + +static std::string FormatKey(const std::smatch& match) { + // Indicies into the regex match + static const int NAMESPACE_INDEX = 1; + static const int FIELD_INDEX = 2; + + // If no namespace, then field will be empty + if (match.str(FIELD_INDEX).empty()) { + return match.str(NAMESPACE_INDEX); + } + + std::stringstream ss; + ss << match.str(NAMESPACE_INDEX) << "." << match.str(FIELD_INDEX); + return ss.str(); +} + +static std::string ExtractKey(const std::type_info& ti) { + // Regex pattern + static const std::regex NamePattern( + ".*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))?>$" + ); + + std::smatch sm; + std::regex_match(demangle(ti), sm, NamePattern); + + return FormatKey(sm); +} + +}//namespace autowiring diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfigUnix.cpp index 5f8276513..84e5304f3 100644 --- a/src/autowiring/AutoConfigUnix.cpp +++ b/src/autowiring/AutoConfigUnix.cpp @@ -1,36 +1,8 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "AutoConfig.h" -#include "demangle.h" -#include -#include -#include - -static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))?>$"); -static const int NAMESPACE_INDEX = 1; -static const int FIELD_INDEX = 2; - -static std::string FormatKey(const std::smatch& match) { - // If no namespace, then field will be empty - if (match.str(FIELD_INDEX).empty()) { - return match.str(NAMESPACE_INDEX); - } - - std::stringstream ss; - ss << match.str(NAMESPACE_INDEX) << "." << match.str(FIELD_INDEX); - std::cout << "KEY: " << ss.str() << std::endl; - return ss.str(); -} - -static std::string ExtractKey(const std::type_info& ti) { - std::smatch sm; - std::regex_match(autowiring::demangle(ti), sm, namePattern); - - assert(sm.size() == 3 && "Regex couldn't properly parse type name"); - - return FormatKey(sm); -} +#include "AutoConfigParser.hpp" AutoConfigBase::AutoConfigBase(const std::type_info& ti): - m_key(ExtractKey(ti)) + m_key(autowiring::ExtractKey(ti)) {} diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 1c4d233fd..fca5d3ec9 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -19,6 +19,7 @@ set(Autowiring_SRCS AnySharedPointer.cpp AutoCheckout.h AutoConfig.h + AutoConfigParser.hpp AutoConfigManager.h AutoConfigManager.cpp AutoRestarter.h diff --git a/src/autowiring/ConfigRegistry.cpp b/src/autowiring/ConfigRegistry.cpp index d5224f2e3..944912f48 100644 --- a/src/autowiring/ConfigRegistry.cpp +++ b/src/autowiring/ConfigRegistry.cpp @@ -1,17 +1,7 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "ConfigRegistry.h" -#include "demangle.h" -#include -#include - -static const std::regex namePattern(".*ConfigTypeExtractor<(?:class |struct )?(\\w*)>"); - -static std::string ExtractFieldName(const std::type_info& ti) { - std::smatch sm; - std::regex_match(autowiring::demangle(ti), sm, namePattern); - return sm.str(1); -} +#include "AutoConfigParser.hpp" // Head of a linked list which will have node for every event type const ConfigRegistryEntry* g_pFirstConfigEntry = nullptr; @@ -19,13 +9,12 @@ size_t g_configEntryCount = 0; ConfigRegistryEntry::ConfigRegistryEntry(const std::type_info& tinfo) : pFlink(g_pFirstConfigEntry), - ti(tinfo), - name(ExtractFieldName(tinfo)) + m_key(autowiring::ExtractKey(tinfo)) { g_configEntryCount++; g_pFirstConfigEntry = this; } -bool ConfigRegistryEntry::validName(const std::type_info& tinfo) const { - return name == ExtractFieldName(tinfo); +bool ConfigRegistryEntry::is(const std::string& key) const { + return m_key == key; } From bcb0285517a6ecd0bc9fad4034beb06f9a389c6c Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 25 Nov 2014 11:18:53 -0800 Subject: [PATCH 030/140] Correctly parse AutoConfig values from string --- autowiring/AutoConfigManager.h | 14 +++++++------- src/autowiring/AutoConfigManager.cpp | 23 ++++++++++++++--------- src/autowiring/test/AutoConfigTest.cpp | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index f69989b2e..0a6813e3c 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -27,7 +27,7 @@ class AutoConfigManager: /// This method will throw an exception if the specified name cannot be found as a configurable value /// in the application, or if the specified value type does not match the type expected by this field /// - AnySharedPointer& Get(const std::string& name); + AnySharedPointer& Get(const std::string& key); /// /// Assigns the specified value to an AnySharedPointer slot @@ -37,12 +37,12 @@ class AutoConfigManager: /// in the application, or if the specified value type does not match the type expected by this field /// template - void Set(const std::string& name, const T& value) { + void Set(const std::string& key, const T& value) { // Set value in this AutoConfigManager std::lock_guard lk(m_lock); - m_attributes[name] = AnySharedPointer(std::make_shared(value)); + m_attributes[key] = AnySharedPointer(std::make_shared(value)); // Recurse through child contexts and set if value hasn't already been set for(const auto& ctxt : ContextEnumerator(GetContext())) { @@ -52,8 +52,8 @@ class AutoConfigManager: AutowiredFast mgmt(ctxt); if(mgmt) { std::lock_guard lk(mgmt->m_lock); - if (mgmt->m_attributes[name]->empty()) - mgmt->m_attributes[name] = m_attributes[name]; + if (mgmt->m_attributes[key]->empty()) + mgmt->m_attributes[key] = m_attributes[key]; } } } @@ -61,7 +61,7 @@ class AutoConfigManager: /// /// Overload for c-style string. Converts to std::string /// - void Set(const std::string& name, const char* value); + void Set(const std::string& key, const char* value); /// /// Coerces the string representation of the specified field to the correct value type @@ -69,5 +69,5 @@ class AutoConfigManager: /// /// This method will throw an exception if there is no string converter available on this type /// - void SetParsed(const std::string& name, const std::string& value); + void SetParsed(const std::string& key, const std::string& value); }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 8fe128403..558a344db 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -28,21 +28,26 @@ AutoConfigManager::AutoConfigManager(void){ AutoConfigManager::~AutoConfigManager(void){} -AnySharedPointer& AutoConfigManager::Get(const std::string& name) { +AnySharedPointer& AutoConfigManager::Get(const std::string& key) { std::lock_guard lk(m_lock); - return m_attributes[name]; + return m_attributes[key]; } -void AutoConfigManager::Set(const std::string& name, const char* value) { - Set(name, std::string(value)); +void AutoConfigManager::Set(const std::string& key, const char* value) { + Set(key, std::string(value)); } -void AutoConfigManager::SetParsed(const std::string& name, const std::string& value) { - //for(auto config = g_pFirstConfigEntry; config; config = config->pFlink) { - // - //} +void AutoConfigManager::SetParsed(const std::string& key, const std::string& value) { + for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { + if (config->is(key)){ + std::lock_guard lk(m_lock); + m_attributes[key] = config->parse(value); + return; + } + } + // Error if key wasn't found in registry std::stringstream ss; - ss << "Cant parse '" << value <<"' for key '" << name << "'."; + ss << "Cant parse '" << value <<"' for key '" << key << "'."; throw autowiring_error(ss.str().c_str()); } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index e5da79f39..c79d75a4c 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -8,7 +8,7 @@ class AutoConfigTest: {}; struct MyConfigurableClass { - AutoConfig m_myName; + AutoConfig m_myName; }; struct MyConfigurableClass2 { From 73f3b4d4ace39740d9018bcffc5949cddad42dcf Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 25 Nov 2014 11:39:12 -0800 Subject: [PATCH 031/140] Correctly verify types when setting AutoConfig values --- autowiring/AutoConfigManager.h | 22 +++++++++++++++++++++- autowiring/ConfigRegistry.h | 6 ++++++ src/autowiring/AutoConfigManager.cpp | 3 ++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 0a6813e3c..486221e04 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -3,6 +3,7 @@ #include "ConfigRegistry.h" #include "autowiring_error.h" #include +#include #include STL_UNORDERED_MAP #include MEMORY_HEADER @@ -38,10 +39,29 @@ class AutoConfigManager: /// template void Set(const std::string& key, const T& value) { + std::lock_guard lk(m_lock); + + // Iterate through all registered configs to verify the key and type match. + bool configFound = false; + for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { + if (config->is(key)){ + if (!config->verifyType(typeid(T))) { + std::stringstream ss; + ss << "Attempting to set config '" << key << "' with incorrect type " << autowiring::demangle(typeid(T)); + throw autowiring_error(ss.str().c_str()); + } + configFound = true; + break; + } + } + if (!configFound) { + std::stringstream ss; + ss << "No configuration found for key '" << key << "'."; + throw autowiring_error(ss.str().c_str()); + } // Set value in this AutoConfigManager - std::lock_guard lk(m_lock); m_attributes[key] = AnySharedPointer(std::make_shared(value)); // Recurse through child contexts and set if value hasn't already been set diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index e74557c4c..e6ae121ce 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -16,6 +16,8 @@ struct ConfigRegistryEntry { bool is(const std::string& key) const; + virtual bool verifyType(const std::type_info& ti) const = 0; + virtual AnySharedPointer parse(const std::string&) const = 0; }; @@ -27,6 +29,10 @@ struct ConfigRegistryEntryT: ConfigRegistryEntry(typeid(Key)) {} + bool verifyType(const std::type_info& ti) const { + return typeid(T) == ti; + } + AnySharedPointer parse(const std::string& str) const { std::istringstream ss(str); T val; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 558a344db..8443e4b09 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -38,9 +38,10 @@ void AutoConfigManager::Set(const std::string& key, const char* value) { } void AutoConfigManager::SetParsed(const std::string& key, const std::string& value) { + std::lock_guard lk(m_lock); + for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { if (config->is(key)){ - std::lock_guard lk(m_lock); m_attributes[key] = config->parse(value); return; } From 4a0491fc931be8d4f9e5367505becde3bc4e3f29 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 25 Nov 2014 13:36:25 -0800 Subject: [PATCH 032/140] Merge platform-specific AutoConfig.cpp's. Add documentation --- autowiring/AutoConfig.h | 33 ++++++++++++++----- autowiring/AutoConfigManager.h | 20 +++-------- .../{AutoConfigUnix.cpp => AutoConfig.cpp} | 0 src/autowiring/AutoConfigManager.cpp | 20 ++++++++++- src/autowiring/AutoConfigParser.hpp | 2 +- src/autowiring/AutoConfigWin.cpp | 30 ----------------- src/autowiring/CMakeLists.txt | 5 ++- 7 files changed, 51 insertions(+), 59 deletions(-) rename src/autowiring/{AutoConfigUnix.cpp => AutoConfig.cpp} (100%) delete mode 100644 src/autowiring/AutoConfigWin.cpp diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 266ead79b..1346168f4 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -15,26 +15,41 @@ struct AnySharedPointer; /// class AutoConfigBase { -public: - // Template paramaters reversed so optional namespace is last - template +protected: + // Template arguemnts TKey specify the key and optional namespace for a config attribute + template struct ConfigTypeExtractor {}; - + +public: AutoConfigBase(const std::type_info& tiName); // Key used to identify this config value const std::string m_key; }; -template +/// +/// Register an attribute with the AutoConfig system. For example +/// +/// AutoConfig m_myVal; +/// defines the key "MyNamespace.MyKey" +/// +/// The Namespace field is optional, so +/// AutoConfig m_myVal; +/// defines the key "MyKey" +/// +/// AutoConfig values can be set from the AutoConfigManager. The string key +/// is used as the identifier for the value +/// +template class AutoConfig: public AutoConfigBase { -public: - static_assert(!is_any...>::value, "void can't be used as a config name"); - static_assert(sizeof...(TField)==1 || sizeof...(TField)==2, "must provide a field and optional namespace"); +private: + // Specifies the optional namespace and key for this config attribute + typedef ConfigTypeExtractor t_field; - typedef ConfigTypeExtractor t_field; +public: + static_assert(sizeof...(TKey)==1 || sizeof...(TKey)==2, "Must provide a field and optional namespace"); AutoConfig(void) : AutoConfigBase(typeid(t_field)), diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 486221e04..b8cb11aa1 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -19,6 +19,9 @@ class AutoConfigManager: private: std::mutex m_lock; std::unordered_map m_attributes; + + // Set an AnySharedPointer. This must be external synchronized + void SetInternal(const std::string& key, const AnySharedPointer& value); public: /// @@ -62,22 +65,9 @@ class AutoConfigManager: } // Set value in this AutoConfigManager - m_attributes[key] = AnySharedPointer(std::make_shared(value)); - - // Recurse through child contexts and set if value hasn't already been set - for(const auto& ctxt : ContextEnumerator(GetContext())) { - if (ctxt == GetContext()) - continue; - - AutowiredFast mgmt(ctxt); - if(mgmt) { - std::lock_guard lk(mgmt->m_lock); - if (mgmt->m_attributes[key]->empty()) - mgmt->m_attributes[key] = m_attributes[key]; - } - } + SetInternal(key, AnySharedPointer(std::make_shared(value))); } - + /// /// Overload for c-style string. Converts to std::string /// diff --git a/src/autowiring/AutoConfigUnix.cpp b/src/autowiring/AutoConfig.cpp similarity index 100% rename from src/autowiring/AutoConfigUnix.cpp rename to src/autowiring/AutoConfig.cpp diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 8443e4b09..cdc547ac4 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -28,6 +28,24 @@ AutoConfigManager::AutoConfigManager(void){ AutoConfigManager::~AutoConfigManager(void){} +void AutoConfigManager::SetInternal(const std::string& key, const AnySharedPointer& value) { + // Set value in this AutoConfigManager + m_attributes[key] = value; + + // Recurse through child contexts and set if value hasn't already been set + for(const auto& ctxt : ContextEnumerator(GetContext())) { + if (ctxt == GetContext()) + continue; + + AutowiredFast mgmt(ctxt); + if(mgmt) { + std::lock_guard lk(mgmt->m_lock); + if (mgmt->m_attributes[key]->empty()) + mgmt->m_attributes[key] = m_attributes[key]; + } + } +} + AnySharedPointer& AutoConfigManager::Get(const std::string& key) { std::lock_guard lk(m_lock); return m_attributes[key]; @@ -42,7 +60,7 @@ void AutoConfigManager::SetParsed(const std::string& key, const std::string& val for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { if (config->is(key)){ - m_attributes[key] = config->parse(value); + SetInternal(key, config->parse(value)); return; } } diff --git a/src/autowiring/AutoConfigParser.hpp b/src/autowiring/AutoConfigParser.hpp index 2d340ed10..d1d15fc74 100644 --- a/src/autowiring/AutoConfigParser.hpp +++ b/src/autowiring/AutoConfigParser.hpp @@ -25,7 +25,7 @@ static std::string FormatKey(const std::smatch& match) { static std::string ExtractKey(const std::type_info& ti) { // Regex pattern static const std::regex NamePattern( - ".*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))?>$" + "^.*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))?>$" ); std::smatch sm; diff --git a/src/autowiring/AutoConfigWin.cpp b/src/autowiring/AutoConfigWin.cpp deleted file mode 100644 index a8b92ae1e..000000000 --- a/src/autowiring/AutoConfigWin.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#include "stdafx.h" -#include "AutoConfig.h" -#include "SlotInformation.h" -#include "demangle.h" -#include "expect.h" -#include - -static std::string CurrentStumpName(void) { - const auto* cs = SlotInformationStackLocation::CurrentStump(); - return cs ? autowiring::demangle(cs->ti) : std::string(); -} - -static std::string ExtractFieldName(const std::type_info& ti) { - // Name will be of the form "struct AutoConfigBase::ConfigTypeExtractor" - std::stringstream ss(ti.name()); - - std::string retVal; - if(ss >> autowiring::expect("struct") - >> autowiring::expect("AutoConfigBase::ConfigTypeExtractor> retVal; - return retVal; -} - -AutoConfigBase::AutoConfigBase(const std::type_info& tiMemberName): - Class(CurrentStumpName()), - Name(ExtractFieldName(tiMemberName)) -{ -} \ No newline at end of file diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index fca5d3ec9..2c5c99224 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -19,9 +19,10 @@ set(Autowiring_SRCS AnySharedPointer.cpp AutoCheckout.h AutoConfig.h - AutoConfigParser.hpp + AutoConfig.cpp AutoConfigManager.h AutoConfigManager.cpp + AutoConfigParser.hpp AutoRestarter.h AutoFuture.h AutoFuture.cpp @@ -163,14 +164,12 @@ endif() set(Autowiring_Win_SRCS CoreThreadWin.cpp - AutoConfigWin.cpp InterlockedExchangeWin.cpp thread_specific_ptr_win.h ) set(Autowiring_Unix_SRCS InterlockedExchangeUnix.cpp - AutoConfigUnix.cpp thread_specific_ptr_unix.h ) From 01b843e8aa787d53df845f1ac988536faf3e3f27 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 25 Nov 2014 15:25:50 -0800 Subject: [PATCH 033/140] Add documentation and change autowiring_error to take a std::string --- autowiring/AutoConfig.h | 2 +- autowiring/AutoConfigManager.h | 9 +++++---- autowiring/autowiring_error.h | 7 ++++--- src/autowiring/AutoConfigManager.cpp | 4 ++-- src/autowiring/autowiring_error.cpp | 2 +- src/autowiring/test/AutoConfigTest.cpp | 3 ++- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 1346168f4..8093bf288 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -49,7 +49,7 @@ class AutoConfig: typedef ConfigTypeExtractor t_field; public: - static_assert(sizeof...(TKey)==1 || sizeof...(TKey)==2, "Must provide a field and optional namespace"); + static_assert(sizeof...(TKey)==1 || sizeof...(TKey)==2, "Must provide a key and optional namespace"); AutoConfig(void) : AutoConfigBase(typeid(t_field)), diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index b8cb11aa1..b47b3d56c 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -50,8 +50,9 @@ class AutoConfigManager: if (config->is(key)){ if (!config->verifyType(typeid(T))) { std::stringstream ss; - ss << "Attempting to set config '" << key << "' with incorrect type " << autowiring::demangle(typeid(T)); - throw autowiring_error(ss.str().c_str()); + ss << "Attempting to set config '" << key << "' with incorrect type '" + << autowiring::demangle(typeid(T)) << "'"; + throw autowiring_error(ss.str()); } configFound = true; break; @@ -60,8 +61,8 @@ class AutoConfigManager: if (!configFound) { std::stringstream ss; - ss << "No configuration found for key '" << key << "'."; - throw autowiring_error(ss.str().c_str()); + ss << "No configuration found for key '" << key << "'"; + throw autowiring_error(ss.str()); } // Set value in this AutoConfigManager diff --git a/autowiring/autowiring_error.h b/autowiring/autowiring_error.h index 3117ee861..3e46704f9 100644 --- a/autowiring/autowiring_error.h +++ b/autowiring/autowiring_error.h @@ -1,18 +1,19 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once #include +#include class autowiring_error: public std::exception { public: - autowiring_error(const char* what); + autowiring_error(const std::string& what); virtual ~autowiring_error(void); private: - const char* m_what; + const std::string m_what; public: - const char* what(void) const throw() override {return m_what;} + const char* what(void) const throw() override {return m_what.c_str();} }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index cdc547ac4..8ed407852 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -67,6 +67,6 @@ void AutoConfigManager::SetParsed(const std::string& key, const std::string& val // Error if key wasn't found in registry std::stringstream ss; - ss << "Cant parse '" << value <<"' for key '" << key << "'."; - throw autowiring_error(ss.str().c_str()); + ss << "Cant parse '" << value <<"' for key '" << key << "'"; + throw autowiring_error(ss.str()); } diff --git a/src/autowiring/autowiring_error.cpp b/src/autowiring/autowiring_error.cpp index 312a0f066..58ef38889 100644 --- a/src/autowiring/autowiring_error.cpp +++ b/src/autowiring/autowiring_error.cpp @@ -2,7 +2,7 @@ #include "stdafx.h" #include "autowiring_error.h" -autowiring_error::autowiring_error(const char* what): +autowiring_error::autowiring_error(const std::string& what): m_what(what) {} diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index c79d75a4c..0f01d4558 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -40,7 +40,6 @@ TEST_F(AutoConfigTest, VerifyPostHocAssignment) { Autowired acm; ASSERT_TRUE(acm.IsAutowired()) << "AutoConfig field did not inject a configuration manager into this context as expected"; - // acm->Set("MyConfigurableClass.XYZ", 323); // Now inject the type which expects this value to be assigned: @@ -86,6 +85,8 @@ TEST_F(AutoConfigTest, VerifyParsedAssignment) { // Direct assignment to a string should not work, the type isn't a string it's an int ASSERT_ANY_THROW(acm->Set("MyConfigurableClass.XYZ", "327")) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; + + ASSERT_ANY_THROW(acm->Set("MyConfigurableClass.XYZ", 3.0)) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; // Assignment to a string type should result in an appropriate coercion to the right value acm->SetParsed("MyConfigurableClass.XYZ", "324"); From dc9becebc3ac9426cd3e2f0e400dc1cd0f7364f4 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 25 Nov 2014 17:14:25 -0800 Subject: [PATCH 034/140] Moved recursive config search from the setters to the getters --- autowiring/AutoConfig.h | 15 ++----- autowiring/AutoConfigManager.h | 11 +++-- src/autowiring/AutoConfigManager.cpp | 58 +++++++++++++++----------- src/autowiring/test/AutoConfigTest.cpp | 24 +++++------ 4 files changed, 56 insertions(+), 52 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 8093bf288..2eea9409d 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -52,8 +52,7 @@ class AutoConfig: static_assert(sizeof...(TKey)==1 || sizeof...(TKey)==2, "Must provide a key and optional namespace"); AutoConfig(void) : - AutoConfigBase(typeid(t_field)), - m_value(m_manager->Get(m_key)) + AutoConfigBase(typeid(t_field)) { // Register with config registry (void)RegConfig::r; @@ -61,25 +60,17 @@ class AutoConfig: private: AutoRequired m_manager; - AnySharedPointer& m_value; public: - operator T(void){ - return m_value; - } - - operator const T&(void){ - return m_value; - } const T& operator*(void) const { - return *m_value.as(); + return *m_manager->Get(m_key).template as(); } /// /// True if this configurable field has been satisfied with a value /// bool IsConfigured(void) const { - return !m_value->empty(); + return m_manager->IsConfigured(m_key); } }; diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index b47b3d56c..291f6e848 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -5,6 +5,7 @@ #include #include #include STL_UNORDERED_MAP +#include STL_UNORDERED_SET #include MEMORY_HEADER struct AnySharedPointer; @@ -19,11 +20,13 @@ class AutoConfigManager: private: std::mutex m_lock; std::unordered_map m_attributes; - - // Set an AnySharedPointer. This must be external synchronized - void SetInternal(const std::string& key, const AnySharedPointer& value); public: + /// + /// Check if this key has been set + /// + bool IsConfigured(const std::string& key); + /// /// Get a reference to where the config value is stored /// @@ -66,7 +69,7 @@ class AutoConfigManager: } // Set value in this AutoConfigManager - SetInternal(key, AnySharedPointer(std::make_shared(value))); + m_attributes[key] = AnySharedPointer(std::make_shared(value)); } /// diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 8ed407852..634bbfe8a 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -9,46 +9,56 @@ using namespace autowiring; -AutoConfigManager::AutoConfigManager(void){ - std::shared_ptr ctxt = GetContext()->GetParentContext(); - +AutoConfigManager::AutoConfigManager(void){} +AutoConfigManager::~AutoConfigManager(void){} + +bool AutoConfigManager::IsConfigured(const std::string& key) { // iterate ancestor contexts, filling any configs + std::shared_ptr ctxt = GetContext(); while (ctxt) { AutowiredFast mgmt(ctxt); if(mgmt) { std::lock_guard lk(mgmt->m_lock); - for (const auto& entry : mgmt->m_attributes) - m_attributes.insert(entry); + if (mgmt->m_attributes.count(key)) { + return true; + } } - + ctxt = ctxt->GetParentContext(); } + + // Key not found + return false; } -AutoConfigManager::~AutoConfigManager(void){} - -void AutoConfigManager::SetInternal(const std::string& key, const AnySharedPointer& value) { - // Set value in this AutoConfigManager - m_attributes[key] = value; +AnySharedPointer& AutoConfigManager::Get(const std::string& key) { + std::lock_guard lk(m_lock); - // Recurse through child contexts and set if value hasn't already been set - for(const auto& ctxt : ContextEnumerator(GetContext())) { - if (ctxt == GetContext()) - continue; - + // Check this first + if (m_attributes.count(key)) { + return m_attributes[key]; + } + + // iterate ancestor contexts, filling any configs + std::shared_ptr ctxt = GetContext()->GetParentContext(); + while (ctxt) { AutowiredFast mgmt(ctxt); + if(mgmt) { std::lock_guard lk(mgmt->m_lock); - if (mgmt->m_attributes[key]->empty()) - mgmt->m_attributes[key] = m_attributes[key]; + if (mgmt->m_attributes.count(key)) { + return mgmt->m_attributes[key]; + } } + + ctxt = ctxt->GetParentContext(); } -} - -AnySharedPointer& AutoConfigManager::Get(const std::string& key) { - std::lock_guard lk(m_lock); - return m_attributes[key]; + + // Key not found, throw exception + std::stringstream ss; + ss << "Attepted to get key '" << key <<"' which hasn't been set"; + throw autowiring_error(ss.str()); } void AutoConfigManager::Set(const std::string& key, const char* value) { @@ -60,7 +70,7 @@ void AutoConfigManager::SetParsed(const std::string& key, const std::string& val for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { if (config->is(key)){ - SetInternal(key, config->parse(value)); + m_attributes[key] = config->parse(value); return; } } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 0f01d4558..08fcbbbad 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -8,24 +8,24 @@ class AutoConfigTest: {}; struct MyConfigurableClass { - AutoConfig m_myName; + AutoConfig m_myName; }; struct MyConfigurableClass2 { - AutoConfig m_myName; + AutoConfig m_myName; }; TEST_F(AutoConfigTest, VerifyCorrectDeconstruction) { AutoRequired mcc; - EXPECT_STREQ("MyConfigurableClass.XYZ", mcc->m_myName.m_key.c_str()) + EXPECT_STREQ("Namespace1.XYZ", mcc->m_myName.m_key.c_str()) << "Configuration variable name was not correctly extracted"; } TEST_F(AutoConfigTest, VerifySimpleAssignment) { // Set an attribute in the manager before injecting anything: AutoRequired acm; - acm->Set("MyConfigurableClass.XYZ", 323); + acm->Set("Namespace1.XYZ", 323); // Now inject the type which expects this value to be assigned: AutoRequired mcc; @@ -40,7 +40,7 @@ TEST_F(AutoConfigTest, VerifyPostHocAssignment) { Autowired acm; ASSERT_TRUE(acm.IsAutowired()) << "AutoConfig field did not inject a configuration manager into this context as expected"; - acm->Set("MyConfigurableClass.XYZ", 323); + acm->Set("Namespace1.XYZ", 323); // Now inject the type which expects this value to be assigned: ASSERT_EQ(323, *mcc->m_myName) << "Configurable type did not receive a value as expected"; @@ -48,7 +48,7 @@ TEST_F(AutoConfigTest, VerifyPostHocAssignment) { TEST_F(AutoConfigTest, VerifyRecursiveSearch) { AutoRequired acm; - acm->Set("MyConfigurableClass.XYZ", 1001); + acm->Set("Namespace1.XYZ", 1001); { AutoCreateContext ctxt; @@ -61,7 +61,7 @@ TEST_F(AutoConfigTest, VerifyRecursiveSearch) { // This must work as expected--a local context override will rewrite configuration values in the local scope AutoRequired sub_mcc; - sub_mcc->Set("MyConfigurableClass.XYZ", 1002); + sub_mcc->Set("Namespace1.XYZ", 1002); ASSERT_EQ(1002, *mcc->m_myName) << "Override of a configurable value in a derived class did not take place as expected"; } } @@ -84,18 +84,18 @@ TEST_F(AutoConfigTest, VerifyParsedAssignment) { AutoRequired acm; // Direct assignment to a string should not work, the type isn't a string it's an int - ASSERT_ANY_THROW(acm->Set("MyConfigurableClass.XYZ", "327")) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; + ASSERT_ANY_THROW(acm->Set("Namespace1.XYZ", "327")) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; - ASSERT_ANY_THROW(acm->Set("MyConfigurableClass.XYZ", 3.0)) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; + ASSERT_ANY_THROW(acm->Set("Namespace1.XYZ", 3.0)) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; // Assignment to a string type should result in an appropriate coercion to the right value - acm->SetParsed("MyConfigurableClass.XYZ", "324"); + acm->SetParsed("Namespace1.XYZ", "324"); } TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { AutoRequired acm; - acm->SetParsed("MyConfigurableClass.XYZ", "324"); - acm->SetParsed("MyConfigurableClass2.XYZ", "1111"); + acm->SetParsed("Namespace1.XYZ", "324"); + acm->SetParsed("Namespace2.XYZ", "1111"); AutoRequired clz1; AutoRequired clz2; From 806df8b39bd938655e2924534f2fce7112c307c1 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 25 Nov 2014 17:46:17 -0800 Subject: [PATCH 035/140] Simplify AutoConfig interface AutoConfig now acts as a value type instead of a pointer. operator T gets the value from the AutoConfigManager and operator= sets it --- autowiring/AutoConfig.h | 8 +++++++- autowiring/AutoConfigManager.h | 2 +- src/autowiring/test/AutoConfigTest.cpp | 24 +++++++++++++++++------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 2eea9409d..db00a4be9 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -63,9 +63,15 @@ class AutoConfig: public: - const T& operator*(void) const { + operator T() const { return *m_manager->Get(m_key).template as(); } + + AutoConfig& operator=(const T& rhs) { + m_manager->Set(m_key, rhs); + + return *this; + } /// /// True if this configurable field has been satisfied with a value diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 291f6e848..26ceaaa83 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -54,7 +54,7 @@ class AutoConfigManager: if (!config->verifyType(typeid(T))) { std::stringstream ss; ss << "Attempting to set config '" << key << "' with incorrect type '" - << autowiring::demangle(typeid(T)) << "'"; + << autowiring::demangle(typeid(T)) << "'"; throw autowiring_error(ss.str()); } configFound = true; diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 08fcbbbad..27e4eb9df 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -29,7 +29,7 @@ TEST_F(AutoConfigTest, VerifySimpleAssignment) { // Now inject the type which expects this value to be assigned: AutoRequired mcc; - ASSERT_EQ(323, *mcc->m_myName) << "Configurable type did not receive a value as expected"; + ASSERT_EQ(323, mcc->m_myName) << "Configurable type did not receive a value as expected"; } TEST_F(AutoConfigTest, VerifyPostHocAssignment) { @@ -43,7 +43,7 @@ TEST_F(AutoConfigTest, VerifyPostHocAssignment) { acm->Set("Namespace1.XYZ", 323); // Now inject the type which expects this value to be assigned: - ASSERT_EQ(323, *mcc->m_myName) << "Configurable type did not receive a value as expected"; + ASSERT_EQ(323, mcc->m_myName) << "Configurable type did not receive a value as expected"; } TEST_F(AutoConfigTest, VerifyRecursiveSearch) { @@ -57,12 +57,12 @@ TEST_F(AutoConfigTest, VerifyRecursiveSearch) { // Now inject an element here, and verify that it was wired up as expected: AutoRequired mcc; ASSERT_TRUE(mcc->m_myName.IsConfigured()) << "A configurable value was not configured as expected"; - ASSERT_EQ(1001, *mcc->m_myName) << "Configurable value obtained from a parent scope did not have the correct value"; + ASSERT_EQ(1001, mcc->m_myName) << "Configurable value obtained from a parent scope did not have the correct value"; // This must work as expected--a local context override will rewrite configuration values in the local scope AutoRequired sub_mcc; sub_mcc->Set("Namespace1.XYZ", 1002); - ASSERT_EQ(1002, *mcc->m_myName) << "Override of a configurable value in a derived class did not take place as expected"; + ASSERT_EQ(1002, mcc->m_myName) << "Override of a configurable value in a derived class did not take place as expected"; } } @@ -76,7 +76,7 @@ TEST_F(AutoConfigTest, DefaultNamespace) { AutoRequired def; - ASSERT_EQ(123, *def->m_def); + ASSERT_EQ(123, def->m_def); } TEST_F(AutoConfigTest, VerifyParsedAssignment) { @@ -100,6 +100,16 @@ TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { AutoRequired clz1; AutoRequired clz2; - ASSERT_EQ(324, *clz1->m_myName); - ASSERT_EQ(1111, *clz2->m_myName); + ASSERT_EQ(324, clz1->m_myName); + ASSERT_EQ(1111, clz2->m_myName); +} + +TEST_F(AutoConfigTest, ChangeConfig) { + AutoRequired clz1; + + clz1->m_myName = 42; + + Autowired acm; + + ASSERT_EQ(42, *acm->Get("Namespace1.XYZ").as()); } From f12aaf652f4c7814454d837e648847b3d45cf576 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 26 Nov 2014 11:56:30 -0800 Subject: [PATCH 036/140] Remove ability to set with operator= Replace with Set function in AutoConfig that forwards to AutoConfigManager --- autowiring/AutoConfig.h | 15 ++++++++++----- src/autowiring/AutoConfigManager.cpp | 12 +++--------- src/autowiring/test/AutoConfigTest.cpp | 15 ++++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index db00a4be9..76c48cedc 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -63,14 +63,12 @@ class AutoConfig: public: - operator T() const { + operator const T&() const { return *m_manager->Get(m_key).template as(); } - AutoConfig& operator=(const T& rhs) { - m_manager->Set(m_key, rhs); - - return *this; + const T& operator*() const { + return operator const T&(); } /// @@ -79,4 +77,11 @@ class AutoConfig: bool IsConfigured(void) const { return m_manager->IsConfigured(m_key); } + + /// + /// Set value on this context's AutoConfigManager + /// + void Set(const T& value) { + m_manager->Set(m_key, value); + } }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 634bbfe8a..4d1f78b8b 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -14,8 +14,7 @@ AutoConfigManager::~AutoConfigManager(void){} bool AutoConfigManager::IsConfigured(const std::string& key) { // iterate ancestor contexts, filling any configs - std::shared_ptr ctxt = GetContext(); - while (ctxt) { + for (auto ctxt = GetContext(); ctxt; ctxt = ctxt->GetParentContext()) { AutowiredFast mgmt(ctxt); if(mgmt) { @@ -24,8 +23,6 @@ bool AutoConfigManager::IsConfigured(const std::string& key) { return true; } } - - ctxt = ctxt->GetParentContext(); } // Key not found @@ -41,8 +38,7 @@ AnySharedPointer& AutoConfigManager::Get(const std::string& key) { } // iterate ancestor contexts, filling any configs - std::shared_ptr ctxt = GetContext()->GetParentContext(); - while (ctxt) { + for (auto ctxt = GetContext()->GetParentContext(); ctxt; ctxt = ctxt->GetParentContext()) { AutowiredFast mgmt(ctxt); if(mgmt) { @@ -51,13 +47,11 @@ AnySharedPointer& AutoConfigManager::Get(const std::string& key) { return mgmt->m_attributes[key]; } } - - ctxt = ctxt->GetParentContext(); } // Key not found, throw exception std::stringstream ss; - ss << "Attepted to get key '" << key <<"' which hasn't been set"; + ss << "Attepted to get key '" << key << "' which hasn't been set"; throw autowiring_error(ss.str()); } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 27e4eb9df..ec2f9ea92 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -100,16 +100,17 @@ TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { AutoRequired clz1; AutoRequired clz2; - ASSERT_EQ(324, clz1->m_myName); + ASSERT_EQ(324, *clz1->m_myName); ASSERT_EQ(1111, clz2->m_myName); } -TEST_F(AutoConfigTest, ChangeConfig) { - AutoRequired clz1; - - clz1->m_myName = 42; +TEST_F(AutoConfigTest, VerifySet) { + AutoRequired acm; + acm->Set("Namespace1.XYZ", 324); - Autowired acm; + AutoRequired clz1; + ASSERT_EQ(324, clz1->m_myName); - ASSERT_EQ(42, *acm->Get("Namespace1.XYZ").as()); + clz1->m_myName.Set(42); + ASSERT_EQ(42, clz1->m_myName); } From f557f31924c0864166953f6209be5cdc5099cb00 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 26 Nov 2014 17:28:46 -0800 Subject: [PATCH 037/140] Don't throw exception if SetParsed can't find key --- autowiring/AutoConfigManager.h | 5 ++++- autowiring/ConfigRegistry.h | 8 ++++++++ src/autowiring/AutoConfigManager.cpp | 10 ++++------ src/autowiring/test/AutoConfigTest.cpp | 6 +++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 26ceaaa83..3807b0b3e 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -83,5 +83,8 @@ class AutoConfigManager: /// /// This method will throw an exception if there is no string converter available on this type /// - void SetParsed(const std::string& key, const std::string& value); + /// + /// True if value successfully set, False if key not found. + /// + bool SetParsed(const std::string& key, const std::string& value); }; diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index e6ae121ce..91bbbfb3a 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -4,6 +4,8 @@ #include #include #include "AnySharedPointer.h" +#include "autowiring_error.h" +#include "demangle.h" struct ConfigRegistryEntry { ConfigRegistryEntry(const std::type_info& ti); @@ -37,6 +39,12 @@ struct ConfigRegistryEntryT: std::istringstream ss(str); T val; ss >> val; + if (ss.fail()) { + std::stringstream msg; + msg << "Failed to parse '" << str << "' as type '" + << autowiring::demangle(typeid(T)) << "'"; + throw autowiring_error(msg.str()); + } return AnySharedPointer(std::make_shared(val)); } }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 4d1f78b8b..ab5180f3f 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -59,18 +59,16 @@ void AutoConfigManager::Set(const std::string& key, const char* value) { Set(key, std::string(value)); } -void AutoConfigManager::SetParsed(const std::string& key, const std::string& value) { +bool AutoConfigManager::SetParsed(const std::string& key, const std::string& value) { std::lock_guard lk(m_lock); for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { if (config->is(key)){ m_attributes[key] = config->parse(value); - return; + return true; } } - // Error if key wasn't found in registry - std::stringstream ss; - ss << "Cant parse '" << value <<"' for key '" << key << "'"; - throw autowiring_error(ss.str()); + // Key not found + return false; } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index ec2f9ea92..2a3907313 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -89,13 +89,13 @@ TEST_F(AutoConfigTest, VerifyParsedAssignment) { ASSERT_ANY_THROW(acm->Set("Namespace1.XYZ", 3.0)) << "An attempt to assign a value to an unrelated type did not generate an exception as expected"; // Assignment to a string type should result in an appropriate coercion to the right value - acm->SetParsed("Namespace1.XYZ", "324"); + ASSERT_TRUE(acm->SetParsed("Namespace1.XYZ", "324")); } TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { AutoRequired acm; - acm->SetParsed("Namespace1.XYZ", "324"); - acm->SetParsed("Namespace2.XYZ", "1111"); + ASSERT_TRUE(acm->SetParsed("Namespace1.XYZ", "324")); + ASSERT_TRUE(acm->SetParsed("Namespace2.XYZ", "1111")); AutoRequired clz1; AutoRequired clz2; From 0f3aaa75a69d6b9cc7621b82d44a5743237da262 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 18:36:07 -0800 Subject: [PATCH 038/140] replaced ADD_MSVC_DISABLED_FILES --- CMakeLists.txt | 8 -------- src/autowiring/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1851fe216..608d42b07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,14 +100,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") include(AddPCH) include(ConditionalSources) -function(ADD_MSVC_DISABLED_FILES SourceGroupName SourcesVar ...) - if(WIN32) - set_source_files_properties( ${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE ) - source_group(${SourceGroupName} FILES ${ARGN}) - set(${SourcesVar} ${${SourcesVar}} ${ARGN} PARENT_SCOPE) - endif(WIN32) -endfunction(ADD_MSVC_DISABLED_FILES) - if(autowiring_BUILD_ARM) # Currently cannot build Autonet for ARM, so default this off on that platform diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index ccbfda3e2..561f47f7b 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -173,7 +173,7 @@ set(Autowiring_Linux_SRCS CoreThreadLinux.cpp ) -ADD_MSVC_DISABLED_FILES("Unix Source" Autowiring_SRCS ${Autowiring_Unix_SRCS}) +add_conditional_sources(Autowiring_SRCS "NOT WIN32" GROUP_NAME "Unix Source" ${Autowiring_Unix_SRCS}) if(WIN32) set(Autowiring_SRCS ${Autowiring_Win_SRCS} ${Autowiring_SRCS}) From cbe174596360b2d856875fe748d6936ead205241 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 19:14:11 -0800 Subject: [PATCH 039/140] Fixed extranious ... which was screwing up ARGV --- cmake-modules/ConditionalSources.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake-modules/ConditionalSources.cmake b/cmake-modules/ConditionalSources.cmake index fa3ec5b95..271b5f9f6 100644 --- a/cmake-modules/ConditionalSources.cmake +++ b/cmake-modules/ConditionalSources.cmake @@ -24,14 +24,14 @@ # the ${ARGV} from being parsed by cmake's macro preprocessor. include(VerboseMessage) -function(conditional_sources condition_var ...) include(CMakeParseArguments) cmake_parse_arguments(conditional_sources "" "GROUP_NAME" "FILES" ${ARGV}) +function(conditional_sources condition_var) source_group(${conditional_sources_GROUP_NAME} FILES ${conditional_sources_FILES}) if(NOT (${condition_var})) - set_source_files_properties( ${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + set_source_files_properties( ${conditional_sources_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) verbose_message("Setting INACTIVE source group \"${conditional_sources_GROUP_NAME}\" with files ${conditional_sources_FILES}") else() verbose_message("Setting source group \"${conditional_sources_GROUP_NAME}\" with files ${conditional_sources_FILES}") @@ -39,7 +39,7 @@ function(conditional_sources condition_var ...) endfunction() #as conditional_sources, but also appends the soruces to the source_list_var -function(add_conditional_sources source_list_var condition_var ...) +function(add_conditional_sources source_list_var condition_var) list(REMOVE_AT ARGV 0) conditional_sources(${ARGV}) From 40327c342a48204896c248e1ce429861daf5141e Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 19:14:44 -0800 Subject: [PATCH 040/140] Started using ARGV instead of ARGN when parsing source files --- cmake-modules/ConditionalSources.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake-modules/ConditionalSources.cmake b/cmake-modules/ConditionalSources.cmake index 271b5f9f6..7d0bd067a 100644 --- a/cmake-modules/ConditionalSources.cmake +++ b/cmake-modules/ConditionalSources.cmake @@ -25,7 +25,7 @@ include(VerboseMessage) include(CMakeParseArguments) - cmake_parse_arguments(conditional_sources "" "GROUP_NAME" "FILES" ${ARGV}) + cmake_parse_arguments(conditional_sources "" "GROUP_NAME" "FILES" ${ARGN}) function(conditional_sources condition_var) source_group(${conditional_sources_GROUP_NAME} FILES ${conditional_sources_FILES}) From 9e71a652d04c9d14e6d547c3285081bc01a188b4 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 19:15:59 -0800 Subject: [PATCH 041/140] added helper function to conditional sources for parsing the arguments, made FILES specifier optional. --- cmake-modules/ConditionalSources.cmake | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmake-modules/ConditionalSources.cmake b/cmake-modules/ConditionalSources.cmake index 7d0bd067a..b40e9c9f4 100644 --- a/cmake-modules/ConditionalSources.cmake +++ b/cmake-modules/ConditionalSources.cmake @@ -24,9 +24,17 @@ # the ${ARGV} from being parsed by cmake's macro preprocessor. include(VerboseMessage) +macro(_conditional_sources_parse_arguments) include(CMakeParseArguments) cmake_parse_arguments(conditional_sources "" "GROUP_NAME" "FILES" ${ARGN}) + + if(NOT DEFINED conditional_sources_FILES) + set(conditional_sources_FILES ${conditional_sources_UNPARSED_ARGUMENTS}) + endif() +endmacro() + function(conditional_sources condition_var) + _conditional_sources_parse_arguments(${ARGN}) source_group(${conditional_sources_GROUP_NAME} FILES ${conditional_sources_FILES}) @@ -43,9 +51,10 @@ function(add_conditional_sources source_list_var condition_var) list(REMOVE_AT ARGV 0) conditional_sources(${ARGV}) - include(CMakeParseArguments) - cmake_parse_arguments(add_conditional_sources "" "" "FILES" ${ARGV}) - set(${source_list_var} ${${source_list_var}} ${add_conditional_sources_FILES} PARENT_SCOPE) + _conditional_sources_parse_arguments(${ARGN}) + + set(${source_list_var} ${${source_list_var}} ${conditional_sources_FILES} PARENT_SCOPE) + verbose_message("Adding ${conditional_sources_FILES} to ${source_list_var}") endfunction() #defines 'func_name' and add_'func_name' shorthands for add_conditional_sources with pre-set conditions. From 1fb1e055c6c89c281c50758f443678413f8774fc Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 19:36:48 -0800 Subject: [PATCH 042/140] Fixed handling of multi-part conditional variables --- cmake-modules/ConditionalSources.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake-modules/ConditionalSources.cmake b/cmake-modules/ConditionalSources.cmake index b40e9c9f4..7766c0249 100644 --- a/cmake-modules/ConditionalSources.cmake +++ b/cmake-modules/ConditionalSources.cmake @@ -38,6 +38,8 @@ function(conditional_sources condition_var) source_group(${conditional_sources_GROUP_NAME} FILES ${conditional_sources_FILES}) + separate_arguments(condition_var) + verbose_message("Evaluating conditional as: ${condition_var}") if(NOT (${condition_var})) set_source_files_properties( ${conditional_sources_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) verbose_message("Setting INACTIVE source group \"${conditional_sources_GROUP_NAME}\" with files ${conditional_sources_FILES}") From da9b829f1696c8861c27d284648781df0bae80af Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Mon, 24 Nov 2014 19:43:20 -0800 Subject: [PATCH 043/140] added some usage of the conditional_sources functions, cleaned up existing one --- src/autowiring/CMakeLists.txt | 40 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 561f47f7b..2069d5360 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -154,44 +154,40 @@ if(NOT APPLE) ) endif() -set(Autowiring_Win_SRCS +add_windows_sources(Autowiring_SRCS CoreThreadWin.cpp InterlockedExchangeWin.cpp thread_specific_ptr_win.h ) -set(Autowiring_Unix_SRCS - InterlockedExchangeUnix.cpp - thread_specific_ptr_unix.h +add_mac_sources(Autowiring_SRCS + CoreThreadMac.cpp ) -set(Autowiring_Mac_SRCS - CoreThreadMac.cpp +add_unix_sources( Autowiring_SRCS + InterlockedExchangeUnix.cpp + thread_specific_ptr_unix.h ) set(Autowiring_Linux_SRCS CoreThreadLinux.cpp ) -add_conditional_sources(Autowiring_SRCS "NOT WIN32" GROUP_NAME "Unix Source" ${Autowiring_Unix_SRCS}) - -if(WIN32) - set(Autowiring_SRCS ${Autowiring_Win_SRCS} ${Autowiring_SRCS}) +add_conditional_sources( Autowiring_SRCS "NOT MSVC" GROUP_NAME "Non-Windows Source" FILES ${Autowiring_Unix_SRCS}) - if(!BUILD_64_BIT) - enable_language(ASM_MASM) - set(Autowiring_SRCS interlocked.asm ${Autowiring_SRCS} ) - endif() -else() - if(APPLE) - set(Autowiring_SRCS ${Autowiring_Mac_SRCS} ${Autowiring_SRCS}) - else() - set(Autowiring_SRCS ${Autowiring_Linux_SRCS} ${Autowiring_SRCS}) - endif() - - set(Autowiring_SRCS ${Autowiring_Unix_SRCS} ${Autowiring_SRCS}) +add_conditional_sources(Autowiring_SRCS "WIN32 AND NOT BUILD_64_BIT" + GROUP_NAME "ASMx86 Source" + FILES interlocked.asm +) +if(WIN32 AND NOT BUILD_64_BIT) + enable_language(ASM_MASM) endif() +add_conditional_sources(Autowiring_SRCS "NOT WIN32 AND NOT APPLE" + GROUP_NAME "Linux Source" + FILES CoreThreadLinux.cpp +) + rewrite_header_paths(Autowiring_SRCS) add_pch(Autowiring_SRCS "stdafx.h" "stdafx.cpp") From d914a5bdce713f53f945bdc3a8f7243f2a5a764a Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Mon, 1 Dec 2014 15:49:03 -0800 Subject: [PATCH 044/140] Fix regex for linux linux doesn't like '\w' in regexes --- src/autowiring/AutoConfigParser.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/autowiring/AutoConfigParser.hpp b/src/autowiring/AutoConfigParser.hpp index d1d15fc74..0ff711d08 100644 --- a/src/autowiring/AutoConfigParser.hpp +++ b/src/autowiring/AutoConfigParser.hpp @@ -5,6 +5,11 @@ #include #include +// Explicit implementation of '\\w', which isn't supported in GCC 4.8 +#define REGEX_WORD "((?:a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|"\ + "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|"\ + "0|1|2|3|4|5|6|7|8|9|_)*)" + namespace autowiring { static std::string FormatKey(const std::smatch& match) { @@ -23,9 +28,9 @@ static std::string FormatKey(const std::smatch& match) { } static std::string ExtractKey(const std::type_info& ti) { - // Regex pattern + // Regex pattern for extracting template argument names static const std::regex NamePattern( - "^.*ConfigTypeExtractor<(?:class |struct )?(\\w*)(?:, (?:class |struct )?(\\w*))?>$" + "^.*ConfigTypeExtractor<(?:class |struct )?" REGEX_WORD "(?:, (?:class |struct )?" REGEX_WORD ")?>$" ); std::smatch sm; From c49154b04cfdc817d324904f562aafe4c8ccb333 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 2 Dec 2014 15:56:28 -0800 Subject: [PATCH 045/140] Change regex to manual string search --- src/autowiring/AutoConfigParser.hpp | 92 ++++++++++++++----- src/autowiring/CMakeLists.txt | 2 +- .../expect.h => src/autowiring/expect.hpp | 0 3 files changed, 68 insertions(+), 26 deletions(-) rename autowiring/expect.h => src/autowiring/expect.hpp (100%) diff --git a/src/autowiring/AutoConfigParser.hpp b/src/autowiring/AutoConfigParser.hpp index 0ff711d08..e0af25063 100644 --- a/src/autowiring/AutoConfigParser.hpp +++ b/src/autowiring/AutoConfigParser.hpp @@ -1,42 +1,84 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once #include "demangle.h" -#include +#include "expect.hpp" #include #include - -// Explicit implementation of '\\w', which isn't supported in GCC 4.8 -#define REGEX_WORD "((?:a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|"\ - "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|"\ - "0|1|2|3|4|5|6|7|8|9|_)*)" +#include namespace autowiring { -static std::string FormatKey(const std::smatch& match) { - // Indicies into the regex match - static const int NAMESPACE_INDEX = 1; - static const int FIELD_INDEX = 2; - - // If no namespace, then field will be empty - if (match.str(FIELD_INDEX).empty()) { - return match.str(NAMESPACE_INDEX); - } - std::stringstream ss; - ss << match.str(NAMESPACE_INDEX) << "." << match.str(FIELD_INDEX); - return ss.str(); +#if __GNUG__// Mac and linux + +static std::string ExtractKey(const std::type_info& ti) { + //Extract Namespace and value from typename + //AutoConfigBase::ConfigTypeExtractor + + std::stringstream ss(demangle(ti)); + + std::string arg1; + std::string arg2; + ss >> expect("AutoConfigBase::ConfigTypeExtractor<"); + ss >> arg1; + + // If arg1 contains a comma, there are 2 arguments + auto found = arg1.find(","); + if (found != std::string::npos) { + ss >> arg2; + + // Remove trailing "," + arg1.pop_back(); + + // Remove trailing '>' + arg2.pop_back(); + + std::stringstream key; + key << arg1 << "." << arg2; + return key.str(); + + } else { + // Remove trailing '>' + arg1.pop_back(); + return arg1; + } } + +#else // Windows static std::string ExtractKey(const std::type_info& ti) { - // Regex pattern for extracting template argument names - static const std::regex NamePattern( - "^.*ConfigTypeExtractor<(?:class |struct )?" REGEX_WORD "(?:, (?:class |struct )?" REGEX_WORD ")?>$" - ); + //Extract Namespace and value from typename + //struct AutoConfigBase::ConfigTypeExtractor - std::smatch sm; - std::regex_match(demangle(ti), sm, NamePattern); + std::stringstream ss(demangle(ti)); - return FormatKey(sm); + std::string arg1; + std::string arg2; + ss >> expect("struct AutoConfigBase::ConfigTypeExtractor> arg1; + + // If arg1 contains a comma, there are 2 arguments + auto found = arg1.find(",struct"); + if (found != std::string::npos) { + ss >> arg2; + + // Remove trailing ",struct" + arg1 = arg1.substr(0, found) + + // Remove trailing '>' + arg2.pop_back(); + + std::stringstream key; + key << arg1 << "." << arg2; + return key.str(); + + } else { + // Remove trailing '>' + arg1.pop_back(); + return arg1; + } } + +#endif }//namespace autowiring diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 2c5c99224..ab0310ec3 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -93,7 +93,7 @@ set(Autowiring_SRCS DispatchQueue.h DispatchQueue.cpp DispatchThunk.h - expect.h + expect.hpp EventInputStream.h EventOutputStream.h EventOutputStream.cpp diff --git a/autowiring/expect.h b/src/autowiring/expect.hpp similarity index 100% rename from autowiring/expect.h rename to src/autowiring/expect.hpp From b2fecf59f217e5b3cc42a05a101fad6f19685a31 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 2 Dec 2014 16:14:38 -0800 Subject: [PATCH 046/140] Bump to version 0.2.12 --- version.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.cmake b/version.cmake index 7441c183b..856b29b82 100644 --- a/version.cmake +++ b/version.cmake @@ -1 +1 @@ -set(autowiring_VERSION 0.2.11) +set(autowiring_VERSION 0.2.12) From dbdf1b4b1b9d7de11057ee4cd46b4fbf0292be72 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Tue, 2 Dec 2014 16:32:45 -0800 Subject: [PATCH 047/140] Unit tests for AutoFilter collapse moved to their own source file --- .../test/AutoFilterCollapseRulesTest.cpp | 114 ++++++++++++++++++ src/autowiring/test/AutoFilterTest.cpp | 89 -------------- src/autowiring/test/CMakeLists.txt | 1 + 3 files changed, 115 insertions(+), 89 deletions(-) create mode 100644 src/autowiring/test/AutoFilterCollapseRulesTest.cpp diff --git a/src/autowiring/test/AutoFilterCollapseRulesTest.cpp b/src/autowiring/test/AutoFilterCollapseRulesTest.cpp new file mode 100644 index 000000000..3774f7b0c --- /dev/null +++ b/src/autowiring/test/AutoFilterCollapseRulesTest.cpp @@ -0,0 +1,114 @@ +#include "stdafx.h" +#include "TestFixtures/Decoration.hpp" + +class AutoFilterCollapseRulesTest: + public testing::Test +{ +public: + AutoFilterCollapseRulesTest(void) { + // All decorator tests must run from an initiated context + AutoCurrentContext()->Initiate(); + } +}; + +class AcceptsConstReference { +public: + AcceptsConstReference(void) : + m_called(0) + {} + + int m_called; + + void AutoFilter(const int& dataIn) { + ++m_called; + } +}; + +class AcceptsSharedPointer { +public: + AcceptsSharedPointer(void) : + m_called(0) + {} + + int m_called; + + void AutoFilter(std::shared_ptr dataIn) { + ++m_called; + } +}; + +class ProducesSharedPointer { +public: + ProducesSharedPointer(void) : + m_called(0) + {} + + int m_called; + + void AutoFilter(std::shared_ptr dataIn) { + ++m_called; + } +}; + +TEST_F(AutoFilterCollapseRulesTest, SharedPtrCollapse) { + AutoRequired factory; + AutoRequired constr_filter; + AutoRequired shared_filter; + + int constr_int = 0; + std::shared_ptr shared_int = std::make_shared(0); + ASSERT_TRUE(static_cast(shared_int)); + + // Decorate(type X) calls AutoFilter(const type& X) + // Decorate(type X) calls AutoFilter(shared_ptr X) + { + auto packet = factory->NewPacket(); + packet->Decorate(constr_int); + ASSERT_EQ(1, constr_filter->m_called) << "Called const reference method " << constr_filter->m_called << " times"; + ASSERT_EQ(1, shared_filter->m_called) << "Called shared pointer method " << shared_filter->m_called << " times"; + } + constr_filter->m_called = 0; + shared_filter->m_called = 0; + + // Decorate(shared_ptr X) calls AutoFilter(const type& X) + // Decorate(shared_ptr X) calls AutoFilter(shared_ptr X) + // NOTE: Decorate(shared_ptr X) shares ownership of X instead of copying. + { + auto packet = factory->NewPacket(); + packet->Decorate(shared_int); + ASSERT_EQ(1, constr_filter->m_called) << "Called const reference method " << constr_filter->m_called << " times"; + ASSERT_EQ(1, shared_filter->m_called) << "Called shared pointer method " << shared_filter->m_called << " times"; + ASSERT_FALSE(shared_int.unique()) << "Argument of Decorate should be shared, not copied, when possible"; + } + constr_filter->m_called = 0; + shared_filter->m_called = 0; + + // DecorateImmediate(type X) calls AutoFilter(const type& X) + // DecorateImmediate(type X) DOES NOT CALL AutoFilter(shared_ptr X) + // NOTE: This case is invalid, since DecorateImmediate assumes no validity of X after the function call, + // so the construction of a shared_ptr from &X would violate the contract of shared_ptr type. + // If an AutoFilter method assumed the validity of shared_ptr Y, a copy could be made that might + // become invalid. + // NOTE: DecorateImmediate(shared_ptr X) is unnecessary (a static_assert will be called). + // Decorate(shared_ptr X) will share the reference to X instead of making a copy. + { + auto packet = factory->NewPacket(); + packet->DecorateImmediate(constr_int); + ASSERT_EQ(1, constr_filter->m_called) << "Called const reference method " << constr_filter->m_called << " times"; + ASSERT_EQ(0, shared_filter->m_called) << "Called shared pointer method " << shared_filter->m_called << " times"; + } + constr_filter->m_called = 0; + shared_filter->m_called = 0; +} + +TEST_F(AutoFilterCollapseRulesTest, SharedPointerAliasingRules) { + AutoRequired factory; + AutoRequired>> genFilter1; + AutoRequired> genFilter2; + + auto packet = factory->NewPacket(); + packet->Decorate(55); + + ASSERT_EQ(1UL, genFilter1->m_called) << "AutoFilter accepting a shared pointer was not called as expected"; + ASSERT_EQ(1UL, genFilter2->m_called) << "AutoFilter accepting a decorated type was not called as expected"; +} diff --git a/src/autowiring/test/AutoFilterTest.cpp b/src/autowiring/test/AutoFilterTest.cpp index cf2f291e3..29cd390b2 100644 --- a/src/autowiring/test/AutoFilterTest.cpp +++ b/src/autowiring/test/AutoFilterTest.cpp @@ -966,95 +966,6 @@ TEST_F(AutoFilterTest, NoDeferredImmediateSatisfaction) { ASSERT_EQ(0UL, wfil->GetDispatchQueueLength()) << "Deferred AutoFilter incorrectly received an immediate-mode decoration"; } -class AcceptsConstReference { -public: - AcceptsConstReference(void) : - m_called(0) - {} - - int m_called; - - void AutoFilter(const int& dataIn) { - ++m_called; - } -}; - -class AcceptsSharedPointer { -public: - AcceptsSharedPointer(void) : - m_called(0) - {} - - int m_called; - - void AutoFilter(std::shared_ptr dataIn) { - ++m_called; - } -}; - -TEST_F(AutoFilterTest, SharedPtrCollapse) { - AutoRequired factory; - AutoRequired constr_filter; - AutoRequired shared_filter; - - int constr_int = 0; - std::shared_ptr shared_int = std::make_shared(0); - ASSERT_TRUE(static_cast(shared_int)); - - // Decorate(type X) calls AutoFilter(const type& X) - // Decorate(type X) calls AutoFilter(shared_ptr X) - { - auto packet = factory->NewPacket(); - packet->Decorate(constr_int); - ASSERT_EQ(1, constr_filter->m_called) << "Called const reference method " << constr_filter->m_called << " times"; - ASSERT_EQ(1, shared_filter->m_called) << "Called shared pointer method " << shared_filter->m_called << " times"; - } - constr_filter->m_called = 0; - shared_filter->m_called = 0; - - // Decorate(shared_ptr X) calls AutoFilter(const type& X) - // Decorate(shared_ptr X) calls AutoFilter(shared_ptr X) - // NOTE: Decorate(shared_ptr X) shares ownership of X instead of copying. - { - auto packet = factory->NewPacket(); - packet->Decorate(shared_int); - ASSERT_EQ(1, constr_filter->m_called) << "Called const reference method " << constr_filter->m_called << " times"; - ASSERT_EQ(1, shared_filter->m_called) << "Called shared pointer method " << shared_filter->m_called << " times"; - ASSERT_FALSE(shared_int.unique()) << "Argument of Decorate should be shared, not copied, when possible"; - } - constr_filter->m_called = 0; - shared_filter->m_called = 0; - - // DecorateImmediate(type X) calls AutoFilter(const type& X) - // DecorateImmediate(type X) DOES NOT CALL AutoFilter(shared_ptr X) - // NOTE: This case is invalid, since DecorateImmediate assumes no validity of X after the function call, - // so the construction of a shared_ptr from &X would violate the contract of shared_ptr type. - // If an AutoFilter method assumed the validity of shared_ptr Y, a copy could be made that might - // become invalid. - // NOTE: DecorateImmediate(shared_ptr X) is unnecessary (a static_assert will be called). - // Decorate(shared_ptr X) will share the reference to X instead of making a copy. - { - auto packet = factory->NewPacket(); - packet->DecorateImmediate(constr_int); - ASSERT_EQ(1, constr_filter->m_called) << "Called const reference method " << constr_filter->m_called << " times"; - ASSERT_EQ(0, shared_filter->m_called) << "Called shared pointer method " << shared_filter->m_called << " times"; - } - constr_filter->m_called = 0; - shared_filter->m_called = 0; -} - -TEST_F(AutoFilterTest, SharedPointerAliasingRules) { - AutoRequired factory; - AutoRequired>> genFilter1; - AutoRequired> genFilter2; - - auto packet = factory->NewPacket(); - packet->Decorate(55); - - ASSERT_EQ(1UL, genFilter1->m_called) << "AutoFilter accepting a shared pointer was not called as expected"; - ASSERT_EQ(1UL, genFilter2->m_called) << "AutoFilter accepting a decorated type was not called as expected"; -} - TEST_F(AutoFilterTest, AutoSelfUpdateTest) { AutoRequired factory; AutoRequired>> filter; diff --git a/src/autowiring/test/CMakeLists.txt b/src/autowiring/test/CMakeLists.txt index 86d78610c..2858a7f6a 100644 --- a/src/autowiring/test/CMakeLists.txt +++ b/src/autowiring/test/CMakeLists.txt @@ -2,6 +2,7 @@ set(AutowiringTest_SRCS AnySharedPointerTest.cpp ArgumentTypeTest.cpp AutoConstructTest.cpp + AutoFilterCollapseRulesTest.cpp AutoInjectableTest.cpp AutoPacketFactoryTest.cpp AutoRestarterTest.cpp From 4cba02793f02d1024f922d432564da1c87cdd08e Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 2 Dec 2014 16:36:28 -0800 Subject: [PATCH 048/140] Add copyright header --- src/autowiring/test/AutoFilterCollapseRulesTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/autowiring/test/AutoFilterCollapseRulesTest.cpp b/src/autowiring/test/AutoFilterCollapseRulesTest.cpp index 3774f7b0c..1b060f048 100644 --- a/src/autowiring/test/AutoFilterCollapseRulesTest.cpp +++ b/src/autowiring/test/AutoFilterCollapseRulesTest.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "TestFixtures/Decoration.hpp" From 57e17025b7c33000a03923fb007368ae3686fc94 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Tue, 2 Dec 2014 16:54:20 -0800 Subject: [PATCH 049/140] Missing semicolon --- src/autowiring/AutoConfigParser.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autowiring/AutoConfigParser.hpp b/src/autowiring/AutoConfigParser.hpp index e0af25063..1a769b9bf 100644 --- a/src/autowiring/AutoConfigParser.hpp +++ b/src/autowiring/AutoConfigParser.hpp @@ -63,7 +63,7 @@ static std::string ExtractKey(const std::type_info& ti) { ss >> arg2; // Remove trailing ",struct" - arg1 = arg1.substr(0, found) + arg1 = arg1.substr(0, found); // Remove trailing '>' arg2.pop_back(); From 1ca23eecb70a698ffa7d94eb52abcea5d33359a6 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Tue, 2 Dec 2014 17:04:42 -0800 Subject: [PATCH 050/140] Adding a platform-independent unit test to validate the Windows key extraction implementation --- src/autowiring/AutoConfigParser.hpp | 25 +++++++++++++------------ src/autowiring/test/AutoConfigTest.cpp | 8 ++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/autowiring/AutoConfigParser.hpp b/src/autowiring/AutoConfigParser.hpp index 1a769b9bf..40b8ba78d 100644 --- a/src/autowiring/AutoConfigParser.hpp +++ b/src/autowiring/AutoConfigParser.hpp @@ -8,15 +8,10 @@ namespace autowiring { - -#if __GNUG__// Mac and linux - -static std::string ExtractKey(const std::type_info& ti) { +static std::string ExtractKeyUnix(std::stringstream& ss) { //Extract Namespace and value from typename //AutoConfigBase::ConfigTypeExtractor - std::stringstream ss(demangle(ti)); - std::string arg1; std::string arg2; ss >> expect("AutoConfigBase::ConfigTypeExtractor<"); @@ -43,15 +38,11 @@ static std::string ExtractKey(const std::type_info& ti) { return arg1; } } - -#else // Windows -static std::string ExtractKey(const std::type_info& ti) { +static std::string ExtractKeyWin(std::stringstream& ss) { //Extract Namespace and value from typename //struct AutoConfigBase::ConfigTypeExtractor - std::stringstream ss(demangle(ti)); - std::string arg1; std::string arg2; ss >> expect("struct AutoConfigBase::ConfigTypeExtractor #include +#include class AutoConfigTest: public testing::Test @@ -114,3 +115,10 @@ TEST_F(AutoConfigTest, VerifySet) { clz1->m_myName.Set(42); ASSERT_EQ(42, clz1->m_myName); } + +TEST_F(AutoConfigTest, ExtractKeyTestWin) { + ASSERT_STREQ( + "Namespace1.XYZ", + autowiring::ExtractKeyWin(std::stringstream("struct AutoConfigBase::ConfigTypeExtractor")).c_str() + ) << "Windows key extraction implementation mismatch"; +} \ No newline at end of file From 3232e32bab7dec62ec435cac044de49ffafc66d9 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 2 Dec 2014 17:27:13 -0800 Subject: [PATCH 051/140] Move AutoConfigParser logic to its own file --- src/autowiring/AutoConfigParser.cpp | 82 +++++++++++++++++++++++++ src/autowiring/AutoConfigParser.hpp | 83 ++------------------------ src/autowiring/CMakeLists.txt | 1 + src/autowiring/test/AutoConfigTest.cpp | 4 +- 4 files changed, 90 insertions(+), 80 deletions(-) create mode 100644 src/autowiring/AutoConfigParser.cpp diff --git a/src/autowiring/AutoConfigParser.cpp b/src/autowiring/AutoConfigParser.cpp new file mode 100644 index 000000000..4d6d5a542 --- /dev/null +++ b/src/autowiring/AutoConfigParser.cpp @@ -0,0 +1,82 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include "AutoConfigParser.hpp" +#include "demangle.h" +#include "expect.hpp" +#include +#include + + +std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { + //Extract Namespace and value from typename + //AutoConfigBase::ConfigTypeExtractor + + std::string arg1; + std::string arg2; + ss >> autowiring::expect("AutoConfigBase::ConfigTypeExtractor<"); + ss >> arg1; + + // If arg1 contains a comma, there are 2 arguments + auto found = arg1.find(","); + if (found != std::string::npos) { + ss >> arg2; + + // Remove trailing "," + arg1.pop_back(); + + // Remove trailing '>' + arg2.pop_back(); + + std::stringstream key; + key << arg1 << "." << arg2; + return key.str(); + + } else { + // Remove trailing '>' + arg1.pop_back(); + return arg1; + } +} + +std::string autowiring::ExtractKeyWin(std::stringstream& ss) { + //Extract Namespace and value from typename + //struct AutoConfigBase::ConfigTypeExtractor + + std::string arg1; + std::string arg2; + ss >> expect("struct AutoConfigBase::ConfigTypeExtractor> arg1; + + // If arg1 contains a comma, there are 2 arguments + auto found = arg1.find(",struct"); + if (found != std::string::npos) { + ss >> arg2; + + // Remove trailing ",struct" + arg1 = arg1.substr(0, found); + + // Remove trailing '>' + arg2.pop_back(); + + std::stringstream key; + key << arg1 << "." << arg2; + return key.str(); + + } else { + // Remove trailing '>' + arg1.pop_back(); + return arg1; + } +} + +std::string autowiring::ExtractKey(const std::type_info& ti) { + std::string demangled = autowiring::demangle(ti); + std::stringstream ss(demangled); + + return +#if __GNUG__// Mac and linux + ExtractKeyUnix(ss); +#else // Windows + ExtractKeyWin(ss); +#endif +} diff --git a/src/autowiring/AutoConfigParser.hpp b/src/autowiring/AutoConfigParser.hpp index 40b8ba78d..3eea60107 100644 --- a/src/autowiring/AutoConfigParser.hpp +++ b/src/autowiring/AutoConfigParser.hpp @@ -1,85 +1,10 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once -#include "demangle.h" -#include "expect.hpp" #include -#include -#include +#include TYPE_INDEX_HEADER namespace autowiring { - -static std::string ExtractKeyUnix(std::stringstream& ss) { - //Extract Namespace and value from typename - //AutoConfigBase::ConfigTypeExtractor - - std::string arg1; - std::string arg2; - ss >> expect("AutoConfigBase::ConfigTypeExtractor<"); - ss >> arg1; - - // If arg1 contains a comma, there are 2 arguments - auto found = arg1.find(","); - if (found != std::string::npos) { - ss >> arg2; - - // Remove trailing "," - arg1.pop_back(); - - // Remove trailing '>' - arg2.pop_back(); - - std::stringstream key; - key << arg1 << "." << arg2; - return key.str(); - - } else { - // Remove trailing '>' - arg1.pop_back(); - return arg1; - } -} - -static std::string ExtractKeyWin(std::stringstream& ss) { - //Extract Namespace and value from typename - //struct AutoConfigBase::ConfigTypeExtractor - - std::string arg1; - std::string arg2; - ss >> expect("struct AutoConfigBase::ConfigTypeExtractor> arg1; - - // If arg1 contains a comma, there are 2 arguments - auto found = arg1.find(",struct"); - if (found != std::string::npos) { - ss >> arg2; - - // Remove trailing ",struct" - arg1 = arg1.substr(0, found); - - // Remove trailing '>' - arg2.pop_back(); - - std::stringstream key; - key << arg1 << "." << arg2; - return key.str(); - - } else { - // Remove trailing '>' - arg1.pop_back(); - return arg1; - } + std::string ExtractKeyUnix(std::stringstream& ss); + std::string ExtractKeyWin(std::stringstream& ss); + std::string ExtractKey(const std::type_info& ti); } - -static std::string ExtractKey(const std::type_info& ti) { - std::string demangled = demangle(ti); - std::stringstream ss(demangled); - - return -#if __GNUG__// Mac and linux - ExtractKeyUnix(ss); -#else // Windows - ExtractKeyWin(ss); -#endif -} - -}//namespace autowiring diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index ab0310ec3..bfae8e3c6 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -23,6 +23,7 @@ set(Autowiring_SRCS AutoConfigManager.h AutoConfigManager.cpp AutoConfigParser.hpp + AutoConfigParser.cpp AutoRestarter.h AutoFuture.h AutoFuture.cpp diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 15c0aa434..adae8ca80 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -117,8 +117,10 @@ TEST_F(AutoConfigTest, VerifySet) { } TEST_F(AutoConfigTest, ExtractKeyTestWin) { + std::stringstream win("struct AutoConfigBase::ConfigTypeExtractor"); + ASSERT_STREQ( "Namespace1.XYZ", - autowiring::ExtractKeyWin(std::stringstream("struct AutoConfigBase::ConfigTypeExtractor")).c_str() + autowiring::ExtractKeyWin(win).c_str() ) << "Windows key extraction implementation mismatch"; } \ No newline at end of file From b5ac78ba9783697e950dcf18313073bce0b1ea25 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 2 Dec 2014 17:30:39 -0800 Subject: [PATCH 052/140] Fix windows parser --- src/autowiring/AutoConfigParser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autowiring/AutoConfigParser.cpp b/src/autowiring/AutoConfigParser.cpp index 4d6d5a542..4c73921b8 100644 --- a/src/autowiring/AutoConfigParser.cpp +++ b/src/autowiring/AutoConfigParser.cpp @@ -13,7 +13,7 @@ std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { std::string arg1; std::string arg2; - ss >> autowiring::expect("AutoConfigBase::ConfigTypeExtractor<"); + ss >> expect("AutoConfigBase::ConfigTypeExtractor<"); ss >> arg1; // If arg1 contains a comma, there are 2 arguments @@ -44,7 +44,7 @@ std::string autowiring::ExtractKeyWin(std::stringstream& ss) { std::string arg1; std::string arg2; - ss >> expect("struct AutoConfigBase::ConfigTypeExtractor> expect("struct") >> expect("AutoConfigBase::ConfigTypeExtractor> arg1; // If arg1 contains a comma, there are 2 arguments @@ -70,7 +70,7 @@ std::string autowiring::ExtractKeyWin(std::stringstream& ss) { } std::string autowiring::ExtractKey(const std::type_info& ti) { - std::string demangled = autowiring::demangle(ti); + std::string demangled = demangle(ti); std::stringstream ss(demangled); return From 1d6d5e2ab9c08b53ee898c0d91520a58cdfd5bac Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 2 Dec 2014 17:51:13 -0800 Subject: [PATCH 053/140] Create internal map of Config registry --- autowiring/AutoConfigManager.h | 23 ++++++++--------------- src/autowiring/AutoConfigManager.cpp | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 3807b0b3e..9d1d3e129 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -20,6 +20,7 @@ class AutoConfigManager: private: std::mutex m_lock; std::unordered_map m_attributes; + const std::unordered_map m_registry; public: /// @@ -47,24 +48,16 @@ class AutoConfigManager: void Set(const std::string& key, const T& value) { std::lock_guard lk(m_lock); - // Iterate through all registered configs to verify the key and type match. - bool configFound = false; - for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { - if (config->is(key)){ - if (!config->verifyType(typeid(T))) { - std::stringstream ss; - ss << "Attempting to set config '" << key << "' with incorrect type '" - << autowiring::demangle(typeid(T)) << "'"; - throw autowiring_error(ss.str()); - } - configFound = true; - break; - } + if (!m_registry.count(key)) { + std::stringstream ss; + ss << "No configuration found for key '" << key << "'"; + throw autowiring_error(ss.str()); } - if (!configFound) { + if (!m_registry.at(key)->verifyType(typeid(T))) { std::stringstream ss; - ss << "No configuration found for key '" << key << "'"; + ss << "Attempting to set config '" << key << "' with incorrect type '" + << autowiring::demangle(typeid(T)) << "'"; throw autowiring_error(ss.str()); } diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index ab5180f3f..89e0e81a6 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -9,7 +9,20 @@ using namespace autowiring; -AutoConfigManager::AutoConfigManager(void){} +static std::unordered_map FillRegistry(void) { + std::unordered_map registry; + + for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { + registry[config->m_key] = config; + } + + return registry; +} + +AutoConfigManager::AutoConfigManager(void): + m_registry(FillRegistry()) +{} + AutoConfigManager::~AutoConfigManager(void){} bool AutoConfigManager::IsConfigured(const std::string& key) { From e2e219e73be270f4e64646a1671dd58a0eb64b3e Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 2 Dec 2014 18:30:04 -0800 Subject: [PATCH 054/140] Make SetParsed work correctly with bools --- autowiring/ConfigRegistry.h | 3 ++- src/autowiring/test/AutoConfigTest.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 91bbbfb3a..050c67b4a 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -38,7 +38,8 @@ struct ConfigRegistryEntryT: AnySharedPointer parse(const std::string& str) const { std::istringstream ss(str); T val; - ss >> val; + ss >> std::boolalpha >> val; + if (ss.fail()) { std::stringstream msg; msg << "Failed to parse '" << str << "' as type '" diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index adae8ca80..cdf556436 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -33,6 +33,21 @@ TEST_F(AutoConfigTest, VerifySimpleAssignment) { ASSERT_EQ(323, mcc->m_myName) << "Configurable type did not receive a value as expected"; } +struct MyBoolClass { + AutoConfig m_bool; +}; + +TEST_F(AutoConfigTest, VerifyBool) { + AutoRequired acm; + AutoRequired clz1; + + acm->Set("bool_space.my_bool", true); + ASSERT_TRUE(clz1->m_bool); + + acm->SetParsed("bool_space.my_bool", "false"); + ASSERT_FALSE(clz1->m_bool); +} + TEST_F(AutoConfigTest, VerifyPostHocAssignment) { // Inject the configurable type first AutoRequired mcc; From b6e561edeb0113c850db359a8e577c98c1e1dac0 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 3 Dec 2014 07:51:33 -0800 Subject: [PATCH 055/140] Ignore list updated --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f02396562..0dd1d95b7 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ lib/*.* autowiring-*-*.zip _CPack_Packages win64/Autowiring.nuspec +Autowiring.nuspec From f70c210d9073da660cfeb5fdb67c8a0b1a13d7bf Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 3 Dec 2014 07:24:31 -0800 Subject: [PATCH 056/140] Deprecation of Stile and Pipe in preparation for a concept redux Will be rolling Stile and Pipe into a new concept of generalized AutoPacket fan in/fan out. This new concept will be optimized for speed and ease of use, but as long as Stile and Pipe exist, there is a significant amount of overlap and occlusion. Thus, these features are being deprecated ahead of the new functionality. --- autowiring/AutoCheckout.h | 11 +- autowiring/AutoFilterDescriptor.h | 61 +-- autowiring/AutoMerge.h | 100 ----- autowiring/AutoPacket.h | 242 +++------- autowiring/AutoPacketFactory.h | 87 ---- autowiring/AutoStile.h | 127 ------ autowiring/CallExtractor.h | 21 +- autowiring/DataFlow.h | 42 -- autowiring/SatCounter.h | 68 +-- autowiring/auto_arg.h | 36 +- autowiring/auto_in.h | 4 +- autowiring/auto_out.h | 17 +- autowiring/optional_ptr.h | 4 +- src/autowiring/AutoPacket.cpp | 318 ++++---------- src/autowiring/AutoPacketFactory.cpp | 211 --------- src/autowiring/CMakeLists.txt | 3 - src/autowiring/test/ArgumentTypeTest.cpp | 6 +- src/autowiring/test/AutoFilterPipeTest.cpp | 436 ------------------- src/autowiring/test/AutoFilterSequencing.cpp | 2 - src/autowiring/test/AutoFilterTest.cpp | 2 - src/autowiring/test/CMakeLists.txt | 1 - src/autowiring/test/DecoratorTest.cpp | 1 - 22 files changed, 202 insertions(+), 1598 deletions(-) delete mode 100644 autowiring/AutoMerge.h delete mode 100644 autowiring/AutoStile.h delete mode 100644 autowiring/DataFlow.h delete mode 100644 src/autowiring/test/AutoFilterPipeTest.cpp diff --git a/autowiring/AutoCheckout.h b/autowiring/AutoCheckout.h index 1dd136a29..e3c4a7896 100644 --- a/autowiring/AutoCheckout.h +++ b/autowiring/AutoCheckout.h @@ -8,21 +8,19 @@ class AutoPacket; template class AutoCheckout { public: - typedef void (AutoPacket::*t_completion)(bool, const std::type_info&, const std::type_info&); + typedef void (AutoPacket::*t_completion)(bool, const std::type_info&); AutoCheckout(void) : m_parent(nullptr), m_val(nullptr), m_ready(false), - m_source(&typeid(void)), completion(nullptr) {} - AutoCheckout(AutoPacket& parent, const std::shared_ptr& val, t_completion completion, const std::type_info& source = typeid(void)) : + AutoCheckout(AutoPacket& parent, const std::shared_ptr& val, t_completion completion) : m_parent(&parent), m_val(val), m_ready(false), - m_source(&source), completion(completion) {} @@ -30,7 +28,6 @@ class AutoCheckout { m_parent(rhs.m_parent), m_val(rhs.m_val), m_ready(rhs.m_ready), - m_source(rhs.m_source), completion(rhs.completion) { rhs.m_parent = nullptr; @@ -40,7 +37,7 @@ class AutoCheckout { ~AutoCheckout(void) { if(m_val) - (m_parent->*completion)(m_ready, typeid(T), *m_source); + (m_parent->*completion)(m_ready, typeid(T)); } private: @@ -50,7 +47,6 @@ class AutoCheckout { AutoPacket* m_parent; std::shared_ptr m_val; mutable bool m_ready; - const std::type_info* m_source; t_completion completion; public: @@ -73,7 +69,6 @@ class AutoCheckout { m_parent = rhs.m_parent; m_val = rhs.m_val; m_ready = rhs.m_ready; - m_source = rhs.m_source; completion = rhs.completion; rhs.m_parent = nullptr; diff --git a/autowiring/AutoFilterDescriptor.h b/autowiring/AutoFilterDescriptor.h index 0d1ebc65f..3bf209ef1 100644 --- a/autowiring/AutoFilterDescriptor.h +++ b/autowiring/AutoFilterDescriptor.h @@ -4,7 +4,6 @@ #include "AutoPacket.h" #include "auto_arg.h" #include "CallExtractor.h" -#include "DataFlow.h" #include "Decompose.h" #include "has_autofilter.h" #include "is_shared_ptr.h" @@ -72,7 +71,6 @@ struct AutoFilterDescriptorStub { AutoFilterDescriptorStub(const AutoFilterDescriptorStub& rhs) : m_pType(rhs.m_pType), m_pArgs(rhs.m_pArgs), - m_dataMap(rhs.m_dataMap), m_deferred(rhs.m_deferred), m_arity(rhs.m_arity), m_requiredCount(rhs.m_requiredCount), @@ -99,12 +97,7 @@ struct AutoFilterDescriptorStub { { for(auto pArg = m_pArgs; *pArg; pArg++) { m_arity++; - autowiring::DataFlow& data = m_dataMap[*pArg->ti]; - // DEFAULT: All data is broadcast - data.broadcast = true; - data.input = pArg->is_input; - data.output = pArg->is_output; if (pArg->is_input) { if (pArg->is_optional) { ++m_optionalCount; @@ -121,10 +114,8 @@ struct AutoFilterDescriptorStub { // This subscriber's argument types // NOTE: This is a reference to a static generated list, - // therefor it MUST be const and MUST be shallow-copied. + // therefore it MUST be const and MUST be shallow-copied. const AutoFilterDescriptorInput* m_pArgs; - typedef std::unordered_map FlowMap; - FlowMap m_dataMap; // Set if this is a deferred subscriber. Deferred subscribers cannot receive immediate-style // decorations, and have additional handling considerations when dealing with non-copyable @@ -173,18 +164,6 @@ struct AutoFilterDescriptorStub { return nullptr; } - /// - /// Copies the data flow information for the argument type to the flow argument. - /// - /// true when the argument type is found - autowiring::DataFlow GetDataFlow(const std::type_info* argType) const { - FlowMap::const_iterator data = m_dataMap.find(*argType); - if (data != m_dataMap.end()) { - return data->second; - } - return autowiring::DataFlow(); //DEFAULT: No flow - } - /// A call lambda wrapping the associated subscriber /// /// Parameters for the associated subscriber are obtained by querying the packet. @@ -192,44 +171,6 @@ struct AutoFilterDescriptorStub { /// subscribers, or an exception will be thrown. /// t_extractedCall GetCall(void) const { return m_pCall; } - - /// - /// Sends or receives broadcast instances of the input or output type. - /// - /// - /// The dataType must declared by the AutoFilter method for this call to have an effect. - /// - /// specifies the data type (input or output) to broadcast - /// when false disables broadcasting - void Broadcast(const std::type_info* dataType, bool enable = true) { - FlowMap::iterator flowFind = m_dataMap.find(*dataType); - if (flowFind == m_dataMap.end()) - return; - autowiring::DataFlow& flow = flowFind->second; - flow.broadcast = enable; - } - - /// - /// Creates a data half-pipe from this node to the target node for the specifed data. - /// - /// - /// A complete pipe requires that both the input and output nodes are modified. - /// This method only modifies this node - the other half-pipe requires a call to the other node. - /// The dataType must declared by the AutoFilter method for this call to have an effect. - /// - /// specifies the data type (input or output) to pipe - /// determines the target node that will receive the data - /// when false removes a pipe, if it exists - void HalfPipe(const std::type_info* dataType, const std::type_info* nodeType, bool enable = true) { - FlowMap::iterator flowFind = m_dataMap.find(*dataType); - if (flowFind == m_dataMap.end()) - return; - autowiring::DataFlow& flow = flowFind->second; - if (enable) - flow.halfpipes.insert(*nodeType); - else - flow.halfpipes.erase(*nodeType); - } }; /// diff --git a/autowiring/AutoMerge.h b/autowiring/AutoMerge.h deleted file mode 100644 index 35767a6d0..000000000 --- a/autowiring/AutoMerge.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#pragma once - -#include "AutoPacket.h" -#include STL_UNORDERED_SET - -/// -/// Extracts all instances of a type from a slave-context on each execution of that context. -/// -/// -/// It is expected that the merged data is desired in another context. -/// This process is facilitated the AutoStile and AutoMergeStile. -/// -template -class AutoMerge -{ -protected: - Autowired m_factory; - -public: - typedef std::unordered_map> merge_data; - typedef std::function merge_call; - - /// Final call in slave context to extract all data of the specified type - /// - /// This will only gather data that is directed to this source, identified by the gather type. - /// - void AutoFilter(const AutoPacket& packet, const merge_call& call) { - if (!call) - return; - - // Gather relevant data of the specified type - merge_data unordered = packet.GetAll(typeid(typename SelectTypeUnifier>::type)); - merge_data broadcast = packet.GetAll(typeid(void)); - unordered.insert(broadcast.begin(), broadcast.end()); - - // Merge with prior merged data - if (packet.Has()) { - merge_data priordata = packet.Get(); - unordered.insert(priordata.begin(), priordata.end()); - } - - // Call the master function decorating this packet - call(unordered); - } - - /// Enables a pipe from source to AutoMerge, and disables broadcasting by source. - /// Removes pipe and reinstates broadcast when false - /// - /// Parameters have the same meaning as in AutoPacketFactory PipeData and BroadcastData - /// - template - void PipeToMerge(const std::type_info* dataType = nullptr, bool enable = true) { - if (!m_factory) - return; - m_factory->BroadcastDataOut(dataType, !enable); - m_factory->PipeData>(dataType, enable); - } -}; - -/// -/// This provides a merge extractor function that can be injected in to a slave_context by AutoStile, -/// and constructs a corresponding instance of AutoMerge in the slave_context. -/// -/// -/// In order for the merged data to be extracted, it is necessary that AutoStile include -/// AutoMergeStile::merge_call as an *input*, so that it will be injected. -/// -template -class AutoMergeStile { -protected: - std::weak_ptr> m_merge; - -public: - typedef typename AutoMerge::merge_data merge_data; - typedef typename AutoMerge::merge_call merge_call; - - AutoMergeStile(CoreContext& slave_context) { - CurrentContextPusher pusher(&slave_context); - m_merge = AutoRequired>(); - } - - /// Provides an extractor function that can be injected by AutoStile - void AutoFilter(AutoPacket& packet) { - // IMPORTANT: - // Because the packet reference will be a decoration on packet, - // if it holds a shared_ptr to itself it will never terminate. - std::weak_ptr weak_packet = packet.shared_from_this(); - packet.Decorate(merge_call([weak_packet](const merge_data& unordered){ - std::shared_ptr master_packet = weak_packet.lock(); - if (!master_packet) - return; - master_packet->Decorate(unordered); - })); - } - - std::shared_ptr> GetMerge() { - return m_merge.lock(); - } -}; diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 030cb65be..7a4ed69ab 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -3,7 +3,6 @@ #include "AnySharedPointer.h" #include "at_exit.h" #include "AutoCheckout.h" -#include "DataFlow.h" #include "DecorationDisposition.h" #include "demangle.h" #include "hash_tuple.h" @@ -72,27 +71,10 @@ class AutoPacket: // The set of decorations currently attached to this object, and the associated lock: // Decorations are indexed first by type and second by pipe terminating type, if any. // NOTE: This is a disambiguation of function reference assignment, and avoids use of constexp. - static std::tuple DSIndex(const std::type_index& data, const std::type_index& source) { - return std::make_tuple(data, source); - } - typedef std::unordered_map, DecorationDisposition> t_decorationMap; + typedef std::unordered_map t_decorationMap; t_decorationMap m_decorations; mutable std::mutex m_lock; - /// - /// Retrieve data flow information for a decoration - /// - /// - /// Broadcast is always true for added or snooping recipients. - /// Pipes are always absent for added or snooping recipients. - /// - autowiring::DataFlow GetDataFlow(const DecorationDisposition& entry) const; - - /// - /// Retrieve data flow information from source - /// - autowiring::DataFlow GetDataFlow(const std::type_info& data, const std::type_info& source); - /// /// Adds all AutoFilter argument information for a recipient /// @@ -150,7 +132,7 @@ class AutoPacket: /// /// Marks the specified entry as being unsatisfiable /// - void MarkUnsatisfiable(const std::type_info& info, const std::type_info& source = typeid(void)); + void MarkUnsatisfiable(const std::type_info& info); /// /// Updates subscriber statuses given that the specified type information has been satisfied @@ -160,7 +142,7 @@ class AutoPacket: /// This method results in a call to the AutoFilter method on any subscribers which are /// satisfied by this decoration. /// - void UpdateSatisfaction(const std::type_info& info, const std::type_info& source = typeid(void)); + void UpdateSatisfaction(const std::type_info& info); /// /// Performs a "satisfaction pulse", which will avoid notifying any deferred filters @@ -173,19 +155,18 @@ class AutoPacket: void PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nInfos); /// Un-templated & locked component of Has - bool UnsafeHas(const std::type_info& data, const std::type_info& source = typeid(void)) const; + bool UnsafeHas(const std::type_info& data) const; /// Un-templated & locked component of Checkout - void UnsafeCheckout(AnySharedPointer* ptr, const std::type_info& data, const std::type_info& source); + void UnsafeCheckout(AnySharedPointer* ptr, const std::type_info& data); /// Un-templated & locked component of CompleteCheckout - void UnsafeComplete(bool ready, const std::type_info& data, const std::type_info& source, - DecorationDisposition* &broadDeco, DecorationDisposition* &pipedDeco); + void UnsafeComplete(bool ready, const std::type_info& data, DecorationDisposition*& entry); /// /// Invoked from a checkout when a checkout has completed /// Ready flag, set to false if the decoration should be marked unsatisfiable - void CompleteCheckout(bool ready, const std::type_info& data, const std::type_info& source = typeid(void)); + void CompleteCheckout(bool ready, const std::type_info& data); public: /// @@ -196,20 +177,20 @@ class AutoPacket: /// satisfied, the AutoPacket does not "have" these types. /// template - bool Has(const std::type_info& source = typeid(void)) const { + bool Has(void) const { std::lock_guard lk(m_lock); - return UnsafeHas(typeid(T), source); + return UnsafeHas(typeid(T)); } /// /// Detects the desired type, or throws an exception if such a type cannot be found /// template - const T& Get(const std::type_info& source = typeid(void)) const { + const T& Get(void) const { static_assert(!std::is_same::value, "Oops!"); const T* retVal; - if(!Get(retVal, source)) { + if(!Get(retVal)) { std::stringstream ss; ss << "Attempted to obtain a type " << autowiring::demangle(retVal) << " which was not decorated on this packet"; @@ -226,10 +207,10 @@ class AutoPacket: /// valid ONLY during recursive satisfaction calls. /// template - bool Get(const T*& out, const std::type_info& source = typeid(void)) const { + bool Get(const T*& out) const { std::lock_guard lk(m_lock); - auto q = m_decorations.find(DSIndex(typeid(T), source)); + auto q = m_decorations.find(typeid(T)); if(q != m_decorations.end() && q->second.satisfied) { auto& disposition = q->second; @@ -257,9 +238,9 @@ class AutoPacket: /// DecorateImmediate. /// template - bool Get(const std::shared_ptr*& out, const std::type_info& source = typeid(void)) const { + bool Get(const std::shared_ptr*& out) const { std::lock_guard lk(m_lock); - auto q = m_decorations.find(DSIndex(typeid(T), source)); + auto q = m_decorations.find(typeid(T)); if(q != m_decorations.end() && q->second.satisfied) { auto& disposition = q->second; if(disposition.m_decoration) { @@ -280,9 +261,9 @@ class AutoPacket: /// PROBLEM: This use case implies that holding shared_ptr references to decorations is NOT SAFE. /// template - bool Get(std::shared_ptr& out, const std::type_info& source = typeid(void)) const { + bool Get(std::shared_ptr& out) const { std::lock_guard lk(m_lock); - auto deco = m_decorations.find(DSIndex(typeid(T), source)); + auto deco = m_decorations.find(typeid(T)); if(deco != m_decorations.end() && deco->second.satisfied) { auto& disposition = deco->second; @@ -303,46 +284,23 @@ class AutoPacket: /// Transfers ownership of argument to AutoPacket /// template - void Put(T* in, const std::type_info& source = typeid(void)) { + void Put(T* in) { const std::type_info& data = typeid(T); - autowiring::DataFlow flow = GetDataFlow(data, source); - if (flow.broadcast) { - auto& entry = m_decorations[DSIndex(data, typeid(void))]; - if (entry.satisfied || - entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot put type " << autowiring::demangle(typeid(T)) - << " from source " << autowiring::demangle(source) - << " on AutoPacket, the requested broadcast already exists"; - throw std::runtime_error(ss.str()); - } - - entry.m_decoration = std::shared_ptr(in); - entry.m_type = &data; // Ensure correct type if instantiated here - entry.satisfied = true; - entry.isCheckedOut = false; - - UpdateSatisfaction(data, typeid(void)); + auto& entry = m_decorations[data]; + if (entry.satisfied || entry.isCheckedOut) { + std::stringstream ss; + ss << "Cannot put type " << autowiring::demangle(typeid(T)) + << " on AutoPacket, the requested broadcast already exists"; + throw std::runtime_error(ss.str()); } - if (!flow.halfpipes.empty()) { - auto& entry = m_decorations[DSIndex(data, source)]; - if (entry.satisfied || - entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot put type " << autowiring::demangle(typeid(T)) - << " from source " << autowiring::demangle(source) - << " on AutoPacket, the requested pipe already exists"; - throw std::runtime_error(ss.str()); - } - entry.m_decoration = std::shared_ptr(in); - entry.m_type = &data; // Ensure correct type if instantiated here - entry.satisfied = true; - entry.isCheckedOut = false; + entry.m_decoration = std::shared_ptr(in); + entry.m_type = &data; // Ensure correct type if instantiated here + entry.satisfied = true; + entry.isCheckedOut = false; - UpdateSatisfaction(data, source); - } + UpdateSatisfaction(data); } /// @@ -355,101 +313,23 @@ class AutoPacket: /// - alias the type of a decoration on AutoPacket /// template - void Put(std::shared_ptr in, const std::type_info& source = typeid(void)) { + void Put(std::shared_ptr in) { const std::type_info& data = typeid(T); - autowiring::DataFlow flow = GetDataFlow(data, source); - if (flow.broadcast) { - auto& entry = m_decorations[DSIndex(data, typeid(void))]; - if (entry.satisfied || - entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot put type " << autowiring::demangle(typeid(T)) - << " from source " << autowiring::demangle(source) - << " on AutoPacket, the requested broadcast already exists"; - throw std::runtime_error(ss.str()); - } - - entry.m_decoration = in; - entry.m_type = &data; // Ensure correct type if instantiated here - entry.satisfied = true; - entry.isCheckedOut = false; - - UpdateSatisfaction(data, typeid(void)); - } - if (!flow.halfpipes.empty()) { - auto& entry = m_decorations[DSIndex(data, source)]; - if (entry.satisfied || - entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot put type " << autowiring::demangle(typeid(T)) - << " from source " << autowiring::demangle(source) - << " on AutoPacket, the requested pipe already exists"; - throw std::runtime_error(ss.str()); - } - - entry.m_decoration = in; - entry.m_type = &data; // Ensure correct type if instantiated here - entry.satisfied = true; - entry.isCheckedOut = false; - - UpdateSatisfaction(data, source); - } - } - - /// - /// The number of sources for the specified type supplied to the specified target - /// - /// Default value counts all broadcast data - /// - /// This method should ONLY be called during the final-call sequence. - /// Before that time, the number of instances of a type may vary. - /// - template - int HasAll(const std::type_info& target = typeid(void)) const { - std::lock_guard lk(m_lock); - - int all = 0; - for (auto& deco : m_decorations) { - if (std::get<0>(deco.first) == typeid(T) && - deco.second.satisfied) { - autowiring::DataFlow flow = GetDataFlow(deco.second); - if (flow.output && - ((flow.broadcast && target == typeid(void)) || - flow.halfpipes.find(target) != flow.halfpipes.end())) { - ++all; - } - } + auto& entry = m_decorations[data]; + if (entry.satisfied || entry.isCheckedOut) { + std::stringstream ss; + ss << "Cannot put type " << autowiring::demangle(typeid(T)) + << " on AutoPacket, the requested broadcast already exists"; + throw std::runtime_error(ss.str()); } - return all; - } - /// - /// All decorations of the specified type supplied to the specified target, indexed by source - /// - /// - /// Default value retrieves all broadcast data - /// - /// This method should ONLY be called during the final-call sequence. - /// Before that time, the number of instances of a type may vary. - /// - template - std::unordered_map> GetAll(const std::type_info& target = typeid(void)) const { - std::lock_guard lk(m_lock); + entry.m_decoration = in; + entry.m_type = &data; // Ensure correct type if instantiated here + entry.satisfied = true; + entry.isCheckedOut = false; - std::unordered_map> all; - for (const auto& deco : m_decorations) { - if (std::get<0>(deco.first) == std::type_index(typeid(T)) && - deco.second.satisfied) { - autowiring::DataFlow flow = GetDataFlow(deco.second); - if (flow.output && - ((flow.broadcast && target == typeid(void)) || - flow.halfpipes.find(target) != flow.halfpipes.end())) { - all[std::get<1>(deco.first)] = deco.second.m_decoration->as(); - } - } - } - return all; + UpdateSatisfaction(data); } /// Shares all broadcast data from this packet with the recipient packet @@ -473,7 +353,7 @@ class AutoPacket: /// when it falls out of scope if so marked. /// template - AutoCheckout Checkout(std::shared_ptr ptr, const std::type_info& source = typeid(void)) { + AutoCheckout Checkout(std::shared_ptr ptr) { const std::type_info& data = typeid(T); /// Injunction to prevent existential loops: @@ -486,19 +366,18 @@ class AutoPacket: AnySharedPointer any_ptr(ptr); { std::lock_guard guard(m_lock); - UnsafeCheckout(&any_ptr, data, source); + UnsafeCheckout(&any_ptr, data); } return AutoCheckout( *this, ptr, - &AutoPacket::CompleteCheckout, - source + &AutoPacket::CompleteCheckout ); } template - AutoCheckout Checkout(const std::type_info& source = typeid(void)) { - return Checkout(std::make_shared(), source); + AutoCheckout Checkout(void) { + return Checkout(std::make_shared()); } /// @@ -509,11 +388,11 @@ class AutoPacket: /// input on this type to be called, if the remainder of their inputs are available. /// template - void Unsatisfiable(const std::type_info& source = typeid(void)) { + void Unsatisfiable(void) { { // Insert a null entry at this location: std::lock_guard lk(m_lock); - auto& entry = m_decorations[DSIndex(typeid(T), source)]; + auto& entry = m_decorations[typeid(T)]; entry.m_type = &typeid(T); // Ensure correct type if instantiated here if(entry.satisfied || entry.isCheckedOut) @@ -524,7 +403,7 @@ class AutoPacket: } // Now trigger a rescan: - MarkUnsatisfiable(typeid(T), source); + MarkUnsatisfiable(typeid(T)); } /// @@ -536,8 +415,8 @@ class AutoPacket: /// value regardless of whether any subscribers exist. /// template - const T& Decorate(T t, const std::type_info& source = typeid(void)) { - return Decorate(std::make_shared(std::forward(t)), source); + const T& Decorate(T t) { + return Decorate(std::make_shared(std::forward(t))); } /// @@ -548,8 +427,8 @@ class AutoPacket: /// shared pointer. /// template - const T& Decorate(std::shared_ptr t, const std::type_info& source = typeid(void)) { - Checkout(t, source).Ready(); + const T& Decorate(std::shared_ptr t) { + Checkout(t).Ready(); return *t; } @@ -566,9 +445,6 @@ class AutoPacket: /// template void DecorateImmediate(const T& immed, const Ts&... immeds) { - // TODO: DecorateImmediate can only broadcast - change this to allow sourced immediate decoration. - const std::type_info& source = typeid(void); - // None of the inputs may be shared pointers--if any of the inputs are shared pointers, they must be attached // to this packet via Decorate, or else dereferenced and used that way. static_assert( @@ -586,7 +462,7 @@ class AutoPacket: { std::lock_guard lk(m_lock); for(size_t i = 0; i < s_arity; i++) { - pTypeSubs[i] = &m_decorations[DSIndex(*s_argTypes[i], source)]; + pTypeSubs[i] = &m_decorations[*s_argTypes[i]]; pTypeSubs[i]->m_type = s_argTypes[i]; // Ensure correct type if instantiated here if(pTypeSubs[i]->satisfied || pTypeSubs[i]->isCheckedOut) { @@ -604,7 +480,7 @@ class AutoPacket: } // Pulse satisfaction: - MakeAtExit([this, &pTypeSubs, &source] { + MakeAtExit([this, &pTypeSubs] { // Mark entries as unsatisfiable: // IMPORTANT: isCheckedOut = true prevents subsequent decorations of this type for(DecorationDisposition* pEntry : pTypeSubs) { @@ -614,7 +490,7 @@ class AutoPacket: // Now trigger a rescan to hit any deferred, unsatisfiable entries: for(const std::type_info* ti : s_argTypes) - MarkUnsatisfiable(*ti, source); + MarkUnsatisfiable(*ti); }), PulseSatisfaction(pTypeSubs, s_arity); } @@ -633,8 +509,8 @@ class AutoPacket: /// SatCounter GetSatisfaction(const std::type_info& subscriber) const; - /// All subscribers to the specified data and source - std::list GetSubscribers(const std::type_info& data, const std::type_info& source = typeid(void)) const; + /// All subscribers to the specified data + std::list GetSubscribers(const std::type_info& data) const; /// All decoration dispositions associated with the data type /// @@ -644,5 +520,5 @@ class AutoPacket: std::list GetDispositions(const std::type_info& data) const; /// True if the indicated type has been requested for use by some consumer - bool HasSubscribers(const std::type_info& data, const std::type_info& source = typeid(void)) const; + bool HasSubscribers(const std::type_info& data) const; }; diff --git a/autowiring/AutoPacketFactory.h b/autowiring/AutoPacketFactory.h index 69496a246..22e67c10c 100644 --- a/autowiring/AutoPacketFactory.h +++ b/autowiring/AutoPacketFactory.h @@ -121,84 +121,6 @@ class AutoPacketFactory: /// The AutoFilter to be removed void RemoveSubscriber(const AutoFilterDescriptor& autoFilter); - /// - /// Sets the broadcast status for the specified output from the node. - /// - /// - /// When dataType = nullptr the broadcast status is set for all declared input and output data. - /// - template - void BroadcastDataOut(const std::type_info* dataType = nullptr, bool enable = true) { - const std::type_info* nodeType = &typeid(typename SelectTypeUnifier::type); - if (dataType) { - GetContext()->NotifyWhenAutowired( - [this, nodeType, dataType, enable](){ - BroadcastOneDataOut(nodeType, dataType, enable); - }); - } else { - GetContext()->NotifyWhenAutowired( - [this, nodeType, enable](){ - BroadcastAllDataOut(nodeType, enable); - }); - } - } - - /// - /// Sets the broadcast status for the specified output from the node. - /// - /// - /// When dataType = nullptr the broadcast status is set for all declared input and output data. - /// - template - void BroadcastDataIn(const std::type_info* dataType = nullptr, bool enable = true) { - const std::type_info* nodeType = &typeid(typename SelectTypeUnifier::type); - if (dataType) { - GetContext()->NotifyWhenAutowired( - [this, nodeType, dataType, enable](){ - BroadcastOneDataIn(nodeType, dataType, enable); - }); - } else { - GetContext()->NotifyWhenAutowired( - [this, nodeType, enable](){ - BroadcastAllDataIn(nodeType, enable); - }); - } - } - - /// - /// Establishes a data pipe from nodeIn to nodeOut. - /// - /// - /// When dataType = nullptr pipes are established for all declared data - /// that are outputs of nodeOut and inputs to nodeIn - /// If nodeOut includes AutoPacket& as an argument then pipes will be defined - /// for all declared input types of nodeIn. Likewise, if nodeIn declares - /// AutoPacket& or const AutoPacket& as an argument then pipes will be defined - /// for all declared outputs of nodeOut. - /// - template - void PipeData(const std::type_info* dataType = nullptr, bool enable = true) { - const std::type_info* nodeOutType = &typeid(typename SelectTypeUnifier::type); - const std::type_info* nodeInType = &typeid(typename SelectTypeUnifier::type); - if (dataType) { - GetContext()->NotifyWhenAutowired( - [this, nodeOutType, nodeInType, dataType, enable](){ - GetContext()->NotifyWhenAutowired( - [this, nodeOutType, nodeInType, dataType, enable](){ - PipeOneData(nodeOutType, nodeInType, dataType, enable); - }); - }); - } else { - GetContext()->NotifyWhenAutowired( - [this, nodeOutType, nodeInType, enable](){ - GetContext()->NotifyWhenAutowired( - [this, nodeOutType, nodeInType, enable](){ - PipeAllData(nodeOutType, nodeInType, enable); - }); - }); - } - } - protected: /// /// Returns a description of the AutoFilter associated with the type nodeType @@ -208,15 +130,6 @@ class AutoPacketFactory: /// AutoFilterDescriptor GetTypeDescriptorUnsafe(const std::type_info* nodeType); - void BroadcastOneDataIn(const std::type_info* nodeType, const std::type_info* dataType, bool enable); - void BroadcastAllDataIn(const std::type_info* nodeType, bool enable); - - void BroadcastOneDataOut(const std::type_info* nodeType, const std::type_info* dataType, bool enable); - void BroadcastAllDataOut(const std::type_info* nodeType, bool enable); - - void PipeOneData(const std::type_info* nodeOutType, const std::type_info* nodeInType, const std::type_info* dataType, bool enable); - void PipeAllData(const std::type_info* nodeOutType, const std::type_info* nodeInType, bool enable); - static bool IsAutoPacketType(const std::type_info& dataType); public: diff --git a/autowiring/AutoStile.h b/autowiring/AutoStile.h deleted file mode 100644 index dfc635e67..000000000 --- a/autowiring/AutoStile.h +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#pragma once - -#include "var_logic.h" -#include "AutoPacket.h" -#include MEMORY_HEADER - -template::is_input> -struct AutoDecorationStile; - -template -struct AutoDecorationStile -{ - /// Decorator for input shares the reference to master_data - static void DecorationStile(std::shared_ptr& slave_packet, std::shared_ptr& master_packet, - data_pipe& master_data, const std::type_info& master_type) { - slave_packet->Decorate(master_data); - } -}; - -template -struct AutoDecorationStile -{ - /// Decorator for output creates an extraction for slave_data - static void DecorationStile(std::shared_ptr& slave_packet, std::shared_ptr& master_packet, - data_pipe& master_data, const std::type_info& master_type) { - static_assert(std::is_same::id_type>>::value, - "Output types must be declared as auto_out"); - - // Reverse argument orientation for AutoFilter in slave context - typedef auto_in::id_type> slave_in_type; - - // HACK: Move sematics do not work with lambdas, so it is necessary to reproduce the auto_out signative using master_packet. - master_data.cancel(); - const std::type_info* stile_source = &master_type; - slave_packet->AddRecipient([master_packet, stile_source](slave_in_type slave_data) { - master_packet->Put(slave_data, *stile_source); - }); - } -}; - -/// -/// AutoStile provides a means of calling a context as though it is an AutoFilter. -/// The AutoStile Args use the same syntax as AutoFilter: -/// - Input types will be injected in to the slave packet -/// - Output types (auto_out only) will be extracted from the slave packet -/// - The absence of any output types indicates that *all* data from the slave context -/// should be output. This is because AutoPacket& is already an argument, and cannot -/// be repeated. -/// ASSERT: Injection and extraction of all data will not yield multiple decorations, -/// since AutoPacket::ForwardAll prevents this from occurring. -/// NOTE: If shared input types are used data copying will be avoided. -/// IMPORTANT: Unshared output types cannot be used, since they will be available -/// before the execution of any Deferred methods in the slave context. -/// -/// -/// When AutoStile::AutoFilter is called it initiates execution of a Slave context, -/// and injects the objects referenced by AutoFilter into the new context. -/// AutoStile also handles the extraction of data requested from the context. -/// -/// If merged data is required from the context then it is necessary to decorate the -/// master_packet with an extraction function, and declare the type of that function -/// as an *input* argument of the AutoStile. The decoration and type are provided by -/// the AutoMergeStile class. -/// -/// -template -class AutoStile -{ -protected: - std::weak_ptr m_slave_factory; - - /// Inject all data from slave_packet into master_packet - static void ForwardStile(std::shared_ptr& slave_packet, std::shared_ptr& master_packet) { - slave_packet->AddRecipient([master_packet](const AutoPacket& slave_packet) { - slave_packet.ForwardAll(master_packet); - }); - } - -public: - AutoStile(std::weak_ptr slave_context = std::weak_ptr()) { - Leash(slave_context); - } - - void AutoFilter(AutoPacket& packet, Args... data) { - std::shared_ptr slave_factory = m_slave_factory.lock(); - if (!slave_factory) - return; - - // Initiate the slave context - std::shared_ptr master_packet = packet.shared_from_this(); - std::shared_ptr slave_packet = slave_factory->NewPacket(); - const std::type_info& master_type = typeid(AutoStile); - (void) std::initializer_list { - (AutoDecorationStile::DecorationStile(slave_packet, master_packet, data, master_type), false)... - }; - - if (var_and::is_input...>::value) { - ForwardStile(slave_packet, master_packet); - } - } - - void Leash(std::weak_ptr slave_context = std::weak_ptr()) { - m_slave_factory.reset(); - - std::shared_ptr strong_context = slave_context.lock(); - if (!strong_context) - return; - - strong_context->NotifyWhenAutowired([this, slave_context](){ - // NOTE: Call-back is not necessarily inside the notifying context. - std::shared_ptr strong_context = slave_context.lock(); - if (!strong_context) - return; - std::shared_ptr slave_factory; - strong_context->FindByTypeRecursive(slave_factory); - m_slave_factory = slave_factory; - }); - } -}; - -/// -/// Zero input argument Stile specialization -/// -template<> -class AutoStile<> -{}; \ No newline at end of file diff --git a/autowiring/CallExtractor.h b/autowiring/CallExtractor.h index 261b1faaf..eb4ff285e 100644 --- a/autowiring/CallExtractor.h +++ b/autowiring/CallExtractor.h @@ -2,13 +2,12 @@ #pragma once #include "auto_arg.h" #include "AutoPacket.h" -#include "DataFlow.h" #include "Decompose.h" class Deferred; // The type of the call centralizer -typedef void(*t_extractedCall)(const AnySharedPointer& obj, AutoPacket&, const autowiring::DataFill&); +typedef void(*t_extractedCall)(const AnySharedPointer& obj, AutoPacket&); /// /// Specialization for immediate mode cases @@ -25,7 +24,7 @@ struct CallExtractor: /// /// Binder struct, lets us refer to an instance of Call by type /// - static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket, const autowiring::DataFill& satisfaction) { + static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket) { const void* pfn = obj->ptr(); // This is the true type of the input, it's the fnptr itself, not a function object @@ -33,7 +32,7 @@ struct CallExtractor: // Handoff ((t_pfn)pfn)( - auto_arg(autoPacket.shared_from_this(), *satisfaction.source(typeid(typename auto_arg::base_type)))... + auto_arg(autoPacket.shared_from_this())... ); } }; @@ -50,7 +49,7 @@ struct CallExtractor: /// Binder struct, lets us refer to an instance of Call by type /// template - static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket, const autowiring::DataFill& satisfaction) { + static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket) { const void* pObj = obj->ptr(); // This exception type indicates that an attempt was made to construct an AutoFilterDescriptor with an @@ -60,7 +59,7 @@ struct CallExtractor: // Handoff (((T*) pObj)->*memFn)( - auto_arg(autoPacket.shared_from_this(), *satisfaction.source(typeid(typename auto_arg::base_type)))... + auto_arg(autoPacket.shared_from_this())... ); } }; @@ -77,12 +76,12 @@ struct CallExtractor : static const size_t N = sizeof...(Args); template - static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket, const autowiring::DataFill& satisfaction) { + static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket) { const void* pObj = obj->ptr(); // Handoff (((const T*) pObj)->*memFn)( - auto_arg(autoPacket.shared_from_this(), *satisfaction.source(typeid(typename auto_arg::base_type)))... + auto_arg(autoPacket.shared_from_this())... ); } }; @@ -99,7 +98,7 @@ struct CallExtractor: static const size_t N = sizeof...(Args); template - static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket, const autowiring::DataFill& satisfaction) { + static void Call(const AnySharedPointer& obj, AutoPacket& autoPacket) { const void* pObj = obj->ptr(); // Obtain a shared pointer of the AutoPacket in order to ensure the packet @@ -111,9 +110,9 @@ struct CallExtractor: // WARNING: The autowiring::DataFill information will be referenced, // since it should be from a SatCounter associated to autoPacket, // and will therefore have the same lifecycle as the AutoPacket. - *(T*) pObj += [pObj, pAutoPacket, &satisfaction] { + *(T*) pObj += [pObj, pAutoPacket] { (((T*) pObj)->*memFn)( - auto_arg(pAutoPacket, *satisfaction.source(typeid(typename auto_arg::base_type)))... + auto_arg(pAutoPacket)... ); }; } diff --git a/autowiring/DataFlow.h b/autowiring/DataFlow.h deleted file mode 100644 index ef2215de4..000000000 --- a/autowiring/DataFlow.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#pragma once -#include TYPE_INDEX_HEADER -#include STL_UNORDERED_SET -#include STL_UNORDERED_MAP - -namespace autowiring { - /// - /// Mutable properties used by AutoFilterDescriptor to describe data pipes. - /// - struct DataFlow { - // DEFAULT: No data flow - DataFlow() : - output(false), - broadcast(false) - {} - - // Broadcast Output: Any AutoFilter can receive this data - // Pipelined Output: AutoFilter only sends data to declared pipes - // Broadcast Input: AutoFilter accepts data from any input - // Pipelined Input: AutoFilter only accepts data from declared pipes - bool input; - bool output; - bool broadcast; - std::unordered_set halfpipes; - }; - -/// Identifies the source fulfilling argument data. -/// Key is argument type, value is source type. -/// If the data is broadcast value will be &typeid(void) - class DataFill: - public std::unordered_map - { - public: - const std::type_info* source(const std::type_index& arg) const { - std::unordered_map::const_iterator itr = find(arg); - if (itr != end()) - return itr->second; - return &typeid(void); - } - }; -} diff --git a/autowiring/SatCounter.h b/autowiring/SatCounter.h index f8898263c..bc0e7db86 100644 --- a/autowiring/SatCounter.h +++ b/autowiring/SatCounter.h @@ -28,8 +28,7 @@ struct SatCounter: AutoFilterDescriptor(static_cast(source)), called(source.called), remaining(source.remaining), - optional(source.optional), - satisfaction(source.satisfaction) + optional(source.optional) {} SatCounter& operator = (const SatCounter& source) { @@ -37,7 +36,6 @@ struct SatCounter: called = source.called; remaining = source.remaining; optional = source.optional; - satisfaction = source.satisfaction; return *this; } @@ -50,9 +48,6 @@ struct SatCounter: // The OPTIONAL remaining counter: size_t optional; - // The sources satisfying each argument - autowiring::DataFill satisfaction; - /// /// Calls the underlying AutoFilter method with the specified AutoPacketAdapter as input /// @@ -63,7 +58,7 @@ struct SatCounter: throw std::runtime_error(ss.str()); } called = true; - GetCall()(GetAutoFilter(), packet, satisfaction); + GetCall()(GetAutoFilter(), packet); } /// @@ -73,75 +68,36 @@ struct SatCounter: called = false; remaining = m_requiredCount; optional = m_optionalCount; - satisfaction.clear(); - - // Insert this type as a provider of output arguments - for (auto& data : m_dataMap) { - if (data.second.output) { - satisfaction[data.first] = m_pType; - } - } - } - - bool IsInput(const std::type_index& data, const std::type_info& source) const { - auto dataFlow = m_dataMap.find(data); - if (dataFlow != m_dataMap.end()) { - if (source == typeid(void)) { - if (dataFlow->second.broadcast) { - return true; - } - } else { - if (dataFlow->second.halfpipes.find(source) != dataFlow->second.halfpipes.end()) { - return true; - } - } - } - return false; } /// /// Conditionally decrements AutoFilter argument satisfaction. /// /// True if this decrement yielded satisfaction of all arguments - bool Decrement(const std::type_index& data, const std::type_info& source, bool is_mandatory) { - if (IsInput(data, source)) { - if (satisfaction.find(data) != satisfaction.end()) { - std::stringstream ss; - ss << "Repeated data type " << autowiring::demangle(data) - << " for " << m_pType->name() - << " provided by " << autowiring::demangle(satisfaction.find(data)->second) - << " and also by " << autowiring::demangle(source) - << std::endl; - throw std::runtime_error(ss.str()); - } - satisfaction[data] = &source; - is_mandatory ? --remaining : --optional; - return remaining == 0 && optional == 0; - } - return false; + bool Decrement(const std::type_index& data, bool is_mandatory) { + is_mandatory ? --remaining : --optional; + return remaining == 0 && optional == 0; } /// /// Conditionally increments AutoFilter argument satisfaction. /// - void Increment(const std::type_index& data, const std::type_info& source, bool is_mandatory) { - if (IsInput(data, source)) { - is_mandatory ? ++remaining : ++optional; - } + void Increment(const std::type_index& data, bool is_mandatory) { + is_mandatory ? ++remaining : ++optional; } /// - /// Removes all remaining + /// Sets the optional count to zero if mandatory inputs are satisfied /// /// True if all mandatory arguments are satisfied bool Resolve() { if (IsDeferred()) // IMPORTANT: Deferred calls cannot be finalized return false; - if (remaining == 0 && - optional != 0) { - optional = 0; - return true; + + if (remaining == 0 && optional != 0) { + optional = 0; + return true; } return false; } diff --git a/autowiring/auto_arg.h b/autowiring/auto_arg.h index 298b82167..1292eb175 100644 --- a/autowiring/auto_arg.h +++ b/autowiring/auto_arg.h @@ -30,8 +30,8 @@ class auto_arg: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_in(packet, source) + auto_arg(std::shared_ptr packet): + auto_in(packet) {} static const bool is_shared = false; @@ -50,8 +50,8 @@ class auto_arg: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_in(packet, source) + auto_arg(std::shared_ptr packet): + auto_in(packet) {} static const bool is_shared = false; @@ -70,8 +70,8 @@ class auto_arg: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_in(packet, source) + auto_arg(std::shared_ptr packet): + auto_in(packet) {} static const bool is_shared = false; @@ -90,8 +90,8 @@ class auto_arg>: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_in(packet, source) + auto_arg(std::shared_ptr packet): + auto_in(packet) {} static const bool is_shared = true; @@ -110,8 +110,8 @@ class auto_arg>: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_in(packet, source) + auto_arg(std::shared_ptr packet): + auto_in(packet) {} static const bool is_shared = true; @@ -130,8 +130,8 @@ class auto_arg: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_out(packet, source) + auto_arg(std::shared_ptr packet): + auto_out(packet) {} static const bool is_shared = false; @@ -150,8 +150,8 @@ class auto_arg>: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_out(packet, source) + auto_arg(std::shared_ptr packet): + auto_out(packet) {} static const bool is_shared = true; @@ -170,8 +170,8 @@ class auto_arg>: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - auto_out(packet, source) + auto_arg(std::shared_ptr packet): + auto_out(packet) {} static const bool is_shared = true; @@ -190,8 +190,8 @@ class auto_arg>: auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - optional_ptr(packet, source) + auto_arg(std::shared_ptr packet): + optional_ptr(packet) {} static const bool is_shared = true; diff --git a/autowiring/auto_in.h b/autowiring/auto_in.h index 9c1330f8d..d41473dc4 100644 --- a/autowiring/auto_in.h +++ b/autowiring/auto_in.h @@ -49,7 +49,7 @@ class auto_in: return *this; } - auto_in (std::shared_ptr packet, const std::type_info& source = typeid(void)) { - packet->Get(*this, source); + auto_in (std::shared_ptr packet) { + packet->Get(*this); } }; diff --git a/autowiring/auto_out.h b/autowiring/auto_out.h index 3aa84d33e..88e32eb34 100644 --- a/autowiring/auto_out.h +++ b/autowiring/auto_out.h @@ -23,7 +23,6 @@ class auto_out: protected: std::shared_ptr m_packet; - const std::type_info* m_source; bool m_makeable; /// @@ -56,15 +55,14 @@ class auto_out: } /// Destruction of auto_out makes type data available - ~auto_out () { - if (shared_type::operator bool()) - m_packet->Put(static_cast(*this), *m_source); + ~auto_out(void) { + if(shared_type::operator bool()) + m_packet->Put(static_cast(*this)); else if (m_makeable) - m_packet->Put(new type(), *m_source); + m_packet->Put(new type()); } - auto_out (): - m_source(nullptr), + auto_out(void) : m_makeable(false) {} @@ -83,8 +81,6 @@ class auto_out: cancel(); shared_type::operator = (std::move(rhs)); m_packet = std::move(rhs.m_packet); - m_source = rhs.m_source; - rhs.m_source = nullptr; m_makeable = rhs.m_makeable; rhs.m_makeable = false; return *this; @@ -102,9 +98,8 @@ class auto_out: return *this; } - auto_out (std::shared_ptr packet, const std::type_info& source = typeid(void)): + auto_out (std::shared_ptr packet): m_packet(packet), - m_source(&source), m_makeable(true) {} diff --git a/autowiring/optional_ptr.h b/autowiring/optional_ptr.h index d4913f75e..d2e00b374 100644 --- a/autowiring/optional_ptr.h +++ b/autowiring/optional_ptr.h @@ -60,7 +60,7 @@ class optional_ptr: return *this; } - optional_ptr (std::shared_ptr packet, const std::type_info& source = typeid(void)) { - packet->Get(*this, source); + optional_ptr (std::shared_ptr packet) { + packet->Get(*this); } }; diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index 8d2fe211a..d87a58549 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -42,103 +42,47 @@ AutoPacket::AutoPacket(AutoPacketFactory& factory, const std::shared_ptr } void AutoPacket::AddSatCounter(SatCounter& satCounter) { - for(auto pCur = satCounter.GetAutoFilterInput(); - *pCur; - pCur++ - ) { + for(auto pCur = satCounter.GetAutoFilterInput(); *pCur; pCur++) { const std::type_info& dataType = *pCur->ti; - auto flow = satCounter.GetDataFlow(&dataType); - if (flow.broadcast) { - // Broadcast source is void - DecorationDisposition* entry = &m_decorations[DSIndex(dataType, typeid(void))]; - entry->m_type = &dataType; - - // Decide what to do with this entry: - // NOTE: Recipients added via AddReceiver can receive broadcast data, - // so it is necessary to decrement the receiver's counters when it is added. - if (pCur->is_input) { - entry->m_subscribers.push_back(std::make_pair(&satCounter, !pCur->is_optional)); - if (entry->satisfied) - satCounter.Decrement(dataType, typeid(void), !pCur->is_optional); - } - if (pCur->is_output) { - if(entry->m_publisher) { - std::stringstream ss; - ss << "Added identical data broadcasts of type " << autowiring::demangle(pCur->ti); - throw std::runtime_error(ss.str()); - } - entry->m_publisher = &satCounter; - } - } - for (auto halfpipe : flow.halfpipes) { - // Pipe terminating type is defined by halfpipe - DecorationDisposition* entry; - if (flow.output) { - entry = &m_decorations[DSIndex(dataType, *satCounter.GetType())]; - } else { - entry = &m_decorations[DSIndex(dataType, halfpipe)]; - } - entry->m_type = &dataType; - // Decide what to do with this entry: - // NOTE: Recipients added via AddReceiver cannot receive piped data, - // and subscribers are added before the packet is decorated. - if (pCur->is_input) { - entry->m_subscribers.push_back(std::make_pair(&satCounter, !pCur->is_optional)); - } - if (pCur->is_output) { - if(entry->m_publisher) { - std::stringstream ss; - ss << "Added identical data pipes from " << satCounter.GetAutoFilterTypeInfo()->name() << " of type " << pCur->ti->name(); - throw std::runtime_error(ss.str()); - } - entry->m_publisher = &satCounter; + // Broadcast source is void + DecorationDisposition* entry = &m_decorations[dataType]; + entry->m_type = &dataType; + + // Decide what to do with this entry: + // NOTE: Recipients added via AddReceiver can receive broadcast data, + // so it is necessary to decrement the receiver's counters when it is added. + if (pCur->is_input) { + entry->m_subscribers.push_back(std::make_pair(&satCounter, !pCur->is_optional)); + if (entry->satisfied) + satCounter.Decrement(dataType, !pCur->is_optional); + } + if (pCur->is_output) { + if(entry->m_publisher) { + std::stringstream ss; + ss << "Added identical data broadcasts of type " << autowiring::demangle(pCur->ti); + throw std::runtime_error(ss.str()); } + entry->m_publisher = &satCounter; } } } void AutoPacket::RemoveSatCounter(SatCounter& satCounter) { - for(auto pCur = satCounter.GetAutoFilterInput(); - *pCur; - pCur++ - ) { + for(auto pCur = satCounter.GetAutoFilterInput(); *pCur; pCur++) { const std::type_info& dataType = *pCur->ti; - auto flow = satCounter.GetDataFlow(&dataType); - if (flow.broadcast) { - // Broadcast source is void - DecorationDisposition* entry = &m_decorations[DSIndex(dataType, typeid(void))]; - - // Decide what to do with this entry: - if (pCur->is_input) { - assert(!entry->m_subscribers.empty()); - assert(&satCounter == entry->m_subscribers.back().first); - entry->m_subscribers.pop_back(); - } - if (pCur->is_output) { - assert(&satCounter == entry->m_publisher); - entry->m_publisher = nullptr; - } - } - for (auto halfpipe : flow.halfpipes) { - // Pipe terminating type is defined by halfpipe - DecorationDisposition* entry; - if (flow.output) { - entry = &m_decorations[DSIndex(dataType, *satCounter.GetType())]; - } else { - entry = &m_decorations[DSIndex(dataType, halfpipe)]; - } - // Decide what to do with this entry: - if (pCur->is_input) { - assert(!entry->m_subscribers.empty()); - assert(&satCounter == entry->m_subscribers.back().first); - entry->m_subscribers.pop_back(); - } - if (pCur->is_output) { - assert(&satCounter == entry->m_publisher); - entry->m_publisher = nullptr; - } + DecorationDisposition* entry = &m_decorations[dataType]; + + // Decide what to do with this entry: + if (pCur->is_input) { + assert(!entry->m_subscribers.empty()); + assert(&satCounter == entry->m_subscribers.back().first); + entry->m_subscribers.pop_back(); + } + if (pCur->is_output) { + assert(&satCounter == entry->m_publisher); + entry->m_publisher = nullptr; } } } @@ -157,11 +101,11 @@ ObjectPool AutoPacket::CreateObjectPool(AutoPacketFactory& factory, ); } -void AutoPacket::MarkUnsatisfiable(const std::type_info& info, const std::type_info& source) { +void AutoPacket::MarkUnsatisfiable(const std::type_info& info) { std::list callQueue; { std::lock_guard lk(m_lock); - auto dFind = m_decorations.find(DSIndex(info, source)); + auto dFind = m_decorations.find(info); if(dFind == m_decorations.end()) // Trivial return, there's no subscriber to this decoration and so we have nothing to do return; @@ -174,7 +118,7 @@ void AutoPacket::MarkUnsatisfiable(const std::type_info& info, const std::type_i continue; // Entry is optional, we will call if we're satisfied after decrementing this optional field - if(satCounter.first->Decrement(info, source, false)) + if(satCounter.first->Decrement(info, false)) callQueue.push_back(satCounter.first); } } @@ -184,7 +128,7 @@ void AutoPacket::MarkUnsatisfiable(const std::type_info& info, const std::type_i call->CallAutoFilter(*this); } -void AutoPacket::UpdateSatisfaction(const std::type_info& info, const std::type_info& source) { +void AutoPacket::UpdateSatisfaction(const std::type_info& info) { std::list callQueue; { std::lock_guard lk(m_lock); @@ -197,7 +141,7 @@ void AutoPacket::UpdateSatisfaction(const std::type_info& info, const std::type_ } } - auto dFind = m_decorations.find(DSIndex(info, source)); + auto dFind = m_decorations.find(info); if(dFind == m_decorations.end()) // Trivial return, there's no subscriber to this decoration and so we have nothing to do return; @@ -205,7 +149,7 @@ void AutoPacket::UpdateSatisfaction(const std::type_info& info, const std::type_ // Update satisfaction inside of lock DecorationDisposition* decoration = &dFind->second; for(const auto& satCounter : decoration->m_subscribers) - if(satCounter.first->Decrement(info, source, satCounter.second)) + if(satCounter.first->Decrement(info, satCounter.second)) callQueue.push_back(satCounter.first); } @@ -215,9 +159,6 @@ void AutoPacket::UpdateSatisfaction(const std::type_info& info, const std::type_ } void AutoPacket::PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nInfos) { - // TODO: DecorateImmediate can only broadcast - change this to allow sourced immediate decoration. - const std::type_info& source = typeid(void); - std::list callQueue; // First pass, decrement what we can: { @@ -245,7 +186,7 @@ void AutoPacket::PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nI // Now do the decrementation and proceed even if optional > 0, // since this is the only opportunity to fulfill the arguments - (cur->Decrement(*pTypeSubs[i]->m_type, source, true) || + (cur->Decrement(*pTypeSubs[i]->m_type, true) || cur->remaining == 0) ) // Finally, queue a call for this type @@ -266,123 +207,68 @@ void AutoPacket::PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nI for(const auto& satCounter : pTypeSubs[i]->m_subscribers) { SatCounter* cur = satCounter.first; if (satCounter.second) { - cur->Increment(*pTypeSubs[i]->m_type, source, true); + cur->Increment(*pTypeSubs[i]->m_type, true); } } } } } -bool AutoPacket::UnsafeHas(const std::type_info& data, const std::type_info& source) const { - auto q = m_decorations.find(DSIndex(data, source)); +bool AutoPacket::UnsafeHas(const std::type_info& data) const { + auto q = m_decorations.find(data); if(q == m_decorations.end()) return false; return q->second.satisfied; } -void AutoPacket::UnsafeCheckout(AnySharedPointer* ptr, const std::type_info& data, const std::type_info& source) { - autowiring::DataFlow flow = GetDataFlow(data, source); - if (flow.broadcast) { - auto& entry = m_decorations[DSIndex(data, typeid(void))]; - entry.m_type = &data; // Ensure correct type if instantiated here - - if (entry.satisfied) { - std::stringstream ss; - ss << "Cannot decorate this packet with type " << autowiring::demangle(*ptr) - << ", the requested decoration already exists"; - throw std::runtime_error(ss.str()); - } - if(entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot check out decoration of type " << autowiring::demangle(*ptr) - << ", it is already checked out elsewhere"; - throw std::runtime_error(ss.str()); - } - entry.isCheckedOut = true; - entry.m_decoration = *ptr; +void AutoPacket::UnsafeCheckout(AnySharedPointer* ptr, const std::type_info& data) { + auto& entry = m_decorations[data]; + entry.m_type = &data; // Ensure correct type if instantiated here + + if (entry.satisfied) { + std::stringstream ss; + ss << "Cannot decorate this packet with type " << autowiring::demangle(*ptr) + << ", the requested decoration already exists"; + throw std::runtime_error(ss.str()); } - if (!flow.halfpipes.empty() || - !flow.broadcast) { - auto& entry = m_decorations[DSIndex(data, source)]; - entry.m_type = &data; // Ensure correct type if instantiated here - - if (entry.satisfied) { - std::stringstream ss; - ss << "Cannot decorate this packet with type " << autowiring::demangle(*ptr) - << ", the requested decoration already exists"; - throw std::runtime_error(ss.str()); - } - if(entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot check out decoration of type " << autowiring::demangle(*ptr) - << ", it is already checked out elsewhere"; - throw std::runtime_error(ss.str()); - } - entry.isCheckedOut = true; - entry.m_decoration = *ptr; + if(entry.isCheckedOut) { + std::stringstream ss; + ss << "Cannot check out decoration of type " << autowiring::demangle(*ptr) + << ", it is already checked out elsewhere"; + throw std::runtime_error(ss.str()); } + entry.isCheckedOut = true; + entry.m_decoration = *ptr; } -void AutoPacket::UnsafeComplete(bool ready, const std::type_info& data, const std::type_info& source, - DecorationDisposition* &broadDeco, DecorationDisposition* &pipedDeco) { - autowiring::DataFlow flow = GetDataFlow(data, source); - if (flow.broadcast) { - broadDeco = &m_decorations[DSIndex(data, typeid(void))]; +void AutoPacket::UnsafeComplete(bool ready, const std::type_info& data, DecorationDisposition*& entry) { + entry = &m_decorations[data]; - assert(broadDeco->m_type != nullptr); // CompleteCheckout must be for an initialized DecorationDisposition - assert(broadDeco->isCheckedOut); // CompleteCheckout must follow Checkout + assert(entry->m_type != nullptr); // CompleteCheckout must be for an initialized DecorationDisposition + assert(entry->isCheckedOut); // CompleteCheckout must follow Checkout - if(!ready) - // Memory must be released, the checkout was cancelled - broadDeco->m_decoration->reset(); + if(!ready) + // Memory must be released, the checkout was cancelled + entry->m_decoration->reset(); - // Reset the checkout flag before releasing the lock: - broadDeco->isCheckedOut = false; - broadDeco->satisfied = true; - } - if (!flow.halfpipes.empty() || - !flow.broadcast) { - // IMPORTANT: If data isn't broadcast it should be provided with a source. - // This enables extraction of multiple types without collision. - pipedDeco = &m_decorations[DSIndex(data, source)]; - - assert(pipedDeco->m_type != nullptr); // CompleteCheckout must be for an initialized DecorationDisposition - assert(pipedDeco->isCheckedOut); // CompleteCheckout must follow Checkout - - if(!ready) - // Memory must be released, the checkout was cancelled - pipedDeco->m_decoration->reset(); - - // Reset the checkout flag before releasing the lock: - pipedDeco->isCheckedOut = false; - pipedDeco->satisfied = true; - } + // Reset the checkout flag before releasing the lock: + entry->isCheckedOut = false; + entry->satisfied = true; } -void AutoPacket::CompleteCheckout(bool ready, const std::type_info& data, const std::type_info& source) { - DecorationDisposition* broadDeco = nullptr; - DecorationDisposition* pipedDeco = nullptr; +void AutoPacket::CompleteCheckout(bool ready, const std::type_info& data) { + DecorationDisposition* entry = nullptr; { - std::lock_guard guard(m_lock); // This allows us to retrieve correct entries for decorated input requests - UnsafeComplete(ready, data, source, broadDeco, pipedDeco); + std::lock_guard guard(m_lock); + UnsafeComplete(ready, data, entry); } - if(ready) { - if (broadDeco) { - UpdateSatisfaction(broadDeco->m_decoration->type(), typeid(void)); - } - if (pipedDeco) { - // NOTE: Only publish with source if pipes are declared - this prevents - // added or snooping filters from satisfying piped input declarations. - UpdateSatisfaction(pipedDeco->m_decoration->type(), source); - } - } else { - if (broadDeco) - MarkUnsatisfiable(broadDeco->m_decoration->type(), typeid(void)); - if (pipedDeco) - MarkUnsatisfiable(pipedDeco->m_decoration->type(), source); - } + if(entry) + if(ready) + UpdateSatisfaction(entry->m_decoration->type()); + else + MarkUnsatisfiable(entry->m_decoration->type()); } void AutoPacket::ForwardAll(std::shared_ptr recipient) const { @@ -405,25 +291,18 @@ void AutoPacket::ForwardAll(std::shared_ptr recipient) const { if (!decoration.second.satisfied) continue; - // Only broadcast data is propagated - const std::type_info& source(typeid(void)); - if (std::get<1>(decoration.first) != source) - continue; - const std::type_info& data = *decoration.second.m_type; // Quietly drop data that is already present on recipient - if (recipient->UnsafeHas(data, typeid(void))) + if (recipient->UnsafeHas(data)) continue; AnySharedPointer any_ptr(decoration.second.m_decoration); - recipient->UnsafeCheckout(&any_ptr, data, source); - - DecorationDisposition* broadDeco = nullptr; - DecorationDisposition* pipedDeco = nullptr; - recipient->UnsafeComplete(true, data, source, broadDeco, pipedDeco); + recipient->UnsafeCheckout(&any_ptr, data); - decoQueue.push_back(broadDeco); + DecorationDisposition* entry = nullptr; + recipient->UnsafeComplete(true, data, entry); + decoQueue.push_back(entry); } m_lock.unlock(); @@ -433,33 +312,8 @@ void AutoPacket::ForwardAll(std::shared_ptr recipient) const { // Recipient satisfaction is updated outside of lock for (DecorationDisposition* broadDeco : decoQueue) { // Satisfy the base declaration first and then the shared pointer: - recipient->UpdateSatisfaction(broadDeco->m_decoration->type(), typeid(void)); - } -} - -DataFlow AutoPacket::GetDataFlow(const DecorationDisposition& entry) const { - DataFlow flow; //DEFAULT: No broadcast, no pipes - if (!entry.m_publisher) { - // Broadcast is always true for added or snooping recipients - flow.broadcast = true; - } else { - flow = entry.m_publisher->GetDataFlow(entry.m_type); - } - return flow; -} - -DataFlow AutoPacket::GetDataFlow(const std::type_info& data, const std::type_info& source) { - DataFlow flow; //DEFAULT: No pipes - flow.broadcast = true; //DEFAULT: Broadcast data from anonymous sources - size_t sat_ind = 0; - for (auto& sat : m_satCounters) { - if (sat_ind > m_subscriberNum) - break; - if (&source == sat.GetAutoFilterTypeInfo()) - flow = sat.GetDataFlow(&data); - ++sat_ind; + recipient->UpdateSatisfaction(broadDeco->m_decoration->type()); } - return flow; } void AutoPacket::Reset(void) { @@ -578,10 +432,10 @@ SatCounter AutoPacket::GetSatisfaction(const std::type_info& subscriber) const { return SatCounter(); } -std::list AutoPacket::GetSubscribers(const std::type_info& data, const std::type_info& source) const { +std::list AutoPacket::GetSubscribers(const std::type_info& data) const { std::lock_guard lk(m_lock); std::list subscribers; - t_decorationMap::const_iterator decoration = m_decorations.find(DSIndex(data, source)); + t_decorationMap::const_iterator decoration = m_decorations.find(data); if (decoration != m_decorations.end()) for (auto& subscriber : decoration->second.m_subscribers) subscribers.push_back(*subscriber.first); @@ -597,7 +451,7 @@ std::list AutoPacket::GetDispositions(const std::type_inf return dispositions; } -bool AutoPacket::HasSubscribers(const std::type_info& data, const std::type_info& source) const { +bool AutoPacket::HasSubscribers(const std::type_info& data) const { std::lock_guard lk(m_lock); - return m_decorations.count(DSIndex(data, source)) != 0; + return m_decorations.count(data) != 0; } diff --git a/src/autowiring/AutoPacketFactory.cpp b/src/autowiring/AutoPacketFactory.cpp index 005c12481..dcf95cb01 100644 --- a/src/autowiring/AutoPacketFactory.cpp +++ b/src/autowiring/AutoPacketFactory.cpp @@ -134,217 +134,6 @@ AutoFilterDescriptor AutoPacketFactory::GetTypeDescriptorUnsafe(const std::type_ return AutoFilterDescriptor(); } -void AutoPacketFactory::BroadcastOneDataOut(const std::type_info* nodeType, const std::type_info* dataType, bool enable) { - { - if (IsAutoPacketType(*dataType)) { - // AutoPacket is always broacast to the entire context - return; - } - - std::lock_guard guard(m_lock); - - // Find and copy the AutoFilterDescriptor instance. - AutoFilterDescriptor update = GetTypeDescriptorUnsafe(nodeType); - if (!update.GetAutoFilterTypeInfo()) - return; - - const AutoFilterDescriptorInput* argDescriptor = update.GetArgumentType(dataType); - if (!argDescriptor || - !argDescriptor->is_output) { - std::stringstream ss; - ss << "Attempted to transmit broadcasts of a type " << dataType->name() - << " that is not an output of " << nodeType->name(); - throw std::runtime_error(ss.str()); - } - - // Extract, modify and insert the broadcast state - m_autoFilters.erase(update); - update.Broadcast(dataType, enable); - m_autoFilters.insert(update); - } - Invalidate(); -} - -void AutoPacketFactory::BroadcastAllDataOut(const std::type_info* nodeType, bool enable) { - { - std::lock_guard guard(m_lock); - - // Find and copy the AutoFilterDescriptor instance. - AutoFilterDescriptor update = GetTypeDescriptorUnsafe(nodeType); - if (!update.GetAutoFilterTypeInfo()) - return; - - // Extract, modify and insert the broadcast state - m_autoFilters.erase(update); - // All input data types accept broadcasts - // NOTE: Iteration is over a static array terminated with nullptr - for (const AutoFilterDescriptorInput* pArg = update.GetAutoFilterInput(); *pArg; ++pArg) { - if (pArg->is_output) - update.Broadcast(pArg->ti, enable); - } - m_autoFilters.insert(update); - } - Invalidate(); -} - -void AutoPacketFactory::BroadcastOneDataIn(const std::type_info* nodeType, const std::type_info* dataType, bool enable) { - { - if (IsAutoPacketType(*dataType)) { - // AutoPacket is always broacast to the entire context - return; - } - - std::lock_guard guard(m_lock); - - // Find and copy the AutoFilterDescriptor instance. - AutoFilterDescriptor update = GetTypeDescriptorUnsafe(nodeType); - if (!update.GetAutoFilterTypeInfo()) - return; - - const AutoFilterDescriptorInput* argDescriptor = update.GetArgumentType(dataType); - if (!argDescriptor || - !argDescriptor->is_input) { - std::stringstream ss; - ss << "Attempted to receive broadcasts of a type " << dataType->name() - << " that is not an input to " << nodeType->name(); - throw std::runtime_error(ss.str()); - } - - // Extract, modify and insert the broadcast state - m_autoFilters.erase(update); - update.Broadcast(dataType, enable); - m_autoFilters.insert(update); - } - Invalidate(); -} - -void AutoPacketFactory::BroadcastAllDataIn(const std::type_info* nodeType, bool enable) { - { - std::lock_guard guard(m_lock); - - // Find and copy the AutoFilterDescriptor instance. - AutoFilterDescriptor update = GetTypeDescriptorUnsafe(nodeType); - if (!update.GetAutoFilterTypeInfo()) - return; - - // Extract, modify and insert the broadcast state - m_autoFilters.erase(update); - // All input data types accept broadcasts - // NOTE: Iteration is over a static array terminated with nullptr - for (const AutoFilterDescriptorInput* pArg = update.GetAutoFilterInput(); *pArg; ++pArg) { - if (pArg->is_input && - !IsAutoPacketType(*pArg->ti)) - update.Broadcast(pArg->ti, enable); - } - m_autoFilters.insert(update); - } - Invalidate(); -} - -void AutoPacketFactory::PipeOneData(const std::type_info* nodeOutType, const std::type_info* nodeInType, const std::type_info* dataType, bool enable) { - if (IsAutoPacketType(*dataType)) { - // AutoPacket is always broacast to the entire context - return; - } - - { - std::lock_guard guard(m_lock); - - // Find and copy both AutoFilterDescriptor instances. - AutoFilterDescriptor updateOut = GetTypeDescriptorUnsafe(nodeOutType); - AutoFilterDescriptor updateIn = GetTypeDescriptorUnsafe(nodeInType); - if (!updateOut.GetAutoFilterTypeInfo() || - !updateIn.GetAutoFilterTypeInfo()) - return; - - // Check for AutoPacket& (or const AutoPacket&) arguments - bool allOut = - !!updateOut.GetArgumentType(&typeid(auto_arg::id_type)); - bool allIn = - updateIn.GetArgumentType(&typeid(auto_arg::id_type)) || - updateIn.GetArgumentType(&typeid(auto_arg::id_type)); - - // Find both data types - const AutoFilterDescriptorInput* argOutDescriptor = updateOut.GetArgumentType(dataType); - const AutoFilterDescriptorInput* argInDescriptor = updateIn.GetArgumentType(dataType); - if (!(allOut || (argOutDescriptor && argOutDescriptor->is_output)) || - !(allIn || (argInDescriptor && argInDescriptor->is_input))) { - std::stringstream ss; - ss << "Attempted to pipe data of a type " << dataType->name() - << " that is not an ouput of " << nodeOutType->name() - << " and an input to " << nodeInType->name(); - throw std::runtime_error(ss.str()); - } - - // Extract, modify and insert the half-pipes - m_autoFilters.erase(updateOut); - m_autoFilters.erase(updateIn); - updateOut.HalfPipe(dataType, nodeInType, enable); - updateIn.HalfPipe(dataType, nodeOutType, enable); - m_autoFilters.insert(updateOut); - m_autoFilters.insert(updateIn); - } - Invalidate(); -} - -void AutoPacketFactory::PipeAllData(const std::type_info* nodeOutType, const std::type_info* nodeInType, bool enable) { - { - std::lock_guard guard(m_lock); - - // Find and copy both AutoFilterDescriptor instances. - AutoFilterDescriptor updateOut = GetTypeDescriptorUnsafe(nodeOutType); - AutoFilterDescriptor updateIn = GetTypeDescriptorUnsafe(nodeInType); - if (!updateOut.GetAutoFilterTypeInfo() || - !updateIn.GetAutoFilterTypeInfo()) - return; - - // Check for AutoPacket& (or const AutoPacket&) arguments - bool allOut = - !!updateOut.GetArgumentType(&typeid(auto_arg::id_type)); - bool allIn = - updateIn.GetArgumentType(&typeid(auto_arg::id_type)) || - updateIn.GetArgumentType(&typeid(auto_arg::id_type)); - - // List all correctly oriented arguments - std::unordered_set dataOutTypes; - std::unordered_set dataInTypes; - for (const AutoFilterDescriptorInput* pArg = updateOut.GetAutoFilterInput(); *pArg; ++pArg) { - if (IsAutoPacketType(*pArg->ti)) - continue; - if (allOut || pArg->is_output) { - dataOutTypes.insert(pArg->ti); - if (allIn) - dataInTypes.insert(pArg->ti); - } - } - - for (const AutoFilterDescriptorInput* pArg = updateIn.GetAutoFilterInput(); *pArg; ++pArg) { - if (IsAutoPacketType(*pArg->ti)) - continue; - if (allIn || pArg->is_input) { - // Include only output types - if (allOut || - dataOutTypes.find(pArg->ti) != dataOutTypes.end()) { - dataInTypes.insert(pArg->ti); - if (allOut) - dataInTypes.insert(pArg->ti); - } - } - } - - // Extract, modify and insert the half-pipes - m_autoFilters.erase(updateOut); - m_autoFilters.erase(updateIn); - for (const std::type_info* dataType : dataInTypes) { - updateOut.HalfPipe(dataType, nodeInType, enable); - updateIn.HalfPipe(dataType, nodeOutType, enable); - } - m_autoFilters.insert(updateOut); - m_autoFilters.insert(updateIn); - } - Invalidate(); -} - size_t AutoPacketFactory::GetOutstanding(void) const { return m_packets.GetOutstanding(); } diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index bfae8e3c6..e9ab31dd5 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -33,7 +33,6 @@ set(Autowiring_SRCS AutoFilterDescriptor.h AutoInjectable.h AutoInjectable.cpp - AutoMerge.h AutoPacket.h AutoPacket.cpp AutoPacketFactory.h @@ -41,7 +40,6 @@ set(Autowiring_SRCS AutoPacketProfiler.h AutoPacketProfiler.cpp AutoSelfUpdate.h - AutoStile.h AutoTimeStamp.h Autowired.h Autowired.cpp @@ -82,7 +80,6 @@ set(Autowiring_SRCS CreationRules.h CurrentContextPusher.cpp CurrentContextPusher.h - DataFlow.h DeclareAutoFilter.h DeclareElseFilter.h Decompose.h diff --git a/src/autowiring/test/ArgumentTypeTest.cpp b/src/autowiring/test/ArgumentTypeTest.cpp index 72f2b7bdb..b712409a0 100644 --- a/src/autowiring/test/ArgumentTypeTest.cpp +++ b/src/autowiring/test/ArgumentTypeTest.cpp @@ -79,7 +79,7 @@ TEST_F(ArgumentTypeTest, TestAutoIn) { AutoRequired factory; std::shared_ptr packet = factory->NewPacket(); packet->Decorate(Argument<0>(1)); - auto_in> in(packet, typeid(void)); + auto_in> in(packet); ASSERT_TRUE(in.is_input) << "Incorrect orientation"; ASSERT_FALSE(in.is_output) << "Incorrect orientation"; ASSERT_EQ(1, in->i) << "Incorrect initialization"; @@ -105,7 +105,7 @@ TEST_F(ArgumentTypeTest, TestAutoOut) { AutoRequired factory; std::shared_ptr packet = factory->NewPacket(); { - auto_out> out(packet, typeid(void)); + auto_out> out(packet); ASSERT_FALSE(out.is_input) << "Incorrect orientation"; ASSERT_TRUE(out.is_output) << "Incorrect orientation"; @@ -116,7 +116,7 @@ TEST_F(ArgumentTypeTest, TestAutoOut) { auto_out> out1(std::move(out)); // Assign by move - auto_out> out2(packet, typeid(void)); + auto_out> out2(packet); out2 = std::move(out1); } diff --git a/src/autowiring/test/AutoFilterPipeTest.cpp b/src/autowiring/test/AutoFilterPipeTest.cpp deleted file mode 100644 index 8970e4066..000000000 --- a/src/autowiring/test/AutoFilterPipeTest.cpp +++ /dev/null @@ -1,436 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#include "stdafx.h" -#include "TestFixtures/Decoration.hpp" -#include -#include -#include -#include - -class AutoFilterPipeTest: - public testing::Test -{ -public: - AutoFilterPipeTest(void) { - AutoCurrentContext()->Initiate(); - } -}; - - -class FilterDiamondIn: - public ContextMember -{ -public: - int m_called; - FilterDiamondIn(void) : m_called(0) {} - void AutoFilter(auto_out> init) { - ++m_called; - init->i = 1; - } -}; - -class FilterDiamondA: - public ContextMember -{ -public: - int m_called; - FilterDiamondA(void) : m_called(0) {} - void AutoFilter(const Decoration<0>& in, auto_out> out) { - ++m_called; - out->i = 2; - } -}; - -class FilterDiamondB: - public ContextMember -{ -public: - int m_called; - FilterDiamondB(void) : m_called(0) {} - void AutoFilter(const Decoration<0>& in, auto_out> out) { - ++m_called; - out->i = 3; - } -}; - -class FilterDiamondOut: - public ContextMember -{ -public: - int m_called; - Decoration<1> m_inLast; - FilterDiamondOut(void) : m_called(0) {} - void AutoFilter(const Decoration<1>& in) { - ++m_called; - m_inLast = in; - } -}; - -class DiamondFilter: - public ContextMember -{ -public: - DiamondFilter() { - Reset(); - } - - void Reset() { - In->m_called = 0; - A->m_called = 0; - B->m_called = 0; - Out->m_called = 0; - In_expected = 0; - A_expected = 0; - B_expected = 0; - Out_expected = 0; - } - - void Verify() { - ASSERT_EQ(In_expected, In->m_called) << "Diamond Filter I called " << In->m_called << " expected " << In_expected; - ASSERT_EQ(A_expected, A->m_called) << "Diamond Filter A called " << A->m_called << " expected " << A_expected; - ASSERT_EQ(B_expected, B->m_called) << "Diamond Filter B called " << B->m_called << " expected " << B_expected; - ASSERT_EQ(Out_expected, Out->m_called) << "Diamond Filter O called " << Out->m_called << " expected " << Out_expected; - } - - AutoRequired In; - AutoRequired A; - AutoRequired B; - AutoRequired Out; - - int In_expected; - int A_expected; - int B_expected; - int Out_expected; -}; - -TEST_F(AutoFilterPipeTest, DataPipeTest) { - AutoCurrentContext()->Initiate(); - AutoRequired factory; - DiamondFilter diamond; - - //Diamond configuration will throw on creation of the packet, preventing any calls - ASSERT_THROW(factory->NewPacket(), std::runtime_error) << "Failed to anticipate broadcast collision"; - diamond.Verify(); - diamond.Reset(); - - //Incorrect pipe declarations will throw - ASSERT_THROW(factory->BroadcastDataIn(&typeid(Decoration<1>),false), std::runtime_error) << "Failed to throw missing type"; - ASSERT_THROW(factory->BroadcastDataIn(&typeid(Decoration<1>),false), std::runtime_error) << "Failed to throw incorrect orientation"; - - //Permit DiamondA to use pipes only, which will prevent data collision, even though all filters are called. - factory->BroadcastDataOut(&typeid(Decoration<1>),false); - ASSERT_NO_THROW(factory->NewPacket()) << "Incorrect data collision"; - ++diamond.In_expected; - ++diamond.A_expected; - ++diamond.B_expected; - ++diamond.Out_expected; - diamond.Verify(); - diamond.Reset(); - - //Permit DiamondIn to use pipes only, which will prevent data propagation - factory->BroadcastDataOut(&typeid(Decoration<0>),false); - factory->NewPacket(); - ++diamond.In_expected; - diamond.Verify(); - diamond.Reset(); - - //Connect DiamondIn to DiamondA - factory->PipeData(&typeid(Decoration<0>)); - factory->NewPacket(); - ++diamond.In_expected; - ++diamond.A_expected; - diamond.Verify(); - diamond.Reset(); - - //Connect DiamondA to DiamondOut, which will cause a collision - //PROBLEM: Exception is thrown, but termination in ~AutoCheckout is not caught - /* - factory->PipeData(); //Pipe all correctly oriented types - factory->PipeData(); //Pipe all correctly oriented types - ASSERT_THROW(factory->NewPacket(), std::runtime_error) << "Data failed to collide"; - */ -} - -template -class FilterOD0 { -public: - void AutoFilter(auto_out> out) { - out->i = num; - } -}; - -class FilterID0 { -public: - void AutoFilter(const Decoration<0>& in) {} -}; - -TEST_F(AutoFilterPipeTest, DISABLED_VerifyMergedOutputs) { - AutoRequired factory; - - AutoRequired> f0D0_broadcast; - AutoRequired> f1D0_pipe_merge; - AutoRequired> f1D0_pipe_fID0; - AutoRequired fID0_pipe_f2D0; - - AutoRequired>> merge; - - // Configure Data Flow - factory->BroadcastDataIn(nullptr, false); - factory->BroadcastDataOut>(nullptr, false); - factory->BroadcastDataOut>(nullptr, false); - factory->PipeData, AutoMerge>>(); - factory->PipeData, FilterID0>(); - // Resulting Flow: - // f0D0 is broadcast, and will be received by merge - // f1D0 -> merge only - // f2D0 -> fID0 only - - AutoMerge>::merge_data extracted; - { - std::shared_ptr packet; - ASSERT_NO_THROW(packet = factory->NewPacket()) << "Multi-Decorate hit an exception"; - packet->Decorate(AutoMerge>::merge_call([&extracted](const AutoMerge>::merge_data& data) { - extracted = data; - })); - - const Decoration<0>* dec0; - ASSERT_TRUE(packet->Get(dec0)) << "Broadcast data should be present"; - ASSERT_EQ(dec0->i, 0) << "Incorrect value for broadcast data"; - ASSERT_FALSE(packet->Get(dec0, typeid(SelectTypeUnifier>::type))) << "Sourced data should be absent from broadcasting source"; - ASSERT_TRUE(packet->Get(dec0, typeid(SelectTypeUnifier>::type))) << "Sourced data should be present from non-broadcasting source"; - ASSERT_EQ(dec0->i, 1) << "Incorrect value for piped data"; - ASSERT_TRUE(packet->Get(dec0, typeid(SelectTypeUnifier>::type))) << "Sourced data should be present from non-broadcasting source"; - ASSERT_EQ(dec0->i, 2) << "Incorrect value for piped data"; - - // Final-Call methods - ASSERT_EQ(1, packet->HasAll>()) << "Single Broadcast source only"; - ASSERT_EQ(1, packet->HasAll>(typeid(SelectTypeUnifier>>::type))) << "Single Piped source only"; - ASSERT_EQ(1, packet->HasAll>(typeid(SelectTypeUnifier::type))) << "Single Piped source only"; - } - ASSERT_EQ(2, extracted.size()) << "Should collect 1 broadcast & 1 pipe"; -} - -TEST_F(AutoFilterPipeTest, VerifyForwardAll) { - const std::shared_ptr>* contents = nullptr; - AutoRequired factory; - std::shared_ptr toPacket = factory->NewPacket(); - { - std::shared_ptr fromPacket = factory->NewPacket(); - fromPacket->Decorate(Decoration<0>(1)); - contents = nullptr; //contents does not own referenced data - ASSERT_TRUE(fromPacket->Get(contents)) << "ForwardedAll failed to move data"; - ASSERT_EQ(1, (*contents)->i) << "ForwardedAll failed to move data"; - - fromPacket->ForwardAll(toPacket); - contents = nullptr; //contents does not own referenced data - ASSERT_TRUE(toPacket->Get(contents)) << "ForwardedAll failed to move data"; - ASSERT_EQ(1, (*contents)->i) << "ForwardedAll failed to move data"; - } - contents = nullptr; //contents does not own referenced data - ASSERT_TRUE(toPacket->Get(contents)) << "Forwarded data is not persistent"; - ASSERT_EQ(1, (*contents)->i) << "Forwarded data is not persistent"; -} - -class JunctionDeferred01: - public CoreThread -{ -public: - Deferred AutoFilter(const Decoration<0>& in, auto_out> out) { - // Wait for AutoStile method to exit - AutoCurrentContext()->Wait(std::chrono::milliseconds(10)); - - out->i = in.i; - return Deferred(this); - } -}; - -class SlaveContext {}; -class MasterContext {}; - -TEST_F(AutoFilterPipeTest, VerifyContextStile) { - // Stile injects Decoration<0> and extracts Decoration<1> - typedef AutoStile< - const Decoration<0>&, - auto_out>, - auto_out> - > test_stile; - std::shared_ptr stile; - std::shared_ptr master_factory; - - AutoCreateContextT slave_context; - { - CurrentContextPusher pusher(slave_context); - AutoRequired(); - AutoRequired(); - slave_context->Initiate(); - } - - AutoCreateContextT master_context; - { - CurrentContextPusher pusher(master_context); - master_factory = AutoRequired(); - stile = AutoRequired(); - master_context->Initiate(); - } - - stile->Leash(slave_context); - { - CurrentContextPusher pusher(master_context); - std::shared_ptr master_packet; - master_packet = master_factory->NewPacket(); - int init = -1; - master_packet->Decorate(Decoration<0>(init)); - - // Create a last-call so that completion of slave context - // is verified. - master_packet->AddRecipient(std::function([init](const AutoPacket& master_final){ - const Decoration<1>* out1; - ASSERT_TRUE(master_final.Get(out1)) << "Stile failed to send & retrieve data"; - ASSERT_EQ(init, out1->i) << "Output was not from junction in slave context"; - const Decoration<2>* out2; - ASSERT_FALSE(master_final.Get(out2)) << "Decoration<2> was not produced in slave context"; - })); - } -} - -class Junction01 { -public: - void AutoFilter(const Decoration<0>& in, auto_out> out) { - out->i = in.i; - } -}; - -TEST_F(AutoFilterPipeTest, VerifyStileExtractAll) { - // Stile injects Decoration<0> and extracts Decoration<1> - std::shared_ptr&>> stile; - std::shared_ptr master_factory; - - AutoCreateContextT slave_context; - { - CurrentContextPusher pusher(slave_context); - AutoRequired(); - AutoRequired(); - slave_context->Initiate(); - } - - AutoCreateContextT master_context; - { - CurrentContextPusher pusher(master_context); - master_factory = AutoRequired(); - stile = AutoRequired&>>(); - master_context->Initiate(); - } - - stile->Leash(slave_context); - { - CurrentContextPusher pusher(master_context); - std::shared_ptr master_packet; - master_packet = master_factory->NewPacket(); - master_packet->Decorate(Decoration<0>()); - ASSERT_TRUE(master_packet->Has>()) << "Stile failed to send & retrieve data"; - } -} - -TEST_F(AutoFilterPipeTest, DISABLED_ExtractMergedData) { - std::shared_ptr>::merge_call&>> stile; - std::shared_ptr master_factory; - - AutoCreateContextT slave_context; - { - CurrentContextPusher pusher(slave_context); - - AutoRequired(); - AutoRequired> f0D0; - AutoRequired> f1D0; - - slave_context->Initiate(); - } - - AutoCreateContextT master_context; - { - CurrentContextPusher pusher(master_context); - - master_factory = AutoRequired(); - stile = AutoRequired>::merge_call&>>(); - AutoConstruct>> merge(*slave_context); - - merge->GetMerge()->PipeToMerge>(); - merge->GetMerge()->PipeToMerge>(); - - master_context->Initiate(); - } - - stile->Leash(slave_context); - { - CurrentContextPusher pusher(master_context); - std::shared_ptr master_packet; - master_packet = master_factory->NewPacket(); - master_packet->Decorate(Decoration<0>()); - const AutoMergeStile>::merge_data* data = nullptr; - ASSERT_TRUE(master_packet->Get(data)) << "Stile failed to send & retrieve data"; - ASSERT_EQ(2, data->size()) << "Merge failed to gather all data"; - } -} - - -template -class FilterGatherAutoOut { -public: - FilterGatherAutoOut() : - FilterGather_AutoGather(this, &FilterGatherAutoOut::AutoGather), - m_called_out(0), - m_called_in(0), - m_out(out), - m_in(in) - {} - - void AutoFilter(auto_out> output) { - ++m_called_out; - output->i = m_out; - } - - NewAutoFilter FilterGather_AutoGather; - void AutoGather(const Decoration& input) { - ++m_called_in; - m_in = input.i; - } - - int m_called_out; - int m_called_in; - int m_out; - int m_in; -}; - -TEST_F(AutoFilterPipeTest, VerifyTwoAutoFilterCallsAutoOut) { - AutoRequired factory; - AutoRequired> zero2one; - AutoRequired> one2zero; - zero2one->m_out = 3; - one2zero->m_out = 4; - - //Verify that calls made on allocation from object pool do not introduce a race condition - { - std::shared_ptr packet = factory->NewPacket(); - ASSERT_EQ(1, zero2one->m_called_out) << "AutoFilter with auto_out as only argument was called " << zero2one->m_called_out << " times"; - ASSERT_EQ(1, zero2one->m_called_in) << "AutoFilter of implicitly decorated type was called " << zero2one->m_called_in << " times"; - ASSERT_EQ(4, zero2one->m_in) << "AutoFilter received incorrect input of " << zero2one->m_in; - ASSERT_EQ(1, one2zero->m_called_out) << "AutoFilter with auto_out as only argument was called " << one2zero->m_called_out << " times"; - ASSERT_EQ(1, one2zero->m_called_in) << "AutoFilter of implicitly decorated type was called " << one2zero->m_called_in << " times"; - ASSERT_EQ(3, one2zero->m_in) << "AutoFilter received incorrect input of " << one2zero->m_in; - zero2one->m_out = 5; - one2zero->m_out = 6; - } - //Verify that no additional calls are made during return of packet to object pool - ASSERT_EQ(1, zero2one->m_called_out) << "AutoFilter with auto_out as only argument was called " << zero2one->m_called_out << " times"; - ASSERT_EQ(1, zero2one->m_called_in) << "AutoFilter of implicitly decorated type was called " << zero2one->m_called_in << " times"; - ASSERT_EQ(4, zero2one->m_in) << "AutoFilter received incorrect input of " << zero2one->m_in; - ASSERT_EQ(1, one2zero->m_called_out) << "AutoFilter with auto_out as only argument was called " << one2zero->m_called_out << " times"; - ASSERT_EQ(1, one2zero->m_called_in) << "AutoFilter of implicitly decorated type was called " << one2zero->m_called_in << " times"; - ASSERT_EQ(3, one2zero->m_in) << "AutoFilter received incorrect input of " << one2zero->m_in; -} - -TEST_F(AutoFilterPipeTest, EmptyTupleHash) { - std::tuple<> empty; - std::hash> hasher; - size_t foo = hasher(empty); - ASSERT_EQ(foo, 0); -} diff --git a/src/autowiring/test/AutoFilterSequencing.cpp b/src/autowiring/test/AutoFilterSequencing.cpp index 291756617..563b75b44 100644 --- a/src/autowiring/test/AutoFilterSequencing.cpp +++ b/src/autowiring/test/AutoFilterSequencing.cpp @@ -2,8 +2,6 @@ #include "stdafx.h" #include "TestFixtures/Decoration.hpp" #include -#include -#include #include #include diff --git a/src/autowiring/test/AutoFilterTest.cpp b/src/autowiring/test/AutoFilterTest.cpp index 29cd390b2..e66a9a4a5 100644 --- a/src/autowiring/test/AutoFilterTest.cpp +++ b/src/autowiring/test/AutoFilterTest.cpp @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include THREAD_HEADER class AutoFilterTest: diff --git a/src/autowiring/test/CMakeLists.txt b/src/autowiring/test/CMakeLists.txt index 3617d502e..4096e71b1 100644 --- a/src/autowiring/test/CMakeLists.txt +++ b/src/autowiring/test/CMakeLists.txt @@ -60,7 +60,6 @@ set(AutowiringTest_SRCS if(autowiring_USE_LIBCXX) set(AutowiringTest_SRCS ${AutowiringTest_SRCS} AutoFilterFunctionTest.cpp - AutoFilterPipeTest.cpp AutoFilterSequencing.cpp AutoFilterTest.cpp ) diff --git a/src/autowiring/test/DecoratorTest.cpp b/src/autowiring/test/DecoratorTest.cpp index 67ded95e2..8ac72ebc1 100644 --- a/src/autowiring/test/DecoratorTest.cpp +++ b/src/autowiring/test/DecoratorTest.cpp @@ -88,7 +88,6 @@ TEST_F(DecoratorTest, VerifyDecoratorAwareness) { // Verify the second one does: auto sat = packet2->GetSatisfaction(typeid(FilterA)); EXPECT_NE(nullptr, sat.GetType()) << "Packet lacked an expected subscription"; - EXPECT_TRUE(sat.IsInput(typeid(Decoration<0>),typeid(void))) << "Incorrect input test"; auto subs = packet2->GetSubscribers(typeid(Decoration<0>)); EXPECT_EQ(1UL, subs.size()) << "Incorrect subscriber count"; auto disps = packet2->GetDispositions(typeid(Decoration<0>)); From 12ba1b82223c6e8a8230333a24e79658190eb5f1 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 3 Dec 2014 08:51:33 -0800 Subject: [PATCH 057/140] Simplification of AutoPacket::Put --- autowiring/AutoPacket.h | 44 ++++++++++------------------------- src/autowiring/AutoPacket.cpp | 18 ++++++++++++++ 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 7a4ed69ab..6149c5c00 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -280,27 +280,22 @@ class AutoPacket: return false; } + /// + /// De-templated placement method + /// + void Put(AnySharedPointer&& in); + /// /// Transfers ownership of argument to AutoPacket /// + /// + /// This method may throw an exception. Ownership is unconditionally transferred to this class + /// even in the event an exception is thrown, thus the passed pointer is guaranteed to be cleaned + /// up properly in all cases. + /// template void Put(T* in) { - const std::type_info& data = typeid(T); - - auto& entry = m_decorations[data]; - if (entry.satisfied || entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot put type " << autowiring::demangle(typeid(T)) - << " on AutoPacket, the requested broadcast already exists"; - throw std::runtime_error(ss.str()); - } - - entry.m_decoration = std::shared_ptr(in); - entry.m_type = &data; // Ensure correct type if instantiated here - entry.satisfied = true; - entry.isCheckedOut = false; - - UpdateSatisfaction(data); + Put(AnySharedPointer(std::shared_ptr(in))); } /// @@ -314,22 +309,7 @@ class AutoPacket: /// template void Put(std::shared_ptr in) { - const std::type_info& data = typeid(T); - - auto& entry = m_decorations[data]; - if (entry.satisfied || entry.isCheckedOut) { - std::stringstream ss; - ss << "Cannot put type " << autowiring::demangle(typeid(T)) - << " on AutoPacket, the requested broadcast already exists"; - throw std::runtime_error(ss.str()); - } - - entry.m_decoration = in; - entry.m_type = &data; // Ensure correct type if instantiated here - entry.satisfied = true; - entry.isCheckedOut = false; - - UpdateSatisfaction(data); + Put(AnySharedPointer(std::move(in))); } /// Shares all broadcast data from this packet with the recipient packet diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index d87a58549..80f33082f 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -271,6 +271,24 @@ void AutoPacket::CompleteCheckout(bool ready, const std::type_info& data) { MarkUnsatisfiable(entry->m_decoration->type()); } +void AutoPacket::Put(AnySharedPointer&& in) { + const std::type_info& ti = in->type(); + auto& entry = m_decorations[ti]; + if(entry.satisfied || entry.isCheckedOut) { + std::stringstream ss; + ss << "Cannot put type " << autowiring::demangle(in->type()) + << " on AutoPacket, the requested broadcast already exists"; + throw std::runtime_error(ss.str()); + } + + entry.m_decoration = std::move(in); + entry.m_type = &ti; + entry.satisfied = true; + entry.isCheckedOut = false; + + UpdateSatisfaction(ti); +} + void AutoPacket::ForwardAll(std::shared_ptr recipient) const { std::list decoQueue; { From 4e2c3d205b1ccec8bec23c26b4e0445179cf4853 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 3 Dec 2014 10:59:02 -0800 Subject: [PATCH 058/140] Adding a -> operator overload to AutoConfig --- autowiring/AutoConfig.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 76c48cedc..f34b1b496 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -71,6 +71,10 @@ class AutoConfig: return operator const T&(); } + const T* operator->(void) const { + return m_manager->Get(m_key)->template as().get(); + } + /// /// True if this configurable field has been satisfied with a value /// From f23bf1309ae4e97d64eec8ee7abf26dc7013392d Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 3 Dec 2014 10:56:05 -0800 Subject: [PATCH 059/140] Adding a non-serializable countercase --- src/autowiring/test/AutoConfigTest.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index cdf556436..937959039 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -138,4 +138,26 @@ TEST_F(AutoConfigTest, ExtractKeyTestWin) { "Namespace1.XYZ", autowiring::ExtractKeyWin(win).c_str() ) << "Windows key extraction implementation mismatch"; +} + +class TypeWithoutAShiftOperator { +public: + int foo; +}; + +TEST_F(AutoConfigTest, TypeWithoutAShiftOperatorTest) { + AutoConfig taso; + + AutoCurrentContext ctxt; + AutoRequired mgr; + + // Indirect assignment should cause an exception + ASSERT_ANY_THROW(mgr->Set("MyValue", "")) << "Expected a throw in a case where a configurable value was used which cannot be assigned"; + + // Direct assignment should be supported still + TypeWithoutAShiftOperator tasoVal; + tasoVal.foo = 592; + mgr->Set("MyValue", tasoVal); + + ASSERT_EQ(592, taso->foo) << "Value assignment did not result in an update to a non-serializable configuration field"; } \ No newline at end of file From b9422388bc6e40d9cbbb9692683c3a6dd67971ae Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 3 Dec 2014 15:48:44 -0800 Subject: [PATCH 060/140] Correctly handle non stream types --- autowiring/ConfigRegistry.h | 35 ++++++++++++++++++++++++-- src/autowiring/AutoConfigManager.cpp | 12 ++++----- src/autowiring/test/AutoConfigTest.cpp | 13 ++++++---- 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 050c67b4a..906358b1c 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -23,6 +23,23 @@ struct ConfigRegistryEntry { virtual AnySharedPointer parse(const std::string&) const = 0; }; +template +struct has_stream { + template + static auto select(std::istream* is, U* u) -> decltype(*is >> *u); + + template + static void select(...); + + static const bool value = !std::is_same(nullptr, nullptr))>::value; +}; + +template +static auto select(std::istream& is, U u) -> decltype(is >> u) { + is >> u; + return is; +} + template struct ConfigRegistryEntryT: public ConfigRegistryEntry @@ -31,11 +48,18 @@ struct ConfigRegistryEntryT: ConfigRegistryEntry(typeid(Key)) {} - bool verifyType(const std::type_info& ti) const { + bool verifyType(const std::type_info& ti) const override { return typeid(T) == ti; } - AnySharedPointer parse(const std::string& str) const { + AnySharedPointer parse(const std::string& str) const override { + return parseInternal(str); + } + + // Only use if there is a stream operator + template + typename std::enable_if::value, AnySharedPointer>::type + parseInternal(const std::string& str) const { std::istringstream ss(str); T val; ss >> std::boolalpha >> val; @@ -48,6 +72,13 @@ struct ConfigRegistryEntryT: } return AnySharedPointer(std::make_shared(val)); } + + template + typename std::enable_if::value, AnySharedPointer>::type + parseInternal(const std::string&) const { + throw autowiring_error("This type doesn't support stream conversions.\ + Define one if you want this to be parsable"); + }; }; extern const ConfigRegistryEntry* g_pFirstConfigEntry; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 89e0e81a6..b2f4635ec 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -75,13 +75,11 @@ void AutoConfigManager::Set(const std::string& key, const char* value) { bool AutoConfigManager::SetParsed(const std::string& key, const std::string& value) { std::lock_guard lk(m_lock); - for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { - if (config->is(key)){ - m_attributes[key] = config->parse(value); - return true; - } + // Key not found + if (!m_registry.count(key)) { + return false; } - // Key not found - return false; + m_attributes[key] = m_registry.at(key)->parse(value); + return true; } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 937959039..7ef87d828 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -145,19 +145,22 @@ class TypeWithoutAShiftOperator { int foo; }; +struct NoShift { + AutoConfig m_noshift; +}; + TEST_F(AutoConfigTest, TypeWithoutAShiftOperatorTest) { - AutoConfig taso; + AutoRequired noshift; - AutoCurrentContext ctxt; AutoRequired mgr; // Indirect assignment should cause an exception - ASSERT_ANY_THROW(mgr->Set("MyValue", "")) << "Expected a throw in a case where a configurable value was used which cannot be assigned"; + ASSERT_ANY_THROW(mgr->Set("MyNoShift", "")) << "Expected a throw in a case where a configurable value was used which cannot be assigned"; // Direct assignment should be supported still TypeWithoutAShiftOperator tasoVal; tasoVal.foo = 592; - mgr->Set("MyValue", tasoVal); + mgr->Set("MyNoShift", tasoVal); - ASSERT_EQ(592, taso->foo) << "Value assignment did not result in an update to a non-serializable configuration field"; + ASSERT_EQ(592, noshift->m_noshift->foo) << "Value assignment did not result in an update to a non-serializable configuration field"; } \ No newline at end of file From 1019b7158ca1a3c11f453d5a8066729d166e0132 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 3 Dec 2014 16:03:10 -0800 Subject: [PATCH 061/140] Remove Set from AutoConfig Use the AutoConfigManager --- autowiring/AutoConfig.h | 7 ------- src/autowiring/test/AutoConfigTest.cpp | 11 ----------- 2 files changed, 18 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index f34b1b496..835bb8c0c 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -81,11 +81,4 @@ class AutoConfig: bool IsConfigured(void) const { return m_manager->IsConfigured(m_key); } - - /// - /// Set value on this context's AutoConfigManager - /// - void Set(const T& value) { - m_manager->Set(m_key, value); - } }; diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 7ef87d828..4c0153d9e 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -120,17 +120,6 @@ TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { ASSERT_EQ(1111, clz2->m_myName); } -TEST_F(AutoConfigTest, VerifySet) { - AutoRequired acm; - acm->Set("Namespace1.XYZ", 324); - - AutoRequired clz1; - ASSERT_EQ(324, clz1->m_myName); - - clz1->m_myName.Set(42); - ASSERT_EQ(42, clz1->m_myName); -} - TEST_F(AutoConfigTest, ExtractKeyTestWin) { std::stringstream win("struct AutoConfigBase::ConfigTypeExtractor"); From 3f29899202c6a830450552b8bc2f42fc9f900991 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 3 Dec 2014 16:31:18 -0800 Subject: [PATCH 062/140] Change AutoConfigManager to recursivly set values Also, AutoConfig now acts as a smart pointer, so you must dereference it --- autowiring/AutoConfig.h | 6 +-- autowiring/AutoConfigManager.h | 6 ++- src/autowiring/AutoConfigManager.cpp | 65 +++++++++++++++----------- src/autowiring/test/AutoConfigTest.cpp | 16 +++---- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 835bb8c0c..1796bf6d2 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -63,12 +63,8 @@ class AutoConfig: public: - operator const T&() const { - return *m_manager->Get(m_key).template as(); - } - const T& operator*() const { - return operator const T&(); + return *m_manager->Get(m_key).template as(); } const T* operator->(void) const { diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 9d1d3e129..12611cb64 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -20,6 +20,7 @@ class AutoConfigManager: private: std::mutex m_lock; std::unordered_map m_attributes; + std::unordered_set m_setHere; const std::unordered_map m_registry; public: @@ -62,7 +63,7 @@ class AutoConfigManager: } // Set value in this AutoConfigManager - m_attributes[key] = AnySharedPointer(std::make_shared(value)); + SetInternal(key, AnySharedPointer(std::make_shared(value))); } /// @@ -80,4 +81,7 @@ class AutoConfigManager: /// True if value successfully set, False if key not found. /// bool SetParsed(const std::string& key, const std::string& value); + +private: + void SetInternal(const std::string& key, AnySharedPointer value); }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index b2f4635ec..86ec78d85 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -21,25 +21,25 @@ static std::unordered_map FillRegistry( AutoConfigManager::AutoConfigManager(void): m_registry(FillRegistry()) -{} - -AutoConfigManager::~AutoConfigManager(void){} - -bool AutoConfigManager::IsConfigured(const std::string& key) { - // iterate ancestor contexts, filling any configs - for (auto ctxt = GetContext(); ctxt; ctxt = ctxt->GetParentContext()) { - AutowiredFast mgmt(ctxt); +{ + // Fill content from parent AutoConfigManagers + for (auto ctxt = GetContext()->GetParentContext(); ctxt; ctxt = ctxt->GetParentContext()) { + AutowiredFast mgmt; - if(mgmt) { + // Found closest AutoConfigManager, use its attributes and return + if (mgmt) { std::lock_guard lk(mgmt->m_lock); - if (mgmt->m_attributes.count(key)) { - return true; - } + m_attributes = mgmt->m_attributes; + return; } } - - // Key not found - return false; +} + +AutoConfigManager::~AutoConfigManager(void){} + +bool AutoConfigManager::IsConfigured(const std::string& key) { + std::lock_guard lk(m_lock); + return m_attributes.count(key); } AnySharedPointer& AutoConfigManager::Get(const std::string& key) { @@ -50,18 +50,6 @@ AnySharedPointer& AutoConfigManager::Get(const std::string& key) { return m_attributes[key]; } - // iterate ancestor contexts, filling any configs - for (auto ctxt = GetContext()->GetParentContext(); ctxt; ctxt = ctxt->GetParentContext()) { - AutowiredFast mgmt(ctxt); - - if(mgmt) { - std::lock_guard lk(mgmt->m_lock); - if (mgmt->m_attributes.count(key)) { - return mgmt->m_attributes[key]; - } - } - } - // Key not found, throw exception std::stringstream ss; ss << "Attepted to get key '" << key << "' which hasn't been set"; @@ -80,6 +68,27 @@ bool AutoConfigManager::SetParsed(const std::string& key, const std::string& val return false; } - m_attributes[key] = m_registry.at(key)->parse(value); + SetInternal(key, m_registry.at(key)->parse(value)); return true; } + +void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer value) { + // Set value and mark that value was set from here + m_attributes[key] = value; + m_setHere.insert(key); + + // Recursivly set values in desendent contexts + for (const auto& ctxt : ContextEnumerator(GetContext())) { + // We already set this context's value + if (ctxt == GetContext()) + continue; + + AutowiredFast mgmt; + if (mgmt) { + std::lock_guard(mgmt->m_lock); + // Don't set value if 'mgmt' set the value itself + if (!mgmt->m_setHere.count(key)) + mgmt->m_attributes[key] = value; + } + } +} diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 4c0153d9e..d83c04d6a 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -30,7 +30,7 @@ TEST_F(AutoConfigTest, VerifySimpleAssignment) { // Now inject the type which expects this value to be assigned: AutoRequired mcc; - ASSERT_EQ(323, mcc->m_myName) << "Configurable type did not receive a value as expected"; + ASSERT_EQ(323, *mcc->m_myName) << "Configurable type did not receive a value as expected"; } struct MyBoolClass { @@ -42,10 +42,10 @@ TEST_F(AutoConfigTest, VerifyBool) { AutoRequired clz1; acm->Set("bool_space.my_bool", true); - ASSERT_TRUE(clz1->m_bool); + ASSERT_TRUE(*clz1->m_bool); acm->SetParsed("bool_space.my_bool", "false"); - ASSERT_FALSE(clz1->m_bool); + ASSERT_FALSE(*clz1->m_bool); } TEST_F(AutoConfigTest, VerifyPostHocAssignment) { @@ -59,7 +59,7 @@ TEST_F(AutoConfigTest, VerifyPostHocAssignment) { acm->Set("Namespace1.XYZ", 323); // Now inject the type which expects this value to be assigned: - ASSERT_EQ(323, mcc->m_myName) << "Configurable type did not receive a value as expected"; + ASSERT_EQ(323, *mcc->m_myName) << "Configurable type did not receive a value as expected"; } TEST_F(AutoConfigTest, VerifyRecursiveSearch) { @@ -73,12 +73,12 @@ TEST_F(AutoConfigTest, VerifyRecursiveSearch) { // Now inject an element here, and verify that it was wired up as expected: AutoRequired mcc; ASSERT_TRUE(mcc->m_myName.IsConfigured()) << "A configurable value was not configured as expected"; - ASSERT_EQ(1001, mcc->m_myName) << "Configurable value obtained from a parent scope did not have the correct value"; + ASSERT_EQ(1001, *mcc->m_myName) << "Configurable value obtained from a parent scope did not have the correct value"; // This must work as expected--a local context override will rewrite configuration values in the local scope AutoRequired sub_mcc; sub_mcc->Set("Namespace1.XYZ", 1002); - ASSERT_EQ(1002, mcc->m_myName) << "Override of a configurable value in a derived class did not take place as expected"; + ASSERT_EQ(1002, *mcc->m_myName) << "Override of a configurable value in a derived class did not take place as expected"; } } @@ -92,7 +92,7 @@ TEST_F(AutoConfigTest, DefaultNamespace) { AutoRequired def; - ASSERT_EQ(123, def->m_def); + ASSERT_EQ(123, *def->m_def); } TEST_F(AutoConfigTest, VerifyParsedAssignment) { @@ -117,7 +117,7 @@ TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { AutoRequired clz2; ASSERT_EQ(324, *clz1->m_myName); - ASSERT_EQ(1111, clz2->m_myName); + ASSERT_EQ(1111, *clz2->m_myName); } TEST_F(AutoConfigTest, ExtractKeyTestWin) { From 06530e8a83332460421d406f23220eac7e8fcfd9 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 3 Dec 2014 17:19:45 -0800 Subject: [PATCH 063/140] Added support for callbacks --- autowiring/AutoConfig.h | 8 +++++++- autowiring/AutoConfigManager.h | 16 +++++++++++++++- src/autowiring/AutoConfigManager.cpp | 20 ++++++++++++++++++-- src/autowiring/test/AutoConfigTest.cpp | 19 ++++++++++++++++++- 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 1796bf6d2..708404c2f 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -62,7 +62,6 @@ class AutoConfig: AutoRequired m_manager; public: - const T& operator*() const { return *m_manager->Get(m_key).template as(); } @@ -77,4 +76,11 @@ class AutoConfig: bool IsConfigured(void) const { return m_manager->IsConfigured(m_key); } + + // Add a callback for when this config value changes + void operator+=(std::function&& fx) { + m_manager->AddCallback(m_key, [fx](const AnySharedPointer& val){ + fx(*val.template as()); + }); + } }; diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 12611cb64..d9c38ec2a 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -19,9 +19,18 @@ class AutoConfigManager: private: std::mutex m_lock; + + // local map of the Config registry + const std::unordered_map m_registry; + + // Values of AutoConfigs in this context std::unordered_map m_attributes; + + // Set of keys for values set from this context std::unordered_set m_setHere; - const std::unordered_map m_registry; + + // map of callbacks registered for a key + std::unordered_map>> m_callbacks; public: /// @@ -82,6 +91,11 @@ class AutoConfigManager: /// bool SetParsed(const std::string& key, const std::string& value); + // Add a callback for when key is changed + void AddCallback(const std::string& key, std::function&& fx); + private: + // Handles setting a value that has already been parsed into an AnySharedPointer + // Must hold m_lock when calling this void SetInternal(const std::string& key, AnySharedPointer value); }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 86ec78d85..14e330be6 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -72,11 +72,21 @@ bool AutoConfigManager::SetParsed(const std::string& key, const std::string& val return true; } +void AutoConfigManager::AddCallback(const std::string& key, std::function&& fx) { + std::lock_guard lk(m_lock); + m_callbacks[key].push_back(fx); +} + void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer value) { // Set value and mark that value was set from here m_attributes[key] = value; m_setHere.insert(key); + // Call callbacks for this key + for (const auto& cb : m_callbacks[key]) { + cb(value); + } + // Recursivly set values in desendent contexts for (const auto& ctxt : ContextEnumerator(GetContext())) { // We already set this context's value @@ -86,9 +96,15 @@ void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer val AutowiredFast mgmt; if (mgmt) { std::lock_guard(mgmt->m_lock); - // Don't set value if 'mgmt' set the value itself - if (!mgmt->m_setHere.count(key)) + // Don't set value if 'mgmt' has set the value itself + if (!mgmt->m_setHere.count(key)) { mgmt->m_attributes[key] = value; + + // Call callbacks for this key + for (const auto& cb : m_callbacks[key]) { + cb(value); + } + } } } } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index d83c04d6a..b948e7fcf 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -152,4 +152,21 @@ TEST_F(AutoConfigTest, TypeWithoutAShiftOperatorTest) { mgr->Set("MyNoShift", tasoVal); ASSERT_EQ(592, noshift->m_noshift->foo) << "Value assignment did not result in an update to a non-serializable configuration field"; -} \ No newline at end of file +} + +TEST_F(AutoConfigTest, Callbacks) { + AutoRequired acm; + AutoRequired mcc; + + acm->Set("Namespace1.XYZ", 4); + + mcc->m_myName += [](int val) { + ASSERT_EQ(val, 42); + }; + + mcc->m_myName += [](int val) { + ASSERT_EQ(val, 42); + }; + + acm->Set("Namespace1.XYZ", 42); +} From 32b6d9220d2982d3004bd4f31e1a6252c3172f04 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 3 Dec 2014 18:39:12 -0800 Subject: [PATCH 064/140] Stop recursing to child contexts if config value was set in this context --- autowiring/ContextEnumerator.h | 4 +++- src/autowiring/AutoConfigManager.cpp | 30 +++++++++++++++++++--------- src/autowiring/ContextEnumerator.cpp | 12 ++++++++--- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/autowiring/ContextEnumerator.h b/autowiring/ContextEnumerator.h index e4b45203f..6cceef532 100644 --- a/autowiring/ContextEnumerator.h +++ b/autowiring/ContextEnumerator.h @@ -60,9 +60,11 @@ class ContextEnumerator // Current context being inspected: std::shared_ptr m_cur; - void _next(void); + void _next(const std::shared_ptr& start); public: + const iterator& NextSibling(void); + // Operator overloads: const iterator& operator++(void); const std::shared_ptr& operator*(void) const { return m_cur; } diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 14e330be6..2c3f3abe1 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -88,23 +88,35 @@ void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer val } // Recursivly set values in desendent contexts - for (const auto& ctxt : ContextEnumerator(GetContext())) { + auto enumerator = ContextEnumerator(GetContext()); + auto ctxt = enumerator.begin(); + while (ctxt != enumerator.end()) { // We already set this context's value - if (ctxt == GetContext()) + if (*ctxt == GetContext()) + ++ctxt; continue; AutowiredFast mgmt; if (mgmt) { std::lock_guard(mgmt->m_lock); - // Don't set value if 'mgmt' has set the value itself - if (!mgmt->m_setHere.count(key)) { - mgmt->m_attributes[key] = value; + + // If value was set in 'mgmt', stop recursing this branch + if (mgmt->m_setHere.count(key)){ - // Call callbacks for this key - for (const auto& cb : m_callbacks[key]) { - cb(value); - } + // Stop recursing down this branch, continue to sibling + ctxt.NextSibling(); + continue; } + + // Continue recursing down branch + mgmt->m_attributes[key] = value; + + // Call callbacks for this key + for (const auto& cb : m_callbacks[key]) + cb(value); + } + // Continue to next context + ++ctxt; } } diff --git a/src/autowiring/ContextEnumerator.cpp b/src/autowiring/ContextEnumerator.cpp index 59bd154f5..78f6fdadc 100644 --- a/src/autowiring/ContextEnumerator.cpp +++ b/src/autowiring/ContextEnumerator.cpp @@ -16,11 +16,11 @@ ContextEnumerator::iterator::iterator(const std::shared_ptr& root, ContextEnumerator::iterator::~iterator(void) {} -void ContextEnumerator::iterator::_next(void) { +void ContextEnumerator::iterator::_next(const std::shared_ptr& start) { std::shared_ptr i; for( // Try to traverse the first child if possible: - i = m_cur->FirstChild(); + i = start; // Continue until we find something and we haven't walked off the end: !i && m_cur; @@ -38,8 +38,14 @@ void ContextEnumerator::iterator::_next(void) { m_cur = i; } + +const ContextEnumerator::iterator& ContextEnumerator::iterator::NextSibling(void) { + _next(m_cur->NextSibling()); + return *this; +} + const ContextEnumerator::iterator& ContextEnumerator::iterator::operator++(void) { - _next(); + _next(m_cur->FirstChild()); return *this; } From f1ef5e6592ed6b9f0aea098144f39fc2f89042ff Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 4 Dec 2014 13:28:59 -0800 Subject: [PATCH 065/140] Fix handling of nested contexts and recursive set --- autowiring/AutoConfigManager.h | 5 +- src/autowiring/AutoConfigManager.cpp | 63 ++++++++++++-------------- src/autowiring/test/AutoConfigTest.cpp | 40 ++++++++++++++++ 3 files changed, 72 insertions(+), 36 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index d9c38ec2a..a0ae942ba 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -17,6 +17,9 @@ class AutoConfigManager: AutoConfigManager(); virtual ~AutoConfigManager(); + // Callback function type + typedef std::function t_callback; + private: std::mutex m_lock; @@ -30,7 +33,7 @@ class AutoConfigManager: std::unordered_set m_setHere; // map of callbacks registered for a key - std::unordered_map>> m_callbacks; + std::unordered_map> m_callbacks; public: /// diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 2c3f3abe1..b6bcc6d61 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -22,16 +22,12 @@ static std::unordered_map FillRegistry( AutoConfigManager::AutoConfigManager(void): m_registry(FillRegistry()) { - // Fill content from parent AutoConfigManagers - for (auto ctxt = GetContext()->GetParentContext(); ctxt; ctxt = ctxt->GetParentContext()) { - AutowiredFast mgmt; - - // Found closest AutoConfigManager, use its attributes and return - if (mgmt) { - std::lock_guard lk(mgmt->m_lock); - m_attributes = mgmt->m_attributes; - return; - } + // Copy parents config settings + auto parent = GetContext()->GetParentContext(); + if (parent) { + AutoRequired mgmt(parent); + std::lock_guard lk(mgmt->m_lock); + m_attributes = mgmt->m_attributes; } } @@ -72,7 +68,7 @@ bool AutoConfigManager::SetParsed(const std::string& key, const std::string& val return true; } -void AutoConfigManager::AddCallback(const std::string& key, std::function&& fx) { +void AutoConfigManager::AddCallback(const std::string& key, t_callback&& fx) { std::lock_guard lk(m_lock); m_callbacks[key].push_back(fx); } @@ -87,35 +83,32 @@ void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer val cb(value); } - // Recursivly set values in desendent contexts + // Enumerate descendant contexts auto enumerator = ContextEnumerator(GetContext()); auto ctxt = enumerator.begin(); + + // Skip current context + ++ctxt; + + // Recursivly set values in desendent contexts while (ctxt != enumerator.end()) { - // We already set this context's value - if (*ctxt == GetContext()) - ++ctxt; - continue; - AutowiredFast mgmt; - if (mgmt) { - std::lock_guard(mgmt->m_lock); - - // If value was set in 'mgmt', stop recursing this branch - if (mgmt->m_setHere.count(key)){ - - // Stop recursing down this branch, continue to sibling - ctxt.NextSibling(); - continue; - } - - // Continue recursing down branch - mgmt->m_attributes[key] = value; - - // Call callbacks for this key - for (const auto& cb : m_callbacks[key]) - cb(value); - + // Make sure we get the AutoConfigManager from "ctxt" + AutoRequired mgmt(*ctxt); + std::lock_guard(mgmt->m_lock); + + // Check if value set from this context + // If so, stop recursing down this branch, continue to sibling + if (mgmt->m_setHere.count(key)){ + ctxt.NextSibling(); + continue; } + + mgmt->m_attributes[key] = value; + + for (const auto& cb : mgmt->m_callbacks[key]) + cb(value); + // Continue to next context ++ctxt; } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index b948e7fcf..3bb4e98a5 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -170,3 +170,43 @@ TEST_F(AutoConfigTest, Callbacks) { acm->Set("Namespace1.XYZ", 42); } + +TEST_F(AutoConfigTest, NestedContexts) { + // Set up contexts and members + AutoCurrentContext ctxt_outer; + std::shared_ptr ctxt_middle = ctxt_outer->Create(); + std::shared_ptr ctxt_inner = ctxt_middle->Create(); + + AutoRequired mcc_outer(ctxt_outer); + AutoRequired mcc_middle(ctxt_middle); + AutoRequired mcc_inner(ctxt_inner); + + AutoRequired acm_outer(ctxt_outer); + AutoRequired acm_middle(ctxt_middle); + + // Set initial value + acm_outer->Set("Namespace1.XYZ", 42); + ASSERT_EQ(42, *mcc_outer->m_myName) << "Config value not set"; + ASSERT_EQ(42, *mcc_middle->m_myName) << "Config value not set in descendant context"; + ASSERT_EQ(42, *mcc_inner->m_myName) << "Config value not set in descendant context"; + + // Set middle, inner shouldn't be able to be set from outer after this + bool callback_hit1 = false; + mcc_inner->m_myName += [&callback_hit1](int) { + callback_hit1 = true; + }; + acm_middle->Set("Namespace1.XYZ", 1337); + ASSERT_EQ(42, *mcc_outer->m_myName) << "Config value changed in outer context"; + ASSERT_EQ(1337, *mcc_middle->m_myName) << "Config value not set"; + ASSERT_EQ(1337, *mcc_inner->m_myName) << "Config value not set in child context"; + ASSERT_TRUE(callback_hit1) << "Callback not hit in inner context"; + + // Set from outter, inner should be shielded my middle context + mcc_inner->m_myName += [](int) { + FAIL() << "This callback should never be hit"; + }; + acm_outer->Set("Namespace1.XYZ", 999); + ASSERT_EQ(999, *mcc_outer->m_myName) << "Config value not set"; + ASSERT_EQ(1337, *mcc_middle->m_myName) << "Config value overwritten when value was set in this context"; + ASSERT_EQ(1337, *mcc_inner->m_myName) << "Config value overwritten when value was set in parent context";; +} From 7a1da4911747c18e32f65cd4bd986f300e86acee Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 4 Dec 2014 14:21:38 -0800 Subject: [PATCH 066/140] Don't construct extraneous AutoConfigManagers when setting config values --- src/autowiring/AutoConfigManager.cpp | 39 ++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index b6bcc6d61..a3d383074 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -25,9 +25,13 @@ AutoConfigManager::AutoConfigManager(void): // Copy parents config settings auto parent = GetContext()->GetParentContext(); if (parent) { - AutoRequired mgmt(parent); - std::lock_guard lk(mgmt->m_lock); - m_attributes = mgmt->m_attributes; + AutowiredFast mgmt(parent); + + // Is there AutoConfigManager in an ancestor? + if (mgmt) { + std::lock_guard lk(mgmt->m_lock); + m_attributes = mgmt->m_attributes; + } } } @@ -94,22 +98,25 @@ void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer val while (ctxt != enumerator.end()) { // Make sure we get the AutoConfigManager from "ctxt" - AutoRequired mgmt(*ctxt); - std::lock_guard(mgmt->m_lock); + std::shared_ptr mgmt; + (*ctxt)->FindByType(mgmt); + if (mgmt) { + std::lock_guard(mgmt->m_lock); - // Check if value set from this context - // If so, stop recursing down this branch, continue to sibling - if (mgmt->m_setHere.count(key)){ - ctxt.NextSibling(); - continue; - } + // Check if value set from this context + // If so, stop recursing down this branch, continue to sibling + if (mgmt->m_setHere.count(key)){ + ctxt.NextSibling(); + continue; + } - mgmt->m_attributes[key] = value; + mgmt->m_attributes[key] = value; - for (const auto& cb : mgmt->m_callbacks[key]) - cb(value); + for (const auto& cb : mgmt->m_callbacks[key]) + cb(value); - // Continue to next context - ++ctxt; + // Continue to next context + ++ctxt; + } } } From 515c3850cc9375c7d93165035492b60890bcdf71 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 4 Dec 2014 14:58:20 -0800 Subject: [PATCH 067/140] Verify sibling contexts work correctly with AutoConfig --- autowiring/AutoConfigManager.h | 1 + autowiring/ConfigRegistry.h | 36 ++++++++++++-------------- src/autowiring/test/AutoConfigTest.cpp | 23 ++++++++++++++-- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index a0ae942ba..ffb75c99a 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -21,6 +21,7 @@ class AutoConfigManager: typedef std::function t_callback; private: + // lock for all members std::mutex m_lock; // local map of the Config registry diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 906358b1c..cc51971ed 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -7,6 +7,18 @@ #include "autowiring_error.h" #include "demangle.h" +// Check if 'T' has a valid stream converion operator +template +struct has_stream { + template + static auto select(std::istream* is, U* u) -> decltype(*is >> *u); + + template + static void select(...); + + static const bool value = !std::is_same(nullptr, nullptr))>::value; +}; + struct ConfigRegistryEntry { ConfigRegistryEntry(const std::type_info& ti); @@ -23,23 +35,6 @@ struct ConfigRegistryEntry { virtual AnySharedPointer parse(const std::string&) const = 0; }; -template -struct has_stream { - template - static auto select(std::istream* is, U* u) -> decltype(*is >> *u); - - template - static void select(...); - - static const bool value = !std::is_same(nullptr, nullptr))>::value; -}; - -template -static auto select(std::istream& is, U u) -> decltype(is >> u) { - is >> u; - return is; -} - template struct ConfigRegistryEntryT: public ConfigRegistryEntry @@ -51,7 +46,9 @@ struct ConfigRegistryEntryT: bool verifyType(const std::type_info& ti) const override { return typeid(T) == ti; } - + + // Parse string into this ConfigEntry's type. Throw an exception + // if no such stream operator exists AnySharedPointer parse(const std::string& str) const override { return parseInternal(str); } @@ -72,7 +69,8 @@ struct ConfigRegistryEntryT: } return AnySharedPointer(std::make_shared(val)); } - + + // Throw exception if there is no stream operator template typename std::enable_if::value, AnySharedPointer>::type parseInternal(const std::string&) const { diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 3bb4e98a5..831e2d0a5 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -138,6 +138,9 @@ struct NoShift { AutoConfig m_noshift; }; +static_assert(has_stream::value, "Stream operation not detected on a primitive type"); +static_assert(!has_stream::value, "Stream operation detected on a type that should not have supported it"); + TEST_F(AutoConfigTest, TypeWithoutAShiftOperatorTest) { AutoRequired noshift; @@ -175,10 +178,12 @@ TEST_F(AutoConfigTest, NestedContexts) { // Set up contexts and members AutoCurrentContext ctxt_outer; std::shared_ptr ctxt_middle = ctxt_outer->Create(); + std::shared_ptr ctxt_sibling = ctxt_outer->Create(); std::shared_ptr ctxt_inner = ctxt_middle->Create(); AutoRequired mcc_outer(ctxt_outer); AutoRequired mcc_middle(ctxt_middle); + AutoRequired mcc_sibling(ctxt_sibling); AutoRequired mcc_inner(ctxt_inner); AutoRequired acm_outer(ctxt_outer); @@ -188,6 +193,7 @@ TEST_F(AutoConfigTest, NestedContexts) { acm_outer->Set("Namespace1.XYZ", 42); ASSERT_EQ(42, *mcc_outer->m_myName) << "Config value not set"; ASSERT_EQ(42, *mcc_middle->m_myName) << "Config value not set in descendant context"; + ASSERT_EQ(42, *mcc_sibling->m_myName) << "Config value not set in descendant context"; ASSERT_EQ(42, *mcc_inner->m_myName) << "Config value not set in descendant context"; // Set middle, inner shouldn't be able to be set from outer after this @@ -197,16 +203,29 @@ TEST_F(AutoConfigTest, NestedContexts) { }; acm_middle->Set("Namespace1.XYZ", 1337); ASSERT_EQ(42, *mcc_outer->m_myName) << "Config value changed in outer context"; + ASSERT_EQ(42, *mcc_sibling->m_myName) << "Config value set from sibling context"; ASSERT_EQ(1337, *mcc_middle->m_myName) << "Config value not set"; ASSERT_EQ(1337, *mcc_inner->m_myName) << "Config value not set in child context"; ASSERT_TRUE(callback_hit1) << "Callback not hit in inner context"; - // Set from outter, inner should be shielded my middle context + // Set from outter, inner should be shielded by middle context mcc_inner->m_myName += [](int) { FAIL() << "This callback should never be hit"; }; + + // Make sure sibling context is not shielded + bool callback_hit2 = false; + mcc_sibling->m_myName += [&callback_hit2](int) { + callback_hit2 = true; + }; + + // Set from outer, shouldn't effect middle or inner contexts acm_outer->Set("Namespace1.XYZ", 999); ASSERT_EQ(999, *mcc_outer->m_myName) << "Config value not set"; ASSERT_EQ(1337, *mcc_middle->m_myName) << "Config value overwritten when value was set in this context"; - ASSERT_EQ(1337, *mcc_inner->m_myName) << "Config value overwritten when value was set in parent context";; + ASSERT_EQ(1337, *mcc_inner->m_myName) << "Config value overwritten when value was set in parent context"; + + // Make sure sibling hit + ASSERT_EQ(999, *mcc_sibling->m_myName) << "Value not set on sibling of context where value was previously set"; + ASSERT_TRUE(callback_hit2) << "Callback not called on sibling of context where value was previously set"; } From 8f60ea08a511b2588e22f09821256190c3cfffd4 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Thu, 4 Dec 2014 15:05:50 -0800 Subject: [PATCH 068/140] Simplify logic for _next in ContextEnumerator --- autowiring/ConfigRegistry.h | 2 +- src/autowiring/ContextEnumerator.cpp | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index cc51971ed..4dc6f3d13 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -7,7 +7,7 @@ #include "autowiring_error.h" #include "demangle.h" -// Check if 'T' has a valid stream converion operator +// Check if 'T' has a valid stream conversion operator template struct has_stream { template diff --git a/src/autowiring/ContextEnumerator.cpp b/src/autowiring/ContextEnumerator.cpp index 78f6fdadc..e9ec5c2b4 100644 --- a/src/autowiring/ContextEnumerator.cpp +++ b/src/autowiring/ContextEnumerator.cpp @@ -17,18 +17,15 @@ ContextEnumerator::iterator::iterator(const std::shared_ptr& root, ContextEnumerator::iterator::~iterator(void) {} void ContextEnumerator::iterator::_next(const std::shared_ptr& start) { - std::shared_ptr i; - for( - // Try to traverse the first child if possible: - i = start; - - // Continue until we find something and we haven't walked off the end: - !i && m_cur; - + // First node to search + std::shared_ptr i = start; + + // Continue until we find something and we haven't walked off the end: + while(!i && m_cur) { // m_cur is ascending, we are right-traversing - i = m_cur->NextSibling(), - m_cur = m_cur->GetParentContext() - ); + i = m_cur->NextSibling(); + m_cur = m_cur->GetParentContext(); + } if(m_cur == m_root) // Root hit, done traversing From 76a4742c96ab9f66bfd6d62bd9df15edd86e6853 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 5 Dec 2014 10:36:41 -0800 Subject: [PATCH 069/140] Add explicit braces to avoid dangling else This was causing a warning --- src/autowiring/AutoPacket.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index 80f33082f..f9c3fbd42 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -264,11 +264,12 @@ void AutoPacket::CompleteCheckout(bool ready, const std::type_info& data) { UnsafeComplete(ready, data, entry); } - if(entry) - if(ready) + if (entry) { + if (ready) UpdateSatisfaction(entry->m_decoration->type()); else MarkUnsatisfiable(entry->m_decoration->type()); + } } void AutoPacket::Put(AnySharedPointer&& in) { From ccb3b3090b074b8bb77334dffe0592e3b7a4cff3 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 5 Dec 2014 10:45:03 -0800 Subject: [PATCH 070/140] Correcting performance warning in MSVC --- src/autowiring/AutoConfigManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index a3d383074..eb73d7b68 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -39,7 +39,7 @@ AutoConfigManager::~AutoConfigManager(void){} bool AutoConfigManager::IsConfigured(const std::string& key) { std::lock_guard lk(m_lock); - return m_attributes.count(key); + return !!m_attributes.count(key); } AnySharedPointer& AutoConfigManager::Get(const std::string& key) { From c75c49cb5ee987566a6862b8744709c2ae162638 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 5 Dec 2014 10:21:04 -0800 Subject: [PATCH 071/140] Eliminating the lifecycle concept from AutoPacket Unfortnunately, this means that the AutoElseFilter, Final Call, and optional pointer concepts have to be deprecated, but it should be possible to reinstate AutoElseFilter at a later time based on a negative decoration concept, and Final Call is a dangerous concept anyway that we should probably not be using. --- autowiring/AutoFilterDescriptor.h | 19 +- autowiring/AutoPacket.h | 7 - autowiring/DeclareElseFilter.h | 74 -------- autowiring/DecorationDisposition.h | 5 +- autowiring/SatCounter.h | 47 ++--- autowiring/auto_arg.h | 70 +------- autowiring/optional_ptr.h | 66 ------- src/autowiring/AutoPacket.cpp | 92 ++-------- src/autowiring/CMakeLists.txt | 2 - src/autowiring/auto_arg.cpp | 2 - src/autowiring/test/ArgumentTypeTest.cpp | 9 - src/autowiring/test/AutoFilterSequencing.cpp | 175 ------------------- src/autowiring/test/AutoFilterTest.cpp | 113 ------------ 13 files changed, 34 insertions(+), 647 deletions(-) delete mode 100644 autowiring/DeclareElseFilter.h delete mode 100644 autowiring/optional_ptr.h diff --git a/autowiring/AutoFilterDescriptor.h b/autowiring/AutoFilterDescriptor.h index 3bf209ef1..dddb32e3f 100644 --- a/autowiring/AutoFilterDescriptor.h +++ b/autowiring/AutoFilterDescriptor.h @@ -22,7 +22,6 @@ struct AutoFilterDescriptorInput { AutoFilterDescriptorInput(void) : is_input(false), is_output(false), - is_optional(false), is_shared(false), ti(nullptr) {} @@ -31,14 +30,12 @@ struct AutoFilterDescriptorInput { AutoFilterDescriptorInput(auto_arg&& traits) : is_input(auto_arg::is_input), is_output(auto_arg::is_output), - is_optional(auto_arg::is_optional), is_shared(auto_arg::is_shared), ti(&typeid(typename auto_arg::id_type)) {} const bool is_input; const bool is_output; - const bool is_optional; const bool is_shared; const std::type_info* const ti; @@ -64,7 +61,6 @@ struct AutoFilterDescriptorStub { m_deferred(false), m_arity(0), m_requiredCount(0), - m_optionalCount(0), m_pCall(nullptr) {} @@ -74,7 +70,6 @@ struct AutoFilterDescriptorStub { m_deferred(rhs.m_deferred), m_arity(rhs.m_arity), m_requiredCount(rhs.m_requiredCount), - m_optionalCount(rhs.m_optionalCount), m_pCall(rhs.m_pCall) {} @@ -92,19 +87,13 @@ struct AutoFilterDescriptorStub { m_deferred(deferred), m_arity(0), m_requiredCount(0), - m_optionalCount(0), m_pCall(pCall) { for(auto pArg = m_pArgs; *pArg; pArg++) { m_arity++; - if (pArg->is_input) { - if (pArg->is_optional) { - ++m_optionalCount; - continue; - } + if (pArg->is_input) ++m_requiredCount; - } } } @@ -127,12 +116,9 @@ struct AutoFilterDescriptorStub { // correctly. size_t m_arity; - // The number of argumetns declared to be required: + // The number of arguments declared to be required: size_t m_requiredCount; - // The number of arguments declared to be optional: - size_t m_optionalCount; - // The first argument of this static global is void*, but it is expected that the argument // that will actually be passed is of a type corresponding to the member function bound // by this operation. Strong guarantees must be made that the types passed into this routine @@ -144,7 +130,6 @@ struct AutoFilterDescriptorStub { const std::type_info* GetType() const { return m_pType; } size_t GetArity(void) const { return m_arity; } size_t GetRequiredCount(void) const { return m_requiredCount; } - size_t GetOptionalCount(void) const { return m_optionalCount; } const AutoFilterDescriptorInput* GetAutoFilterInput(void) const { return m_pArgs; } bool IsDeferred(void) const { return m_deferred; } const std::type_info* GetAutoFilterTypeInfo(void) const { return m_pType; } diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 7a4ed69ab..072c5f80c 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -50,13 +50,6 @@ class AutoPacket: static ObjectPool CreateObjectPool(AutoPacketFactory& factory, const std::shared_ptr& outstanding); private: - // Lifecycle mutability flag - enum Mutability { - enable_all = 0, - disable_update = 1, //Disables update while resolving optional arguments - disable_decorate = 2 //Disables decorate while resolving final calls - } m_lifecyle; - // Saturation counters, constructed when the packet is created and reset each time thereafter // IMPORTANT: Elements in m_satCounters MUST be stationary, since they will be referenced! std::list m_satCounters; diff --git a/autowiring/DeclareElseFilter.h b/autowiring/DeclareElseFilter.h deleted file mode 100644 index 482d1e603..000000000 --- a/autowiring/DeclareElseFilter.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#pragma once -#include "ContextMember.h" -#include "DeclareElseFilter.h" -#include "SatCounter.h" - -template -class MicroElseFilter; - -/// -/// Zero-argument specialization -/// -template -class MicroElseFilter : - public ContextMember -{ -public: - MicroElseFilter(Base* base, void (Base::*filter)(const AutoPacket&)) : - ContextMember("MicroElseFilter"), - base(base), - filter(filter) - {} - -protected: - Base* base; - void (Base::*filter)(const AutoPacket&); -}; - -/// If Base::AutoFilter is not called, this will execute a Final-Call method -template -class MicroElseFilter: - public MicroElseFilter -{ -public: - MicroElseFilter(Base* base, void (Base::*filter)(const AutoPacket&)) : - MicroElseFilter(base, filter) - {} - - void AutoFilter(const AutoPacket& packet) { - const bool has_all[] = {packet.Has(), packet.Has()... }; - - for(bool cur : has_all) - if(!cur) { - // Missing decoration, base filter wasn't called - (this->base->*(this->filter))(packet); - return; - } - - /// Base::AutoFilter has already been called for this packet - } -}; - -/// -/// Creates a MicroElseFilter to be called when the specified AutoFilter routine is not called -/// -/// The filter whose state is to be tested when determining whether to call -template -std::shared_ptr> DeclareElseFilter(void(Test::*testFilter)(Args...), Base* that, void (Base::*filter)(const AutoPacket&)) { - AutoCurrentContext ctxt; - return ctxt->template Inject>(that, filter); -} - -/// -/// Creates a MicroElseFilter class that will call the method provided in the constructor -/// if and only if Base::AutoFilter has not been called. -/// -/// -/// In the constructor of a class that will be Injected into a context call this function as: -/// DeclareElseFilter(this, &MyClass::ElseFilter) -/// -template -std::shared_ptr> DeclareElseFilter(Base* that, void (Base::*filter)(const AutoPacket&)) { - return DeclareElseFilter(&Base::AutoFilter, that, filter); -} diff --git a/autowiring/DecorationDisposition.h b/autowiring/DecorationDisposition.h index ade513687..0eb2c3c37 100644 --- a/autowiring/DecorationDisposition.h +++ b/autowiring/DecorationDisposition.h @@ -74,9 +74,8 @@ struct DecorationDisposition // taking place. SatCounter* m_publisher; - // Satisfaction counters, with the second part indicating a required entry if true, - // or an optional entry if false. - std::vector> m_subscribers; + // Satisfaction counters + std::vector m_subscribers; // Indicates that the internally held object is currently checked out, // but might not be satisfied, since the data is being prepared. diff --git a/autowiring/SatCounter.h b/autowiring/SatCounter.h index bc0e7db86..250e6db95 100644 --- a/autowiring/SatCounter.h +++ b/autowiring/SatCounter.h @@ -13,41 +13,34 @@ struct SatCounter: { SatCounter(void): called(false), - remaining(0), - optional(0) + remaining(0) {} SatCounter(const AutoFilterDescriptor& source): AutoFilterDescriptor(source), called(false), - remaining(0), - optional(0) + remaining(0) {} SatCounter(const SatCounter& source): AutoFilterDescriptor(static_cast(source)), called(source.called), - remaining(source.remaining), - optional(source.optional) + remaining(source.remaining) {} SatCounter& operator = (const SatCounter& source) { AutoFilterDescriptor::operator = (source); called = source.called; remaining = source.remaining; - optional = source.optional; return *this; } // The number of times the AutoFilter is called bool called; - // The REQUIRED remaining counter: + // The number of inputs remaining to this counter: size_t remaining; - // The OPTIONAL remaining counter: - size_t optional; - /// /// Calls the underlying AutoFilter method with the specified AutoPacketAdapter as input /// @@ -62,46 +55,28 @@ struct SatCounter: } /// - /// Resets the optional and remaining counters to their initial values + /// Resets the remaining counter to its initial value /// void Reset(void) { called = false; remaining = m_requiredCount; - optional = m_optionalCount; } /// /// Conditionally decrements AutoFilter argument satisfaction. /// /// True if this decrement yielded satisfaction of all arguments - bool Decrement(const std::type_index& data, bool is_mandatory) { - is_mandatory ? --remaining : --optional; - return remaining == 0 && optional == 0; + bool Decrement(const std::type_index& data) { + return !--remaining; } /// /// Conditionally increments AutoFilter argument satisfaction. /// - void Increment(const std::type_index& data, bool is_mandatory) { - is_mandatory ? ++remaining : ++optional; - } - - /// - /// Sets the optional count to zero if mandatory inputs are satisfied - /// - /// True if all mandatory arguments are satisfied - bool Resolve() { - if (IsDeferred()) - // IMPORTANT: Deferred calls cannot be finalized - return false; - - if (remaining == 0 && optional != 0) { - optional = 0; - return true; - } - return false; + void Increment(const std::type_index& data) { + ++remaining; } - /// False if there are any mandatory or optional elements still outstanding - operator bool(void) const { return !remaining && !optional; } + /// False if there are any inputs still outstanding + operator bool(void) const { return !remaining; } }; diff --git a/autowiring/auto_arg.h b/autowiring/auto_arg.h index 1292eb175..3de5d4b5c 100644 --- a/autowiring/auto_arg.h +++ b/autowiring/auto_arg.h @@ -2,7 +2,6 @@ #pragma once #include "auto_in.h" #include "auto_out.h" -#include "optional_ptr.h" /* The auto_arg classes are used to generate of auto_in and auto_out types @@ -35,7 +34,6 @@ class auto_arg: {} static const bool is_shared = false; - static const bool is_optional = false; }; /// @@ -55,7 +53,6 @@ class auto_arg: {} static const bool is_shared = false; - static const bool is_optional = false; }; /// @@ -75,7 +72,6 @@ class auto_arg: {} static const bool is_shared = false; - static const bool is_optional = false; }; /// @@ -95,7 +91,6 @@ class auto_arg>: {} static const bool is_shared = true; - static const bool is_optional = false; }; /// @@ -115,7 +110,6 @@ class auto_arg>: {} static const bool is_shared = true; - static const bool is_optional = false; }; /// @@ -135,7 +129,6 @@ class auto_arg: {} static const bool is_shared = false; - static const bool is_optional = false; }; /// @@ -155,7 +148,6 @@ class auto_arg>: {} static const bool is_shared = true; - static const bool is_optional = false; }; /// @@ -175,27 +167,6 @@ class auto_arg>: {} static const bool is_shared = true; - static const bool is_optional = true; -}; - -/// -/// Specialization for equivalent type optional_ptr -/// -template -class auto_arg>: - public optional_ptr -{ -public: - typedef optional_ptr auto_type; - - auto_arg() {} - - auto_arg(std::shared_ptr packet): - optional_ptr(packet) - {} - - static const bool is_shared = true; - static const bool is_optional = true; }; /// @@ -235,7 +206,7 @@ class auto_arg auto_arg() {} - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): + auto_arg(std::shared_ptr packet) : m_packet(packet) {} @@ -253,42 +224,13 @@ class auto_arg /// deferred calls. /// template<> -class auto_arg +class auto_arg: + public auto_arg { -protected: - /// Sigil to distinguish const AutoPacket& - class final_call_sigil { - public: - final_call_sigil(void); - virtual ~final_call_sigil(void); - }; - - std::shared_ptr m_packet; - public: - typedef const AutoPacket& auto_type; - - typedef final_call_sigil id_type; - typedef const AutoPacket& base_type; - typedef std::weak_ptr shared_type; + auto_arg(void) {} - // const AutoPacket& can only be used to observe data - static const bool is_input = true; - static const bool is_output = false; - - operator base_type () const { - return *m_packet; - } - operator shared_type () { - return m_packet; - } - - auto_arg() {} - - auto_arg(std::shared_ptr packet, const std::type_info& source = typeid(void)): - m_packet(packet) + auto_arg(std::shared_ptr packet) : + auto_arg(std::const_pointer_cast(packet)) {} - - static const bool is_shared = false; - static const bool is_optional = false; }; diff --git a/autowiring/optional_ptr.h b/autowiring/optional_ptr.h deleted file mode 100644 index d2e00b374..000000000 --- a/autowiring/optional_ptr.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#pragma once - -#include "AutoPacket.h" -#include MEMORY_HEADER - -/// -/// A wrapper type, used to indicate a pointer which may optionally be satisfied -/// -/// -/// An optional pointer denotes a field which may be omitted during a call to a filter -/// method. The caller is responsible for testing a field for correctness. -/// -/// Consumers are cautioned against using optional_ptr where not necessary. Users of -/// optional_ptr will only be notified that a field is not satisfied when the packet is -/// about to be destroyed, or the field has been explicitly marked as unsatisfiable -/// (for example, due to a failed checkout). -/// -template -class optional_ptr: - public std::shared_ptr -{ -public: - typedef type id_type; - typedef const type* base_type; - typedef std::shared_ptr shared_type; - // WARNING: optional_ptr::shared_type == auto_in::shared_type - - static const bool is_input = true; - static const bool is_output = false; - - operator base_type () const { - return this->get(); - } - - operator shared_type () { - return *this; - } - - optional_ptr (): - shared_type(nullptr) - {} - - optional_ptr (const optional_ptr& rhs): - shared_type(rhs) - {} - - optional_ptr (optional_ptr&& rhs): - shared_type(std::move(rhs)) - {} - - optional_ptr& operator = (optional_ptr& rhs) { - shared_type::operator = (rhs); - return *this; - } - - optional_ptr& operator = (optional_ptr&& rhs) { - shared_type::reset(); - static_cast(*this) = std::move(rhs); - return *this; - } - - optional_ptr (std::shared_ptr packet) { - packet->Get(*this); - } -}; diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index d87a58549..746c70f8e 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -53,9 +53,9 @@ void AutoPacket::AddSatCounter(SatCounter& satCounter) { // NOTE: Recipients added via AddReceiver can receive broadcast data, // so it is necessary to decrement the receiver's counters when it is added. if (pCur->is_input) { - entry->m_subscribers.push_back(std::make_pair(&satCounter, !pCur->is_optional)); + entry->m_subscribers.push_back(&satCounter); if (entry->satisfied) - satCounter.Decrement(dataType, !pCur->is_optional); + satCounter.Decrement(dataType); } if (pCur->is_output) { if(entry->m_publisher) { @@ -77,7 +77,7 @@ void AutoPacket::RemoveSatCounter(SatCounter& satCounter) { // Decide what to do with this entry: if (pCur->is_input) { assert(!entry->m_subscribers.empty()); - assert(&satCounter == entry->m_subscribers.back().first); + assert(&satCounter == entry->m_subscribers.back()); entry->m_subscribers.pop_back(); } if (pCur->is_output) { @@ -102,30 +102,8 @@ ObjectPool AutoPacket::CreateObjectPool(AutoPacketFactory& factory, } void AutoPacket::MarkUnsatisfiable(const std::type_info& info) { - std::list callQueue; - { - std::lock_guard lk(m_lock); - auto dFind = m_decorations.find(info); - if(dFind == m_decorations.end()) - // Trivial return, there's no subscriber to this decoration and so we have nothing to do - return; - - // Update satisfaction inside of lock - DecorationDisposition* decoration = &dFind->second; - for(const auto& satCounter : decoration->m_subscribers) { - if(satCounter.second) - // Entry is mandatory, leave it unsatisfaible - continue; - - // Entry is optional, we will call if we're satisfied after decrementing this optional field - if(satCounter.first->Decrement(info, false)) - callQueue.push_back(satCounter.first); - } - } - - // Make calls outside of lock, to avoid deadlock from decorations in methods - for (SatCounter* call : callQueue) - call->CallAutoFilter(*this); + // TODO: + // Add an anti-present decoration } void AutoPacket::UpdateSatisfaction(const std::type_info& info) { @@ -133,14 +111,6 @@ void AutoPacket::UpdateSatisfaction(const std::type_info& info) { { std::lock_guard lk(m_lock); - if (info != typeid(auto_arg::id_type)) { - switch (m_lifecyle) { - case disable_decorate: throw std::runtime_error("Cannot provide decorations in final-call (const AutoPacket&) AutoFilter methods"); - case disable_update: return; // Quietly prevent recusion during optional_ptr resolution - default: break; //enable_all - } - } - auto dFind = m_decorations.find(info); if(dFind == m_decorations.end()) // Trivial return, there's no subscriber to this decoration and so we have nothing to do @@ -149,8 +119,8 @@ void AutoPacket::UpdateSatisfaction(const std::type_info& info) { // Update satisfaction inside of lock DecorationDisposition* decoration = &dFind->second; for(const auto& satCounter : decoration->m_subscribers) - if(satCounter.first->Decrement(info, satCounter.second)) - callQueue.push_back(satCounter.first); + if(satCounter->Decrement(info)) + callQueue.push_back(satCounter); } // Make calls outside of lock, to avoid deadlock from decorations in methods @@ -163,19 +133,9 @@ void AutoPacket::PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nI // First pass, decrement what we can: { std::lock_guard lk(m_lock); - switch (m_lifecyle) { - case disable_decorate: throw std::runtime_error("Cannot provide decorations in final-call (const AutoPacket&) AutoFilter methods"); - case disable_update: return; // Quietly prevent recusion during optional_ptr resolution - default: break; //enable_all - } - for(size_t i = nInfos; i--;) { - for(std::pair& subscriber : pTypeSubs[i]->m_subscribers) { - SatCounter* cur = subscriber.first; + for(SatCounter*& cur : pTypeSubs[i]->m_subscribers) { if( - // We only care about mandatory inputs - subscriber.second && - // We only care about sat counters that aren't deferred--skip everyone else // Deferred calls will be too late. !cur->IsDeferred() && @@ -186,7 +146,7 @@ void AutoPacket::PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nI // Now do the decrementation and proceed even if optional > 0, // since this is the only opportunity to fulfill the arguments - (cur->Decrement(*pTypeSubs[i]->m_type, true) || + (cur->Decrement(*pTypeSubs[i]->m_type) || cur->remaining == 0) ) // Finally, queue a call for this type @@ -203,14 +163,9 @@ void AutoPacket::PulseSatisfaction(DecorationDisposition* pTypeSubs[], size_t nI // since data in this call will not be available subsequently { std::lock_guard lk(m_lock); - for(size_t i = nInfos; i--;) { - for(const auto& satCounter : pTypeSubs[i]->m_subscribers) { - SatCounter* cur = satCounter.first; - if (satCounter.second) { - cur->Increment(*pTypeSubs[i]->m_type, true); - } - } - } + for(size_t i = nInfos; i--;) + for(const auto& cur : pTypeSubs[i]->m_subscribers) + cur->Increment(*pTypeSubs[i]->m_type); } } @@ -336,9 +291,6 @@ void AutoPacket::Initialize(void) { if(!m_outstanding) throw std::runtime_error("Cannot proceed with this packet, enclosing context already expired"); - // Enter issued state - m_lifecyle = enable_all; - // Find all subscribers with no required or optional arguments: std::list callCounters; for (auto& satCounter : m_satCounters) @@ -355,24 +307,6 @@ void AutoPacket::Initialize(void) { } void AutoPacket::Finalize(void) { - // Queue calls to ensure that calls to Decorate inside of AutoFilter methods - // will NOT effect the resolution of optional arguments. - std::list callQueue; - { - std::lock_guard lk(m_lock); - for(auto& decoration : m_decorations) - for(auto& satCounter : decoration.second.m_subscribers) - if(!satCounter.second) - if(satCounter.first->Resolve()) - callQueue.push_back(satCounter.first); - } - m_lifecyle = disable_update; - for (SatCounter* call : callQueue) - call->CallAutoFilter(*this); - - // Last-call indicated by argumument type const AutoPacket&: - m_lifecyle = disable_decorate; - UpdateSatisfaction(typeid(auto_arg::id_type)); // Remove all recipients & clean up the decorations list // ASSERT: This reverses the order of accumulation, @@ -438,7 +372,7 @@ std::list AutoPacket::GetSubscribers(const std::type_info& data) con t_decorationMap::const_iterator decoration = m_decorations.find(data); if (decoration != m_decorations.end()) for (auto& subscriber : decoration->second.m_subscribers) - subscribers.push_back(*subscriber.first); + subscribers.push_back(*subscriber); return subscribers; } diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 65834683d..efbc8eb65 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -81,7 +81,6 @@ set(Autowiring_SRCS CurrentContextPusher.cpp CurrentContextPusher.h DeclareAutoFilter.h - DeclareElseFilter.h Decompose.h DecorationDisposition.h Deserialize.h @@ -126,7 +125,6 @@ set(Autowiring_SRCS ObjectPoolMonitor.h ObjectPoolMonitor.cpp ObjectTraits.h - optional_ptr.h SatCounter.h MicroAutoFilter.h MicroBolt.h diff --git a/src/autowiring/auto_arg.cpp b/src/autowiring/auto_arg.cpp index 5542b6c2b..9da7446a6 100644 --- a/src/autowiring/auto_arg.cpp +++ b/src/autowiring/auto_arg.cpp @@ -5,5 +5,3 @@ auto_arg::first_call_sigil::first_call_sigil(void){} auto_arg::first_call_sigil::~first_call_sigil(void){} -auto_arg::final_call_sigil::final_call_sigil(void){} -auto_arg::final_call_sigil::~final_call_sigil(void){} diff --git a/src/autowiring/test/ArgumentTypeTest.cpp b/src/autowiring/test/ArgumentTypeTest.cpp index b712409a0..b231b9ab3 100644 --- a/src/autowiring/test/ArgumentTypeTest.cpp +++ b/src/autowiring/test/ArgumentTypeTest.cpp @@ -41,7 +41,6 @@ typedef const Argument<0> copied_in_const; typedef const Argument<0>& required_in; typedef std::shared_ptr> required_in_shared; typedef auto_in> fundamental_in; -typedef optional_ptr> optional_in_shared; typedef Argument<0>& required_out; typedef std::shared_ptr> required_out_shared; typedef auto_out> fundamental_out; @@ -56,23 +55,15 @@ TEST_F(ArgumentTypeTest, AutoFilterTemplateTests) { ASSERT_TRUE(auto_arg::is_input) << "Should be input"; ASSERT_TRUE(auto_arg::is_shared) << "Input is a shared ptr"; - ASSERT_FALSE(auto_arg::is_optional) << "Input is not optional"; - - ASSERT_TRUE(auto_arg::is_input) << "Should be input"; - ASSERT_TRUE(auto_arg::is_shared) << "Input is a shared ptr"; - ASSERT_TRUE(auto_arg::is_optional) << "Input is not optional"; ASSERT_FALSE(auto_arg::is_input) << "Should be output"; ASSERT_FALSE(auto_arg::is_shared) << "Output is a shared ptr"; - ASSERT_FALSE(auto_arg::is_optional) << "Output is not optional"; ASSERT_FALSE(auto_arg::is_input) << "Should be output"; ASSERT_TRUE(auto_arg::is_shared) << "Output is a shared ptr"; - ASSERT_FALSE(auto_arg::is_optional) << "Output is optional"; ASSERT_FALSE(auto_arg::is_input) << "Should be output"; ASSERT_TRUE(auto_arg::is_shared) << "Output is a shared ptr"; - ASSERT_TRUE(auto_arg::is_optional) << "Output is optional"; } TEST_F(ArgumentTypeTest, TestAutoIn) { diff --git a/src/autowiring/test/AutoFilterSequencing.cpp b/src/autowiring/test/AutoFilterSequencing.cpp index 563b75b44..d66fb3d9f 100644 --- a/src/autowiring/test/AutoFilterSequencing.cpp +++ b/src/autowiring/test/AutoFilterSequencing.cpp @@ -3,7 +3,6 @@ #include "TestFixtures/Decoration.hpp" #include #include -#include class AutoFilterSequencing: public testing::Test @@ -43,151 +42,15 @@ static_assert( "Decomposed type did not correctly name the implementing type of an inherited method" ); -class FilterLast { -public: - int m_called; - - FilterLast() : m_called(0) {}; - - void AutoFilter(const AutoPacket& pkt) { - ++m_called; - ASSERT_TRUE(pkt.Has>()) << "Missing FilterFirst Decoration<0>"; - } -}; - -class FilterLastD0 { -public: - int m_called; - - FilterLastD0() : m_called(0) {}; - - void AutoFilter(const AutoPacket& pkt, const Decoration<0>& dec) { - ++m_called; - ASSERT_EQ(0, dec.i) << "Incorrect decoration value"; - } -}; - -class FilterLastD1 { -public: - int m_called; - - FilterLastD1() : m_called(0) {}; - - void AutoFilter(const AutoPacket& pkt, const Decoration<1>& dec) { - ++m_called; - FAIL() << "Final-Call to AutoFilter with unsatisfied type"; - } -}; - TEST_F(AutoFilterSequencing, VerifyFirstLastCalls) { AutoRequired factory; AutoRequired first; - AutoRequired last; - AutoRequired lastD0; - AutoRequired lastD1; { auto pkt = factory->NewPacket(); ASSERT_EQ(1, first->m_called) << "First-call filter was not applied"; - ASSERT_EQ(0, last->m_called) << "Last-call filter was called early"; - ASSERT_EQ(0, lastD0->m_called) << "Last-call filter was not applied"; } ASSERT_EQ(1, first->m_called) << "First-call filter was applied as final call"; - ASSERT_EQ(1, lastD0->m_called) << "Last-call filter was not applied"; -} - -class LogicFilter { -protected: - typedef BasedAutoFilter&> t_Next; - std::shared_ptr> m_MicroElseFilter; - std::shared_ptr m_BasedNextFilter; - std::shared_ptr> m_MicroNextElseFilter; - -public: - int m_calledAuto; - int m_calledElse; - int m_calledNext; - int m_calledNextElse; - - LogicFilter() : - m_calledAuto(0), - m_calledElse(0), - m_calledNext(0), - m_calledNextElse(0) - { - m_MicroElseFilter = DeclareElseFilter(this, &LogicFilter::ElseFilter); - m_BasedNextFilter = DeclareAutoFilter(this, &LogicFilter::NextFilter); - m_MicroNextElseFilter = DeclareElseFilter(&t_Next::AutoFilter, this, &LogicFilter::NextElseFilter); - Reset(); - } - - /// Normal AutoFilter call, implemented by MicroAutoFilter - void AutoFilter(const Decoration<0>& deco) { - ++m_calledAuto; - } - - /// Called when AutoFilter is not - void ElseFilter(const AutoPacket& packet) { - ++m_calledElse; - ASSERT_FALSE(packet.Has>()) << "AutoFilter should not have been called"; - } - - /// Declared AutoFilter call, implemented by MicroAutoFilter - void NextFilter(const Decoration<1>& deco) { - ++m_calledNext; - } - - /// Declared AutoFilter call, implemented by MicroAutoFilter - void NextElseFilter(const AutoPacket& packet) { - ++m_calledNextElse; - ASSERT_FALSE(packet.Has>()) << "NextFilter should not have been called"; - } - - void Reset() { - m_calledAuto = 0; - m_calledElse = 0; - m_calledNext = 0; - m_calledNextElse = 0; - } -}; - -TEST_F(AutoFilterSequencing, TestLogicFilter) { - AutoRequired factory; - AutoRequired logic; - - // Issue & return a packet without decorating - { - auto pkt = factory->NewPacket(); - ASSERT_EQ(0, logic->m_calledAuto) << "Called AutoFilter without Decoration<0>"; - ASSERT_EQ(0, logic->m_calledElse) << "Called ElseFilter before packet final-calls"; - ASSERT_EQ(0, logic->m_calledNext) << "Called NextFilter without Decoration<0>"; - ASSERT_EQ(0, logic->m_calledNextElse) << "Called NextElseFilter before packet final-calls"; - } - ASSERT_EQ(0, logic->m_calledAuto) << "Called AutoFilter without Decoration<0>"; - ASSERT_EQ(1, logic->m_calledElse) << "Failed to call ElseFilter in packet final-calls"; - ASSERT_EQ(0, logic->m_calledNext) << "Called NextFilter without Decoration<0>"; - ASSERT_EQ(1, logic->m_calledNextElse) << "Failed to call NextElseFilter in packet final-calls"; - logic->Reset(); - - // Issue & decoration a packet - { - auto pkt = factory->NewPacket(); - pkt->Decorate(Decoration<0>()); - ASSERT_EQ(1, logic->m_calledAuto) << "Failed to call AutoFilter with Decoration<0>"; - ASSERT_EQ(0, logic->m_calledElse) << "Called ElseFilter before packet final-calls"; - ASSERT_EQ(0, logic->m_calledNext) << "Called NextFilter without Decoration<0>"; - ASSERT_EQ(0, logic->m_calledNextElse) << "Called NextElseFilter before packet final-calls"; - - pkt->Decorate(Decoration<1>()); - ASSERT_EQ(1, logic->m_calledAuto) << "Multiple calls to AutoFilter with Decoration<0>"; - ASSERT_EQ(0, logic->m_calledElse) << "Called ElseFilter before packet final-calls"; - ASSERT_EQ(1, logic->m_calledNext) << "Failed to call NextFilter with Decoration<1>"; - ASSERT_EQ(0, logic->m_calledNextElse) << "Called NextElseFilter before packet final-calls"; - } - ASSERT_EQ(1, logic->m_calledAuto) << "Multiple calls to AutoFilter with Decoration<0>"; - ASSERT_EQ(0, logic->m_calledElse) << "Called ElseFilter in packet final-calls"; - ASSERT_EQ(1, logic->m_calledNext) << "Multiple calls to NextFilter with Decoration<1>"; - ASSERT_EQ(0, logic->m_calledNextElse) << "Called NextElseFilter in packet final-calls"; } class FilterOutDeferred: @@ -199,41 +62,3 @@ class FilterOutDeferred: return Deferred(this); } }; - -TEST_F(AutoFilterSequencing, VerifyAutoOutDeferred) { - AutoRequired factory; - AutoRequired out; - AutoRequired last; - { - std::shared_ptr packet = factory->NewPacket(); - // Creation of packet triggers Deferred AutoFilter call - // Destruction of packet trigerrs FilterLast, which tests - // for the existence of Decoration<0> on the packet - } - out->Stop(true); // Run-down all queued calls (out) - out->Wait(); // Wait for calls to compelte (last) - - ASSERT_EQ(last->m_called, 1) << "FilterLast was not called"; -} - -class FilterFinalFail1 { -public: - void AutoFilter(optional_ptr>, auto_out>) {} -}; - -class FilterFinalFail2 { -public: - void AutoFilter(const AutoPacket&, auto_out>) {} -}; - -TEST_F(AutoFilterSequencing, DISABLED_VerifyFinalImmutability) { - AutoRequired factory; - AutoRequired fail1; - ASSERT_THROW(factory->NewPacket(), std::runtime_error) << "Output holds shared_ptr to packet, which is invalid in Finalize"; - - // PROBLEM: Exception is thrown correctly, but is not caught by test. - AutoRequired fail2; - auto packet = factory->NewPacket(); - packet->Decorate(Decoration<0>()); - ASSERT_THROW(factory->NewPacket(), std::runtime_error) << "Output holds shared_ptr to packet, which is invalid in Finalize"; -} diff --git a/src/autowiring/test/AutoFilterTest.cpp b/src/autowiring/test/AutoFilterTest.cpp index e66a9a4a5..ff765cf37 100644 --- a/src/autowiring/test/AutoFilterTest.cpp +++ b/src/autowiring/test/AutoFilterTest.cpp @@ -4,10 +4,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -164,54 +162,6 @@ TEST_F(AutoFilterTest, VerifyAutoOutPooled) { ASSERT_EQ(result0->i, 1) << "Output incorrect"; } -TEST_F(AutoFilterTest, VerifyOptionalFilter) { - AutoRequired factory; - - AutoRequired, optional_ptr>>> fgA; - AutoRequired>, Decoration<0>>> fgB; - AutoRequired>, Decoration<1>>> fgC; - AutoRequired, optional_ptr>, optional_ptr>>> fgD; - - //Test resolution through parameter satisfaction - { - auto packet = factory->NewPacket(); - packet->Decorate(Decoration<0>()); - - ASSERT_TRUE(fgA->m_called == 0) << "An AutoFilter was called " << fgA->m_called << " times when an optional input was unresolved"; - ASSERT_TRUE(fgB->m_called == 0) << "An AutoFilter was called " << fgB->m_called << " times when an optional input was unresolved"; - ASSERT_TRUE(fgC->m_called == 0) << "An AutoFilter was called " << fgC->m_called << " times when a required input was not available"; - - packet->Decorate(Decoration<1>()); - - ASSERT_TRUE(fgA->m_called == 1) << "An AutoFilter was called " << fgA->m_called << " times when all inputs were simultaneously available"; - ASSERT_TRUE(fgB->m_called == 1) << "An AutoFilter was called " << fgB->m_called << " times when all inputs were simultaneously available"; - ASSERT_TRUE(fgC->m_called == 1) << "An AutoFilter was called " << fgC->m_called << " times when all inputs were simultaneously available"; - ASSERT_TRUE(fgD->m_called == 0) << "An AutoFilter was called " << fgD->m_called << " times when an optional input was unresolved"; - } - - fgA->m_called = 0; - fgB->m_called = 0; - fgC->m_called = 0; - fgD->m_called = 0; - - //Test resultion through packet destruction - { - auto packet = factory->NewPacket(); - packet->Decorate(Decoration<0>()); - packet->Decorate(Decoration<2>()); - - ASSERT_TRUE(fgA->m_called == 0) << "An AutoFilter was called " << fgA->m_called << " before optional arguments were resolved"; - ASSERT_TRUE(fgB->m_called == 0) << "An AutoFilter was called " << fgB->m_called << " before optional arguments were resolved"; - ASSERT_TRUE(fgC->m_called == 0) << "An AutoFilter was called " << fgC->m_called << " before optional arguments were resolved"; - ASSERT_TRUE(fgD->m_called == 0) << "An AutoFilter was called " << fgD->m_called << " before optional arguments were resolved"; - } - - ASSERT_TRUE(fgA->m_called == 1) << "An AutoFilter was called " << fgA->m_called << " times when all required inputs were available"; - ASSERT_TRUE(fgB->m_called == 1) << "An AutoFilter was called " << fgB->m_called << " times when all required inputs were available"; - ASSERT_TRUE(fgC->m_called == 0) << "An AutoFilter was called " << fgC->m_called << " times when a required input was not available"; - ASSERT_TRUE(fgD->m_called == 1) << "An AutoFilter was called " << fgD->m_called << " times when all required inputs were available"; -} - TEST_F(AutoFilterTest, VerifyNoMultiDecorate) { AutoRequired filterA; AutoRequired factory; @@ -465,66 +415,6 @@ TEST_F(AutoFilterTest, VerifyAntiDecorate) { } } -class OptionalResolveFilter { -public: - size_t m_called; - OptionalResolveFilter() : m_called(0) { - DeclareAutoFilter(this, &OptionalResolveFilter::NextFilter1); - DeclareAutoFilter(this, &OptionalResolveFilter::NextFilter2); - }; - - void AutoFilter(AutoPacket& pkt, optional_ptr> opt) { - ++m_called; - if (pkt.Has>()) return; //Cannot attempt decorations - - if (opt) { - //Called before final - ASSERT_NO_THROW(pkt.Decorate(Decoration<-1>())) << "Decoration should be allowed"; - ASSERT_TRUE(pkt.Has>()); - - Decoration<-2> deco; - ASSERT_NO_THROW(pkt.DecorateImmediate(deco)) << "Decoration should be allowed"; - } else { - //Called during final - ASSERT_NO_THROW(pkt.Decorate(Decoration<-1>())) << "Decoration should be blocked quietly"; - ASSERT_TRUE(pkt.Has>()) << "Resolved AutoFilter calls should be able to add decorations"; - - Decoration<-2> deco; - ASSERT_NO_THROW(pkt.DecorateImmediate(deco)) << "Decoration should be blocked quietly"; - } - } - - void NextFilter1(AutoPacket& pkt, const Decoration<-1>& dec) { - ASSERT_TRUE(pkt.Has>()) << "NextFilter1 called during optional resolution"; - } - - void NextFilter2(AutoPacket& pkt, const Decoration<-2>& dec) { - ASSERT_TRUE(pkt.Has>()) << "NextFilter2 called during optional resolution"; - } -}; - -TEST_F(AutoFilterTest, BlockResolveRecursion) { - AutoRequired factory; - AutoRequired resolve; - - //Verify decoration success when optional is satisfied - resolve->m_called = 0; - { - auto pkt = factory->NewPacket(); - pkt->Decorate(Decoration<0>()); - ASSERT_EQ(1, resolve->m_called) << "Failed to call AutoFilter with satisfied optional argument"; - } - ASSERT_EQ(1, resolve->m_called) << "Multiple calls to AutoFilter with satisfied optional argument"; - - //Verify decoration blocking when optional is resolved - resolve->m_called = 0; - { - auto pkt = factory->NewPacket(); - ASSERT_EQ(0, resolve->m_called) << "Called AutoFilter with missing optional argument"; - } - ASSERT_EQ(1, resolve->m_called) << "Failed to call AutoFilter with resolved optional argument"; -} - /// /// Replicate the static_assert in has_autofilter /// @@ -875,7 +765,6 @@ TEST_F(AutoFilterTest, MultiImmediateComplex) { // All of the filters that we're adding AutoRequired>> fg1; - AutoRequired, optional_ptr>>> fg2; AutoRequired, Decoration<1>>> fg3; AutoRequired, Decoration<2>>> fg4; @@ -889,14 +778,12 @@ TEST_F(AutoFilterTest, MultiImmediateComplex) { // Validate expected behaviors: ASSERT_EQ(1, fg1->m_called) << "Trivial filter was not called as expected, even though Decoration<0> should have been available"; - ASSERT_EQ(1, fg2->m_called) << "Filter with an unsatisfied optional argument was not called"; ASSERT_EQ(1, fg3->m_called) << "Saturated filter was not called as expected"; ASSERT_EQ(0, fg4->m_called) << "Undersaturated filter was called even though it should not have been"; } // Validate expected behaviors: ASSERT_EQ(1, fg1->m_called) << "Trivial filter was called repeatedly"; - ASSERT_EQ(1, fg2->m_called) << "Filter with an unsatisfied optional argument was called repeatedly"; ASSERT_EQ(1, fg3->m_called) << "Saturated filter was not called as expected was called repeatedly"; ASSERT_EQ(0, fg4->m_called) << "Undersaturated filter was called"; } From 0f23c49f8de6011cb9bbbb2f67f3d55a45239fc0 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 5 Dec 2014 11:29:48 -0800 Subject: [PATCH 072/140] Include APPLE as a unix platform --- cmake-modules/ConditionalSources.cmake | 2 +- src/autowiring/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake-modules/ConditionalSources.cmake b/cmake-modules/ConditionalSources.cmake index 7766c0249..e24bd25b5 100644 --- a/cmake-modules/ConditionalSources.cmake +++ b/cmake-modules/ConditionalSources.cmake @@ -78,5 +78,5 @@ endmacro() #Some good defaults add_named_conditional_functions("windows_sources" "Windows Source" WIN32) add_named_conditional_functions("mac_sources" "Mac Source" APPLE) -add_named_conditional_functions("unix_sources" "Unix Source" "UNIX AND NOT APPLE AND NOT WIN32") +add_named_conditional_functions("unix_sources" "Unix Source" "UNIX AND NOT WIN32") add_named_conditional_functions("resource_files" "Resource Files" FALSE) diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 65834683d..db8e69b5b 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -170,7 +170,7 @@ add_mac_sources(Autowiring_SRCS CoreThreadMac.cpp ) -add_unix_sources( Autowiring_SRCS +add_unix_sources(Autowiring_SRCS InterlockedExchangeUnix.cpp thread_specific_ptr_unix.h ) From c9fd55bdacfbbd3a28bf4ae9307edc07a8d7a85d Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 5 Dec 2014 12:37:52 -0800 Subject: [PATCH 073/140] Updated visualizer to work with the latest AutoPacket definition --- nuget/tools/autowiring.natvis | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nuget/tools/autowiring.natvis b/nuget/tools/autowiring.natvis index 6c5bec08e..bbc235cd8 100644 --- a/nuget/tools/autowiring.natvis +++ b/nuget/tools/autowiring.natvis @@ -18,7 +18,7 @@ - + [Global Context] [ ] [{((char*)sc_type._M_data + 6 + (*(char*)sc_type._M_data == 's')),sb}] @@ -112,7 +112,7 @@ (AutoFilterDescriptor*)this - + Packet Factory @@ -144,7 +144,7 @@ (SharedPointerSlot*)m_space - + {((char*)m_type->_M_data + 6 + (*(char*)m_type->_M_data == 's')),sb} @@ -152,7 +152,7 @@ - + _Mysize @@ -162,7 +162,7 @@ - + [ {m_decorations._List._Mysize} decorations ] From 66cab45fb9e1c9ced646f032118126568c3bb212 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 5 Dec 2014 11:12:14 -0800 Subject: [PATCH 074/140] Refactoring auto_arg for efficiency and referential transparency --- autowiring/AutoFilterDescriptor.h | 4 +- autowiring/AutoPacket.h | 10 +- autowiring/AutoTimeStamp.h | 7 +- autowiring/CallExtractor.h | 6 +- autowiring/auto_arg.h | 171 ++++++++---------- autowiring/auto_in.h | 51 ++---- autowiring/auto_out.h | 131 +++++--------- src/autowiring/AutoPacket.cpp | 2 +- src/autowiring/test/ArgumentTypeTest.cpp | 23 +-- .../test/AutoFilterCollapseRulesTest.cpp | 42 +++-- src/autowiring/test/AutoFilterTest.cpp | 7 +- .../test/TestFixtures/Decoration.hpp | 1 + 12 files changed, 190 insertions(+), 265 deletions(-) diff --git a/autowiring/AutoFilterDescriptor.h b/autowiring/AutoFilterDescriptor.h index dddb32e3f..dc8f89ba5 100644 --- a/autowiring/AutoFilterDescriptor.h +++ b/autowiring/AutoFilterDescriptor.h @@ -27,7 +27,7 @@ struct AutoFilterDescriptorInput { {} template - AutoFilterDescriptorInput(auto_arg&& traits) : + AutoFilterDescriptorInput(auto_arg*) : is_input(auto_arg::is_input), is_output(auto_arg::is_output), is_shared(auto_arg::is_shared), @@ -46,7 +46,7 @@ struct AutoFilterDescriptorInput { template struct rebind { operator AutoFilterDescriptorInput() { - return auto_arg(); + return AutoFilterDescriptorInput((auto_arg*)nullptr); } }; }; diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index f7b5f01a0..c83f7fa2e 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -204,8 +204,7 @@ class AutoPacket: std::lock_guard lk(m_lock); auto q = m_decorations.find(typeid(T)); - if(q != m_decorations.end() && - q->second.satisfied) { + if(q != m_decorations.end() && q->second.satisfied) { auto& disposition = q->second; if(disposition.m_decoration) { out = disposition.m_decoration->as().get(); @@ -273,6 +272,13 @@ class AutoPacket: return false; } + template + const std::shared_ptr& GetShared(void) const { + const std::shared_ptr* retVal; + Get(retVal); + return *retVal; + } + /// /// De-templated placement method /// diff --git a/autowiring/AutoTimeStamp.h b/autowiring/AutoTimeStamp.h index 8e643abbf..26e222e8e 100644 --- a/autowiring/AutoTimeStamp.h +++ b/autowiring/AutoTimeStamp.h @@ -10,13 +10,12 @@ /// class AutoTimeStamp { public: - /// Alias type for maximum precision timing - class time : public std::chrono::high_resolution_clock::time_point {}; - /// Records time of issue of AutoPacket /// /// Default constructor yielding current time is called by auto_out - void AutoFilter(auto_out template class auto_arg: - public auto_in -{ -public: - auto_arg(AutoPacket& packet): - auto_in(packet) - {} - - static const bool is_shared = false; -}; + public auto_arg +{}; /// /// Specialization for "const T&" ~ auto_in /// template -class auto_arg: - public auto_in -{ -public: - auto_arg(AutoPacket& packet): - auto_in(packet) - {} - - static const bool is_shared = false; -}; +class auto_arg : + public auto_arg +{}; /// /// Specialization for "std::shared_ptr" ~ auto_in /// template -class auto_arg>: - public auto_in> +class auto_arg> { public: + typedef auto_in> type; typedef T id_type; - - auto_arg(AutoPacket& packet): - auto_in>(packet) - {} - + static const bool is_input = true; + static const bool is_output = false; static const bool is_shared = true; }; @@ -84,15 +66,8 @@ class auto_arg>: /// template class auto_arg>: - public auto_in -{ -public: - auto_arg(AutoPacket& packet): - auto_in(packet) - {} - - static const bool is_shared = true; -}; + public auto_arg +{}; /// /// Specialization for "T&" ~ auto_in @@ -102,12 +77,10 @@ class auto_arg : public auto_out { public: - typedef auto_out auto_type; - - auto_arg(AutoPacket& packet) : - auto_out(packet) - {} - + typedef auto_out type; + typedef T id_type; + static const bool is_input = false; + static const bool is_output = true; static const bool is_shared = false; }; @@ -115,16 +88,9 @@ class auto_arg : /// Specialization for "std::shared_ptr&" ~ auto_in /// template -class auto_arg&> : - public auto_out -{ -public: - auto_arg(AutoPacket& packet) : - auto_out(packet) - {} - - static const bool is_shared = false; -}; +class auto_arg&>: + public auto_arg +{}; /// /// Forbidden input T @@ -142,70 +108,23 @@ class auto_arg> { /// template class auto_arg>: - public auto_out -{ -public: - auto_arg(AutoPacket& packet): - auto_out(packet) - {} + public auto_arg +{}; - static const bool is_shared = true; -}; /// -/// Specialization for first-call "AutoPacket&" +/// AutoPacket specialization /// +/// +/// This type is treated as an input type because it supports concurrent modification +/// template<> class auto_arg { public: - auto_arg(AutoPacket& packet) : - m_packet(packet) - {} - -protected: - /// Sigil to distinguish AutoPacket& - class first_call_sigil { - public: - first_call_sigil(void); - virtual ~first_call_sigil(void); - }; - - AutoPacket& m_packet; - -public: - typedef first_call_sigil id_type; - - // Although AutoPacket& enable both inputs and outputs - // its availability is handled as an input. + typedef auto_in type; + typedef AutoPacket id_type; static const bool is_input = true; static const bool is_output = false; - - operator AutoPacket&(void) const { - return m_packet; - } - operator std::shared_ptr(void) { - return m_packet.shared_from_this(); - } - static const bool is_shared = false; }; - -/// -/// Specialization for final-call "const AutoPacket&" -/// -/// -/// This is called during Finalize, so the shared_ptr may -/// be invalidated if the associated ObjectPool is cleared. -/// Therefore it is essential that this cannot be used with -/// deferred calls. -/// -template<> -class auto_arg: - public auto_arg -{ -public: - auto_arg(const AutoPacket& packet) : - auto_arg(const_cast(packet)) - {} -}; diff --git a/autowiring/auto_in.h b/autowiring/auto_in.h index a2a0ea564..4ab7961a8 100644 --- a/autowiring/auto_in.h +++ b/autowiring/auto_in.h @@ -29,12 +29,25 @@ class auto_in const T& m_value; public: - const T& value(void) const { - return m_value; - } - - // Convenience overloads: operator const T&() const { return m_value; } const T& operator*(void) const { return m_value; } const T* operator->(void) const { return &m_value; } }; + + +template<> +class auto_in +{ +public: + auto_in(AutoPacket& packet) : + packet(packet) + {} + +private: + AutoPacket& packet; + +public: + operator AutoPacket&() const { return packet; } + AutoPacket& operator*(void) const { return packet; } + AutoPacket* operator->(void) const { return &packet; } +}; \ No newline at end of file diff --git a/autowiring/auto_out.h b/autowiring/auto_out.h index 1a4ed2df6..7dab8e33f 100644 --- a/autowiring/auto_out.h +++ b/autowiring/auto_out.h @@ -20,9 +20,6 @@ class auto_out public: typedef T id_type; - static const bool is_input = false; - static const bool is_output = true; - auto_out(const auto_out& rhs) = delete; auto_out(auto_out&& rhs) : m_packet(rhs.m_packet), diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 3a26d55c3..7691be46d 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -14,7 +14,6 @@ set(Autowiring_SRCS auto_in.h auto_out.h auto_arg.h - auto_arg.cpp AnySharedPointer.h AnySharedPointer.cpp AutoCheckout.h diff --git a/src/autowiring/auto_arg.cpp b/src/autowiring/auto_arg.cpp deleted file mode 100644 index 9da7446a6..000000000 --- a/src/autowiring/auto_arg.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. -#include "stdafx.h" -#include "auto_arg.h" - -auto_arg::first_call_sigil::first_call_sigil(void){} -auto_arg::first_call_sigil::~first_call_sigil(void){} - diff --git a/src/autowiring/test/ArgumentTypeTest.cpp b/src/autowiring/test/ArgumentTypeTest.cpp index 95564d798..a9c01c551 100644 --- a/src/autowiring/test/ArgumentTypeTest.cpp +++ b/src/autowiring/test/ArgumentTypeTest.cpp @@ -53,13 +53,13 @@ TEST_F(ArgumentTypeTest, AutoFilterTemplateTests) { ASSERT_TRUE(auto_arg::is_shared) << "Input is a shared ptr"; ASSERT_TRUE(auto_arg::is_input) << "Should be input"; - ASSERT_TRUE(auto_arg::is_shared) << "Input is a shared ptr"; + ASSERT_FALSE(auto_arg::is_shared) << "Input is not explicitly a shared ptr"; ASSERT_FALSE(auto_arg::is_input) << "Should be output"; ASSERT_FALSE(auto_arg::is_shared) << "Output is a shared ptr"; ASSERT_FALSE(auto_arg::is_input) << "Should be output"; - ASSERT_TRUE(auto_arg::is_shared) << "Output is a shared ptr"; + ASSERT_FALSE(auto_arg::is_shared) << "Output is a shared ptr"; } TEST_F(ArgumentTypeTest, TestAutoIn) { @@ -84,17 +84,18 @@ TEST_F(ArgumentTypeTest, TestAutoIn) { } // Deduced Type - auto_arg>> arg(*packet); - ASSERT_EQ(1, in.value().use_count()) << "AutoPacket should be the sole shared pointer reference"; + auto_arg>>::type arg(*packet); + ASSERT_EQ(1, in->use_count()) << "AutoPacket should be the sole shared pointer reference"; } TEST_F(ArgumentTypeTest, TestAutoOut) { AutoRequired factory; std::shared_ptr packet = factory->NewPacket(); { - auto_out> out(*packet); - ASSERT_FALSE(out.is_input) << "Incorrect orientation"; - ASSERT_TRUE(out.is_output) << "Incorrect orientation"; + typedef auto_arg&> t_argType; + t_argType::type out(*packet); + ASSERT_FALSE(t_argType::is_input) << "Incorrect orientation"; + ASSERT_TRUE(t_argType::is_output) << "Incorrect orientation"; // Implicit commitment to output out->i = 1; From eb40b3eebfdd73ebbef162c9596a7ab5884db139 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Fri, 5 Dec 2014 16:28:20 -0800 Subject: [PATCH 077/140] First skeleton implementation of AutoParameter and some unit tests of how it should extend AutoConfig with the use of a required default value and an optional validator --- autowiring/AutoConfig.h | 2 +- autowiring/AutoParameter.h | 38 +++++++++ src/autowiring/CMakeLists.txt | 1 + src/autowiring/test/AutoParameterTest.cpp | 96 +++++++++++++++++++++++ src/autowiring/test/CMakeLists.txt | 1 + 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 autowiring/AutoParameter.h create mode 100644 src/autowiring/test/AutoParameterTest.cpp diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 708404c2f..d68116134 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -58,7 +58,7 @@ class AutoConfig: (void)RegConfig::r; } -private: +protected: AutoRequired m_manager; public: diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h new file mode 100644 index 000000000..02b2e906f --- /dev/null +++ b/autowiring/AutoParameter.h @@ -0,0 +1,38 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#pragma once +#include "AutoConfig.h" + +/// +/// Register an AutoParameter with "AutoParam" namespace in AutoConfigManager. +/// In addition to being the lookup string, the Key also: +/// - Contains the default value +/// - Supply a validator function (optional) +/// +/// AutoParameter uses AutoConfig under the hood and will use "AutoParam" as +/// its namespace +/// +template +class AutoParameter: + public AutoConfig +{ +public: + AutoParameter() : + AutoConfig() + { + // TODO: + // REQUIRED: default value. + // OPTIONAL: validator. + // Make sure + } + + void Reset() { + // TODO: Reset to default + } + + bool Set(const T& value) { + // TODO: validate, set, etc + + this->m_manager->Set(this->m_key, value); + return true; + } +}; diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 3a26d55c3..2d1f3b4d1 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -39,6 +39,7 @@ set(Autowiring_SRCS AutoPacketFactory.cpp AutoPacketProfiler.h AutoPacketProfiler.cpp + AutoParameter.h AutoSelfUpdate.h AutoTimeStamp.h Autowired.h diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp new file mode 100644 index 000000000..dec125e16 --- /dev/null +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -0,0 +1,96 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include +#include + +class AutoParameterTest: + public testing::Test +{}; + + +struct MyParamClass1 { + AutoParameter m_param; +}; + +TEST_F(AutoParameterTest, VerifyDefaultValueRequired) { + ASSERT_ANY_THROW(AutoRequired()) + << "Should not allow parameter without default value"; +} + + +struct MyParamClass2 { + struct MyIntParam2 { + int GetDefault() const { return 0; } + }; + + AutoParameter m_param; +}; + +TEST_F(AutoParameterTest, VerifyCorrectDeconstruction) { + AutoRequired mpc; + auto& param = mpc->m_param; + + EXPECT_STREQ("AutoParam.MyIntClass1", param.m_key.c_str()) + << "Configuration variable name was not correctly extracted"; +} + +TEST_F(AutoParameterTest, VerifyDefaultValue) { + AutoRequired mpc; + auto& param = mpc->m_param; + + ASSERT_EQ(*param, 15) + << "Default value was not properly set"; +} + +TEST_F(AutoParameterTest, VerifyResetToDefaultValue) { + AutoRequired mpc; + auto& param = mpc->m_param; + + ASSERT_TRUE(param.Set(30) && *param == 30) + << "Could not set the parameter to another value"; + + param.Reset(); + + ASSERT_EQ(*param, 15) + << "Parameter was not properly reset to its default value"; +} + + +struct MyParamClass3 { + struct MyIntParam3 { + int GetDefault() const { return 15; } + + bool operator()(const int& value) { return 10 <= value && value <= 20; } + }; + + AutoParameter m_param; +}; + +TEST_F(AutoParameterTest, VerifyValidationFunction) { + AutoRequired mpc; + auto& param = mpc->m_param; + + ASSERT_FALSE(param.Set(9)) + << "Set() should return false when setting invalid value"; + ASSERT_EQ(*param, 15) + << "Failed set attempts should not have altered the previous state"; + + ASSERT_TRUE(param.Set(10) && *param == 10) + << "Should be able to set values that are valid according to the validation function"; +} + + +struct MyParamClass4 { + struct MyIntParam4 { + int GetDefault() const { return 0; } + + bool operator()(const int& value) { return 10 <= value && value <= 20; } + }; + + AutoParameter m_param; +}; + +TEST_F(AutoParameterTest, VerifyInvalidDefaultValue) { + ASSERT_ANY_THROW(AutoRequired()) + << "Cannot construct a parameter where default value is invalid"; +} diff --git a/src/autowiring/test/CMakeLists.txt b/src/autowiring/test/CMakeLists.txt index 12217bfc1..d355b1f88 100644 --- a/src/autowiring/test/CMakeLists.txt +++ b/src/autowiring/test/CMakeLists.txt @@ -6,6 +6,7 @@ set(AutowiringTest_SRCS AutoFilterCollapseRulesTest.cpp AutoInjectableTest.cpp AutoPacketFactoryTest.cpp + AutoParameterTest.cpp AutoRestarterTest.cpp AutowiringTest.cpp AutowiringUtilitiesTest.cpp From 50b2ce89dc4e9efeb23b6542a3fbd7327a7c8f25 Mon Sep 17 00:00:00 2001 From: Ted Nitz Date: Fri, 5 Dec 2014 17:11:38 -0800 Subject: [PATCH 078/140] Sort the source file list within the CMake configuration, and strip a couple trailing spaces. --- src/autonet/CMakeLists.txt | 2 +- src/autotesting/CMakeLists.txt | 2 +- src/autowiring/CMakeLists.txt | 126 ++++++++++++++++----------------- 3 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/autonet/CMakeLists.txt b/src/autonet/CMakeLists.txt index c66e5aa05..3cb1b5b82 100644 --- a/src/autonet/CMakeLists.txt +++ b/src/autonet/CMakeLists.txt @@ -75,7 +75,7 @@ endif() if(NOT NO_INSTALL_AUTONET AND NOT AUTOWIRING_IS_EMBEDDED) install(TARGETS AutoNet EXPORT AutowiringTargets DESTINATION lib - COMPONENT autowiring + COMPONENT autowiring CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES} ) endif() diff --git a/src/autotesting/CMakeLists.txt b/src/autotesting/CMakeLists.txt index 44516c513..143403caf 100644 --- a/src/autotesting/CMakeLists.txt +++ b/src/autotesting/CMakeLists.txt @@ -12,7 +12,7 @@ target_link_libraries(AutoTesting Autowiring) if(NOT AUTOWIRING_IS_EMBEDDED) install(TARGETS AutoTesting EXPORT AutowiringTargets DESTINATION lib - COMPONENT autowiring + COMPONENT autowiring CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES} ) endif() diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 7691be46d..0c34bad31 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -10,135 +10,135 @@ add_googletest(benchmark) # set(Autowiring_SRCS - at_exit.h - auto_in.h - auto_out.h - auto_arg.h - AnySharedPointer.h AnySharedPointer.cpp + AnySharedPointer.h + atomic_object.h + at_exit.h AutoCheckout.h - AutoConfig.h AutoConfig.cpp - AutoConfigManager.h + AutoConfig.h AutoConfigManager.cpp - AutoConfigParser.hpp + AutoConfigManager.h AutoConfigParser.cpp - AutoRestarter.h - AutoFuture.h - AutoFuture.cpp - AutowiringConfig.h - CoreJob.h - CoreJob.cpp + AutoConfigParser.hpp AutoFilterDescriptor.h - AutoInjectable.h + AutoFuture.cpp + AutoFuture.h AutoInjectable.cpp - AutoPacket.h + AutoInjectable.h AutoPacket.cpp - AutoPacketFactory.h + AutoPacket.h AutoPacketFactory.cpp - AutoPacketProfiler.h + AutoPacketFactory.h AutoPacketProfiler.cpp + AutoPacketProfiler.h + AutoRestarter.h AutoSelfUpdate.h AutoTimeStamp.h - Autowired.h - Autowired.cpp - AutowirableSlot.h AutowirableSlot.cpp + AutowirableSlot.h + Autowired.cpp + Autowired.h + autowiring.h + AutowiringConfig.h AutowiringConfig.h - AutowiringEvents.h AutowiringEvents.cpp - autowiring.h - autowiring_error.h + AutowiringEvents.h autowiring_error.cpp - BasicThread.h + autowiring_error.h + auto_arg.h + auto_in.h + auto_out.h BasicThread.cpp - BasicThreadStateBlock.h + BasicThread.h BasicThreadStateBlock.cpp + BasicThreadStateBlock.h Bolt.h - BoltBase.h BoltBase.cpp + BoltBase.h CallExtractor.h - ConfigRegistry.h ConfigRegistry.cpp + ConfigRegistry.h ContextCreator.h - ContextCreatorBase.h ContextCreatorBase.cpp - ContextEnumerator.h + ContextCreatorBase.h ContextEnumerator.cpp + ContextEnumerator.h ContextMap.h ContextMember.cpp ContextMember.h CoreContext.cpp CoreContext.h - CoreContextStateBlock.h CoreContextStateBlock.cpp + CoreContextStateBlock.h + CoreJob.cpp + CoreJob.h + CoreRunnable.cpp + CoreRunnable.h CoreThread.cpp CoreThread.h - CoreRunnable.h - CoreRunnable.cpp CreationRules.h CurrentContextPusher.cpp CurrentContextPusher.h DeclareAutoFilter.h Decompose.h DecorationDisposition.h - Deserialize.h Deferred.h - demangle.h demangle.cpp - DispatchQueue.h + demangle.h + Deserialize.h DispatchQueue.cpp + DispatchQueue.h DispatchThunk.h - expect.hpp EventInputStream.h - EventOutputStream.h EventOutputStream.cpp - EventRegistry.h + EventOutputStream.h EventRegistry.cpp - fast_pointer_cast.h - JunctionBox.h - JunctionBoxBase.h - JunctionBoxBase.cpp - JunctionBoxEntry.h - JunctionBoxManager.h - JunctionBoxManager.cpp - ExceptionFilter.h + EventRegistry.h ExceptionFilter.cpp + ExceptionFilter.h + expect.hpp + fast_pointer_cast.h GlobalCoreContext.cpp GlobalCoreContext.h - has_autoinit.h + hash_tuple.h has_autofilter.h + has_autoinit.h has_simple_constructor.h has_static_new.h - hash_tuple.h index_tuple.h - is_any.h - is_shared_ptr.h InterlockedExchange.h InvokeRelay.h - atomic_object.h + is_any.h + is_shared_ptr.h + JunctionBox.h + JunctionBoxBase.cpp + JunctionBoxBase.h + JunctionBoxEntry.h + JunctionBoxManager.cpp + JunctionBoxManager.h member_new_type.h - Object.h + MicroAutoFilter.h + MicroBolt.h + NewAutoFilter.h Object.cpp + Object.h ObjectPool.h - ObjectPoolMonitor.h ObjectPoolMonitor.cpp + ObjectPoolMonitor.h ObjectTraits.h SatCounter.h - MicroAutoFilter.h - MicroBolt.h - NewAutoFilter.h SharedPointerSlot.h - SlotInformation.h SlotInformation.cpp - TeardownNotifier.h + SlotInformation.h TeardownNotifier.cpp - ThreadStatusBlock.h + TeardownNotifier.h ThreadStatusBlock.cpp + ThreadStatusBlock.h thread_specific_ptr.h TypeIdentifier.h - TypeRegistry.h TypeRegistry.cpp + TypeRegistry.h TypeUnifier.h unlock_object.h uuid.h @@ -186,7 +186,7 @@ if(WIN32 AND NOT BUILD_64_BIT) enable_language(ASM_MASM) endif() -add_conditional_sources(Autowiring_SRCS "NOT WIN32 AND NOT APPLE" +add_conditional_sources(Autowiring_SRCS "NOT WIN32 AND NOT APPLE" GROUP_NAME "Linux Source" FILES CoreThreadLinux.cpp ) @@ -228,7 +228,7 @@ endif() if(NOT AUTOWIRING_IS_EMBEDDED) install(TARGETS Autowiring EXPORT AutowiringTargets DESTINATION lib - COMPONENT autowiring + COMPONENT autowiring CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES} ) endif() From a9b6b1dcd7c093d5cddd24f6f7b53d95b025dc3a Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Fri, 5 Dec 2014 17:24:30 -0800 Subject: [PATCH 079/140] Making Default() and Validate() static functions --- autowiring/AutoParameter.h | 6 +++--- src/autowiring/test/AutoParameterTest.cpp | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 02b2e906f..380bc3674 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -4,9 +4,9 @@ /// /// Register an AutoParameter with "AutoParam" namespace in AutoConfigManager. -/// In addition to being the lookup string, the Key also: -/// - Contains the default value -/// - Supply a validator function (optional) +/// In addition to being the lookup string, the Key also implements: +/// - static constexpr T Default() +/// - (optional) static bool Validate(const T&) /// /// AutoParameter uses AutoConfig under the hood and will use "AutoParam" as /// its namespace diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index dec125e16..859919135 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -20,7 +20,7 @@ TEST_F(AutoParameterTest, VerifyDefaultValueRequired) { struct MyParamClass2 { struct MyIntParam2 { - int GetDefault() const { return 0; } + static constexpr int Default() { return 15; } }; AutoParameter m_param; @@ -58,9 +58,8 @@ TEST_F(AutoParameterTest, VerifyResetToDefaultValue) { struct MyParamClass3 { struct MyIntParam3 { - int GetDefault() const { return 15; } - - bool operator()(const int& value) { return 10 <= value && value <= 20; } + static constexpr int Default() { return 15; } + static bool Validate(const int& value) { return 10 <= value && value <= 20; } }; AutoParameter m_param; @@ -82,9 +81,8 @@ TEST_F(AutoParameterTest, VerifyValidationFunction) { struct MyParamClass4 { struct MyIntParam4 { - int GetDefault() const { return 0; } - - bool operator()(const int& value) { return 10 <= value && value <= 20; } + static constexpr int Default() { return 0; } + static bool Validate(const int& value) { return 10 <= value && value <= 20; } }; AutoParameter m_param; From 2eed04c87a696258b33502d80613fd1fedd4954c Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Fri, 5 Dec 2014 18:59:21 -0800 Subject: [PATCH 080/140] Setting the default value in the AutoParameter constructor --- autowiring/AutoParameter.h | 1 + src/autowiring/test/AutoParameterTest.cpp | 22 ++++++---------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 380bc3674..f9e478cdb 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -19,6 +19,7 @@ class AutoParameter: AutoParameter() : AutoConfig() { + Set(TKey::Default()); // TODO: // REQUIRED: default value. // OPTIONAL: validator. diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 859919135..50d5f1783 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -9,33 +9,23 @@ class AutoParameterTest: struct MyParamClass1 { - AutoParameter m_param; -}; - -TEST_F(AutoParameterTest, VerifyDefaultValueRequired) { - ASSERT_ANY_THROW(AutoRequired()) - << "Should not allow parameter without default value"; -} - - -struct MyParamClass2 { - struct MyIntParam2 { + struct MyIntParam1 { static constexpr int Default() { return 15; } }; - AutoParameter m_param; + AutoParameter m_param; }; TEST_F(AutoParameterTest, VerifyCorrectDeconstruction) { - AutoRequired mpc; + AutoRequired mpc; auto& param = mpc->m_param; - EXPECT_STREQ("AutoParam.MyIntClass1", param.m_key.c_str()) + EXPECT_STREQ("AutoParam.MyParamClass1::MyIntParam1", param.m_key.c_str()) << "Configuration variable name was not correctly extracted"; } TEST_F(AutoParameterTest, VerifyDefaultValue) { - AutoRequired mpc; + AutoRequired mpc; auto& param = mpc->m_param; ASSERT_EQ(*param, 15) @@ -43,7 +33,7 @@ TEST_F(AutoParameterTest, VerifyDefaultValue) { } TEST_F(AutoParameterTest, VerifyResetToDefaultValue) { - AutoRequired mpc; + AutoRequired mpc; auto& param = mpc->m_param; ASSERT_TRUE(param.Set(30) && *param == 30) From 7fc1f27c86d2a864af068d215669a7ce67e05893 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Fri, 5 Dec 2014 19:01:24 -0800 Subject: [PATCH 081/140] Removing the explicit Reset() function because it has complications of how to propagate the context location of where a AutoConfig is set. Instead, just manually Set() --- autowiring/AutoParameter.h | 4 ---- src/autowiring/test/AutoParameterTest.cpp | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index f9e478cdb..c25834156 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -26,10 +26,6 @@ class AutoParameter: // Make sure } - void Reset() { - // TODO: Reset to default - } - bool Set(const T& value) { // TODO: validate, set, etc diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 50d5f1783..8f3930f35 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -39,7 +39,8 @@ TEST_F(AutoParameterTest, VerifyResetToDefaultValue) { ASSERT_TRUE(param.Set(30) && *param == 30) << "Could not set the parameter to another value"; - param.Reset(); + // Reset + param.Set(MyParamClass1::MyIntParam1::Default()); ASSERT_EQ(*param, 15) << "Parameter was not properly reset to its default value"; From 6da2a4e724ebaf11c47ffc91e6f8f1b9b739a971 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Mon, 8 Dec 2014 10:07:38 -0800 Subject: [PATCH 082/140] Add verify function for AutoParameter --- autowiring/AutoConfigManager.h | 8 +++++++- src/autowiring/AutoConfigManager.cpp | 4 ++++ src/autowiring/test/AutoConfigTest.cpp | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index ffb75c99a..457384e9e 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -20,6 +20,9 @@ class AutoConfigManager: // Callback function type typedef std::function t_callback; + // Validator function type + typedef std::function t_validator; + private: // lock for all members std::mutex m_lock; @@ -96,7 +99,10 @@ class AutoConfigManager: bool SetParsed(const std::string& key, const std::string& value); // Add a callback for when key is changed - void AddCallback(const std::string& key, std::function&& fx); + void AddCallback(const std::string& key, t_callback&& fx); + + // Add a validator for a config value + bool AddValidator(const std::string& key, t_validator&& validator); private: // Handles setting a value that has already been parsed into an AnySharedPointer diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index eb73d7b68..c8bfaf5d7 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -77,6 +77,10 @@ void AutoConfigManager::AddCallback(const std::string& key, t_callback&& fx) { m_callbacks[key].push_back(fx); } +bool AutoConfigManager::AddValidator(const std::string& key, t_validator&& validator) { + return true; +} + void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer value) { // Set value and mark that value was set from here m_attributes[key] = value; diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 831e2d0a5..298f3009d 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -229,3 +229,20 @@ TEST_F(AutoConfigTest, NestedContexts) { ASSERT_EQ(999, *mcc_sibling->m_myName) << "Value not set on sibling of context where value was previously set"; ASSERT_TRUE(callback_hit2) << "Callback not called on sibling of context where value was previously set"; } + +TEST_F(AutoConfigTest, Validators) { + AutoRequired acm; + AutoRequired mcc; + + acm->Set("Namespace1.XYZ", 42); + ASSERT_EQ(42, *mcc->m_myName); + + acm->AddValidator("Namespace1.XYZ", [](const AnySharedPointer& ptr){ + const int val = *ptr->as(); + + return (val < 50); + }); + + ASSERT_ANY_THROW(acm->Set("Namespace1.XYZ", 1337)) << "Should throw exception when setting invalid value"; + ASSERT_EQ(42, *mcc->m_myName); +} From e383f228c5798dfe5ad858cedbdb1a6ae9de9a5c Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Mon, 8 Dec 2014 12:21:47 -0800 Subject: [PATCH 083/140] First implementation of AutoParameter validation with has_validate SFINAE --- autowiring/AutoParameter.h | 15 ++++++++------ autowiring/has_validate.h | 39 +++++++++++++++++++++++++++++++++++ src/autowiring/CMakeLists.txt | 1 + 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 autowiring/has_validate.h diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index c25834156..e53bc1942 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -1,6 +1,7 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once #include "AutoConfig.h" +#include "has_validate.h" /// /// Register an AutoParameter with "AutoParam" namespace in AutoConfigManager. @@ -19,15 +20,17 @@ class AutoParameter: AutoParameter() : AutoConfig() { - Set(TKey::Default()); - // TODO: - // REQUIRED: default value. - // OPTIONAL: validator. - // Make sure + T defaultValue = TKey::Default(); + if (!CallValidate(defaultValue, has_validate())) { + throw autowiring_error("invalid value for key: " + this->m_key); + } + Set(defaultValue); } bool Set(const T& value) { - // TODO: validate, set, etc + if (!CallValidate(value, has_validate())) { + return false; + } this->m_manager->Set(this->m_key, value); return true; diff --git a/autowiring/has_validate.h b/autowiring/has_validate.h new file mode 100644 index 000000000..130868a2f --- /dev/null +++ b/autowiring/has_validate.h @@ -0,0 +1,39 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#pragma once +#include "Decompose.h" +#include + +template +struct has_validate_function { + template + struct unnamed_constant; + + template + static std::false_type select(...); + + template + static std::true_type select(unnamed_constant*); + + // Conveninece typedef used externally: + typedef decltype(select(nullptr)) has_valid; + + // Evaluates to true only if T includes a unique AutoFilter method with at least one argument. + static const bool value = has_valid::value; +}; + +/// +/// Detects whether the specified type T has a static method with the name Validate +/// +template +struct has_validate : has_validate_function::has_valid {}; + +template +static bool CallValidate(const Object& obj, std::true_type) { + return Validator::Validate(obj); +} + +template +static bool CallValidate(const Object& obj, std::false_type) { + return true; +} + diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 2d1f3b4d1..53c3ff0bb 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -112,6 +112,7 @@ set(Autowiring_SRCS has_autofilter.h has_simple_constructor.h has_static_new.h + has_validate.h hash_tuple.h index_tuple.h is_any.h From 4ace78b335d013c77430b4511586cb252fbdd624 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Mon, 8 Dec 2014 12:59:26 -0800 Subject: [PATCH 084/140] Eliminating an assertion that cannot actually be guaranteed --- src/autowiring/test/ObjectPoolTest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/autowiring/test/ObjectPoolTest.cpp b/src/autowiring/test/ObjectPoolTest.cpp index 72459fab0..de797593c 100644 --- a/src/autowiring/test/ObjectPoolTest.cpp +++ b/src/autowiring/test/ObjectPoolTest.cpp @@ -297,7 +297,12 @@ TEST_F(ObjectPoolTest, RundownWhileWaiting) { proceed = true; cv.notify_all(); } - ASSERT_ANY_THROW(pool.Wait()) << "Wait operation should throw if it is rundown while threads are waiting"; + + // This could throw, but we can't guarantee that it will; in either case, + // the behavior is tolerated + try { + pool.Wait(); + } catch(...) {} }); // Block until the async call is at least started From 5cd7b8058716d44994c6b1c6edec3cc9888df9c6 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 5 Dec 2014 17:31:18 -0800 Subject: [PATCH 085/140] Eliminating the need to define an STL metatype to use AddRecipient Also adding and testing a += operator overload --- autowiring/AnySharedPointer.h | 2 +- autowiring/AutoConfig.h | 4 +-- autowiring/AutoFilterDescriptor.h | 19 +++++------- autowiring/AutoPacket.h | 9 ++++++ autowiring/CallExtractor.h | 2 +- autowiring/SharedPointerSlot.h | 6 +--- .../test/AutoFilterFunctionTest.cpp | 30 +++++++++---------- 7 files changed, 37 insertions(+), 35 deletions(-) diff --git a/autowiring/AnySharedPointer.h b/autowiring/AnySharedPointer.h index d53876586..efbed42a0 100644 --- a/autowiring/AnySharedPointer.h +++ b/autowiring/AnySharedPointer.h @@ -97,7 +97,7 @@ class AnySharedPointerT: SharedPointerSlotT* slot(void) { return (SharedPointerSlotT*) m_space; } const SharedPointerSlotT* slot(void) const { return (const SharedPointerSlotT*) m_space; } - T& operator*(void) { return **slot(); } + T& operator*(void) { return *slot()->get(); } const T& operator*(void) const { return **slot(); } T* operator->(void) { return slot()->get().get(); } diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 708404c2f..d4d8b0d52 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -63,7 +63,7 @@ class AutoConfig: public: const T& operator*() const { - return *m_manager->Get(m_key).template as(); + return *m_manager->Get(m_key).template as().get(); } const T* operator->(void) const { @@ -80,7 +80,7 @@ class AutoConfig: // Add a callback for when this config value changes void operator+=(std::function&& fx) { m_manager->AddCallback(m_key, [fx](const AnySharedPointer& val){ - fx(*val.template as()); + fx(*val.template as().get()); }); } }; diff --git a/autowiring/AutoFilterDescriptor.h b/autowiring/AutoFilterDescriptor.h index dc8f89ba5..1ee3e8090 100644 --- a/autowiring/AutoFilterDescriptor.h +++ b/autowiring/AutoFilterDescriptor.h @@ -265,22 +265,19 @@ struct AutoFilterDescriptor: // capture it in a template processing context. Hopefully this can be changed // once MSVC adopts constexpr. AnySharedPointer( - std::shared_ptr( - pfn, - [](decltype(pfn)){} + std::shared_ptr( + (void*)pfn, + [](void*){} ) ), // The remainder is fairly straightforward - CallExtractor(), - &CallExtractor::Call - ) - {} + &typeid(pfn), - // Convenience overload: - template - AutoFilterDescriptor(RetType(&pfn)(Args...)): - AutoFilterDescriptor(&pfn) + CallExtractor::template Enumerate::types, + false, + CallExtractor::Call + ) {} protected: diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index c83f7fa2e..91a25a9d0 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -482,6 +482,15 @@ class AutoPacket: /// void AddRecipient(const AutoFilterDescriptor& descriptor); + /// + /// Convenience overload, identical in behavior to AddRecipient + /// + template + AutoPacket& operator+=(Fx&& fx) { + AddRecipient(AutoFilterDescriptor(std::forward(fx))); + return *this; + } + /// A reference to the satisfaction counter for the specified type /// /// If the type is not a subscriber GetSatisfaction().GetType() == nullptr will be true diff --git a/autowiring/CallExtractor.h b/autowiring/CallExtractor.h index e370b4a5e..bcd64435a 100644 --- a/autowiring/CallExtractor.h +++ b/autowiring/CallExtractor.h @@ -32,7 +32,7 @@ struct CallExtractor: // Handoff ((t_pfn)pfn)( - typename auto_arg::type(autoPacket.shared_from_this())... + typename auto_arg::type(autoPacket)... ); } }; diff --git a/autowiring/SharedPointerSlot.h b/autowiring/SharedPointerSlot.h index 72d96b6b2..84545e823 100644 --- a/autowiring/SharedPointerSlot.h +++ b/autowiring/SharedPointerSlot.h @@ -272,7 +272,7 @@ struct SharedPointerSlotT: return (void*)get().get(); } virtual const void* ptr(void) const override { - return get().get(); + return (const void*)get().get(); } virtual void New(void* pSpace, size_t nBytes) const override { @@ -312,8 +312,4 @@ struct SharedPointerSlotT: T* operator->(void) const { return get().get(); } - - T& operator*(void) const { - return *get(); - } }; diff --git a/src/autowiring/test/AutoFilterFunctionTest.cpp b/src/autowiring/test/AutoFilterFunctionTest.cpp index 76fea9115..144917d2c 100644 --- a/src/autowiring/test/AutoFilterFunctionTest.cpp +++ b/src/autowiring/test/AutoFilterFunctionTest.cpp @@ -16,8 +16,6 @@ void FilterFunction(const Decoration<0>& typeIn, auto_out> typeOut typeOut->i += 1 + typeIn.i; } -typedef std::function&, auto_out>)> FilterFunctionType; - TEST_F(AutoFilterFunctionalTest, FunctionDecorationTest) { // AddRecipient that is an instance of std::function f : a -> b // This must be satisfied by decoration of type a, @@ -29,7 +27,7 @@ TEST_F(AutoFilterFunctionalTest, FunctionDecorationTest) { { auto packet = factory->NewPacket(); packet->Decorate(Decoration<0>()); - packet->AddRecipient(FilterFunctionType(FilterFunction)); + packet->AddRecipient(AutoFilterDescriptor(&FilterFunction)); const Decoration<1>* getdec; ASSERT_TRUE(packet->Get(getdec)) << "Decoration function was not called"; } @@ -38,7 +36,7 @@ TEST_F(AutoFilterFunctionalTest, FunctionDecorationTest) { //NOTE: This test also catches failures to flush temporary subscriber information { auto packet = factory->NewPacket(); - packet->AddRecipient(FilterFunctionType(FilterFunction)); + packet->AddRecipient(AutoFilterDescriptor(&FilterFunction)); packet->Decorate(Decoration<0>()); const Decoration<1>* getdec; ASSERT_TRUE(packet->Get(getdec)) << "Decoration function was not called"; @@ -52,9 +50,15 @@ TEST_F(AutoFilterFunctionalTest, FunctionDecorationLambdaTest) { { auto packet = factory->NewPacket(); int addType = 1; - packet->AddRecipient(FilterFunctionType([addType](const Decoration<0>& typeIn, auto_out> typeOut) { - typeOut->i += 1 + typeIn.i; - })); + auto sentry = std::make_shared(true); + *packet += + [addType, sentry](const Decoration<0>& typeIn, auto_out> typeOut) { + typeOut->i += 1 + typeIn.i; + }; + + // Sentry's use count should be precisely two at this point + ASSERT_EQ(2UL, sentry.use_count()) << "Appended recipient lambda was destroyed unexpectedly when it should have been pended"; + packet->Decorate(Decoration<0>()); const Decoration<1>* getdec; ASSERT_TRUE(packet->Get(getdec)) << "Decoration function was not called"; @@ -62,31 +66,27 @@ TEST_F(AutoFilterFunctionalTest, FunctionDecorationLambdaTest) { } } -typedef std::function>)> InjectorFunctionType; - TEST_F(AutoFilterFunctionalTest, FunctionInjectorTest) { AutoRequired factory; auto packet = factory->NewPacket(); int addType = 1; - packet->AddRecipient(InjectorFunctionType([addType](auto_out> typeOut) { + packet->AddRecipient([addType](auto_out> typeOut) { typeOut->i += addType; - })); + }); const Decoration<0>* getdec; ASSERT_TRUE(packet->Get(getdec)) << "Decoration function was not called"; ASSERT_EQ(0 + addType, getdec->i) << "Increment was not applied"; } -typedef std::function&)> ExtractorFunctionType; - TEST_F(AutoFilterFunctionalTest, FunctionExtractorTest) { AutoRequired factory; auto packet = factory->NewPacket(); int extType = -1; - packet->AddRecipient(ExtractorFunctionType([&extType](const Decoration<1>& typeIn) { + packet->AddRecipient([&extType](const Decoration<1>& typeIn) { extType = typeIn.i; - })); + }); packet->Decorate(Decoration<1>()); ASSERT_EQ(1, extType) << "Decoration type was not extracted"; } From f37ed3228b0142d95aab575889b5d32ce0681feb Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Mon, 8 Dec 2014 14:48:32 -0800 Subject: [PATCH 086/140] Correctly check validators when setting a value --- autowiring/AutoConfigManager.h | 17 +++++--- src/autowiring/AutoConfigManager.cpp | 60 ++++++++++++++++++---------- 2 files changed, 52 insertions(+), 25 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 457384e9e..5d2f83423 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -31,13 +31,16 @@ class AutoConfigManager: const std::unordered_map m_registry; // Values of AutoConfigs in this context - std::unordered_map m_attributes; + std::unordered_map m_values; // Set of keys for values set from this context std::unordered_set m_setHere; // map of callbacks registered for a key std::unordered_map> m_callbacks; + + // map of validators registered for a key + std::unordered_map> m_validators; public: /// @@ -79,7 +82,7 @@ class AutoConfigManager: } // Set value in this AutoConfigManager - SetInternal(key, AnySharedPointer(std::make_shared(value))); + SetRecursive(key, AnySharedPointer(std::make_shared(value))); } /// @@ -102,10 +105,14 @@ class AutoConfigManager: void AddCallback(const std::string& key, t_callback&& fx); // Add a validator for a config value - bool AddValidator(const std::string& key, t_validator&& validator); + void AddValidator(const std::string& key, t_validator&& validator); private: - // Handles setting a value that has already been parsed into an AnySharedPointer + // Handles setting a value recursivly to all child contexts + // Must hold m_lock when calling this + void SetRecursive(const std::string& key, AnySharedPointer value); + + // Set a value in this manager, check validators, call callbacks // Must hold m_lock when calling this - void SetInternal(const std::string& key, AnySharedPointer value); + void SetInternal(const std::string& key, const AnySharedPointer& value); }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index c8bfaf5d7..ff5802bc0 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -30,7 +30,7 @@ AutoConfigManager::AutoConfigManager(void): // Is there AutoConfigManager in an ancestor? if (mgmt) { std::lock_guard lk(mgmt->m_lock); - m_attributes = mgmt->m_attributes; + m_values = mgmt->m_values; } } } @@ -39,15 +39,15 @@ AutoConfigManager::~AutoConfigManager(void){} bool AutoConfigManager::IsConfigured(const std::string& key) { std::lock_guard lk(m_lock); - return !!m_attributes.count(key); + return !!m_values.count(key); } AnySharedPointer& AutoConfigManager::Get(const std::string& key) { std::lock_guard lk(m_lock); // Check this first - if (m_attributes.count(key)) { - return m_attributes[key]; + if (m_values.count(key)) { + return m_values[key]; } // Key not found, throw exception @@ -77,19 +77,20 @@ void AutoConfigManager::AddCallback(const std::string& key, t_callback&& fx) { m_callbacks[key].push_back(fx); } -bool AutoConfigManager::AddValidator(const std::string& key, t_validator&& validator) { - return true; +void AutoConfigManager::AddValidator(const std::string& key, t_validator&& validator) { + std::lock_guard lk(m_lock); + if(validator(m_values[key])) { + m_validators[key].push_back(validator); + } else { + std::stringstream ss; + ss << "Current value for key '" << key << "' is invalid"; + throw autowiring_error(ss.str()); + } } -void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer value) { - // Set value and mark that value was set from here - m_attributes[key] = value; - m_setHere.insert(key); - - // Call callbacks for this key - for (const auto& cb : m_callbacks[key]) { - cb(value); - } +void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer value) { + // Actually set the value in this manager + SetInternal(key, value); // Enumerate descendant contexts auto enumerator = ContextEnumerator(GetContext()); @@ -113,14 +114,33 @@ void AutoConfigManager::SetInternal(const std::string& key, AnySharedPointer val ctxt.NextSibling(); continue; } - - mgmt->m_attributes[key] = value; - - for (const auto& cb : mgmt->m_callbacks[key]) - cb(value); + + //Actaully set the value + mgmt->SetInternal(key, value); // Continue to next context ++ctxt; } } + + // Mark that value was succefully set from this manager + m_setHere.insert(key); +} + +void AutoConfigManager::SetInternal(const std::string& key, const AnySharedPointer& value) { + // Call all validators for this key + for (auto const& fx : m_validators[key]) { + if (!fx(value)){ + std::stringstream ss; + ss << "Attempted to set key '" << key << "'which didin't pass validator"; + throw autowiring_error(ss.str()); + } + } + + m_values[key] = value; + + // Call callbacks for this key + for (const auto& cb : m_callbacks[key]) { + cb(value); + } } From ca4195c369306ea185d2ee972581b6aaaca44210 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Mon, 8 Dec 2014 14:55:12 -0800 Subject: [PATCH 087/140] Add more validator tests --- src/autowiring/AutoConfigManager.cpp | 6 +++--- src/autowiring/test/AutoConfigTest.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index ff5802bc0..e49c722de 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -79,12 +79,12 @@ void AutoConfigManager::AddCallback(const std::string& key, t_callback&& fx) { void AutoConfigManager::AddValidator(const std::string& key, t_validator&& validator) { std::lock_guard lk(m_lock); - if(validator(m_values[key])) { - m_validators[key].push_back(validator); - } else { + if(m_values.count(key) && !validator(m_values[key])) { std::stringstream ss; ss << "Current value for key '" << key << "' is invalid"; throw autowiring_error(ss.str()); + } else { + m_validators[key].push_back(validator); } } diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 298f3009d..8c5b37898 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -234,6 +234,11 @@ TEST_F(AutoConfigTest, Validators) { AutoRequired acm; AutoRequired mcc; + // Add validator to key that hasn't been set + acm->AddValidator("Namespace1.XYZ", [](const AnySharedPointer& ptr){ + return true; + }); + acm->Set("Namespace1.XYZ", 42); ASSERT_EQ(42, *mcc->m_myName); @@ -245,4 +250,11 @@ TEST_F(AutoConfigTest, Validators) { ASSERT_ANY_THROW(acm->Set("Namespace1.XYZ", 1337)) << "Should throw exception when setting invalid value"; ASSERT_EQ(42, *mcc->m_myName); + + // Assert adding validator that doesn't validate current value throws execpetion + ASSERT_ANY_THROW(acm->AddValidator("Namespace1.XYZ", [](const AnySharedPointer& ptr){ + const int val = *ptr->as(); + + return (val < 0); + })); } From bb68aa2f292f2b85ed4da5327a1c16d276fb1243 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Mon, 8 Dec 2014 16:58:52 -0800 Subject: [PATCH 088/140] =?UTF-8?q?Removed=20the=20setting/configuring=20o?= =?UTF-8?q?f=20the=20parameter=20in=20the=20constructor.=20=20A=20paramete?= =?UTF-8?q?r=20will=20not=20be=20=E2=80=9CConfigured=E2=80=9D=20until=20it?= =?UTF-8?q?=20is=20explicitly=20set=20by=20the=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autowiring/AutoParameter.h | 34 +++++++++++++++++++---- src/autowiring/test/AutoParameterTest.cpp | 10 +++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index e53bc1942..999426c38 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -18,21 +18,43 @@ class AutoParameter: { public: AutoParameter() : - AutoConfig() + AutoConfig(), + m_default(TKey::Default()) { - T defaultValue = TKey::Default(); - if (!CallValidate(defaultValue, has_validate())) { - throw autowiring_error("invalid value for key: " + this->m_key); + if (!isValid(m_default)) { + throw autowiring_error("invalid default value for key: " + this->m_key); + } + + if (this->IsConfigured() && isValid(this->template operator*())) { + throw autowiring_error("currently configured value is invalid for key: " + this->m_key); } - Set(defaultValue); + } + + const T& operator*() const { + return this->IsConfigured() ? + this->template AutoConfig::operator*() : + m_default; + } + + const T* operator->(void) const { + return this->IsConfigured() ? + this->template AutoConfig::operator->() : + &m_default; } bool Set(const T& value) { - if (!CallValidate(value, has_validate())) { + if (!isValid(value)) { return false; } this->m_manager->Set(this->m_key, value); return true; } + +protected: + const T m_default; + + bool isValid(const T& value) const { + return CallValidate(value, has_validate()); + } }; diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 8f3930f35..69e35a6c1 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -30,6 +30,16 @@ TEST_F(AutoParameterTest, VerifyDefaultValue) { ASSERT_EQ(*param, 15) << "Default value was not properly set"; + ASSERT_FALSE(param.IsConfigured()) + << "Using the default value does not mean the parameter should be configured/set"; +} + +TEST_F(AutoParameterTest, VerifySetShouldCallConfigure) { + AutoRequired mpc; + auto& param = mpc->m_param; + + ASSERT_TRUE(param.Set(MyParamClass1::MyIntParam1::Default()) && param.IsConfigured()) + << "Settung the variable should configure it in the auto config manager"; } TEST_F(AutoParameterTest, VerifyResetToDefaultValue) { From 626bb432547f0f598ce54f94a0321808de48a64b Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Mon, 8 Dec 2014 16:59:35 -0800 Subject: [PATCH 089/140] changing variable name --- src/autowiring/test/AutoParameterTest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 69e35a6c1..c985d352a 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -57,17 +57,17 @@ TEST_F(AutoParameterTest, VerifyResetToDefaultValue) { } -struct MyParamClass3 { - struct MyIntParam3 { +struct MyParamClass2 { + struct MyIntParam2 { static constexpr int Default() { return 15; } static bool Validate(const int& value) { return 10 <= value && value <= 20; } }; - AutoParameter m_param; + AutoParameter m_param; }; TEST_F(AutoParameterTest, VerifyValidationFunction) { - AutoRequired mpc; + AutoRequired mpc; auto& param = mpc->m_param; ASSERT_FALSE(param.Set(9)) From da773f20aa0915da884d573ca26465ccf3629194 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Mon, 8 Dec 2014 17:14:33 -0800 Subject: [PATCH 090/140] name change --- src/autowiring/test/AutoParameterTest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index c985d352a..9faab10da 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -80,16 +80,16 @@ TEST_F(AutoParameterTest, VerifyValidationFunction) { } -struct MyParamClass4 { - struct MyIntParam4 { +struct MyParamClass3 { + struct MyIntParam3 { static constexpr int Default() { return 0; } static bool Validate(const int& value) { return 10 <= value && value <= 20; } }; - AutoParameter m_param; + AutoParameter m_param; }; TEST_F(AutoParameterTest, VerifyInvalidDefaultValue) { - ASSERT_ANY_THROW(AutoRequired()) + ASSERT_ANY_THROW(AutoRequired()) << "Cannot construct a parameter where default value is invalid"; } From 333ad682c3e014550f05ca1aa853a52486e700dc Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Mon, 8 Dec 2014 17:15:01 -0800 Subject: [PATCH 091/140] Adding the validator to AutoConfigManager in the construction of AutoParameter --- autowiring/AutoParameter.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 999426c38..f28b9f1ab 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -28,6 +28,10 @@ class AutoParameter: if (this->IsConfigured() && isValid(this->template operator*())) { throw autowiring_error("currently configured value is invalid for key: " + this->m_key); } + + this->m_manager->AddValidator(this->m_key, [this](const AnySharedPointer& val) -> bool { + return isValid(*val.template as().get()); + }); } const T& operator*() const { From 9c455c2bdd172185d63846970c20c5ff8c70a614 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Mon, 8 Dec 2014 18:07:16 -0800 Subject: [PATCH 092/140] Fixed incorrect logic for adding a parameter that was previously configured but invalid upon parameter construction --- autowiring/AutoParameter.h | 2 +- src/autowiring/test/AutoParameterTest.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index f28b9f1ab..01ee55363 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -25,7 +25,7 @@ class AutoParameter: throw autowiring_error("invalid default value for key: " + this->m_key); } - if (this->IsConfigured() && isValid(this->template operator*())) { + if (this->IsConfigured() && !isValid(this->template operator*())) { throw autowiring_error("currently configured value is invalid for key: " + this->m_key); } diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 9faab10da..39eec8168 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -93,3 +93,20 @@ TEST_F(AutoParameterTest, VerifyInvalidDefaultValue) { ASSERT_ANY_THROW(AutoRequired()) << "Cannot construct a parameter where default value is invalid"; } + +struct MyParamClass4 { + struct MyIntParam4 { + static constexpr int Default() { return 15; } + static bool Validate(const int& value) { return 10 <= value && value <= 20; } + }; + + AutoParameter m_param; +}; + +TEST_F(AutoParameterTest, VerifyInvalidPreconfiguredValue) { + AutoRequired acm; + acm->Set("AutoParam.MyParamClass4::MyIntParam4", 0); + + ASSERT_ANY_THROW(AutoRequired()) + << "Should not be able to initialize a parameter that had a previous value set that is invalid with new validation"; +} From 5422a3833cc177c99eb338c3409cc2519cda5d1c Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 11:36:39 -0800 Subject: [PATCH 093/140] Move ConfigTypeExtractor definition to ConfigRegistry We can now access the raw key types in the registry --- autowiring/AutoConfig.h | 13 ++----------- autowiring/ConfigRegistry.h | 16 ++++++++++------ src/autowiring/AutoConfigParser.cpp | 4 ++-- src/autowiring/test/AutoConfigTest.cpp | 2 +- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index d4d8b0d52..41df95f59 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -15,11 +15,6 @@ struct AnySharedPointer; /// class AutoConfigBase { -protected: - // Template arguemnts TKey specify the key and optional namespace for a config attribute - template - struct ConfigTypeExtractor {}; - public: AutoConfigBase(const std::type_info& tiName); @@ -44,18 +39,14 @@ template class AutoConfig: public AutoConfigBase { -private: - // Specifies the optional namespace and key for this config attribute - typedef ConfigTypeExtractor t_field; - public: static_assert(sizeof...(TKey)==1 || sizeof...(TKey)==2, "Must provide a key and optional namespace"); AutoConfig(void) : - AutoConfigBase(typeid(t_field)) + AutoConfigBase(typeid(ConfigTypeExtractor)) { // Register with config registry - (void)RegConfig::r; + (void)RegConfig::r; } private: diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 4dc6f3d13..41dc90b5f 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -35,12 +35,16 @@ struct ConfigRegistryEntry { virtual AnySharedPointer parse(const std::string&) const = 0; }; -template +// Template arguemnts TKey specify the key and optional namespace for a config attribute +template +struct ConfigTypeExtractor {}; + +template struct ConfigRegistryEntryT: public ConfigRegistryEntry { ConfigRegistryEntryT(void): - ConfigRegistryEntry(typeid(Key)) + ConfigRegistryEntry(typeid(ConfigTypeExtractor)) {} bool verifyType(const std::type_info& ti) const override { @@ -89,12 +93,12 @@ extern size_t g_confgiEntryCount; /// Any instance of this type registry parameterized on type T will be added to the /// global static type registry, and this registry is computed at link time. /// -template +template class RegConfig { public: - static const ConfigRegistryEntryT r; + static const ConfigRegistryEntryT r; }; -template -const ConfigRegistryEntryT RegConfig::r; +template +const ConfigRegistryEntryT RegConfig::r; diff --git a/src/autowiring/AutoConfigParser.cpp b/src/autowiring/AutoConfigParser.cpp index 4c73921b8..43b93b51c 100644 --- a/src/autowiring/AutoConfigParser.cpp +++ b/src/autowiring/AutoConfigParser.cpp @@ -13,7 +13,7 @@ std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { std::string arg1; std::string arg2; - ss >> expect("AutoConfigBase::ConfigTypeExtractor<"); + ss >> expect("ConfigTypeExtractor<"); ss >> arg1; // If arg1 contains a comma, there are 2 arguments @@ -44,7 +44,7 @@ std::string autowiring::ExtractKeyWin(std::stringstream& ss) { std::string arg1; std::string arg2; - ss >> expect("struct") >> expect("AutoConfigBase::ConfigTypeExtractor> expect("struct") >> expect("ConfigTypeExtractor> arg1; // If arg1 contains a comma, there are 2 arguments diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 8c5b37898..f1726a989 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -121,7 +121,7 @@ TEST_F(AutoConfigTest, VerifyDuplicateConfigAssignment) { } TEST_F(AutoConfigTest, ExtractKeyTestWin) { - std::stringstream win("struct AutoConfigBase::ConfigTypeExtractor"); + std::stringstream win("struct ConfigTypeExtractor"); ASSERT_STREQ( "Namespace1.XYZ", From 2e6ddfe596b678f9b0c730a464a433c5ed4a03de Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 11:56:53 -0800 Subject: [PATCH 094/140] Add get validator function. Needs to handle incomplete types --- autowiring/AutoParameter.h | 2 ++ autowiring/ConfigRegistry.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 999426c38..a8e680047 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -12,6 +12,8 @@ /// AutoParameter uses AutoConfig under the hood and will use "AutoParam" as /// its namespace /// +struct AutoParam{}; + template class AutoParameter: public AutoConfig diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 41dc90b5f..2e50b349c 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -6,6 +6,7 @@ #include "AnySharedPointer.h" #include "autowiring_error.h" #include "demangle.h" +#include "has_validate.h" // Check if 'T' has a valid stream conversion operator template @@ -33,6 +34,8 @@ struct ConfigRegistryEntry { virtual bool verifyType(const std::type_info& ti) const = 0; virtual AnySharedPointer parse(const std::string&) const = 0; + + virtual std::function validator(void) const = 0; }; // Template arguemnts TKey specify the key and optional namespace for a config attribute @@ -81,6 +84,13 @@ struct ConfigRegistryEntryT: throw autowiring_error("This type doesn't support stream conversions.\ Define one if you want this to be parsable"); }; + + std::function validator(void) const override { + return [] (const AnySharedPointer& ptr) { + typedef decltype(std::get(std::tuple())) validator_t; + return CallValidate(*ptr.template as().get(), has_validate()); + }; + } }; extern const ConfigRegistryEntry* g_pFirstConfigEntry; From 0be84a3ab2351be231b726529d9903a3cde953c9 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 12:14:44 -0800 Subject: [PATCH 095/140] Add get_last to extract last parameter in parameter pack --- autowiring/ConfigRegistry.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 2e50b349c..9462be04a 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -42,6 +42,19 @@ struct ConfigRegistryEntry { template struct ConfigTypeExtractor {}; +template +struct get_last; + +template +struct get_last{ + typedef typename get_last::last last; +}; + +template +struct get_last{ + typedef T last; +}; + template struct ConfigRegistryEntryT: public ConfigRegistryEntry @@ -87,7 +100,7 @@ struct ConfigRegistryEntryT: std::function validator(void) const override { return [] (const AnySharedPointer& ptr) { - typedef decltype(std::get(std::tuple())) validator_t; + typedef typename get_last::last validator_t; return CallValidate(*ptr.template as().get(), has_validate()); }; } From b37e078910e63ae8ce79c045d6ebddff85826894 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Tue, 9 Dec 2014 13:35:32 -0800 Subject: [PATCH 096/140] Constexpr not supported in MSVC, fixing other miscellaneous MSVC compiler errors --- autowiring/AutoParameter.h | 7 ++++--- src/autowiring/test/AutoParameterTest.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 01ee55363..c5f745327 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -25,7 +25,7 @@ class AutoParameter: throw autowiring_error("invalid default value for key: " + this->m_key); } - if (this->IsConfigured() && !isValid(this->template operator*())) { + if (this->IsConfigured() && !isValid(**this)) { throw autowiring_error("currently configured value is invalid for key: " + this->m_key); } @@ -35,8 +35,9 @@ class AutoParameter: } const T& operator*() const { - return this->IsConfigured() ? - this->template AutoConfig::operator*() : + return + this->IsConfigured() ? + AutoConfig::operator*() : m_default; } diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 39eec8168..598ec9442 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -10,7 +10,7 @@ class AutoParameterTest: struct MyParamClass1 { struct MyIntParam1 { - static constexpr int Default() { return 15; } + static int Default() { return 15; } }; AutoParameter m_param; @@ -59,7 +59,7 @@ TEST_F(AutoParameterTest, VerifyResetToDefaultValue) { struct MyParamClass2 { struct MyIntParam2 { - static constexpr int Default() { return 15; } + static int Default() { return 15; } static bool Validate(const int& value) { return 10 <= value && value <= 20; } }; @@ -82,7 +82,7 @@ TEST_F(AutoParameterTest, VerifyValidationFunction) { struct MyParamClass3 { struct MyIntParam3 { - static constexpr int Default() { return 0; } + static int Default() { return 0; } static bool Validate(const int& value) { return 10 <= value && value <= 20; } }; @@ -96,7 +96,7 @@ TEST_F(AutoParameterTest, VerifyInvalidDefaultValue) { struct MyParamClass4 { struct MyIntParam4 { - static constexpr int Default() { return 15; } + static int Default() { return 15; } static bool Validate(const int& value) { return 10 <= value && value <= 20; } }; From d4c3bb8ae8f0ab3588de934c2a0243bb582e3417 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 14:19:22 -0800 Subject: [PATCH 097/140] Add validator AutoConfig test --- src/autowiring/test/AutoConfigTest.cpp | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index f1726a989..d9b313192 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -258,3 +258,30 @@ TEST_F(AutoConfigTest, Validators) { return (val < 0); })); } + +struct MyValidatedClass{ + struct ValidatedKey{ + static bool Validate(const int& value) { + return value > 5; + } + }; + + AutoConfig m_config; +}; + +TEST_F(AutoConfigTest, ImplicitValidator) { + AutoRequired acm; + + ASSERT_ANY_THROW(acm->Set("ValidatedKey", 2)) << "AutoConfigManager didn't regect invalid value"; + + AutoRequired valid; + + acm->Set("ValidatedKey", 42); + ASSERT_EQ(41, *valid->m_config) << "Value not set for key"; + + ASSERT_ANY_THROW(acm->Set("ValidatedKey", 1)) << "AutoConfigManager didn't regect invalid value"; + ASSERT_EQ(41, *valid->m_config) << "Value not set for key"; + + acm->Set("ValidatedKey", 1337); + ASSERT_EQ(1337, *valid->m_config) << "Value not set for key"; +} From 29f35fd7b4c636b050c1d470844cfd77c8692302 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 15:38:12 -0800 Subject: [PATCH 098/140] Added static validator functionality to AutoConfigManager The internal validator and registry maps are now const static --- autowiring/AutoConfigManager.h | 27 +++++----- autowiring/ConfigRegistry.h | 13 +++-- src/autowiring/AutoConfigManager.cpp | 73 +++++++++++++++----------- src/autowiring/ConfigRegistry.cpp | 5 +- src/autowiring/test/AutoConfigTest.cpp | 46 +++------------- 5 files changed, 77 insertions(+), 87 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 5d2f83423..627430252 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -24,12 +24,15 @@ class AutoConfigManager: typedef std::function t_validator; private: + // local map of the config registry + static const std::unordered_map s_registry; + + // map of validators registered for a key + static const std::unordered_map> s_validators; + // lock for all members std::mutex m_lock; - // local map of the Config registry - const std::unordered_map m_registry; - // Values of AutoConfigs in this context std::unordered_map m_values; @@ -38,9 +41,6 @@ class AutoConfigManager: // map of callbacks registered for a key std::unordered_map> m_callbacks; - - // map of validators registered for a key - std::unordered_map> m_validators; public: /// @@ -48,6 +48,11 @@ class AutoConfigManager: /// bool IsConfigured(const std::string& key); + /// + /// Check if this key was inherited from an ancestor context + /// + bool IsInherited(const std::string& key); + /// /// Get a reference to where the config value is stored /// @@ -66,15 +71,14 @@ class AutoConfigManager: /// template void Set(const std::string& key, const T& value) { - std::lock_guard lk(m_lock); - if (!m_registry.count(key)) { + if (!s_registry.count(key)) { std::stringstream ss; ss << "No configuration found for key '" << key << "'"; throw autowiring_error(ss.str()); } - if (!m_registry.at(key)->verifyType(typeid(T))) { + if (!s_registry.at(key)->verifyType(typeid(T))) { std::stringstream ss; ss << "Attempting to set config '" << key << "' with incorrect type '" << autowiring::demangle(typeid(T)) << "'"; @@ -104,9 +108,6 @@ class AutoConfigManager: // Add a callback for when key is changed void AddCallback(const std::string& key, t_callback&& fx); - // Add a validator for a config value - void AddValidator(const std::string& key, t_validator&& validator); - private: // Handles setting a value recursivly to all child contexts // Must hold m_lock when calling this @@ -114,5 +115,5 @@ class AutoConfigManager: // Set a value in this manager, check validators, call callbacks // Must hold m_lock when calling this - void SetInternal(const std::string& key, const AnySharedPointer& value); + void SetInternal(const std::string& key, const AnySharedPointer& value, bool setFromHere=false); }; diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 9462be04a..d99203bdc 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -21,7 +21,7 @@ struct has_stream { }; struct ConfigRegistryEntry { - ConfigRegistryEntry(const std::type_info& ti); + ConfigRegistryEntry(const std::type_info& ti, bool has_validator); // Next entry in the list: const ConfigRegistryEntry* const pFlink; @@ -29,6 +29,9 @@ struct ConfigRegistryEntry { // Configuration name const std::string m_key; + // True if a validator was provided + const bool m_has_validator; + bool is(const std::string& key) const; virtual bool verifyType(const std::type_info& ti) const = 0; @@ -59,8 +62,11 @@ template struct ConfigRegistryEntryT: public ConfigRegistryEntry { + // The "key" proper, without the namespace + typedef typename get_last::last t_key; + ConfigRegistryEntryT(void): - ConfigRegistryEntry(typeid(ConfigTypeExtractor)) + ConfigRegistryEntry(typeid(ConfigTypeExtractor), has_validate()) {} bool verifyType(const std::type_info& ti) const override { @@ -100,8 +106,7 @@ struct ConfigRegistryEntryT: std::function validator(void) const override { return [] (const AnySharedPointer& ptr) { - typedef typename get_last::last validator_t; - return CallValidate(*ptr.template as().get(), has_validate()); + return CallValidate(*ptr.template as().get(), has_validate()); }; } }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index e49c722de..248d776a8 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -9,6 +9,7 @@ using namespace autowiring; +// Create map of all config values in the program static std::unordered_map FillRegistry(void) { std::unordered_map registry; @@ -19,9 +20,23 @@ static std::unordered_map FillRegistry( return registry; } -AutoConfigManager::AutoConfigManager(void): - m_registry(FillRegistry()) -{ +// Create map of all validators specified +static std::unordered_map> FillValidators(void) { + std::unordered_map> validator; + + for (auto config = g_pFirstConfigEntry; config; config = config->pFlink) { + if (config->m_has_validator) { + validator[config->m_key].push_back(config->validator()); + } + } + + return validator; +} + +const std::unordered_map AutoConfigManager::s_registry = FillRegistry(); +const std::unordered_map> AutoConfigManager::s_validators = FillValidators(); + +AutoConfigManager::AutoConfigManager(void){ // Copy parents config settings auto parent = GetContext()->GetParentContext(); if (parent) { @@ -42,6 +57,11 @@ bool AutoConfigManager::IsConfigured(const std::string& key) { return !!m_values.count(key); } +bool AutoConfigManager::IsInherited(const std::string& key) { + std::lock_guard lk(m_lock); + return !m_setHere.count(key); +} + AnySharedPointer& AutoConfigManager::Get(const std::string& key) { std::lock_guard lk(m_lock); @@ -61,14 +81,12 @@ void AutoConfigManager::Set(const std::string& key, const char* value) { } bool AutoConfigManager::SetParsed(const std::string& key, const std::string& value) { - std::lock_guard lk(m_lock); - // Key not found - if (!m_registry.count(key)) { + if (!s_registry.count(key)) { return false; } - SetInternal(key, m_registry.at(key)->parse(value)); + SetInternal(key, s_registry.at(key)->parse(value)); return true; } @@ -77,20 +95,9 @@ void AutoConfigManager::AddCallback(const std::string& key, t_callback&& fx) { m_callbacks[key].push_back(fx); } -void AutoConfigManager::AddValidator(const std::string& key, t_validator&& validator) { - std::lock_guard lk(m_lock); - if(m_values.count(key) && !validator(m_values[key])) { - std::stringstream ss; - ss << "Current value for key '" << key << "' is invalid"; - throw autowiring_error(ss.str()); - } else { - m_validators[key].push_back(validator); - } -} - void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer value) { // Actually set the value in this manager - SetInternal(key, value); + SetInternal(key, value, true); // Enumerate descendant contexts auto enumerator = ContextEnumerator(GetContext()); @@ -106,11 +113,10 @@ void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer va std::shared_ptr mgmt; (*ctxt)->FindByType(mgmt); if (mgmt) { - std::lock_guard(mgmt->m_lock); // Check if value set from this context // If so, stop recursing down this branch, continue to sibling - if (mgmt->m_setHere.count(key)){ + if (!mgmt->IsInherited(key)){ ctxt.NextSibling(); continue; } @@ -122,23 +128,30 @@ void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer va ++ctxt; } } - - // Mark that value was succefully set from this manager - m_setHere.insert(key); } -void AutoConfigManager::SetInternal(const std::string& key, const AnySharedPointer& value) { +void AutoConfigManager::SetInternal(const std::string& key, const AnySharedPointer& value, bool setFromHere) { + // Call all validators for this key - for (auto const& fx : m_validators[key]) { - if (!fx(value)){ - std::stringstream ss; - ss << "Attempted to set key '" << key << "'which didin't pass validator"; - throw autowiring_error(ss.str()); + if (s_validators.count(key)) { + for (auto const& fx : s_validators.at(key)) { + if (!fx(value)){ + std::stringstream ss; + ss << "Attempted to set key '" << key << "'which didin't pass validator"; + throw autowiring_error(ss.str()); + } } } + // Lock when modifiy local maps + std::lock_guard lk(m_lock); m_values[key] = value; + // Mark if this key was set from here, and not inherited + if (setFromHere){ + m_setHere.insert(key); + } + // Call callbacks for this key for (const auto& cb : m_callbacks[key]) { cb(value); diff --git a/src/autowiring/ConfigRegistry.cpp b/src/autowiring/ConfigRegistry.cpp index 944912f48..2728c9274 100644 --- a/src/autowiring/ConfigRegistry.cpp +++ b/src/autowiring/ConfigRegistry.cpp @@ -7,9 +7,10 @@ const ConfigRegistryEntry* g_pFirstConfigEntry = nullptr; size_t g_configEntryCount = 0; -ConfigRegistryEntry::ConfigRegistryEntry(const std::type_info& tinfo) : +ConfigRegistryEntry::ConfigRegistryEntry(const std::type_info& tinfo, bool has_validator) : pFlink(g_pFirstConfigEntry), - m_key(autowiring::ExtractKey(tinfo)) + m_key(autowiring::ExtractKey(tinfo)), + m_has_validator(has_validator) { g_configEntryCount++; g_pFirstConfigEntry = this; diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index d9b313192..381181424 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -230,46 +230,16 @@ TEST_F(AutoConfigTest, NestedContexts) { ASSERT_TRUE(callback_hit2) << "Callback not called on sibling of context where value was previously set"; } -TEST_F(AutoConfigTest, Validators) { - AutoRequired acm; - AutoRequired mcc; - - // Add validator to key that hasn't been set - acm->AddValidator("Namespace1.XYZ", [](const AnySharedPointer& ptr){ - return true; - }); - - acm->Set("Namespace1.XYZ", 42); - ASSERT_EQ(42, *mcc->m_myName); - - acm->AddValidator("Namespace1.XYZ", [](const AnySharedPointer& ptr){ - const int val = *ptr->as(); - - return (val < 50); - }); - - ASSERT_ANY_THROW(acm->Set("Namespace1.XYZ", 1337)) << "Should throw exception when setting invalid value"; - ASSERT_EQ(42, *mcc->m_myName); - - // Assert adding validator that doesn't validate current value throws execpetion - ASSERT_ANY_THROW(acm->AddValidator("Namespace1.XYZ", [](const AnySharedPointer& ptr){ - const int val = *ptr->as(); - - return (val < 0); - })); -} - +struct ValidatedKey{ + static bool Validate(const int& value) { + return value > 5; + } +}; struct MyValidatedClass{ - struct ValidatedKey{ - static bool Validate(const int& value) { - return value > 5; - } - }; - AutoConfig m_config; }; -TEST_F(AutoConfigTest, ImplicitValidator) { +TEST_F(AutoConfigTest, Validators) { AutoRequired acm; ASSERT_ANY_THROW(acm->Set("ValidatedKey", 2)) << "AutoConfigManager didn't regect invalid value"; @@ -277,10 +247,10 @@ TEST_F(AutoConfigTest, ImplicitValidator) { AutoRequired valid; acm->Set("ValidatedKey", 42); - ASSERT_EQ(41, *valid->m_config) << "Value not set for key"; + ASSERT_EQ(42, *valid->m_config) << "Value not set for key"; ASSERT_ANY_THROW(acm->Set("ValidatedKey", 1)) << "AutoConfigManager didn't regect invalid value"; - ASSERT_EQ(41, *valid->m_config) << "Value not set for key"; + ASSERT_EQ(42, *valid->m_config) << "Value not set for key"; acm->Set("ValidatedKey", 1337); ASSERT_EQ(1337, *valid->m_config) << "Value not set for key"; From 310e7426795660d2795e9608ad47d59ec89ece9c Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 15:41:01 -0800 Subject: [PATCH 099/140] Remove unnessesary validity checks from AutoParameter --- autowiring/AutoParameter.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index a8e680047..ce019db73 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -26,10 +26,6 @@ class AutoParameter: if (!isValid(m_default)) { throw autowiring_error("invalid default value for key: " + this->m_key); } - - if (this->IsConfigured() && isValid(this->template operator*())) { - throw autowiring_error("currently configured value is invalid for key: " + this->m_key); - } } const T& operator*() const { From c47c1174408af1df5cb83acef3fd40d2cb870da3 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 16:19:43 -0800 Subject: [PATCH 100/140] Only check validations once when setting --- autowiring/AutoConfigManager.h | 3 +- src/autowiring/AutoConfigManager.cpp | 47 ++++++++++++++-------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 627430252..baec96e43 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -110,10 +110,9 @@ class AutoConfigManager: private: // Handles setting a value recursivly to all child contexts - // Must hold m_lock when calling this void SetRecursive(const std::string& key, AnySharedPointer value); // Set a value in this manager, check validators, call callbacks // Must hold m_lock when calling this - void SetInternal(const std::string& key, const AnySharedPointer& value, bool setFromHere=false); + void SetInternal(const std::string& key, const AnySharedPointer& value); }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 248d776a8..51fbff225 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -86,7 +86,7 @@ bool AutoConfigManager::SetParsed(const std::string& key, const std::string& val return false; } - SetInternal(key, s_registry.at(key)->parse(value)); + SetRecursive(key, s_registry.at(key)->parse(value)); return true; } @@ -96,8 +96,25 @@ void AutoConfigManager::AddCallback(const std::string& key, t_callback&& fx) { } void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer value) { + // Call all validators for this key + if (s_validators.count(key)) { + for (auto const& fx : s_validators.at(key)) { + if (!fx(value)){ + std::stringstream ss; + ss << "Attempted to set key '" << key << "'which didin't pass validator"; + throw autowiring_error(ss.str()); + } + } + } + + // Grab lock until done setting + std::lock_guard lk(m_lock); + // Actually set the value in this manager - SetInternal(key, value, true); + SetInternal(key, value); + + // Mark the value was set from this manager + m_setHere.insert(key); // Enumerate descendant contexts auto enumerator = ContextEnumerator(GetContext()); @@ -113,10 +130,11 @@ void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer va std::shared_ptr mgmt; (*ctxt)->FindByType(mgmt); if (mgmt) { + std::lock_guard child_lk(mgmt->m_lock); - // Check if value set from this context + // Check if value was set from this context // If so, stop recursing down this branch, continue to sibling - if (!mgmt->IsInherited(key)){ + if (mgmt->m_setHere.count(key)){ ctxt.NextSibling(); continue; } @@ -130,28 +148,9 @@ void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer va } } -void AutoConfigManager::SetInternal(const std::string& key, const AnySharedPointer& value, bool setFromHere) { - - // Call all validators for this key - if (s_validators.count(key)) { - for (auto const& fx : s_validators.at(key)) { - if (!fx(value)){ - std::stringstream ss; - ss << "Attempted to set key '" << key << "'which didin't pass validator"; - throw autowiring_error(ss.str()); - } - } - } - - // Lock when modifiy local maps - std::lock_guard lk(m_lock); +void AutoConfigManager::SetInternal(const std::string& key, const AnySharedPointer& value) { m_values[key] = value; - // Mark if this key was set from here, and not inherited - if (setFromHere){ - m_setHere.insert(key); - } - // Call callbacks for this key for (const auto& cb : m_callbacks[key]) { cb(value); From 93fe42f177c2fd0479a777a115c88c0624cf7719 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 16:27:38 -0800 Subject: [PATCH 101/140] Make SetParsed catch internal exceptions and return false on unsuccessful set --- autowiring/AutoConfigManager.h | 4 ++-- src/autowiring/AutoConfigManager.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index baec96e43..47a1266bb 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -105,14 +105,14 @@ class AutoConfigManager: /// bool SetParsed(const std::string& key, const std::string& value); - // Add a callback for when key is changed + // Add a callback for when key is changed in this context void AddCallback(const std::string& key, t_callback&& fx); private: // Handles setting a value recursivly to all child contexts void SetRecursive(const std::string& key, AnySharedPointer value); - // Set a value in this manager, check validators, call callbacks + // Set a value in this manager, call callbacks // Must hold m_lock when calling this void SetInternal(const std::string& key, const AnySharedPointer& value); }; diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 51fbff225..6e528c3cd 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -86,7 +86,12 @@ bool AutoConfigManager::SetParsed(const std::string& key, const std::string& val return false; } - SetRecursive(key, s_registry.at(key)->parse(value)); + try { + SetRecursive(key, s_registry.at(key)->parse(value)); + } catch (autowiring_error& e){ + std::cerr << e.what() << std::endl; + return false; + } return true; } @@ -130,7 +135,7 @@ void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer va std::shared_ptr mgmt; (*ctxt)->FindByType(mgmt); if (mgmt) { - std::lock_guard child_lk(mgmt->m_lock); + std::lock_guard descendant_lk(mgmt->m_lock); // Check if value was set from this context // If so, stop recursing down this branch, continue to sibling From 07aebbe7dd8074af84bc60fcb0d1d9ffd1bc4316 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Tue, 9 Dec 2014 13:56:41 -0800 Subject: [PATCH 102/140] Adding static assertion, fixing unit test on MSVC --- autowiring/AutoParameter.h | 2 +- autowiring/has_validate.h | 27 +++++++++++------------ src/autowiring/test/AutoParameterTest.cpp | 10 +++++++++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index c5f745327..3e80b4ce1 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -60,6 +60,6 @@ class AutoParameter: const T m_default; bool isValid(const T& value) const { - return CallValidate(value, has_validate()); + return CallValidate(value, typename has_validate::has_valid()); } }; diff --git a/autowiring/has_validate.h b/autowiring/has_validate.h index 130868a2f..2a0d37dae 100644 --- a/autowiring/has_validate.h +++ b/autowiring/has_validate.h @@ -5,14 +5,21 @@ template struct has_validate_function { +}; + +/// +/// Detects whether the specified type T has a static method with the name Validate +/// +template +struct has_validate { template struct unnamed_constant; template - static std::false_type select(...); + static std::true_type select(decltype(&U::Validate)); template - static std::true_type select(unnamed_constant*); + static std::false_type select(...); // Conveninece typedef used externally: typedef decltype(select(nullptr)) has_valid; @@ -21,19 +28,11 @@ struct has_validate_function { static const bool value = has_valid::value; }; -/// -/// Detects whether the specified type T has a static method with the name Validate -/// -template -struct has_validate : has_validate_function::has_valid {}; - -template -static bool CallValidate(const Object& obj, std::true_type) { +template +static bool CallValidate(const T& obj, std::true_type) { return Validator::Validate(obj); } -template -static bool CallValidate(const Object& obj, std::false_type) { - return true; -} +template +static bool CallValidate(const T& obj, std::false_type) {return true;} diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 598ec9442..aa69cb919 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -16,6 +16,11 @@ struct MyParamClass1 { AutoParameter m_param; }; +static_assert( + !has_validate::value, + "has_validate SFINAE class incorrectly detected validator on MyIntParam1" +); + TEST_F(AutoParameterTest, VerifyCorrectDeconstruction) { AutoRequired mpc; auto& param = mpc->m_param; @@ -66,6 +71,11 @@ struct MyParamClass2 { AutoParameter m_param; }; +static_assert( + has_validate::value, + "has_validate SFINAE class failed to detect a validator on MyIntParam2" +); + TEST_F(AutoParameterTest, VerifyValidationFunction) { AutoRequired mpc; auto& param = mpc->m_param; From 69a68a7fe95cb9a9cc4b86f7a0a7b8987b97e1d4 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 19:10:42 -0800 Subject: [PATCH 103/140] Fix outdated AutoParameter test Validators now only set implicitly --- src/autowiring/test/AutoParameterTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index aa69cb919..78f5ad1d7 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -115,8 +115,8 @@ struct MyParamClass4 { TEST_F(AutoParameterTest, VerifyInvalidPreconfiguredValue) { AutoRequired acm; - acm->Set("AutoParam.MyParamClass4::MyIntParam4", 0); + ASSERT_ANY_THROW(acm->Set("AutoParam.MyParamClass4::MyIntParam4", 0)); - ASSERT_ANY_THROW(AutoRequired()) - << "Should not be able to initialize a parameter that had a previous value set that is invalid with new validation"; + AutoRequired my4; + ASSERT_EQ(15, *my4->m_param); } From 7a3a4117ccca26a5886921dde03bc36dd820aafc Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Tue, 9 Dec 2014 19:34:15 -0800 Subject: [PATCH 104/140] Clean up comments --- src/autowiring/AutoConfigManager.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 6e528c3cd..939027f65 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -9,7 +9,7 @@ using namespace autowiring; -// Create map of all config values in the program +// Create map of all config values in the registry static std::unordered_map FillRegistry(void) { std::unordered_map registry; @@ -37,7 +37,7 @@ const std::unordered_map AutoConfigMana const std::unordered_map> AutoConfigManager::s_validators = FillValidators(); AutoConfigManager::AutoConfigManager(void){ - // Copy parents config settings + // Copy parent's config settings auto parent = GetContext()->GetParentContext(); if (parent) { AutowiredFast mgmt(parent); @@ -65,7 +65,6 @@ bool AutoConfigManager::IsInherited(const std::string& key) { AnySharedPointer& AutoConfigManager::Get(const std::string& key) { std::lock_guard lk(m_lock); - // Check this first if (m_values.count(key)) { return m_values[key]; } @@ -86,12 +85,7 @@ bool AutoConfigManager::SetParsed(const std::string& key, const std::string& val return false; } - try { - SetRecursive(key, s_registry.at(key)->parse(value)); - } catch (autowiring_error& e){ - std::cerr << e.what() << std::endl; - return false; - } + SetRecursive(key, s_registry.at(key)->parse(value)); return true; } @@ -112,13 +106,13 @@ void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer va } } - // Grab lock until done setting + // Grab lock until done setting value std::lock_guard lk(m_lock); // Actually set the value in this manager SetInternal(key, value); - // Mark the value was set from this manager + // Mark key set from this manager m_setHere.insert(key); // Enumerate descendant contexts @@ -138,7 +132,7 @@ void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer va std::lock_guard descendant_lk(mgmt->m_lock); // Check if value was set from this context - // If so, stop recursing down this branch, continue to sibling + // If so, stop recursing down this branch, continue to next sibling if (mgmt->m_setHere.count(key)){ ctxt.NextSibling(); continue; From 099c08a6c76639acf5ec479caef9e78d4e364960 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 10 Dec 2014 09:23:24 -0800 Subject: [PATCH 105/140] "template" keyword unnecessary here, prevents compilation on MSVC --- autowiring/ConfigRegistry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 4a17d21cd..675839a2d 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -106,7 +106,7 @@ struct ConfigRegistryEntryT: std::function validator(void) const override { return [] (const AnySharedPointer& ptr) { - return CallValidate(*ptr.template as().get(), typename has_validate::has_valid()); + return CallValidate(*ptr.as().get(), typename has_validate::has_valid()); }; } }; From cb76200962d94ab152fb4f8ea33b79a1e67509cc Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 10 Dec 2014 09:55:03 -0800 Subject: [PATCH 106/140] Adding the ability to remove recipients from an AutoPacket post-hoc --- autowiring/AutoPacket.h | 22 ++++++--- src/autowiring/AutoPacket.cpp | 46 ++++++++++++------- .../test/AutoFilterFunctionTest.cpp | 17 +++++++ 3 files changed, 62 insertions(+), 23 deletions(-) diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 91a25a9d0..412077840 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -47,6 +47,11 @@ class AutoPacket: public: ~AutoPacket(); + struct Recipient { + // The iterator pointing to the location where the satisfaction counter was inserted + std::list::iterator position; + }; + static ObjectPool CreateObjectPool(AutoPacketFactory& factory, const std::shared_ptr& outstanding); private: @@ -76,7 +81,7 @@ class AutoPacket: /// /// Removes all AutoFilter argument information for a recipient /// - void RemoveSatCounter(SatCounter& satCounter); + void RemoveSatCounter(const SatCounter& satCounter); // Outstanding count local and remote holds: std::shared_ptr m_outstanding; @@ -478,17 +483,22 @@ class AutoPacket: /// Adds a recipient for data associated only with this issuance of the packet. /// /// - /// Recipients added in this way cannot receive piped data, since they are anonymous. + /// This method is not idempotent. The returned Recipient structure may be used to remove + /// the recipient safely at any point. The caller MUST NOT attempt /// - void AddRecipient(const AutoFilterDescriptor& descriptor); + Recipient AddRecipient(const AutoFilterDescriptor& descriptor); + + /// + /// Removes a previously added packet recipient + /// + void RemoveRecipient(Recipient&& recipient); /// /// Convenience overload, identical in behavior to AddRecipient /// template - AutoPacket& operator+=(Fx&& fx) { - AddRecipient(AutoFilterDescriptor(std::forward(fx))); - return *this; + Recipient operator+=(Fx&& fx) { + return AddRecipient(AutoFilterDescriptor(std::forward(fx))); } /// A reference to the satisfaction counter for the specified type diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index 6a0a784a9..d5b85adc4 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -44,14 +44,10 @@ AutoPacket::AutoPacket(AutoPacketFactory& factory, const std::shared_ptr void AutoPacket::AddSatCounter(SatCounter& satCounter) { for(auto pCur = satCounter.GetAutoFilterInput(); *pCur; pCur++) { const std::type_info& dataType = *pCur->ti; - - // Broadcast source is void DecorationDisposition* entry = &m_decorations[dataType]; entry->m_type = &dataType; // Decide what to do with this entry: - // NOTE: Recipients added via AddReceiver can receive broadcast data, - // so it is necessary to decrement the receiver's counters when it is added. if (pCur->is_input) { entry->m_subscribers.push_back(&satCounter); if (entry->satisfied) @@ -68,7 +64,7 @@ void AutoPacket::AddSatCounter(SatCounter& satCounter) { } } -void AutoPacket::RemoveSatCounter(SatCounter& satCounter) { +void AutoPacket::RemoveSatCounter(const SatCounter& satCounter) { for(auto pCur = satCounter.GetAutoFilterInput(); *pCur; pCur++) { const std::type_info& dataType = *pCur->ti; @@ -353,28 +349,44 @@ void AutoPacket::Finalize(void) { Reset(); } -void AutoPacket::AddRecipient(const AutoFilterDescriptor& descriptor) { - SatCounter* call = nullptr; +AutoPacket::Recipient AutoPacket::AddRecipient(const AutoFilterDescriptor& descriptor) { + Recipient retVal; + SatCounter* recipient; + { std::lock_guard lk(m_lock); // (1) Append & Initialize new satisfaction counter m_satCounters.push_back(descriptor); - SatCounter& recipient = m_satCounters.back(); - recipient.Reset(); + retVal.position = m_satCounters.end(); + retVal.position--; + recipient = &m_satCounters.back(); + recipient->Reset(); // (2) Update satisfaction & Append types from subscriber - AddSatCounter(recipient); + AddSatCounter(*recipient); - // (3) Check call status inside of lock - if (recipient) { - call = &recipient; - } + // (3) Short-circuit if we don't need to call + if(!*recipient) + return retVal; } - // (4) If all types are satisfied, call AutoFilter now. - if (call) - call->CallAutoFilter(*this); + // (4) All types are satisfied, call AutoFilter now. + recipient->CallAutoFilter(*this); + return retVal; +} + +void AutoPacket::RemoveRecipient(Recipient&& recipient) { + // Copy out the iterator, and eliminate the iterator from the source structure + auto q = recipient.position; + recipient.position = m_satCounters.end(); + + // Remove the recipient from our list + { + std::lock_guard lk(m_lock); + RemoveSatCounter(*q); + m_satCounters.erase(q); + } } SatCounter AutoPacket::GetSatisfaction(const std::type_info& subscriber) const { diff --git a/src/autowiring/test/AutoFilterFunctionTest.cpp b/src/autowiring/test/AutoFilterFunctionTest.cpp index 144917d2c..b94519b4e 100644 --- a/src/autowiring/test/AutoFilterFunctionTest.cpp +++ b/src/autowiring/test/AutoFilterFunctionTest.cpp @@ -90,3 +90,20 @@ TEST_F(AutoFilterFunctionalTest, FunctionExtractorTest) { packet->Decorate(Decoration<1>()); ASSERT_EQ(1, extType) << "Decoration type was not extracted"; } + +TEST_F(AutoFilterFunctionalTest, RecipientRemovalTest) { + auto called = std::make_shared(false); + AutoRequired factory; + + // Add a recipient and then remove it, verify it doesn't get called + auto packet = factory->NewPacket(); + AutoPacket::Recipient recipient = + ( + *packet += [called] (const Decoration<0>&) { + *called = true; + } + ); + packet->RemoveRecipient(std::move(recipient)); + + ASSERT_FALSE(*called) << "A recipient that should have been removed was called"; +} \ No newline at end of file From 4e48aa238c4cf3c798fbfca6efed47148628c75e Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 10 Dec 2014 10:46:17 -0800 Subject: [PATCH 107/140] Switching to an iterator for post-hoc subscriber removal --- autowiring/AutoPacket.h | 6 ++++-- src/autowiring/AutoPacket.cpp | 27 ++++++++++----------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 412077840..317861e3c 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -56,9 +56,11 @@ class AutoPacket: private: // Saturation counters, constructed when the packet is created and reset each time thereafter - // IMPORTANT: Elements in m_satCounters MUST be stationary, since they will be referenced! std::list m_satCounters; - size_t m_subscriberNum; + + // An iterator referring to the first permanent subscriber in the list of satisfaction counters + // Temporary subscribers are pushed to the front of the list prior to this iterator + std::list::iterator m_firstSubscriber; // A pointer back to the factory that created us. Used for recording lifetime statistics. std::shared_ptr m_parentFactory; diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index d5b85adc4..6a2d54db4 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -32,7 +32,7 @@ AutoPacket::AutoPacket(AutoPacketFactory& factory, const std::shared_ptr m_satCounters.erase(std::unique(m_satCounters.begin(), m_satCounters.end()), m_satCounters.end()); // Record divide between subscribers & recipients - m_subscriberNum = m_satCounters.size(); + m_firstSubscriber = m_satCounters.begin(); // Prime the satisfaction graph for each element: for(auto& satCounter : m_satCounters) @@ -322,15 +322,11 @@ void AutoPacket::Initialize(void) { } void AutoPacket::Finalize(void) { - // Remove all recipients & clean up the decorations list - // ASSERT: This reverses the order of accumulation, - // so searching for the subscriber is avoided. - while (m_satCounters.size() > m_subscriberNum) { - SatCounter& recipient = m_satCounters.back(); - RemoveSatCounter(recipient); - m_satCounters.pop_back(); - } + // ASSERT: This reverses the order of accumulation, so searching for the subscriber is avoided. + for(auto q = m_satCounters.begin(); q != m_firstSubscriber; q++) + RemoveSatCounter(*q); + m_satCounters.erase(m_satCounters.begin(), m_firstSubscriber); // Remove decoration dispositions specific to subscribers t_decorationMap::iterator dItr = m_decorations.begin(); @@ -357,9 +353,8 @@ AutoPacket::Recipient AutoPacket::AddRecipient(const AutoFilterDescriptor& descr std::lock_guard lk(m_lock); // (1) Append & Initialize new satisfaction counter - m_satCounters.push_back(descriptor); - retVal.position = m_satCounters.end(); - retVal.position--; + m_satCounters.push_front(descriptor); + retVal.position = m_satCounters.begin(); recipient = &m_satCounters.back(); recipient->Reset(); @@ -382,11 +377,9 @@ void AutoPacket::RemoveRecipient(Recipient&& recipient) { recipient.position = m_satCounters.end(); // Remove the recipient from our list - { - std::lock_guard lk(m_lock); - RemoveSatCounter(*q); - m_satCounters.erase(q); - } + std::lock_guard lk(m_lock); + RemoveSatCounter(*q); + m_satCounters.erase(q); } SatCounter AutoPacket::GetSatisfaction(const std::type_info& subscriber) const { From 8cbb960fd0384b92f9abecb532fc739cc236497d Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 10 Dec 2014 12:06:09 -0800 Subject: [PATCH 108/140] Adding the ability to attach a non-modifying listener to a packet This permits users who have a const reference to an AutoPacket to monitor for the introduction of another decoration without running the risk of accidentally attaching unintended decorations to that packet. --- autowiring/AutoPacket.h | 21 ++++++++++++++++++- autowiring/CallExtractor.h | 5 +++++ autowiring/InvokeRelay.h | 4 ++-- autowiring/is_any.h | 12 +++++------ .../test/AutoFilterFunctionTest.cpp | 17 +++++++++++++++ 5 files changed, 50 insertions(+), 9 deletions(-) diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 317861e3c..c04bcc064 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -434,7 +434,7 @@ class AutoPacket: // None of the inputs may be shared pointers--if any of the inputs are shared pointers, they must be attached // to this packet via Decorate, or else dereferenced and used that way. static_assert( - !is_any, is_shared_ptr...>::value, + !is_any::value, is_shared_ptr::value...>::value, "DecorateImmediate must not be used to attach a shared pointer, use Decorate on such a decoration instead" ); @@ -503,6 +503,12 @@ class AutoPacket: return AddRecipient(AutoFilterDescriptor(std::forward(fx))); } + /// + /// Convenience overload, provided to allow the attachment of receive-only filters to a const AutoPacket + /// + template + const AutoPacket& operator+=(Fx&& fx) const; + /// A reference to the satisfaction counter for the specified type /// /// If the type is not a subscriber GetSatisfaction().GetType() == nullptr will be true @@ -522,3 +528,16 @@ class AutoPacket: /// True if the indicated type has been requested for use by some consumer bool HasSubscribers(const std::type_info& data) const; }; + +#include "CallExtractor.h" + +template +const AutoPacket& AutoPacket::operator+=(Fx&& fx) const +{ + static_assert( + !CallExtractor::has_outputs, + "Cannot add an AutoFilter to a const AutoPacket if any of its arguments are output types" + ); + *const_cast(this) += std::forward(fx); + return *this; +} \ No newline at end of file diff --git a/autowiring/CallExtractor.h b/autowiring/CallExtractor.h index bcd64435a..56db44442 100644 --- a/autowiring/CallExtractor.h +++ b/autowiring/CallExtractor.h @@ -19,7 +19,9 @@ template struct CallExtractor: Decompose { + static const bool has_outputs = is_any::is_output...>::value; static const bool deferred = false; + static const bool stateless = true; /// /// Binder struct, lets us refer to an instance of Call by type @@ -41,6 +43,7 @@ template struct CallExtractor: Decompose { + static const bool has_outputs = is_any::is_output...>::value; static const bool stateless = false; static const bool deferred = false; static const size_t N = sizeof...(Args); @@ -71,6 +74,7 @@ template struct CallExtractor : Decompose { + static const bool has_outputs = is_any::is_output...>::value; static const bool stateless = true; static const bool deferred = false; static const size_t N = sizeof...(Args); @@ -93,6 +97,7 @@ template struct CallExtractor: Decompose { + static const bool has_outputs = is_any::is_output...>::value; static const bool stateless = false; static const bool deferred = true; static const size_t N = sizeof...(Args); diff --git a/autowiring/InvokeRelay.h b/autowiring/InvokeRelay.h index 4f3673a8d..535095c19 100644 --- a/autowiring/InvokeRelay.h +++ b/autowiring/InvokeRelay.h @@ -68,7 +68,7 @@ class InvokeRelay { erp(nullptr) {} - static_assert(!is_any...>::value, "Can't use rvalue references as event argument type"); + static_assert(!is_any::value...>::value, "Can't use rvalue references as event argument type"); private: std::shared_ptr> erp; @@ -103,7 +103,7 @@ class InvokeRelay { erp(nullptr) {} - static_assert(!is_any...>::value, "Can't use rvalue references as event argument type"); + static_assert(!is_any::value...>::value, "Can't use rvalue references as event argument type"); private: std::shared_ptr> erp; diff --git a/autowiring/is_any.h b/autowiring/is_any.h index 32d06be8d..405d73dcc 100644 --- a/autowiring/is_any.h +++ b/autowiring/is_any.h @@ -3,19 +3,19 @@ #include TYPE_TRAITS_HEADER /// -/// Check if any T::value is true +/// Check if any T is true /// /// /// Check is_any<...>::value for result /// -template -struct is_any{ +template +struct is_any { static const bool value = false; }; -template -struct is_any{ - static const bool value = Head::value || is_any::value; +template +struct is_any { + static const bool value = Head || is_any::value; }; /// diff --git a/src/autowiring/test/AutoFilterFunctionTest.cpp b/src/autowiring/test/AutoFilterFunctionTest.cpp index b94519b4e..0b4ed7f9a 100644 --- a/src/autowiring/test/AutoFilterFunctionTest.cpp +++ b/src/autowiring/test/AutoFilterFunctionTest.cpp @@ -106,4 +106,21 @@ TEST_F(AutoFilterFunctionalTest, RecipientRemovalTest) { packet->RemoveRecipient(std::move(recipient)); ASSERT_FALSE(*called) << "A recipient that should have been removed was called"; +} + +TEST_F(AutoFilterFunctionalTest, ObservingFunctionTest) { + AutoRequired factory; + + auto packet = factory->NewPacket(); + + // Attach a lambda to a const version of this packet: + auto called = std::make_shared(false); + static_cast(*packet) += [called](const Decoration<0>& dec, Decoration<1> dec1) { + *called = true; + }; + + // Verify that a call was made as expected once we decorate: + packet->Decorate(Decoration<0>()); + packet->Decorate(Decoration<1>()); + ASSERT_TRUE(*called) << "Receive-only filter attached to a const packet image was not correctly called"; } \ No newline at end of file From 4b18b912e9a9e69ba7d07df1a1e66cc78a536c66 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 10 Dec 2014 12:38:03 -0800 Subject: [PATCH 109/140] Typename not supported in this context, breaks MSVC --- autowiring/AutoParameter.h | 2 +- autowiring/ConfigRegistry.h | 2 +- autowiring/has_validate.h | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 5d0162da8..0b7aaaed2 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -54,6 +54,6 @@ class AutoParameter: const T m_default; bool isValid(const T& value) const { - return CallValidate(value, typename has_validate::has_valid()); + return CallValidate::Call(value); } }; diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 675839a2d..fc258de2a 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -106,7 +106,7 @@ struct ConfigRegistryEntryT: std::function validator(void) const override { return [] (const AnySharedPointer& ptr) { - return CallValidate(*ptr.as().get(), typename has_validate::has_valid()); + return CallValidate::Call(*ptr.as().get()); }; } }; diff --git a/autowiring/has_validate.h b/autowiring/has_validate.h index 2a0d37dae..8f01a419e 100644 --- a/autowiring/has_validate.h +++ b/autowiring/has_validate.h @@ -28,11 +28,14 @@ struct has_validate { static const bool value = has_valid::value; }; -template -static bool CallValidate(const T& obj, std::true_type) { - return Validator::Validate(obj); -} +template::value> +struct CallValidate { + static bool Call(const T&) { return true; } +}; template -static bool CallValidate(const T& obj, std::false_type) {return true;} - +struct CallValidate { + static bool Call(const T& obj) { + return Validator::Validate(obj); + } +}; From 60ebf70c04683239cfc6304d8b31d65d380760c9 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 10 Dec 2014 13:53:44 -0800 Subject: [PATCH 110/140] Remove unused code Also fix up logic for IsInherited and add test --- autowiring/has_validate.h | 9 --------- src/autowiring/AutoConfigManager.cpp | 2 +- src/autowiring/AutoConfigParser.cpp | 4 ++-- src/autowiring/test/AutoConfigTest.cpp | 1 + 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/autowiring/has_validate.h b/autowiring/has_validate.h index 8f01a419e..e4aff992e 100644 --- a/autowiring/has_validate.h +++ b/autowiring/has_validate.h @@ -1,20 +1,11 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once -#include "Decompose.h" -#include - -template -struct has_validate_function { -}; /// /// Detects whether the specified type T has a static method with the name Validate /// template struct has_validate { - template - struct unnamed_constant; - template static std::true_type select(decltype(&U::Validate)); diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 939027f65..28a6f3da0 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -59,7 +59,7 @@ bool AutoConfigManager::IsConfigured(const std::string& key) { bool AutoConfigManager::IsInherited(const std::string& key) { std::lock_guard lk(m_lock); - return !m_setHere.count(key); + return m_values.count(key) && !m_setHere.count(key); } AnySharedPointer& AutoConfigManager::Get(const std::string& key) { diff --git a/src/autowiring/AutoConfigParser.cpp b/src/autowiring/AutoConfigParser.cpp index 43b93b51c..548d46bdb 100644 --- a/src/autowiring/AutoConfigParser.cpp +++ b/src/autowiring/AutoConfigParser.cpp @@ -9,7 +9,7 @@ std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { //Extract Namespace and value from typename - //AutoConfigBase::ConfigTypeExtractor + //ConfigTypeExtractor std::string arg1; std::string arg2; @@ -40,7 +40,7 @@ std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { std::string autowiring::ExtractKeyWin(std::stringstream& ss) { //Extract Namespace and value from typename - //struct AutoConfigBase::ConfigTypeExtractor + //struct ConfigTypeExtractor std::string arg1; std::string arg2; diff --git a/src/autowiring/test/AutoConfigTest.cpp b/src/autowiring/test/AutoConfigTest.cpp index 381181424..2d8daf3f8 100644 --- a/src/autowiring/test/AutoConfigTest.cpp +++ b/src/autowiring/test/AutoConfigTest.cpp @@ -195,6 +195,7 @@ TEST_F(AutoConfigTest, NestedContexts) { ASSERT_EQ(42, *mcc_middle->m_myName) << "Config value not set in descendant context"; ASSERT_EQ(42, *mcc_sibling->m_myName) << "Config value not set in descendant context"; ASSERT_EQ(42, *mcc_inner->m_myName) << "Config value not set in descendant context"; + EXPECT_TRUE(acm_middle->IsInherited("Namespace1.XYZ")) << "Inherited key not marked as such"; // Set middle, inner shouldn't be able to be set from outer after this bool callback_hit1 = false; From 72db728b4fd2964fb41dc5fe77ece1e289a63697 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Wed, 10 Dec 2014 14:05:53 -0800 Subject: [PATCH 111/140] Remove unnecessary headers --- autowiring/AutoConfig.h | 3 +-- autowiring/AutoConfigManager.h | 3 ++- autowiring/ConfigRegistry.h | 34 +++++++++++++++++----------- src/autowiring/AutoConfigManager.cpp | 4 ---- src/autowiring/AutoConfigParser.cpp | 2 -- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/autowiring/AutoConfig.h b/autowiring/AutoConfig.h index 4f861a39a..15004e8e5 100644 --- a/autowiring/AutoConfig.h +++ b/autowiring/AutoConfig.h @@ -3,10 +3,9 @@ #include "Autowired.h" #include "AutoConfigManager.h" #include "ConfigRegistry.h" -#include "is_any.h" #include -#include +#include TYPE_INDEX_HEADER struct AnySharedPointer; diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 47a1266bb..7f306c1b7 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -1,9 +1,10 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once -#include "ConfigRegistry.h" #include "autowiring_error.h" +#include "ConfigRegistry.h" #include #include +#include #include STL_UNORDERED_MAP #include STL_UNORDERED_SET #include MEMORY_HEADER diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index fc258de2a..5cfab3358 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -20,6 +20,21 @@ struct has_stream { static const bool value = !std::is_same(nullptr, nullptr))>::value; }; +// Get last type in parameter pack +template +struct get_last; + +template +struct get_last{ + typedef typename get_last::last last; +}; + +template +struct get_last{ + typedef T last; +}; + +// Stores information about an AutoConfig entry struct ConfigRegistryEntry { ConfigRegistryEntry(const std::type_info& ti, bool has_validator); @@ -32,12 +47,18 @@ struct ConfigRegistryEntry { // True if a validator was provided const bool m_has_validator; + // Is this key identify this entry? bool is(const std::string& key) const; + // Verify 'ti' is the same type as this entry's value virtual bool verifyType(const std::type_info& ti) const = 0; + // Parse a string into this entrie's value type. + // Type must have operator>> T defined virtual AnySharedPointer parse(const std::string&) const = 0; + // Returns function which validates this input. The validator function is + // defined as KEY::Validate(const T&) where KEY is the type identifing this entry virtual std::function validator(void) const = 0; }; @@ -45,19 +66,6 @@ struct ConfigRegistryEntry { template struct ConfigTypeExtractor {}; -template -struct get_last; - -template -struct get_last{ - typedef typename get_last::last last; -}; - -template -struct get_last{ - typedef T last; -}; - template struct ConfigRegistryEntryT: public ConfigRegistryEntry diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 28a6f3da0..4c3ed719d 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -2,10 +2,6 @@ #include "stdafx.h" #include "AutoConfig.h" #include "AnySharedPointer.h" -#include "demangle.h" -#include -#include -#include using namespace autowiring; diff --git a/src/autowiring/AutoConfigParser.cpp b/src/autowiring/AutoConfigParser.cpp index 548d46bdb..f6a35d3f3 100644 --- a/src/autowiring/AutoConfigParser.cpp +++ b/src/autowiring/AutoConfigParser.cpp @@ -3,8 +3,6 @@ #include "AutoConfigParser.hpp" #include "demangle.h" #include "expect.hpp" -#include -#include std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { From fb46884ed59e6074e64c835e5c673f9eb3141519 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 10 Dec 2014 13:28:25 -0800 Subject: [PATCH 112/140] Eliminating of object pool concept from AutoPacketFactory The use of an object pool complicates AutoPacket's lifetime and does not appear to improve performance. AutoPacket is actually a very small type; rather than using a pool to optimize initialization, it's probably more worthwhile to investigate memoization of the constructor into the AutoPacketFactory type. --- autowiring/AutoPacket.h | 63 ++++------------- autowiring/AutoPacketFactory.h | 15 ++-- autowiring/AutoPacketInternal.h | 28 ++++++++ src/autowiring/AutoPacket.cpp | 98 +++++--------------------- src/autowiring/AutoPacketFactory.cpp | 54 +++++++++----- src/autowiring/AutoPacketInternal.cpp | 30 ++++++++ src/autowiring/CMakeLists.txt | 2 + src/autowiring/test/AutoFilterTest.cpp | 12 ++++ 8 files changed, 147 insertions(+), 155 deletions(-) create mode 100644 autowiring/AutoPacketInternal.h create mode 100644 src/autowiring/AutoPacketInternal.cpp diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index c04bcc064..bfbdc5d45 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -42,9 +42,9 @@ class AutoPacket: private: AutoPacket(const AutoPacket& rhs) = delete; AutoPacket(AutoPacket&&) = delete; - AutoPacket(AutoPacketFactory& factory, const std::shared_ptr& outstanding); public: + AutoPacket(AutoPacketFactory& factory, std::shared_ptr&& outstanding); ~AutoPacket(); struct Recipient { @@ -52,9 +52,7 @@ class AutoPacket: std::list::iterator position; }; - static ObjectPool CreateObjectPool(AutoPacketFactory& factory, const std::shared_ptr& outstanding); - -private: +protected: // Saturation counters, constructed when the packet is created and reset each time thereafter std::list m_satCounters; @@ -63,10 +61,10 @@ class AutoPacket: std::list::iterator m_firstSubscriber; // A pointer back to the factory that created us. Used for recording lifetime statistics. - std::shared_ptr m_parentFactory; + const std::shared_ptr m_parentFactory; // Hold the time point at which this packet was last initalized. - std::chrono::high_resolution_clock::time_point m_initTime; + const std::chrono::high_resolution_clock::time_point m_initTime; // The set of decorations currently attached to this object, and the associated lock: // Decorations are indexed first by type and second by pipe terminating type, if any. @@ -75,6 +73,16 @@ class AutoPacket: t_decorationMap m_decorations; mutable std::mutex m_lock; + /// + /// Last chance call with unsatisfied optional arguments. + /// + /// + /// This is called when the packet is returned to the AutoPacketFactory. + /// It is not called when the Packet is destroyed, since that could result in + /// suprious calles when no packet is issued. + /// + void Finalize(void); + /// /// Adds all AutoFilter argument information for a recipient /// @@ -86,48 +94,7 @@ class AutoPacket: void RemoveSatCounter(const SatCounter& satCounter); // Outstanding count local and remote holds: - std::shared_ptr m_outstanding; - const std::shared_ptr& m_outstandingRemote; - - /// - /// Resets satisfaction counters and decoration status. - /// - /// - /// Is it expected that AutoPacketFactory will call methods in the following order: - /// AutoPacket(); //Construction in ObjectPool - /// Initialize(); //Issued from ObjectPool - /// Decorate(); - /// ... //More Decorate calls - /// Finalize(); //Returned to ObjectPool - /// Initialize(); - /// ... //More Issue & Return cycles - /// ~AutoPacket(); //Destruction in ObjectPool - /// Reset() must be called before the body of Initialize() in order to begin in the - /// correct state. It must also be called after the body of Finalize() in order to - /// avoid holding shared_ptr references. - /// Therefore Reset() is called at the conclusion of both AutoPacket() and Finalize(). - /// - void Reset(void); - - /// - /// Decrements subscribers requiring AutoPacket argument then calls all initializing subscribers. - /// - /// - /// Initialize is called when a packet is issued by the AutoPacketFactory. - /// It is not called when the Packet is created since that could result in - /// spurious calls when no packet is issued. - /// - void Initialize(void); - - /// - /// Last chance call with unsatisfied optional arguments. - /// - /// - /// This is called when the packet is returned to the AutoPacketFactory. - /// It is not called when the Packet is destroyed, since that could result in - /// suprious calles when no packet is issued. - /// - void Finalize(void); + const std::shared_ptr m_outstanding; /// /// Marks the specified entry as being unsatisfiable diff --git a/autowiring/AutoPacketFactory.h b/autowiring/AutoPacketFactory.h index 22e67c10c..85b95af78 100644 --- a/autowiring/AutoPacketFactory.h +++ b/autowiring/AutoPacketFactory.h @@ -5,7 +5,6 @@ #include "AutoFilterDescriptor.h" #include "ContextMember.h" #include "CoreRunnable.h" -#include "ObjectPool.h" #include #include #include CHRONO_HEADER @@ -48,15 +47,8 @@ class AutoPacketFactory: // Outstanding reference if this factory is currently running: std::shared_ptr m_outstanding; - /// - /// An independently maintained object pool just for packets - /// - /// - /// The object pool defined here is provided mainly to allow detection of - /// pipeline packet expiration in order to support expiration notification - /// broadcasts. - /// - ObjectPool m_packets; + // Internal outstanding reference for issued packet: + std::weak_ptr m_outstandingInternal; // Collection of known subscribers typedef std::unordered_set> t_autoFilterSet; @@ -67,6 +59,9 @@ class AutoPacketFactory: double m_packetDurationSum; double m_packetDurationSqSum; + // Returns the internal outstanding count, for use with AutoPacket + std::shared_ptr GetInternalOutstanding(void); + // Recursive invalidation routine, causes AutoPacket object pools to be dumped to the root void Invalidate(void); diff --git a/autowiring/AutoPacketInternal.h b/autowiring/AutoPacketInternal.h new file mode 100644 index 000000000..dd3807e1d --- /dev/null +++ b/autowiring/AutoPacketInternal.h @@ -0,0 +1,28 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#pragma once +#include "AutoPacket.h" + +/// +/// Internal representation type for AutoPacket, provides methods for exclusive use with a packet factory +/// +class AutoPacketInternal: + public AutoPacket +{ +public: + AutoPacketInternal(AutoPacketFactory& factory, std::shared_ptr&& outstanding); + ~AutoPacketInternal(void); + +private: + +public: + /// + /// Decrements subscribers requiring AutoPacket argument then calls all initializing subscribers. + /// + /// + /// Initialize is called when a packet is issued by the AutoPacketFactory. + /// It is not called when the Packet is created since that could result in + /// spurious calls when no packet is issued. + /// + void Initialize(void); +}; + diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index 6a2d54db4..04d3a7373 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -11,13 +11,10 @@ using namespace autowiring; -// This must appear in .cpp in order to avoid compilation failure due to: -// "Arithmetic on a pointer to an incomplete type 'SatCounter'" -AutoPacket::~AutoPacket() {} - -AutoPacket::AutoPacket(AutoPacketFactory& factory, const std::shared_ptr& outstanding): +AutoPacket::AutoPacket(AutoPacketFactory& factory, std::shared_ptr&& outstanding): m_parentFactory(std::static_pointer_cast(factory.shared_from_this())), - m_outstandingRemote(outstanding) + m_outstanding(std::move(outstanding)), + m_initTime(std::chrono::high_resolution_clock::now()) { // Traverse all contexts, adding their packet subscriber vectors one at a time: for(const auto& curContext : ContextEnumerator(factory.GetContext())) { @@ -38,7 +35,21 @@ AutoPacket::AutoPacket(AutoPacketFactory& factory, const std::shared_ptr for(auto& satCounter : m_satCounters) AddSatCounter(satCounter); - Reset(); + // Initialize all counters: + for (auto& satCounter : m_satCounters) + satCounter.Reset(); + + // Clear all references: + for (auto& decoration : m_decorations) + decoration.second.Reset(); +} + +AutoPacket::~AutoPacket(void) { + m_parentFactory->RecordPacketDuration( + std::chrono::duration_cast( + std::chrono::high_resolution_clock::now() - m_initTime + ) + ); } void AutoPacket::AddSatCounter(SatCounter& satCounter) { @@ -83,20 +94,6 @@ void AutoPacket::RemoveSatCounter(const SatCounter& satCounter) { } } -ObjectPool AutoPacket::CreateObjectPool(AutoPacketFactory& factory, const std::shared_ptr& outstanding) { - return ObjectPool( - ~0, - ~0, - [&factory, &outstanding] { return new AutoPacket(factory, outstanding); }, - [] (AutoPacket& packet) { packet.Initialize(); }, - [] (AutoPacket& packet) { - // IMPORTANT: Create shared_ptr with no destructor to enable outputs to AutoPacket - std::shared_ptr shared(&packet, [](AutoPacket*){}); - packet.Finalize(); - } - ); -} - void AutoPacket::MarkUnsatisfiable(const std::type_info& info) { // TODO: // Add an anti-present decoration @@ -286,65 +283,6 @@ void AutoPacket::ForwardAll(std::shared_ptr recipient) const { } } -void AutoPacket::Reset(void) { - // Initialize all counters: - std::lock_guard lk(m_lock); - for(auto& satCounter : m_satCounters) - satCounter.Reset(); - - // Clear all references: - for(auto& decoration : m_decorations) - decoration.second.Reset(); -} - -void AutoPacket::Initialize(void) { - // Record the timepoint of initialization - m_initTime = std::chrono::high_resolution_clock::now(); - - // Hold an outstanding count from the parent packet factory - m_outstanding = m_outstandingRemote; - if(!m_outstanding) - throw std::runtime_error("Cannot proceed with this packet, enclosing context already expired"); - - // Find all subscribers with no required or optional arguments: - std::list callCounters; - for (auto& satCounter : m_satCounters) - if (satCounter) - callCounters.push_back(&satCounter); - - // Call all subscribers with no required or optional arguments: - // NOTE: This may result in decorations that cause other subscribers to be called. - for (SatCounter* call : callCounters) - call->CallAutoFilter(*this); - - // First-call indicated by argumument type AutoPacket&: - UpdateSatisfaction(typeid(auto_arg::id_type)); -} - -void AutoPacket::Finalize(void) { - // Remove all recipients & clean up the decorations list - // ASSERT: This reverses the order of accumulation, so searching for the subscriber is avoided. - for(auto q = m_satCounters.begin(); q != m_firstSubscriber; q++) - RemoveSatCounter(*q); - m_satCounters.erase(m_satCounters.begin(), m_firstSubscriber); - - // Remove decoration dispositions specific to subscribers - t_decorationMap::iterator dItr = m_decorations.begin(); - t_decorationMap::iterator dEnd = m_decorations.end(); - while (dItr != dEnd) { - if (dItr->second.m_subscribers.empty()) - dItr = m_decorations.erase(dItr); - else - ++dItr; - } - - m_parentFactory->RecordPacketDuration( - std::chrono::duration_cast( - std::chrono::high_resolution_clock::now() - m_initTime)); - - Reset(); -} - AutoPacket::Recipient AutoPacket::AddRecipient(const AutoFilterDescriptor& descriptor) { Recipient retVal; SatCounter* recipient; diff --git a/src/autowiring/AutoPacketFactory.cpp b/src/autowiring/AutoPacketFactory.cpp index dcf95cb01..1cc56337d 100644 --- a/src/autowiring/AutoPacketFactory.cpp +++ b/src/autowiring/AutoPacketFactory.cpp @@ -1,7 +1,7 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "AutoPacketFactory.h" -#include "AutoPacket.h" +#include "AutoPacketInternal.h" #include "fast_pointer_cast.h" #include "thread_specific_ptr.h" #include @@ -12,7 +12,7 @@ AutoPacketFactory::AutoPacketFactory(void): ContextMember("AutoPacketFactory"), m_parent(GetContext()->GetParentContext()), m_wasStopped(false), - m_packets(AutoPacket::CreateObjectPool(*this, m_outstanding)), + m_outstanding(0), m_packetCount(0), m_packetDurationSum(0), m_packetDurationSqSum(0) @@ -29,11 +29,12 @@ std::shared_ptr AutoPacketFactory::NewPacket(void) { if(!IsRunning()) throw autowiring_error("Cannot create a packet until the AutoPacketFactory is started"); - // Obtain a packet, return it - std::shared_ptr retVal; - m_packets(retVal); - - // Done, return + // Obtain a packet, initialize it, return it + auto retVal = std::make_shared( + *this, + GetInternalOutstanding() + ); + retVal->Initialize(); return retVal; } @@ -55,13 +56,33 @@ bool AutoPacketFactory::Start(std::shared_ptr outstanding) { return true; } +std::shared_ptr AutoPacketFactory::GetInternalOutstanding(void) { + auto retVal = m_outstandingInternal.lock(); + if (retVal) + return retVal; + + auto outstanding = m_outstanding; + retVal = std::shared_ptr( + (void*)1, + [this, outstanding] (void*) mutable { + std::lock_guard lk(m_lock); + m_stateCondition.notify_all(); + + // Weak pointer will prevent our lambda from being destroyed, so we manually reset + // the outstanding counter in order to force it to be reset here + outstanding.reset(); + } + ); + m_outstandingInternal = retVal; + return retVal; +} + void AutoPacketFactory::Stop(bool graceful) { // Return optimization if(m_wasStopped) return; // Kill the object pool - m_packets.SetOutstandingLimit(0); Invalidate(); // Queue of local variables to be destroyed when leaving scope @@ -88,17 +109,16 @@ void AutoPacketFactory::Clear(void) { } void AutoPacketFactory::Wait(void) { - { - std::unique_lock lk(m_lock); - m_stateCondition.wait(lk, [this]{ return ShouldStop(); }); - } - - // Now we need to block until all packets come back to the object pool: - m_packets.Rundown(); + std::unique_lock lk(m_lock); + m_stateCondition.wait( + lk, + [this]{ + return ShouldStop() && m_outstandingInternal.expired(); + } + ); } void AutoPacketFactory::Invalidate(void) { - m_packets.ClearCachedEntities(); if(m_parent) m_parent->Invalidate(); } @@ -135,7 +155,7 @@ AutoFilterDescriptor AutoPacketFactory::GetTypeDescriptorUnsafe(const std::type_ } size_t AutoPacketFactory::GetOutstanding(void) const { - return m_packets.GetOutstanding(); + return m_outstandingInternal.use_count(); } void AutoPacketFactory::RecordPacketDuration(std::chrono::nanoseconds duration) { diff --git a/src/autowiring/AutoPacketInternal.cpp b/src/autowiring/AutoPacketInternal.cpp new file mode 100644 index 000000000..e0c1be75f --- /dev/null +++ b/src/autowiring/AutoPacketInternal.cpp @@ -0,0 +1,30 @@ +// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. +#include "stdafx.h" +#include "AutoPacketInternal.h" +#include "AutoPacketFactory.h" +#include "SatCounter.h" + +AutoPacketInternal::AutoPacketInternal(AutoPacketFactory& factory, std::shared_ptr&& outstanding) : + AutoPacket(factory, std::move(outstanding)) +{ +} + +AutoPacketInternal::~AutoPacketInternal(void) +{ +} + +void AutoPacketInternal::Initialize(void) { + // Find all subscribers with no required or optional arguments: + std::list callCounters; + for (auto& satCounter : m_satCounters) + if (satCounter) + callCounters.push_back(&satCounter); + + // Call all subscribers with no required or optional arguments: + // NOTE: This may result in decorations that cause other subscribers to be called. + for (SatCounter* call : callCounters) + call->CallAutoFilter(*this); + + // First-call indicated by argumument type AutoPacket&: + UpdateSatisfaction(typeid(auto_arg::id_type)); +} diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 908fc4b32..1210f9fd8 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -28,6 +28,8 @@ set(Autowiring_SRCS AutoInjectable.h AutoPacket.cpp AutoPacket.h + AutoPacketInternal.cpp + AutoPacketInternal.h AutoPacketFactory.cpp AutoPacketFactory.h AutoPacketProfiler.cpp diff --git a/src/autowiring/test/AutoFilterTest.cpp b/src/autowiring/test/AutoFilterTest.cpp index c092c1f6a..7961553ae 100644 --- a/src/autowiring/test/AutoFilterTest.cpp +++ b/src/autowiring/test/AutoFilterTest.cpp @@ -21,6 +21,17 @@ class AutoFilterTest: } }; +TEST_F(AutoFilterTest, GetOutstandingTest) { + AutoRequired factory; + + { + auto packet = factory->NewPacket(); + ASSERT_EQ(1UL, factory->GetOutstanding()) << "Factory outstanding count mismatch"; + } + + ASSERT_EQ(0UL, factory->GetOutstanding()) << "Factory outstanding did not go to zero after releasing the only outstanding packet"; +} + TEST_F(AutoFilterTest, VerifyDescendentAwareness) { // Create a packet while the factory has no subscribers: AutoRequired parentFactory; @@ -138,6 +149,7 @@ class FilterOut { TEST_F(AutoFilterTest, VerifyAutoOut) { AutoRequired factory; AutoRequired out; + std::shared_ptr packet = factory->NewPacket(); const Decoration<0>* result0 = nullptr; ASSERT_TRUE(packet->Get(result0)) << "Output missing"; From 25d72ef2900e3b1d8729b2885bd1679c4c1d7506 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Wed, 10 Dec 2014 15:55:57 -0800 Subject: [PATCH 113/140] Adding simple keys for the user to inherit for creating parameters with a default value and parameters with a default value and range (min/max) --- autowiring/AutoParameter.h | 24 +++++++++++++++ src/autowiring/test/AutoParameterTest.cpp | 36 +++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 0b7aaaed2..cd5a22662 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -57,3 +57,27 @@ class AutoParameter: return CallValidate::Call(value); } }; + +/// +/// Default Key helper for parameters that only need a default value +/// +template +struct DefaultKey +{ +public: + static T Default() { return DEFAULT; } +}; + +/// +/// Key helper for parameters that will specify default, min and max +/// +template +struct DefaultMinMaxKey : public DefaultKey +{ +public: + static_assert(MIN <= DEFAULT && DEFAULT <= MAX, "Default value must be within range"); + + static bool Validate(const T& value) { + return MIN <= value && value <= MAX; + } +}; diff --git a/src/autowiring/test/AutoParameterTest.cpp b/src/autowiring/test/AutoParameterTest.cpp index 78f5ad1d7..1f50b5af5 100644 --- a/src/autowiring/test/AutoParameterTest.cpp +++ b/src/autowiring/test/AutoParameterTest.cpp @@ -120,3 +120,39 @@ TEST_F(AutoParameterTest, VerifyInvalidPreconfiguredValue) { AutoRequired my4; ASSERT_EQ(15, *my4->m_param); } + +struct MyParamClass5 { + struct MyDefaultKey : DefaultKey {}; + AutoParameter m_param; +}; + +TEST_F(AutoParameterTest, VerifyDefaultKey) { + AutoRequired mpc; + auto& param = mpc->m_param; + + ASSERT_EQ(*param, 15) + << "Default value was not properly set"; + ASSERT_FALSE(param.IsConfigured()) + << "Using the default value does not mean the parameter should be configured/set"; +} + +struct MyParamClass6 { + struct MyMinMaxKey : DefaultMinMaxKey {}; + AutoParameter m_param; +}; + +TEST_F(AutoParameterTest, VerifyDefaultMinMaxKey) { + AutoRequired mpc; + auto& param = mpc->m_param; + + ASSERT_EQ(*param, 15) + << "Default "; + + ASSERT_FALSE(param.Set(9)) + << "Set() should return false when setting invalid value"; + ASSERT_EQ(*param, 15) + << "Failed set attempts should not have altered the previous state"; + + ASSERT_TRUE(param.Set(10) && *param == 10) + << "Should be able to set values that are valid according to the validation function"; +} \ No newline at end of file From 2d7fff3e3d40090c7c22a703147dfb762f609cc8 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Wed, 10 Dec 2014 16:15:13 -0800 Subject: [PATCH 114/140] Disallow the use of DefaultKey and DefaultMinMaxKey statically by providing a pure virtual destructor --- autowiring/AutoParameter.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index cd5a22662..d5b961010 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -2,6 +2,7 @@ #pragma once #include "AutoConfig.h" #include "has_validate.h" +#include /// /// Register an AutoParameter with "AutoParam" namespace in AutoConfigManager. @@ -19,6 +20,8 @@ class AutoParameter: public AutoConfig { public: + static_assert(std::is_constructible(), "Cannot use the default keys provided. You must subclass and use your own"); + AutoParameter() : AutoConfig(), m_default(TKey::Default()) @@ -66,6 +69,9 @@ struct DefaultKey { public: static T Default() { return DEFAULT; } + +protected: + virtual ~DefaultKey() = 0; }; /// @@ -80,4 +86,7 @@ struct DefaultMinMaxKey : public DefaultKey static bool Validate(const T& value) { return MIN <= value && value <= MAX; } + +protected: + virtual ~DefaultMinMaxKey() = 0; }; From a584834dd6e1d921936bebbd3068e538c9f80495 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Wed, 10 Dec 2014 16:25:01 -0800 Subject: [PATCH 115/140] Adding more comments for the default key base classes --- autowiring/AutoParameter.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index d5b961010..c136ffaf0 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -62,8 +62,16 @@ class AutoParameter: }; /// -/// Default Key helper for parameters that only need a default value +/// Base class for providing an easy way to specify just a default value /// +/// +/// Because the class names are used as keys to be stored in the AutoConfigManager, these classes cannot be used +/// directly and must be subclassed: +/// +/// struct MyDefaultKey : DefaultKey {}; +/// AutoParameter param; +/// +/// template struct DefaultKey { @@ -75,8 +83,16 @@ struct DefaultKey }; /// -/// Key helper for parameters that will specify default, min and max +/// Base class for providing an easy way to default, min and max values /// +/// +/// Because the class names are used as keys to be stored in the AutoConfigManager, these classes cannot be used +/// directly and must be subclassed: +/// +/// struct MyDefaultMinMaxKey : DefaultMinMaxKey {}; +/// AutoParameter param; +/// +/// template struct DefaultMinMaxKey : public DefaultKey { From fa85e26be99f55337bc527273d41e92b0213c3fb Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Wed, 10 Dec 2014 16:27:59 -0800 Subject: [PATCH 116/140] =?UTF-8?q?Removing=20the=20=E2=80=9Cstruct?= =?UTF-8?q?=E2=80=9D=20before=20AutoParam=20definitions=20since=20it?= =?UTF-8?q?=E2=80=99s=20already=20defined=20at=20the=20top?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autowiring/AutoParameter.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index c136ffaf0..77772a49d 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -4,6 +4,8 @@ #include "has_validate.h" #include +struct AutoParam{}; + /// /// Register an AutoParameter with "AutoParam" namespace in AutoConfigManager. /// In addition to being the lookup string, the Key also implements: @@ -13,17 +15,15 @@ /// AutoParameter uses AutoConfig under the hood and will use "AutoParam" as /// its namespace /// -struct AutoParam{}; - template class AutoParameter: - public AutoConfig + public AutoConfig { public: static_assert(std::is_constructible(), "Cannot use the default keys provided. You must subclass and use your own"); AutoParameter() : - AutoConfig(), + AutoConfig(), m_default(TKey::Default()) { if (!isValid(m_default)) { @@ -34,13 +34,13 @@ class AutoParameter: const T& operator*() const { return this->IsConfigured() ? - AutoConfig::operator*() : + AutoConfig::operator*() : m_default; } const T* operator->(void) const { return this->IsConfigured() ? - this->template AutoConfig::operator->() : + this->template AutoConfig::operator->() : &m_default; } From 7ff3cb7b31f8d1e5feb13b1a130c68eb9e8596b9 Mon Sep 17 00:00:00 2001 From: Jimmy Nguyen Date: Wed, 10 Dec 2014 16:55:49 -0800 Subject: [PATCH 117/140] Changing to use value member --- autowiring/AutoParameter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index 77772a49d..b7f22b8fb 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -20,7 +20,7 @@ class AutoParameter: public AutoConfig { public: - static_assert(std::is_constructible(), "Cannot use the default keys provided. You must subclass and use your own"); + static_assert(std::is_constructible::value, "Cannot use the default keys provided. You must subclass and use your own"); AutoParameter() : AutoConfig(), From 11ba58819cd1e5b79297846344887f2f16c2d881 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Wed, 10 Dec 2014 17:12:14 -0800 Subject: [PATCH 118/140] First subscriber no longer relevant when packets are not pooled --- autowiring/AutoPacket.h | 26 ++++++-------------------- src/autowiring/AutoPacket.cpp | 3 --- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index bfbdc5d45..70c903b78 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -53,19 +53,18 @@ class AutoPacket: }; protected: - // Saturation counters, constructed when the packet is created and reset each time thereafter - std::list m_satCounters; - - // An iterator referring to the first permanent subscriber in the list of satisfaction counters - // Temporary subscribers are pushed to the front of the list prior to this iterator - std::list::iterator m_firstSubscriber; - // A pointer back to the factory that created us. Used for recording lifetime statistics. const std::shared_ptr m_parentFactory; // Hold the time point at which this packet was last initalized. const std::chrono::high_resolution_clock::time_point m_initTime; + // Outstanding count local and remote holds: + const std::shared_ptr m_outstanding; + + // Saturation counters, constructed when the packet is created and reset each time thereafter + std::list m_satCounters; + // The set of decorations currently attached to this object, and the associated lock: // Decorations are indexed first by type and second by pipe terminating type, if any. // NOTE: This is a disambiguation of function reference assignment, and avoids use of constexp. @@ -73,16 +72,6 @@ class AutoPacket: t_decorationMap m_decorations; mutable std::mutex m_lock; - /// - /// Last chance call with unsatisfied optional arguments. - /// - /// - /// This is called when the packet is returned to the AutoPacketFactory. - /// It is not called when the Packet is destroyed, since that could result in - /// suprious calles when no packet is issued. - /// - void Finalize(void); - /// /// Adds all AutoFilter argument information for a recipient /// @@ -93,9 +82,6 @@ class AutoPacket: /// void RemoveSatCounter(const SatCounter& satCounter); - // Outstanding count local and remote holds: - const std::shared_ptr m_outstanding; - /// /// Marks the specified entry as being unsatisfiable /// diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index 04d3a7373..c89e88ef7 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -28,9 +28,6 @@ AutoPacket::AutoPacket(AutoPacketFactory& factory, std::shared_ptr&& outst m_satCounters.sort(); m_satCounters.erase(std::unique(m_satCounters.begin(), m_satCounters.end()), m_satCounters.end()); - // Record divide between subscribers & recipients - m_firstSubscriber = m_satCounters.begin(); - // Prime the satisfaction graph for each element: for(auto& satCounter : m_satCounters) AddSatCounter(satCounter); From 33aad0b5333d8cdea50fc87d3932026c657cff53 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 12 Dec 2014 16:20:17 -0800 Subject: [PATCH 119/140] Correcting Windows build 64-bit conditional sources were not correctly checking the autowiring_BUILD_64 flag, and were using BUILD_64_BIT instead. --- src/autowiring/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 1210f9fd8..fc47dab52 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -181,12 +181,13 @@ set(Autowiring_Linux_SRCS CoreThreadLinux.cpp ) -add_conditional_sources( Autowiring_SRCS "NOT MSVC" GROUP_NAME "Non-Windows Source" FILES ${Autowiring_Unix_SRCS}) +add_conditional_sources(Autowiring_SRCS "NOT MSVC" GROUP_NAME "Non-Windows Source" FILES ${Autowiring_Unix_SRCS}) -add_conditional_sources(Autowiring_SRCS "WIN32 AND NOT BUILD_64_BIT" +add_conditional_sources(Autowiring_SRCS "WIN32 AND NOT autowiring_BUILD_64" GROUP_NAME "ASMx86 Source" FILES interlocked.asm ) + if(WIN32 AND NOT BUILD_64_BIT) enable_language(ASM_MASM) endif() From ef8561a17abfcba9b0552b71faa65e0295baebae Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 12 Dec 2014 17:02:55 -0800 Subject: [PATCH 120/140] Add fixes for libstdc++ --- autowiring/AutoConfigManager.h | 2 +- autowiring/AutoParameter.h | 2 +- autowiring/C++11/boost_tuple.h | 10 ++++++++++ autowiring/ConfigRegistry.h | 1 + src/autowiring/AutoConfigManager.cpp | 4 ++-- src/autowiring/AutoConfigParser.cpp | 10 +++++----- src/autowiring/test/TestFixtures/Decoration.hpp | 3 ++- 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/autowiring/AutoConfigManager.h b/autowiring/AutoConfigManager.h index 7f306c1b7..7b0b93e9e 100644 --- a/autowiring/AutoConfigManager.h +++ b/autowiring/AutoConfigManager.h @@ -79,7 +79,7 @@ class AutoConfigManager: throw autowiring_error(ss.str()); } - if (!s_registry.at(key)->verifyType(typeid(T))) { + if (!s_registry.find(key)->second->verifyType(typeid(T))) { std::stringstream ss; ss << "Attempting to set config '" << key << "' with incorrect type '" << autowiring::demangle(typeid(T)) << "'"; diff --git a/autowiring/AutoParameter.h b/autowiring/AutoParameter.h index b7f22b8fb..b889bc168 100644 --- a/autowiring/AutoParameter.h +++ b/autowiring/AutoParameter.h @@ -2,7 +2,7 @@ #pragma once #include "AutoConfig.h" #include "has_validate.h" -#include +#include TYPE_TRAITS_HEADER struct AutoParam{}; diff --git a/autowiring/C++11/boost_tuple.h b/autowiring/C++11/boost_tuple.h index ab8c0e9ce..1a8319ecc 100644 --- a/autowiring/C++11/boost_tuple.h +++ b/autowiring/C++11/boost_tuple.h @@ -12,6 +12,11 @@ namespace std { m_tuple(ele...) {} virtual ~tuple(void){} + + tuple& operator=(const tuple& other) { + m_tuple = other.m_tuple; + return *this; + } bool operator==(const tuple& other) const { return m_tuple == other.m_tuple; @@ -23,6 +28,11 @@ namespace std { boost::tuple m_tuple; }; + + template + ::std::tuple tie(const Ts&... val) { + return ::std::tuple(val...) ; + } template auto get(const ::std::tuple& tup) -> decltype(boost::get(tup.m_tuple)) { diff --git a/autowiring/ConfigRegistry.h b/autowiring/ConfigRegistry.h index 5cfab3358..4d5799748 100644 --- a/autowiring/ConfigRegistry.h +++ b/autowiring/ConfigRegistry.h @@ -1,6 +1,7 @@ // Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. #pragma once #include MEMORY_HEADER +#include FUNCTIONAL_HEADER #include #include #include "AnySharedPointer.h" diff --git a/src/autowiring/AutoConfigManager.cpp b/src/autowiring/AutoConfigManager.cpp index 4c3ed719d..5ddb90c74 100644 --- a/src/autowiring/AutoConfigManager.cpp +++ b/src/autowiring/AutoConfigManager.cpp @@ -81,7 +81,7 @@ bool AutoConfigManager::SetParsed(const std::string& key, const std::string& val return false; } - SetRecursive(key, s_registry.at(key)->parse(value)); + SetRecursive(key, s_registry.find(key)->second->parse(value)); return true; } @@ -93,7 +93,7 @@ void AutoConfigManager::AddCallback(const std::string& key, t_callback&& fx) { void AutoConfigManager::SetRecursive(const std::string& key, AnySharedPointer value) { // Call all validators for this key if (s_validators.count(key)) { - for (auto const& fx : s_validators.at(key)) { + for (auto const& fx : s_validators.find(key)->second) { if (!fx(value)){ std::stringstream ss; ss << "Attempted to set key '" << key << "'which didin't pass validator"; diff --git a/src/autowiring/AutoConfigParser.cpp b/src/autowiring/AutoConfigParser.cpp index f6a35d3f3..fbb5a083f 100644 --- a/src/autowiring/AutoConfigParser.cpp +++ b/src/autowiring/AutoConfigParser.cpp @@ -20,10 +20,10 @@ std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { ss >> arg2; // Remove trailing "," - arg1.pop_back(); + arg1.resize(arg1.size()-1); // Remove trailing '>' - arg2.pop_back(); + arg2.resize(arg2.size()-1); std::stringstream key; key << arg1 << "." << arg2; @@ -31,7 +31,7 @@ std::string autowiring::ExtractKeyUnix(std::stringstream& ss) { } else { // Remove trailing '>' - arg1.pop_back(); + arg1.resize(arg1.size()-1); return arg1; } } @@ -54,7 +54,7 @@ std::string autowiring::ExtractKeyWin(std::stringstream& ss) { arg1 = arg1.substr(0, found); // Remove trailing '>' - arg2.pop_back(); + arg2.resize(arg2.size()-1); std::stringstream key; key << arg1 << "." << arg2; @@ -62,7 +62,7 @@ std::string autowiring::ExtractKeyWin(std::stringstream& ss) { } else { // Remove trailing '>' - arg1.pop_back(); + arg1.resize(arg1.size()-1); return arg1; } } diff --git a/src/autowiring/test/TestFixtures/Decoration.hpp b/src/autowiring/test/TestFixtures/Decoration.hpp index d5ffe82e6..29600c778 100644 --- a/src/autowiring/test/TestFixtures/Decoration.hpp +++ b/src/autowiring/test/TestFixtures/Decoration.hpp @@ -140,7 +140,8 @@ template class FilterGen { public: FilterGen(void): - m_called(0) + m_called(0), + m_args(Args()...) {} void AutoFilter(AutoPacket& packet, Args... args) { From b65b836f6bfd8257ab9ad21affd40e04e352d7dd Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 12 Dec 2014 17:15:56 -0800 Subject: [PATCH 121/140] Fix linux problem with libstdc++ fix --- src/autowiring/test/TestFixtures/Decoration.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autowiring/test/TestFixtures/Decoration.hpp b/src/autowiring/test/TestFixtures/Decoration.hpp index 29600c778..fba466d56 100644 --- a/src/autowiring/test/TestFixtures/Decoration.hpp +++ b/src/autowiring/test/TestFixtures/Decoration.hpp @@ -141,7 +141,7 @@ class FilterGen { public: FilterGen(void): m_called(0), - m_args(Args()...) + m_args() {} void AutoFilter(AutoPacket& packet, Args... args) { From 32046c68e3b188604eaab568bdbd936ad41154a1 Mon Sep 17 00:00:00 2001 From: Graham Tremper Date: Fri, 12 Dec 2014 18:42:12 -0800 Subject: [PATCH 122/140] Pragma out tests incompatible with libstdc++ --- src/autowiring/test/AutoFilterCollapseRulesTest.cpp | 4 +++- src/autowiring/test/TestFixtures/Decoration.hpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/autowiring/test/AutoFilterCollapseRulesTest.cpp b/src/autowiring/test/AutoFilterCollapseRulesTest.cpp index f482054a6..94d0b88b6 100644 --- a/src/autowiring/test/AutoFilterCollapseRulesTest.cpp +++ b/src/autowiring/test/AutoFilterCollapseRulesTest.cpp @@ -89,6 +89,7 @@ TEST_F(AutoFilterCollapseRulesTest, SharedPtrCollapse) { shared_filter->m_called = 0; } +#if AUTOWIRING_USE_LIBCXX TEST_F(AutoFilterCollapseRulesTest, SharedPointerAliasingRules) { AutoRequired factory; AutoRequired>> genFilter1; @@ -124,4 +125,5 @@ TEST_F(AutoFilterCollapseRulesTest, AutoFilterSharedAliasingRules) { auto packet = factory->NewPacket(); ASSERT_TRUE(packet->Has()) << "Filter producing a shared pointer of type int did not correctly collapse to the basic int type"; ASSERT_EQ(55, std::get<0>(consumes->m_args)) << "Filter consuming a shared pointer output was not called as expected"; -} \ No newline at end of file +} +#endif diff --git a/src/autowiring/test/TestFixtures/Decoration.hpp b/src/autowiring/test/TestFixtures/Decoration.hpp index fba466d56..19a0ec5a7 100644 --- a/src/autowiring/test/TestFixtures/Decoration.hpp +++ b/src/autowiring/test/TestFixtures/Decoration.hpp @@ -136,12 +136,12 @@ class FilterF: /// /// A generic filter which accepts templated input types /// +#if AUTOWIRING_USE_LIBCXX template class FilterGen { public: FilterGen(void): - m_called(0), - m_args() + m_called(0) {} void AutoFilter(AutoPacket& packet, Args... args) { @@ -162,6 +162,7 @@ class FilterGen { int m_called; std::tuple::type...> m_args; }; +#endif /// /// A filter that should trigger a static_assert in AutoRequire From f8b6b6c37b32e66280e6f64cd9c9386e0f2fab4c Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 12 Dec 2014 20:02:08 -0800 Subject: [PATCH 123/140] Corrected a minor defect with the direction of a linked list reference This verification should guard against future issues about the wrong saturation counter's AutoFilter getting called when a filter is detected as being full satisfied. - Added unit test to verify multiple observers are called as expected --- src/autowiring/AutoPacket.cpp | 2 +- .../test/AutoFilterFunctionTest.cpp | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index c89e88ef7..f3eba7933 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -290,7 +290,7 @@ AutoPacket::Recipient AutoPacket::AddRecipient(const AutoFilterDescriptor& descr // (1) Append & Initialize new satisfaction counter m_satCounters.push_front(descriptor); retVal.position = m_satCounters.begin(); - recipient = &m_satCounters.back(); + recipient = &m_satCounters.front(); recipient->Reset(); // (2) Update satisfaction & Append types from subscriber diff --git a/src/autowiring/test/AutoFilterFunctionTest.cpp b/src/autowiring/test/AutoFilterFunctionTest.cpp index 0b4ed7f9a..056737cf9 100644 --- a/src/autowiring/test/AutoFilterFunctionTest.cpp +++ b/src/autowiring/test/AutoFilterFunctionTest.cpp @@ -123,4 +123,31 @@ TEST_F(AutoFilterFunctionalTest, ObservingFunctionTest) { packet->Decorate(Decoration<0>()); packet->Decorate(Decoration<1>()); ASSERT_TRUE(*called) << "Receive-only filter attached to a const packet image was not correctly called"; +} + + +TEST_F(AutoFilterFunctionalTest, TripleFunctionTest) { + AutoRequired factory; + + auto packet = factory->NewPacket(); + + // Attach two lambdas, verify they each get called when we expect; + auto called1 = std::make_shared(false); + auto called2 = std::make_shared(false); + auto called3 = std::make_shared(false); + *packet += [called1](const Decoration<0>&) { *called1 = true; }; + *packet += [called2](const Decoration<0>&, const Decoration<1>&) { *called2 = true; }; + *packet += [called3](const Decoration<1>&) { *called3 = true; }; + + // Only the third method should be called + packet->Decorate(Decoration<1>()); + + ASSERT_FALSE(*called1) << "Incorrect filter method called in response to Decorate"; + ASSERT_FALSE(*called2) << "Incorrect filter method called in response to Decorate"; + ASSERT_TRUE(*called3) << "Filter method called when a decoration was absent"; + + // Now the other two should be called: + packet->Decorate(Decoration<0>()); + ASSERT_TRUE(*called1) << "Final observer method was not invoked as expected"; + ASSERT_TRUE(*called2) << "Two-argument observer method not invoked as expected"; } \ No newline at end of file From 402a95a036abf56f40b02cb5ee0514ad9128db74 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 12 Dec 2014 20:43:13 -0800 Subject: [PATCH 124/140] Adding TeardownListener functionality to AutoPacket This gives users the ability to register a lambda which is notified when the underlying AutoPacket is destroyed. This is useful when attempting to evaluate whether an AutoPacket has been fully processed. Users to receive the packet on teardown should make the following call: packet->AddTeardownListener([] { // ...foo... }); --- autowiring/AutoPacket.h | 4 +++- src/autowiring/test/AutoFilterTest.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 70c903b78..9315db955 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -10,6 +10,7 @@ #include "is_shared_ptr.h" #include "MicroAutoFilter.h" #include "ObjectPool.h" +#include "TeardownNotifier.h" #include #include #include @@ -37,7 +38,8 @@ struct AutoFilterDescriptor; /// manually with the Advertise function. /// class AutoPacket: - public std::enable_shared_from_this + public std::enable_shared_from_this, + public TeardownNotifier { private: AutoPacket(const AutoPacket& rhs) = delete; diff --git a/src/autowiring/test/AutoFilterTest.cpp b/src/autowiring/test/AutoFilterTest.cpp index 7961553ae..8a54f3d2c 100644 --- a/src/autowiring/test/AutoFilterTest.cpp +++ b/src/autowiring/test/AutoFilterTest.cpp @@ -1025,4 +1025,18 @@ TEST_F(AutoFilterTest, AutoFilterInBaseClassNoAlias) { // Trivial validation that we got something back ASSERT_EQ(1UL, d->m_called) << "Filter defined in base class in an Object-inheriting type was not called the expected number of times"; +} + +TEST_F(AutoFilterTest, PacketTeardownNotificationCheck) { + AutoRequired factory; + auto called = std::make_shared(false); + + { + auto packet = factory->NewPacket(); + packet->AddTeardownListener([called] { *called = true; }); + ASSERT_FALSE(*called) << "Teardown listener called before packet was destroyed"; + } + + ASSERT_TRUE(*called) << "Teardown listener was not called after packet destruction"; + ASSERT_TRUE(called.unique()) << "Teardown listener lambda function was leaked"; } \ No newline at end of file From a817c671fbf0be1a0add825678cfe3c077aaa2b6 Mon Sep 17 00:00:00 2001 From: Jason Lokerson Date: Fri, 12 Dec 2014 20:36:19 -0800 Subject: [PATCH 125/140] Simplification of DecorateImmediate Making use of a function defined at file level for an array initialization, should also ease the burden in object files where DecorateImmediate is heavily used --- autowiring/AutoPacket.h | 46 +++++++++++--------------- src/autowiring/AutoPacket.cpp | 22 ++++++++++++ src/autowiring/test/AutoFilterTest.cpp | 3 +- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/autowiring/AutoPacket.h b/autowiring/AutoPacket.h index 70c903b78..8bc7e5ecf 100644 --- a/autowiring/AutoPacket.h +++ b/autowiring/AutoPacket.h @@ -72,6 +72,16 @@ class AutoPacket: t_decorationMap m_decorations; mutable std::mutex m_lock; + /// + /// Checks out the decoration named by the specified type information and attaches the specified immediate pointer to it + /// + /// + /// An immediate checkout differs from a standard checkout in that the internally held decoration is only temporarily + /// available. Thus, callers are either satisfied at the point of decoration, or will not be satisfied for that + /// type. + /// + DecorationDisposition& CheckoutImmediateUnsafe(const std::type_info& ti, const void* pvImmed); + /// /// Adds all AutoFilter argument information for a recipient /// @@ -390,33 +400,15 @@ class AutoPacket: !is_any::value, is_shared_ptr::value...>::value, "DecorateImmediate must not be used to attach a shared pointer, use Decorate on such a decoration instead" ); - - // These are the things we're going to be working with while we perform immediate decoration: - static const std::type_info* s_argTypes [] = {&typeid(T), &typeid(Ts)...}; - static const size_t s_arity = 1 + sizeof...(Ts); - const void* pvImmeds [] = {&immed, &immeds...}; - DecorationDisposition* pTypeSubs[s_arity]; // Perform standard decoration with a short initialization: - { - std::lock_guard lk(m_lock); - for(size_t i = 0; i < s_arity; i++) { - pTypeSubs[i] = &m_decorations[*s_argTypes[i]]; - pTypeSubs[i]->m_type = s_argTypes[i]; // Ensure correct type if instantiated here - if(pTypeSubs[i]->satisfied || - pTypeSubs[i]->isCheckedOut) { - std::stringstream ss; - ss << "Cannot perform immediate decoration with type " << autowiring::demangle(*s_argTypes[i]) - << ", the requested decoration already exists"; - throw std::runtime_error(ss.str()); - } - - // Mark the entry as appropriate: - pTypeSubs[i]->isCheckedOut = true; - pTypeSubs[i]->satisfied = true; - pTypeSubs[i]->m_pImmediate = pvImmeds[i]; - } - } + std::unique_lock lk(m_lock); + DecorationDisposition* pTypeSubs[1 + sizeof...(Ts)] = { + &CheckoutImmediateUnsafe(typeid(T), &immed), + &CheckoutImmediateUnsafe(typeid(Ts), &immeds)... + }; + lk.unlock(); + // Pulse satisfaction: MakeAtExit([this, &pTypeSubs] { @@ -428,10 +420,10 @@ class AutoPacket: } // Now trigger a rescan to hit any deferred, unsatisfiable entries: - for(const std::type_info* ti : s_argTypes) + for(const std::type_info* ti : {&typeid(T), &typeid(Ts)...}) MarkUnsatisfiable(*ti); }), - PulseSatisfaction(pTypeSubs, s_arity); + PulseSatisfaction(pTypeSubs, 1 + sizeof...(Ts)); } /// diff --git a/src/autowiring/AutoPacket.cpp b/src/autowiring/AutoPacket.cpp index f3eba7933..31c769d8d 100644 --- a/src/autowiring/AutoPacket.cpp +++ b/src/autowiring/AutoPacket.cpp @@ -49,6 +49,28 @@ AutoPacket::~AutoPacket(void) { ); } +DecorationDisposition& AutoPacket::CheckoutImmediateUnsafe(const std::type_info& ti, const void* pvImmed) +{ + // Obtain the decoration disposition of the entry we will be returning + DecorationDisposition& dec = m_decorations[ti]; + + // Ensure correct type if instantiated here + dec.m_type = &ti; + + if (dec.satisfied || dec.isCheckedOut) { + std::stringstream ss; + ss << "Cannot perform immediate decoration with type " << autowiring::demangle(ti) + << ", the requested decoration already exists"; + throw std::runtime_error(ss.str()); + } + + // Mark the entry as appropriate: + dec.isCheckedOut = true; + dec.satisfied = true; + dec.m_pImmediate = pvImmed; + return dec; +} + void AutoPacket::AddSatCounter(SatCounter& satCounter) { for(auto pCur = satCounter.GetAutoFilterInput(); *pCur; pCur++) { const std::type_info& dataType = *pCur->ti; diff --git a/src/autowiring/test/AutoFilterTest.cpp b/src/autowiring/test/AutoFilterTest.cpp index 7961553ae..79577929c 100644 --- a/src/autowiring/test/AutoFilterTest.cpp +++ b/src/autowiring/test/AutoFilterTest.cpp @@ -1025,4 +1025,5 @@ TEST_F(AutoFilterTest, AutoFilterInBaseClassNoAlias) { // Trivial validation that we got something back ASSERT_EQ(1UL, d->m_called) << "Filter defined in base class in an Object-inheriting type was not called the expected number of times"; -} \ No newline at end of file +} + From 08e26c92b4bef7cdebdfac352454f8f6ced8905f Mon Sep 17 00:00:00 2001 From: Jonathan Marsden Date: Mon, 15 Dec 2014 13:22:33 -0800 Subject: [PATCH 126/140] Add a subset of boost that uses the autoboost namespace --- contrib/autoboost/README.md | 7 + .../boost/algorithm/string/case_conv.hpp | 176 + .../boost/algorithm/string/classification.hpp | 312 + .../boost/algorithm/string/compare.hpp | 199 + .../boost/algorithm/string/concept.hpp | 83 + .../boost/algorithm/string/config.hpp | 28 + .../boost/algorithm/string/constants.hpp | 36 + .../algorithm/string/detail/case_conv.hpp | 123 + .../string/detail/classification.hpp | 353 ++ .../algorithm/string/detail/find_format.hpp | 204 + .../string/detail/find_format_all.hpp | 273 + .../string/detail/find_format_store.hpp | 89 + .../algorithm/string/detail/find_iterator.hpp | 87 + .../boost/algorithm/string/detail/finder.hpp | 639 ++ .../algorithm/string/detail/formatter.hpp | 119 + .../string/detail/replace_storage.hpp | 159 + .../algorithm/string/detail/sequence.hpp | 200 + .../boost/algorithm/string/detail/trim.hpp | 95 + .../boost/algorithm/string/detail/util.hpp | 106 + .../boost/algorithm/string/erase.hpp | 844 +++ .../boost/algorithm/string/find_format.hpp | 287 + .../boost/algorithm/string/find_iterator.hpp | 383 ++ .../boost/algorithm/string/finder.hpp | 270 + .../boost/algorithm/string/formatter.hpp | 120 + .../boost/algorithm/string/iter_find.hpp | 193 + .../algorithm/string/predicate_facade.hpp | 42 + .../boost/algorithm/string/replace.hpp | 928 +++ .../algorithm/string/sequence_traits.hpp | 120 + .../boost/algorithm/string/split.hpp | 163 + .../autoboost/boost/algorithm/string/trim.hpp | 398 ++ .../boost/algorithm/string/yes_no_type.hpp | 33 + contrib/autoboost/boost/align/align.hpp | 20 + .../autoboost/boost/align/detail/address.hpp | 27 + .../autoboost/boost/align/detail/align.hpp | 38 + .../boost/align/detail/align_cxx11.hpp | 20 + .../boost/align/detail/is_alignment.hpp | 27 + contrib/autoboost/boost/aligned_storage.hpp | 143 + contrib/autoboost/boost/archive/add_facet.hpp | 55 + .../boost/archive/archive_exception.hpp | 99 + .../autoboost/boost/archive/basic_archive.hpp | 304 + .../boost/archive/basic_binary_iarchive.hpp | 228 + .../boost/archive/basic_binary_iprimitive.hpp | 190 + .../boost/archive/basic_binary_oarchive.hpp | 186 + .../boost/archive/basic_binary_oprimitive.hpp | 183 + .../archive/basic_streambuf_locale_saver.hpp | 73 + .../boost/archive/basic_text_iarchive.hpp | 97 + .../boost/archive/basic_text_iprimitive.hpp | 137 + .../boost/archive/basic_text_oarchive.hpp | 122 + .../boost/archive/basic_text_oprimitive.hpp | 206 + .../boost/archive/basic_xml_archive.hpp | 67 + .../boost/archive/basic_xml_iarchive.hpp | 133 + .../boost/archive/basic_xml_oarchive.hpp | 150 + .../boost/archive/binary_iarchive.hpp | 64 + .../boost/archive/binary_iarchive_impl.hpp | 108 + .../boost/archive/binary_oarchive.hpp | 64 + .../boost/archive/binary_oarchive_impl.hpp | 109 + .../boost/archive/binary_wiarchive.hpp | 56 + .../boost/archive/binary_woarchive.hpp | 59 + .../autoboost/boost/archive/codecvt_null.hpp | 100 + .../boost/archive/detail/abi_prefix.hpp | 20 + .../boost/archive/detail/abi_suffix.hpp | 19 + .../archive/detail/archive_serializer_map.hpp | 55 + .../archive/detail/auto_link_archive.hpp | 48 + .../archive/detail/auto_link_warchive.hpp | 47 + .../boost/archive/detail/basic_iarchive.hpp | 105 + .../archive/detail/basic_iserializer.hpp | 95 + .../boost/archive/detail/basic_oarchive.hpp | 100 + .../archive/detail/basic_oserializer.hpp | 93 + .../detail/basic_pointer_iserializer.hpp | 74 + .../detail/basic_pointer_oserializer.hpp | 72 + .../boost/archive/detail/basic_serializer.hpp | 79 + .../archive/detail/basic_serializer_map.hpp | 69 + .../autoboost/boost/archive/detail/check.hpp | 169 + .../boost/archive/detail/common_iarchive.hpp | 88 + .../boost/archive/detail/common_oarchive.hpp | 87 + .../autoboost/boost/archive/detail/decl.hpp | 79 + .../archive/detail/helper_collection.hpp | 108 + .../archive/detail/interface_iarchive.hpp | 77 + .../archive/detail/interface_oarchive.hpp | 84 + .../boost/archive/detail/iserializer.hpp | 658 +++ .../boost/archive/detail/oserializer.hpp | 531 ++ .../boost/archive/detail/register_archive.hpp | 91 + .../archive/detail/utf8_codecvt_facet.hpp | 23 + .../autoboost/boost/archive/dinkumware.hpp | 224 + .../archive/impl/archive_serializer_map.ipp | 71 + .../archive/impl/basic_binary_iarchive.ipp | 133 + .../archive/impl/basic_binary_iprimitive.ipp | 210 + .../archive/impl/basic_binary_oarchive.ipp | 46 + .../archive/impl/basic_binary_oprimitive.ipp | 161 + .../archive/impl/basic_text_iarchive.ipp | 76 + .../archive/impl/basic_text_iprimitive.ipp | 152 + .../archive/impl/basic_text_oarchive.ipp | 62 + .../archive/impl/basic_text_oprimitive.ipp | 115 + .../boost/archive/impl/basic_xml_grammar.hpp | 173 + .../boost/archive/impl/basic_xml_iarchive.ipp | 114 + .../boost/archive/impl/basic_xml_oarchive.ipp | 275 + .../boost/archive/impl/text_iarchive_impl.ipp | 128 + .../boost/archive/impl/text_oarchive_impl.ipp | 124 + .../archive/impl/text_wiarchive_impl.ipp | 118 + .../archive/impl/text_woarchive_impl.ipp | 85 + .../boost/archive/impl/xml_iarchive_impl.ipp | 204 + .../boost/archive/impl/xml_oarchive_impl.ipp | 117 + .../boost/archive/impl/xml_wiarchive_impl.ipp | 211 + .../boost/archive/impl/xml_woarchive_impl.ipp | 167 + .../archive/iterators/base64_from_binary.hpp | 111 + .../archive/iterators/binary_from_base64.hpp | 119 + .../archive/iterators/dataflow_exception.hpp | 80 + .../boost/archive/iterators/escape.hpp | 114 + .../archive/iterators/insert_linebreaks.hpp | 101 + .../archive/iterators/istream_iterator.hpp | 107 + .../boost/archive/iterators/mb_from_wchar.hpp | 136 + .../archive/iterators/ostream_iterator.hpp | 83 + .../archive/iterators/remove_whitespace.hpp | 169 + .../archive/iterators/transform_width.hpp | 177 + .../boost/archive/iterators/unescape.hpp | 89 + .../boost/archive/iterators/wchar_from_mb.hpp | 129 + .../boost/archive/iterators/xml_escape.hpp | 122 + .../boost/archive/iterators/xml_unescape.hpp | 126 + .../boost/archive/polymorphic_iarchive.hpp | 172 + .../boost/archive/polymorphic_oarchive.hpp | 157 + .../autoboost/boost/archive/text_iarchive.hpp | 142 + .../autoboost/boost/archive/text_oarchive.hpp | 129 + .../boost/archive/text_wiarchive.hpp | 139 + .../boost/archive/text_woarchive.hpp | 155 + contrib/autoboost/boost/archive/wcslen.hpp | 56 + .../boost/archive/xml_archive_exception.hpp | 56 + .../autoboost/boost/archive/xml_iarchive.hpp | 152 + .../autoboost/boost/archive/xml_oarchive.hpp | 143 + .../autoboost/boost/archive/xml_wiarchive.hpp | 159 + .../autoboost/boost/archive/xml_woarchive.hpp | 151 + contrib/autoboost/boost/array.hpp | 446 ++ contrib/autoboost/boost/asio.hpp | 121 + contrib/autoboost/boost/asio/async_result.hpp | 96 + .../boost/asio/basic_datagram_socket.hpp | 951 +++ .../boost/asio/basic_deadline_timer.hpp | 520 ++ .../autoboost/boost/asio/basic_io_object.hpp | 242 + .../autoboost/boost/asio/basic_raw_socket.hpp | 942 +++ .../boost/asio/basic_seq_packet_socket.hpp | 567 ++ .../boost/asio/basic_serial_port.hpp | 697 +++ .../autoboost/boost/asio/basic_signal_set.hpp | 386 ++ contrib/autoboost/boost/asio/basic_socket.hpp | 1520 +++++ .../boost/asio/basic_socket_acceptor.hpp | 1138 ++++ .../boost/asio/basic_socket_iostream.hpp | 288 + .../boost/asio/basic_socket_streambuf.hpp | 569 ++ .../boost/asio/basic_stream_socket.hpp | 854 +++ .../autoboost/boost/asio/basic_streambuf.hpp | 371 ++ .../boost/asio/basic_streambuf_fwd.hpp | 35 + .../boost/asio/basic_waitable_timer.hpp | 521 ++ contrib/autoboost/boost/asio/buffer.hpp | 2241 +++++++ .../boost/asio/buffered_read_stream.hpp | 246 + .../boost/asio/buffered_read_stream_fwd.hpp | 27 + .../autoboost/boost/asio/buffered_stream.hpp | 260 + .../boost/asio/buffered_stream_fwd.hpp | 27 + .../boost/asio/buffered_write_stream.hpp | 238 + .../boost/asio/buffered_write_stream_fwd.hpp | 27 + .../autoboost/boost/asio/buffers_iterator.hpp | 483 ++ .../boost/asio/completion_condition.hpp | 220 + contrib/autoboost/boost/asio/connect.hpp | 825 +++ contrib/autoboost/boost/asio/coroutine.hpp | 330 ++ .../boost/asio/datagram_socket_service.hpp | 434 ++ .../autoboost/boost/asio/deadline_timer.hpp | 42 + .../boost/asio/deadline_timer_service.hpp | 173 + .../autoboost/boost/asio/detail/addressof.hpp | 40 + contrib/autoboost/boost/asio/detail/array.hpp | 40 + .../autoboost/boost/asio/detail/array_fwd.hpp | 34 + .../autoboost/boost/asio/detail/assert.hpp | 32 + .../boost/asio/detail/atomic_count.hpp | 47 + .../asio/detail/base_from_completion_cond.hpp | 70 + .../boost/asio/detail/bind_handler.hpp | 491 ++ .../boost/asio/detail/buffer_resize_guard.hpp | 68 + .../asio/detail/buffer_sequence_adapter.hpp | 385 ++ .../asio/detail/buffered_stream_storage.hpp | 128 + .../boost/asio/detail/call_stack.hpp | 127 + .../boost/asio/detail/chrono_time_traits.hpp | 192 + .../boost/asio/detail/completion_handler.hpp | 83 + .../autoboost/boost/asio/detail/config.hpp | 906 +++ .../boost/asio/detail/consuming_buffers.hpp | 294 + .../autoboost/boost/asio/detail/cstdint.hpp | 48 + .../boost/asio/detail/date_time_fwd.hpp | 34 + .../asio/detail/deadline_timer_service.hpp | 229 + .../boost/asio/detail/dependent_type.hpp | 38 + .../boost/asio/detail/descriptor_ops.hpp | 119 + .../boost/asio/detail/descriptor_read_op.hpp | 121 + .../boost/asio/detail/descriptor_write_op.hpp | 121 + .../boost/asio/detail/dev_poll_reactor.hpp | 208 + .../boost/asio/detail/epoll_reactor.hpp | 244 + contrib/autoboost/boost/asio/detail/event.hpp | 50 + .../detail/eventfd_select_interrupter.hpp | 85 + .../boost/asio/detail/fd_set_adapter.hpp | 41 + .../boost/asio/detail/fenced_block.hpp | 78 + .../autoboost/boost/asio/detail/function.hpp | 40 + .../asio/detail/gcc_arm_fenced_block.hpp | 91 + .../asio/detail/gcc_hppa_fenced_block.hpp | 68 + .../asio/detail/gcc_sync_fenced_block.hpp | 65 + .../asio/detail/gcc_x86_fenced_block.hpp | 99 + .../asio/detail/handler_alloc_helpers.hpp | 82 + .../asio/detail/handler_cont_helpers.hpp | 45 + .../asio/detail/handler_invoke_helpers.hpp | 57 + .../boost/asio/detail/handler_tracking.hpp | 161 + .../asio/detail/handler_type_requirements.hpp | 490 ++ .../autoboost/boost/asio/detail/hash_map.hpp | 333 ++ .../detail/impl/buffer_sequence_adapter.ipp | 120 + .../boost/asio/detail/impl/descriptor_ops.ipp | 453 ++ .../asio/detail/impl/dev_poll_reactor.hpp | 80 + .../asio/detail/impl/dev_poll_reactor.ipp | 432 ++ .../boost/asio/detail/impl/epoll_reactor.hpp | 78 + .../boost/asio/detail/impl/epoll_reactor.ipp | 664 +++ .../impl/eventfd_select_interrupter.ipp | 167 + .../asio/detail/impl/handler_tracking.ipp | 307 + .../boost/asio/detail/impl/kqueue_reactor.hpp | 82 + .../boost/asio/detail/impl/kqueue_reactor.ipp | 498 ++ .../detail/impl/pipe_select_interrupter.ipp | 126 + .../boost/asio/detail/impl/posix_event.ipp | 49 + .../boost/asio/detail/impl/posix_mutex.ipp | 48 + .../boost/asio/detail/impl/posix_thread.ipp | 76 + .../boost/asio/detail/impl/posix_tss_ptr.ipp | 48 + .../impl/reactive_descriptor_service.ipp | 210 + .../impl/reactive_serial_port_service.ipp | 153 + .../impl/reactive_socket_service_base.ipp | 269 + .../detail/impl/resolver_service_base.ipp | 132 + .../boost/asio/detail/impl/select_reactor.hpp | 89 + .../boost/asio/detail/impl/select_reactor.ipp | 315 + .../asio/detail/impl/service_registry.hpp | 90 + .../asio/detail/impl/service_registry.ipp | 190 + .../asio/detail/impl/signal_set_service.ipp | 649 +++ .../boost/asio/detail/impl/socket_ops.ipp | 3396 +++++++++++ .../detail/impl/socket_select_interrupter.ipp | 177 + .../boost/asio/detail/impl/strand_service.hpp | 120 + .../boost/asio/detail/impl/strand_service.ipp | 178 + .../asio/detail/impl/task_io_service.hpp | 80 + .../asio/detail/impl/task_io_service.ipp | 476 ++ .../boost/asio/detail/impl/throw_error.ipp | 47 + .../asio/detail/impl/timer_queue_ptime.ipp | 86 + .../asio/detail/impl/timer_queue_set.ipp | 103 + .../boost/asio/detail/impl/win_event.ipp | 69 + .../detail/impl/win_iocp_handle_service.ipp | 527 ++ .../asio/detail/impl/win_iocp_io_service.hpp | 132 + .../asio/detail/impl/win_iocp_io_service.ipp | 540 ++ .../impl/win_iocp_serial_port_service.ipp | 182 + .../impl/win_iocp_socket_service_base.ipp | 730 +++ .../boost/asio/detail/impl/win_mutex.ipp | 80 + .../detail/impl/win_object_handle_service.ipp | 446 ++ .../asio/detail/impl/win_static_mutex.ipp | 120 + .../boost/asio/detail/impl/win_thread.ipp | 141 + .../boost/asio/detail/impl/win_tss_ptr.ipp | 59 + .../impl/winrt_ssocket_service_base.ipp | 614 ++ .../detail/impl/winrt_timer_scheduler.hpp | 81 + .../detail/impl/winrt_timer_scheduler.ipp | 124 + .../boost/asio/detail/impl/winsock_init.ipp | 84 + .../boost/asio/detail/io_control.hpp | 136 + .../boost/asio/detail/keyword_tss_ptr.hpp | 72 + .../boost/asio/detail/kqueue_reactor.hpp | 222 + .../autoboost/boost/asio/detail/limits.hpp | 26 + .../asio/detail/local_free_on_block_exit.hpp | 59 + .../boost/asio/detail/macos_fenced_block.hpp | 63 + contrib/autoboost/boost/asio/detail/mutex.hpp | 50 + .../boost/asio/detail/noncopyable.hpp | 45 + .../boost/asio/detail/null_event.hpp | 90 + .../boost/asio/detail/null_fenced_block.hpp | 47 + .../boost/asio/detail/null_mutex.hpp | 66 + .../boost/asio/detail/null_reactor.hpp | 69 + .../boost/asio/detail/null_signal_blocker.hpp | 71 + .../boost/asio/detail/null_socket_service.hpp | 499 ++ .../boost/asio/detail/null_static_mutex.hpp | 62 + .../boost/asio/detail/null_thread.hpp | 63 + .../boost/asio/detail/null_tss_ptr.hpp | 70 + .../boost/asio/detail/object_pool.hpp | 148 + .../boost/asio/detail/old_win_sdk_compat.hpp | 216 + .../autoboost/boost/asio/detail/op_queue.hpp | 158 + .../autoboost/boost/asio/detail/operation.hpp | 40 + .../asio/detail/pipe_select_interrupter.hpp | 91 + .../boost/asio/detail/pop_options.hpp | 105 + .../boost/asio/detail/posix_event.hpp | 128 + .../asio/detail/posix_fd_set_adapter.hpp | 120 + .../boost/asio/detail/posix_mutex.hpp | 78 + .../asio/detail/posix_signal_blocker.hpp | 87 + .../boost/asio/detail/posix_static_mutex.hpp | 66 + .../boost/asio/detail/posix_thread.hpp | 107 + .../boost/asio/detail/posix_tss_ptr.hpp | 81 + .../boost/asio/detail/push_options.hpp | 138 + .../detail/reactive_descriptor_service.hpp | 324 ++ .../asio/detail/reactive_null_buffers_op.hpp | 90 + .../detail/reactive_serial_port_service.hpp | 236 + .../asio/detail/reactive_socket_accept_op.hpp | 138 + .../detail/reactive_socket_connect_op.hpp | 108 + .../asio/detail/reactive_socket_recv_op.hpp | 125 + .../detail/reactive_socket_recvfrom_op.hpp | 135 + .../detail/reactive_socket_recvmsg_op.hpp | 127 + .../asio/detail/reactive_socket_send_op.hpp | 122 + .../asio/detail/reactive_socket_sendto_op.hpp | 125 + .../asio/detail/reactive_socket_service.hpp | 459 ++ .../detail/reactive_socket_service_base.hpp | 452 ++ .../autoboost/boost/asio/detail/reactor.hpp | 32 + .../boost/asio/detail/reactor_fwd.hpp | 42 + .../boost/asio/detail/reactor_op.hpp | 63 + .../boost/asio/detail/reactor_op_queue.hpp | 170 + .../autoboost/boost/asio/detail/regex_fwd.hpp | 35 + .../boost/asio/detail/resolve_endpoint_op.hpp | 123 + .../boost/asio/detail/resolve_op.hpp | 133 + .../boost/asio/detail/resolver_service.hpp | 131 + .../asio/detail/resolver_service_base.hpp | 131 + .../boost/asio/detail/scoped_lock.hpp | 103 + .../boost/asio/detail/scoped_ptr.hpp | 81 + .../boost/asio/detail/select_interrupter.hpp | 48 + .../boost/asio/detail/select_reactor.hpp | 221 + .../boost/asio/detail/service_registry.hpp | 158 + .../boost/asio/detail/shared_ptr.hpp | 40 + .../boost/asio/detail/signal_blocker.hpp | 46 + .../boost/asio/detail/signal_handler.hpp | 84 + .../boost/asio/detail/signal_init.hpp | 49 + .../autoboost/boost/asio/detail/signal_op.hpp | 51 + .../boost/asio/detail/signal_set_service.hpp | 218 + .../boost/asio/detail/socket_holder.hpp | 100 + .../boost/asio/detail/socket_ops.hpp | 336 ++ .../boost/asio/detail/socket_option.hpp | 318 + .../asio/detail/socket_select_interrupter.hpp | 93 + .../boost/asio/detail/socket_types.hpp | 406 ++ .../asio/detail/solaris_fenced_block.hpp | 63 + .../boost/asio/detail/static_mutex.hpp | 54 + .../autoboost/boost/asio/detail/std_event.hpp | 178 + .../autoboost/boost/asio/detail/std_mutex.hpp | 75 + .../boost/asio/detail/std_static_mutex.hpp | 83 + .../boost/asio/detail/std_thread.hpp | 67 + .../boost/asio/detail/strand_service.hpp | 144 + .../boost/asio/detail/task_io_service.hpp | 203 + .../asio/detail/task_io_service_operation.hpp | 78 + .../detail/task_io_service_thread_info.hpp | 42 + .../autoboost/boost/asio/detail/thread.hpp | 58 + .../boost/asio/detail/thread_info_base.hpp | 93 + .../boost/asio/detail/throw_error.hpp | 55 + .../boost/asio/detail/throw_exception.hpp | 53 + .../boost/asio/detail/timer_queue.hpp | 334 ++ .../boost/asio/detail/timer_queue_base.hpp | 70 + .../boost/asio/detail/timer_queue_ptime.hpp | 95 + .../boost/asio/detail/timer_queue_set.hpp | 68 + .../boost/asio/detail/timer_scheduler.hpp | 35 + .../boost/asio/detail/timer_scheduler_fwd.hpp | 42 + .../autoboost/boost/asio/detail/tss_ptr.hpp | 71 + .../boost/asio/detail/type_traits.hpp | 60 + .../boost/asio/detail/variadic_templates.hpp | 63 + .../boost/asio/detail/wait_handler.hpp | 85 + .../autoboost/boost/asio/detail/wait_op.hpp | 47 + .../autoboost/boost/asio/detail/weak_ptr.hpp | 40 + .../autoboost/boost/asio/detail/win_event.hpp | 128 + .../boost/asio/detail/win_fd_set_adapter.hpp | 151 + .../boost/asio/detail/win_fenced_block.hpp | 91 + .../asio/detail/win_iocp_handle_read_op.hpp | 111 + .../asio/detail/win_iocp_handle_service.hpp | 324 ++ .../asio/detail/win_iocp_handle_write_op.hpp | 103 + .../boost/asio/detail/win_iocp_io_service.hpp | 317 + .../asio/detail/win_iocp_null_buffers_op.hpp | 121 + .../boost/asio/detail/win_iocp_operation.hpp | 97 + .../asio/detail/win_iocp_overlapped_op.hpp | 90 + .../asio/detail/win_iocp_overlapped_ptr.hpp | 146 + .../detail/win_iocp_serial_port_service.hpp | 230 + .../asio/detail/win_iocp_socket_accept_op.hpp | 167 + .../detail/win_iocp_socket_connect_op.hpp | 126 + .../asio/detail/win_iocp_socket_recv_op.hpp | 117 + .../detail/win_iocp_socket_recvfrom_op.hpp | 125 + .../detail/win_iocp_socket_recvmsg_op.hpp | 118 + .../asio/detail/win_iocp_socket_send_op.hpp | 111 + .../asio/detail/win_iocp_socket_service.hpp | 527 ++ .../detail/win_iocp_socket_service_base.hpp | 526 ++ .../asio/detail/win_iocp_thread_info.hpp | 36 + .../autoboost/boost/asio/detail/win_mutex.hpp | 80 + .../asio/detail/win_object_handle_service.hpp | 185 + .../boost/asio/detail/win_static_mutex.hpp | 76 + .../boost/asio/detail/win_thread.hpp | 141 + .../boost/asio/detail/win_tss_ptr.hpp | 81 + .../boost/asio/detail/wince_thread.hpp | 118 + .../boost/asio/detail/winrt_async_manager.hpp | 296 + .../boost/asio/detail/winrt_async_op.hpp | 67 + .../boost/asio/detail/winrt_resolve_op.hpp | 119 + .../asio/detail/winrt_resolver_service.hpp | 185 + .../asio/detail/winrt_socket_connect_op.hpp | 92 + .../asio/detail/winrt_socket_recv_op.hpp | 112 + .../asio/detail/winrt_socket_send_op.hpp | 103 + .../asio/detail/winrt_ssocket_service.hpp | 234 + .../detail/winrt_ssocket_service_base.hpp | 357 ++ .../asio/detail/winrt_timer_scheduler.hpp | 133 + .../boost/asio/detail/winrt_utils.hpp | 108 + .../boost/asio/detail/winsock_init.hpp | 130 + .../boost/asio/detail/wrapped_handler.hpp | 293 + contrib/autoboost/boost/asio/error.hpp | 336 ++ .../boost/asio/generic/basic_endpoint.hpp | 195 + .../boost/asio/generic/datagram_protocol.hpp | 125 + .../boost/asio/generic/detail/endpoint.hpp | 135 + .../asio/generic/detail/impl/endpoint.ipp | 111 + .../boost/asio/generic/raw_protocol.hpp | 123 + .../asio/generic/seq_packet_protocol.hpp | 124 + .../boost/asio/generic/stream_protocol.hpp | 129 + .../boost/asio/handler_alloc_hook.hpp | 83 + .../boost/asio/handler_continuation_hook.hpp | 56 + .../boost/asio/handler_invoke_hook.hpp | 87 + contrib/autoboost/boost/asio/handler_type.hpp | 114 + .../boost/asio/high_resolution_timer.hpp | 65 + .../boost/asio/impl/buffered_read_stream.hpp | 360 ++ .../boost/asio/impl/buffered_write_stream.hpp | 340 ++ contrib/autoboost/boost/asio/impl/connect.hpp | 430 ++ contrib/autoboost/boost/asio/impl/error.ipp | 130 + .../boost/asio/impl/handler_alloc_hook.ipp | 79 + .../autoboost/boost/asio/impl/io_service.hpp | 156 + .../autoboost/boost/asio/impl/io_service.ipp | 157 + contrib/autoboost/boost/asio/impl/read.hpp | 755 +++ contrib/autoboost/boost/asio/impl/read_at.hpp | 812 +++ .../autoboost/boost/asio/impl/read_until.hpp | 1149 ++++ .../boost/asio/impl/serial_port_base.hpp | 61 + .../boost/asio/impl/serial_port_base.ipp | 556 ++ contrib/autoboost/boost/asio/impl/spawn.hpp | 338 ++ contrib/autoboost/boost/asio/impl/src.cpp | 25 + contrib/autoboost/boost/asio/impl/src.hpp | 73 + .../autoboost/boost/asio/impl/use_future.hpp | 174 + contrib/autoboost/boost/asio/impl/write.hpp | 767 +++ .../autoboost/boost/asio/impl/write_at.hpp | 827 +++ contrib/autoboost/boost/asio/io_service.hpp | 772 +++ contrib/autoboost/boost/asio/ip/address.hpp | 202 + .../autoboost/boost/asio/ip/address_v4.hpp | 243 + .../autoboost/boost/asio/ip/address_v6.hpp | 248 + .../boost/asio/ip/basic_endpoint.hpp | 265 + .../boost/asio/ip/basic_resolver.hpp | 270 + .../boost/asio/ip/basic_resolver_entry.hpp | 96 + .../boost/asio/ip/basic_resolver_iterator.hpp | 262 + .../boost/asio/ip/basic_resolver_query.hpp | 246 + .../boost/asio/ip/detail/endpoint.hpp | 141 + .../boost/asio/ip/detail/impl/endpoint.ipp | 206 + .../boost/asio/ip/detail/socket_option.hpp | 571 ++ contrib/autoboost/boost/asio/ip/host_name.hpp | 44 + contrib/autoboost/boost/asio/ip/icmp.hpp | 117 + .../autoboost/boost/asio/ip/impl/address.hpp | 55 + .../autoboost/boost/asio/ip/impl/address.ipp | 228 + .../boost/asio/ip/impl/address_v4.hpp | 55 + .../boost/asio/ip/impl/address_v4.ipp | 180 + .../boost/asio/ip/impl/address_v6.hpp | 55 + .../boost/asio/ip/impl/address_v6.ipp | 300 + .../boost/asio/ip/impl/basic_endpoint.hpp | 57 + .../boost/asio/ip/impl/host_name.ipp | 56 + contrib/autoboost/boost/asio/ip/multicast.hpp | 193 + .../boost/asio/ip/resolver_query_base.hpp | 132 + .../boost/asio/ip/resolver_service.hpp | 178 + contrib/autoboost/boost/asio/ip/tcp.hpp | 157 + contrib/autoboost/boost/asio/ip/udp.hpp | 113 + contrib/autoboost/boost/asio/ip/unicast.hpp | 72 + contrib/autoboost/boost/asio/ip/v6_only.hpp | 71 + .../autoboost/boost/asio/is_read_buffered.hpp | 61 + .../boost/asio/is_write_buffered.hpp | 61 + .../boost/asio/local/basic_endpoint.hpp | 241 + .../boost/asio/local/connect_pair.hpp | 106 + .../boost/asio/local/datagram_protocol.hpp | 82 + .../boost/asio/local/detail/endpoint.hpp | 135 + .../boost/asio/local/detail/impl/endpoint.ipp | 130 + .../boost/asio/local/stream_protocol.hpp | 92 + contrib/autoboost/boost/asio/placeholders.hpp | 125 + .../boost/asio/posix/basic_descriptor.hpp | 492 ++ .../asio/posix/basic_stream_descriptor.hpp | 364 ++ .../boost/asio/posix/descriptor_base.hpp | 99 + .../boost/asio/posix/stream_descriptor.hpp | 39 + .../asio/posix/stream_descriptor_service.hpp | 262 + .../boost/asio/raw_socket_service.hpp | 434 ++ contrib/autoboost/boost/asio/read.hpp | 633 ++ contrib/autoboost/boost/asio/read_at.hpp | 666 +++ contrib/autoboost/boost/asio/read_until.hpp | 925 +++ .../boost/asio/seq_packet_socket_service.hpp | 382 ++ contrib/autoboost/boost/asio/serial_port.hpp | 38 + .../autoboost/boost/asio/serial_port_base.hpp | 169 + .../boost/asio/serial_port_service.hpp | 255 + contrib/autoboost/boost/asio/signal_set.hpp | 30 + .../boost/asio/signal_set_service.hpp | 136 + .../boost/asio/socket_acceptor_service.hpp | 304 + contrib/autoboost/boost/asio/socket_base.hpp | 522 ++ contrib/autoboost/boost/asio/spawn.hpp | 267 + contrib/autoboost/boost/asio/ssl.hpp | 30 + .../boost/asio/ssl/basic_context.hpp | 42 + contrib/autoboost/boost/asio/ssl/context.hpp | 789 +++ .../autoboost/boost/asio/ssl/context_base.hpp | 169 + .../boost/asio/ssl/context_service.hpp | 42 + .../asio/ssl/detail/buffered_handshake_op.hpp | 112 + .../boost/asio/ssl/detail/engine.hpp | 166 + .../boost/asio/ssl/detail/handshake_op.hpp | 70 + .../boost/asio/ssl/detail/impl/engine.ipp | 328 ++ .../asio/ssl/detail/impl/openssl_init.ipp | 147 + .../autoboost/boost/asio/ssl/detail/io.hpp | 349 ++ .../boost/asio/ssl/detail/openssl_init.hpp | 103 + .../boost/asio/ssl/detail/openssl_types.hpp | 28 + .../asio/ssl/detail/password_callback.hpp | 74 + .../boost/asio/ssl/detail/read_op.hpp | 75 + .../boost/asio/ssl/detail/shutdown_op.hpp | 62 + .../boost/asio/ssl/detail/stream_core.hpp | 128 + .../boost/asio/ssl/detail/verify_callback.hpp | 70 + .../boost/asio/ssl/detail/write_op.hpp | 75 + contrib/autoboost/boost/asio/ssl/error.hpp | 72 + .../autoboost/boost/asio/ssl/impl/context.hpp | 73 + .../autoboost/boost/asio/ssl/impl/context.ipp | 952 +++ .../autoboost/boost/asio/ssl/impl/error.ipp | 59 + .../asio/ssl/impl/rfc2818_verification.ipp | 168 + contrib/autoboost/boost/asio/ssl/impl/src.hpp | 28 + .../boost/asio/ssl/old/basic_context.hpp | 436 ++ .../boost/asio/ssl/old/context_service.hpp | 176 + .../old/detail/openssl_context_service.hpp | 388 ++ .../asio/ssl/old/detail/openssl_operation.hpp | 526 ++ .../ssl/old/detail/openssl_stream_service.hpp | 573 ++ .../autoboost/boost/asio/ssl/old/stream.hpp | 503 ++ .../boost/asio/ssl/old/stream_service.hpp | 186 + .../boost/asio/ssl/rfc2818_verification.hpp | 102 + contrib/autoboost/boost/asio/ssl/stream.hpp | 758 +++ .../autoboost/boost/asio/ssl/stream_base.hpp | 54 + .../boost/asio/ssl/stream_service.hpp | 42 + .../boost/asio/ssl/verify_context.hpp | 75 + .../autoboost/boost/asio/ssl/verify_mode.hpp | 65 + contrib/autoboost/boost/asio/steady_timer.hpp | 63 + contrib/autoboost/boost/asio/strand.hpp | 254 + .../boost/asio/stream_socket_service.hpp | 378 ++ contrib/autoboost/boost/asio/streambuf.hpp | 35 + contrib/autoboost/boost/asio/system_timer.hpp | 59 + contrib/autoboost/boost/asio/time_traits.hpp | 90 + contrib/autoboost/boost/asio/unyield.hpp | 21 + contrib/autoboost/boost/asio/use_future.hpp | 94 + contrib/autoboost/boost/asio/version.hpp | 23 + contrib/autoboost/boost/asio/wait_traits.hpp | 43 + .../boost/asio/waitable_timer_service.hpp | 170 + .../boost/asio/windows/basic_handle.hpp | 283 + .../asio/windows/basic_object_handle.hpp | 180 + .../windows/basic_random_access_handle.hpp | 378 ++ .../asio/windows/basic_stream_handle.hpp | 361 ++ .../boost/asio/windows/object_handle.hpp | 40 + .../asio/windows/object_handle_service.hpp | 179 + .../boost/asio/windows/overlapped_ptr.hpp | 118 + .../asio/windows/random_access_handle.hpp | 39 + .../windows/random_access_handle_service.hpp | 222 + .../boost/asio/windows/stream_handle.hpp | 39 + .../asio/windows/stream_handle_service.hpp | 220 + contrib/autoboost/boost/asio/write.hpp | 620 ++ contrib/autoboost/boost/asio/write_at.hpp | 672 +++ contrib/autoboost/boost/asio/yield.hpp | 23 + contrib/autoboost/boost/assert.hpp | 78 + contrib/autoboost/boost/atomic.hpp | 18 + contrib/autoboost/boost/atomic/atomic.hpp | 93 + .../autoboost/boost/atomic/atomic_flag.hpp | 33 + .../autoboost/boost/atomic/capabilities.hpp | 161 + .../boost/atomic/detail/atomic_flag.hpp | 70 + .../boost/atomic/detail/atomic_template.hpp | 774 +++ .../autoboost/boost/atomic/detail/casts.hpp | 64 + .../autoboost/boost/atomic/detail/config.hpp | 24 + .../boost/atomic/detail/int_sizes.hpp | 140 + .../autoboost/boost/atomic/detail/link.hpp | 58 + .../boost/atomic/detail/lockpool.hpp | 51 + .../boost/atomic/detail/operations.hpp | 24 + .../boost/atomic/detail/operations_fwd.hpp | 34 + .../atomic/detail/operations_lockfree.hpp | 30 + .../boost/atomic/detail/ops_emulated.hpp | 149 + .../autoboost/boost/atomic/detail/pause.hpp | 43 + .../boost/atomic/detail/platform.hpp | 115 + .../boost/atomic/detail/storage_type.hpp | 168 + contrib/autoboost/boost/atomic/fences.hpp | 67 + contrib/autoboost/boost/bind.hpp | 24 + contrib/autoboost/boost/bind/arg.hpp | 62 + contrib/autoboost/boost/bind/bind.hpp | 1751 ++++++ contrib/autoboost/boost/bind/bind_cc.hpp | 117 + contrib/autoboost/boost/bind/bind_mf2_cc.hpp | 228 + contrib/autoboost/boost/bind/bind_mf_cc.hpp | 227 + .../autoboost/boost/bind/bind_template.hpp | 345 ++ contrib/autoboost/boost/bind/mem_fn.hpp | 389 ++ contrib/autoboost/boost/bind/mem_fn_cc.hpp | 103 + .../autoboost/boost/bind/mem_fn_template.hpp | 1047 ++++ contrib/autoboost/boost/bind/mem_fn_vw.hpp | 130 + contrib/autoboost/boost/bind/placeholders.hpp | 69 + contrib/autoboost/boost/bind/storage.hpp | 475 ++ contrib/autoboost/boost/call_traits.hpp | 20 + contrib/autoboost/boost/cerrno.hpp | 331 ++ contrib/autoboost/boost/checked_delete.hpp | 17 + contrib/autoboost/boost/chrono/ceil.hpp | 36 + contrib/autoboost/boost/chrono/chrono.hpp | 15 + .../autoboost/boost/chrono/clock_string.hpp | 25 + contrib/autoboost/boost/chrono/config.hpp | 216 + .../boost/chrono/detail/inlined/chrono.hpp | 44 + .../chrono/detail/inlined/mac/chrono.hpp | 241 + .../chrono/detail/inlined/posix/chrono.hpp | 120 + .../chrono/detail/inlined/win/chrono.hpp | 149 + .../chrono/detail/is_evenly_divisible_by.hpp | 31 + .../boost/chrono/detail/static_assert.hpp | 30 + .../autoboost/boost/chrono/detail/system.hpp | 29 + contrib/autoboost/boost/chrono/duration.hpp | 794 +++ .../autoboost/boost/chrono/system_clocks.hpp | 233 + contrib/autoboost/boost/chrono/time_point.hpp | 380 ++ contrib/autoboost/boost/compressed_pair.hpp | 20 + contrib/autoboost/boost/concept/assert.hpp | 45 + .../concept/detail/backward_compatibility.hpp | 16 + .../boost/concept/detail/borland.hpp | 30 + .../boost/concept/detail/concept_def.hpp | 34 + .../boost/concept/detail/concept_undef.hpp | 5 + .../boost/concept/detail/general.hpp | 84 + .../boost/concept/detail/has_constraints.hpp | 50 + .../autoboost/boost/concept/detail/msvc.hpp | 123 + contrib/autoboost/boost/concept/usage.hpp | 36 + contrib/autoboost/boost/concept_check.hpp | 1085 ++++ contrib/autoboost/boost/config.hpp | 67 + .../boost/config/abi/borland_prefix.hpp | 27 + .../boost/config/abi/borland_suffix.hpp | 12 + .../boost/config/abi/msvc_prefix.hpp | 22 + .../boost/config/abi/msvc_suffix.hpp | 8 + contrib/autoboost/boost/config/abi_prefix.hpp | 25 + contrib/autoboost/boost/config/abi_suffix.hpp | 27 + contrib/autoboost/boost/config/auto_link.hpp | 439 ++ .../boost/config/compiler/borland.hpp | 318 + .../autoboost/boost/config/compiler/clang.hpp | 272 + .../boost/config/compiler/codegear.hpp | 220 + .../boost/config/compiler/comeau.hpp | 59 + .../boost/config/compiler/common_edg.hpp | 143 + .../boost/config/compiler/compaq_cxx.hpp | 19 + .../autoboost/boost/config/compiler/cray.hpp | 92 + .../boost/config/compiler/digitalmars.hpp | 124 + .../autoboost/boost/config/compiler/gcc.hpp | 296 + .../boost/config/compiler/gcc_xml.hpp | 95 + .../boost/config/compiler/greenhills.hpp | 28 + .../boost/config/compiler/hp_acc.hpp | 145 + .../autoboost/boost/config/compiler/intel.hpp | 458 ++ .../autoboost/boost/config/compiler/kai.hpp | 33 + .../boost/config/compiler/metrowerks.hpp | 179 + .../autoboost/boost/config/compiler/mpw.hpp | 121 + .../autoboost/boost/config/compiler/nvcc.hpp | 16 + .../boost/config/compiler/pathscale.hpp | 114 + .../autoboost/boost/config/compiler/pgi.hpp | 155 + .../boost/config/compiler/sgi_mipspro.hpp | 29 + .../boost/config/compiler/sunpro_cc.hpp | 183 + .../autoboost/boost/config/compiler/vacpp.hpp | 162 + .../boost/config/compiler/visualc.hpp | 300 + .../autoboost/boost/config/no_tr1/cmath.hpp | 28 + .../autoboost/boost/config/no_tr1/complex.hpp | 28 + .../boost/config/no_tr1/functional.hpp | 28 + .../autoboost/boost/config/no_tr1/memory.hpp | 28 + .../autoboost/boost/config/no_tr1/utility.hpp | 28 + .../autoboost/boost/config/platform/aix.hpp | 33 + .../boost/config/platform/amigaos.hpp | 15 + .../autoboost/boost/config/platform/beos.hpp | 26 + .../autoboost/boost/config/platform/bsd.hpp | 86 + .../autoboost/boost/config/platform/cray.hpp | 18 + .../boost/config/platform/cygwin.hpp | 58 + .../autoboost/boost/config/platform/hpux.hpp | 87 + .../autoboost/boost/config/platform/irix.hpp | 31 + .../autoboost/boost/config/platform/linux.hpp | 105 + .../autoboost/boost/config/platform/macos.hpp | 87 + .../boost/config/platform/qnxnto.hpp | 31 + .../boost/config/platform/solaris.hpp | 28 + .../boost/config/platform/symbian.hpp | 97 + .../autoboost/boost/config/platform/vms.hpp | 25 + .../boost/config/platform/vxworks.hpp | 369 ++ .../autoboost/boost/config/platform/win32.hpp | 82 + .../autoboost/boost/config/posix_features.hpp | 95 + .../boost/config/requires_threads.hpp | 92 + .../boost/config/select_compiler_config.hpp | 144 + .../boost/config/select_platform_config.hpp | 129 + .../boost/config/select_stdlib_config.hpp | 105 + .../boost/config/stdlib/dinkumware.hpp | 170 + .../autoboost/boost/config/stdlib/libcomo.hpp | 75 + .../autoboost/boost/config/stdlib/libcpp.hpp | 70 + .../boost/config/stdlib/libstdcpp3.hpp | 243 + .../autoboost/boost/config/stdlib/modena.hpp | 59 + contrib/autoboost/boost/config/stdlib/msl.hpp | 87 + .../boost/config/stdlib/roguewave.hpp | 189 + contrib/autoboost/boost/config/stdlib/sgi.hpp | 151 + .../autoboost/boost/config/stdlib/stlport.hpp | 246 + .../autoboost/boost/config/stdlib/vacpp.hpp | 57 + contrib/autoboost/boost/config/suffix.hpp | 995 ++++ contrib/autoboost/boost/config/user.hpp | 133 + .../boost/config/warning_disable.hpp | 47 + .../boost/container/allocator_traits.hpp | 409 ++ .../boost/container/container_fwd.hpp | 270 + .../container/detail/advanced_insert_int.hpp | 477 ++ .../boost/container/detail/algorithms.hpp | 62 + .../container/detail/allocation_type.hpp | 54 + .../detail/allocator_version_traits.hpp | 168 + .../boost/container/detail/config_begin.hpp | 48 + .../boost/container/detail/config_end.hpp | 13 + .../boost/container/detail/destroyers.hpp | 380 ++ .../boost/container/detail/iterators.hpp | 821 +++ .../boost/container/detail/memory_util.hpp | 90 + .../autoboost/boost/container/detail/mpl.hpp | 183 + .../detail/multiallocation_chain.hpp | 292 + .../autoboost/boost/container/detail/pair.hpp | 374 ++ .../boost/container/detail/placement_new.hpp | 27 + .../boost/container/detail/preprocessor.hpp | 228 + .../boost/container/detail/std_fwd.hpp | 59 + .../container/detail/transform_iterator.hpp | 177 + .../boost/container/detail/type_traits.hpp | 237 + .../boost/container/detail/utilities.hpp | 1267 ++++ .../boost/container/detail/value_init.hpp | 45 + .../detail/variadic_templates_tools.hpp | 154 + .../boost/container/detail/version_type.hpp | 103 + .../boost/container/detail/workaround.hpp | 72 + .../boost/container/scoped_allocator.hpp | 1534 +++++ .../boost/container/scoped_allocator_fwd.hpp | 87 + .../boost/container/throw_exception.hpp | 166 + contrib/autoboost/boost/container/vector.hpp | 2984 ++++++++++ .../autoboost/boost/context/detail/config.hpp | 49 + contrib/autoboost/boost/context/fcontext.hpp | 45 + contrib/autoboost/boost/core/addressof.hpp | 162 + .../autoboost/boost/core/checked_delete.hpp | 69 + contrib/autoboost/boost/core/demangle.hpp | 121 + contrib/autoboost/boost/core/enable_if.hpp | 119 + .../boost/core/explicit_operator_bool.hpp | 154 + .../autoboost/boost/core/ignore_unused.hpp | 70 + .../autoboost/boost/core/lightweight_test.hpp | 171 + .../boost/core/no_exceptions_support.hpp | 44 + contrib/autoboost/boost/core/noncopyable.hpp | 48 + contrib/autoboost/boost/core/ref.hpp | 301 + contrib/autoboost/boost/core/scoped_enum.hpp | 192 + contrib/autoboost/boost/core/swap.hpp | 60 + contrib/autoboost/boost/core/typeinfo.hpp | 151 + contrib/autoboost/boost/coroutine/all.hpp | 21 + .../boost/coroutine/asymmetric_coroutine.hpp | 2243 +++++++ .../autoboost/boost/coroutine/attributes.hpp | 94 + .../autoboost/boost/coroutine/coroutine.hpp | 13 + .../boost/coroutine/detail/config.hpp | 49 + .../coroutine/detail/coroutine_context.hpp | 62 + .../boost/coroutine/detail/flags.hpp | 48 + .../boost/coroutine/detail/parameters.hpp | 102 + .../coroutine/detail/pull_coroutine_impl.hpp | 355 ++ .../detail/pull_coroutine_object.hpp | 324 ++ .../detail/pull_coroutine_synthesized.hpp | 80 + .../coroutine/detail/push_coroutine_impl.hpp | 295 + .../detail/push_coroutine_object.hpp | 336 ++ .../detail/push_coroutine_synthesized.hpp | 78 + .../boost/coroutine/detail/setup.hpp | 75 + .../detail/symmetric_coroutine_call.hpp | 822 +++ .../detail/symmetric_coroutine_impl.hpp | 472 ++ .../detail/symmetric_coroutine_object.hpp | 281 + .../detail/symmetric_coroutine_yield.hpp | 307 + .../boost/coroutine/detail/trampoline.hpp | 67 + .../coroutine/detail/trampoline_pull.hpp | 48 + .../coroutine/detail/trampoline_push.hpp | 77 + .../autoboost/boost/coroutine/exceptions.hpp | 105 + contrib/autoboost/boost/coroutine/flags.hpp | 27 + .../posix/protected_stack_allocator.hpp | 105 + .../posix/segmented_stack_allocator.hpp | 69 + .../coroutine/protected_stack_allocator.hpp | 13 + .../coroutine/segmented_stack_allocator.hpp | 15 + .../boost/coroutine/stack_allocator.hpp | 37 + .../boost/coroutine/stack_context.hpp | 66 + .../boost/coroutine/stack_traits.hpp | 42 + .../coroutine/standard_stack_allocator.hpp | 75 + .../boost/coroutine/symmetric_coroutine.hpp | 35 + .../windows/protected_stack_allocator.hpp | 87 + contrib/autoboost/boost/cregex.hpp | 39 + contrib/autoboost/boost/cstdint.hpp | 545 ++ contrib/autoboost/boost/cstdlib.hpp | 41 + contrib/autoboost/boost/current_function.hpp | 71 + .../boost/date_time/adjust_functors.hpp | 178 + contrib/autoboost/boost/date_time/c_time.hpp | 123 + .../boost/date_time/compiler_config.hpp | 169 + .../boost/date_time/constrained_value.hpp | 121 + contrib/autoboost/boost/date_time/date.hpp | 208 + .../boost/date_time/date_clock_device.hpp | 77 + .../autoboost/boost/date_time/date_defs.hpp | 26 + .../boost/date_time/date_duration.hpp | 146 + .../boost/date_time/date_duration_types.hpp | 269 + .../autoboost/boost/date_time/date_facet.hpp | 767 +++ .../boost/date_time/date_format_simple.hpp | 159 + .../boost/date_time/date_formatting.hpp | 135 + .../date_time/date_formatting_limited.hpp | 121 + .../date_time/date_formatting_locales.hpp | 233 + .../date_time/date_generator_formatter.hpp | 265 + .../boost/date_time/date_generator_parser.hpp | 330 ++ .../boost/date_time/date_generators.hpp | 509 ++ .../boost/date_time/date_iterator.hpp | 101 + .../boost/date_time/date_names_put.hpp | 320 + .../boost/date_time/date_parsing.hpp | 316 + .../autoboost/boost/date_time/dst_rules.hpp | 391 ++ .../boost/date_time/filetime_functions.hpp | 170 + .../boost/date_time/format_date_parser.hpp | 731 +++ .../boost/date_time/gregorian/conversion.hpp | 68 + .../boost/date_time/gregorian/formatters.hpp | 162 + .../gregorian/formatters_limited.hpp | 81 + .../date_time/gregorian/greg_calendar.hpp | 48 + .../boost/date_time/gregorian/greg_date.hpp | 136 + .../boost/date_time/gregorian/greg_day.hpp | 57 + .../date_time/gregorian/greg_day_of_year.hpp | 38 + .../date_time/gregorian/greg_duration.hpp | 134 + .../gregorian/greg_duration_types.hpp | 43 + .../boost/date_time/gregorian/greg_facet.hpp | 352 ++ .../boost/date_time/gregorian/greg_month.hpp | 105 + .../date_time/gregorian/greg_weekday.hpp | 66 + .../boost/date_time/gregorian/greg_year.hpp | 53 + .../boost/date_time/gregorian/greg_ymd.hpp | 33 + .../boost/date_time/gregorian/gregorian.hpp | 38 + .../date_time/gregorian/gregorian_io.hpp | 784 +++ .../date_time/gregorian/gregorian_types.hpp | 109 + .../boost/date_time/gregorian/parsers.hpp | 91 + .../boost/date_time/gregorian_calendar.hpp | 70 + .../boost/date_time/gregorian_calendar.ipp | 219 + .../autoboost/boost/date_time/int_adapter.hpp | 509 ++ .../autoboost/boost/date_time/iso_format.hpp | 303 + .../boost/date_time/locale_config.hpp | 31 + .../boost/date_time/microsec_time_clock.hpp | 127 + .../boost/date_time/parse_format_base.hpp | 29 + contrib/autoboost/boost/date_time/period.hpp | 377 ++ .../boost/date_time/period_formatter.hpp | 196 + .../boost/date_time/period_parser.hpp | 198 + .../boost/date_time/posix_time/conversion.hpp | 94 + .../posix_time/date_duration_operators.hpp | 114 + .../boost/date_time/posix_time/posix_time.hpp | 39 + .../posix_time/posix_time_config.hpp | 178 + .../posix_time/posix_time_duration.hpp | 82 + .../date_time/posix_time/posix_time_io.hpp | 236 + .../posix_time/posix_time_legacy_io.hpp | 153 + .../posix_time/posix_time_system.hpp | 68 + .../date_time/posix_time/posix_time_types.hpp | 55 + .../boost/date_time/posix_time/ptime.hpp | 65 + .../date_time/posix_time/time_formatters.hpp | 289 + .../posix_time/time_formatters_limited.hpp | 212 + .../date_time/posix_time/time_parsers.hpp | 44 + .../date_time/posix_time/time_period.hpp | 29 + .../boost/date_time/special_defs.hpp | 25 + .../date_time/special_values_formatter.hpp | 96 + .../boost/date_time/special_values_parser.hpp | 159 + .../boost/date_time/string_convert.hpp | 32 + .../boost/date_time/string_parse_tree.hpp | 278 + .../boost/date_time/strings_from_facet.hpp | 125 + contrib/autoboost/boost/date_time/time.hpp | 191 + .../autoboost/boost/date_time/time_clock.hpp | 83 + .../autoboost/boost/date_time/time_defs.hpp | 43 + .../boost/date_time/time_duration.hpp | 293 + .../autoboost/boost/date_time/time_facet.hpp | 1367 +++++ .../date_time/time_formatting_streams.hpp | 122 + .../boost/date_time/time_iterator.hpp | 52 + .../boost/date_time/time_parsing.hpp | 324 ++ .../date_time/time_resolution_traits.hpp | 144 + .../boost/date_time/time_system_counted.hpp | 254 + .../boost/date_time/time_system_split.hpp | 207 + .../boost/date_time/wrapping_int.hpp | 169 + .../boost/date_time/year_month_day.hpp | 45 + .../autoboost/boost/detail/atomic_count.hpp | 21 + .../boost/detail/atomic_redef_macros.hpp | 19 + .../boost/detail/atomic_undef_macros.hpp | 39 + .../boost/detail/basic_pointerbuf.hpp | 139 + .../autoboost/boost/detail/binary_search.hpp | 216 + .../autoboost/boost/detail/call_traits.hpp | 172 + .../boost/detail/compressed_pair.hpp | 443 ++ .../autoboost/boost/detail/container_fwd.hpp | 157 + contrib/autoboost/boost/detail/endian.hpp | 11 + contrib/autoboost/boost/detail/fenv.hpp | 101 + .../boost/detail/indirect_traits.hpp | 205 + .../autoboost/boost/detail/interlocked.hpp | 218 + .../boost/detail/is_incrementable.hpp | 133 + contrib/autoboost/boost/detail/iterator.hpp | 26 + .../boost/detail/lcast_precision.hpp | 184 + .../boost/detail/lightweight_mutex.hpp | 22 + .../boost/detail/lightweight_test.hpp | 17 + .../boost/detail/no_exceptions_support.hpp | 17 + .../boost/detail/reference_content.hpp | 120 + .../boost/detail/scoped_enum_emulation.hpp | 17 + .../autoboost/boost/detail/sp_typeinfo.hpp | 36 + .../boost/detail/utf8_codecvt_facet.hpp | 191 + .../boost/detail/utf8_codecvt_facet.ipp | 284 + .../boost/detail/winapi/GetLastError.hpp | 31 + .../boost/detail/winapi/basic_types.hpp | 134 + .../autoboost/boost/detail/winapi/config.hpp | 53 + .../autoboost/boost/detail/winapi/time.hpp | 105 + .../autoboost/boost/detail/winapi/timers.hpp | 44 + contrib/autoboost/boost/detail/workaround.hpp | 267 + .../boost/enable_shared_from_this.hpp | 18 + .../exception/current_exception_cast.hpp | 43 + .../detail/clone_current_exception.hpp | 56 + .../exception/detail/error_info_impl.hpp | 74 + .../boost/exception/detail/exception_ptr.hpp | 513 ++ .../exception/detail/is_output_streamable.hpp | 60 + .../exception/detail/object_hex_dump.hpp | 50 + .../boost/exception/detail/type_info.hpp | 81 + .../exception/diagnostic_information.hpp | 201 + .../autoboost/boost/exception/exception.hpp | 489 ++ .../boost/exception/get_error_info.hpp | 130 + contrib/autoboost/boost/exception/info.hpp | 198 + .../autoboost/boost/exception/to_string.hpp | 88 + .../boost/exception/to_string_stub.hpp | 117 + contrib/autoboost/boost/exception_ptr.hpp | 11 + contrib/autoboost/boost/function.hpp | 66 + .../function/detail/function_iterate.hpp | 16 + .../function/detail/gen_maybe_include.pl | 37 + .../boost/function/detail/maybe_include.hpp | 267 + .../boost/function/detail/prologue.hpp | 26 + .../autoboost/boost/function/function0.hpp | 12 + .../autoboost/boost/function/function1.hpp | 12 + .../autoboost/boost/function/function10.hpp | 12 + .../autoboost/boost/function/function2.hpp | 12 + .../autoboost/boost/function/function3.hpp | 12 + .../autoboost/boost/function/function4.hpp | 12 + .../autoboost/boost/function/function5.hpp | 12 + .../autoboost/boost/function/function6.hpp | 12 + .../autoboost/boost/function/function7.hpp | 12 + .../autoboost/boost/function/function8.hpp | 12 + .../autoboost/boost/function/function9.hpp | 12 + .../boost/function/function_base.hpp | 902 +++ .../autoboost/boost/function/function_fwd.hpp | 69 + .../boost/function/function_template.hpp | 1187 ++++ contrib/autoboost/boost/function_equal.hpp | 28 + contrib/autoboost/boost/functional/hash.hpp | 7 + .../hash/detail/float_functions.hpp | 336 ++ .../functional/hash/detail/hash_float.hpp | 271 + .../boost/functional/hash/detail/limits.hpp | 62 + .../boost/functional/hash/extensions.hpp | 318 + .../autoboost/boost/functional/hash/hash.hpp | 559 ++ .../boost/functional/hash/hash_fwd.hpp | 36 + .../autoboost/boost/functional/hash_fwd.hpp | 11 + contrib/autoboost/boost/get_pointer.hpp | 48 + .../autoboost/boost/indirect_reference.hpp | 43 + contrib/autoboost/boost/integer.hpp | 261 + .../autoboost/boost/integer/static_log2.hpp | 127 + contrib/autoboost/boost/integer_fwd.hpp | 164 + contrib/autoboost/boost/integer_traits.hpp | 256 + .../intrusive/circular_slist_algorithms.hpp | 407 ++ .../boost/intrusive/detail/algo_type.hpp | 46 + .../intrusive/detail/array_initializer.hpp | 90 + .../boost/intrusive/detail/assert.hpp | 41 + .../detail/common_slist_algorithms.hpp | 194 + .../boost/intrusive/detail/config_begin.hpp | 51 + .../boost/intrusive/detail/config_end.hpp | 15 + .../detail/default_header_holder.hpp | 65 + .../intrusive/detail/ebo_functor_holder.hpp | 226 + .../boost/intrusive/detail/equal_to_value.hpp | 44 + .../intrusive/detail/exception_disposer.hpp | 84 + .../intrusive/detail/function_detector.hpp | 88 + .../boost/intrusive/detail/generic_hook.hpp | 217 + .../intrusive/detail/get_value_traits.hpp | 218 + .../has_member_function_callable_with.hpp | 372 ++ .../boost/intrusive/detail/hook_traits.hpp | 182 + .../boost/intrusive/detail/iiterator.hpp | 227 + .../detail/is_stateful_value_traits.hpp | 77 + .../intrusive/detail/key_nodeptr_comp.hpp | 72 + .../boost/intrusive/detail/memory_util.hpp | 92 + .../autoboost/boost/intrusive/detail/mpl.hpp | 376 ++ .../boost/intrusive/detail/node_holder.hpp | 31 + .../intrusive/detail/parent_from_member.hpp | 120 + .../intrusive/detail/pointer_element.hpp | 170 + .../boost/intrusive/detail/preprocessor.hpp | 42 + .../intrusive/detail/reverse_iterator.hpp | 139 + .../intrusive/detail/simple_disposers.hpp | 46 + .../boost/intrusive/detail/size_holder.hpp | 80 + .../boost/intrusive/detail/slist_iterator.hpp | 120 + .../boost/intrusive/detail/slist_node.hpp | 59 + .../boost/intrusive/detail/std_fwd.hpp | 54 + .../boost/intrusive/detail/to_raw_pointer.hpp | 42 + .../boost/intrusive/detail/uncast.hpp | 51 + .../boost/intrusive/detail/workaround.hpp | 30 + .../boost/intrusive/intrusive_fwd.hpp | 729 +++ .../intrusive/linear_slist_algorithms.hpp | 342 ++ .../autoboost/boost/intrusive/link_mode.hpp | 63 + contrib/autoboost/boost/intrusive/options.hpp | 248 + .../boost/intrusive/pack_options.hpp | 374 ++ .../boost/intrusive/pointer_rebind.hpp | 188 + .../boost/intrusive/pointer_traits.hpp | 275 + contrib/autoboost/boost/intrusive/slist.hpp | 2276 ++++++++ .../autoboost/boost/intrusive/slist_hook.hpp | 289 + contrib/autoboost/boost/intrusive_ptr.hpp | 18 + contrib/autoboost/boost/io/ios_state.hpp | 439 ++ contrib/autoboost/boost/io_fwd.hpp | 67 + contrib/autoboost/boost/is_placeholder.hpp | 31 + contrib/autoboost/boost/iterator.hpp | 20 + .../boost/iterator/detail/config_def.hpp | 128 + .../boost/iterator/detail/config_undef.hpp | 24 + .../boost/iterator/detail/enable_if.hpp | 83 + .../detail/facade_iterator_category.hpp | 193 + .../iterator/detail/minimum_category.hpp | 19 + .../boost/iterator/filter_iterator.hpp | 137 + .../boost/iterator/interoperable.hpp | 54 + .../boost/iterator/iterator_adaptor.hpp | 360 ++ .../boost/iterator/iterator_categories.hpp | 222 + .../boost/iterator/iterator_concepts.hpp | 275 + .../boost/iterator/iterator_facade.hpp | 971 +++ .../boost/iterator/iterator_traits.hpp | 60 + .../boost/iterator/minimum_category.hpp | 95 + .../boost/iterator/reverse_iterator.hpp | 74 + .../boost/iterator/transform_iterator.hpp | 171 + contrib/autoboost/boost/lambda/bind.hpp | 19 + contrib/autoboost/boost/lambda/core.hpp | 79 + .../autoboost/boost/lambda/detail/actions.hpp | 174 + .../boost/lambda/detail/arity_code.hpp | 110 + .../boost/lambda/detail/bind_functions.hpp | 1879 ++++++ .../boost/lambda/detail/function_adaptors.hpp | 789 +++ .../boost/lambda/detail/is_instance_of.hpp | 104 + .../boost/lambda/detail/lambda_config.hpp | 48 + .../lambda/detail/lambda_functor_base.hpp | 615 ++ .../boost/lambda/detail/lambda_functors.hpp | 357 ++ .../boost/lambda/detail/lambda_fwd.hpp | 74 + .../boost/lambda/detail/lambda_traits.hpp | 578 ++ .../boost/lambda/detail/member_ptr.hpp | 737 +++ .../boost/lambda/detail/operator_actions.hpp | 139 + .../detail/operator_lambda_func_base.hpp | 271 + .../detail/operator_return_type_traits.hpp | 917 +++ .../boost/lambda/detail/operators.hpp | 370 ++ contrib/autoboost/boost/lambda/detail/ret.hpp | 325 ++ .../lambda/detail/return_type_traits.hpp | 282 + .../boost/lambda/detail/select_functions.hpp | 74 + contrib/autoboost/boost/lambda/if.hpp | 462 ++ contrib/autoboost/boost/lambda/lambda.hpp | 34 + contrib/autoboost/boost/lexical_cast.hpp | 105 + .../boost/lexical_cast/bad_lexical_cast.hpp | 101 + .../lexical_cast/detail/converter_lexical.hpp | 520 ++ .../detail/converter_lexical_streams.hpp | 817 +++ .../lexical_cast/detail/converter_numeric.hpp | 179 + .../boost/lexical_cast/detail/inf_nan.hpp | 197 + .../lexical_cast/detail/is_character.hpp | 57 + .../detail/lcast_char_constants.hpp | 46 + .../detail/lcast_float_converters.hpp | 294 + .../detail/lcast_unsigned_converters.hpp | 295 + .../boost/lexical_cast/detail/widest_char.hpp | 40 + .../lexical_cast/try_lexical_convert.hpp | 198 + contrib/autoboost/boost/limits.hpp | 146 + contrib/autoboost/boost/logic/tribool.hpp | 460 ++ contrib/autoboost/boost/logic/tribool_fwd.hpp | 15 + contrib/autoboost/boost/make_shared.hpp | 17 + .../autoboost/boost/math/common_factor_rt.hpp | 460 ++ .../autoboost/boost/math/policies/policy.hpp | 991 ++++ .../special_functions/detail/fp_traits.hpp | 579 ++ .../special_functions/detail/round_fwd.hpp | 93 + .../math/special_functions/fpclassify.hpp | 606 ++ .../boost/math/special_functions/math_fwd.hpp | 1499 +++++ .../boost/math/special_functions/sign.hpp | 194 + contrib/autoboost/boost/math/tools/config.hpp | 397 ++ .../autoboost/boost/math/tools/promotion.hpp | 175 + .../autoboost/boost/math/tools/real_cast.hpp | 29 + contrib/autoboost/boost/math/tools/user.hpp | 105 + contrib/autoboost/boost/math_fwd.hpp | 108 + contrib/autoboost/boost/mem_fn.hpp | 24 + contrib/autoboost/boost/memory_order.hpp | 57 + contrib/autoboost/boost/move/algorithm.hpp | 274 + contrib/autoboost/boost/move/core.hpp | 446 ++ .../autoboost/boost/move/default_delete.hpp | 187 + .../boost/move/detail/config_begin.hpp | 18 + .../boost/move/detail/config_end.hpp | 12 + .../boost/move/detail/meta_utils.hpp | 476 ++ .../boost/move/detail/move_helpers.hpp | 163 + .../move/detail/unique_ptr_meta_utils.hpp | 583 ++ .../boost/move/detail/workaround.hpp | 26 + contrib/autoboost/boost/move/iterator.hpp | 304 + contrib/autoboost/boost/move/make_unique.hpp | 619 ++ contrib/autoboost/boost/move/move.hpp | 27 + contrib/autoboost/boost/move/traits.hpp | 72 + contrib/autoboost/boost/move/unique_ptr.hpp | 855 +++ contrib/autoboost/boost/move/utility.hpp | 141 + contrib/autoboost/boost/move/utility_core.hpp | 295 + contrib/autoboost/boost/mpl/O1_size.hpp | 40 + contrib/autoboost/boost/mpl/O1_size_fwd.hpp | 24 + contrib/autoboost/boost/mpl/advance.hpp | 76 + contrib/autoboost/boost/mpl/advance_fwd.hpp | 28 + contrib/autoboost/boost/mpl/always.hpp | 38 + contrib/autoboost/boost/mpl/and.hpp | 60 + contrib/autoboost/boost/mpl/apply.hpp | 229 + contrib/autoboost/boost/mpl/apply_fwd.hpp | 107 + contrib/autoboost/boost/mpl/apply_wrap.hpp | 234 + contrib/autoboost/boost/mpl/arg.hpp | 131 + contrib/autoboost/boost/mpl/arg_fwd.hpp | 28 + contrib/autoboost/boost/mpl/assert.hpp | 439 ++ contrib/autoboost/boost/mpl/at.hpp | 52 + contrib/autoboost/boost/mpl/at_fwd.hpp | 24 + .../autoboost/boost/mpl/aux_/O1_size_impl.hpp | 87 + .../autoboost/boost/mpl/aux_/adl_barrier.hpp | 48 + .../boost/mpl/aux_/advance_backward.hpp | 128 + .../boost/mpl/aux_/advance_forward.hpp | 127 + .../autoboost/boost/mpl/aux_/arg_typedef.hpp | 31 + .../boost/mpl/aux_/arithmetic_op.hpp | 92 + contrib/autoboost/boost/mpl/aux_/arity.hpp | 39 + .../autoboost/boost/mpl/aux_/arity_spec.hpp | 67 + contrib/autoboost/boost/mpl/aux_/at_impl.hpp | 45 + .../boost/mpl/aux_/begin_end_impl.hpp | 101 + .../autoboost/boost/mpl/aux_/clear_impl.hpp | 35 + .../boost/mpl/aux_/common_name_wknd.hpp | 34 + .../boost/mpl/aux_/comparison_op.hpp | 83 + .../autoboost/boost/mpl/aux_/config/adl.hpp | 40 + .../boost/mpl/aux_/config/arrays.hpp | 30 + .../autoboost/boost/mpl/aux_/config/bcc.hpp | 28 + .../autoboost/boost/mpl/aux_/config/bind.hpp | 33 + .../boost/mpl/aux_/config/compiler.hpp | 66 + .../autoboost/boost/mpl/aux_/config/ctps.hpp | 30 + .../boost/mpl/aux_/config/dependent_nttp.hpp | 35 + .../mpl/aux_/config/dmc_ambiguous_ctps.hpp | 27 + .../autoboost/boost/mpl/aux_/config/dtp.hpp | 46 + .../autoboost/boost/mpl/aux_/config/eti.hpp | 47 + .../boost/mpl/aux_/config/forwarding.hpp | 27 + .../autoboost/boost/mpl/aux_/config/gcc.hpp | 23 + .../autoboost/boost/mpl/aux_/config/gpu.hpp | 35 + .../boost/mpl/aux_/config/has_apply.hpp | 32 + .../boost/mpl/aux_/config/has_xxx.hpp | 34 + .../boost/mpl/aux_/config/integral.hpp | 38 + .../autoboost/boost/mpl/aux_/config/intel.hpp | 21 + .../boost/mpl/aux_/config/lambda.hpp | 32 + .../autoboost/boost/mpl/aux_/config/msvc.hpp | 21 + .../boost/mpl/aux_/config/msvc_typename.hpp | 26 + .../autoboost/boost/mpl/aux_/config/nttp.hpp | 41 + .../mpl/aux_/config/overload_resolution.hpp | 29 + .../boost/mpl/aux_/config/pp_counter.hpp | 26 + .../boost/mpl/aux_/config/preprocessor.hpp | 39 + .../boost/mpl/aux_/config/static_constant.hpp | 25 + .../autoboost/boost/mpl/aux_/config/ttp.hpp | 41 + .../boost/mpl/aux_/config/typeof.hpp | 38 + .../mpl/aux_/config/use_preprocessed.hpp | 19 + .../boost/mpl/aux_/config/workaround.hpp | 19 + .../boost/mpl/aux_/contains_impl.hpp | 61 + .../autoboost/boost/mpl/aux_/count_args.hpp | 105 + .../autoboost/boost/mpl/aux_/find_if_pred.hpp | 31 + .../autoboost/boost/mpl/aux_/fold_impl.hpp | 43 + .../boost/mpl/aux_/fold_impl_body.hpp | 365 ++ .../autoboost/boost/mpl/aux_/full_lambda.hpp | 354 ++ .../autoboost/boost/mpl/aux_/has_apply.hpp | 32 + .../autoboost/boost/mpl/aux_/has_begin.hpp | 23 + .../autoboost/boost/mpl/aux_/has_rebind.hpp | 99 + contrib/autoboost/boost/mpl/aux_/has_size.hpp | 23 + contrib/autoboost/boost/mpl/aux_/has_tag.hpp | 23 + contrib/autoboost/boost/mpl/aux_/has_type.hpp | 23 + .../boost/mpl/aux_/include_preprocessed.hpp | 42 + .../boost/mpl/aux_/inserter_algorithm.hpp | 159 + .../boost/mpl/aux_/integral_wrapper.hpp | 93 + .../boost/mpl/aux_/is_msvc_eti_arg.hpp | 64 + .../autoboost/boost/mpl/aux_/iter_apply.hpp | 47 + .../boost/mpl/aux_/iter_fold_if_impl.hpp | 210 + .../boost/mpl/aux_/iter_fold_impl.hpp | 42 + .../boost/mpl/aux_/lambda_arity_param.hpp | 25 + .../boost/mpl/aux_/lambda_no_ctps.hpp | 193 + .../autoboost/boost/mpl/aux_/lambda_spec.hpp | 49 + .../boost/mpl/aux_/lambda_support.hpp | 169 + .../autoboost/boost/mpl/aux_/largest_int.hpp | 63 + .../autoboost/boost/mpl/aux_/logical_op.hpp | 165 + contrib/autoboost/boost/mpl/aux_/msvc_dtw.hpp | 68 + .../boost/mpl/aux_/msvc_eti_base.hpp | 77 + .../boost/mpl/aux_/msvc_is_class.hpp | 58 + .../boost/mpl/aux_/msvc_never_true.hpp | 34 + .../autoboost/boost/mpl/aux_/msvc_type.hpp | 62 + contrib/autoboost/boost/mpl/aux_/na.hpp | 95 + .../autoboost/boost/mpl/aux_/na_assert.hpp | 34 + contrib/autoboost/boost/mpl/aux_/na_fwd.hpp | 31 + contrib/autoboost/boost/mpl/aux_/na_spec.hpp | 175 + .../boost/mpl/aux_/nested_type_wknd.hpp | 48 + .../autoboost/boost/mpl/aux_/nttp_decl.hpp | 35 + .../boost/mpl/aux_/numeric_cast_utils.hpp | 77 + .../autoboost/boost/mpl/aux_/numeric_op.hpp | 315 + .../preprocessed/bcc/advance_backward.hpp | 97 + .../aux_/preprocessed/bcc/advance_forward.hpp | 97 + .../boost/mpl/aux_/preprocessed/bcc/and.hpp | 69 + .../boost/mpl/aux_/preprocessed/bcc/apply.hpp | 169 + .../mpl/aux_/preprocessed/bcc/apply_fwd.hpp | 52 + .../mpl/aux_/preprocessed/bcc/apply_wrap.hpp | 461 ++ .../boost/mpl/aux_/preprocessed/bcc/arg.hpp | 117 + .../mpl/aux_/preprocessed/bcc/basic_bind.hpp | 300 + .../boost/mpl/aux_/preprocessed/bcc/bind.hpp | 397 ++ .../mpl/aux_/preprocessed/bcc/bind_fwd.hpp | 46 + .../mpl/aux_/preprocessed/bcc/bitand.hpp | 147 + .../boost/mpl/aux_/preprocessed/bcc/bitor.hpp | 147 + .../mpl/aux_/preprocessed/bcc/bitxor.hpp | 147 + .../boost/mpl/aux_/preprocessed/bcc/deque.hpp | 323 + .../mpl/aux_/preprocessed/bcc/divides.hpp | 146 + .../mpl/aux_/preprocessed/bcc/equal_to.hpp | 94 + .../mpl/aux_/preprocessed/bcc/fold_impl.hpp | 180 + .../mpl/aux_/preprocessed/bcc/full_lambda.hpp | 558 ++ .../mpl/aux_/preprocessed/bcc/greater.hpp | 94 + .../aux_/preprocessed/bcc/greater_equal.hpp | 94 + .../mpl/aux_/preprocessed/bcc/inherit.hpp | 139 + .../preprocessed/bcc/iter_fold_if_impl.hpp | 133 + .../aux_/preprocessed/bcc/iter_fold_impl.hpp | 180 + .../aux_/preprocessed/bcc/lambda_no_ctps.hpp | 229 + .../boost/mpl/aux_/preprocessed/bcc/less.hpp | 94 + .../mpl/aux_/preprocessed/bcc/less_equal.hpp | 94 + .../boost/mpl/aux_/preprocessed/bcc/list.hpp | 323 + .../mpl/aux_/preprocessed/bcc/list_c.hpp | 328 ++ .../boost/mpl/aux_/preprocessed/bcc/map.hpp | 323 + .../boost/mpl/aux_/preprocessed/bcc/minus.hpp | 146 + .../mpl/aux_/preprocessed/bcc/modulus.hpp | 101 + .../aux_/preprocessed/bcc/not_equal_to.hpp | 94 + .../boost/mpl/aux_/preprocessed/bcc/or.hpp | 69 + .../aux_/preprocessed/bcc/placeholders.hpp | 105 + .../boost/mpl/aux_/preprocessed/bcc/plus.hpp | 146 + .../boost/mpl/aux_/preprocessed/bcc/quote.hpp | 119 + .../preprocessed/bcc/reverse_fold_impl.hpp | 295 + .../bcc/reverse_iter_fold_impl.hpp | 295 + .../boost/mpl/aux_/preprocessed/bcc/set.hpp | 323 + .../boost/mpl/aux_/preprocessed/bcc/set_c.hpp | 328 ++ .../mpl/aux_/preprocessed/bcc/shift_left.hpp | 99 + .../mpl/aux_/preprocessed/bcc/shift_right.hpp | 99 + .../aux_/preprocessed/bcc/template_arity.hpp | 40 + .../boost/mpl/aux_/preprocessed/bcc/times.hpp | 146 + .../mpl/aux_/preprocessed/bcc/unpack_args.hpp | 97 + .../mpl/aux_/preprocessed/bcc/vector.hpp | 323 + .../mpl/aux_/preprocessed/bcc/vector_c.hpp | 309 + .../preprocessed/bcc551/advance_backward.hpp | 97 + .../preprocessed/bcc551/advance_forward.hpp | 97 + .../mpl/aux_/preprocessed/bcc551/and.hpp | 69 + .../mpl/aux_/preprocessed/bcc551/apply.hpp | 169 + .../aux_/preprocessed/bcc551/apply_fwd.hpp | 52 + .../aux_/preprocessed/bcc551/apply_wrap.hpp | 456 ++ .../mpl/aux_/preprocessed/bcc551/arg.hpp | 123 + .../aux_/preprocessed/bcc551/basic_bind.hpp | 306 + .../mpl/aux_/preprocessed/bcc551/bind.hpp | 403 ++ .../mpl/aux_/preprocessed/bcc551/bind_fwd.hpp | 46 + .../mpl/aux_/preprocessed/bcc551/bitand.hpp | 147 + .../mpl/aux_/preprocessed/bcc551/bitor.hpp | 147 + .../mpl/aux_/preprocessed/bcc551/bitxor.hpp | 147 + .../mpl/aux_/preprocessed/bcc551/deque.hpp | 323 + .../mpl/aux_/preprocessed/bcc551/divides.hpp | 146 + .../mpl/aux_/preprocessed/bcc551/equal_to.hpp | 94 + .../aux_/preprocessed/bcc551/fold_impl.hpp | 180 + .../aux_/preprocessed/bcc551/full_lambda.hpp | 558 ++ .../mpl/aux_/preprocessed/bcc551/greater.hpp | 94 + .../preprocessed/bcc551/greater_equal.hpp | 94 + .../mpl/aux_/preprocessed/bcc551/inherit.hpp | 141 + .../preprocessed/bcc551/iter_fold_if_impl.hpp | 133 + .../preprocessed/bcc551/iter_fold_impl.hpp | 180 + .../preprocessed/bcc551/lambda_no_ctps.hpp | 229 + .../mpl/aux_/preprocessed/bcc551/less.hpp | 94 + .../aux_/preprocessed/bcc551/less_equal.hpp | 94 + .../mpl/aux_/preprocessed/bcc551/list.hpp | 323 + .../mpl/aux_/preprocessed/bcc551/list_c.hpp | 328 ++ .../mpl/aux_/preprocessed/bcc551/map.hpp | 323 + .../mpl/aux_/preprocessed/bcc551/minus.hpp | 146 + .../mpl/aux_/preprocessed/bcc551/modulus.hpp | 101 + .../aux_/preprocessed/bcc551/not_equal_to.hpp | 94 + .../boost/mpl/aux_/preprocessed/bcc551/or.hpp | 69 + .../aux_/preprocessed/bcc551/placeholders.hpp | 105 + .../mpl/aux_/preprocessed/bcc551/plus.hpp | 146 + .../mpl/aux_/preprocessed/bcc551/quote.hpp | 11 + .../preprocessed/bcc551/reverse_fold_impl.hpp | 295 + .../bcc551/reverse_iter_fold_impl.hpp | 295 + .../mpl/aux_/preprocessed/bcc551/set.hpp | 323 + .../mpl/aux_/preprocessed/bcc551/set_c.hpp | 328 ++ .../aux_/preprocessed/bcc551/shift_left.hpp | 99 + .../aux_/preprocessed/bcc551/shift_right.hpp | 99 + .../preprocessed/bcc551/template_arity.hpp | 40 + .../mpl/aux_/preprocessed/bcc551/times.hpp | 146 + .../aux_/preprocessed/bcc551/unpack_args.hpp | 97 + .../mpl/aux_/preprocessed/bcc551/vector.hpp | 323 + .../mpl/aux_/preprocessed/bcc551/vector_c.hpp | 309 + .../bcc_pre590/advance_backward.hpp | 97 + .../bcc_pre590/advance_forward.hpp | 97 + .../mpl/aux_/preprocessed/bcc_pre590/and.hpp | 69 + .../aux_/preprocessed/bcc_pre590/apply.hpp | 169 + .../preprocessed/bcc_pre590/apply_fwd.hpp | 52 + .../preprocessed/bcc_pre590/apply_wrap.hpp | 456 ++ .../mpl/aux_/preprocessed/bcc_pre590/arg.hpp | 117 + .../preprocessed/bcc_pre590/basic_bind.hpp | 300 + .../mpl/aux_/preprocessed/bcc_pre590/bind.hpp | 397 ++ .../aux_/preprocessed/bcc_pre590/bind_fwd.hpp | 46 + .../aux_/preprocessed/bcc_pre590/bitand.hpp | 147 + .../aux_/preprocessed/bcc_pre590/bitor.hpp | 147 + .../aux_/preprocessed/bcc_pre590/bitxor.hpp | 147 + .../aux_/preprocessed/bcc_pre590/deque.hpp | 323 + .../aux_/preprocessed/bcc_pre590/divides.hpp | 146 + .../aux_/preprocessed/bcc_pre590/equal_to.hpp | 94 + .../preprocessed/bcc_pre590/fold_impl.hpp | 180 + .../preprocessed/bcc_pre590/full_lambda.hpp | 558 ++ .../aux_/preprocessed/bcc_pre590/greater.hpp | 94 + .../preprocessed/bcc_pre590/greater_equal.hpp | 94 + .../aux_/preprocessed/bcc_pre590/inherit.hpp | 139 + .../bcc_pre590/iter_fold_if_impl.hpp | 133 + .../bcc_pre590/iter_fold_impl.hpp | 180 + .../bcc_pre590/lambda_no_ctps.hpp | 229 + .../mpl/aux_/preprocessed/bcc_pre590/less.hpp | 94 + .../preprocessed/bcc_pre590/less_equal.hpp | 94 + .../mpl/aux_/preprocessed/bcc_pre590/list.hpp | 323 + .../aux_/preprocessed/bcc_pre590/list_c.hpp | 328 ++ .../mpl/aux_/preprocessed/bcc_pre590/map.hpp | 323 + .../aux_/preprocessed/bcc_pre590/minus.hpp | 146 + .../aux_/preprocessed/bcc_pre590/modulus.hpp | 101 + .../preprocessed/bcc_pre590/not_equal_to.hpp | 94 + .../mpl/aux_/preprocessed/bcc_pre590/or.hpp | 69 + .../preprocessed/bcc_pre590/placeholders.hpp | 105 + .../mpl/aux_/preprocessed/bcc_pre590/plus.hpp | 146 + .../aux_/preprocessed/bcc_pre590/quote.hpp | 11 + .../bcc_pre590/reverse_fold_impl.hpp | 295 + .../bcc_pre590/reverse_iter_fold_impl.hpp | 295 + .../mpl/aux_/preprocessed/bcc_pre590/set.hpp | 323 + .../aux_/preprocessed/bcc_pre590/set_c.hpp | 328 ++ .../preprocessed/bcc_pre590/shift_left.hpp | 99 + .../preprocessed/bcc_pre590/shift_right.hpp | 99 + .../bcc_pre590/template_arity.hpp | 40 + .../aux_/preprocessed/bcc_pre590/times.hpp | 146 + .../preprocessed/bcc_pre590/unpack_args.hpp | 97 + .../aux_/preprocessed/bcc_pre590/vector.hpp | 323 + .../aux_/preprocessed/bcc_pre590/vector_c.hpp | 309 + .../preprocessed/dmc/advance_backward.hpp | 97 + .../aux_/preprocessed/dmc/advance_forward.hpp | 97 + .../boost/mpl/aux_/preprocessed/dmc/and.hpp | 69 + .../boost/mpl/aux_/preprocessed/dmc/apply.hpp | 169 + .../mpl/aux_/preprocessed/dmc/apply_fwd.hpp | 52 + .../mpl/aux_/preprocessed/dmc/apply_wrap.hpp | 84 + .../boost/mpl/aux_/preprocessed/dmc/arg.hpp | 123 + .../mpl/aux_/preprocessed/dmc/basic_bind.hpp | 406 ++ .../boost/mpl/aux_/preprocessed/dmc/bind.hpp | 515 ++ .../mpl/aux_/preprocessed/dmc/bind_fwd.hpp | 53 + .../mpl/aux_/preprocessed/dmc/bitand.hpp | 147 + .../boost/mpl/aux_/preprocessed/dmc/bitor.hpp | 147 + .../mpl/aux_/preprocessed/dmc/bitxor.hpp | 147 + .../boost/mpl/aux_/preprocessed/dmc/deque.hpp | 323 + .../mpl/aux_/preprocessed/dmc/divides.hpp | 146 + .../mpl/aux_/preprocessed/dmc/equal_to.hpp | 94 + .../mpl/aux_/preprocessed/dmc/fold_impl.hpp | 180 + .../mpl/aux_/preprocessed/dmc/full_lambda.hpp | 536 ++ .../mpl/aux_/preprocessed/dmc/greater.hpp | 94 + .../aux_/preprocessed/dmc/greater_equal.hpp | 94 + .../mpl/aux_/preprocessed/dmc/inherit.hpp | 141 + .../preprocessed/dmc/iter_fold_if_impl.hpp | 133 + .../aux_/preprocessed/dmc/iter_fold_impl.hpp | 180 + .../aux_/preprocessed/dmc/lambda_no_ctps.hpp | 229 + .../boost/mpl/aux_/preprocessed/dmc/less.hpp | 94 + .../mpl/aux_/preprocessed/dmc/less_equal.hpp | 94 + .../boost/mpl/aux_/preprocessed/dmc/list.hpp | 323 + .../mpl/aux_/preprocessed/dmc/list_c.hpp | 328 ++ .../boost/mpl/aux_/preprocessed/dmc/map.hpp | 323 + .../boost/mpl/aux_/preprocessed/dmc/minus.hpp | 146 + .../mpl/aux_/preprocessed/dmc/modulus.hpp | 101 + .../aux_/preprocessed/dmc/not_equal_to.hpp | 94 + .../boost/mpl/aux_/preprocessed/dmc/or.hpp | 69 + .../aux_/preprocessed/dmc/placeholders.hpp | 105 + .../boost/mpl/aux_/preprocessed/dmc/plus.hpp | 146 + .../boost/mpl/aux_/preprocessed/dmc/quote.hpp | 123 + .../preprocessed/dmc/reverse_fold_impl.hpp | 231 + .../dmc/reverse_iter_fold_impl.hpp | 231 + .../boost/mpl/aux_/preprocessed/dmc/set.hpp | 323 + .../boost/mpl/aux_/preprocessed/dmc/set_c.hpp | 328 ++ .../mpl/aux_/preprocessed/dmc/shift_left.hpp | 99 + .../mpl/aux_/preprocessed/dmc/shift_right.hpp | 99 + .../aux_/preprocessed/dmc/template_arity.hpp | 11 + .../boost/mpl/aux_/preprocessed/dmc/times.hpp | 146 + .../mpl/aux_/preprocessed/dmc/unpack_args.hpp | 94 + .../mpl/aux_/preprocessed/dmc/vector.hpp | 323 + .../mpl/aux_/preprocessed/dmc/vector_c.hpp | 309 + .../preprocessed/gcc/advance_backward.hpp | 97 + .../aux_/preprocessed/gcc/advance_forward.hpp | 97 + .../boost/mpl/aux_/preprocessed/gcc/and.hpp | 69 + .../boost/mpl/aux_/preprocessed/gcc/apply.hpp | 169 + .../mpl/aux_/preprocessed/gcc/apply_fwd.hpp | 52 + .../mpl/aux_/preprocessed/gcc/apply_wrap.hpp | 84 + .../boost/mpl/aux_/preprocessed/gcc/arg.hpp | 123 + .../mpl/aux_/preprocessed/gcc/basic_bind.hpp | 440 ++ .../boost/mpl/aux_/preprocessed/gcc/bind.hpp | 561 ++ .../mpl/aux_/preprocessed/gcc/bind_fwd.hpp | 52 + .../mpl/aux_/preprocessed/gcc/bitand.hpp | 147 + .../boost/mpl/aux_/preprocessed/gcc/bitor.hpp | 147 + .../mpl/aux_/preprocessed/gcc/bitxor.hpp | 147 + .../boost/mpl/aux_/preprocessed/gcc/deque.hpp | 323 + .../mpl/aux_/preprocessed/gcc/divides.hpp | 146 + .../mpl/aux_/preprocessed/gcc/equal_to.hpp | 94 + .../mpl/aux_/preprocessed/gcc/fold_impl.hpp | 180 + .../mpl/aux_/preprocessed/gcc/full_lambda.hpp | 558 ++ .../mpl/aux_/preprocessed/gcc/greater.hpp | 94 + .../aux_/preprocessed/gcc/greater_equal.hpp | 94 + .../mpl/aux_/preprocessed/gcc/inherit.hpp | 141 + .../preprocessed/gcc/iter_fold_if_impl.hpp | 133 + .../aux_/preprocessed/gcc/iter_fold_impl.hpp | 180 + .../aux_/preprocessed/gcc/lambda_no_ctps.hpp | 229 + .../boost/mpl/aux_/preprocessed/gcc/less.hpp | 94 + .../mpl/aux_/preprocessed/gcc/less_equal.hpp | 94 + .../boost/mpl/aux_/preprocessed/gcc/list.hpp | 323 + .../mpl/aux_/preprocessed/gcc/list_c.hpp | 328 ++ .../boost/mpl/aux_/preprocessed/gcc/map.hpp | 323 + .../boost/mpl/aux_/preprocessed/gcc/minus.hpp | 146 + .../mpl/aux_/preprocessed/gcc/modulus.hpp | 101 + .../aux_/preprocessed/gcc/not_equal_to.hpp | 94 + .../boost/mpl/aux_/preprocessed/gcc/or.hpp | 69 + .../aux_/preprocessed/gcc/placeholders.hpp | 105 + .../boost/mpl/aux_/preprocessed/gcc/plus.hpp | 146 + .../boost/mpl/aux_/preprocessed/gcc/quote.hpp | 123 + .../preprocessed/gcc/reverse_fold_impl.hpp | 231 + .../gcc/reverse_iter_fold_impl.hpp | 231 + .../boost/mpl/aux_/preprocessed/gcc/set.hpp | 323 + .../boost/mpl/aux_/preprocessed/gcc/set_c.hpp | 328 ++ .../mpl/aux_/preprocessed/gcc/shift_left.hpp | 99 + .../mpl/aux_/preprocessed/gcc/shift_right.hpp | 99 + .../aux_/preprocessed/gcc/template_arity.hpp | 97 + .../boost/mpl/aux_/preprocessed/gcc/times.hpp | 146 + .../mpl/aux_/preprocessed/gcc/unpack_args.hpp | 94 + .../mpl/aux_/preprocessed/gcc/vector.hpp | 323 + .../mpl/aux_/preprocessed/gcc/vector_c.hpp | 309 + .../preprocessed/msvc60/advance_backward.hpp | 132 + .../preprocessed/msvc60/advance_forward.hpp | 132 + .../mpl/aux_/preprocessed/msvc60/and.hpp | 73 + .../mpl/aux_/preprocessed/msvc60/apply.hpp | 166 + .../aux_/preprocessed/msvc60/apply_fwd.hpp | 46 + .../aux_/preprocessed/msvc60/apply_wrap.hpp | 247 + .../mpl/aux_/preprocessed/msvc60/arg.hpp | 123 + .../aux_/preprocessed/msvc60/basic_bind.hpp | 328 ++ .../mpl/aux_/preprocessed/msvc60/bind.hpp | 432 ++ .../mpl/aux_/preprocessed/msvc60/bind_fwd.hpp | 46 + .../mpl/aux_/preprocessed/msvc60/bitand.hpp | 149 + .../mpl/aux_/preprocessed/msvc60/bitor.hpp | 149 + .../mpl/aux_/preprocessed/msvc60/bitxor.hpp | 149 + .../mpl/aux_/preprocessed/msvc60/deque.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc60/divides.hpp | 148 + .../mpl/aux_/preprocessed/msvc60/equal_to.hpp | 102 + .../aux_/preprocessed/msvc60/fold_impl.hpp | 293 + .../aux_/preprocessed/msvc60/full_lambda.hpp | 554 ++ .../mpl/aux_/preprocessed/msvc60/greater.hpp | 102 + .../preprocessed/msvc60/greater_equal.hpp | 102 + .../mpl/aux_/preprocessed/msvc60/inherit.hpp | 166 + .../preprocessed/msvc60/iter_fold_if_impl.hpp | 133 + .../preprocessed/msvc60/iter_fold_impl.hpp | 293 + .../preprocessed/msvc60/lambda_no_ctps.hpp | 229 + .../mpl/aux_/preprocessed/msvc60/less.hpp | 102 + .../aux_/preprocessed/msvc60/less_equal.hpp | 102 + .../mpl/aux_/preprocessed/msvc60/list.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc60/list_c.hpp | 534 ++ .../mpl/aux_/preprocessed/msvc60/map.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc60/minus.hpp | 148 + .../mpl/aux_/preprocessed/msvc60/modulus.hpp | 115 + .../aux_/preprocessed/msvc60/not_equal_to.hpp | 102 + .../boost/mpl/aux_/preprocessed/msvc60/or.hpp | 73 + .../aux_/preprocessed/msvc60/placeholders.hpp | 105 + .../mpl/aux_/preprocessed/msvc60/plus.hpp | 148 + .../mpl/aux_/preprocessed/msvc60/quote.hpp | 11 + .../preprocessed/msvc60/reverse_fold_impl.hpp | 343 ++ .../msvc60/reverse_iter_fold_impl.hpp | 343 ++ .../mpl/aux_/preprocessed/msvc60/set.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc60/set_c.hpp | 534 ++ .../aux_/preprocessed/msvc60/shift_left.hpp | 114 + .../aux_/preprocessed/msvc60/shift_right.hpp | 114 + .../preprocessed/msvc60/template_arity.hpp | 46 + .../mpl/aux_/preprocessed/msvc60/times.hpp | 148 + .../aux_/preprocessed/msvc60/unpack_args.hpp | 109 + .../mpl/aux_/preprocessed/msvc60/vector.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc60/vector_c.hpp | 534 ++ .../preprocessed/msvc70/advance_backward.hpp | 97 + .../preprocessed/msvc70/advance_forward.hpp | 97 + .../mpl/aux_/preprocessed/msvc70/and.hpp | 71 + .../mpl/aux_/preprocessed/msvc70/apply.hpp | 160 + .../aux_/preprocessed/msvc70/apply_fwd.hpp | 46 + .../aux_/preprocessed/msvc70/apply_wrap.hpp | 138 + .../mpl/aux_/preprocessed/msvc70/arg.hpp | 123 + .../aux_/preprocessed/msvc70/basic_bind.hpp | 328 ++ .../mpl/aux_/preprocessed/msvc70/bind.hpp | 432 ++ .../mpl/aux_/preprocessed/msvc70/bind_fwd.hpp | 46 + .../mpl/aux_/preprocessed/msvc70/bitand.hpp | 151 + .../mpl/aux_/preprocessed/msvc70/bitor.hpp | 151 + .../mpl/aux_/preprocessed/msvc70/bitxor.hpp | 151 + .../mpl/aux_/preprocessed/msvc70/deque.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc70/divides.hpp | 150 + .../mpl/aux_/preprocessed/msvc70/equal_to.hpp | 102 + .../aux_/preprocessed/msvc70/fold_impl.hpp | 245 + .../aux_/preprocessed/msvc70/full_lambda.hpp | 554 ++ .../mpl/aux_/preprocessed/msvc70/greater.hpp | 102 + .../preprocessed/msvc70/greater_equal.hpp | 102 + .../mpl/aux_/preprocessed/msvc70/inherit.hpp | 166 + .../preprocessed/msvc70/iter_fold_if_impl.hpp | 133 + .../preprocessed/msvc70/iter_fold_impl.hpp | 245 + .../preprocessed/msvc70/lambda_no_ctps.hpp | 229 + .../mpl/aux_/preprocessed/msvc70/less.hpp | 102 + .../aux_/preprocessed/msvc70/less_equal.hpp | 102 + .../mpl/aux_/preprocessed/msvc70/list.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc70/list_c.hpp | 534 ++ .../mpl/aux_/preprocessed/msvc70/map.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc70/minus.hpp | 150 + .../mpl/aux_/preprocessed/msvc70/modulus.hpp | 115 + .../aux_/preprocessed/msvc70/not_equal_to.hpp | 102 + .../boost/mpl/aux_/preprocessed/msvc70/or.hpp | 71 + .../aux_/preprocessed/msvc70/placeholders.hpp | 105 + .../mpl/aux_/preprocessed/msvc70/plus.hpp | 150 + .../mpl/aux_/preprocessed/msvc70/quote.hpp | 116 + .../preprocessed/msvc70/reverse_fold_impl.hpp | 295 + .../msvc70/reverse_iter_fold_impl.hpp | 295 + .../mpl/aux_/preprocessed/msvc70/set.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc70/set_c.hpp | 534 ++ .../aux_/preprocessed/msvc70/shift_left.hpp | 114 + .../aux_/preprocessed/msvc70/shift_right.hpp | 114 + .../preprocessed/msvc70/template_arity.hpp | 46 + .../mpl/aux_/preprocessed/msvc70/times.hpp | 150 + .../aux_/preprocessed/msvc70/unpack_args.hpp | 109 + .../mpl/aux_/preprocessed/msvc70/vector.hpp | 556 ++ .../mpl/aux_/preprocessed/msvc70/vector_c.hpp | 534 ++ .../preprocessed/mwcw/advance_backward.hpp | 97 + .../preprocessed/mwcw/advance_forward.hpp | 97 + .../boost/mpl/aux_/preprocessed/mwcw/and.hpp | 69 + .../mpl/aux_/preprocessed/mwcw/apply.hpp | 169 + .../mpl/aux_/preprocessed/mwcw/apply_fwd.hpp | 52 + .../mpl/aux_/preprocessed/mwcw/apply_wrap.hpp | 456 ++ .../boost/mpl/aux_/preprocessed/mwcw/arg.hpp | 123 + .../mpl/aux_/preprocessed/mwcw/basic_bind.hpp | 440 ++ .../boost/mpl/aux_/preprocessed/mwcw/bind.hpp | 561 ++ .../mpl/aux_/preprocessed/mwcw/bind_fwd.hpp | 52 + .../mpl/aux_/preprocessed/mwcw/bitand.hpp | 147 + .../mpl/aux_/preprocessed/mwcw/bitor.hpp | 147 + .../mpl/aux_/preprocessed/mwcw/bitxor.hpp | 147 + .../mpl/aux_/preprocessed/mwcw/deque.hpp | 323 + .../mpl/aux_/preprocessed/mwcw/divides.hpp | 146 + .../mpl/aux_/preprocessed/mwcw/equal_to.hpp | 94 + .../mpl/aux_/preprocessed/mwcw/fold_impl.hpp | 180 + .../aux_/preprocessed/mwcw/full_lambda.hpp | 554 ++ .../mpl/aux_/preprocessed/mwcw/greater.hpp | 94 + .../aux_/preprocessed/mwcw/greater_equal.hpp | 94 + .../mpl/aux_/preprocessed/mwcw/inherit.hpp | 141 + .../preprocessed/mwcw/iter_fold_if_impl.hpp | 133 + .../aux_/preprocessed/mwcw/iter_fold_impl.hpp | 180 + .../aux_/preprocessed/mwcw/lambda_no_ctps.hpp | 229 + .../boost/mpl/aux_/preprocessed/mwcw/less.hpp | 94 + .../mpl/aux_/preprocessed/mwcw/less_equal.hpp | 94 + .../boost/mpl/aux_/preprocessed/mwcw/list.hpp | 323 + .../mpl/aux_/preprocessed/mwcw/list_c.hpp | 328 ++ .../boost/mpl/aux_/preprocessed/mwcw/map.hpp | 323 + .../mpl/aux_/preprocessed/mwcw/minus.hpp | 146 + .../mpl/aux_/preprocessed/mwcw/modulus.hpp | 101 + .../aux_/preprocessed/mwcw/not_equal_to.hpp | 94 + .../boost/mpl/aux_/preprocessed/mwcw/or.hpp | 69 + .../aux_/preprocessed/mwcw/placeholders.hpp | 105 + .../boost/mpl/aux_/preprocessed/mwcw/plus.hpp | 146 + .../mpl/aux_/preprocessed/mwcw/quote.hpp | 123 + .../preprocessed/mwcw/reverse_fold_impl.hpp | 231 + .../mwcw/reverse_iter_fold_impl.hpp | 231 + .../boost/mpl/aux_/preprocessed/mwcw/set.hpp | 323 + .../mpl/aux_/preprocessed/mwcw/set_c.hpp | 328 ++ .../mpl/aux_/preprocessed/mwcw/shift_left.hpp | 99 + .../aux_/preprocessed/mwcw/shift_right.hpp | 99 + .../aux_/preprocessed/mwcw/template_arity.hpp | 11 + .../mpl/aux_/preprocessed/mwcw/times.hpp | 146 + .../aux_/preprocessed/mwcw/unpack_args.hpp | 94 + .../mpl/aux_/preprocessed/mwcw/vector.hpp | 323 + .../mpl/aux_/preprocessed/mwcw/vector_c.hpp | 309 + .../preprocessed/no_ctps/advance_backward.hpp | 97 + .../preprocessed/no_ctps/advance_forward.hpp | 97 + .../mpl/aux_/preprocessed/no_ctps/and.hpp | 73 + .../mpl/aux_/preprocessed/no_ctps/apply.hpp | 268 + .../aux_/preprocessed/no_ctps/apply_fwd.hpp | 50 + .../aux_/preprocessed/no_ctps/apply_wrap.hpp | 78 + .../mpl/aux_/preprocessed/no_ctps/arg.hpp | 123 + .../aux_/preprocessed/no_ctps/basic_bind.hpp | 486 ++ .../mpl/aux_/preprocessed/no_ctps/bind.hpp | 590 ++ .../aux_/preprocessed/no_ctps/bind_fwd.hpp | 52 + .../mpl/aux_/preprocessed/no_ctps/bitand.hpp | 134 + .../mpl/aux_/preprocessed/no_ctps/bitor.hpp | 134 + .../mpl/aux_/preprocessed/no_ctps/bitxor.hpp | 134 + .../mpl/aux_/preprocessed/no_ctps/deque.hpp | 556 ++ .../mpl/aux_/preprocessed/no_ctps/divides.hpp | 133 + .../aux_/preprocessed/no_ctps/equal_to.hpp | 94 + .../aux_/preprocessed/no_ctps/fold_impl.hpp | 245 + .../aux_/preprocessed/no_ctps/full_lambda.hpp | 554 ++ .../mpl/aux_/preprocessed/no_ctps/greater.hpp | 94 + .../preprocessed/no_ctps/greater_equal.hpp | 94 + .../mpl/aux_/preprocessed/no_ctps/inherit.hpp | 166 + .../no_ctps/iter_fold_if_impl.hpp | 133 + .../preprocessed/no_ctps/iter_fold_impl.hpp | 245 + .../preprocessed/no_ctps/lambda_no_ctps.hpp | 229 + .../mpl/aux_/preprocessed/no_ctps/less.hpp | 94 + .../aux_/preprocessed/no_ctps/less_equal.hpp | 94 + .../mpl/aux_/preprocessed/no_ctps/list.hpp | 556 ++ .../mpl/aux_/preprocessed/no_ctps/list_c.hpp | 534 ++ .../mpl/aux_/preprocessed/no_ctps/map.hpp | 556 ++ .../mpl/aux_/preprocessed/no_ctps/minus.hpp | 133 + .../mpl/aux_/preprocessed/no_ctps/modulus.hpp | 101 + .../preprocessed/no_ctps/not_equal_to.hpp | 94 + .../mpl/aux_/preprocessed/no_ctps/or.hpp | 73 + .../preprocessed/no_ctps/placeholders.hpp | 105 + .../mpl/aux_/preprocessed/no_ctps/plus.hpp | 133 + .../mpl/aux_/preprocessed/no_ctps/quote.hpp | 116 + .../no_ctps/reverse_fold_impl.hpp | 295 + .../no_ctps/reverse_iter_fold_impl.hpp | 295 + .../mpl/aux_/preprocessed/no_ctps/set.hpp | 556 ++ .../mpl/aux_/preprocessed/no_ctps/set_c.hpp | 534 ++ .../aux_/preprocessed/no_ctps/shift_left.hpp | 99 + .../aux_/preprocessed/no_ctps/shift_right.hpp | 99 + .../preprocessed/no_ctps/template_arity.hpp | 40 + .../mpl/aux_/preprocessed/no_ctps/times.hpp | 133 + .../aux_/preprocessed/no_ctps/unpack_args.hpp | 109 + .../mpl/aux_/preprocessed/no_ctps/vector.hpp | 556 ++ .../aux_/preprocessed/no_ctps/vector_c.hpp | 534 ++ .../preprocessed/no_ttp/advance_backward.hpp | 97 + .../preprocessed/no_ttp/advance_forward.hpp | 97 + .../mpl/aux_/preprocessed/no_ttp/and.hpp | 69 + .../mpl/aux_/preprocessed/no_ttp/apply.hpp | 169 + .../aux_/preprocessed/no_ttp/apply_fwd.hpp | 52 + .../aux_/preprocessed/no_ttp/apply_wrap.hpp | 84 + .../mpl/aux_/preprocessed/no_ttp/arg.hpp | 123 + .../aux_/preprocessed/no_ttp/basic_bind.hpp | 369 ++ .../mpl/aux_/preprocessed/no_ttp/bind.hpp | 466 ++ .../mpl/aux_/preprocessed/no_ttp/bind_fwd.hpp | 52 + .../mpl/aux_/preprocessed/no_ttp/bitand.hpp | 157 + .../mpl/aux_/preprocessed/no_ttp/bitor.hpp | 157 + .../mpl/aux_/preprocessed/no_ttp/bitxor.hpp | 157 + .../mpl/aux_/preprocessed/no_ttp/deque.hpp | 323 + .../mpl/aux_/preprocessed/no_ttp/divides.hpp | 156 + .../mpl/aux_/preprocessed/no_ttp/equal_to.hpp | 98 + .../aux_/preprocessed/no_ttp/fold_impl.hpp | 180 + .../aux_/preprocessed/no_ttp/full_lambda.hpp | 554 ++ .../mpl/aux_/preprocessed/no_ttp/greater.hpp | 98 + .../preprocessed/no_ttp/greater_equal.hpp | 98 + .../mpl/aux_/preprocessed/no_ttp/inherit.hpp | 141 + .../preprocessed/no_ttp/iter_fold_if_impl.hpp | 133 + .../preprocessed/no_ttp/iter_fold_impl.hpp | 180 + .../preprocessed/no_ttp/lambda_no_ctps.hpp | 229 + .../mpl/aux_/preprocessed/no_ttp/less.hpp | 98 + .../aux_/preprocessed/no_ttp/less_equal.hpp | 98 + .../mpl/aux_/preprocessed/no_ttp/list.hpp | 323 + .../mpl/aux_/preprocessed/no_ttp/list_c.hpp | 328 ++ .../mpl/aux_/preprocessed/no_ttp/map.hpp | 323 + .../mpl/aux_/preprocessed/no_ttp/minus.hpp | 156 + .../mpl/aux_/preprocessed/no_ttp/modulus.hpp | 111 + .../aux_/preprocessed/no_ttp/not_equal_to.hpp | 98 + .../boost/mpl/aux_/preprocessed/no_ttp/or.hpp | 69 + .../aux_/preprocessed/no_ttp/placeholders.hpp | 105 + .../mpl/aux_/preprocessed/no_ttp/plus.hpp | 156 + .../mpl/aux_/preprocessed/no_ttp/quote.hpp | 11 + .../preprocessed/no_ttp/reverse_fold_impl.hpp | 231 + .../no_ttp/reverse_iter_fold_impl.hpp | 231 + .../mpl/aux_/preprocessed/no_ttp/set.hpp | 323 + .../mpl/aux_/preprocessed/no_ttp/set_c.hpp | 328 ++ .../aux_/preprocessed/no_ttp/shift_left.hpp | 110 + .../aux_/preprocessed/no_ttp/shift_right.hpp | 110 + .../preprocessed/no_ttp/template_arity.hpp | 40 + .../mpl/aux_/preprocessed/no_ttp/times.hpp | 156 + .../aux_/preprocessed/no_ttp/unpack_args.hpp | 94 + .../mpl/aux_/preprocessed/no_ttp/vector.hpp | 323 + .../mpl/aux_/preprocessed/no_ttp/vector_c.hpp | 309 + .../preprocessed/plain/advance_backward.hpp | 97 + .../preprocessed/plain/advance_forward.hpp | 97 + .../boost/mpl/aux_/preprocessed/plain/and.hpp | 64 + .../mpl/aux_/preprocessed/plain/apply.hpp | 139 + .../mpl/aux_/preprocessed/plain/apply_fwd.hpp | 52 + .../aux_/preprocessed/plain/apply_wrap.hpp | 84 + .../boost/mpl/aux_/preprocessed/plain/arg.hpp | 123 + .../aux_/preprocessed/plain/basic_bind.hpp | 440 ++ .../mpl/aux_/preprocessed/plain/bind.hpp | 561 ++ .../mpl/aux_/preprocessed/plain/bind_fwd.hpp | 52 + .../mpl/aux_/preprocessed/plain/bitand.hpp | 142 + .../mpl/aux_/preprocessed/plain/bitor.hpp | 142 + .../mpl/aux_/preprocessed/plain/bitxor.hpp | 142 + .../mpl/aux_/preprocessed/plain/deque.hpp | 323 + .../mpl/aux_/preprocessed/plain/divides.hpp | 141 + .../mpl/aux_/preprocessed/plain/equal_to.hpp | 92 + .../mpl/aux_/preprocessed/plain/fold_impl.hpp | 180 + .../aux_/preprocessed/plain/full_lambda.hpp | 554 ++ .../mpl/aux_/preprocessed/plain/greater.hpp | 92 + .../aux_/preprocessed/plain/greater_equal.hpp | 92 + .../mpl/aux_/preprocessed/plain/inherit.hpp | 125 + .../preprocessed/plain/iter_fold_if_impl.hpp | 133 + .../preprocessed/plain/iter_fold_impl.hpp | 180 + .../preprocessed/plain/lambda_no_ctps.hpp | 228 + .../mpl/aux_/preprocessed/plain/less.hpp | 92 + .../aux_/preprocessed/plain/less_equal.hpp | 92 + .../mpl/aux_/preprocessed/plain/list.hpp | 323 + .../mpl/aux_/preprocessed/plain/list_c.hpp | 328 ++ .../boost/mpl/aux_/preprocessed/plain/map.hpp | 323 + .../mpl/aux_/preprocessed/plain/minus.hpp | 141 + .../mpl/aux_/preprocessed/plain/modulus.hpp | 99 + .../aux_/preprocessed/plain/not_equal_to.hpp | 92 + .../boost/mpl/aux_/preprocessed/plain/or.hpp | 64 + .../aux_/preprocessed/plain/placeholders.hpp | 105 + .../mpl/aux_/preprocessed/plain/plus.hpp | 141 + .../mpl/aux_/preprocessed/plain/quote.hpp | 123 + .../preprocessed/plain/reverse_fold_impl.hpp | 231 + .../plain/reverse_iter_fold_impl.hpp | 231 + .../boost/mpl/aux_/preprocessed/plain/set.hpp | 323 + .../mpl/aux_/preprocessed/plain/set_c.hpp | 328 ++ .../aux_/preprocessed/plain/shift_left.hpp | 97 + .../aux_/preprocessed/plain/shift_right.hpp | 97 + .../preprocessed/plain/template_arity.hpp | 11 + .../mpl/aux_/preprocessed/plain/times.hpp | 141 + .../aux_/preprocessed/plain/unpack_args.hpp | 94 + .../mpl/aux_/preprocessed/plain/vector.hpp | 323 + .../mpl/aux_/preprocessed/plain/vector_c.hpp | 309 + .../boost/mpl/aux_/preprocessor/add.hpp | 65 + .../mpl/aux_/preprocessor/def_params_tail.hpp | 105 + .../mpl/aux_/preprocessor/default_params.hpp | 67 + .../boost/mpl/aux_/preprocessor/enum.hpp | 62 + .../mpl/aux_/preprocessor/ext_params.hpp | 78 + .../mpl/aux_/preprocessor/filter_params.hpp | 28 + .../boost/mpl/aux_/preprocessor/params.hpp | 65 + .../aux_/preprocessor/partial_spec_params.hpp | 32 + .../boost/mpl/aux_/preprocessor/range.hpp | 23 + .../boost/mpl/aux_/preprocessor/repeat.hpp | 51 + .../boost/mpl/aux_/preprocessor/sub.hpp | 65 + .../boost/mpl/aux_/preprocessor/tuple.hpp | 29 + .../boost/mpl/aux_/push_back_impl.hpp | 70 + .../boost/mpl/aux_/push_front_impl.hpp | 71 + .../boost/mpl/aux_/reverse_fold_impl.hpp | 44 + .../boost/mpl/aux_/reverse_fold_impl_body.hpp | 412 ++ .../boost/mpl/aux_/sequence_wrapper.hpp | 292 + .../autoboost/boost/mpl/aux_/size_impl.hpp | 52 + .../autoboost/boost/mpl/aux_/static_cast.hpp | 27 + .../boost/mpl/aux_/template_arity.hpp | 189 + .../boost/mpl/aux_/template_arity_fwd.hpp | 23 + .../boost/mpl/aux_/traits_lambda_spec.hpp | 63 + .../autoboost/boost/mpl/aux_/type_wrapper.hpp | 47 + contrib/autoboost/boost/mpl/aux_/unwrap.hpp | 51 + .../autoboost/boost/mpl/aux_/value_wknd.hpp | 89 + contrib/autoboost/boost/mpl/aux_/yes_no.hpp | 58 + contrib/autoboost/boost/mpl/back_fwd.hpp | 24 + contrib/autoboost/boost/mpl/back_inserter.hpp | 34 + contrib/autoboost/boost/mpl/begin_end.hpp | 57 + contrib/autoboost/boost/mpl/begin_end_fwd.hpp | 27 + contrib/autoboost/boost/mpl/bind.hpp | 551 ++ contrib/autoboost/boost/mpl/bind_fwd.hpp | 99 + contrib/autoboost/boost/mpl/bool.hpp | 39 + contrib/autoboost/boost/mpl/bool_fwd.hpp | 33 + contrib/autoboost/boost/mpl/clear.hpp | 39 + contrib/autoboost/boost/mpl/clear_fwd.hpp | 24 + contrib/autoboost/boost/mpl/comparison.hpp | 24 + contrib/autoboost/boost/mpl/contains.hpp | 41 + contrib/autoboost/boost/mpl/contains_fwd.hpp | 25 + contrib/autoboost/boost/mpl/copy.hpp | 58 + contrib/autoboost/boost/mpl/deref.hpp | 41 + contrib/autoboost/boost/mpl/distance.hpp | 78 + contrib/autoboost/boost/mpl/distance_fwd.hpp | 28 + contrib/autoboost/boost/mpl/empty_fwd.hpp | 24 + contrib/autoboost/boost/mpl/equal_to.hpp | 21 + contrib/autoboost/boost/mpl/eval_if.hpp | 71 + contrib/autoboost/boost/mpl/find.hpp | 38 + contrib/autoboost/boost/mpl/find_if.hpp | 50 + contrib/autoboost/boost/mpl/fold.hpp | 48 + contrib/autoboost/boost/mpl/for_each.hpp | 123 + contrib/autoboost/boost/mpl/front_fwd.hpp | 24 + .../autoboost/boost/mpl/front_inserter.hpp | 33 + contrib/autoboost/boost/mpl/greater.hpp | 21 + contrib/autoboost/boost/mpl/greater_equal.hpp | 21 + contrib/autoboost/boost/mpl/has_xxx.hpp | 647 ++ contrib/autoboost/boost/mpl/identity.hpp | 45 + contrib/autoboost/boost/mpl/if.hpp | 135 + contrib/autoboost/boost/mpl/inserter.hpp | 32 + contrib/autoboost/boost/mpl/int.hpp | 22 + contrib/autoboost/boost/mpl/int_fwd.hpp | 27 + contrib/autoboost/boost/mpl/integral_c.hpp | 51 + .../autoboost/boost/mpl/integral_c_fwd.hpp | 32 + .../autoboost/boost/mpl/integral_c_tag.hpp | 26 + .../autoboost/boost/mpl/is_placeholder.hpp | 67 + contrib/autoboost/boost/mpl/is_sequence.hpp | 112 + contrib/autoboost/boost/mpl/iter_fold.hpp | 49 + contrib/autoboost/boost/mpl/iter_fold_if.hpp | 117 + .../autoboost/boost/mpl/iterator_range.hpp | 42 + contrib/autoboost/boost/mpl/iterator_tags.hpp | 27 + contrib/autoboost/boost/mpl/lambda.hpp | 29 + contrib/autoboost/boost/mpl/lambda_fwd.hpp | 57 + contrib/autoboost/boost/mpl/less.hpp | 21 + contrib/autoboost/boost/mpl/less_equal.hpp | 21 + contrib/autoboost/boost/mpl/limits/arity.hpp | 21 + contrib/autoboost/boost/mpl/limits/list.hpp | 21 + .../autoboost/boost/mpl/limits/unrolling.hpp | 21 + contrib/autoboost/boost/mpl/limits/vector.hpp | 21 + contrib/autoboost/boost/mpl/list.hpp | 57 + .../autoboost/boost/mpl/list/aux_/O1_size.hpp | 33 + .../boost/mpl/list/aux_/begin_end.hpp | 44 + .../autoboost/boost/mpl/list/aux_/clear.hpp | 34 + .../autoboost/boost/mpl/list/aux_/empty.hpp | 34 + .../autoboost/boost/mpl/list/aux_/front.hpp | 33 + .../mpl/list/aux_/include_preprocessed.hpp | 35 + .../autoboost/boost/mpl/list/aux_/item.hpp | 55 + .../boost/mpl/list/aux_/iterator.hpp | 76 + .../boost/mpl/list/aux_/numbered.hpp | 68 + .../boost/mpl/list/aux_/numbered_c.hpp | 71 + .../boost/mpl/list/aux_/pop_front.hpp | 34 + .../list/aux_/preprocessed/plain/list10.hpp | 149 + .../list/aux_/preprocessed/plain/list10_c.hpp | 164 + .../list/aux_/preprocessed/plain/list20.hpp | 169 + .../list/aux_/preprocessed/plain/list20_c.hpp | 173 + .../list/aux_/preprocessed/plain/list30.hpp | 189 + .../list/aux_/preprocessed/plain/list30_c.hpp | 183 + .../list/aux_/preprocessed/plain/list40.hpp | 209 + .../list/aux_/preprocessed/plain/list40_c.hpp | 193 + .../list/aux_/preprocessed/plain/list50.hpp | 229 + .../list/aux_/preprocessed/plain/list50_c.hpp | 203 + .../boost/mpl/list/aux_/push_back.hpp | 36 + .../boost/mpl/list/aux_/push_front.hpp | 39 + .../autoboost/boost/mpl/list/aux_/size.hpp | 33 + contrib/autoboost/boost/mpl/list/aux_/tag.hpp | 24 + contrib/autoboost/boost/mpl/list/list0.hpp | 42 + contrib/autoboost/boost/mpl/list/list0_c.hpp | 31 + contrib/autoboost/boost/mpl/list/list10.hpp | 43 + contrib/autoboost/boost/mpl/list/list10_c.hpp | 43 + contrib/autoboost/boost/mpl/list/list20.hpp | 43 + contrib/autoboost/boost/mpl/list/list20_c.hpp | 43 + contrib/autoboost/boost/mpl/list/list30.hpp | 43 + contrib/autoboost/boost/mpl/list/list30_c.hpp | 43 + contrib/autoboost/boost/mpl/list/list40.hpp | 43 + contrib/autoboost/boost/mpl/list/list40_c.hpp | 43 + contrib/autoboost/boost/mpl/list/list50.hpp | 43 + contrib/autoboost/boost/mpl/list/list50_c.hpp | 43 + contrib/autoboost/boost/mpl/logical.hpp | 21 + contrib/autoboost/boost/mpl/long.hpp | 22 + contrib/autoboost/boost/mpl/long_fwd.hpp | 27 + contrib/autoboost/boost/mpl/minus.hpp | 21 + contrib/autoboost/boost/mpl/multiplies.hpp | 53 + contrib/autoboost/boost/mpl/negate.hpp | 81 + contrib/autoboost/boost/mpl/next.hpp | 19 + contrib/autoboost/boost/mpl/next_prior.hpp | 49 + contrib/autoboost/boost/mpl/not.hpp | 51 + contrib/autoboost/boost/mpl/not_equal_to.hpp | 21 + contrib/autoboost/boost/mpl/numeric_cast.hpp | 41 + contrib/autoboost/boost/mpl/or.hpp | 61 + contrib/autoboost/boost/mpl/pair.hpp | 70 + contrib/autoboost/boost/mpl/placeholders.hpp | 100 + contrib/autoboost/boost/mpl/plus.hpp | 21 + contrib/autoboost/boost/mpl/pop_back_fwd.hpp | 24 + contrib/autoboost/boost/mpl/pop_front_fwd.hpp | 24 + contrib/autoboost/boost/mpl/print.hpp | 75 + contrib/autoboost/boost/mpl/prior.hpp | 19 + contrib/autoboost/boost/mpl/protect.hpp | 55 + contrib/autoboost/boost/mpl/push_back.hpp | 53 + contrib/autoboost/boost/mpl/push_back_fwd.hpp | 24 + contrib/autoboost/boost/mpl/push_front.hpp | 52 + .../autoboost/boost/mpl/push_front_fwd.hpp | 24 + contrib/autoboost/boost/mpl/quote.hpp | 151 + contrib/autoboost/boost/mpl/remove_if.hpp | 83 + contrib/autoboost/boost/mpl/reverse_fold.hpp | 50 + contrib/autoboost/boost/mpl/same_as.hpp | 55 + contrib/autoboost/boost/mpl/sequence_tag.hpp | 124 + .../autoboost/boost/mpl/sequence_tag_fwd.hpp | 26 + contrib/autoboost/boost/mpl/size.hpp | 42 + contrib/autoboost/boost/mpl/size_fwd.hpp | 24 + contrib/autoboost/boost/mpl/size_t.hpp | 25 + contrib/autoboost/boost/mpl/size_t_fwd.hpp | 28 + contrib/autoboost/boost/mpl/tag.hpp | 52 + contrib/autoboost/boost/mpl/times.hpp | 21 + contrib/autoboost/boost/mpl/vector.hpp | 57 + .../boost/mpl/vector/aux_/O1_size.hpp | 56 + .../autoboost/boost/mpl/vector/aux_/at.hpp | 116 + .../autoboost/boost/mpl/vector/aux_/back.hpp | 59 + .../boost/mpl/vector/aux_/begin_end.hpp | 49 + .../autoboost/boost/mpl/vector/aux_/clear.hpp | 55 + .../autoboost/boost/mpl/vector/aux_/empty.hpp | 68 + .../autoboost/boost/mpl/vector/aux_/front.hpp | 56 + .../mpl/vector/aux_/include_preprocessed.hpp | 55 + .../autoboost/boost/mpl/vector/aux_/item.hpp | 103 + .../boost/mpl/vector/aux_/iterator.hpp | 130 + .../boost/mpl/vector/aux_/numbered.hpp | 218 + .../boost/mpl/vector/aux_/numbered_c.hpp | 77 + .../boost/mpl/vector/aux_/pop_back.hpp | 40 + .../boost/mpl/vector/aux_/pop_front.hpp | 40 + .../aux_/preprocessed/no_ctps/vector10.hpp | 1528 +++++ .../aux_/preprocessed/no_ctps/vector10_c.hpp | 149 + .../aux_/preprocessed/no_ctps/vector20.hpp | 1804 ++++++ .../aux_/preprocessed/no_ctps/vector20_c.hpp | 195 + .../aux_/preprocessed/no_ctps/vector30.hpp | 2124 +++++++ .../aux_/preprocessed/no_ctps/vector30_c.hpp | 238 + .../aux_/preprocessed/no_ctps/vector40.hpp | 2444 ++++++++ .../aux_/preprocessed/no_ctps/vector40_c.hpp | 281 + .../aux_/preprocessed/no_ctps/vector50.hpp | 2764 +++++++++ .../aux_/preprocessed/no_ctps/vector50_c.hpp | 325 ++ .../aux_/preprocessed/plain/vector10.hpp | 829 +++ .../aux_/preprocessed/plain/vector10_c.hpp | 149 + .../aux_/preprocessed/plain/vector20.hpp | 1144 ++++ .../aux_/preprocessed/plain/vector20_c.hpp | 195 + .../aux_/preprocessed/plain/vector30.hpp | 1464 +++++ .../aux_/preprocessed/plain/vector30_c.hpp | 238 + .../aux_/preprocessed/plain/vector40.hpp | 1784 ++++++ .../aux_/preprocessed/plain/vector40_c.hpp | 281 + .../aux_/preprocessed/plain/vector50.hpp | 2104 +++++++ .../aux_/preprocessed/plain/vector50_c.hpp | 325 ++ .../preprocessed/typeof_based/vector10.hpp | 139 + .../preprocessed/typeof_based/vector10_c.hpp | 154 + .../preprocessed/typeof_based/vector20.hpp | 159 + .../preprocessed/typeof_based/vector20_c.hpp | 163 + .../preprocessed/typeof_based/vector30.hpp | 179 + .../preprocessed/typeof_based/vector30_c.hpp | 173 + .../preprocessed/typeof_based/vector40.hpp | 199 + .../preprocessed/typeof_based/vector40_c.hpp | 183 + .../preprocessed/typeof_based/vector50.hpp | 219 + .../preprocessed/typeof_based/vector50_c.hpp | 193 + .../boost/mpl/vector/aux_/push_back.hpp | 40 + .../boost/mpl/vector/aux_/push_front.hpp | 40 + .../autoboost/boost/mpl/vector/aux_/size.hpp | 49 + .../autoboost/boost/mpl/vector/aux_/tag.hpp | 32 + .../boost/mpl/vector/aux_/vector0.hpp | 52 + .../autoboost/boost/mpl/vector/vector0.hpp | 34 + .../autoboost/boost/mpl/vector/vector0_c.hpp | 31 + .../autoboost/boost/mpl/vector/vector10.hpp | 45 + .../autoboost/boost/mpl/vector/vector10_c.hpp | 46 + .../autoboost/boost/mpl/vector/vector20.hpp | 45 + .../autoboost/boost/mpl/vector/vector20_c.hpp | 46 + .../autoboost/boost/mpl/vector/vector30.hpp | 45 + .../autoboost/boost/mpl/vector/vector30_c.hpp | 47 + .../autoboost/boost/mpl/vector/vector40.hpp | 45 + .../autoboost/boost/mpl/vector/vector40_c.hpp | 46 + .../autoboost/boost/mpl/vector/vector50.hpp | 45 + .../autoboost/boost/mpl/vector/vector50_c.hpp | 46 + contrib/autoboost/boost/mpl/void.hpp | 76 + contrib/autoboost/boost/mpl/void_fwd.hpp | 26 + contrib/autoboost/boost/next_prior.hpp | 165 + contrib/autoboost/boost/non_type.hpp | 27 + contrib/autoboost/boost/noncopyable.hpp | 17 + contrib/autoboost/boost/none.hpp | 28 + contrib/autoboost/boost/none_t.hpp | 24 + .../boost/numeric/conversion/bounds.hpp | 24 + .../boost/numeric/conversion/cast.hpp | 61 + .../numeric/conversion/conversion_traits.hpp | 39 + .../boost/numeric/conversion/converter.hpp | 68 + .../numeric/conversion/converter_policies.hpp | 194 + .../numeric/conversion/detail/bounds.hpp | 58 + .../conversion/detail/conversion_traits.hpp | 97 + .../numeric/conversion/detail/converter.hpp | 602 ++ .../conversion/detail/int_float_mixture.hpp | 72 + .../conversion/detail/is_subranged.hpp | 234 + .../boost/numeric/conversion/detail/meta.hpp | 120 + .../conversion/detail/numeric_cast_traits.hpp | 138 + .../conversion/detail/old_numeric_cast.hpp | 339 ++ .../numeric_cast_traits_common.hpp | 1741 ++++++ .../numeric_cast_traits_long_long.hpp | 347 ++ .../conversion/detail/sign_mixture.hpp | 72 + .../conversion/detail/udt_builtin_mixture.hpp | 69 + .../conversion/int_float_mixture_enum.hpp | 29 + .../conversion/numeric_cast_traits.hpp | 31 + .../numeric/conversion/sign_mixture_enum.hpp | 29 + .../conversion/udt_builtin_mixture_enum.hpp | 26 + contrib/autoboost/boost/operators.hpp | 948 +++ contrib/autoboost/boost/optional.hpp | 18 + .../boost/optional/bad_optional_access.hpp | 32 + contrib/autoboost/boost/optional/optional.hpp | 1512 +++++ .../autoboost/boost/optional/optional_fwd.hpp | 30 + contrib/autoboost/boost/pointee.hpp | 74 + contrib/autoboost/boost/predef.h | 19 + contrib/autoboost/boost/predef/architecture.h | 30 + .../boost/predef/architecture/alpha.h | 60 + .../autoboost/boost/predef/architecture/arm.h | 71 + .../boost/predef/architecture/blackfin.h | 47 + .../boost/predef/architecture/convex.h | 67 + .../boost/predef/architecture/ia64.h | 49 + .../boost/predef/architecture/m68k.h | 83 + .../boost/predef/architecture/mips.h | 74 + .../boost/predef/architecture/parisc.h | 65 + .../autoboost/boost/predef/architecture/ppc.h | 73 + .../boost/predef/architecture/pyramid.h | 43 + .../boost/predef/architecture/rs6k.h | 56 + .../boost/predef/architecture/sparc.h | 55 + .../boost/predef/architecture/superh.h | 68 + .../boost/predef/architecture/sys370.h | 44 + .../boost/predef/architecture/sys390.h | 44 + .../autoboost/boost/predef/architecture/x86.h | 38 + .../boost/predef/architecture/x86/32.h | 87 + .../boost/predef/architecture/x86/64.h | 50 + .../autoboost/boost/predef/architecture/z.h | 43 + contrib/autoboost/boost/predef/compiler.h | 41 + .../autoboost/boost/predef/compiler/borland.h | 64 + .../autoboost/boost/predef/compiler/clang.h | 57 + .../autoboost/boost/predef/compiler/comeau.h | 62 + .../autoboost/boost/predef/compiler/compaq.h | 67 + .../autoboost/boost/predef/compiler/diab.h | 57 + .../boost/predef/compiler/digitalmars.h | 57 + .../autoboost/boost/predef/compiler/dignus.h | 57 + contrib/autoboost/boost/predef/compiler/edg.h | 57 + .../autoboost/boost/predef/compiler/ekopath.h | 58 + contrib/autoboost/boost/predef/compiler/gcc.h | 69 + .../autoboost/boost/predef/compiler/gcc_xml.h | 53 + .../boost/predef/compiler/greenhills.h | 67 + .../autoboost/boost/predef/compiler/hp_acc.h | 62 + contrib/autoboost/boost/predef/compiler/iar.h | 57 + contrib/autoboost/boost/predef/compiler/ibm.h | 73 + .../autoboost/boost/predef/compiler/intel.h | 66 + contrib/autoboost/boost/predef/compiler/kai.h | 57 + .../autoboost/boost/predef/compiler/llvm.h | 58 + .../boost/predef/compiler/metaware.h | 54 + .../boost/predef/compiler/metrowerks.h | 78 + .../boost/predef/compiler/microtec.h | 54 + contrib/autoboost/boost/predef/compiler/mpw.h | 64 + .../autoboost/boost/predef/compiler/palm.h | 57 + contrib/autoboost/boost/predef/compiler/pgi.h | 61 + .../boost/predef/compiler/sgi_mipspro.h | 67 + .../autoboost/boost/predef/compiler/sunpro.h | 67 + .../autoboost/boost/predef/compiler/tendra.h | 54 + .../autoboost/boost/predef/compiler/visualc.h | 79 + .../autoboost/boost/predef/compiler/watcom.h | 57 + .../autoboost/boost/predef/detail/_cassert.h | 17 + .../boost/predef/detail/_exception.h | 15 + .../boost/predef/detail/comp_detected.h | 10 + .../boost/predef/detail/endian_compat.h | 26 + .../boost/predef/detail/os_detected.h | 10 + .../boost/predef/detail/platform_detected.h | 10 + contrib/autoboost/boost/predef/detail/test.h | 17 + contrib/autoboost/boost/predef/language.h | 15 + .../autoboost/boost/predef/language/objc.h | 43 + .../autoboost/boost/predef/language/stdc.h | 54 + .../autoboost/boost/predef/language/stdcpp.h | 124 + contrib/autoboost/boost/predef/library.h | 14 + contrib/autoboost/boost/predef/library/c.h | 18 + .../boost/predef/library/c/_prefix.h | 13 + .../autoboost/boost/predef/library/c/gnu.h | 62 + contrib/autoboost/boost/predef/library/c/uc.h | 48 + .../autoboost/boost/predef/library/c/vms.h | 48 + .../autoboost/boost/predef/library/c/zos.h | 57 + contrib/autoboost/boost/predef/library/std.h | 23 + .../boost/predef/library/std/_prefix.h | 23 + .../autoboost/boost/predef/library/std/cxx.h | 47 + .../boost/predef/library/std/dinkumware.h | 53 + .../boost/predef/library/std/libcomo.h | 48 + .../boost/predef/library/std/modena.h | 46 + .../autoboost/boost/predef/library/std/msl.h | 54 + .../boost/predef/library/std/roguewave.h | 57 + .../autoboost/boost/predef/library/std/sgi.h | 52 + .../boost/predef/library/std/stdcpp3.h | 54 + .../boost/predef/library/std/stlport.h | 60 + .../boost/predef/library/std/vacpp.h | 45 + contrib/autoboost/boost/predef/make.h | 87 + contrib/autoboost/boost/predef/os.h | 30 + contrib/autoboost/boost/predef/os/aix.h | 67 + contrib/autoboost/boost/predef/os/amigaos.h | 47 + contrib/autoboost/boost/predef/os/android.h | 46 + contrib/autoboost/boost/predef/os/beos.h | 46 + contrib/autoboost/boost/predef/os/bsd.h | 95 + contrib/autoboost/boost/predef/os/bsd/bsdi.h | 48 + .../autoboost/boost/predef/os/bsd/dragonfly.h | 50 + contrib/autoboost/boost/predef/os/bsd/free.h | 60 + contrib/autoboost/boost/predef/os/bsd/net.h | 84 + contrib/autoboost/boost/predef/os/bsd/open.h | 171 + contrib/autoboost/boost/predef/os/cygwin.h | 46 + contrib/autoboost/boost/predef/os/hpux.h | 48 + contrib/autoboost/boost/predef/os/ios.h | 51 + contrib/autoboost/boost/predef/os/irix.h | 47 + contrib/autoboost/boost/predef/os/linux.h | 47 + contrib/autoboost/boost/predef/os/macos.h | 66 + contrib/autoboost/boost/predef/os/os400.h | 46 + contrib/autoboost/boost/predef/os/qnxnto.h | 60 + contrib/autoboost/boost/predef/os/solaris.h | 47 + contrib/autoboost/boost/predef/os/unix.h | 76 + contrib/autoboost/boost/predef/os/vms.h | 53 + contrib/autoboost/boost/predef/os/windows.h | 51 + contrib/autoboost/boost/predef/other.h | 14 + contrib/autoboost/boost/predef/other/endian.h | 204 + contrib/autoboost/boost/predef/platform.h | 19 + .../autoboost/boost/predef/platform/mingw.h | 70 + .../boost/predef/platform/windows_desktop.h | 44 + .../boost/predef/platform/windows_phone.h | 42 + .../boost/predef/platform/windows_runtime.h | 44 + .../boost/predef/platform/windows_store.h | 42 + .../autoboost/boost/predef/version_number.h | 54 + .../boost/preprocessor/arithmetic/add.hpp | 51 + .../boost/preprocessor/arithmetic/dec.hpp | 288 + .../arithmetic/detail/div_base.hpp | 61 + .../boost/preprocessor/arithmetic/inc.hpp | 288 + .../boost/preprocessor/arithmetic/mod.hpp | 39 + .../boost/preprocessor/arithmetic/sub.hpp | 50 + .../boost/preprocessor/array/data.hpp | 28 + .../boost/preprocessor/array/elem.hpp | 29 + .../boost/preprocessor/array/size.hpp | 28 + contrib/autoboost/boost/preprocessor/cat.hpp | 35 + .../autoboost/boost/preprocessor/comma_if.hpp | 17 + .../boost/preprocessor/comparison/greater.hpp | 38 + .../boost/preprocessor/comparison/less.hpp | 46 + .../preprocessor/comparison/less_equal.hpp | 39 + .../preprocessor/comparison/not_equal.hpp | 814 +++ .../boost/preprocessor/config/config.hpp | 101 + .../boost/preprocessor/control/deduce_d.hpp | 22 + .../preprocessor/control/detail/dmc/while.hpp | 536 ++ .../preprocessor/control/detail/edg/while.hpp | 534 ++ .../control/detail/msvc/while.hpp | 277 + .../preprocessor/control/detail/while.hpp | 536 ++ .../boost/preprocessor/control/expr_if.hpp | 30 + .../boost/preprocessor/control/expr_iif.hpp | 31 + .../boost/preprocessor/control/if.hpp | 30 + .../boost/preprocessor/control/iif.hpp | 34 + .../boost/preprocessor/control/while.hpp | 312 + contrib/autoboost/boost/preprocessor/dec.hpp | 17 + .../boost/preprocessor/detail/auto_rec.hpp | 293 + .../boost/preprocessor/detail/check.hpp | 48 + .../preprocessor/detail/dmc/auto_rec.hpp | 286 + .../boost/preprocessor/detail/is_binary.hpp | 30 + .../boost/preprocessor/detail/is_unary.hpp | 30 + .../boost/preprocessor/detail/split.hpp | 35 + .../autoboost/boost/preprocessor/empty.hpp | 17 + contrib/autoboost/boost/preprocessor/enum.hpp | 17 + .../boost/preprocessor/enum_params.hpp | 17 + .../enum_params_with_a_default.hpp | 17 + .../enum_params_with_defaults.hpp | 17 + .../preprocessor/enum_shifted_params.hpp | 17 + .../autoboost/boost/preprocessor/expr_if.hpp | 17 + .../facilities/detail/is_empty.hpp | 55 + .../boost/preprocessor/facilities/empty.hpp | 23 + .../boost/preprocessor/facilities/expand.hpp | 28 + .../preprocessor/facilities/identity.hpp | 23 + .../preprocessor/facilities/intercept.hpp | 277 + .../boost/preprocessor/facilities/is_1.hpp | 23 + .../preprocessor/facilities/is_empty.hpp | 57 + .../facilities/is_empty_variadic.hpp | 57 + .../preprocessor/facilities/overload.hpp | 25 + .../autoboost/boost/preprocessor/identity.hpp | 17 + contrib/autoboost/boost/preprocessor/if.hpp | 17 + contrib/autoboost/boost/preprocessor/inc.hpp | 17 + .../autoboost/boost/preprocessor/iterate.hpp | 17 + .../iteration/detail/bounds/lower1.hpp | 99 + .../iteration/detail/bounds/lower2.hpp | 99 + .../iteration/detail/bounds/lower3.hpp | 99 + .../iteration/detail/bounds/lower4.hpp | 99 + .../iteration/detail/bounds/lower5.hpp | 99 + .../iteration/detail/bounds/upper1.hpp | 99 + .../iteration/detail/bounds/upper2.hpp | 99 + .../iteration/detail/bounds/upper3.hpp | 99 + .../iteration/detail/bounds/upper4.hpp | 99 + .../iteration/detail/bounds/upper5.hpp | 99 + .../preprocessor/iteration/detail/finish.hpp | 99 + .../iteration/detail/iter/forward1.hpp | 1342 +++++ .../iteration/detail/iter/forward2.hpp | 1338 +++++ .../iteration/detail/iter/forward3.hpp | 1338 +++++ .../iteration/detail/iter/forward4.hpp | 1338 +++++ .../iteration/detail/iter/forward5.hpp | 1338 +++++ .../iteration/detail/iter/reverse1.hpp | 1296 +++++ .../iteration/detail/iter/reverse2.hpp | 1296 +++++ .../iteration/detail/iter/reverse3.hpp | 1296 +++++ .../iteration/detail/iter/reverse4.hpp | 1296 +++++ .../iteration/detail/iter/reverse5.hpp | 1296 +++++ .../preprocessor/iteration/detail/local.hpp | 812 +++ .../preprocessor/iteration/detail/rlocal.hpp | 782 +++ .../preprocessor/iteration/detail/self.hpp | 21 + .../preprocessor/iteration/detail/start.hpp | 99 + .../boost/preprocessor/iteration/iterate.hpp | 82 + .../boost/preprocessor/iteration/local.hpp | 26 + .../boost/preprocessor/iteration/self.hpp | 19 + .../autoboost/boost/preprocessor/list/adt.hpp | 73 + .../boost/preprocessor/list/append.hpp | 40 + .../list/detail/dmc/fold_left.hpp | 279 + .../list/detail/edg/fold_left.hpp | 536 ++ .../list/detail/edg/fold_right.hpp | 794 +++ .../preprocessor/list/detail/fold_left.hpp | 279 + .../preprocessor/list/detail/fold_right.hpp | 277 + .../boost/preprocessor/list/fold_left.hpp | 303 + .../boost/preprocessor/list/fold_right.hpp | 40 + .../boost/preprocessor/list/for_each_i.hpp | 65 + .../boost/preprocessor/list/reverse.hpp | 40 + .../boost/preprocessor/list/transform.hpp | 49 + .../boost/preprocessor/logical/and.hpp | 30 + .../boost/preprocessor/logical/bitand.hpp | 38 + .../boost/preprocessor/logical/bitor.hpp | 38 + .../boost/preprocessor/logical/bool.hpp | 288 + .../boost/preprocessor/logical/compl.hpp | 36 + .../boost/preprocessor/logical/not.hpp | 30 + .../boost/preprocessor/logical/or.hpp | 30 + .../boost/preprocessor/punctuation/comma.hpp | 21 + .../preprocessor/punctuation/comma_if.hpp | 31 + .../punctuation/detail/is_begin_parens.hpp | 48 + .../punctuation/is_begin_parens.hpp | 51 + .../boost/preprocessor/punctuation/paren.hpp | 23 + .../preprocessor/punctuation/paren_if.hpp | 38 + .../autoboost/boost/preprocessor/repeat.hpp | 17 + .../boost/preprocessor/repeat_2nd.hpp | 17 + .../boost/preprocessor/repeat_from_to.hpp | 17 + .../repetition/detail/dmc/for.hpp | 536 ++ .../repetition/detail/edg/for.hpp | 534 ++ .../preprocessor/repetition/detail/for.hpp | 536 ++ .../repetition/detail/msvc/for.hpp | 277 + .../boost/preprocessor/repetition/enum.hpp | 66 + .../repetition/enum_binary_params.hpp | 54 + .../preprocessor/repetition/enum_params.hpp | 41 + .../repetition/enum_params_with_a_default.hpp | 25 + .../repetition/enum_params_with_defaults.hpp | 24 + .../repetition/enum_shifted_params.hpp | 44 + .../preprocessor/repetition/enum_trailing.hpp | 63 + .../repetition/enum_trailing_params.hpp | 38 + .../boost/preprocessor/repetition/for.hpp | 306 + .../boost/preprocessor/repetition/repeat.hpp | 825 +++ .../repetition/repeat_from_to.hpp | 87 + .../autoboost/boost/preprocessor/seq/cat.hpp | 49 + .../boost/preprocessor/seq/detail/split.hpp | 284 + .../autoboost/boost/preprocessor/seq/elem.hpp | 304 + .../autoboost/boost/preprocessor/seq/enum.hpp | 288 + .../boost/preprocessor/seq/first_n.hpp | 30 + .../boost/preprocessor/seq/fold_left.hpp | 1070 ++++ .../boost/preprocessor/seq/for_each.hpp | 60 + .../boost/preprocessor/seq/for_each_i.hpp | 61 + .../boost/preprocessor/seq/rest_n.hpp | 30 + .../autoboost/boost/preprocessor/seq/seq.hpp | 44 + .../autoboost/boost/preprocessor/seq/size.hpp | 547 ++ .../boost/preprocessor/seq/subseq.hpp | 28 + .../boost/preprocessor/seq/transform.hpp | 48 + .../preprocessor/slot/detail/counter.hpp | 269 + .../boost/preprocessor/slot/detail/def.hpp | 49 + .../boost/preprocessor/slot/detail/shared.hpp | 247 + .../boost/preprocessor/slot/detail/slot1.hpp | 267 + .../boost/preprocessor/slot/detail/slot2.hpp | 267 + .../boost/preprocessor/slot/detail/slot3.hpp | 267 + .../boost/preprocessor/slot/detail/slot4.hpp | 267 + .../boost/preprocessor/slot/detail/slot5.hpp | 267 + .../boost/preprocessor/slot/slot.hpp | 32 + .../boost/preprocessor/stringize.hpp | 33 + .../tuple/detail/is_single_return.hpp | 28 + .../boost/preprocessor/tuple/eat.hpp | 106 + .../boost/preprocessor/tuple/elem.hpp | 201 + .../boost/preprocessor/tuple/rem.hpp | 149 + .../boost/preprocessor/tuple/size.hpp | 28 + .../boost/preprocessor/tuple/to_list.hpp | 118 + .../boost/preprocessor/variadic/elem.hpp | 94 + .../boost/preprocessor/variadic/size.hpp | 30 + contrib/autoboost/boost/progress.hpp | 143 + contrib/autoboost/boost/range.hpp | 23 + .../autoboost/boost/range/algorithm/equal.hpp | 200 + contrib/autoboost/boost/range/as_literal.hpp | 127 + contrib/autoboost/boost/range/begin.hpp | 135 + contrib/autoboost/boost/range/category.hpp | 29 + contrib/autoboost/boost/range/concepts.hpp | 386 ++ contrib/autoboost/boost/range/config.hpp | 56 + .../autoboost/boost/range/const_iterator.hpp | 76 + .../boost/range/const_reverse_iterator.hpp | 35 + .../boost/range/detail/as_literal.hpp | 33 + .../autoboost/boost/range/detail/begin.hpp | 83 + .../autoboost/boost/range/detail/common.hpp | 117 + .../boost/range/detail/detail_str.hpp | 376 ++ contrib/autoboost/boost/range/detail/end.hpp | 86 + .../range/detail/extract_optional_type.hpp | 48 + .../boost/range/detail/has_member_size.hpp | 66 + .../range/detail/implementation_help.hpp | 114 + .../boost/range/detail/misc_concept.hpp | 33 + .../detail/msvc_has_iterator_workaround.hpp | 132 + .../boost/range/detail/remove_extent.hpp | 157 + .../boost/range/detail/safe_bool.hpp | 72 + .../autoboost/boost/range/detail/sfinae.hpp | 77 + .../boost/range/detail/size_type.hpp | 55 + .../boost/range/detail/str_types.hpp | 38 + .../boost/range/detail/value_type.hpp | 72 + .../autoboost/boost/range/difference_type.hpp | 35 + contrib/autoboost/boost/range/distance.hpp | 34 + contrib/autoboost/boost/range/empty.hpp | 34 + contrib/autoboost/boost/range/end.hpp | 128 + contrib/autoboost/boost/range/functions.hpp | 27 + .../boost/range/has_range_iterator.hpp | 83 + contrib/autoboost/boost/range/iterator.hpp | 76 + .../autoboost/boost/range/iterator_range.hpp | 16 + .../boost/range/iterator_range_core.hpp | 869 +++ .../boost/range/iterator_range_io.hpp | 93 + .../autoboost/boost/range/metafunctions.hpp | 31 + .../boost/range/mutable_iterator.hpp | 79 + contrib/autoboost/boost/range/pointer.hpp | 30 + contrib/autoboost/boost/range/range_fwd.hpp | 63 + contrib/autoboost/boost/range/rbegin.hpp | 65 + contrib/autoboost/boost/range/reference.hpp | 29 + contrib/autoboost/boost/range/rend.hpp | 65 + .../autoboost/boost/range/result_iterator.hpp | 33 + .../boost/range/reverse_iterator.hpp | 42 + .../boost/range/reverse_result_iterator.hpp | 32 + contrib/autoboost/boost/range/size.hpp | 67 + contrib/autoboost/boost/range/size_type.hpp | 98 + contrib/autoboost/boost/range/sub_range.hpp | 287 + contrib/autoboost/boost/range/value_type.hpp | 30 + contrib/autoboost/boost/ratio/config.hpp | 92 + .../autoboost/boost/ratio/detail/mpl/abs.hpp | 89 + .../autoboost/boost/ratio/detail/mpl/gcd.hpp | 124 + .../autoboost/boost/ratio/detail/mpl/lcm.hpp | 126 + .../autoboost/boost/ratio/detail/mpl/sign.hpp | 89 + .../boost/ratio/detail/overflow_helpers.hpp | 367 ++ .../boost/ratio/mpl/rational_c_tag.hpp | 25 + contrib/autoboost/boost/ratio/ratio.hpp | 293 + contrib/autoboost/boost/ratio/ratio_fwd.hpp | 105 + contrib/autoboost/boost/rational.hpp | 611 ++ contrib/autoboost/boost/ref.hpp | 17 + contrib/autoboost/boost/regex.hpp | 37 + contrib/autoboost/boost/regex/config.hpp | 435 ++ .../autoboost/boost/regex/config/borland.hpp | 72 + .../autoboost/boost/regex/config/cwchar.hpp | 207 + contrib/autoboost/boost/regex/icu.hpp | 1022 ++++ .../autoboost/boost/regex/pattern_except.hpp | 100 + .../boost/regex/pending/object_cache.hpp | 165 + .../boost/regex/pending/static_mutex.hpp | 182 + .../boost/regex/pending/unicode_iterator.hpp | 782 +++ .../autoboost/boost/regex/regex_traits.hpp | 35 + contrib/autoboost/boost/regex/user.hpp | 93 + .../autoboost/boost/regex/v4/basic_regex.hpp | 780 +++ .../boost/regex/v4/basic_regex_creator.hpp | 1552 +++++ .../boost/regex/v4/basic_regex_parser.hpp | 2879 +++++++++ .../boost/regex/v4/c_regex_traits.hpp | 211 + .../boost/regex/v4/char_regex_traits.hpp | 81 + .../boost/regex/v4/cpp_regex_traits.hpp | 1141 ++++ contrib/autoboost/boost/regex/v4/cregex.hpp | 330 ++ .../autoboost/boost/regex/v4/error_type.hpp | 59 + contrib/autoboost/boost/regex/v4/fileiter.hpp | 455 ++ .../autoboost/boost/regex/v4/instances.hpp | 218 + .../boost/regex/v4/iterator_category.hpp | 91 + .../boost/regex/v4/iterator_traits.hpp | 135 + .../autoboost/boost/regex/v4/match_flags.hpp | 138 + .../boost/regex/v4/match_results.hpp | 702 +++ .../boost/regex/v4/mem_block_cache.hpp | 99 + .../autoboost/boost/regex/v4/perl_matcher.hpp | 583 ++ .../boost/regex/v4/perl_matcher_common.hpp | 992 ++++ .../regex/v4/perl_matcher_non_recursive.hpp | 1660 ++++++ .../boost/regex/v4/perl_matcher_recursive.hpp | 1003 ++++ .../boost/regex/v4/primary_transform.hpp | 146 + .../boost/regex/v4/protected_call.hpp | 81 + contrib/autoboost/boost/regex/v4/regbase.hpp | 180 + contrib/autoboost/boost/regex/v4/regex.hpp | 202 + .../autoboost/boost/regex/v4/regex_format.hpp | 1156 ++++ .../autoboost/boost/regex/v4/regex_fwd.hpp | 73 + .../autoboost/boost/regex/v4/regex_grep.hpp | 155 + .../boost/regex/v4/regex_iterator.hpp | 201 + .../autoboost/boost/regex/v4/regex_match.hpp | 382 ++ .../autoboost/boost/regex/v4/regex_merge.hpp | 93 + .../boost/regex/v4/regex_raw_buffer.hpp | 210 + .../boost/regex/v4/regex_replace.hpp | 99 + .../autoboost/boost/regex/v4/regex_search.hpp | 217 + .../autoboost/boost/regex/v4/regex_split.hpp | 172 + .../boost/regex/v4/regex_token_iterator.hpp | 333 ++ .../autoboost/boost/regex/v4/regex_traits.hpp | 189 + .../boost/regex/v4/regex_traits_defaults.hpp | 371 ++ .../boost/regex/v4/regex_workaround.hpp | 232 + contrib/autoboost/boost/regex/v4/states.hpp | 301 + .../autoboost/boost/regex/v4/sub_match.hpp | 511 ++ .../autoboost/boost/regex/v4/syntax_type.hpp | 105 + .../boost/regex/v4/u32regex_iterator.hpp | 193 + .../regex/v4/u32regex_token_iterator.hpp | 368 ++ .../boost/regex/v4/w32_regex_traits.hpp | 739 +++ contrib/autoboost/boost/regex_fwd.hpp | 33 + contrib/autoboost/boost/scoped_array.hpp | 16 + contrib/autoboost/boost/scoped_ptr.hpp | 16 + .../autoboost/boost/serialization/access.hpp | 147 + .../autoboost/boost/serialization/array.hpp | 171 + .../boost/serialization/assume_abstract.hpp | 59 + .../boost/serialization/base_object.hpp | 112 + .../serialization/collection_size_type.hpp | 62 + .../boost/serialization/collection_traits.hpp | 79 + .../serialization/collections_load_imp.hpp | 166 + .../serialization/collections_save_imp.hpp | 82 + .../autoboost/boost/serialization/config.hpp | 85 + .../boost/serialization/detail/get_data.hpp | 61 + .../detail/stack_constructor.hpp | 69 + .../serialization/extended_type_info.hpp | 120 + .../extended_type_info_no_rtti.hpp | 182 + .../extended_type_info_typeid.hpp | 165 + .../autoboost/boost/serialization/factory.hpp | 101 + .../boost/serialization/force_include.hpp | 59 + .../serialization/is_bitwise_serializable.hpp | 46 + .../boost/serialization/item_version_type.hpp | 68 + .../autoboost/boost/serialization/level.hpp | 124 + .../boost/serialization/level_enum.hpp | 55 + contrib/autoboost/boost/serialization/nvp.hpp | 138 + .../autoboost/boost/serialization/pfto.hpp | 78 + .../boost/serialization/serialization.hpp | 167 + .../boost/serialization/shared_ptr_helper.hpp | 211 + .../boost/serialization/singleton.hpp | 158 + .../boost/serialization/smart_cast.hpp | 303 + .../boost/serialization/split_free.hpp | 93 + .../boost/serialization/split_member.hpp | 86 + .../boost/serialization/state_saver.hpp | 96 + .../boost/serialization/static_warning.hpp | 108 + .../autoboost/boost/serialization/string.hpp | 91 + .../boost/serialization/strong_typedef.hpp | 66 + .../boost/serialization/throw_exception.hpp | 44 + .../boost/serialization/tracking.hpp | 118 + .../boost/serialization/tracking_enum.hpp | 41 + .../autoboost/boost/serialization/traits.hpp | 65 + .../type_info_implementation.hpp | 86 + .../autoboost/boost/serialization/vector.hpp | 216 + .../autoboost/boost/serialization/version.hpp | 107 + .../boost/serialization/void_cast.hpp | 298 + .../boost/serialization/void_cast_fwd.hpp | 37 + .../autoboost/boost/serialization/wrapper.hpp | 60 + contrib/autoboost/boost/shared_array.hpp | 19 + contrib/autoboost/boost/shared_ptr.hpp | 19 + contrib/autoboost/boost/smart_ptr.hpp | 31 + .../boost/smart_ptr/allocate_shared_array.hpp | 181 + .../boost/smart_ptr/bad_weak_ptr.hpp | 59 + .../smart_ptr/detail/array_allocator.hpp | 318 + .../smart_ptr/detail/array_count_impl.hpp | 67 + .../boost/smart_ptr/detail/array_traits.hpp | 60 + .../boost/smart_ptr/detail/array_utility.hpp | 214 + .../boost/smart_ptr/detail/atomic_count.hpp | 96 + .../smart_ptr/detail/atomic_count_gcc.hpp | 72 + .../smart_ptr/detail/atomic_count_gcc_x86.hpp | 77 + .../smart_ptr/detail/atomic_count_nt.hpp | 59 + .../smart_ptr/detail/atomic_count_pt.hpp | 97 + .../smart_ptr/detail/atomic_count_spin.hpp | 62 + .../detail/atomic_count_std_atomic.hpp | 60 + .../smart_ptr/detail/atomic_count_sync.hpp | 61 + .../smart_ptr/detail/atomic_count_win32.hpp | 63 + .../smart_ptr/detail/lightweight_mutex.hpp | 42 + .../boost/smart_ptr/detail/lwm_nop.hpp | 37 + .../boost/smart_ptr/detail/lwm_pthreads.hpp | 87 + .../boost/smart_ptr/detail/lwm_win32_cs.hpp | 119 + .../boost/smart_ptr/detail/operator_bool.hpp | 63 + .../smart_ptr/detail/quick_allocator.hpp | 199 + .../boost/smart_ptr/detail/shared_count.hpp | 675 +++ .../boost/smart_ptr/detail/sp_convertible.hpp | 91 + .../smart_ptr/detail/sp_counted_base.hpp | 82 + .../detail/sp_counted_base_acc_ia64.hpp | 151 + .../smart_ptr/detail/sp_counted_base_aix.hpp | 143 + .../detail/sp_counted_base_cw_ppc.hpp | 171 + .../detail/sp_counted_base_gcc_ia64.hpp | 158 + .../detail/sp_counted_base_gcc_mips.hpp | 182 + .../detail/sp_counted_base_gcc_ppc.hpp | 182 + .../detail/sp_counted_base_gcc_sparc.hpp | 167 + .../detail/sp_counted_base_gcc_x86.hpp | 174 + .../smart_ptr/detail/sp_counted_base_nt.hpp | 108 + .../smart_ptr/detail/sp_counted_base_pt.hpp | 137 + .../detail/sp_counted_base_snc_ps3.hpp | 162 + .../smart_ptr/detail/sp_counted_base_spin.hpp | 132 + .../detail/sp_counted_base_std_atomic.hpp | 137 + .../smart_ptr/detail/sp_counted_base_sync.hpp | 156 + .../detail/sp_counted_base_vacpp_ppc.hpp | 151 + .../smart_ptr/detail/sp_counted_base_w32.hpp | 131 + .../smart_ptr/detail/sp_counted_impl.hpp | 271 + .../boost/smart_ptr/detail/sp_forward.hpp | 52 + .../boost/smart_ptr/detail/sp_has_sync.hpp | 69 + .../boost/smart_ptr/detail/sp_if_array.hpp | 34 + .../boost/smart_ptr/detail/sp_interlocked.hpp | 152 + .../boost/smart_ptr/detail/sp_nullptr_t.hpp | 45 + .../boost/smart_ptr/detail/spinlock.hpp | 65 + .../smart_ptr/detail/spinlock_gcc_arm.hpp | 120 + .../boost/smart_ptr/detail/spinlock_nt.hpp | 89 + .../boost/smart_ptr/detail/spinlock_pool.hpp | 91 + .../boost/smart_ptr/detail/spinlock_pt.hpp | 79 + .../smart_ptr/detail/spinlock_std_atomic.hpp | 83 + .../boost/smart_ptr/detail/spinlock_sync.hpp | 87 + .../boost/smart_ptr/detail/spinlock_w32.hpp | 113 + .../boost/smart_ptr/detail/yield_k.hpp | 168 + .../smart_ptr/enable_shared_from_this.hpp | 79 + .../boost/smart_ptr/intrusive_ptr.hpp | 336 ++ .../autoboost/boost/smart_ptr/make_shared.hpp | 22 + .../boost/smart_ptr/make_shared_array.hpp | 158 + .../boost/smart_ptr/make_shared_object.hpp | 1131 ++++ .../boost/smart_ptr/scoped_array.hpp | 132 + .../autoboost/boost/smart_ptr/scoped_ptr.hpp | 157 + .../boost/smart_ptr/shared_array.hpp | 292 + .../autoboost/boost/smart_ptr/shared_ptr.hpp | 1028 ++++ .../autoboost/boost/smart_ptr/weak_ptr.hpp | 253 + .../boost/spirit/home/classic/core/assert.hpp | 38 + .../home/classic/core/composite/actions.hpp | 136 + .../classic/core/composite/alternative.hpp | 147 + .../home/classic/core/composite/composite.hpp | 151 + .../classic/core/composite/difference.hpp | 150 + .../classic/core/composite/directives.hpp | 607 ++ .../classic/core/composite/exclusive_or.hpp | 142 + .../core/composite/impl/alternative.ipp | 90 + .../core/composite/impl/difference.ipp | 90 + .../core/composite/impl/directives.ipp | 210 + .../core/composite/impl/exclusive_or.ipp | 90 + .../core/composite/impl/intersection.ipp | 90 + .../core/composite/impl/kleene_star.ipp | 34 + .../home/classic/core/composite/impl/list.ipp | 93 + .../classic/core/composite/impl/optional.ipp | 34 + .../classic/core/composite/impl/positive.ipp | 34 + .../classic/core/composite/impl/sequence.ipp | 90 + .../core/composite/impl/sequential_and.ipp | 90 + .../core/composite/impl/sequential_or.ipp | 90 + .../classic/core/composite/intersection.hpp | 142 + .../classic/core/composite/kleene_star.hpp | 109 + .../home/classic/core/composite/list.hpp | 73 + .../home/classic/core/composite/operators.hpp | 25 + .../home/classic/core/composite/optional.hpp | 94 + .../home/classic/core/composite/positive.hpp | 112 + .../home/classic/core/composite/sequence.hpp | 142 + .../classic/core/composite/sequential_and.hpp | 76 + .../classic/core/composite/sequential_or.hpp | 154 + .../boost/spirit/home/classic/core/config.hpp | 62 + .../spirit/home/classic/core/impl/match.ipp | 113 + .../classic/core/impl/match_attr_traits.ipp | 102 + .../spirit/home/classic/core/impl/parser.ipp | 55 + .../boost/spirit/home/classic/core/match.hpp | 185 + .../boost/spirit/home/classic/core/nil.hpp | 25 + .../classic/core/non_terminal/impl/rule.ipp | 420 ++ .../core/non_terminal/parser_context.hpp | 150 + .../classic/core/non_terminal/parser_id.hpp | 122 + .../home/classic/core/non_terminal/rule.hpp | 175 + .../boost/spirit/home/classic/core/parser.hpp | 223 + .../classic/core/primitives/impl/numerics.ipp | 478 ++ .../core/primitives/impl/primitives.ipp | 390 ++ .../home/classic/core/primitives/numerics.hpp | 289 + .../classic/core/primitives/numerics_fwd.hpp | 88 + .../classic/core/primitives/primitives.hpp | 654 +++ .../spirit/home/classic/core/safe_bool.hpp | 64 + .../classic/core/scanner/impl/skipper.ipp | 181 + .../home/classic/core/scanner/scanner.hpp | 329 ++ .../home/classic/core/scanner/scanner_fwd.hpp | 52 + .../home/classic/core/scanner/skipper.hpp | 197 + .../home/classic/core/scanner/skipper_fwd.hpp | 32 + .../boost/spirit/home/classic/debug.hpp | 154 + .../spirit/home/classic/meta/as_parser.hpp | 113 + .../boost/spirit/home/classic/namespace.hpp | 35 + .../spirit/home/classic/utility/chset.hpp | 187 + .../home/classic/utility/chset_operators.hpp | 402 ++ .../home/classic/utility/impl/chset.ipp | 322 + .../utility/impl/chset/basic_chset.hpp | 107 + .../utility/impl/chset/basic_chset.ipp | 246 + .../classic/utility/impl/chset/range_run.hpp | 127 + .../classic/utility/impl/chset/range_run.ipp | 218 + .../classic/utility/impl/chset_operators.ipp | 592 ++ .../boost/spirit/home/classic/version.hpp | 30 + .../boost/spirit/include/classic_actions.hpp | 12 + .../boost/spirit/include/classic_chset.hpp | 12 + .../boost/spirit/include/classic_numerics.hpp | 12 + .../spirit/include/classic_operators.hpp | 12 + .../boost/spirit/include/classic_rule.hpp | 12 + contrib/autoboost/boost/static_assert.hpp | 195 + contrib/autoboost/boost/swap.hpp | 17 + contrib/autoboost/boost/system/api_config.hpp | 42 + contrib/autoboost/boost/system/config.hpp | 70 + .../autoboost/boost/system/cygwin_error.hpp | 56 + .../boost/system/detail/error_code.ipp | 467 ++ .../detail/local_free_on_destruction.hpp | 40 + contrib/autoboost/boost/system/error_code.hpp | 520 ++ .../autoboost/boost/system/linux_error.hpp | 110 + .../autoboost/boost/system/system_error.hpp | 84 + .../autoboost/boost/system/windows_error.hpp | 126 + contrib/autoboost/boost/test/debug.hpp | 101 + contrib/autoboost/boost/test/debug_config.hpp | 24 + .../autoboost/boost/test/detail/config.hpp | 104 + .../boost/test/detail/enable_warnings.hpp | 30 + .../autoboost/boost/test/detail/fwd_decl.hpp | 48 + .../boost/test/detail/global_typedef.hpp | 88 + .../autoboost/boost/test/detail/log_level.hpp | 43 + .../boost/test/detail/suppress_warnings.hpp | 31 + .../test/detail/unit_test_parameters.hpp | 69 + .../boost/test/detail/workaround.hpp | 65 + .../boost/test/execution_monitor.hpp | 263 + .../boost/test/floating_point_comparison.hpp | 286 + contrib/autoboost/boost/test/framework.hpp | 112 + .../test/impl/compiler_log_formatter.ipp | 222 + .../autoboost/boost/test/impl/cpp_main.ipp | 139 + contrib/autoboost/boost/test/impl/debug.ipp | 970 +++ .../boost/test/impl/exception_safety.ipp | 537 ++ .../boost/test/impl/execution_monitor.ipp | 1367 +++++ .../autoboost/boost/test/impl/framework.ipp | 503 ++ .../boost/test/impl/interaction_based.ipp | 90 + .../boost/test/impl/logged_expectations.ipp | 246 + .../test/impl/plain_report_formatter.ipp | 198 + .../boost/test/impl/progress_monitor.ipp | 110 + .../boost/test/impl/results_collector.ipp | 294 + .../boost/test/impl/results_reporter.ipp | 202 + .../autoboost/boost/test/impl/test_main.ipp | 68 + .../autoboost/boost/test/impl/test_tools.ipp | 628 ++ .../boost/test/impl/unit_test_log.ipp | 444 ++ .../boost/test/impl/unit_test_main.ipp | 246 + .../boost/test/impl/unit_test_monitor.ipp | 101 + .../boost/test/impl/unit_test_parameters.ipp | 527 ++ .../boost/test/impl/unit_test_suite.ipp | 346 ++ .../boost/test/impl/xml_log_formatter.ipp | 180 + .../boost/test/impl/xml_report_formatter.ipp | 115 + .../boost/test/interaction_based.hpp | 262 + contrib/autoboost/boost/test/mock_object.hpp | 328 ++ .../test/output/compiler_log_formatter.hpp | 68 + .../test/output/plain_report_formatter.hpp | 62 + .../boost/test/output/xml_log_formatter.hpp | 72 + .../test/output/xml_report_formatter.hpp | 58 + .../boost/test/output_test_stream.hpp | 78 + .../autoboost/boost/test/predicate_result.hpp | 88 + .../autoboost/boost/test/progress_monitor.hpp | 70 + .../boost/test/results_collector.hpp | 112 + .../autoboost/boost/test/results_reporter.hpp | 88 + .../autoboost/boost/test/test_observer.hpp | 65 + contrib/autoboost/boost/test/test_tools.hpp | 719 +++ contrib/autoboost/boost/test/unit_test.hpp | 66 + .../autoboost/boost/test/unit_test_log.hpp | 177 + .../boost/test/unit_test_log_formatter.hpp | 123 + .../boost/test/unit_test_monitor.hpp | 69 + .../autoboost/boost/test/unit_test_suite.hpp | 245 + .../boost/test/unit_test_suite_impl.hpp | 434 ++ .../autoboost/boost/test/utils/algorithm.hpp | 228 + .../autoboost/boost/test/utils/assign_op.hpp | 41 + .../utils/basic_cstring/basic_cstring.hpp | 731 +++ .../utils/basic_cstring/basic_cstring_fwd.hpp | 40 + .../utils/basic_cstring/bcs_char_traits.hpp | 150 + .../test/utils/basic_cstring/compare.hpp | 115 + .../boost/test/utils/basic_cstring/io.hpp | 73 + .../autoboost/boost/test/utils/callback.hpp | 310 + .../boost/test/utils/class_properties.hpp | 221 + .../boost/test/utils/custom_manip.hpp | 63 + .../boost/test/utils/fixed_mapping.hpp | 124 + .../autoboost/boost/test/utils/foreach.hpp | 281 + .../utils/iterator/input_iterator_facade.hpp | 109 + .../test/utils/iterator/token_iterator.hpp | 418 ++ .../boost/test/utils/lazy_ostream.hpp | 114 + .../boost/test/utils/named_params.hpp | 329 ++ contrib/autoboost/boost/test/utils/rtti.hpp | 64 + .../boost/test/utils/runtime/argument.hpp | 112 + .../utils/runtime/cla/argument_factory.hpp | 218 + .../test/utils/runtime/cla/argv_traverser.hpp | 98 + .../test/utils/runtime/cla/argv_traverser.ipp | 209 + .../utils/runtime/cla/basic_parameter.hpp | 85 + .../test/utils/runtime/cla/char_parameter.hpp | 98 + .../test/utils/runtime/cla/char_parameter.ipp | 57 + .../cla/detail/argument_value_usage.hpp | 82 + .../utils/runtime/cla/dual_name_parameter.hpp | 96 + .../utils/runtime/cla/dual_name_parameter.ipp | 90 + .../boost/test/utils/runtime/cla/fwd.hpp | 55 + .../test/utils/runtime/cla/id_policy.hpp | 145 + .../test/utils/runtime/cla/id_policy.ipp | 118 + .../runtime/cla/iface/argument_factory.hpp | 51 + .../utils/runtime/cla/iface/id_policy.hpp | 73 + .../boost/test/utils/runtime/cla/modifier.hpp | 69 + .../utils/runtime/cla/named_parameter.hpp | 93 + .../utils/runtime/cla/named_parameter.ipp | 129 + .../test/utils/runtime/cla/parameter.hpp | 150 + .../boost/test/utils/runtime/cla/parser.hpp | 153 + .../boost/test/utils/runtime/cla/parser.ipp | 258 + .../utils/runtime/cla/typed_parameter.hpp | 70 + .../test/utils/runtime/cla/validation.hpp | 55 + .../test/utils/runtime/cla/validation.ipp | 65 + .../utils/runtime/cla/value_generator.hpp | 81 + .../test/utils/runtime/cla/value_handler.hpp | 57 + .../boost/test/utils/runtime/config.hpp | 156 + .../test/utils/runtime/env/environment.hpp | 172 + .../test/utils/runtime/env/environment.ipp | 125 + .../boost/test/utils/runtime/env/fwd.hpp | 54 + .../boost/test/utils/runtime/env/modifier.hpp | 47 + .../boost/test/utils/runtime/env/variable.hpp | 223 + .../boost/test/utils/runtime/fwd.hpp | 41 + .../runtime/interpret_argument_value.hpp | 163 + .../boost/test/utils/runtime/parameter.hpp | 38 + .../boost/test/utils/runtime/trace.hpp | 30 + .../boost/test/utils/runtime/validation.hpp | 82 + .../boost/test/utils/trivial_singleton.hpp | 74 + .../boost/test/utils/wrap_stringstream.hpp | 164 + .../boost/test/utils/xml_printer.hpp | 118 + contrib/autoboost/boost/thread.hpp | 26 + contrib/autoboost/boost/thread/barrier.hpp | 254 + .../boost/thread/condition_variable.hpp | 21 + .../thread/csbl/memory/allocator_arg.hpp | 41 + .../thread/csbl/memory/allocator_traits.hpp | 35 + .../boost/thread/csbl/memory/config.hpp | 16 + .../thread/csbl/memory/pointer_traits.hpp | 35 + .../thread/csbl/memory/scoped_allocator.hpp | 35 + .../boost/thread/csbl/memory/shared_ptr.hpp | 42 + .../boost/thread/csbl/memory/unique_ptr.hpp | 28 + contrib/autoboost/boost/thread/csbl/tuple.hpp | 49 + .../autoboost/boost/thread/csbl/vector.hpp | 35 + contrib/autoboost/boost/thread/cv_status.hpp | 26 + .../autoboost/boost/thread/detail/config.hpp | 465 ++ .../autoboost/boost/thread/detail/delete.hpp | 58 + .../autoboost/boost/thread/detail/invoke.hpp | 1604 +++++ .../autoboost/boost/thread/detail/invoker.hpp | 754 +++ .../boost/thread/detail/is_convertible.hpp | 49 + .../boost/thread/detail/lockable_wrapper.hpp | 45 + .../thread/detail/make_tuple_indices.hpp | 224 + .../autoboost/boost/thread/detail/memory.hpp | 48 + .../autoboost/boost/thread/detail/move.hpp | 355 ++ .../boost/thread/detail/nullary_function.hpp | 234 + .../boost/thread/detail/platform.hpp | 73 + .../autoboost/boost/thread/detail/thread.hpp | 872 +++ .../boost/thread/detail/thread_group.hpp | 154 + .../boost/thread/detail/thread_heap_alloc.hpp | 23 + .../thread/detail/thread_interruption.hpp | 39 + .../boost/thread/detail/tss_hooks.hpp | 65 + .../boost/thread/detail/variadic_footer.hpp | 10 + .../boost/thread/detail/variadic_header.hpp | 19 + .../boost/thread/exceptional_ptr.hpp | 44 + contrib/autoboost/boost/thread/exceptions.hpp | 225 + contrib/autoboost/boost/thread/future.hpp | 5184 +++++++++++++++++ .../boost/thread/future_error_code.hpp | 61 + .../boost/thread/is_locked_by_this_thread.hpp | 39 + .../boost/thread/lock_algorithms.hpp | 468 ++ contrib/autoboost/boost/thread/lock_guard.hpp | 88 + .../autoboost/boost/thread/lock_options.hpp | 31 + contrib/autoboost/boost/thread/lock_types.hpp | 1230 ++++ .../boost/thread/lockable_traits.hpp | 207 + contrib/autoboost/boost/thread/locks.hpp | 16 + contrib/autoboost/boost/thread/mutex.hpp | 53 + contrib/autoboost/boost/thread/once.hpp | 44 + .../thread/pthread/condition_variable.hpp | 383 ++ .../thread/pthread/condition_variable_fwd.hpp | 266 + .../autoboost/boost/thread/pthread/mutex.hpp | 357 ++ .../autoboost/boost/thread/pthread/once.hpp | 540 ++ .../boost/thread/pthread/once_atomic.hpp | 313 + .../pthread/pthread_mutex_scoped_lock.hpp | 64 + .../boost/thread/pthread/recursive_mutex.hpp | 401 ++ .../boost/thread/pthread/shared_mutex.hpp | 716 +++ .../boost/thread/pthread/thread_data.hpp | 283 + .../thread/pthread/thread_heap_alloc.hpp | 242 + .../boost/thread/pthread/timespec.hpp | 120 + .../boost/thread/recursive_mutex.hpp | 64 + .../autoboost/boost/thread/shared_mutex.hpp | 49 + contrib/autoboost/boost/thread/thread.hpp | 16 + .../autoboost/boost/thread/thread_only.hpp | 29 + .../autoboost/boost/thread/thread_time.hpp | 55 + contrib/autoboost/boost/thread/tss.hpp | 113 + contrib/autoboost/boost/thread/v2/thread.hpp | 142 + contrib/autoboost/boost/thread/xtime.hpp | 93 + contrib/autoboost/boost/throw_exception.hpp | 102 + contrib/autoboost/boost/timer.hpp | 72 + contrib/autoboost/boost/token_functions.hpp | 650 +++ contrib/autoboost/boost/token_iterator.hpp | 128 + contrib/autoboost/boost/tokenizer.hpp | 98 + .../boost/tuple/detail/tuple_basic.hpp | 989 ++++ contrib/autoboost/boost/tuple/tuple.hpp | 67 + contrib/autoboost/boost/type.hpp | 18 + .../autoboost/boost/type_traits/add_const.hpp | 45 + .../autoboost/boost/type_traits/add_cv.hpp | 46 + .../type_traits/add_lvalue_reference.hpp | 26 + .../boost/type_traits/add_pointer.hpp | 72 + .../boost/type_traits/add_reference.hpp | 72 + .../type_traits/add_rvalue_reference.hpp | 66 + .../boost/type_traits/add_volatile.hpp | 45 + .../boost/type_traits/alignment_of.hpp | 126 + .../boost/type_traits/common_type.hpp | 157 + .../boost/type_traits/composite_traits.hpp | 29 + .../boost/type_traits/conditional.hpp | 25 + .../autoboost/boost/type_traits/config.hpp | 72 + .../boost/type_traits/conversion_traits.hpp | 17 + .../autoboost/boost/type_traits/cv_traits.hpp | 24 + contrib/autoboost/boost/type_traits/decay.hpp | 44 + .../type_traits/detail/bool_trait_def.hpp | 188 + .../type_traits/detail/bool_trait_undef.hpp | 28 + .../type_traits/detail/common_type_imp.hpp | 333 ++ .../type_traits/detail/cv_traits_impl.hpp | 140 + .../boost/type_traits/detail/false_result.hpp | 28 + .../detail/has_binary_operator.hpp | 229 + .../boost/type_traits/detail/ice_and.hpp | 35 + .../boost/type_traits/detail/ice_eq.hpp | 36 + .../boost/type_traits/detail/ice_not.hpp | 31 + .../boost/type_traits/detail/ice_or.hpp | 34 + .../detail/is_function_ptr_helper.hpp | 168 + .../detail/is_function_ptr_tester.hpp | 440 ++ .../detail/is_mem_fun_pointer_impl.hpp | 713 +++ .../detail/is_mem_fun_pointer_tester.hpp | 1790 ++++++ .../type_traits/detail/size_t_trait_def.hpp | 51 + .../type_traits/detail/size_t_trait_undef.hpp | 16 + .../detail/template_arity_spec.hpp | 31 + .../type_traits/detail/type_trait_def.hpp | 67 + .../type_traits/detail/type_trait_undef.hpp | 19 + .../boost/type_traits/detail/yes_no_type.hpp | 26 + .../boost/type_traits/function_traits.hpp | 174 + .../boost/type_traits/has_left_shift.hpp | 49 + .../autoboost/boost/type_traits/has_minus.hpp | 60 + .../boost/type_traits/has_minus_assign.hpp | 65 + .../boost/type_traits/has_new_operator.hpp | 154 + .../boost/type_traits/has_nothrow_assign.hpp | 44 + .../type_traits/has_nothrow_constructor.hpp | 53 + .../boost/type_traits/has_nothrow_copy.hpp | 53 + .../autoboost/boost/type_traits/has_plus.hpp | 54 + .../boost/type_traits/has_plus_assign.hpp | 66 + .../boost/type_traits/has_right_shift.hpp | 49 + .../boost/type_traits/has_trivial_assign.hpp | 57 + .../type_traits/has_trivial_constructor.hpp | 51 + .../boost/type_traits/has_trivial_copy.hpp | 82 + .../type_traits/has_trivial_destructor.hpp | 49 + .../type_traits/has_trivial_move_assign.hpp | 57 + .../has_trivial_move_constructor.hpp | 57 + contrib/autoboost/boost/type_traits/ice.hpp | 20 + .../boost/type_traits/integral_constant.hpp | 39 + .../boost/type_traits/integral_promotion.hpp | 194 + .../boost/type_traits/intrinsics.hpp | 309 + .../boost/type_traits/is_abstract.hpp | 153 + .../boost/type_traits/is_arithmetic.hpp | 51 + .../autoboost/boost/type_traits/is_array.hpp | 50 + .../boost/type_traits/is_base_and_derived.hpp | 252 + .../boost/type_traits/is_base_of.hpp | 49 + .../autoboost/boost/type_traits/is_class.hpp | 129 + .../boost/type_traits/is_compound.hpp | 46 + .../autoboost/boost/type_traits/is_const.hpp | 90 + .../boost/type_traits/is_convertible.hpp | 494 ++ .../type_traits/is_copy_constructible.hpp | 125 + .../autoboost/boost/type_traits/is_empty.hpp | 142 + .../autoboost/boost/type_traits/is_enum.hpp | 188 + .../autoboost/boost/type_traits/is_float.hpp | 27 + .../boost/type_traits/is_floating_point.hpp | 27 + .../boost/type_traits/is_function.hpp | 109 + .../boost/type_traits/is_fundamental.hpp | 45 + .../boost/type_traits/is_integral.hpp | 88 + .../boost/type_traits/is_lvalue_reference.hpp | 56 + .../is_member_function_pointer.hpp | 133 + .../boost/type_traits/is_member_pointer.hpp | 65 + .../is_nothrow_move_assignable.hpp | 92 + .../is_nothrow_move_constructible.hpp | 90 + .../autoboost/boost/type_traits/is_object.hpp | 45 + .../autoboost/boost/type_traits/is_pod.hpp | 79 + .../boost/type_traits/is_pointer.hpp | 88 + .../boost/type_traits/is_polymorphic.hpp | 123 + .../boost/type_traits/is_reference.hpp | 45 + .../boost/type_traits/is_rvalue_reference.hpp | 29 + .../autoboost/boost/type_traits/is_same.hpp | 45 + .../autoboost/boost/type_traits/is_scalar.hpp | 55 + .../autoboost/boost/type_traits/is_signed.hpp | 136 + .../boost/type_traits/is_stateless.hpp | 48 + .../autoboost/boost/type_traits/is_union.hpp | 57 + .../boost/type_traits/is_unsigned.hpp | 135 + .../boost/type_traits/is_virtual_base_of.hpp | 102 + .../autoboost/boost/type_traits/is_void.hpp | 38 + .../boost/type_traits/is_volatile.hpp | 84 + .../boost/type_traits/make_signed.hpp | 151 + .../boost/type_traits/make_unsigned.hpp | 151 + .../boost/type_traits/object_traits.hpp | 33 + .../boost/type_traits/remove_bounds.hpp | 40 + .../boost/type_traits/remove_const.hpp | 79 + .../autoboost/boost/type_traits/remove_cv.hpp | 63 + .../boost/type_traits/remove_extent.hpp | 40 + .../boost/type_traits/remove_pointer.hpp | 83 + .../boost/type_traits/remove_reference.hpp | 59 + .../boost/type_traits/remove_volatile.hpp | 77 + .../boost/type_traits/same_traits.hpp | 15 + .../boost/type_traits/transform_traits.hpp | 21 + .../boost/type_traits/type_with_alignment.hpp | 357 ++ .../boost/typeof/dmc/typeof_impl.hpp | 100 + .../autoboost/boost/typeof/encode_decode.hpp | 61 + .../boost/typeof/encode_decode_params.hpp | 34 + .../autoboost/boost/typeof/int_encoding.hpp | 118 + .../boost/typeof/integral_template_param.hpp | 80 + contrib/autoboost/boost/typeof/message.hpp | 8 + contrib/autoboost/boost/typeof/modifiers.hpp | 121 + .../boost/typeof/msvc/typeof_impl.hpp | 283 + contrib/autoboost/boost/typeof/native.hpp | 60 + .../boost/typeof/pointers_data_members.hpp | 38 + .../boost/typeof/register_functions.hpp | 50 + .../typeof/register_functions_iterate.hpp | 135 + .../boost/typeof/register_fundamental.hpp | 62 + .../boost/typeof/register_mem_functions.hpp | 32 + .../boost/typeof/template_encoding.hpp | 160 + .../boost/typeof/template_template_param.hpp | 149 + .../autoboost/boost/typeof/type_encoding.hpp | 27 + .../boost/typeof/type_template_param.hpp | 37 + contrib/autoboost/boost/typeof/typeof.hpp | 218 + .../autoboost/boost/typeof/typeof_impl.hpp | 186 + .../autoboost/boost/typeof/unsupported.hpp | 29 + contrib/autoboost/boost/typeof/vector.hpp | 166 + contrib/autoboost/boost/typeof/vector100.hpp | 321 + contrib/autoboost/boost/typeof/vector150.hpp | 471 ++ contrib/autoboost/boost/typeof/vector200.hpp | 621 ++ contrib/autoboost/boost/typeof/vector50.hpp | 171 + contrib/autoboost/boost/utility.hpp | 21 + contrib/autoboost/boost/utility/addressof.hpp | 17 + .../boost/utility/base_from_member.hpp | 171 + contrib/autoboost/boost/utility/binary.hpp | 708 +++ .../boost/utility/compare_pointees.hpp | 68 + contrib/autoboost/boost/utility/declval.hpp | 44 + .../detail/in_place_factory_prefix.hpp | 36 + .../detail/in_place_factory_suffix.hpp | 23 + .../utility/detail/result_of_iterate.hpp | 221 + contrib/autoboost/boost/utility/enable_if.hpp | 17 + .../boost/utility/explicit_operator_bool.hpp | 17 + .../autoboost/boost/utility/identity_type.hpp | 46 + .../boost/utility/in_place_factory.hpp | 86 + contrib/autoboost/boost/utility/result_of.hpp | 210 + contrib/autoboost/boost/utility/swap.hpp | 17 + .../autoboost/boost/utility/value_init.hpp | 281 + contrib/autoboost/boost/version.hpp | 32 + contrib/autoboost/boost/visit_each.hpp | 27 + contrib/autoboost/boost/weak_ptr.hpp | 18 + .../autoboost/libs/atomic/src/lockpool.cpp | 144 + .../src/detail/coroutine_context.cpp | 87 + .../libs/coroutine/src/exceptions.cpp | 36 + .../libs/coroutine/src/posix/stack_traits.cpp | 108 + .../coroutine/src/windows/stack_traits.cpp | 110 + .../libs/date_time/src/date_time.doc | 72 + .../src/gregorian/date_generators.cpp | 38 + .../date_time/src/gregorian/greg_month.cpp | 173 + .../date_time/src/gregorian/greg_names.hpp | 43 + .../date_time/src/gregorian/greg_weekday.cpp | 50 + .../src/gregorian/gregorian_types.cpp | 62 + .../src/posix_time/posix_time_types.cpp | 35 + .../clone_current_exception_non_intrusive.cpp | 320 + .../libs/regex/src/c_regex_traits.cpp | 206 + .../libs/regex/src/cpp_regex_traits.cpp | 117 + contrib/autoboost/libs/regex/src/cregex.cpp | 660 +++ contrib/autoboost/libs/regex/src/fileiter.cpp | 927 +++ contrib/autoboost/libs/regex/src/icu.cpp | 507 ++ .../autoboost/libs/regex/src/instances.cpp | 32 + .../autoboost/libs/regex/src/internals.hpp | 35 + .../autoboost/libs/regex/src/posix_api.cpp | 296 + contrib/autoboost/libs/regex/src/regex.cpp | 227 + .../autoboost/libs/regex/src/regex_debug.cpp | 59 + .../libs/regex/src/regex_raw_buffer.cpp | 72 + .../libs/regex/src/regex_traits_defaults.cpp | 692 +++ .../autoboost/libs/regex/src/static_mutex.cpp | 183 + .../autoboost/libs/regex/src/usinstances.cpp | 81 + .../libs/regex/src/w32_regex_traits.cpp | 652 +++ .../libs/regex/src/wc_regex_traits.cpp | 314 + .../libs/regex/src/wide_posix_api.cpp | 315 + .../autoboost/libs/regex/src/winstances.cpp | 35 + .../serialization/src/archive_exception.cpp | 127 + .../libs/serialization/src/basic_archive.cpp | 81 + .../libs/serialization/src/basic_iarchive.cpp | 596 ++ .../serialization/src/basic_iserializer.cpp | 33 + .../libs/serialization/src/basic_oarchive.cpp | 465 ++ .../serialization/src/basic_oserializer.cpp | 33 + .../src/basic_pointer_iserializer.cpp | 30 + .../src/basic_pointer_oserializer.cpp | 30 + .../src/basic_serializer_map.cpp | 112 + .../src/basic_text_iprimitive.cpp | 28 + .../src/basic_text_oprimitive.cpp | 28 + .../src/basic_text_wiprimitive.cpp | 35 + .../src/basic_text_woprimitive.cpp | 35 + .../serialization/src/basic_xml_archive.cpp | 51 + .../serialization/src/basic_xml_grammar.ipp | 468 ++ .../serialization/src/binary_iarchive.cpp | 39 + .../serialization/src/binary_oarchive.cpp | 39 + .../serialization/src/binary_wiarchive.cpp | 47 + .../serialization/src/binary_woarchive.cpp | 44 + .../libs/serialization/src/codecvt_null.cpp | 83 + .../serialization/src/extended_type_info.cpp | 188 + .../src/extended_type_info_no_rtti.cpp | 85 + .../src/extended_type_info_typeid.cpp | 161 + .../src/polymorphic_iarchive.cpp | 29 + .../src/polymorphic_oarchive.cpp | 29 + .../serialization/src/shared_ptr_helper.cpp | 63 + .../libs/serialization/src/stl_port.cpp | 43 + .../libs/serialization/src/text_iarchive.cpp | 32 + .../libs/serialization/src/text_oarchive.cpp | 33 + .../libs/serialization/src/text_wiarchive.cpp | 37 + .../libs/serialization/src/text_woarchive.cpp | 35 + .../serialization/src/utf8_codecvt_facet.cpp | 20 + .../libs/serialization/src/void_cast.cpp | 360 ++ .../src/xml_archive_exception.cpp | 56 + .../libs/serialization/src/xml_grammar.cpp | 73 + .../libs/serialization/src/xml_iarchive.cpp | 42 + .../libs/serialization/src/xml_oarchive.cpp | 32 + .../libs/serialization/src/xml_wgrammar.cpp | 157 + .../libs/serialization/src/xml_wiarchive.cpp | 49 + .../libs/serialization/src/xml_woarchive.cpp | 35 + .../libs/smart_ptr/src/sp_collector.cpp | 270 + .../libs/smart_ptr/src/sp_debug_hooks.cpp | 243 + .../autoboost/libs/system/src/error_code.cpp | 20 + .../libs/test/src/compiler_log_formatter.cpp | 18 + contrib/autoboost/libs/test/src/cpp_main.cpp | 19 + contrib/autoboost/libs/test/src/debug.cpp | 24 + .../libs/test/src/exception_safety.cpp | 19 + .../libs/test/src/execution_monitor.cpp | 18 + contrib/autoboost/libs/test/src/framework.cpp | 18 + .../libs/test/src/interaction_based.cpp | 18 + .../libs/test/src/logged_expectations.cpp | 18 + .../libs/test/src/plain_report_formatter.cpp | 18 + .../libs/test/src/progress_monitor.cpp | 18 + .../libs/test/src/results_collector.cpp | 18 + .../libs/test/src/results_reporter.cpp | 18 + contrib/autoboost/libs/test/src/test_main.cpp | 18 + .../autoboost/libs/test/src/test_tools.cpp | 18 + .../autoboost/libs/test/src/unit_test_log.cpp | 18 + .../libs/test/src/unit_test_main.cpp | 18 + .../libs/test/src/unit_test_monitor.cpp | 18 + .../libs/test/src/unit_test_parameters.cpp | 18 + .../libs/test/src/unit_test_suite.cpp | 18 + .../libs/test/src/xml_log_formatter.cpp | 18 + .../libs/test/src/xml_report_formatter.cpp | 18 + contrib/autoboost/libs/thread/src/future.cpp | 64 + .../libs/thread/src/pthread/once.cpp | 80 + .../libs/thread/src/pthread/once_atomic.cpp | 90 + .../libs/thread/src/pthread/thread.cpp | 851 +++ .../libs/thread/src/pthread/timeconv.inl | 151 + .../autoboost/libs/thread/src/tss_null.cpp | 38 + 2904 files changed, 525014 insertions(+) create mode 100644 contrib/autoboost/README.md create mode 100644 contrib/autoboost/boost/algorithm/string/case_conv.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/classification.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/compare.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/concept.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/config.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/constants.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/case_conv.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/classification.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/find_format.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/find_format_all.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/find_format_store.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/find_iterator.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/finder.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/formatter.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/replace_storage.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/sequence.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/trim.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/detail/util.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/erase.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/find_format.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/find_iterator.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/finder.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/formatter.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/iter_find.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/predicate_facade.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/replace.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/sequence_traits.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/split.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/trim.hpp create mode 100644 contrib/autoboost/boost/algorithm/string/yes_no_type.hpp create mode 100644 contrib/autoboost/boost/align/align.hpp create mode 100644 contrib/autoboost/boost/align/detail/address.hpp create mode 100644 contrib/autoboost/boost/align/detail/align.hpp create mode 100644 contrib/autoboost/boost/align/detail/align_cxx11.hpp create mode 100644 contrib/autoboost/boost/align/detail/is_alignment.hpp create mode 100644 contrib/autoboost/boost/aligned_storage.hpp create mode 100644 contrib/autoboost/boost/archive/add_facet.hpp create mode 100644 contrib/autoboost/boost/archive/archive_exception.hpp create mode 100644 contrib/autoboost/boost/archive/basic_archive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_binary_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_binary_iprimitive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_binary_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_binary_oprimitive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_streambuf_locale_saver.hpp create mode 100644 contrib/autoboost/boost/archive/basic_text_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_text_iprimitive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_text_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_text_oprimitive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_xml_archive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_xml_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/basic_xml_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/binary_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/binary_iarchive_impl.hpp create mode 100644 contrib/autoboost/boost/archive/binary_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/binary_oarchive_impl.hpp create mode 100644 contrib/autoboost/boost/archive/binary_wiarchive.hpp create mode 100644 contrib/autoboost/boost/archive/binary_woarchive.hpp create mode 100644 contrib/autoboost/boost/archive/codecvt_null.hpp create mode 100644 contrib/autoboost/boost/archive/detail/abi_prefix.hpp create mode 100644 contrib/autoboost/boost/archive/detail/abi_suffix.hpp create mode 100644 contrib/autoboost/boost/archive/detail/archive_serializer_map.hpp create mode 100644 contrib/autoboost/boost/archive/detail/auto_link_archive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/auto_link_warchive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_iserializer.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_oserializer.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_pointer_iserializer.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_pointer_oserializer.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_serializer.hpp create mode 100644 contrib/autoboost/boost/archive/detail/basic_serializer_map.hpp create mode 100644 contrib/autoboost/boost/archive/detail/check.hpp create mode 100644 contrib/autoboost/boost/archive/detail/common_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/common_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/decl.hpp create mode 100644 contrib/autoboost/boost/archive/detail/helper_collection.hpp create mode 100644 contrib/autoboost/boost/archive/detail/interface_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/interface_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/iserializer.hpp create mode 100644 contrib/autoboost/boost/archive/detail/oserializer.hpp create mode 100644 contrib/autoboost/boost/archive/detail/register_archive.hpp create mode 100644 contrib/autoboost/boost/archive/detail/utf8_codecvt_facet.hpp create mode 100644 contrib/autoboost/boost/archive/dinkumware.hpp create mode 100644 contrib/autoboost/boost/archive/impl/archive_serializer_map.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_binary_iarchive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_binary_iprimitive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_binary_oarchive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_binary_oprimitive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_text_iarchive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_text_iprimitive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_text_oarchive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_text_oprimitive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_xml_grammar.hpp create mode 100644 contrib/autoboost/boost/archive/impl/basic_xml_iarchive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/basic_xml_oarchive.ipp create mode 100644 contrib/autoboost/boost/archive/impl/text_iarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/impl/text_oarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/impl/text_wiarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/impl/text_woarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/impl/xml_iarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/impl/xml_oarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/impl/xml_wiarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/impl/xml_woarchive_impl.ipp create mode 100644 contrib/autoboost/boost/archive/iterators/base64_from_binary.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/binary_from_base64.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/dataflow_exception.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/escape.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/insert_linebreaks.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/istream_iterator.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/mb_from_wchar.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/ostream_iterator.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/remove_whitespace.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/transform_width.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/unescape.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/wchar_from_mb.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/xml_escape.hpp create mode 100644 contrib/autoboost/boost/archive/iterators/xml_unescape.hpp create mode 100644 contrib/autoboost/boost/archive/polymorphic_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/polymorphic_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/text_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/text_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/text_wiarchive.hpp create mode 100644 contrib/autoboost/boost/archive/text_woarchive.hpp create mode 100644 contrib/autoboost/boost/archive/wcslen.hpp create mode 100644 contrib/autoboost/boost/archive/xml_archive_exception.hpp create mode 100644 contrib/autoboost/boost/archive/xml_iarchive.hpp create mode 100644 contrib/autoboost/boost/archive/xml_oarchive.hpp create mode 100644 contrib/autoboost/boost/archive/xml_wiarchive.hpp create mode 100644 contrib/autoboost/boost/archive/xml_woarchive.hpp create mode 100644 contrib/autoboost/boost/array.hpp create mode 100644 contrib/autoboost/boost/asio.hpp create mode 100644 contrib/autoboost/boost/asio/async_result.hpp create mode 100644 contrib/autoboost/boost/asio/basic_datagram_socket.hpp create mode 100644 contrib/autoboost/boost/asio/basic_deadline_timer.hpp create mode 100644 contrib/autoboost/boost/asio/basic_io_object.hpp create mode 100644 contrib/autoboost/boost/asio/basic_raw_socket.hpp create mode 100644 contrib/autoboost/boost/asio/basic_seq_packet_socket.hpp create mode 100644 contrib/autoboost/boost/asio/basic_serial_port.hpp create mode 100644 contrib/autoboost/boost/asio/basic_signal_set.hpp create mode 100644 contrib/autoboost/boost/asio/basic_socket.hpp create mode 100644 contrib/autoboost/boost/asio/basic_socket_acceptor.hpp create mode 100644 contrib/autoboost/boost/asio/basic_socket_iostream.hpp create mode 100644 contrib/autoboost/boost/asio/basic_socket_streambuf.hpp create mode 100644 contrib/autoboost/boost/asio/basic_stream_socket.hpp create mode 100644 contrib/autoboost/boost/asio/basic_streambuf.hpp create mode 100644 contrib/autoboost/boost/asio/basic_streambuf_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/basic_waitable_timer.hpp create mode 100644 contrib/autoboost/boost/asio/buffer.hpp create mode 100644 contrib/autoboost/boost/asio/buffered_read_stream.hpp create mode 100644 contrib/autoboost/boost/asio/buffered_read_stream_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/buffered_stream.hpp create mode 100644 contrib/autoboost/boost/asio/buffered_stream_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/buffered_write_stream.hpp create mode 100644 contrib/autoboost/boost/asio/buffered_write_stream_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/buffers_iterator.hpp create mode 100644 contrib/autoboost/boost/asio/completion_condition.hpp create mode 100644 contrib/autoboost/boost/asio/connect.hpp create mode 100644 contrib/autoboost/boost/asio/coroutine.hpp create mode 100644 contrib/autoboost/boost/asio/datagram_socket_service.hpp create mode 100644 contrib/autoboost/boost/asio/deadline_timer.hpp create mode 100644 contrib/autoboost/boost/asio/deadline_timer_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/addressof.hpp create mode 100644 contrib/autoboost/boost/asio/detail/array.hpp create mode 100644 contrib/autoboost/boost/asio/detail/array_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/detail/assert.hpp create mode 100644 contrib/autoboost/boost/asio/detail/atomic_count.hpp create mode 100644 contrib/autoboost/boost/asio/detail/base_from_completion_cond.hpp create mode 100644 contrib/autoboost/boost/asio/detail/bind_handler.hpp create mode 100644 contrib/autoboost/boost/asio/detail/buffer_resize_guard.hpp create mode 100644 contrib/autoboost/boost/asio/detail/buffer_sequence_adapter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/buffered_stream_storage.hpp create mode 100644 contrib/autoboost/boost/asio/detail/call_stack.hpp create mode 100644 contrib/autoboost/boost/asio/detail/chrono_time_traits.hpp create mode 100644 contrib/autoboost/boost/asio/detail/completion_handler.hpp create mode 100644 contrib/autoboost/boost/asio/detail/config.hpp create mode 100644 contrib/autoboost/boost/asio/detail/consuming_buffers.hpp create mode 100644 contrib/autoboost/boost/asio/detail/cstdint.hpp create mode 100644 contrib/autoboost/boost/asio/detail/date_time_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/detail/deadline_timer_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/dependent_type.hpp create mode 100644 contrib/autoboost/boost/asio/detail/descriptor_ops.hpp create mode 100644 contrib/autoboost/boost/asio/detail/descriptor_read_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/descriptor_write_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/dev_poll_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/epoll_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/event.hpp create mode 100644 contrib/autoboost/boost/asio/detail/eventfd_select_interrupter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/fd_set_adapter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/function.hpp create mode 100644 contrib/autoboost/boost/asio/detail/gcc_arm_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/gcc_hppa_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/gcc_sync_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/gcc_x86_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/handler_alloc_helpers.hpp create mode 100644 contrib/autoboost/boost/asio/detail/handler_cont_helpers.hpp create mode 100644 contrib/autoboost/boost/asio/detail/handler_invoke_helpers.hpp create mode 100644 contrib/autoboost/boost/asio/detail/handler_tracking.hpp create mode 100644 contrib/autoboost/boost/asio/detail/handler_type_requirements.hpp create mode 100644 contrib/autoboost/boost/asio/detail/hash_map.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/buffer_sequence_adapter.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/descriptor_ops.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/dev_poll_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/dev_poll_reactor.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/epoll_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/epoll_reactor.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/eventfd_select_interrupter.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/handler_tracking.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/kqueue_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/kqueue_reactor.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/pipe_select_interrupter.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/posix_event.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/posix_mutex.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/posix_thread.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/posix_tss_ptr.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/reactive_descriptor_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/reactive_serial_port_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/reactive_socket_service_base.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/resolver_service_base.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/select_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/select_reactor.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/service_registry.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/service_registry.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/signal_set_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/socket_ops.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/socket_select_interrupter.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/strand_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/strand_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/task_io_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/task_io_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/throw_error.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/timer_queue_ptime.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/timer_queue_set.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_event.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_iocp_handle_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_iocp_io_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_iocp_io_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_iocp_serial_port_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_iocp_socket_service_base.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_mutex.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_object_handle_service.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_static_mutex.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_thread.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/win_tss_ptr.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/winrt_ssocket_service_base.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/winrt_timer_scheduler.hpp create mode 100644 contrib/autoboost/boost/asio/detail/impl/winrt_timer_scheduler.ipp create mode 100644 contrib/autoboost/boost/asio/detail/impl/winsock_init.ipp create mode 100644 contrib/autoboost/boost/asio/detail/io_control.hpp create mode 100644 contrib/autoboost/boost/asio/detail/keyword_tss_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/kqueue_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/limits.hpp create mode 100644 contrib/autoboost/boost/asio/detail/local_free_on_block_exit.hpp create mode 100644 contrib/autoboost/boost/asio/detail/macos_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/noncopyable.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_event.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_signal_blocker.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_socket_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_static_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_thread.hpp create mode 100644 contrib/autoboost/boost/asio/detail/null_tss_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/object_pool.hpp create mode 100644 contrib/autoboost/boost/asio/detail/old_win_sdk_compat.hpp create mode 100644 contrib/autoboost/boost/asio/detail/op_queue.hpp create mode 100644 contrib/autoboost/boost/asio/detail/operation.hpp create mode 100644 contrib/autoboost/boost/asio/detail/pipe_select_interrupter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/pop_options.hpp create mode 100644 contrib/autoboost/boost/asio/detail/posix_event.hpp create mode 100644 contrib/autoboost/boost/asio/detail/posix_fd_set_adapter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/posix_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/posix_signal_blocker.hpp create mode 100644 contrib/autoboost/boost/asio/detail/posix_static_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/posix_thread.hpp create mode 100644 contrib/autoboost/boost/asio/detail/posix_tss_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/push_options.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_descriptor_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_null_buffers_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_serial_port_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_accept_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_connect_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_recv_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_recvfrom_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_recvmsg_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_send_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_sendto_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactive_socket_service_base.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactor_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactor_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/reactor_op_queue.hpp create mode 100644 contrib/autoboost/boost/asio/detail/regex_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/detail/resolve_endpoint_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/resolve_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/resolver_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/resolver_service_base.hpp create mode 100644 contrib/autoboost/boost/asio/detail/scoped_lock.hpp create mode 100644 contrib/autoboost/boost/asio/detail/scoped_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/select_interrupter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/select_reactor.hpp create mode 100644 contrib/autoboost/boost/asio/detail/service_registry.hpp create mode 100644 contrib/autoboost/boost/asio/detail/shared_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/signal_blocker.hpp create mode 100644 contrib/autoboost/boost/asio/detail/signal_handler.hpp create mode 100644 contrib/autoboost/boost/asio/detail/signal_init.hpp create mode 100644 contrib/autoboost/boost/asio/detail/signal_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/signal_set_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/socket_holder.hpp create mode 100644 contrib/autoboost/boost/asio/detail/socket_ops.hpp create mode 100644 contrib/autoboost/boost/asio/detail/socket_option.hpp create mode 100644 contrib/autoboost/boost/asio/detail/socket_select_interrupter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/socket_types.hpp create mode 100644 contrib/autoboost/boost/asio/detail/solaris_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/static_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/std_event.hpp create mode 100644 contrib/autoboost/boost/asio/detail/std_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/std_static_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/std_thread.hpp create mode 100644 contrib/autoboost/boost/asio/detail/strand_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/task_io_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/task_io_service_operation.hpp create mode 100644 contrib/autoboost/boost/asio/detail/task_io_service_thread_info.hpp create mode 100644 contrib/autoboost/boost/asio/detail/thread.hpp create mode 100644 contrib/autoboost/boost/asio/detail/thread_info_base.hpp create mode 100644 contrib/autoboost/boost/asio/detail/throw_error.hpp create mode 100644 contrib/autoboost/boost/asio/detail/throw_exception.hpp create mode 100644 contrib/autoboost/boost/asio/detail/timer_queue.hpp create mode 100644 contrib/autoboost/boost/asio/detail/timer_queue_base.hpp create mode 100644 contrib/autoboost/boost/asio/detail/timer_queue_ptime.hpp create mode 100644 contrib/autoboost/boost/asio/detail/timer_queue_set.hpp create mode 100644 contrib/autoboost/boost/asio/detail/timer_scheduler.hpp create mode 100644 contrib/autoboost/boost/asio/detail/timer_scheduler_fwd.hpp create mode 100644 contrib/autoboost/boost/asio/detail/tss_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/type_traits.hpp create mode 100644 contrib/autoboost/boost/asio/detail/variadic_templates.hpp create mode 100644 contrib/autoboost/boost/asio/detail/wait_handler.hpp create mode 100644 contrib/autoboost/boost/asio/detail/wait_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/weak_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_event.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_fd_set_adapter.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_fenced_block.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_handle_read_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_handle_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_handle_write_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_io_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_null_buffers_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_operation.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_overlapped_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_overlapped_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_serial_port_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_accept_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_connect_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_recv_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_send_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_socket_service_base.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_iocp_thread_info.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_object_handle_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_static_mutex.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_thread.hpp create mode 100644 contrib/autoboost/boost/asio/detail/win_tss_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/detail/wince_thread.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_async_manager.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_async_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_resolve_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_resolver_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_socket_connect_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_socket_recv_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_socket_send_op.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_ssocket_service.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_ssocket_service_base.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_timer_scheduler.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winrt_utils.hpp create mode 100644 contrib/autoboost/boost/asio/detail/winsock_init.hpp create mode 100644 contrib/autoboost/boost/asio/detail/wrapped_handler.hpp create mode 100644 contrib/autoboost/boost/asio/error.hpp create mode 100644 contrib/autoboost/boost/asio/generic/basic_endpoint.hpp create mode 100644 contrib/autoboost/boost/asio/generic/datagram_protocol.hpp create mode 100644 contrib/autoboost/boost/asio/generic/detail/endpoint.hpp create mode 100644 contrib/autoboost/boost/asio/generic/detail/impl/endpoint.ipp create mode 100644 contrib/autoboost/boost/asio/generic/raw_protocol.hpp create mode 100644 contrib/autoboost/boost/asio/generic/seq_packet_protocol.hpp create mode 100644 contrib/autoboost/boost/asio/generic/stream_protocol.hpp create mode 100644 contrib/autoboost/boost/asio/handler_alloc_hook.hpp create mode 100644 contrib/autoboost/boost/asio/handler_continuation_hook.hpp create mode 100644 contrib/autoboost/boost/asio/handler_invoke_hook.hpp create mode 100644 contrib/autoboost/boost/asio/handler_type.hpp create mode 100644 contrib/autoboost/boost/asio/high_resolution_timer.hpp create mode 100644 contrib/autoboost/boost/asio/impl/buffered_read_stream.hpp create mode 100644 contrib/autoboost/boost/asio/impl/buffered_write_stream.hpp create mode 100644 contrib/autoboost/boost/asio/impl/connect.hpp create mode 100644 contrib/autoboost/boost/asio/impl/error.ipp create mode 100644 contrib/autoboost/boost/asio/impl/handler_alloc_hook.ipp create mode 100644 contrib/autoboost/boost/asio/impl/io_service.hpp create mode 100644 contrib/autoboost/boost/asio/impl/io_service.ipp create mode 100644 contrib/autoboost/boost/asio/impl/read.hpp create mode 100644 contrib/autoboost/boost/asio/impl/read_at.hpp create mode 100644 contrib/autoboost/boost/asio/impl/read_until.hpp create mode 100644 contrib/autoboost/boost/asio/impl/serial_port_base.hpp create mode 100644 contrib/autoboost/boost/asio/impl/serial_port_base.ipp create mode 100644 contrib/autoboost/boost/asio/impl/spawn.hpp create mode 100644 contrib/autoboost/boost/asio/impl/src.cpp create mode 100644 contrib/autoboost/boost/asio/impl/src.hpp create mode 100644 contrib/autoboost/boost/asio/impl/use_future.hpp create mode 100644 contrib/autoboost/boost/asio/impl/write.hpp create mode 100644 contrib/autoboost/boost/asio/impl/write_at.hpp create mode 100644 contrib/autoboost/boost/asio/io_service.hpp create mode 100644 contrib/autoboost/boost/asio/ip/address.hpp create mode 100644 contrib/autoboost/boost/asio/ip/address_v4.hpp create mode 100644 contrib/autoboost/boost/asio/ip/address_v6.hpp create mode 100644 contrib/autoboost/boost/asio/ip/basic_endpoint.hpp create mode 100644 contrib/autoboost/boost/asio/ip/basic_resolver.hpp create mode 100644 contrib/autoboost/boost/asio/ip/basic_resolver_entry.hpp create mode 100644 contrib/autoboost/boost/asio/ip/basic_resolver_iterator.hpp create mode 100644 contrib/autoboost/boost/asio/ip/basic_resolver_query.hpp create mode 100644 contrib/autoboost/boost/asio/ip/detail/endpoint.hpp create mode 100644 contrib/autoboost/boost/asio/ip/detail/impl/endpoint.ipp create mode 100644 contrib/autoboost/boost/asio/ip/detail/socket_option.hpp create mode 100644 contrib/autoboost/boost/asio/ip/host_name.hpp create mode 100644 contrib/autoboost/boost/asio/ip/icmp.hpp create mode 100644 contrib/autoboost/boost/asio/ip/impl/address.hpp create mode 100644 contrib/autoboost/boost/asio/ip/impl/address.ipp create mode 100644 contrib/autoboost/boost/asio/ip/impl/address_v4.hpp create mode 100644 contrib/autoboost/boost/asio/ip/impl/address_v4.ipp create mode 100644 contrib/autoboost/boost/asio/ip/impl/address_v6.hpp create mode 100644 contrib/autoboost/boost/asio/ip/impl/address_v6.ipp create mode 100644 contrib/autoboost/boost/asio/ip/impl/basic_endpoint.hpp create mode 100644 contrib/autoboost/boost/asio/ip/impl/host_name.ipp create mode 100644 contrib/autoboost/boost/asio/ip/multicast.hpp create mode 100644 contrib/autoboost/boost/asio/ip/resolver_query_base.hpp create mode 100644 contrib/autoboost/boost/asio/ip/resolver_service.hpp create mode 100644 contrib/autoboost/boost/asio/ip/tcp.hpp create mode 100644 contrib/autoboost/boost/asio/ip/udp.hpp create mode 100644 contrib/autoboost/boost/asio/ip/unicast.hpp create mode 100644 contrib/autoboost/boost/asio/ip/v6_only.hpp create mode 100644 contrib/autoboost/boost/asio/is_read_buffered.hpp create mode 100644 contrib/autoboost/boost/asio/is_write_buffered.hpp create mode 100644 contrib/autoboost/boost/asio/local/basic_endpoint.hpp create mode 100644 contrib/autoboost/boost/asio/local/connect_pair.hpp create mode 100644 contrib/autoboost/boost/asio/local/datagram_protocol.hpp create mode 100644 contrib/autoboost/boost/asio/local/detail/endpoint.hpp create mode 100644 contrib/autoboost/boost/asio/local/detail/impl/endpoint.ipp create mode 100644 contrib/autoboost/boost/asio/local/stream_protocol.hpp create mode 100644 contrib/autoboost/boost/asio/placeholders.hpp create mode 100644 contrib/autoboost/boost/asio/posix/basic_descriptor.hpp create mode 100644 contrib/autoboost/boost/asio/posix/basic_stream_descriptor.hpp create mode 100644 contrib/autoboost/boost/asio/posix/descriptor_base.hpp create mode 100644 contrib/autoboost/boost/asio/posix/stream_descriptor.hpp create mode 100644 contrib/autoboost/boost/asio/posix/stream_descriptor_service.hpp create mode 100644 contrib/autoboost/boost/asio/raw_socket_service.hpp create mode 100644 contrib/autoboost/boost/asio/read.hpp create mode 100644 contrib/autoboost/boost/asio/read_at.hpp create mode 100644 contrib/autoboost/boost/asio/read_until.hpp create mode 100644 contrib/autoboost/boost/asio/seq_packet_socket_service.hpp create mode 100644 contrib/autoboost/boost/asio/serial_port.hpp create mode 100644 contrib/autoboost/boost/asio/serial_port_base.hpp create mode 100644 contrib/autoboost/boost/asio/serial_port_service.hpp create mode 100644 contrib/autoboost/boost/asio/signal_set.hpp create mode 100644 contrib/autoboost/boost/asio/signal_set_service.hpp create mode 100644 contrib/autoboost/boost/asio/socket_acceptor_service.hpp create mode 100644 contrib/autoboost/boost/asio/socket_base.hpp create mode 100644 contrib/autoboost/boost/asio/spawn.hpp create mode 100644 contrib/autoboost/boost/asio/ssl.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/basic_context.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/context.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/context_base.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/context_service.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/buffered_handshake_op.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/engine.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/handshake_op.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/impl/engine.ipp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/impl/openssl_init.ipp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/io.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/openssl_init.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/openssl_types.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/password_callback.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/read_op.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/shutdown_op.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/stream_core.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/verify_callback.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/detail/write_op.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/error.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/impl/context.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/impl/context.ipp create mode 100644 contrib/autoboost/boost/asio/ssl/impl/error.ipp create mode 100644 contrib/autoboost/boost/asio/ssl/impl/rfc2818_verification.ipp create mode 100644 contrib/autoboost/boost/asio/ssl/impl/src.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/old/basic_context.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/old/context_service.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/old/detail/openssl_context_service.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/old/detail/openssl_operation.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/old/detail/openssl_stream_service.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/old/stream.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/old/stream_service.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/rfc2818_verification.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/stream.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/stream_base.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/stream_service.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/verify_context.hpp create mode 100644 contrib/autoboost/boost/asio/ssl/verify_mode.hpp create mode 100644 contrib/autoboost/boost/asio/steady_timer.hpp create mode 100644 contrib/autoboost/boost/asio/strand.hpp create mode 100644 contrib/autoboost/boost/asio/stream_socket_service.hpp create mode 100644 contrib/autoboost/boost/asio/streambuf.hpp create mode 100644 contrib/autoboost/boost/asio/system_timer.hpp create mode 100644 contrib/autoboost/boost/asio/time_traits.hpp create mode 100644 contrib/autoboost/boost/asio/unyield.hpp create mode 100644 contrib/autoboost/boost/asio/use_future.hpp create mode 100644 contrib/autoboost/boost/asio/version.hpp create mode 100644 contrib/autoboost/boost/asio/wait_traits.hpp create mode 100644 contrib/autoboost/boost/asio/waitable_timer_service.hpp create mode 100644 contrib/autoboost/boost/asio/windows/basic_handle.hpp create mode 100644 contrib/autoboost/boost/asio/windows/basic_object_handle.hpp create mode 100644 contrib/autoboost/boost/asio/windows/basic_random_access_handle.hpp create mode 100644 contrib/autoboost/boost/asio/windows/basic_stream_handle.hpp create mode 100644 contrib/autoboost/boost/asio/windows/object_handle.hpp create mode 100644 contrib/autoboost/boost/asio/windows/object_handle_service.hpp create mode 100644 contrib/autoboost/boost/asio/windows/overlapped_ptr.hpp create mode 100644 contrib/autoboost/boost/asio/windows/random_access_handle.hpp create mode 100644 contrib/autoboost/boost/asio/windows/random_access_handle_service.hpp create mode 100644 contrib/autoboost/boost/asio/windows/stream_handle.hpp create mode 100644 contrib/autoboost/boost/asio/windows/stream_handle_service.hpp create mode 100644 contrib/autoboost/boost/asio/write.hpp create mode 100644 contrib/autoboost/boost/asio/write_at.hpp create mode 100644 contrib/autoboost/boost/asio/yield.hpp create mode 100644 contrib/autoboost/boost/assert.hpp create mode 100644 contrib/autoboost/boost/atomic.hpp create mode 100644 contrib/autoboost/boost/atomic/atomic.hpp create mode 100644 contrib/autoboost/boost/atomic/atomic_flag.hpp create mode 100644 contrib/autoboost/boost/atomic/capabilities.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/atomic_flag.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/atomic_template.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/casts.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/config.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/int_sizes.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/link.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/lockpool.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/operations.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/operations_fwd.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/operations_lockfree.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/ops_emulated.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/pause.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/platform.hpp create mode 100644 contrib/autoboost/boost/atomic/detail/storage_type.hpp create mode 100644 contrib/autoboost/boost/atomic/fences.hpp create mode 100644 contrib/autoboost/boost/bind.hpp create mode 100644 contrib/autoboost/boost/bind/arg.hpp create mode 100644 contrib/autoboost/boost/bind/bind.hpp create mode 100644 contrib/autoboost/boost/bind/bind_cc.hpp create mode 100644 contrib/autoboost/boost/bind/bind_mf2_cc.hpp create mode 100644 contrib/autoboost/boost/bind/bind_mf_cc.hpp create mode 100644 contrib/autoboost/boost/bind/bind_template.hpp create mode 100644 contrib/autoboost/boost/bind/mem_fn.hpp create mode 100644 contrib/autoboost/boost/bind/mem_fn_cc.hpp create mode 100644 contrib/autoboost/boost/bind/mem_fn_template.hpp create mode 100644 contrib/autoboost/boost/bind/mem_fn_vw.hpp create mode 100644 contrib/autoboost/boost/bind/placeholders.hpp create mode 100644 contrib/autoboost/boost/bind/storage.hpp create mode 100644 contrib/autoboost/boost/call_traits.hpp create mode 100644 contrib/autoboost/boost/cerrno.hpp create mode 100644 contrib/autoboost/boost/checked_delete.hpp create mode 100644 contrib/autoboost/boost/chrono/ceil.hpp create mode 100644 contrib/autoboost/boost/chrono/chrono.hpp create mode 100644 contrib/autoboost/boost/chrono/clock_string.hpp create mode 100644 contrib/autoboost/boost/chrono/config.hpp create mode 100644 contrib/autoboost/boost/chrono/detail/inlined/chrono.hpp create mode 100644 contrib/autoboost/boost/chrono/detail/inlined/mac/chrono.hpp create mode 100644 contrib/autoboost/boost/chrono/detail/inlined/posix/chrono.hpp create mode 100644 contrib/autoboost/boost/chrono/detail/inlined/win/chrono.hpp create mode 100644 contrib/autoboost/boost/chrono/detail/is_evenly_divisible_by.hpp create mode 100644 contrib/autoboost/boost/chrono/detail/static_assert.hpp create mode 100644 contrib/autoboost/boost/chrono/detail/system.hpp create mode 100644 contrib/autoboost/boost/chrono/duration.hpp create mode 100644 contrib/autoboost/boost/chrono/system_clocks.hpp create mode 100644 contrib/autoboost/boost/chrono/time_point.hpp create mode 100644 contrib/autoboost/boost/compressed_pair.hpp create mode 100644 contrib/autoboost/boost/concept/assert.hpp create mode 100644 contrib/autoboost/boost/concept/detail/backward_compatibility.hpp create mode 100644 contrib/autoboost/boost/concept/detail/borland.hpp create mode 100644 contrib/autoboost/boost/concept/detail/concept_def.hpp create mode 100644 contrib/autoboost/boost/concept/detail/concept_undef.hpp create mode 100644 contrib/autoboost/boost/concept/detail/general.hpp create mode 100644 contrib/autoboost/boost/concept/detail/has_constraints.hpp create mode 100644 contrib/autoboost/boost/concept/detail/msvc.hpp create mode 100644 contrib/autoboost/boost/concept/usage.hpp create mode 100644 contrib/autoboost/boost/concept_check.hpp create mode 100644 contrib/autoboost/boost/config.hpp create mode 100644 contrib/autoboost/boost/config/abi/borland_prefix.hpp create mode 100644 contrib/autoboost/boost/config/abi/borland_suffix.hpp create mode 100644 contrib/autoboost/boost/config/abi/msvc_prefix.hpp create mode 100644 contrib/autoboost/boost/config/abi/msvc_suffix.hpp create mode 100644 contrib/autoboost/boost/config/abi_prefix.hpp create mode 100644 contrib/autoboost/boost/config/abi_suffix.hpp create mode 100644 contrib/autoboost/boost/config/auto_link.hpp create mode 100644 contrib/autoboost/boost/config/compiler/borland.hpp create mode 100644 contrib/autoboost/boost/config/compiler/clang.hpp create mode 100644 contrib/autoboost/boost/config/compiler/codegear.hpp create mode 100644 contrib/autoboost/boost/config/compiler/comeau.hpp create mode 100644 contrib/autoboost/boost/config/compiler/common_edg.hpp create mode 100644 contrib/autoboost/boost/config/compiler/compaq_cxx.hpp create mode 100644 contrib/autoboost/boost/config/compiler/cray.hpp create mode 100644 contrib/autoboost/boost/config/compiler/digitalmars.hpp create mode 100644 contrib/autoboost/boost/config/compiler/gcc.hpp create mode 100644 contrib/autoboost/boost/config/compiler/gcc_xml.hpp create mode 100644 contrib/autoboost/boost/config/compiler/greenhills.hpp create mode 100644 contrib/autoboost/boost/config/compiler/hp_acc.hpp create mode 100644 contrib/autoboost/boost/config/compiler/intel.hpp create mode 100644 contrib/autoboost/boost/config/compiler/kai.hpp create mode 100644 contrib/autoboost/boost/config/compiler/metrowerks.hpp create mode 100644 contrib/autoboost/boost/config/compiler/mpw.hpp create mode 100644 contrib/autoboost/boost/config/compiler/nvcc.hpp create mode 100644 contrib/autoboost/boost/config/compiler/pathscale.hpp create mode 100644 contrib/autoboost/boost/config/compiler/pgi.hpp create mode 100644 contrib/autoboost/boost/config/compiler/sgi_mipspro.hpp create mode 100644 contrib/autoboost/boost/config/compiler/sunpro_cc.hpp create mode 100644 contrib/autoboost/boost/config/compiler/vacpp.hpp create mode 100644 contrib/autoboost/boost/config/compiler/visualc.hpp create mode 100644 contrib/autoboost/boost/config/no_tr1/cmath.hpp create mode 100644 contrib/autoboost/boost/config/no_tr1/complex.hpp create mode 100644 contrib/autoboost/boost/config/no_tr1/functional.hpp create mode 100644 contrib/autoboost/boost/config/no_tr1/memory.hpp create mode 100644 contrib/autoboost/boost/config/no_tr1/utility.hpp create mode 100644 contrib/autoboost/boost/config/platform/aix.hpp create mode 100644 contrib/autoboost/boost/config/platform/amigaos.hpp create mode 100644 contrib/autoboost/boost/config/platform/beos.hpp create mode 100644 contrib/autoboost/boost/config/platform/bsd.hpp create mode 100644 contrib/autoboost/boost/config/platform/cray.hpp create mode 100644 contrib/autoboost/boost/config/platform/cygwin.hpp create mode 100644 contrib/autoboost/boost/config/platform/hpux.hpp create mode 100644 contrib/autoboost/boost/config/platform/irix.hpp create mode 100644 contrib/autoboost/boost/config/platform/linux.hpp create mode 100644 contrib/autoboost/boost/config/platform/macos.hpp create mode 100644 contrib/autoboost/boost/config/platform/qnxnto.hpp create mode 100644 contrib/autoboost/boost/config/platform/solaris.hpp create mode 100644 contrib/autoboost/boost/config/platform/symbian.hpp create mode 100644 contrib/autoboost/boost/config/platform/vms.hpp create mode 100644 contrib/autoboost/boost/config/platform/vxworks.hpp create mode 100644 contrib/autoboost/boost/config/platform/win32.hpp create mode 100644 contrib/autoboost/boost/config/posix_features.hpp create mode 100644 contrib/autoboost/boost/config/requires_threads.hpp create mode 100644 contrib/autoboost/boost/config/select_compiler_config.hpp create mode 100644 contrib/autoboost/boost/config/select_platform_config.hpp create mode 100644 contrib/autoboost/boost/config/select_stdlib_config.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/dinkumware.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/libcomo.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/libcpp.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/libstdcpp3.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/modena.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/msl.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/roguewave.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/sgi.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/stlport.hpp create mode 100644 contrib/autoboost/boost/config/stdlib/vacpp.hpp create mode 100644 contrib/autoboost/boost/config/suffix.hpp create mode 100644 contrib/autoboost/boost/config/user.hpp create mode 100644 contrib/autoboost/boost/config/warning_disable.hpp create mode 100644 contrib/autoboost/boost/container/allocator_traits.hpp create mode 100644 contrib/autoboost/boost/container/container_fwd.hpp create mode 100644 contrib/autoboost/boost/container/detail/advanced_insert_int.hpp create mode 100644 contrib/autoboost/boost/container/detail/algorithms.hpp create mode 100644 contrib/autoboost/boost/container/detail/allocation_type.hpp create mode 100644 contrib/autoboost/boost/container/detail/allocator_version_traits.hpp create mode 100644 contrib/autoboost/boost/container/detail/config_begin.hpp create mode 100644 contrib/autoboost/boost/container/detail/config_end.hpp create mode 100644 contrib/autoboost/boost/container/detail/destroyers.hpp create mode 100644 contrib/autoboost/boost/container/detail/iterators.hpp create mode 100644 contrib/autoboost/boost/container/detail/memory_util.hpp create mode 100644 contrib/autoboost/boost/container/detail/mpl.hpp create mode 100644 contrib/autoboost/boost/container/detail/multiallocation_chain.hpp create mode 100644 contrib/autoboost/boost/container/detail/pair.hpp create mode 100644 contrib/autoboost/boost/container/detail/placement_new.hpp create mode 100644 contrib/autoboost/boost/container/detail/preprocessor.hpp create mode 100644 contrib/autoboost/boost/container/detail/std_fwd.hpp create mode 100644 contrib/autoboost/boost/container/detail/transform_iterator.hpp create mode 100644 contrib/autoboost/boost/container/detail/type_traits.hpp create mode 100644 contrib/autoboost/boost/container/detail/utilities.hpp create mode 100644 contrib/autoboost/boost/container/detail/value_init.hpp create mode 100644 contrib/autoboost/boost/container/detail/variadic_templates_tools.hpp create mode 100644 contrib/autoboost/boost/container/detail/version_type.hpp create mode 100644 contrib/autoboost/boost/container/detail/workaround.hpp create mode 100644 contrib/autoboost/boost/container/scoped_allocator.hpp create mode 100644 contrib/autoboost/boost/container/scoped_allocator_fwd.hpp create mode 100644 contrib/autoboost/boost/container/throw_exception.hpp create mode 100644 contrib/autoboost/boost/container/vector.hpp create mode 100644 contrib/autoboost/boost/context/detail/config.hpp create mode 100644 contrib/autoboost/boost/context/fcontext.hpp create mode 100644 contrib/autoboost/boost/core/addressof.hpp create mode 100644 contrib/autoboost/boost/core/checked_delete.hpp create mode 100644 contrib/autoboost/boost/core/demangle.hpp create mode 100644 contrib/autoboost/boost/core/enable_if.hpp create mode 100644 contrib/autoboost/boost/core/explicit_operator_bool.hpp create mode 100644 contrib/autoboost/boost/core/ignore_unused.hpp create mode 100644 contrib/autoboost/boost/core/lightweight_test.hpp create mode 100644 contrib/autoboost/boost/core/no_exceptions_support.hpp create mode 100644 contrib/autoboost/boost/core/noncopyable.hpp create mode 100644 contrib/autoboost/boost/core/ref.hpp create mode 100644 contrib/autoboost/boost/core/scoped_enum.hpp create mode 100644 contrib/autoboost/boost/core/swap.hpp create mode 100644 contrib/autoboost/boost/core/typeinfo.hpp create mode 100644 contrib/autoboost/boost/coroutine/all.hpp create mode 100644 contrib/autoboost/boost/coroutine/asymmetric_coroutine.hpp create mode 100644 contrib/autoboost/boost/coroutine/attributes.hpp create mode 100644 contrib/autoboost/boost/coroutine/coroutine.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/config.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/coroutine_context.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/flags.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/parameters.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/pull_coroutine_impl.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/pull_coroutine_object.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/pull_coroutine_synthesized.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/push_coroutine_impl.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/push_coroutine_object.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/push_coroutine_synthesized.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/setup.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/symmetric_coroutine_call.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/symmetric_coroutine_impl.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/symmetric_coroutine_object.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/symmetric_coroutine_yield.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/trampoline.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/trampoline_pull.hpp create mode 100644 contrib/autoboost/boost/coroutine/detail/trampoline_push.hpp create mode 100644 contrib/autoboost/boost/coroutine/exceptions.hpp create mode 100644 contrib/autoboost/boost/coroutine/flags.hpp create mode 100644 contrib/autoboost/boost/coroutine/posix/protected_stack_allocator.hpp create mode 100644 contrib/autoboost/boost/coroutine/posix/segmented_stack_allocator.hpp create mode 100644 contrib/autoboost/boost/coroutine/protected_stack_allocator.hpp create mode 100644 contrib/autoboost/boost/coroutine/segmented_stack_allocator.hpp create mode 100644 contrib/autoboost/boost/coroutine/stack_allocator.hpp create mode 100644 contrib/autoboost/boost/coroutine/stack_context.hpp create mode 100644 contrib/autoboost/boost/coroutine/stack_traits.hpp create mode 100644 contrib/autoboost/boost/coroutine/standard_stack_allocator.hpp create mode 100644 contrib/autoboost/boost/coroutine/symmetric_coroutine.hpp create mode 100644 contrib/autoboost/boost/coroutine/windows/protected_stack_allocator.hpp create mode 100644 contrib/autoboost/boost/cregex.hpp create mode 100644 contrib/autoboost/boost/cstdint.hpp create mode 100644 contrib/autoboost/boost/cstdlib.hpp create mode 100644 contrib/autoboost/boost/current_function.hpp create mode 100644 contrib/autoboost/boost/date_time/adjust_functors.hpp create mode 100644 contrib/autoboost/boost/date_time/c_time.hpp create mode 100644 contrib/autoboost/boost/date_time/compiler_config.hpp create mode 100644 contrib/autoboost/boost/date_time/constrained_value.hpp create mode 100644 contrib/autoboost/boost/date_time/date.hpp create mode 100644 contrib/autoboost/boost/date_time/date_clock_device.hpp create mode 100644 contrib/autoboost/boost/date_time/date_defs.hpp create mode 100644 contrib/autoboost/boost/date_time/date_duration.hpp create mode 100644 contrib/autoboost/boost/date_time/date_duration_types.hpp create mode 100644 contrib/autoboost/boost/date_time/date_facet.hpp create mode 100644 contrib/autoboost/boost/date_time/date_format_simple.hpp create mode 100644 contrib/autoboost/boost/date_time/date_formatting.hpp create mode 100644 contrib/autoboost/boost/date_time/date_formatting_limited.hpp create mode 100644 contrib/autoboost/boost/date_time/date_formatting_locales.hpp create mode 100644 contrib/autoboost/boost/date_time/date_generator_formatter.hpp create mode 100644 contrib/autoboost/boost/date_time/date_generator_parser.hpp create mode 100644 contrib/autoboost/boost/date_time/date_generators.hpp create mode 100644 contrib/autoboost/boost/date_time/date_iterator.hpp create mode 100644 contrib/autoboost/boost/date_time/date_names_put.hpp create mode 100644 contrib/autoboost/boost/date_time/date_parsing.hpp create mode 100644 contrib/autoboost/boost/date_time/dst_rules.hpp create mode 100644 contrib/autoboost/boost/date_time/filetime_functions.hpp create mode 100644 contrib/autoboost/boost/date_time/format_date_parser.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/conversion.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/formatters.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/formatters_limited.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_calendar.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_date.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_day.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_day_of_year.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_duration.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_duration_types.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_facet.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_month.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_weekday.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_year.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/greg_ymd.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/gregorian.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/gregorian_io.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/gregorian_types.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian/parsers.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian_calendar.hpp create mode 100644 contrib/autoboost/boost/date_time/gregorian_calendar.ipp create mode 100644 contrib/autoboost/boost/date_time/int_adapter.hpp create mode 100644 contrib/autoboost/boost/date_time/iso_format.hpp create mode 100644 contrib/autoboost/boost/date_time/locale_config.hpp create mode 100644 contrib/autoboost/boost/date_time/microsec_time_clock.hpp create mode 100644 contrib/autoboost/boost/date_time/parse_format_base.hpp create mode 100644 contrib/autoboost/boost/date_time/period.hpp create mode 100644 contrib/autoboost/boost/date_time/period_formatter.hpp create mode 100644 contrib/autoboost/boost/date_time/period_parser.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/conversion.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/date_duration_operators.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/posix_time.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/posix_time_config.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/posix_time_duration.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/posix_time_io.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/posix_time_legacy_io.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/posix_time_system.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/posix_time_types.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/ptime.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/time_formatters.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/time_formatters_limited.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/time_parsers.hpp create mode 100644 contrib/autoboost/boost/date_time/posix_time/time_period.hpp create mode 100644 contrib/autoboost/boost/date_time/special_defs.hpp create mode 100644 contrib/autoboost/boost/date_time/special_values_formatter.hpp create mode 100644 contrib/autoboost/boost/date_time/special_values_parser.hpp create mode 100644 contrib/autoboost/boost/date_time/string_convert.hpp create mode 100644 contrib/autoboost/boost/date_time/string_parse_tree.hpp create mode 100644 contrib/autoboost/boost/date_time/strings_from_facet.hpp create mode 100644 contrib/autoboost/boost/date_time/time.hpp create mode 100644 contrib/autoboost/boost/date_time/time_clock.hpp create mode 100644 contrib/autoboost/boost/date_time/time_defs.hpp create mode 100644 contrib/autoboost/boost/date_time/time_duration.hpp create mode 100644 contrib/autoboost/boost/date_time/time_facet.hpp create mode 100644 contrib/autoboost/boost/date_time/time_formatting_streams.hpp create mode 100644 contrib/autoboost/boost/date_time/time_iterator.hpp create mode 100644 contrib/autoboost/boost/date_time/time_parsing.hpp create mode 100644 contrib/autoboost/boost/date_time/time_resolution_traits.hpp create mode 100644 contrib/autoboost/boost/date_time/time_system_counted.hpp create mode 100644 contrib/autoboost/boost/date_time/time_system_split.hpp create mode 100644 contrib/autoboost/boost/date_time/wrapping_int.hpp create mode 100644 contrib/autoboost/boost/date_time/year_month_day.hpp create mode 100644 contrib/autoboost/boost/detail/atomic_count.hpp create mode 100644 contrib/autoboost/boost/detail/atomic_redef_macros.hpp create mode 100644 contrib/autoboost/boost/detail/atomic_undef_macros.hpp create mode 100644 contrib/autoboost/boost/detail/basic_pointerbuf.hpp create mode 100644 contrib/autoboost/boost/detail/binary_search.hpp create mode 100644 contrib/autoboost/boost/detail/call_traits.hpp create mode 100644 contrib/autoboost/boost/detail/compressed_pair.hpp create mode 100644 contrib/autoboost/boost/detail/container_fwd.hpp create mode 100644 contrib/autoboost/boost/detail/endian.hpp create mode 100644 contrib/autoboost/boost/detail/fenv.hpp create mode 100644 contrib/autoboost/boost/detail/indirect_traits.hpp create mode 100644 contrib/autoboost/boost/detail/interlocked.hpp create mode 100644 contrib/autoboost/boost/detail/is_incrementable.hpp create mode 100644 contrib/autoboost/boost/detail/iterator.hpp create mode 100644 contrib/autoboost/boost/detail/lcast_precision.hpp create mode 100644 contrib/autoboost/boost/detail/lightweight_mutex.hpp create mode 100644 contrib/autoboost/boost/detail/lightweight_test.hpp create mode 100644 contrib/autoboost/boost/detail/no_exceptions_support.hpp create mode 100644 contrib/autoboost/boost/detail/reference_content.hpp create mode 100644 contrib/autoboost/boost/detail/scoped_enum_emulation.hpp create mode 100644 contrib/autoboost/boost/detail/sp_typeinfo.hpp create mode 100644 contrib/autoboost/boost/detail/utf8_codecvt_facet.hpp create mode 100644 contrib/autoboost/boost/detail/utf8_codecvt_facet.ipp create mode 100644 contrib/autoboost/boost/detail/winapi/GetLastError.hpp create mode 100644 contrib/autoboost/boost/detail/winapi/basic_types.hpp create mode 100644 contrib/autoboost/boost/detail/winapi/config.hpp create mode 100644 contrib/autoboost/boost/detail/winapi/time.hpp create mode 100644 contrib/autoboost/boost/detail/winapi/timers.hpp create mode 100644 contrib/autoboost/boost/detail/workaround.hpp create mode 100644 contrib/autoboost/boost/enable_shared_from_this.hpp create mode 100644 contrib/autoboost/boost/exception/current_exception_cast.hpp create mode 100644 contrib/autoboost/boost/exception/detail/clone_current_exception.hpp create mode 100644 contrib/autoboost/boost/exception/detail/error_info_impl.hpp create mode 100644 contrib/autoboost/boost/exception/detail/exception_ptr.hpp create mode 100644 contrib/autoboost/boost/exception/detail/is_output_streamable.hpp create mode 100644 contrib/autoboost/boost/exception/detail/object_hex_dump.hpp create mode 100644 contrib/autoboost/boost/exception/detail/type_info.hpp create mode 100644 contrib/autoboost/boost/exception/diagnostic_information.hpp create mode 100644 contrib/autoboost/boost/exception/exception.hpp create mode 100644 contrib/autoboost/boost/exception/get_error_info.hpp create mode 100644 contrib/autoboost/boost/exception/info.hpp create mode 100644 contrib/autoboost/boost/exception/to_string.hpp create mode 100644 contrib/autoboost/boost/exception/to_string_stub.hpp create mode 100644 contrib/autoboost/boost/exception_ptr.hpp create mode 100644 contrib/autoboost/boost/function.hpp create mode 100644 contrib/autoboost/boost/function/detail/function_iterate.hpp create mode 100644 contrib/autoboost/boost/function/detail/gen_maybe_include.pl create mode 100644 contrib/autoboost/boost/function/detail/maybe_include.hpp create mode 100644 contrib/autoboost/boost/function/detail/prologue.hpp create mode 100644 contrib/autoboost/boost/function/function0.hpp create mode 100644 contrib/autoboost/boost/function/function1.hpp create mode 100644 contrib/autoboost/boost/function/function10.hpp create mode 100644 contrib/autoboost/boost/function/function2.hpp create mode 100644 contrib/autoboost/boost/function/function3.hpp create mode 100644 contrib/autoboost/boost/function/function4.hpp create mode 100644 contrib/autoboost/boost/function/function5.hpp create mode 100644 contrib/autoboost/boost/function/function6.hpp create mode 100644 contrib/autoboost/boost/function/function7.hpp create mode 100644 contrib/autoboost/boost/function/function8.hpp create mode 100644 contrib/autoboost/boost/function/function9.hpp create mode 100644 contrib/autoboost/boost/function/function_base.hpp create mode 100644 contrib/autoboost/boost/function/function_fwd.hpp create mode 100644 contrib/autoboost/boost/function/function_template.hpp create mode 100644 contrib/autoboost/boost/function_equal.hpp create mode 100644 contrib/autoboost/boost/functional/hash.hpp create mode 100644 contrib/autoboost/boost/functional/hash/detail/float_functions.hpp create mode 100644 contrib/autoboost/boost/functional/hash/detail/hash_float.hpp create mode 100644 contrib/autoboost/boost/functional/hash/detail/limits.hpp create mode 100644 contrib/autoboost/boost/functional/hash/extensions.hpp create mode 100644 contrib/autoboost/boost/functional/hash/hash.hpp create mode 100644 contrib/autoboost/boost/functional/hash/hash_fwd.hpp create mode 100644 contrib/autoboost/boost/functional/hash_fwd.hpp create mode 100644 contrib/autoboost/boost/get_pointer.hpp create mode 100644 contrib/autoboost/boost/indirect_reference.hpp create mode 100644 contrib/autoboost/boost/integer.hpp create mode 100644 contrib/autoboost/boost/integer/static_log2.hpp create mode 100644 contrib/autoboost/boost/integer_fwd.hpp create mode 100644 contrib/autoboost/boost/integer_traits.hpp create mode 100644 contrib/autoboost/boost/intrusive/circular_slist_algorithms.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/algo_type.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/array_initializer.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/assert.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/common_slist_algorithms.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/config_begin.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/config_end.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/default_header_holder.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/ebo_functor_holder.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/equal_to_value.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/exception_disposer.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/function_detector.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/generic_hook.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/get_value_traits.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/has_member_function_callable_with.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/hook_traits.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/iiterator.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/is_stateful_value_traits.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/key_nodeptr_comp.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/memory_util.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/mpl.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/node_holder.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/parent_from_member.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/pointer_element.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/preprocessor.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/reverse_iterator.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/simple_disposers.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/size_holder.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/slist_iterator.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/slist_node.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/std_fwd.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/to_raw_pointer.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/uncast.hpp create mode 100644 contrib/autoboost/boost/intrusive/detail/workaround.hpp create mode 100644 contrib/autoboost/boost/intrusive/intrusive_fwd.hpp create mode 100644 contrib/autoboost/boost/intrusive/linear_slist_algorithms.hpp create mode 100644 contrib/autoboost/boost/intrusive/link_mode.hpp create mode 100644 contrib/autoboost/boost/intrusive/options.hpp create mode 100644 contrib/autoboost/boost/intrusive/pack_options.hpp create mode 100644 contrib/autoboost/boost/intrusive/pointer_rebind.hpp create mode 100644 contrib/autoboost/boost/intrusive/pointer_traits.hpp create mode 100644 contrib/autoboost/boost/intrusive/slist.hpp create mode 100644 contrib/autoboost/boost/intrusive/slist_hook.hpp create mode 100644 contrib/autoboost/boost/intrusive_ptr.hpp create mode 100644 contrib/autoboost/boost/io/ios_state.hpp create mode 100644 contrib/autoboost/boost/io_fwd.hpp create mode 100644 contrib/autoboost/boost/is_placeholder.hpp create mode 100644 contrib/autoboost/boost/iterator.hpp create mode 100644 contrib/autoboost/boost/iterator/detail/config_def.hpp create mode 100644 contrib/autoboost/boost/iterator/detail/config_undef.hpp create mode 100644 contrib/autoboost/boost/iterator/detail/enable_if.hpp create mode 100644 contrib/autoboost/boost/iterator/detail/facade_iterator_category.hpp create mode 100644 contrib/autoboost/boost/iterator/detail/minimum_category.hpp create mode 100644 contrib/autoboost/boost/iterator/filter_iterator.hpp create mode 100644 contrib/autoboost/boost/iterator/interoperable.hpp create mode 100644 contrib/autoboost/boost/iterator/iterator_adaptor.hpp create mode 100644 contrib/autoboost/boost/iterator/iterator_categories.hpp create mode 100644 contrib/autoboost/boost/iterator/iterator_concepts.hpp create mode 100644 contrib/autoboost/boost/iterator/iterator_facade.hpp create mode 100644 contrib/autoboost/boost/iterator/iterator_traits.hpp create mode 100644 contrib/autoboost/boost/iterator/minimum_category.hpp create mode 100644 contrib/autoboost/boost/iterator/reverse_iterator.hpp create mode 100644 contrib/autoboost/boost/iterator/transform_iterator.hpp create mode 100644 contrib/autoboost/boost/lambda/bind.hpp create mode 100644 contrib/autoboost/boost/lambda/core.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/actions.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/arity_code.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/bind_functions.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/function_adaptors.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/is_instance_of.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/lambda_config.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/lambda_functor_base.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/lambda_functors.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/lambda_fwd.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/lambda_traits.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/member_ptr.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/operator_actions.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/operator_lambda_func_base.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/operator_return_type_traits.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/operators.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/ret.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/return_type_traits.hpp create mode 100644 contrib/autoboost/boost/lambda/detail/select_functions.hpp create mode 100644 contrib/autoboost/boost/lambda/if.hpp create mode 100644 contrib/autoboost/boost/lambda/lambda.hpp create mode 100644 contrib/autoboost/boost/lexical_cast.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/bad_lexical_cast.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/converter_lexical.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/converter_lexical_streams.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/converter_numeric.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/inf_nan.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/is_character.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/lcast_char_constants.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/lcast_float_converters.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/lcast_unsigned_converters.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/detail/widest_char.hpp create mode 100644 contrib/autoboost/boost/lexical_cast/try_lexical_convert.hpp create mode 100644 contrib/autoboost/boost/limits.hpp create mode 100644 contrib/autoboost/boost/logic/tribool.hpp create mode 100644 contrib/autoboost/boost/logic/tribool_fwd.hpp create mode 100644 contrib/autoboost/boost/make_shared.hpp create mode 100644 contrib/autoboost/boost/math/common_factor_rt.hpp create mode 100644 contrib/autoboost/boost/math/policies/policy.hpp create mode 100644 contrib/autoboost/boost/math/special_functions/detail/fp_traits.hpp create mode 100644 contrib/autoboost/boost/math/special_functions/detail/round_fwd.hpp create mode 100644 contrib/autoboost/boost/math/special_functions/fpclassify.hpp create mode 100644 contrib/autoboost/boost/math/special_functions/math_fwd.hpp create mode 100644 contrib/autoboost/boost/math/special_functions/sign.hpp create mode 100644 contrib/autoboost/boost/math/tools/config.hpp create mode 100644 contrib/autoboost/boost/math/tools/promotion.hpp create mode 100644 contrib/autoboost/boost/math/tools/real_cast.hpp create mode 100644 contrib/autoboost/boost/math/tools/user.hpp create mode 100644 contrib/autoboost/boost/math_fwd.hpp create mode 100644 contrib/autoboost/boost/mem_fn.hpp create mode 100644 contrib/autoboost/boost/memory_order.hpp create mode 100644 contrib/autoboost/boost/move/algorithm.hpp create mode 100644 contrib/autoboost/boost/move/core.hpp create mode 100644 contrib/autoboost/boost/move/default_delete.hpp create mode 100644 contrib/autoboost/boost/move/detail/config_begin.hpp create mode 100644 contrib/autoboost/boost/move/detail/config_end.hpp create mode 100644 contrib/autoboost/boost/move/detail/meta_utils.hpp create mode 100644 contrib/autoboost/boost/move/detail/move_helpers.hpp create mode 100644 contrib/autoboost/boost/move/detail/unique_ptr_meta_utils.hpp create mode 100644 contrib/autoboost/boost/move/detail/workaround.hpp create mode 100644 contrib/autoboost/boost/move/iterator.hpp create mode 100644 contrib/autoboost/boost/move/make_unique.hpp create mode 100644 contrib/autoboost/boost/move/move.hpp create mode 100644 contrib/autoboost/boost/move/traits.hpp create mode 100644 contrib/autoboost/boost/move/unique_ptr.hpp create mode 100644 contrib/autoboost/boost/move/utility.hpp create mode 100644 contrib/autoboost/boost/move/utility_core.hpp create mode 100644 contrib/autoboost/boost/mpl/O1_size.hpp create mode 100644 contrib/autoboost/boost/mpl/O1_size_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/advance.hpp create mode 100644 contrib/autoboost/boost/mpl/advance_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/always.hpp create mode 100644 contrib/autoboost/boost/mpl/and.hpp create mode 100644 contrib/autoboost/boost/mpl/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/arg_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/assert.hpp create mode 100644 contrib/autoboost/boost/mpl/at.hpp create mode 100644 contrib/autoboost/boost/mpl/at_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/O1_size_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/adl_barrier.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/arg_typedef.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/arithmetic_op.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/arity_spec.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/at_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/begin_end_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/clear_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/common_name_wknd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/comparison_op.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/adl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/arrays.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/bcc.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/compiler.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/dependent_nttp.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/dtp.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/eti.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/forwarding.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/gcc.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/gpu.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/has_apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/has_xxx.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/integral.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/intel.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/msvc.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/msvc_typename.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/nttp.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/overload_resolution.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/pp_counter.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/preprocessor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/static_constant.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/ttp.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/typeof.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/use_preprocessed.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/config/workaround.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/contains_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/count_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/find_if_pred.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/fold_impl_body.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/has_apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/has_begin.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/has_rebind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/has_size.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/has_tag.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/has_type.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/include_preprocessed.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/inserter_algorithm.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/integral_wrapper.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/is_msvc_eti_arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/iter_apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/lambda_arity_param.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/lambda_spec.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/lambda_support.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/largest_int.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/logical_op.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/msvc_dtw.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/msvc_eti_base.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/msvc_is_class.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/msvc_never_true.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/msvc_type.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/na.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/na_assert.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/na_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/na_spec.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/nested_type_wknd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/nttp_decl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/numeric_cast_utils.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/numeric_op.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc551/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/bcc_pre590/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/dmc/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/gcc/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc60/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/msvc70/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/mwcw/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ctps/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/no_ttp/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/advance_backward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/advance_forward.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/and.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/apply.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/apply_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/apply_wrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/arg.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/basic_bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/bitand.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/bitor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/bitxor.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/deque.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/divides.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/full_lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/inherit.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/iter_fold_if_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/lambda_no_ctps.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/less.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/list.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/list_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/map.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/modulus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/or.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/reverse_iter_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/set.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/set_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/shift_left.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/shift_right.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/times.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/unpack_args.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessed/plain/vector_c.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/add.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/def_params_tail.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/default_params.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/enum.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/ext_params.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/filter_params.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/params.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/partial_spec_params.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/range.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/repeat.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/sub.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/preprocessor/tuple.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/push_back_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/push_front_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/reverse_fold_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/reverse_fold_impl_body.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/sequence_wrapper.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/size_impl.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/static_cast.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/template_arity.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/template_arity_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/traits_lambda_spec.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/type_wrapper.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/unwrap.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/value_wknd.hpp create mode 100644 contrib/autoboost/boost/mpl/aux_/yes_no.hpp create mode 100644 contrib/autoboost/boost/mpl/back_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/back_inserter.hpp create mode 100644 contrib/autoboost/boost/mpl/begin_end.hpp create mode 100644 contrib/autoboost/boost/mpl/begin_end_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/bind.hpp create mode 100644 contrib/autoboost/boost/mpl/bind_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/bool.hpp create mode 100644 contrib/autoboost/boost/mpl/bool_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/clear.hpp create mode 100644 contrib/autoboost/boost/mpl/clear_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/comparison.hpp create mode 100644 contrib/autoboost/boost/mpl/contains.hpp create mode 100644 contrib/autoboost/boost/mpl/contains_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/copy.hpp create mode 100644 contrib/autoboost/boost/mpl/deref.hpp create mode 100644 contrib/autoboost/boost/mpl/distance.hpp create mode 100644 contrib/autoboost/boost/mpl/distance_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/empty_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/eval_if.hpp create mode 100644 contrib/autoboost/boost/mpl/find.hpp create mode 100644 contrib/autoboost/boost/mpl/find_if.hpp create mode 100644 contrib/autoboost/boost/mpl/fold.hpp create mode 100644 contrib/autoboost/boost/mpl/for_each.hpp create mode 100644 contrib/autoboost/boost/mpl/front_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/front_inserter.hpp create mode 100644 contrib/autoboost/boost/mpl/greater.hpp create mode 100644 contrib/autoboost/boost/mpl/greater_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/has_xxx.hpp create mode 100644 contrib/autoboost/boost/mpl/identity.hpp create mode 100644 contrib/autoboost/boost/mpl/if.hpp create mode 100644 contrib/autoboost/boost/mpl/inserter.hpp create mode 100644 contrib/autoboost/boost/mpl/int.hpp create mode 100644 contrib/autoboost/boost/mpl/int_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/integral_c.hpp create mode 100644 contrib/autoboost/boost/mpl/integral_c_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/integral_c_tag.hpp create mode 100644 contrib/autoboost/boost/mpl/is_placeholder.hpp create mode 100644 contrib/autoboost/boost/mpl/is_sequence.hpp create mode 100644 contrib/autoboost/boost/mpl/iter_fold.hpp create mode 100644 contrib/autoboost/boost/mpl/iter_fold_if.hpp create mode 100644 contrib/autoboost/boost/mpl/iterator_range.hpp create mode 100644 contrib/autoboost/boost/mpl/iterator_tags.hpp create mode 100644 contrib/autoboost/boost/mpl/lambda.hpp create mode 100644 contrib/autoboost/boost/mpl/lambda_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/less.hpp create mode 100644 contrib/autoboost/boost/mpl/less_equal.hpp create mode 100644 contrib/autoboost/boost/mpl/limits/arity.hpp create mode 100644 contrib/autoboost/boost/mpl/limits/list.hpp create mode 100644 contrib/autoboost/boost/mpl/limits/unrolling.hpp create mode 100644 contrib/autoboost/boost/mpl/limits/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/list.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/O1_size.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/begin_end.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/clear.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/empty.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/front.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/include_preprocessed.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/item.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/iterator.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/numbered.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/numbered_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/pop_front.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list10.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list10_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list20.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list20_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list30.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list30_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list40.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list40_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list50.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/preprocessed/plain/list50_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/push_back.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/push_front.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/size.hpp create mode 100644 contrib/autoboost/boost/mpl/list/aux_/tag.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list0.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list0_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list10.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list10_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list20.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list20_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list30.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list30_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list40.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list40_c.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list50.hpp create mode 100644 contrib/autoboost/boost/mpl/list/list50_c.hpp create mode 100644 contrib/autoboost/boost/mpl/logical.hpp create mode 100644 contrib/autoboost/boost/mpl/long.hpp create mode 100644 contrib/autoboost/boost/mpl/long_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/minus.hpp create mode 100644 contrib/autoboost/boost/mpl/multiplies.hpp create mode 100644 contrib/autoboost/boost/mpl/negate.hpp create mode 100644 contrib/autoboost/boost/mpl/next.hpp create mode 100644 contrib/autoboost/boost/mpl/next_prior.hpp create mode 100644 contrib/autoboost/boost/mpl/not.hpp create mode 100644 contrib/autoboost/boost/mpl/not_equal_to.hpp create mode 100644 contrib/autoboost/boost/mpl/numeric_cast.hpp create mode 100644 contrib/autoboost/boost/mpl/or.hpp create mode 100644 contrib/autoboost/boost/mpl/pair.hpp create mode 100644 contrib/autoboost/boost/mpl/placeholders.hpp create mode 100644 contrib/autoboost/boost/mpl/plus.hpp create mode 100644 contrib/autoboost/boost/mpl/pop_back_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/pop_front_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/print.hpp create mode 100644 contrib/autoboost/boost/mpl/prior.hpp create mode 100644 contrib/autoboost/boost/mpl/protect.hpp create mode 100644 contrib/autoboost/boost/mpl/push_back.hpp create mode 100644 contrib/autoboost/boost/mpl/push_back_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/push_front.hpp create mode 100644 contrib/autoboost/boost/mpl/push_front_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/quote.hpp create mode 100644 contrib/autoboost/boost/mpl/remove_if.hpp create mode 100644 contrib/autoboost/boost/mpl/reverse_fold.hpp create mode 100644 contrib/autoboost/boost/mpl/same_as.hpp create mode 100644 contrib/autoboost/boost/mpl/sequence_tag.hpp create mode 100644 contrib/autoboost/boost/mpl/sequence_tag_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/size.hpp create mode 100644 contrib/autoboost/boost/mpl/size_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/size_t.hpp create mode 100644 contrib/autoboost/boost/mpl/size_t_fwd.hpp create mode 100644 contrib/autoboost/boost/mpl/tag.hpp create mode 100644 contrib/autoboost/boost/mpl/times.hpp create mode 100644 contrib/autoboost/boost/mpl/vector.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/O1_size.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/at.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/back.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/begin_end.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/clear.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/empty.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/front.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/include_preprocessed.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/item.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/iterator.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/numbered.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/numbered_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/pop_back.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/pop_front.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector10.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector10_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector20.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector20_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector30.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector30_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector40.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector40_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector50.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/no_ctps/vector50_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector10.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector10_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector20.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector20_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector30.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector30_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector40.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector40_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector50.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/plain/vector50_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector20.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector20_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector30.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector30_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector40.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector40_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector50.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/preprocessed/typeof_based/vector50_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/push_back.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/push_front.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/size.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/tag.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/aux_/vector0.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector0.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector0_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector10.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector10_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector20.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector20_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector30.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector30_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector40.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector40_c.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector50.hpp create mode 100644 contrib/autoboost/boost/mpl/vector/vector50_c.hpp create mode 100644 contrib/autoboost/boost/mpl/void.hpp create mode 100644 contrib/autoboost/boost/mpl/void_fwd.hpp create mode 100644 contrib/autoboost/boost/next_prior.hpp create mode 100644 contrib/autoboost/boost/non_type.hpp create mode 100644 contrib/autoboost/boost/noncopyable.hpp create mode 100644 contrib/autoboost/boost/none.hpp create mode 100644 contrib/autoboost/boost/none_t.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/bounds.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/cast.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/conversion_traits.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/converter.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/converter_policies.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/bounds.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/conversion_traits.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/converter.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/int_float_mixture.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/is_subranged.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/meta.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/numeric_cast_traits.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/old_numeric_cast.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/sign_mixture.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/detail/udt_builtin_mixture.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/int_float_mixture_enum.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/numeric_cast_traits.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/sign_mixture_enum.hpp create mode 100644 contrib/autoboost/boost/numeric/conversion/udt_builtin_mixture_enum.hpp create mode 100644 contrib/autoboost/boost/operators.hpp create mode 100644 contrib/autoboost/boost/optional.hpp create mode 100644 contrib/autoboost/boost/optional/bad_optional_access.hpp create mode 100644 contrib/autoboost/boost/optional/optional.hpp create mode 100644 contrib/autoboost/boost/optional/optional_fwd.hpp create mode 100644 contrib/autoboost/boost/pointee.hpp create mode 100644 contrib/autoboost/boost/predef.h create mode 100644 contrib/autoboost/boost/predef/architecture.h create mode 100644 contrib/autoboost/boost/predef/architecture/alpha.h create mode 100644 contrib/autoboost/boost/predef/architecture/arm.h create mode 100644 contrib/autoboost/boost/predef/architecture/blackfin.h create mode 100644 contrib/autoboost/boost/predef/architecture/convex.h create mode 100644 contrib/autoboost/boost/predef/architecture/ia64.h create mode 100644 contrib/autoboost/boost/predef/architecture/m68k.h create mode 100644 contrib/autoboost/boost/predef/architecture/mips.h create mode 100644 contrib/autoboost/boost/predef/architecture/parisc.h create mode 100644 contrib/autoboost/boost/predef/architecture/ppc.h create mode 100644 contrib/autoboost/boost/predef/architecture/pyramid.h create mode 100644 contrib/autoboost/boost/predef/architecture/rs6k.h create mode 100644 contrib/autoboost/boost/predef/architecture/sparc.h create mode 100644 contrib/autoboost/boost/predef/architecture/superh.h create mode 100644 contrib/autoboost/boost/predef/architecture/sys370.h create mode 100644 contrib/autoboost/boost/predef/architecture/sys390.h create mode 100644 contrib/autoboost/boost/predef/architecture/x86.h create mode 100644 contrib/autoboost/boost/predef/architecture/x86/32.h create mode 100644 contrib/autoboost/boost/predef/architecture/x86/64.h create mode 100644 contrib/autoboost/boost/predef/architecture/z.h create mode 100644 contrib/autoboost/boost/predef/compiler.h create mode 100644 contrib/autoboost/boost/predef/compiler/borland.h create mode 100644 contrib/autoboost/boost/predef/compiler/clang.h create mode 100644 contrib/autoboost/boost/predef/compiler/comeau.h create mode 100644 contrib/autoboost/boost/predef/compiler/compaq.h create mode 100644 contrib/autoboost/boost/predef/compiler/diab.h create mode 100644 contrib/autoboost/boost/predef/compiler/digitalmars.h create mode 100644 contrib/autoboost/boost/predef/compiler/dignus.h create mode 100644 contrib/autoboost/boost/predef/compiler/edg.h create mode 100644 contrib/autoboost/boost/predef/compiler/ekopath.h create mode 100644 contrib/autoboost/boost/predef/compiler/gcc.h create mode 100644 contrib/autoboost/boost/predef/compiler/gcc_xml.h create mode 100644 contrib/autoboost/boost/predef/compiler/greenhills.h create mode 100644 contrib/autoboost/boost/predef/compiler/hp_acc.h create mode 100644 contrib/autoboost/boost/predef/compiler/iar.h create mode 100644 contrib/autoboost/boost/predef/compiler/ibm.h create mode 100644 contrib/autoboost/boost/predef/compiler/intel.h create mode 100644 contrib/autoboost/boost/predef/compiler/kai.h create mode 100644 contrib/autoboost/boost/predef/compiler/llvm.h create mode 100644 contrib/autoboost/boost/predef/compiler/metaware.h create mode 100644 contrib/autoboost/boost/predef/compiler/metrowerks.h create mode 100644 contrib/autoboost/boost/predef/compiler/microtec.h create mode 100644 contrib/autoboost/boost/predef/compiler/mpw.h create mode 100644 contrib/autoboost/boost/predef/compiler/palm.h create mode 100644 contrib/autoboost/boost/predef/compiler/pgi.h create mode 100644 contrib/autoboost/boost/predef/compiler/sgi_mipspro.h create mode 100644 contrib/autoboost/boost/predef/compiler/sunpro.h create mode 100644 contrib/autoboost/boost/predef/compiler/tendra.h create mode 100644 contrib/autoboost/boost/predef/compiler/visualc.h create mode 100644 contrib/autoboost/boost/predef/compiler/watcom.h create mode 100644 contrib/autoboost/boost/predef/detail/_cassert.h create mode 100644 contrib/autoboost/boost/predef/detail/_exception.h create mode 100644 contrib/autoboost/boost/predef/detail/comp_detected.h create mode 100644 contrib/autoboost/boost/predef/detail/endian_compat.h create mode 100644 contrib/autoboost/boost/predef/detail/os_detected.h create mode 100644 contrib/autoboost/boost/predef/detail/platform_detected.h create mode 100644 contrib/autoboost/boost/predef/detail/test.h create mode 100644 contrib/autoboost/boost/predef/language.h create mode 100644 contrib/autoboost/boost/predef/language/objc.h create mode 100644 contrib/autoboost/boost/predef/language/stdc.h create mode 100644 contrib/autoboost/boost/predef/language/stdcpp.h create mode 100644 contrib/autoboost/boost/predef/library.h create mode 100644 contrib/autoboost/boost/predef/library/c.h create mode 100644 contrib/autoboost/boost/predef/library/c/_prefix.h create mode 100644 contrib/autoboost/boost/predef/library/c/gnu.h create mode 100644 contrib/autoboost/boost/predef/library/c/uc.h create mode 100644 contrib/autoboost/boost/predef/library/c/vms.h create mode 100644 contrib/autoboost/boost/predef/library/c/zos.h create mode 100644 contrib/autoboost/boost/predef/library/std.h create mode 100644 contrib/autoboost/boost/predef/library/std/_prefix.h create mode 100644 contrib/autoboost/boost/predef/library/std/cxx.h create mode 100644 contrib/autoboost/boost/predef/library/std/dinkumware.h create mode 100644 contrib/autoboost/boost/predef/library/std/libcomo.h create mode 100644 contrib/autoboost/boost/predef/library/std/modena.h create mode 100644 contrib/autoboost/boost/predef/library/std/msl.h create mode 100644 contrib/autoboost/boost/predef/library/std/roguewave.h create mode 100644 contrib/autoboost/boost/predef/library/std/sgi.h create mode 100644 contrib/autoboost/boost/predef/library/std/stdcpp3.h create mode 100644 contrib/autoboost/boost/predef/library/std/stlport.h create mode 100644 contrib/autoboost/boost/predef/library/std/vacpp.h create mode 100644 contrib/autoboost/boost/predef/make.h create mode 100644 contrib/autoboost/boost/predef/os.h create mode 100644 contrib/autoboost/boost/predef/os/aix.h create mode 100644 contrib/autoboost/boost/predef/os/amigaos.h create mode 100644 contrib/autoboost/boost/predef/os/android.h create mode 100644 contrib/autoboost/boost/predef/os/beos.h create mode 100644 contrib/autoboost/boost/predef/os/bsd.h create mode 100644 contrib/autoboost/boost/predef/os/bsd/bsdi.h create mode 100644 contrib/autoboost/boost/predef/os/bsd/dragonfly.h create mode 100644 contrib/autoboost/boost/predef/os/bsd/free.h create mode 100644 contrib/autoboost/boost/predef/os/bsd/net.h create mode 100644 contrib/autoboost/boost/predef/os/bsd/open.h create mode 100644 contrib/autoboost/boost/predef/os/cygwin.h create mode 100644 contrib/autoboost/boost/predef/os/hpux.h create mode 100644 contrib/autoboost/boost/predef/os/ios.h create mode 100644 contrib/autoboost/boost/predef/os/irix.h create mode 100644 contrib/autoboost/boost/predef/os/linux.h create mode 100644 contrib/autoboost/boost/predef/os/macos.h create mode 100644 contrib/autoboost/boost/predef/os/os400.h create mode 100644 contrib/autoboost/boost/predef/os/qnxnto.h create mode 100644 contrib/autoboost/boost/predef/os/solaris.h create mode 100644 contrib/autoboost/boost/predef/os/unix.h create mode 100644 contrib/autoboost/boost/predef/os/vms.h create mode 100644 contrib/autoboost/boost/predef/os/windows.h create mode 100644 contrib/autoboost/boost/predef/other.h create mode 100644 contrib/autoboost/boost/predef/other/endian.h create mode 100644 contrib/autoboost/boost/predef/platform.h create mode 100644 contrib/autoboost/boost/predef/platform/mingw.h create mode 100644 contrib/autoboost/boost/predef/platform/windows_desktop.h create mode 100644 contrib/autoboost/boost/predef/platform/windows_phone.h create mode 100644 contrib/autoboost/boost/predef/platform/windows_runtime.h create mode 100644 contrib/autoboost/boost/predef/platform/windows_store.h create mode 100644 contrib/autoboost/boost/predef/version_number.h create mode 100644 contrib/autoboost/boost/preprocessor/arithmetic/add.hpp create mode 100644 contrib/autoboost/boost/preprocessor/arithmetic/dec.hpp create mode 100644 contrib/autoboost/boost/preprocessor/arithmetic/detail/div_base.hpp create mode 100644 contrib/autoboost/boost/preprocessor/arithmetic/inc.hpp create mode 100644 contrib/autoboost/boost/preprocessor/arithmetic/mod.hpp create mode 100644 contrib/autoboost/boost/preprocessor/arithmetic/sub.hpp create mode 100644 contrib/autoboost/boost/preprocessor/array/data.hpp create mode 100644 contrib/autoboost/boost/preprocessor/array/elem.hpp create mode 100644 contrib/autoboost/boost/preprocessor/array/size.hpp create mode 100644 contrib/autoboost/boost/preprocessor/cat.hpp create mode 100644 contrib/autoboost/boost/preprocessor/comma_if.hpp create mode 100644 contrib/autoboost/boost/preprocessor/comparison/greater.hpp create mode 100644 contrib/autoboost/boost/preprocessor/comparison/less.hpp create mode 100644 contrib/autoboost/boost/preprocessor/comparison/less_equal.hpp create mode 100644 contrib/autoboost/boost/preprocessor/comparison/not_equal.hpp create mode 100644 contrib/autoboost/boost/preprocessor/config/config.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/deduce_d.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/detail/dmc/while.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/detail/edg/while.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/detail/msvc/while.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/detail/while.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/expr_if.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/expr_iif.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/if.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/iif.hpp create mode 100644 contrib/autoboost/boost/preprocessor/control/while.hpp create mode 100644 contrib/autoboost/boost/preprocessor/dec.hpp create mode 100644 contrib/autoboost/boost/preprocessor/detail/auto_rec.hpp create mode 100644 contrib/autoboost/boost/preprocessor/detail/check.hpp create mode 100644 contrib/autoboost/boost/preprocessor/detail/dmc/auto_rec.hpp create mode 100644 contrib/autoboost/boost/preprocessor/detail/is_binary.hpp create mode 100644 contrib/autoboost/boost/preprocessor/detail/is_unary.hpp create mode 100644 contrib/autoboost/boost/preprocessor/detail/split.hpp create mode 100644 contrib/autoboost/boost/preprocessor/empty.hpp create mode 100644 contrib/autoboost/boost/preprocessor/enum.hpp create mode 100644 contrib/autoboost/boost/preprocessor/enum_params.hpp create mode 100644 contrib/autoboost/boost/preprocessor/enum_params_with_a_default.hpp create mode 100644 contrib/autoboost/boost/preprocessor/enum_params_with_defaults.hpp create mode 100644 contrib/autoboost/boost/preprocessor/enum_shifted_params.hpp create mode 100644 contrib/autoboost/boost/preprocessor/expr_if.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/detail/is_empty.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/empty.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/expand.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/identity.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/intercept.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/is_1.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/is_empty.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/is_empty_variadic.hpp create mode 100644 contrib/autoboost/boost/preprocessor/facilities/overload.hpp create mode 100644 contrib/autoboost/boost/preprocessor/identity.hpp create mode 100644 contrib/autoboost/boost/preprocessor/if.hpp create mode 100644 contrib/autoboost/boost/preprocessor/inc.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iterate.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/lower1.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/lower2.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/lower3.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/lower4.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/lower5.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/upper1.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/upper2.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/upper3.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/upper4.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/bounds/upper5.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/finish.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/forward1.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/forward2.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/forward3.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/forward4.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/forward5.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/reverse1.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/reverse2.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/reverse3.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/reverse4.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/iter/reverse5.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/local.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/rlocal.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/self.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/detail/start.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/iterate.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/local.hpp create mode 100644 contrib/autoboost/boost/preprocessor/iteration/self.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/adt.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/append.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/detail/dmc/fold_left.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/detail/edg/fold_left.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/detail/edg/fold_right.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/detail/fold_left.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/detail/fold_right.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/fold_left.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/fold_right.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/for_each_i.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/reverse.hpp create mode 100644 contrib/autoboost/boost/preprocessor/list/transform.hpp create mode 100644 contrib/autoboost/boost/preprocessor/logical/and.hpp create mode 100644 contrib/autoboost/boost/preprocessor/logical/bitand.hpp create mode 100644 contrib/autoboost/boost/preprocessor/logical/bitor.hpp create mode 100644 contrib/autoboost/boost/preprocessor/logical/bool.hpp create mode 100644 contrib/autoboost/boost/preprocessor/logical/compl.hpp create mode 100644 contrib/autoboost/boost/preprocessor/logical/not.hpp create mode 100644 contrib/autoboost/boost/preprocessor/logical/or.hpp create mode 100644 contrib/autoboost/boost/preprocessor/punctuation/comma.hpp create mode 100644 contrib/autoboost/boost/preprocessor/punctuation/comma_if.hpp create mode 100644 contrib/autoboost/boost/preprocessor/punctuation/detail/is_begin_parens.hpp create mode 100644 contrib/autoboost/boost/preprocessor/punctuation/is_begin_parens.hpp create mode 100644 contrib/autoboost/boost/preprocessor/punctuation/paren.hpp create mode 100644 contrib/autoboost/boost/preprocessor/punctuation/paren_if.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repeat.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repeat_2nd.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repeat_from_to.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/detail/dmc/for.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/detail/edg/for.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/detail/for.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/detail/msvc/for.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum_binary_params.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum_params.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum_params_with_a_default.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum_params_with_defaults.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum_shifted_params.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum_trailing.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/enum_trailing_params.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/for.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/repeat.hpp create mode 100644 contrib/autoboost/boost/preprocessor/repetition/repeat_from_to.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/cat.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/detail/split.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/elem.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/enum.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/first_n.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/fold_left.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/for_each.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/for_each_i.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/rest_n.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/seq.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/size.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/subseq.hpp create mode 100644 contrib/autoboost/boost/preprocessor/seq/transform.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/counter.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/def.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/shared.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/slot1.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/slot2.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/slot3.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/slot4.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/detail/slot5.hpp create mode 100644 contrib/autoboost/boost/preprocessor/slot/slot.hpp create mode 100644 contrib/autoboost/boost/preprocessor/stringize.hpp create mode 100644 contrib/autoboost/boost/preprocessor/tuple/detail/is_single_return.hpp create mode 100644 contrib/autoboost/boost/preprocessor/tuple/eat.hpp create mode 100644 contrib/autoboost/boost/preprocessor/tuple/elem.hpp create mode 100644 contrib/autoboost/boost/preprocessor/tuple/rem.hpp create mode 100644 contrib/autoboost/boost/preprocessor/tuple/size.hpp create mode 100644 contrib/autoboost/boost/preprocessor/tuple/to_list.hpp create mode 100644 contrib/autoboost/boost/preprocessor/variadic/elem.hpp create mode 100644 contrib/autoboost/boost/preprocessor/variadic/size.hpp create mode 100644 contrib/autoboost/boost/progress.hpp create mode 100644 contrib/autoboost/boost/range.hpp create mode 100644 contrib/autoboost/boost/range/algorithm/equal.hpp create mode 100644 contrib/autoboost/boost/range/as_literal.hpp create mode 100644 contrib/autoboost/boost/range/begin.hpp create mode 100644 contrib/autoboost/boost/range/category.hpp create mode 100644 contrib/autoboost/boost/range/concepts.hpp create mode 100644 contrib/autoboost/boost/range/config.hpp create mode 100644 contrib/autoboost/boost/range/const_iterator.hpp create mode 100644 contrib/autoboost/boost/range/const_reverse_iterator.hpp create mode 100644 contrib/autoboost/boost/range/detail/as_literal.hpp create mode 100644 contrib/autoboost/boost/range/detail/begin.hpp create mode 100644 contrib/autoboost/boost/range/detail/common.hpp create mode 100644 contrib/autoboost/boost/range/detail/detail_str.hpp create mode 100644 contrib/autoboost/boost/range/detail/end.hpp create mode 100644 contrib/autoboost/boost/range/detail/extract_optional_type.hpp create mode 100644 contrib/autoboost/boost/range/detail/has_member_size.hpp create mode 100644 contrib/autoboost/boost/range/detail/implementation_help.hpp create mode 100644 contrib/autoboost/boost/range/detail/misc_concept.hpp create mode 100644 contrib/autoboost/boost/range/detail/msvc_has_iterator_workaround.hpp create mode 100644 contrib/autoboost/boost/range/detail/remove_extent.hpp create mode 100644 contrib/autoboost/boost/range/detail/safe_bool.hpp create mode 100644 contrib/autoboost/boost/range/detail/sfinae.hpp create mode 100644 contrib/autoboost/boost/range/detail/size_type.hpp create mode 100644 contrib/autoboost/boost/range/detail/str_types.hpp create mode 100644 contrib/autoboost/boost/range/detail/value_type.hpp create mode 100644 contrib/autoboost/boost/range/difference_type.hpp create mode 100644 contrib/autoboost/boost/range/distance.hpp create mode 100644 contrib/autoboost/boost/range/empty.hpp create mode 100644 contrib/autoboost/boost/range/end.hpp create mode 100644 contrib/autoboost/boost/range/functions.hpp create mode 100644 contrib/autoboost/boost/range/has_range_iterator.hpp create mode 100644 contrib/autoboost/boost/range/iterator.hpp create mode 100644 contrib/autoboost/boost/range/iterator_range.hpp create mode 100644 contrib/autoboost/boost/range/iterator_range_core.hpp create mode 100644 contrib/autoboost/boost/range/iterator_range_io.hpp create mode 100644 contrib/autoboost/boost/range/metafunctions.hpp create mode 100644 contrib/autoboost/boost/range/mutable_iterator.hpp create mode 100644 contrib/autoboost/boost/range/pointer.hpp create mode 100644 contrib/autoboost/boost/range/range_fwd.hpp create mode 100644 contrib/autoboost/boost/range/rbegin.hpp create mode 100644 contrib/autoboost/boost/range/reference.hpp create mode 100644 contrib/autoboost/boost/range/rend.hpp create mode 100644 contrib/autoboost/boost/range/result_iterator.hpp create mode 100644 contrib/autoboost/boost/range/reverse_iterator.hpp create mode 100644 contrib/autoboost/boost/range/reverse_result_iterator.hpp create mode 100644 contrib/autoboost/boost/range/size.hpp create mode 100644 contrib/autoboost/boost/range/size_type.hpp create mode 100644 contrib/autoboost/boost/range/sub_range.hpp create mode 100644 contrib/autoboost/boost/range/value_type.hpp create mode 100644 contrib/autoboost/boost/ratio/config.hpp create mode 100644 contrib/autoboost/boost/ratio/detail/mpl/abs.hpp create mode 100644 contrib/autoboost/boost/ratio/detail/mpl/gcd.hpp create mode 100644 contrib/autoboost/boost/ratio/detail/mpl/lcm.hpp create mode 100644 contrib/autoboost/boost/ratio/detail/mpl/sign.hpp create mode 100644 contrib/autoboost/boost/ratio/detail/overflow_helpers.hpp create mode 100644 contrib/autoboost/boost/ratio/mpl/rational_c_tag.hpp create mode 100644 contrib/autoboost/boost/ratio/ratio.hpp create mode 100644 contrib/autoboost/boost/ratio/ratio_fwd.hpp create mode 100644 contrib/autoboost/boost/rational.hpp create mode 100644 contrib/autoboost/boost/ref.hpp create mode 100644 contrib/autoboost/boost/regex.hpp create mode 100644 contrib/autoboost/boost/regex/config.hpp create mode 100644 contrib/autoboost/boost/regex/config/borland.hpp create mode 100644 contrib/autoboost/boost/regex/config/cwchar.hpp create mode 100644 contrib/autoboost/boost/regex/icu.hpp create mode 100644 contrib/autoboost/boost/regex/pattern_except.hpp create mode 100644 contrib/autoboost/boost/regex/pending/object_cache.hpp create mode 100644 contrib/autoboost/boost/regex/pending/static_mutex.hpp create mode 100644 contrib/autoboost/boost/regex/pending/unicode_iterator.hpp create mode 100644 contrib/autoboost/boost/regex/regex_traits.hpp create mode 100644 contrib/autoboost/boost/regex/user.hpp create mode 100644 contrib/autoboost/boost/regex/v4/basic_regex.hpp create mode 100644 contrib/autoboost/boost/regex/v4/basic_regex_creator.hpp create mode 100644 contrib/autoboost/boost/regex/v4/basic_regex_parser.hpp create mode 100644 contrib/autoboost/boost/regex/v4/c_regex_traits.hpp create mode 100644 contrib/autoboost/boost/regex/v4/char_regex_traits.hpp create mode 100644 contrib/autoboost/boost/regex/v4/cpp_regex_traits.hpp create mode 100644 contrib/autoboost/boost/regex/v4/cregex.hpp create mode 100644 contrib/autoboost/boost/regex/v4/error_type.hpp create mode 100644 contrib/autoboost/boost/regex/v4/fileiter.hpp create mode 100644 contrib/autoboost/boost/regex/v4/instances.hpp create mode 100644 contrib/autoboost/boost/regex/v4/iterator_category.hpp create mode 100644 contrib/autoboost/boost/regex/v4/iterator_traits.hpp create mode 100644 contrib/autoboost/boost/regex/v4/match_flags.hpp create mode 100644 contrib/autoboost/boost/regex/v4/match_results.hpp create mode 100644 contrib/autoboost/boost/regex/v4/mem_block_cache.hpp create mode 100644 contrib/autoboost/boost/regex/v4/perl_matcher.hpp create mode 100644 contrib/autoboost/boost/regex/v4/perl_matcher_common.hpp create mode 100644 contrib/autoboost/boost/regex/v4/perl_matcher_non_recursive.hpp create mode 100644 contrib/autoboost/boost/regex/v4/perl_matcher_recursive.hpp create mode 100644 contrib/autoboost/boost/regex/v4/primary_transform.hpp create mode 100644 contrib/autoboost/boost/regex/v4/protected_call.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regbase.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_format.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_fwd.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_grep.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_iterator.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_match.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_merge.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_raw_buffer.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_replace.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_search.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_split.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_token_iterator.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_traits.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_traits_defaults.hpp create mode 100644 contrib/autoboost/boost/regex/v4/regex_workaround.hpp create mode 100644 contrib/autoboost/boost/regex/v4/states.hpp create mode 100644 contrib/autoboost/boost/regex/v4/sub_match.hpp create mode 100644 contrib/autoboost/boost/regex/v4/syntax_type.hpp create mode 100644 contrib/autoboost/boost/regex/v4/u32regex_iterator.hpp create mode 100644 contrib/autoboost/boost/regex/v4/u32regex_token_iterator.hpp create mode 100644 contrib/autoboost/boost/regex/v4/w32_regex_traits.hpp create mode 100644 contrib/autoboost/boost/regex_fwd.hpp create mode 100644 contrib/autoboost/boost/scoped_array.hpp create mode 100644 contrib/autoboost/boost/scoped_ptr.hpp create mode 100644 contrib/autoboost/boost/serialization/access.hpp create mode 100644 contrib/autoboost/boost/serialization/array.hpp create mode 100644 contrib/autoboost/boost/serialization/assume_abstract.hpp create mode 100644 contrib/autoboost/boost/serialization/base_object.hpp create mode 100644 contrib/autoboost/boost/serialization/collection_size_type.hpp create mode 100644 contrib/autoboost/boost/serialization/collection_traits.hpp create mode 100644 contrib/autoboost/boost/serialization/collections_load_imp.hpp create mode 100644 contrib/autoboost/boost/serialization/collections_save_imp.hpp create mode 100644 contrib/autoboost/boost/serialization/config.hpp create mode 100644 contrib/autoboost/boost/serialization/detail/get_data.hpp create mode 100644 contrib/autoboost/boost/serialization/detail/stack_constructor.hpp create mode 100644 contrib/autoboost/boost/serialization/extended_type_info.hpp create mode 100644 contrib/autoboost/boost/serialization/extended_type_info_no_rtti.hpp create mode 100644 contrib/autoboost/boost/serialization/extended_type_info_typeid.hpp create mode 100644 contrib/autoboost/boost/serialization/factory.hpp create mode 100644 contrib/autoboost/boost/serialization/force_include.hpp create mode 100644 contrib/autoboost/boost/serialization/is_bitwise_serializable.hpp create mode 100644 contrib/autoboost/boost/serialization/item_version_type.hpp create mode 100644 contrib/autoboost/boost/serialization/level.hpp create mode 100644 contrib/autoboost/boost/serialization/level_enum.hpp create mode 100644 contrib/autoboost/boost/serialization/nvp.hpp create mode 100644 contrib/autoboost/boost/serialization/pfto.hpp create mode 100644 contrib/autoboost/boost/serialization/serialization.hpp create mode 100644 contrib/autoboost/boost/serialization/shared_ptr_helper.hpp create mode 100644 contrib/autoboost/boost/serialization/singleton.hpp create mode 100644 contrib/autoboost/boost/serialization/smart_cast.hpp create mode 100644 contrib/autoboost/boost/serialization/split_free.hpp create mode 100644 contrib/autoboost/boost/serialization/split_member.hpp create mode 100644 contrib/autoboost/boost/serialization/state_saver.hpp create mode 100644 contrib/autoboost/boost/serialization/static_warning.hpp create mode 100644 contrib/autoboost/boost/serialization/string.hpp create mode 100644 contrib/autoboost/boost/serialization/strong_typedef.hpp create mode 100644 contrib/autoboost/boost/serialization/throw_exception.hpp create mode 100644 contrib/autoboost/boost/serialization/tracking.hpp create mode 100644 contrib/autoboost/boost/serialization/tracking_enum.hpp create mode 100644 contrib/autoboost/boost/serialization/traits.hpp create mode 100644 contrib/autoboost/boost/serialization/type_info_implementation.hpp create mode 100644 contrib/autoboost/boost/serialization/vector.hpp create mode 100644 contrib/autoboost/boost/serialization/version.hpp create mode 100644 contrib/autoboost/boost/serialization/void_cast.hpp create mode 100644 contrib/autoboost/boost/serialization/void_cast_fwd.hpp create mode 100644 contrib/autoboost/boost/serialization/wrapper.hpp create mode 100644 contrib/autoboost/boost/shared_array.hpp create mode 100644 contrib/autoboost/boost/shared_ptr.hpp create mode 100644 contrib/autoboost/boost/smart_ptr.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/allocate_shared_array.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/bad_weak_ptr.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/array_allocator.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/array_count_impl.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/array_traits.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/array_utility.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_gcc.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_nt.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_pt.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_spin.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_sync.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/atomic_count_win32.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/lightweight_mutex.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/lwm_nop.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/lwm_pthreads.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/lwm_win32_cs.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/operator_bool.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/quick_allocator.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/shared_count.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_convertible.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_aix.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_nt.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_pt.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_spin.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_sync.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_base_w32.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_counted_impl.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_forward.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_has_sync.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_if_array.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_interlocked.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/sp_nullptr_t.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock_gcc_arm.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock_nt.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock_pool.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock_pt.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock_std_atomic.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock_sync.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/spinlock_w32.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/detail/yield_k.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/enable_shared_from_this.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/intrusive_ptr.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/make_shared.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/make_shared_array.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/make_shared_object.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/scoped_array.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/scoped_ptr.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/shared_array.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/shared_ptr.hpp create mode 100644 contrib/autoboost/boost/smart_ptr/weak_ptr.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/assert.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/actions.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/alternative.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/composite.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/difference.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/directives.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/exclusive_or.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/alternative.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/difference.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/directives.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/exclusive_or.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/intersection.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/kleene_star.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/list.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/optional.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/positive.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/sequence.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/sequential_and.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/impl/sequential_or.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/intersection.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/kleene_star.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/list.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/operators.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/optional.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/positive.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/sequence.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/sequential_and.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/composite/sequential_or.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/config.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/impl/match.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/impl/match_attr_traits.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/impl/parser.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/match.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/nil.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/non_terminal/parser_context.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/non_terminal/parser_id.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/non_terminal/rule.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/parser.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/primitives/impl/numerics.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/primitives/impl/primitives.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/primitives/numerics.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/primitives/numerics_fwd.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/primitives/primitives.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/safe_bool.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/scanner/impl/skipper.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/scanner/scanner.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/scanner/scanner_fwd.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/scanner/skipper.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/core/scanner/skipper_fwd.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/debug.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/meta/as_parser.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/namespace.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/chset.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/chset_operators.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/impl/chset.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/impl/chset/basic_chset.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/impl/chset/basic_chset.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/impl/chset/range_run.hpp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/impl/chset/range_run.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/utility/impl/chset_operators.ipp create mode 100644 contrib/autoboost/boost/spirit/home/classic/version.hpp create mode 100644 contrib/autoboost/boost/spirit/include/classic_actions.hpp create mode 100644 contrib/autoboost/boost/spirit/include/classic_chset.hpp create mode 100644 contrib/autoboost/boost/spirit/include/classic_numerics.hpp create mode 100644 contrib/autoboost/boost/spirit/include/classic_operators.hpp create mode 100644 contrib/autoboost/boost/spirit/include/classic_rule.hpp create mode 100644 contrib/autoboost/boost/static_assert.hpp create mode 100644 contrib/autoboost/boost/swap.hpp create mode 100644 contrib/autoboost/boost/system/api_config.hpp create mode 100644 contrib/autoboost/boost/system/config.hpp create mode 100644 contrib/autoboost/boost/system/cygwin_error.hpp create mode 100644 contrib/autoboost/boost/system/detail/error_code.ipp create mode 100644 contrib/autoboost/boost/system/detail/local_free_on_destruction.hpp create mode 100644 contrib/autoboost/boost/system/error_code.hpp create mode 100644 contrib/autoboost/boost/system/linux_error.hpp create mode 100644 contrib/autoboost/boost/system/system_error.hpp create mode 100644 contrib/autoboost/boost/system/windows_error.hpp create mode 100644 contrib/autoboost/boost/test/debug.hpp create mode 100644 contrib/autoboost/boost/test/debug_config.hpp create mode 100644 contrib/autoboost/boost/test/detail/config.hpp create mode 100644 contrib/autoboost/boost/test/detail/enable_warnings.hpp create mode 100644 contrib/autoboost/boost/test/detail/fwd_decl.hpp create mode 100644 contrib/autoboost/boost/test/detail/global_typedef.hpp create mode 100644 contrib/autoboost/boost/test/detail/log_level.hpp create mode 100644 contrib/autoboost/boost/test/detail/suppress_warnings.hpp create mode 100644 contrib/autoboost/boost/test/detail/unit_test_parameters.hpp create mode 100644 contrib/autoboost/boost/test/detail/workaround.hpp create mode 100644 contrib/autoboost/boost/test/execution_monitor.hpp create mode 100644 contrib/autoboost/boost/test/floating_point_comparison.hpp create mode 100644 contrib/autoboost/boost/test/framework.hpp create mode 100644 contrib/autoboost/boost/test/impl/compiler_log_formatter.ipp create mode 100644 contrib/autoboost/boost/test/impl/cpp_main.ipp create mode 100644 contrib/autoboost/boost/test/impl/debug.ipp create mode 100644 contrib/autoboost/boost/test/impl/exception_safety.ipp create mode 100644 contrib/autoboost/boost/test/impl/execution_monitor.ipp create mode 100644 contrib/autoboost/boost/test/impl/framework.ipp create mode 100644 contrib/autoboost/boost/test/impl/interaction_based.ipp create mode 100644 contrib/autoboost/boost/test/impl/logged_expectations.ipp create mode 100644 contrib/autoboost/boost/test/impl/plain_report_formatter.ipp create mode 100644 contrib/autoboost/boost/test/impl/progress_monitor.ipp create mode 100644 contrib/autoboost/boost/test/impl/results_collector.ipp create mode 100644 contrib/autoboost/boost/test/impl/results_reporter.ipp create mode 100644 contrib/autoboost/boost/test/impl/test_main.ipp create mode 100644 contrib/autoboost/boost/test/impl/test_tools.ipp create mode 100644 contrib/autoboost/boost/test/impl/unit_test_log.ipp create mode 100644 contrib/autoboost/boost/test/impl/unit_test_main.ipp create mode 100644 contrib/autoboost/boost/test/impl/unit_test_monitor.ipp create mode 100644 contrib/autoboost/boost/test/impl/unit_test_parameters.ipp create mode 100644 contrib/autoboost/boost/test/impl/unit_test_suite.ipp create mode 100644 contrib/autoboost/boost/test/impl/xml_log_formatter.ipp create mode 100644 contrib/autoboost/boost/test/impl/xml_report_formatter.ipp create mode 100644 contrib/autoboost/boost/test/interaction_based.hpp create mode 100644 contrib/autoboost/boost/test/mock_object.hpp create mode 100644 contrib/autoboost/boost/test/output/compiler_log_formatter.hpp create mode 100644 contrib/autoboost/boost/test/output/plain_report_formatter.hpp create mode 100644 contrib/autoboost/boost/test/output/xml_log_formatter.hpp create mode 100644 contrib/autoboost/boost/test/output/xml_report_formatter.hpp create mode 100644 contrib/autoboost/boost/test/output_test_stream.hpp create mode 100644 contrib/autoboost/boost/test/predicate_result.hpp create mode 100644 contrib/autoboost/boost/test/progress_monitor.hpp create mode 100644 contrib/autoboost/boost/test/results_collector.hpp create mode 100644 contrib/autoboost/boost/test/results_reporter.hpp create mode 100644 contrib/autoboost/boost/test/test_observer.hpp create mode 100644 contrib/autoboost/boost/test/test_tools.hpp create mode 100644 contrib/autoboost/boost/test/unit_test.hpp create mode 100644 contrib/autoboost/boost/test/unit_test_log.hpp create mode 100644 contrib/autoboost/boost/test/unit_test_log_formatter.hpp create mode 100644 contrib/autoboost/boost/test/unit_test_monitor.hpp create mode 100644 contrib/autoboost/boost/test/unit_test_suite.hpp create mode 100644 contrib/autoboost/boost/test/unit_test_suite_impl.hpp create mode 100644 contrib/autoboost/boost/test/utils/algorithm.hpp create mode 100644 contrib/autoboost/boost/test/utils/assign_op.hpp create mode 100644 contrib/autoboost/boost/test/utils/basic_cstring/basic_cstring.hpp create mode 100644 contrib/autoboost/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp create mode 100644 contrib/autoboost/boost/test/utils/basic_cstring/bcs_char_traits.hpp create mode 100644 contrib/autoboost/boost/test/utils/basic_cstring/compare.hpp create mode 100644 contrib/autoboost/boost/test/utils/basic_cstring/io.hpp create mode 100644 contrib/autoboost/boost/test/utils/callback.hpp create mode 100644 contrib/autoboost/boost/test/utils/class_properties.hpp create mode 100644 contrib/autoboost/boost/test/utils/custom_manip.hpp create mode 100644 contrib/autoboost/boost/test/utils/fixed_mapping.hpp create mode 100644 contrib/autoboost/boost/test/utils/foreach.hpp create mode 100644 contrib/autoboost/boost/test/utils/iterator/input_iterator_facade.hpp create mode 100644 contrib/autoboost/boost/test/utils/iterator/token_iterator.hpp create mode 100644 contrib/autoboost/boost/test/utils/lazy_ostream.hpp create mode 100644 contrib/autoboost/boost/test/utils/named_params.hpp create mode 100644 contrib/autoboost/boost/test/utils/rtti.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/argument.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/argument_factory.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/argv_traverser.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/argv_traverser.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/basic_parameter.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/char_parameter.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/char_parameter.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/dual_name_parameter.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/dual_name_parameter.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/fwd.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/id_policy.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/id_policy.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/iface/argument_factory.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/iface/id_policy.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/modifier.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/named_parameter.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/named_parameter.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/parameter.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/parser.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/parser.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/typed_parameter.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/validation.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/validation.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/value_generator.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/cla/value_handler.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/config.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/env/environment.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/env/environment.ipp create mode 100644 contrib/autoboost/boost/test/utils/runtime/env/fwd.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/env/modifier.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/env/variable.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/fwd.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/interpret_argument_value.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/parameter.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/trace.hpp create mode 100644 contrib/autoboost/boost/test/utils/runtime/validation.hpp create mode 100644 contrib/autoboost/boost/test/utils/trivial_singleton.hpp create mode 100644 contrib/autoboost/boost/test/utils/wrap_stringstream.hpp create mode 100644 contrib/autoboost/boost/test/utils/xml_printer.hpp create mode 100644 contrib/autoboost/boost/thread.hpp create mode 100644 contrib/autoboost/boost/thread/barrier.hpp create mode 100644 contrib/autoboost/boost/thread/condition_variable.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/memory/allocator_arg.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/memory/allocator_traits.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/memory/config.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/memory/pointer_traits.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/memory/scoped_allocator.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/memory/shared_ptr.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/memory/unique_ptr.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/tuple.hpp create mode 100644 contrib/autoboost/boost/thread/csbl/vector.hpp create mode 100644 contrib/autoboost/boost/thread/cv_status.hpp create mode 100644 contrib/autoboost/boost/thread/detail/config.hpp create mode 100644 contrib/autoboost/boost/thread/detail/delete.hpp create mode 100644 contrib/autoboost/boost/thread/detail/invoke.hpp create mode 100644 contrib/autoboost/boost/thread/detail/invoker.hpp create mode 100644 contrib/autoboost/boost/thread/detail/is_convertible.hpp create mode 100644 contrib/autoboost/boost/thread/detail/lockable_wrapper.hpp create mode 100644 contrib/autoboost/boost/thread/detail/make_tuple_indices.hpp create mode 100644 contrib/autoboost/boost/thread/detail/memory.hpp create mode 100644 contrib/autoboost/boost/thread/detail/move.hpp create mode 100644 contrib/autoboost/boost/thread/detail/nullary_function.hpp create mode 100644 contrib/autoboost/boost/thread/detail/platform.hpp create mode 100644 contrib/autoboost/boost/thread/detail/thread.hpp create mode 100644 contrib/autoboost/boost/thread/detail/thread_group.hpp create mode 100644 contrib/autoboost/boost/thread/detail/thread_heap_alloc.hpp create mode 100644 contrib/autoboost/boost/thread/detail/thread_interruption.hpp create mode 100644 contrib/autoboost/boost/thread/detail/tss_hooks.hpp create mode 100644 contrib/autoboost/boost/thread/detail/variadic_footer.hpp create mode 100644 contrib/autoboost/boost/thread/detail/variadic_header.hpp create mode 100644 contrib/autoboost/boost/thread/exceptional_ptr.hpp create mode 100644 contrib/autoboost/boost/thread/exceptions.hpp create mode 100644 contrib/autoboost/boost/thread/future.hpp create mode 100644 contrib/autoboost/boost/thread/future_error_code.hpp create mode 100644 contrib/autoboost/boost/thread/is_locked_by_this_thread.hpp create mode 100644 contrib/autoboost/boost/thread/lock_algorithms.hpp create mode 100644 contrib/autoboost/boost/thread/lock_guard.hpp create mode 100644 contrib/autoboost/boost/thread/lock_options.hpp create mode 100644 contrib/autoboost/boost/thread/lock_types.hpp create mode 100644 contrib/autoboost/boost/thread/lockable_traits.hpp create mode 100644 contrib/autoboost/boost/thread/locks.hpp create mode 100644 contrib/autoboost/boost/thread/mutex.hpp create mode 100644 contrib/autoboost/boost/thread/once.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/condition_variable.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/condition_variable_fwd.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/mutex.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/once.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/once_atomic.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/pthread_mutex_scoped_lock.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/recursive_mutex.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/shared_mutex.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/thread_data.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/thread_heap_alloc.hpp create mode 100644 contrib/autoboost/boost/thread/pthread/timespec.hpp create mode 100644 contrib/autoboost/boost/thread/recursive_mutex.hpp create mode 100644 contrib/autoboost/boost/thread/shared_mutex.hpp create mode 100644 contrib/autoboost/boost/thread/thread.hpp create mode 100644 contrib/autoboost/boost/thread/thread_only.hpp create mode 100644 contrib/autoboost/boost/thread/thread_time.hpp create mode 100644 contrib/autoboost/boost/thread/tss.hpp create mode 100644 contrib/autoboost/boost/thread/v2/thread.hpp create mode 100644 contrib/autoboost/boost/thread/xtime.hpp create mode 100644 contrib/autoboost/boost/throw_exception.hpp create mode 100644 contrib/autoboost/boost/timer.hpp create mode 100644 contrib/autoboost/boost/token_functions.hpp create mode 100644 contrib/autoboost/boost/token_iterator.hpp create mode 100644 contrib/autoboost/boost/tokenizer.hpp create mode 100644 contrib/autoboost/boost/tuple/detail/tuple_basic.hpp create mode 100644 contrib/autoboost/boost/tuple/tuple.hpp create mode 100644 contrib/autoboost/boost/type.hpp create mode 100644 contrib/autoboost/boost/type_traits/add_const.hpp create mode 100644 contrib/autoboost/boost/type_traits/add_cv.hpp create mode 100644 contrib/autoboost/boost/type_traits/add_lvalue_reference.hpp create mode 100644 contrib/autoboost/boost/type_traits/add_pointer.hpp create mode 100644 contrib/autoboost/boost/type_traits/add_reference.hpp create mode 100644 contrib/autoboost/boost/type_traits/add_rvalue_reference.hpp create mode 100644 contrib/autoboost/boost/type_traits/add_volatile.hpp create mode 100644 contrib/autoboost/boost/type_traits/alignment_of.hpp create mode 100644 contrib/autoboost/boost/type_traits/common_type.hpp create mode 100644 contrib/autoboost/boost/type_traits/composite_traits.hpp create mode 100644 contrib/autoboost/boost/type_traits/conditional.hpp create mode 100644 contrib/autoboost/boost/type_traits/config.hpp create mode 100644 contrib/autoboost/boost/type_traits/conversion_traits.hpp create mode 100644 contrib/autoboost/boost/type_traits/cv_traits.hpp create mode 100644 contrib/autoboost/boost/type_traits/decay.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/bool_trait_def.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/bool_trait_undef.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/common_type_imp.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/cv_traits_impl.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/false_result.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/has_binary_operator.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/ice_and.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/ice_eq.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/ice_not.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/ice_or.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/is_function_ptr_helper.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/is_function_ptr_tester.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/size_t_trait_def.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/size_t_trait_undef.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/template_arity_spec.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/type_trait_def.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/type_trait_undef.hpp create mode 100644 contrib/autoboost/boost/type_traits/detail/yes_no_type.hpp create mode 100644 contrib/autoboost/boost/type_traits/function_traits.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_left_shift.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_minus.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_minus_assign.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_new_operator.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_nothrow_assign.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_nothrow_constructor.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_nothrow_copy.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_plus.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_plus_assign.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_right_shift.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_trivial_assign.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_trivial_constructor.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_trivial_copy.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_trivial_destructor.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_trivial_move_assign.hpp create mode 100644 contrib/autoboost/boost/type_traits/has_trivial_move_constructor.hpp create mode 100644 contrib/autoboost/boost/type_traits/ice.hpp create mode 100644 contrib/autoboost/boost/type_traits/integral_constant.hpp create mode 100644 contrib/autoboost/boost/type_traits/integral_promotion.hpp create mode 100644 contrib/autoboost/boost/type_traits/intrinsics.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_abstract.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_arithmetic.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_array.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_base_and_derived.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_base_of.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_class.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_compound.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_const.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_convertible.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_copy_constructible.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_empty.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_enum.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_float.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_floating_point.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_function.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_fundamental.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_integral.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_lvalue_reference.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_member_function_pointer.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_member_pointer.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_nothrow_move_assignable.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_nothrow_move_constructible.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_object.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_pod.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_pointer.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_polymorphic.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_reference.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_rvalue_reference.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_same.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_scalar.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_signed.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_stateless.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_union.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_unsigned.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_virtual_base_of.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_void.hpp create mode 100644 contrib/autoboost/boost/type_traits/is_volatile.hpp create mode 100644 contrib/autoboost/boost/type_traits/make_signed.hpp create mode 100644 contrib/autoboost/boost/type_traits/make_unsigned.hpp create mode 100644 contrib/autoboost/boost/type_traits/object_traits.hpp create mode 100644 contrib/autoboost/boost/type_traits/remove_bounds.hpp create mode 100644 contrib/autoboost/boost/type_traits/remove_const.hpp create mode 100644 contrib/autoboost/boost/type_traits/remove_cv.hpp create mode 100644 contrib/autoboost/boost/type_traits/remove_extent.hpp create mode 100644 contrib/autoboost/boost/type_traits/remove_pointer.hpp create mode 100644 contrib/autoboost/boost/type_traits/remove_reference.hpp create mode 100644 contrib/autoboost/boost/type_traits/remove_volatile.hpp create mode 100644 contrib/autoboost/boost/type_traits/same_traits.hpp create mode 100644 contrib/autoboost/boost/type_traits/transform_traits.hpp create mode 100644 contrib/autoboost/boost/type_traits/type_with_alignment.hpp create mode 100644 contrib/autoboost/boost/typeof/dmc/typeof_impl.hpp create mode 100644 contrib/autoboost/boost/typeof/encode_decode.hpp create mode 100644 contrib/autoboost/boost/typeof/encode_decode_params.hpp create mode 100644 contrib/autoboost/boost/typeof/int_encoding.hpp create mode 100644 contrib/autoboost/boost/typeof/integral_template_param.hpp create mode 100644 contrib/autoboost/boost/typeof/message.hpp create mode 100644 contrib/autoboost/boost/typeof/modifiers.hpp create mode 100644 contrib/autoboost/boost/typeof/msvc/typeof_impl.hpp create mode 100644 contrib/autoboost/boost/typeof/native.hpp create mode 100644 contrib/autoboost/boost/typeof/pointers_data_members.hpp create mode 100644 contrib/autoboost/boost/typeof/register_functions.hpp create mode 100644 contrib/autoboost/boost/typeof/register_functions_iterate.hpp create mode 100644 contrib/autoboost/boost/typeof/register_fundamental.hpp create mode 100644 contrib/autoboost/boost/typeof/register_mem_functions.hpp create mode 100644 contrib/autoboost/boost/typeof/template_encoding.hpp create mode 100644 contrib/autoboost/boost/typeof/template_template_param.hpp create mode 100644 contrib/autoboost/boost/typeof/type_encoding.hpp create mode 100644 contrib/autoboost/boost/typeof/type_template_param.hpp create mode 100644 contrib/autoboost/boost/typeof/typeof.hpp create mode 100644 contrib/autoboost/boost/typeof/typeof_impl.hpp create mode 100644 contrib/autoboost/boost/typeof/unsupported.hpp create mode 100644 contrib/autoboost/boost/typeof/vector.hpp create mode 100644 contrib/autoboost/boost/typeof/vector100.hpp create mode 100644 contrib/autoboost/boost/typeof/vector150.hpp create mode 100644 contrib/autoboost/boost/typeof/vector200.hpp create mode 100644 contrib/autoboost/boost/typeof/vector50.hpp create mode 100644 contrib/autoboost/boost/utility.hpp create mode 100644 contrib/autoboost/boost/utility/addressof.hpp create mode 100644 contrib/autoboost/boost/utility/base_from_member.hpp create mode 100644 contrib/autoboost/boost/utility/binary.hpp create mode 100644 contrib/autoboost/boost/utility/compare_pointees.hpp create mode 100644 contrib/autoboost/boost/utility/declval.hpp create mode 100644 contrib/autoboost/boost/utility/detail/in_place_factory_prefix.hpp create mode 100644 contrib/autoboost/boost/utility/detail/in_place_factory_suffix.hpp create mode 100644 contrib/autoboost/boost/utility/detail/result_of_iterate.hpp create mode 100644 contrib/autoboost/boost/utility/enable_if.hpp create mode 100644 contrib/autoboost/boost/utility/explicit_operator_bool.hpp create mode 100644 contrib/autoboost/boost/utility/identity_type.hpp create mode 100644 contrib/autoboost/boost/utility/in_place_factory.hpp create mode 100644 contrib/autoboost/boost/utility/result_of.hpp create mode 100644 contrib/autoboost/boost/utility/swap.hpp create mode 100644 contrib/autoboost/boost/utility/value_init.hpp create mode 100644 contrib/autoboost/boost/version.hpp create mode 100644 contrib/autoboost/boost/visit_each.hpp create mode 100644 contrib/autoboost/boost/weak_ptr.hpp create mode 100644 contrib/autoboost/libs/atomic/src/lockpool.cpp create mode 100644 contrib/autoboost/libs/coroutine/src/detail/coroutine_context.cpp create mode 100644 contrib/autoboost/libs/coroutine/src/exceptions.cpp create mode 100644 contrib/autoboost/libs/coroutine/src/posix/stack_traits.cpp create mode 100644 contrib/autoboost/libs/coroutine/src/windows/stack_traits.cpp create mode 100644 contrib/autoboost/libs/date_time/src/date_time.doc create mode 100644 contrib/autoboost/libs/date_time/src/gregorian/date_generators.cpp create mode 100644 contrib/autoboost/libs/date_time/src/gregorian/greg_month.cpp create mode 100644 contrib/autoboost/libs/date_time/src/gregorian/greg_names.hpp create mode 100644 contrib/autoboost/libs/date_time/src/gregorian/greg_weekday.cpp create mode 100644 contrib/autoboost/libs/date_time/src/gregorian/gregorian_types.cpp create mode 100644 contrib/autoboost/libs/date_time/src/posix_time/posix_time_types.cpp create mode 100644 contrib/autoboost/libs/exception/src/clone_current_exception_non_intrusive.cpp create mode 100644 contrib/autoboost/libs/regex/src/c_regex_traits.cpp create mode 100644 contrib/autoboost/libs/regex/src/cpp_regex_traits.cpp create mode 100644 contrib/autoboost/libs/regex/src/cregex.cpp create mode 100644 contrib/autoboost/libs/regex/src/fileiter.cpp create mode 100644 contrib/autoboost/libs/regex/src/icu.cpp create mode 100644 contrib/autoboost/libs/regex/src/instances.cpp create mode 100644 contrib/autoboost/libs/regex/src/internals.hpp create mode 100644 contrib/autoboost/libs/regex/src/posix_api.cpp create mode 100644 contrib/autoboost/libs/regex/src/regex.cpp create mode 100644 contrib/autoboost/libs/regex/src/regex_debug.cpp create mode 100644 contrib/autoboost/libs/regex/src/regex_raw_buffer.cpp create mode 100644 contrib/autoboost/libs/regex/src/regex_traits_defaults.cpp create mode 100644 contrib/autoboost/libs/regex/src/static_mutex.cpp create mode 100644 contrib/autoboost/libs/regex/src/usinstances.cpp create mode 100644 contrib/autoboost/libs/regex/src/w32_regex_traits.cpp create mode 100644 contrib/autoboost/libs/regex/src/wc_regex_traits.cpp create mode 100644 contrib/autoboost/libs/regex/src/wide_posix_api.cpp create mode 100644 contrib/autoboost/libs/regex/src/winstances.cpp create mode 100644 contrib/autoboost/libs/serialization/src/archive_exception.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_archive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_iarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_iserializer.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_oarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_oserializer.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_pointer_iserializer.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_pointer_oserializer.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_serializer_map.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_text_iprimitive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_text_oprimitive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_text_wiprimitive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_text_woprimitive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_xml_archive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/basic_xml_grammar.ipp create mode 100644 contrib/autoboost/libs/serialization/src/binary_iarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/binary_oarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/binary_wiarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/binary_woarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/codecvt_null.cpp create mode 100644 contrib/autoboost/libs/serialization/src/extended_type_info.cpp create mode 100644 contrib/autoboost/libs/serialization/src/extended_type_info_no_rtti.cpp create mode 100644 contrib/autoboost/libs/serialization/src/extended_type_info_typeid.cpp create mode 100644 contrib/autoboost/libs/serialization/src/polymorphic_iarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/polymorphic_oarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/shared_ptr_helper.cpp create mode 100644 contrib/autoboost/libs/serialization/src/stl_port.cpp create mode 100644 contrib/autoboost/libs/serialization/src/text_iarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/text_oarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/text_wiarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/text_woarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/utf8_codecvt_facet.cpp create mode 100644 contrib/autoboost/libs/serialization/src/void_cast.cpp create mode 100644 contrib/autoboost/libs/serialization/src/xml_archive_exception.cpp create mode 100644 contrib/autoboost/libs/serialization/src/xml_grammar.cpp create mode 100644 contrib/autoboost/libs/serialization/src/xml_iarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/xml_oarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/xml_wgrammar.cpp create mode 100644 contrib/autoboost/libs/serialization/src/xml_wiarchive.cpp create mode 100644 contrib/autoboost/libs/serialization/src/xml_woarchive.cpp create mode 100644 contrib/autoboost/libs/smart_ptr/src/sp_collector.cpp create mode 100644 contrib/autoboost/libs/smart_ptr/src/sp_debug_hooks.cpp create mode 100644 contrib/autoboost/libs/system/src/error_code.cpp create mode 100644 contrib/autoboost/libs/test/src/compiler_log_formatter.cpp create mode 100644 contrib/autoboost/libs/test/src/cpp_main.cpp create mode 100644 contrib/autoboost/libs/test/src/debug.cpp create mode 100644 contrib/autoboost/libs/test/src/exception_safety.cpp create mode 100644 contrib/autoboost/libs/test/src/execution_monitor.cpp create mode 100644 contrib/autoboost/libs/test/src/framework.cpp create mode 100644 contrib/autoboost/libs/test/src/interaction_based.cpp create mode 100644 contrib/autoboost/libs/test/src/logged_expectations.cpp create mode 100644 contrib/autoboost/libs/test/src/plain_report_formatter.cpp create mode 100644 contrib/autoboost/libs/test/src/progress_monitor.cpp create mode 100644 contrib/autoboost/libs/test/src/results_collector.cpp create mode 100644 contrib/autoboost/libs/test/src/results_reporter.cpp create mode 100644 contrib/autoboost/libs/test/src/test_main.cpp create mode 100644 contrib/autoboost/libs/test/src/test_tools.cpp create mode 100644 contrib/autoboost/libs/test/src/unit_test_log.cpp create mode 100644 contrib/autoboost/libs/test/src/unit_test_main.cpp create mode 100644 contrib/autoboost/libs/test/src/unit_test_monitor.cpp create mode 100644 contrib/autoboost/libs/test/src/unit_test_parameters.cpp create mode 100644 contrib/autoboost/libs/test/src/unit_test_suite.cpp create mode 100644 contrib/autoboost/libs/test/src/xml_log_formatter.cpp create mode 100644 contrib/autoboost/libs/test/src/xml_report_formatter.cpp create mode 100644 contrib/autoboost/libs/thread/src/future.cpp create mode 100644 contrib/autoboost/libs/thread/src/pthread/once.cpp create mode 100644 contrib/autoboost/libs/thread/src/pthread/once_atomic.cpp create mode 100644 contrib/autoboost/libs/thread/src/pthread/thread.cpp create mode 100644 contrib/autoboost/libs/thread/src/pthread/timeconv.inl create mode 100644 contrib/autoboost/libs/thread/src/tss_null.cpp diff --git a/contrib/autoboost/README.md b/contrib/autoboost/README.md new file mode 100644 index 000000000..e0e7a68db --- /dev/null +++ b/contrib/autoboost/README.md @@ -0,0 +1,7 @@ +Boost +===== + +This directory contains a subset of Boost used to build websocketpp. + +It uses the "autoboost" namespace instead of "boost" to prevent potential +namespace collisions. diff --git a/contrib/autoboost/boost/algorithm/string/case_conv.hpp b/contrib/autoboost/boost/algorithm/string/case_conv.hpp new file mode 100644 index 000000000..707183f82 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/case_conv.hpp @@ -0,0 +1,176 @@ +// Boost string_algo library case_conv.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_CASE_CONV_HPP +#define BOOST_STRING_CASE_CONV_HPP + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +/*! \file + Defines sequence case-conversion algorithms. + Algorithms convert each element in the input sequence to the + desired case using provided locales. +*/ + +namespace autoboost { + namespace algorithm { + +// to_lower -----------------------------------------------// + + //! Convert to lower case + /*! + Each element of the input sequence is converted to lower + case. The result is a copy of the input converted to lower case. + It is returned as a sequence or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input range + \param Loc A locale used for conversion + \return + An output iterator pointing just after the last inserted character or + a copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + + */ + template + inline OutputIteratorT + to_lower_copy( + OutputIteratorT Output, + const RangeT& Input, + const std::locale& Loc=std::locale()) + { + return ::autoboost::algorithm::detail::transform_range_copy( + Output, + ::autoboost::as_literal(Input), + ::autoboost::algorithm::detail::to_lowerF< + typename range_value::type >(Loc)); + } + + //! Convert to lower case + /*! + \overload + */ + template + inline SequenceT to_lower_copy( + const SequenceT& Input, + const std::locale& Loc=std::locale()) + { + return ::autoboost::algorithm::detail::transform_range_copy( + Input, + ::autoboost::algorithm::detail::to_lowerF< + typename range_value::type >(Loc)); + } + + //! Convert to lower case + /*! + Each element of the input sequence is converted to lower + case. The input sequence is modified in-place. + + \param Input A range + \param Loc a locale used for conversion + */ + template + inline void to_lower( + WritableRangeT& Input, + const std::locale& Loc=std::locale()) + { + ::autoboost::algorithm::detail::transform_range( + ::autoboost::as_literal(Input), + ::autoboost::algorithm::detail::to_lowerF< + typename range_value::type >(Loc)); + } + +// to_upper -----------------------------------------------// + + //! Convert to upper case + /*! + Each element of the input sequence is converted to upper + case. The result is a copy of the input converted to upper case. + It is returned as a sequence or copied to the output iterator + + \param Output An output iterator to which the result will be copied + \param Input An input range + \param Loc A locale used for conversion + \return + An output iterator pointing just after the last inserted character or + a copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template + inline OutputIteratorT + to_upper_copy( + OutputIteratorT Output, + const RangeT& Input, + const std::locale& Loc=std::locale()) + { + return ::autoboost::algorithm::detail::transform_range_copy( + Output, + ::autoboost::as_literal(Input), + ::autoboost::algorithm::detail::to_upperF< + typename range_value::type >(Loc)); + } + + //! Convert to upper case + /*! + \overload + */ + template + inline SequenceT to_upper_copy( + const SequenceT& Input, + const std::locale& Loc=std::locale()) + { + return ::autoboost::algorithm::detail::transform_range_copy( + Input, + ::autoboost::algorithm::detail::to_upperF< + typename range_value::type >(Loc)); + } + + //! Convert to upper case + /*! + Each element of the input sequence is converted to upper + case. The input sequence is modified in-place. + + \param Input An input range + \param Loc a locale used for conversion + */ + template + inline void to_upper( + WritableRangeT& Input, + const std::locale& Loc=std::locale()) + { + ::autoboost::algorithm::detail::transform_range( + ::autoboost::as_literal(Input), + ::autoboost::algorithm::detail::to_upperF< + typename range_value::type >(Loc)); + } + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::to_lower; + using algorithm::to_lower_copy; + using algorithm::to_upper; + using algorithm::to_upper_copy; + +} // namespace autoboost + +#endif // BOOST_STRING_CASE_CONV_HPP diff --git a/contrib/autoboost/boost/algorithm/string/classification.hpp b/contrib/autoboost/boost/algorithm/string/classification.hpp new file mode 100644 index 000000000..9a04edd4d --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/classification.hpp @@ -0,0 +1,312 @@ +// Boost string_algo library classification.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_CLASSIFICATION_HPP +#define BOOST_STRING_CLASSIFICATION_HPP + +#include +#include +#include +#include +#include +#include + + +/*! \file + Classification predicates are included in the library to give + some more convenience when using algorithms like \c trim() and \c all(). + They wrap functionality of STL classification functions ( e.g. \c std::isspace() ) + into generic functors. +*/ + +namespace autoboost { + namespace algorithm { + +// classification functor generator -------------------------------------// + + //! is_classified predicate + /*! + Construct the \c is_classified predicate. This predicate holds if the input is + of specified \c std::ctype category. + + \param Type A \c std::ctype category + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_classified(std::ctype_base::mask Type, const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(Type, Loc); + } + + //! is_space predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::space category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_space(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::space, Loc); + } + + //! is_alnum predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::alnum category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_alnum(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::alnum, Loc); + } + + //! is_alpha predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::alpha category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_alpha(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::alpha, Loc); + } + + //! is_cntrl predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::cntrl category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_cntrl(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::cntrl, Loc); + } + + //! is_digit predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::digit category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_digit(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::digit, Loc); + } + + //! is_graph predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::graph category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_graph(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::graph, Loc); + } + + //! is_lower predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::lower category. + + \param Loc A locale used for classification + \return An instance of \c is_classified predicate + */ + inline detail::is_classifiedF + is_lower(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::lower, Loc); + } + + //! is_print predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::print category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_print(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::print, Loc); + } + + //! is_punct predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::punct category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_punct(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::punct, Loc); + } + + //! is_upper predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::upper category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_upper(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::upper, Loc); + } + + //! is_xdigit predicate + /*! + Construct the \c is_classified predicate for the \c ctype_base::xdigit category. + + \param Loc A locale used for classification + \return An instance of the \c is_classified predicate + */ + inline detail::is_classifiedF + is_xdigit(const std::locale& Loc=std::locale()) + { + return detail::is_classifiedF(std::ctype_base::xdigit, Loc); + } + + //! is_any_of predicate + /*! + Construct the \c is_any_of predicate. The predicate holds if the input + is included in the specified set of characters. + + \param Set A set of characters to be recognized + \return An instance of the \c is_any_of predicate + */ + template + inline detail::is_any_ofF< + BOOST_STRING_TYPENAME range_value::type> + is_any_of( const RangeT& Set ) + { + iterator_range::type> lit_set(autoboost::as_literal(Set)); + return detail::is_any_ofF::type>(lit_set); + } + + //! is_from_range predicate + /*! + Construct the \c is_from_range predicate. The predicate holds if the input + is included in the specified range. (i.e. From <= Ch <= To ) + + \param From The start of the range + \param To The end of the range + \return An instance of the \c is_from_range predicate + */ + template + inline detail::is_from_rangeF is_from_range(CharT From, CharT To) + { + return detail::is_from_rangeF(From,To); + } + + // predicate combinators ---------------------------------------------------// + + //! predicate 'and' composition predicate + /*! + Construct the \c class_and predicate. This predicate can be used + to logically combine two classification predicates. \c class_and holds, + if both predicates return true. + + \param Pred1 The first predicate + \param Pred2 The second predicate + \return An instance of the \c class_and predicate + */ + template + inline detail::pred_andF + operator&&( + const predicate_facade& Pred1, + const predicate_facade& Pred2 ) + { + // Doing the static_cast with the pointer instead of the reference + // is a workaround for some compilers which have problems with + // static_cast's of template references, i.e. CW8. /grafik/ + return detail::pred_andF( + *static_cast(&Pred1), + *static_cast(&Pred2) ); + } + + //! predicate 'or' composition predicate + /*! + Construct the \c class_or predicate. This predicate can be used + to logically combine two classification predicates. \c class_or holds, + if one of the predicates return true. + + \param Pred1 The first predicate + \param Pred2 The second predicate + \return An instance of the \c class_or predicate + */ + template + inline detail::pred_orF + operator||( + const predicate_facade& Pred1, + const predicate_facade& Pred2 ) + { + // Doing the static_cast with the pointer instead of the reference + // is a workaround for some compilers which have problems with + // static_cast's of template references, i.e. CW8. /grafik/ + return detail::pred_orF( + *static_cast(&Pred1), + *static_cast(&Pred2)); + } + + //! predicate negation operator + /*! + Construct the \c class_not predicate. This predicate represents a negation. + \c class_or holds if of the predicates return false. + + \param Pred The predicate to be negated + \return An instance of the \c class_not predicate + */ + template + inline detail::pred_notF + operator!( const predicate_facade& Pred ) + { + // Doing the static_cast with the pointer instead of the reference + // is a workaround for some compilers which have problems with + // static_cast's of template references, i.e. CW8. /grafik/ + return detail::pred_notF(*static_cast(&Pred)); + } + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::is_classified; + using algorithm::is_space; + using algorithm::is_alnum; + using algorithm::is_alpha; + using algorithm::is_cntrl; + using algorithm::is_digit; + using algorithm::is_graph; + using algorithm::is_lower; + using algorithm::is_upper; + using algorithm::is_print; + using algorithm::is_punct; + using algorithm::is_xdigit; + using algorithm::is_any_of; + using algorithm::is_from_range; + +} // namespace autoboost + +#endif // BOOST_STRING_PREDICATE_HPP diff --git a/contrib/autoboost/boost/algorithm/string/compare.hpp b/contrib/autoboost/boost/algorithm/string/compare.hpp new file mode 100644 index 000000000..8384a99db --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/compare.hpp @@ -0,0 +1,199 @@ +// Boost string_algo library compare.hpp header file -------------------------// + +// Copyright Pavol Droba 2002-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/ for updates, documentation, and revision history. + +#ifndef BOOST_STRING_COMPARE_HPP +#define BOOST_STRING_COMPARE_HPP + +#include +#include + +/*! \file + Defines element comparison predicates. Many algorithms in this library can + take an additional argument with a predicate used to compare elements. + This makes it possible, for instance, to have case insensitive versions + of the algorithms. +*/ + +namespace autoboost { + namespace algorithm { + + // is_equal functor -----------------------------------------------// + + //! is_equal functor + /*! + Standard STL equal_to only handle comparison between arguments + of the same type. This is a less restrictive version which wraps operator ==. + */ + struct is_equal + { + //! Function operator + /*! + Compare two operands for equality + */ + template< typename T1, typename T2 > + bool operator()( const T1& Arg1, const T2& Arg2 ) const + { + return Arg1==Arg2; + } + }; + + //! case insensitive version of is_equal + /*! + Case insensitive comparison predicate. Comparison is done using + specified locales. + */ + struct is_iequal + { + //! Constructor + /*! + \param Loc locales used for comparison + */ + is_iequal( const std::locale& Loc=std::locale() ) : + m_Loc( Loc ) {} + + //! Function operator + /*! + Compare two operands. Case is ignored. + */ + template< typename T1, typename T2 > + bool operator()( const T1& Arg1, const T2& Arg2 ) const + { + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::toupper(Arg1)==std::toupper(Arg2); + #else + return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc); + #endif + } + + private: + std::locale m_Loc; + }; + + // is_less functor -----------------------------------------------// + + //! is_less functor + /*! + Convenient version of standard std::less. Operation is templated, therefore it is + not required to specify the exact types upon the construction + */ + struct is_less + { + //! Functor operation + /*! + Compare two operands using > operator + */ + template< typename T1, typename T2 > + bool operator()( const T1& Arg1, const T2& Arg2 ) const + { + return Arg1 + bool operator()( const T1& Arg1, const T2& Arg2 ) const + { + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::toupper(Arg1)(Arg1,m_Loc)(Arg2,m_Loc); + #endif + } + + private: + std::locale m_Loc; + }; + + // is_not_greater functor -----------------------------------------------// + + //! is_not_greater functor + /*! + Convenient version of standard std::not_greater_to. Operation is templated, therefore it is + not required to specify the exact types upon the construction + */ + struct is_not_greater + { + //! Functor operation + /*! + Compare two operands using > operator + */ + template< typename T1, typename T2 > + bool operator()( const T1& Arg1, const T2& Arg2 ) const + { + return Arg1<=Arg2; + } + }; + + + //! case insensitive version of is_not_greater + /*! + Case insensitive comparison predicate. Comparison is done using + specified locales. + */ + struct is_not_igreater + { + //! Constructor + /*! + \param Loc locales used for comparison + */ + is_not_igreater( const std::locale& Loc=std::locale() ) : + m_Loc( Loc ) {} + + //! Function operator + /*! + Compare two operands. Case is ignored. + */ + template< typename T1, typename T2 > + bool operator()( const T1& Arg1, const T2& Arg2 ) const + { + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::toupper(Arg1)<=std::toupper(Arg2); + #else + return std::toupper(Arg1,m_Loc)<=std::toupper(Arg2,m_Loc); + #endif + } + + private: + std::locale m_Loc; + }; + + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::is_equal; + using algorithm::is_iequal; + using algorithm::is_less; + using algorithm::is_iless; + using algorithm::is_not_greater; + using algorithm::is_not_igreater; + +} // namespace autoboost + + +#endif // BOOST_STRING_COMPARE_HPP diff --git a/contrib/autoboost/boost/algorithm/string/concept.hpp b/contrib/autoboost/boost/algorithm/string/concept.hpp new file mode 100644 index 000000000..39a782446 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/concept.hpp @@ -0,0 +1,83 @@ +// Boost string_algo library concept.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_CONCEPT_HPP +#define BOOST_STRING_CONCEPT_HPP + +#include +#include +#include +#include + +/*! \file + Defines concepts used in string_algo library +*/ + +namespace autoboost { + namespace algorithm { + + //! Finder concept + /*! + Defines the Finder concept. Finder is a functor which selects + an arbitrary part of a string. Search is performed on + the range specified by starting and ending iterators. + + Result of the find operation must be convertible to iterator_range. + */ + template + struct FinderConcept + { + private: + typedef iterator_range range; + public: + void constraints() + { + // Operation + r=(*pF)(i,i); + } + private: + range r; + IteratorT i; + FinderT* pF; + }; // Finder_concept + + + //! Formatter concept + /*! + Defines the Formatter concept. Formatter is a functor, which + takes a result from a finder operation and transforms it + in a specific way. + + Result must be a container supported by container_traits, + or a reference to it. + */ + template + struct FormatterConcept + { + public: + void constraints() + { + // Operation + ::autoboost::begin((*pFo)( (*pF)(i,i) )); + ::autoboost::end((*pFo)( (*pF)(i,i) )); + } + private: + IteratorT i; + FinderT* pF; + FormatterT *pFo; + }; // FormatterConcept; + + } // namespace algorithm +} // namespace autoboost + + + + +#endif // BOOST_STRING_CONCEPT_HPP diff --git a/contrib/autoboost/boost/algorithm/string/config.hpp b/contrib/autoboost/boost/algorithm/string/config.hpp new file mode 100644 index 000000000..559750ac8 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/config.hpp @@ -0,0 +1,28 @@ +// Boost string_algo library config.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_CONFIG_HPP +#define BOOST_STRING_CONFIG_HPP + +#include +#include + +#ifdef BOOST_STRING_DEDUCED_TYPENAME +# error "macro already defined!" +#endif + +#define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME + +// Metrowerks workaround +#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x +#pragma parse_func_templ off +#endif + +#endif // BOOST_STRING_CONFIG_HPP diff --git a/contrib/autoboost/boost/algorithm/string/constants.hpp b/contrib/autoboost/boost/algorithm/string/constants.hpp new file mode 100644 index 000000000..5e0a4474a --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/constants.hpp @@ -0,0 +1,36 @@ +// Boost string_algo library constants.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_CONSTANTS_HPP +#define BOOST_STRING_CONSTANTS_HPP + +namespace autoboost { + namespace algorithm { + + //! Token compression mode + /*! + Specifies token compression mode for the token_finder. + */ + enum token_compress_mode_type + { + token_compress_on, //!< Compress adjacent tokens + token_compress_off //!< Do not compress adjacent tokens + }; + + } // namespace algorithm + + // pull the names to the boost namespace + using algorithm::token_compress_on; + using algorithm::token_compress_off; + +} // namespace autoboost + +#endif // BOOST_STRING_CONSTANTS_HPP + diff --git a/contrib/autoboost/boost/algorithm/string/detail/case_conv.hpp b/contrib/autoboost/boost/algorithm/string/detail/case_conv.hpp new file mode 100644 index 000000000..8bbeee523 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/case_conv.hpp @@ -0,0 +1,123 @@ +// Boost string_algo library string_funct.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_CASE_CONV_DETAIL_HPP +#define BOOST_STRING_CASE_CONV_DETAIL_HPP + +#include +#include +#include + +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// case conversion functors -----------------------------------------------// + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + // a tolower functor + template + struct to_lowerF : public std::unary_function + { + // Constructor + to_lowerF( const std::locale& Loc ) : m_Loc( &Loc ) {} + + // Operation + CharT operator ()( CharT Ch ) const + { + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::tolower( static_cast::type> ( Ch )); + #else + return std::tolower( Ch, *m_Loc ); + #endif + } + private: + const std::locale* m_Loc; + }; + + // a toupper functor + template + struct to_upperF : public std::unary_function + { + // Constructor + to_upperF( const std::locale& Loc ) : m_Loc( &Loc ) {} + + // Operation + CharT operator ()( CharT Ch ) const + { + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + return std::toupper( static_cast::type> ( Ch )); + #else + return std::toupper( Ch, *m_Loc ); + #endif + } + private: + const std::locale* m_Loc; + }; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +// algorithm implementation ------------------------------------------------------------------------- + + // Transform a range + template + OutputIteratorT transform_range_copy( + OutputIteratorT Output, + const RangeT& Input, + FunctorT Functor) + { + return std::transform( + ::autoboost::begin(Input), + ::autoboost::end(Input), + Output, + Functor); + } + + // Transform a range (in-place) + template + void transform_range( + const RangeT& Input, + FunctorT Functor) + { + std::transform( + ::autoboost::begin(Input), + ::autoboost::end(Input), + ::autoboost::begin(Input), + Functor); + } + + template + inline SequenceT transform_range_copy( + const RangeT& Input, + FunctorT Functor) + { + return SequenceT( + ::autoboost::make_transform_iterator( + ::autoboost::begin(Input), + Functor), + ::autoboost::make_transform_iterator( + ::autoboost::end(Input), + Functor)); + } + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_CASE_CONV_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/classification.hpp b/contrib/autoboost/boost/algorithm/string/detail/classification.hpp new file mode 100644 index 000000000..7a5d893f0 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/classification.hpp @@ -0,0 +1,353 @@ +// Boost string_algo library classification.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_CLASSIFICATION_DETAIL_HPP +#define BOOST_STRING_CLASSIFICATION_DETAIL_HPP + +#include +#include +#include +#include + +#include +#include + +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// classification functors -----------------------------------------------// + + // is_classified functor + struct is_classifiedF : + public predicate_facade + { + // Boost.ResultOf support + typedef bool result_type; + + // Constructor from a locale + is_classifiedF(std::ctype_base::mask Type, std::locale const & Loc = std::locale()) : + m_Type(Type), m_Locale(Loc) {} + // Operation + template + bool operator()( CharT Ch ) const + { + return std::use_facet< std::ctype >(m_Locale).is( m_Type, Ch ); + } + + #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x582) && !defined(_USE_OLD_RW_STL) + template<> + bool operator()( char const Ch ) const + { + return std::use_facet< std::ctype >(m_Locale).is( m_Type, Ch ); + } + #endif + + private: + std::ctype_base::mask m_Type; + std::locale m_Locale; + }; + + + // is_any_of functor + /* + returns true if the value is from the specified set + */ + template + struct is_any_ofF : + public predicate_facade > + { + private: + // set cannot operate on const value-type + typedef typename ::autoboost::remove_const::type set_value_type; + + public: + // Boost.ResultOf support + typedef bool result_type; + + // Constructor + template + is_any_ofF( const RangeT& Range ) : m_Size(0) + { + // Prepare storage + m_Storage.m_dynSet=0; + + std::size_t Size=::autoboost::distance(Range); + m_Size=Size; + set_value_type* Storage=0; + + if(use_fixed_storage(m_Size)) + { + // Use fixed storage + Storage=&m_Storage.m_fixSet[0]; + } + else + { + // Use dynamic storage + m_Storage.m_dynSet=new set_value_type[m_Size]; + Storage=m_Storage.m_dynSet; + } + + // Use fixed storage + ::std::copy(::autoboost::begin(Range), ::autoboost::end(Range), Storage); + ::std::sort(Storage, Storage+m_Size); + } + + // Copy constructor + is_any_ofF(const is_any_ofF& Other) : m_Size(Other.m_Size) + { + // Prepare storage + m_Storage.m_dynSet=0; + const set_value_type* SrcStorage=0; + set_value_type* DestStorage=0; + + if(use_fixed_storage(m_Size)) + { + // Use fixed storage + DestStorage=&m_Storage.m_fixSet[0]; + SrcStorage=&Other.m_Storage.m_fixSet[0]; + } + else + { + // Use dynamic storage + m_Storage.m_dynSet=new set_value_type[m_Size]; + DestStorage=m_Storage.m_dynSet; + SrcStorage=Other.m_Storage.m_dynSet; + } + + // Use fixed storage + ::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); + } + + // Destructor + ~is_any_ofF() + { + if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0) + { + delete [] m_Storage.m_dynSet; + } + } + + // Assignment + is_any_ofF& operator=(const is_any_ofF& Other) + { + // Handle self assignment + if(this==&Other) return *this; + + // Prepare storage + const set_value_type* SrcStorage; + set_value_type* DestStorage; + + if(use_fixed_storage(Other.m_Size)) + { + // Use fixed storage + DestStorage=&m_Storage.m_fixSet[0]; + SrcStorage=&Other.m_Storage.m_fixSet[0]; + + // Delete old storage if was present + if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0) + { + delete [] m_Storage.m_dynSet; + } + + // Set new size + m_Size=Other.m_Size; + } + else + { + // Other uses dynamic storage + SrcStorage=Other.m_Storage.m_dynSet; + + // Check what kind of storage are we using right now + if(use_fixed_storage(m_Size)) + { + // Using fixed storage, allocate new + set_value_type* pTemp=new set_value_type[Other.m_Size]; + DestStorage=pTemp; + m_Storage.m_dynSet=pTemp; + m_Size=Other.m_Size; + } + else + { + // Using dynamic storage, check if can reuse + if(m_Storage.m_dynSet!=0 && m_Size>=Other.m_Size && m_Size + bool operator()( Char2T Ch ) const + { + const set_value_type* Storage= + (use_fixed_storage(m_Size)) + ? &m_Storage.m_fixSet[0] + : m_Storage.m_dynSet; + + return ::std::binary_search(Storage, Storage+m_Size, Ch); + } + private: + // check if the size is eligible for fixed storage + static bool use_fixed_storage(std::size_t size) + { + return size<=sizeof(set_value_type*)*2; + } + + + private: + // storage + // The actual used storage is selected on the type + union + { + set_value_type* m_dynSet; + set_value_type m_fixSet[sizeof(set_value_type*)*2]; + } + m_Storage; + + // storage size + ::std::size_t m_Size; + }; + + // is_from_range functor + /* + returns true if the value is from the specified range. + (i.e. x>=From && x>=To) + */ + template + struct is_from_rangeF : + public predicate_facade< is_from_rangeF > + { + // Boost.ResultOf support + typedef bool result_type; + + // Constructor + is_from_rangeF( CharT From, CharT To ) : m_From(From), m_To(To) {} + + // Operation + template + bool operator()( Char2T Ch ) const + { + return ( m_From <= Ch ) && ( Ch <= m_To ); + } + + private: + CharT m_From; + CharT m_To; + }; + + // class_and composition predicate + template + struct pred_andF : + public predicate_facade< pred_andF > + { + public: + + // Boost.ResultOf support + typedef bool result_type; + + // Constructor + pred_andF( Pred1T Pred1, Pred2T Pred2 ) : + m_Pred1(Pred1), m_Pred2(Pred2) {} + + // Operation + template + bool operator()( CharT Ch ) const + { + return m_Pred1(Ch) && m_Pred2(Ch); + } + + private: + Pred1T m_Pred1; + Pred2T m_Pred2; + }; + + // class_or composition predicate + template + struct pred_orF : + public predicate_facade< pred_orF > + { + public: + // Boost.ResultOf support + typedef bool result_type; + + // Constructor + pred_orF( Pred1T Pred1, Pred2T Pred2 ) : + m_Pred1(Pred1), m_Pred2(Pred2) {} + + // Operation + template + bool operator()( CharT Ch ) const + { + return m_Pred1(Ch) || m_Pred2(Ch); + } + + private: + Pred1T m_Pred1; + Pred2T m_Pred2; + }; + + // class_not composition predicate + template< typename PredT > + struct pred_notF : + public predicate_facade< pred_notF > + { + public: + // Boost.ResultOf support + typedef bool result_type; + + // Constructor + pred_notF( PredT Pred ) : m_Pred(Pred) {} + + // Operation + template + bool operator()( CharT Ch ) const + { + return !m_Pred(Ch); + } + + private: + PredT m_Pred; + }; + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_CLASSIFICATION_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/find_format.hpp b/contrib/autoboost/boost/algorithm/string/detail/find_format.hpp new file mode 100644 index 000000000..b6c52b8b1 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/find_format.hpp @@ -0,0 +1,204 @@ +// Boost string_algo library find_format.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_FIND_FORMAT_DETAIL_HPP +#define BOOST_STRING_FIND_FORMAT_DETAIL_HPP + +#include +#include +#include +#include +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// find_format_copy (iterator variant) implementation -------------------------------// + + template< + typename OutputIteratorT, + typename InputT, + typename FormatterT, + typename FindResultT, + typename FormatResultT > + inline OutputIteratorT find_format_copy_impl2( + OutputIteratorT Output, + const InputT& Input, + FormatterT Formatter, + const FindResultT& FindResult, + const FormatResultT& FormatResult ) + { + typedef find_format_store< + BOOST_STRING_TYPENAME + range_const_iterator::type, + FormatterT, + FormatResultT > store_type; + + // Create store for the find result + store_type M( FindResult, FormatResult, Formatter ); + + if ( !M ) + { + // Match not found - return original sequence + Output = std::copy( ::autoboost::begin(Input), ::autoboost::end(Input), Output ); + return Output; + } + + // Copy the beginning of the sequence + Output = std::copy( ::autoboost::begin(Input), ::autoboost::begin(M), Output ); + // Format find result + // Copy formatted result + Output = std::copy( ::autoboost::begin(M.format_result()), ::autoboost::end(M.format_result()), Output ); + // Copy the rest of the sequence + Output = std::copy( M.end(), ::autoboost::end(Input), Output ); + + return Output; + } + + template< + typename OutputIteratorT, + typename InputT, + typename FormatterT, + typename FindResultT > + inline OutputIteratorT find_format_copy_impl( + OutputIteratorT Output, + const InputT& Input, + FormatterT Formatter, + const FindResultT& FindResult ) + { + if( ::autoboost::algorithm::detail::check_find_result(Input, FindResult) ) { + return ::autoboost::algorithm::detail::find_format_copy_impl2( + Output, + Input, + Formatter, + FindResult, + Formatter(FindResult) ); + } else { + return std::copy( ::autoboost::begin(Input), ::autoboost::end(Input), Output ); + } + } + + +// find_format_copy implementation --------------------------------------------------// + + template< + typename InputT, + typename FormatterT, + typename FindResultT, + typename FormatResultT > + inline InputT find_format_copy_impl2( + const InputT& Input, + FormatterT Formatter, + const FindResultT& FindResult, + const FormatResultT& FormatResult) + { + typedef find_format_store< + BOOST_STRING_TYPENAME + range_const_iterator::type, + FormatterT, + FormatResultT > store_type; + + // Create store for the find result + store_type M( FindResult, FormatResult, Formatter ); + + if ( !M ) + { + // Match not found - return original sequence + return InputT( Input ); + } + + InputT Output; + // Copy the beginning of the sequence + autoboost::algorithm::detail::insert( Output, ::autoboost::end(Output), ::autoboost::begin(Input), M.begin() ); + // Copy formatted result + autoboost::algorithm::detail::insert( Output, ::autoboost::end(Output), M.format_result() ); + // Copy the rest of the sequence + autoboost::algorithm::detail::insert( Output, ::autoboost::end(Output), M.end(), ::autoboost::end(Input) ); + + return Output; + } + + template< + typename InputT, + typename FormatterT, + typename FindResultT > + inline InputT find_format_copy_impl( + const InputT& Input, + FormatterT Formatter, + const FindResultT& FindResult) + { + if( ::autoboost::algorithm::detail::check_find_result(Input, FindResult) ) { + return ::autoboost::algorithm::detail::find_format_copy_impl2( + Input, + Formatter, + FindResult, + Formatter(FindResult) ); + } else { + return Input; + } + } + + // replace implementation ----------------------------------------------------// + + template< + typename InputT, + typename FormatterT, + typename FindResultT, + typename FormatResultT > + inline void find_format_impl2( + InputT& Input, + FormatterT Formatter, + const FindResultT& FindResult, + const FormatResultT& FormatResult) + { + typedef find_format_store< + BOOST_STRING_TYPENAME + range_iterator::type, + FormatterT, + FormatResultT > store_type; + + // Create store for the find result + store_type M( FindResult, FormatResult, Formatter ); + + if ( !M ) + { + // Search not found - return original sequence + return; + } + + // Replace match + ::autoboost::algorithm::detail::replace( Input, M.begin(), M.end(), M.format_result() ); + } + + template< + typename InputT, + typename FormatterT, + typename FindResultT > + inline void find_format_impl( + InputT& Input, + FormatterT Formatter, + const FindResultT& FindResult) + { + if( ::autoboost::algorithm::detail::check_find_result(Input, FindResult) ) { + ::autoboost::algorithm::detail::find_format_impl2( + Input, + Formatter, + FindResult, + Formatter(FindResult) ); + } + } + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + +#endif // BOOST_STRING_FIND_FORMAT_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/find_format_all.hpp b/contrib/autoboost/boost/algorithm/string/detail/find_format_all.hpp new file mode 100644 index 000000000..569db00d4 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/find_format_all.hpp @@ -0,0 +1,273 @@ +// Boost string_algo library find_format_all.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP +#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP + +#include +#include +#include +#include +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// find_format_all_copy (iterator variant) implementation ---------------------------// + + template< + typename OutputIteratorT, + typename InputT, + typename FinderT, + typename FormatterT, + typename FindResultT, + typename FormatResultT > + inline OutputIteratorT find_format_all_copy_impl2( + OutputIteratorT Output, + const InputT& Input, + FinderT Finder, + FormatterT Formatter, + const FindResultT& FindResult, + const FormatResultT& FormatResult ) + { + typedef BOOST_STRING_TYPENAME + range_const_iterator::type input_iterator_type; + + typedef find_format_store< + input_iterator_type, + FormatterT, + FormatResultT > store_type; + + // Create store for the find result + store_type M( FindResult, FormatResult, Formatter ); + + // Initialize last match + input_iterator_type LastMatch=::autoboost::begin(Input); + + // Iterate through all matches + while( M ) + { + // Copy the beginning of the sequence + Output = std::copy( LastMatch, M.begin(), Output ); + // Copy formatted result + Output = std::copy( ::autoboost::begin(M.format_result()), ::autoboost::end(M.format_result()), Output ); + + // Proceed to the next match + LastMatch=M.end(); + M=Finder( LastMatch, ::autoboost::end(Input) ); + } + + // Copy the rest of the sequence + Output = std::copy( LastMatch, ::autoboost::end(Input), Output ); + + return Output; + } + + template< + typename OutputIteratorT, + typename InputT, + typename FinderT, + typename FormatterT, + typename FindResultT > + inline OutputIteratorT find_format_all_copy_impl( + OutputIteratorT Output, + const InputT& Input, + FinderT Finder, + FormatterT Formatter, + const FindResultT& FindResult ) + { + if( ::autoboost::algorithm::detail::check_find_result(Input, FindResult) ) { + return ::autoboost::algorithm::detail::find_format_all_copy_impl2( + Output, + Input, + Finder, + Formatter, + FindResult, + Formatter(FindResult) ); + } else { + return std::copy( ::autoboost::begin(Input), ::autoboost::end(Input), Output ); + } + } + + // find_format_all_copy implementation ----------------------------------------------// + + template< + typename InputT, + typename FinderT, + typename FormatterT, + typename FindResultT, + typename FormatResultT > + inline InputT find_format_all_copy_impl2( + const InputT& Input, + FinderT Finder, + FormatterT Formatter, + const FindResultT& FindResult, + const FormatResultT& FormatResult) + { + typedef BOOST_STRING_TYPENAME + range_const_iterator::type input_iterator_type; + + typedef find_format_store< + input_iterator_type, + FormatterT, + FormatResultT > store_type; + + // Create store for the find result + store_type M( FindResult, FormatResult, Formatter ); + + // Initialize last match + input_iterator_type LastMatch=::autoboost::begin(Input); + + // Output temporary + InputT Output; + + // Iterate through all matches + while( M ) + { + // Copy the beginning of the sequence + autoboost::algorithm::detail::insert( Output, ::autoboost::end(Output), LastMatch, M.begin() ); + // Copy formatted result + autoboost::algorithm::detail::insert( Output, ::autoboost::end(Output), M.format_result() ); + + // Proceed to the next match + LastMatch=M.end(); + M=Finder( LastMatch, ::autoboost::end(Input) ); + } + + // Copy the rest of the sequence + ::autoboost::algorithm::detail::insert( Output, ::autoboost::end(Output), LastMatch, ::autoboost::end(Input) ); + + return Output; + } + + template< + typename InputT, + typename FinderT, + typename FormatterT, + typename FindResultT > + inline InputT find_format_all_copy_impl( + const InputT& Input, + FinderT Finder, + FormatterT Formatter, + const FindResultT& FindResult) + { + if( ::autoboost::algorithm::detail::check_find_result(Input, FindResult) ) { + return ::autoboost::algorithm::detail::find_format_all_copy_impl2( + Input, + Finder, + Formatter, + FindResult, + Formatter(FindResult) ); + } else { + return Input; + } + } + + // find_format_all implementation ------------------------------------------------// + + template< + typename InputT, + typename FinderT, + typename FormatterT, + typename FindResultT, + typename FormatResultT > + inline void find_format_all_impl2( + InputT& Input, + FinderT Finder, + FormatterT Formatter, + FindResultT FindResult, + FormatResultT FormatResult) + { + typedef BOOST_STRING_TYPENAME + range_iterator::type input_iterator_type; + typedef find_format_store< + input_iterator_type, + FormatterT, + FormatResultT > store_type; + + // Create store for the find result + store_type M( FindResult, FormatResult, Formatter ); + + // Instantiate replacement storage + std::deque< + BOOST_STRING_TYPENAME range_value::type> Storage; + + // Initialize replacement iterators + input_iterator_type InsertIt=::autoboost::begin(Input); + input_iterator_type SearchIt=::autoboost::begin(Input); + + while( M ) + { + // process the segment + InsertIt=process_segment( + Storage, + Input, + InsertIt, + SearchIt, + M.begin() ); + + // Adjust search iterator + SearchIt=M.end(); + + // Copy formatted replace to the storage + ::autoboost::algorithm::detail::copy_to_storage( Storage, M.format_result() ); + + // Find range for a next match + M=Finder( SearchIt, ::autoboost::end(Input) ); + } + + // process the last segment + InsertIt=::autoboost::algorithm::detail::process_segment( + Storage, + Input, + InsertIt, + SearchIt, + ::autoboost::end(Input) ); + + if ( Storage.empty() ) + { + // Truncate input + ::autoboost::algorithm::detail::erase( Input, InsertIt, ::autoboost::end(Input) ); + } + else + { + // Copy remaining data to the end of input + ::autoboost::algorithm::detail::insert( Input, ::autoboost::end(Input), Storage.begin(), Storage.end() ); + } + } + + template< + typename InputT, + typename FinderT, + typename FormatterT, + typename FindResultT > + inline void find_format_all_impl( + InputT& Input, + FinderT Finder, + FormatterT Formatter, + FindResultT FindResult) + { + if( ::autoboost::algorithm::detail::check_find_result(Input, FindResult) ) { + ::autoboost::algorithm::detail::find_format_all_impl2( + Input, + Finder, + Formatter, + FindResult, + Formatter(FindResult) ); + } + } + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + +#endif // BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/find_format_store.hpp b/contrib/autoboost/boost/algorithm/string/detail/find_format_store.hpp new file mode 100644 index 000000000..d6d01500b --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/find_format_store.hpp @@ -0,0 +1,89 @@ +// Boost string_algo library find_format_store.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP +#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP + +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// temporary format and find result storage --------------------------------// + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + template< + typename ForwardIteratorT, + typename FormatterT, + typename FormatResultT > + class find_format_store : + public iterator_range + { + public: + // typedefs + typedef iterator_range base_type; + typedef FormatterT formatter_type; + typedef FormatResultT format_result_type; + + public: + // Construction + find_format_store( + const base_type& FindResult, + const format_result_type& FormatResult, + const formatter_type& Formatter ) : + base_type(FindResult), + m_FormatResult(FormatResult), + m_Formatter(Formatter) {} + + // Assignment + template< typename FindResultT > + find_format_store& operator=( FindResultT FindResult ) + { + iterator_range::operator=(FindResult); + if( !this->empty() ) { + m_FormatResult=m_Formatter(FindResult); + } + + return *this; + } + + // Retrieve format result + const format_result_type& format_result() + { + return m_FormatResult; + } + + private: + format_result_type m_FormatResult; + const formatter_type& m_Formatter; + }; + + template + bool check_find_result(InputT&, FindResultT& FindResult) + { + typedef BOOST_STRING_TYPENAME + range_const_iterator::type input_iterator_type; + iterator_range ResultRange(FindResult); + return !ResultRange.empty(); + } + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + } // namespace detail + } // namespace algorithm +} // namespace autoboost + +#endif // BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/find_iterator.hpp b/contrib/autoboost/boost/algorithm/string/detail/find_iterator.hpp new file mode 100644 index 000000000..fd8250e21 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/find_iterator.hpp @@ -0,0 +1,87 @@ +// Boost string_algo library find_iterator.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_FIND_ITERATOR_DETAIL_HPP +#define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP + +#include +#include +#include +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// find_iterator base -----------------------------------------------// + + // Find iterator base + template + class find_iterator_base + { + protected: + // typedefs + typedef IteratorT input_iterator_type; + typedef iterator_range match_type; + typedef function2< + match_type, + input_iterator_type, + input_iterator_type> finder_type; + + protected: + // Protected construction/destruction + + // Default constructor + find_iterator_base() {}; + // Copy construction + find_iterator_base( const find_iterator_base& Other ) : + m_Finder(Other.m_Finder) {} + + // Constructor + template + find_iterator_base( FinderT Finder, int ) : + m_Finder(Finder) {} + + // Destructor + ~find_iterator_base() {} + + // Find operation + match_type do_find( + input_iterator_type Begin, + input_iterator_type End ) const + { + if (!m_Finder.empty()) + { + return m_Finder(Begin,End); + } + else + { + return match_type(End,End); + } + } + + // Check + bool is_null() const + { + return m_Finder.empty(); + } + + private: + // Finder + finder_type m_Finder; + }; + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_FIND_ITERATOR_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/finder.hpp b/contrib/autoboost/boost/algorithm/string/detail/finder.hpp new file mode 100644 index 000000000..f06edbced --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/finder.hpp @@ -0,0 +1,639 @@ +// Boost string_algo library finder.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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/ for updates, documentation, and revision history. + +#ifndef BOOST_STRING_FINDER_DETAIL_HPP +#define BOOST_STRING_FINDER_DETAIL_HPP + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + + +// find first functor -----------------------------------------------// + + // find a subsequence in the sequence ( functor ) + /* + Returns a pair marking the subsequence in the sequence. + If the find fails, functor returns + */ + template + struct first_finderF + { + typedef SearchIteratorT search_iterator_type; + + // Construction + template< typename SearchT > + first_finderF( const SearchT& Search, PredicateT Comp ) : + m_Search(::autoboost::begin(Search), ::autoboost::end(Search)), m_Comp(Comp) {} + first_finderF( + search_iterator_type SearchBegin, + search_iterator_type SearchEnd, + PredicateT Comp ) : + m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {} + + // Operation + template< typename ForwardIteratorT > + iterator_range + operator()( + ForwardIteratorT Begin, + ForwardIteratorT End ) const + { + typedef iterator_range result_type; + typedef ForwardIteratorT input_iterator_type; + + // Outer loop + for(input_iterator_type OuterIt=Begin; + OuterIt!=End; + ++OuterIt) + { + // Sanity check + if( autoboost::empty(m_Search) ) + return result_type( End, End ); + + input_iterator_type InnerIt=OuterIt; + search_iterator_type SubstrIt=m_Search.begin(); + for(; + InnerIt!=End && SubstrIt!=m_Search.end(); + ++InnerIt,++SubstrIt) + { + if( !( m_Comp(*InnerIt,*SubstrIt) ) ) + break; + } + + // Substring matching succeeded + if ( SubstrIt==m_Search.end() ) + return result_type( OuterIt, InnerIt ); + } + + return result_type( End, End ); + } + + private: + iterator_range m_Search; + PredicateT m_Comp; + }; + +// find last functor -----------------------------------------------// + + // find the last match a subsequence in the sequence ( functor ) + /* + Returns a pair marking the subsequence in the sequence. + If the find fails, returns + */ + template + struct last_finderF + { + typedef SearchIteratorT search_iterator_type; + typedef first_finderF< + search_iterator_type, + PredicateT> first_finder_type; + + // Construction + template< typename SearchT > + last_finderF( const SearchT& Search, PredicateT Comp ) : + m_Search(::autoboost::begin(Search), ::autoboost::end(Search)), m_Comp(Comp) {} + last_finderF( + search_iterator_type SearchBegin, + search_iterator_type SearchEnd, + PredicateT Comp ) : + m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {} + + // Operation + template< typename ForwardIteratorT > + iterator_range + operator()( + ForwardIteratorT Begin, + ForwardIteratorT End ) const + { + typedef iterator_range result_type; + + if( autoboost::empty(m_Search) ) + return result_type( End, End ); + + typedef BOOST_STRING_TYPENAME autoboost::detail:: + iterator_traits::iterator_category category; + + return findit( Begin, End, category() ); + } + + private: + // forward iterator + template< typename ForwardIteratorT > + iterator_range + findit( + ForwardIteratorT Begin, + ForwardIteratorT End, + std::forward_iterator_tag ) const + { + typedef iterator_range result_type; + + first_finder_type first_finder( + m_Search.begin(), m_Search.end(), m_Comp ); + + result_type M=first_finder( Begin, End ); + result_type Last=M; + + while( M ) + { + Last=M; + M=first_finder( ::autoboost::end(M), End ); + } + + return Last; + } + + // bidirectional iterator + template< typename ForwardIteratorT > + iterator_range + findit( + ForwardIteratorT Begin, + ForwardIteratorT End, + std::bidirectional_iterator_tag ) const + { + typedef iterator_range result_type; + typedef ForwardIteratorT input_iterator_type; + + // Outer loop + for(input_iterator_type OuterIt=End; + OuterIt!=Begin; ) + { + input_iterator_type OuterIt2=--OuterIt; + + input_iterator_type InnerIt=OuterIt2; + search_iterator_type SubstrIt=m_Search.begin(); + for(; + InnerIt!=End && SubstrIt!=m_Search.end(); + ++InnerIt,++SubstrIt) + { + if( !( m_Comp(*InnerIt,*SubstrIt) ) ) + break; + } + + // Substring matching succeeded + if( SubstrIt==m_Search.end() ) + return result_type( OuterIt2, InnerIt ); + } + + return result_type( End, End ); + } + + private: + iterator_range m_Search; + PredicateT m_Comp; + }; + +// find n-th functor -----------------------------------------------// + + // find the n-th match of a subsequence in the sequence ( functor ) + /* + Returns a pair marking the subsequence in the sequence. + If the find fails, returns + */ + template + struct nth_finderF + { + typedef SearchIteratorT search_iterator_type; + typedef first_finderF< + search_iterator_type, + PredicateT> first_finder_type; + typedef last_finderF< + search_iterator_type, + PredicateT> last_finder_type; + + // Construction + template< typename SearchT > + nth_finderF( + const SearchT& Search, + int Nth, + PredicateT Comp) : + m_Search(::autoboost::begin(Search), ::autoboost::end(Search)), + m_Nth(Nth), + m_Comp(Comp) {} + nth_finderF( + search_iterator_type SearchBegin, + search_iterator_type SearchEnd, + int Nth, + PredicateT Comp) : + m_Search(SearchBegin, SearchEnd), + m_Nth(Nth), + m_Comp(Comp) {} + + // Operation + template< typename ForwardIteratorT > + iterator_range + operator()( + ForwardIteratorT Begin, + ForwardIteratorT End ) const + { + if(m_Nth>=0) + { + return find_forward(Begin, End, m_Nth); + } + else + { + return find_backward(Begin, End, -m_Nth); + } + + } + + private: + // Implementation helpers + template< typename ForwardIteratorT > + iterator_range + find_forward( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N) const + { + typedef iterator_range result_type; + + // Sanity check + if( autoboost::empty(m_Search) ) + return result_type( End, End ); + + // Instantiate find functor + first_finder_type first_finder( + m_Search.begin(), m_Search.end(), m_Comp ); + + result_type M( Begin, Begin ); + + for( unsigned int n=0; n<=N; ++n ) + { + // find next match + M=first_finder( ::autoboost::end(M), End ); + + if ( !M ) + { + // Subsequence not found, return + return M; + } + } + + return M; + } + + template< typename ForwardIteratorT > + iterator_range + find_backward( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N) const + { + typedef iterator_range result_type; + + // Sanity check + if( autoboost::empty(m_Search) ) + return result_type( End, End ); + + // Instantiate find functor + last_finder_type last_finder( + m_Search.begin(), m_Search.end(), m_Comp ); + + result_type M( End, End ); + + for( unsigned int n=1; n<=N; ++n ) + { + // find next match + M=last_finder( Begin, ::autoboost::begin(M) ); + + if ( !M ) + { + // Subsequence not found, return + return M; + } + } + + return M; + } + + + private: + iterator_range m_Search; + int m_Nth; + PredicateT m_Comp; + }; + +// find head/tail implementation helpers ---------------------------// + + template + iterator_range + find_head_impl( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N, + std::forward_iterator_tag ) + { + typedef ForwardIteratorT input_iterator_type; + typedef iterator_range result_type; + + input_iterator_type It=Begin; + for( + unsigned int Index=0; + Index + iterator_range + find_head_impl( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N, + std::random_access_iterator_tag ) + { + typedef iterator_range result_type; + + if ( (End<=Begin) || ( static_cast(End-Begin) < N ) ) + return result_type( Begin, End ); + + return result_type(Begin,Begin+N); + } + + // Find head implementation + template + iterator_range + find_head_impl( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N ) + { + typedef BOOST_STRING_TYPENAME autoboost::detail:: + iterator_traits::iterator_category category; + + return ::autoboost::algorithm::detail::find_head_impl( Begin, End, N, category() ); + } + + template< typename ForwardIteratorT > + iterator_range + find_tail_impl( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N, + std::forward_iterator_tag ) + { + typedef ForwardIteratorT input_iterator_type; + typedef iterator_range result_type; + + unsigned int Index=0; + input_iterator_type It=Begin; + input_iterator_type It2=Begin; + + // Advance It2 by N increments + for( Index=0; Index + iterator_range + find_tail_impl( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N, + std::bidirectional_iterator_tag ) + { + typedef ForwardIteratorT input_iterator_type; + typedef iterator_range result_type; + + input_iterator_type It=End; + for( + unsigned int Index=0; + Index + iterator_range + find_tail_impl( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N, + std::random_access_iterator_tag ) + { + typedef iterator_range result_type; + + if ( (End<=Begin) || ( static_cast(End-Begin) < N ) ) + return result_type( Begin, End ); + + return result_type( End-N, End ); + } + + // Operation + template< typename ForwardIteratorT > + iterator_range + find_tail_impl( + ForwardIteratorT Begin, + ForwardIteratorT End, + unsigned int N ) + { + typedef BOOST_STRING_TYPENAME autoboost::detail:: + iterator_traits::iterator_category category; + + return ::autoboost::algorithm::detail::find_tail_impl( Begin, End, N, category() ); + } + + + +// find head functor -----------------------------------------------// + + + // find a head in the sequence ( functor ) + /* + This functor find a head of the specified range. For + a specified N, the head is a subsequence of N starting + elements of the range. + */ + struct head_finderF + { + // Construction + head_finderF( int N ) : m_N(N) {} + + // Operation + template< typename ForwardIteratorT > + iterator_range + operator()( + ForwardIteratorT Begin, + ForwardIteratorT End ) const + { + if(m_N>=0) + { + return ::autoboost::algorithm::detail::find_head_impl( Begin, End, m_N ); + } + else + { + iterator_range Res= + ::autoboost::algorithm::detail::find_tail_impl( Begin, End, -m_N ); + + return ::autoboost::make_iterator_range(Begin, Res.begin()); + } + } + + private: + int m_N; + }; + +// find tail functor -----------------------------------------------// + + + // find a tail in the sequence ( functor ) + /* + This functor find a tail of the specified range. For + a specified N, the head is a subsequence of N starting + elements of the range. + */ + struct tail_finderF + { + // Construction + tail_finderF( int N ) : m_N(N) {} + + // Operation + template< typename ForwardIteratorT > + iterator_range + operator()( + ForwardIteratorT Begin, + ForwardIteratorT End ) const + { + if(m_N>=0) + { + return ::autoboost::algorithm::detail::find_tail_impl( Begin, End, m_N ); + } + else + { + iterator_range Res= + ::autoboost::algorithm::detail::find_head_impl( Begin, End, -m_N ); + + return ::autoboost::make_iterator_range(Res.end(), End); + } + } + + private: + int m_N; + }; + +// find token functor -----------------------------------------------// + + // find a token in a sequence ( functor ) + /* + This find functor finds a token specified be a predicate + in a sequence. It is equivalent of std::find algorithm, + with an exception that it return range instead of a single + iterator. + + If bCompress is set to true, adjacent matching tokens are + concatenated into one match. + */ + template< typename PredicateT > + struct token_finderF + { + // Construction + token_finderF( + PredicateT Pred, + token_compress_mode_type eCompress=token_compress_off ) : + m_Pred(Pred), m_eCompress(eCompress) {} + + // Operation + template< typename ForwardIteratorT > + iterator_range + operator()( + ForwardIteratorT Begin, + ForwardIteratorT End ) const + { + typedef iterator_range result_type; + + ForwardIteratorT It=std::find_if( Begin, End, m_Pred ); + + if( It==End ) + { + return result_type( End, End ); + } + else + { + ForwardIteratorT It2=It; + + if( m_eCompress==token_compress_on ) + { + // Find first non-matching character + while( It2!=End && m_Pred(*It2) ) ++It2; + } + else + { + // Advance by one position + ++It2; + } + + return result_type( It, It2 ); + } + } + + private: + PredicateT m_Pred; + token_compress_mode_type m_eCompress; + }; + +// find range functor -----------------------------------------------// + + // find a range in the sequence ( functor ) + /* + This functor actually does not perform any find operation. + It always returns given iterator range as a result. + */ + template + struct range_finderF + { + typedef ForwardIterator1T input_iterator_type; + typedef iterator_range result_type; + + // Construction + range_finderF( + input_iterator_type Begin, + input_iterator_type End ) : m_Range(Begin, End) {} + + range_finderF(const iterator_range& Range) : + m_Range(Range) {} + + // Operation + template< typename ForwardIterator2T > + iterator_range + operator()( + ForwardIterator2T, + ForwardIterator2T ) const + { +#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 ) + return iterator_range(this->m_Range); +#else + return m_Range; +#endif + } + + private: + iterator_range m_Range; + }; + + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + +#endif // BOOST_STRING_FINDER_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/formatter.hpp b/contrib/autoboost/boost/algorithm/string/detail/formatter.hpp new file mode 100644 index 000000000..df91d9413 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/formatter.hpp @@ -0,0 +1,119 @@ +// Boost string_algo library formatter.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_FORMATTER_DETAIL_HPP +#define BOOST_STRING_FORMATTER_DETAIL_HPP + + +#include +#include +#include +#include + +#include + +// generic replace functors -----------------------------------------------// + +namespace autoboost { + namespace algorithm { + namespace detail { + +// const format functor ----------------------------------------------------// + + // constant format functor + template + struct const_formatF + { + private: + typedef BOOST_STRING_TYPENAME + range_const_iterator::type format_iterator; + typedef iterator_range result_type; + + public: + // Construction + const_formatF(const RangeT& Format) : + m_Format(::autoboost::begin(Format), ::autoboost::end(Format)) {} + + // Operation +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + template + result_type& operator()(const Range2T&) + { + return m_Format; + } +#endif + + template + const result_type& operator()(const Range2T&) const + { + return m_Format; + } + + private: + result_type m_Format; + }; + +// identity format functor ----------------------------------------------------// + + // identity format functor + template + struct identity_formatF + { + // Operation + template< typename Range2T > + const RangeT& operator()(const Range2T& Replace) const + { + return RangeT(::autoboost::begin(Replace), ::autoboost::end(Replace)); + } + }; + +// empty format functor ( used by erase ) ------------------------------------// + + // empty format functor + template< typename CharT > + struct empty_formatF + { + template< typename ReplaceT > + empty_container operator()(const ReplaceT&) const + { + return empty_container(); + } + }; + +// dissect format functor ----------------------------------------------------// + + // dissect format functor + template + struct dissect_formatF + { + public: + // Construction + dissect_formatF(FinderT Finder) : + m_Finder(Finder) {} + + // Operation + template + inline iterator_range< + BOOST_STRING_TYPENAME range_const_iterator::type> + operator()(const RangeT& Replace) const + { + return m_Finder(::autoboost::begin(Replace), ::autoboost::end(Replace)); + } + + private: + FinderT m_Finder; + }; + + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + +#endif // BOOST_STRING_FORMATTER_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/replace_storage.hpp b/contrib/autoboost/boost/algorithm/string/detail/replace_storage.hpp new file mode 100644 index 000000000..8ac7e4b14 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/replace_storage.hpp @@ -0,0 +1,159 @@ +// Boost string_algo library replace_storage.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP +#define BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP + +#include +#include +#include +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// storage handling routines -----------------------------------------------// + + template< typename StorageT, typename OutputIteratorT > + inline OutputIteratorT move_from_storage( + StorageT& Storage, + OutputIteratorT DestBegin, + OutputIteratorT DestEnd ) + { + OutputIteratorT OutputIt=DestBegin; + + while( !Storage.empty() && OutputIt!=DestEnd ) + { + *OutputIt=Storage.front(); + Storage.pop_front(); + ++OutputIt; + } + + return OutputIt; + } + + template< typename StorageT, typename WhatT > + inline void copy_to_storage( + StorageT& Storage, + const WhatT& What ) + { + Storage.insert( Storage.end(), ::autoboost::begin(What), ::autoboost::end(What) ); + } + + +// process segment routine -----------------------------------------------// + + template< bool HasStableIterators > + struct process_segment_helper + { + // Optimized version of process_segment for generic sequence + template< + typename StorageT, + typename InputT, + typename ForwardIteratorT > + ForwardIteratorT operator()( + StorageT& Storage, + InputT& /*Input*/, + ForwardIteratorT InsertIt, + ForwardIteratorT SegmentBegin, + ForwardIteratorT SegmentEnd ) + { + // Copy data from the storage until the beginning of the segment + ForwardIteratorT It=::autoboost::algorithm::detail::move_from_storage( Storage, InsertIt, SegmentBegin ); + + // 3 cases are possible : + // a) Storage is empty, It==SegmentBegin + // b) Storage is empty, It!=SegmentBegin + // c) Storage is not empty + + if( Storage.empty() ) + { + if( It==SegmentBegin ) + { + // Case a) everything is grand, just return end of segment + return SegmentEnd; + } + else + { + // Case b) move the segment backwards + return std::copy( SegmentBegin, SegmentEnd, It ); + } + } + else + { + // Case c) -> shift the segment to the left and keep the overlap in the storage + while( It!=SegmentEnd ) + { + // Store value into storage + Storage.push_back( *It ); + // Get the top from the storage and put it here + *It=Storage.front(); + Storage.pop_front(); + + // Advance + ++It; + } + + return It; + } + } + }; + + template<> + struct process_segment_helper< true > + { + // Optimized version of process_segment for list-like sequence + template< + typename StorageT, + typename InputT, + typename ForwardIteratorT > + ForwardIteratorT operator()( + StorageT& Storage, + InputT& Input, + ForwardIteratorT InsertIt, + ForwardIteratorT SegmentBegin, + ForwardIteratorT SegmentEnd ) + + { + // Call replace to do the job + ::autoboost::algorithm::detail::replace( Input, InsertIt, SegmentBegin, Storage ); + // Empty the storage + Storage.clear(); + // Iterators were not changed, simply return the end of segment + return SegmentEnd; + } + }; + + // Process one segment in the replace_all algorithm + template< + typename StorageT, + typename InputT, + typename ForwardIteratorT > + inline ForwardIteratorT process_segment( + StorageT& Storage, + InputT& Input, + ForwardIteratorT InsertIt, + ForwardIteratorT SegmentBegin, + ForwardIteratorT SegmentEnd ) + { + return + process_segment_helper< + has_stable_iterators::value>()( + Storage, Input, InsertIt, SegmentBegin, SegmentEnd ); + } + + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + +#endif // BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/sequence.hpp b/contrib/autoboost/boost/algorithm/string/detail/sequence.hpp new file mode 100644 index 000000000..ebc56261c --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/sequence.hpp @@ -0,0 +1,200 @@ +// Boost string_algo library sequence.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_DETAIL_SEQUENCE_HPP +#define BOOST_STRING_DETAIL_SEQUENCE_HPP + +#include +#include +#include +#include +#include + +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// insert helpers -------------------------------------------------// + + template< typename InputT, typename ForwardIteratorT > + inline void insert( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator At, + ForwardIteratorT Begin, + ForwardIteratorT End ) + { + Input.insert( At, Begin, End ); + } + + template< typename InputT, typename InsertT > + inline void insert( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator At, + const InsertT& Insert ) + { + ::autoboost::algorithm::detail::insert( Input, At, ::autoboost::begin(Insert), ::autoboost::end(Insert) ); + } + +// erase helper ---------------------------------------------------// + + // Erase a range in the sequence + /* + Returns the iterator pointing just after the erase subrange + */ + template< typename InputT > + inline typename InputT::iterator erase( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator From, + BOOST_STRING_TYPENAME InputT::iterator To ) + { + return Input.erase( From, To ); + } + +// replace helper implementation ----------------------------------// + + // Optimized version of replace for generic sequence containers + // Assumption: insert and erase are expensive + template< bool HasConstTimeOperations > + struct replace_const_time_helper + { + template< typename InputT, typename ForwardIteratorT > + void operator()( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator From, + BOOST_STRING_TYPENAME InputT::iterator To, + ForwardIteratorT Begin, + ForwardIteratorT End ) + { + // Copy data to the container ( as much as possible ) + ForwardIteratorT InsertIt=Begin; + BOOST_STRING_TYPENAME InputT::iterator InputIt=From; + for(; InsertIt!=End && InputIt!=To; InsertIt++, InputIt++ ) + { + *InputIt=*InsertIt; + } + + if ( InsertIt!=End ) + { + // Replace sequence is longer, insert it + Input.insert( InputIt, InsertIt, End ); + } + else + { + if ( InputIt!=To ) + { + // Replace sequence is shorter, erase the rest + Input.erase( InputIt, To ); + } + } + } + }; + + template<> + struct replace_const_time_helper< true > + { + // Const-time erase and insert methods -> use them + template< typename InputT, typename ForwardIteratorT > + void operator()( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator From, + BOOST_STRING_TYPENAME InputT::iterator To, + ForwardIteratorT Begin, + ForwardIteratorT End ) + { + BOOST_STRING_TYPENAME InputT::iterator At=Input.erase( From, To ); + if ( Begin!=End ) + { + if(!Input.empty()) + { + Input.insert( At, Begin, End ); + } + else + { + Input.insert( Input.begin(), Begin, End ); + } + } + } + }; + + // No native replace method + template< bool HasNative > + struct replace_native_helper + { + template< typename InputT, typename ForwardIteratorT > + void operator()( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator From, + BOOST_STRING_TYPENAME InputT::iterator To, + ForwardIteratorT Begin, + ForwardIteratorT End ) + { + replace_const_time_helper< + autoboost::mpl::and_< + has_const_time_insert, + has_const_time_erase >::value >()( + Input, From, To, Begin, End ); + } + }; + + // Container has native replace method + template<> + struct replace_native_helper< true > + { + template< typename InputT, typename ForwardIteratorT > + void operator()( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator From, + BOOST_STRING_TYPENAME InputT::iterator To, + ForwardIteratorT Begin, + ForwardIteratorT End ) + { + Input.replace( From, To, Begin, End ); + } + }; + +// replace helper -------------------------------------------------// + + template< typename InputT, typename ForwardIteratorT > + inline void replace( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator From, + BOOST_STRING_TYPENAME InputT::iterator To, + ForwardIteratorT Begin, + ForwardIteratorT End ) + { + replace_native_helper< has_native_replace::value >()( + Input, From, To, Begin, End ); + } + + template< typename InputT, typename InsertT > + inline void replace( + InputT& Input, + BOOST_STRING_TYPENAME InputT::iterator From, + BOOST_STRING_TYPENAME InputT::iterator To, + const InsertT& Insert ) + { + if(From!=To) + { + ::autoboost::algorithm::detail::replace( Input, From, To, ::autoboost::begin(Insert), ::autoboost::end(Insert) ); + } + else + { + ::autoboost::algorithm::detail::insert( Input, From, ::autoboost::begin(Insert), ::autoboost::end(Insert) ); + } + } + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_DETAIL_SEQUENCE_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/trim.hpp b/contrib/autoboost/boost/algorithm/string/detail/trim.hpp new file mode 100644 index 000000000..bde391083 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/trim.hpp @@ -0,0 +1,95 @@ +// Boost string_algo library trim.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_TRIM_DETAIL_HPP +#define BOOST_STRING_TRIM_DETAIL_HPP + +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// trim iterator helper -----------------------------------------------// + + template< typename ForwardIteratorT, typename PredicateT > + inline ForwardIteratorT trim_end_iter_select( + ForwardIteratorT InBegin, + ForwardIteratorT InEnd, + PredicateT IsSpace, + std::forward_iterator_tag ) + { + ForwardIteratorT TrimIt=InBegin; + + for( ForwardIteratorT It=InBegin; It!=InEnd; ++It ) + { + if ( !IsSpace(*It) ) + { + TrimIt=It; + ++TrimIt; + } + } + + return TrimIt; + } + + template< typename ForwardIteratorT, typename PredicateT > + inline ForwardIteratorT trim_end_iter_select( + ForwardIteratorT InBegin, + ForwardIteratorT InEnd, + PredicateT IsSpace, + std::bidirectional_iterator_tag ) + { + for( ForwardIteratorT It=InEnd; It!=InBegin; ) + { + if ( !IsSpace(*(--It)) ) + return ++It; + } + + return InBegin; + } + // Search for first non matching character from the beginning of the sequence + template< typename ForwardIteratorT, typename PredicateT > + inline ForwardIteratorT trim_begin( + ForwardIteratorT InBegin, + ForwardIteratorT InEnd, + PredicateT IsSpace ) + { + ForwardIteratorT It=InBegin; + for(; It!=InEnd; ++It ) + { + if (!IsSpace(*It)) + return It; + } + + return It; + } + + // Search for first non matching character from the end of the sequence + template< typename ForwardIteratorT, typename PredicateT > + inline ForwardIteratorT trim_end( + ForwardIteratorT InBegin, + ForwardIteratorT InEnd, + PredicateT IsSpace ) + { + typedef BOOST_STRING_TYPENAME autoboost::detail:: + iterator_traits::iterator_category category; + + return ::autoboost::algorithm::detail::trim_end_iter_select( InBegin, InEnd, IsSpace, category() ); + } + + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_TRIM_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/detail/util.hpp b/contrib/autoboost/boost/algorithm/string/detail/util.hpp new file mode 100644 index 000000000..4a694f4a0 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/detail/util.hpp @@ -0,0 +1,106 @@ +// Boost string_algo library util.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_UTIL_DETAIL_HPP +#define BOOST_STRING_UTIL_DETAIL_HPP + +#include +#include +#include + +namespace autoboost { + namespace algorithm { + namespace detail { + +// empty container -----------------------------------------------// + + // empty_container + /* + This class represents always empty container, + containing elements of type CharT. + + It is supposed to be used in a const version only + */ + template< typename CharT > + struct empty_container + { + typedef empty_container type; + typedef CharT value_type; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef const value_type& reference; + typedef const value_type& const_reference; + typedef const value_type* iterator; + typedef const value_type* const_iterator; + + + // Operations + const_iterator begin() const + { + return reinterpret_cast(0); + } + + const_iterator end() const + { + return reinterpret_cast(0); + } + + bool empty() const + { + return false; + } + + size_type size() const + { + return 0; + } + }; + +// bounded copy algorithm -----------------------------------------------// + + // Bounded version of the std::copy algorithm + template + inline OutputIteratorT bounded_copy( + InputIteratorT First, + InputIteratorT Last, + OutputIteratorT DestFirst, + OutputIteratorT DestLast ) + { + InputIteratorT InputIt=First; + OutputIteratorT OutputIt=DestFirst; + for(; InputIt!=Last && OutputIt!=DestLast; InputIt++, OutputIt++ ) + { + *OutputIt=*InputIt; + } + + return OutputIt; + } + +// iterator range utilities -----------------------------------------// + + // copy range functor + template< + typename SeqT, + typename IteratorT=BOOST_STRING_TYPENAME SeqT::const_iterator > + struct copy_iterator_rangeF : + public std::unary_function< iterator_range, SeqT > + { + SeqT operator()( const iterator_range& Range ) const + { + return copy_range(Range); + } + }; + + } // namespace detail + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_UTIL_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/erase.hpp b/contrib/autoboost/boost/algorithm/string/erase.hpp new file mode 100644 index 000000000..aced7ecb7 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/erase.hpp @@ -0,0 +1,844 @@ +// Boost string_algo library erase.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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/ for updates, documentation, and revision history. + +#ifndef BOOST_STRING_ERASE_HPP +#define BOOST_STRING_ERASE_HPP + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +/*! \file + Defines various erase algorithms. Each algorithm removes + part(s) of the input according to a searching criteria. +*/ + +namespace autoboost { + namespace algorithm { + +// erase_range -------------------------------------------------------// + + //! Erase range algorithm + /*! + Remove the given range from the input. The result is a modified copy of + the input. It is returned as a sequence or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input sequence + \param SearchRange A range in the input to be removed + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template + inline OutputIteratorT erase_range_copy( + OutputIteratorT Output, + const RangeT& Input, + const iterator_range< + BOOST_STRING_TYPENAME + range_const_iterator::type>& SearchRange ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::range_finder(SearchRange), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase range algorithm + /*! + \overload + */ + template + inline SequenceT erase_range_copy( + const SequenceT& Input, + const iterator_range< + BOOST_STRING_TYPENAME + range_const_iterator::type>& SearchRange ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::range_finder(SearchRange), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase range algorithm + /*! + Remove the given range from the input. + The input sequence is modified in-place. + + \param Input An input sequence + \param SearchRange A range in the input to be removed + */ + template + inline void erase_range( + SequenceT& Input, + const iterator_range< + BOOST_STRING_TYPENAME + range_iterator::type>& SearchRange ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::range_finder(SearchRange), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_first --------------------------------------------------------// + + //! Erase first algorithm + /*! + Remove the first occurrence of the substring from the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT erase_first_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase first algorithm + /*! + \overload + */ + template + inline SequenceT erase_first_copy( + const SequenceT& Input, + const RangeT& Search ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase first algorithm + /*! + Remove the first occurrence of the substring from the input. + The input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for. + */ + template + inline void erase_first( + SequenceT& Input, + const RangeT& Search ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_first ( case insensitive ) ------------------------------------// + + //! Erase first algorithm ( case insensitive ) + /*! + Remove the first occurrence of the substring from the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT ierase_first_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase first algorithm ( case insensitive ) + /*! + \overload + */ + template + inline SequenceT ierase_first_copy( + const SequenceT& Input, + const RangeT& Search, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase first algorithm ( case insensitive ) + /*! + Remove the first occurrence of the substring from the input. + The input sequence is modified in-place. Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for + \param Loc A locale used for case insensitive comparison + */ + template + inline void ierase_first( + SequenceT& Input, + const RangeT& Search, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_last --------------------------------------------------------// + + //! Erase last algorithm + /*! + Remove the last occurrence of the substring from the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for. + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT erase_last_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::last_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase last algorithm + /*! + \overload + */ + template + inline SequenceT erase_last_copy( + const SequenceT& Input, + const RangeT& Search ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::last_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase last algorithm + /*! + Remove the last occurrence of the substring from the input. + The input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for + */ + template + inline void erase_last( + SequenceT& Input, + const RangeT& Search ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::last_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_last ( case insensitive ) ------------------------------------// + + //! Erase last algorithm ( case insensitive ) + /*! + Remove the last occurrence of the substring from the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT ierase_last_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::last_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase last algorithm ( case insensitive ) + /*! + \overload + */ + template + inline SequenceT ierase_last_copy( + const SequenceT& Input, + const RangeT& Search, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::last_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase last algorithm ( case insensitive ) + /*! + Remove the last occurrence of the substring from the input. + The input sequence is modified in-place. Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for + \param Loc A locale used for case insensitive comparison + */ + template + inline void ierase_last( + SequenceT& Input, + const RangeT& Search, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::last_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_nth --------------------------------------------------------------------// + + //! Erase nth algorithm + /*! + Remove the Nth occurrence of the substring in the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT erase_nth_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + int Nth ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::nth_finder(Search, Nth), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase nth algorithm + /*! + \overload + */ + template + inline SequenceT erase_nth_copy( + const SequenceT& Input, + const RangeT& Search, + int Nth ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase nth algorithm + /*! + Remove the Nth occurrence of the substring in the input. + The input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for. + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + */ + template + inline void erase_nth( + SequenceT& Input, + const RangeT& Search, + int Nth ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_nth ( case insensitive ) ---------------------------------------------// + + //! Erase nth algorithm ( case insensitive ) + /*! + Remove the Nth occurrence of the substring in the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for. + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT ierase_nth_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + int Nth, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase nth algorithm + /*! + \overload + */ + template + inline SequenceT ierase_nth_copy( + const SequenceT& Input, + const RangeT& Search, + int Nth, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + empty_formatter(Input) ); + } + + //! Erase nth algorithm + /*! + Remove the Nth occurrence of the substring in the input. + The input sequence is modified in-place. Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for. + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + \param Loc A locale used for case insensitive comparison + */ + template + inline void ierase_nth( + SequenceT& Input, + const RangeT& Search, + int Nth, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + +// erase_all --------------------------------------------------------// + + //! Erase all algorithm + /*! + Remove all the occurrences of the string from the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + + \param Output An output iterator to which the result will be copied + \param Input An input sequence + \param Search A substring to be searched for. + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT erase_all_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search ) + { + return ::autoboost::algorithm::find_format_all_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase all algorithm + /*! + \overload + */ + template + inline SequenceT erase_all_copy( + const SequenceT& Input, + const RangeT& Search ) + { + return ::autoboost::algorithm::find_format_all_copy( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase all algorithm + /*! + Remove all the occurrences of the string from the input. + The input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for. + */ + template + inline void erase_all( + SequenceT& Input, + const RangeT& Search ) + { + ::autoboost::algorithm::find_format_all( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_all ( case insensitive ) ------------------------------------// + + //! Erase all algorithm ( case insensitive ) + /*! + Remove all the occurrences of the string from the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT ierase_all_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_all_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase all algorithm ( case insensitive ) + /*! + \overload + */ + template + inline SequenceT ierase_all_copy( + const SequenceT& Input, + const RangeT& Search, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_all_copy( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + + //! Erase all algorithm ( case insensitive ) + /*! + Remove all the occurrences of the string from the input. + The input sequence is modified in-place. Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for. + \param Loc A locale used for case insensitive comparison + */ + template + inline void ierase_all( + SequenceT& Input, + const RangeT& Search, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format_all( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::empty_formatter(Input) ); + } + +// erase_head --------------------------------------------------------------------// + + //! Erase head algorithm + /*! + Remove the head from the input. The head is a prefix of a sequence of given size. + If the sequence is shorter then required, the whole string is + considered to be the head. The result is a modified copy of the input. + It is returned as a sequence or copied to the output iterator. + + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param N Length of the head. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename RangeT> + inline OutputIteratorT erase_head_copy( + OutputIteratorT Output, + const RangeT& Input, + int N ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::head_finder(N), + ::autoboost::algorithm::empty_formatter( Input ) ); + } + + //! Erase head algorithm + /*! + \overload + */ + template + inline SequenceT erase_head_copy( + const SequenceT& Input, + int N ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::head_finder(N), + ::autoboost::algorithm::empty_formatter( Input ) ); + } + + //! Erase head algorithm + /*! + Remove the head from the input. The head is a prefix of a sequence of given size. + If the sequence is shorter then required, the whole string is + considered to be the head. The input sequence is modified in-place. + + \param Input An input string + \param N Length of the head + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + */ + template + inline void erase_head( + SequenceT& Input, + int N ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::head_finder(N), + ::autoboost::algorithm::empty_formatter( Input ) ); + } + +// erase_tail --------------------------------------------------------------------// + + //! Erase tail algorithm + /*! + Remove the tail from the input. The tail is a suffix of a sequence of given size. + If the sequence is shorter then required, the whole string is + considered to be the tail. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param N Length of the tail. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename RangeT> + inline OutputIteratorT erase_tail_copy( + OutputIteratorT Output, + const RangeT& Input, + int N ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::tail_finder(N), + ::autoboost::algorithm::empty_formatter( Input ) ); + } + + //! Erase tail algorithm + /*! + \overload + */ + template + inline SequenceT erase_tail_copy( + const SequenceT& Input, + int N ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::tail_finder(N), + ::autoboost::algorithm::empty_formatter( Input ) ); + } + + //! Erase tail algorithm + /*! + Remove the tail from the input. The tail is a suffix of a sequence of given size. + If the sequence is shorter then required, the whole string is + considered to be the tail. The input sequence is modified in-place. + + \param Input An input string + \param N Length of the tail + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + */ + template + inline void erase_tail( + SequenceT& Input, + int N ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::tail_finder(N), + ::autoboost::algorithm::empty_formatter( Input ) ); + } + + } // namespace algorithm + + // pull names into the boost namespace + using algorithm::erase_range_copy; + using algorithm::erase_range; + using algorithm::erase_first_copy; + using algorithm::erase_first; + using algorithm::ierase_first_copy; + using algorithm::ierase_first; + using algorithm::erase_last_copy; + using algorithm::erase_last; + using algorithm::ierase_last_copy; + using algorithm::ierase_last; + using algorithm::erase_nth_copy; + using algorithm::erase_nth; + using algorithm::ierase_nth_copy; + using algorithm::ierase_nth; + using algorithm::erase_all_copy; + using algorithm::erase_all; + using algorithm::ierase_all_copy; + using algorithm::ierase_all; + using algorithm::erase_head_copy; + using algorithm::erase_head; + using algorithm::erase_tail_copy; + using algorithm::erase_tail; + +} // namespace autoboost + + +#endif // BOOST_ERASE_HPP diff --git a/contrib/autoboost/boost/algorithm/string/find_format.hpp b/contrib/autoboost/boost/algorithm/string/find_format.hpp new file mode 100644 index 000000000..e473d1ce5 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/find_format.hpp @@ -0,0 +1,287 @@ +// Boost string_algo library find_format.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_FIND_FORMAT_HPP +#define BOOST_STRING_FIND_FORMAT_HPP + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/*! \file + Defines generic replace algorithms. Each algorithm replaces + part(s) of the input. The part to be replaced is looked up using a Finder object. + Result of finding is then used by a Formatter object to generate the replacement. +*/ + +namespace autoboost { + namespace algorithm { + +// generic replace -----------------------------------------------------------------// + + //! Generic replace algorithm + /*! + Use the Finder to search for a substring. Use the Formatter to format + this substring and replace it in the input. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input sequence + \param Finder A Finder object used to search for a match to be replaced + \param Formatter A Formatter object used to format a match + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename RangeT, + typename FinderT, + typename FormatterT> + inline OutputIteratorT find_format_copy( + OutputIteratorT Output, + const RangeT& Input, + FinderT Finder, + FormatterT Formatter ) + { + // Concept check + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( + FormatterConcept< + FormatterT, + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); + + iterator_range::type> lit_input(::autoboost::as_literal(Input)); + + return detail::find_format_copy_impl( + Output, + lit_input, + Formatter, + Finder( ::autoboost::begin(lit_input), ::autoboost::end(lit_input) ) ); + } + + //! Generic replace algorithm + /*! + \overload + */ + template< + typename SequenceT, + typename FinderT, + typename FormatterT> + inline SequenceT find_format_copy( + const SequenceT& Input, + FinderT Finder, + FormatterT Formatter ) + { + // Concept check + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( + FormatterConcept< + FormatterT, + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); + + return detail::find_format_copy_impl( + Input, + Formatter, + Finder(::autoboost::begin(Input), ::autoboost::end(Input))); + } + + //! Generic replace algorithm + /*! + Use the Finder to search for a substring. Use the Formatter to format + this substring and replace it in the input. The input is modified in-place. + + \param Input An input sequence + \param Finder A Finder object used to search for a match to be replaced + \param Formatter A Formatter object used to format a match + */ + template< + typename SequenceT, + typename FinderT, + typename FormatterT> + inline void find_format( + SequenceT& Input, + FinderT Finder, + FormatterT Formatter) + { + // Concept check + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( + FormatterConcept< + FormatterT, + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); + + detail::find_format_impl( + Input, + Formatter, + Finder(::autoboost::begin(Input), ::autoboost::end(Input))); + } + + +// find_format_all generic ----------------------------------------------------------------// + + //! Generic replace all algorithm + /*! + Use the Finder to search for a substring. Use the Formatter to format + this substring and replace it in the input. Repeat this for all matching + substrings. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input sequence + \param Finder A Finder object used to search for a match to be replaced + \param Formatter A Formatter object used to format a match + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename RangeT, + typename FinderT, + typename FormatterT> + inline OutputIteratorT find_format_all_copy( + OutputIteratorT Output, + const RangeT& Input, + FinderT Finder, + FormatterT Formatter) + { + // Concept check + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( + FormatterConcept< + FormatterT, + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); + + iterator_range::type> lit_input(::autoboost::as_literal(Input)); + + return detail::find_format_all_copy_impl( + Output, + lit_input, + Finder, + Formatter, + Finder(::autoboost::begin(lit_input), ::autoboost::end(lit_input))); + } + + //! Generic replace all algorithm + /*! + \overload + */ + template< + typename SequenceT, + typename FinderT, + typename FormatterT > + inline SequenceT find_format_all_copy( + const SequenceT& Input, + FinderT Finder, + FormatterT Formatter ) + { + // Concept check + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( + FormatterConcept< + FormatterT, + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); + + return detail::find_format_all_copy_impl( + Input, + Finder, + Formatter, + Finder( ::autoboost::begin(Input), ::autoboost::end(Input) ) ); + } + + //! Generic replace all algorithm + /*! + Use the Finder to search for a substring. Use the Formatter to format + this substring and replace it in the input. Repeat this for all matching + substrings.The input is modified in-place. + + \param Input An input sequence + \param Finder A Finder object used to search for a match to be replaced + \param Formatter A Formatter object used to format a match + */ + template< + typename SequenceT, + typename FinderT, + typename FormatterT > + inline void find_format_all( + SequenceT& Input, + FinderT Finder, + FormatterT Formatter ) + { + // Concept check + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_const_iterator::type> + )); + BOOST_CONCEPT_ASSERT(( + FormatterConcept< + FormatterT, + FinderT,BOOST_STRING_TYPENAME range_const_iterator::type> + )); + + detail::find_format_all_impl( + Input, + Finder, + Formatter, + Finder(::autoboost::begin(Input), ::autoboost::end(Input))); + + } + + } // namespace algorithm + + // pull the names to the boost namespace + using algorithm::find_format_copy; + using algorithm::find_format; + using algorithm::find_format_all_copy; + using algorithm::find_format_all; + +} // namespace autoboost + + +#endif // BOOST_STRING_FIND_FORMAT_HPP diff --git a/contrib/autoboost/boost/algorithm/string/find_iterator.hpp b/contrib/autoboost/boost/algorithm/string/find_iterator.hpp new file mode 100644 index 000000000..1d516b4f1 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/find_iterator.hpp @@ -0,0 +1,383 @@ +// Boost string_algo library find_iterator.hpp header file ---------------------------// + +// Copyright Pavol Droba 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) + +// See http://www.boost.org/ for updates, documentation, and revision history. + +#ifndef BOOST_STRING_FIND_ITERATOR_HPP +#define BOOST_STRING_FIND_ITERATOR_HPP + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +/*! \file + Defines find iterator classes. Find iterator repeatedly applies a Finder + to the specified input string to search for matches. Dereferencing + the iterator yields the current match or a range between the last and the current + match depending on the iterator used. +*/ + +namespace autoboost { + namespace algorithm { + +// find_iterator -----------------------------------------------// + + //! find_iterator + /*! + Find iterator encapsulates a Finder and allows + for incremental searching in a string. + Each increment moves the iterator to the next match. + + Find iterator is a readable forward traversal iterator. + + Dereferencing the iterator yields an iterator_range delimiting + the current match. + */ + template + class find_iterator : + public iterator_facade< + find_iterator, + const iterator_range, + forward_traversal_tag >, + private detail::find_iterator_base + { + private: + // facade support + friend class ::autoboost::iterator_core_access; + + private: + // typedefs + + typedef detail::find_iterator_base base_type; + typedef BOOST_STRING_TYPENAME + base_type::input_iterator_type input_iterator_type; + typedef BOOST_STRING_TYPENAME + base_type::match_type match_type; + + public: + //! Default constructor + /*! + Construct null iterator. All null iterators are equal. + + \post eof()==true + */ + find_iterator() {} + + //! Copy constructor + /*! + Construct a copy of the find_iterator + */ + find_iterator( const find_iterator& Other ) : + base_type(Other), + m_Match(Other.m_Match), + m_End(Other.m_End) {} + + //! Constructor + /*! + Construct new find_iterator for a given finder + and a range. + */ + template + find_iterator( + IteratorT Begin, + IteratorT End, + FinderT Finder ) : + detail::find_iterator_base(Finder,0), + m_Match(Begin,Begin), + m_End(End) + { + increment(); + } + + //! Constructor + /*! + Construct new find_iterator for a given finder + and a range. + */ + template + find_iterator( + RangeT& Col, + FinderT Finder ) : + detail::find_iterator_base(Finder,0) + { + iterator_range::type> lit_col(::autoboost::as_literal(Col)); + m_Match=::autoboost::make_iterator_range(::autoboost::begin(lit_col), ::autoboost::begin(lit_col)); + m_End=::autoboost::end(lit_col); + + increment(); + } + + private: + // iterator operations + + // dereference + const match_type& dereference() const + { + return m_Match; + } + + // increment + void increment() + { + m_Match=this->do_find(m_Match.end(),m_End); + } + + // comparison + bool equal( const find_iterator& Other ) const + { + bool bEof=eof(); + bool bOtherEof=Other.eof(); + + return bEof || bOtherEof ? bEof==bOtherEof : + ( + m_Match==Other.m_Match && + m_End==Other.m_End + ); + } + + public: + // operations + + //! Eof check + /*! + Check the eof condition. Eof condition means that + there is nothing more to be searched i.e. find_iterator + is after the last match. + */ + bool eof() const + { + return + this->is_null() || + ( + m_Match.begin() == m_End && + m_Match.end() == m_End + ); + } + + private: + // Attributes + match_type m_Match; + input_iterator_type m_End; + }; + + //! find iterator construction helper + /*! + * Construct a find iterator to iterate through the specified string + */ + template + inline find_iterator< + BOOST_STRING_TYPENAME range_iterator::type> + make_find_iterator( + RangeT& Collection, + FinderT Finder) + { + return find_iterator::type>( + Collection, Finder); + } + +// split iterator -----------------------------------------------// + + //! split_iterator + /*! + Split iterator encapsulates a Finder and allows + for incremental searching in a string. + Unlike the find iterator, split iterator iterates + through gaps between matches. + + Find iterator is a readable forward traversal iterator. + + Dereferencing the iterator yields an iterator_range delimiting + the current match. + */ + template + class split_iterator : + public iterator_facade< + split_iterator, + const iterator_range, + forward_traversal_tag >, + private detail::find_iterator_base + { + private: + // facade support + friend class ::autoboost::iterator_core_access; + + private: + // typedefs + + typedef detail::find_iterator_base base_type; + typedef BOOST_STRING_TYPENAME + base_type::input_iterator_type input_iterator_type; + typedef BOOST_STRING_TYPENAME + base_type::match_type match_type; + + public: + //! Default constructor + /*! + Construct null iterator. All null iterators are equal. + + \post eof()==true + */ + split_iterator() { m_bEof = true; } + //! Copy constructor + /*! + Construct a copy of the split_iterator + */ + split_iterator( const split_iterator& Other ) : + base_type(Other), + m_Match(Other.m_Match), + m_Next(Other.m_Next), + m_End(Other.m_End), + m_bEof(Other.m_bEof) + {} + + //! Constructor + /*! + Construct new split_iterator for a given finder + and a range. + */ + template + split_iterator( + IteratorT Begin, + IteratorT End, + FinderT Finder ) : + detail::find_iterator_base(Finder,0), + m_Match(Begin,Begin), + m_Next(Begin), + m_End(End), + m_bEof(false) + { + // force the correct behavior for empty sequences and yield at least one token + if(Begin!=End) + { + increment(); + } + } + //! Constructor + /*! + Construct new split_iterator for a given finder + and a collection. + */ + template + split_iterator( + RangeT& Col, + FinderT Finder ) : + detail::find_iterator_base(Finder,0), + m_bEof(false) + { + iterator_range::type> lit_col(::autoboost::as_literal(Col)); + m_Match=make_iterator_range(::autoboost::begin(lit_col), ::autoboost::begin(lit_col)); + m_Next=::autoboost::begin(lit_col); + m_End=::autoboost::end(lit_col); + + // force the correct behavior for empty sequences and yield at least one token + if(m_Next!=m_End) + { + increment(); + } + } + + + private: + // iterator operations + + // dereference + const match_type& dereference() const + { + return m_Match; + } + + // increment + void increment() + { + match_type FindMatch=this->do_find( m_Next, m_End ); + + if(FindMatch.begin()==m_End && FindMatch.end()==m_End) + { + if(m_Match.end()==m_End) + { + // Mark iterator as eof + m_bEof=true; + } + } + + m_Match=match_type( m_Next, FindMatch.begin() ); + m_Next=FindMatch.end(); + } + + // comparison + bool equal( const split_iterator& Other ) const + { + bool bEof=eof(); + bool bOtherEof=Other.eof(); + + return bEof || bOtherEof ? bEof==bOtherEof : + ( + m_Match==Other.m_Match && + m_Next==Other.m_Next && + m_End==Other.m_End + ); + } + + public: + // operations + + //! Eof check + /*! + Check the eof condition. Eof condition means that + there is nothing more to be searched i.e. find_iterator + is after the last match. + */ + bool eof() const + { + return this->is_null() || m_bEof; + } + + private: + // Attributes + match_type m_Match; + input_iterator_type m_Next; + input_iterator_type m_End; + bool m_bEof; + }; + + //! split iterator construction helper + /*! + * Construct a split iterator to iterate through the specified collection + */ + template + inline split_iterator< + BOOST_STRING_TYPENAME range_iterator::type> + make_split_iterator( + RangeT& Collection, + FinderT Finder) + { + return split_iterator::type>( + Collection, Finder); + } + + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::find_iterator; + using algorithm::make_find_iterator; + using algorithm::split_iterator; + using algorithm::make_split_iterator; + +} // namespace autoboost + + +#endif // BOOST_STRING_FIND_ITERATOR_HPP diff --git a/contrib/autoboost/boost/algorithm/string/finder.hpp b/contrib/autoboost/boost/algorithm/string/finder.hpp new file mode 100644 index 000000000..2dd3992f8 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/finder.hpp @@ -0,0 +1,270 @@ +// Boost string_algo library finder.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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/ for updates, documentation, and revision history. + +#ifndef BOOST_STRING_FINDER_HPP +#define BOOST_STRING_FINDER_HPP + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +/*! \file + Defines Finder generators. Finder object is a functor which is able to + find a substring matching a specific criteria in the input. + Finders are used as a pluggable components for replace, find + and split facilities. This header contains generator functions + for finders provided in this library. +*/ + +namespace autoboost { + namespace algorithm { + +// Finder generators ------------------------------------------// + + //! "First" finder + /*! + Construct the \c first_finder. The finder searches for the first + occurrence of the string in a given input. + The result is given as an \c iterator_range delimiting the match. + + \param Search A substring to be searched for. + \param Comp An element comparison predicate + \return An instance of the \c first_finder object + */ + template + inline detail::first_finderF< + BOOST_STRING_TYPENAME range_const_iterator::type, + is_equal> + first_finder( const RangeT& Search ) + { + return + detail::first_finderF< + BOOST_STRING_TYPENAME + range_const_iterator::type, + is_equal>( ::autoboost::as_literal(Search), is_equal() ) ; + } + + //! "First" finder + /*! + \overload + */ + template + inline detail::first_finderF< + BOOST_STRING_TYPENAME range_const_iterator::type, + PredicateT> + first_finder( + const RangeT& Search, PredicateT Comp ) + { + return + detail::first_finderF< + BOOST_STRING_TYPENAME + range_const_iterator::type, + PredicateT>( ::autoboost::as_literal(Search), Comp ); + } + + //! "Last" finder + /*! + Construct the \c last_finder. The finder searches for the last + occurrence of the string in a given input. + The result is given as an \c iterator_range delimiting the match. + + \param Search A substring to be searched for. + \param Comp An element comparison predicate + \return An instance of the \c last_finder object + */ + template + inline detail::last_finderF< + BOOST_STRING_TYPENAME range_const_iterator::type, + is_equal> + last_finder( const RangeT& Search ) + { + return + detail::last_finderF< + BOOST_STRING_TYPENAME + range_const_iterator::type, + is_equal>( ::autoboost::as_literal(Search), is_equal() ); + } + //! "Last" finder + /*! + \overload + */ + template + inline detail::last_finderF< + BOOST_STRING_TYPENAME range_const_iterator::type, + PredicateT> + last_finder( const RangeT& Search, PredicateT Comp ) + { + return + detail::last_finderF< + BOOST_STRING_TYPENAME + range_const_iterator::type, + PredicateT>( ::autoboost::as_literal(Search), Comp ) ; + } + + //! "Nth" finder + /*! + Construct the \c nth_finder. The finder searches for the n-th (zero-indexed) + occurrence of the string in a given input. + The result is given as an \c iterator_range delimiting the match. + + \param Search A substring to be searched for. + \param Nth An index of the match to be find + \param Comp An element comparison predicate + \return An instance of the \c nth_finder object + */ + template + inline detail::nth_finderF< + BOOST_STRING_TYPENAME range_const_iterator::type, + is_equal> + nth_finder( + const RangeT& Search, + int Nth) + { + return + detail::nth_finderF< + BOOST_STRING_TYPENAME + range_const_iterator::type, + is_equal>( ::autoboost::as_literal(Search), Nth, is_equal() ) ; + } + //! "Nth" finder + /*! + \overload + */ + template + inline detail::nth_finderF< + BOOST_STRING_TYPENAME range_const_iterator::type, + PredicateT> + nth_finder( + const RangeT& Search, + int Nth, + PredicateT Comp ) + { + return + detail::nth_finderF< + BOOST_STRING_TYPENAME + range_const_iterator::type, + PredicateT>( ::autoboost::as_literal(Search), Nth, Comp ); + } + + //! "Head" finder + /*! + Construct the \c head_finder. The finder returns a head of a given + input. The head is a prefix of a string up to n elements in + size. If an input has less then n elements, whole input is + considered a head. + The result is given as an \c iterator_range delimiting the match. + + \param N The size of the head + \return An instance of the \c head_finder object + */ + inline detail::head_finderF + head_finder( int N ) + { + return detail::head_finderF(N); + } + + //! "Tail" finder + /*! + Construct the \c tail_finder. The finder returns a tail of a given + input. The tail is a suffix of a string up to n elements in + size. If an input has less then n elements, whole input is + considered a head. + The result is given as an \c iterator_range delimiting the match. + + \param N The size of the head + \return An instance of the \c tail_finder object + */ + inline detail::tail_finderF + tail_finder( int N ) + { + return detail::tail_finderF(N); + } + + //! "Token" finder + /*! + Construct the \c token_finder. The finder searches for a token + specified by a predicate. It is similar to std::find_if + algorithm, with an exception that it return a range of + instead of a single iterator. + + If "compress token mode" is enabled, adjacent matching tokens are + concatenated into one match. Thus the finder can be used to + search for continuous segments of characters satisfying the + given predicate. + + The result is given as an \c iterator_range delimiting the match. + + \param Pred An element selection predicate + \param eCompress Compress flag + \return An instance of the \c token_finder object + */ + template< typename PredicateT > + inline detail::token_finderF + token_finder( + PredicateT Pred, + token_compress_mode_type eCompress=token_compress_off ) + { + return detail::token_finderF( Pred, eCompress ); + } + + //! "Range" finder + /*! + Construct the \c range_finder. The finder does not perform + any operation. It simply returns the given range for + any input. + + \param Begin Beginning of the range + \param End End of the range + \param Range The range. + \return An instance of the \c range_finger object + */ + template< typename ForwardIteratorT > + inline detail::range_finderF + range_finder( + ForwardIteratorT Begin, + ForwardIteratorT End ) + { + return detail::range_finderF( Begin, End ); + } + + //! "Range" finder + /*! + \overload + */ + template< typename ForwardIteratorT > + inline detail::range_finderF + range_finder( iterator_range Range ) + { + return detail::range_finderF( Range ); + } + + } // namespace algorithm + + // pull the names to the boost namespace + using algorithm::first_finder; + using algorithm::last_finder; + using algorithm::nth_finder; + using algorithm::head_finder; + using algorithm::tail_finder; + using algorithm::token_finder; + using algorithm::range_finder; + +} // namespace autoboost + + +#endif // BOOST_STRING_FINDER_HPP diff --git a/contrib/autoboost/boost/algorithm/string/formatter.hpp b/contrib/autoboost/boost/algorithm/string/formatter.hpp new file mode 100644 index 000000000..04850fdc4 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/formatter.hpp @@ -0,0 +1,120 @@ +// Boost string_algo library formatter.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_FORMATTER_HPP +#define BOOST_STRING_FORMATTER_HPP + +#include +#include +#include +#include + +#include + +/*! \file + Defines Formatter generators. Formatter is a functor which formats + a string according to given parameters. A Formatter works + in conjunction with a Finder. A Finder can provide additional information + for a specific Formatter. An example of such a cooperation is regex_finder + and regex_formatter. + + Formatters are used as pluggable components for replace facilities. + This header contains generator functions for the Formatters provided in this library. +*/ + +namespace autoboost { + namespace algorithm { + +// generic formatters ---------------------------------------------------------------// + + //! Constant formatter + /*! + Constructs a \c const_formatter. Const formatter always returns + the same value, regardless of the parameter. + + \param Format A predefined value used as a result for formatting + \return An instance of the \c const_formatter object. + */ + template + inline detail::const_formatF< + iterator_range< + BOOST_STRING_TYPENAME range_const_iterator::type> > + const_formatter(const RangeT& Format) + { + return detail::const_formatF< + iterator_range< + BOOST_STRING_TYPENAME range_const_iterator::type> >(::autoboost::as_literal(Format)); + } + + //! Identity formatter + /*! + Constructs an \c identity_formatter. Identity formatter always returns + the parameter. + + \return An instance of the \c identity_formatter object. + */ + template + inline detail::identity_formatF< + iterator_range< + BOOST_STRING_TYPENAME range_const_iterator::type> > + identity_formatter() + { + return detail::identity_formatF< + iterator_range< + BOOST_STRING_TYPENAME range_const_iterator::type> >(); + } + + //! Empty formatter + /*! + Constructs an \c empty_formatter. Empty formatter always returns an empty + sequence. + + \param Input container used to select a correct value_type for the + resulting empty_container<>. + \return An instance of the \c empty_formatter object. + */ + template + inline detail::empty_formatF< + BOOST_STRING_TYPENAME range_value::type> + empty_formatter(const RangeT&) + { + return detail::empty_formatF< + BOOST_STRING_TYPENAME range_value::type>(); + } + + //! Empty formatter + /*! + Constructs a \c dissect_formatter. Dissect formatter uses a specified finder + to extract a portion of the formatted sequence. The first finder's match is returned + as a result + + \param Finder a finder used to select a portion of the formatted sequence + \return An instance of the \c dissect_formatter object. + */ + template + inline detail::dissect_formatF< FinderT > + dissect_formatter(const FinderT& Finder) + { + return detail::dissect_formatF(Finder); + } + + + } // namespace algorithm + + // pull the names to the boost namespace + using algorithm::const_formatter; + using algorithm::identity_formatter; + using algorithm::empty_formatter; + using algorithm::dissect_formatter; + +} // namespace autoboost + + +#endif // BOOST_FORMATTER_HPP diff --git a/contrib/autoboost/boost/algorithm/string/iter_find.hpp b/contrib/autoboost/boost/algorithm/string/iter_find.hpp new file mode 100644 index 000000000..b2685d4a4 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/iter_find.hpp @@ -0,0 +1,193 @@ +// Boost string_algo library iter_find.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_ITER_FIND_HPP +#define BOOST_STRING_ITER_FIND_HPP + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/*! \file + Defines generic split algorithms. Split algorithms can be + used to divide a sequence into several part according + to a given criteria. Result is given as a 'container + of containers' where elements are copies or references + to extracted parts. + + There are two algorithms provided. One iterates over matching + substrings, the other one over the gaps between these matches. +*/ + +namespace autoboost { + namespace algorithm { + +// iterate find ---------------------------------------------------// + + //! Iter find algorithm + /*! + This algorithm executes a given finder in iteration on the input, + until the end of input is reached, or no match is found. + Iteration is done using built-in find_iterator, so the real + searching is performed only when needed. + In each iteration new match is found and added to the result. + + \param Result A 'container container' to contain the result of search. + Both outer and inner container must have constructor taking a pair + of iterators as an argument. + Typical type of the result is + \c std::vector> + (each element of such a vector will container a range delimiting + a match). + \param Input A container which will be searched. + \param Finder A Finder object used for searching + \return A reference to the result + + \note Prior content of the result will be overwritten. + */ + template< + typename SequenceSequenceT, + typename RangeT, + typename FinderT > + inline SequenceSequenceT& + iter_find( + SequenceSequenceT& Result, + RangeT& Input, + FinderT Finder ) + { + BOOST_CONCEPT_ASSERT(( + FinderConcept< + FinderT, + BOOST_STRING_TYPENAME range_iterator::type> + )); + + iterator_range::type> lit_input(::autoboost::as_literal(Input)); + + typedef BOOST_STRING_TYPENAME + range_iterator::type input_iterator_type; + typedef find_iterator find_iterator_type; + typedef detail::copy_iterator_rangeF< + BOOST_STRING_TYPENAME + range_value::type, + input_iterator_type> copy_range_type; + + input_iterator_type InputEnd=::autoboost::end(lit_input); + + typedef transform_iterator + transform_iter_type; + + transform_iter_type itBegin= + ::autoboost::make_transform_iterator( + find_iterator_type( ::autoboost::begin(lit_input), InputEnd, Finder ), + copy_range_type()); + + transform_iter_type itEnd= + ::autoboost::make_transform_iterator( + find_iterator_type(), + copy_range_type()); + + SequenceSequenceT Tmp(itBegin, itEnd); + + Result.swap(Tmp); + return Result; + } + +// iterate split ---------------------------------------------------// + + //! Split find algorithm + /*! + This algorithm executes a given finder in iteration on the input, + until the end of input is reached, or no match is found. + Iteration is done using built-in find_iterator, so the real + searching is performed only when needed. + Each match is used as a separator of segments. These segments are then + returned in the result. + + \param Result A 'container container' to contain the result of search. + Both outer and inner container must have constructor taking a pair + of iterators as an argument. + Typical type of the result is + \c std::vector> + (each element of such a vector will container a range delimiting + a match). + \param Input A container which will be searched. + \param Finder A finder object used for searching + \return A reference to the result + + \note Prior content of the result will be overwritten. + */ + template< + typename SequenceSequenceT, + typename RangeT, + typename FinderT > + inline SequenceSequenceT& + iter_split( + SequenceSequenceT& Result, + RangeT& Input, + FinderT Finder ) + { + BOOST_CONCEPT_ASSERT(( + FinderConcept::type> + )); + + iterator_range::type> lit_input(::autoboost::as_literal(Input)); + + typedef BOOST_STRING_TYPENAME + range_iterator::type input_iterator_type; + typedef split_iterator find_iterator_type; + typedef detail::copy_iterator_rangeF< + BOOST_STRING_TYPENAME + range_value::type, + input_iterator_type> copy_range_type; + + input_iterator_type InputEnd=::autoboost::end(lit_input); + + typedef transform_iterator + transform_iter_type; + + transform_iter_type itBegin= + ::autoboost::make_transform_iterator( + find_iterator_type( ::autoboost::begin(lit_input), InputEnd, Finder ), + copy_range_type() ); + + transform_iter_type itEnd= + ::autoboost::make_transform_iterator( + find_iterator_type(), + copy_range_type() ); + + SequenceSequenceT Tmp(itBegin, itEnd); + + Result.swap(Tmp); + return Result; + } + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::iter_find; + using algorithm::iter_split; + +} // namespace autoboost + + +#endif // BOOST_STRING_ITER_FIND_HPP diff --git a/contrib/autoboost/boost/algorithm/string/predicate_facade.hpp b/contrib/autoboost/boost/algorithm/string/predicate_facade.hpp new file mode 100644 index 000000000..7adfcf299 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/predicate_facade.hpp @@ -0,0 +1,42 @@ +// Boost string_algo library predicate_facade.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_PREDICATE_FACADE_HPP +#define BOOST_STRING_PREDICATE_FACADE_HPP + +#include + +/* + \file boost/algorith/string/predicate_facade.hpp + This file contains predicate_facade definition. This template class is used + to identify classification predicates, so they can be combined using + composition operators. +*/ + +namespace autoboost { + namespace algorithm { + +// predicate facade ------------------------------------------------------// + + //! Predicate facade + /*! + This class allows to recognize classification + predicates, so that they can be combined using + composition operators. + Every classification predicate must be derived from this class. + */ + template + struct predicate_facade {}; + + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_CLASSIFICATION_DETAIL_HPP diff --git a/contrib/autoboost/boost/algorithm/string/replace.hpp b/contrib/autoboost/boost/algorithm/string/replace.hpp new file mode 100644 index 000000000..5fb174a97 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/replace.hpp @@ -0,0 +1,928 @@ +// Boost string_algo library replace.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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/ for updates, documentation, and revision history. + +#ifndef BOOST_STRING_REPLACE_HPP +#define BOOST_STRING_REPLACE_HPP + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/*! \file + Defines various replace algorithms. Each algorithm replaces + part(s) of the input according to set of searching and replace criteria. +*/ + +namespace autoboost { + namespace algorithm { + +// replace_range --------------------------------------------------------------------// + + //! Replace range algorithm + /*! + Replace the given range in the input string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param SearchRange A range in the input to be substituted + \param Format A substitute string + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT replace_range_copy( + OutputIteratorT Output, + const Range1T& Input, + const iterator_range< + BOOST_STRING_TYPENAME + range_const_iterator::type>& SearchRange, + const Range2T& Format) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::range_finder(SearchRange), + ::autoboost::algorithm::const_formatter(Format)); + } + + //! Replace range algorithm + /*! + \overload + */ + template + inline SequenceT replace_range_copy( + const SequenceT& Input, + const iterator_range< + BOOST_STRING_TYPENAME + range_const_iterator::type>& SearchRange, + const RangeT& Format) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::range_finder(SearchRange), + ::autoboost::algorithm::const_formatter(Format)); + } + + //! Replace range algorithm + /*! + Replace the given range in the input string. + The input sequence is modified in-place. + + \param Input An input string + \param SearchRange A range in the input to be substituted + \param Format A substitute string + */ + template + inline void replace_range( + SequenceT& Input, + const iterator_range< + BOOST_STRING_TYPENAME + range_iterator::type>& SearchRange, + const RangeT& Format) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::range_finder(SearchRange), + ::autoboost::algorithm::const_formatter(Format)); + } + +// replace_first --------------------------------------------------------------------// + + //! Replace first algorithm + /*! + Replace the first match of the search substring in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT replace_first_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const Range3T& Format) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace first algorithm + /*! + \overload + */ + template + inline SequenceT replace_first_copy( + const SequenceT& Input, + const Range1T& Search, + const Range2T& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace first algorithm + /*! + replace the first match of the search substring in the input + with the format string. The input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + */ + template + inline void replace_first( + SequenceT& Input, + const Range1T& Search, + const Range2T& Format ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_first ( case insensitive ) ---------------------------------------------// + + //! Replace first algorithm ( case insensitive ) + /*! + Replace the first match of the search substring in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT ireplace_first_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const Range3T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace first algorithm ( case insensitive ) + /*! + \overload + */ + template + inline SequenceT ireplace_first_copy( + const SequenceT& Input, + const Range2T& Search, + const Range1T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace first algorithm ( case insensitive ) + /*! + Replace the first match of the search substring in the input + with the format string. Input sequence is modified in-place. + Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + */ + template + inline void ireplace_first( + SequenceT& Input, + const Range1T& Search, + const Range2T& Format, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_last --------------------------------------------------------------------// + + //! Replace last algorithm + /*! + Replace the last match of the search string in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT replace_last_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const Range3T& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::last_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace last algorithm + /*! + \overload + */ + template + inline SequenceT replace_last_copy( + const SequenceT& Input, + const Range1T& Search, + const Range2T& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::last_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace last algorithm + /*! + Replace the last match of the search string in the input + with the format string. Input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + */ + template + inline void replace_last( + SequenceT& Input, + const Range1T& Search, + const Range2T& Format ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::last_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_last ( case insensitive ) -----------------------------------------------// + + //! Replace last algorithm ( case insensitive ) + /*! + Replace the last match of the search string in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT ireplace_last_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const Range3T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::last_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace last algorithm ( case insensitive ) + /*! + \overload + */ + template + inline SequenceT ireplace_last_copy( + const SequenceT& Input, + const Range1T& Search, + const Range2T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::last_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace last algorithm ( case insensitive ) + /*! + Replace the last match of the search string in the input + with the format string.The input sequence is modified in-place. + Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + \return A reference to the modified input + */ + template + inline void ireplace_last( + SequenceT& Input, + const Range1T& Search, + const Range2T& Format, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::last_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_nth --------------------------------------------------------------------// + + //! Replace nth algorithm + /*! + Replace an Nth (zero-indexed) match of the search string in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + \param Format A substitute string + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT replace_nth_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + int Nth, + const Range3T& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::nth_finder(Search, Nth), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace nth algorithm + /*! + \overload + */ + template + inline SequenceT replace_nth_copy( + const SequenceT& Input, + const Range1T& Search, + int Nth, + const Range2T& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace nth algorithm + /*! + Replace an Nth (zero-indexed) match of the search string in the input + with the format string. Input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + \param Format A substitute string + */ + template + inline void replace_nth( + SequenceT& Input, + const Range1T& Search, + int Nth, + const Range2T& Format ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_nth ( case insensitive ) -----------------------------------------------// + + //! Replace nth algorithm ( case insensitive ) + /*! + Replace an Nth (zero-indexed) match of the search string in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT ireplace_nth_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + int Nth, + const Range3T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc) ), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace nth algorithm ( case insensitive ) + /*! + \overload + */ + template + inline SequenceT ireplace_nth_copy( + const SequenceT& Input, + const Range1T& Search, + int Nth, + const Range2T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace nth algorithm ( case insensitive ) + /*! + Replace an Nth (zero-indexed) match of the search string in the input + with the format string. Input sequence is modified in-place. + Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for + \param Nth An index of the match to be replaced. The index is 0-based. + For negative N, matches are counted from the end of string. + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + */ + template + inline void ireplace_nth( + SequenceT& Input, + const Range1T& Search, + int Nth, + const Range2T& Format, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_all --------------------------------------------------------------------// + + //! Replace all algorithm + /*! + Replace all occurrences of the search string in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT replace_all_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const Range3T& Format ) + { + return ::autoboost::algorithm::find_format_all_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace all algorithm + /*! + \overload + */ + template + inline SequenceT replace_all_copy( + const SequenceT& Input, + const Range1T& Search, + const Range2T& Format ) + { + return ::autoboost::algorithm::find_format_all_copy( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace all algorithm + /*! + Replace all occurrences of the search string in the input + with the format string. The input sequence is modified in-place. + + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \return A reference to the modified input + */ + template + inline void replace_all( + SequenceT& Input, + const Range1T& Search, + const Range2T& Format ) + { + ::autoboost::algorithm::find_format_all( + Input, + ::autoboost::algorithm::first_finder(Search), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_all ( case insensitive ) -----------------------------------------------// + + //! Replace all algorithm ( case insensitive ) + /*! + Replace all occurrences of the search string in the input + with the format string. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + Searching is case insensitive. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T, + typename Range3T> + inline OutputIteratorT ireplace_all_copy( + OutputIteratorT Output, + const Range1T& Input, + const Range2T& Search, + const Range3T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_all_copy( + Output, + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace all algorithm ( case insensitive ) + /*! + \overload + */ + template + inline SequenceT ireplace_all_copy( + const SequenceT& Input, + const Range1T& Search, + const Range2T& Format, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::find_format_all_copy( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace all algorithm ( case insensitive ) + /*! + Replace all occurrences of the search string in the input + with the format string.The input sequence is modified in-place. + Searching is case insensitive. + + \param Input An input string + \param Search A substring to be searched for + \param Format A substitute string + \param Loc A locale used for case insensitive comparison + */ + template + inline void ireplace_all( + SequenceT& Input, + const Range1T& Search, + const Range2T& Format, + const std::locale& Loc=std::locale() ) + { + ::autoboost::algorithm::find_format_all( + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc)), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_head --------------------------------------------------------------------// + + //! Replace head algorithm + /*! + Replace the head of the input with the given format string. + The head is a prefix of a string of given size. + If the sequence is shorter then required, whole string if + considered to be the head. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param N Length of the head. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + \param Format A substitute string + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT replace_head_copy( + OutputIteratorT Output, + const Range1T& Input, + int N, + const Range2T& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::head_finder(N), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace head algorithm + /*! + \overload + */ + template + inline SequenceT replace_head_copy( + const SequenceT& Input, + int N, + const RangeT& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::head_finder(N), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace head algorithm + /*! + Replace the head of the input with the given format string. + The head is a prefix of a string of given size. + If the sequence is shorter then required, the whole string is + considered to be the head. The input sequence is modified in-place. + + \param Input An input string + \param N Length of the head. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + \param Format A substitute string + */ + template + inline void replace_head( + SequenceT& Input, + int N, + const RangeT& Format ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::head_finder(N), + ::autoboost::algorithm::const_formatter(Format) ); + } + +// replace_tail --------------------------------------------------------------------// + + //! Replace tail algorithm + /*! + Replace the tail of the input with the given format string. + The tail is a suffix of a string of given size. + If the sequence is shorter then required, whole string is + considered to be the tail. + The result is a modified copy of the input. It is returned as a sequence + or copied to the output iterator. + + \param Output An output iterator to which the result will be copied + \param Input An input string + \param N Length of the tail. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + \param Format A substitute string + \return An output iterator pointing just after the last inserted character or + a modified copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template< + typename OutputIteratorT, + typename Range1T, + typename Range2T> + inline OutputIteratorT replace_tail_copy( + OutputIteratorT Output, + const Range1T& Input, + int N, + const Range2T& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Output, + Input, + ::autoboost::algorithm::tail_finder(N), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace tail algorithm + /*! + \overload + */ + template + inline SequenceT replace_tail_copy( + const SequenceT& Input, + int N, + const RangeT& Format ) + { + return ::autoboost::algorithm::find_format_copy( + Input, + ::autoboost::algorithm::tail_finder(N), + ::autoboost::algorithm::const_formatter(Format) ); + } + + //! Replace tail algorithm + /*! + Replace the tail of the input with the given format sequence. + The tail is a suffix of a string of given size. + If the sequence is shorter then required, the whole string is + considered to be the tail. The input sequence is modified in-place. + + \param Input An input string + \param N Length of the tail. + For N>=0, at most N characters are extracted. + For N<0, size(Input)-|N| characters are extracted. + \param Format A substitute string + */ + template + inline void replace_tail( + SequenceT& Input, + int N, + const RangeT& Format ) + { + ::autoboost::algorithm::find_format( + Input, + ::autoboost::algorithm::tail_finder(N), + ::autoboost::algorithm::const_formatter(Format) ); + } + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::replace_range_copy; + using algorithm::replace_range; + using algorithm::replace_first_copy; + using algorithm::replace_first; + using algorithm::ireplace_first_copy; + using algorithm::ireplace_first; + using algorithm::replace_last_copy; + using algorithm::replace_last; + using algorithm::ireplace_last_copy; + using algorithm::ireplace_last; + using algorithm::replace_nth_copy; + using algorithm::replace_nth; + using algorithm::ireplace_nth_copy; + using algorithm::ireplace_nth; + using algorithm::replace_all_copy; + using algorithm::replace_all; + using algorithm::ireplace_all_copy; + using algorithm::ireplace_all; + using algorithm::replace_head_copy; + using algorithm::replace_head; + using algorithm::replace_tail_copy; + using algorithm::replace_tail; + +} // namespace autoboost + +#endif // BOOST_REPLACE_HPP diff --git a/contrib/autoboost/boost/algorithm/string/sequence_traits.hpp b/contrib/autoboost/boost/algorithm/string/sequence_traits.hpp new file mode 100644 index 000000000..d668b1ed8 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/sequence_traits.hpp @@ -0,0 +1,120 @@ +// Boost string_algo library sequence_traits.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP +#define BOOST_STRING_SEQUENCE_TRAITS_HPP + +#include +#include +#include + +/*! \file + Traits defined in this header are used by various algorithms to achieve + better performance for specific containers. + Traits provide fail-safe defaults. If a container supports some of these + features, it is possible to specialize the specific trait for this container. + For lacking compilers, it is possible of define an override for a specific tester + function. + + Due to a language restriction, it is not currently possible to define specializations for + stl containers without including the corresponding header. To decrease the overhead + needed by this inclusion, user can selectively include a specialization + header for a specific container. They are located in boost/algorithm/string/stl + directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp + header which contains specializations for all stl containers. +*/ + +namespace autoboost { + namespace algorithm { + +// sequence traits -----------------------------------------------// + + + //! Native replace trait + /*! + This trait specifies that the sequence has \c std::string like replace method + */ + template< typename T > + class has_native_replace + { + + public: +# if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + enum { value = false }; +# else + BOOST_STATIC_CONSTANT(bool, value=false); +# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + + + typedef mpl::bool_::value> type; + }; + + + //! Stable iterators trait + /*! + This trait specifies that the sequence has stable iterators. It means + that operations like insert/erase/replace do not invalidate iterators. + */ + template< typename T > + class has_stable_iterators + { + public: +# if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + enum { value = false }; +# else + BOOST_STATIC_CONSTANT(bool, value=false); +# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + + typedef mpl::bool_::value> type; + }; + + + //! Const time insert trait + /*! + This trait specifies that the sequence's insert method has + constant time complexity. + */ + template< typename T > + class has_const_time_insert + { + public: +# if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + enum { value = false }; +# else + BOOST_STATIC_CONSTANT(bool, value=false); +# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + + typedef mpl::bool_::value> type; + }; + + + //! Const time erase trait + /*! + This trait specifies that the sequence's erase method has + constant time complexity. + */ + template< typename T > + class has_const_time_erase + { + public: +# if BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + enum { value = false }; +# else + BOOST_STATIC_CONSTANT(bool, value=false); +# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 ) + + typedef mpl::bool_::value> type; + }; + + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_SEQUENCE_TRAITS_HPP diff --git a/contrib/autoboost/boost/algorithm/string/split.hpp b/contrib/autoboost/boost/algorithm/string/split.hpp new file mode 100644 index 000000000..2256d1d4c --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/split.hpp @@ -0,0 +1,163 @@ +// Boost string_algo library split.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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/ for updates, documentation, and revision history. + +#ifndef BOOST_STRING_SPLIT_HPP +#define BOOST_STRING_SPLIT_HPP + +#include + +#include +#include +#include + +/*! \file + Defines basic split algorithms. + Split algorithms can be used to divide a string + into several parts according to given criteria. + + Each part is copied and added as a new element to the + output container. + Thus the result container must be able to hold copies + of the matches (in a compatible structure like std::string) or + a reference to it (e.g. using the iterator range class). + Examples of such a container are \c std::vector + or \c std::list> +*/ + +namespace autoboost { + namespace algorithm { + +// find_all ------------------------------------------------------------// + + //! Find all algorithm + /*! + This algorithm finds all occurrences of the search string + in the input. + + Each part is copied and added as a new element to the + output container. + Thus the result container must be able to hold copies + of the matches (in a compatible structure like std::string) or + a reference to it (e.g. using the iterator range class). + Examples of such a container are \c std::vector + or \c std::list> + + \param Result A container that can hold copies of references to the substrings + \param Input A container which will be searched. + \param Search A substring to be searched for. + \return A reference the result + + \note Prior content of the result will be overwritten. + + \note This function provides the strong exception-safety guarantee + */ + template< typename SequenceSequenceT, typename Range1T, typename Range2T > + inline SequenceSequenceT& find_all( + SequenceSequenceT& Result, + Range1T& Input, + const Range2T& Search) + { + return ::autoboost::algorithm::iter_find( + Result, + Input, + ::autoboost::algorithm::first_finder(Search) ); + } + + //! Find all algorithm ( case insensitive ) + /*! + This algorithm finds all occurrences of the search string + in the input. + Each part is copied and added as a new element to the + output container. Thus the result container must be able to hold copies + of the matches (in a compatible structure like std::string) or + a reference to it (e.g. using the iterator range class). + Examples of such a container are \c std::vector + or \c std::list> + + Searching is case insensitive. + + \param Result A container that can hold copies of references to the substrings + \param Input A container which will be searched. + \param Search A substring to be searched for. + \param Loc A locale used for case insensitive comparison + \return A reference the result + + \note Prior content of the result will be overwritten. + + \note This function provides the strong exception-safety guarantee + */ + template< typename SequenceSequenceT, typename Range1T, typename Range2T > + inline SequenceSequenceT& ifind_all( + SequenceSequenceT& Result, + Range1T& Input, + const Range2T& Search, + const std::locale& Loc=std::locale() ) + { + return ::autoboost::algorithm::iter_find( + Result, + Input, + ::autoboost::algorithm::first_finder(Search, is_iequal(Loc) ) ); + } + + +// tokenize -------------------------------------------------------------// + + //! Split algorithm + /*! + Tokenize expression. This function is equivalent to C strtok. Input + sequence is split into tokens, separated by separators. Separators + are given by means of the predicate. + + Each part is copied and added as a new element to the + output container. + Thus the result container must be able to hold copies + of the matches (in a compatible structure like std::string) or + a reference to it (e.g. using the iterator range class). + Examples of such a container are \c std::vector + or \c std::list> + + \param Result A container that can hold copies of references to the substrings + \param Input A container which will be searched. + \param Pred A predicate to identify separators. This predicate is + supposed to return true if a given element is a separator. + \param eCompress If eCompress argument is set to token_compress_on, adjacent + separators are merged together. Otherwise, every two separators + delimit a token. + \return A reference the result + + \note Prior content of the result will be overwritten. + + \note This function provides the strong exception-safety guarantee + */ + template< typename SequenceSequenceT, typename RangeT, typename PredicateT > + inline SequenceSequenceT& split( + SequenceSequenceT& Result, + RangeT& Input, + PredicateT Pred, + token_compress_mode_type eCompress=token_compress_off ) + { + return ::autoboost::algorithm::iter_split( + Result, + Input, + ::autoboost::algorithm::token_finder( Pred, eCompress ) ); + } + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::find_all; + using algorithm::ifind_all; + using algorithm::split; + +} // namespace autoboost + + +#endif // BOOST_STRING_SPLIT_HPP + diff --git a/contrib/autoboost/boost/algorithm/string/trim.hpp b/contrib/autoboost/boost/algorithm/string/trim.hpp new file mode 100644 index 000000000..998fb6acb --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/trim.hpp @@ -0,0 +1,398 @@ +// Boost string_algo library trim.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_TRIM_HPP +#define BOOST_STRING_TRIM_HPP + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +/*! \file + Defines trim algorithms. + Trim algorithms are used to remove trailing and leading spaces from a + sequence (string). Space is recognized using given locales. + + Parametric (\c _if) variants use a predicate (functor) to select which characters + are to be trimmed.. + Functions take a selection predicate as a parameter, which is used to determine + whether a character is a space. Common predicates are provided in classification.hpp header. + +*/ + +namespace autoboost { + namespace algorithm { + + // left trim -----------------------------------------------// + + + //! Left trim - parametric + /*! + Remove all leading spaces from the input. + The supplied predicate is used to determine which characters are considered spaces. + The result is a trimmed copy of the input. It is returned as a sequence + or copied to the output iterator + + \param Output An output iterator to which the result will be copied + \param Input An input range + \param IsSpace A unary predicate identifying spaces + \return + An output iterator pointing just after the last inserted character or + a copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template + inline OutputIteratorT trim_left_copy_if( + OutputIteratorT Output, + const RangeT& Input, + PredicateT IsSpace) + { + iterator_range::type> lit_range(::autoboost::as_literal(Input)); + + std::copy( + ::autoboost::algorithm::detail::trim_begin( + ::autoboost::begin(lit_range), + ::autoboost::end(lit_range), + IsSpace ), + ::autoboost::end(lit_range), + Output); + + return Output; + } + + //! Left trim - parametric + /*! + \overload + */ + template + inline SequenceT trim_left_copy_if(const SequenceT& Input, PredicateT IsSpace) + { + return SequenceT( + ::autoboost::algorithm::detail::trim_begin( + ::autoboost::begin(Input), + ::autoboost::end(Input), + IsSpace ), + ::autoboost::end(Input)); + } + + //! Left trim - parametric + /*! + Remove all leading spaces from the input. + The result is a trimmed copy of the input. + + \param Input An input sequence + \param Loc a locale used for 'space' classification + \return A trimmed copy of the input + + \note This function provides the strong exception-safety guarantee + */ + template + inline SequenceT trim_left_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) + { + return + ::autoboost::algorithm::trim_left_copy_if( + Input, + is_space(Loc)); + } + + //! Left trim + /*! + Remove all leading spaces from the input. The supplied predicate is + used to determine which characters are considered spaces. + The input sequence is modified in-place. + + \param Input An input sequence + \param IsSpace A unary predicate identifying spaces + */ + template + inline void trim_left_if(SequenceT& Input, PredicateT IsSpace) + { + Input.erase( + ::autoboost::begin(Input), + ::autoboost::algorithm::detail::trim_begin( + ::autoboost::begin(Input), + ::autoboost::end(Input), + IsSpace)); + } + + //! Left trim + /*! + Remove all leading spaces from the input. + The Input sequence is modified in-place. + + \param Input An input sequence + \param Loc A locale used for 'space' classification + */ + template + inline void trim_left(SequenceT& Input, const std::locale& Loc=std::locale()) + { + ::autoboost::algorithm::trim_left_if( + Input, + is_space(Loc)); + } + + // right trim -----------------------------------------------// + + //! Right trim - parametric + /*! + Remove all trailing spaces from the input. + The supplied predicate is used to determine which characters are considered spaces. + The result is a trimmed copy of the input. It is returned as a sequence + or copied to the output iterator + + \param Output An output iterator to which the result will be copied + \param Input An input range + \param IsSpace A unary predicate identifying spaces + \return + An output iterator pointing just after the last inserted character or + a copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template + inline OutputIteratorT trim_right_copy_if( + OutputIteratorT Output, + const RangeT& Input, + PredicateT IsSpace ) + { + iterator_range::type> lit_range(::autoboost::as_literal(Input)); + + std::copy( + ::autoboost::begin(lit_range), + ::autoboost::algorithm::detail::trim_end( + ::autoboost::begin(lit_range), + ::autoboost::end(lit_range), + IsSpace ), + Output ); + + return Output; + } + + //! Right trim - parametric + /*! + \overload + */ + template + inline SequenceT trim_right_copy_if(const SequenceT& Input, PredicateT IsSpace) + { + return SequenceT( + ::autoboost::begin(Input), + ::autoboost::algorithm::detail::trim_end( + ::autoboost::begin(Input), + ::autoboost::end(Input), + IsSpace) + ); + } + + //! Right trim + /*! + Remove all trailing spaces from the input. + The result is a trimmed copy of the input + + \param Input An input sequence + \param Loc A locale used for 'space' classification + \return A trimmed copy of the input + + \note This function provides the strong exception-safety guarantee + */ + template + inline SequenceT trim_right_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) + { + return + ::autoboost::algorithm::trim_right_copy_if( + Input, + is_space(Loc)); + } + + + //! Right trim - parametric + /*! + Remove all trailing spaces from the input. + The supplied predicate is used to determine which characters are considered spaces. + The input sequence is modified in-place. + + \param Input An input sequence + \param IsSpace A unary predicate identifying spaces + */ + template + inline void trim_right_if(SequenceT& Input, PredicateT IsSpace) + { + Input.erase( + ::autoboost::algorithm::detail::trim_end( + ::autoboost::begin(Input), + ::autoboost::end(Input), + IsSpace ), + ::autoboost::end(Input) + ); + } + + + //! Right trim + /*! + Remove all trailing spaces from the input. + The input sequence is modified in-place. + + \param Input An input sequence + \param Loc A locale used for 'space' classification + */ + template + inline void trim_right(SequenceT& Input, const std::locale& Loc=std::locale()) + { + ::autoboost::algorithm::trim_right_if( + Input, + is_space(Loc) ); + } + + // both side trim -----------------------------------------------// + + //! Trim - parametric + /*! + Remove all trailing and leading spaces from the input. + The supplied predicate is used to determine which characters are considered spaces. + The result is a trimmed copy of the input. It is returned as a sequence + or copied to the output iterator + + \param Output An output iterator to which the result will be copied + \param Input An input range + \param IsSpace A unary predicate identifying spaces + \return + An output iterator pointing just after the last inserted character or + a copy of the input + + \note The second variant of this function provides the strong exception-safety guarantee + */ + template + inline OutputIteratorT trim_copy_if( + OutputIteratorT Output, + const RangeT& Input, + PredicateT IsSpace) + { + iterator_range::type> lit_range(::autoboost::as_literal(Input)); + + BOOST_STRING_TYPENAME + range_const_iterator::type TrimEnd= + ::autoboost::algorithm::detail::trim_end( + ::autoboost::begin(lit_range), + ::autoboost::end(lit_range), + IsSpace); + + std::copy( + detail::trim_begin( + ::autoboost::begin(lit_range), TrimEnd, IsSpace), + TrimEnd, + Output + ); + + return Output; + } + + //! Trim - parametric + /*! + \overload + */ + template + inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace) + { + BOOST_STRING_TYPENAME + range_const_iterator::type TrimEnd= + ::autoboost::algorithm::detail::trim_end( + ::autoboost::begin(Input), + ::autoboost::end(Input), + IsSpace); + + return SequenceT( + detail::trim_begin( + ::autoboost::begin(Input), + TrimEnd, + IsSpace), + TrimEnd + ); + } + + //! Trim + /*! + Remove all leading and trailing spaces from the input. + The result is a trimmed copy of the input + + \param Input An input sequence + \param Loc A locale used for 'space' classification + \return A trimmed copy of the input + + \note This function provides the strong exception-safety guarantee + */ + template + inline SequenceT trim_copy( const SequenceT& Input, const std::locale& Loc=std::locale() ) + { + return + ::autoboost::algorithm::trim_copy_if( + Input, + is_space(Loc) ); + } + + //! Trim + /*! + Remove all leading and trailing spaces from the input. + The supplied predicate is used to determine which characters are considered spaces. + The input sequence is modified in-place. + + \param Input An input sequence + \param IsSpace A unary predicate identifying spaces + */ + template + inline void trim_if(SequenceT& Input, PredicateT IsSpace) + { + ::autoboost::algorithm::trim_right_if( Input, IsSpace ); + ::autoboost::algorithm::trim_left_if( Input, IsSpace ); + } + + //! Trim + /*! + Remove all leading and trailing spaces from the input. + The input sequence is modified in-place. + + \param Input An input sequence + \param Loc A locale used for 'space' classification + */ + template + inline void trim(SequenceT& Input, const std::locale& Loc=std::locale()) + { + ::autoboost::algorithm::trim_if( + Input, + is_space( Loc ) ); + } + + } // namespace algorithm + + // pull names to the boost namespace + using algorithm::trim_left; + using algorithm::trim_left_if; + using algorithm::trim_left_copy; + using algorithm::trim_left_copy_if; + using algorithm::trim_right; + using algorithm::trim_right_if; + using algorithm::trim_right_copy; + using algorithm::trim_right_copy_if; + using algorithm::trim; + using algorithm::trim_if; + using algorithm::trim_copy; + using algorithm::trim_copy_if; + +} // namespace autoboost + +#endif // BOOST_STRING_TRIM_HPP diff --git a/contrib/autoboost/boost/algorithm/string/yes_no_type.hpp b/contrib/autoboost/boost/algorithm/string/yes_no_type.hpp new file mode 100644 index 000000000..c215b4559 --- /dev/null +++ b/contrib/autoboost/boost/algorithm/string/yes_no_type.hpp @@ -0,0 +1,33 @@ +// Boost string_algo library yes_no_type.hpp header file ---------------------------// + +// Copyright Pavol Droba 2002-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 updates, documentation, and revision history. + +#ifndef BOOST_STRING_YES_NO_TYPE_DETAIL_HPP +#define BOOST_STRING_YES_NO_TYPE_DETAIL_HPP + +namespace autoboost { + namespace algorithm { + + // taken from boost mailing-list + // when yes_no_type will become officially + // a part of boost distribution, this header + // will be deprecated + template struct size_descriptor + { + typedef char (& type)[I]; + }; + + typedef size_descriptor<1>::type yes_type; + typedef size_descriptor<2>::type no_type; + + } // namespace algorithm +} // namespace autoboost + + +#endif // BOOST_STRING_YES_NO_TYPE_DETAIL_HPP diff --git a/contrib/autoboost/boost/align/align.hpp b/contrib/autoboost/boost/align/align.hpp new file mode 100644 index 000000000..1600a243c --- /dev/null +++ b/contrib/autoboost/boost/align/align.hpp @@ -0,0 +1,20 @@ +/* + (c) 2014 Glen Joseph Fernandes + glenjofe at gmail dot com + + Distributed under the Boost Software + License, Version 1.0. + http://boost.org/LICENSE_1_0.txt +*/ +#ifndef BOOST_ALIGN_ALIGN_HPP +#define BOOST_ALIGN_ALIGN_HPP + +#include + +#if !defined(BOOST_NO_CXX11_STD_ALIGN) +#include +#else +#include +#endif + +#endif diff --git a/contrib/autoboost/boost/align/detail/address.hpp b/contrib/autoboost/boost/align/detail/address.hpp new file mode 100644 index 000000000..c01cc1e6f --- /dev/null +++ b/contrib/autoboost/boost/align/detail/address.hpp @@ -0,0 +1,27 @@ +/* + (c) 2014 Glen Joseph Fernandes + glenjofe at gmail dot com + + Distributed under the Boost Software + License, Version 1.0. + http://boost.org/LICENSE_1_0.txt +*/ +#ifndef BOOST_ALIGN_DETAIL_ADDRESS_HPP +#define BOOST_ALIGN_DETAIL_ADDRESS_HPP + +#include +#include + +namespace autoboost { + namespace alignment { + namespace detail { +#if defined(BOOST_HAS_INTPTR_T) + typedef autoboost::uintptr_t address_t; +#else + typedef std::size_t address_t; +#endif + } + } +} + +#endif diff --git a/contrib/autoboost/boost/align/detail/align.hpp b/contrib/autoboost/boost/align/detail/align.hpp new file mode 100644 index 000000000..01f985456 --- /dev/null +++ b/contrib/autoboost/boost/align/detail/align.hpp @@ -0,0 +1,38 @@ +/* + (c) 2014 Glen Joseph Fernandes + glenjofe at gmail dot com + + Distributed under the Boost Software + License, Version 1.0. + http://boost.org/LICENSE_1_0.txt +*/ +#ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP +#define BOOST_ALIGN_DETAIL_ALIGN_HPP + +#include +#include +#include +#include + +namespace autoboost { + namespace alignment { + inline void* align(std::size_t alignment, std::size_t size, + void*& ptr, std::size_t& space) + { + BOOST_ASSERT(detail::is_alignment(alignment)); + std::size_t n = detail::address_t(ptr) & (alignment - 1); + if (n != 0) { + n = alignment - n; + } + void* p = 0; + if (n <= space && size <= space - n) { + p = static_cast(ptr) + n; + ptr = p; + space -= n; + } + return p; + } + } +} + +#endif diff --git a/contrib/autoboost/boost/align/detail/align_cxx11.hpp b/contrib/autoboost/boost/align/detail/align_cxx11.hpp new file mode 100644 index 000000000..f3f6c367b --- /dev/null +++ b/contrib/autoboost/boost/align/detail/align_cxx11.hpp @@ -0,0 +1,20 @@ +/* + (c) 2014 Glen Joseph Fernandes + glenjofe at gmail dot com + + Distributed under the Boost Software + License, Version 1.0. + http://boost.org/LICENSE_1_0.txt +*/ +#ifndef BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP +#define BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP + +#include + +namespace autoboost { + namespace alignment { + using std::align; + } +} + +#endif diff --git a/contrib/autoboost/boost/align/detail/is_alignment.hpp b/contrib/autoboost/boost/align/detail/is_alignment.hpp new file mode 100644 index 000000000..5c701fb58 --- /dev/null +++ b/contrib/autoboost/boost/align/detail/is_alignment.hpp @@ -0,0 +1,27 @@ +/* + (c) 2014 Glen Joseph Fernandes + glenjofe at gmail dot com + + Distributed under the Boost Software + License, Version 1.0. + http://boost.org/LICENSE_1_0.txt +*/ +#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP +#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP + +#include +#include + +namespace autoboost { + namespace alignment { + namespace detail { + BOOST_CONSTEXPR inline bool is_alignment(std::size_t + value) BOOST_NOEXCEPT + { + return (value > 0) && ((value & (value - 1)) == 0); + } + } + } +} + +#endif diff --git a/contrib/autoboost/boost/aligned_storage.hpp b/contrib/autoboost/boost/aligned_storage.hpp new file mode 100644 index 000000000..f9c236418 --- /dev/null +++ b/contrib/autoboost/boost/aligned_storage.hpp @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// boost aligned_storage.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2002-2003 +// Eric Friedman, Itay Maman +// +// Distributed under the 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_ALIGNED_STORAGE_HPP +#define BOOST_ALIGNED_STORAGE_HPP + +#include // for std::size_t + +#include "boost/config.hpp" +#include "boost/detail/workaround.hpp" +#include "boost/type_traits/alignment_of.hpp" +#include "boost/type_traits/type_with_alignment.hpp" +#include "boost/type_traits/is_pod.hpp" + +#include "boost/mpl/eval_if.hpp" +#include "boost/mpl/identity.hpp" + +#include "boost/type_traits/detail/bool_trait_def.hpp" + +namespace autoboost { + +namespace detail { namespace aligned_storage { + +BOOST_STATIC_CONSTANT( + std::size_t + , alignment_of_max_align = ::autoboost::alignment_of::value + ); + +// +// To be TR1 conforming this must be a POD type: +// +template < + std::size_t size_ + , std::size_t alignment_ +> +struct aligned_storage_imp +{ + union data_t + { + char buf[size_]; + + typename ::autoboost::mpl::eval_if_c< + alignment_ == std::size_t(-1) + , ::autoboost::mpl::identity< ::autoboost::detail::max_align > + , ::autoboost::type_with_alignment + >::type align_; + } data_; + void* address() const { return const_cast(this); } +}; + +template< std::size_t alignment_ > +struct aligned_storage_imp<0u,alignment_> +{ + /* intentionally empty */ + void* address() const { return 0; } +}; + +}} // namespace detail::aligned_storage + +template < + std::size_t size_ + , std::size_t alignment_ = std::size_t(-1) +> +class aligned_storage : +#ifndef __BORLANDC__ + private +#else + public +#endif + ::autoboost::detail::aligned_storage::aligned_storage_imp +{ + +public: // constants + + typedef ::autoboost::detail::aligned_storage::aligned_storage_imp type; + + BOOST_STATIC_CONSTANT( + std::size_t + , size = size_ + ); + BOOST_STATIC_CONSTANT( + std::size_t + , alignment = ( + alignment_ == std::size_t(-1) + ? ::autoboost::detail::aligned_storage::alignment_of_max_align + : alignment_ + ) + ); + +private: // noncopyable + + aligned_storage(const aligned_storage&); + aligned_storage& operator=(const aligned_storage&); + +public: // structors + + aligned_storage() + { + } + + ~aligned_storage() + { + } + +public: // accessors + + void* address() + { + return static_cast(this)->address(); + } + + const void* address() const + { + return static_cast(this)->address(); + } +}; + +// +// Make sure that is_pod recognises aligned_storage<>::type +// as a POD (Note that aligned_storage<> itself is not a POD): +// +template +struct is_pod< ::autoboost::detail::aligned_storage::aligned_storage_imp > + BOOST_TT_AUX_BOOL_C_BASE(true) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true) +}; + + +} // namespace autoboost + +#include "boost/type_traits/detail/bool_trait_undef.hpp" + +#endif // BOOST_ALIGNED_STORAGE_HPP diff --git a/contrib/autoboost/boost/archive/add_facet.hpp b/contrib/autoboost/boost/archive/add_facet.hpp new file mode 100644 index 000000000..f36cee890 --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include +#include + +// 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 autoboost { +namespace archive { + +template +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 autoboost + +#undef BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT + +#endif // BOOST_ARCHIVE_ADD_FACET_HPP diff --git a/contrib/autoboost/boost/archive/archive_exception.hpp b/contrib/autoboost/boost/archive/archive_exception.hpp new file mode 100644 index 000000000..7dfdcdda0 --- /dev/null +++ b/contrib/autoboost/boost/archive/archive_exception.hpp @@ -0,0 +1,99 @@ +#ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include + +#include +#include +#include + +// 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 +#endif + +#include // must be the last header + +namespace autoboost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by archives +// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception : + public virtual std::exception +{ +protected: + char m_buffer[128]; +public: + typedef enum { + no_exception, // initialized without code + other_exception, // any excepton not listed below + unregistered_class, // attempt to serialize a pointer of + // 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 serialized through a pointer. + // Were this permitted, 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 + input_stream_error, // error on input 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 program + // needs to be rebuilt. + multiple_code_instantiation, // code for implementing serialization for some + // type has been instantiated in more than one module. + output_stream_error // error on input stream + } exception_code; +public: + exception_code code; + archive_exception( + exception_code c, + const char * e1 = NULL, + const char * e2 = NULL + ); + virtual ~archive_exception() throw(); + virtual const char *what() const throw(); +protected: + unsigned int + append(unsigned int l, const char * a); + archive_exception(); +}; + +}// namespace archive +}// namespace autoboost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/contrib/autoboost/boost/archive/basic_archive.hpp b/contrib/autoboost/boost/archive/basic_archive.hpp new file mode 100644 index 000000000..a1779fbf9 --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_archive.hpp @@ -0,0 +1,304 @@ +#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_ARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 // count +#include +#include +#include // size_t +#include +#include + +#include +#include // must be the last header + +namespace autoboost { +namespace archive { + +#if defined(_MSC_VER) +#pragma warning( push ) +#pragma warning( disable : 4244 4267 ) +#endif + +/* NOTE : Warning : Warning : Warning : Warning : Warning + * Don't ever changes this. If you do, they previously created + * binary archives won't be readable !!! + */ +class library_version_type { +private: + typedef uint_least16_t base_type; + base_type t; +public: + library_version_type(): t(0) {}; + explicit library_version_type(const unsigned int & t_) : t(t_){ + BOOST_ASSERT(t_ <= autoboost::integer_traits::const_max); + } + library_version_type(const library_version_type & t_) : + t(t_.t) + {} + library_version_type & operator=(const library_version_type & rhs){ + t = rhs.t; + return *this; + } + // used for text output + operator base_type () const { + return t; + } + // used for text input + operator base_type & (){ + return t; + } + bool operator==(const library_version_type & rhs) const { + return t == rhs.t; + } + bool operator<(const library_version_type & rhs) const { + return t < rhs.t; + } +}; + +BOOST_ARCHIVE_DECL(library_version_type) +BOOST_ARCHIVE_VERSION(); + +class version_type { +private: + typedef uint_least32_t base_type; + base_type t; +public: + // should be private - but MPI fails if it's not!!! + version_type(): t(0) {}; + explicit version_type(const unsigned int & t_) : t(t_){ + BOOST_ASSERT(t_ <= autoboost::integer_traits::const_max); + } + version_type(const version_type & t_) : + t(t_.t) + {} + version_type & operator=(const version_type & rhs){ + t = rhs.t; + return *this; + } + // used for text output + operator base_type () const { + return t; + } + // used for text intput + operator base_type & (){ + return t; + } + bool operator==(const version_type & rhs) const { + return t == rhs.t; + } + bool operator<(const version_type & rhs) const { + return t < rhs.t; + } +}; + +class class_id_type { +private: + typedef int_least16_t base_type; + base_type t; +public: + // should be private - but then can't use BOOST_STRONG_TYPE below + class_id_type() : t(0) {}; + explicit class_id_type(const int t_) : t(t_){ + BOOST_ASSERT(t_ <= autoboost::integer_traits::const_max); + } + explicit class_id_type(const std::size_t t_) : t(t_){ + // BOOST_ASSERT(t_ <= autoboost::integer_traits::const_max); + } + class_id_type(const class_id_type & t_) : + t(t_.t) + {} + class_id_type & operator=(const class_id_type & rhs){ + t = rhs.t; + return *this; + } + + // used for text output + operator int () const { + return t; + } + // used for text input + operator int_least16_t &() { + return t; + } + bool operator==(const class_id_type & rhs) const { + return t == rhs.t; + } + bool operator<(const class_id_type & rhs) const { + return t < rhs.t; + } +}; + +#define NULL_POINTER_TAG autoboost::archive::class_id_type(-1) + +class object_id_type { +private: + typedef uint_least32_t base_type; + base_type t; +public: + object_id_type(): t(0) {}; + // note: presumes that size_t >= unsigned int. + explicit object_id_type(const std::size_t & t_) : t(t_){ + BOOST_ASSERT(t_ <= autoboost::integer_traits::const_max); + } + object_id_type(const object_id_type & t_) : + t(t_.t) + {} + object_id_type & operator=(const object_id_type & rhs){ + t = rhs.t; + return *this; + } + // used for text output + operator uint_least32_t () const { + return t; + } + // used for text input + operator uint_least32_t & () { + return t; + } + bool operator==(const object_id_type & rhs) const { + return t == rhs.t; + } + bool operator<(const object_id_type & rhs) const { + return t < rhs.t; + } +}; + +#if defined(_MSC_VER) +#pragma warning( pop ) +#endif + +struct tracking_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 autoboost::noncopyable +{ + char *t; + operator const char * & () const { + return const_cast(t); + } + operator char * () { + return t; + } + std::size_t size() const { + return std::strlen(t); + } + explicit class_name_type(const char *key_) + : t(const_cast(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 +}; + +BOOST_ARCHIVE_DECL(const char *) +BOOST_ARCHIVE_SIGNATURE(); + +/* NOTE : Warning : Warning : Warning : Warning : Warning + * If any of these are changed to different sized types, + * binary_iarchive won't be able to read older archives + * unless you rev the library version and include conditional + * code based on the library version. There is nothing + * inherently wrong in doing this - but you have to be super + * careful because it's easy to get wrong and start breaking + * old archives !!! + */ + +#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \ + class D : public T { \ + public: \ + explicit D(const T tt) : T(tt){} \ + }; \ +/**/ + +BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_reference_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_optional_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(object_id_type, object_reference_type) + +}// namespace archive +}// namespace autoboost + +#include // pops abi_suffix.hpp pragmas + +#include + +// set implementation level to primitive for all types +// used internally by the serialization library + +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::library_version_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::version_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::class_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::class_id_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::class_id_optional_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::class_name_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::object_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::object_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(autoboost::archive::tracking_type, primitive_type) + +#include + +// set types used internally by the serialization library +// to be bitwise serializable + +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::library_version_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::version_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::class_id_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::class_id_reference_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::class_id_optional_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::class_name_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::object_id_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::object_reference_type) +BOOST_IS_BITWISE_SERIALIZABLE(autoboost::archive::tracking_type) + +#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_binary_iarchive.hpp b/contrib/autoboost/boost/archive/basic_binary_iarchive.hpp new file mode 100644 index 000000000..f089ab2e4 --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_binary_iarchive.hpp @@ -0,0 +1,228 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +#include // must be the last header + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_iarchive - read serialized objects from a input binary stream +template +class basic_binary_iarchive : + public detail::common_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + #else + friend class detail::interface_iarchive; + #endif +#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 detail_common_iarchive; + template + void load_override(T & t, BOOST_PFTO int version){ + this->detail_common_iarchive::load_override(t, static_cast(version)); + } + + // include these to trap a change in binary format which + // isn't specifically handled + // upto 32K classes + BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t)); + BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t)); + // upto 2G objects + BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t)); + BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t)); + + // binary files don't include the optional information + void load_override(class_id_optional_type & /* t */, int){} + + void load_override(tracking_type & t, int /*version*/){ + library_version_type lvt = this->get_library_version(); + if(autoboost::archive::library_version_type(6) < lvt){ + int_least8_t x=0; + * this->This() >> x; + t = autoboost::archive::tracking_type(x); + } + else{ + bool x=0; + * this->This() >> x; + t = autoboost::archive::tracking_type(x); + } + } + void load_override(class_id_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(autoboost::archive::library_version_type(7) < lvt){ + this->detail_common_iarchive::load_override(t, version); + } + else + if(autoboost::archive::library_version_type(6) < lvt){ + int_least16_t x=0; + * this->This() >> x; + t = autoboost::archive::class_id_type(x); + } + else{ + int x=0; + * this->This() >> x; + t = autoboost::archive::class_id_type(x); + } + } + void load_override(class_id_reference_type & t, int version){ + load_override(static_cast(t), version); + } +#if 0 + void load_override(class_id_reference_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(autoboost::archive::library_version_type(7) < lvt){ + this->detail_common_iarchive::load_override(t, version); + } + else + if(autoboost::archive::library_version_type(6) < lvt){ + int_least16_t x=0; + * this->This() >> x; + t = autoboost::archive::class_id_reference_type( + autoboost::archive::class_id_type(x) + ); + } + else{ + int x=0; + * this->This() >> x; + t = autoboost::archive::class_id_reference_type( + autoboost::archive::class_id_type(x) + ); + } + } +#endif + + void load_override(version_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(autoboost::archive::library_version_type(7) < lvt){ + this->detail_common_iarchive::load_override(t, version); + } + else + if(autoboost::archive::library_version_type(6) < lvt){ + uint_least8_t x=0; + * this->This() >> x; + t = autoboost::archive::version_type(x); + } + else + if(autoboost::archive::library_version_type(5) < lvt){ + uint_least16_t x=0; + * this->This() >> x; + t = autoboost::archive::version_type(x); + } + else + if(autoboost::archive::library_version_type(2) < lvt){ + // upto 255 versions + unsigned char x=0; + * this->This() >> x; + t = version_type(x); + } + else{ + unsigned int x=0; + * this->This() >> x; + t = autoboost::archive::version_type(x); + } + } + + void load_override(autoboost::serialization::item_version_type & t, int version){ + library_version_type lvt = this->get_library_version(); +// if(autoboost::archive::library_version_type(7) < lvt){ + if(autoboost::archive::library_version_type(6) < lvt){ + this->detail_common_iarchive::load_override(t, version); + } + else + if(autoboost::archive::library_version_type(6) < lvt){ + uint_least16_t x=0; + * this->This() >> x; + t = autoboost::serialization::item_version_type(x); + } + else{ + unsigned int x=0; + * this->This() >> x; + t = autoboost::serialization::item_version_type(x); + } + } + + void load_override(serialization::collection_size_type & t, int version){ + if(autoboost::archive::library_version_type(5) < this->get_library_version()){ + this->detail_common_iarchive::load_override(t, version); + } + else{ + unsigned int 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(flags) + {} +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_binary_iprimitive.hpp b/contrib/autoboost/boost/archive/basic_binary_iprimitive.hpp new file mode 100644 index 000000000..62300fa8e --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include +#include +#include // std::memcpy +#include // std::size_t +#include // basic_streambuf +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include // must be the last header + +namespace autoboost { +namespace archive { + +///////////////////////////////////////////////////////////////////////////// +// class binary_iarchive - read serialized objects from a input binary stream +template +class basic_binary_iprimitive +{ +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class load_access; +protected: +#else +public: +#endif + std::basic_streambuf & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + #ifndef BOOST_NO_STD_LOCALE + autoboost::scoped_ptr archive_locale; + basic_streambuf_locale_saver locale_saver; + #endif + + // main template for serilization of primitive types + template + 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; + BOOST_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 & 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 + // use_array_optimization; + struct use_array_optimization { + template + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef typename autoboost::serialization::is_bitwise_serializable< T >::type type; + }; + #else + struct apply : public autoboost::serialization::is_bitwise_serializable< T > {}; + #endif + }; + + // the optimized load_array dispatches to load_binary + template + void load_array(serialization::array& a, unsigned int) + { + load_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void + load_binary(void *address, std::size_t count); +}; + +template +inline void +basic_binary_iprimitive::load_binary( + void *address, + std::size_t count +){ + // note: an optimizer should eliminate the following for char files + BOOST_ASSERT( + static_cast(count / sizeof(Elem)) + <= autoboost::integer_traits::const_max + ); + std::streamsize s = static_cast(count / sizeof(Elem)); + std::streamsize scount = m_sb.sgetn( + static_cast(address), + s + ); + if(scount != s) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + // note: an optimizer should eliminate the following for char files + BOOST_ASSERT(count % sizeof(Elem) <= autoboost::integer_traits::const_max); + s = static_cast(count % sizeof(Elem)); + if(0 < s){ +// if(is.fail()) +// autoboost::serialization::throw_exception( +// archive_exception(archive_exception::stream_error) +// ); + Elem t; + scount = m_sb.sgetn(& t, 1); + if(scount != 1) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + std::memcpy(static_cast(address) + (count - s), &t, static_cast(s)); + } +} + +} // namespace archive +} // namespace autoboost + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_binary_oarchive.hpp b/contrib/autoboost/boost/archive/basic_binary_oarchive.hpp new file mode 100644 index 000000000..35be208d5 --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_binary_oarchive.hpp @@ -0,0 +1,186 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +////////////////////////////////////////////////////////////////////// +// 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 basic_binary_oarchive : + public archive::detail::common_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + #else + friend class detail::interface_oarchive; + #endif +#endif + // any datatype not specifed below will be handled by base class + typedef detail::common_oarchive detail_common_oarchive; + template + void save_override(const T & t, BOOST_PFTO int version){ + this->detail_common_oarchive::save_override(t, static_cast(version)); + } + + // include these to trap a change in binary format which + // isn't specifically handled + BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool)); + // upto 32K classes + BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t)); + BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t)); + // upto 2G objects + BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t)); + BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t)); + + // binary files don't include the optional information + void save_override(const class_id_optional_type & /* t */, int){} + + // enable this if we decide to support generation of previous versions + #if 0 + void save_override(const autoboost::archive::version_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(autoboost::archive::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t, version); + } + else + if(autoboost::archive::library_version_type(6) < lvt){ + const autoboost::uint_least16_t x = t; + * this->This() << x; + } + else{ + const unsigned int x = t; + * this->This() << x; + } + } + void save_override(const autoboost::serialization::item_version_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(autoboost::archive::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t, version); + } + else + if(autoboost::archive::library_version_type(6) < lvt){ + const autoboost::uint_least16_t x = t; + * this->This() << x; + } + else{ + const unsigned int x = t; + * this->This() << x; + } + } + + void save_override(class_id_type & t, int version){ + library_version_type lvt = this->get_library_version(); + if(autoboost::archive::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t, version); + } + else + if(autoboost::archive::library_version_type(6) < lvt){ + const autoboost::int_least16_t x = t; + * this->This() << x; + } + else{ + const int x = t; + * this->This() << x; + } + } + void save_override(class_id_reference_type & t, int version){ + save_override(static_cast(t), version); + } + + #endif + + // 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; + } + + #if 0 + void save_override(const serialization::collection_size_type & t, int){ + if (get_library_version() < autoboost::archive::library_version_type(6)){ + unsigned int x=0; + * this->This() >> x; + t = serialization::collection_size_type(x); + } + else{ + * this->This() >> t; + } + } + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + init(); + + basic_binary_oarchive(unsigned int flags) : + detail::common_oarchive(flags) + {} +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_binary_oprimitive.hpp b/contrib/autoboost/boost/archive/basic_binary_oprimitive.hpp new file mode 100644 index 000000000..7ec2d389f --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_binary_oprimitive.hpp @@ -0,0 +1,183 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include +#include // basic_streambuf +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include // must be the last header + +namespace autoboost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_oprimitive - binary output of prmitives + +template +class basic_binary_oprimitive { +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class save_access; +protected: +#else +public: +#endif + std::basic_streambuf & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + #ifndef BOOST_NO_STD_LOCALE + autoboost::scoped_ptr archive_locale; + basic_streambuf_locale_saver locale_saver; + #endif + // default saving of primitives. + template + 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){ + BOOST_ASSERT(0 == static_cast(t) || 1 == static_cast(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 & 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 + // use_array_optimization; + // workaround without using mpl lambdas + struct use_array_optimization { + template + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef typename autoboost::serialization::is_bitwise_serializable< T >::type type; + }; + #else + struct apply : public autoboost::serialization::is_bitwise_serializable< T > {}; + #endif + }; + + + // the optimized save_array dispatches to save_binary + template + void save_array(autoboost::serialization::array const& a, unsigned int) + { + save_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void save_binary(const void *address, std::size_t count); +}; + +template +inline void +basic_binary_oprimitive::save_binary( + const void *address, + std::size_t count +){ + //BOOST_ASSERT( + // static_cast((std::numeric_limits::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()) + // autoboost::serialization::throw_exception( + // archive_exception(archive_exception::output_stream_error) + // ); + // figure number of elements to output - round up + count = ( count + sizeof(Elem) - 1) + / sizeof(Elem); + BOOST_ASSERT(count <= std::size_t(autoboost::integer_traits::const_max)); + std::streamsize scount = m_sb.sputn( + static_cast(address), + static_cast(count) + ); + if(count != static_cast(scount)) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + //os.write( + // static_cast(address), + // count + //); + //BOOST_ASSERT(os.good()); +} + +} //namespace autoboost +} //namespace archive + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_streambuf_locale_saver.hpp b/contrib/autoboost/boost/archive/basic_streambuf_locale_saver.hpp new file mode 100644 index 000000000..fd45ed9de --- /dev/null +++ b/contrib/autoboost/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) +# 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 .) + +// See for the library's home page. + +#ifndef BOOST_NO_STD_LOCALE + +#include // for std::locale +#include // for std::basic_streambuf + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost{ +namespace archive{ + +template < typename Ch, class Tr > +class basic_streambuf_locale_saver : + private autoboost::noncopyable +{ +public: + typedef ::std::basic_streambuf state_type; + typedef ::std::locale aspect_type; + explicit basic_streambuf_locale_saver( state_type &s ) + : s_save_( s ), a_save_( s.getloc() ) + {} + explicit 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/contrib/autoboost/boost/archive/basic_text_iarchive.hpp b/contrib/autoboost/boost/archive/basic_text_iarchive.hpp new file mode 100644 index 000000000..057ab2cf9 --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_text_iarchive.hpp @@ -0,0 +1,97 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 but rather +// use two template parameters + +#include +#include +#include + +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - read serialized objects from a input text stream +template +class basic_text_iarchive : + public detail::common_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + #else + friend class detail::interface_iarchive; + #endif +#endif + // intermediate level to support override of operators + // fot templates in the absence of partial function + // template ordering + typedef detail::common_iarchive detail_common_iarchive; + template + 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(flags) + {} + ~basic_text_iarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_text_iprimitive.hpp b/contrib/autoboost/boost/archive/basic_text_iprimitive.hpp new file mode 100644 index 000000000..0afa87cac --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_text_iprimitive.hpp @@ -0,0 +1,137 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 but rather +// use two template parameters + +#include +#include +#include // size_t + +#include +#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 +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include // must be the last header + +namespace autoboost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - load serialized objects from a input text stream +#if defined(_MSC_VER) +#pragma warning( push ) +#pragma warning( disable : 4244 4267 ) +#endif + +template +class basic_text_iprimitive { +protected: + IStream &is; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + autoboost::scoped_ptr archive_locale; + basic_streambuf_locale_saver< + typename IStream::char_type, + typename IStream::traits_type + > locale_saver; + #endif + + template + void load(T & t) + { + if(is >> t) + return; + autoboost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + } + + void load(char & t) + { + short int i; + load(i); + t = i; + } + void load(signed char & t) + { + short int i; + load(i); + t = i; + } + void load(unsigned char & t) + { + unsigned short int i; + load(i); + t = i; + } + + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void load(wchar_t & t) + { + BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int)); + int i; + load(i); + 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); +}; + +#if defined(_MSC_VER) +#pragma warning( pop ) +#endif + +} // namespace archive +} // namespace autoboost + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_text_oarchive.hpp b/contrib/autoboost/boost/archive/basic_text_oarchive.hpp new file mode 100644 index 000000000..3c6d9701b --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_text_oarchive.hpp @@ -0,0 +1,122 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 but rather +// use two template parameters + +#include +#include +#include +#include + +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oarchive +template +class basic_text_oarchive : + public detail::common_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + #else + friend class detail::interface_oarchive; + #endif +#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 detail_common_oarchive; + template + 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(); + this->detail_common_oarchive::save_override(t, 0); + } + + // 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(flags), + delimiter(none) + {} + ~basic_text_oarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_text_oprimitive.hpp b/contrib/autoboost/boost/archive/basic_text_oprimitive.hpp new file mode 100644 index 000000000..a463f4b7e --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_text_oprimitive.hpp @@ -0,0 +1,206 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 but rather +// use two template parameters + +#include +#include +#include +#include // size_t + +#include +#include +#include +#include + +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include // must be the last header + +namespace autoboost { +namespace archive { + +class save_access; + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oprimitive - output of prmitives to stream +template +class basic_text_oprimitive +{ +protected: + OStream &os; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + autoboost::scoped_ptr archive_locale; + basic_streambuf_locale_saver< + typename OStream::char_type, + typename OStream::traits_type + > locale_saver; + #endif + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + void save(const bool t){ + // trap usage of invalid uninitialized boolean which would + // otherwise crash on load. + BOOST_ASSERT(0 == static_cast(t) || 1 == static_cast(t)); + if(os.fail()) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + os << t; + } + void save(const signed char t) + { + save(static_cast(t)); + } + void save(const unsigned char t) + { + save(static_cast(t)); + } + void save(const char t) + { + save(static_cast(t)); + } + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void save(const wchar_t t) + { + BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int)); + save(static_cast(t)); + } + #endif + + ///////////////////////////////////////////////////////// + // saving of any types not listed above + + template + void save_impl(const T &t, autoboost::mpl::bool_ &){ + if(os.fail()) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + os << t; + } + + ///////////////////////////////////////////////////////// + // floating point types need even more special treatment + // the following determines whether the type T is some sort + // of floating point type. Note that we then assume that + // the stream << operator is defined on that type - if not + // we'll get a compile time error. This is meant to automatically + // support synthesized types which support floating point + // operations. Also it should handle compiler dependent types + // such long double. Due to John Maddock. + + template + struct is_float { + typedef typename mpl::bool_< + autoboost::is_floating_point::value + || (std::numeric_limits::is_specialized + && !std::numeric_limits::is_integer + && !std::numeric_limits::is_exact + && std::numeric_limits::max_exponent) + >::type type; + }; + + template + void save_impl(const T &t, autoboost::mpl::bool_ &){ + // must be a user mistake - can't serialize un-initialized data + if(os.fail()) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + // The formulae for the number of decimla digits required is given in + // http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf + // which is derived from Kahan's paper: + // www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps + // const unsigned int digits = (std::numeric_limits::digits * 3010) / 10000; + // note: I've commented out the above because I didn't get good results. e.g. + // in one case I got a difference of 19 units. + #ifndef BOOST_NO_CXX11_NUMERIC_LIMITS + const unsigned int digits = std::numeric_limits::max_digits10; + #else + const unsigned int digits = std::numeric_limits::digits10 + 2; + #endif + os << std::setprecision(digits) << std::scientific << t; + } + + template + void save(const T & t){ + autoboost::io::ios_flags_saver fs(os); + autoboost::io::ios_precision_saver ps(os); + typename is_float::type tf; + save_impl(t, tf); + } + + 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(typename OStream::char_type c){ + if(os.fail()) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + os.put(c); + } + // unformatted append of null terminated string + void put(const char * s){ + while('\0' != *s) + os.put(*s++); + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) + save_binary(const void *address, std::size_t count); +}; + +} //namespace autoboost +} //namespace archive + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_xml_archive.hpp b/contrib/autoboost/boost/archive/basic_xml_archive.hpp new file mode 100644 index 000000000..d5ddbd68d --- /dev/null +++ b/contrib/autoboost/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) +# 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 + +#include +#include // must be the last header + +namespace autoboost { +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 autoboost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP + diff --git a/contrib/autoboost/boost/archive/basic_xml_iarchive.hpp b/contrib/autoboost/boost/archive/basic_xml_iarchive.hpp new file mode 100644 index 000000000..d739823c0 --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_xml_iarchive.hpp @@ -0,0 +1,133 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include + +#include + +#include +#include + +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class xml_iarchive - read serialized objects from a input text stream +template +class basic_xml_iarchive : + public detail::common_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + #else + friend class detail::interface_iarchive; + #endif +#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 + 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 detail_common_iarchive; + template + void load_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + autoboost::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 autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/basic_xml_oarchive.hpp b/contrib/autoboost/boost/archive/basic_xml_oarchive.hpp new file mode 100644 index 000000000..230a131f2 --- /dev/null +++ b/contrib/autoboost/boost/archive/basic_xml_oarchive.hpp @@ -0,0 +1,150 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include + +#include +#include +#include + +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +////////////////////////////////////////////////////////////////////// +// class basic_xml_oarchive - write serialized objects to a xml output stream +template +class basic_xml_oarchive : + public detail::common_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: +#endif +#if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; +#else + friend class detail::interface_oarchive; +#endif + friend class save_access; + // 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 + 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 detail_common_oarchive; + template + void save_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + ::autoboost::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 autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/binary_iarchive.hpp b/contrib/autoboost/boost/archive/binary_iarchive.hpp new file mode 100644 index 000000000..33ead9a4c --- /dev/null +++ b/contrib/autoboost/boost/archive/binary_iarchive.hpp @@ -0,0 +1,64 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +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< + autoboost::archive::binary_iarchive, + std::istream::char_type, + std::istream::traits_type + >{ +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 autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::binary_iarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(autoboost::archive::binary_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/binary_iarchive_impl.hpp b/contrib/autoboost/boost/archive/binary_iarchive_impl.hpp new file mode 100644 index 000000000..83f8c51d0 --- /dev/null +++ b/contrib/autoboost/boost/archive/binary_iarchive_impl.hpp @@ -0,0 +1,108 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class binary_iarchive_impl : + public basic_binary_iprimitive, + public basic_binary_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + friend basic_binary_iarchive; + friend load_access; + #else + friend class detail::interface_iarchive; + friend class basic_binary_iarchive; + friend class load_access; + #endif +#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 + void load_override(T & t, BOOST_PFTO int){ + this->basic_binary_iarchive::load_override(t, 0L); + } + void init(unsigned int flags){ + if(0 != (flags & no_header)) + return; + #if ! defined(__MWERKS__) + this->basic_binary_iarchive::init(); + this->basic_binary_iprimitive::init(); + #else + basic_binary_iarchive::init(); + basic_binary_iprimitive::init(); + #endif + } + binary_iarchive_impl( + std::basic_streambuf & bsb, + unsigned int flags + ) : + basic_binary_iprimitive( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive(flags) + { + init(flags); + } + binary_iarchive_impl( + std::basic_istream & is, + unsigned int flags + ) : + basic_binary_iprimitive( + * is.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive(flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP diff --git a/contrib/autoboost/boost/archive/binary_oarchive.hpp b/contrib/autoboost/boost/archive/binary_oarchive.hpp new file mode 100644 index 000000000..9557ee406 --- /dev/null +++ b/contrib/autoboost/boost/archive/binary_oarchive.hpp @@ -0,0 +1,64 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +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) + {} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::binary_oarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(autoboost::archive::binary_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/binary_oarchive_impl.hpp b/contrib/autoboost/boost/archive/binary_oarchive_impl.hpp new file mode 100644 index 000000000..07fb9320f --- /dev/null +++ b/contrib/autoboost/boost/archive/binary_oarchive_impl.hpp @@ -0,0 +1,109 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class binary_oarchive_impl : + public basic_binary_oprimitive, + public basic_binary_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend basic_binary_oarchive; + friend save_access; + #else + friend class detail::interface_oarchive; + friend class basic_binary_oarchive; + friend class save_access; + #endif +#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 + void save_override(T & t, BOOST_PFTO int){ + this->basic_binary_oarchive::save_override(t, 0L); + } + void init(unsigned int flags) { + if(0 != (flags & no_header)) + return; + #if ! defined(__MWERKS__) + this->basic_binary_oarchive::init(); + this->basic_binary_oprimitive::init(); + #else + basic_binary_oarchive::init(); + basic_binary_oprimitive::init(); + #endif + } + binary_oarchive_impl( + std::basic_streambuf & bsb, + unsigned int flags + ) : + basic_binary_oprimitive( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive(flags) + { + init(flags); + } + binary_oarchive_impl( + std::basic_ostream & os, + unsigned int flags + ) : + basic_binary_oprimitive( + * os.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive(flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP diff --git a/contrib/autoboost/boost/archive/binary_wiarchive.hpp b/contrib/autoboost/boost/archive/binary_wiarchive.hpp new file mode 100644 index 000000000..641e7ca27 --- /dev/null +++ b/contrib/autoboost/boost/archive/binary_wiarchive.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include // wistream +#include +#include + +namespace autoboost { +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 autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::binary_wiarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/binary_woarchive.hpp b/contrib/autoboost/boost/archive/binary_woarchive.hpp new file mode 100644 index 000000000..3ab4238e6 --- /dev/null +++ b/contrib/autoboost/boost/archive/binary_woarchive.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include +#include + +namespace autoboost { +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) + {} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::binary_woarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/codecvt_null.hpp b/contrib/autoboost/boost/archive/codecvt_null.hpp new file mode 100644 index 000000000..022e1031f --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include // NULL, size_t +#include // for mbstate_t +#include +#include +#include // 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 autoboost { +namespace archive { + +template +class codecvt_null; + +template<> +class codecvt_null : public std::codecvt +{ + virtual bool do_always_noconv() const throw() { + return true; + } +public: + explicit codecvt_null(std::size_t no_locale_manage = 0) : + std::codecvt(no_locale_manage) + {} +}; + +template<> +class codecvt_null : public std::codecvt +{ + 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 autoboost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif +#include // pop pragmas + +#endif //BOOST_ARCHIVE_CODECVT_NULL_HPP diff --git a/contrib/autoboost/boost/archive/detail/abi_prefix.hpp b/contrib/autoboost/boost/archive/detail/abi_prefix.hpp new file mode 100644 index 000000000..e39ef11f1 --- /dev/null +++ b/contrib/autoboost/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 // 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/contrib/autoboost/boost/archive/detail/abi_suffix.hpp b/contrib/autoboost/boost/archive/detail/abi_suffix.hpp new file mode 100644 index 000000000..a283b36cf --- /dev/null +++ b/contrib/autoboost/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 // pops abi_suffix.hpp pragmas + +#if defined( __BORLANDC__ ) +#pragma nopushoptwarn +#endif + diff --git a/contrib/autoboost/boost/archive/detail/archive_serializer_map.hpp b/contrib/autoboost/boost/archive/detail/archive_serializer_map.hpp new file mode 100644 index 000000000..0b25cf88c --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include +#include // must be the last header + +namespace autoboost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_serializer; + +template +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 autoboost::serialization::extended_type_info & type_ + ); +}; + +} // namespace detail +} // namespace archive +} // namespace autoboost + +#include // must be the last header + +#endif //BOOST_ARCHIVE_SERIALIZER_MAP_HPP diff --git a/contrib/autoboost/boost/archive/detail/auto_link_archive.hpp b/contrib/autoboost/boost/archive/detail/auto_link_archive.hpp new file mode 100644 index 000000000..35e1acf45 --- /dev/null +++ b/contrib/autoboost/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) +# 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 + +#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 autoboost_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 +#endif // auto-linking disabled + +#endif // BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/detail/auto_link_warchive.hpp b/contrib/autoboost/boost/archive/detail/auto_link_warchive.hpp new file mode 100644 index 000000000..4bcaa3142 --- /dev/null +++ b/contrib/autoboost/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) +# 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 + +#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 autoboost_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 +#endif // auto-linking disabled + +#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_iarchive.hpp b/contrib/autoboost/boost/archive/detail/basic_iarchive.hpp new file mode 100644 index 000000000..87d6fb8a8 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/basic_iarchive.hpp @@ -0,0 +1,105 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include + +#include +#include +#include +#include +#include // must be the last header + +namespace autoboost { +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 autoboost::noncopyable, + public autoboost::archive::detail::helper_collection +{ + 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 + // autoboost::scoped_ptr 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 autoboost::serialization::extended_type_info & eti + ) + + ); + // real public API starts here + void + set_library_version(library_version_type archive_library_version); + library_version_type + 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 autoboost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_iserializer.hpp b/contrib/autoboost/boost/archive/detail/basic_iserializer.hpp new file mode 100644 index 000000000..380a22680 --- /dev/null +++ b/contrib/autoboost/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) +# 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 // NULL +#include + +#include +#include +#include +#include +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +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 autoboost::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 autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_oarchive.hpp b/contrib/autoboost/boost/archive/detail/basic_oarchive.hpp new file mode 100644 index 000000000..f388cb56a --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/basic_oarchive.hpp @@ -0,0 +1,100 @@ +#ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 // NULL +#include +#include + +// can't use this - much as I'd like to as borland doesn't support it +// #include + +#include +#include +#include +#include // must be the last header + +namespace autoboost { +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 autoboost::noncopyable, + public autoboost::archive::detail::helper_collection +{ + friend class basic_oarchive_impl; + // hide implementation of this class to minimize header conclusion + // in client code. note: borland can't use scoped_ptr + //autoboost::scoped_ptr 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 + library_version_type get_library_version() const; + unsigned int get_flags() const; +}; + +} // namespace detail +} // namespace archive +} // namespace autoboost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_oserializer.hpp b/contrib/autoboost/boost/archive/detail/basic_oserializer.hpp new file mode 100644 index 000000000..4eacf5d0d --- /dev/null +++ b/contrib/autoboost/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) +# 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 // NULL +#include +#include + +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +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 autoboost::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 autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_pointer_iserializer.hpp b/contrib/autoboost/boost/archive/detail/basic_pointer_iserializer.hpp new file mode 100644 index 000000000..1cb313db4 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/basic_pointer_iserializer.hpp @@ -0,0 +1,74 @@ +#ifndef BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +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 autoboost::serialization::extended_type_info & type_ + ); + // account for bogus gcc warning + #if defined(__GNUC__) + virtual + #endif + ~basic_pointer_iserializer(); +public: + virtual void * heap_allocation() const = 0; + 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 autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_pointer_oserializer.hpp b/contrib/autoboost/boost/archive/detail/basic_pointer_oserializer.hpp new file mode 100644 index 000000000..4f1089b63 --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +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 autoboost::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 autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_serializer.hpp b/contrib/autoboost/boost/archive/detail/basic_serializer.hpp new file mode 100644 index 000000000..98ef3646a --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include // NULL + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { +namespace detail { + +class basic_serializer : + private autoboost::noncopyable +{ + const autoboost::serialization::extended_type_info * m_eti; +protected: + explicit basic_serializer( + const autoboost::serialization::extended_type_info & eti + ) : + m_eti(& eti) + { + BOOST_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 autoboost::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 autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP diff --git a/contrib/autoboost/boost/archive/detail/basic_serializer_map.hpp b/contrib/autoboost/boost/archive/detail/basic_serializer_map.hpp new file mode 100644 index 000000000..025633146 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/basic_serializer_map.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_SERIALIZER_MAP_HPP +#define BOOST_SERIALIZER_MAP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include +#include + +#include // must be the last header + +namespace autoboost { +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 + autoboost::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 autoboost::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 autoboost + +#include // must be the last header + +#endif // BOOST_SERIALIZER_MAP_HPP diff --git a/contrib/autoboost/boost/archive/detail/check.hpp b/contrib/autoboost/boost/archive/detail/check.hpp new file mode 100644 index 000000000..679991bb2 --- /dev/null +++ b/contrib/autoboost/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) +# 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace autoboost { +namespace archive { +namespace detail { + +// checks for objects + +template +inline void check_object_level(){ + typedef + typename mpl::greater_equal< + serialization::implementation_level< T >, + mpl::int_ + >::type typex; + + // trap attempts to serialize objects marked + // not_serializable + BOOST_STATIC_ASSERT(typex::value); +} + +template +inline void check_object_versioning(){ + typedef + typename mpl::or_< + typename mpl::greater< + serialization::implementation_level< T >, + mpl::int_ + >, + 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 +inline void check_object_tracking(){ + // presume it has already been determined that + // T is not a const + BOOST_STATIC_ASSERT(! autoboost::is_const< T >::value); + typedef typename mpl::equal_to< + serialization::tracking_level< T >, + mpl::int_ + >::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 +inline void check_pointer_level(){ + // we should only invoke this once we KNOW that T + // has been used as a pointer!! + typedef + typename mpl::or_< + typename mpl::greater< + serialization::implementation_level< T >, + mpl::int_ + >, + typename mpl::not_< + typename mpl::equal_to< + serialization::tracking_level< T >, + mpl::int_ + > + > + > 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 +void inline check_pointer_tracking(){ + typedef typename mpl::greater< + serialization::tracking_level< T >, + mpl::int_ + >::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 +inline void check_const_loading(){ + typedef + typename mpl::or_< + typename autoboost::serialization::is_wrapper< T >, + typename mpl::not_< + typename autoboost::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/contrib/autoboost/boost/archive/detail/common_iarchive.hpp b/contrib/autoboost/boost/archive/detail/common_iarchive.hpp new file mode 100644 index 000000000..2609506f5 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/common_iarchive.hpp @@ -0,0 +1,88 @@ +#ifndef BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { +namespace detail { + +class extended_type_info; + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template +class common_iarchive : + public basic_iarchive, + public interface_iarchive +{ + friend class interface_iarchive; +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 + 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() + {} +}; + +} // namespace detail +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP + diff --git a/contrib/autoboost/boost/archive/detail/common_oarchive.hpp b/contrib/autoboost/boost/archive/detail/common_oarchive.hpp new file mode 100644 index 000000000..815195972 --- /dev/null +++ b/contrib/autoboost/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) +# 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 + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { +namespace detail { + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template +class common_oarchive : + public basic_oarchive, + public interface_oarchive +{ + friend class interface_oarchive; +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 + 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() + {} +}; + +} // namespace detail +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/detail/decl.hpp b/contrib/autoboost/boost/archive/detail/decl.hpp new file mode 100644 index 000000000..44e22be96 --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include + +#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/contrib/autoboost/boost/archive/detail/helper_collection.hpp b/contrib/autoboost/boost/archive/detail/helper_collection.hpp new file mode 100644 index 000000000..2c7babf84 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/helper_collection.hpp @@ -0,0 +1,108 @@ +#ifndef BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP +#define BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_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 +// helper_collection.hpp: archive support for run-time helpers + +// (C) Copyright 2002-2008 Robert Ramey and Joaquin M Lopez Munoz +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.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 // NULL +#include +#include +#include +#include + +#include + +#ifdef BOOST_NO_CXX11_SMART_PTR + #include + #include +#endif + +namespace autoboost { + +namespace archive { +namespace detail { + +class helper_collection +{ + helper_collection(const helper_collection&); // non-copyable + helper_collection& operator = (const helper_collection&); // non-copyable + + // note: we dont' actually "share" the function object pointer + // we only use shared_ptr to make sure that it get's deleted + + #ifndef BOOST_NO_CXX11_SMART_PTR + typedef std::pair< + const void *, + std::shared_ptr + > helper_value_type; + template + std::shared_ptr make_helper_ptr(){ + return std::make_shared(); + } + #else + typedef std::pair< + const void *, + autoboost::shared_ptr + > helper_value_type; + template + autoboost::shared_ptr make_helper_ptr(){ + return autoboost::make_shared(); + } + #endif + typedef std::vector collection; + collection m_collection; + + struct predicate { + const void * const m_ti; + bool operator()(helper_value_type const &rhs) const { + return m_ti == rhs.first; + } + predicate(const void * ti) : + m_ti(ti) + {} + }; +protected: + helper_collection(){} + ~helper_collection(){} +public: + template + Helper& get_helper(void * const id = 0) { + + collection::const_iterator it = + std::find_if( + m_collection.begin(), + m_collection.end(), + predicate(id) + ); + + void * rval; + if(it == m_collection.end()){ + m_collection.push_back( + std::make_pair(id, make_helper_ptr()) + ); + rval = m_collection.back().second.get(); + } + else{ + rval = it->second.get(); + } + return *static_cast(rval); + } +}; + +} // namespace detail +} // namespace serialization +} // namespace autoboost + +#endif // BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP diff --git a/contrib/autoboost/boost/archive/detail/interface_iarchive.hpp b/contrib/autoboost/boost/archive/detail/interface_iarchive.hpp new file mode 100644 index 000000000..e3a3007c7 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/interface_iarchive.hpp @@ -0,0 +1,77 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 // NULL +#include +#include +#include +#include +#include +#include // must be the last header + +namespace autoboost { +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; + +template +class interface_iarchive +{ +protected: + interface_iarchive(){}; +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + template + const basic_pointer_iserializer * + register_type(T * = NULL){ + const basic_pointer_iserializer & bpis = + autoboost::serialization::singleton< + pointer_iserializer + >::get_const_instance(); + this->This()->register_basic_serializer(bpis.get_basic_serializer()); + return & bpis; + } + template + Archive & operator>>(T & t){ + this->This()->load_override(t, 0); + return * this->This(); + } + + // the & operator + template + Archive & operator&(T & t){ + return *(this->This()) >> t; + } +}; + +} // namespace detail +} // namespace archive +} // namespace autoboost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/detail/interface_oarchive.hpp b/contrib/autoboost/boost/archive/detail/interface_oarchive.hpp new file mode 100644 index 000000000..9689b4a34 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/interface_oarchive.hpp @@ -0,0 +1,84 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 // NULL +#include +#include + +#include +#include +#include // must be the last header + +#include + +namespace autoboost { +namespace archive { +namespace detail { + +class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + +template +class interface_oarchive +{ +protected: + interface_oarchive(){}; +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + template + const basic_pointer_oserializer * + register_type(const T * = NULL){ + const basic_pointer_oserializer & bpos = + autoboost::serialization::singleton< + pointer_oserializer + >::get_const_instance(); + this->This()->register_basic_serializer(bpos.get_basic_serializer()); + return & bpos; + } + + template + Archive & operator<<(T & t){ + this->This()->save_override(t, 0); + return * this->This(); + } + + // the & operator + template + Archive & operator&(T & t){ + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + return * this->This() << const_cast(t); + #else + return * this->This() << t; + #endif + } +}; + +} // namespace detail +} // namespace archive +} // namespace autoboost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/detail/iserializer.hpp b/contrib/autoboost/boost/archive/detail/iserializer.hpp new file mode 100644 index 000000000..63eaaf306 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/iserializer.hpp @@ -0,0 +1,658 @@ +#ifndef BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP +#define BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#pragma inline_depth(511) +#pragma inline_recursion(on) +#endif + +#if defined(__MWERKS__) +#pragma inline_depth(511) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// 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 // for placement new +#include // size_t, NULL + +#include +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#define DONT_USE_HAS_NEW_OPERATOR ( \ + defined(__BORLANDC__) \ + || BOOST_WORKAROUND(__IBMCPP__, < 1210) \ + || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ +) +#if ! DONT_USE_HAS_NEW_OPERATOR +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// the following is need only for dynamic cast of polymorphic pointers +#include +#include +#include +#include +#include +#include + +namespace autoboost { + +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 + 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 iserializer : public basic_iserializer +{ +private: + virtual void destroy(/*const*/ void *address) const { + autoboost::serialization::access::destroy(static_cast(address)); + } +protected: + // protected constructor since it's always created by singleton + explicit iserializer() : + basic_iserializer( + autoboost::serialization::singleton< + typename + autoboost::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 autoboost::serialization::implementation_level< T >::value + >= autoboost::serialization::object_class_info; + } + virtual bool tracking(const unsigned int /* flags */) const { + return autoboost::serialization::tracking_level< T >::value + == autoboost::serialization::track_always + || ( autoboost::serialization::tracking_level< T >::value + == autoboost::serialization::track_selectively + && serialized_as_pointer()); + } + virtual version_type version() const { + return version_type(::autoboost::serialization::version< T >::value); + } + virtual bool is_polymorphic() const { + return autoboost::is_polymorphic< T >::value; + } + virtual ~iserializer(){}; +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template +BOOST_DLLEXPORT void iserializer::load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version +) const { + // note: we now comment this out. Before we permited archive + // version # to be very large. Now we don't. To permit + // readers of these old archives, we have to suppress this + // code. Perhaps in the future we might re-enable it but + // permit its suppression with a runtime switch. + #if 0 + // trap case where the program cannot handle the current version + if(file_version > static_cast(version())) + autoboost::serialization::throw_exception( + archive::archive_exception( + autoboost::archive::archive_exception::unsupported_class_version, + get_debug_info() + ) + ); + #endif + // make sure call is routed through the higest interface that might + // be specialized by the user. + autoboost::serialization::serialize_adl( + autoboost::serialization::smart_cast_reference(ar), + * static_cast(x), + file_version + ); +} + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +// the purpose of this code is to allocate memory for an object +// without requiring the constructor to be called. Presumably +// the allocated object will be subsequently initialized with +// "placement new". +// note: we have the boost type trait has_new_operator but we +// have no corresponding has_delete_operator. So we presume +// that the former being true would imply that the a delete +// operator is also defined for the class T. + +template +struct heap_allocation { + // autoboost::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_new(){ + return static_cast(operator new(sizeof(T))); + } + static void invoke_delete(T *t){ + (operator delete(t)); + } + #else + // note: we presume that a true value for has_new_operator + // implies the existence of a class specific delete operator as well + // as a class specific new operator. + struct has_new_operator { + static T * invoke_new() { + return static_cast((T::operator new)(sizeof(T))); + } + static void invoke_delete(T * t) { + // if compilation fails here, the likely cause that the class + // T has a class specific new operator but no class specific + // delete operator which matches the following signature. Fix + // your program to have this. Note that adding operator delete + // with only one parameter doesn't seem correct to me since + // the standard(3.7.4.2) says " + // "If a class T has a member deallocation function named + // 'operator delete' with exactly one parameter, then that function + // is a usual (non-placement) deallocation function" which I take + // to mean that it will call the destructor of type T which we don't + // want to do here. + // Note: reliance upon automatic conversion from T * to void * here + (T::operator delete)(t, sizeof(T)); + } + }; + struct doesnt_have_new_operator { + static T* invoke_new() { + return static_cast(operator new(sizeof(T))); + } + static void invoke_delete(T * t) { + // Note: I'm reliance upon automatic conversion from T * to void * here + (operator delete)(t); + } + }; + static T * invoke_new() { + typedef typename + mpl::eval_if< + autoboost::has_new_operator< T >, + mpl::identity, + mpl::identity + >::type typex; + return typex::invoke_new(); + } + static void invoke_delete(T *t) { + typedef typename + mpl::eval_if< + autoboost::has_new_operator< T >, + mpl::identity, + mpl::identity + >::type typex; + typex::invoke_delete(t); + } + #endif + explicit heap_allocation(){ + m_p = invoke_new(); + } + ~heap_allocation(){ + if (0 != m_p) + invoke_delete(m_p); + } + T* get() const { + return m_p; + } + + T* release() { + T* p = m_p; + m_p = 0; + return p; + } +private: + T* m_p; +}; + +template +class pointer_iserializer : + public basic_pointer_iserializer +{ +private: + virtual void * heap_allocation() const { + detail::heap_allocation h; + T * t = h.get(); + h.release(); + return t; + } + virtual const basic_iserializer & get_basic_serializer() const { + return autoboost::serialization::singleton< + iserializer + >::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: BOOST_DLLEXPORT is so that code for polymorphic class +// serialized only through base class won't get optimized out +template +BOOST_DLLEXPORT void pointer_iserializer::load_object_ptr( + basic_iarchive & ar, + void * t, + const unsigned int file_version +) const +{ + Archive & ar_impl = + autoboost::serialization::smart_cast_reference(ar); + + // note that the above will throw std::bad_alloc if the allocation + // fails so we don't have to address this contingency here. + + // 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 situation that occurs when + // load_constructor de-serializes something through a pointer. + ar.next_object_pointer(t); + autoboost::serialization::load_construct_data_adl( + ar_impl, + static_cast(t), + file_version + ); + } + BOOST_CATCH(...){ + // if we get here the load_construct failed. The heap_allocation + // will be automatically deleted so we don't have to do anything + // special here. + BOOST_RETHROW; + } + BOOST_CATCH_END + + ar_impl >> autoboost::serialization::make_nvp(NULL, * static_cast(t)); +} + +template +pointer_iserializer::pointer_iserializer() : + basic_pointer_iserializer( + autoboost::serialization::singleton< + typename + autoboost::serialization::type_info_implementation< T >::type + >::get_const_instance() + ) +{ + autoboost::serialization::singleton< + iserializer + >::get_mutable_instance().set_bpis(this); + archive_serializer_map::insert(this); +} + +template +pointer_iserializer::~pointer_iserializer(){ + archive_serializer_map::erase(this); +} + +template +struct load_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct load_primitive { + template + 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 + 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. + autoboost::serialization::serialize_adl( + ar, + const_cast(t), + autoboost::serialization::version< T >::value + ); + } + }; + + // note this save class information including version + // and serialization level to the archive + struct load_standard { + template + static void invoke(Archive &ar, const T & t){ + void * x = & const_cast(t); + ar.load_object( + x, + autoboost::serialization::singleton< + iserializer + >::get_const_instance() + ); + } + }; + + struct load_conditional { + template + 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 + static void invoke(Archive & ar, T &t){ + typedef typename mpl::eval_if< + // if its primitive + mpl::equal_to< + autoboost::serialization::implementation_level< T >, + mpl::int_ + >, + mpl::identity, + // else + typename mpl::eval_if< + // class info / version + mpl::greater_equal< + autoboost::serialization::implementation_level< T >, + mpl::int_ + >, + // do standard load + mpl::identity, + // else + typename mpl::eval_if< + // no tracking + mpl::equal_to< + autoboost::serialization::tracking_level< T >, + mpl::int_ + >, + // do a fast load + mpl::identity, + // else + // do a fast load only tracking is turned off + mpl::identity + > > >::type typex; + check_object_versioning< T >(); + check_object_level< T >(); + typex::invoke(ar, t); + } +}; + +template +struct load_pointer_type { + struct abstract + { + template + static const basic_pointer_iserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(autoboost::is_polymorphic< T >::value); + return static_cast(NULL); + } + }; + + struct non_abstract + { + template + static const basic_pointer_iserializer * register_type(Archive & ar){ + return ar.register_type(static_cast(NULL)); + } + }; + + template + static const basic_pointer_iserializer * register_type(Archive &ar, const 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 typename + mpl::eval_if< + autoboost::serialization::is_abstract, + autoboost::mpl::identity, + autoboost::mpl::identity + >::type typex; + return typex::template register_type< T >(ar); + } + + template + static T * pointer_tweak( + const autoboost::serialization::extended_type_info & eti, + void const * const t, + const T & + ) { + // tweak the pointer back to the base class + void * upcast = const_cast( + autoboost::serialization::void_upcast( + eti, + autoboost::serialization::singleton< + typename + autoboost::serialization::type_info_implementation< T >::type + >::get_const_instance(), + t + ) + ); + if(NULL == upcast) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::unregistered_class) + ); + return static_cast(upcast); + } + + template + static void check_load(T & /* t */){ + check_pointer_level< T >(); + check_pointer_tracking< T >(); + } + + static const basic_pointer_iserializer * + find(const autoboost::serialization::extended_type_info & type){ + return static_cast( + archive_serializer_map::find(type) + ); + } + + template + static void invoke(Archive & ar, Tptr & t){ + check_load(*t); + const basic_pointer_iserializer * bpis_ptr = register_type(ar, *t); + const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer( + // note major hack here !!! + // I tried every way to convert Tptr &t (where Tptr might + // include const) to void * &. This is the only way + // I could make it work. RR + (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 +struct load_enum_type { + template + static void invoke(Archive &ar, T &t){ + // convert integers to correct enum to load + int i; + ar >> autoboost::serialization::make_nvp(NULL, i); + t = static_cast< T >(i); + } +}; + +template +struct load_array_type { + template + static void invoke(Archive &ar, T &t){ + typedef 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(static_cast(&t[1])) + - static_cast(static_cast(&t[0])) + ); + autoboost::serialization::collection_size_type count; + ar >> BOOST_SERIALIZATION_NVP(count); + if(static_cast(count) > current_count) + autoboost::serialization::throw_exception( + archive::archive_exception( + autoboost::archive::archive_exception::array_size_too_short + ) + ); + ar >> serialization::make_array(static_cast(&t[0]),count); + } +}; + +} // detail + +template +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 + typename mpl::eval_if, + mpl::identity > + ,//else + typename mpl::eval_if, + mpl::identity > + ,//else + typename mpl::eval_if, + mpl::identity > + ,//else + mpl::identity > + > + > + >::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 +inline void load(Archive &ar, const T & t){ + load(ar, const_cast(t)); +} +#endif + +// let wrappers through. +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +template +inline void load_wrapper(Archive &ar, const T&t, mpl::true_){ + autoboost::archive::load(ar, const_cast(t)); +} + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560)) +template +inline void load(Archive &ar, const T&t){ + load_wrapper(ar,t,serialization::is_wrapper< T >()); +} +#endif +#endif + +#endif + +} // namespace archive +} // namespace autoboost + +#endif // BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP diff --git a/contrib/autoboost/boost/archive/detail/oserializer.hpp b/contrib/autoboost/boost/archive/detail/oserializer.hpp new file mode 100644 index 000000000..23aca6d84 --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include // NULL + +#include +#include +#include + +#include +#include +#include +#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace autoboost { + +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 + static void end_preamble(Archive & ar){ + ar.end_preamble(); + } + template + 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 oserializer : public basic_oserializer +{ +private: + // private constructor to inhibit any existence other than the + // static one +public: + explicit BOOST_DLLEXPORT oserializer() : + basic_oserializer( + autoboost::serialization::singleton< + typename + autoboost::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 autoboost::serialization::implementation_level< T >::value + >= autoboost::serialization::object_class_info; + } + virtual bool tracking(const unsigned int /* flags */) const { + return autoboost::serialization::tracking_level< T >::value == autoboost::serialization::track_always + || (autoboost::serialization::tracking_level< T >::value == autoboost::serialization::track_selectively + && serialized_as_pointer()); + } + virtual version_type version() const { + return version_type(::autoboost::serialization::version< T >::value); + } + virtual bool is_polymorphic() const { + return autoboost::is_polymorphic< T >::value; + } + virtual ~oserializer(){} +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template +BOOST_DLLEXPORT void oserializer::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(autoboost::is_const< T >::value == false); + autoboost::serialization::serialize_adl( + autoboost::serialization::smart_cast_reference(ar), + * static_cast(const_cast(x)), + version() + ); +} + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template +class pointer_oserializer : + public basic_pointer_oserializer +{ +private: + const basic_oserializer & + get_basic_serializer() const { + return autoboost::serialization::singleton< + oserializer + >::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 +BOOST_DLLEXPORT void pointer_oserializer::save_object_ptr( + basic_oarchive & ar, + const void * x +) const { + BOOST_ASSERT(NULL != x); + // make sure call is routed through the highest interface that might + // be specialized by the user. + T * t = static_cast(const_cast(x)); + const unsigned int file_version = autoboost::serialization::version< T >::value; + Archive & ar_impl + = autoboost::serialization::smart_cast_reference(ar); + autoboost::serialization::save_construct_data_adl( + ar_impl, + t, + file_version + ); + ar_impl << autoboost::serialization::make_nvp(NULL, * t); +} + +template +pointer_oserializer::pointer_oserializer() : + basic_pointer_oserializer( + autoboost::serialization::singleton< + typename + autoboost::serialization::type_info_implementation< T >::type + >::get_const_instance() + ) +{ + // make sure appropriate member function is instantiated + autoboost::serialization::singleton< + oserializer + >::get_mutable_instance().set_bpos(this); + archive_serializer_map::insert(this); +} + +template +pointer_oserializer::~pointer_oserializer(){ + archive_serializer_map::erase(this); +} + +template +struct save_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct save_primitive { + template + 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 + static void invoke(Archive & ar, const T & t){ + // make sure call is routed through the highest interface that might + // be specialized by the user. + autoboost::serialization::serialize_adl( + ar, + const_cast(t), + ::autoboost::serialization::version< T >::value + ); + } + }; + // adds class information to the archive. This includes + // serialization level and class version + struct save_standard { + template + static void invoke(Archive &ar, const T & t){ + ar.save_object( + & t, + autoboost::serialization::singleton< + oserializer + >::get_const_instance() + ); + } + }; + + // adds class information to the archive. This includes + // serialization level and class version + struct save_conditional { + template + 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 + static void invoke(Archive & ar, const T & t){ + typedef + typename mpl::eval_if< + // if its primitive + mpl::equal_to< + autoboost::serialization::implementation_level< T >, + mpl::int_ + >, + mpl::identity, + // else + typename mpl::eval_if< + // class info / version + mpl::greater_equal< + autoboost::serialization::implementation_level< T >, + mpl::int_ + >, + // do standard save + mpl::identity, + // else + typename mpl::eval_if< + // no tracking + mpl::equal_to< + autoboost::serialization::tracking_level< T >, + mpl::int_ + >, + // do a fast save + mpl::identity, + // else + // do a fast save only tracking is turned off + mpl::identity + > > >::type typex; + check_object_versioning< T >(); + typex::invoke(ar, t); + } + template + static void invoke(Archive & ar, T & t){ + check_object_level< T >(); + check_object_tracking< T >(); + invoke(ar, const_cast(t)); + } +}; + +template +struct save_pointer_type { + struct abstract + { + template + static const basic_pointer_oserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(autoboost::is_polymorphic< T >::value); + return NULL; + } + }; + + struct non_abstract + { + template + static const basic_pointer_oserializer * register_type(Archive & ar){ + return ar.register_type(static_cast(NULL)); + } + }; + + template + 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 + typename mpl::eval_if< + autoboost::serialization::is_abstract< T >, + mpl::identity, + mpl::identity + >::type typex; + return typex::template register_type< T >(ar); + } + + struct non_polymorphic + { + template + static void save( + Archive &ar, + T & t + ){ + const basic_pointer_oserializer & bpos = + autoboost::serialization::singleton< + pointer_oserializer + >::get_const_instance(); + // save the requested pointer type + ar.save_pointer(& t, & bpos); + } + }; + + struct polymorphic + { + template + static void save( + Archive &ar, + T & t + ){ + typename + autoboost::serialization::type_info_implementation< T >::type const + & i = autoboost::serialization::singleton< + typename + autoboost::serialization::type_info_implementation< T >::type + >::get_const_instance(); + + autoboost::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 + BOOST_ASSERT(NULL != this_type); + + const autoboost::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){ + autoboost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + "derived class not registered or exported" + ) + ); + } + + // if its not a pointer to a more derived type + const void *vp = static_cast(&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(&t) + ); + if(NULL == vp){ + autoboost::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( + autoboost::serialization::singleton< + archive_serializer_map + >::get_const_instance().find(*true_type) + ); + BOOST_ASSERT(NULL != bpos); + if(NULL == bpos) + autoboost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + "derived class not registered or exported" + ) + ); + ar.save_pointer(vp, bpos); + } + }; + + template + static void save( + Archive & ar, + const T & t + ){ + check_pointer_level< T >(); + check_pointer_tracking< T >(); + typedef typename mpl::eval_if< + is_polymorphic< T >, + mpl::identity, + mpl::identity + >::type type; + type::save(ar, const_cast(t)); + } + + template + static void invoke(Archive &ar, const TPtr t){ + register_type(ar, * t); + if(NULL == t){ + basic_oarchive & boa + = autoboost::serialization::smart_cast_reference(ar); + boa.save_null_pointer(); + save_access::end_preamble(ar); + return; + } + save(ar, * t); + } +}; + +template +struct save_enum_type +{ + template + static void invoke(Archive &ar, const T &t){ + // convert enum to integers on save + const int i = static_cast(t); + ar << autoboost::serialization::make_nvp(NULL, i); + } +}; + +template +struct save_array_type +{ + template + static void invoke(Archive &ar, const T &t){ + typedef typename autoboost::remove_extent< T >::type value_type; + + save_access::end_preamble(ar); + // consider alignment + std::size_t c = sizeof(t) / ( + static_cast(static_cast(&t[1])) + - static_cast(static_cast(&t[0])) + ); + autoboost::serialization::collection_size_type count(c); + ar << BOOST_SERIALIZATION_NVP(count); + ar << serialization::make_array(static_cast(&t[0]),count); + } +}; + +} // detail + +template +inline void save(Archive & ar, /*const*/ T &t){ + typedef + typename mpl::eval_if, + mpl::identity >, + //else + typename mpl::eval_if, + mpl::identity >, + //else + typename mpl::eval_if, + mpl::identity >, + //else + mpl::identity > + > + > + >::type typex; + typex::invoke(ar, t); +} + +} // namespace archive +} // namespace autoboost + +#endif // BOOST_ARCHIVE_OSERIALIZER_HPP diff --git a/contrib/autoboost/boost/archive/detail/register_archive.hpp b/contrib/autoboost/boost/archive/detail/register_archive.hpp new file mode 100644 index 000000000..b9ab80483 --- /dev/null +++ b/contrib/autoboost/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 autoboost { 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 +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 +struct _ptr_serialization_support + : ptr_serialization_support +{ + typedef int type; +}; + +#ifdef __SUNPRO_CC + +template +struct counter : counter {}; +template<> +struct counter<0> {}; + +template +void instantiate_ptr_serialization(Serializable* s, int, adl_tag) { + instantiate_ptr_serialization(s, counter<20>()); +} + +template +struct get_counter { + static const int value = sizeof(adjust_counter(counter<20>())); + typedef counter type; + typedef counter prior; + typedef char (&next)[value+1]; +}; + +char adjust_counter(counter<0>); +template +void instantiate_ptr_serialization(Serializable*, counter<0>) {} + +#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ +namespace autoboost { namespace archive { namespace detail { \ + get_counter::next adjust_counter(get_counter::type);\ + template \ + void instantiate_ptr_serialization(Serializable* s, \ + get_counter::type) { \ + ptr_serialization_support x; \ + instantiate_ptr_serialization(s, get_counter::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 +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 autoboost { namespace archive { namespace detail { \ + \ +template \ +typename _ptr_serialization_support::type \ +instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \ + \ +}}} +#endif +}}} // namespace autoboost::archive::detail + +#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP diff --git a/contrib/autoboost/boost/archive/detail/utf8_codecvt_facet.hpp b/contrib/autoboost/boost/archive/detail/utf8_codecvt_facet.hpp new file mode 100644 index 000000000..9697e4b08 --- /dev/null +++ b/contrib/autoboost/boost/archive/detail/utf8_codecvt_facet.hpp @@ -0,0 +1,23 @@ +// 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 + +#ifdef BOOST_NO_CXX11_HDR_CODECVT + #define BOOST_UTF8_BEGIN_NAMESPACE \ + namespace autoboost { namespace archive { namespace detail { + #define BOOST_UTF8_DECL + #define BOOST_UTF8_END_NAMESPACE }}} + + #include + + #undef BOOST_UTF8_END_NAMESPACE + #undef BOOST_UTF8_DECL + #undef BOOST_UTF8_BEGIN_NAMESPACE +#endif // BOOST_NO_CXX11_HDR_CODECVT +#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP + diff --git a/contrib/autoboost/boost/archive/dinkumware.hpp b/contrib/autoboost/boost/archive/dinkumware.hpp new file mode 100644 index 000000000..e8ec2413a --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include + +#include +#include + +namespace std { + +// define i/o operators for 64 bit integers +template +basic_ostream & +operator<<(basic_ostream & os, autoboost::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 +basic_ostream & +operator<<(basic_ostream &os, autoboost::int64_t t){ + if(0 <= t){ + os << static_cast(t); + } + else{ + os.put('-'); + os << -t; + } + return os; +} + +template +basic_istream & +operator>>(basic_istream &is, autoboost::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 +basic_istream & +operator>>(basic_istream &is, autoboost::uint64_t & t){ + autoboost::int64_t it; + is >> it; + t = it; + return is; +} + +//#endif + +template<> +class back_insert_iterator > : public + iterator +{ +public: + typedef basic_string container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator & operator*(){ + return (*this); + } + + back_insert_iterator & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template +inline back_insert_iterator > back_inserter( + basic_string & s +){ + return (std::back_insert_iterator >(s)); +} + +template<> +class back_insert_iterator > : public + iterator +{ +public: + typedef basic_string container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator & operator*(){ + return (*this); + } + + back_insert_iterator & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template +inline back_insert_iterator > back_inserter( + basic_string & s +){ + return (std::back_insert_iterator >(s)); +} + +} // namespace std + +#endif //BOOST_ARCHIVE_DINKUMWARE_HPP diff --git a/contrib/autoboost/boost/archive/impl/archive_serializer_map.ipp b/contrib/autoboost/boost/archive/impl/archive_serializer_map.ipp new file mode 100644 index 000000000..5b719a7e6 --- /dev/null +++ b/contrib/autoboost/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 +#include +#include +#include + +namespace autoboost { +namespace archive { +namespace detail { + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace extra_detail { // anon + template + class map : public basic_serializer_map + {}; +} + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(bool) +archive_serializer_map::insert(const basic_serializer * bs){ + return autoboost::serialization::singleton< + extra_detail::map + >::get_mutable_instance().insert(bs); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +archive_serializer_map::erase(const basic_serializer * bs){ + if(autoboost::serialization::singleton< + extra_detail::map + >::is_destroyed()) + return; + autoboost::serialization::singleton< + extra_detail::map + >::get_mutable_instance().erase(bs); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_serializer *) +archive_serializer_map::find( + const autoboost::serialization::extended_type_info & eti +) { + return autoboost::serialization::singleton< + extra_detail::map + >::get_const_instance().find(eti); +} + +} // namespace detail +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_binary_iarchive.ipp b/contrib/autoboost/boost/archive/impl/basic_binary_iarchive.ipp new file mode 100644 index 000000000..2e4cdc897 --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/basic_binary_iarchive.ipp @@ -0,0 +1,133 @@ +/////////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 +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; + using ::strlen; + using ::size_t; +} +#endif + +#include +#include + +#include + +namespace autoboost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_archive +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iarchive::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)) + autoboost::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iarchive::init(){ + // read signature in an archive version independent manner + std::string file_signature; + + #if 0 // commented out since it interfers with derivation + try { + std::size_t l; + this->This()->load(l); + if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) { + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != file_signature.data()) + #endif + file_signature.resize(l); + // note breaking a rule here - could be a problem on some platform + if(0 < l) + this->This()->load_binary(&(*file_signature.begin()), l); + } + } + catch(archive_exception const &) { // catch stream_error archive exceptions + // will cause invalid_signature archive exception to be thrown below + file_signature = ""; + } + #else + // https://svn.boost.org/trac/boost/ticket/7301 + * this->This() >> file_signature; + #endif + + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + autoboost::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 + library_version_type input_library_version; + //* this->This() >> input_library_version; + { + int v = 0; + v = this->This()->m_sb.sbumpc(); + #if defined(BOOST_LITTLE_ENDIAN) + if(v < 6){ + ; + } + else + if(v < 7){ + // version 6 - next byte should be zero + this->This()->m_sb.sbumpc(); + } + else + if(v < 8){ + int x1; + // version 7 = might be followed by zero or some other byte + x1 = this->This()->m_sb.sgetc(); + // it's =a zero, push it back + if(0 == x1) + this->This()->m_sb.sbumpc(); + } + else{ + // version 8+ followed by a zero + this->This()->m_sb.sbumpc(); + } + #elif defined(BOOST_BIG_ENDIAN) + if(v == 0) + v = this->This()->m_sb.sbumpc(); + #endif + input_library_version = static_cast(v); + } + + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->set_library_version(input_library_version); + #else + detail::basic_iarchive::set_library_version(input_library_version); + #endif + + if(BOOST_ARCHIVE_VERSION() < input_library_version) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_binary_iprimitive.ipp b/contrib/autoboost/boost/archive/impl/basic_binary_iprimitive.ipp new file mode 100644 index 000000000..4715e95c3 --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/basic_binary_iprimitive.ipp @@ -0,0 +1,210 @@ +/////////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 +#include // size_t, NULL +#include // memcpy + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + using ::memcpy; +} // namespace std +#endif + +#include // fixup for RogueWave + +#include +#include + +#include +#include +#include +#include + +namespace autoboost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_iprimitive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::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) + autoboost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of int" + ) + ); + this->This()->load(size); + if(sizeof(long) != size) + autoboost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of long" + ) + ); + this->This()->load(size); + if(sizeof(float) != size) + autoboost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of float" + ) + ); + this->This()->load(size); + if(sizeof(double) != size) + autoboost::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) + autoboost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "endian setting" + ) + ); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_iprimitive::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(ws.data()), l * sizeof(wchar_t) / sizeof(char)); +} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_iprimitive::basic_binary_iprimitive( + std::basic_streambuf & 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( + autoboost::archive::add_facet( + std::locale::classic(), + new codecvt_null + ) + ); + 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 input_streambuf_access : public std::basic_streambuf { + public: + virtual int sync(){ +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + return this->basic_streambuf::sync(); +#else + return this->basic_streambuf::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_iprimitive::~basic_binary_iprimitive(){ + // push back unread characters + //destructor can't throw ! + try{ + static_cast &>(m_sb).sync(); + } + catch(...){ + } +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_binary_oarchive.ipp b/contrib/autoboost/boost/archive/impl/basic_binary_oarchive.ipp new file mode 100644 index 000000000..62ba82cba --- /dev/null +++ b/contrib/autoboost/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 +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +namespace autoboost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_oarchive + +template +#if !defined(__BORLANDC__) +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +#else +void +#endif +basic_binary_oarchive::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 library_version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_binary_oprimitive.ipp b/contrib/autoboost/boost/archive/impl/basic_binary_oprimitive.ipp new file mode 100644 index 000000000..976aac419 --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/basic_binary_oprimitive.ipp @@ -0,0 +1,161 @@ +/////////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 +#include // NULL +#include + +#include + +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include + +#include +#include +#include + +namespace autoboost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_oprimitive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::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(sizeof(int))); + this->This()->save(static_cast(sizeof(long))); + this->This()->save(static_cast(sizeof(float))); + this->This()->save(static_cast(sizeof(double))); + // for checking endianness + this->This()->save(int(1)); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::save(const char * s) +{ + std::size_t l = std::strlen(s); + this->This()->save(l); + save_binary(s, l); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::save(const std::string &s) +{ + std::size_t l = static_cast(s.size()); + this->This()->save(l); + save_binary(s.data(), l); +} + +#ifndef BOOST_NO_CWCHAR +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::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)); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_binary_oprimitive::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 + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_oprimitive::basic_binary_oprimitive( + std::basic_streambuf & 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 + ) + ); + 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 output_streambuf_access : public std::basic_streambuf { + public: + virtual int sync(){ +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) + return this->basic_streambuf::sync(); +#else + return this->basic_streambuf::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_binary_oprimitive::~basic_binary_oprimitive(){ + // flush buffer + //destructor can't throw + try{ + static_cast &>(m_sb).sync(); + } + catch(...){ + } +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_text_iarchive.ipp b/contrib/autoboost/boost/archive/impl/basic_text_iarchive.ipp new file mode 100644 index 000000000..ecafd55a6 --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/basic_text_iarchive.ipp @@ -0,0 +1,76 @@ +/////////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 +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include +#include +#include + +namespace autoboost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of text_text_archive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iarchive::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)) + autoboost::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iarchive::init(void){ + // read signature in an archive version independent manner + std::string file_signature; + * this->This() >> file_signature; + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + autoboost::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 + library_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 + detail::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) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_text_iprimitive.ipp b/contrib/autoboost/boost/archive/impl/basic_text_iprimitive.ipp new file mode 100644 index 000000000..439114c0b --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/basic_text_iprimitive.ipp @@ -0,0 +1,152 @@ +/////////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 // size_t +#include // NULL + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace autoboost { +namespace archive { + +namespace detail { + template + static inline bool is_whitespace(CharType c); + + template<> + inline bool is_whitespace(char t){ + return 0 != std::isspace(t); + } + + #ifndef BOOST_NO_CWCHAR + template<> + inline bool is_whitespace(wchar_t t){ + return 0 != std::iswspace(t); + } + #endif +} // detail + +// translate base64 text into binary and copy into buffer +// until buffer is full. +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_iprimitive::load_binary( + void *address, + std::size_t count +){ + typedef typename IStream::char_type CharType; + + if(0 == count) + return; + + BOOST_ASSERT( + static_cast((std::numeric_limits::max)()) + > (count + sizeof(CharType) - 1)/sizeof(CharType) + ); + + if(is.fail()) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + // convert from base64 to binary + typedef typename + iterators::transform_width< + iterators::binary_from_base64< + iterators::remove_whitespace< + iterators::istream_iterator + > + ,CharType + > + ,8 + ,6 + ,CharType + > + binary; + + binary i = binary( + BOOST_MAKE_PFTO_WRAPPER( + iterators::istream_iterator(is) + ) + ); + + char * caddr = static_cast(address); + + // take care that we don't increment anymore than necessary + while(count-- > 0){ + *caddr++ = static_cast(*i++); + } + + // skip over any excess input + for(;;){ + typename IStream::int_type r; + r = is.get(); + if(is.eof()) + break; + if(detail::is_whitespace(static_cast(r))) + break; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_iprimitive::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 + ) + ); + is.imbue(* archive_locale); + } + is >> std::noboolalpha; +} +#else + is(is_), + flags_saver(is_), + precision_saver(is_) +{} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_iprimitive::~basic_text_iprimitive(){ + is.sync(); +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_text_oarchive.ipp b/contrib/autoboost/boost/archive/impl/basic_text_oarchive.ipp new file mode 100644 index 000000000..378b9e6b6 --- /dev/null +++ b/contrib/autoboost/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 +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +namespace autoboost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of basic_text_oarchive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oarchive::newtoken() +{ + switch(delimiter){ + default: + BOOST_ASSERT(false); + break; + case eol: + this->This()->put('\n'); + delimiter = space; + break; + case space: + this->This()->put(' '); + break; + case none: + delimiter = space; + break; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oarchive::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 library_version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_text_oprimitive.ipp b/contrib/autoboost/boost/archive/impl/basic_text_oprimitive.ipp new file mode 100644 index 000000000..7a4f0d3da --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/basic_text_oprimitive.ipp @@ -0,0 +1,115 @@ +/////////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 // NULL +#include // std::copy +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace autoboost { +namespace archive { + +// translate to base64 and copy in to buffer. +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_text_oprimitive::save_binary( + const void *address, + std::size_t count +){ + typedef typename OStream::char_type CharType; + + if(0 == count) + return; + + if(os.fail()) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + + os.put('\n'); + + typedef + autoboost::archive::iterators::insert_linebreaks< + autoboost::archive::iterators::base64_from_binary< + autoboost::archive::iterators::transform_width< + const char *, + 6, + 8 + > + > + ,76 + ,const char // cwpro8 needs this + > + base64_text; + + autoboost::archive::iterators::ostream_iterator oi(os); + std::copy( + base64_text(BOOST_MAKE_PFTO_WRAPPER(static_cast(address))), + base64_text( + BOOST_MAKE_PFTO_WRAPPER(static_cast(address) + count) + ), + oi + ); + + std::size_t tail = count % 3; + if(tail > 0){ + *oi++ = '='; + if(tail < 2) + *oi = '='; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_oprimitive::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 + ) + ); + os.imbue(* archive_locale); + } + os << std::noboolalpha; +} +#else + os(os_), + flags_saver(os_), + precision_saver(os_) +{} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_text_oprimitive::~basic_text_oprimitive(){ + os << std::endl; +} + +} //namespace autoboost +} //namespace archive diff --git a/contrib/autoboost/boost/archive/impl/basic_xml_grammar.hpp b/contrib/autoboost/boost/archive/impl/basic_xml_grammar.hpp new file mode 100644 index 000000000..754717b3e --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/basic_xml_grammar.hpp @@ -0,0 +1,173 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP +#define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include + +#include +#include + +#include +#include +#include + +namespace autoboost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// XML grammar parsing + +template +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 IStream; + typedef BOOST_DEDUCED_TYPENAME std::basic_string StringType; + typedef BOOST_DEDUCED_TYPENAME autoboost::spirit::classic::chset chset_t; + typedef BOOST_DEDUCED_TYPENAME autoboost::spirit::classic::chlit chlit_t; + typedef BOOST_DEDUCED_TYPENAME autoboost::spirit::classic::scanner< + BOOST_DEDUCED_TYPENAME std::basic_string::iterator + > scanner_t; + typedef BOOST_DEDUCED_TYPENAME autoboost::spirit::classic::rule 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; + int_least16_t class_id; + //object_id_type object_id; + uint_least32_t object_id; + //version_type version; + unsigned int 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 autoboost + +#endif // BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP diff --git a/contrib/autoboost/boost/archive/impl/basic_xml_iarchive.ipp b/contrib/autoboost/boost/archive/impl/basic_xml_iarchive.ipp new file mode 100644 index 000000000..9949cf167 --- /dev/null +++ b/contrib/autoboost/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 +#include // NULL +#include + +#include +#include +#include +#include + +namespace autoboost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of xml_text_archive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::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){ + autoboost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + } + // don't check start tag at highest level + ++depth; + return; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::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){ + autoboost::serialization::throw_exception( + archive_exception(archive_exception::input_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 + ) + ){ + autoboost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_tag_mismatch, + name + ) + ); + } + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(object_id_type & t, int){ + t = object_id_type(this->This()->gimpl->rv.object_id); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(version_type & t, int){ + t = version_type(this->This()->gimpl->rv.version); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(class_id_type & t, int){ + t = class_id_type(this->This()->gimpl->rv.class_id); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_iarchive::load_override(tracking_type & t, int){ + t = this->This()->gimpl->rv.tracking_level; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_iarchive::basic_xml_iarchive(unsigned int flags) : + detail::common_iarchive(flags), + depth(0) +{} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_iarchive::~basic_xml_iarchive(){} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/basic_xml_oarchive.ipp b/contrib/autoboost/boost/archive/impl/basic_xml_oarchive.ipp new file mode 100644 index 000000000..f76ac5494 --- /dev/null +++ b/contrib/autoboost/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 +#include // NULL +#include +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include +#include +#include +#include + +namespace autoboost { +namespace archive { + +namespace detail { +template +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]) + autoboost::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::indent(){ + int i; + for(i = depth; i-- > 0;) + this->This()->put('\t'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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()); + + 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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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()); + + end_preamble(); + --depth; + if(indent_next){ + this->This()->put('\n'); + indent(); + } + indent_next = true; + this->This()->put("This()->save(name); + this->This()->put('>'); + if(0 == depth) + this->This()->put('\n'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::end_preamble(){ + if(pending_preamble){ + this->This()->put('>'); + pending_preamble = false; + } +} +#if 0 +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const version_type & t, int) +{ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_VERSION(), i); +} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override( + const object_reference_type & t, + int +){ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const version_type & t, int) +{ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_VERSION(), i); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const class_id_type & t, int) +{ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override( + const class_id_reference_type & t, + int +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override( + const class_id_optional_type & t, + int +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::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 +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::save_override(const tracking_type & t, int) +{ + write_attribute(BOOST_ARCHIVE_XML_TRACKING(), t.t); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(void) +basic_xml_oarchive::init(){ + // xml header + this->This()->put("\n"); + this->This()->put("\n"); + // xml document wrapper - outer root + this->This()->put("This()->put(">\n"); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_oarchive::basic_xml_oarchive(unsigned int flags) : + detail::common_oarchive(flags), + depth(0), + indent_next(false), + pending_preamble(false) +{ +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) +basic_xml_oarchive::~basic_xml_oarchive(){ + if(0 == (this->get_flags() & no_header)){ + BOOST_TRY{ + this->This()->put("\n"); + } + BOOST_CATCH(...){} + BOOST_CATCH_END + } +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/text_iarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/text_iarchive_impl.ipp new file mode 100644 index 000000000..bba087034 --- /dev/null +++ b/contrib/autoboost/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 // size_t, NULL +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include // RogueWave + +#include + +namespace autoboost { +namespace archive { + +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::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 +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::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 +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::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 +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::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 +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::load_override(class_name_type & t, int){ + basic_text_iarchive::load_override(t, 0); +} + +template +BOOST_ARCHIVE_DECL(void) +text_iarchive_impl::init(){ + basic_text_iarchive::init(); +} + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +text_iarchive_impl::text_iarchive_impl( + std::istream & is, + unsigned int flags +) : + basic_text_iprimitive( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive(flags) +{ + if(0 == (flags & no_header)) + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->init(); + #else + this->basic_text_iarchive::init(); + #endif +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/text_oarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/text_oarchive_impl.ipp new file mode 100644 index 000000000..b48cf8ea4 --- /dev/null +++ b/contrib/autoboost/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 +#include +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include +#include + +namespace autoboost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_oprimitive overrides for the combination +// of template parameters used to create a text_oprimitive + +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::save(const char * s) +{ + const std::size_t len = std::ostream::traits_type::length(s); + *this->This() << len; + this->This()->newtoken(); + os << s; +} + +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::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 +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::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 +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::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 +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +text_oarchive_impl::text_oarchive_impl( + std::ostream & os, + unsigned int flags +) : + basic_text_oprimitive( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive(flags) +{ + if(0 == (flags & no_header)) + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->init(); + #else + this->basic_text_oarchive::init(); + #endif +} + +template +BOOST_ARCHIVE_DECL(void) +text_oarchive_impl::save_binary(const void *address, std::size_t count){ + put('\n'); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->delimiter = this->eol; +} + +} // namespace archive +} // namespace autoboost + diff --git a/contrib/autoboost/boost/archive/impl/text_wiarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/text_wiarchive_impl.ipp new file mode 100644 index 000000000..fa77f8a88 --- /dev/null +++ b/contrib/autoboost/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 // size_t, NULL + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include // fixup for RogueWave + +#ifndef BOOST_NO_STD_WSTREAMBUF +#include + +namespace autoboost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of wiprimtives functions +// +template +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::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 +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::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 +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::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 +BOOST_WARCHIVE_DECL(void) +text_wiarchive_impl::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(ws.data()), size); +} +#endif + +template +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +text_wiarchive_impl::text_wiarchive_impl( + std::wistream & is, + unsigned int flags +) : + basic_text_iprimitive( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive(flags) +{ + if(0 == (flags & no_header)) + basic_text_iarchive::init(); +} + +} // archive +} // boost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/contrib/autoboost/boost/archive/impl/text_woarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/text_woarchive_impl.ipp new file mode 100644 index 000000000..fadce910b --- /dev/null +++ b/contrib/autoboost/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 +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; + using ::size_t; +} // namespace std +#endif + +#include + +#include + +namespace autoboost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of woarchive functions +// +template +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::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 +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::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 +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::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 +BOOST_WARCHIVE_DECL(void) +text_woarchive_impl::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 autoboost + +#endif + diff --git a/contrib/autoboost/boost/archive/impl/xml_iarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/xml_iarchive_impl.ipp new file mode 100644 index 000000000..bec6cf568 --- /dev/null +++ b/contrib/autoboost/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 +#include // memcpy +#include // NULL +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include // mbtowc +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mbtowc; + } // namespace std +#endif +#endif // BOOST_NO_CWCHAR + +#include // RogueWave and Dinkumware +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include + +#include +#include +#include +#include + +#include "basic_xml_grammar.hpp" + +namespace autoboost { +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 +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(std::wstring &ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + autoboost::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; + } + autoboost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + } +} +#endif // BOOST_NO_STD_WSTRING + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(wchar_t * ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + autoboost::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 length = std::mbtowc(&wc, start, end - start); + if(0 < length){ + start += length; + *ws++ = wc; + continue; + } + autoboost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + } + *ws = L'\0'; +} +#endif // BOOST_NO_INTRINSIC_WCHAR_T + +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(std::string &s){ + bool result = gimpl->parse_string(is, s); + if(! result) + autoboost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} + +template +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load(char * s){ + std::string tstring; + bool result = gimpl->parse_string(is, tstring); + if(! result) + autoboost::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 +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::load_override(class_name_type & t, int){ + const std::string & s = gimpl->rv.class_name; + if(s.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + autoboost::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 +BOOST_ARCHIVE_DECL(void) +xml_iarchive_impl::init(){ + gimpl->init(is); + this->set_library_version( + library_version_type(gimpl->rv.version) + ); +} + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_iarchive_impl::xml_iarchive_impl( + std::istream &is_, + unsigned int flags +) : + basic_text_iprimitive( + is_, + 0 != (flags & no_codecvt) + ), + basic_xml_iarchive(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 +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_iarchive_impl::~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 autoboost diff --git a/contrib/autoboost/boost/archive/impl/xml_oarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/xml_oarchive_impl.ipp new file mode 100644 index 000000000..8ad788643 --- /dev/null +++ b/contrib/autoboost/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 +#include +#include // std::copy +#include + +#include // strlen +#include // msvc 6.0 needs this to suppress warnings +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include +#include + +#ifndef BOOST_NO_CWCHAR +#include +#include +#endif + +namespace autoboost { +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 +void save_iterator(std::ostream &os, InputIterator begin, InputIterator end){ + typedef autoboost::archive::iterators::mb_from_wchar< + autoboost::archive::iterators::xml_escape + > translator; + std::copy( + translator(BOOST_MAKE_PFTO_WRAPPER(begin)), + translator(BOOST_MAKE_PFTO_WRAPPER(end)), + autoboost::archive::iterators::ostream_iterator(os) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::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 +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::save(const wchar_t * ws){ + save_iterator(os, ws, ws + std::wcslen(ws)); +} +#endif + +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::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 autoboost::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())), + autoboost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_ARCHIVE_DECL(void) +xml_oarchive_impl::save(const char * s){ + typedef autoboost::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))), + autoboost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_oarchive_impl::xml_oarchive_impl( + std::ostream & os_, + unsigned int flags +) : + basic_text_oprimitive( + os_, + 0 != (flags & no_codecvt) + ), + basic_xml_oarchive(flags) +{ + if(0 == (flags & no_header)) + this->init(); +} + +} // namespace archive +} // namespace autoboost diff --git a/contrib/autoboost/boost/archive/impl/xml_wiarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/xml_wiarchive_impl.ipp new file mode 100644 index 000000000..73440a41b --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/xml_wiarchive_impl.ipp @@ -0,0 +1,211 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_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 +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} //std +#endif + +#include // msvc 6.0 needs this to suppress warnings +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include // std::copy + +#include // Dinkumware and RogueWave +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include +#include +#include + +#include +#include +#ifndef BOOST_NO_CXX11_HDR_CODECVT + #include + namespace autoboost { namespace archive { namespace detail { + typedef std::codecvt_utf8 utf8_codecvt_facet; + } } } +#else + #include +#endif + +#include +#include + +#include +#include + +#include "basic_xml_grammar.hpp" + +namespace autoboost { +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( + BOOST_MAKE_PFTO_WRAPPER(ws.begin()) + ), + iterators::mb_from_wchar( + BOOST_MAKE_PFTO_WRAPPER(ws.end()) + ), + s + ); + s[ws.size()] = 0; +} + +} // anonymous + +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(std::string & s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + autoboost::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( + BOOST_MAKE_PFTO_WRAPPER(ws.begin()) + ), + iterators::mb_from_wchar( + BOOST_MAKE_PFTO_WRAPPER(ws.end()) + ), + std::back_inserter(s) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(std::wstring & ws){ + bool result = gimpl->parse_string(is, ws); + if(! result) + autoboost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} +#endif + +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(char * s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + autoboost::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 +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load(wchar_t * ws){ + std::wstring twstring; + bool result = gimpl->parse_string(is, twstring); + if(! result) + autoboost::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 +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::load_override(class_name_type & t, int){ + const std::wstring & ws = gimpl->rv.class_name; + if(ws.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + autoboost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + copy_to_ptr(t, ws); +} + +template +BOOST_WARCHIVE_DECL(void) +xml_wiarchive_impl::init(){ + gimpl->init(is); + this->set_library_version( + library_version_type(gimpl->rv.version) + ); +} + +template +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_wiarchive_impl::xml_wiarchive_impl( + std::wistream &is_, + unsigned int flags +) : + basic_text_iprimitive( + is_, + true // don't change the codecvt - use the one below + ), + basic_xml_iarchive(flags), + gimpl(new xml_wgrammar()) +{ + if(0 == (flags & no_codecvt)){ + archive_locale.reset( + add_facet( + is_.getloc(), + new autoboost::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 +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_wiarchive_impl::~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 autoboost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/contrib/autoboost/boost/archive/impl/xml_woarchive_impl.ipp b/contrib/autoboost/boost/archive/impl/xml_woarchive_impl.ipp new file mode 100644 index 000000000..10e6ff098 --- /dev/null +++ b/contrib/autoboost/boost/archive/impl/xml_woarchive_impl.ipp @@ -0,0 +1,167 @@ +/////////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 +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include +#include // std::copy +#include + +#include // strlen +#include // mbtowc +#include // wcslen + +#include +#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 +#include + +#include +#include +#include +#include + +#include +#ifndef BOOST_NO_CXX11_HDR_CODECVT + #include + namespace autoboost { namespace archive { namespace detail { + typedef std::codecvt_utf8 utf8_codecvt_facet; + } } } +#else + #include +#endif + +namespace autoboost { +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 +void save_iterator(std::wostream &os, InputIterator begin, InputIterator end){ + typedef iterators::wchar_from_mb< + iterators::xml_escape + > xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(begin)), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(end)), + autoboost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::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 +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::save(const std::wstring & ws){ +#if 0 + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.begin())), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.end())), + autoboost::archive::iterators::ostream_iterator(os) + ); +#endif + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.data())), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws.data() + ws.size())), + autoboost::archive::iterators::ostream_iterator(os) + ); +} +#endif //BOOST_NO_STD_WSTRING + +template +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::save(const char * s){ + save_iterator(os, s, s + std::strlen(s)); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL(void) +xml_woarchive_impl::save(const wchar_t * ws){ + os << ws; + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws)), + xmbtows(BOOST_MAKE_PFTO_WRAPPER(ws + std::wcslen(ws))), + autoboost::archive::iterators::ostream_iterator(os) + ); +} +#endif + +template +BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) +xml_woarchive_impl::xml_woarchive_impl( + std::wostream & os_, + unsigned int flags +) : + basic_text_oprimitive( + os_, + true // don't change the codecvt - use the one below + ), + basic_xml_oarchive(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. + if(0 == (flags & no_codecvt)){ + autoboost::archive::detail::utf8_codecvt_facet *pfacet; + #if defined(__SGI_STL_PORT) + // 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. + static autoboost::archive::detail::utf8_codecvt_facet + facet(static_cast(1)); + pfacet = & facet; + #else + pfacet = new autoboost::archive::detail::utf8_codecvt_facet; + #endif + archive_locale.reset(add_facet(os_.getloc(), pfacet)); + os.imbue(* archive_locale); + } + if(0 == (flags & no_header)) + this->init(); +} + +} // namespace archive +} // namespace autoboost + +#endif //BOOST_NO_STD_WSTREAMBUF diff --git a/contrib/autoboost/boost/archive/iterators/base64_from_binary.hpp b/contrib/autoboost/boost/archive/iterators/base64_from_binary.hpp new file mode 100644 index 000000000..08a811935 --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/base64_from_binary.hpp @@ -0,0 +1,111 @@ +#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) +# 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 + +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include + +namespace autoboost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert binary integers to base64 characters + +namespace detail { + +template +struct from_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + const char * lookup_table = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/"; + BOOST_ASSERT(t < 64); + return lookup_table[static_cast(t)]; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template +// typedef transform_iterator< +// from_6_bit, +// transform_width +// > 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 +template< + class Base, + class CharType = typename autoboost::iterator_value::type +> +class base64_from_binary : + public transform_iterator< + detail::from_6_bit, + Base + > +{ + friend class autoboost::iterator_core_access; + typedef transform_iterator< + typename detail::from_6_bit, + Base + > super_t; + +public: + // make composible buy using templated constructor + template + base64_from_binary(BOOST_PFTO_WRAPPER(T) start) : + super_t( + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start))), + detail::from_6_bit() + ) + {} + // 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() + ) + {} +// base64_from_binary(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP diff --git a/contrib/autoboost/boost/archive/iterators/binary_from_base64.hpp b/contrib/autoboost/boost/archive/iterators/binary_from_base64.hpp new file mode 100644 index 000000000..65ba893fe --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/binary_from_base64.hpp @@ -0,0 +1,119 @@ +#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) +# 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 + +#include +#include +#include + +#include +#include + +namespace autoboost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert base64 characters to binary data + +namespace detail { + +template +struct to_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + const signed 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, 0,-1,-1, // render '=' as 0 + -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) + autoboost::serialization::throw_exception( + dataflow_exception(dataflow_exception::invalid_base64_character) + ); + return value; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template +// typedef transform_iterator< +// from_6_bit, +// transform_width +// > 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 = typename autoboost::iterator_value::type +> +class binary_from_base64 : public + transform_iterator< + detail::to_6_bit, + Base + > +{ + friend class autoboost::iterator_core_access; + typedef transform_iterator< + detail::to_6_bit, + Base + > super_t; +public: + // make composible buy using templated constructor + template + binary_from_base64(BOOST_PFTO_WRAPPER(T) start) : + super_t( + Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start))), + detail::to_6_bit() + ) + {} + // 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() + ) + {} +// binary_from_base64(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP diff --git a/contrib/autoboost/boost/archive/iterators/dataflow_exception.hpp b/contrib/autoboost/boost/archive/iterators/dataflow_exception.hpp new file mode 100644 index 000000000..640578aeb --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#ifndef BOOST_NO_EXCEPTIONS +#include +#endif //BOOST_NO_EXCEPTIONS + +#include + +namespace autoboost { +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: + BOOST_ASSERT(false); + break; + } + return msg; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace autoboost + +#endif //BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP diff --git a/contrib/autoboost/boost/archive/iterators/escape.hpp b/contrib/autoboost/boost/archive/iterators/escape.hpp new file mode 100644 index 000000000..cb68aee3c --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/escape.hpp @@ -0,0 +1,114 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include // NULL + +#include +#include + +namespace autoboost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into text + +template +class escape : + public autoboost::iterator_adaptor< + Derived, + Base, + typename autoboost::iterator_value::type, + single_pass_traversal_tag, + typename autoboost::iterator_value::type + > +{ + typedef typename autoboost::iterator_value::type base_value_type; + typedef typename autoboost::iterator_reference::type reference_type; + friend class autoboost::iterator_core_access; + + typedef typename autoboost::iterator_adaptor< + Derived, + Base, + base_value_type, + single_pass_traversal_tag, + base_value_type + > super_t; + + typedef escape this_t; + + void dereference_impl() { + m_current_value = static_cast(this)->fill(m_bnext, m_bend); + m_full = true; + } + + //Access the value referred to + reference_type dereference() const { + if(!m_full) + const_cast(this)->dereference_impl(); + return m_current_value; + } + + bool equal(const this_t & rhs) const { + if(m_full){ + if(! rhs.m_full) + const_cast(& rhs)->dereference_impl(); + } + else{ + if(rhs.m_full) + const_cast(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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP diff --git a/contrib/autoboost/boost/archive/iterators/insert_linebreaks.hpp b/contrib/autoboost/boost/archive/iterators/insert_linebreaks.hpp new file mode 100644 index 000000000..0a2b06691 --- /dev/null +++ b/contrib/autoboost/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) +# 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 + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::memcpy; } +#endif + +#include + +#include +#include + +namespace autoboost { +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 = typename autoboost::iterator_value::type +> +class insert_linebreaks : + public iterator_adaptor< + insert_linebreaks, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ +private: + friend class autoboost::iterator_core_access; + typedef iterator_adaptor< + insert_linebreaks, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + bool equal(const insert_linebreaks & 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 + 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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP diff --git a/contrib/autoboost/boost/archive/iterators/istream_iterator.hpp b/contrib/autoboost/boost/archive/iterators/istream_iterator.hpp new file mode 100644 index 000000000..877effe85 --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/istream_iterator.hpp @@ -0,0 +1,107 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 // NULL +#include +#include + +namespace autoboost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template +class istream_iterator : + public autoboost::iterator_facade< + istream_iterator, + Elem, + std::input_iterator_tag, + Elem + > +{ + friend class autoboost::iterator_core_access; + typedef istream_iterator this_t ; + typedef typename autoboost::iterator_facade< + istream_iterator, + Elem, + std::input_iterator_tag, + Elem + > super_t; + typedef typename std::basic_istream istream_type; + + bool equal(const this_t & rhs) const { + // note: only works for comparison against end of stream + return m_istream == rhs.m_istream; + } + +/* + //Access the value referred to + Elem dereference() const { + return m_current_value; + } + + void increment(){ + if(NULL != m_istream){ + m_current_value = static_cast(m_istream->get()); + if(! m_istream->good()){ + const_cast(this)->m_istream = NULL; + } + } + } +*/ + //Access the value referred to + Elem dereference() const { + return m_istream->peek(); + } + + void increment(){ + if(NULL != m_istream){ + m_istream->ignore(1); + } + } + + 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 & rhs) : + m_istream(rhs.m_istream), + m_current_value(rhs.m_current_value) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP diff --git a/contrib/autoboost/boost/archive/iterators/mb_from_wchar.hpp b/contrib/autoboost/boost/archive/iterators/mb_from_wchar.hpp new file mode 100644 index 000000000..d7e04ba96 --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include // size_t +#include // for wctomb() + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + using ::wctomb; +} // namespace std +#endif + +#include +#include + +namespace autoboost { +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 // the input iterator +class mb_from_wchar + : public autoboost::iterator_adaptor< + mb_from_wchar, + Base, + wchar_t, + single_pass_traversal_tag, + char + > +{ + friend class autoboost::iterator_core_access; + + typedef typename autoboost::iterator_adaptor< + mb_from_wchar, + Base, + wchar_t, + single_pass_traversal_tag, + char + > super_t; + + typedef mb_from_wchar this_t; + + char dereference_impl() { + if(! m_full){ + fill(); + m_full = true; + } + return m_buffer[m_bnext]; + } + char dereference() const { + return (const_cast(this))->dereference_impl(); + } + + // test for iterator equality + bool equal(const mb_from_wchar & 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 + BOOST_ASSERT(-1 != m_bend); + BOOST_ASSERT((std::size_t)m_bend <= sizeof(m_buffer)); + BOOST_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 + 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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP diff --git a/contrib/autoboost/boost/archive/iterators/ostream_iterator.hpp b/contrib/autoboost/boost/archive/iterators/ostream_iterator.hpp new file mode 100644 index 000000000..1c724a493 --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include + +namespace autoboost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template +class ostream_iterator : + public autoboost::iterator_facade< + ostream_iterator, + Elem, + std::output_iterator_tag, + ostream_iterator & + > +{ + friend class autoboost::iterator_core_access; + typedef ostream_iterator this_t ; + typedef Elem char_type; + typedef std::basic_ostream ostream_type; + + //emulate the behavior of std::ostream + ostream_iterator & dereference() const { + return const_cast(*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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP diff --git a/contrib/autoboost/boost/archive/iterators/remove_whitespace.hpp b/contrib/autoboost/boost/archive/iterators/remove_whitespace.hpp new file mode 100644 index 000000000..333d432f1 --- /dev/null +++ b/contrib/autoboost/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) +# 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 + +#include + +#include +#include +#include + +// 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 // iswspace +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::iswspace; } +#endif +#endif + +#include // 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 + +namespace { // anonymous + +template +struct remove_whitespace_predicate; + +template<> +struct remove_whitespace_predicate +{ + bool operator()(unsigned char t){ + return ! std::isspace(t); + } +}; + +#ifndef BOOST_NO_CWCHAR +template<> +struct remove_whitespace_predicate +{ + 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 autoboost { +namespace archive { +namespace iterators { + +// custom version of filter iterator which doesn't look ahead further than +// necessary + +template +class filter_iterator + : public autoboost::iterator_adaptor< + filter_iterator, + Base, + use_default, + single_pass_traversal_tag + > +{ + friend class autoboost::iterator_core_access; + typedef typename autoboost::iterator_adaptor< + filter_iterator, + Base, + use_default, + single_pass_traversal_tag + > super_t; + typedef filter_iterator this_t; + typedef 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)->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 remove_whitespace : + public filter_iterator< + remove_whitespace_predicate< + typename autoboost::iterator_value::type + //typename Base::value_type + >, + Base + > +{ + friend class autoboost::iterator_core_access; + typedef filter_iterator< + remove_whitespace_predicate< + typename autoboost::iterator_value::type + //typename Base::value_type + >, + Base + > super_t; +public: +// remove_whitespace(){} // why is this needed? + // make composible buy using templated constructor + template + 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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP diff --git a/contrib/autoboost/boost/archive/iterators/transform_width.hpp b/contrib/autoboost/boost/archive/iterators/transform_width.hpp new file mode 100644 index 000000000..bd125a326 --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/transform_width.hpp @@ -0,0 +1,177 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP +#define BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include + +#include // std::min + +namespace autoboost { +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 = typename autoboost::iterator_value::type // output character +> +class transform_width : + public autoboost::iterator_adaptor< + transform_width, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ + friend class autoboost::iterator_core_access; + typedef typename autoboost::iterator_adaptor< + transform_width, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + typedef transform_width this_t; + typedef typename iterator_value::type base_value_type; + + void fill(); + + CharType dereference() const { + if(!m_buffer_out_full) + const_cast(this)->fill(); + return m_buffer_out; + } + + bool equal_impl(const this_t & rhs){ + if(BitsIn < BitsOut) // discard any left over bits + return this->base_reference() == rhs.base_reference(); + else{ + // BitsIn > BitsOut // zero fill + if(this->base_reference() == rhs.base_reference()){ + m_end_of_sequence = true; + return 0 == m_remaining_bits; + } + return false; + } + } + + // standard iterator interface + bool equal(const this_t & rhs) const { + return const_cast(this)->equal_impl(rhs); + } + + void increment(){ + m_buffer_out_full = false; + } + + bool m_buffer_out_full; + CharType m_buffer_out; + + // last read element from input + base_value_type m_buffer_in; + + // number of bits to left in the input buffer. + unsigned int m_remaining_bits; + + // flag to indicate we've reached end of data. + bool m_end_of_sequence; + +public: + // make composible buy using templated constructor + template + transform_width(BOOST_PFTO_WRAPPER(T) start) : + super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), + m_buffer_out_full(false), + // To disable GCC warning, but not truly necessary + //(m_buffer_in will be initialized later before being + //used because m_remaining_bits == 0) + m_buffer_in(0), + m_remaining_bits(0), + m_end_of_sequence(false) + {} + // intel 7.1 doesn't like default copy constructor + transform_width(const transform_width & rhs) : + super_t(rhs.base_reference()), + m_buffer_out_full(rhs.m_buffer_out_full), + m_buffer_in(rhs.m_buffer_in), + m_remaining_bits(rhs.m_remaining_bits), + m_end_of_sequence(false) + {} +}; + +template< + class Base, + int BitsOut, + int BitsIn, + class CharType +> +void transform_width::fill() { + unsigned int missing_bits = BitsOut; + m_buffer_out = 0; + do{ + if(0 == m_remaining_bits){ + if(m_end_of_sequence){ + m_buffer_in = 0; + m_remaining_bits = missing_bits; + } + else{ + m_buffer_in = * this->base_reference()++; + m_remaining_bits = BitsIn; + } + } + + // append these bits to the next output + // up to the size of the output + unsigned int i = std::min(missing_bits, m_remaining_bits); + // shift interesting bits to least significant position + base_value_type j = m_buffer_in >> (m_remaining_bits - i); + // and mask off the un interesting higher bits + // note presumption of twos complement notation + j &= (1 << i) - 1; + // append then interesting bits to the output value + m_buffer_out <<= i; + m_buffer_out |= j; + + // and update counters + missing_bits -= i; + m_remaining_bits -= i; + }while(0 < missing_bits); + m_buffer_out_full = true; +} + +} // namespace iterators +} // namespace archive +} // namespace autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP diff --git a/contrib/autoboost/boost/archive/iterators/unescape.hpp b/contrib/autoboost/boost/archive/iterators/unescape.hpp new file mode 100644 index 000000000..d4d0fa9a7 --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/unescape.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include + +namespace autoboost { +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 unescape + : public autoboost::iterator_adaptor< + unescape, + Base, + typename pointee::type, + single_pass_traversal_tag, + typename pointee::type + > +{ + friend class autoboost::iterator_core_access; + typedef typename autoboost::iterator_adaptor< + unescape, + Base, + typename pointee::type, + single_pass_traversal_tag, + typename pointee::type + > super_t; + + typedef unescape this_t; +public: + typedef typename this_t::value_type value_type; + typedef typename this_t::reference reference; +private: + value_type dereference_impl() { + if(! m_full){ + m_current_value = static_cast(this)->drain(); + m_full = true; + } + return m_current_value; + } + + reference dereference() const { + return const_cast(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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP diff --git a/contrib/autoboost/boost/archive/iterators/wchar_from_mb.hpp b/contrib/autoboost/boost/archive/iterators/wchar_from_mb.hpp new file mode 100644 index 000000000..1b710ac43 --- /dev/null +++ b/contrib/autoboost/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) +# 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 +#include +#include // size_t +#include // mblen + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mblen; + using ::mbtowc; +} // namespace std +#endif + +#include +#include + +#include +#include + +namespace autoboost { +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 wchar_from_mb + : public autoboost::iterator_adaptor< + wchar_from_mb, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > +{ + friend class autoboost::iterator_core_access; + typedef typename autoboost::iterator_adaptor< + wchar_from_mb, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > super_t; + + typedef wchar_from_mb 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)->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 + 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 +wchar_t wchar_from_mb::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) + autoboost::serialization::throw_exception(iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + )); + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP diff --git a/contrib/autoboost/boost/archive/iterators/xml_escape.hpp b/contrib/autoboost/boost/archive/iterators/xml_escape.hpp new file mode 100644 index 000000000..d87f745bd --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/xml_escape.hpp @@ -0,0 +1,122 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include +#include + +namespace autoboost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into xml text + +template +class xml_escape + : public escape, Base> +{ + friend class autoboost::iterator_core_access; + + typedef escape, Base> super_t; + +public: + char fill(const char * & bstart, const char * & bend); + wchar_t fill(const wchar_t * & bstart, const wchar_t * & bend); + + template + 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 +char xml_escape::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 +wchar_t xml_escape::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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP diff --git a/contrib/autoboost/boost/archive/iterators/xml_unescape.hpp b/contrib/autoboost/boost/archive/iterators/xml_unescape.hpp new file mode 100644 index 000000000..574fab26d --- /dev/null +++ b/contrib/autoboost/boost/archive/iterators/xml_unescape.hpp @@ -0,0 +1,126 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include + +#include +#include + +namespace autoboost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// replace &??? xml escape sequences with the corresponding characters +template +class xml_unescape + : public unescape, Base> +{ + friend class autoboost::iterator_core_access; + typedef xml_unescape this_t; + typedef unescape super_t; + typedef typename autoboost::iterator_reference reference_type; + + reference_type dereference() const { + return unescape, Base>::dereference(); + } +public: + // workaround msvc 7.1 ICU crash + #if defined(BOOST_MSVC) + typedef int value_type; + #else + typedef typename this_t::value_type value_type; + #endif + + void drain_residue(const char *literal); + value_type drain(); + + template + 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 +void xml_unescape::drain_residue(const char * literal){ + do{ + if(* literal != * ++(this->base_reference())) + autoboost::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 +typename xml_unescape::value_type +//int +xml_unescape::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 autoboost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP diff --git a/contrib/autoboost/boost/archive/polymorphic_iarchive.hpp b/contrib/autoboost/boost/archive/polymorphic_iarchive.hpp new file mode 100644 index 000000000..63308070a --- /dev/null +++ b/contrib/autoboost/boost/archive/polymorphic_iarchive.hpp @@ -0,0 +1,172 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 // std::size_t +#include // ULONG_MAX +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include + +#include +#include // must be the last header + +namespace autoboost { +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 +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_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_HAS_LONG_LONG) + virtual void load(autoboost::long_long_type & t) = 0; + virtual void load(autoboost::ulong_long_type & t) = 0; + #elif defined(BOOST_HAS_MS_INT64) + virtual void load(__int64 & t) = 0; + virtual void load(unsigned __int64 & 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 + void load_override(T & t, BOOST_PFTO int) + { + archive::load(* this->This(), t); + } + // special treatment for name-value pairs. + template + void load_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + autoboost::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(library_version_type archive_library_version) = 0; + virtual library_version_type 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 autoboost::serialization::extended_type_info & type + ) + ) = 0; +}; + +} // namespace archive +} // namespace autoboost + +#include // pops abi_suffix.hpp pragmas + +namespace autoboost { +namespace archive { + +class polymorphic_iarchive : + public polymorphic_iarchive_impl +{ +public: + virtual ~polymorphic_iarchive(){}; +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::polymorphic_iarchive) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/polymorphic_oarchive.hpp b/contrib/autoboost/boost/archive/polymorphic_oarchive.hpp new file mode 100644 index 000000000..93026d5d0 --- /dev/null +++ b/contrib/autoboost/boost/archive/polymorphic_oarchive.hpp @@ -0,0 +1,157 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 // size_t +#include // ULONG_MAX +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include // must be the last header + +namespace autoboost { +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 +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_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_HAS_LONG_LONG) + virtual void save(const autoboost::long_long_type t) = 0; + virtual void save(const autoboost::ulong_long_type t) = 0; + #elif defined(BOOST_HAS_MS_INT64) + virtual void save(const __int64 t) = 0; + virtual void save(const unsigned __int64 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 + void save_override(T & t, BOOST_PFTO int) + { + archive::save(* this->This(), t); + } + // special treatment for name-value pairs. + template + void save_override( + #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + const + #endif + ::autoboost::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 library_version_type 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 autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::polymorphic_oarchive) + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/text_iarchive.hpp b/contrib/autoboost/boost/archive/text_iarchive.hpp new file mode 100644 index 000000000..e9afce651 --- /dev/null +++ b/contrib/autoboost/boost/archive/text_iarchive.hpp @@ -0,0 +1,142 @@ +#ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class text_iarchive_impl : + public basic_text_iprimitive, + public basic_text_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + friend load_access; + #else + friend class detail::interface_iarchive; + friend class load_access; + #endif +#endif + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + void load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void load(autoboost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = autoboost::serialization::item_version_type(v); + } + 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 + void load_override(T & t, BOOST_PFTO int){ + basic_text_iarchive::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); + // don't import inline definitions! leave this as a reminder. + //BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) + ~text_iarchive_impl(){}; +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +class text_iarchive : + public text_iarchive_impl{ +public: + text_iarchive(std::istream & is_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_iarchive_impl(is_, flags) + {} + ~text_iarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::text_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/text_oarchive.hpp b/contrib/autoboost/boost/archive/text_oarchive.hpp new file mode 100644 index 000000000..3d862ab08 --- /dev/null +++ b/contrib/autoboost/boost/archive/text_oarchive.hpp @@ -0,0 +1,129 @@ +#ifndef BOOST_ARCHIVE_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include // std::size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class text_oarchive_impl : + /* protected ? */ public basic_text_oprimitive, + public basic_text_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend basic_text_oarchive; + friend save_access; + #else + friend class detail::interface_oarchive; + friend class basic_text_oarchive; + friend class save_access; + #endif +#endif + template + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive::save(t); + } + void save(const version_type & t){ + save(static_cast(t)); + } + void save(const autoboost::serialization::item_version_type & t){ + save(static_cast(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); + // don't import inline definitions! leave this as a reminder. + //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 +{ +public: + text_oarchive(std::ostream & os_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_oarchive_impl(os_, flags) + {} + ~text_oarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::text_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_TEXT_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/text_wiarchive.hpp b/contrib/autoboost/boost/archive/text_wiarchive.hpp new file mode 100644 index 000000000..ad7bd3f92 --- /dev/null +++ b/contrib/autoboost/boost/archive/text_wiarchive.hpp @@ -0,0 +1,139 @@ +#ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class text_wiarchive_impl : + public basic_text_iprimitive, + public basic_text_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + friend load_access; + #else + friend class detail::interface_iarchive; + friend class load_access; + #endif +#endif + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + void load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void load(autoboost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = autoboost::serialization::item_version_type(v); + } + 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 + void load_override(T & t, BOOST_PFTO int){ + basic_text_iarchive::load_override(t, 0); + } + BOOST_WARCHIVE_DECL(BOOST_PP_EMPTY()) + text_wiarchive_impl(std::wistream & is, unsigned int flags); + ~text_wiarchive_impl(){}; +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +class text_wiarchive : + public text_wiarchive_impl{ +public: + text_wiarchive(std::wistream & is, unsigned int flags = 0) : + text_wiarchive_impl(is, flags) + {} + ~text_wiarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::text_wiarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/text_woarchive.hpp b/contrib/autoboost/boost/archive/text_woarchive.hpp new file mode 100644 index 000000000..1dd58c9ea --- /dev/null +++ b/contrib/autoboost/boost/archive/text_woarchive.hpp @@ -0,0 +1,155 @@ +#ifndef BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include // size_t + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class text_woarchive_impl : + public basic_text_oprimitive, + public basic_text_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend basic_text_oarchive; + friend save_access; + #else + friend class detail::interface_oarchive; + friend class basic_text_oarchive; + friend class save_access; + #endif +#endif + template + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive::save(t); + } + void save(const version_type & t){ + save(static_cast(t)); + } + void save(const autoboost::serialization::item_version_type & t){ + save(static_cast(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( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive(flags) + { + if(0 == (flags & no_header)) + basic_text_oarchive::init(); + } +public: + void save_binary(const void *address, std::size_t count){ + put(static_cast('\n')); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + put(static_cast('\n')); + this->delimiter = this->none; + } + +}; + +// we use the following because we can't use +// typedef 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 +{ +public: + text_woarchive(std::wostream & os, unsigned int flags = 0) : + text_woarchive_impl(os, flags) + {} + ~text_woarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::text_woarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/wcslen.hpp b/contrib/autoboost/boost/archive/wcslen.hpp new file mode 100644 index 000000000..2a3d6351d --- /dev/null +++ b/contrib/autoboost/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) +# 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 // size_t +#include +#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 +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif + +#endif // wcslen + +#endif //BOOST_NO_CWCHAR + +#endif //BOOST_ARCHIVE_WCSLEN_HPP diff --git a/contrib/autoboost/boost/archive/xml_archive_exception.hpp b/contrib/autoboost/boost/archive/xml_archive_exception.hpp new file mode 100644 index 000000000..89ac24054 --- /dev/null +++ b/contrib/autoboost/boost/archive/xml_archive_exception.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#include + +#include +#include +#include +#include + +#include // must be the last header + +namespace autoboost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by xml archives +// +class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) xml_archive_exception : + public virtual autoboost::archive::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 autoboost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_XML_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/contrib/autoboost/boost/archive/xml_iarchive.hpp b/contrib/autoboost/boost/archive/xml_iarchive.hpp new file mode 100644 index 000000000..725de403a --- /dev/null +++ b/contrib/autoboost/boost/archive/xml_iarchive.hpp @@ -0,0 +1,152 @@ +#ifndef BOOST_ARCHIVE_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +//#include +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class basic_xml_grammar; +typedef basic_xml_grammar xml_grammar; + +template +class xml_iarchive_impl : + public basic_text_iprimitive, + public basic_xml_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + friend basic_xml_iarchive; + friend load_access; + #else + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; + #endif +#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 gimpl; + xml_grammar *gimpl; + + std::istream & get_is(){ + return is; + } + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + void + load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void + load(autoboost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = autoboost::serialization::item_version_type(v); + } + 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 + void load_override(T & t, BOOST_PFTO int){ + basic_xml_iarchive::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(); +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +class xml_iarchive : + public xml_iarchive_impl{ +public: + xml_iarchive(std::istream & is, unsigned int flags = 0) : + xml_iarchive_impl(is, flags) + {} + ~xml_iarchive(){}; +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::xml_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_XML_IARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/xml_oarchive.hpp b/contrib/autoboost/boost/archive/xml_oarchive.hpp new file mode 100644 index 000000000..073ed2a22 --- /dev/null +++ b/contrib/autoboost/boost/archive/xml_oarchive.hpp @@ -0,0 +1,143 @@ +#ifndef BOOST_ARCHIVE_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 + +#include // size_t +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class xml_oarchive_impl : + public basic_text_oprimitive, + public basic_xml_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend basic_xml_oarchive; + friend save_access; + #else + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; + #endif +#endif + //void end_preamble(){ + // basic_xml_oarchive::end_preamble(); + //} + template + void save(const T & t){ + basic_text_oprimitive::save(t); + } + void + save(const version_type & t){ + save(static_cast(t)); + } + void + save(const autoboost::serialization::item_version_type & t){ + save(static_cast(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::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; + +// 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 +{ +public: + xml_oarchive(std::ostream & os, unsigned int flags = 0) : + xml_oarchive_impl(os, flags) + {} + ~xml_oarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::xml_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/xml_wiarchive.hpp b/contrib/autoboost/boost/archive/xml_wiarchive.hpp new file mode 100644 index 000000000..d8ff50ed0 --- /dev/null +++ b/contrib/autoboost/boost/archive/xml_wiarchive.hpp @@ -0,0 +1,159 @@ +#ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include + +//#include +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class basic_xml_grammar; +typedef basic_xml_grammar xml_wgrammar; + +template +class xml_wiarchive_impl : + public basic_text_iprimitive, + public basic_xml_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + friend basic_xml_iarchive; + friend load_access; + #else + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; + #endif +#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 gimpl; + xml_wgrammar *gimpl; + std::wistream & get_is(){ + return is; + } + template + void + load(T & t){ + basic_text_iprimitive::load(t); + } + void + load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void + load(autoboost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = autoboost::serialization::item_version_type(v); + } + 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 + void load_override(T & t, BOOST_PFTO int){ + basic_xml_iarchive::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(); +}; + +} // namespace archive +} // namespace autoboost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +class xml_wiarchive : + public xml_wiarchive_impl{ +public: + xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + xml_wiarchive_impl(is, flags) + {} + ~xml_wiarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::xml_wiarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP diff --git a/contrib/autoboost/boost/archive/xml_woarchive.hpp b/contrib/autoboost/boost/archive/xml_woarchive.hpp new file mode 100644 index 000000000..f62540450 --- /dev/null +++ b/contrib/autoboost/boost/archive/xml_woarchive.hpp @@ -0,0 +1,151 @@ +#ifndef BOOST_ARCHIVE_XML_WOARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# 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 +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace autoboost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class xml_woarchive_impl : + public basic_text_oprimitive, + public basic_xml_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend basic_xml_oarchive; + friend save_access; + #else + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; + #endif +#endif + + //void end_preamble(){ + // basic_xml_oarchive::end_preamble(); + //} + template + void + save(const T & t){ + basic_text_oprimitive::save(t); + } + void + save(const version_type & t){ + save(static_cast(t)); + } + void + save(const autoboost::serialization::item_version_type & t){ + save(static_cast(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::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; + +// 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 +{ +public: + xml_woarchive(std::wostream & os, unsigned int flags = 0) : + xml_woarchive_impl(os, flags) + {} + ~xml_woarchive(){} +}; + +} // namespace archive +} // namespace autoboost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(autoboost::archive::xml_woarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/contrib/autoboost/boost/array.hpp b/contrib/autoboost/boost/array.hpp new file mode 100644 index 000000000..861ade0f8 --- /dev/null +++ b/contrib/autoboost/boost/array.hpp @@ -0,0 +1,446 @@ +/* The following code declares class array, + * an STL container (as wrapper) for arrays of constant size. + * + * See + * http://www.boost.org/libs/array/ + * for documentation. + * + * The original author site is at: http://www.josuttis.com/ + * + * (C) Copyright Nicolai M. Josuttis 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) + * + * 14 Apr 2012 - (mtc) Added support for autoboost::hash + * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility. + * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group. + * See or Trac issue #3168 + * Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow) + * 10 Mar 2010 - added workaround for SUNCC and !STLPort [trac #3893] (Marshall Clow) + * 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis) + * 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries. + * 05 Aug 2001 - minor update (Nico Josuttis) + * 20 Jan 2001 - STLport fix (Beman Dawes) + * 29 Sep 2000 - Initial Revision (Nico Josuttis) + * + * Jan 29, 2004 + */ +#ifndef BOOST_ARRAY_HPP +#define BOOST_ARRAY_HPP + +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +# pragma warning(push) +# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe +# pragma warning(disable:4510) // autoboost::array' : default constructor could not be generated +# pragma warning(disable:4610) // warning C4610: class 'autoboost::array' can never be instantiated - user defined constructor required +#endif + +#include +#include +#include +#include + +// Handles broken standard libraries better than +#include +#include +#include +#include + +// FIXES for broken compilers +#include + + +namespace autoboost { + + template + class array { + public: + T elems[N]; // fixed-size array of elements of type T + + public: + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // iterator support + iterator begin() { return elems; } + const_iterator begin() const { return elems; } + const_iterator cbegin() const { return elems; } + + iterator end() { return elems+N; } + const_iterator end() const { return elems+N; } + const_iterator cend() const { return elems+N; } + + // reverse iterator support +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) + // workaround for broken reverse_iterator in VC7 + typedef std::reverse_iterator > reverse_iterator; + typedef std::reverse_iterator > const_reverse_iterator; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#endif + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + const_reverse_iterator crbegin() const { + return const_reverse_iterator(end()); + } + + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + const_reverse_iterator crend() const { + return const_reverse_iterator(begin()); + } + + // operator[] + reference operator[](size_type i) + { + BOOST_ASSERT_MSG( i < N, "out of range" ); + return elems[i]; + } + + const_reference operator[](size_type i) const + { + BOOST_ASSERT_MSG( i < N, "out of range" ); + return elems[i]; + } + + // at() with range check + reference at(size_type i) { rangecheck(i); return elems[i]; } + const_reference at(size_type i) const { rangecheck(i); return elems[i]; } + + // front() and back() + reference front() + { + return elems[0]; + } + + const_reference front() const + { + return elems[0]; + } + + reference back() + { + return elems[N-1]; + } + + const_reference back() const + { + return elems[N-1]; + } + + // size is constant + static size_type size() { return N; } + static bool empty() { return false; } + static size_type max_size() { return N; } + enum { static_size = N }; + + // swap (note: linear complexity) + void swap (array& y) { + for (size_type i = 0; i < N; ++i) + autoboost::swap(elems[i],y.elems[i]); + } + + // direct access to data (read-only) + const T* data() const { return elems; } + T* data() { return elems; } + + // use array as C array (direct read/write access to data) + T* c_array() { return elems; } + + // assignment with type conversion + template + array& operator= (const array& rhs) { + std::copy(rhs.begin(),rhs.end(), begin()); + return *this; + } + + // assign one value to all elements + void assign (const T& value) { fill ( value ); } // A synonym for fill + void fill (const T& value) + { + std::fill_n(begin(),size(),value); + } + + // check range (may be private because it is static) + static void rangecheck (size_type i) { + if (i >= size()) { + std::out_of_range e("array<>: index out of range"); + autoboost::throw_exception(e); + } + } + + }; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + template< class T > + class array< T, 0 > { + + public: + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // iterator support + iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); } + const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); } + const_iterator cbegin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); } + + iterator end() { return begin(); } + const_iterator end() const { return begin(); } + const_iterator cend() const { return cbegin(); } + + // reverse iterator support +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) + // workaround for broken reverse_iterator in VC7 + typedef std::reverse_iterator > reverse_iterator; + typedef std::reverse_iterator > const_reverse_iterator; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#endif + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + const_reverse_iterator crbegin() const { + return const_reverse_iterator(end()); + } + + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + const_reverse_iterator crend() const { + return const_reverse_iterator(begin()); + } + + // operator[] + reference operator[](size_type /*i*/) + { + return failed_rangecheck(); + } + + const_reference operator[](size_type /*i*/) const + { + return failed_rangecheck(); + } + + // at() with range check + reference at(size_type /*i*/) { return failed_rangecheck(); } + const_reference at(size_type /*i*/) const { return failed_rangecheck(); } + + // front() and back() + reference front() + { + return failed_rangecheck(); + } + + const_reference front() const + { + return failed_rangecheck(); + } + + reference back() + { + return failed_rangecheck(); + } + + const_reference back() const + { + return failed_rangecheck(); + } + + // size is constant + static size_type size() { return 0; } + static bool empty() { return true; } + static size_type max_size() { return 0; } + enum { static_size = 0 }; + + void swap (array& /*y*/) { + } + + // direct access to data (read-only) + const T* data() const { return 0; } + T* data() { return 0; } + + // use array as C array (direct read/write access to data) + T* c_array() { return 0; } + + // assignment with type conversion + template + array& operator= (const array& ) { + return *this; + } + + // assign one value to all elements + void assign (const T& value) { fill ( value ); } + void fill (const T& ) {} + + // check range (may be private because it is static) + static reference failed_rangecheck () { + std::out_of_range e("attempt to access element of an empty array"); + autoboost::throw_exception(e); +#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__)) + // + // We need to return something here to keep + // some compilers happy: however we will never + // actually get here.... + // + static T placeholder; + return placeholder; +#endif + } + }; +#endif + + // comparisons + template + bool operator== (const array& x, const array& y) { + return std::equal(x.begin(), x.end(), y.begin()); + } + template + bool operator< (const array& x, const array& y) { + return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); + } + template + bool operator!= (const array& x, const array& y) { + return !(x==y); + } + template + bool operator> (const array& x, const array& y) { + return y + bool operator<= (const array& x, const array& y) { + return !(y + bool operator>= (const array& x, const array& y) { + return !(x + inline void swap (array& x, array& y) { + x.swap(y); + } + +#if defined(__SUNPRO_CC) +// Trac ticket #4757; the Sun Solaris compiler can't handle +// syntax like 'T(&get_c_array(autoboost::array& arg))[N]' +// +// We can't just use this for all compilers, because the +// borland compilers can't handle this form. + namespace detail { + template struct c_array + { + typedef T type[N]; + }; + } + + // Specific for autoboost::array: simply returns its elems data member. + template + typename detail::c_array::type& get_c_array(autoboost::array& arg) + { + return arg.elems; + } + + // Specific for autoboost::array: simply returns its elems data member. + template + typename const detail::c_array::type& get_c_array(const autoboost::array& arg) + { + return arg.elems; + } +#else +// Specific for autoboost::array: simply returns its elems data member. + template + T(&get_c_array(autoboost::array& arg))[N] + { + return arg.elems; + } + + // Const version. + template + const T(&get_c_array(const autoboost::array& arg))[N] + { + return arg.elems; + } +#endif + +#if 0 + // Overload for std::array, assuming that std::array will have + // explicit conversion functions as discussed at the WG21 meeting + // in Summit, March 2009. + template + T(&get_c_array(std::array& arg))[N] + { + return static_cast(arg); + } + + // Const version. + template + const T(&get_c_array(const std::array& arg))[N] + { + return static_cast(arg); + } +#endif + + + template + std::size_t hash_value(const array& arr) + { + return autoboost::hash_range(arr.begin(), arr.end()); + } + +} /* namespace autoboost */ + + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +# pragma warning(pop) +#endif + +#endif /*BOOST_ARRAY_HPP*/ diff --git a/contrib/autoboost/boost/asio.hpp b/contrib/autoboost/boost/asio.hpp new file mode 100644 index 000000000..871fcbe41 --- /dev/null +++ b/contrib/autoboost/boost/asio.hpp @@ -0,0 +1,121 @@ +// +// asio.hpp +// ~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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 www.boost.org/libs/asio for documentation. +// + +#ifndef BOOST_ASIO_HPP +#define BOOST_ASIO_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_ASIO_HPP diff --git a/contrib/autoboost/boost/asio/async_result.hpp b/contrib/autoboost/boost/asio/async_result.hpp new file mode 100644 index 000000000..08d8f6ac7 --- /dev/null +++ b/contrib/autoboost/boost/asio/async_result.hpp @@ -0,0 +1,96 @@ +// +// async_result.hpp +// ~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_ASYNC_RESULT_HPP +#define BOOST_ASIO_ASYNC_RESULT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// An interface for customising the behaviour of an initiating function. +/** + * This template may be specialised for user-defined handler types. + */ +template +class async_result +{ +public: + /// The return type of the initiating function. + typedef void type; + + /// Construct an async result from a given handler. + /** + * When using a specalised async_result, the constructor has an opportunity + * to initialise some state associated with the handler, which is then + * returned from the initiating function. + */ + explicit async_result(Handler&) + { + } + + /// Obtain the value to be returned from the initiating function. + type get() + { + } +}; + +namespace detail { + +// Helper template to deduce the true type of a handler, capture a local copy +// of the handler, and then create an async_result for the handler. +template +struct async_result_init +{ + explicit async_result_init(BOOST_ASIO_MOVE_ARG(Handler) orig_handler) + : handler(BOOST_ASIO_MOVE_CAST(Handler)(orig_handler)), + result(handler) + { + } + + typename handler_type::type handler; + async_result::type> result; +}; + +template +struct async_result_type_helper +{ + typedef typename async_result< + typename handler_type::type + >::type type; +}; + +} // namespace detail +} // namespace asio +} // namespace autoboost + +#include + +#if defined(GENERATING_DOCUMENTATION) +# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \ + void_or_deduced +#elif defined(_MSC_VER) && (_MSC_VER < 1500) +# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \ + typename ::autoboost::asio::detail::async_result_type_helper::type +#else +# define BOOST_ASIO_INITFN_RESULT_TYPE(h, sig) \ + typename ::autoboost::asio::async_result< \ + typename ::autoboost::asio::handler_type::type>::type +#endif + +#endif // BOOST_ASIO_ASYNC_RESULT_HPP diff --git a/contrib/autoboost/boost/asio/basic_datagram_socket.hpp b/contrib/autoboost/boost/asio/basic_datagram_socket.hpp new file mode 100644 index 000000000..00295cda5 --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_datagram_socket.hpp @@ -0,0 +1,951 @@ +// +// basic_datagram_socket.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_DATAGRAM_SOCKET_HPP +#define BOOST_ASIO_BASIC_DATAGRAM_SOCKET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides datagram-oriented socket functionality. +/** + * The basic_datagram_socket class template provides asynchronous and blocking + * datagram-oriented socket functionality. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template > +class basic_datagram_socket + : public basic_socket +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename DatagramSocketService::native_handle_type native_type; + + /// The native representation of a socket. + typedef typename DatagramSocketService::native_handle_type native_handle_type; + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// Construct a basic_datagram_socket without opening it. + /** + * This constructor creates a datagram socket without opening it. The open() + * function must be called before data can be sent or received on the socket. + * + * @param io_service The io_service object that the datagram socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + */ + explicit basic_datagram_socket(autoboost::asio::io_service& io_service) + : basic_socket(io_service) + { + } + + /// Construct and open a basic_datagram_socket. + /** + * This constructor creates and opens a datagram socket. + * + * @param io_service The io_service object that the datagram socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_datagram_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol) + : basic_socket(io_service, protocol) + { + } + + /// Construct a basic_datagram_socket, opening it and binding it to the given + /// local endpoint. + /** + * This constructor creates a datagram socket and automatically opens it bound + * to the specified endpoint on the local machine. The protocol used is the + * protocol associated with the given endpoint. + * + * @param io_service The io_service object that the datagram socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + * + * @param endpoint An endpoint on the local machine to which the datagram + * socket will be bound. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_datagram_socket(autoboost::asio::io_service& io_service, + const endpoint_type& endpoint) + : basic_socket(io_service, endpoint) + { + } + + /// Construct a basic_datagram_socket on an existing native socket. + /** + * This constructor creates a datagram socket object to hold an existing + * native socket. + * + * @param io_service The io_service object that the datagram socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @param native_socket The new underlying socket implementation. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_datagram_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol, const native_handle_type& native_socket) + : basic_socket( + io_service, protocol, native_socket) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_datagram_socket from another. + /** + * This constructor moves a datagram socket from one object to another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + basic_datagram_socket(basic_datagram_socket&& other) + : basic_socket( + BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other)) + { + } + + /// Move-assign a basic_datagram_socket from another. + /** + * This assignment operator moves a datagram socket from one object to + * another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + basic_datagram_socket& operator=(basic_datagram_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other)); + return *this; + } + + /// Move-construct a basic_datagram_socket from a socket of another protocol + /// type. + /** + * This constructor moves a datagram socket from one object to another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + template + basic_datagram_socket( + basic_datagram_socket&& other, + typename enable_if::value>::type* = 0) + : basic_socket( + BOOST_ASIO_MOVE_CAST2(basic_datagram_socket< + Protocol1, DatagramSocketService1>)(other)) + { + } + + /// Move-assign a basic_datagram_socket from a socket of another protocol + /// type. + /** + * This assignment operator moves a datagram socket from one object to + * another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_datagram_socket>::type& operator=( + basic_datagram_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST2(basic_datagram_socket< + Protocol1, DatagramSocketService1>)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Send some data on a connected socket. + /** + * This function is used to send data on the datagram socket. The function + * call will block until the data has been sent successfully or an error + * occurs. + * + * @param buffers One ore more data buffers to be sent on the socket. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The send operation can only be used with a connected socket. Use + * the send_to function to send data on an unconnected datagram socket. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code socket.send(autoboost::asio::buffer(data, size)); @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t send(const ConstBufferSequence& buffers) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + autoboost::asio::detail::throw_error(ec, "send"); + return s; + } + + /// Send some data on a connected socket. + /** + * This function is used to send data on the datagram socket. The function + * call will block until the data has been sent successfully or an error + * occurs. + * + * @param buffers One ore more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The send operation can only be used with a connected socket. Use + * the send_to function to send data on an unconnected datagram socket. + */ + template + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + autoboost::asio::detail::throw_error(ec, "send"); + return s; + } + + /// Send some data on a connected socket. + /** + * This function is used to send data on the datagram socket. The function + * call will block until the data has been sent successfully or an error + * occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes sent. + * + * @note The send operation can only be used with a connected socket. Use + * the send_to function to send data on an unconnected datagram socket. + */ + template + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, autoboost::system::error_code& ec) + { + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); + } + + /// Start an asynchronous send on a connected socket. + /** + * This function is used to asynchronously send data on the datagram socket. + * The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent on the socket. Although + * the buffers object may be copied as necessary, ownership of the underlying + * memory blocks is retained by the caller, which must guarantee that they + * remain valid until the handler is called. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_send operation can only be used with a connected socket. + * Use the async_send_to function to send data on an unconnected datagram + * socket. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.async_send(autoboost::asio::buffer(data, size), handler); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Start an asynchronous send on a connected socket. + /** + * This function is used to asynchronously send data on the datagram socket. + * The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent on the socket. Although + * the buffers object may be copied as necessary, ownership of the underlying + * memory blocks is retained by the caller, which must guarantee that they + * remain valid until the handler is called. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_send operation can only be used with a connected socket. + * Use the async_send_to function to send data on an unconnected datagram + * socket. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Send a datagram to the specified endpoint. + /** + * This function is used to send a datagram to the specified remote endpoint. + * The function call will block until the data has been sent successfully or + * an error occurs. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * + * @param destination The remote endpoint to which the data will be sent. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * autoboost::asio::ip::udp::endpoint destination( + * autoboost::asio::ip::address::from_string("1.2.3.4"), 12345); + * socket.send_to(autoboost::asio::buffer(data, size), destination); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, 0, ec); + autoboost::asio::detail::throw_error(ec, "send_to"); + return s; + } + + /// Send a datagram to the specified endpoint. + /** + * This function is used to send a datagram to the specified remote endpoint. + * The function call will block until the data has been sent successfully or + * an error occurs. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * + * @param destination The remote endpoint to which the data will be sent. + * + * @param flags Flags specifying how the send call is to be made. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + template + std::size_t send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, flags, ec); + autoboost::asio::detail::throw_error(ec, "send_to"); + return s; + } + + /// Send a datagram to the specified endpoint. + /** + * This function is used to send a datagram to the specified remote endpoint. + * The function call will block until the data has been sent successfully or + * an error occurs. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * + * @param destination The remote endpoint to which the data will be sent. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes sent. + */ + template + std::size_t send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, socket_base::message_flags flags, + autoboost::system::error_code& ec) + { + return this->get_service().send_to(this->get_implementation(), + buffers, destination, flags, ec); + } + + /// Start an asynchronous send. + /** + * This function is used to asynchronously send a datagram to the specified + * remote endpoint. The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param destination The remote endpoint to which the data will be sent. + * Copies will be made of the endpoint as required. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * autoboost::asio::ip::udp::endpoint destination( + * autoboost::asio::ip::address::from_string("1.2.3.4"), 12345); + * socket.async_send_to( + * autoboost::asio::buffer(data, size), destination, handler); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send_to( + this->get_implementation(), buffers, destination, 0, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Start an asynchronous send. + /** + * This function is used to asynchronously send a datagram to the specified + * remote endpoint. The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param destination The remote endpoint to which the data will be sent. + * Copies will be made of the endpoint as required. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send_to( + this->get_implementation(), buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the datagram socket. The function + * call will block until data has been received successfully or an error + * occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The receive operation can only be used with a connected socket. Use + * the receive_from function to receive data on an unconnected datagram + * socket. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code socket.receive(autoboost::asio::buffer(data, size)); @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t receive(const MutableBufferSequence& buffers) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + autoboost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the datagram socket. The function + * call will block until data has been received successfully or an error + * occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The receive operation can only be used with a connected socket. Use + * the receive_from function to receive data on an unconnected datagram + * socket. + */ + template + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + autoboost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the datagram socket. The function + * call will block until data has been received successfully or an error + * occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes received. + * + * @note The receive operation can only be used with a connected socket. Use + * the receive_from function to receive data on an unconnected datagram + * socket. + */ + template + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags flags, autoboost::system::error_code& ec) + { + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + } + + /// Start an asynchronous receive on a connected socket. + /** + * This function is used to asynchronously receive data from the datagram + * socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_receive operation can only be used with a connected socket. + * Use the async_receive_from function to receive data on an unconnected + * datagram socket. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive(autoboost::asio::buffer(data, size), handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Start an asynchronous receive on a connected socket. + /** + * This function is used to asynchronously receive data from the datagram + * socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_receive operation can only be used with a connected socket. + * Use the async_receive_from function to receive data on an unconnected + * datagram socket. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Receive a datagram with the endpoint of the sender. + /** + * This function is used to receive a datagram. The function call will block + * until data has been received successfully or an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the datagram. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * autoboost::asio::ip::udp::endpoint sender_endpoint; + * socket.receive_from( + * autoboost::asio::buffer(data, size), sender_endpoint); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, ec); + autoboost::asio::detail::throw_error(ec, "receive_from"); + return s; + } + + /// Receive a datagram with the endpoint of the sender. + /** + * This function is used to receive a datagram. The function call will block + * until data has been received successfully or an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the datagram. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + template + std::size_t receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, ec); + autoboost::asio::detail::throw_error(ec, "receive_from"); + return s; + } + + /// Receive a datagram with the endpoint of the sender. + /** + * This function is used to receive a datagram. The function call will block + * until data has been received successfully or an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the datagram. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes received. + */ + template + std::size_t receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, socket_base::message_flags flags, + autoboost::system::error_code& ec) + { + return this->get_service().receive_from(this->get_implementation(), + buffers, sender_endpoint, flags, ec); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive a datagram. The function + * call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the datagram. Ownership of the sender_endpoint object + * is retained by the caller, which must guarantee that it is valid until the + * handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code socket.async_receive_from( + * autoboost::asio::buffer(data, size), sender_endpoint, handler); @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive a datagram. The function + * call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the datagram. Ownership of the sender_endpoint object + * is retained by the caller, which must guarantee that it is valid until the + * handler is called. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // BOOST_ASIO_BASIC_DATAGRAM_SOCKET_HPP diff --git a/contrib/autoboost/boost/asio/basic_deadline_timer.hpp b/contrib/autoboost/boost/asio/basic_deadline_timer.hpp new file mode 100644 index 000000000..adee2bfc5 --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_deadline_timer.hpp @@ -0,0 +1,520 @@ +// +// basic_deadline_timer.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_DEADLINE_TIMER_HPP +#define BOOST_ASIO_BASIC_DEADLINE_TIMER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ + || defined(GENERATING_DOCUMENTATION) + +#include +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides waitable timer functionality. +/** + * The basic_deadline_timer class template provides the ability to perform a + * blocking or asynchronous wait for a timer to expire. + * + * A deadline timer is always in one of two states: "expired" or "not expired". + * If the wait() or async_wait() function is called on an expired timer, the + * wait operation will complete immediately. + * + * Most applications will use the autoboost::asio::deadline_timer typedef. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + * + * @par Examples + * Performing a blocking wait: + * @code + * // Construct a timer without setting an expiry time. + * autoboost::asio::deadline_timer timer(io_service); + * + * // Set an expiry time relative to now. + * timer.expires_from_now(autoboost::posix_time::seconds(5)); + * + * // Wait for the timer to expire. + * timer.wait(); + * @endcode + * + * @par + * Performing an asynchronous wait: + * @code + * void handler(const autoboost::system::error_code& error) + * { + * if (!error) + * { + * // Timer expired. + * } + * } + * + * ... + * + * // Construct a timer with an absolute expiry time. + * autoboost::asio::deadline_timer timer(io_service, + * autoboost::posix_time::time_from_string("2005-12-07 23:59:59.000")); + * + * // Start an asynchronous wait. + * timer.async_wait(handler); + * @endcode + * + * @par Changing an active deadline_timer's expiry time + * + * Changing the expiry time of a timer while there are pending asynchronous + * waits causes those wait operations to be cancelled. To ensure that the action + * associated with the timer is performed only once, use something like this: + * used: + * + * @code + * void on_some_event() + * { + * if (my_timer.expires_from_now(seconds(5)) > 0) + * { + * // We managed to cancel the timer. Start new asynchronous wait. + * my_timer.async_wait(on_timeout); + * } + * else + * { + * // Too late, timer has already expired! + * } + * } + * + * void on_timeout(const autoboost::system::error_code& e) + * { + * if (e != autoboost::asio::error::operation_aborted) + * { + * // Timer was not cancelled, take necessary action. + * } + * } + * @endcode + * + * @li The autoboost::asio::basic_deadline_timer::expires_from_now() function + * cancels any pending asynchronous waits, and returns the number of + * asynchronous waits that were cancelled. If it returns 0 then you were too + * late and the wait handler has already been executed, or will soon be + * executed. If it returns 1 then the wait handler was successfully cancelled. + * + * @li If a wait handler is cancelled, the autoboost::system::error_code passed to + * it contains the value autoboost::asio::error::operation_aborted. + */ +template , + typename TimerService = deadline_timer_service > +class basic_deadline_timer + : public basic_io_object +{ +public: + /// The time traits type. + typedef TimeTraits traits_type; + + /// The time type. + typedef typename traits_type::time_type time_type; + + /// The duration type. + typedef typename traits_type::duration_type duration_type; + + /// Constructor. + /** + * This constructor creates a timer without setting an expiry time. The + * expires_at() or expires_from_now() functions must be called to set an + * expiry time before the timer can be waited on. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + */ + explicit basic_deadline_timer(autoboost::asio::io_service& io_service) + : basic_io_object(io_service) + { + } + + /// Constructor to set a particular expiry time as an absolute time. + /** + * This constructor creates a timer and sets the expiry time. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + * + * @param expiry_time The expiry time to be used for the timer, expressed + * as an absolute time. + */ + basic_deadline_timer(autoboost::asio::io_service& io_service, + const time_type& expiry_time) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->service.expires_at(this->implementation, expiry_time, ec); + autoboost::asio::detail::throw_error(ec, "expires_at"); + } + + /// Constructor to set a particular expiry time relative to now. + /** + * This constructor creates a timer and sets the expiry time. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + * + * @param expiry_time The expiry time to be used for the timer, relative to + * now. + */ + basic_deadline_timer(autoboost::asio::io_service& io_service, + const duration_type& expiry_time) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->service.expires_from_now(this->implementation, expiry_time, ec); + autoboost::asio::detail::throw_error(ec, "expires_from_now"); + } + + /// Cancel any asynchronous operations that are waiting on the timer. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the timer. The handler for each cancelled operation will + * be invoked with the autoboost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel() + { + autoboost::system::error_code ec; + std::size_t s = this->service.cancel(this->implementation, ec); + autoboost::asio::detail::throw_error(ec, "cancel"); + return s; + } + + /// Cancel any asynchronous operations that are waiting on the timer. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the timer. The handler for each cancelled operation will + * be invoked with the autoboost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel(autoboost::system::error_code& ec) + { + return this->service.cancel(this->implementation, ec); + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * autoboost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when cancel_one() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel_one() + { + autoboost::system::error_code ec; + std::size_t s = this->service.cancel_one(this->implementation, ec); + autoboost::asio::detail::throw_error(ec, "cancel_one"); + return s; + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * autoboost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @note If the timer has already expired when cancel_one() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel_one(autoboost::system::error_code& ec) + { + return this->service.cancel_one(this->implementation, ec); + } + + /// Get the timer's expiry time as an absolute time. + /** + * This function may be used to obtain the timer's current expiry time. + * Whether the timer has expired or not does not affect this value. + */ + time_type expires_at() const + { + return this->service.expires_at(this->implementation); + } + + /// Set the timer's expiry time as an absolute time. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the autoboost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when expires_at() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_at(const time_type& expiry_time) + { + autoboost::system::error_code ec; + std::size_t s = this->service.expires_at( + this->implementation, expiry_time, ec); + autoboost::asio::detail::throw_error(ec, "expires_at"); + return s; + } + + /// Set the timer's expiry time as an absolute time. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the autoboost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when expires_at() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_at(const time_type& expiry_time, + autoboost::system::error_code& ec) + { + return this->service.expires_at(this->implementation, expiry_time, ec); + } + + /// Get the timer's expiry time relative to now. + /** + * This function may be used to obtain the timer's current expiry time. + * Whether the timer has expired or not does not affect this value. + */ + duration_type expires_from_now() const + { + return this->service.expires_from_now(this->implementation); + } + + /// Set the timer's expiry time relative to now. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the autoboost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when expires_from_now() is called, + * then the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_from_now(const duration_type& expiry_time) + { + autoboost::system::error_code ec; + std::size_t s = this->service.expires_from_now( + this->implementation, expiry_time, ec); + autoboost::asio::detail::throw_error(ec, "expires_from_now"); + return s; + } + + /// Set the timer's expiry time relative to now. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the autoboost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when expires_from_now() is called, + * then the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_from_now(const duration_type& expiry_time, + autoboost::system::error_code& ec) + { + return this->service.expires_from_now( + this->implementation, expiry_time, ec); + } + + /// Perform a blocking wait on the timer. + /** + * This function is used to wait for the timer to expire. This function + * blocks and does not return until the timer has expired. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void wait() + { + autoboost::system::error_code ec; + this->service.wait(this->implementation, ec); + autoboost::asio::detail::throw_error(ec, "wait"); + } + + /// Perform a blocking wait on the timer. + /** + * This function is used to wait for the timer to expire. This function + * blocks and does not return until the timer has expired. + * + * @param ec Set to indicate what error occurred, if any. + */ + void wait(autoboost::system::error_code& ec) + { + this->service.wait(this->implementation, ec); + } + + /// Start an asynchronous wait on the timer. + /** + * This function may be used to initiate an asynchronous wait against the + * timer. It always returns immediately. + * + * For each call to async_wait(), the supplied handler will be called exactly + * once. The handler will be called when: + * + * @li The timer has expired. + * + * @li The timer was cancelled, in which case the handler is passed the error + * code autoboost::asio::error::operation_aborted. + * + * @param handler The handler to be called when the timer expires. Copies + * will be made of the handler as required. The function signature of the + * handler must be: + * @code void handler( + * const autoboost::system::error_code& error // Result of operation. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WaitHandler, + void (autoboost::system::error_code)) + async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WaitHandler. + BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; + + return this->service.async_wait(this->implementation, + BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_BASIC_DEADLINE_TIMER_HPP diff --git a/contrib/autoboost/boost/asio/basic_io_object.hpp b/contrib/autoboost/boost/asio/basic_io_object.hpp new file mode 100644 index 000000000..236446850 --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_io_object.hpp @@ -0,0 +1,242 @@ +// +// basic_io_object.hpp +// ~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_IO_OBJECT_HPP +#define BOOST_ASIO_BASIC_IO_OBJECT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include + +#include + +namespace autoboost { +namespace asio { + +#if defined(BOOST_ASIO_HAS_MOVE) +namespace detail +{ + // Type trait used to determine whether a service supports move. + template + class service_has_move + { + private: + typedef IoObjectService service_type; + typedef typename service_type::implementation_type implementation_type; + + template + static auto eval(T* t, U* u) -> decltype(t->move_construct(*u, *u), char()); + static char (&eval(...))[2]; + + public: + static const bool value = + sizeof(service_has_move::eval( + static_cast(0), + static_cast(0))) == 1; + }; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + +/// Base class for all I/O objects. +/** + * @note All I/O objects are non-copyable. However, when using C++0x, certain + * I/O objects do support move construction and move assignment. + */ +#if !defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) +template +#else +template ::value> +#endif +class basic_io_object +{ +public: + /// The type of the service that will be used to provide I/O operations. + typedef IoObjectService service_type; + + /// The underlying implementation type of I/O object. + typedef typename service_type::implementation_type implementation_type; + + /// Get the io_service associated with the object. + /** + * This function may be used to obtain the io_service object that the I/O + * object uses to dispatch handlers for asynchronous operations. + * + * @return A reference to the io_service object that the I/O object will use + * to dispatch handlers. Ownership is not transferred to the caller. + */ + autoboost::asio::io_service& get_io_service() + { + return service.get_io_service(); + } + +protected: + /// Construct a basic_io_object. + /** + * Performs: + * @code get_service().construct(get_implementation()); @endcode + */ + explicit basic_io_object(autoboost::asio::io_service& io_service) + : service(autoboost::asio::use_service(io_service)) + { + service.construct(implementation); + } + +#if defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_io_object. + /** + * Performs: + * @code get_service().move_construct( + * get_implementation(), other.get_implementation()); @endcode + * + * @note Available only for services that support movability, + */ + basic_io_object(basic_io_object&& other); + + /// Move-assign a basic_io_object. + /** + * Performs: + * @code get_service().move_assign(get_implementation(), + * other.get_service(), other.get_implementation()); @endcode + * + * @note Available only for services that support movability, + */ + basic_io_object& operator=(basic_io_object&& other); +#endif // defined(GENERATING_DOCUMENTATION) + + /// Protected destructor to prevent deletion through this type. + /** + * Performs: + * @code get_service().destroy(get_implementation()); @endcode + */ + ~basic_io_object() + { + service.destroy(implementation); + } + + /// Get the service associated with the I/O object. + service_type& get_service() + { + return service; + } + + /// Get the service associated with the I/O object. + const service_type& get_service() const + { + return service; + } + + /// (Deprecated: Use get_service().) The service associated with the I/O + /// object. + /** + * @note Available only for services that do not support movability. + */ + service_type& service; + + /// Get the underlying implementation of the I/O object. + implementation_type& get_implementation() + { + return implementation; + } + + /// Get the underlying implementation of the I/O object. + const implementation_type& get_implementation() const + { + return implementation; + } + + /// (Deprecated: Use get_implementation().) The underlying implementation of + /// the I/O object. + implementation_type implementation; + +private: + basic_io_object(const basic_io_object&); + basic_io_object& operator=(const basic_io_object&); +}; + +#if defined(BOOST_ASIO_HAS_MOVE) +// Specialisation for movable objects. +template +class basic_io_object +{ +public: + typedef IoObjectService service_type; + typedef typename service_type::implementation_type implementation_type; + + autoboost::asio::io_service& get_io_service() + { + return service_->get_io_service(); + } + +protected: + explicit basic_io_object(autoboost::asio::io_service& io_service) + : service_(&autoboost::asio::use_service(io_service)) + { + service_->construct(implementation); + } + + basic_io_object(basic_io_object&& other) + : service_(&other.get_service()) + { + service_->move_construct(implementation, other.implementation); + } + + ~basic_io_object() + { + service_->destroy(implementation); + } + + basic_io_object& operator=(basic_io_object&& other) + { + service_->move_assign(implementation, + *other.service_, other.implementation); + service_ = other.service_; + return *this; + } + + service_type& get_service() + { + return *service_; + } + + const service_type& get_service() const + { + return *service_; + } + + implementation_type& get_implementation() + { + return implementation; + } + + const implementation_type& get_implementation() const + { + return implementation; + } + + implementation_type implementation; + +private: + basic_io_object(const basic_io_object&); + void operator=(const basic_io_object&); + + IoObjectService* service_; +}; +#endif // defined(BOOST_ASIO_HAS_MOVE) + +} // namespace asio +} // namespace autoboost + +#include + +#endif // BOOST_ASIO_BASIC_IO_OBJECT_HPP diff --git a/contrib/autoboost/boost/asio/basic_raw_socket.hpp b/contrib/autoboost/boost/asio/basic_raw_socket.hpp new file mode 100644 index 000000000..73cddf834 --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_raw_socket.hpp @@ -0,0 +1,942 @@ +// +// basic_raw_socket.hpp +// ~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_RAW_SOCKET_HPP +#define BOOST_ASIO_BASIC_RAW_SOCKET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides raw-oriented socket functionality. +/** + * The basic_raw_socket class template provides asynchronous and blocking + * raw-oriented socket functionality. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template > +class basic_raw_socket + : public basic_socket +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename RawSocketService::native_handle_type native_type; + + /// The native representation of a socket. + typedef typename RawSocketService::native_handle_type native_handle_type; + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// Construct a basic_raw_socket without opening it. + /** + * This constructor creates a raw socket without opening it. The open() + * function must be called before data can be sent or received on the socket. + * + * @param io_service The io_service object that the raw socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + */ + explicit basic_raw_socket(autoboost::asio::io_service& io_service) + : basic_socket(io_service) + { + } + + /// Construct and open a basic_raw_socket. + /** + * This constructor creates and opens a raw socket. + * + * @param io_service The io_service object that the raw socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_raw_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol) + : basic_socket(io_service, protocol) + { + } + + /// Construct a basic_raw_socket, opening it and binding it to the given + /// local endpoint. + /** + * This constructor creates a raw socket and automatically opens it bound + * to the specified endpoint on the local machine. The protocol used is the + * protocol associated with the given endpoint. + * + * @param io_service The io_service object that the raw socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + * + * @param endpoint An endpoint on the local machine to which the raw + * socket will be bound. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_raw_socket(autoboost::asio::io_service& io_service, + const endpoint_type& endpoint) + : basic_socket(io_service, endpoint) + { + } + + /// Construct a basic_raw_socket on an existing native socket. + /** + * This constructor creates a raw socket object to hold an existing + * native socket. + * + * @param io_service The io_service object that the raw socket will use + * to dispatch handlers for any asynchronous operations performed on the + * socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @param native_socket The new underlying socket implementation. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_raw_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol, const native_handle_type& native_socket) + : basic_socket( + io_service, protocol, native_socket) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_raw_socket from another. + /** + * This constructor moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + basic_raw_socket(basic_raw_socket&& other) + : basic_socket( + BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other)) + { + } + + /// Move-assign a basic_raw_socket from another. + /** + * This assignment operator moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + basic_raw_socket& operator=(basic_raw_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other)); + return *this; + } + + /// Move-construct a basic_raw_socket from a socket of another protocol type. + /** + * This constructor moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + template + basic_raw_socket(basic_raw_socket&& other, + typename enable_if::value>::type* = 0) + : basic_socket( + BOOST_ASIO_MOVE_CAST2(basic_raw_socket< + Protocol1, RawSocketService1>)(other)) + { + } + + /// Move-assign a basic_raw_socket from a socket of another protocol type. + /** + * This assignment operator moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_raw_socket>::type& operator=( + basic_raw_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST2(basic_raw_socket< + Protocol1, RawSocketService1>)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Send some data on a connected socket. + /** + * This function is used to send data on the raw socket. The function call + * will block until the data has been sent successfully or an error occurs. + * + * @param buffers One ore more data buffers to be sent on the socket. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The send operation can only be used with a connected socket. Use + * the send_to function to send data on an unconnected raw socket. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code socket.send(autoboost::asio::buffer(data, size)); @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t send(const ConstBufferSequence& buffers) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + autoboost::asio::detail::throw_error(ec, "send"); + return s; + } + + /// Send some data on a connected socket. + /** + * This function is used to send data on the raw socket. The function call + * will block until the data has been sent successfully or an error occurs. + * + * @param buffers One ore more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The send operation can only be used with a connected socket. Use + * the send_to function to send data on an unconnected raw socket. + */ + template + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + autoboost::asio::detail::throw_error(ec, "send"); + return s; + } + + /// Send some data on a connected socket. + /** + * This function is used to send data on the raw socket. The function call + * will block until the data has been sent successfully or an error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes sent. + * + * @note The send operation can only be used with a connected socket. Use + * the send_to function to send data on an unconnected raw socket. + */ + template + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, autoboost::system::error_code& ec) + { + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); + } + + /// Start an asynchronous send on a connected socket. + /** + * This function is used to send data on the raw socket. The function call + * will block until the data has been sent successfully or an error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. Although + * the buffers object may be copied as necessary, ownership of the underlying + * memory blocks is retained by the caller, which must guarantee that they + * remain valid until the handler is called. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_send operation can only be used with a connected socket. + * Use the async_send_to function to send data on an unconnected raw + * socket. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.async_send(autoboost::asio::buffer(data, size), handler); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Start an asynchronous send on a connected socket. + /** + * This function is used to send data on the raw socket. The function call + * will block until the data has been sent successfully or an error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. Although + * the buffers object may be copied as necessary, ownership of the underlying + * memory blocks is retained by the caller, which must guarantee that they + * remain valid until the handler is called. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_send operation can only be used with a connected socket. + * Use the async_send_to function to send data on an unconnected raw + * socket. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Send raw data to the specified endpoint. + /** + * This function is used to send raw data to the specified remote endpoint. + * The function call will block until the data has been sent successfully or + * an error occurs. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * + * @param destination The remote endpoint to which the data will be sent. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * autoboost::asio::ip::udp::endpoint destination( + * autoboost::asio::ip::address::from_string("1.2.3.4"), 12345); + * socket.send_to(autoboost::asio::buffer(data, size), destination); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, 0, ec); + autoboost::asio::detail::throw_error(ec, "send_to"); + return s; + } + + /// Send raw data to the specified endpoint. + /** + * This function is used to send raw data to the specified remote endpoint. + * The function call will block until the data has been sent successfully or + * an error occurs. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * + * @param destination The remote endpoint to which the data will be sent. + * + * @param flags Flags specifying how the send call is to be made. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + template + std::size_t send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, flags, ec); + autoboost::asio::detail::throw_error(ec, "send_to"); + return s; + } + + /// Send raw data to the specified endpoint. + /** + * This function is used to send raw data to the specified remote endpoint. + * The function call will block until the data has been sent successfully or + * an error occurs. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * + * @param destination The remote endpoint to which the data will be sent. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes sent. + */ + template + std::size_t send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, socket_base::message_flags flags, + autoboost::system::error_code& ec) + { + return this->get_service().send_to(this->get_implementation(), + buffers, destination, flags, ec); + } + + /// Start an asynchronous send. + /** + * This function is used to asynchronously send raw data to the specified + * remote endpoint. The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param destination The remote endpoint to which the data will be sent. + * Copies will be made of the endpoint as required. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * autoboost::asio::ip::udp::endpoint destination( + * autoboost::asio::ip::address::from_string("1.2.3.4"), 12345); + * socket.async_send_to( + * autoboost::asio::buffer(data, size), destination, handler); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send_to(this->get_implementation(), + buffers, destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Start an asynchronous send. + /** + * This function is used to asynchronously send raw data to the specified + * remote endpoint. The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent to the remote endpoint. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param destination The remote endpoint to which the data will be sent. + * Copies will be made of the endpoint as required. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send_to(const ConstBufferSequence& buffers, + const endpoint_type& destination, socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send_to( + this->get_implementation(), buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the raw socket. The function + * call will block until data has been received successfully or an error + * occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The receive operation can only be used with a connected socket. Use + * the receive_from function to receive data on an unconnected raw + * socket. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code socket.receive(autoboost::asio::buffer(data, size)); @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t receive(const MutableBufferSequence& buffers) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + autoboost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the raw socket. The function + * call will block until data has been received successfully or an error + * occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The receive operation can only be used with a connected socket. Use + * the receive_from function to receive data on an unconnected raw + * socket. + */ + template + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + autoboost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the raw socket. The function + * call will block until data has been received successfully or an error + * occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes received. + * + * @note The receive operation can only be used with a connected socket. Use + * the receive_from function to receive data on an unconnected raw + * socket. + */ + template + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags flags, autoboost::system::error_code& ec) + { + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + } + + /// Start an asynchronous receive on a connected socket. + /** + * This function is used to asynchronously receive data from the raw + * socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_receive operation can only be used with a connected socket. + * Use the async_receive_from function to receive data on an unconnected + * raw socket. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive(autoboost::asio::buffer(data, size), handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Start an asynchronous receive on a connected socket. + /** + * This function is used to asynchronously receive data from the raw + * socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The async_receive operation can only be used with a connected socket. + * Use the async_receive_from function to receive data on an unconnected + * raw socket. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Receive raw data with the endpoint of the sender. + /** + * This function is used to receive raw data. The function call will block + * until data has been received successfully or an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the data. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * autoboost::asio::ip::udp::endpoint sender_endpoint; + * socket.receive_from( + * autoboost::asio::buffer(data, size), sender_endpoint); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, ec); + autoboost::asio::detail::throw_error(ec, "receive_from"); + return s; + } + + /// Receive raw data with the endpoint of the sender. + /** + * This function is used to receive raw data. The function call will block + * until data has been received successfully or an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the data. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + template + std::size_t receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, ec); + autoboost::asio::detail::throw_error(ec, "receive_from"); + return s; + } + + /// Receive raw data with the endpoint of the sender. + /** + * This function is used to receive raw data. The function call will block + * until data has been received successfully or an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the data. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes received. + */ + template + std::size_t receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, socket_base::message_flags flags, + autoboost::system::error_code& ec) + { + return this->get_service().receive_from(this->get_implementation(), + buffers, sender_endpoint, flags, ec); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive raw data. The function + * call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the data. Ownership of the sender_endpoint object + * is retained by the caller, which must guarantee that it is valid until the + * handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code socket.async_receive_from( + * autoboost::asio::buffer(data, size), 0, sender_endpoint, handler); @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive raw data. The function + * call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param sender_endpoint An endpoint object that receives the endpoint of + * the remote sender of the data. Ownership of the sender_endpoint object + * is retained by the caller, which must guarantee that it is valid until the + * handler is called. + * + * @param flags Flags specifying how the receive call is to be made. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive_from(const MutableBufferSequence& buffers, + endpoint_type& sender_endpoint, socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // BOOST_ASIO_BASIC_RAW_SOCKET_HPP diff --git a/contrib/autoboost/boost/asio/basic_seq_packet_socket.hpp b/contrib/autoboost/boost/asio/basic_seq_packet_socket.hpp new file mode 100644 index 000000000..99cc18ac1 --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_seq_packet_socket.hpp @@ -0,0 +1,567 @@ +// +// basic_seq_packet_socket.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP +#define BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides sequenced packet socket functionality. +/** + * The basic_seq_packet_socket class template provides asynchronous and blocking + * sequenced packet socket functionality. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template > +class basic_seq_packet_socket + : public basic_socket +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename SeqPacketSocketService::native_handle_type native_type; + + /// The native representation of a socket. + typedef typename SeqPacketSocketService::native_handle_type + native_handle_type; + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// Construct a basic_seq_packet_socket without opening it. + /** + * This constructor creates a sequenced packet socket without opening it. The + * socket needs to be opened and then connected or accepted before data can + * be sent or received on it. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + */ + explicit basic_seq_packet_socket(autoboost::asio::io_service& io_service) + : basic_socket(io_service) + { + } + + /// Construct and open a basic_seq_packet_socket. + /** + * This constructor creates and opens a sequenced_packet socket. The socket + * needs to be connected or accepted before data can be sent or received on + * it. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol) + : basic_socket(io_service, protocol) + { + } + + /// Construct a basic_seq_packet_socket, opening it and binding it to the + /// given local endpoint. + /** + * This constructor creates a sequenced packet socket and automatically opens + * it bound to the specified endpoint on the local machine. The protocol used + * is the protocol associated with the given endpoint. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param endpoint An endpoint on the local machine to which the sequenced + * packet socket will be bound. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(autoboost::asio::io_service& io_service, + const endpoint_type& endpoint) + : basic_socket(io_service, endpoint) + { + } + + /// Construct a basic_seq_packet_socket on an existing native socket. + /** + * This constructor creates a sequenced packet socket object to hold an + * existing native socket. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @param native_socket The new underlying socket implementation. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol, const native_handle_type& native_socket) + : basic_socket( + io_service, protocol, native_socket) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_seq_packet_socket from another. + /** + * This constructor moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + basic_seq_packet_socket(basic_seq_packet_socket&& other) + : basic_socket( + BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other)) + { + } + + /// Move-assign a basic_seq_packet_socket from another. + /** + * This assignment operator moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + basic_seq_packet_socket& operator=(basic_seq_packet_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other)); + return *this; + } + + /// Move-construct a basic_seq_packet_socket from a socket of another protocol + /// type. + /** + * This constructor moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + template + basic_seq_packet_socket( + basic_seq_packet_socket&& other, + typename enable_if::value>::type* = 0) + : basic_socket( + BOOST_ASIO_MOVE_CAST2(basic_seq_packet_socket< + Protocol1, SeqPacketSocketService1>)(other)) + { + } + + /// Move-assign a basic_seq_packet_socket from a socket of another protocol + /// type. + /** + * This assignment operator moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_seq_packet_socket>::type& operator=( + basic_seq_packet_socket&& other) + { + basic_socket::operator=( + BOOST_ASIO_MOVE_CAST2(basic_seq_packet_socket< + Protocol1, SeqPacketSocketService1>)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Send some data on the socket. + /** + * This function is used to send data on the sequenced packet socket. The + * function call will block until the data has been sent successfully, or an + * until error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @returns The number of bytes sent. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.send(autoboost::asio::buffer(data, size), 0); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + autoboost::asio::detail::throw_error(ec, "send"); + return s; + } + + /// Send some data on the socket. + /** + * This function is used to send data on the sequenced packet socket. The + * function call will block the data has been sent successfully, or an until + * error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes sent. Returns 0 if an error occurred. + * + * @note The send operation may not transmit all of the data to the peer. + * Consider using the @ref write function if you need to ensure that all data + * is written before the blocking operation completes. + */ + template + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, autoboost::system::error_code& ec) + { + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); + } + + /// Start an asynchronous send. + /** + * This function is used to asynchronously send data on the sequenced packet + * socket. The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent on the socket. Although + * the buffers object may be copied as necessary, ownership of the underlying + * memory blocks is retained by the caller, which must guarantee that they + * remain valid until the handler is called. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.async_send(autoboost::asio::buffer(data, size), 0, handler); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Receive some data on the socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. An error code of + * autoboost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.receive(autoboost::asio::buffer(data, size), out_flags); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, out_flags, ec); + autoboost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on the socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @returns The number of bytes received. + * + * @throws autoboost::system::system_error Thrown on failure. An error code of + * autoboost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @note The receive operation may not receive all of the requested number of + * bytes. Consider using the @ref read function if you need to ensure that the + * requested amount of data is read before the blocking operation completes. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.receive(autoboost::asio::buffer(data, size), 0, out_flags); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, in_flags, out_flags, ec); + autoboost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes received. Returns 0 if an error occurred. + * + * @note The receive operation may not receive all of the requested number of + * bytes. Consider using the @ref read function if you need to ensure that the + * requested amount of data is read before the blocking operation completes. + */ + template + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, autoboost::system::error_code& ec) + { + return this->get_service().receive(this->get_implementation(), + buffers, in_flags, out_flags, ec); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive data from the sequenced + * packet socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param out_flags Once the asynchronous operation completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. The caller must guarantee that the referenced + * variable remains valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive(autoboost::asio::buffer(data, size), out_flags, handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive( + this->get_implementation(), buffers, 0, out_flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive data from the sequenced + * data socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags Once the asynchronous operation completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. The caller must guarantee that the referenced + * variable remains valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive( + * autoboost::asio::buffer(data, size), + * 0, out_flags, handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_receive( + this->get_implementation(), buffers, in_flags, out_flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP diff --git a/contrib/autoboost/boost/asio/basic_serial_port.hpp b/contrib/autoboost/boost/asio/basic_serial_port.hpp new file mode 100644 index 000000000..9ae1f20b1 --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_serial_port.hpp @@ -0,0 +1,697 @@ +// +// basic_serial_port.hpp +// ~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.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_ASIO_BASIC_SERIAL_PORT_HPP +#define BOOST_ASIO_BASIC_SERIAL_PORT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if defined(BOOST_ASIO_HAS_SERIAL_PORT) \ + || defined(GENERATING_DOCUMENTATION) + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides serial port functionality. +/** + * The basic_serial_port class template provides functionality that is common + * to all serial ports. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template +class basic_serial_port + : public basic_io_object, + public serial_port_base +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// serial port. + typedef typename SerialPortService::native_handle_type native_type; + + /// The native representation of a serial port. + typedef typename SerialPortService::native_handle_type native_handle_type; + + /// A basic_serial_port is always the lowest layer. + typedef basic_serial_port lowest_layer_type; + + /// Construct a basic_serial_port without opening it. + /** + * This constructor creates a serial port without opening it. + * + * @param io_service The io_service object that the serial port will use to + * dispatch handlers for any asynchronous operations performed on the port. + */ + explicit basic_serial_port(autoboost::asio::io_service& io_service) + : basic_io_object(io_service) + { + } + + /// Construct and open a basic_serial_port. + /** + * This constructor creates and opens a serial port for the specified device + * name. + * + * @param io_service The io_service object that the serial port will use to + * dispatch handlers for any asynchronous operations performed on the port. + * + * @param device The platform-specific device name for this serial + * port. + */ + explicit basic_serial_port(autoboost::asio::io_service& io_service, + const char* device) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->get_service().open(this->get_implementation(), device, ec); + autoboost::asio::detail::throw_error(ec, "open"); + } + + /// Construct and open a basic_serial_port. + /** + * This constructor creates and opens a serial port for the specified device + * name. + * + * @param io_service The io_service object that the serial port will use to + * dispatch handlers for any asynchronous operations performed on the port. + * + * @param device The platform-specific device name for this serial + * port. + */ + explicit basic_serial_port(autoboost::asio::io_service& io_service, + const std::string& device) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->get_service().open(this->get_implementation(), device, ec); + autoboost::asio::detail::throw_error(ec, "open"); + } + + /// Construct a basic_serial_port on an existing native serial port. + /** + * This constructor creates a serial port object to hold an existing native + * serial port. + * + * @param io_service The io_service object that the serial port will use to + * dispatch handlers for any asynchronous operations performed on the port. + * + * @param native_serial_port A native serial port. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_serial_port(autoboost::asio::io_service& io_service, + const native_handle_type& native_serial_port) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->get_service().assign(this->get_implementation(), + native_serial_port, ec); + autoboost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_serial_port from another. + /** + * This constructor moves a serial port from one object to another. + * + * @param other The other basic_serial_port object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_serial_port(io_service&) constructor. + */ + basic_serial_port(basic_serial_port&& other) + : basic_io_object( + BOOST_ASIO_MOVE_CAST(basic_serial_port)(other)) + { + } + + /// Move-assign a basic_serial_port from another. + /** + * This assignment operator moves a serial port from one object to another. + * + * @param other The other basic_serial_port object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_serial_port(io_service&) constructor. + */ + basic_serial_port& operator=(basic_serial_port&& other) + { + basic_io_object::operator=( + BOOST_ASIO_MOVE_CAST(basic_serial_port)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Get a reference to the lowest layer. + /** + * This function returns a reference to the lowest layer in a stack of + * layers. Since a basic_serial_port cannot contain any further layers, it + * simply returns a reference to itself. + * + * @return A reference to the lowest layer in the stack of layers. Ownership + * is not transferred to the caller. + */ + lowest_layer_type& lowest_layer() + { + return *this; + } + + /// Get a const reference to the lowest layer. + /** + * This function returns a const reference to the lowest layer in a stack of + * layers. Since a basic_serial_port cannot contain any further layers, it + * simply returns a reference to itself. + * + * @return A const reference to the lowest layer in the stack of layers. + * Ownership is not transferred to the caller. + */ + const lowest_layer_type& lowest_layer() const + { + return *this; + } + + /// Open the serial port using the specified device name. + /** + * This function opens the serial port for the specified device name. + * + * @param device The platform-specific device name. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void open(const std::string& device) + { + autoboost::system::error_code ec; + this->get_service().open(this->get_implementation(), device, ec); + autoboost::asio::detail::throw_error(ec, "open"); + } + + /// Open the serial port using the specified device name. + /** + * This function opens the serial port using the given platform-specific + * device name. + * + * @param device The platform-specific device name. + * + * @param ec Set the indicate what error occurred, if any. + */ + autoboost::system::error_code open(const std::string& device, + autoboost::system::error_code& ec) + { + return this->get_service().open(this->get_implementation(), device, ec); + } + + /// Assign an existing native serial port to the serial port. + /* + * This function opens the serial port to hold an existing native serial port. + * + * @param native_serial_port A native serial port. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void assign(const native_handle_type& native_serial_port) + { + autoboost::system::error_code ec; + this->get_service().assign(this->get_implementation(), + native_serial_port, ec); + autoboost::asio::detail::throw_error(ec, "assign"); + } + + /// Assign an existing native serial port to the serial port. + /* + * This function opens the serial port to hold an existing native serial port. + * + * @param native_serial_port A native serial port. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code assign(const native_handle_type& native_serial_port, + autoboost::system::error_code& ec) + { + return this->get_service().assign(this->get_implementation(), + native_serial_port, ec); + } + + /// Determine whether the serial port is open. + bool is_open() const + { + return this->get_service().is_open(this->get_implementation()); + } + + /// Close the serial port. + /** + * This function is used to close the serial port. Any asynchronous read or + * write operations will be cancelled immediately, and will complete with the + * autoboost::asio::error::operation_aborted error. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void close() + { + autoboost::system::error_code ec; + this->get_service().close(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "close"); + } + + /// Close the serial port. + /** + * This function is used to close the serial port. Any asynchronous read or + * write operations will be cancelled immediately, and will complete with the + * autoboost::asio::error::operation_aborted error. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code close(autoboost::system::error_code& ec) + { + return this->get_service().close(this->get_implementation(), ec); + } + + /// (Deprecated: Use native_handle().) Get the native serial port + /// representation. + /** + * This function may be used to obtain the underlying representation of the + * serial port. This is intended to allow access to native serial port + * functionality that is not otherwise provided. + */ + native_type native() + { + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native serial port representation. + /** + * This function may be used to obtain the underlying representation of the + * serial port. This is intended to allow access to native serial port + * functionality that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->get_implementation()); + } + + /// Cancel all asynchronous operations associated with the serial port. + /** + * This function causes all outstanding asynchronous read or write operations + * to finish immediately, and the handlers for cancelled operations will be + * passed the autoboost::asio::error::operation_aborted error. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void cancel() + { + autoboost::system::error_code ec; + this->get_service().cancel(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "cancel"); + } + + /// Cancel all asynchronous operations associated with the serial port. + /** + * This function causes all outstanding asynchronous read or write operations + * to finish immediately, and the handlers for cancelled operations will be + * passed the autoboost::asio::error::operation_aborted error. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code cancel(autoboost::system::error_code& ec) + { + return this->get_service().cancel(this->get_implementation(), ec); + } + + /// Send a break sequence to the serial port. + /** + * This function causes a break sequence of platform-specific duration to be + * sent out the serial port. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void send_break() + { + autoboost::system::error_code ec; + this->get_service().send_break(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "send_break"); + } + + /// Send a break sequence to the serial port. + /** + * This function causes a break sequence of platform-specific duration to be + * sent out the serial port. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code send_break(autoboost::system::error_code& ec) + { + return this->get_service().send_break(this->get_implementation(), ec); + } + + /// Set an option on the serial port. + /** + * This function is used to set an option on the serial port. + * + * @param option The option value to be set on the serial port. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa SettableSerialPortOption @n + * autoboost::asio::serial_port_base::baud_rate @n + * autoboost::asio::serial_port_base::flow_control @n + * autoboost::asio::serial_port_base::parity @n + * autoboost::asio::serial_port_base::stop_bits @n + * autoboost::asio::serial_port_base::character_size + */ + template + void set_option(const SettableSerialPortOption& option) + { + autoboost::system::error_code ec; + this->get_service().set_option(this->get_implementation(), option, ec); + autoboost::asio::detail::throw_error(ec, "set_option"); + } + + /// Set an option on the serial port. + /** + * This function is used to set an option on the serial port. + * + * @param option The option value to be set on the serial port. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa SettableSerialPortOption @n + * autoboost::asio::serial_port_base::baud_rate @n + * autoboost::asio::serial_port_base::flow_control @n + * autoboost::asio::serial_port_base::parity @n + * autoboost::asio::serial_port_base::stop_bits @n + * autoboost::asio::serial_port_base::character_size + */ + template + autoboost::system::error_code set_option(const SettableSerialPortOption& option, + autoboost::system::error_code& ec) + { + return this->get_service().set_option( + this->get_implementation(), option, ec); + } + + /// Get an option from the serial port. + /** + * This function is used to get the current value of an option on the serial + * port. + * + * @param option The option value to be obtained from the serial port. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa GettableSerialPortOption @n + * autoboost::asio::serial_port_base::baud_rate @n + * autoboost::asio::serial_port_base::flow_control @n + * autoboost::asio::serial_port_base::parity @n + * autoboost::asio::serial_port_base::stop_bits @n + * autoboost::asio::serial_port_base::character_size + */ + template + void get_option(GettableSerialPortOption& option) + { + autoboost::system::error_code ec; + this->get_service().get_option(this->get_implementation(), option, ec); + autoboost::asio::detail::throw_error(ec, "get_option"); + } + + /// Get an option from the serial port. + /** + * This function is used to get the current value of an option on the serial + * port. + * + * @param option The option value to be obtained from the serial port. + * + * @param ec Set to indicate what error occured, if any. + * + * @sa GettableSerialPortOption @n + * autoboost::asio::serial_port_base::baud_rate @n + * autoboost::asio::serial_port_base::flow_control @n + * autoboost::asio::serial_port_base::parity @n + * autoboost::asio::serial_port_base::stop_bits @n + * autoboost::asio::serial_port_base::character_size + */ + template + autoboost::system::error_code get_option(GettableSerialPortOption& option, + autoboost::system::error_code& ec) + { + return this->get_service().get_option( + this->get_implementation(), option, ec); + } + + /// Write some data to the serial port. + /** + * This function is used to write data to the serial port. The function call + * will block until one or more bytes of the data has been written + * successfully, or until an error occurs. + * + * @param buffers One or more data buffers to be written to the serial port. + * + * @returns The number of bytes written. + * + * @throws autoboost::system::system_error Thrown on failure. An error code of + * autoboost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @note The write_some operation may not transmit all of the data to the + * peer. Consider using the @ref write function if you need to ensure that + * all data is written before the blocking operation completes. + * + * @par Example + * To write a single data buffer use the @ref buffer function as follows: + * @code + * serial_port.write_some(autoboost::asio::buffer(data, size)); + * @endcode + * See the @ref buffer documentation for information on writing multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t write_some(const ConstBufferSequence& buffers) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().write_some( + this->get_implementation(), buffers, ec); + autoboost::asio::detail::throw_error(ec, "write_some"); + return s; + } + + /// Write some data to the serial port. + /** + * This function is used to write data to the serial port. The function call + * will block until one or more bytes of the data has been written + * successfully, or until an error occurs. + * + * @param buffers One or more data buffers to be written to the serial port. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes written. Returns 0 if an error occurred. + * + * @note The write_some operation may not transmit all of the data to the + * peer. Consider using the @ref write function if you need to ensure that + * all data is written before the blocking operation completes. + */ + template + std::size_t write_some(const ConstBufferSequence& buffers, + autoboost::system::error_code& ec) + { + return this->get_service().write_some( + this->get_implementation(), buffers, ec); + } + + /// Start an asynchronous write. + /** + * This function is used to asynchronously write data to the serial port. + * The function call always returns immediately. + * + * @param buffers One or more data buffers to be written to the serial port. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param handler The handler to be called when the write operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes written. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The write operation may not transmit all of the data to the peer. + * Consider using the @ref async_write function if you need to ensure that all + * data is written before the asynchronous operation completes. + * + * @par Example + * To write a single data buffer use the @ref buffer function as follows: + * @code + * serial_port.async_write_some(autoboost::asio::buffer(data, size), handler); + * @endcode + * See the @ref buffer documentation for information on writing multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, + void (autoboost::system::error_code, std::size_t)) + async_write_some(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + return this->get_service().async_write_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Read some data from the serial port. + /** + * This function is used to read data from the serial port. The function + * call will block until one or more bytes of data has been read successfully, + * or until an error occurs. + * + * @param buffers One or more buffers into which the data will be read. + * + * @returns The number of bytes read. + * + * @throws autoboost::system::system_error Thrown on failure. An error code of + * autoboost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @note The read_some operation may not read all of the requested number of + * bytes. Consider using the @ref read function if you need to ensure that + * the requested amount of data is read before the blocking operation + * completes. + * + * @par Example + * To read into a single data buffer use the @ref buffer function as follows: + * @code + * serial_port.read_some(autoboost::asio::buffer(data, size)); + * @endcode + * See the @ref buffer documentation for information on reading into multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + std::size_t read_some(const MutableBufferSequence& buffers) + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().read_some( + this->get_implementation(), buffers, ec); + autoboost::asio::detail::throw_error(ec, "read_some"); + return s; + } + + /// Read some data from the serial port. + /** + * This function is used to read data from the serial port. The function + * call will block until one or more bytes of data has been read successfully, + * or until an error occurs. + * + * @param buffers One or more buffers into which the data will be read. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes read. Returns 0 if an error occurred. + * + * @note The read_some operation may not read all of the requested number of + * bytes. Consider using the @ref read function if you need to ensure that + * the requested amount of data is read before the blocking operation + * completes. + */ + template + std::size_t read_some(const MutableBufferSequence& buffers, + autoboost::system::error_code& ec) + { + return this->get_service().read_some( + this->get_implementation(), buffers, ec); + } + + /// Start an asynchronous read. + /** + * This function is used to asynchronously read data from the serial port. + * The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be read. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param handler The handler to be called when the read operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes read. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @note The read operation may not read all of the requested number of bytes. + * Consider using the @ref async_read function if you need to ensure that the + * requested amount of data is read before the asynchronous operation + * completes. + * + * @par Example + * To read into a single data buffer use the @ref buffer function as follows: + * @code + * serial_port.async_read_some(autoboost::asio::buffer(data, size), handler); + * @endcode + * See the @ref buffer documentation for information on reading into multiple + * buffers in one go, and how to use it with arrays, autoboost::array or + * std::vector. + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, + void (autoboost::system::error_code, std::size_t)) + async_read_some(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + return this->get_service().async_read_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_BASIC_SERIAL_PORT_HPP diff --git a/contrib/autoboost/boost/asio/basic_signal_set.hpp b/contrib/autoboost/boost/asio/basic_signal_set.hpp new file mode 100644 index 000000000..d220caa5b --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_signal_set.hpp @@ -0,0 +1,386 @@ +// +// basic_signal_set.hpp +// ~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_SIGNAL_SET_HPP +#define BOOST_ASIO_BASIC_SIGNAL_SET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides signal functionality. +/** + * The basic_signal_set class template provides the ability to perform an + * asynchronous wait for one or more signals to occur. + * + * Most applications will use the autoboost::asio::signal_set typedef. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + * + * @par Example + * Performing an asynchronous wait: + * @code + * void handler( + * const autoboost::system::error_code& error, + * int signal_number) + * { + * if (!error) + * { + * // A signal occurred. + * } + * } + * + * ... + * + * // Construct a signal set registered for process termination. + * autoboost::asio::signal_set signals(io_service, SIGINT, SIGTERM); + * + * // Start an asynchronous wait for one of the signals to occur. + * signals.async_wait(handler); + * @endcode + * + * @par Queueing of signal notifications + * + * If a signal is registered with a signal_set, and the signal occurs when + * there are no waiting handlers, then the signal notification is queued. The + * next async_wait operation on that signal_set will dequeue the notification. + * If multiple notifications are queued, subsequent async_wait operations + * dequeue them one at a time. Signal notifications are dequeued in order of + * ascending signal number. + * + * If a signal number is removed from a signal_set (using the @c remove or @c + * erase member functions) then any queued notifications for that signal are + * discarded. + * + * @par Multiple registration of signals + * + * The same signal number may be registered with different signal_set objects. + * When the signal occurs, one handler is called for each signal_set object. + * + * Note that multiple registration only works for signals that are registered + * using Asio. The application must not also register a signal handler using + * functions such as @c signal() or @c sigaction(). + * + * @par Signal masking on POSIX platforms + * + * POSIX allows signals to be blocked using functions such as @c sigprocmask() + * and @c pthread_sigmask(). For signals to be delivered, programs must ensure + * that any signals registered using signal_set objects are unblocked in at + * least one thread. + */ +template +class basic_signal_set + : public basic_io_object +{ +public: + /// Construct a signal set without adding any signals. + /** + * This constructor creates a signal set without registering for any signals. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + */ + explicit basic_signal_set(autoboost::asio::io_service& io_service) + : basic_io_object(io_service) + { + } + + /// Construct a signal set and add one signal. + /** + * This constructor creates a signal set and registers for one signal. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + * + * @param signal_number_1 The signal number to be added. + * + * @note This constructor is equivalent to performing: + * @code autoboost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); @endcode + */ + basic_signal_set(autoboost::asio::io_service& io_service, int signal_number_1) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + autoboost::asio::detail::throw_error(ec, "add"); + } + + /// Construct a signal set and add two signals. + /** + * This constructor creates a signal set and registers for two signals. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + * + * @param signal_number_1 The first signal number to be added. + * + * @param signal_number_2 The second signal number to be added. + * + * @note This constructor is equivalent to performing: + * @code autoboost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); + * signals.add(signal_number_2); @endcode + */ + basic_signal_set(autoboost::asio::io_service& io_service, int signal_number_1, + int signal_number_2) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + autoboost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_2, ec); + autoboost::asio::detail::throw_error(ec, "add"); + } + + /// Construct a signal set and add three signals. + /** + * This constructor creates a signal set and registers for three signals. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + * + * @param signal_number_1 The first signal number to be added. + * + * @param signal_number_2 The second signal number to be added. + * + * @param signal_number_3 The third signal number to be added. + * + * @note This constructor is equivalent to performing: + * @code autoboost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); + * signals.add(signal_number_2); + * signals.add(signal_number_3); @endcode + */ + basic_signal_set(autoboost::asio::io_service& io_service, int signal_number_1, + int signal_number_2, int signal_number_3) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + autoboost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_2, ec); + autoboost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_3, ec); + autoboost::asio::detail::throw_error(ec, "add"); + } + + /// Add a signal to a signal_set. + /** + * This function adds the specified signal to the set. It has no effect if the + * signal is already in the set. + * + * @param signal_number The signal to be added to the set. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void add(int signal_number) + { + autoboost::system::error_code ec; + this->service.add(this->implementation, signal_number, ec); + autoboost::asio::detail::throw_error(ec, "add"); + } + + /// Add a signal to a signal_set. + /** + * This function adds the specified signal to the set. It has no effect if the + * signal is already in the set. + * + * @param signal_number The signal to be added to the set. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code add(int signal_number, + autoboost::system::error_code& ec) + { + return this->service.add(this->implementation, signal_number, ec); + } + + /// Remove a signal from a signal_set. + /** + * This function removes the specified signal from the set. It has no effect + * if the signal is not in the set. + * + * @param signal_number The signal to be removed from the set. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note Removes any notifications that have been queued for the specified + * signal number. + */ + void remove(int signal_number) + { + autoboost::system::error_code ec; + this->service.remove(this->implementation, signal_number, ec); + autoboost::asio::detail::throw_error(ec, "remove"); + } + + /// Remove a signal from a signal_set. + /** + * This function removes the specified signal from the set. It has no effect + * if the signal is not in the set. + * + * @param signal_number The signal to be removed from the set. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note Removes any notifications that have been queued for the specified + * signal number. + */ + autoboost::system::error_code remove(int signal_number, + autoboost::system::error_code& ec) + { + return this->service.remove(this->implementation, signal_number, ec); + } + + /// Remove all signals from a signal_set. + /** + * This function removes all signals from the set. It has no effect if the set + * is already empty. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note Removes all queued notifications. + */ + void clear() + { + autoboost::system::error_code ec; + this->service.clear(this->implementation, ec); + autoboost::asio::detail::throw_error(ec, "clear"); + } + + /// Remove all signals from a signal_set. + /** + * This function removes all signals from the set. It has no effect if the set + * is already empty. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note Removes all queued notifications. + */ + autoboost::system::error_code clear(autoboost::system::error_code& ec) + { + return this->service.clear(this->implementation, ec); + } + + /// Cancel all operations associated with the signal set. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the signal set. The handler for each cancelled + * operation will be invoked with the autoboost::asio::error::operation_aborted + * error code. + * + * Cancellation does not alter the set of registered signals. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note If a registered signal occurred before cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + void cancel() + { + autoboost::system::error_code ec; + this->service.cancel(this->implementation, ec); + autoboost::asio::detail::throw_error(ec, "cancel"); + } + + /// Cancel all operations associated with the signal set. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the signal set. The handler for each cancelled + * operation will be invoked with the autoboost::asio::error::operation_aborted + * error code. + * + * Cancellation does not alter the set of registered signals. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note If a registered signal occurred before cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + autoboost::system::error_code cancel(autoboost::system::error_code& ec) + { + return this->service.cancel(this->implementation, ec); + } + + /// Start an asynchronous operation to wait for a signal to be delivered. + /** + * This function may be used to initiate an asynchronous wait against the + * signal set. It always returns immediately. + * + * For each call to async_wait(), the supplied handler will be called exactly + * once. The handler will be called when: + * + * @li One of the registered signals in the signal set occurs; or + * + * @li The signal set was cancelled, in which case the handler is passed the + * error code autoboost::asio::error::operation_aborted. + * + * @param handler The handler to be called when the signal occurs. Copies + * will be made of the handler as required. The function signature of the + * handler must be: + * @code void handler( + * const autoboost::system::error_code& error, // Result of operation. + * int signal_number // Indicates which signal occurred. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(SignalHandler, + void (autoboost::system::error_code, int)) + async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a SignalHandler. + BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check; + + return this->service.async_wait(this->implementation, + BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // BOOST_ASIO_BASIC_SIGNAL_SET_HPP diff --git a/contrib/autoboost/boost/asio/basic_socket.hpp b/contrib/autoboost/boost/asio/basic_socket.hpp new file mode 100644 index 000000000..1e23dea9a --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_socket.hpp @@ -0,0 +1,1520 @@ +// +// basic_socket.hpp +// ~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_SOCKET_HPP +#define BOOST_ASIO_BASIC_SOCKET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides socket functionality. +/** + * The basic_socket class template provides functionality that is common to both + * stream-oriented and datagram-oriented sockets. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template +class basic_socket + : public basic_io_object, + public socket_base +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename SocketService::native_handle_type native_type; + + /// The native representation of a socket. + typedef typename SocketService::native_handle_type native_handle_type; + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// A basic_socket is always the lowest layer. + typedef basic_socket lowest_layer_type; + + /// Construct a basic_socket without opening it. + /** + * This constructor creates a socket without opening it. + * + * @param io_service The io_service object that the socket will use to + * dispatch handlers for any asynchronous operations performed on the socket. + */ + explicit basic_socket(autoboost::asio::io_service& io_service) + : basic_io_object(io_service) + { + } + + /// Construct and open a basic_socket. + /** + * This constructor creates and opens a socket. + * + * @param io_service The io_service object that the socket will use to + * dispatch handlers for any asynchronous operations performed on the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->get_service().open(this->get_implementation(), protocol, ec); + autoboost::asio::detail::throw_error(ec, "open"); + } + + /// Construct a basic_socket, opening it and binding it to the given local + /// endpoint. + /** + * This constructor creates a socket and automatically opens it bound to the + * specified endpoint on the local machine. The protocol used is the protocol + * associated with the given endpoint. + * + * @param io_service The io_service object that the socket will use to + * dispatch handlers for any asynchronous operations performed on the socket. + * + * @param endpoint An endpoint on the local machine to which the socket will + * be bound. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_socket(autoboost::asio::io_service& io_service, + const endpoint_type& endpoint) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + const protocol_type protocol = endpoint.protocol(); + this->get_service().open(this->get_implementation(), protocol, ec); + autoboost::asio::detail::throw_error(ec, "open"); + this->get_service().bind(this->get_implementation(), endpoint, ec); + autoboost::asio::detail::throw_error(ec, "bind"); + } + + /// Construct a basic_socket on an existing native socket. + /** + * This constructor creates a socket object to hold an existing native socket. + * + * @param io_service The io_service object that the socket will use to + * dispatch handlers for any asynchronous operations performed on the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @param native_socket A native socket. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_socket(autoboost::asio::io_service& io_service, + const protocol_type& protocol, const native_handle_type& native_socket) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->get_service().assign(this->get_implementation(), + protocol, native_socket, ec); + autoboost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_socket from another. + /** + * This constructor moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + basic_socket(basic_socket&& other) + : basic_io_object( + BOOST_ASIO_MOVE_CAST(basic_socket)(other)) + { + } + + /// Move-assign a basic_socket from another. + /** + * This assignment operator moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + basic_socket& operator=(basic_socket&& other) + { + basic_io_object::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket)(other)); + return *this; + } + + // All sockets have access to each other's implementations. + template + friend class basic_socket; + + /// Move-construct a basic_socket from a socket of another protocol type. + /** + * This constructor moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + basic_socket(basic_socket&& other, + typename enable_if::value>::type* = 0) + : basic_io_object(other.get_io_service()) + { + this->get_service().template converting_move_construct( + this->get_implementation(), other.get_implementation()); + } + + /// Move-assign a basic_socket from a socket of another protocol type. + /** + * This assignment operator moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_socket>::type& operator=( + basic_socket&& other) + { + basic_socket tmp(BOOST_ASIO_MOVE_CAST2(basic_socket< + Protocol1, SocketService1>)(other)); + basic_io_object::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket)(tmp)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Get a reference to the lowest layer. + /** + * This function returns a reference to the lowest layer in a stack of + * layers. Since a basic_socket cannot contain any further layers, it simply + * returns a reference to itself. + * + * @return A reference to the lowest layer in the stack of layers. Ownership + * is not transferred to the caller. + */ + lowest_layer_type& lowest_layer() + { + return *this; + } + + /// Get a const reference to the lowest layer. + /** + * This function returns a const reference to the lowest layer in a stack of + * layers. Since a basic_socket cannot contain any further layers, it simply + * returns a reference to itself. + * + * @return A const reference to the lowest layer in the stack of layers. + * Ownership is not transferred to the caller. + */ + const lowest_layer_type& lowest_layer() const + { + return *this; + } + + /// Open the socket using the specified protocol. + /** + * This function opens the socket so that it will use the specified protocol. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * socket.open(autoboost::asio::ip::tcp::v4()); + * @endcode + */ + void open(const protocol_type& protocol = protocol_type()) + { + autoboost::system::error_code ec; + this->get_service().open(this->get_implementation(), protocol, ec); + autoboost::asio::detail::throw_error(ec, "open"); + } + + /// Open the socket using the specified protocol. + /** + * This function opens the socket so that it will use the specified protocol. + * + * @param protocol An object specifying which protocol is to be used. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * autoboost::system::error_code ec; + * socket.open(autoboost::asio::ip::tcp::v4(), ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code open(const protocol_type& protocol, + autoboost::system::error_code& ec) + { + return this->get_service().open(this->get_implementation(), protocol, ec); + } + + /// Assign an existing native socket to the socket. + /* + * This function opens the socket to hold an existing native socket. + * + * @param protocol An object specifying which protocol is to be used. + * + * @param native_socket A native socket. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void assign(const protocol_type& protocol, + const native_handle_type& native_socket) + { + autoboost::system::error_code ec; + this->get_service().assign(this->get_implementation(), + protocol, native_socket, ec); + autoboost::asio::detail::throw_error(ec, "assign"); + } + + /// Assign an existing native socket to the socket. + /* + * This function opens the socket to hold an existing native socket. + * + * @param protocol An object specifying which protocol is to be used. + * + * @param native_socket A native socket. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code assign(const protocol_type& protocol, + const native_handle_type& native_socket, autoboost::system::error_code& ec) + { + return this->get_service().assign(this->get_implementation(), + protocol, native_socket, ec); + } + + /// Determine whether the socket is open. + bool is_open() const + { + return this->get_service().is_open(this->get_implementation()); + } + + /// Close the socket. + /** + * This function is used to close the socket. Any asynchronous send, receive + * or connect operations will be cancelled immediately, and will complete + * with the autoboost::asio::error::operation_aborted error. + * + * @throws autoboost::system::system_error Thrown on failure. Note that, even if + * the function indicates an error, the underlying descriptor is closed. + * + * @note For portable behaviour with respect to graceful closure of a + * connected socket, call shutdown() before closing the socket. + */ + void close() + { + autoboost::system::error_code ec; + this->get_service().close(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "close"); + } + + /// Close the socket. + /** + * This function is used to close the socket. Any asynchronous send, receive + * or connect operations will be cancelled immediately, and will complete + * with the autoboost::asio::error::operation_aborted error. + * + * @param ec Set to indicate what error occurred, if any. Note that, even if + * the function indicates an error, the underlying descriptor is closed. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::system::error_code ec; + * socket.close(ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + * + * @note For portable behaviour with respect to graceful closure of a + * connected socket, call shutdown() before closing the socket. + */ + autoboost::system::error_code close(autoboost::system::error_code& ec) + { + return this->get_service().close(this->get_implementation(), ec); + } + + /// (Deprecated: Use native_handle().) Get the native socket representation. + /** + * This function may be used to obtain the underlying representation of the + * socket. This is intended to allow access to native socket functionality + * that is not otherwise provided. + */ + native_type native() + { + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native socket representation. + /** + * This function may be used to obtain the underlying representation of the + * socket. This is intended to allow access to native socket functionality + * that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->get_implementation()); + } + + /// Cancel all asynchronous operations associated with the socket. + /** + * This function causes all outstanding asynchronous connect, send and receive + * operations to finish immediately, and the handlers for cancelled operations + * will be passed the autoboost::asio::error::operation_aborted error. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note Calls to cancel() will always fail with + * autoboost::asio::error::operation_not_supported when run on Windows XP, Windows + * Server 2003, and earlier versions of Windows, unless + * BOOST_ASIO_ENABLE_CANCELIO is defined. However, the CancelIo function has + * two issues that should be considered before enabling its use: + * + * @li It will only cancel asynchronous operations that were initiated in the + * current thread. + * + * @li It can appear to complete without error, but the request to cancel the + * unfinished operations may be silently ignored by the operating system. + * Whether it works or not seems to depend on the drivers that are installed. + * + * For portable cancellation, consider using one of the following + * alternatives: + * + * @li Disable asio's I/O completion port backend by defining + * BOOST_ASIO_DISABLE_IOCP. + * + * @li Use the close() function to simultaneously cancel the outstanding + * operations and close the socket. + * + * When running on Windows Vista, Windows Server 2008, and later, the + * CancelIoEx function is always used. This function does not have the + * problems described above. + */ +#if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400) \ + && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600) \ + && !defined(BOOST_ASIO_ENABLE_CANCELIO) + __declspec(deprecated("By default, this function always fails with " + "operation_not_supported when used on Windows XP, Windows Server 2003, " + "or earlier. Consult documentation for details.")) +#endif + void cancel() + { + autoboost::system::error_code ec; + this->get_service().cancel(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "cancel"); + } + + /// Cancel all asynchronous operations associated with the socket. + /** + * This function causes all outstanding asynchronous connect, send and receive + * operations to finish immediately, and the handlers for cancelled operations + * will be passed the autoboost::asio::error::operation_aborted error. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note Calls to cancel() will always fail with + * autoboost::asio::error::operation_not_supported when run on Windows XP, Windows + * Server 2003, and earlier versions of Windows, unless + * BOOST_ASIO_ENABLE_CANCELIO is defined. However, the CancelIo function has + * two issues that should be considered before enabling its use: + * + * @li It will only cancel asynchronous operations that were initiated in the + * current thread. + * + * @li It can appear to complete without error, but the request to cancel the + * unfinished operations may be silently ignored by the operating system. + * Whether it works or not seems to depend on the drivers that are installed. + * + * For portable cancellation, consider using one of the following + * alternatives: + * + * @li Disable asio's I/O completion port backend by defining + * BOOST_ASIO_DISABLE_IOCP. + * + * @li Use the close() function to simultaneously cancel the outstanding + * operations and close the socket. + * + * When running on Windows Vista, Windows Server 2008, and later, the + * CancelIoEx function is always used. This function does not have the + * problems described above. + */ +#if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400) \ + && (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600) \ + && !defined(BOOST_ASIO_ENABLE_CANCELIO) + __declspec(deprecated("By default, this function always fails with " + "operation_not_supported when used on Windows XP, Windows Server 2003, " + "or earlier. Consult documentation for details.")) +#endif + autoboost::system::error_code cancel(autoboost::system::error_code& ec) + { + return this->get_service().cancel(this->get_implementation(), ec); + } + + /// Determine whether the socket is at the out-of-band data mark. + /** + * This function is used to check whether the socket input is currently + * positioned at the out-of-band data mark. + * + * @return A bool indicating whether the socket is at the out-of-band data + * mark. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + bool at_mark() const + { + autoboost::system::error_code ec; + bool b = this->get_service().at_mark(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "at_mark"); + return b; + } + + /// Determine whether the socket is at the out-of-band data mark. + /** + * This function is used to check whether the socket input is currently + * positioned at the out-of-band data mark. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return A bool indicating whether the socket is at the out-of-band data + * mark. + */ + bool at_mark(autoboost::system::error_code& ec) const + { + return this->get_service().at_mark(this->get_implementation(), ec); + } + + /// Determine the number of bytes available for reading. + /** + * This function is used to determine the number of bytes that may be read + * without blocking. + * + * @return The number of bytes that may be read without blocking, or 0 if an + * error occurs. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + std::size_t available() const + { + autoboost::system::error_code ec; + std::size_t s = this->get_service().available( + this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "available"); + return s; + } + + /// Determine the number of bytes available for reading. + /** + * This function is used to determine the number of bytes that may be read + * without blocking. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of bytes that may be read without blocking, or 0 if an + * error occurs. + */ + std::size_t available(autoboost::system::error_code& ec) const + { + return this->get_service().available(this->get_implementation(), ec); + } + + /// Bind the socket to the given local endpoint. + /** + * This function binds the socket to the specified endpoint on the local + * machine. + * + * @param endpoint An endpoint on the local machine to which the socket will + * be bound. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * socket.open(autoboost::asio::ip::tcp::v4()); + * socket.bind(autoboost::asio::ip::tcp::endpoint( + * autoboost::asio::ip::tcp::v4(), 12345)); + * @endcode + */ + void bind(const endpoint_type& endpoint) + { + autoboost::system::error_code ec; + this->get_service().bind(this->get_implementation(), endpoint, ec); + autoboost::asio::detail::throw_error(ec, "bind"); + } + + /// Bind the socket to the given local endpoint. + /** + * This function binds the socket to the specified endpoint on the local + * machine. + * + * @param endpoint An endpoint on the local machine to which the socket will + * be bound. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * socket.open(autoboost::asio::ip::tcp::v4()); + * autoboost::system::error_code ec; + * socket.bind(autoboost::asio::ip::tcp::endpoint( + * autoboost::asio::ip::tcp::v4(), 12345), ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code bind(const endpoint_type& endpoint, + autoboost::system::error_code& ec) + { + return this->get_service().bind(this->get_implementation(), endpoint, ec); + } + + /// Connect the socket to the specified endpoint. + /** + * This function is used to connect a socket to the specified remote endpoint. + * The function call will block until the connection is successfully made or + * an error occurs. + * + * The socket is automatically opened if it is not already open. If the + * connect fails, and the socket was automatically opened, the socket is + * not returned to the closed state. + * + * @param peer_endpoint The remote endpoint to which the socket will be + * connected. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint( + * autoboost::asio::ip::address::from_string("1.2.3.4"), 12345); + * socket.connect(endpoint); + * @endcode + */ + void connect(const endpoint_type& peer_endpoint) + { + autoboost::system::error_code ec; + if (!is_open()) + { + this->get_service().open(this->get_implementation(), + peer_endpoint.protocol(), ec); + autoboost::asio::detail::throw_error(ec, "connect"); + } + this->get_service().connect(this->get_implementation(), peer_endpoint, ec); + autoboost::asio::detail::throw_error(ec, "connect"); + } + + /// Connect the socket to the specified endpoint. + /** + * This function is used to connect a socket to the specified remote endpoint. + * The function call will block until the connection is successfully made or + * an error occurs. + * + * The socket is automatically opened if it is not already open. If the + * connect fails, and the socket was automatically opened, the socket is + * not returned to the closed state. + * + * @param peer_endpoint The remote endpoint to which the socket will be + * connected. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint( + * autoboost::asio::ip::address::from_string("1.2.3.4"), 12345); + * autoboost::system::error_code ec; + * socket.connect(endpoint, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code connect(const endpoint_type& peer_endpoint, + autoboost::system::error_code& ec) + { + if (!is_open()) + { + if (this->get_service().open(this->get_implementation(), + peer_endpoint.protocol(), ec)) + { + return ec; + } + } + + return this->get_service().connect( + this->get_implementation(), peer_endpoint, ec); + } + + /// Start an asynchronous connect. + /** + * This function is used to asynchronously connect a socket to the specified + * remote endpoint. The function call always returns immediately. + * + * The socket is automatically opened if it is not already open. If the + * connect fails, and the socket was automatically opened, the socket is + * not returned to the closed state. + * + * @param peer_endpoint The remote endpoint to which the socket will be + * connected. Copies will be made of the endpoint object as required. + * + * @param handler The handler to be called when the connection operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error // Result of operation + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * @code + * void connect_handler(const autoboost::system::error_code& error) + * { + * if (!error) + * { + * // Connect succeeded. + * } + * } + * + * ... + * + * autoboost::asio::ip::tcp::socket socket(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint( + * autoboost::asio::ip::address::from_string("1.2.3.4"), 12345); + * socket.async_connect(endpoint, connect_handler); + * @endcode + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler, + void (autoboost::system::error_code)) + async_connect(const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ConnectHandler. + BOOST_ASIO_CONNECT_HANDLER_CHECK(ConnectHandler, handler) type_check; + + if (!is_open()) + { + autoboost::system::error_code ec; + const protocol_type protocol = peer_endpoint.protocol(); + if (this->get_service().open(this->get_implementation(), protocol, ec)) + { + detail::async_result_init< + ConnectHandler, void (autoboost::system::error_code)> init( + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); + + this->get_io_service().post( + autoboost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE( + ConnectHandler, void (autoboost::system::error_code)))( + init.handler), ec)); + + return init.result.get(); + } + } + + return this->get_service().async_connect(this->get_implementation(), + peer_endpoint, BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); + } + + /// Set an option on the socket. + /** + * This function is used to set an option on the socket. + * + * @param option The new option value to be set on the socket. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa SettableSocketOption @n + * autoboost::asio::socket_base::broadcast @n + * autoboost::asio::socket_base::do_not_route @n + * autoboost::asio::socket_base::keep_alive @n + * autoboost::asio::socket_base::linger @n + * autoboost::asio::socket_base::receive_buffer_size @n + * autoboost::asio::socket_base::receive_low_watermark @n + * autoboost::asio::socket_base::reuse_address @n + * autoboost::asio::socket_base::send_buffer_size @n + * autoboost::asio::socket_base::send_low_watermark @n + * autoboost::asio::ip::multicast::join_group @n + * autoboost::asio::ip::multicast::leave_group @n + * autoboost::asio::ip::multicast::enable_loopback @n + * autoboost::asio::ip::multicast::outbound_interface @n + * autoboost::asio::ip::multicast::hops @n + * autoboost::asio::ip::tcp::no_delay + * + * @par Example + * Setting the IPPROTO_TCP/TCP_NODELAY option: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::no_delay option(true); + * socket.set_option(option); + * @endcode + */ + template + void set_option(const SettableSocketOption& option) + { + autoboost::system::error_code ec; + this->get_service().set_option(this->get_implementation(), option, ec); + autoboost::asio::detail::throw_error(ec, "set_option"); + } + + /// Set an option on the socket. + /** + * This function is used to set an option on the socket. + * + * @param option The new option value to be set on the socket. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa SettableSocketOption @n + * autoboost::asio::socket_base::broadcast @n + * autoboost::asio::socket_base::do_not_route @n + * autoboost::asio::socket_base::keep_alive @n + * autoboost::asio::socket_base::linger @n + * autoboost::asio::socket_base::receive_buffer_size @n + * autoboost::asio::socket_base::receive_low_watermark @n + * autoboost::asio::socket_base::reuse_address @n + * autoboost::asio::socket_base::send_buffer_size @n + * autoboost::asio::socket_base::send_low_watermark @n + * autoboost::asio::ip::multicast::join_group @n + * autoboost::asio::ip::multicast::leave_group @n + * autoboost::asio::ip::multicast::enable_loopback @n + * autoboost::asio::ip::multicast::outbound_interface @n + * autoboost::asio::ip::multicast::hops @n + * autoboost::asio::ip::tcp::no_delay + * + * @par Example + * Setting the IPPROTO_TCP/TCP_NODELAY option: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::no_delay option(true); + * autoboost::system::error_code ec; + * socket.set_option(option, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + template + autoboost::system::error_code set_option(const SettableSocketOption& option, + autoboost::system::error_code& ec) + { + return this->get_service().set_option( + this->get_implementation(), option, ec); + } + + /// Get an option from the socket. + /** + * This function is used to get the current value of an option on the socket. + * + * @param option The option value to be obtained from the socket. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa GettableSocketOption @n + * autoboost::asio::socket_base::broadcast @n + * autoboost::asio::socket_base::do_not_route @n + * autoboost::asio::socket_base::keep_alive @n + * autoboost::asio::socket_base::linger @n + * autoboost::asio::socket_base::receive_buffer_size @n + * autoboost::asio::socket_base::receive_low_watermark @n + * autoboost::asio::socket_base::reuse_address @n + * autoboost::asio::socket_base::send_buffer_size @n + * autoboost::asio::socket_base::send_low_watermark @n + * autoboost::asio::ip::multicast::join_group @n + * autoboost::asio::ip::multicast::leave_group @n + * autoboost::asio::ip::multicast::enable_loopback @n + * autoboost::asio::ip::multicast::outbound_interface @n + * autoboost::asio::ip::multicast::hops @n + * autoboost::asio::ip::tcp::no_delay + * + * @par Example + * Getting the value of the SOL_SOCKET/SO_KEEPALIVE option: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::socket::keep_alive option; + * socket.get_option(option); + * bool is_set = option.value(); + * @endcode + */ + template + void get_option(GettableSocketOption& option) const + { + autoboost::system::error_code ec; + this->get_service().get_option(this->get_implementation(), option, ec); + autoboost::asio::detail::throw_error(ec, "get_option"); + } + + /// Get an option from the socket. + /** + * This function is used to get the current value of an option on the socket. + * + * @param option The option value to be obtained from the socket. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa GettableSocketOption @n + * autoboost::asio::socket_base::broadcast @n + * autoboost::asio::socket_base::do_not_route @n + * autoboost::asio::socket_base::keep_alive @n + * autoboost::asio::socket_base::linger @n + * autoboost::asio::socket_base::receive_buffer_size @n + * autoboost::asio::socket_base::receive_low_watermark @n + * autoboost::asio::socket_base::reuse_address @n + * autoboost::asio::socket_base::send_buffer_size @n + * autoboost::asio::socket_base::send_low_watermark @n + * autoboost::asio::ip::multicast::join_group @n + * autoboost::asio::ip::multicast::leave_group @n + * autoboost::asio::ip::multicast::enable_loopback @n + * autoboost::asio::ip::multicast::outbound_interface @n + * autoboost::asio::ip::multicast::hops @n + * autoboost::asio::ip::tcp::no_delay + * + * @par Example + * Getting the value of the SOL_SOCKET/SO_KEEPALIVE option: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::socket::keep_alive option; + * autoboost::system::error_code ec; + * socket.get_option(option, ec); + * if (ec) + * { + * // An error occurred. + * } + * bool is_set = option.value(); + * @endcode + */ + template + autoboost::system::error_code get_option(GettableSocketOption& option, + autoboost::system::error_code& ec) const + { + return this->get_service().get_option( + this->get_implementation(), option, ec); + } + + /// Perform an IO control command on the socket. + /** + * This function is used to execute an IO control command on the socket. + * + * @param command The IO control command to be performed on the socket. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa IoControlCommand @n + * autoboost::asio::socket_base::bytes_readable @n + * autoboost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::socket::bytes_readable command; + * socket.io_control(command); + * std::size_t bytes_readable = command.get(); + * @endcode + */ + template + void io_control(IoControlCommand& command) + { + autoboost::system::error_code ec; + this->get_service().io_control(this->get_implementation(), command, ec); + autoboost::asio::detail::throw_error(ec, "io_control"); + } + + /// Perform an IO control command on the socket. + /** + * This function is used to execute an IO control command on the socket. + * + * @param command The IO control command to be performed on the socket. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa IoControlCommand @n + * autoboost::asio::socket_base::bytes_readable @n + * autoboost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::socket::bytes_readable command; + * autoboost::system::error_code ec; + * socket.io_control(command, ec); + * if (ec) + * { + * // An error occurred. + * } + * std::size_t bytes_readable = command.get(); + * @endcode + */ + template + autoboost::system::error_code io_control(IoControlCommand& command, + autoboost::system::error_code& ec) + { + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the socket. + /** + * @returns @c true if the socket's synchronous operations will fail with + * autoboost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * autoboost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the socket. + /** + * @param mode If @c true, the socket's synchronous operations will fail with + * autoboost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * autoboost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + autoboost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + autoboost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the socket. + /** + * @param mode If @c true, the socket's synchronous operations will fail with + * autoboost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * autoboost::asio::error::would_block. + */ + autoboost::system::error_code non_blocking( + bool mode, autoboost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native socket. This mode has no effect on the behaviour of the socket + * object's synchronous operations. + * + * @returns @c true if the underlying socket is in non-blocking mode and + * direct system calls may fail with autoboost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the socket object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native socket. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(autoboost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = autoboost::system::error_code(n < 0 ? errno : 0, + * autoboost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == autoboost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == autoboost::asio::error::would_block + * || ec == autoboost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(autoboost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(autoboost::asio::null_buffers(), op); + * } @endcode + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the native socket implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native socket. It has no effect on the behaviour of the socket object's + * synchronous operations. + * + * @param mode If @c true, the underlying socket is put into non-blocking + * mode and direct system calls may fail with autoboost::asio::error::would_block + * (or the equivalent system error). + * + * @throws autoboost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with autoboost::asio::error::invalid_argument, as the + * combination does not make sense. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(autoboost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = autoboost::system::error_code(n < 0 ? errno : 0, + * autoboost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == autoboost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == autoboost::asio::error::would_block + * || ec == autoboost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(autoboost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(autoboost::asio::null_buffers(), op); + * } @endcode + */ + void native_non_blocking(bool mode) + { + autoboost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + autoboost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native socket implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native socket. It has no effect on the behaviour of the socket object's + * synchronous operations. + * + * @param mode If @c true, the underlying socket is put into non-blocking + * mode and direct system calls may fail with autoboost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with autoboost::asio::error::invalid_argument, as the + * combination does not make sense. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(autoboost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = autoboost::system::error_code(n < 0 ? errno : 0, + * autoboost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == autoboost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == autoboost::asio::error::would_block + * || ec == autoboost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(autoboost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(autoboost::asio::null_buffers(), op); + * } @endcode + */ + autoboost::system::error_code native_non_blocking( + bool mode, autoboost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + } + + /// Get the local endpoint of the socket. + /** + * This function is used to obtain the locally bound endpoint of the socket. + * + * @returns An object that represents the local endpoint of the socket. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(); + * @endcode + */ + endpoint_type local_endpoint() const + { + autoboost::system::error_code ec; + endpoint_type ep = this->get_service().local_endpoint( + this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "local_endpoint"); + return ep; + } + + /// Get the local endpoint of the socket. + /** + * This function is used to obtain the locally bound endpoint of the socket. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns An object that represents the local endpoint of the socket. + * Returns a default-constructed endpoint object if an error occurred. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::system::error_code ec; + * autoboost::asio::ip::tcp::endpoint endpoint = socket.local_endpoint(ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + endpoint_type local_endpoint(autoboost::system::error_code& ec) const + { + return this->get_service().local_endpoint(this->get_implementation(), ec); + } + + /// Get the remote endpoint of the socket. + /** + * This function is used to obtain the remote endpoint of the socket. + * + * @returns An object that represents the remote endpoint of the socket. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); + * @endcode + */ + endpoint_type remote_endpoint() const + { + autoboost::system::error_code ec; + endpoint_type ep = this->get_service().remote_endpoint( + this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "remote_endpoint"); + return ep; + } + + /// Get the remote endpoint of the socket. + /** + * This function is used to obtain the remote endpoint of the socket. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns An object that represents the remote endpoint of the socket. + * Returns a default-constructed endpoint object if an error occurred. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::system::error_code ec; + * autoboost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + endpoint_type remote_endpoint(autoboost::system::error_code& ec) const + { + return this->get_service().remote_endpoint(this->get_implementation(), ec); + } + + /// Disable sends or receives on the socket. + /** + * This function is used to disable send operations, receive operations, or + * both. + * + * @param what Determines what types of operation will no longer be allowed. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * Shutting down the send side of the socket: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * socket.shutdown(autoboost::asio::ip::tcp::socket::shutdown_send); + * @endcode + */ + void shutdown(shutdown_type what) + { + autoboost::system::error_code ec; + this->get_service().shutdown(this->get_implementation(), what, ec); + autoboost::asio::detail::throw_error(ec, "shutdown"); + } + + /// Disable sends or receives on the socket. + /** + * This function is used to disable send operations, receive operations, or + * both. + * + * @param what Determines what types of operation will no longer be allowed. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * Shutting down the send side of the socket: + * @code + * autoboost::asio::ip::tcp::socket socket(io_service); + * ... + * autoboost::system::error_code ec; + * socket.shutdown(autoboost::asio::ip::tcp::socket::shutdown_send, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code shutdown(shutdown_type what, + autoboost::system::error_code& ec) + { + return this->get_service().shutdown(this->get_implementation(), what, ec); + } + +protected: + /// Protected destructor to prevent deletion through this type. + ~basic_socket() + { + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // BOOST_ASIO_BASIC_SOCKET_HPP diff --git a/contrib/autoboost/boost/asio/basic_socket_acceptor.hpp b/contrib/autoboost/boost/asio/basic_socket_acceptor.hpp new file mode 100644 index 000000000..b1f770b49 --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_socket_acceptor.hpp @@ -0,0 +1,1138 @@ +// +// basic_socket_acceptor.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_SOCKET_ACCEPTOR_HPP +#define BOOST_ASIO_BASIC_SOCKET_ACCEPTOR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace autoboost { +namespace asio { + +/// Provides the ability to accept new connections. +/** + * The basic_socket_acceptor class template is used for accepting new socket + * connections. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + * + * @par Example + * Opening a socket acceptor with the SO_REUSEADDR option enabled: + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint(autoboost::asio::ip::tcp::v4(), port); + * acceptor.open(endpoint.protocol()); + * acceptor.set_option(autoboost::asio::ip::tcp::acceptor::reuse_address(true)); + * acceptor.bind(endpoint); + * acceptor.listen(); + * @endcode + */ +template > +class basic_socket_acceptor + : public basic_io_object, + public socket_base +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of an + /// acceptor. + typedef typename SocketAcceptorService::native_handle_type native_type; + + /// The native representation of an acceptor. + typedef typename SocketAcceptorService::native_handle_type native_handle_type; + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// Construct an acceptor without opening it. + /** + * This constructor creates an acceptor without opening it to listen for new + * connections. The open() function must be called before the acceptor can + * accept new socket connections. + * + * @param io_service The io_service object that the acceptor will use to + * dispatch handlers for any asynchronous operations performed on the + * acceptor. + */ + explicit basic_socket_acceptor(autoboost::asio::io_service& io_service) + : basic_io_object(io_service) + { + } + + /// Construct an open acceptor. + /** + * This constructor creates an acceptor and automatically opens it. + * + * @param io_service The io_service object that the acceptor will use to + * dispatch handlers for any asynchronous operations performed on the + * acceptor. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_socket_acceptor(autoboost::asio::io_service& io_service, + const protocol_type& protocol) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->get_service().open(this->get_implementation(), protocol, ec); + autoboost::asio::detail::throw_error(ec, "open"); + } + + /// Construct an acceptor opened on the given endpoint. + /** + * This constructor creates an acceptor and automatically opens it to listen + * for new connections on the specified endpoint. + * + * @param io_service The io_service object that the acceptor will use to + * dispatch handlers for any asynchronous operations performed on the + * acceptor. + * + * @param endpoint An endpoint on the local machine on which the acceptor + * will listen for new connections. + * + * @param reuse_addr Whether the constructor should set the socket option + * socket_base::reuse_address. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note This constructor is equivalent to the following code: + * @code + * basic_socket_acceptor acceptor(io_service); + * acceptor.open(endpoint.protocol()); + * if (reuse_addr) + * acceptor.set_option(socket_base::reuse_address(true)); + * acceptor.bind(endpoint); + * acceptor.listen(listen_backlog); + * @endcode + */ + basic_socket_acceptor(autoboost::asio::io_service& io_service, + const endpoint_type& endpoint, bool reuse_addr = true) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + const protocol_type protocol = endpoint.protocol(); + this->get_service().open(this->get_implementation(), protocol, ec); + autoboost::asio::detail::throw_error(ec, "open"); + if (reuse_addr) + { + this->get_service().set_option(this->get_implementation(), + socket_base::reuse_address(true), ec); + autoboost::asio::detail::throw_error(ec, "set_option"); + } + this->get_service().bind(this->get_implementation(), endpoint, ec); + autoboost::asio::detail::throw_error(ec, "bind"); + this->get_service().listen(this->get_implementation(), + socket_base::max_connections, ec); + autoboost::asio::detail::throw_error(ec, "listen"); + } + + /// Construct a basic_socket_acceptor on an existing native acceptor. + /** + * This constructor creates an acceptor object to hold an existing native + * acceptor. + * + * @param io_service The io_service object that the acceptor will use to + * dispatch handlers for any asynchronous operations performed on the + * acceptor. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @param native_acceptor A native acceptor. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + basic_socket_acceptor(autoboost::asio::io_service& io_service, + const protocol_type& protocol, const native_handle_type& native_acceptor) + : basic_io_object(io_service) + { + autoboost::system::error_code ec; + this->get_service().assign(this->get_implementation(), + protocol, native_acceptor, ec); + autoboost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_socket_acceptor from another. + /** + * This constructor moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket_acceptor(io_service&) constructor. + */ + basic_socket_acceptor(basic_socket_acceptor&& other) + : basic_io_object( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other)) + { + } + + /// Move-assign a basic_socket_acceptor from another. + /** + * This assignment operator moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket_acceptor(io_service&) constructor. + */ + basic_socket_acceptor& operator=(basic_socket_acceptor&& other) + { + basic_io_object::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other)); + return *this; + } + + // All socket acceptors have access to each other's implementations. + template + friend class basic_socket_acceptor; + + /// Move-construct a basic_socket_acceptor from an acceptor of another + /// protocol type. + /** + * This constructor moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + basic_socket_acceptor( + basic_socket_acceptor&& other, + typename enable_if::value>::type* = 0) + : basic_io_object(other.get_io_service()) + { + this->get_service().template converting_move_construct( + this->get_implementation(), other.get_implementation()); + } + + /// Move-assign a basic_socket_acceptor from an acceptor of another protocol + /// type. + /** + * This assignment operator moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + template + typename enable_if::value, + basic_socket_acceptor>::type& operator=( + basic_socket_acceptor&& other) + { + basic_socket_acceptor tmp(BOOST_ASIO_MOVE_CAST2(basic_socket_acceptor< + Protocol1, SocketAcceptorService1>)(other)); + basic_io_object::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(tmp)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Open the acceptor using the specified protocol. + /** + * This function opens the socket acceptor so that it will use the specified + * protocol. + * + * @param protocol An object specifying which protocol is to be used. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * acceptor.open(autoboost::asio::ip::tcp::v4()); + * @endcode + */ + void open(const protocol_type& protocol = protocol_type()) + { + autoboost::system::error_code ec; + this->get_service().open(this->get_implementation(), protocol, ec); + autoboost::asio::detail::throw_error(ec, "open"); + } + + /// Open the acceptor using the specified protocol. + /** + * This function opens the socket acceptor so that it will use the specified + * protocol. + * + * @param protocol An object specifying which protocol is to be used. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * autoboost::system::error_code ec; + * acceptor.open(autoboost::asio::ip::tcp::v4(), ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code open(const protocol_type& protocol, + autoboost::system::error_code& ec) + { + return this->get_service().open(this->get_implementation(), protocol, ec); + } + + /// Assigns an existing native acceptor to the acceptor. + /* + * This function opens the acceptor to hold an existing native acceptor. + * + * @param protocol An object specifying which protocol is to be used. + * + * @param native_acceptor A native acceptor. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void assign(const protocol_type& protocol, + const native_handle_type& native_acceptor) + { + autoboost::system::error_code ec; + this->get_service().assign(this->get_implementation(), + protocol, native_acceptor, ec); + autoboost::asio::detail::throw_error(ec, "assign"); + } + + /// Assigns an existing native acceptor to the acceptor. + /* + * This function opens the acceptor to hold an existing native acceptor. + * + * @param protocol An object specifying which protocol is to be used. + * + * @param native_acceptor A native acceptor. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code assign(const protocol_type& protocol, + const native_handle_type& native_acceptor, autoboost::system::error_code& ec) + { + return this->get_service().assign(this->get_implementation(), + protocol, native_acceptor, ec); + } + + /// Determine whether the acceptor is open. + bool is_open() const + { + return this->get_service().is_open(this->get_implementation()); + } + + /// Bind the acceptor to the given local endpoint. + /** + * This function binds the socket acceptor to the specified endpoint on the + * local machine. + * + * @param endpoint An endpoint on the local machine to which the socket + * acceptor will be bound. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint(autoboost::asio::ip::tcp::v4(), 12345); + * acceptor.open(endpoint.protocol()); + * acceptor.bind(endpoint); + * @endcode + */ + void bind(const endpoint_type& endpoint) + { + autoboost::system::error_code ec; + this->get_service().bind(this->get_implementation(), endpoint, ec); + autoboost::asio::detail::throw_error(ec, "bind"); + } + + /// Bind the acceptor to the given local endpoint. + /** + * This function binds the socket acceptor to the specified endpoint on the + * local machine. + * + * @param endpoint An endpoint on the local machine to which the socket + * acceptor will be bound. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint(autoboost::asio::ip::tcp::v4(), 12345); + * acceptor.open(endpoint.protocol()); + * autoboost::system::error_code ec; + * acceptor.bind(endpoint, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code bind(const endpoint_type& endpoint, + autoboost::system::error_code& ec) + { + return this->get_service().bind(this->get_implementation(), endpoint, ec); + } + + /// Place the acceptor into the state where it will listen for new + /// connections. + /** + * This function puts the socket acceptor into the state where it may accept + * new connections. + * + * @param backlog The maximum length of the queue of pending connections. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void listen(int backlog = socket_base::max_connections) + { + autoboost::system::error_code ec; + this->get_service().listen(this->get_implementation(), backlog, ec); + autoboost::asio::detail::throw_error(ec, "listen"); + } + + /// Place the acceptor into the state where it will listen for new + /// connections. + /** + * This function puts the socket acceptor into the state where it may accept + * new connections. + * + * @param backlog The maximum length of the queue of pending connections. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::system::error_code ec; + * acceptor.listen(autoboost::asio::socket_base::max_connections, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code listen(int backlog, autoboost::system::error_code& ec) + { + return this->get_service().listen(this->get_implementation(), backlog, ec); + } + + /// Close the acceptor. + /** + * This function is used to close the acceptor. Any asynchronous accept + * operations will be cancelled immediately. + * + * A subsequent call to open() is required before the acceptor can again be + * used to again perform socket accept operations. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void close() + { + autoboost::system::error_code ec; + this->get_service().close(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "close"); + } + + /// Close the acceptor. + /** + * This function is used to close the acceptor. Any asynchronous accept + * operations will be cancelled immediately. + * + * A subsequent call to open() is required before the acceptor can again be + * used to again perform socket accept operations. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::system::error_code ec; + * acceptor.close(ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + autoboost::system::error_code close(autoboost::system::error_code& ec) + { + return this->get_service().close(this->get_implementation(), ec); + } + + /// (Deprecated: Use native_handle().) Get the native acceptor representation. + /** + * This function may be used to obtain the underlying representation of the + * acceptor. This is intended to allow access to native acceptor functionality + * that is not otherwise provided. + */ + native_type native() + { + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native acceptor representation. + /** + * This function may be used to obtain the underlying representation of the + * acceptor. This is intended to allow access to native acceptor functionality + * that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->get_implementation()); + } + + /// Cancel all asynchronous operations associated with the acceptor. + /** + * This function causes all outstanding asynchronous connect, send and receive + * operations to finish immediately, and the handlers for cancelled operations + * will be passed the autoboost::asio::error::operation_aborted error. + * + * @throws autoboost::system::system_error Thrown on failure. + */ + void cancel() + { + autoboost::system::error_code ec; + this->get_service().cancel(this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "cancel"); + } + + /// Cancel all asynchronous operations associated with the acceptor. + /** + * This function causes all outstanding asynchronous connect, send and receive + * operations to finish immediately, and the handlers for cancelled operations + * will be passed the autoboost::asio::error::operation_aborted error. + * + * @param ec Set to indicate what error occurred, if any. + */ + autoboost::system::error_code cancel(autoboost::system::error_code& ec) + { + return this->get_service().cancel(this->get_implementation(), ec); + } + + /// Set an option on the acceptor. + /** + * This function is used to set an option on the acceptor. + * + * @param option The new option value to be set on the acceptor. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa SettableSocketOption @n + * autoboost::asio::socket_base::reuse_address + * autoboost::asio::socket_base::enable_connection_aborted + * + * @par Example + * Setting the SOL_SOCKET/SO_REUSEADDR option: + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::acceptor::reuse_address option(true); + * acceptor.set_option(option); + * @endcode + */ + template + void set_option(const SettableSocketOption& option) + { + autoboost::system::error_code ec; + this->get_service().set_option(this->get_implementation(), option, ec); + autoboost::asio::detail::throw_error(ec, "set_option"); + } + + /// Set an option on the acceptor. + /** + * This function is used to set an option on the acceptor. + * + * @param option The new option value to be set on the acceptor. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa SettableSocketOption @n + * autoboost::asio::socket_base::reuse_address + * autoboost::asio::socket_base::enable_connection_aborted + * + * @par Example + * Setting the SOL_SOCKET/SO_REUSEADDR option: + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::acceptor::reuse_address option(true); + * autoboost::system::error_code ec; + * acceptor.set_option(option, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + template + autoboost::system::error_code set_option(const SettableSocketOption& option, + autoboost::system::error_code& ec) + { + return this->get_service().set_option( + this->get_implementation(), option, ec); + } + + /// Get an option from the acceptor. + /** + * This function is used to get the current value of an option on the + * acceptor. + * + * @param option The option value to be obtained from the acceptor. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa GettableSocketOption @n + * autoboost::asio::socket_base::reuse_address + * + * @par Example + * Getting the value of the SOL_SOCKET/SO_REUSEADDR option: + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::acceptor::reuse_address option; + * acceptor.get_option(option); + * bool is_set = option.get(); + * @endcode + */ + template + void get_option(GettableSocketOption& option) + { + autoboost::system::error_code ec; + this->get_service().get_option(this->get_implementation(), option, ec); + autoboost::asio::detail::throw_error(ec, "get_option"); + } + + /// Get an option from the acceptor. + /** + * This function is used to get the current value of an option on the + * acceptor. + * + * @param option The option value to be obtained from the acceptor. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa GettableSocketOption @n + * autoboost::asio::socket_base::reuse_address + * + * @par Example + * Getting the value of the SOL_SOCKET/SO_REUSEADDR option: + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::acceptor::reuse_address option; + * autoboost::system::error_code ec; + * acceptor.get_option(option, ec); + * if (ec) + * { + * // An error occurred. + * } + * bool is_set = option.get(); + * @endcode + */ + template + autoboost::system::error_code get_option(GettableSocketOption& option, + autoboost::system::error_code& ec) + { + return this->get_service().get_option( + this->get_implementation(), option, ec); + } + + /// Perform an IO control command on the acceptor. + /** + * This function is used to execute an IO control command on the acceptor. + * + * @param command The IO control command to be performed on the acceptor. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @sa IoControlCommand @n + * autoboost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::acceptor::non_blocking_io command(true); + * socket.io_control(command); + * @endcode + */ + template + void io_control(IoControlCommand& command) + { + autoboost::system::error_code ec; + this->get_service().io_control(this->get_implementation(), command, ec); + autoboost::asio::detail::throw_error(ec, "io_control"); + } + + /// Perform an IO control command on the acceptor. + /** + * This function is used to execute an IO control command on the acceptor. + * + * @param command The IO control command to be performed on the acceptor. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa IoControlCommand @n + * autoboost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::acceptor::non_blocking_io command(true); + * autoboost::system::error_code ec; + * socket.io_control(command, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + template + autoboost::system::error_code io_control(IoControlCommand& command, + autoboost::system::error_code& ec) + { + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the acceptor. + /** + * @returns @c true if the acceptor's synchronous operations will fail with + * autoboost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * autoboost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the acceptor. + /** + * @param mode If @c true, the acceptor's synchronous operations will fail + * with autoboost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * autoboost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + autoboost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + autoboost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the acceptor. + /** + * @param mode If @c true, the acceptor's synchronous operations will fail + * with autoboost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * autoboost::asio::error::would_block. + */ + autoboost::system::error_code non_blocking( + bool mode, autoboost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native acceptor. This mode has no effect on the behaviour of the acceptor + * object's synchronous operations. + * + * @returns @c true if the underlying acceptor is in non-blocking mode and + * direct system calls may fail with autoboost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the acceptor object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native acceptor. + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native acceptor. It has no effect on the behaviour of the acceptor object's + * synchronous operations. + * + * @param mode If @c true, the underlying acceptor is put into non-blocking + * mode and direct system calls may fail with autoboost::asio::error::would_block + * (or the equivalent system error). + * + * @throws autoboost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with autoboost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + void native_non_blocking(bool mode) + { + autoboost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + autoboost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native acceptor. It has no effect on the behaviour of the acceptor object's + * synchronous operations. + * + * @param mode If @c true, the underlying acceptor is put into non-blocking + * mode and direct system calls may fail with autoboost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with autoboost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + autoboost::system::error_code native_non_blocking( + bool mode, autoboost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + } + + /// Get the local endpoint of the acceptor. + /** + * This function is used to obtain the locally bound endpoint of the acceptor. + * + * @returns An object that represents the local endpoint of the acceptor. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(); + * @endcode + */ + endpoint_type local_endpoint() const + { + autoboost::system::error_code ec; + endpoint_type ep = this->get_service().local_endpoint( + this->get_implementation(), ec); + autoboost::asio::detail::throw_error(ec, "local_endpoint"); + return ep; + } + + /// Get the local endpoint of the acceptor. + /** + * This function is used to obtain the locally bound endpoint of the acceptor. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns An object that represents the local endpoint of the acceptor. + * Returns a default-constructed endpoint object if an error occurred and the + * error handler did not throw an exception. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::system::error_code ec; + * autoboost::asio::ip::tcp::endpoint endpoint = acceptor.local_endpoint(ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + endpoint_type local_endpoint(autoboost::system::error_code& ec) const + { + return this->get_service().local_endpoint(this->get_implementation(), ec); + } + + /// Accept a new connection. + /** + * This function is used to accept a new connection from a peer into the + * given socket. The function call will block until a new connection has been + * accepted successfully or an error occurs. + * + * @param peer The socket into which the new connection will be accepted. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::socket socket(io_service); + * acceptor.accept(socket); + * @endcode + */ + template + void accept(basic_socket& peer, + typename enable_if::value>::type* = 0) + { + autoboost::system::error_code ec; + this->get_service().accept(this->get_implementation(), + peer, static_cast(0), ec); + autoboost::asio::detail::throw_error(ec, "accept"); + } + + /// Accept a new connection. + /** + * This function is used to accept a new connection from a peer into the + * given socket. The function call will block until a new connection has been + * accepted successfully or an error occurs. + * + * @param peer The socket into which the new connection will be accepted. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::soocket socket(io_service); + * autoboost::system::error_code ec; + * acceptor.accept(socket, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + template + autoboost::system::error_code accept( + basic_socket& peer, + autoboost::system::error_code& ec, + typename enable_if::value>::type* = 0) + { + return this->get_service().accept(this->get_implementation(), + peer, static_cast(0), ec); + } + + /// Start an asynchronous accept. + /** + * This function is used to asynchronously accept a new connection into a + * socket. The function call always returns immediately. + * + * @param peer The socket into which the new connection will be accepted. + * Ownership of the peer object is retained by the caller, which must + * guarantee that it is valid until the handler is called. + * + * @param handler The handler to be called when the accept operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error // Result of operation. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + * + * @par Example + * @code + * void accept_handler(const autoboost::system::error_code& error) + * { + * if (!error) + * { + * // Accept succeeded. + * } + * } + * + * ... + * + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::socket socket(io_service); + * acceptor.async_accept(socket, accept_handler); + * @endcode + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, + void (autoboost::system::error_code)) + async_accept(basic_socket& peer, + BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, + typename enable_if::value>::type* = 0) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a AcceptHandler. + BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; + + return this->get_service().async_accept(this->get_implementation(), + peer, static_cast(0), + BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); + } + + /// Accept a new connection and obtain the endpoint of the peer + /** + * This function is used to accept a new connection from a peer into the + * given socket, and additionally provide the endpoint of the remote peer. + * The function call will block until a new connection has been accepted + * successfully or an error occurs. + * + * @param peer The socket into which the new connection will be accepted. + * + * @param peer_endpoint An endpoint object which will receive the endpoint of + * the remote peer. + * + * @throws autoboost::system::system_error Thrown on failure. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::socket socket(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint; + * acceptor.accept(socket, endpoint); + * @endcode + */ + template + void accept(basic_socket& peer, + endpoint_type& peer_endpoint) + { + autoboost::system::error_code ec; + this->get_service().accept(this->get_implementation(), + peer, &peer_endpoint, ec); + autoboost::asio::detail::throw_error(ec, "accept"); + } + + /// Accept a new connection and obtain the endpoint of the peer + /** + * This function is used to accept a new connection from a peer into the + * given socket, and additionally provide the endpoint of the remote peer. + * The function call will block until a new connection has been accepted + * successfully or an error occurs. + * + * @param peer The socket into which the new connection will be accepted. + * + * @param peer_endpoint An endpoint object which will receive the endpoint of + * the remote peer. + * + * @param ec Set to indicate what error occurred, if any. + * + * @par Example + * @code + * autoboost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * autoboost::asio::ip::tcp::socket socket(io_service); + * autoboost::asio::ip::tcp::endpoint endpoint; + * autoboost::system::error_code ec; + * acceptor.accept(socket, endpoint, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + template + autoboost::system::error_code accept( + basic_socket& peer, + endpoint_type& peer_endpoint, autoboost::system::error_code& ec) + { + return this->get_service().accept( + this->get_implementation(), peer, &peer_endpoint, ec); + } + + /// Start an asynchronous accept. + /** + * This function is used to asynchronously accept a new connection into a + * socket, and additionally obtain the endpoint of the remote peer. The + * function call always returns immediately. + * + * @param peer The socket into which the new connection will be accepted. + * Ownership of the peer object is retained by the caller, which must + * guarantee that it is valid until the handler is called. + * + * @param peer_endpoint An endpoint object into which the endpoint of the + * remote peer will be written. Ownership of the peer_endpoint object is + * retained by the caller, which must guarantee that it is valid until the + * handler is called. + * + * @param handler The handler to be called when the accept operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const autoboost::system::error_code& error // Result of operation. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * autoboost::asio::io_service::post(). + */ + template + BOOST_ASIO_INITFN_RESULT_TYPE(AcceptHandler, + void (autoboost::system::error_code)) + async_accept(basic_socket& peer, + endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a AcceptHandler. + BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; + + return this->get_service().async_accept(this->get_implementation(), peer, + &peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); + } +}; + +} // namespace asio +} // namespace autoboost + +#include + +#endif // BOOST_ASIO_BASIC_SOCKET_ACCEPTOR_HPP diff --git a/contrib/autoboost/boost/asio/basic_socket_iostream.hpp b/contrib/autoboost/boost/asio/basic_socket_iostream.hpp new file mode 100644 index 000000000..0265a186a --- /dev/null +++ b/contrib/autoboost/boost/asio/basic_socket_iostream.hpp @@ -0,0 +1,288 @@ +// +// basic_socket_iostream.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot 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_ASIO_BASIC_SOCKET_IOSTREAM_HPP +#define BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include + +#if !defined(BOOST_ASIO_NO_IOSTREAM) + +#include +#include +#include +#include + +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +# include + +// A macro that should expand to: +// template +// explicit basic_socket_iostream(T1 x1, ..., Tn xn) +// : std::basic_iostream( +// &this->detail::socket_iostream_base< +// Protocol, StreamSocketService, Time, +// TimeTraits, TimerService>::streambuf_) +// { +// if (rdbuf()->connect(x1, ..., xn) == 0) +// this->setstate(std::ios_base::failbit); +// } +// This macro should only persist within this file. + +# define BOOST_ASIO_PRIVATE_CTR_DEF(n) \ + template \ + explicit basic_socket_iostream(BOOST_ASIO_VARIADIC_PARAMS(n)) \ + : std::basic_iostream( \ + &this->detail::socket_iostream_base< \ + Protocol, StreamSocketService, Time, \ + TimeTraits, TimerService>::streambuf_) \ + { \ + this->setf(std::ios_base::unitbuf); \ + if (rdbuf()->connect(BOOST_ASIO_VARIADIC_ARGS(n)) == 0) \ + this->setstate(std::ios_base::failbit); \ + } \ + /**/ + +// A macro that should expand to: +// template +// void connect(T1 x1, ..., Tn xn) +// { +// if (rdbuf()->connect(x1, ..., xn) == 0) +// this->setstate(std::ios_base::failbit); +// } +// This macro should only persist within this file. + +# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \ + template \ + void connect(BOOST_ASIO_VARIADIC_PARAMS(n)) \ + { \ + if (rdbuf()->connect(BOOST_ASIO_VARIADIC_ARGS(n)) == 0) \ + this->setstate(std::ios_base::failbit); \ + } \ + /**/ + +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +#include + +namespace autoboost { +namespace asio { +namespace detail { + +// A separate base class is used to ensure that the streambuf is initialised +// prior to the basic_socket_iostream's basic_iostream base class. +template +class socket_iostream_base +{ +protected: + basic_socket_streambuf streambuf_; +}; + +} + +/// Iostream interface for a socket. +template , +#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ + || defined(GENERATING_DOCUMENTATION) + typename Time = autoboost::posix_time::ptime, + typename TimeTraits = autoboost::asio::time_traits