00001 // $Id: SafeIterator.cti 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2008 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 "SafeIterator.ih" 00027 00028 // Custom includes 00029 00030 #define prefix_ inline 00031 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00032 00033 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00034 // senf::SafePacketParserWrapper<Parser> 00035 00036 template <class Parser> 00037 prefix_ senf::SafePacketParserWrapper<Parser>::SafePacketParserWrapper() 00038 : parser_(), i_() 00039 {} 00040 00041 template <class Parser> 00042 prefix_ senf::SafePacketParserWrapper<Parser>::SafePacketParserWrapper(Parser parser) 00043 : parser_(parser), i_(parser) 00044 {} 00045 00046 template <class Parser> 00047 prefix_ senf::SafePacketParserWrapper<Parser> & senf::SafePacketParserWrapper<Parser>::operator=(Parser parser) 00048 { 00049 parser_ = parser; 00050 i_ = parser; 00051 return *this; 00052 } 00053 00054 template <class Parser> 00055 prefix_ Parser & senf::SafePacketParserWrapper<Parser>::operator*() 00056 const 00057 { 00058 SENF_ASSERT( i_, "Dereferencing empty SafePacketParserWrapper" ); 00059 parser_->i_ = PacketParserBase::data_iterator(i_); 00060 return *parser_; 00061 } 00062 00063 template <class Parser> 00064 prefix_ Parser * senf::SafePacketParserWrapper<Parser>::operator->() 00065 const 00066 { 00067 SENF_ASSERT( i_, "Dereferencing empty SafePacketParserWrapper" ); 00068 parser_->i_ = PacketParserBase::data_iterator(i_); 00069 return & (*parser_); 00070 } 00071 00072 template <class Parser> 00073 prefix_ bool senf::SafePacketParserWrapper<Parser>::boolean_test() 00074 const 00075 { 00076 return i_; 00077 } 00078 00079 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00080 #undef prefix_ 00081 00082 00083 // Local Variables: 00084 // mode: c++ 00085 // fill-column: 100 00086 // comment-column: 40 00087 // c-file-style: "senf" 00088 // indent-tabs-mode: nil 00089 // ispell-local-dictionary: "american" 00090 // compile-command: "scons -u test" 00091 // End: