Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

shared_vector.h

Go to the documentation of this file.
00001 // -*- mode: c++; -*-
00002 //
00003 //The Biomolecule Toolkit (BTK) is a C++ library for use in the
00004 //modeling, analysis, and design of biological macromolecules.
00005 //Copyright (C) 2004, Christopher Saunders <ctsa@users.sourceforge.net>
00006 //
00007 //This program is free software; you can redistribute it and/or modify
00008 //it under the terms of the GNU Lesser General Public License as published
00009 //by the Free Software Foundation; either version 2.1 of the License, or (at
00010 //your option) any later version.
00011 //
00012 //This program is distributed in the hope that it will be useful,  but
00013 //WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //Lesser General Public License for more details. 
00016 //
00017 //You should have received a copy of the GNU Lesser General Public License 
00018 //along with this program; if not, write to the Free Software Foundation, 
00019 //Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00021 
00027 #ifndef BTK_SHARED_VECTOR_H
00028 #define BTK_SHARED_VECTOR_H
00029 
00030 #include "shared_vector_base.h"
00031 
00032 
00033 namespace BTK {
00034 
00044 template <typename T> 
00045 class SharedVector : public SharedVectorBase<T> {
00046   typedef SharedVectorBase<T> base_type;
00047 public:
00048   typedef SharedVector<T> self_type;
00049 
00051 
00052   typedef typename base_type::value_type value_type;
00053   typedef typename base_type::reference reference;
00054   typedef typename base_type::const_reference const_reference;
00055   typedef typename base_type::pointer pointer;
00056   typedef typename base_type::const_pointer const_pointer;
00057   typedef typename base_type::size_type size_type;
00058   typedef typename base_type::iterator iterator;
00059   typedef typename base_type::const_iterator const_iterator;
00061 
00063   SharedVector(size_type s = 0) : base_type(s) {}
00064 
00065   template <typename InputIterator>
00066   SharedVector(InputIterator first, InputIterator last) : base_type(first,last) {}
00067   
00068   SharedVector(const self_type& source) : base_type(source) {}
00069 
00070   template <typename T2>
00071   SharedVector(const SharedVector<T2>& source) : base_type(source) {}
00072 
00073   ~SharedVector() {}
00074 
00076   self_type& operator=(const self_type& rhs) {
00077     if (&rhs == this) return *this;
00078     base_type::operator=(rhs);
00079     return *this;
00080   }
00081 
00082   template <typename T2>
00083   self_type& operator=(const SharedVector<T2>& rhs) {
00084     base_type::operator=(rhs);
00085     return *this;
00086   }
00087 
00088   // protected->public
00089   using base_type::clear;
00090   using base_type::resize;
00091   using base_type::reserve;
00092   using base_type::push_back;
00093   using base_type::insert;
00094   using base_type::erase;
00095   using base_type::shallow_push_back;
00096   using base_type::shallow_insert;
00097   using base_type::shallow_copy;
00098 
00099   template <typename InputIterator>
00100   void insert(iterator pos,
00101               InputIterator first,
00102               InputIterator last) { base_type::insert(pos,first,last); }
00103 
00104 };
00105 
00106 } // namespace BTK
00107 
00108 #endif

Generated on Wed Apr 14 00:43:18 2004 for BTK by doxygen 1.3.6