31 requires (std::is_trivially_copyable_v<T>)
34 f.write(
reinterpret_cast<const char*
>(&x),
sizeof(T));
48 requires (std::is_trivially_copyable_v<T>)
51 f.read(
reinterpret_cast<char*
>(&x),
sizeof(T));
103 template<
typename T,
int R=-1,
int C=-1>
104 inline void serialize(std::ostream& f,
const Eigen::Matrix<T,R,C>& x)
106 Index r = x.rows(), c = x.cols();
107 f.write(
reinterpret_cast<const char*
>(&r),
sizeof(Index));
108 f.write(
reinterpret_cast<const char*
>(&c),
sizeof(Index));
109 for(Index i = 0 ; i < r ; i++)
110 for(Index j = 0 ; j < c ; j++)
125 template<
typename T,
int R=-1,
int C=-1>
129 f.read(
reinterpret_cast<char*
>(&r),
sizeof(Index));
130 f.read(
reinterpret_cast<char*
>(&c),
sizeof(Index));
132 if constexpr(R == -1 && C == -1)
134 else if constexpr(R == -1 || C == -1)
135 x.resize(std::max(r,c));
137 assert_release(R == r && C == c);
139 for(Index i = 0 ; i < r ; i++)
140 for(Index j = 0 ; j < c ; j++)
156 template <
typename T>
157 inline void serialize(std::ostream& f,
const SampledTraj<T>& x)
159 Index size = x.nb_samples();
160 f.write(
reinterpret_cast<const char*
>(&size),
sizeof(size));
162 for(
const auto& [ti, xi] : x)
179 template <
typename T>
184 f.read(
reinterpret_cast<char*
>(&size),
sizeof(size));
186 for(Index i = 0 ; i < size ; i++)
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:49
double ub() const
Returns the upper bound of this.
Definition codac2_Interval_impl.h:115
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:110
auto lb() const
Returns a matrix containing the lower bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:91
auto ub() const
Returns a matrix containing the upper bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:103
Definition codac2_OctaSym.h:21
void serialize(std::ostream &f, const T &x)
Writes the binary representation of a trivially copyable object to the given output stream.
Definition codac2_serialization.h:32
void deserialize(std::istream &f, T &x)
Reads the binary representation of a trivially copyable object from the given input stream.
Definition codac2_serialization.h:49