[221] | 1 | /***************************************************************************
|
---|
| 2 | * blitz/update.h Declaration of the _bz_XXXX updater classes
|
---|
| 3 | *
|
---|
| 4 | * $Id: update.h,v 1.1.1.1 1999-04-09 17:58:59 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.5 1998/03/14 00:04:47 tveldhui
|
---|
| 27 | * 0.2-alpha-05
|
---|
| 28 | *
|
---|
| 29 | * Revision 1.4 1997/07/16 14:51:20 tveldhui
|
---|
| 30 | * Update: Alpha release 0.2 (Arrays)
|
---|
| 31 | *
|
---|
| 32 | * Revision 1.3 1997/01/24 14:42:00 tveldhui
|
---|
| 33 | * Periodic RCS update
|
---|
| 34 | *
|
---|
| 35 | * Revision 1.2 1997/01/23 03:28:28 tveldhui
|
---|
| 36 | * Periodic RCS update
|
---|
| 37 | *
|
---|
| 38 | * Revision 1.1 1997/01/13 22:19:58 tveldhui
|
---|
| 39 | * Periodic RCS update
|
---|
| 40 | *
|
---|
| 41 | *
|
---|
| 42 | */
|
---|
| 43 |
|
---|
| 44 | #ifndef BZ_UPDATE_H
|
---|
| 45 | #define BZ_UPDATE_H
|
---|
| 46 |
|
---|
| 47 | #ifndef BZ_BLITZ_H
|
---|
| 48 | #include <blitz/blitz.h>
|
---|
| 49 | #endif
|
---|
| 50 |
|
---|
| 51 | BZ_NAMESPACE(blitz)
|
---|
| 52 |
|
---|
| 53 | class _bz_updater_base { };
|
---|
| 54 |
|
---|
| 55 | #define BZ_DECL_UPDATER(name,op,symbol) \
|
---|
| 56 | template<class X, class Y> \
|
---|
| 57 | class name : public _bz_updater_base { \
|
---|
| 58 | public: \
|
---|
| 59 | static inline void update(X& _bz_restrict x, Y y) \
|
---|
| 60 | { x op y; } \
|
---|
| 61 | static void prettyPrint(string& str) \
|
---|
| 62 | { str += symbol; } \
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | BZ_DECL_UPDATER(_bz_update, =, "=");
|
---|
| 66 | BZ_DECL_UPDATER(_bz_plus_update, +=, "+=");
|
---|
| 67 | BZ_DECL_UPDATER(_bz_minus_update, -=, "-=");
|
---|
| 68 | BZ_DECL_UPDATER(_bz_multiply_update, *=, "*=");
|
---|
| 69 | BZ_DECL_UPDATER(_bz_divide_update, /=, "/=");
|
---|
| 70 | BZ_DECL_UPDATER(_bz_mod_update, %=, "%=");
|
---|
| 71 | BZ_DECL_UPDATER(_bz_xor_update, ^=, "^=");
|
---|
| 72 | BZ_DECL_UPDATER(_bz_bitand_update, &=, "&=");
|
---|
| 73 | BZ_DECL_UPDATER(_bz_bitor_update, |=, "|=");
|
---|
| 74 | BZ_DECL_UPDATER(_bz_shiftl_update, <<=, "<<=");
|
---|
| 75 | BZ_DECL_UPDATER(_bz_shiftr_update, >>=, ">>=");
|
---|
| 76 |
|
---|
| 77 | BZ_NAMESPACE_END
|
---|
| 78 |
|
---|
| 79 | #endif // BZ_UPDATE_H
|
---|
| 80 |
|
---|