X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FSafeIterator.cci;h=0f24bb8433593c9a92075aa60f21fd9e9363ea24;hb=8a6697d11e9a6557d9a5c42b4052666fce32bc10;hp=dbd126433e529d583a06c79b59679572b06d4223;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Packets/SafeIterator.cci b/senf/Packets/SafeIterator.cci index dbd1264..0f24bb8 100644 --- a/senf/Packets/SafeIterator.cci +++ b/senf/Packets/SafeIterator.cci @@ -1,24 +1,29 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) -// Competence Center NETwork research (NET), St. Augustin, GERMANY -// Stefan Bund // -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. +// The contents of this file are subject to the Fraunhofer FOKUS Public License +// Version 1.0 (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// http://senf.berlios.de/license.html // -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// The Fraunhofer FOKUS Public License Version 1.0 is based on, +// but modifies the Mozilla Public License Version 1.1. +// See the full license text for the amendments. // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the -// Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Software distributed under the License is distributed on an "AS IS" basis, +// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +// for the specific language governing rights and limitations under the License. +// +// The Original Code is Fraunhofer FOKUS code. +// +// The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. +// (registered association), Hansastraße 27 c, 80686 Munich, Germany. +// All Rights Reserved. +// +// Contributor(s): +// Stefan Bund /** \file \brief SafeIterator inline non-template implementation */ @@ -28,9 +33,9 @@ // Custom includes #define prefix_ inline -///////////////////////////////cci.p/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::safe_data_iterator prefix_ senf::safe_data_iterator::safe_data_iterator() @@ -52,13 +57,13 @@ prefix_ senf::safe_data_iterator::safe_data_iterator(PacketParserBase const & p prefix_ senf::PacketData::iterator senf::safe_data_iterator::i() const { - SENF_ASSERT(data_); + SENF_ASSERT(data_, "Use/dereferencing of empty safe_data_iterator"); return boost::next(data_->begin(),i_); } prefix_ senf::safe_data_iterator & senf::safe_data_iterator::operator=(PacketData::iterator i) { - SENF_ASSERT(data_); + SENF_ASSERT(data_, "Use/dereferencing of empty safe_data_iterator"); i_ = std::distance(data_->begin(),i); return *this; } @@ -86,7 +91,7 @@ prefix_ bool senf::safe_data_iterator::boolean_test() prefix_ senf::PacketData & senf::safe_data_iterator::data() const { - SENF_ASSERT(data_); + SENF_ASSERT(data_, "Use/dereferencing of empty safe_data_iterator"); return *data_; } @@ -99,7 +104,7 @@ prefix_ senf::safe_data_iterator::value_type & senf::safe_data_iterator::derefer prefix_ bool senf::safe_data_iterator::equal(safe_data_iterator const & other) const { - SENF_ASSERT(data_ == other.data_); + SENF_ASSERT(data_ == other.data_, "Comparing iterators of two different containers is invalid"); return i_ == other.i_; } @@ -107,7 +112,7 @@ prefix_ senf::safe_data_iterator::difference_type senf::safe_data_iterator::distance_to(safe_data_iterator const & other) const { - SENF_ASSERT(data_ == other.data_); + SENF_ASSERT(data_ == other.data_, "Comparing iterators of two different containers is invalid"); return other.i_ - i_; } @@ -118,17 +123,17 @@ prefix_ void senf::safe_data_iterator::increment() prefix_ void senf::safe_data_iterator::decrement() { - SENF_ASSERT(i_>0); + SENF_ASSERT(i_>0, "Decrementing iterator before beginning of container" ); --i_; } prefix_ void senf::safe_data_iterator::advance(difference_type n) { - SENF_ASSERT( -n < difference_type(i_) ); + SENF_ASSERT( -n < difference_type(i_), "Moving iterator to before beginning of container" ); i_ += n; } -///////////////////////////////cci.e/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_