diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-08-21 18:11:46 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-10-11 18:53:06 +0200 |
commit | 7f5e51b940d65cf541403a50af74163b9aed5cb8 (patch) | |
tree | e540d3cd4d678cd276a9d496490ac5e527f30a78 /storage/ndb/src/kernel/vm/Array.hpp | |
parent | 57dd1f6f3fcbc7a46e1b3e71257987315f7aa687 (diff) | |
download | mariadb-git-7f5e51b940d65cf541403a50af74163b9aed5cb8.tar.gz |
MDEV-34 delete storage/ndb and sql/*ndb* (and collateral changes)
remove:
* NDB from everywhere
* IM from mtr-v1
* packaging/rpm-oel and packaging/rpm-uln
* few unused spec files
* plug.in file
* .bzrignore
Diffstat (limited to 'storage/ndb/src/kernel/vm/Array.hpp')
-rw-r--r-- | storage/ndb/src/kernel/vm/Array.hpp | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/storage/ndb/src/kernel/vm/Array.hpp b/storage/ndb/src/kernel/vm/Array.hpp deleted file mode 100644 index 7d9f955c296..00000000000 --- a/storage/ndb/src/kernel/vm/Array.hpp +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright (c) 2003, 2005 MySQL AB - Use is subject to license terms - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -#ifndef ARRAY_HPP -#define ARRAY_HPP - -#include "ArrayPool.hpp" - -#include <pc.hpp> -#include <ErrorReporter.hpp> - -/** - * Template class used for implementing an - * array of object retreived from a pool - */ -template <class T> -class Array { -public: - Array(ArrayPool<T> & thePool); - - /** - * Allocate an <b>n</b> objects from pool - * These can now be addressed with 0 <= ptr.i < n - */ - bool seize(Uint32 i); - - /** - * Release all object from array - */ - void release(); - - /** - * Return current size of array - */ - Uint32 getSize() const; - - /** - * empty - */ - inline bool empty() const { return sz == 0;} - - /** - * Update i & p value according to <b>i</b> - */ - void getPtr(Ptr<T> &, Uint32 i) const; - - /** - * Update p value for ptr according to i value - */ - void getPtr(Ptr<T> &) const ; - - /** - * Get pointer for i value - */ - T * getPtr(Uint32 i) const; - -private: - Uint32 base, sz; - ArrayPool<T> & thePool; -}; - -template<class T> -inline -Array<T>::Array(ArrayPool<T> & _pool) - : thePool(_pool) -{ - sz = 0; - base = RNIL; -} - -template<class T> -inline -bool -Array<T>::seize(Uint32 n){ - if(base == RNIL && n > 0){ - base = thePool.seizeN(n); - if(base != RNIL){ - sz = n; - return true; - } - return false; - } - ErrorReporter::handleAssert("Array<T>::seize failed", __FILE__, __LINE__); - return false; -} - -template<class T> -inline -void -Array<T>::release(){ - if(base != RNIL){ - thePool.releaseN(base, sz); - sz = 0; - base = RNIL; - return; - } -} - -template<class T> -inline -Uint32 -Array<T>::getSize() const { - return sz; -} - -template <class T> -inline -void -Array<T>::getPtr(Ptr<T> & p, Uint32 i) const { - p.i = i; -#ifdef ARRAY_GUARD - if(i < sz && base != RNIL){ - p.p = thePool.getPtr(i + base); - return; - } else { - ErrorReporter::handleAssert("Array::getPtr failed", __FILE__, __LINE__); - } -#endif - p.p = thePool.getPtr(i + base); -} - -template<class T> -inline -void -Array<T>::getPtr(Ptr<T> & ptr) const { -#ifdef ARRAY_GUARD - if(ptr.i < sz && base != RNIL){ - ptr.p = thePool.getPtr(ptr.i + base); - return; - } else { - ErrorReporter::handleAssert("Array<T>::getPtr failed", __FILE__, __LINE__); - } -#endif - ptr.p = thePool.getPtr(ptr.i + base); -} - -template<class T> -inline -T * -Array<T>::getPtr(Uint32 i) const { -#ifdef ARRAY_GUARD - if(i < sz && base != RNIL){ - return thePool.getPtr(i + base); - } else { - ErrorReporter::handleAssert("Array<T>::getPtr failed", __FILE__, __LINE__); - } -#endif - return thePool.getPtr(i + base); -} - - -#endif |