Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

Decorator.hpp

00001 #if !defined (__DECORATOR_HPP)
00002 #define __DECORATOR_HPP
00003 
00004 /*
00005   CoreLinux++ 
00006   Copyright (C) 1999,2000 CoreLinux Consortium
00007   
00008    The CoreLinux++ Library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public License as
00010    published by the Free Software Foundation; either version 2 of the
00011    License, or (at your option) any later version.
00012 
00013    The CoreLinux++ Library Library is distributed in the hope that it will 
00014    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public
00019    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00020    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.  
00022 */   
00023 
00024 #if   !defined(__COMMON_HPP)
00025 #include <Common.hpp>
00026 #endif
00027   
00028 
00029 namespace corelinux
00030 {
00031 
00038    template <class Implementation>
00039       class Decorator : public CoreLinuxObject
00040       {
00041       public:
00042 
00043          //
00044          // Constructors
00045          //
00046    
00052                               Decorator( Implementation aImplementation )
00053                                  :
00054                                  CoreLinuxObject(),
00055                                  theImplementation(aImplementation)
00056                               {
00057                                  ;  // do nothing
00058                               }
00059    
00065                               Decorator( const Decorator &aDecorator ) 
00066                                  :
00067                                  CoreLinuxObject(),
00068                                  theImplementation
00069                                     ( 
00070                                        aDecorator.getImplementation() 
00071                                     )
00072                               {
00073                                  ; // do nothing
00074                               }
00075    
00077    
00078          virtual              ~Decorator( void )
00079          {
00080             ;  // do nothing
00081          }
00082    
00083          //
00084          // Operator overloads
00085          //
00094                   Decorator &  operator=( const Decorator & aDecorator ) 
00095                      throw(Exception)
00096                   {
00097                      this->setImplementation
00098                         (  aDecorator.getImplementation() );
00099 
00100                      return (*this);
00101                   }
00102    
00109                   bool     operator==( const Decorator & aDecorator ) const
00110                   {
00111                      return 
00112                         (
00113                            this == &aDecorator && 
00114                            (
00115                               this->getImplementation() == 
00116                                  aDecorator.getImplementation() 
00117                            )
00118                         );
00119                   }
00120    
00121          //
00122          // Accessors
00123          //
00124    
00130          virtual  Implementation getImplementation( void ) const
00131                   {
00132                      return theImplementation;
00133                   }
00134 
00135          //
00136          // Mutators
00137          //
00138 
00144          virtual  void  setImplementation( Implementation aImplementation )
00145                      throw(Exception)
00146                   {
00147                      theImplementation = aImplementation;
00148                   }
00149 
00150       protected:
00151 
00152          //
00153          // Constructors
00154          //
00155    
00163                               Decorator( void ) 
00164                                  throw (Assertion)
00165                                  :
00166                                  CoreLinuxObject()
00167                               {
00168                                  NEVER_GET_HERE;
00169                               }
00170    
00171    
00172       protected:
00173    
00175    
00176                   Implementation   theImplementation;
00177    
00178    
00179       };
00180 
00181 }
00182           
00183 #endif   // if !defined(__DECORATOR_HPP)
00184 
00185 /*
00186    Common rcs information do not modify
00187    $Author: prudhomm $
00188    $Revision: 1.1 $
00189    $Date: 2000/04/23 20:43:13 $
00190    $Locker:  $
00191 */
00192 
00193 
00194 
00195 

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium