OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimJobThreadQueue.h
Go to the documentation of this file.
1 #ifndef ossimJobThreadQueue_HEADER
2 #define ossimJobThreadQueue_HEADER
4 #include <ossim/base/Thread.h>
5 #include <mutex>
6 
58 {
59 public:
66  ossimJobThreadQueue(std::shared_ptr<ossimJobQueue> jqueue=0);
67 
71  virtual ~ossimJobThreadQueue();
72 
79  void setJobQueue(std::shared_ptr<ossimJobQueue> jqueue);
80 
84  std::shared_ptr<ossimJobQueue> getJobQueue();
85 
89  const std::shared_ptr<ossimJobQueue> getJobQueue() const;
90 
94  std::shared_ptr<ossimJob> currentJob();
95 
99  void cancelCurrentJob();
100 
104  bool isValidQueue()const;
105 
110  virtual void run();
111 
117  void setDone(bool done);
118 
122  bool isDone()const;
123 
127  virtual void cancel();
128 
133  bool isEmpty()const;
134 
139  bool isProcessingJob()const;
140 
145  bool hasJobsToProcess()const;
146 
147 protected:
152  void startThreadForQueue();
153 
157  virtual std::shared_ptr<ossimJob> nextJob();
158 
160  mutable std::mutex m_threadMutex;
161  std::shared_ptr<ossimJobQueue> m_jobQueue;
162  std::shared_ptr<ossimJob> m_currentJob;
163 
164 };
165 
166 #endif
std::shared_ptr< ossimJobQueue > m_jobQueue
virtual void run()=0
This method must be overriden and is the main entry point for any work that needs to be done...
std::shared_ptr< ossimJob > m_currentJob
Thread is an abstract class.
Definition: Thread.h:66
#define OSSIM_DLL
ossimJobThreadQueue allows one to instantiate a thread with a shared queue.
virtual void cancel()
This basically requests that the thread be canceled.
Definition: Thread.h:117