ConfigurationListener.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00019 #include <rtm/ConfigurationListener.h>
00020 
00021 namespace RTC
00022 {
00023 
00024   //============================================================
00032   ConfigurationParamListener::~ConfigurationParamListener(){}
00033 
00041   ConfigurationSetNameListener::~ConfigurationSetNameListener(){}
00042 
00050   ConfigurationSetListener::~ConfigurationSetListener(){}
00051 
00052 
00053   //============================================================
00061   ConfigurationParamListenerHolder::ConfigurationParamListenerHolder()
00062   {
00063   }
00064   
00065   
00066   ConfigurationParamListenerHolder::~ConfigurationParamListenerHolder()
00067   {
00068     Guard guard(m_mutex);
00069     for (int i(0), len(m_listeners.size()); i < len; ++i)
00070       {
00071         if (m_listeners[i].second)
00072           {
00073             delete m_listeners[i].first;
00074           }
00075       }
00076   }
00077 
00078   
00079   void ConfigurationParamListenerHolder::
00080   addListener(ConfigurationParamListener* listener,
00081               bool autoclean)
00082   {
00083     Guard guard(m_mutex);
00084     m_listeners.push_back(Entry(listener, autoclean));
00085   }
00086   
00087   
00088   void ConfigurationParamListenerHolder::
00089   removeListener(ConfigurationParamListener* listener)
00090   {
00091     Guard guard(m_mutex);
00092     std::vector<Entry>::iterator it(m_listeners.begin());
00093     
00094     for (; it != m_listeners.end(); ++it)
00095       {
00096         if ((*it).first == listener)
00097           {
00098             if ((*it).second)
00099               {
00100                 delete (*it).first;
00101               }
00102             m_listeners.erase(it);
00103             return;
00104           }
00105       }
00106     
00107   }
00108   
00109   
00110   void ConfigurationParamListenerHolder::notify(const char* config_set_name,
00111                                                 const char* config_param_name)
00112   {
00113     Guard guard(m_mutex);
00114     for (int i(0), len(m_listeners.size()); i < len; ++i)
00115       {
00116         m_listeners[i].first->operator()(config_set_name, config_param_name);
00117       }
00118   }
00119 
00120 
00121   //============================================================
00129   ConfigurationSetListenerHolder::ConfigurationSetListenerHolder()
00130   {
00131   }
00132     
00133   
00134   ConfigurationSetListenerHolder::~ConfigurationSetListenerHolder()
00135   {
00136     Guard guard(m_mutex);
00137     for (int i(0), len(m_listeners.size()); i < len; ++i)
00138       {
00139         if (m_listeners[i].second)
00140           {
00141             delete m_listeners[i].first;
00142           }
00143       }
00144   }
00145   
00146   
00147   void ConfigurationSetListenerHolder::
00148   addListener(ConfigurationSetListener* listener,
00149               bool autoclean)
00150   {
00151     Guard guard(m_mutex);
00152     m_listeners.push_back(Entry(listener, autoclean));
00153   }
00154   
00155   
00156   void ConfigurationSetListenerHolder::
00157   removeListener(ConfigurationSetListener* listener)
00158   {
00159     Guard guard(m_mutex);
00160     std::vector<Entry>::iterator it(m_listeners.begin());
00161     
00162     for (; it != m_listeners.end(); ++it)
00163       {
00164         if ((*it).first == listener)
00165           {
00166             if ((*it).second)
00167               {
00168                 delete (*it).first;
00169               }
00170             m_listeners.erase(it);
00171             return;
00172           }
00173       }
00174     
00175   }
00176   
00177   
00178   void ConfigurationSetListenerHolder::
00179   notify(const coil::Properties& config_set)
00180   {
00181     Guard guard(m_mutex);
00182     for (int i(0), len(m_listeners.size()); i < len; ++i)
00183       {
00184         m_listeners[i].first->operator()(config_set);
00185       }
00186   }
00187 
00188   //============================================================
00196   ConfigurationSetNameListenerHolder::ConfigurationSetNameListenerHolder()
00197   {
00198   }
00199   
00200 
00201   ConfigurationSetNameListenerHolder::~ConfigurationSetNameListenerHolder()
00202   {
00203     Guard guard(m_mutex);
00204     for (int i(0), len(m_listeners.size()); i < len; ++i)
00205       {
00206         if (m_listeners[i].second)
00207           {
00208             delete m_listeners[i].first;
00209           }
00210       }
00211   }
00212 
00213   
00214   void ConfigurationSetNameListenerHolder::
00215   addListener(ConfigurationSetNameListener* listener, bool autoclean)
00216   {
00217     Guard guard(m_mutex);
00218     m_listeners.push_back(Entry(listener, autoclean));
00219   }
00220 
00221   
00222   void ConfigurationSetNameListenerHolder::
00223   removeListener(ConfigurationSetNameListener* listener)
00224   {
00225     Guard guard(m_mutex);
00226     std::vector<Entry>::iterator it(m_listeners.begin());
00227     for (; it != m_listeners.end(); ++it)
00228       {
00229         if ((*it).first == listener)
00230           {
00231             if ((*it).second)
00232               {
00233                 delete (*it).first;
00234               }
00235             m_listeners.erase(it);
00236             return;
00237           }
00238       }
00239     
00240   }
00241 
00242     
00243   void ConfigurationSetNameListenerHolder::notify(const char* config_set_name)
00244   {
00245     Guard guard(m_mutex);
00246     for (int i(0), len(m_listeners.size()); i < len; ++i)
00247       {
00248         m_listeners[i].first->operator()(config_set_name);
00249       }
00250   }
00251 
00252 };
00253 
00254 


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:03