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

/magnus/back_end/global/DerivedObjectOf.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: DerivedObjectOf.h,v 1.1.1.1 1995/11/20 17:54:39 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: A representation pointer wrapper
00009 //
00010 // Principal Author: Stephane Collart
00011 //
00012 // Status: Complete
00013 //
00014 // Description:
00015 //
00016 // Usage:
00017 //
00018 //   @stc see comments in PureRep
00019 //
00020 // Revision History:
00021 //
00022 
00023 
00024 #ifndef _DERIVED_OBJECT_OF_H_
00025 #define _DERIVED_OBJECT_OF_H_
00026 
00027 
00028 template <class Base, class Rep> class DerivedObjectOf : public Base
00029 {
00030   /*!< This class assumes Base is itself an ObjectOf kind of class, i.e.
00031 
00032  1) Base has members look(), enhance(), change() returning some BaseRep* type
00033 
00034  2) Base has a constructor Base( BaseRep* );
00035 
00036  3) BaseRep is directly or indirectly derived from PureRep
00037 
00038  4) Rep is derived from BaseRep
00039   */
00040 
00041 public:
00042 
00043         /////////////////////////////////////////////////////////////////////////
00044         //                                                                     //
00045         // Constructors                                                        //
00046         //                                                                     //  
00047         /////////////////////////////////////////////////////////////////////////
00048 
00049         // copy constructor provided by compiler
00050 
00051         // destructor provided by compiler
00052 
00053         /////////////////////////////////////////////////////////////////////////
00054         //                                                                     //
00055         // Conventional Operators                                              //
00056         //                                                                     //  
00057         /////////////////////////////////////////////////////////////////////////
00058 
00059         // assignment operator provided by compiler
00060 
00061 protected:
00062 
00063         /////////////////////////////////////////////////////////////////////////
00064         //                                                                     //
00065         // Representation Handles                                              //
00066         //                                                                     //  
00067         /////////////////////////////////////////////////////////////////////////
00068 
00069         // Shadowed representation accessors:
00070 
00071         const Rep* look( ) const { return (Rep*)Base::look(); }
00072         /*!< Returns a constant pointer to its representation object
00073           For safe read-only access. */
00074         Rep* enhance( ) const { return (Rep*)Base::enhance(); }
00075         /*!< Returns a pointer to its representation object
00076           \warning for altering an object without triggering cloning.
00077           Use to change theRep without altering semantics.
00078         */
00079         Rep* change( ) { return (Rep*)Base::change(); }
00080         /*!< Returns a pointer to its representation object
00081           For safe read/write access. */
00082 
00083         /////////////////////////////////////////////////////////////////////////
00084         //                                                                     //
00085         // Special Constructors                                                //
00086         //                                                                     //  
00087         /////////////////////////////////////////////////////////////////////////
00088 
00089         DerivedObjectOf( Rep* newrep ) : Base( newrep ) { }
00090         //!< Constructor for base class initialisation
00091 
00092         DerivedObjectOf( const Base& b ) : Base( b ) { }
00093         //!< Constructor for base class intialisation when cast conversion to derived is desired 
00094 
00095 };
00096 
00097 #endif

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