Matrix.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *
00003  * Copyright (C) 2009-2010 Cassio Neri Moreira
00004  *
00005  * This file is part of the KeyValue library.
00006  *
00007  * The KeyValue library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License as published
00009  * by the Free Software Foundation, either version 3 of the License, or (at
00010  * your option) any later version.
00011  *
00012  * The KeyValue library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00015  * Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License along
00018  * with KeyValue. If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  **************************************************************************/
00021 
00028 #ifndef KEYVALUE_VALUE_MATRIX_H_
00029 #define KEYVALUE_VALUE_MATRIX_H_
00030 
00031 #include <iosfwd>
00032 #include <boost/intrusive_ptr.hpp>
00033 
00034 #include "keyvalue/value/Variant.h"
00035 
00036 namespace keyvalue {
00037 namespace value {
00038 
00057 class Matrix {
00058 
00059 public:
00060 
00071   explicit
00072   Matrix(size_t nRows = 1, size_t nCols = 1);
00073 
00079   size_t
00080   getNRows() const;
00081 
00087   size_t
00088   getNCols() const;
00089 
00106    void
00107    resize(size_t nRows, size_t nCols);
00108 
00124   const Variant&
00125   operator()(size_t i, size_t j) const;
00126 
00130   Variant&
00131   operator()(size_t i, size_t j);
00132 
00153   bool
00154   operator==(const Matrix& rhs) const;
00155 
00156 protected:
00157 
00177   void
00178   transposeVector();
00179 
00180 private:
00181 
00189   struct Impl;
00190   boost::intrusive_ptr<Impl> pimpl_;
00191 
00192   friend void
00193   intrusive_ptr_add_ref(Matrix::Impl* pimpl);
00194 
00195   friend void
00196   intrusive_ptr_release(Matrix::Impl* pimpl);
00197 };
00198 
00208 void
00209 intrusive_ptr_add_ref(Matrix::Impl* pimpl);
00210 
00220 void
00221 intrusive_ptr_release(Matrix::Impl* pimpl);
00222 
00228 std::ostream&
00229 operator<<(std::ostream& os, const Matrix& matrix);
00230 
00231 } // namespace value
00232 } // namespace keyvalue
00233 
00234 #endif // KEYVALUE_VALUE_MATRIX_H_

Generated on Sat Mar 20 15:08:29 2010 for KeyValue by  doxygen 1.6.1