A breakdown of the classes used in gnuclad. Only the relevant public parts are shown, first the members and then the constructors & methods.
The most important class is the Cladogram. It is instantiated by a
single object which describes the whole timeline and will be passed to the
parser/generator.
The Cladogram usually doesn't need to be accessed by the
parser, except for the add*** functions.
The generator is meant to make use of the data
vectors.
class Cladogram std::vector<Node *> nodes; std::vector<Connector *> connectors; std::vector<Domain *> domains; std::vector<Image *> includeSVG; std::vector<Image *> includePNG; Node * addNode(std::string tname); Domain * addDomain(std::string tname); Connector * addConnector(); Image * addImage(std::string tname, std::vector<Image *> &vector);
The cladogram also holds all configuration options, as well as additional functions.
The second most important class, a single Node.
It should be initialised only with the addNode() method:
Node * Cladogram::addNode(std::string tname);
The 'offset' is meant for the generator (it can be ignored by the parser).
class Node std::string name std::string parentName std::vector<NameChange> nameChanges; Date start; Date stop; Color color; std::string iconfile; std::string description; int offset; void addNameChange(std::string newName, Date date, std::string description);
A Color object can be initialised either with RGB (1-255)
or a hex color value (#abc or #abcdef).
It will automatically convert and hold the other value too.
class Color int red; int green; int blue; std::string hex; Color(int tred, int tgreen, int tblue); Color(std::string thex);
The Date object can be initialised either with year,month,day or
year,month or year integer parameters; or with a string in the format "y.m.d" or
"y.m" or "y", where the letters can be arbitrary (also negative) integers.
The monthset/dayset switches tell the generator to honor the month and day
settings, and should be ignored by the parser.
class Date int year; int month; int day; bool monthset; bool dayset; Date(int tyear, int tmonth, int tday); Date(int tyear, int tmonth); Date(int tyear); Date(const std::string str); bool operator<(const Date d); bool operator==(Date d); Date operator+(const Date d);
The Image object is to be initialised only with addImage() in the
parser:
Image * Cladogram::addImage(std::string tname, std::vector<Image *> &vector);
The parser has to specify the vector it wants the image to be loaded into (see the Cladogram class below for details). It is usually passed to the generator unchanged and contains three members.
class Image std::string filename; int x; int y;
The NameChange is to be initialised only with addNameChange() in the
parser:
void Node::addNameChange(std::string newName, Date date, std::string description);
The generator can access the nameChanges vector of the Node, making use of the three members.
class NameChange std::string newName; Date date; std::string description;
The Domain is to be initialised only with addDomain() in the parser:
Domain * Cladogram::addDomain(std::string tname);
The 'offsetA' and 'offsetB' are meant for the generator (they can be ignored by the parser).
class Domain std::string nodeName; Color color; int intensity; int offsetA; int offsetB;
The Connector is to be initialised only with addConnector() in the
parser:
Connector * Cladogram::addConnector();
The 'offsetA' and 'offsetB' are meant for the generator (they can be ignored by the parser).
class Connector std::string fromName; std::string toName; Date fromWhen; Date toWhen; int thickness; Color color; int offsetA; int offsetB;
The InputFile serves as a container to pass data to the parser.
class InputFile: std::ifstream * p; std::string name; InputFile(std::string tname); ~InputFile();