From c35d5af1c2845ad072525e69f3f7be01994bcc2f Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 4 Oct 2009 19:04:59 +0000 Subject: Purge test suite and C++ wrapper - for now. --- libdimensionxx/dimensionxx/progress.hpp | 135 -------------------------------- 1 file changed, 135 deletions(-) delete mode 100644 libdimensionxx/dimensionxx/progress.hpp (limited to 'libdimensionxx/dimensionxx/progress.hpp') diff --git a/libdimensionxx/dimensionxx/progress.hpp b/libdimensionxx/dimensionxx/progress.hpp deleted file mode 100644 index 555c8c5..0000000 --- a/libdimensionxx/dimensionxx/progress.hpp +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * Copyright (C) 2009 Tavian Barnes * - * * - * This file is part of The Dimension Library. * - * * - * The Dimension Library is free software; you can redistribute it and/ * - * or modify it under the terms of the GNU Lesser General Public License * - * as published by the Free Software Foundation; either version 3 of the * - * License, or (at your option) any later version. * - * * - * The Dimension Library is distributed in the hope that it will be * - * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this program. If not, see * - * . * - *************************************************************************/ - -// dmnsn_progress* wrapper. - -#ifndef DIMENSIONXX_PROGRESS_HPP -#define DIMENSIONXX_PROGRESS_HPP - -#include // For tr1::shared_ptr -#include - -namespace Dimension -{ - // Base class for persisting objects - class Persist_Base - { - public: - virtual ~Persist_Base() = 0; - - protected: - Persist_Base() { } - - private: - // Copying prohibited - Persist_Base(const Persist_Base&); - Persist_Base& operator=(const Persist_Base&); - }; - - // Class for persisting objects - template - class Persist : public Persist_Base - { - public: - Persist(T* t) : m_t(t) { } - virtual ~Persist() { delete m_t; } - - T* persisted() const { return m_t; } - - private: - T* m_t; - }; - - // Class for persisting many objects - class Persister - { - public: - // Persister(); - // Persister(const Persister& persister); - // ~Persister(); - - // Persister& operator=(const Persister& persister); - - template - void persist(T* t); - - // Access the first persisted element - template - Persist& first(); - - private: - // Copy-assignment prohibited - Persister& operator=(const Persister&); - - std::list > m_persists; - }; - - // dmnsn_progress* wrapper class to represent an asynchronous worker thread - class Progress - { - public: - explicit Progress(dmnsn_progress* progress); - Progress(dmnsn_progress* progress, const Persister& persister); - // Progress(const Progress& progress); - - // Finishes the job without throwing - ~Progress(); - - double progress() const; - void wait(double progress) const; - - void new_element(unsigned int total); - void increment(); - void done(); - - // Wait for job to finish, throwing if the job failed - void finish(); - - // Access the set of persisted objects - Persister& persister(); - - // Access the wrapped C object. - dmnsn_progress* dmnsn(); - const dmnsn_progress* dmnsn() const; - - private: - // Copy assignment prohibited - Progress& operator=(const Progress&); - - std::tr1::shared_ptr m_progress; - Persister m_persister; - }; - - template - void - Persister::persist(T* t) - { - m_persists.push_back(std::tr1::shared_ptr(new Persist(t))); - } - - template - Persist& - Persister::first() - { - return dynamic_cast&>(*m_persists.front()); - } -} - -#endif /* DIMENSIONXX_PROGRESS_HPP */ -- cgit v1.2.3