GraphLab: Distributed Graph-Parallel API
2.1
|
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities. More...
#include <graphlab/serialization/oarchive.hpp>
Public Member Functions | |
oarchive (std::ostream &outstream) | |
constructor. Takes a generic std::ostream object | |
void | expand_buf (size_t s) |
void | write (const char *c, std::streamsize s) |
template<typename T > | |
void | direct_assign (const T &t) |
void | advance (size_t s) |
bool | fail () |
Returns true if the underlying stream is in a failure state. |
Public Attributes | |
std::ostream * | out |
char * | buf |
size_t | off |
size_t | len |
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
Given a standard output stream, you can construct an oarchive object by:
For instance, to serialize to a file,
Once the oarc object is constructed, Serializable objects can be written to it using the << stream operator.
Alternatively, data can be directly written to the stream using the oarchive::write() function.
Written data can be deserialized using graphlab::iarchive. For more usage details, see Serialization
The oarchive object should not be used once the associated stream object is closed or is destroyed.
The oarc object does not flush the associated stream, and the user may need to manually flush the associated stream to clear any stream buffers. For instance, while the std::stringstream may be used for both output and input, it is necessary to flush the stream before all bytes written to the stringstream are available for input.
To use this class, include graphlab/serialization/serialization_includes.hpp
Definition at line 86 of file oarchive.hpp.
|
inline |
Directly writes "s" bytes from the memory location pointed to by "c" into the stream.
Definition at line 108 of file oarchive.hpp.