]> git.cworth.org Git - apitrace/blobdiff - retrace.hpp
Fix a crash when loading multiple frames at once.
[apitrace] / retrace.hpp
index c87fc946c9e5e8e647473f2352179ccbfdd34669..b697adb6b2c7fa7495be034f831c1f47d23b025f 100644 (file)
 #ifndef _RETRACE_HPP_
 #define _RETRACE_HPP_
 
+#include <string.h>
+
 #include <map>
 
+#include "trace_model.hpp"
+
+
 namespace retrace {
 
 
@@ -73,6 +78,50 @@ public:
 };
 
 
+/**
+ * Output verbosity when retracing files.
+ */
+extern int verbosity;
+
+
+void ignore(Trace::Call &call);
+void retrace_unknown(Trace::Call &call);
+
+
+typedef void (*Callback)(Trace::Call &call);
+
+struct Entry {
+    const char *name;
+    Callback callback;
+};
+
+
+struct stringComparer {
+  bool operator() (const char *a, const  char *b) const {
+    return strcmp(a, b) < 0;
+  }
+};
+
+
+class Retracer
+{
+    typedef std::map<const char *, Callback, stringComparer> Map;
+    Map map;
+
+    std::vector<Callback> callbacks;
+
+public:
+    Retracer() {}
+
+    virtual ~Retracer() {}
+
+    void addCallback(const Entry *entry);
+    void addCallbacks(const Entry *entries);
+
+    void retrace(Trace::Call &call);
+};
+
+
 } /* namespace retrace */
 
 #endif /* _RETRACE_HPP_ */