From 9bf1a76e91b8c5a8e9bdcde396f3dd04656faeab Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 27 Feb 2014 20:12:52 -0800 Subject: [PATCH] Remove unused classes --- Builds/VisualStudio2013/RippleD.vcxproj | 1 - .../VisualStudio2013/RippleD.vcxproj.filters | 3 - .../Builds/VisualStudio2013/beast.vcxproj | 3 - .../VisualStudio2013/beast.vcxproj.filters | 9 -- src/beast/beast/TypeTraits.h | 1 - src/beast/beast/Utility.h | 2 - src/beast/beast/crypto/Sha256.h | 7 +- src/beast/beast/crypto/impl/Sha256.cpp | 2 +- src/beast/beast/type_traits/RemoveSigned.h | 45 ------- src/beast/beast/utility/BaseFromMember.h | 71 ----------- src/beast/beast/utility/EnableIf.h | 48 -------- src/ripple/algorithm/TODO.md | 4 - src/ripple/algorithm/api/DiscreteClock.h | 111 ------------------ src/ripple/types/TODO.md | 1 - 14 files changed, 5 insertions(+), 303 deletions(-) delete mode 100644 src/beast/beast/type_traits/RemoveSigned.h delete mode 100644 src/beast/beast/utility/BaseFromMember.h delete mode 100644 src/beast/beast/utility/EnableIf.h delete mode 100644 src/ripple/algorithm/api/DiscreteClock.h diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index 78ce2ff17..7f6f3cf22 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -2229,7 +2229,6 @@ - diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index ec16d1dc9..8902a946a 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -2538,9 +2538,6 @@ [1] Ripple\algorithm\api - - [1] Ripple\algorithm\api - [1] Ripple\sitefiles diff --git a/src/beast/Builds/VisualStudio2013/beast.vcxproj b/src/beast/Builds/VisualStudio2013/beast.vcxproj index 95f484156..2d2943b2b 100644 --- a/src/beast/Builds/VisualStudio2013/beast.vcxproj +++ b/src/beast/Builds/VisualStudio2013/beast.vcxproj @@ -223,13 +223,10 @@ - - - diff --git a/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters b/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters index b57463e16..bb202a9de 100644 --- a/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters +++ b/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters @@ -866,12 +866,6 @@ beast\type_traits - - beast\type_traits - - - beast\utility - beast\utility @@ -1140,9 +1134,6 @@ beast\threads - - beast\utility - beast diff --git a/src/beast/beast/TypeTraits.h b/src/beast/beast/TypeTraits.h index 6af5fedc1..b790e9ada 100644 --- a/src/beast/beast/TypeTraits.h +++ b/src/beast/beast/TypeTraits.h @@ -23,6 +23,5 @@ #include "type_traits/IntegralConstant.h" #include "type_traits/IsIntegral.h" #include "type_traits/IsSigned.h" -#include "type_traits/RemoveSigned.h" #endif diff --git a/src/beast/beast/Utility.h b/src/beast/beast/Utility.h index 6c9685343..c214de92d 100644 --- a/src/beast/beast/Utility.h +++ b/src/beast/beast/Utility.h @@ -20,9 +20,7 @@ #ifndef BEAST_UTILITY_H_INCLUDED #define BEAST_UTILITY_H_INCLUDED -#include "utility/BaseFromMember.h" #include "utility/Debug.h" -#include "utility/EnableIf.h" #include "utility/Error.h" #include "utility/Journal.h" #include "utility/LeakChecked.h" diff --git a/src/beast/beast/crypto/Sha256.h b/src/beast/beast/crypto/Sha256.h index a3f4c5c52..9f3c0d3e0 100644 --- a/src/beast/beast/crypto/Sha256.h +++ b/src/beast/beast/crypto/Sha256.h @@ -22,7 +22,8 @@ #include "../Config.h" #include "../CStdInt.h" -#include "../FixedArray.h" + +#include //------------------------------------------------------------------------------ @@ -36,7 +37,7 @@ enum }; /** A container suitable for holding the resulting hash. */ -typedef FixedArray digest_type; +typedef std::array digest_type; namespace detail { struct Context @@ -85,7 +86,7 @@ public: digest_type& finish (digest_type& digest) { - finish (digest.c_array()); + finish (digest.data()); return digest; } diff --git a/src/beast/beast/crypto/impl/Sha256.cpp b/src/beast/beast/crypto/impl/Sha256.cpp index 7542c189d..3eb1f5774 100644 --- a/src/beast/beast/crypto/impl/Sha256.cpp +++ b/src/beast/beast/crypto/impl/Sha256.cpp @@ -88,7 +88,7 @@ void* hash (void const* buffer, std::size_t bytes, void* digest) digest_type& hash (void const* buffer, std::size_t bytes, digest_type& digest) { - hash (buffer, bytes, digest.c_array()); + hash (buffer, bytes, digest.data()); return digest; } diff --git a/src/beast/beast/type_traits/RemoveSigned.h b/src/beast/beast/type_traits/RemoveSigned.h deleted file mode 100644 index e159d4d4b..000000000 --- a/src/beast/beast/type_traits/RemoveSigned.h +++ /dev/null @@ -1,45 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_TYPE_TRAITS_REMOVESIGNED_H_INCLUDED -#define BEAST_TYPE_TRAITS_REMOVESIGNED_H_INCLUDED - -#include "IntegralConstant.h" -#include "../CStdInt.h" - -namespace beast { - -/** Returns an equally sized, unsigned type. - Requires: - IsIntegral::value == true -*/ -template -struct RemoveSigned -{ - typedef T type; -}; - -template <> struct RemoveSigned { typedef uint8 type; }; -template <> struct RemoveSigned { typedef uint16 type; }; -template <> struct RemoveSigned { typedef uint32 type; }; -template <> struct RemoveSigned { typedef uint64 type; }; - -} - -#endif diff --git a/src/beast/beast/utility/BaseFromMember.h b/src/beast/beast/utility/BaseFromMember.h deleted file mode 100644 index e2103b649..000000000 --- a/src/beast/beast/utility/BaseFromMember.h +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_UTILITY_BASEFROMMEMBER_H_INCLUDED -#define BEAST_UTILITY_BASEFROMMEMBER_H_INCLUDED - -namespace beast { - -template -class BaseFromMember -{ -private: - T m_t; - -public: - BaseFromMember () - : m_t (T()) - { - } - - template - explicit BaseFromMember (P1 const& p1) - : m_t (p1) - { } - - template - BaseFromMember (P1 const& p1, P2 const& p2) - : m_t (p1, p2) - { } - - template - BaseFromMember (P1 const& p1, P2 const& p2, P3 const& p3) - : m_t (p1, p2, p3) - { } - - template - BaseFromMember (P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4) - : m_t (p1, p2, p3, p4) - { } - - template - BaseFromMember (P1 const& p1, P2 const& p2, P3 const& p3, P4 const& p4, P5 const& p5) - : m_t (p1, p2, p3, p4, p5) - { } - - T& member() - { return m_t; } - - T const& member() const - { return m_t; } -}; - -} - -#endif diff --git a/src/beast/beast/utility/EnableIf.h b/src/beast/beast/utility/EnableIf.h deleted file mode 100644 index 51087fa41..000000000 --- a/src/beast/beast/utility/EnableIf.h +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of Beast: https://github.com/vinniefalco/Beast - Copyright 2013, Vinnie Falco - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef BEAST_UTILITY_ENABLEIF_H_INCLUDED -#define BEAST_UTILITY_ENABLEIF_H_INCLUDED - -#include "../type_traits/IntegralConstant.h" - -namespace beast -{ - -template -struct EnableIfBool : TrueType { typedef T type; }; - -template -struct EnableIfBool : FalseType { }; - -template -struct EnableIf : public EnableIfBool { }; - -template -struct DisableIfBool : FalseType { typedef T type; }; - -template -struct DisableIfBool { }; - -template -struct DisableIf : public DisableIfBool { }; - -} - -#endif diff --git a/src/ripple/algorithm/TODO.md b/src/ripple/algorithm/TODO.md index b05e3dce4..de9244643 100644 --- a/src/ripple/algorithm/TODO.md +++ b/src/ripple/algorithm/TODO.md @@ -1,5 +1 @@ # Algorithm TODO - -- Rethink the CycledSet (and cousin AgedCache). Make each element part - of an intrusive linked list, add a DiscreteClock data member, and - perform aging on each insertion or sweep rather than once in a while. diff --git a/src/ripple/algorithm/api/DiscreteClock.h b/src/ripple/algorithm/api/DiscreteClock.h deleted file mode 100644 index 02d307df0..000000000 --- a/src/ripple/algorithm/api/DiscreteClock.h +++ /dev/null @@ -1,111 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_ALGORITHM_DISCRETECLOCK_H_INCLUDED -#define RIPPLE_ALGORITHM_DISCRETECLOCK_H_INCLUDED - -#include "beast/beast/StaticAssert.h" -#include "beast/beast/type_traits/IsIntegral.h" -#include "beast/beast/chrono/RelativeTime.h" - -namespace ripple { - -/** Interface for an elapsed time clock that uses integral units. */ -template -class DiscreteClock -{ -public: - /** Source of time for the discrete clock. */ - class Source - { - public: - typedef ElapsedType elapsed_type; - typedef DiscreteClock DiscreteClockType; - virtual ElapsedType operator() () = 0; - }; - - /** Integral elapsed time type relative to an unspecified past event. */ - typedef ElapsedType elapsed_type; - - DiscreteClock (Source& source) - : m_source (source) - { - static_bassert (IsIntegral ::value); - } - - /** Returns the elapsed time in discrete units. - The elapsed time is relative to an unspecified event. - */ - elapsed_type operator() () const - { - return m_source(); - } - -private: - Source& m_source; -}; - -//------------------------------------------------------------------------------ - -/** Seconds-based clock that uses elapsed time from startup as a time source. */ -class SimpleMonotonicClock : public DiscreteClock ::Source -{ -public: - elapsed_type operator() () - { - return static_cast ( - RelativeTime::fromStartup().inSeconds()); - } -}; - -//------------------------------------------------------------------------------ - -/** A manually-operated clock. - This can be useful for unit tests. -*/ -class ManualClock : public DiscreteClock ::Source -{ -private: - elapsed_type m_now; - -public: - ManualClock () - : m_now (elapsed_type()) - { - } - - elapsed_type& now() - { - return m_now; - } - - elapsed_type now() const - { - return m_now; - } - - elapsed_type operator() () - { - return now(); - } -}; - -} - -#endif diff --git a/src/ripple/types/TODO.md b/src/ripple/types/TODO.md index cd2811731..0f837e073 100644 --- a/src/ripple/types/TODO.md +++ b/src/ripple/types/TODO.md @@ -4,4 +4,3 @@ - Clean up and optimize Base58 conversions -- Generalize AgedHistory to use a DiscreteClock and not have two maps