source: XMLIO_V2/external/include/blitz/update.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.4 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/update.h      Declaration of the _bz_XXXX updater classes
4 *
5 * $Id: update.h,v 1.5 2004/03/09 21:55:31 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_UPDATE_H
28#define BZ_UPDATE_H
29
30#include <blitz/blitz.h>
31
32BZ_NAMESPACE(blitz)
33
34class _bz_updater_base { };
35
36#define BZ_DECL_UPDATER(name,op,symbol)                     \
37  template<typename X, typename Y>                          \
38  class name : public _bz_updater_base {                    \
39  public:                                                   \
40    static inline void update(X& restrict x, Y y)           \
41    { x op y; }                                             \
42    static void prettyPrint(BZ_STD_SCOPE(string) &str)      \
43    { str += symbol; }                                      \
44  }
45
46template<typename X, typename Y>
47class _bz_update : public _bz_updater_base {
48  public:
49    static inline void update(X& restrict x, Y y)
50    { x = (X)y; }
51
52    static void prettyPrint(BZ_STD_SCOPE(string) &str)
53    { str += "="; }
54};
55
56BZ_DECL_UPDATER(_bz_plus_update, +=, "+=");
57BZ_DECL_UPDATER(_bz_minus_update, -=, "-=");
58BZ_DECL_UPDATER(_bz_multiply_update, *=, "*=");
59BZ_DECL_UPDATER(_bz_divide_update, /=, "/=");
60BZ_DECL_UPDATER(_bz_mod_update, %=, "%=");
61BZ_DECL_UPDATER(_bz_xor_update, ^=, "^=");
62BZ_DECL_UPDATER(_bz_bitand_update, &=, "&=");
63BZ_DECL_UPDATER(_bz_bitor_update, |=, "|=");
64BZ_DECL_UPDATER(_bz_shiftl_update, <<=, "<<=");
65BZ_DECL_UPDATER(_bz_shiftr_update, >>=, ">>=");
66
67BZ_NAMESPACE_END
68
69#endif // BZ_UPDATE_H
70
Note: See TracBrowser for help on using the repository browser.