author | Francesco Abbate <francesco.bbt@gmail.com> | 2009年12月17日 11:02:22 +0000 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2009年12月17日 11:02:22 +0000 |
commit | 720b18d7f1a5dba6ebc4c4f4ea4a5c2e1a8b74d4 (patch) | |
tree | 1f6da5d02f842a1866f3cb78dd12f37332473d66 /agg-plot/resource-manager.h | |
parent | d00328bd46965223c83f3880204943d8e5844034 (diff) | |
download | gsl-shell-720b18d7f1a5dba6ebc4c4f4ea4a5c2e1a8b74d4.tar.gz |
-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
|