#include #include using namespace std; #include "edge.h" #include "vertex.h" //====================================================== constructor Edge::Edge() { id = -1; name = '\0'; }//end constructor Edge::Edge(int newId) { this->id = newId; } Edge::Edge(int newId, string newName) { this->id = newId; this->name = newName; } Edge::Edge(int newId, Vertex *head, Vertex *tail) { this->id = newId; this->head = head; this->tail = tail; } Edge::Edge(int newId, string newName, Vertex *head, Vertex *tail) { this->id = newId; this->name = newName; this->head = head; this->tail = tail; this->code = 0; } Edge::Edge(int newId, string newName, Vertex *head, Vertex *tail, int timerCode) { this->id = newId; this->name = newName; this->head = head; this->tail = tail; this->code = timerCode; } Edge::Edge(int newId, string newName, Vertex *head, Vertex *tail, int timerCode, string input, string output) { this->id = newId; this->name = newName; this->head = head; this->tail = tail; this->code = timerCode; this->recv = input; this->send = output; //cout << "\nRECEIVED INPUT: " << recv; } //======================================================= destructor // free space allocated for the string Edge::~Edge() { name.~basic_string(); //delete &head; //delete &tail; } int Edge::getId() { return this->id; } string Edge::getName() { return this->name; } string Edge::getInput() { return recv; } string Edge::getOutput() { return this->send; } Vertex* Edge::getHead() { return head; } Vertex* Edge::getTail() { return tail; } int Edge::getCode() { return code; } void Edge::setId(int newId) { this->id = newId; } void Edge::setName(string &newName) { this->name = newName; } void Edge::setInput(string &newInput) { this->send = newInput; } void Edge::setOutput(string &newInput) { this->recv = newInput; } void Edge::setHead(Vertex *newName) { this->head = newName; } void Edge::setTail(Vertex *newName) { this->tail = newName; } void Edge::setCode(int timerCode) { this->code = timerCode; } void Edge::printInfo() { cout << "EDGE::< " << id << ", " << head->getId() << ", " << tail->getId() << ", " << code << ", " << recv << ", " << send << ", " << name << " >\n"; }