osgEarth 2.1.1
|
Public Types | |
enum | State { STATE_IDLE, STATE_PENDING, STATE_IN_PROGRESS, STATE_COMPLETED } |
Public Member Functions | |
TaskRequest (float priority=0.0f) | |
virtual void | operator() (ProgressCallback *progress)=0 |
void | run () |
void | cancel () |
bool | isIdle () const |
bool | isPending () const |
bool | isCompleted () const |
bool | isInProgress () const |
bool | isRunning () const |
bool | wasCanceled () const |
void | setPriority (float value) |
float | getPriority () const |
State | getState () const |
void | setState (State s) |
void | setStamp (int stamp) |
int | getStamp () const |
osg::Referenced * | getResult () const |
ProgressCallback * | getProgressCallback () |
void | setProgressCallback (ProgressCallback *progress) |
const std::string & | getName () const |
void | setName (const std::string &name) |
void | reset () |
osg::Timer_t | startTime () const |
osg::Timer_t | endTime () const |
double | runTime () const |
void | setCompletedEvent (Threading::Event *value) |
Threading::Event * | getCompletedEvent () const |
Protected Attributes | |
float | _priority |
volatile State | _state |
volatile int | _stamp |
osg::ref_ptr< osg::Referenced > | _result |
osg::ref_ptr< ProgressCallback > | _progress |
std::string | _name |
osg::Timer_t | _startTime |
osg::Timer_t | _endTime |
Threading::Event * | _completedEvent |
Definition at line 34 of file TaskService.
Definition at line 37 of file TaskService.
TaskRequest::TaskRequest | ( | float | priority = 0.0f | ) |
Definition at line 29 of file TaskService.cpp.
: osg::Referenced( true ), _priority( priority ), _state( STATE_IDLE ) { _progress = new ProgressCallback(); }
void TaskRequest::cancel | ( | ) |
Definition at line 53 of file TaskService.cpp.
{ //OE_INFO << LC << "TR [" << getName() << "] canceled" << std::endl; _progress->cancel(); }
osg::Timer_t osgEarth::TaskRequest::endTime | ( | ) | const [inline] |
Definition at line 73 of file TaskService.
{ return _endTime; }
Threading::Event* osgEarth::TaskRequest::getCompletedEvent | ( | ) | const [inline] |
Definition at line 77 of file TaskService.
{ return _completedEvent; }
const std::string& osgEarth::TaskRequest::getName | ( | ) | const [inline] |
Definition at line 69 of file TaskService.
{ return _name; }
float osgEarth::TaskRequest::getPriority | ( | ) | const [inline] |
Definition at line 61 of file TaskService.
{ return _priority; }
ProgressCallback* osgEarth::TaskRequest::getProgressCallback | ( | ) | [inline] |
Definition at line 67 of file TaskService.
{ return _progress.get(); }
osg::Referenced* osgEarth::TaskRequest::getResult | ( | ) | const [inline] |
Definition at line 66 of file TaskService.
{ return _result.get(); }
int osgEarth::TaskRequest::getStamp | ( | ) | const [inline] |
Definition at line 65 of file TaskService.
{ return _stamp; }
State osgEarth::TaskRequest::getState | ( | ) | const [inline] |
Definition at line 62 of file TaskService.
{ return _state; }
bool osgEarth::TaskRequest::isCompleted | ( | ) | const [inline] |
Definition at line 54 of file TaskService.
{ return _state == STATE_COMPLETED; }
bool osgEarth::TaskRequest::isIdle | ( | ) | const [inline] |
Definition at line 52 of file TaskService.
{ return _state == STATE_IDLE; }
bool osgEarth::TaskRequest::isInProgress | ( | ) | const [inline] |
Definition at line 55 of file TaskService.
{ return _state == STATE_IN_PROGRESS; }
bool osgEarth::TaskRequest::isPending | ( | ) | const [inline] |
Definition at line 53 of file TaskService.
{ return _state == STATE_PENDING; }
bool osgEarth::TaskRequest::isRunning | ( | ) | const [inline] |
Definition at line 56 of file TaskService.
{ return isPending() || isInProgress(); }
virtual void osgEarth::TaskRequest::operator() | ( | ProgressCallback * | progress | ) | [pure virtual] |
Implemented in osgEarth::ParallelTask< T >, AsyncPurge, AsyncInsert, AsyncUpdateAccessTime, AsyncUpdateAccessTimePool, ImageRequest, anonymous_namespace{StreamingTile.cpp}::TileColorLayerRequest, anonymous_namespace{StreamingTile.cpp}::TileElevationLayerRequest, anonymous_namespace{StreamingTile.cpp}::TileElevationPlaceholderLayerRequest, anonymous_namespace{StreamingTile.cpp}::TileGenRequest, seamless::anonymous_namespace{Geographic.cpp}::HeightFieldRequest, and seamless::anonymous_namespace{Geographic.cpp}::ImageRequest.
void osgEarth::TaskRequest::reset | ( | ) | [inline] |
Definition at line 71 of file TaskService.
{ _result = 0L; }
void TaskRequest::run | ( | ) |
Definition at line 38 of file TaskService.cpp.
{ if ( _state == STATE_IN_PROGRESS ) { _startTime = osg::Timer::instance()->tick(); (*this)( _progress.get() ); _endTime = osg::Timer::instance()->tick(); } else { _progress->cancel(); } }
double osgEarth::TaskRequest::runTime | ( | ) | const [inline] |
Definition at line 74 of file TaskService.
{ return osg::Timer::instance()->delta_s(_startTime,_endTime); }
void osgEarth::TaskRequest::setCompletedEvent | ( | Threading::Event * | value | ) | [inline] |
Definition at line 76 of file TaskService.
{ _completedEvent = value; }
void osgEarth::TaskRequest::setName | ( | const std::string & | name | ) | [inline] |
Definition at line 70 of file TaskService.
{ _name = name; }
void osgEarth::TaskRequest::setPriority | ( | float | value | ) | [inline] |
Definition at line 60 of file TaskService.
{ _priority = value; }
void osgEarth::TaskRequest::setProgressCallback | ( | ProgressCallback * | progress | ) | [inline] |
Definition at line 68 of file TaskService.
{ _progress = progress? progress : new ProgressCallback(); }
void osgEarth::TaskRequest::setStamp | ( | int | stamp | ) | [inline] |
Definition at line 64 of file TaskService.
{ _stamp = stamp; }
void osgEarth::TaskRequest::setState | ( | State | s | ) | [inline] |
Definition at line 63 of file TaskService.
{ _state = s; }
osg::Timer_t osgEarth::TaskRequest::startTime | ( | ) | const [inline] |
Definition at line 72 of file TaskService.
{ return _startTime; }
bool TaskRequest::wasCanceled | ( | ) | const |
Definition at line 60 of file TaskService.cpp.
{ return _progress->isCanceled(); }
Threading::Event* osgEarth::TaskRequest::_completedEvent [protected] |
Definition at line 88 of file TaskService.
osg::Timer_t osgEarth::TaskRequest::_endTime [protected] |
Definition at line 87 of file TaskService.
std::string osgEarth::TaskRequest::_name [protected] |
Definition at line 85 of file TaskService.
float osgEarth::TaskRequest::_priority [protected] |
Definition at line 80 of file TaskService.
osg::ref_ptr< ProgressCallback > osgEarth::TaskRequest::_progress [protected] |
Definition at line 84 of file TaskService.
osg::ref_ptr<osg::Referenced> osgEarth::TaskRequest::_result [protected] |
Reimplemented in ImageRequest.
Definition at line 83 of file TaskService.
volatile int osgEarth::TaskRequest::_stamp [protected] |
Definition at line 82 of file TaskService.
osg::Timer_t osgEarth::TaskRequest::_startTime [protected] |
Definition at line 86 of file TaskService.
volatile State osgEarth::TaskRequest::_state [protected] |
Definition at line 81 of file TaskService.