source: XMLIO_V2/external/include/blitz/vecexprwrap.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: 2.3 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/vecexprwrap.h   Vector expression templates wrapper class
4 *
5 * $Id: vecexprwrap.h,v 1.5 2005/05/07 04:17:56 julianc Exp $
6 *
7 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * Suggestions:          blitz-dev@oonumerics.org
20 * Bugs:                 blitz-bugs@oonumerics.org
21 *
22 * For more information, please see the Blitz++ Home Page:
23 *    http://oonumerics.org/blitz/
24 *
25 ***************************************************************************/
26
27#ifndef BZ_VECEXPRWRAP_H
28#define BZ_VECEXPRWRAP_H
29
30#ifndef BZ_BLITZ_H
31 #include <blitz/blitz.h>
32#endif
33
34BZ_NAMESPACE(blitz)
35
36template<typename P_expr>
37class _bz_VecExpr {
38
39public:
40    typedef P_expr T_expr;
41    typedef _bz_typename T_expr::T_numtype T_numtype;
42
43#ifdef BZ_PASS_EXPR_BY_VALUE
44    _bz_VecExpr(T_expr a)
45        : iter_(a)
46    { }
47#else
48    _bz_VecExpr(const T_expr& a)
49        : iter_(a)
50    { }
51#endif
52
53#ifdef BZ_MANUAL_VECEXPR_COPY_CONSTRUCTOR
54    _bz_VecExpr(const _bz_VecExpr<T_expr>& a)
55        : iter_(a.iter_)
56    { }
57#endif
58
59    T_numtype operator[](int i) const
60    { return iter_[i]; }
61
62    T_numtype operator()(int i) const
63    { return iter_(i); }
64
65    int length(int recommendedLength) const
66    { return iter_.length(recommendedLength); }
67
68    static const int 
69        _bz_staticLengthCount = P_expr::_bz_staticLengthCount,
70        _bz_dynamicLengthCount = P_expr::_bz_dynamicLengthCount,
71        _bz_staticLength = P_expr::_bz_staticLength;
72
73    int _bz_suggestLength() const
74    { return iter_._bz_suggestLength(); }
75
76    bool _bz_hasFastAccess() const
77    { return iter_._bz_hasFastAccess(); }
78
79    T_numtype _bz_fastAccess(int i) const
80    { return iter_._bz_fastAccess(i); }
81
82private:
83    _bz_VecExpr();
84
85    T_expr iter_;
86};
87
88BZ_NAMESPACE_END
89
90#endif // BZ_VECEXPRWRAP_H
Note: See TracBrowser for help on using the repository browser.