|
template<typename... Wanted> |
static tuple< unique_ptr< Wanted >... > | try_load_first (istream &in, const string &filename="") |
|
template<typename... Wanted> |
static tuple< unique_ptr< Wanted >... > | try_load_first (const string &filename) |
|
template<typename Wanted > |
static unique_ptr< Wanted > | try_load_one (istream &in, const string &filename="") |
|
template<typename Wanted > |
static unique_ptr< Wanted > | try_load_one (const string &filename) |
|
template<typename Wanted > |
static unique_ptr< Wanted > | load_one (istream &in, const string &filename="") |
|
template<typename Wanted > |
static unique_ptr< Wanted > | load_one (const string &filename) |
|
template<typename Have > |
static void | save (const Have &have, ostream &out) |
|
template<typename Have > |
static void | save (const Have &have, const string &filename) |
|
static void | with_save_stream (ostream &to, const string &tag, const function< void(ostream &)> &use_stream) |
|
|
template<typename FirstPriority , typename SecondPriority , typename... Rest> |
static tuple< unique_ptr< FirstPriority >, unique_ptr< SecondPriority >, unique_ptr< Rest >... > | try_load_first_bare (istream &in, const string &filename, bool &found) |
|
template<typename Only > |
static tuple< unique_ptr< Only > > | try_load_first_bare (istream &in, const string &filename, bool &found) |
|
template<typename FirstPriority , typename SecondPriority , typename... Rest> |
static tuple< unique_ptr< FirstPriority >, unique_ptr< SecondPriority >, unique_ptr< Rest >... > | try_load_first_encapsulated (MessageIterator &it, bool &found) |
|
template<typename Only > |
static tuple< unique_ptr< Only > > | try_load_first_encapsulated (MessageIterator &it, bool &found) |
|
template<typename Wanted > |
static unique_ptr< Wanted > | try_load_bare (istream &in, const string &filename="") |
|
template<typename Wanted > |
static unique_ptr< Wanted > | try_load_encapsulated (istream &in) |
|
template<typename Wanted > |
static unique_ptr< Wanted > | try_load_encapsulated (MessageIterator &it) |
|
static void | with_putback (istream &in, const function< void(istream &)> &callback) |
|
template<typename T > |
static string | describe () |
|
Interface for reading/writing files.
Originally designed for Protobuf-based type-tagged files with optional BGZIP compression.
Now mostly used for files identified by prefixes or sniffing functions.
Allows you to load e.g. a HandleGraph from a file with the implementation being auto-selected based on what is in the file.
template<typename Wanted >
static unique_ptr<Wanted> vg::io::VPKG::load_one |
( |
istream & |
in, |
|
|
const string & |
filename = "" |
|
) |
| |
|
inlinestatic |
Load an object of the given type from a stream. The stream may be VPKG with the appropriate tag, or a bare non-VPKG stream understood by the loader. Tagged messages that can't be used to load the thing we are looking for are skipped. Ends the program with an error if the object could not be found in the stream.
May consume trailing data from the stream.
template<typename Wanted >
static unique_ptr<Wanted> vg::io::VPKG::try_load_bare |
( |
istream & |
in, |
|
|
const string & |
filename = "" |
|
) |
| |
|
inlinestaticprivate |
Load an object of the given type from a stream. The stream has to be a bare non-VPKG stream understood by the loader. Returns the loaded object, or null if no loader liked the input.
filename is optional, and can be used by callback code that may, for some reason, want to link the stream back to a path (cough cough GFA loader cough cough).
template<typename... Wanted>
static tuple<unique_ptr<Wanted>...> vg::io::VPKG::try_load_first |
( |
const string & |
filename | ) |
|
|
inlinestatic |
Allocate and load the first available type from the given stream. Returns a tuple where at most one item is filled, and that item is the first type we could successfully load out of the template parameters.
If any type is to be loaded from type-tagged messages, it must come first, or its type-tagged messages may be skipped when looking for higher-priority types.
template<typename... Wanted>
static tuple<unique_ptr<Wanted>...> vg::io::VPKG::try_load_first |
( |
istream & |
in, |
|
|
const string & |
filename = "" |
|
) |
| |
|
inlinestatic |
Allocate and load an available type from the given stream. Returns a tuple where at most one item is filled, and that item is the first type we could successfully load out of the template parameters, except that bare loaders are prioritized over encapsulated ones.
filename is optional, and can be used by callback code that may, for some reason, want to link the stream back to a path (cough cough GFA loader cough cough)
template<typename FirstPriority , typename SecondPriority , typename... Rest>
static tuple<unique_ptr<FirstPriority>, unique_ptr<SecondPriority>, unique_ptr<Rest>...> vg::io::VPKG::try_load_first_bare |
( |
istream & |
in, |
|
|
const string & |
filename, |
|
|
bool & |
found |
|
) |
| |
|
inlinestaticprivate |
Allocate and load the first available type from the given stream, using a bare loader. Returns a tuple where at most one item is filled, and that item is the first type we could successfully load out of the template parameters. Sets found to true if anything is successfully loaded.
filename is optional, and can be used by callback code that may, for some reason, want to link the stream back to a path (cough cough GFA loader cough cough)
template<typename Only >
static tuple<unique_ptr<Only> > vg::io::VPKG::try_load_first_bare |
( |
istream & |
in, |
|
|
const string & |
filename, |
|
|
bool & |
found |
|
) |
| |
|
inlinestaticprivate |
Allocate and load the first available type from the given stream, using a bare loader. Returns a tuple where at most one item is filled, and that item is the first type we could successfully load out of the template parameters. Sets found to true if anything is successfully loaded.
filename is optional, and can be used by callback code that may, for some reason, want to link the stream back to a path (cough cough GFA loader cough cough)
template<typename FirstPriority , typename SecondPriority , typename... Rest>
static tuple<unique_ptr<FirstPriority>, unique_ptr<SecondPriority>, unique_ptr<Rest>...> vg::io::VPKG::try_load_first_encapsulated |
( |
MessageIterator & |
it, |
|
|
bool & |
found |
|
) |
| |
|
inlinestaticprivate |
Allocate and load the first available type from the given iterator, using a bare loader. Returns a tuple where at most one item is filled, and that item is the first type we could successfully load out of the template parameters. Sets found to true if anything is successfully loaded.
template<typename Wanted >
static unique_ptr<Wanted> vg::io::VPKG::try_load_one |
( |
istream & |
in, |
|
|
const string & |
filename = "" |
|
) |
| |
|
inlinestatic |
Load an object of the given type from a file. The stream may be VPKG with the appropriate tag, or a bare non-VPKG stream understood by the loader.
Tagged messages that can't be used to load the thing we are looking for may or may not be consumed, so you should not call this function in a loop over types on the same stream.
filename is optional, and can be used by callback code that may, for some reason, want to link the stream back to a path (cough cough GFA loader cough cough)