#include #include #include "Tracer.h" using std::cout; using std::endl; using std::ostream; using std::string; using std::stringstream; Tracer::Tracer(): id_(Tracer::nextid_++) { value_ = id_; cout << "Tracer" << PrintID() << endl; } Tracer::~Tracer() { cout << "~Tracer" << PrintID() << endl; } Tracer::Tracer(const Tracer &rhs): id_(Tracer::nextid_++) { value_ = rhs.value_; cout << "TracerCopy[" << PrintID(); cout << "<--" << rhs.PrintID() << "]" << endl; } Tracer &Tracer::operator=(const Tracer &rhs) { cout << "Tracer" << PrintID() << "=" << rhs.PrintID() << endl; value_ = rhs.value_; return *this; } bool Tracer::operator<(const Tracer &rhs) const { cout << "Tracer" << PrintID() << "<" << rhs.PrintID() << endl; return value_ < rhs.value_; } string Tracer::PrintID(void) const { stringstream ss; ss << "(id:" << id_ << ",v:" << value_ << ")"; return ss.str(); } ostream &operator<<(ostream &out, const Tracer &rhs) { out << "(id:" << rhs.id_ << ",v:" << rhs.value_ << ")"; return out; } int Tracer::nextid_ = 0;