summaryrefslogtreecommitdiffstats
path: root/libdimensionxx/progress.cpp
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-06-24 21:28:51 +0000
committerTavian Barnes <tavianator@gmail.com>2009-06-24 21:28:51 +0000
commit603712c38a127e297eddd23975fb950499a0c10c (patch)
tree1ec4a3f870f57ab72b0003399657654d91bf247b /libdimensionxx/progress.cpp
parent706acbb46a91adef8ed2ec1d255802e93c59b65a (diff)
downloaddimension-603712c38a127e297eddd23975fb950499a0c10c.tar.xz
New asynchronous PNG_Canvas interface.
Diffstat (limited to 'libdimensionxx/progress.cpp')
-rw-r--r--libdimensionxx/progress.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/libdimensionxx/progress.cpp b/libdimensionxx/progress.cpp
index d09ac9b..ca74571 100644
--- a/libdimensionxx/progress.cpp
+++ b/libdimensionxx/progress.cpp
@@ -22,13 +22,20 @@
namespace Dimension
{
+ Persist_Base::~Persist_Base()
+ { }
+
Progress::Progress(dmnsn_progress* progress)
: m_progress(new dmnsn_progress*(progress))
{ }
+ Progress::Progress(dmnsn_progress* progress, const Persister& persister)
+ : m_progress(new dmnsn_progress*(progress)), m_persister(persister)
+ { }
+
Progress::~Progress()
{
- if (m_progress.unique()) {
+ if (m_progress && m_progress.unique()) {
try {
dmnsn_finish_progress(dmnsn());
} catch (...) {
@@ -73,20 +80,36 @@ namespace Dimension
{
if (m_progress.unique()) {
dmnsn_finish_progress(dmnsn());
+ m_progress.reset();
} else {
throw Dimension_Error("Attempt to finish non-unique Progress.");
}
}
+ // Access the set of persisted objects
+ Persister&
+ Progress::persister()
+ {
+ return m_persister;
+ }
+
dmnsn_progress*
Progress::dmnsn()
{
+ if (!m_progress) {
+ throw Dimension_Error("Attempting to access finished array.");
+ }
+
return *m_progress;
}
const dmnsn_progress*
Progress::dmnsn() const
{
+ if (!m_progress) {
+ throw Dimension_Error("Attempting to access finished array.");
+ }
+
return *m_progress;
}
}