Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3cd54fb
Add handler submodule
kachsheev Oct 13, 2023
5f2e5e3
Add Expected class to Common. Fix 'Utils' -> 'UtilsTest'
kachsheev Dec 24, 2023
5f5993b
Add implementation of network hadler
kachsheev Dec 24, 2023
56e49c1
Move files and fix headers
kachsheev Sep 16, 2024
b4dcbe5
Add 'Common/TypeMapper' with tests
kachsheev Sep 17, 2024
fa971dd
Redesign UDP part of Hanler
kachsheev Sep 23, 2024
e38116d
Add pull() member function to Optional
kachsheev Sep 23, 2024
94a3ba5
Fix compilation errors and warnings
kachsheev Sep 23, 2024
d651b6b
Rename Handler tests
kachsheev Sep 24, 2024
96ea3c5
Fix build on MSVC 2017
kachsheev Sep 24, 2024
5898af1
Change returning type in 'Handler::ServerHandle::getSessionHandle()'
kachsheev Sep 24, 2024
14f1f6e
Multiple changes
kachsheev Sep 24, 2024
6b387c8
Common/Expected: add 'ifResultGet()' and 'ifErrorGet()' for change da…
kachsheev Dec 14, 2024
a8cc028
Common/ReferenceWrapper: update, add default copy/move ctorss add ass…
kachsheev Dec 14, 2024
81ebedd
Handler/Network/Tests: fix tests location
kachsheev Dec 14, 2024
d915dcb
Dump changes
kachsheev Dec 14, 2024
278e730
Templates/Array: fix compilation error
kachsheev Dec 14, 2024
730d45f
Os/Async/Network/Registrar: remove useless header
kachsheev Dec 14, 2024
713482e
Os/Threads/ConditionVariable: remove tryWait and unwait
kachsheev Dec 14, 2024
ebacb07
Os/Threads/Counter: update
kachsheev Dec 14, 2024
2870e21
Templates/Object: fix compilation error
kachsheev Dec 14, 2024
f94fcd0
Templates/SimpleAlgorithms: fix
kachsheev Dec 14, 2024
62c487a
Common/Tests: small fixes in FunctionTrait and VoidType tests
kachsheev Dec 14, 2024
e95b1e4
Handler/Tests/Network/Udp: add test templates; add tests for UDP storage
kachsheev Dec 16, 2024
d6add2e
Add initial tests for Handler
kachsheev Aug 11, 2026
7d1c36d
Fix UdpTest
kachsheev Aug 11, 2026
d672fab
Add notification types for five type of sockets events
kachsheev Aug 12, 2026
aac8a3e
Add EventType for async networking
kachsheev Aug 16, 2026
6678693
Remove useless push() functions in Registrar
kachsheev Aug 16, 2026
aa3bcf2
Fix build
kachsheev Aug 16, 2026
678111d
Refactoring Udp types
kachsheev Aug 17, 2026
dbe7bff
Replace raw pointer to ReferenceWrapper && add fill() and range() fun…
kachsheev Aug 17, 2026
5f3ae00
Rename onece-include macro checks
kachsheev Aug 17, 2026
dc35ae1
Implementation of Worker<->Registrar and Worker<->Storage for UDP
kachsheev Aug 18, 2026
75d06ae
Add initional tests for Handler and Handler/Udp
kachsheev Aug 18, 2026
dcb66a1
Sort test priorities
kachsheev Aug 19, 2026
1e1e09d
Implement Udp/TypeMappingTest
kachsheev Aug 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/FlameIDE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(HEADER_MODULES
${FLAME_INCLUDE_SUBMODLUES_PATH}/Common
${FLAME_INCLUDE_SUBMODLUES_PATH}/Constants
${FLAME_INCLUDE_SUBMODLUES_PATH}/Crypto
${FLAME_INCLUDE_SUBMODLUES_PATH}/Handler
${FLAME_INCLUDE_SUBMODLUES_PATH}/Os
${FLAME_INCLUDE_SUBMODLUES_PATH}/Others
# ${FLAME_INCLUDE_SUBMODLUES_PATH}/Streams
Expand Down
48 changes: 40 additions & 8 deletions include/FlameIDE/Common/Expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ class Expected
template<typename Functor>
const Me &ifResult(Functor &&functor) const noexcept;

template<typename Functor>
Me &ifResultGet(Functor &&functor) noexcept;

template<typename Functor>
Me &ifError(Functor &&functor) noexcept;
template<typename Functor>
const Me &ifError(Functor &&functor) const noexcept;

template<typename Functor>
Me &ifErrorGet(Functor &&functor) noexcept;

void done() noexcept;
void done() const noexcept;

Expand All @@ -52,7 +58,7 @@ class Expected
{
UNKNOWN = -1
, RESULT = 0
, ERROR = 1
, INVALID = 1
};

union Data
Expand Down Expand Up @@ -146,10 +152,10 @@ Expected<ResultType, ErrorType>::operator=(Me &&expected) noexcept
{
expected.ifResult([this](ResultType &&result)
{
operator=(move(result));
this->operator=(move(result));
}).ifError([this](ErrorType &&error)
{
operator=(move(error));
this->operator=(move(error));
}).done();
return *this;
}
Expand Down Expand Up @@ -180,7 +186,7 @@ Expected<ResultType, ErrorType>::operator=(const ErrorType &error) noexcept
{
destroy();
flame_ide::placementNew(&data.error.value, error);
data.state = State::ERROR;
data.state = State::INVALID;
return *this;
}

Expand All @@ -190,7 +196,7 @@ Expected<ResultType, ErrorType>::operator=(ErrorType &&error) noexcept
{
destroy();
flame_ide::placementNew(&data.error.value, move(error));
data.state = State::ERROR;
data.state = State::INVALID;
return *this;
}

Expand Down Expand Up @@ -221,12 +227,25 @@ Expected<ResultType, ErrorType>::ifResult(Functor &&functor) const noexcept
return *this;
}

template<typename ResultType, typename ErrorType>
template<typename Functor>
Expected<ResultType, ErrorType> &
Expected<ResultType, ErrorType>::ifResultGet(Functor &&functor) noexcept
{
if (State::RESULT != data.state)
return *this;

functor(data.result.value);

return *this;
}

template<typename ResultType, typename ErrorType>
template<typename Functor>
Expected<ResultType, ErrorType> &
Expected<ResultType, ErrorType>::ifError(Functor &&functor) noexcept
{
if (State::ERROR != data.state)
if (State::INVALID != data.state)
return *this;

functor(move(data.error.value));
Expand All @@ -240,7 +259,20 @@ template<typename Functor>
const Expected<ResultType, ErrorType> &
Expected<ResultType, ErrorType>::ifError(Functor &&functor) const noexcept
{
if (State::ERROR != data.state)
if (State::INVALID != data.state)
return *this;

functor(data.error.value);

return *this;
}

template<typename ResultType, typename ErrorType>
template<typename Functor>
Expected<ResultType, ErrorType> &
Expected<ResultType, ErrorType>::ifErrorGet(Functor &&functor) noexcept
{
if (State::INVALID != data.state)
return *this;

functor(data.error.value);
Expand All @@ -267,7 +299,7 @@ void Expected<ResultType, ErrorType>::destroy() noexcept
data.result.value.~ResultType();
return;

case State::ERROR:
case State::INVALID:
data.error.value.~ErrorType();
return;

Expand Down
1 change: 0 additions & 1 deletion include/FlameIDE/Common/PrimitiveTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ using long_t = ::int64_t;
using float_t = float;
using double_t = double;
using ldouble_t = long double;

using ptrint_t = ::intptr_t;
using ptruint_t = ::uintptr_t;

Expand Down
7 changes: 7 additions & 0 deletions include/FlameIDE/Common/ReferenceWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ template<typename T, typename Traits = ContainerTraits<T>>
class ReferenceWrapper
{
public:
using Me = ReferenceWrapper<T, Traits>;
using Pointer = typename Traits::Pointer;
using Reference = typename Traits::Reference;

ReferenceWrapper(const Me &) noexcept = default;
ReferenceWrapper(Me &&) noexcept = default;

///
/// @brief ReferenceWrapper
/// @param initValue
Expand All @@ -28,6 +32,9 @@ class ReferenceWrapper
///
ReferenceWrapper(Reference initValue) noexcept;

Me &operator=(const Me &) noexcept = default;
Me &operator=(Me &&) noexcept = default;

///
/// @brief get
/// @return
Expand Down
38 changes: 38 additions & 0 deletions include/FlameIDE/Common/Traits/Functional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,44 @@ struct DoSomeByIndex<T, SIZE, SIZE>
{}
};

///
/// @brief The TypeMappingTrait class
/// @tparam T1
/// @tparam T2
///
template<typename T1, typename T2>
struct TypeMappingTrait
{
using Type1 = T1;
using Type2 = T2;
};

///
/// @brief The TypeMapper class
/// @tparam T
/// @tparam TypeMappingTrait
/// @tparam ENABLE_STATIC_ASSERT
///
template<typename T, typename TypeMappingTrait, bool ENABLE_STATIC_ASSERT = true>
struct TypeMapper
{
using Type = typename ChooseType<
ComparingTypes<T, typename TypeMappingTrait::Type1>::VALUE
, typename TypeMappingTrait::Type2
, typename ChooseType<
ComparingTypes<T, typename TypeMappingTrait::Type2>::VALUE
, typename TypeMappingTrait::Type1
, Empty
>::Type
>::Type;

static_assert(
!ENABLE_STATIC_ASSERT
|| ComparingTypes<Type, Empty>::VALUE == FalseType::VALUE
, "Type does not include in chosen TypeMatchingTrait"
);
};

}

#endif // FLAMEIDE_COMMON_TRAITS_FUCTIONAL_HPP
8 changes: 8 additions & 0 deletions include/FlameIDE/Handler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.14)

set(SOURCE_MODULES
${CMAKE_CURRENT_LIST_DIR}/Network
)
foreach(module ${SOURCE_MODULES})
add_subdirectory(${module})
endforeach()
20 changes: 20 additions & 0 deletions include/FlameIDE/Handler/Network/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.14)

set(NAME "Handler.Network")
set(NAME_ALIAS "Handler::Network")
set(LIBRARY_ALIAS_NAME ${FLAME_NAMESPACE}::${NAME_ALIAS}::Headers)
set(DEPENDENCY_LIST
${FLAME_NAMESPACE}::Common::Headers
${FLAME_NAMESPACE}::Os::Headers
${FLAME_NAMESPACE}::Templates::Headers
)

get_sources(FILE_LIST)
flame_header_library(
NAME "${NAME}"
LIBRARY_ALIAS_NAME "${LIBRARY_ALIAS_NAME}"
HEADER_LIST "${FILE_LIST}"
DEPENDENCY_TARGET_LIST "${DEPENDENCY_LIST}"
INCLUDE_PATHS "${FLAME_INCLUDE_PATH}"
INSTALL_SUBDIR "${FLAME_NAMESPACE}/${NAME}"
)
Loading
Loading