X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_model.hpp;h=a2847547421f8972666681d0784882192e2fb628;hb=2257168033b52be3094efdbd7eadff8eb77a4c4e;hp=ddbcabd2993e357687588f7d3c0c549b609e715a;hpb=50d5820026f75a8ea53330c24d3337448f971d10;p=apitrace diff --git a/trace_model.hpp b/trace_model.hpp index ddbcabd..a284754 100644 --- a/trace_model.hpp +++ b/trace_model.hpp @@ -96,10 +96,13 @@ public: virtual double toDouble(void) const; virtual void *toPointer(void) const; + virtual void *toPointer(bool bind); virtual unsigned long long toUIntPtr(void) const; virtual const char *toString(void) const; const Value & operator[](size_t index) const; + + void dump(std::ostream &os, bool color=true); }; @@ -112,6 +115,7 @@ public: virtual float toFloat(void) const; virtual double toDouble(void) const; void *toPointer(void) const; + void *toPointer(bool bind); unsigned long long toUIntPtr(void) const; const char *toString(void) const; void visit(Visitor &visitor); @@ -255,16 +259,19 @@ public: Blob(size_t _size) { size = _size; buf = new char[_size]; + bound = false; } ~Blob(); bool toBool(void) const; void *toPointer(void) const; + void *toPointer(bool bind); void visit(Visitor &visitor); size_t size; char *buf; + bool bound; }; @@ -275,6 +282,7 @@ public: bool toBool(void) const; void *toPointer(void) const; + void *toPointer(bool bind); unsigned long long toUIntPtr(void) const; void visit(Visitor &visitor); }; @@ -305,7 +313,12 @@ protected: }; -std::ostream & operator <<(std::ostream &os, Value *value); +inline std::ostream & operator <<(std::ostream &os, Value *value) { + if (value) { + value->dump(os); + } + return os; +} class Call @@ -327,10 +340,15 @@ public: assert(index < args.size()); return *(args[index]); } + + void dump(std::ostream &os, bool color=true); }; -std::ostream & operator <<(std::ostream &os, Call &call); +inline std::ostream & operator <<(std::ostream &os, Call &call) { + call.dump(os); + return os; +} } /* namespace Trace */