-rw-r--r-- | agg-plot/resource-manager.h | 29 |
diff --git a/agg-plot/resource-manager.h b/agg-plot/resource-manager.h new file mode 100644 index 00000000..c59782a3 --- /dev/null +++ b/agg-plot/resource-manager.h @@ -0,0 +1,29 @@ +#ifndef AGGPLOT_RESOURCE_MANAGER_H
+#define AGGPLOT_RESOURCE_MANAGER_H
+
+
+class no_management {
+ public:
+ template <class T>
+ static void acquire(T* p) {};
+
+ template <class T>
+ static void dispose(T* p) {};
+};
+
+
+class ref_manager {
+public:
+ template <class T>
+ static void acquire(T* p) { p->ref(); };
+
+ template <class T>
+ static void dispose(T* p)
+ {
+ unsigned rc = p->unref();
+ if (rc == 0)
+ delete p;
+ };
+};
+
+#endif
|