source: git/factory/templates/ftmpl_afactor.h @ b893ec

spielwiese
Last change on this file since b893ec was f224fda, checked in by Martin Lee <martinlee84@…>, 11 years ago
chg: added new templates to hold absolute factors Conflicts: factory/canonicalform.h factory/ftmpl_inst.cc
  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[f224fda]1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_AFACTOR_H
4#define INCL_AFACTOR_H
5
6#include <factory/factoryconf.h>
7
8#ifndef NOSTREAMIO
9#ifdef HAVE_IOSTREAM
10#include <iostream>
11#define OSTREAM std::ostream
12#elif defined(HAVE_IOSTREAM_H)
13#include <iostream.h>
14#define OSTREAM ostream
15#endif
16#endif /* NOSTREAMIO */
17
18template <class T>
19class AFactor {
20private:
21    T _factor;
22    T _minpoly;
23    int _exp;
24public:
25    AFactor() : _factor(1), _minpoly (1), _exp(0) {}
26    AFactor( const AFactor<T> & f ) : _factor(f._factor), _minpoly (f._minpoly), _exp(f._exp) {}
27    AFactor( const T & f, const T & m, int e ) : _factor(f), _minpoly (m), _exp(e) {}
28    AFactor( const T & f, const T & m ) : _factor(f), _minpoly (m), _exp(1) {}
29    ~AFactor() {}
30    AFactor<T>& operator= ( const AFactor<T>& );
31    T factor() const { return _factor; }
32    T minpoly() const { return _minpoly; }
33    int exp() const { return _exp; }
34    T value() const { return power( _factor, _exp ); }
35#ifndef NOSTREAMIO
36    void print ( OSTREAM& ) const;
37#endif /* NOSTREAMIO */
38};
39
40#ifndef NOSTREAMIO
41template <class T>
42OSTREAM& operator<< ( OSTREAM & os, const AFactor<T> & f );
43#endif /* NOSTREAMIO */
44
45#endif /* ! INCL_AFACTOR_H */
Note: See TracBrowser for help on using the repository browser.