1 #ifndef ISPN_HOTROD_BASICMARSHALLER_H 2 #define ISPN_HOTROD_BASICMARSHALLER_H 21 void marshall(
const T& s, std::vector<char>& b) {
22 #if __GNUG__ && __GNUC__ < 5 23 static_assert(std::is_fundamental<T>::value,
"Type is not fundamental. A marshaller specialization is needed");
25 static_assert(std::is_trivially_copyable<T>::value,
"Type is not trivially_copyable. A marshaller specialization is needed");
28 std::memcpy(b.data(), &s,
sizeof(s));
31 #if __GNUG__ && __GNUC__ < 5 32 static_assert(std::is_fundamental<T>::value,
"Type is not trivially_copyable. A marshaller specialization is needed");
34 static_assert(std::is_trivially_copyable<T>::value,
"Type is not trivially_copyable. A marshaller specialization is needed");
37 std::memcpy(s, b.data(),
sizeof(*s));
47 void marshall(
const std::string& s, std::vector<char>& b) {
48 b.assign(s.data(), s.data()+s.size());
50 std::string*
unmarshall(
const std::vector<char>& b) {
51 std::string* s =
new std::string(b.data(), b.size());
void marshall(const T &s, std::vector< char > &b)
Definition: BasicMarshaller.h:21
Definition: AuthenticationConfiguration.h:10
Definition: BasicMarshaller.h:18
T * unmarshall(const std::vector< char > &b)
Definition: BasicMarshaller.h:30
Definition: Marshaller.h:12