source: git/factory/libfac/factor/class.h @ 43bbd6

spielwiese
Last change on this file since 43bbd6 was dccceb, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
moved libfac under factory/ CHG: moved libfac/ under factory/ Note: starting to merge libfac into factory (as a private library)
  • Property mode set to 100644
File size: 1.7 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2// emacs edit mode for this file is -*- C++ -*-
3// $Id$
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
22template <class T>
23class Substitution {
24private:
25    T _factor;
26    T _exp;
27public:
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};
50template <class T>
51int 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
Note: See TracBrowser for help on using the repository browser.