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

/magnus/back_end/SessionManager/include/OutMessages.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: OutMessages.h,v 1.10 2000/02/10 00:11:43 bormotov 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: Declarations of class OutMessage, and derivatives
00009 //           ARCUpdate, CheckinMessage, FEDataUpdate, LogMessage,
00010 //           ParseErrorMessage, StateTransition, Warning
00011 //
00012 // Principal Author: Roger Needham
00013 //
00014 // Status: useable
00015 //
00016 // Revision History:
00017 //
00018 // 01/25/98 @am added ParseParamErrorMessage class. It reports to
00019 // the front end about parsing errors in parameters.
00020 //
00021 // 01/27/2000 @am added PackageInfoMessage class. 
00022 
00023 #ifndef _OUTMESSAGES_H_
00024 #define _OUTMESSAGES_H_
00025 
00026 #include <stdio.h>
00027 #include <iostream.h>
00028 #include "Chars.h"
00029 #include "List.h"
00030 #include "ARC.h"
00031 #include "ARCSlotID.h"
00032 #include "FEData.h"
00033 #include "VectorPtr.h"
00034 
00035 //---------------------------------------------------------------------------//
00036 //--------------------------- OutMessage ------------------------------------//
00037 //---------------------------------------------------------------------------//
00038 
00039 // At some point we should use a hidden ostream, not cout.
00040 
00041 class OutMessage
00042 {
00043 public:
00044 
00045   void send( ) const;
00046 
00047 protected:
00048 
00049   OutMessage( ) { } //@rn gcc 2.6.3 claims I need this...
00050 
00051   virtual void print(ostream& ostr) const = 0;
00052   // Used by class SessionManager.
00053 
00054 private:
00055 
00056   OutMessage( const OutMessage& );
00057   // Hidden, not to be implemented.
00058 };
00059 
00060 
00061 //---------------------------------------------------------------------------//
00062 //--------------------------- LogMessage ------------------------------------//
00063 //---------------------------------------------------------------------------//
00064 
00065 class LogMessage : public OutMessage, protected FEData, public ostrstream
00066 {
00067 public:
00068 
00069   // Do *NOT* mess with the ostrstream directly, unless you like debugging.
00070   // It is imported publicly only to get the existing << operators.
00071 
00072   // The following ctors initialize a message to the logs of the views of
00073   // the indicated OIDs (no OID means the session log only).
00074   // message_level == 1 means the message should be echoed to the session log;
00075   // message_level == 2 means the message is only for the addressed log.
00076 
00077   LogMessage(int message_level = 1);
00078 
00079   LogMessage(OID o, int message_level = 1);
00080 
00081   LogMessage(OID o1, OID o2, int message_level = 1);
00082 
00083   LogMessage(OID o1, OID o2, OID o3, int message_level = 1);
00084 
00085   LogMessage( const char* msg, int message_level = 1);
00086 
00087   LogMessage(OID o, const char* msg, int message_level = 1);
00088 
00089 protected:
00090 
00091   void print(ostream& ostr) const;  // overrides OutMessage
00092 
00093 private:
00094 
00095   int num_addressees;
00096 
00097   VectorPtrOf<OID> oids; //[3];
00098   
00099   int level;
00100 };
00101 
00102 
00103 //---------------------------------------------------------------------------//
00104 //------------------------ ParseErrorMessage --------------------------------//
00105 //---------------------------------------------------------------------------//
00106 
00107 
00108 class ParseErrorMessage : public OutMessage
00109 {
00110 public:
00111 
00112   ParseErrorMessage(const Chars name, const Chars diagnosis);
00113   // The FE requires that `diagnosis' start with an int indicating the
00114   // position of the error, followed by a ' '. Use 0 if no other value
00115   // is appropriate.
00116 
00117 protected:
00118 
00119   void print(ostream& ostr) const;  // overrides OutMessage
00120 
00121 private:
00122 
00123   const Chars theName;
00124   const Chars theDiagnosis;
00125 };
00126 
00127 //---------------------------------------------------------------------------//
00128 //------------------------ PackageInfoMessage ---------------------------//
00129 //---------------------------------------------------------------------------//
00130 
00131 class PackageInfoMessage : public OutMessage
00132 {
00133 public:
00134   
00135   PackageInfoMessage(const Chars& name, const Chars& command, 
00136                      const Chars& ch_type, const Chars& obj);
00137 protected:
00138   
00139   void print(ostream& ostr) const;  // overrides OutMessage
00140   
00141 private:
00142   
00143   const Chars theChType;
00144   const Chars theName;
00145   const Chars theObject;
00146   const Chars theCommand;
00147  
00148 };
00149 
00150 //---------------------------------------------------------------------------//
00151 //------------------------ ParseParamErrorMessage ---------------------------//
00152 //---------------------------------------------------------------------------//
00153 
00154 class ParseParamErrorMessage : public OutMessage
00155 {
00156 public:
00157   
00158   ParseParamErrorMessage(OID o,const Chars& name, 
00159                          const Chars& type,
00160                          const Chars& msg);
00161 protected:
00162   
00163   void print(ostream& ostr) const;  // overrides OutMessage
00164   
00165 private:
00166   
00167   OID theOID;
00168   const Chars theType;
00169   const Chars theName;
00170   const Chars theMsg;
00171   
00172 };
00173 
00174 //---------------------------------------------------------------------------//
00175 //------------------------ ParseParamOk -------------------------------------//
00176 //---------------------------------------------------------------------------//
00177 
00178 class ParseParamOk : public ParseParamErrorMessage
00179 {
00180 public:
00181   
00182   ParseParamOk(OID o):
00183     ParseParamErrorMessage(o,"Parameters","","none") { }
00184 };
00185 
00186 //---------------------------------------------------------------------------//
00187 //------------------------- CheckinMessage ----------------------------------//
00188 //---------------------------------------------------------------------------//
00189 
00190 class CheckinMessage : public OutMessage
00191 {
00192 public:
00193 
00194   CheckinMessage(const class SMObject& smo,
00195                  const Chars name,
00196                  const ListOf<OID> dependencies,
00197                  bool bPrintDefinition = true
00198                  );
00199 
00200   // Copy ctor and dtor supplied by compiler
00201 
00202 protected:
00203 
00204   void print(ostream& ostr) const;  // overrides OutMessage
00205 
00206 private:
00207 
00208   const class SMObject& theSMO;
00209   const Chars theName;
00210   const ListOf<OID> theDependencies;
00211   bool BPrintDefinition;
00212 
00213 };
00214 
00215 
00216 //---------------------------------------------------------------------------//
00217 //-------------------------- FEDataUpdate -----------------------------------//
00218 //---------------------------------------------------------------------------//
00219 
00220 class FEDataUpdate : public OutMessage, protected FEData
00221 {
00222 public:
00223   
00224   FEDataUpdate( const Key& key, const Expression& datum )
00225     : theKey( key ), theDatum( datum )
00226   { }
00227 
00228 protected:
00229   
00230   void print(ostream& ostr) const;  // overrides OutMessage
00231 
00232 private:
00233 
00234   const Key theKey;
00235   const Expression theDatum;
00236 };
00237 
00238 
00239 //---------------------------------------------------------------------------//
00240 //------------------------- StateTransition ---------------------------------//
00241 //---------------------------------------------------------------------------//
00242 
00243 class StateTransition : public OutMessage
00244 {
00245 public:
00246 
00247   enum Kind { START, SUSPEND, RESUME, TERMINATE, STALLED };
00248 
00249   StateTransition(Kind k, OID o) : kind( k ), oid( o ) { }
00250 
00251 protected:
00252   
00253   void print(ostream& ostr) const;  // overrides OutMessage
00254 
00255 private:
00256 
00257   const Kind kind;
00258   const OID oid;
00259 };
00260 
00261 
00262 //---------------------------------------------------------------------------//
00263 //---------------------------- ARCUpdate ------------------------------------//
00264 //---------------------------------------------------------------------------//
00265 
00266 class ARCUpdate : public OutMessage
00267 {
00268 public:
00269 
00270   ARCUpdate(OID o, ARCSlotID a, ARC v) : oid( o ), asi( a ), value( v ) { }
00271 
00272 protected:
00273   
00274   void print(ostream& ostr) const;  // overrides OutMessage
00275 
00276 private:
00277 
00278   OID oid;
00279   ARCSlotID asi;
00280   ARC value;
00281 
00282 };
00283 
00284 
00285 //---------------------------------------------------------------------------//
00286 //----------------------------- Warning -------------------------------------//
00287 //---------------------------------------------------------------------------//
00288 
00289 class Warning : public OutMessage, protected FEData, public ostrstream
00290 {
00291   // Do *NOT* mess with the ostrstream directly, unless you like debugging.
00292   // It is imported publicly only to get the existing << operators.
00293 
00294 protected:
00295   
00296   void print(ostream& ostr) const;  // overrides OutMessage
00297 
00298 };
00299 
00300 
00301 //----------------------------- Message -------------------------------------//
00302 
00303 
00304 class Message : public OutMessage, protected FEData, public ostrstream
00305 {
00306 
00307 public:
00308   
00309   Message( Chars title = "Information" ) : theTitle( title ) { }
00310 
00311 protected:
00312   
00313   void print(ostream& ostr) const;  // overrides OutMessage
00314 
00315 private:
00316 
00317   Chars theTitle;
00318 };
00319 
00320 //-------------------------- InvokingMessage --------------------------------//
00321 
00322 
00323 class InvokingMessage : public OutMessage, protected FEData, public ostrstream
00324 {
00325 
00326 public:
00327   
00328   InvokingMessage( ) { }
00329 
00330 protected:
00331   
00332   void print(ostream& ostr) const;  // overrides OutMessage
00333 };
00334 
00335 
00336 #endif

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