DataPointStlVector.hpp

Go to the documentation of this file.
00001 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00002 //
00003 //        This file is part of E-Cell Simulation Environment package
00004 //
00005 //                Copyright (C) 2000-2002 Keio University
00006 //
00007 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00008 //
00009 //
00010 // E-Cell is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2 of the License, or (at your option) any later version.
00014 // 
00015 // E-Cell is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00018 // See the GNU General Public License for more details.
00019 // 
00020 // You should have received a copy of the GNU General Public
00021 // License along with E-Cell -- see the file COPYING.
00022 // If not, write to the Free Software Foundation, Inc.,
00023 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024 // 
00025 //END_HEADER
00026 //
00027 // written by Masayuki Okayama <smash@e-cell.org>,
00028 // E-Cell Project.
00029 //
00030 
00031 
00032 #if !defined(__DATAPOINT_STL_VECTOR_HPP)
00033 #define __DATAPOINT_STL_VECTOR_HPP
00034 
00035 #include <vector>
00036 #include <algorithm>
00037 
00038 #include "libecs.hpp"
00039 
00040 #include "DataPoint.hpp"
00041 
00042 namespace libecs
00043 {
00044 
00045   /** @addtogroup logging
00046    *@{
00047    */
00048 
00049   /** @file */
00050 
00051 
00052   DECLARE_CLASS(DataPointStlVector);
00053   DECLARE_TYPE(DataPoint,Containee);
00054   DECLARE_VECTOR(Containee,Container);
00055 
00056 
00057   class DataPointStlVector
00058   {
00059 
00060   public:
00061 
00062     typedef Container::const_iterator  const_iterator;
00063     typedef Container::iterator        iterator;
00064     typedef Container::const_reference const_reference;
00065     typedef Container::reference       reference;
00066     typedef Container::size_type       size_type;
00067     
00068     explicit DataPointStlVector( void )
00069     {
00070       ; // do nothing
00071     }
00072 
00073     DataPointStlVector( const_iterator start, const_iterator end )
00074       :
00075       theContainer( start, end )
00076     {
00077       ; // do nothing
00078     }
00079 
00080 
00081     DataPointStlVector( DataPointStlVectorCref vector )
00082       :
00083       theContainer( vector.getContainer() )
00084     {
00085       ; // do nothing
00086     }
00087 
00088     DataPointStlVector( DataPointStlVectorRef vector )
00089       :
00090       theContainer( vector.getContainer() )
00091     {
00092       ; // do nothing
00093     }
00094 
00095 
00096     ~DataPointStlVector(void);
00097 
00098     ContainerCref getContainer() const
00099     {
00100       return theContainer;
00101     }
00102 
00103     bool empty() const
00104     {
00105       return theContainer.empty();
00106     }
00107 
00108     size_type size() const
00109     {
00110       return theContainer.size();
00111     }
00112 
00113     const_iterator begin() const
00114     {
00115       return theContainer.begin();
00116     }
00117 
00118     const_iterator end() const
00119     {
00120       return theContainer.end();
00121     }
00122 
00123     const_reference front() const
00124     {
00125       return theContainer.front();
00126     }
00127 
00128     const_reference back() const
00129     {
00130       return theContainer.back();
00131     }
00132 
00133     iterator begin()
00134     {
00135       return theContainer.begin();
00136     }
00137 
00138     iterator end()
00139     {
00140       return theContainer.end();
00141     }
00142 
00143     reference back()
00144     {
00145       return theContainer.back();
00146     }
00147 
00148 
00149     void push( ContaineeRef aRef )
00150     {
00151       theContainer.push_back( aRef );
00152     }
00153 
00154     void push( ContaineeCref aCref )
00155     {
00156       theContainer.push_back( aCref );
00157     }
00158 
00159     void push( ContaineePtr aPtr )
00160     {
00161       theContainer.push_back( *aPtr );
00162     }
00163 
00164 
00165     void push( RealParam t, PolymorphCref v )
00166     {
00167       theContainer.push_back( Containee( t, v ) );
00168     }
00169 
00170     void push( RealParam t, RealParam v )
00171     {
00172       theContainer.push_back( Containee( t, v ) );
00173     }
00174 
00175     static const_iterator lower_bound( const_iterator first,
00176                                        const_iterator last,
00177                                        RealParam aTime ) 
00178     {
00179       return std::lower_bound( first, last, aTime );
00180     }
00181 
00182     static const_iterator upper_bound( const_iterator first,
00183                                        const_iterator last,
00184                                        RealParam aTime ) 
00185     {
00186       return std::upper_bound( first, last, aTime );
00187     }
00188 
00189 
00190   private:
00191     Container theContainer;
00192 
00193 
00194   };
00195 
00196   //@}
00197 
00198 } // namespace libecs
00199 
00200 #endif /* __DATAPOINT_STL_VECTOR_HPP */

Generated on Mon Dec 18 07:24:07 2006 for E-CELL C++ libraries (libecs and libemc) 3.1.105 by  doxygen 1.5.1