source: git/factory/cf_map.h @ ff3a4f

fieker-DuValspielwiese
Last change on this file since ff3a4f 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
RevLine 
[493c477]1/* emacs edit mode for this file is -*- C++ -*- */
[341696]2/* $Id$ */
[2dd068]3
4#ifndef INCL_CF_MAP_H
5#define INCL_CF_MAP_H
6
[95d5c6]7//{{{ docu
8//
9// cf_map.h - header to cf_map.cc.
10//
11//}}}
12
[e4fe2b]13// #include "config.h"
[b973c0]14
[997ae52]15#ifndef NOSTREAMIO
[1dc616]16#ifdef HAVE_IOSTREAM
17#include <iostream>
[181148]18#define OSTREAM std::ostream
[1dc616]19#elif defined(HAVE_IOSTREAM_H)
[2dd068]20#include <iostream.h>
[181148]21#define OSTREAM ostream
[1dc616]22#endif
[997ae52]23#endif /* NOSTREAMIO */
24
[2dd068]25#include "variable.h"
[95d5c6]26#include "canonicalform.h"
[ee668e]27#include <factory/templates/ftmpl_list.h>
[2dd068]28
29/*BEGINPUBLIC*/
30
[95d5c6]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//
[f2e972]44// Variable var () const
45// CanonicalForm subst () const
[95d5c6]46//
47// var(), subst() - selectors, return V and P, resp.
48//
49//}}}
[2dd068]50class MapPair
51{
52private:
53    Variable V;
54    CanonicalForm S;
55public:
[f2e972]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; }
[997ae52]63#ifndef NOSTREAMIO
[181148]64    void print( OSTREAM&) const;
65    friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p );
[997ae52]66#endif /* NOSTREAMIO */
[2dd068]67};
[95d5c6]68//}}}
[2dd068]69
70typedef List<MapPair> MPList;
71typedef ListIterator<MapPair> MPListIterator;
72
[95d5c6]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)
[f2e972]80// describing which canonical form S to insert for variable V.
[95d5c6]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//}}}
[2dd068]87class CFMap
88{
89private:
90  MPList P;
91public:
[f2e972]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 ) {}
[95d5c6]99  CFMap & operator = ( const CFMap & m );
[f2e972]100  void newpair ( const Variable & v, const CanonicalForm & s );
[95d5c6]101  CanonicalForm operator () ( const CanonicalForm & f ) const;
[997ae52]102#ifndef NOSTREAMIO
[181148]103  friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m );
[997ae52]104#endif /* NOSTREAMIO */
[2dd068]105};
[95d5c6]106//}}}
[2dd068]107
108CanonicalForm compress ( const CanonicalForm & f, CFMap & m );
109void compress ( const CFArray & a, CFMap & M, CFMap & N );
[cc3e5e]110void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N );
[2dd068]111
112/*ENDPUBLIC*/
113
[493c477]114#endif /* ! INCL_CF_MAP_H */
Note: See TracBrowser for help on using the repository browser.