00001 #if !defined (__BRIDGE_HPP)
00002 #define __BRIDGE_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
00043 template <class Implementation>
00044 class Bridge : public CoreLinuxObject
00045 {
00046 public:
00047
00053 Bridge( Implementation aImplementation )
00054 :
00055 CoreLinuxObject(),
00056 theImplementation(aImplementation)
00057 {
00058 ; // do nothing
00059 }
00060
00061
00063
00064 virtual ~Bridge( void )
00065 {
00066 ; // do nothing
00067 }
00068
00069 //
00070 // Operator overloads
00071 //
00080 Bridge & operator=( const Bridge & aRef ) throw(Exception)
00081 {
00082 this->setImplementation( aRef.getImplementation() );
00083 return (*this);
00084 }
00085
00092 bool operator==( const Bridge & ) const
00093 {
00094 return (this == &aRef);
00095 }
00096
00103 bool operator!=( const Bridge & ) const
00104 {
00105 return !(*this == aRef);
00106 }
00107
00108 protected:
00109
00117 Bridge( void ) throw (Assertion)
00118 {
00119 NEVER_GET_HERE;
00120 }
00121
00131 Bridge( const Bridge & ) throw (Assertion)
00132 {
00133 NEVER_GET_HERE;
00134 }
00135 //
00136 // Accessors
00137 //
00143 Implementation getImplementation( void ) const
00144 {
00145 return theImplementation;
00146 }
00147
00148 //
00149 // Mutators
00150 //
00151
00160 void setImplementation( Implementation aImpl ) throw(Exception)
00161 {
00162 theImplementation = cloneImplementation(aImpl);
00163 }
00164
00165
00174 virtual Implementation cloneImplementation
00175 (
00176 Implementation
00177 ) throw(Exception) = 0;
00178
00179 private:
00180
00182
00183 Implementation theImplementation;
00184
00185
00186 };
00187
00188 }
00189
00190 #endif // if !defined(__BRIDGE_HPP)
00191
00192 /*
00193 Common rcs information do not modify
00194 $Author: prudhomm $
00195 $Revision: 1.1 $
00196 $Date: 2000/04/23 20:43:13 $
00197 $Locker: $
00198 */
00199
00200
00201