source: git/factory/cf_map.h @ 1a9dc5

spielwiese
Last change on this file since 1a9dc5 was ee668e, checked in by Jan Engelhardt <jengelh@…>, 12 years ago
factory/build: restore out-of-tree build support When attempting an OOT build, it fails to find <factory/cplusplus.h>, because cplusplus.h is always (even in in-tree builds) produced in "${builddir}", and not "${top_srcdir}/../factory". Furthermore, one must not rely on the basename of ${top_srcdir}, and going above ${top_srcdir} is undefined and may lead to spurious build failures. (Consider a hypothetical chroot on ${top_srcdir}). Therefore, create a directory include/factory and use -Iinclude such that <factory/*> yields a buildable state, move all exported header files there. Previous OOT build log: 17:22 seven:../factory/obj > make CXX cplusplus.o CXXLD cplusplus ./cplusplus > ./cplusplus.h ../bin/makeheader ../factory.template factory.h ../bin/makeheader ../factoryconf.template factoryconf.h YACC readcf.cc make all-am make[1]: Entering directory `/home/jengelh/obs/zu/home/jengelh/science/singsource/factory/obj' CXX libfactory_a-algext.o CXX libfactory_a-canonicalform.o In file included from ../cf_factory.h:12:0, from ../canonicalform.cc:7: ../../factory/cf_gmp.h:14:33: fatal error: factory/cplusplus.h: Ingen slik fil eller filkatalog compilation terminated. make[1]: *** [libfactory_a-canonicalform.o] Error 1 make[1]: Leaving directory `/home/jengelh/obs/zu/home/jengelh/science/singsource/factory/obj' make: *** [all] Error 2
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4#ifndef INCL_CF_MAP_H
5#define INCL_CF_MAP_H
6
7//{{{ docu
8//
9// cf_map.h - header to cf_map.cc.
10//
11//}}}
12
13// #include "config.h"
14
15#ifndef NOSTREAMIO
16#ifdef HAVE_IOSTREAM
17#include <iostream>
18#define OSTREAM std::ostream
19#elif defined(HAVE_IOSTREAM_H)
20#include <iostream.h>
21#define OSTREAM ostream
22#endif
23#endif /* NOSTREAMIO */
24
25#include "variable.h"
26#include "canonicalform.h"
27#include <factory/templates/ftmpl_list.h>
28
29/*BEGINPUBLIC*/
30
31//{{{ class MapPair
32//{{{ docu
33//
34// class MapPair - stores one mapping pair (Variable -> CanonicalForm).
35//
36// This class is only used to store such pairs.  It has no
37// methods to transform a CanonicalForm as the class CFMap has.
38//
39// V, S: the pair (V -> S)
40//
41//}}}
42//{{{ inline method docu
43//
44// Variable var () const
45// CanonicalForm subst () const
46//
47// var(), subst() - selectors, return V and P, resp.
48//
49//}}}
50class MapPair
51{
52private:
53    Variable V;
54    CanonicalForm S;
55public:
56    MapPair ( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {}
57    MapPair () : V(), S(1) {}
58    MapPair ( const MapPair & p ) : V(p.V), S(p.S) {}
59    ~MapPair () {}
60    MapPair & operator = ( const MapPair & p );
61    Variable var () const { return V; }
62    CanonicalForm subst () const { return S; }
63#ifndef NOSTREAMIO
64    void print( OSTREAM&) const;
65    friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p );
66#endif /* NOSTREAMIO */
67};
68//}}}
69
70typedef List<MapPair> MPList;
71typedef ListIterator<MapPair> MPListIterator;
72
73//{{{ class CFMap
74//{{{ docu
75//
76// class CFMap - class to map canonical forms.
77//
78// Use an object of class CFMap to insert 'values' into canonical
79// form.  Such a mapping is defined by a list of MapPairs (V -> S)
80// describing which canonical form S to insert for variable V.
81// Hereby, the substituted canonical forms are not subject to
82// further substitutions.
83//
84// P: list of MapPairs, sorted by level in descending order
85//
86//}}}
87class CFMap
88{
89private:
90  MPList P;
91public:
92  CFMap () {}
93  CFMap ( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {}
94  CFMap ( const Variable & v ) : P( MapPair( v, 1 ) ) {}
95  CFMap ( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {}
96  ~CFMap () {}
97  CFMap ( const CFList & L );
98  CFMap ( const CFMap & m ) : P( m.P ) {}
99  CFMap & operator = ( const CFMap & m );
100  void newpair ( const Variable & v, const CanonicalForm & s );
101  CanonicalForm operator () ( const CanonicalForm & f ) const;
102#ifndef NOSTREAMIO
103  friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m );
104#endif /* NOSTREAMIO */
105};
106//}}}
107
108CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
109void compress ( const CFArray & a, CFMap & M, CFMap & N );
110void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
111
112/*ENDPUBLIC*/
113
114#endif /* ! INCL_CF_MAP_H */
Note: See TracBrowser for help on using the repository browser.