1 | /////////////////////////////////////////////////////////////////////////////// |
---|
2 | // emacs edit mode for this file is -*- C++ -*- |
---|
3 | // $Id: class.h,v 1.7 2008-06-10 14:49:16 Singular Exp $ |
---|
4 | /////////////////////////////////////////////////////////////////////////////// |
---|
5 | #ifndef INCL_CLASS_H |
---|
6 | #define INCL_CLASS_H |
---|
7 | |
---|
8 | // #pragma interface |
---|
9 | |
---|
10 | #ifndef NOSTREAMIO |
---|
11 | #ifdef HAVE_IOSTREAM |
---|
12 | #include <iostream> |
---|
13 | #define OSTREAM std::ostream |
---|
14 | #define ISTREAM std::istream |
---|
15 | #elif defined(HAVE_IOSTREAM_H) |
---|
16 | #include <iostream.h> |
---|
17 | #define OSTREAM ostream |
---|
18 | #define ISTREAM istream |
---|
19 | #endif |
---|
20 | #endif |
---|
21 | |
---|
22 | template <class T> |
---|
23 | class Substitution { |
---|
24 | private: |
---|
25 | T _factor; |
---|
26 | T _exp; |
---|
27 | public: |
---|
28 | Substitution() : _factor(1), _exp(0) {} |
---|
29 | Substitution( const Substitution<T> & f ) : _factor(f._factor), _exp(f._exp) {} |
---|
30 | Substitution( const T & f, const T & e ) : _factor(f), _exp(e) {} |
---|
31 | Substitution( const T & f ) : _factor(f), _exp(1) {} |
---|
32 | ~Substitution() {} |
---|
33 | Substitution<T>& operator= ( const Substitution<T>& ); |
---|
34 | Substitution<T>& operator= ( const T& ); |
---|
35 | T factor() const { return _factor; } |
---|
36 | T exp() const { return _exp; } |
---|
37 | // T value() const { return power( _factor, _exp ); } |
---|
38 | // Factor<T>& operator+= ( int i ) { _exp += i; return *this; } |
---|
39 | // Factor<T>& operator*= ( int i ) { _exp *= i; return *this; } |
---|
40 | // Substitution<T>& operator*= ( const T & f ) { _factor *= f; _exp *= f; return *this; } |
---|
41 | #ifndef NOSTREAMIO |
---|
42 | void print ( OSTREAM& ) const; |
---|
43 | friend OSTREAM& operator<< ( OSTREAM & os, const Substitution<T> & f ) |
---|
44 | { |
---|
45 | f.print( os ); |
---|
46 | return os; |
---|
47 | } |
---|
48 | #endif |
---|
49 | }; |
---|
50 | template <class T> |
---|
51 | int operator== ( const Substitution<T>&, const Substitution<T>& ); |
---|
52 | |
---|
53 | // #ifdef IMPL_CLASS_H |
---|
54 | // #include "class.cc" |
---|
55 | // #endif |
---|
56 | |
---|
57 | #endif /* INCL_CLASS_H */ |
---|
58 | |
---|
59 | //////////////////////////////////////////////////////////// |
---|
60 | /* |
---|
61 | $Log: not supported by cvs2svn $ |
---|
62 | Revision 1.6 2006/05/16 14:46:50 Singular |
---|
63 | *hannes: gcc 4.1 fixes |
---|
64 | |
---|
65 | Revision 1.5 2000/05/29 08:06:47 pohl |
---|
66 | no artificial friend |
---|
67 | |
---|
68 | Revision 1.4 1997/09/12 07:19:54 Singular |
---|
69 | * hannes/michael: libfac-0.3.0 |
---|
70 | |
---|
71 | Revision 1.2 1997/04/25 22:21:26 michael |
---|
72 | Version for libfac-0.2.1 |
---|
73 | |
---|
74 | */ |
---|