1 | /* Copyright 1996 Michael Messollen. All rights reserved. */ |
---|
2 | /////////////////////////////////////////////////////////////////////////////// |
---|
3 | // emacs edit mode for this file is -*- C++ -*- |
---|
4 | // $Id: class.h,v 1.4 1997-09-12 07:19:54 Singular Exp $ |
---|
5 | /////////////////////////////////////////////////////////////////////////////// |
---|
6 | #ifndef INCL_CLASS_H |
---|
7 | #define INCL_CLASS_H |
---|
8 | |
---|
9 | // #pragma interface |
---|
10 | |
---|
11 | #ifndef NOSTREAMIO |
---|
12 | #include <iostream.h> |
---|
13 | #endif |
---|
14 | |
---|
15 | template <class T> |
---|
16 | class Substitution { |
---|
17 | private: |
---|
18 | T _factor; |
---|
19 | T _exp; |
---|
20 | public: |
---|
21 | Substitution() : _factor(1), _exp(0) {} |
---|
22 | Substitution( const Substitution<T> & f ) : _factor(f._factor), _exp(f._exp) {} |
---|
23 | Substitution( const T & f, const T & e ) : _factor(f), _exp(e) {} |
---|
24 | Substitution( const T & f ) : _factor(f), _exp(1) {} |
---|
25 | ~Substitution() {} |
---|
26 | Substitution<T>& operator= ( const Substitution<T>& ); |
---|
27 | Substitution<T>& operator= ( const T& ); |
---|
28 | T factor() const { return _factor; } |
---|
29 | T exp() const { return _exp; } |
---|
30 | // T value() const { return power( _factor, _exp ); } |
---|
31 | // Factor<T>& operator+= ( int i ) { _exp += i; return *this; } |
---|
32 | // Factor<T>& operator*= ( int i ) { _exp *= i; return *this; } |
---|
33 | // Substitution<T>& operator*= ( const T & f ) { _factor *= f; _exp *= f; return *this; } |
---|
34 | friend int operator== ( const Substitution<T>&, const Substitution<T>& ); |
---|
35 | #ifndef NOSTREAMIO |
---|
36 | void print ( ostream& ) const; |
---|
37 | friend ostream& operator<< ( ostream & os, const Substitution<T> & f ) |
---|
38 | { |
---|
39 | f.print( os ); |
---|
40 | return os; |
---|
41 | } |
---|
42 | #endif |
---|
43 | }; |
---|
44 | |
---|
45 | // #ifdef IMPL_CLASS_H |
---|
46 | // #include "class.cc" |
---|
47 | // #endif |
---|
48 | |
---|
49 | #endif /* INCL_CLASS_H */ |
---|
50 | |
---|
51 | //////////////////////////////////////////////////////////// |
---|
52 | /* |
---|
53 | $Log: not supported by cvs2svn $ |
---|
54 | Revision 1.2 1997/04/25 22:21:26 michael |
---|
55 | Version for libfac-0.2.1 |
---|
56 | |
---|
57 | */ |
---|