source: git/factory/templates/ftmpl_factor.h @ 684544

spielwiese
Last change on this file since 684544 was 684544, checked in by Rüdiger Stobbe <stobbe@…>, 28 years ago
Initial revision git-svn-id: file:///usr/local/Singular/svn/trunk@7 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.1 KB
Line 
1// emacs edit mode for this file is -*- C++ -*-
2// $Id: ftmpl_factor.h,v 1.0 1996-05-17 11:06:32 stobbe Exp $
3
4#ifndef INCL_FACTOR_H
5#define INCL_FACTOR_H
6
7/*
8$Log: not supported by cvs2svn $
9*/
10
11#include <iostream.h>
12
13
14template <class T>
15class Factor {
16private:
17    T _factor;
18    int _exp;
19public:
20    Factor() : _factor(1), _exp(0) {}
21    Factor( const Factor<T> & f ) : _factor(f._factor), _exp(f._exp) {}
22    Factor( const T & f, int e ) : _factor(f), _exp(e) {}
23    Factor( const T & f ) : _factor(f), _exp(1) {}
24    ~Factor() {}
25    Factor<T>& operator= ( const Factor<T>& );
26    Factor<T>& operator= ( const T& );
27    T factor() const { return _factor; }
28    int exp() const { return _exp; }
29    T value() const { return power( _factor, _exp ); }
30    Factor<T>& operator+= ( int i ) { _exp += i; return *this; }
31    Factor<T>& operator*= ( int i ) { _exp *= i; return *this; }
32    Factor<T>& operator*= ( const T & f ) { _factor *= f; return *this; }
33    friend int operator== ( const Factor<T>&, const Factor<T>& );
34    void print ( ostream& ) const;
35};
36
37template <class T>
38ostream& operator<< ( ostream & os, const Factor<T> & f );
39
40#endif /* INCL_FACTOR_H */
Note: See TracBrowser for help on using the repository browser.