|
GiNaC
1.6.2
|
00001 00005 /* 00006 * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef GINAC_WILDCARD_H 00024 #define GINAC_WILDCARD_H 00025 00026 #include "ex.h" 00027 #include "archive.h" 00028 00029 namespace GiNaC { 00030 00033 class wildcard : public basic 00034 { 00035 GINAC_DECLARE_REGISTERED_CLASS(wildcard, basic) 00036 00037 // other constructors 00038 public: 00040 wildcard(unsigned label); 00041 00042 // functions overriding virtual functions from base classes 00043 public: 00044 bool match(const ex & pattern, exmap& repl_lst) const; 00045 00047 void archive(archive_node& n) const; 00049 void read_archive(const archive_node& n, lst& syms); 00050 protected: 00051 unsigned calchash() const; 00052 00053 // non-virtual functions in this class 00054 public: 00055 unsigned get_label() const {return label;} 00056 00057 protected: 00058 void do_print(const print_context & c, unsigned level) const; 00059 void do_print_tree(const print_tree & c, unsigned level) const; 00060 void do_print_python_repr(const print_python_repr & c, unsigned level) const; 00061 00062 // member variables 00063 private: 00064 unsigned label; 00065 }; 00066 GINAC_DECLARE_UNARCHIVER(wildcard); 00067 00068 00069 // utility functions 00070 00072 inline ex wild(unsigned label = 0) 00073 { 00074 return wildcard(label); 00075 } 00076 00078 bool haswild(const ex & x); 00079 00080 } // namespace GiNaC 00081 00082 #endif // ndef GINAC_WILDCARD_H