00001 /* 00002 * Copyright (C) 2006-2011, SRI International (R) 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU Lesser General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #pragma once 00019 00020 #ifndef __OpenKarto_Pair_h__ 00021 #define __OpenKarto_Pair_h__ 00022 00023 #include <OpenKarto/Types.h> 00024 00025 namespace karto 00026 { 00027 00029 00030 00035 template<typename U, typename V> 00036 class Pair 00037 { 00038 public: 00042 Pair() 00043 { 00044 } 00045 00051 Pair(const U& rFirst, const V& rSecond) 00052 { 00053 m_First = rFirst; 00054 m_Second = rSecond; 00055 } 00056 00061 inline U& GetFirst() 00062 { 00063 return m_First; 00064 } 00065 00070 inline const U& GetFirst() const 00071 { 00072 return m_First; 00073 } 00074 00079 inline V& GetSecond() 00080 { 00081 return m_Second; 00082 } 00083 00088 inline const V& GetSecond() const 00089 { 00090 return m_Second; 00091 } 00092 00096 inline kt_bool operator==(const Pair& rPair) 00097 { 00098 return (m_First == rPair.m_First) && (m_Second == rPair.m_Second); 00099 } 00100 00101 private: 00102 U m_First; 00103 V m_Second; 00104 }; 00105 00107 00108 } 00109 00110 #endif // __OpenKarto_Pair_h__