Skip to content

Commit

Permalink
♻ Replace Cereal with Ser20
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFouchy committed Jul 21, 2024
1 parent 81dc23d commit 1166eb8
Show file tree
Hide file tree
Showing 49 changed files with 238 additions and 241 deletions.
2 changes: 1 addition & 1 deletion Cool
Submodule Cool updated 109 files
2 changes: 1 addition & 1 deletion lib/cmd
18 changes: 9 additions & 9 deletions src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Nodes/NodesLibraryManager.h>
#include <ProjectManager/Command_SaveProject.h>
#include <ProjectManager/RecentlyOpened.h>
#include <reg/cereal.hpp>
#include <reg/ser20.hpp>
#include "CommandCore/CommandExecutor_TopLevel.h"
#include "CommandCore/CommandExecutor_WithoutHistory_Ref.h"
#include "CommandCore/ReversibleCommandExecutor_WithoutHistory_Ref.h"
Expand Down Expand Up @@ -116,18 +116,18 @@ class App : public Cool::IApp {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive, class AppT>
static void serialize_impl(Archive& archive, AppT&& app) // Template to allow us to use it for both App& and App const&.
{
archive(
cereal::make_nvp("Recently opened projects", app._recently_opened_projects),
cereal::make_nvp("Gallery Poster", app._gallery_poster),
cereal::make_nvp("Tips", app._tips_manager),
cereal::make_nvp("Output view", app._output_view),
cereal::make_nvp("Webcams config", Cool::WebcamsConfigs::instance()),
cereal::make_nvp("MIDI config", Cool::midi_manager()),
cereal::make_nvp("OSC config", Cool::osc_manager())
ser20::make_nvp("Recently opened projects", app._recently_opened_projects),
ser20::make_nvp("Gallery Poster", app._gallery_poster),
ser20::make_nvp("Tips", app._tips_manager),
ser20::make_nvp("Output view", app._output_view),
ser20::make_nvp("Webcams config", Cool::WebcamsConfigs::instance()),
ser20::make_nvp("MIDI config", Cool::midi_manager()),
ser20::make_nvp("OSC config", Cool::osc_manager())
);
}
template<class Archive>
Expand Down
11 changes: 5 additions & 6 deletions src/CommandCore/LAB_REGISTER_COMMAND.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include <cereal/archives/json.hpp>
#include <cereal/types/polymorphic.hpp>
#include <ser20/archives/json.hpp>
#include <ser20/types/polymorphic.hpp>
#include "CommandCore/PolymorphicCommand.h"

#define LAB_REGISTER_COMMAND(CommandType) \
CEREAL_REGISTER_TYPE(Lab::PolymorphicCommand<CommandType>) \
CEREAL_REGISTER_POLYMORPHIC_RELATION(Lab::ICommand, Lab::PolymorphicCommand<CommandType>)
#define LAB_REGISTER_COMMAND(CommandType) \
SER20_REGISTER_TYPE(Lab::PolymorphicCommand<CommandType>) \
SER20_REGISTER_POLYMORPHIC_RELATION(Lab::ICommand, Lab::PolymorphicCommand<CommandType>)
11 changes: 5 additions & 6 deletions src/CommandCore/LAB_REGISTER_REVERSIBLE_COMMAND.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include <cereal/archives/json.hpp>
#include <cereal/types/polymorphic.hpp>
#include <ser20/archives/json.hpp>
#include <ser20/types/polymorphic.hpp>
#include "CommandCore/PolymorphicReversibleCommand.h"

#define LAB_REGISTER_REVERSIBLE_COMMAND(CommandType) \
CEREAL_REGISTER_TYPE(Lab::PolymorphicReversibleCommand<CommandType>) \
CEREAL_REGISTER_POLYMORPHIC_RELATION(Lab::IReversibleCommand, Lab::PolymorphicReversibleCommand<CommandType>)
#define LAB_REGISTER_REVERSIBLE_COMMAND(CommandType) \
SER20_REGISTER_TYPE(Lab::PolymorphicReversibleCommand<CommandType>) \
SER20_REGISTER_POLYMORPHIC_RELATION(Lab::IReversibleCommand, Lab::PolymorphicReversibleCommand<CommandType>)
2 changes: 1 addition & 1 deletion src/CommandCore/PolymorphicReversibleCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PolymorphicReversibleCommand final : public IReversibleCommand {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Commands/Command_AddLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ struct Command_AddLink {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Link id", link_id),
cereal::make_nvp("Link", link)
ser20::make_nvp("Link id", link_id),
ser20::make_nvp("Link", link)
);
}
};
Expand All @@ -39,12 +39,12 @@ struct ReversibleCommand_AddLink {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd)
ser20::make_nvp("Forward", fwd)
);
}
};
Expand Down
10 changes: 5 additions & 5 deletions src/Commands/Command_AddNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ struct Command_AddNode {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Node id", node_id),
cereal::make_nvp("Node", node)
ser20::make_nvp("Node id", node_id),
ser20::make_nvp("Node", node)
);
}
};
Expand All @@ -39,12 +39,12 @@ struct ReversibleCommand_AddNode {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd)
ser20::make_nvp("Forward", fwd)
);
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/Command_ChangeNodeDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ struct Command_ChangeNodeDefinition {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Node id", node_id),
cereal::make_nvp("New value", new_value)
ser20::make_nvp("Node id", node_id),
ser20::make_nvp("New value", new_value)
);
}
};
Expand All @@ -40,13 +40,13 @@ struct ReversibleCommand_ChangeNodeDefinition {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd),
cereal::make_nvp("Old value", old_value)
ser20::make_nvp("Forward", fwd),
ser20::make_nvp("Old value", old_value)
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Command_FinishedEditingVariable.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Command_FinishedEditingVariable {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive&)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Command_OpenImageExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct Command_OpenImageExporter {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive&)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Command_OpenVideoExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct Command_OpenVideoExporter {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive&)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Commands/Command_RemoveLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ struct Command_RemoveLink {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Link id", link_id),
cereal::make_nvp("Link", link)
ser20::make_nvp("Link id", link_id),
ser20::make_nvp("Link", link)
);
}
};
Expand All @@ -39,12 +39,12 @@ struct ReversibleCommand_RemoveLink {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd)
ser20::make_nvp("Forward", fwd)
);
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/Command_RemoveNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ struct Command_RemoveNode {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Node id", node_id),
cereal::make_nvp("Node", node)
ser20::make_nvp("Node id", node_id),
ser20::make_nvp("Node", node)
);
}
};
Expand All @@ -40,13 +40,13 @@ struct ReversibleCommand_RemoveNode {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd),
cereal::make_nvp("Node position", node_pos)
ser20::make_nvp("Forward", fwd),
ser20::make_nvp("Node position", node_pos)
);
}
};
Expand Down
10 changes: 5 additions & 5 deletions src/Commands/Command_SetMainNodeId.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ struct Command_SetMainNodeId {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Main node id", main_node_id)
ser20::make_nvp("Main node id", main_node_id)
);
}
};
Expand All @@ -37,13 +37,13 @@ struct ReversibleCommand_SetMainNodeId {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd),
cereal::make_nvp("Old main node id", old_main_node_id)
ser20::make_nvp("Forward", fwd),
ser20::make_nvp("Old main node id", old_main_node_id)
);
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/Command_SetVariable.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ struct Command_SetVariable {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Variable ref", var_ref),
cereal::make_nvp("Value", value)
ser20::make_nvp("Variable ref", var_ref),
ser20::make_nvp("Value", value)
);
}
};
Expand Down Expand Up @@ -109,13 +109,13 @@ struct ReversibleCommand_SetVariable {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd),
cereal::make_nvp("Old value", old_value)
ser20::make_nvp("Forward", fwd),
ser20::make_nvp("Old value", old_value)
);
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/Command_SetVariableDefaultMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ struct Command_SetVariableDefaultMetadata {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Variable ref", var_ref),
cereal::make_nvp("Default metadata", default_metadata)
ser20::make_nvp("Variable ref", var_ref),
ser20::make_nvp("Default metadata", default_metadata)
);
}
};
Expand Down Expand Up @@ -73,13 +73,13 @@ struct ReversibleCommand_SetVariableDefaultMetadata {

private:
// Serialization
friend class cereal::access;
friend class ser20::access;
template<class Archive>
void serialize(Archive& archive)
{
archive(
cereal::make_nvp("Forward", fwd),
cereal::make_nvp("Old default metadata", old_default_metadata)
ser20::make_nvp("Forward", fwd),
ser20::make_nvp("Old default metadata", old_default_metadata)
);
}
};
Expand Down
Loading

0 comments on commit 1166eb8

Please sign in to comment.