#include #include #include "Tracer.h" using std::cout; using std::endl; using std::ostream; using std::string; using std::stringstream; using std::vector; Tracer::Tracer(): id_(Tracer::nextid_++), value_(id_) { cout << "Tracer(" << Print() << ")" << endl; } Tracer::~Tracer() { cout << "~Tracer(" << Print() << ")" << endl; } Tracer::Tracer(const Tracer &rhs): id_(Tracer::nextid_++) { value_ = rhs.value_; cout << "TracerCopy({" << Print(); cout << "}<--{" << rhs.Print() << "})" << endl; } Tracer &Tracer::operator=(const Tracer &rhs) { value_ = rhs.value_; cout << "TracerOp=({" << Print() << "}={" << rhs.Print() << "})" << endl; return *this; } bool Tracer::operator<(const Tracer &rhs) const { cout << "Op< : {" << Print() << "}<{" << rhs.Print() << "}" << endl; return value_ < rhs.value_; } string Tracer::Print(void) const { stringstream ss; string open("id:"), spacer(" val:"), close(""); ss << open << id_ << spacer << value_ << close; return ss.str(); } ostream &operator<<(ostream &out, const Tracer &rhs) { out << rhs.Print(); return out; } int Tracer::nextid_ = 0;