diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f793b77..24bd59a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,6 +9,8 @@ add_library(fragment_store ./fragment_store/serializer.hpp ./fragment_store/fragment_store.hpp ./fragment_store/fragment_store.cpp + + ./json/message_components.hpp # TODO: move ) target_link_libraries(fragment_store PUBLIC diff --git a/src/fragment_store/message_fragment_store.cpp b/src/fragment_store/message_fragment_store.cpp index 7fe8d6e..e8af12a 100644 --- a/src/fragment_store/message_fragment_store.cpp +++ b/src/fragment_store/message_fragment_store.cpp @@ -1,5 +1,7 @@ #include "./message_fragment_store.hpp" +#include "../json/message_components.hpp" + #include #include @@ -29,20 +31,6 @@ namespace Message::Components { std::vector fuid_open; }; - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Timestamp, ts) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampProcessed, ts) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampWritten, ts) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactFrom, c) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactTo, c) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Read, ts) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MessageText, text) - - namespace Transfer { - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo::FileDirEntry, file_name, file_size) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo, file_list, total_size) - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfoLocal, file_list) - } // Transfer - } // Message::Components namespace Fragment::Components { @@ -314,12 +302,12 @@ MessageFragmentStore::MessageFragmentStore( // files //_sc.registerSerializerJson() - _sc.registerSerializerJson(); - _sc.registerDeSerializerJson(); - _sc.registerSerializerJson(); - _sc.registerDeSerializerJson(); - _sc.registerSerializerJson(); - _sc.registerDeSerializerJson(); + //_sc.registerSerializerJson(); + //_sc.registerDeSerializerJson(); + //_sc.registerSerializerJson(); + //_sc.registerDeSerializerJson(); + //_sc.registerSerializerJson(); + //_sc.registerDeSerializerJson(); _fs.subscribe(this, FragmentStore_Event::fragment_construct); } @@ -347,8 +335,8 @@ float MessageFragmentStore::tick(float time_delta) { continue; } - // require msg and file for now - if (!reg->any_of(m)) { + // require msg for now + if (!reg->any_of(m)) { continue; } diff --git a/src/json/message_components.hpp b/src/json/message_components.hpp new file mode 100644 index 0000000..c272e6c --- /dev/null +++ b/src/json/message_components.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +#include + +#include + +namespace Message::Components { + + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Timestamp, ts) + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampProcessed, ts) + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TimestampWritten, ts) + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactFrom, c) + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(ContactTo, c) + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Read, ts) + // TODO: SyncedBy + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MessageText, text) + + namespace Transfer { + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo::FileDirEntry, file_name, file_size) + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfo, file_list, total_size) + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FileInfoLocal, file_list) + } // Transfer + +} // Message::Components +