OpenStructure
Loading...
Searching...
No Matches
progress.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// This file is part of the OpenStructure project <www.openstructure.org>
3//
4// Copyright (C) 2008-2020 by the OpenStructure authors
5// Copyright (C) 2003-2010 by the IPLT authors
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License as published by the Free
9// Software Foundation; either version 3.0 of the License, or (at your option)
10// any later version.
11// This library is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14// details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this library; if not, write to the Free Software Foundation, Inc.,
18// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//------------------------------------------------------------------------------
20
21/*
22 Author: Andreas Schenk
23*/
24#ifndef PROGRESS_HH_
25#define PROGRESS_HH_
26
27#include <vector>
28
30
31namespace ost {
32
33namespace img
34{
35
37{
38public:
39 static Progress& Instance();
40 virtual ~Progress();
41 void Register(const void* process, unsigned long steps, unsigned long delta=1);
42 void DeRegister(const void* process);
43 void AdvanceProgress(const void* process,unsigned long step=1);
45 void AddCallback(void(*fpt)(void)){function_pointer_=fpt;}
46 bool IsActive(){return ! processes_.empty();}
47private:
48 Progress();
49 Real progress_;
50 std::vector<const void *> processes_;
51 std::vector<unsigned long> process_steps_;
52 std::vector<unsigned long> process_deltas_;
53 unsigned long delta_step_;
54 void(*function_pointer_)(void);
55};
56
57}}//ns
58
59#endif /*PROGRESS_HH_*/
void DeRegister(const void *process)
void AddCallback(void(*fpt)(void))
Definition progress.hh:45
static Progress & Instance()
void Register(const void *process, unsigned long steps, unsigned long delta=1)
void AdvanceProgress(const void *process, unsigned long step=1)
#define DLLEXPORT_OST_IMG_BASE
float Real
Definition base.hh:44
Definition base.dox:1