phylopomp
Phylodynamics for POMPs
Loading...
Searching...
No Matches
newick.cc File Reference
#include "ball.h"
#include "node.h"
#include "nodeseq.h"
#include "genealogy.h"
#include "internal.h"
#include <R.h>
#include <Rmath.h>
#include <Rdefines.h>
#include <cstring>
#include <charconv>
#include <iostream>
Include dependency graph for newick.cc:

Go to the source code of this file.

Functions

std::string double2string (double value)
 
SEXP newick (SEXP State, SEXP Extended)
 tree in newick format
 

Function Documentation

◆ double2string()

std::string double2string ( double value)

Definition at line 16 of file newick.cc.

18{
19 char buffer[32];
20 auto [ptr, ec] = std::to_chars(buffer,buffer+sizeof(buffer),value);
21 if (ec == std::errc()) {
22 return string_t(buffer,ptr);
23 } else {
24 err("error in %s",__func__); // #nocov
25 }
26}
#define err(...)
Definition internal.h:18
Here is the caller graph for this function:

◆ newick()

SEXP newick ( SEXP State,
SEXP Extended )

tree in newick format

Definition at line 118 of file newick.cc.

118 {
119 PROTECT(Extended = AS_LOGICAL(Extended));
120 bool extended = *LOGICAL(Extended);
121 genealogy_t A(State);
122 UNPROTECT(1);
123 return mkString(A.newick(extended).c_str());
124 }
Encodes a genealogy.
Definition genealogy.h:19
Here is the call graph for this function: