[658] | 1 | /***************************************************************************
|
---|
| 2 | * blitz/array/slice.h Helper classes for slicing arrays
|
---|
| 3 | *
|
---|
| 4 | * $Id: slice.h,v 1.1.1.1 1999-11-26 16:37:07 ansari Exp $
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca>
|
---|
| 7 | *
|
---|
| 8 | * This program is free software; you can redistribute it and/or
|
---|
| 9 | * modify it under the terms of the GNU General Public License
|
---|
| 10 | * as published by the Free Software Foundation; either version 2
|
---|
| 11 | * of the License, or (at your option) any later version.
|
---|
| 12 | *
|
---|
| 13 | * This program is distributed in the hope that it will be useful,
|
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 16 | * GNU General Public License for more details.
|
---|
| 17 | *
|
---|
| 18 | * Suggestions: blitz-suggest@cybervision.com
|
---|
| 19 | * Bugs: blitz-bugs@cybervision.com
|
---|
| 20 | *
|
---|
| 21 | * For more information, please see the Blitz++ Home Page:
|
---|
| 22 | * http://seurat.uwaterloo.ca/blitz/
|
---|
| 23 | *
|
---|
| 24 | ***************************************************************************
|
---|
| 25 | * $Log: not supported by cvs2svn $
|
---|
| 26 | * Revision 1.1.1.1 1999/04/09 17:59:04 ansari
|
---|
| 27 | * Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99
|
---|
| 28 | *
|
---|
| 29 | * Revision 1.2 1998/03/14 00:04:47 tveldhui
|
---|
| 30 | * 0.2-alpha-05
|
---|
| 31 | *
|
---|
| 32 | * Revision 1.1 1997/07/16 14:51:20 tveldhui
|
---|
| 33 | * Update: Alpha release 0.2 (Arrays)
|
---|
| 34 | *
|
---|
| 35 | */
|
---|
| 36 |
|
---|
| 37 | #ifndef BZ_ARRAYSLICE_H
|
---|
| 38 | #define BZ_ARRAYSLICE_H
|
---|
| 39 |
|
---|
| 40 | #ifndef BZ_ARRAY_H
|
---|
| 41 | #error <blitz/array/slice.h> must be included via <blitz/array.h>
|
---|
| 42 | #endif
|
---|
| 43 |
|
---|
| 44 | BZ_NAMESPACE(blitz)
|
---|
| 45 |
|
---|
| 46 | // Forward declaration
|
---|
| 47 | template<class T, int N>
|
---|
| 48 | class Array;
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | class nilArraySection { };
|
---|
| 53 |
|
---|
| 54 | template<class T>
|
---|
| 55 | class ArraySectionInfo {
|
---|
| 56 | public:
|
---|
| 57 | enum { isValidType = 0, rank = 0, isPick = 0 };
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | template<>
|
---|
| 61 | class ArraySectionInfo<Range> {
|
---|
| 62 | public:
|
---|
| 63 | enum { isValidType = 1, rank = 1, isPick = 0 };
|
---|
| 64 | };
|
---|
| 65 |
|
---|
| 66 | template<>
|
---|
| 67 | class ArraySectionInfo<int> {
|
---|
| 68 | public:
|
---|
| 69 | enum { isValidType = 1, rank = 0, isPick = 0 };
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 | template<>
|
---|
| 73 | class ArraySectionInfo<nilArraySection> {
|
---|
| 74 | public:
|
---|
| 75 | enum { isValidType = 1, rank = 0, isPick = 0 };
|
---|
| 76 | };
|
---|
| 77 |
|
---|
| 78 | template<class T_numtype, class T1, class T2 = nilArraySection,
|
---|
| 79 | class T3 = nilArraySection, class T4 = nilArraySection,
|
---|
| 80 | class T5 = nilArraySection, class T6 = nilArraySection,
|
---|
| 81 | class T7 = nilArraySection, class T8 = nilArraySection,
|
---|
| 82 | class T9 = nilArraySection, class T10 = nilArraySection,
|
---|
| 83 | class T11 = nilArraySection>
|
---|
| 84 | class SliceInfo {
|
---|
| 85 | public:
|
---|
| 86 | enum {
|
---|
| 87 | numValidTypes = ArraySectionInfo<T1>::isValidType
|
---|
| 88 | + ArraySectionInfo<T2>::isValidType
|
---|
| 89 | + ArraySectionInfo<T3>::isValidType
|
---|
| 90 | + ArraySectionInfo<T4>::isValidType
|
---|
| 91 | + ArraySectionInfo<T5>::isValidType
|
---|
| 92 | + ArraySectionInfo<T6>::isValidType
|
---|
| 93 | + ArraySectionInfo<T7>::isValidType
|
---|
| 94 | + ArraySectionInfo<T8>::isValidType
|
---|
| 95 | + ArraySectionInfo<T9>::isValidType
|
---|
| 96 | + ArraySectionInfo<T10>::isValidType
|
---|
| 97 | + ArraySectionInfo<T11>::isValidType,
|
---|
| 98 |
|
---|
| 99 | rank = ArraySectionInfo<T1>::rank
|
---|
| 100 | + ArraySectionInfo<T2>::rank
|
---|
| 101 | + ArraySectionInfo<T3>::rank
|
---|
| 102 | + ArraySectionInfo<T4>::rank
|
---|
| 103 | + ArraySectionInfo<T5>::rank
|
---|
| 104 | + ArraySectionInfo<T6>::rank
|
---|
| 105 | + ArraySectionInfo<T7>::rank
|
---|
| 106 | + ArraySectionInfo<T8>::rank
|
---|
| 107 | + ArraySectionInfo<T9>::rank
|
---|
| 108 | + ArraySectionInfo<T10>::rank
|
---|
| 109 | + ArraySectionInfo<T11>::rank,
|
---|
| 110 |
|
---|
| 111 | isPick = ArraySectionInfo<T1>::isPick
|
---|
| 112 | + ArraySectionInfo<T2>::isPick
|
---|
| 113 | + ArraySectionInfo<T3>::isPick
|
---|
| 114 | + ArraySectionInfo<T4>::isPick
|
---|
| 115 | + ArraySectionInfo<T5>::isPick
|
---|
| 116 | + ArraySectionInfo<T6>::isPick
|
---|
| 117 | + ArraySectionInfo<T7>::isPick
|
---|
| 118 | + ArraySectionInfo<T8>::isPick
|
---|
| 119 | + ArraySectionInfo<T9>::isPick
|
---|
| 120 | + ArraySectionInfo<T10>::isPick
|
---|
| 121 | + ArraySectionInfo<T11>::isPick
|
---|
| 122 | };
|
---|
| 123 |
|
---|
| 124 | typedef Array<T_numtype,numValidTypes> T_array;
|
---|
| 125 | typedef Array<T_numtype,rank> T_slice;
|
---|
| 126 | };
|
---|
| 127 |
|
---|
| 128 | BZ_NAMESPACE_END
|
---|
| 129 |
|
---|
| 130 | #endif // BZ_ARRAYSLICE_H
|
---|