Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/magnus/back_end/Elt/include/WordRep.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: WordRep.h,v 1.4 2000/03/03 04:12:30 bormotov Exp $
00003  */
00004 
00005 // Copyright (C) 1994 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 
00008 // Contents: Definition of WordRep class.
00009 //
00010 // Principal Author: Stephane Collart
00011 //
00012 // Status: Useable.
00013 //
00014 // Revision History:
00015 //
00016 // * 01/96 Dmitry B. implemented IPC tools.
00017 //
00018 
00019 #ifndef _WORD_REP_H_
00020 #define _WORD_REP_H_
00021 
00022 
00023 #include "EltRep.h"
00024 #include "WordData.h"
00025 
00026 
00027 struct WordRep : EltRep, WordData {
00028 
00029 // constructors:
00030   
00031   WordRep( int len ) : WordData(len) { }
00032 
00033   WordRep( const Generator& x ) : WordData(x) { }
00034 
00035   WordRep( const Generator& x, const Generator& y ) : WordData(x, y) { }
00036 
00037   WordRep( const VectorOf<Generator>& v ) : WordData(v) { }
00038 
00039   WordRep( const ListOf<Generator>& l ) : WordData(l) { }
00040 
00041   WordRep( const GeneratorType *p, int len ) : WordData(p, len) { }
00042 
00043 // Representation and type stuff:
00044   
00045   PureRep* clone( ) const { return new WordRep(*this); }
00046 
00047   static const Type theWordType;
00048 
00049   static Type type( ) { return theWordType; }
00050 
00051   Type actualType( ) const { return theWordType; }
00052   // overrides EltRep::actualType()
00053 
00054 // :
00055 
00056   Bool operator == ( const EltRep& ) const;
00057   
00058   int hash() const;
00059 
00060   EltRep* operator * ( const EltRep& a ) const;
00061 
00062   EltRep* inverse() const;
00063 
00064   EltRep* rightMultBy( const Generator& x ) const;
00065 
00066   EltRep* leftMultBy( const Generator& x ) const;
00067 
00068   EltRep* conjugateBy( const EltRep* ep ) const;
00069 
00070   EltRep* commutatorWith( const EltRep* ep ) const;
00071 
00072   void printOn(ostream&) const;
00073   // overrides Elt::printOn();
00074 
00075   void debugPrint(ostream&) const;
00076   // overrides Elt::debugPrint();
00077 
00078 
00079   /////////////////////////////////////////////////////////////////////////
00080   //                                                                     //
00081   // IPC tools:                                                          //
00082   //                                                                     //
00083   /////////////////////////////////////////////////////////////////////////
00084     
00085   void write( ostream& ostr ) const
00086   {
00087     ostr < len;
00088     for( int i = 0; i < len; ++i )
00089       ostr < wrd[i];
00090   }
00091 
00092   void read( istream& istr )
00093   {
00094     delete [] wrd;
00095     istr > len;
00096     wrd = new GeneratorType[len];
00097     for( int i = 0; i < len; ++i ) {
00098       istr > wrd[i];
00099 #ifdef DEBUG
00100       if( wrd[i] == 0 ) {
00101         error("WordRep::read(istream&): Zero generator was read");
00102       }
00103 #endif
00104     }
00105   }
00106 
00107 };
00108 
00109 #endif

Generated at Tue Jun 19 09:49:34 2001 for Magnus Classes by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001