DUDS
Distributed Update of Data from Something
Serialize.hpp File Reference

Serialization support for Interstellar Time data types. More...

#include <duds/time/interstellar/Interstellar.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/nvp.hpp>
Include dependency graph for Serialize.hpp:

Go to the source code of this file.

Namespaces

 boost
 
 boost::serialization
 

Macros

#define SETDUR(val)   val.value
 
#define SETMILLI(val)   duds::time::interstellar::Milliseconds(val)
 
#define SETNANO(val)   duds::time::interstellar::Nanoseconds(val)
 
#define SETPTR(val)   duds::time::interstellar::Femtoseconds(val.value)
 
#define SETSEC(val)   duds::time::interstellar::Seconds(val)
 
#define SETSELF(val)   val
 
#define TIMESER(IST, INT, GET, SETOP, FLD)
 Makes serialization functions. More...
 

Detailed Description

Serialization support for Interstellar Time data types.

Definition in file Serialize.hpp.

Macro Definition Documentation

◆ SETDUR

#define SETDUR (   val)    val.value

Definition at line 41 of file Serialize.hpp.

◆ SETMILLI

#define SETMILLI (   val)    duds::time::interstellar::Milliseconds(val)

Definition at line 44 of file Serialize.hpp.

◆ SETNANO

#define SETNANO (   val)    duds::time::interstellar::Nanoseconds(val)

Definition at line 45 of file Serialize.hpp.

◆ SETPTR

#define SETPTR (   val)    duds::time::interstellar::Femtoseconds(val.value)

Definition at line 42 of file Serialize.hpp.

◆ SETSEC

#define SETSEC (   val)    duds::time::interstellar::Seconds(val)

Definition at line 46 of file Serialize.hpp.

◆ SETSELF

#define SETSELF (   val)    val

Definition at line 43 of file Serialize.hpp.

◆ TIMESER

#define TIMESER (   IST,
  INT,
  GET,
  SETOP,
  FLD 
)
Value:
template <class Archive> \
void save(Archive &ar, const duds::time::interstellar::IST &t, const unsigned int) { \
INT val(t.GET()); \
ar & boost::serialization::make_nvp(#FLD, val); \
} \
template <class Archive> \
void load(Archive &ar, duds::time::interstellar::IST &t, const unsigned int) { \
INT val; \
ar & boost::serialization::make_nvp(#FLD, val); \
t = duds::time::interstellar::IST(SET ## SETOP(val)); \
} \
template <class Archive> \
void serialize(Archive &a, duds::time::interstellar::IST &t, const unsigned int v) { \
split_free(a, t, v); \
}

Makes serialization functions.

I tried with just templates, but it didn't go well, so I used macros to avoid the compiler errors I was getting.

Definition at line 24 of file Serialize.hpp.