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

spielwiese
Last change on this file since eced154 was 6ab5981, checked in by Jens Schmidt <schmidt@…>, 27 years ago
o header fixed git-svn-id: file:///usr/local/Singular/svn/trunk@411 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: ftmpl_factor.h,v 1.4 1997-06-19 13:11:15 schmidt Exp $ */
3
4#ifndef INCL_FACTOR_H
5#define INCL_FACTOR_H
6
7#include <factoryconf.h>
8
9#ifndef NOSTREAMIO
10#include <iostream.h>
11#endif /* NOSTREAMIO */
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#ifndef NOSTREAMIO
35    void print ( ostream& ) const;
36#endif /* NOSTREAMIO */
37};
38
39#ifndef NOSTREAMIO
40template <class T>
41ostream& operator<< ( ostream & os, const Factor<T> & f );
42#endif /* NOSTREAMIO */
43
44#endif /* ! INCL_FACTOR_H */
Note: See TracBrowser for help on using the repository browser.