simple.cc - generated code example
[prop.git] / include / AD / automata / termpat.h
bloba625244055bdab80647dc83dd445c7eadaa655a2
1 //////////////////////////////////////////////////////////////////////////////
2 // NOTICE:
3 //
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are free to incorporate any part of ADLib and Prop into
9 // your programs.
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
16 // code.
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
21 // Allen Leung
22 // 1994
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef term_patterns_h
26 #define term_patterns_h
28 #include <AD/generic/generic.h> // Generic definitions
30 typedef class a_TermPat * TermPat;
31 class a_TermPat {
33 a_Term(const a_TermPat&); // no copy constructor
34 void operator = (const a_TermPat&); // no assignment
36 public:
38 typedef short Symbol; // Functor or variable is a symbol
39 typedef short Functor; // A functor (i.e. constructor)
40 typedef unsigned char Arity; // Arity of a functor
42 Functor f; // functor
43 Arity n; // arity
44 TermPat subterms[1]; // array of subterms, if any
46 public:
48 a_TermPat () {}
49 a_TermPat (Functor g, Arity k = 0) : f(g), n(k) {}
51 Functor tag() const { return f; }
52 int arity() const { return n; }
53 TermPat nth(int i) { return subterms[i]; }
54 friend Bool isWild(const TermPat p) { return p == 0; }
57 #endif