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_MONOMER_CONTAINER_H 00028 #define BTK_MONOMER_CONTAINER_H 00029 00030 00031 #include "monomer.h" 00032 00033 #include <boost/concept_check.hpp> 00034 00035 namespace BTK { 00036 00044 template <typename MonomerType> 00045 class MonomerContainer : public SharedVectorBase<MonomerType> { 00046 BOOST_CLASS_REQUIRE2( MonomerType, basic_monomer, boost, ConvertibleConcept); 00047 00048 typedef SharedVectorBase<MonomerType> base_type; 00049 typedef MonomerContainer<MonomerType> self_type; 00050 public: 00051 00053 00054 typedef typename base_type::value_type value_type; 00055 typedef typename base_type::reference reference; 00056 typedef typename base_type::const_reference const_reference; 00057 typedef typename base_type::pointer pointer; 00058 typedef typename base_type::const_pointer const_pointer; 00059 typedef typename base_type::size_type size_type; 00060 typedef typename base_type::iterator iterator; 00061 typedef typename base_type::const_iterator const_iterator; 00063 00065 00066 typedef value_type monomer_type; 00067 typedef iterator monomer_iterator; 00068 typedef const_iterator const_monomer_iterator; 00070 00071 00073 MonomerContainer(size_type s = 0) : base_type(s) {} 00074 00075 template <typename InputIterator> 00076 MonomerContainer(InputIterator first,InputIterator last) : base_type(first,last) {} 00077 00078 MonomerContainer(const self_type& source) : base_type(source) {} 00079 00080 template <typename T2> 00081 MonomerContainer(const MonomerContainer<T2>& source) : base_type(source) {} 00082 00083 ~MonomerContainer() {} 00084 00085 00087 self_type& operator=(const self_type& rhs) { 00088 if (&rhs == this) return *this; 00089 base_type::operator=(rhs); 00090 return *this; 00091 } 00092 00093 template <typename T2> 00094 self_type& operator=(const MonomerContainer<T2>& rhs) { 00095 base_type::operator=(rhs); 00096 return *this; 00097 } 00098 00099 00100 00102 00103 size_type monomer_size() const { return this->size(); } 00104 00105 iterator monomer_begin() { return this->begin(); } 00106 const_iterator monomer_begin() const { return this->begin(); } 00107 00108 iterator monomer_end() { return this->end(); } 00109 const_iterator monomer_end() const { return this->end(); } 00110 00111 reference monomer(size_type i) { return this->operator[](i); } 00112 const_reference monomer(size_type i) const { return this->operator[](i); } 00113 00114 reference monomer_back() { return this->back(); } 00115 const_reference monomer_back() const { return this->back(); } 00116 00117 reference monomer_front() { return this->front(); } 00118 const_reference monomer_front() const { return this->front(); } 00120 00121 }; 00122 00123 } // namespace BTK 00124 00125 00126 #endif
1.3.6