Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

gate.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2003, 2004, 2005 Laboratoire de Recherche en Informatique
00002 
00003 // This file is part of Qolyester.
00004 
00005 // Qolyester is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 // Qolyester is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 
00019 #ifndef QOLYESTER_DAEMON_SET_GATE_HXX
00020 # define QOLYESTER_DAEMON_SET_GATE_HXX 1
00021 
00022 # include "gate.hh"
00023 
00024 namespace olsr {
00025   
00026   namespace set {
00027 
00028 # ifdef QOLYESTER_ENABLE_NUMPREFIX
00029     GateEntry::GateEntry(const address_t& naddr, const unsigned prefix) :
00030       naddr_(naddr), prefix_(prefix) {}
00031 # else      
00032     GateEntry::GateEntry(const address_t& naddr, const unsigned prefix) :
00033       naddr_(naddr), nmask_(address_t::netmask(prefix)), prefix_(prefix) {}
00034 # endif
00035       
00036     GateSet::GateSet()
00037       : gset_(),
00038         hna_gset_(gset_)
00039     {}
00040     
00041     std::pair<GateSet::iterator, bool>
00042     GateSet::insert(const gset_t::value_type& x) {
00043       std::pair<iterator, bool> p = gset_.insert(x);
00044       if (p.second)
00045         hna_gset_.insert(p.first);
00046       return p;
00047     }
00048 
00049     void
00050     GateSet::erase(iterator pos) {
00051       hna_gset_.erase(pos);
00052       gset_.erase(pos);
00053     }
00054 
00055     bool
00056     GateSet::empty() const {
00057       return gset_.empty();
00058     }
00059 
00060   } // namespace set
00061 
00062 } // namespace olsr
00063 
00064 #endif // ! QOLYESTER_DAEMON_SET_GATE_HXX

Generated on Thu Jul 28 21:21:47 2005 for Qolyester daemon by  doxygen 1.4.1