00001 // -*- mode: c++; indent-tabs-mode: nil; -*- 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) 2006, Tim Robertson <kid50@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 00023 00024 #ifndef BTK_IO_TYPE_SYSTEM_PROXY_HPP 00025 #define BTK_IO_TYPE_SYSTEM_PROXY_HPP 00026 00027 #include <boost/shared_ptr.hpp> 00028 00029 namespace BTK { 00030 namespace IO { 00031 00050 template <typename TS> 00051 class TypeSystemProxy 00052 { 00053 public: 00054 typedef TS type_system; 00055 typedef TypeSystemProxy<type_system> self_type; 00056 00058 00059 typedef typename type_system::element_dictionary element_dictionary; 00060 typedef typename type_system::atom_dictionary atom_dictionary; 00061 typedef typename type_system::monomer_dictionary monomer_dictionary; 00062 typedef typename type_system::structure_dictionary structure_dictionary; 00063 00064 typedef typename element_dictionary::id_type element_id_type; 00065 typedef typename atom_dictionary::id_type atom_id_type; 00066 typedef typename monomer_dictionary::id_type monomer_id_type; 00067 typedef typename structure_dictionary::id_type structure_id_type; 00069 00072 TypeSystemProxy() : 00073 _ptr(new type_system()) {} 00074 00078 TypeSystemProxy(self_type const & src) : 00079 _ptr(src._ptr) {} 00080 00085 TypeSystemProxy(type_system const & ts) : 00086 _ptr(new type_system(ts)) {} 00087 00089 00090 element_dictionary & get_element_dictionary() 00091 { return _ptr->get_element_dictionary(); } 00092 atom_dictionary & get_atom_dictionary() 00093 { return _ptr->get_atom_dictionary(); } 00094 monomer_dictionary & get_monomer_dictionary() 00095 { return _ptr->get_monomer_dictionary(); } 00096 structure_dictionary & get_structure_dictionary() 00097 { return _ptr->get_structure_dictionary(); } 00098 00099 00100 element_dictionary const & get_element_dictionary() const 00101 { return _ptr->get_element_dictionary(); } 00102 atom_dictionary const & get_atom_dictionary() const 00103 { return _ptr->get_atom_dictionary(); } 00104 monomer_dictionary const & get_monomer_dictionary() const 00105 { return _ptr->get_monomer_dictionary(); } 00106 structure_dictionary const & get_structure_dictionary() const 00107 { return _ptr->get_structure_dictionary(); } 00109 00111 self_type clone() const 00112 { 00113 return self_type(*_ptr); 00114 } 00115 00116 bool operator==(self_type const & rhs) const 00117 { 00118 return _ptr == rhs._ptr; 00119 } 00120 00121 bool operator!=(self_type const & rhs) const 00122 { 00123 return _ptr != rhs._ptr; 00124 } 00125 00126 private: 00127 boost::shared_ptr<type_system> _ptr; 00128 }; 00129 00130 } // namespace IO 00131 } // namespace BTK 00132 00133 #endif