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

atom_index_pair.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 
00022 
00023 #ifndef BTK_ATOM_INDEX_PAIR_H
00024 #define BTK_ATOM_INDEX_PAIR_H
00025 
00026 #include "atom_types.h"
00027 
00028 #include <algorithm>
00029 #include <utility>
00030 
00031 
00032 namespace BTK{
00033 
00034   struct AtomIndexPair {
00035     typedef std::pair<int,ATOM::index_t> monomer_atom_idx_t;
00036 
00037     AtomIndexPair() {}
00038     
00039     AtomIndexPair(monomer_atom_idx_t atom_index1,
00040                   monomer_atom_idx_t atom_index2)
00041       : _atom_index1(atom_index1),
00042         _atom_index2(atom_index2)
00043     {
00044       if(_atom_index1>_atom_index2) std::swap(_atom_index1,_atom_index2);
00045     }
00046 
00047     bool
00048     operator<(const AtomIndexPair& right) const
00049     {
00050       if ( _atom_index1 == right._atom_index1 )
00051         return _atom_index2 < right._atom_index2;
00052       else 
00053         return _atom_index1 < right._atom_index1;
00054     }
00055 
00056     monomer_atom_idx_t atom_index1() const { return _atom_index1; }
00057     monomer_atom_idx_t atom_index2() const { return _atom_index2; }
00058     
00059   private:
00060     monomer_atom_idx_t _atom_index1;
00061     monomer_atom_idx_t _atom_index2;
00062   };
00063 
00064 }
00065 
00066 #endif
00067 
00068 

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