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

/magnus/back_end/SessionManager/include/OID.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: OID.h,v 1.6 2000/09/21 21:17:02 alex 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: Declaration of interface class OID
00009 //
00010 // Principal Author: Roger Needham
00011 //
00012 // Status: complete
00013 //
00014 // Revision History:
00015 //
00016 
00017 #ifndef _OID_H_
00018 #define _OID_H_
00019 
00020 
00021 #include <iostream.h>
00022 #include "IPC.h"
00023 
00024 
00025 //---------------------------------------------------------------------------//
00026 //------------------------------- OID ---------------------------------------//
00027 //---------------------------------------------------------------------------//
00028 
00029 class OID
00030 {
00031 public:
00032 
00033   bool operator == ( const OID& oid ) const {
00034          return theOID == oid.theOID;
00035   }
00036 
00037   bool operator != ( const OID& oid ) const {
00038          return theOID != oid.theOID;
00039   }
00040 
00041   inline friend ostream& operator << ( ostream& ostr, const OID& oid ) {
00042          return ostr << oid.theOID;
00043   }
00044 
00045   int hash( ) const { return theOID; }
00046 
00047   int unwrap( ) const { return theOID; }
00048   // We don't want a conversion, even for friends, because of possible
00049   // ambiguity. Making this private creates friendship problems for
00050   // classes in the scope of another class. It seems safe enough to
00051   // permit public unwrapping, since only friends can rewrap.
00052 
00053   /////////////////////////////////////////////////////////////////////////
00054   //                                                                     //
00055   // IPC tools:                                                          //
00056   //                                                                     //
00057   /////////////////////////////////////////////////////////////////////////
00058 
00059   friend ostream& operator < ( ostream& ostr, const OID& oid )
00060   {
00061     ostr < oid.theOID;
00062     return ostr;
00063   }
00064   
00065   friend istream& operator > ( istream& istr, OID& oid )
00066   {
00067     istr > oid.theOID;
00068     return istr;
00069   }
00070 
00071 private:
00072 
00073   friend class Ctor;
00074   friend class SessionManager;
00075   friend class TheObjects;
00076   friend class SMFPGroup;
00077   friend class RunPackage; // @am need to find SMObject by its OID, why is it private?
00078   friend class DatabaseManager;
00079 
00080   OID( int i ) : theOID( i ) { }
00081   // Used by class Ctor, class SessionManager, class TheObjects.
00082 
00083 /*@@db
00084   OID( );  // Hidden, not to be implemented.
00085 */
00086 
00087   int theOID;
00088 
00089  
00090   //@@db temporary declaration.
00091 
00092   
00093 public:
00094 
00095   OID( ) : theOID( 0 ) { }
00096   
00097 };
00098 
00099 #endif

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