Owner.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 
00023 #ifndef _DWFCORE_OWNER_H
00024 #define _DWFCORE_OWNER_H
00025 
00030 
00031 
00032 #include "dwfcore/SkipList.h"
00033 #include "dwfcore/Exception.h"
00034 
00035 
00036 
00037 namespace DWFCore
00038 {
00039 
00040 
00041 //
00042 // fwd decl
00043 //
00044 class DWFOwnable;
00045 
00046 
00057 class DWFOwner
00058 {
00059 
00060 public:
00061 
00067     _DWFCORE_API
00068     virtual ~DWFOwner()
00069         throw();
00070 
00079     _DWFCORE_API
00080     virtual void notifyOwnerChanged( DWFOwnable& rOwnable )
00081         throw( DWFException );
00082 
00094     _DWFCORE_API
00095     virtual void notifyOwnableDeletion( DWFOwnable& rOwnable )
00096         throw( DWFException );
00097 
00098 protected:
00099 
00105     _DWFCORE_API DWFOwner()
00106         throw();
00107 };
00108 
00116 struct IDWFOwnable
00117 {
00124         _DWFCORE_API
00125     virtual void own( DWFOwner& rOwner )
00126         throw( DWFException ) = 0;
00127 
00139     _DWFCORE_API
00140     virtual bool disown( DWFOwner& rOwner, bool bForget )
00141         throw( DWFException )= 0;
00142 
00149     _DWFCORE_API
00150     virtual DWFOwner* owner()
00151         throw( DWFException )= 0;
00152 
00160     _DWFCORE_API
00161     virtual void observe( DWFOwner& rObserver )
00162         throw( DWFException )= 0;
00163 
00171     _DWFCORE_API
00172     virtual bool unobserve( DWFOwner& rObserver )
00173         throw( DWFException )= 0;
00174 
00180         _DWFCORE_API
00181         virtual ~IDWFOwnable() throw(){}
00182 };
00183 
00196 class DWFOwnable : public IDWFOwnable
00197 {
00198 
00199 public:
00200 
00206     _DWFCORE_API
00207     virtual ~DWFOwnable()
00208         throw();
00209 
00216     _DWFCORE_API
00217     virtual void own( DWFOwner& rOwner )
00218         throw( DWFException );
00219 
00231     _DWFCORE_API
00232     virtual bool disown( DWFOwner& rOwner, bool bForget )
00233         throw( DWFException );
00234 
00241     _DWFCORE_API
00242     virtual DWFOwner* owner()
00243         throw( DWFException );
00244 
00252     _DWFCORE_API
00253     virtual void observe( DWFOwner& rObserver )
00254         throw( DWFException );
00255 
00263     _DWFCORE_API
00264     virtual bool unobserve( DWFOwner& rObserver )
00265         throw( DWFException );
00266 
00267 
00268 protected:
00269 
00275     _DWFCORE_API DWFOwnable()
00276         throw();
00277 
00287     _DWFCORE_API
00288     void _notifyDelete()
00289         throw();
00290 
00291 private:
00292 
00293     DWFOwner*                _pOwner;
00294     std::set<DWFOwner*>      _oOwnerObservers;
00295 };
00296 
00297 }
00298 
00299 
00300 #endif

Generated on Tue Jan 6 22:39:29 2009 for Autodesk DWF Core Library by  doxygen 1.4.5