source: git/factory/include/factory/templates/ftmpl_list.h @ ee668e

jengelh-datetimespielwiese
Last change on this file since ee668e was ee668e, checked in by Jan Engelhardt <jengelh@…>, 11 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: 3.0 KB
RevLine 
[6ab5981]1/* emacs edit mode for this file is -*- C++ -*- */
[341696]2/* $Id$ */
[684544]3
4#ifndef INCL_LIST_H
5#define INCL_LIST_H
6
[e4fe2b]7// #include <factory/factoryconf.h>
[8c0163]8
[175e355]9#ifndef NOSTREAMIO
[1dc616]10#ifdef HAVE_IOSTREAM
11#include <iostream>
[181148]12#define OSTREAM std::ostream
[1dc616]13#elif defined(HAVE_IOSTREAM_H)
[684544]14#include <iostream.h>
[181148]15#define OSTREAM ostream
[1dc616]16#endif
[175e355]17#endif /* NOSTREAMIO */
[684544]18
[31a2be7]19template <class T>
20class ListIterator;
21
22template <class T>
23class List;
[684544]24
[22347b6]25#ifndef NOSTREAMIO
26template <class T>
[181148]27OSTREAM& operator<< ( OSTREAM &, const List<T> &);
[22347b6]28#endif
29
[684544]30template <class T>
31class ListItem
32{
33private:
34    ListItem * next;
35    ListItem * prev;
36    T * item;
37public:
38    ListItem( const ListItem<T>& );
39    ListItem( const T&, ListItem<T>*, ListItem<T>* );
40    ListItem( T* , ListItem<T>* , ListItem<T>* );
41    ~ListItem();
42    ListItem<T>& operator= ( const ListItem<T>& );
43    ListItem<T>* getNext();
44    ListItem<T>* getPrev();
45    T& getItem();
[175e355]46#ifndef NOSTREAMIO
[181148]47    void print ( OSTREAM& );
[175e355]48#endif /* NOSTREAMIO */
[684544]49    friend class ListIterator<T>;
50    friend class List<T>;
51};
52
53template <class T>
54class List
55{
56private:
57    ListItem<T> *first;
58    ListItem<T> *last;
59    int _length;
60public:
61    List();
62    List( const List<T>& );
63    List( const T& );
64    ~List();
65    List<T>& operator= ( const List<T>& );
66    void insert ( const T& );
67    void insert ( const T&, int (*cmpf)( const T&, const T& ) );
68    void insert ( const T&, int (*cmpf)( const T&, const T& ), void (*insf)( T&, const T& ) );
69    void append ( const T& );
70    int isEmpty() const;
71    int length() const;
72    T getFirst() const;
73    void removeFirst();
74    T getLast() const;
75    void removeLast();
76    void sort ( int (*) ( const T&, const T& ) );
[175e355]77#ifndef NOSTREAMIO
[181148]78    void print ( OSTREAM & ) const;
79    friend OSTREAM& operator<< <T>( OSTREAM & os, const List<T> & l );
[175e355]80#endif /* NOSTREAMIO */
[684544]81    friend class ListIterator<T>;
82};
83
[175e355]84#ifndef NOSTREAMIO
[684544]85template <class T>
[181148]86OSTREAM& operator<< ( OSTREAM & os, const List<T> & l );
[175e355]87#endif /* NOSTREAMIO */
[684544]88
89template <class T>
90class ListIterator {
91private:
92    List<T> *theList;
93    ListItem<T> *current;
94public:
95    ListIterator();
96    ListIterator( const ListIterator<T>& );
97    ListIterator( const List<T>& );
98    ~ListIterator();
99    ListIterator<T>& operator = ( const ListIterator<T>& );
100    ListIterator<T>& operator = ( const List<T>& );
101    T& getItem() const;
102    int hasItem();
103    void operator++();
104    void operator--();
105    void operator++( int );
106    void operator--( int );
107    void firstItem();
108    void lastItem();
109    void insert( const T& );
110    void append( const T& );
111    void remove( int moveright );
112};
113
114template <class T>
115List<T> Union ( const List<T>&, const List<T>& );
116
117template <class T>
118List<T> Difference ( const List<T>&, const List<T>& );
119
120template <class T>
121List<T> Union ( const List<T>&, const List<T>&, int (*cmpf)( const T&, const T& ), void (*insf)( T&, const T& ) );
122
123template <class T>
124T prod ( const List<T>& );
125
[c48e80]126template <class T>
127bool find (const List<T>&, const T& t);
128
[6ab5981]129#endif /* ! INCL_LIST_H */
Note: See TracBrowser for help on using the repository browser.