1 | /***************************************************************************
|
---|
2 | * blitz/vecexprwrap.h Vector expression templates wrapper class
|
---|
3 | *
|
---|
4 | * $Id: vecexprwrap.h,v 1.1.1.1 1999-11-26 16:37:05 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:01 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_VECEXPRWRAP_H
|
---|
38 | #define BZ_VECEXPRWRAP_H
|
---|
39 |
|
---|
40 | #ifndef BZ_BLITZ_H
|
---|
41 | #include <blitz/blitz.h>
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | BZ_NAMESPACE(blitz)
|
---|
45 |
|
---|
46 | template<class P_expr>
|
---|
47 | class _bz_VecExpr {
|
---|
48 |
|
---|
49 | public:
|
---|
50 | typedef P_expr T_expr;
|
---|
51 | typedef _bz_typename T_expr::T_numtype T_numtype;
|
---|
52 |
|
---|
53 | #ifdef BZ_PASS_EXPR_BY_VALUE
|
---|
54 | _bz_VecExpr(T_expr a)
|
---|
55 | : iter_(a)
|
---|
56 | { }
|
---|
57 | #else
|
---|
58 | _bz_VecExpr(const T_expr& a)
|
---|
59 | : iter_(a)
|
---|
60 | { }
|
---|
61 | #endif
|
---|
62 |
|
---|
63 | #ifdef BZ_MANUAL_VECEXPR_COPY_CONSTRUCTOR
|
---|
64 | _bz_VecExpr(const _bz_VecExpr<T_expr>& a)
|
---|
65 | : iter_(a.iter_)
|
---|
66 | { }
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | T_numtype operator[](int i) const
|
---|
70 | { return iter_[i]; }
|
---|
71 |
|
---|
72 | T_numtype operator()(int i) const
|
---|
73 | { return iter_(i); }
|
---|
74 |
|
---|
75 | int length(int recommendedLength) const
|
---|
76 | { return iter_.length(recommendedLength); }
|
---|
77 |
|
---|
78 | enum { _bz_staticLengthCount = BZ_ENUM_CAST(P_expr::_bz_staticLengthCount),
|
---|
79 | _bz_dynamicLengthCount = BZ_ENUM_CAST(P_expr::_bz_dynamicLengthCount),
|
---|
80 | _bz_staticLength = BZ_ENUM_CAST(P_expr::_bz_staticLength) };
|
---|
81 |
|
---|
82 | int _bz_suggestLength() const
|
---|
83 | { return iter_._bz_suggestLength(); }
|
---|
84 |
|
---|
85 | _bz_bool _bz_hasFastAccess() const
|
---|
86 | { return iter_._bz_hasFastAccess(); }
|
---|
87 |
|
---|
88 | T_numtype _bz_fastAccess(int i) const
|
---|
89 | { return iter_._bz_fastAccess(i); }
|
---|
90 |
|
---|
91 | private:
|
---|
92 | _bz_VecExpr();
|
---|
93 |
|
---|
94 | T_expr iter_;
|
---|
95 | };
|
---|
96 |
|
---|
97 | BZ_NAMESPACE_END
|
---|
98 |
|
---|
99 | #endif // BZ_VECEXPRWRAP_H
|
---|