Program Listing for File serializer.h

Return to documentation for file (include/coal/serialization/serializer.h)

//
// Copyright (c) 2024 INRIA
//

#ifndef COAL_SERIALIZATION_SERIALIZER_H
#define COAL_SERIALIZATION_SERIALIZER_H

#include "coal/serialization/archive.h"

namespace coal {
namespace serialization {

struct Serializer {
  template <typename T>
  static void loadFromText(T& object, const std::string& filename) {
    ::coal::serialization::loadFromText(object, filename);
  }

  template <typename T>
  static void saveToText(const T& object, const std::string& filename) {
    ::coal::serialization::saveToText(object, filename);
  }

  template <typename T>
  static void loadFromStringStream(T& object, std::istringstream& is) {
    ::coal::serialization::loadFromStringStream(object, is);
  }

  template <typename T>
  static void saveToStringStream(const T& object, std::stringstream& ss) {
    ::coal::serialization::saveToStringStream(object, ss);
  }

  template <typename T>
  static void loadFromString(T& object, const std::string& str) {
    ::coal::serialization::loadFromString(object, str);
  }

  template <typename T>
  static std::string saveToString(const T& object) {
    return ::coal::serialization::saveToString(object);
  }

  template <typename T>
  static void loadFromXML(T& object, const std::string& filename,
                          const std::string& tag_name) {
    ::coal::serialization::loadFromXML(object, filename, tag_name);
  }

  template <typename T>
  static void saveToXML(const T& object, const std::string& filename,
                        const std::string& tag_name) {
    ::coal::serialization::saveToXML(object, filename, tag_name);
  }

  template <typename T>
  static void loadFromBinary(T& object, const std::string& filename) {
    ::coal::serialization::loadFromBinary(object, filename);
  }

  template <typename T>
  static void saveToBinary(const T& object, const std::string& filename) {
    ::coal::serialization::saveToBinary(object, filename);
  }

  template <typename T>
  static void loadFromBuffer(T& object, boost::asio::streambuf& container) {
    ::coal::serialization::loadFromBuffer(object, container);
  }

  template <typename T>
  static void saveToBuffer(const T& object, boost::asio::streambuf& container) {
    ::coal::serialization::saveToBuffer(object, container);
  }
};

}  // namespace serialization
}  // namespace coal

#endif  // ifndef COAL_SERIALIZATION_SERIALIZER_H