Files
LBPM/IO/PackData.h

78 lines
2.3 KiB
C
Raw Normal View History

2021-01-04 23:37:44 -05:00
// This file contains unctions to pack/unpack data structures
#ifndef included_PackData
#define included_PackData
#include <map>
2021-03-17 10:24:14 -04:00
#include <set>
#include <vector>
2022-01-10 15:46:06 -05:00
#include <cstddef>
2021-01-04 23:37:44 -05:00
//! Template function to return the buffer size required to pack a class
template<class TYPE>
2021-03-17 10:24:14 -04:00
size_t packsize( const TYPE &rhs );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE>
2021-03-17 10:24:14 -04:00
void pack( const TYPE &rhs, char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to unpack a class from a buffer
template<class TYPE>
2021-03-17 10:24:14 -04:00
void unpack( TYPE &data, const char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to return the buffer size required to pack a std::vector
template<class TYPE>
2021-03-17 10:24:14 -04:00
size_t packsize( const std::vector<TYPE> &rhs );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE>
2021-03-17 10:24:14 -04:00
void pack( const std::vector<TYPE> &rhs, char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE>
2021-03-17 10:24:14 -04:00
void unpack( std::vector<TYPE> &data, const char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to return the buffer size required to pack a std::pair
template<class TYPE1, class TYPE2>
2021-03-17 10:24:14 -04:00
size_t packsize( const std::pair<TYPE1, TYPE2> &rhs );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE1, class TYPE2>
2021-03-17 10:24:14 -04:00
void pack( const std::pair<TYPE1, TYPE2> &rhs, char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE1, class TYPE2>
2021-03-17 10:24:14 -04:00
void unpack( std::pair<TYPE1, TYPE2> &data, const char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to return the buffer size required to pack a std::map
template<class TYPE1, class TYPE2>
2021-03-17 10:24:14 -04:00
size_t packsize( const std::map<TYPE1, TYPE2> &rhs );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE1, class TYPE2>
2021-03-17 10:24:14 -04:00
void pack( const std::map<TYPE1, TYPE2> &rhs, char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE1, class TYPE2>
2021-03-17 10:24:14 -04:00
void unpack( std::map<TYPE1, TYPE2> &data, const char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to return the buffer size required to pack a std::set
template<class TYPE>
2021-03-17 10:24:14 -04:00
size_t packsize( const std::set<TYPE> &rhs );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE>
2021-03-17 10:24:14 -04:00
void pack( const std::set<TYPE> &rhs, char *buffer );
2021-01-04 23:37:44 -05:00
//! Template function to pack a class to a buffer
template<class TYPE>
2021-03-17 10:24:14 -04:00
void unpack( std::set<TYPE> &data, const char *buffer );
2021-01-04 23:37:44 -05:00
#include "IO/PackData.hpp"
#endif