00001 // $Id: Events.cc 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2007 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00026 #include "Events.hh" 00027 #include "Events.ih" 00028 00029 // Custom includes 00030 #include "Route.hh" 00031 #include "EventManager.hh" 00032 00033 //#include "Events.mpp" 00034 #define prefix_ 00035 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00036 00037 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00038 // senf::ppi::EventDescriptor 00039 00040 prefix_ senf::ppi::EventDescriptor::~EventDescriptor() 00041 { 00042 if (binding_) 00043 binding_->manager().destroyEvent(*this); 00044 } 00045 00046 prefix_ void senf::ppi::EventDescriptor::notifyUnthrottle() 00047 { 00048 Routes::const_iterator i (routes_.begin()); 00049 Routes::const_iterator const i_end (routes_.end()); 00050 for (; i != i_end; ++i) 00051 if ((*i)->throttled()) 00052 break; 00053 if (i != i_end) 00054 return; 00055 throttled_ = false; 00056 enabled(true); 00057 } 00058 00059 prefix_ void senf::ppi::EventDescriptor::enabled(bool v) 00060 { 00061 SENF_ASSERT(v_isRegistered(), "Module::registerEvent() call missing"); 00062 if (throttled_ && v) 00063 return; 00064 if (v && ! enabled_) 00065 v_enable(); 00066 else if (! v && enabled_) 00067 v_disable(); 00068 enabled_ = v; 00069 } 00070 00071 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00072 #undef prefix_ 00073 //#include "Events.mpp" 00074 00075 00076 // Local Variables: 00077 // mode: c++ 00078 // fill-column: 100 00079 // comment-column: 40 00080 // c-file-style: "senf" 00081 // indent-tabs-mode: nil 00082 // ispell-local-dictionary: "american" 00083 // compile-command: "scons -u test" 00084 // End: