#include "wvbuf.h"
#include <stdint.h>
#include <netinet/in.h>
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Classes | |
class | WvDeserialize< T > |
Deserialize a complex templated object. More... | |
class | WvDeserialize< T * > |
If there's a deserializer for type "T", this will make a default deserializer for type "T *"; that is, it'll allocate the new object dynamically and you'll have to free it after. More... | |
class | WvDeserialize< WvBuf * > |
Deserialize a WvBuf. More... | |
class | WvDeserialize< WvList< T > * > |
Deserialize a list of serializable things. More... | |
Functions | |
template<typename T> void | wv_serialize (WvBuf &buf, const T &t) |
Encode an object as an array of bytes and put it into a WvBuf. | |
int32_t | _wv_htonl (int32_t i) |
This function shouldn't be necessary at all, but using it makes totally insane assembler errors go away (gcc 2.95.4, glibc 2.3.1). | |
template<typename T> void | wv_serialize_scalar (WvBuf &buf, const T t) |
A helper function that serializes different types of integers. | |
void | _wv_serialize (WvBuf &buf, long long i) |
void | _wv_serialize (WvBuf &buf, unsigned long long i) |
void | _wv_serialize (WvBuf &buf, long i) |
void | _wv_serialize (WvBuf &buf, unsigned long i) |
void | _wv_serialize (WvBuf &buf, int i) |
void | _wv_serialize (WvBuf &buf, unsigned int i) |
void | _wv_serialize (WvBuf &buf, short i) |
void | _wv_serialize (WvBuf &buf, unsigned short i) |
void | _wv_serialize (WvBuf &buf, bool i) |
void | _wv_serialize (WvBuf &buf, char i) |
Note: char != signed char for purposes of function overloading! | |
void | _wv_serialize (WvBuf &buf, signed char i) |
void | _wv_serialize (WvBuf &buf, unsigned char i) |
void | _wv_serialize (WvBuf &buf, WvStringParm s) |
Serialize a WvString. | |
void | _wv_serialize (WvBuf &buf, const WvBuf &inbuf) |
Serialize a WvBuf. | |
template<typename T> void | _wv_serialize (WvBuf &buf, const WvList< T > &list) |
Serialize a list of serializable things. | |
template<typename T> T | _wv_deserialize (WvBuf &buf) |
Deserialize an object. | |
template<typename T> T | wv_deserialize (WvBuf &buf) |
Deserialize an object: read bytes from a buffer, and return an object constructed from that. | |
int32_t | _wv_ntohl (int32_t i) |
This function shouldn't be necessary at all, but using it makes totally insane assembler errors go away (gcc 2.95.4, glibc 2.3.1). | |
template<typename T> T | wv_deserialize_scalar (WvBuf &buf) |
A helper function that deserializes different types of integers. | |
template<typename T> T | xwv_deserialize_scalar (WvBuf &buf) |
template<> long long | _wv_deserialize< long long > (WvBuf &buf) |
template<> unsigned long long | _wv_deserialize< unsigned long long > (WvBuf &buf) |
template<> long | _wv_deserialize< long > (WvBuf &buf) |
template<> unsigned long | _wv_deserialize< unsigned long > (WvBuf &buf) |
template<> int | _wv_deserialize< int > (WvBuf &buf) |
template<> unsigned int | _wv_deserialize< unsigned int > (WvBuf &buf) |
template<> short | _wv_deserialize< short > (WvBuf &buf) |
template<> unsigned short | _wv_deserialize< unsigned short > (WvBuf &buf) |
template<> bool | _wv_deserialize< bool > (WvBuf &buf) |
template<> char | _wv_deserialize< char > (WvBuf &buf) |
template<> signed char | _wv_deserialize< signed char > (WvBuf &buf) |
template<> unsigned char | _wv_deserialize< unsigned char > (WvBuf &buf) |
template<> WvString | _wv_deserialize< WvString > (WvBuf &buf) |
Deserialize a WvString. |
|
Deserialize an object. See wv_deserialize(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Deserialize a WvString. Stops at (and includes) the terminating nul (zero) character. Serialized WvStrings are guaranteed not to contain nul except as the last character. |
|
This function shouldn't be necessary at all, but using it makes totally insane assembler errors go away (gcc 2.95.4, glibc 2.3.1).
Definition at line 34 of file wvserialize.h. Referenced by wv_serialize_scalar(). |
|
This function shouldn't be necessary at all, but using it makes totally insane assembler errors go away (gcc 2.95.4, glibc 2.3.1).
Definition at line 222 of file wvserialize.h. Referenced by wv_deserialize_scalar(). |
|
Serialize a list of serializable things. Oh boy - I think I'm having a bit too much fun. Definition at line 134 of file wvserialize.h. References WvListBase::count(). Referenced by wv_serialize(). |
|
Serialize a WvBuf. This is handier than it sounds, because then WvGdbmHash's value can be a WvBuf. Definition at line 121 of file wvserialize.h. References WvBufBase< unsigned char >::put(), WvBufBaseCommonImpl< unsigned char >::used(), and wv_serialize(). |
|
Serialize a WvString. The string serializer is guaranteed to not insert any nuls (character 0) into the output stream except for the string-terminating one, which is always present. This makes deserialization easy. Definition at line 109 of file wvserialize.h. References WvFastString::isnull(), WvBufBase< unsigned char >::put(), and WvBufBase< unsigned char >::putstr(). |
|
Definition at line 99 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 97 of file wvserialize.h. References wv_serialize_scalar(). |
|
Note: char != signed char for purposes of function overloading!
Definition at line 95 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 91 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 89 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 87 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 85 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 83 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 81 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 79 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 77 of file wvserialize.h. References wv_serialize_scalar(). |
|
Definition at line 75 of file wvserialize.h. References wv_serialize_scalar(). |
|
Deserialize an object: read bytes from a buffer, and return an object constructed from that. Note that there is no default deserializer. You have to specialize this template for every data type you might want to deserialize. We do define some for a few standard C types. Implementation note: If you define a deserializer for your own type, name it _wv_deserialize() (with the underscore). If you're unlucky, you may need to define a WvDeserialize class instead. Note that if you have a data structure, you probably want to wv_deserialize<MyType *>(buf) instead of wv_deserialize<MyType>(buf) to avoid extra copies. You'll have to define _wv_deserialize() appropriately, of course. Pointer-based _wv_deserialize() functions allocate memory, so you'll have to 'delete' the returned object yourself. Definition at line 212 of file wvserialize.h. |
|
A helper function that deserializes different types of integers. Since it's inlined, the "if" is actually executed at compile time, so don't worry. Definition at line 234 of file wvserialize.h. References _wv_ntohl(), WvBufBaseCommonImpl< unsigned char >::get(), and WvBufBaseCommonImpl< unsigned char >::used(). |
|
Encode an object as an array of bytes and put it into a WvBuf. This function just calls an overloaded _wv_serialize() function. There was really no need for a template here at all, except for symmetry with wv_deserialize() which does need one. Definition at line 24 of file wvserialize.h. References _wv_serialize(). Referenced by _wv_serialize(), WvGdbmHash< K, D >::datumize< T >::datumize(), and WvGdbmList< T >::save(). |
|
A helper function that serializes different types of integers. Since it's inlined, the "if" is actually executed at compile time, so don't worry. The clever part: it doesn't really matter what size an 'int' or a 'long' is, as long as it's one of the sizes supported by this function. If an int is 32 bits, we'll use the 32-bit serializer... and so on. Definition at line 51 of file wvserialize.h. References _wv_htonl(), and WvBufBase< unsigned char >::put(). Referenced by _wv_serialize(). |
|
Definition at line 256 of file wvserialize.h. |