Includes methods for fixed-size types, and objects which known how to serialialize themselves (Serializable)
Definition in file Serializable.h.
#include <inttypes.h>
#include "m_net.h"
#include <string>
#include <sstream>
#include <iostream>
#include <typeinfo>
#include <ctype.h>
#include <boost/lexical_cast.hpp>
#include <boost/concept_check.hpp>
#include "Exception.h"
#include "massert.h"


Go to the source code of this file.
Namespaces | |
| namespace | mace |
Classes | |
| class | mace::Serializer |
| Base class for boost concept checking. Template parameter must derive from Serializer. More... | |
| class | mace::SoftState |
| indicates that this serializer does nothing, a type deriving from it will not be Serializable More... | |
| class | mace::SerializationException |
| exception for errors during serialization or deserialization More... | |
| class | mace::SerializationUtil |
| Utility for helping with Xml serialization. More... | |
| class | mace::Serializable |
| Objects which know how to serialize themselves. More... | |
| class | mace::SerializeConcept< T > |
| class for use with concept checking to make better error messages More... | |
Functions | |
| static bool | _DO_BYTE_SWAP () |
| true if the system requires byte swapping | |
| uint64_t | htonll (const uint64_t &t) |
| Defines 8 byte swapping method (host to network). | |
| uint64_t | ntohll (const uint64_t &t) |
| Defines 8 byte swapping method (network to host). | |
| Serializable * | mace::getSerializable (void *pitem) |
| returns a Serializable pointer if the object is Serializable, NULL otherwise. (uses static typing only) | |
| Serializable * | mace::getSerializable (Serializable *pitem) |
| returns a Serializable pointer if the object is Serializable, NULL otherwise. (uses static typing only) | |
| const Serializable * | mace::getSerializable (const void *pitem) |
| returns a Serializable const pointer if the object is Serializable, NULL otherwise. (uses static typing only) | |
| const Serializable * | mace::getSerializable (const Serializable *pitem) |
| returns a Serializable const pointer if the object is Serializable, NULL otherwise. (uses static typing only) | |
| void | mace::serialize (std::string &str, const Serializable *pitem) |
| serialize object onto str using the fact the object knows how to serialize itself | |
| void | mace::serialize (std::string &str, const uint8_t *pitem) |
| serialize object onto str using a simple append | |
| void | mace::serialize (std::string &str, const uint16_t *pitem) |
| serialize object onto str using htons() | |
| void | mace::serialize (std::string &str, const uint32_t *pitem) |
| serialize object onto str using htonl() | |
| void | mace::serialize (std::string &str, const uint64_t *pitem) |
| serialize object onto str using htonll() | |
| void | mace::serialize (std::string &str, const int8_t *pitem) |
| serialize object onto str using a simple append | |
| void | mace::serialize (std::string &str, const int16_t *pitem) |
| serialize object onto str using htons() | |
| void | mace::serialize (std::string &str, const int32_t *pitem) |
| serialize object onto str using htonl() | |
| void | mace::serialize (std::string &str, const int64_t *pitem) |
| serialize object onto str using htonll() | |
| void | mace::serialize (std::string &str, const bool *pitem) |
| treat pitem as a uint8_t and call serialize() | |
| void | mace::serialize (std::string &str, const float *pitem) |
| void | mace::serialize (std::string &str, const double *pitem) |
| void | mace::serialize (std::string &str, const std::string *pitem) |
| serialize a string onto a string by serializing first its size, then the contents | |
| int | mace::deserialize (std::istream &in, Serializable *pitem) throw (SerializationException) |
| deserialize an object, taking advantage that it knows how to deserialize itself (return bytes deserialized) | |
| int | mace::deserialize (std::istream &in, int8_t *pitem) throw (SerializationException) |
| read in a byte for the integer | |
| int | mace::deserialize (std::istream &in, int16_t *pitem) throw (SerializationException) |
| read in two bytes, using ntohs | |
| int | mace::deserialize (std::istream &in, int32_t *pitem) throw (SerializationException) |
| read in four bytes, using ntohl | |
| int | mace::deserialize (std::istream &in, int64_t *pitem) throw (SerializationException) |
| read in eight bytes, using ntohll | |
| int | mace::deserialize (std::istream &in, uint8_t *pitem) throw (SerializationException) |
| read in a byte for the integer | |
| int | mace::deserialize (std::istream &in, uint16_t *pitem) throw (SerializationException) |
| read in two bytes, using ntohs | |
| int | mace::deserialize (std::istream &in, uint32_t *pitem) throw (SerializationException) |
| read in four bytes, using ntohl | |
| int | mace::deserialize (std::istream &in, uint64_t *pitem) throw (SerializationException) |
| read in eight bytes, using ntohll | |
| int | mace::deserialize (std::istream &in, bool *pitem) throw (SerializationException) |
| treat like an int8_t | |
| int | mace::deserialize (std::istream &in, float *pitem) throw (SerializationException) |
| int | mace::deserialize (std::istream &in, double *pitem) throw (SerializationException) |
| int | mace::deserialize (std::istream &in, std::string *pitem) throw (SerializationException) |
| deserialize by reading first the size, then extracting that number of bytes | |
| template<typename S> | |
| int | mace::deserializeStr (const std::string &str, S *pitem) |
| deserialize from a string (rather than istream) by using an istringstream | |
| template<typename S> | |
| std::string | mace::serialize (const S *pitem) |
| serialize an arbitrary item into a string to return by calling either serialize(string&, const S*) or using serializeStr() | |
| template<typename S> | |
| void | mace::deserialize (const std::string &s, S *pitem) throw (SerializationException) |
| deserialize an object object from a string (rather than istream) | |
| template<typename S> | |
| void | mace::serializeMap (std::string &str, const S &s) |
| Generic (and now unused) method for serializing a map. | |
| template<typename S> | |
| int | mace::deserializeMap (std::istream &in, S &s) throw (SerializationException) |
| Generic (and now unused) method for deserializing a map. | |
1.5.5