23 #include <blackboard/blackboard.h>
24 #include <interfaces/ObjectPositionInterface.h>
25 #include <plugins/openni/utils/hand_if_observer.h>
43 queue_lock_ =
new Mutex();
46 std::list<ObjectPositionInterface *> hand_ifs =
47 bb_->open_multiple_for_reading<ObjectPositionInterface>(
"OpenNI Hand *");
49 std::list<ObjectPositionInterface *>::iterator i;
50 for (i = hand_ifs.begin(); i != hand_ifs.end(); ++i) {
53 hands_[hand.hand_if->id()] = hand;
56 bbio_add_observed_create(
"ObjectPositionInterface",
"OpenNI Hand *");
57 bb_->register_observer(
this);
61 HandIfObserver::~HandIfObserver()
63 bb_->unregister_observer(
this);
68 HandIfObserver::bb_interface_created(
const char *type,
const char *
id)
throw()
70 if (hands_.find(
id) == hands_.end()) {
72 queues_[active_queue_].push(
id);
73 queue_lock_->unlock();
81 HandIfObserver::process_queue()
84 unsigned int proc_queue = active_queue_;
85 active_queue_ = 1 - active_queue_;
86 queue_lock_->unlock();
87 while (!queues_[proc_queue].empty()) {
88 std::string
id = queues_[proc_queue].front();
100 queues_[proc_queue].pop();