• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

baciSmartServantPointer.h

Go to the documentation of this file.
00001 #ifndef SMARTSERVANTPOINTER_H
00002 #define SMARTSERVANTPOINTER_H
00003 /*******************************************************************************
00004 * ALMA - Atacama Large Millimiter Array
00005 * (c) European Southern Observatory, 2004 
00006 *
00007 *This library is free software; you can redistribute it and/or
00008 *modify it under the terms of the GNU Lesser General Public
00009 *License as published by the Free Software Foundation; either
00010 *version 2.1 of the License, or (at your option) any later version.
00011 *
00012 *This library is distributed in the hope that it will be useful,
00013 *but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 *Lesser General Public License for more details.
00016 *
00017 *You should have received a copy of the GNU Lesser General Public
00018 *License along with this library; if not, write to the Free Software
00019 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * "@(#) $Id: baciSmartServantPointer.h,v 1.4 2005/01/07 23:41:17 dfugate Exp $"
00022 *
00023 * who       when      what
00024 * --------  --------  ----------------------------------------------
00025 * acaproni  2004-04-06  created
00026 */
00027 
00033 #include "lokiSmartPtr.h"
00034 
00035 namespace baci 
00036 {
00037 
00045         template <class T> class CORBAServantSPStorage:
00046         public Loki::DefaultSPStorage<T>
00047                 {
00048                 public:
00054                     typedef T* StoredType;
00058                 CORBAServantSPStorage() : Loki::DefaultSPStorage<T>() 
00059                 {}
00060 
00061                 // The storage policy doesn't initialize the stored pointer 
00062                 //     which will be initialized by the OwnershipPolicy's Clone fn
00063                 CORBAServantSPStorage(const CORBAServantSPStorage& st) : 
00064                         Loki::DefaultSPStorage<T>(st)
00065                 {}
00066 
00067                 template <class U>
00068                         CORBAServantSPStorage(const CORBAServantSPStorage<U>& st) : 
00069                         Loki::DefaultSPStorage<U>(st) 
00070                 {}
00071         
00072                 CORBAServantSPStorage(const StoredType& p) : 
00073                         Loki::DefaultSPStorage<T>(p) {}
00074         
00075 
00076         protected:
00077             // CORBA Servants cannot be deleted.
00078             // One must call Destroy()
00079             void Destroy()
00080                 {
00081                     if(GetImpl(*this) != 0)
00082                         {
00083                         (*this)->destroy(); 
00084                         }
00085                 }  
00086         };
00087 
00088         template<class T>
00089         class SmartServantPointer: public  Loki::SmartPtr<
00090             T, 
00091             Loki::RefCounted, 
00092             Loki::AllowConversion,
00093             Loki::AssertCheck,
00094             CORBAServantSPStorage
00095             >
00096         {
00097           public:
00098             SmartServantPointer();
00099             SmartServantPointer(T* prop);
00100         };
00101         
00102 } // End of namespace baci
00103 
00104 #include "baciSmartServantPointer.i"
00105 
00106 #endif /*SMARTSERVANTPOINTER_H*/

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0