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

/magnus/back_end/Group/include/ORWordProblem.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: ORWordProblem.h,v 1.1.1.1 1995/11/20 17:54:21 rogern Exp $
00003  */
00004 
00005 // Copyright (C) 1995 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 //
00008 // Contents: Definition of utility class ORWordProblem, which wraps
00009 //           a BlackBox connected to Dion Gildenhuys' one relator
00010 //           word problem program.
00011 //
00012 // Principal Author: Roger Needham
00013 //
00014 // Status: Under development
00015 //
00016 // Usage:  (@rn out of date)
00017 //
00018 // You need only one object in this class, since the program it talks to
00019 // accepts arbitrarily many pairs of relators and test words.
00020 //
00021 // Multiplexing is not a problem now, since BlackBox communication is
00022 // strictly synchronous.
00023 //
00024 // First call findAnswer(const Word& relator, const Word& testWord)
00025 // to compute the result.
00026 // Then call goodStatus( ) to see if anything went wrong.
00027 // If that returns true, get the result from isTrivial( ),
00028 // otherwise this effectively shuts down forever.
00029 //
00030 // Revision History:
00031 //
00032 
00033 
00034 #ifndef _OR_WORD_PROBLEM_H_
00035 #define _OR_WORD_PROBLEM_H_
00036 
00037 
00038 #include "BlackBox.h"
00039 #include "Word.h"
00040 
00041 
00042 class ORWordProblem {
00043 
00044 public:
00045 
00046   //////////////////////////////////////////////////////////////
00047   //                                                          //
00048   // Constructors:                                            //
00049   //                                                          //
00050   //////////////////////////////////////////////////////////////
00051 
00052   ORWordProblem(const Word& relator);
00053 
00054   ~ORWordProblem( ) { delete orwp; }
00055 
00056   /////////////////////////////////////////////////////////////////////////
00057   //                                                                     //
00058   // Activation members:                                                 //
00059   //                                                                     //
00060   /////////////////////////////////////////////////////////////////////////
00061 
00062   void findAnswer(const Word& testWord);
00063   // This will not return until it has the answer.
00064 
00065   //////////////////////////////////////////////////////////////////////
00066   //                                                                  //
00067   // Accessors:                                                       //
00068   //                                                                  //
00069   //////////////////////////////////////////////////////////////////////
00070 
00071   bool goodStatus( ) { return status; }
00072 
00073   bool isTrivial( );
00074 
00075 private:
00076 
00077   //////////////////////////////////////////////////////////////////////
00078   //                                                                  //
00079   // Data Members:                                                    //
00080   //                                                                  //
00081   //////////////////////////////////////////////////////////////////////
00082 
00083   BlackBox* orwp;
00084   // Wraps the orwp executable.
00085 
00086   const Word theRelator;
00087 
00088   bool status;
00089   // True until something goes wrong, then we give up altogether.
00090 
00091   bool result;
00092   // The last answer computed.
00093 
00094   //////////////////////////////////////////////////////////////////////
00095   //                                                                  //
00096   // Private Members:                                                 //
00097   //                                                                  //
00098   //////////////////////////////////////////////////////////////////////
00099 
00100   void printWord(const Word& w, ostream& ostr);
00101   // Output w in Dion's format.
00102 
00103 };
00104 
00105 #endif

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