X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPackets%2FListBParser.cti;h=5c2deb94a0e8f1c666e6b6257e74b565dac668ef;hb=HEAD;hp=ac603c3551f7e550cfa422d92991fb08dce27264;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Packets/ListBParser.cti b/senf/Packets/ListBParser.cti index ac603c3..5c2deb9 100644 --- a/senf/Packets/ListBParser.cti +++ b/senf/Packets/ListBParser.cti @@ -2,23 +2,28 @@ // // Copyright (C) 2007 // 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 ListBParser inline template implementation */ @@ -28,9 +33,9 @@ // Custom includes #define prefix_ inline -///////////////////////////////cti.p/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::detail::ListBParser_Policy template @@ -70,29 +75,16 @@ prefix_ void senf::detail::ListBParser_Policy::init(dat AuxPolicy::aux(0,i,s); } -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::detail::ListBParser_Policy template -prefix_ -senf::detail::ListBParser_Policy::container_policy:: -container_policy(parser_policy const & p) - : AuxPolicy (p) -{ - data_iterator const e (boost::next(parser_type::get(p).i(),parser_type::get(p).bytes())); - data_iterator i (AuxPolicy::adjust(parser_type::get(p).i(), parser_type::get(p).state())); - for( n_=0; i!=e; - ++n_, std::advance(i,senf::bytes(ElementParser(i,parser_type::get(p).state())))) ; - container_size_ = parser_type::get(p).data().size(); -} - -template prefix_ typename senf::detail::ListBParser_Policy::container_policy::size_type senf::detail::ListBParser_Policy::container_policy::bytes(data_iterator i, state_type s) const { - return AuxPolicy::aux(i,s) + AuxPolicy::aux_bytes; + return AuxPolicy::WrapperPolicy::aux(i,s) + AuxPolicy::aux_bytes; } template @@ -110,15 +102,30 @@ init(data_iterator i, state_type s) { n_ = 0; container_size_ = s->size(); - AuxPolicy::aux(0,i,s); + AuxPolicy::WrapperPolicy::aux(0,i,s); } template +prefix_ void +senf::detail::ListBParser_Policy::container_policy:: +construct(container_type & c) + const +{} + +template +prefix_ void +senf::detail::ListBParser_Policy::container_policy:: +destruct(container_type & c) + const +{} + +template prefix_ void senf::detail::ListBParser_Policy::container_policy:: erase(container_type & c, data_iterator p) { size_type b (senf::bytes(ElementParser(p,c.state()))); - AuxPolicy::aux( AuxPolicy::aux(c.i(), c.state())-b, c.i(), c.state()); + AuxPolicy::WrapperPolicy::aux( + AuxPolicy::WrapperPolicy::aux(c.i(), c.state())-b, c.i(), c.state()); --n_; // The container will be reduced by b bytes directly after this call container_size_ = c.data().size()-b; @@ -130,7 +137,8 @@ senf::detail::ListBParser_Policy::container_policy:: insert(container_type & c, data_iterator p) { size_type b (senf::bytes(ElementParser(p,c.state()))); - AuxPolicy::aux( AuxPolicy::aux(c.i(), c.state())+b, c.i(), c.state()); + AuxPolicy::WrapperPolicy::aux( + AuxPolicy::WrapperPolicy::aux(c.i(), c.state())+b, c.i(), c.state()); ++n_; container_size_ = c.data().size(); } @@ -143,10 +151,14 @@ update(container_type const & c) { if (container_size_ == c.data().size()) return; - data_iterator i (AuxPolicy::adjust(c.i(), c.state())); +#if 1 + data_iterator i (AuxPolicy::WrapperPolicy::adjust(c.i(), c.state())); data_iterator j (i); for (size_type n (n_); n; --n, std::advance(j,senf::bytes(ElementParser(j,c.state())))) ; - aux( std::distance(i,j), c.i(), c.state() ); + AuxPolicy::WrapperPolicy::aux( std::distance(i,j), c.i(), c.state() ); +#else + AuxPolicy::WrapperPolicy::aux( aux(c.i(),c.state()) + c.data().size() - container_size_, c.i(), c.state() ); +#endif container_size_ = c.data().size(); } @@ -156,7 +168,7 @@ senf::detail::ListBParser_Policy::container_policy:: setBegin(container_type const & c, iterator_data & d) const { - return AuxPolicy::adjust(c.i(), c.state()); + return AuxPolicy::WrapperPolicy::adjust(c.i(), c.state()); } template @@ -165,7 +177,7 @@ senf::detail::ListBParser_Policy::container_policy:: setEnd(container_type const & c, iterator_data & d) const { - return boost::next(AuxPolicy::adjust(c.i(), c.state()),aux(c.i(),c.state())); + return boost::next(AuxPolicy::WrapperPolicy::adjust(c.i(), c.state()),AuxPolicy::WrapperPolicy::aux(c.i(),c.state())); } template @@ -182,7 +194,7 @@ next(container_type const & c, iterator_data & d) const { return boost::next( container_type::iterator::get(d).i(), - senf::bytes(ElementParser( container_type::iterator::get(d).i(), + senf::bytes(ElementParser( container_type::iterator::get(d).i(), c.state() )) ); } @@ -195,7 +207,7 @@ raw(container_type const & c, iterator_data const & d) return container_type::iterator::get(d).i(); } -///////////////////////////////cti.e/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_