47 memcpy(o,buf,
sizeof(buf)); o +=
sizeof(buf);
49 return reinterpret_cast<const pocket_t&
>(p) >> o;
55 memcpy(buf,o,
sizeof(buf)); o +=
sizeof(buf);
58 o = (o >>
reinterpret_cast<pocket_t&
>(p));
133 for (
ball_it i = begin(); i != end(); i++) {
134 switch ((*i)->color) {
154 for (
ball_it i = cbegin(); i != cend(); i++) {
179 std::string s =
"node("
180 + std::to_string(
uniq)
181 +
"," + std::to_string(
deme()) +
",";
183 s += std::to_string(
lineage());
186 s +=
", t = " + std::to_string(
slate) +
"\n";
190 std::string
yaml (std::string tab =
"")
const {
191 std::string t = tab +
" ";
192 std::string o =
"name: " + std::to_string(
uniq) +
"\n"
193 + tab +
"time: " + std::to_string(
slate) +
"\n"
194 + tab +
"deme: " + std::to_string(
deme()) +
"\n";
196 o += tab +
"lineage: " + std::to_string(
lineage()) +
"\n";
204 PROTECT(O = NEW_LIST(4));
205 PROTECT(On = NEW_CHARACTER(4));
216 std::string o1 =
"", o2 =
"", o3 =
"";
229 for (
ball_it i = begin(); i != end(); i++) {
236 if (
n++ > 0) o2 +=
",";
241 if (
n++ > 0) o2 +=
",";
249 + std::to_string(
deme())
250 +
"_" + std::to_string(
uniq)
251 +
":" + std::to_string(
slate - tpar);
Balls function as pointers.
node_t * child(void) const
a child is the owner of a green ball
node_t * owner(void) const
view owner of a green ball
name_t deme(void) const
view deme
std::string newick(const slate_t &t) const
element of a newick representation
node_t * holder(void) const
in whose pocket do I lie?
Encodes a genealogical node.
node_t & operator=(const node_t &p)=delete
copy assignment operator
friend raw_t * operator>>(const node_t &p, raw_t *o)
binary serialization of node_t
name_t lineage(void) const
view lineage
size_t bytesize(void) const
size of binary serialization
name_t & lineage(void)
set lineage
bool dead_root(void) const
node_t * parent(void) const
node_t(const node_t &p)=delete
copy constructor
name_t & deme(void)
set deme
std::string newick(const slate_t &tnow, const slate_t &tpar) const
Newick format.
name_t lineage(const ball_t *g) const
view lineage associated with a green ball
SEXP structure(void) const
R list description.
std::string describe(void) const
human-readable info
ball_t * green_ball(void) const
pointer to my green ball
std::string yaml(std::string tab="") const
machine-readable info
node_t(name_t u=0, slate_t t=R_NaReal)
basic constructor for node class
name_t deme(void) const
view deme
ball_t *& green_ball(void)
set green ball
node_t(node_t &&p)=delete
move constructor
void lineage_incr(int *incr, int *sat, int *etype) const
bool holds_own(void) const
int nchildren(void) const
number of descendants
A pocket is a set of balls.
SEXP structure(void) const
R list description.
std::string yaml(std::string tab="") const
human/machine-readable info
void repair_holder(node_t *p)
std::string describe(void) const
human-readable info
size_t bytesize(void) const
size of binary serialization
bool holds(ball_t *b) const
does this node hold the given ball?
static int set_list_elem(SEXP list, SEXP names, SEXP element, const char *name, int pos)
static const name_t null_lineage
std::set< ball_t *, ball_order >::const_iterator ball_it