From: <ust...@us...> - 2008-06-26 16:41:16
|
Revision: 2674 http://clucene.svn.sourceforge.net/clucene/?rev=2674&view=rev Author: ustramooner Date: 2008-06-26 09:40:17 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Added Paths: ----------- branches/lucene2_3_2/src/CLucene/util/Array.h Removed Paths: ------------- branches/lucene2_3_2/src/CLucene/util/_Array.h Copied: branches/lucene2_3_2/src/CLucene/util/Array.h (from rev 2668, branches/lucene2_3_2/src/CLucene/util/_Array.h) =================================================================== --- branches/lucene2_3_2/src/CLucene/util/Array.h (rev 0) +++ branches/lucene2_3_2/src/CLucene/util/Array.h 2008-06-26 16:40:17 UTC (rev 2674) @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------------ +* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team +* +* Distributable under the terms of either the Apache License (Version 2.0) or +* the GNU Lesser General Public License, as specified in the COPYING file. +------------------------------------------------------------------------------*/ +#ifndef _lucene_util_Array_ +#define _lucene_util_Array_ + + +template<typename T> +class CLUCENE_EXPORT Array: LUCENE_BASE{ +public: + T* values; + size_t length; + + void deleteAll(){ + for (size_t i=0;i<length;i++) + _CLDELETE(values[i]); + _CLDELETE_ARRAY(values); + } + void deleteArray(){ + _CLDELETE_ARRAY(values); + } + + Array(){ + values = NULL; + length = 0; + } + Array(T* values, size_t length){ + this->values = values; + this->length = length; + } + Array(size_t length){ + this->values = _CL_NEWARRAY(T,length); + this->length = length; + } + ~Array(){} + + const T operator[](size_t _Pos) const + { + if (length <= _Pos){ + _CLTHROWA(CL_ERR_IllegalArgument,"vector subscript out of range"); + } + return (*(values + _Pos)); + } + T operator[](size_t _Pos) + { + if (length <= _Pos){ + _CLTHROWA(CL_ERR_IllegalArgument,"vector subscript out of range"); + } + return (*(values + _Pos)); + } + +}; + +#endif Deleted: branches/lucene2_3_2/src/CLucene/util/_Array.h =================================================================== --- branches/lucene2_3_2/src/CLucene/util/_Array.h 2008-06-26 16:39:02 UTC (rev 2673) +++ branches/lucene2_3_2/src/CLucene/util/_Array.h 2008-06-26 16:40:17 UTC (rev 2674) @@ -1,57 +0,0 @@ -/*------------------------------------------------------------------------------ -* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team -* -* Distributable under the terms of either the Apache License (Version 2.0) or -* the GNU Lesser General Public License, as specified in the COPYING file. -------------------------------------------------------------------------------*/ -#ifndef _lucene_util_Array_ -#define _lucene_util_Array_ - - -template<typename T> -class CLUCENE_EXPORT Array: LUCENE_BASE{ -public: - T* values; - size_t length; - - void deleteAll(){ - for (size_t i=0;i<length;i++) - _CLDELETE(values[i]); - _CLDELETE_ARRAY(values); - } - void deleteArray(){ - _CLDELETE_ARRAY(values); - } - - Array(){ - values = NULL; - length = 0; - } - Array(T* values, size_t length){ - this->values = values; - this->length = length; - } - Array(size_t length){ - this->values = _CL_NEWARRAY(T,length); - this->length = length; - } - ~Array(){} - - const T operator[](size_t _Pos) const - { - if (length <= _Pos){ - _CLTHROWA(CL_ERR_IllegalArgument,"vector subscript out of range"); - } - return (*(values + _Pos)); - } - T operator[](size_t _Pos) - { - if (length <= _Pos){ - _CLTHROWA(CL_ERR_IllegalArgument,"vector subscript out of range"); - } - return (*(values + _Pos)); - } - -}; - -#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |