source: git/factory/templates/ftmpl_factor.h @ 8c0163

spielwiese
Last change on this file since 8c0163 was 8c0163, checked in by Jens Schmidt <schmidt@…>, 27 years ago
#include <config.h> added the header config.h will be included be makeheader git-svn-id: file:///usr/local/Singular/svn/trunk@161 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.4 KB
Line 
1// emacs edit mode for this file is -*- C++ -*-
2// $Id: ftmpl_factor.h,v 1.2 1997-04-15 10:08:06 schmidt Exp $
3
4#ifndef INCL_FACTOR_H
5#define INCL_FACTOR_H
6
7/*
8$Log: not supported by cvs2svn $
9Revision 1.1  1997/03/27 10:30:35  schmidt
10stream-io wrapped by NOSTREAMIO
11
12Revision 1.0  1996/05/17 11:06:32  stobbe
13Initial revision
14
15*/
16
17/*MAKEHEADER*/
18#include "templates/config.h"
19
20#ifndef NOSTREAMIO
21#include <iostream.h>
22#endif /* NOSTREAMIO */
23
24
25template <class T>
26class Factor {
27private:
28    T _factor;
29    int _exp;
30public:
31    Factor() : _factor(1), _exp(0) {}
32    Factor( const Factor<T> & f ) : _factor(f._factor), _exp(f._exp) {}
33    Factor( const T & f, int e ) : _factor(f), _exp(e) {}
34    Factor( const T & f ) : _factor(f), _exp(1) {}
35    ~Factor() {}
36    Factor<T>& operator= ( const Factor<T>& );
37    Factor<T>& operator= ( const T& );
38    T factor() const { return _factor; }
39    int exp() const { return _exp; }
40    T value() const { return power( _factor, _exp ); }
41    Factor<T>& operator+= ( int i ) { _exp += i; return *this; }
42    Factor<T>& operator*= ( int i ) { _exp *= i; return *this; }
43    Factor<T>& operator*= ( const T & f ) { _factor *= f; return *this; }
44    friend int operator== ( const Factor<T>&, const Factor<T>& );
45#ifndef NOSTREAMIO
46    void print ( ostream& ) const;
47#endif /* NOSTREAMIO */
48};
49
50#ifndef NOSTREAMIO
51template <class T>
52ostream& operator<< ( ostream & os, const Factor<T> & f );
53#endif /* NOSTREAMIO */
54
55#endif /* INCL_FACTOR_H */
Note: See TracBrowser for help on using the repository browser.