Skip to content

Commit

Permalink
feat(daisi): Add macro to deserialize ns3::Time from scenariofile
Browse files Browse the repository at this point in the history
  • Loading branch information
ltoenning committed Sep 18, 2023
1 parent 8b08a05 commit 9f65cdc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions daisi/src/manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ target_sources(daisi_manager_scenariofile_component
target_link_libraries(daisi_manager_scenariofile_component
INTERFACE
yaml-cpp
ns3::libcore
)

add_library(daisi_manager_general_scenariofile INTERFACE)
Expand Down
15 changes: 15 additions & 0 deletions daisi/src/manager/scenariofile_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,23 @@
#include <optional>
#include <variant>

#include "ns3/core-module.h"

#define STRING_NAME(VAR_NAME) #VAR_NAME
#define SERIALIZE_VAR(VAR) serializeType(VAR, STRING_NAME(VAR), node);
#define SERIALIZE_NS3_TIME(VAR) \
{ \
std::string internal; \
serializeType(internal, STRING_NAME(VAR), node); \
VAR = ns3::Time(internal); \
}

#define SERIALIZE_NS3_TIME_VARIANT(VAR) \
{ \
std::optional<std::string> internal; \
serializeType(internal, STRING_NAME(VAR), node); \
if (internal) VAR = ns3::Time(internal.value()); \
}

namespace daisi {

Expand Down

0 comments on commit 9f65cdc

Please sign in to comment.