// $Id$ // // Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // 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. // // 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. // // 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. // Definition of inline template functions #include "ParseArray.ih" // Custom includes #include #if defined(_STLP_ALGORITHM) || (__GNUC__<4 && __GNUC_MINOR__<4) #define copy_n std::copy_n #else #include #define copy_n __gnu_cxx::copy_n #endif #define prefix_ inline ///////////////////////////////cti.p/////////////////////////////////////// template prefix_ senf::Parse_Array::Parse_Array() {} template prefix_ senf::Parse_Array::Parse_Array(Iterator const & i) : ParserBase(i) {} template prefix_ unsigned senf::Parse_Array::bytes() { return elements*Parser::bytes(); } template prefix_ bool senf::Parse_Array::check(Iterator const & e) const { return e-this->i() >= bytes(); } template prefix_ void senf::Parse_Array::init() const { iterator e=end(); for (iterator i=begin(); i!=e; ++i) i->init(); } /////////////////////////////////////////////////////////////////////////// template prefix_ typename senf::Parse_Array::size_type senf::Parse_Array::size() { return elements; } template prefix_ typename senf::Parse_Array::iterator senf::Parse_Array::begin() const { return iterator(this->i()); } template prefix_ typename senf::Parse_Array::iterator senf::Parse_Array::end() const { return iterator(this->i()+bytes()); } template prefix_ typename senf::Parse_Array::range_type senf::Parse_Array::range() const { return std::make_pair(begin(),end()); } template prefix_ typename senf::Parse_Array::iterator senf::Parse_Array::value() const { return begin(); } template prefix_ typename senf::Parse_Array::value_type senf::Parse_Array::operator[](difference_type i) const { return begin()[i]; } template template prefix_ senf::Parse_Array const & senf::Parse_Array::operator=(InputIterator const & i) { copy_n(i,size(),begin()); } /////////////////////////////////////////////////////////////////////////// template prefix_ Iterator senf::impl::Parse_Array_iterator::raw() const { return i_; } template prefix_ Parser senf::impl::Parse_Array_iterator::operator[](int i) const { return (*this+i).dereference(); } template prefix_ senf::impl::Parse_Array_iterator::Parse_Array_iterator() : i_() {} template prefix_ senf::impl::Parse_Array_iterator:: Parse_Array_iterator(Iterator const & i) : i_(i) {} template prefix_ Parser senf::impl::Parse_Array_iterator::dereference() const { return Parser(i_); } template prefix_ bool senf::impl::Parse_Array_iterator:: equal(Parse_Array_iterator const & other) const { return i_==other.i_; } template prefix_ int senf::impl::Parse_Array_iterator:: distance_to(Parse_Array_iterator const & other) const { return (other.i_-i_)/Parser::bytes(); } template prefix_ void senf::impl::Parse_Array_iterator::increment() { i_ += Parser::bytes(); } template prefix_ void senf::impl::Parse_Array_iterator::decrement() { i_ -= Parser::bytes(); } template prefix_ void senf::impl::Parse_Array_iterator::advance(int n) { i_ += n*Parser::bytes(); } #undef copy_n ///////////////////////////////cti.e/////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // End: