#include <string>
#include <sstream>
#include <list>
#include <map>
#include <deque>
#include <iostream>
#include <memory>
#include <cassert>
#include <typeinfo>
#include <s11n.net/s11n/phoenix.hpp>
#include <s11n.net/s11n/exception.hpp>
#include <s11n.net/s11n/s11n_debuggering_macros.hpp>
#include <s11n.net/s11n/classload.hpp>
#include <s11n.net/s11n/serialize.hpp>
#include <s11n.net/s11n/traits.hpp>
#include <s11n.net/s11n/export.hpp>
Go to the source code of this file.
Namespaces | |
namespace | s11n |
namespace | s11n::io |
Functions | |
std::ostream * | get_ostream (const std::string name) |
Returns an output stream for the given file name. | |
std::istream * | get_istream (const std::string name, bool ExternalData=true) |
Returns an input stream for the given file name. | |
std::string | get_magic_cookie (const std::string &src, bool ExternalData=true) |
Convenience function for grabbing the first line of a file. | |
std::string | get_magic_cookie (std::istream &is) |
Convenience function for grabbing the first line of a stream. | |
template<typename NodeType> | |
NodeType * | load_node_classload_serializer (std::istream &is) |
Tries to load a NodeType object from the given node. | |
template<typename NodeType> | |
NodeType * | load_node (std::istream &is) |
Tries to load a node from the given input stream. | |
template<typename NodeType> | |
NodeType * | load_node (const std::string &src, bool ExternalData=true) |
Overloaded form of load_node( istream ), provided for convenience. | |
template<typename NodeT, typename SerializableT> | |
SerializableT * | load_serializable (std::istream &src) |
Tries to load a SerializableT from the given stream. | |
template<typename NodeT, typename SerializableT> | |
SerializableT * | load_serializable (const std::string &src, bool ExternalData=true) |
An overloaded form which takes an input string. |
|
Returns an input stream for the given file name. Caller owns the returned pointer, which may be 0. The returned stream supports libzl and libbz2 if your libs11n is built with libs11n_zfstream support. That means that if zfstream::compression_policy() is set, then the returned string might be a compressing stream. If ExternalData is false then name is assumed to be a string containing input, and a string-reading stream is returned. |
|
Convenience function for grabbing the first line of a stream. Returns the first line of the given stream, or an empty string on error. |
|
Convenience function for grabbing the first line of a file. If ExternalData == true then returns the first line of the file, else returns up to the first newline of src. |
|
Returns an output stream for the given file name. Caller owns the returned pointer, which may be 0. The returned stream supports libzl and libbz2 if your libs11n is built with libs11n_zfstream support, meaning it can read files compressed with zlib/gzip or bz2lib. |
|
Overloaded form of load_node( istream ), provided for convenience. If ExternalData is true, input is treated as a file, otherwise it is treated as a string containing input to parse. ACHTUNG: Only usable for loading ROOT nodes. Maintenance note: ExternalData==false may be extremely inefficient, as src may get copied one additional time. Definition at line 413 of file data_node_io.hpp. |
|
Tries to load a node from the given input stream. ACHTUNG: Only usable for loading ROOT nodes. Definition at line 393 of file data_node_io.hpp. Referenced by s11nlite::load_node_unary_f::operator()(), s11nlite::load_node_nullary_string_f::operator()(), and s11nlite::load_node_stream_nullary_f::operator()(). |
|
Tries to load a NodeType object from the given node. It uses the cookie from the input stream (the first line) and uses s11n::cl::classload<SerializerBaseType>() to find a matching Serializer. On error 0 is returned or an exception is thrown, else a new pointer, which the caller owns. Achtung: the first line of input from the input stream is consumed by this function (to find the cookie), and the cookie is not passed on to the handler! The only reliable way around this [that i know of] is to buffer the whole input as a string, and i don't wanna do that (it's really bad for massive data files). ACHTUNG: Only usable for loading ROOT nodes. Special feature: If the first line of the stream is "#s11n::io::serializer CLASSNAME" then the CLASSNAME token is expected to be a Serializer class name. This function will try to classload that object. If successful it will use that type to deserialize the input stream. If that fails, it will return 0. The intention of this feature is to simplify creation of non-C++ tools which generate s11n data (e.g., perl scripts), so that they don't need to know the exact cookies. Definition at line 327 of file data_node_io.hpp. References CERR. |
|
An overloaded form which takes an input string. If ExternalData is true the string is treated as a file name, otherwise it is processed as an input stream. ACHTUNG: Only usable for loading ROOT nodes. Definition at line 450 of file data_node_io.hpp. References CERR. |
|
Tries to load a SerializableT from the given stream. On success returns a new object, else 0. The caller owns the returned pointer. ACHTUNG: Only usable for loading ROOT nodes. Definition at line 430 of file data_node_io.hpp. References CERR. |