25 #include "interface_list_maintainer.h"
27 #include <core/threading/mutex_locker.h>
65 std::list<fawkes::Interface *>::iterator pif_tmp;
66 for (pif_tmp = ifs_tmp.begin(); pif_tmp != ifs_tmp.end(); ++pif_tmp) {
68 std::string id_list_tmp((*pif_tmp)->id());
69 bool is_in_list =
false;
71 for (pif_class = ifs_.begin(); pif_class != ifs_.end(); ++pif_class) {
72 std::string id_list_class((*pif_class)->id());
74 if (id_list_tmp.compare(id_list_class) == 0) {
75 blackboard_->
close(*pif_tmp);
81 ifs_.push_back((*pif_tmp));
99 for (pif = ifs_.begin(); pif != ifs_.end(); ++pif) {
103 blackboard_->
close(*pif);
114 BlackBoardInterfaceListMaintainer::bb_interface_created(
const char *
type,
const char *
id)
throw()
118 pif = blackboard_->open_for_reading(
type,
id);
126 bbil_add_reader_interface(pif);
127 bbil_add_writer_interface(pif);
128 blackboard_->update_listener(
this);
130 logger_->log_warn(name_,
"Failed to register for %s:%s: %s",
type,
id, e.
what());
132 bbil_remove_reader_interface(pif);
133 bbil_remove_writer_interface(pif);
134 blackboard_->update_listener(
this);
135 blackboard_->close(pif);
138 name_,
"Failed to deregister %s:%s during error recovery: %s",
type,
id, e.
what());
143 ifs_.push_back_locked(pif);
152 BlackBoardInterfaceListMaintainer::bb_interface_writer_removed(
fawkes::Interface *interface,
153 unsigned int instance_serial)
throw()
155 conditional_close(interface);
164 BlackBoardInterfaceListMaintainer::bb_interface_reader_removed(
fawkes::Interface *interface,
165 unsigned int instance_serial)
throw()
167 conditional_close(interface);
176 BlackBoardInterfaceListMaintainer::conditional_close(
Interface *pif)
throw()
185 logger_->log_info(name_,
"Last on %s, closing", pif->
uid());
193 std::string
uid = pif->
uid();
195 bbil_remove_reader_interface(pif);
196 bbil_remove_writer_interface(pif);
197 blackboard_->update_listener(
this);
198 blackboard_->close(pif);
200 logger_->log_error(name_,
"Failed to unregister or close %s: %s",
uid.c_str(), e.
what());