source: XMLIO_V2/external/include/blitz/array/slice.h @ 80

Last change on this file since 80 was 80, checked in by ymipsl, 14 years ago

ajout lib externe

  • Property svn:eol-style set to native
File size: 4.0 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/array/slice.h    Helper classes for slicing arrays
4 *
5 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * Suggestions:          blitz-dev@oonumerics.org
18 * Bugs:                 blitz-bugs@oonumerics.org
19 *
20 * For more information, please see the Blitz++ Home Page:
21 *    http://oonumerics.org/blitz/
22 *
23 ****************************************************************************/
24#ifndef BZ_ARRAYSLICE_H
25#define BZ_ARRAYSLICE_H
26
27#ifndef BZ_ARRAY_H
28 #error <blitz/array/slice.h> must be included via <blitz/array.h>
29#endif
30
31BZ_NAMESPACE(blitz)
32
33// Forward declaration
34template<typename T, int N>
35class Array;
36
37
38
39class nilArraySection { };
40
41template<typename T>
42class ArraySectionInfo {
43public:
44    static const int isValidType = 0, rank = 0, isPick = 0;
45};
46
47template<>
48class ArraySectionInfo<Range> {
49public:
50    static const int isValidType = 1, rank = 1, isPick = 0;
51};
52
53template<>
54class ArraySectionInfo<int> {
55public:
56    static const int isValidType = 1, rank = 0, isPick = 0;
57};
58
59template<>
60class ArraySectionInfo<nilArraySection> {
61public:
62    static const int isValidType = 1, rank = 0, isPick = 0;
63};
64
65template<typename T_numtype, typename T1, typename T2 = nilArraySection, 
66    class T3 = nilArraySection, typename T4 = nilArraySection, 
67    class T5 = nilArraySection, typename T6 = nilArraySection, 
68    class T7 = nilArraySection, typename T8 = nilArraySection, 
69    class T9 = nilArraySection, typename T10 = nilArraySection, 
70    class T11 = nilArraySection>
71class SliceInfo {
72public:
73    static const int 
74        numValidTypes = ArraySectionInfo<T1>::isValidType
75                      + ArraySectionInfo<T2>::isValidType
76                      + ArraySectionInfo<T3>::isValidType
77                      + ArraySectionInfo<T4>::isValidType
78                      + ArraySectionInfo<T5>::isValidType
79                      + ArraySectionInfo<T6>::isValidType
80                      + ArraySectionInfo<T7>::isValidType
81                      + ArraySectionInfo<T8>::isValidType
82                      + ArraySectionInfo<T9>::isValidType
83                      + ArraySectionInfo<T10>::isValidType
84                      + ArraySectionInfo<T11>::isValidType,
85
86        rank          = ArraySectionInfo<T1>::rank
87                      + ArraySectionInfo<T2>::rank
88                      + ArraySectionInfo<T3>::rank
89                      + ArraySectionInfo<T4>::rank
90                      + ArraySectionInfo<T5>::rank
91                      + ArraySectionInfo<T6>::rank
92                      + ArraySectionInfo<T7>::rank
93                      + ArraySectionInfo<T8>::rank
94                      + ArraySectionInfo<T9>::rank
95                      + ArraySectionInfo<T10>::rank
96                      + ArraySectionInfo<T11>::rank,
97
98        isPick        = ArraySectionInfo<T1>::isPick
99                      + ArraySectionInfo<T2>::isPick
100                      + ArraySectionInfo<T3>::isPick
101                      + ArraySectionInfo<T4>::isPick
102                      + ArraySectionInfo<T5>::isPick
103                      + ArraySectionInfo<T6>::isPick
104                      + ArraySectionInfo<T7>::isPick
105                      + ArraySectionInfo<T8>::isPick
106                      + ArraySectionInfo<T9>::isPick
107                      + ArraySectionInfo<T10>::isPick
108                      + ArraySectionInfo<T11>::isPick;
109
110    typedef Array<T_numtype,numValidTypes> T_array;
111    typedef Array<T_numtype,rank> T_slice;
112};
113
114BZ_NAMESPACE_END
115
116#endif // BZ_ARRAYSLICE_H
Note: See TracBrowser for help on using the repository browser.