From 04dab0bb9591ce63698e1b3191a3be5364f20dcf Mon Sep 17 00:00:00 2001 From: Claudius Holeksa Date: Sun, 5 Dec 2021 16:17:23 +0100 Subject: [PATCH] executed format --- schema/kelgin_schema_compile | 8 ------ source/kelgin/async.h | 4 +-- source/kelgin/async.tmpl.h | 2 +- source/kelgin/common.h | 4 +-- source/kelgin/json.h | 4 ++- source/kelgin/message.h | 46 +++++++++++++++++-------------- source/kelgin/message_container.h | 40 ++++++++++++++------------- source/kelgin/schema.h | 19 ++++--------- source/kelgin/string_literal.h | 4 +-- 9 files changed, 62 insertions(+), 69 deletions(-) delete mode 100755 schema/kelgin_schema_compile diff --git a/schema/kelgin_schema_compile b/schema/kelgin_schema_compile deleted file mode 100755 index 4aedca6..0000000 --- a/schema/kelgin_schema_compile +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python3 - - - - - -if __name__ == "__main__": - print("Schema compiler: Not working"); diff --git a/source/kelgin/async.h b/source/kelgin/async.h index 2e2cf47..af69cfc 100644 --- a/source/kelgin/async.h +++ b/source/kelgin/async.h @@ -183,7 +183,7 @@ public: * Useful for resource lifetime control. */ template - [[nodiscard]] Conveyor attach(Args &&... args); + [[nodiscard]] Conveyor attach(Args &&...args); /** @todo implement * This method limits the total amount of passed elements @@ -601,7 +601,7 @@ private: std::tuple attached_data; public: - AttachConveyorNode(Own &&dep, Args &&... args) + AttachConveyorNode(Own &&dep, Args &&...args) : AttachConveyorNodeBase(std::move(dep)), attached_data{ std::move(args...)} {} }; diff --git a/source/kelgin/async.tmpl.h b/source/kelgin/async.tmpl.h index 292a38d..67312e5 100644 --- a/source/kelgin/async.tmpl.h +++ b/source/kelgin/async.tmpl.h @@ -73,7 +73,7 @@ template Conveyor Conveyor::buffer(size_t size) { template template -Conveyor Conveyor::attach(Args &&... args) { +Conveyor Conveyor::attach(Args &&...args) { Own> attach_node = heap>(std::move(node), std::move(args...)); return Conveyor{std::move(attach_node), storage}; diff --git a/source/kelgin/common.h b/source/kelgin/common.h index 58d4d2b..3939076 100644 --- a/source/kelgin/common.h +++ b/source/kelgin/common.h @@ -39,11 +39,11 @@ template using Our = std::shared_ptr; template using Lent = std::weak_ptr; -template Own heap(Args &&... args) { +template Own heap(Args &&...args) { return Own(new T(std::forward(args)...)); } -template Our share(Args &&... args) { +template Our share(Args &&...args) { return std::make_shared(std::forward(args)...); } diff --git a/source/kelgin/json.h b/source/kelgin/json.h index edb5b6f..189a491 100644 --- a/source/kelgin/json.h +++ b/source/kelgin/json.h @@ -835,7 +835,9 @@ Error JsonCodec::decodeValue(Own &message, Buffer &buffer, decodeNull(buffer); message = std::move(msg_null); } break; - default: { return criticalError("Cannot identify next JSON value"); } + default: { + return criticalError("Cannot identify next JSON value"); + } } skipWhitespace(buffer); diff --git a/source/kelgin/message.h b/source/kelgin/message.h index 65330e1..2f2bb24 100644 --- a/source/kelgin/message.h +++ b/source/kelgin/message.h @@ -2,9 +2,9 @@ #include #include +#include #include #include -#include #include "common.h" @@ -29,21 +29,21 @@ public: }; /* * Representing all message types - * Description which type to use happens through the use of the schema classes in schema.h - * The message classes are a container class which either contains singular types or has - * some form of encoding in a buffer present + * Description which type to use happens through the use of the schema classes + * in schema.h The message classes are a container class which either contains + * singular types or has some form of encoding in a buffer present */ template class Message...>, Container> final : public MessageBase { private: - using SchemaType = schema::Struct...>; - using MessageType = - Message; + using SchemaType = schema::Struct...>; + using MessageType = Message; Container container; - static_assert(std::is_same_v, "Container should have same Schema as Message"); + static_assert(std::is_same_v, + "Container should have same Schema as Message"); friend class Builder; friend class Reader; @@ -59,13 +59,15 @@ public: Reader asReader() { return Reader{MessageType & message}; } - template - typename Container::Element::Builder init(){ - return typename Container::Element::Builder{message.container.get()}; + template typename Container::Element::Builder init() { + return typename Container::Element::Builder{ + message.container.get()}; } - template typename Container::Element::Builder init(){ - constexpr size_t i = MessageParameterPackIndex::Value; + template + typename Container::Element::Builder init() { + constexpr size_t i = + MessageParameterPackIndex::Value; return init(); } @@ -80,25 +82,27 @@ public: Builder asBuilder() { return Builder{MessageType & message}; } - template - typename Container::Element::Reader get(){ - return typename Container::Element::Reader{message.container.get()}; + template typename Container::Element::Reader get() { + return typename Container::Element::Reader{ + message.container.get()}; } - template typename Container::Element::Reader get(){ - constexpr size_t i = MessageParameterPackIndex::Value; + template + typename Container::Element::Reader get() { + constexpr size_t i = + MessageParameterPackIndex::Value; return get(); } }; }; -template -class Message, Container> final : public MessageBase { +template +class Message, Container> final : public MessageBase { private: Container container; -public: +public: }; class MessageReader { diff --git a/source/kelgin/message_container.h b/source/kelgin/message_container.h index f6a2b73..fd2b53c 100644 --- a/source/kelgin/message_container.h +++ b/source/kelgin/message_container.h @@ -3,44 +3,46 @@ #include "schema.h" namespace gin { -template -class MessageContainer; +template class MessageContainer; template class Message; -template struct MessageParameterPackType ; +template struct MessageParameterPackType; -template struct MessageParameterPackType <0, TN, T...> { +template struct MessageParameterPackType<0, TN, T...> { using Type = T; }; -template struct MessageParameterPackType { - using Type = typename MessageParameterPackType::Type; +template +struct MessageParameterPackType { + using Type = typename MessageParameterPackType::Type; }; -template struct MessageParameterPackIndex; +template struct MessageParameterPackIndex; -template struct MessageParameterPackIndex { +template struct MessageParameterPackIndex { static constexpr size_t Value = 0u; }; -template struct MessageParameterPackIndex { - static constexpr size_t Value = 1u + MessageParameterPackIndex::Value; +template +struct MessageParameterPackIndex { + static constexpr size_t Value = + 1u + MessageParameterPackIndex::Value; }; -template class MessageContainer...>> { +template +class MessageContainer...>> { private: using ValueType = std::tuple>...>; ValueType values; + public: - using SchemaType = schema::Struct...>; + using SchemaType = schema::Struct...>; - template - using Element = MessageParameterPackType>...>; + template + using Element = + MessageParameterPackType>...>; - template - Element& get(){ - return std::get(values); - } + template Element &get() { return std::get(values); } }; -} +} // namespace gin diff --git a/source/kelgin/schema.h b/source/kelgin/schema.h index 897b3b7..559c991 100644 --- a/source/kelgin/schema.h +++ b/source/kelgin/schema.h @@ -23,19 +23,12 @@ struct SignedIntegral {}; struct UnsignedIntegral {}; struct FloatingPoint {}; -template -struct Primitive { - static_assert( - ( - (std::is_same_v || std::is_same_v) && - (N == 1 || N == 2 || N == 4 || N == 8) - )|| - ( - std::is_same_v && - (N==4 || N == 8) - ), - "Primitive Type is not supported" - ); +template struct Primitive { + static_assert(((std::is_same_v || + std::is_same_v)&&(N == 1 || N == 2 || + N == 4 || N == 8)) || + (std::is_same_v && (N == 4 || N == 8)), + "Primitive Type is not supported"); }; using Int8 = Primitive; diff --git a/source/kelgin/string_literal.h b/source/kelgin/string_literal.h index e017ca6..2979ce2 100644 --- a/source/kelgin/string_literal.h +++ b/source/kelgin/string_literal.h @@ -12,7 +12,7 @@ namespace gin { template