Next: , Previous: Classes, Up: Programming


6.2 Additional Cladogram functions

The Cladogram class holds all the data and configuration settings, but also a few additional resources.

The following can be directly accessed for general information.

     std::string gnuclad_version;
     std::string inputFolder;
     
     int maximumOffset;
     Date beginningOfTime;

These are meant to be set by the parser if needed:

     bool truncateFolder;    // Use only base name of child after parent assignment
     bool inVitro;           // Don't warn if child starts after parent stops
     bool tighterDomains;    // Tighten domains to expand just half as far

The following method (usually executed with clad->nodesPreorder()) will change the order of the nodes vector such that every parent will occur after all it's children, topologically sorted. This is useful for preventing line overlaps in SVG output.

     void nodesPreorder();

6.3 Helper functions

Here's an additional list of small helpers you can get when including 'gnuclad.h'. This is meant as a quick overview. For descriptions, take a look at the 'gnuclad-helpers.cpp' source file.

void pressEnter();

std::string strToLower(std::string str);

std::string getBaseName(std::string fname);

std::string getExt(std::string fname);

std::ifstream * new_infile(const std::string fname);

std::ofstream * new_outfile(const std::string fname);

void safeClose(std::ifstream * fp);

void safeClose(std::ofstream * fp);

void explode(const std::string str, const char delimiter, std::vector<std::string> * v);

void explodeSafely(const std::string str, const char delimiter, const char toggle, std::vector<std::string> * v);

std::string findReplace(std::string str, std::string find, std::string replace);

double str2double(const std::string str);

int str2int(const std::string s);

std::string int2str(const int n);

std::string base64_encode(const char * raw, unsigned int len);

Date currentDate();

std::string Date2str(Date date);

int datePX(Date d, const Cladogram * clad);