1 | /***************************************************************************
|
---|
2 | * blitz/meta/vecassign.h TinyVector assignment metaprogram
|
---|
3 | *
|
---|
4 | * $Id: vecassign.h,v 1.1.1.1 1999-04-09 17:59:03 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.2 1998/03/14 00:08:44 tveldhui
|
---|
27 | * 0.2-alpha-05
|
---|
28 | *
|
---|
29 | * Revision 1.1 1997/07/16 14:51:20 tveldhui
|
---|
30 | * Update: Alpha release 0.2 (Arrays)
|
---|
31 | *
|
---|
32 | */
|
---|
33 |
|
---|
34 | #ifndef BZ_META_VECASSIGN_H
|
---|
35 | #define BZ_META_VECASSIGN_H
|
---|
36 |
|
---|
37 | BZ_NAMESPACE(blitz)
|
---|
38 |
|
---|
39 | template<int N, int I>
|
---|
40 | class _bz_meta_vecAssign {
|
---|
41 | public:
|
---|
42 | enum { loopFlag = (I < N-1) ? 1 : 0 };
|
---|
43 |
|
---|
44 | template<class T_vector, class T_expr, class T_updater>
|
---|
45 | static inline void fastAssign(T_vector& vec, T_expr expr, T_updater u)
|
---|
46 | {
|
---|
47 | u.update(vec[I], expr._bz_fastAccess(I));
|
---|
48 | _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
|
---|
49 | ::fastAssign(vec,expr,u);
|
---|
50 | }
|
---|
51 |
|
---|
52 | template<class T_vector, class T_expr, class T_updater>
|
---|
53 | static inline void assign(T_vector& vec, T_expr expr, T_updater u)
|
---|
54 | {
|
---|
55 | u.update(vec[I], expr[I]);
|
---|
56 | _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
|
---|
57 | ::assign(vec,expr,u);
|
---|
58 | }
|
---|
59 |
|
---|
60 | template<class T_vector, class T_numtype, class T_updater>
|
---|
61 | static inline void assignWithArgs(T_vector& vec, T_updater u,
|
---|
62 | T_numtype x0, T_numtype x1=0, T_numtype x2=0, T_numtype x3=0,
|
---|
63 | T_numtype x4=0, T_numtype x5=0, T_numtype x6=0, T_numtype x7=0,
|
---|
64 | T_numtype x8=0, T_numtype x9=0)
|
---|
65 | {
|
---|
66 | u.update(vec[I], x0);
|
---|
67 | _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
|
---|
68 | ::assignWithArgs(vec, u, x1, x2, x3, x4, x5, x6, x7, x8, x9);
|
---|
69 | }
|
---|
70 |
|
---|
71 | };
|
---|
72 |
|
---|
73 | template<>
|
---|
74 | class _bz_meta_vecAssign<0,0> {
|
---|
75 | public:
|
---|
76 | template<class T_vector, class T_expr, class T_updater>
|
---|
77 | static inline void fastAssign(T_vector& vec, T_expr expr, T_updater u)
|
---|
78 | { }
|
---|
79 |
|
---|
80 | template<class T_vector, class T_expr, class T_updater>
|
---|
81 | static inline void assign(T_vector& vec, T_expr expr, T_updater u)
|
---|
82 | { }
|
---|
83 |
|
---|
84 | template<class T_vector, class T_numtype, class T_updater>
|
---|
85 | static inline void assignWithArgs(T_vector& vec, T_updater u,
|
---|
86 | T_numtype x0, T_numtype x1=0, T_numtype x2=0, T_numtype x3=0,
|
---|
87 | T_numtype x4=0, T_numtype x5=0, T_numtype x6=0, T_numtype x7=0,
|
---|
88 | T_numtype x8=0, T_numtype x9=0)
|
---|
89 | {
|
---|
90 | }
|
---|
91 | };
|
---|
92 |
|
---|
93 | BZ_NAMESPACE_END
|
---|
94 |
|
---|
95 | #endif // BZ_META_ASSIGN_H
|
---|