00001 00002 /*************************************************************************** 00003 * aqt_vision_threads.h - FireVision Base Vision Camera Data 00004 * 00005 * Created: Mon Sep 24 16:16:05 2007 00006 * Copyright 2006-2007 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #ifndef __FIREVISION_APPS_BASE_AQT_VISION_THREADS_H_ 00024 #define __FIREVISION_APPS_BASE_AQT_VISION_THREADS_H_ 00025 00026 #include <core/threading/thread_list.h> 00027 00028 namespace fawkes { 00029 class Clock; 00030 class Time; 00031 class Barrier; 00032 } 00033 00034 class FvAqtVisionThreads 00035 { 00036 friend class FvBaseThread; 00037 friend class FvAquisitionThread; 00038 public: 00039 FvAqtVisionThreads(fawkes::Clock *clock); 00040 ~FvAqtVisionThreads(); 00041 00042 void add_waiting_thread(fawkes::Thread *thread); 00043 void remove_thread(fawkes::Thread *thread); 00044 void remove_waiting_thread(fawkes::Thread *thread); 00045 void set_thread_running(fawkes::Thread *thread); 00046 00047 bool empty(); 00048 float empty_time(); 00049 00050 bool has_cyclic_thread(); 00051 00052 void wakeup_and_wait_cyclic_threads(); 00053 00054 void set_prepfin_hold(bool hold); 00055 00056 bool has_waiting_thread(fawkes::Thread *t); 00057 00058 private: 00059 fawkes::ThreadList *running_threads_cyclic; 00060 fawkes::ThreadList *running_threads_cont; 00061 fawkes::ThreadList *waiting_threads; 00062 00063 fawkes::Barrier *cyclic_barrier; 00064 00065 fawkes::Clock *clock; 00066 fawkes::Time *_empty_time; 00067 }; 00068 00069 #endif