[*] More house cleaning / clean up

This commit is contained in:
Reece Wilson 2021-10-23 21:13:40 +01:00
parent 39834cef6a
commit 81ba305558
13 changed files with 74 additions and 31 deletions

View File

@ -14,16 +14,11 @@ namespace Aurora::Async
struct WorkerId_t;
}
#include "ICommandSubscriber.hpp"
#include "ITextLineSubscriber.hpp"
namespace Aurora::Console::Commands
{
AUKN_INTERFACE(ICommandSubscriber,
AUI_METHOD(void, OnCommand, (const Parse::ParsedObject &, parseList))
);
AUKN_INTERFACE(ITextLineSubscriber,
AUI_METHOD(void, OnProcessedLineUTF8, (const AuString &, line))
);
AUKN_SYM void AddCommand(const AuString &tag, const Parse::ParseObject &commandStructure, const AuSPtr<ICommandSubscriber> &subscriber);
/**

View File

@ -0,0 +1,15 @@
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: ICommandSubscriber.hpp
Date: 2021-10-23
Author: Reece
***/
#pragma once
namespace Aurora::Console::Commands
{
AUKN_INTERFACE(ICommandSubscriber,
AUI_METHOD(void, OnCommand, (const Parse::ParsedObject &, parseList))
);
}

View File

@ -0,0 +1,15 @@
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: ITextLineSubscriber.hpp
Date: 2021-10-23
Author: Reece
***/
#pragma once
namespace Aurora::Console::Commands
{
AUKN_INTERFACE(ITextLineSubscriber,
AUI_METHOD(void, OnProcessedLineUTF8, (const AuString &, line))
);
}

View File

@ -7,12 +7,10 @@
***/
#pragma once
#include "IConsoleSubscriber.hpp"
namespace Aurora::Console::Hooks
{
AUKN_INTERFACE(IConsoleSubscriber,
AUI_METHOD(void, OnMessage, (const ConsoleMessage &, message))
);
AUKN_SYM void AddSubscription(const AuSPtr<IConsoleSubscriber> &subscriber);
AUKN_SYM void RemoveSubscription(const AuSPtr<IConsoleSubscriber> &subscriber);

View File

@ -0,0 +1,15 @@
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IConsoleSubscriber.hpp
Date: 2021-10-23
Author: Reece
***/
#pragma once
namespace Aurora::Console::Hooks
{
AUKN_INTERFACE(IConsoleSubscriber,
AUI_METHOD(void, OnMessage, (const ConsoleMessage &, message))
);
}

View File

@ -11,7 +11,7 @@
template<typename ... T>
static inline void __declspec(noreturn) SysPanic(T... args)
{
Aurora::Console::Logging::WriteLinef(Aurora::Console::EAnsiColor::eBoldRed, "Fatal", args...);
Aurora::Console::Logging::WriteLinef(Aurora::Console::EAnsiColor::eBoldRed, "Fatal", std::forward<T>(args)...);
Aurora::Debug::Panic();
}
#endif

View File

@ -19,15 +19,15 @@ namespace Aurora::Hashing
return (str[0] == '\0') ? value : fnv1a(&str[1], (value ^ AuUInt64(str[0])) * kFnv1MagicPrime64);
}
inline constexpr uint32_t fnv1a_trunc(const char *const str) noexcept
inline constexpr AuUInt32 fnv1a_trunc(const char *const str) noexcept
{
return static_cast<uint32_t>(fnv1a(str));
return static_cast<AuUInt32>(fnv1a(str));
}
constexpr AuUInt32 kFnv1MagicVal32 = 0x811c9dc5;
constexpr AuUInt32 kFnv1MagicPrime32 = 0x01000193;
inline constexpr uint32_t fnv1a_32(const char *const str, const AuUInt32 value = kFnv1MagicVal32) noexcept
inline constexpr AuUInt32 fnv1a_32(const char *const str, const AuUInt32 value = kFnv1MagicVal32) noexcept
{
return (str[0] == '\0') ? value : fnv1a_32(&str[1], (value ^ AuUInt32(str[0])) * kFnv1MagicPrime32);
}

View File

@ -1,7 +1,7 @@
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: CommonDigests.hpp
File: Digests.hpp
Date: 2021-6-10
Author: Reece
***/

View File

@ -9,6 +9,6 @@
#include "EHashType.hpp"
#include "HashStream.hpp"
#include "CommonDigests.hpp"
#include "Digests.hpp"
#include "CE/fnv1.hpp"

View File

@ -39,6 +39,7 @@ namespace Aurora::IO::FS
AUKN_SYM bool Copy(const AuString &src, const AuString &dest);
}
#include "IFileStream.hpp"
#include "FileStream.hpp"
#include "FileArbitraryReader.hpp"
#include "FileReader.hpp"

View File

@ -9,18 +9,6 @@
namespace Aurora::IO::FS
{
class IFileStream
{
public:
virtual AuUInt64 GetOffset() = 0;
virtual bool SetOffset(AuUInt64 offset) = 0;
virtual AuUInt64 GetLength() = 0;
virtual bool Read(const Memory::MemoryViewStreamWrite &parameters) = 0;
virtual bool Write(const Memory::MemoryViewStreamRead &parameters) = 0;
virtual void Close() = 0;
virtual void Flush() = 0;
};
AUKN_SHARED_API(OpenRead, IFileStream, const AuString &path);
AUKN_SHARED_API(OpenWrite, IFileStream, const AuString &path);
}

View File

@ -0,0 +1,16 @@
#pragma once
namespace Aurora::IO::FS
{
class IFileStream
{
public:
virtual AuUInt64 GetOffset() = 0;
virtual bool SetOffset(AuUInt64 offset) = 0;
virtual AuUInt64 GetLength() = 0;
virtual bool Read(const Memory::MemoryViewStreamWrite &parameters) = 0;
virtual bool Write(const Memory::MemoryViewStreamRead &parameters) = 0;
virtual void Close() = 0;
virtual void Flush() = 0;
};
}

View File

@ -100,7 +100,7 @@ Bonus point UNIX (4): <br>
No wait multiple mechanism
1, 2, 4: Use the high performance AuThreadPrimitives objects<br>
1, 2, 3: Use the high performance AuThreadPrimitives objects<br>
4: Consider using loop sources, perhaps with the async subsystem, in your async application. <br>
Performance of loop sources will vary wildly between platforms, always being generally worse than <br>
the high performance primitives. They should be used to observe kernel-level signalable resources.<br>