/usr/include/osgEarth/Progress is in libosgearth-dev 2.7.0+dfsg-2+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 Pelican Mapping
* http://osgearth.org
*
* osgEarth 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_PROGRESS_H
#define OSGEARTH_PROGRESS_H 1
#include <osgEarth/Common>
#include <osgEarth/Containers>
namespace osgEarth
{
/**
* ProgressCallback is a general purpose interface for functions that need to report progress.
*/
class OSGEARTH_EXPORT ProgressCallback : public osg::Referenced
{
public:
/**
* Creates a new ProgressCallback
*/
ProgressCallback();
virtual ~ProgressCallback() { }
/**
* Callback function that will be called.
* @param current
* The amount of work done in the current stage
* @param total
* The total amount of work to be done in the current stage
* @param stage
* Stage of the operation we're currently in
* @param totalStages
* Total number of stages in the operation
* @param msg
* Description of what is being done. Useful when total is unknown.
* @param returns
* Returns true if the current task should be cancelled, false otherwise.
*/
virtual bool reportProgress(
double current,
double total,
unsigned currentStage,
unsigned totalStages,
const std::string& msg );
/**
* Convenience functions
*/
bool reportProgress( double current, double total, const std::string& msg ) {
return reportProgress(current, total, 0, 1, msg );
}
bool reportProgress( double current, double total ) {
return reportProgress(current, total, 0, 1, "" );
}
/**
* called when the process starts
*/
virtual void onStarted() { }
/**
* called when the process completed
*/
virtual void onCompleted() { }
/**
* Sets the cancelation flag
*/
virtual void cancel() { _canceled = true; }
/**
* Whether cancelation was requested
*/
virtual bool isCanceled() { return _canceled; }
std::string& message() { return _message; }
/**
* Resets the canceled flag.
*/
void reset() { _canceled = false; }
/**
*Whether or not the task should be retried.
*/
bool needsRetry() const { return _needsRetry; }
/**
* Sets whether or not the task should be retried
*/
void setNeedsRetry( bool needsRetry ) { _needsRetry = needsRetry; }
/**
* Access user stats
*/
fast_map<std::string,double>& stats() { return _stats; }
protected:
volatile unsigned _numStages;
std::string _message;
mutable bool _needsRetry;
mutable bool _canceled;
mutable fast_map<std::string, double> _stats;
};
/**
* ConsoleProgressCallback is a simple ProgressCallback that reports progress to the console
*/
class OSGEARTH_EXPORT ConsoleProgressCallback : public ProgressCallback
{
public:
/**
* Creates a new ConsoleProgressCallback
*/
ConsoleProgressCallback();
virtual ~ConsoleProgressCallback() { }
/**
* Callback function that will be called.
* @param current
* The amount of work done in the current stage
* @param total
* The total amount of work to be done in the current stage
* @param stage
* Stage of the operation we're currently in
* @param totalStages
* Total number of stages in the operation
* @param msg
* Description of what is being done. Useful when total is unknown.
* @param returns
* Returns true if the current task should be cancelled, false otherwise.
*/
virtual bool reportProgress(
double current,
double total,
unsigned currentStage,
unsigned totalStages,
const std::string& msg );
};
}
#endif
|