10 bool guaranteeUniqueFlag)
12 std::shared_ptr<Callback> cb;
17 if(guaranteeUniqueFlag)
43 std::shared_ptr<ossimJob> result;
44 std::shared_ptr<Callback> cb;
45 if(name.
empty())
return result;
48 ossimJob::List::iterator iter =
findByName(name);
66 std::shared_ptr<ossimJob> result;
67 std::shared_ptr<Callback> cb;
68 if(
id.empty())
return result;
71 ossimJob::List::iterator iter =
findById(
id);
89 std::shared_ptr<ossimJob> removedJob;
90 std::shared_ptr<Callback> cb;
110 std::shared_ptr<Callback> cb;
114 ossimJob::List::iterator iter =
m_jobQueue.begin();
117 if((*iter)->isStopped())
119 removedJobs.push_back(*iter);
128 if(!removedJobs.empty())
132 ossimJob::List::iterator iter = removedJobs.begin();
133 while(iter!=removedJobs.end())
146 std::shared_ptr<Callback> cb;
154 for(ossimJob::List::iterator iter=removedJobs.begin();iter!=removedJobs.end();++iter)
166 if (blockIfEmptyFlag && emptyFlag)
171 std::shared_ptr<ossimJob> result;
180 ossimJob::List::iterator iter=
m_jobQueue.begin();
182 (((*iter)->isCanceled())))
219 ossimJob::List::iterator iter =
m_jobQueue.begin();
222 if(
id == (*iter)->id())
234 ossimJob::List::iterator iter =
m_jobQueue.begin();
237 if(name == (*iter)->name())
256 ossimJob::List::iterator iter = std::find_if(
m_jobQueue.begin(),
m_jobQueue.end(), [
n, job](
const std::shared_ptr<ossimJob> jobIter){
257 bool result = (jobIter == job);
258 if(!result&&!
n.empty()) result = jobIter->name() ==
n;
281 ossimJob::List::const_iterator iter =
m_jobQueue.begin();
std::shared_ptr< ossimJobQueue > getSharedFromThis()
This is the safe way to create a std::shared_ptr for 'this'.
virtual void clear()
Will clear the queue.
void set(bool releaseFlag)
Will set the relase flag and wake up all threads to test the condition again.
virtual void releaseBlock()
will release the block and have any blocked threads continue
ossimJob::List::iterator findByName(const ossimString &name)
Internal method that returns an iterator.
ossimJob::List::iterator findByPointer(const std::shared_ptr< ossimJob > job)
Internal method that returns an iterator.
std::shared_ptr< Callback > callback()
ossimJob::List m_jobQueue
std::shared_ptr< Callback > m_callback
void release()
Releases the threads and will not return until all threads are released.
ossimJob::List::iterator findByNameOrPointer(const std::shared_ptr< ossimJob > job)
Internal method that returns an iterator.
virtual void remove(const std::shared_ptr< ossimJob > Job)
Allows one to pass in a job pointer to remove.
os2<< "> n<< " > nendobj n
ossimJob::List::iterator findById(const ossimString &id)
Internal method that returns an iterator.
virtual std::shared_ptr< ossimJob > removeById(const ossimString &id)
Allows one to remove a job passing in it's id.
unsigned int ossim_uint32
void setCallback(std::shared_ptr< Callback > c)
Allows one to set the callback to the list.
void block()
Will block the calling thread based on the internal condition.
virtual std::shared_ptr< ossimJob > removeByName(const ossimString &name)
Allows one to remove a job passing in it's name.
std::list< std::shared_ptr< ossimJob > > List
bool hasJob(std::shared_ptr< ossimJob > job)
Internal method that determines if we have the job.
std::mutex m_jobQueueMutex
ossimJobQueue()
Default constructor.
virtual std::shared_ptr< ossimJob > nextJob(bool blockIfEmptyFlag=true)
Will grab the next job on the list and will return the job or a null shared_ptr.
virtual void removeStoppedJobs()
Will remove any stopped jobs from the queue.
virtual void add(std::shared_ptr< ossimJob > job, bool guaranteeUniqueFlag=true)
Will add a job to the queue and if the guaranteeUniqueFlag is set it will scan and make sure the job ...