From 3b2fd7c368b50994585e7dfbb233674acafe0dd7 Mon Sep 17 00:00:00 2001 From: Reece Date: Thu, 21 Oct 2021 11:04:29 +0100 Subject: [PATCH] [+] Added AuXXXX namespace aliases [*] Clock.hpp readability [+] Added pseudofunction macros for weak/shared/bind this --- Include/Aurora/Runtime.hpp | 21 +++++++++++ Include/Aurora/Time/Clock.hpp | 70 +++++++++++++++++------------------ Include/AuroraMacros.hpp | 14 ++++++- 3 files changed, 68 insertions(+), 37 deletions(-) diff --git a/Include/Aurora/Runtime.hpp b/Include/Aurora/Runtime.hpp index eb4f1785..cd84a7b0 100644 --- a/Include/Aurora/Runtime.hpp +++ b/Include/Aurora/Runtime.hpp @@ -69,6 +69,27 @@ #include "Time/Time.hpp" #include "Loop/Loop.hpp" +namespace AuAsync = Aurora::Async; +namespace AuBuild = Aurora::Build; +namespace AuCompression = Aurora::Compression; +namespace AuConsole = Aurora::Console; +namespace AuCrypto = Aurora::Crypto; +namespace AuData = Aurora::Data; +namespace AuDebug = Aurora::Debug; +namespace AuThreading = Aurora::Threading; +namespace AuThreadPrimitives = Aurora::Threading::Primitives; +namespace AuHwInfo = Aurora::HWInfo; +namespace AuIO = Aurora::IO; +namespace AuIOFS = Aurora::IO::FS; +namespace AuIONet = Aurora::IO::Net; +namespace AuLocale = Aurora::Locale; +namespace AuParse = Aurora::Parse; +namespace AuProcess = Aurora::Process; +namespace AuProcesses = Aurora::Processes; +namespace AuTelemetry = Aurora::Telemetry; +namespace AuTime = Aurora::Time; +namespace AuTypes = Aurora::Types; +namespace AuLog = Aurora::Console::Logging; namespace Aurora { diff --git a/Include/Aurora/Time/Clock.hpp b/Include/Aurora/Time/Clock.hpp index d3364e71..4d995e23 100644 --- a/Include/Aurora/Time/Clock.hpp +++ b/Include/Aurora/Time/Clock.hpp @@ -9,28 +9,6 @@ namespace Aurora::Time { - // aurora epoch to time_t - - /** - Converts seconds from the Aurora epoch to time_t - @deprecated - */ - AUKN_SYM time_t SToCTime(AuInt64 time); - - /** - Converts nanoseconds from the Aurora epoch to time_t - @deprecated - */ - AUKN_SYM time_t NSToCTime(AuInt64 time); - - /** - Converts milliseconds from the Aurora epoch to time_t - @deprecated - */ - AUKN_SYM time_t MSToCTime(AuInt64 time); - - AUKN_SYM AuInt64 CTimeToMS(time_t time); - /** Converts milliseconds from the Aurora epoch to a civil timestamp structure similar to or of std::tm @@ -61,6 +39,27 @@ namespace Aurora::Time */ AUKN_SYM AuUInt64 CurrentClockNS(); + /** + Translates the Aurora epoch to the standard unix epoch + */ + AUKN_SYM AuInt64 ConvertAuroraToUnixMS(AuInt64 in); + + /** + Translates the Aurora epoch to the standard unix epoch + */ + AUKN_SYM AuInt64 ConvertAuroraToUnixNS(AuInt64 in); + + /** + Translates a standard unix epoch to the Aurora epoch + */ + AUKN_SYM AuInt64 ConvertUnixToAuroraMS(AuInt64 in); + + /** + Translates a standard unix epoch to the Aurora epoch + */ + AUKN_SYM AuInt64 ConvertUnixToAuroraNS(AuInt64 in); + + /** Returns a high resolution count of jiffies with an undefined epoch from a high resolution clock. @@ -77,27 +76,26 @@ namespace Aurora::Time */ AUKN_SYM AuUInt64 ConvertInternalToAuroraEpochMS(AuUInt64 in); AUKN_SYM AuUInt64 ConvertInternalToAuroraEpochNS(AuUInt64 in); + + /** + Converts seconds from the Aurora epoch to time_t + @deprecated + */ + AUKN_SYM time_t SToCTime(AuInt64 time); /** - Translates the Aurora epoch to the standard unix epoch + Converts nanoseconds from the Aurora epoch to time_t + @deprecated */ - AUKN_SYM AuInt64 ConvertAuroraToUnixMS(AuInt64 in); + AUKN_SYM time_t NSToCTime(AuInt64 time); /** - Translates the Aurora epoch to the standard unix epoch + Converts milliseconds from the Aurora epoch to time_t + @deprecated */ - AUKN_SYM AuInt64 ConvertAuroraToUnixNS(AuInt64 in); + AUKN_SYM time_t MSToCTime(AuInt64 time); - - /** - Translates a standard unix epoch to the Aurora epoch - */ - AUKN_SYM AuInt64 ConvertUnixToAuroraMS(AuInt64 in); - - /** - Translates a standard unix epoch to the Aurora epoch - */ - AUKN_SYM AuInt64 ConvertUnixToAuroraNS(AuInt64 in); + AUKN_SYM AuInt64 CTimeToMS(time_t time); /** Retrieves the freqency as a fraction of: jiffies per second / 1 * nanoseconds in a second diff --git a/Include/AuroraMacros.hpp b/Include/AuroraMacros.hpp index 38970121..cb69698e 100644 --- a/Include/AuroraMacros.hpp +++ b/Include/AuroraMacros.hpp @@ -114,4 +114,16 @@ name ## Shared_t name ## Shared(T... args) \ #define AU_EMIT_BOTH(a, b) a b #include "AuroraInterfaces.hpp" -#include "AuroraForEach.hpp" \ No newline at end of file +#include "AuroraForEach.hpp" + +#if !defined(AuBindThis) + #define AuBindThis(method, ...) std::bind(method, this, ## __VA_ARGS__) +#endif + +#if !defined(AuSharedFromThis) + #define AuSharedFromThis() AU_SHARED_FROM_THIS +#endif + +#if !defined(AuWeakFromThis) + #define AuWeakFromThis() AU_SHARED_FROM_THIS +#endif \ No newline at end of file