GiNaC 1.8.10
wildcard.h
Go to the documentation of this file.
1
5/*
6 * GiNaC Copyright (C) 1999-2026 Johannes Gutenberg University Mainz, Germany
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (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 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef GINAC_WILDCARD_H
23#define GINAC_WILDCARD_H
24
25#include "ex.h"
26#include "archive.h"
27
28namespace GiNaC {
29
32class wildcard : public basic
33{
35
36 // other constructors
37public:
39 wildcard(unsigned label);
40
41 // functions overriding virtual functions from base classes
42public:
43 bool match(const ex & pattern, exmap& repl_lst) const override;
44
46 void archive(archive_node& n) const override;
48 void read_archive(const archive_node& n, lst& syms) override;
49protected:
50 unsigned calchash() const override;
51
52 // non-virtual functions in this class
53public:
54 unsigned get_label() const {return label;}
55
56protected:
57 void do_print(const print_context & c, unsigned level) const;
58 void do_print_tree(const print_tree & c, unsigned level) const;
59 void do_print_python_repr(const print_python_repr & c, unsigned level) const;
60
61 // member variables
62private:
63 unsigned label;
64};
66
67
68// utility functions
69
71inline ex wild(unsigned label = 0)
72{
73 return wildcard(label);
74}
75
77bool haswild(const ex & x);
78
79} // namespace GiNaC
80
81#endif // ndef GINAC_WILDCARD_H
Archiving of GiNaC expressions.
#define GINAC_DECLARE_UNARCHIVER(classname)
Helper macros to register a class with (un)archiving (a.k.a.
Definition archive.h:218
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
Definition archive.h:48
This class holds archived versions of GiNaC expressions (class ex).
Definition archive.h:254
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
Definition basic.h:104
Wrapper template for making GiNaC classes out of STL containers.
Definition container.h:72
Lightweight wrapper for GiNaC's symbolic objects.
Definition ex.h:72
Base class for print_contexts.
Definition print.h:101
Context for python-parsable output.
Definition print.h:137
Context for tree-like output for debugging.
Definition print.h:145
This class acts as a wildcard for subs(), match(), has() and find().
Definition wildcard.h:33
bool match(const ex &pattern, exmap &repl_lst) const override
Check whether the expression matches a given pattern.
Definition wildcard.cpp:113
void read_archive(const archive_node &n, lst &syms) override
Read (a.k.a.
Definition wildcard.cpp:56
unsigned calchash() const override
Compute the hash value of an object and if it makes sense to store it in the objects status_flags,...
Definition wildcard.cpp:102
void do_print(const print_context &c, unsigned level) const
Definition wildcard.cpp:85
unsigned label
Label used to distinguish different wildcards.
Definition wildcard.h:63
void do_print_python_repr(const print_python_repr &c, unsigned level) const
Definition wildcard.cpp:97
unsigned get_label() const
Definition wildcard.h:54
void do_print_tree(const print_tree &c, unsigned level) const
Definition wildcard.cpp:90
Interface to GiNaC's light-weight expression handles.
size_t n
Definition factor.cpp:1431
size_t c
Definition factor.cpp:756
ex x
Definition factor.cpp:1609
exset syms
Definition factor.cpp:2427
Definition add.cpp:35
bool haswild(const ex &x)
Check whether x has a wildcard anywhere as a subexpression.
Definition wildcard.cpp:121
std::map< ex, ex, ex_is_less > exmap
Definition basic.h:49
ex wild(unsigned label=0)
Create a wildcard object with the specified label.
Definition wildcard.h:71
#define GINAC_DECLARE_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the declaration of each registered class.
Definition registrar.h:151

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.