15 static const char*
colores[] = {
"green",
"blue",
"black"};
47 memcpy(o,buf,
sizeof(buf)); o +=
sizeof(buf);
54 memcpy(buf,o,
sizeof(buf)); o +=
sizeof(buf);
137 +
"(" + std::to_string(
uniq) +
",";
139 o += std::to_string(
_deme);
145 std::string
yaml (std::string tab =
"")
const {
148 + tab +
"name: " + std::to_string(
uniq) +
"\n";
150 o += tab +
"deme: " + std::to_string(
_deme) +
"\n";
156 SEXP O, On, Name, Color, Deme;
157 int size = (
is(
black)) ? 3 : 2;
158 PROTECT(O = NEW_LIST(size));
159 PROTECT(On = NEW_CHARACTER(size));
160 PROTECT(Name = NEW_INTEGER(1));
161 *INTEGER(Name) = int(
uniq);
162 PROTECT(Color = NEW_CHARACTER(1));
167 PROTECT(Deme = NEW_INTEGER(1));
168 *INTEGER(Deme) = int(
_deme);
179 +
"_" + std::to_string(
_deme)
180 +
"_" + std::to_string(
uniq)
181 +
":" + std::to_string(t);
static const name_t undeme
static const char * colorsymb[]
static const char * colores[]
Balls function as pointers.
node_t * child(void) const
a child is the owner of a green ball
ball_t(ball_t &&)=delete
move constructor
node_t * owner(void) const
view owner of a green ball
name_t deme(void) const
view deme
std::string yaml(std::string tab="") const
machine-readable info
std::string color_symbol(void) const
machine-readable color symbols
static const size_t bytesize
size of binary serialization
std::string describe(void) const
human-readable info
std::string newick(const slate_t &t) const
element of a newick representation
friend raw_t * operator>>(const ball_t &b, raw_t *o)
binary serialization
SEXP structure(void) const
R list description.
node_t *& holder(void)
in whose pocket do I lie?
bool is(color_t c) const
is a given ball of the given color?
ball_t(node_t *who=0, name_t u=0, color_t col=green, name_t d=undeme)
basic constructor for ball class
node_t * holder(void) const
in whose pocket do I lie?
std::string color_name(void) const
human-readable colors
~ball_t(void)=default
destructor
ball_t(const ball_t &)=delete
copy constructor
ball_t & operator=(const ball_t &)=delete
copy assignment operator
name_t & deme(void)
change deme
node_t *& owner(void)
change owner of a green ball
Encodes a genealogical node.
static int set_list_elem(SEXP list, SEXP names, SEXP element, const char *name, int pos)