vg
tools for working with variation graphs
|
#include <vpkg.hpp>
Static Public Member Functions | |
template<typename... Wanted> | |
static tuple< unique_ptr< Wanted >... > | load_all (istream &in) |
template<typename... Wanted> | |
static tuple< unique_ptr< Wanted >... > | load_all (const string &filename) |
template<typename Wanted > | |
static unique_ptr< Wanted > | try_load_one (istream &in) |
template<typename Wanted > | |
static unique_ptr< Wanted > | try_load_one (const string &filename) |
template<typename Wanted > | |
static unique_ptr< Wanted > | load_one (istream &in) |
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) |
Private Types | |
enum | LoadProgress { LOAD_SUCCESS, LOAD_FINISHED, LOAD_SEARCHING } |
Static Private Member Functions | |
template<typename... TupleTypes> | |
static tuple< unique_ptr< TupleTypes >... > | to_tuple (deque< void * > items) |
template<typename Pointed > | |
static unique_ptr< Pointed > | extract_first (deque< void * > &pointers) |
template<typename One > | |
static LoadProgress | load_into_one (MessageIterator &it, size_t i, deque< void * > &dest) |
template<typename T > | |
static string | describe () |
template<typename T > | |
static std::enable_if< std::is_default_constructible< T >::value, unique_ptr< T > >::type | make_default_or_null () |
template<typename T > | |
static std::enable_if<!std::is_default_constructible< T >::value, unique_ptr< T > >::type | make_default_or_null () |
static bool | sniff_magic (istream &stream, const string &magic) |
Interface for reading/writing type-tagged files.
Allows you to load a HandleGraph from a file with the implementation being auto-selected based on what is in the file.
Allows you to load multiple indexes or objects from the same file, as they are found.
Allows saving multiple indexes or objects to a file with one call.
|
private |
|
inlinestaticprivate |
Return a string to represent the given type. Should be demangled and human-readable.
|
inlinestaticprivate |
Pop off the first item in the given collection and wrap it in a typed unique_ptr.
|
inlinestatic |
Allocate and load one or more objects from the given file on a single pass. Returns a tuple of pointers to loaded objects, or null if they could not be found. Only works on VPKG-formatted files. Supports "-" for standard input.
|
inlinestatic |
Allocate and load one or more objects from the given stream on a single pass. Returns a tuple of pointers to loaded objects, or null if they could not be found. Only works on VPKG-formatted files. TODO: Probably ought to fail if something isn't found!
|
inlinestaticprivate |
If the null slot at index i in the given collection of void*s can be filled with an object of type One from the given MessageIterator, fill it.
Returns LOAD_SUCCESS if it finds and loads something, LOAD_FINISHED if it is filled in or hits EOF, and LOAD_SEARCHING if it is still unfilled but can't be loaded from the current tag.
|
inlinestatic |
Load an object of the given type from a file by name. 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 file. Supports "-" for standard input.
|
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.
|
inlinestaticprivate |
Return a new default-constructed instance of the given type, or a null pointer if it is not default constructible.
This version matches default-consttructable types.
|
inlinestaticprivate |
Return a new default-constructed instance of the given type, or a null pointer if it is not default constructible.
This version matches non-default-consttructable types.
|
inlinestatic |
|
inlinestatic |
Save an object to the given stream, using the appropriate saver.
|
staticprivate |
Return true of the given stream starts with the given magic number prefix, and false otherwise. Returns the stream to its initial position regardless of the result.
|
inlinestaticprivate |
Given a collection of void pointers, give ownership of the objects they point to, if any, to unique_ptrs in a tuple.
|
inlinestatic |
Load an object of the given type from a file by name. 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. Returns null if the object could not be found in the file. Supports "-" for standard input.
|
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. This doesn't work for Protobuf messages directly, but it will work for e.g. vg::VG.
|
static |
Lower-level function used to get direct access to a stream tagged with the given tag, in the given type-tagged message output file.