#include <genesis/placement/formats/jplace_writer.hpp>
Write Jplace data.
This class provides facilities for writing Jplace data to different output targets.
Exemplary usage:
std::string outfile = "path/to/file.jplace"; Sample sample; JplaceWriter().write( sample, utils::to_file( outfile ));
Furthermore, using to_document(), the Sample can also be transformed into our internal Json representaion in form of a utils::JsonDocument that adheres to the Jplace standard. This is probably rarely needed, but might be useful nonetheless.
See JplaceReader for more information on the data format. See Sample for more information on the data structure.
Definition at line 80 of file jplace_writer.hpp.
Public Member Functions | |
JplaceWriter () | |
JplaceWriter (JplaceWriter &&)=default | |
JplaceWriter (JplaceWriter const &)=default | |
~JplaceWriter ()=default | |
size_t | branch_length_precision () const |
Get the precision used for printing the branch_length floating point numbers of the reference Tree of the Sample. More... | |
JplaceWriter & | branch_length_precision (size_t value) |
Set the precision used for printing the branch_length floating point numbers of the reference Tree of the Sample. More... | |
std::string const & | invocation () const |
Get the currently set "invocation" string to be written to the jplace file. More... | |
JplaceWriter & | invocation (std::string const &invocation) |
Set the "invocation" string to be written to the jplace file. More... | |
JplaceWriter & | operator= (JplaceWriter &&)=default |
JplaceWriter & | operator= (JplaceWriter const &)=default |
std::string const & | program () const |
Get the currently set "program" string to be written to the jplace file. More... | |
JplaceWriter & | program (std::string const &program) |
Set the "program" string to be written to the jplace file. More... | |
utils::JsonDocument | to_document (Sample const &sample) const |
Store the data of a Sample in a JsonDocument object. More... | |
void | write (Sample const &sample, std::shared_ptr< utils::BaseOutputTarget > target) const |
Write a Sample to an output target, using the Jplace format. More... | |
JplaceWriter | ( | ) |
Definition at line 65 of file jplace_writer.cpp.
|
default |
|
default |
|
default |
|
inline |
Get the precision used for printing the branch_length
floating point numbers of the reference Tree of the Sample.
Definition at line 128 of file jplace_writer.hpp.
|
inline |
Set the precision used for printing the branch_length
floating point numbers of the reference Tree of the Sample.
Definition at line 137 of file jplace_writer.hpp.
|
inline |
Get the currently set "invocation" string to be written to the jplace file.
This is jplace meta-data that can be set to later identify settings used when creating the jplace file.
Definition at line 171 of file jplace_writer.hpp.
|
inline |
Set the "invocation" string to be written to the jplace file.
Get the currently set "invocation" string to be written to the jplace file. This is jplace meta-data that can be set to later identify settings used when creating the jplace file.
Definition at line 181 of file jplace_writer.hpp.
|
default |
|
default |
|
inline |
Get the currently set "program" string to be written to the jplace file.
This is jplace meta-data that can be set to later identify settings used when creating the jplace file.
Definition at line 149 of file jplace_writer.hpp.
|
inline |
Set the "program" string to be written to the jplace file.
Get the currently set "program" string to be written to the jplace file. This is jplace meta-data that can be set to later identify settings used when creating the jplace file.
Definition at line 159 of file jplace_writer.hpp.
utils::JsonDocument to_document | ( | Sample const & | sample | ) | const |
Store the data of a Sample in a JsonDocument object.
This method is not really useful anymore, as we can now directly write to files, strings and streams. It is however kept here for reference and in case someone wants to work with Json files directly.
Definition at line 190 of file jplace_writer.cpp.
void write | ( | Sample const & | sample, |
std::shared_ptr< utils::BaseOutputTarget > | target | ||
) | const |
Write a Sample to an output target, using the Jplace format.
See the output target convenience functions utils::to_file(), utils::to_stream(), and utils::to_string() for examples of how to obtain a suitable output target.
Definition at line 75 of file jplace_writer.cpp.