Fawkes API  Fawkes Development Version
aqt_vision_threads.h
1 
2 /***************************************************************************
3  * aqt_vision_threads.h - FireVision Base Vision Camera Data
4  *
5  * Created: Mon Sep 24 16:16:05 2007
6  * Copyright 2006-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _FIREVISION_APPS_BASE_AQT_VISION_THREADS_H_
24 #define _FIREVISION_APPS_BASE_AQT_VISION_THREADS_H_
25 
26 #include <core/threading/thread_list.h>
27 #include <utils/time/time.h>
28 
29 #include <memory>
30 
31 namespace fawkes {
32 class Clock;
33 class Barrier;
34 } // namespace fawkes
35 
36 class FvBaseThread;
37 class FvAquisitionThread;
38 
40 {
41  friend FvBaseThread;
42  friend FvAquisitionThread;
43 
44 public:
47 
48  void add_waiting_thread(fawkes::Thread *thread);
49  void remove_thread(fawkes::Thread *thread);
51  void set_thread_running(fawkes::Thread *thread);
52 
53  bool empty();
54  float empty_time();
55 
56  bool has_cyclic_thread();
57  bool has_cont_thread();
58 
60 
61  void set_prepfin_hold(bool hold);
62 
64 
65 private:
66  fawkes::ThreadList running_threads_cyclic;
67  fawkes::ThreadList running_threads_cont;
68  fawkes::ThreadList waiting_threads;
69 
70  std::unique_ptr<fawkes::Barrier> cyclic_barrier;
71 
72  fawkes::Clock *clock;
73  fawkes::Time _empty_time;
74 };
75 
76 #endif
FvAqtVisionThreads::has_waiting_thread
bool has_waiting_thread(fawkes::Thread *t)
Check if the given waiting thread is registered.
Definition: aqt_vision_threads.cpp:138
FvAqtVisionThreads::~FvAqtVisionThreads
~FvAqtVisionThreads()
Destructor.
Definition: aqt_vision_threads.cpp:50
FvAqtVisionThreads
Aquisition-dependant threads.
Definition: aqt_vision_threads.h:40
FvAqtVisionThreads::has_cont_thread
bool has_cont_thread()
Check if there is at least one continuous thread.
Definition: aqt_vision_threads.cpp:128
FvAqtVisionThreads::remove_waiting_thread
void remove_waiting_thread(fawkes::Thread *thread)
Remove waiting thread.
Definition: aqt_vision_threads.cpp:107
FvAqtVisionThreads::empty
bool empty()
Check if there is no thread at all.
Definition: aqt_vision_threads.cpp:148
FvAqtVisionThreads::remove_thread
void remove_thread(fawkes::Thread *thread)
Remove a thread.
Definition: aqt_vision_threads.cpp:88
FvAqtVisionThreads::FvAqtVisionThreads
FvAqtVisionThreads(fawkes::Clock *clock)
Constructor.
Definition: aqt_vision_threads.cpp:43
FvAqtVisionThreads::set_prepfin_hold
void set_prepfin_hold(bool hold)
Set prepfin hold fo cyclic threads.
Definition: aqt_vision_threads.cpp:182
FvAqtVisionThreads::add_waiting_thread
void add_waiting_thread(fawkes::Thread *thread)
Add a thread in waiting state.
Definition: aqt_vision_threads.cpp:60
FvBaseThread
FireVision base thread.
Definition: base_thread.h:54
fawkes
Fawkes library namespace.
FvAqtVisionThreads::set_thread_running
void set_thread_running(fawkes::Thread *thread)
Mark the thread as running.
Definition: aqt_vision_threads.cpp:69
FvAqtVisionThreads::has_cyclic_thread
bool has_cyclic_thread()
Check if there is at least one cyclic thread.
Definition: aqt_vision_threads.cpp:119
fawkes::Time
A class for handling time.
Definition: time.h:93
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
FvAqtVisionThreads::empty_time
float empty_time()
Get the empty time.
Definition: aqt_vision_threads.cpp:158
FvAqtVisionThreads::wakeup_and_wait_cyclic_threads
void wakeup_and_wait_cyclic_threads()
Wakeup and wait for all cyclic threads.
Definition: aqt_vision_threads.cpp:165
fawkes::Clock
This is supposed to be the central clock in Fawkes.
Definition: clock.h:35
fawkes::ThreadList
List of threads.
Definition: thread_list.h:56