yat
0.8.3pre
|
00001 #ifndef _theplu_yat_utility_index_ 00002 #define _theplu_yat_utility_index_ 00003 00004 // $Id: Index.h 2119 2009-12-12 23:11:43Z peter $ 00005 00006 /* 00007 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 00008 Copyright (C) 2009 Peter Johansson 00009 00010 This file is part of the yat library, http://dev.thep.lu.se/yat 00011 00012 The yat library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU General Public License as 00014 published by the Free Software Foundation; either version 3 of the 00015 License, or (at your option) any later version. 00016 00017 The yat library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with yat. If not, see <http://www.gnu.org/licenses/>. 00024 */ 00025 00026 #include "SmartPtr.h" 00027 00028 #include <vector> 00029 00030 namespace theplu { 00031 namespace yat { 00032 namespace utility { 00033 00041 class Index 00042 { 00043 public: 00049 typedef std::vector<size_t>::const_iterator const_iterator; 00050 00054 Index(void); 00055 00060 explicit Index(size_t n); 00061 00065 Index(const Index& a, const Index& b); 00066 00070 explicit Index(const SmartPtr<const std::vector<size_t> >& vec); 00071 00077 explicit Index(const std::vector<size_t>& vec); 00078 00084 const_iterator begin(void) const; 00085 00091 const_iterator end(void) const; 00092 00096 const size_t& operator[](size_t) const; 00097 00101 size_t size(void) const; 00102 00106 const std::vector<size_t>& vector(void) const; 00107 00108 private: 00109 // using compiler generated copy 00110 // Index(const Index&); 00111 // const Index& operator=(const Index&); 00112 00113 SmartPtr<const std::vector<size_t> > index_; 00114 }; 00115 00116 }}} // of namespace utility, yat, and theplu 00117 00118 #endif