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 
28 namespace fawkes {
29  class Clock;
30  class Time;
31  class Barrier;
32 }
33 
35 {
36  friend class FvBaseThread;
37  friend class FvAquisitionThread;
38  public:
41 
42  void add_waiting_thread(fawkes::Thread *thread);
43  void remove_thread(fawkes::Thread *thread);
45  void set_thread_running(fawkes::Thread *thread);
46 
47  bool empty();
48  float empty_time();
49 
50  bool has_cyclic_thread();
51 
53 
54  void set_prepfin_hold(bool hold);
55 
57 
58  private:
59  fawkes::ThreadList *running_threads_cyclic;
60  fawkes::ThreadList *running_threads_cont;
61  fawkes::ThreadList *waiting_threads;
62 
63  fawkes::Barrier *cyclic_barrier;
64 
65  fawkes::Clock *clock;
66  fawkes::Time *_empty_time;
67 };
68 
69 #endif
void wakeup_and_wait_cyclic_threads()
Wakeup and wait for all cyclic threads.
Fawkes library namespace.
This is supposed to be the central clock in Fawkes.
Definition: clock.h:34
bool has_waiting_thread(fawkes::Thread *t)
Check if the given waiting thread is registered.
FvAqtVisionThreads(fawkes::Clock *clock)
Constructor.
A class for handling time.
Definition: time.h:91
~FvAqtVisionThreads()
Destructor.
Aquisition-dependant threads.
Thread class encapsulation of pthreads.
Definition: thread.h:42
void set_prepfin_hold(bool hold)
Set prepfin hold fo cyclic threads.
void set_thread_running(fawkes::Thread *thread)
Mark the thread as running.
void remove_waiting_thread(fawkes::Thread *thread)
Remove waiting thread.
bool has_cyclic_thread()
Check if there is at least one cyclic thread.
bool empty()
Check if there is no thread at all.
List of threads.
Definition: thread_list.h:57
FireVision base thread.
Definition: base_thread.h:46
void remove_thread(fawkes::Thread *thread)
Remove a thread.
float empty_time()
Get the empty time.
void add_waiting_thread(fawkes::Thread *thread)
Add a thread in waiting state.
A barrier is a synchronization tool which blocks until a given number of threads have reached the bar...
Definition: barrier.h:32