CallForwarder.h

Go to the documentation of this file.
00001 namespace CF {
00002         template<typename TWhat> class CallForwarder {
00003         public:
00004                 CallForwarder(TWhat * ptr) { m_ptr.new_t(ptr); }
00005 
00006                 void Orphan() {*m_ptr = NULL;}
00007                 bool IsValid() const { return *m_ptr != NULL; }
00008                 bool IsEmpty() const { return !IsValid(); }
00009 
00010                 TWhat * operator->() const {
00011                         PFC_ASSERT( IsValid() );
00012                         return *m_ptr;
00013                 }
00014 
00015                 TWhat & operator*() const {
00016                         PFC_ASSERT( IsValid() );
00017                         return **m_ptr;
00018                 }
00019 
00020         private:
00021                 pfc::rcptr_t<TWhat*> m_ptr;
00022         };
00023 
00024         template<typename TWhat> class CallForwarderMaster : public CallForwarder<TWhat> {
00025         public:
00026                 CallForwarderMaster(TWhat * ptr) : CallForwarder<TWhat>(ptr) {}
00027                 ~CallForwarderMaster() { Orphan(); }
00028 
00029                 PFC_CLASS_NOT_COPYABLE(CallForwarderMaster, CallForwarderMaster<TWhat>);
00030         };
00031 
00032 }

Generated on Thu Aug 28 21:15:30 2008 for foobar2000 SDK by  doxygen 1.5.5