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

EventPtr.h

00001 #ifndef _UNEVT_EventPtr_H_  // -*-c++-*-
00002 
00003 /*
00004  * Copyright (C) 1991-9 Eric M. Hopper <hopper@omnifarious.mn.org>
00005  * 
00006  *     This program is free software; you can redistribute it and/or modify it
00007  *     under the terms of the GNU Lesser General Public License as published
00008  *     by the Free Software Foundation; either version 2 of the License, or
00009  *     (at your option) any later version.
00010  * 
00011  *     This program is distributed in the hope that it will be useful, but
00012  *     WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *     Lesser General Public License for more details.
00015  * 
00016  *     You should have received a copy of the GNU Lesser General Public
00017  *     License along with this program; if not, write to the Free Software
00018  *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifdef __GNUG__
00022 #  pragma interface
00023 #endif
00024 
00025 /* $Header: /home/hopper/src/cvs/C++/UniEvent/UniEvent/EventPtr.h,v 1.7 2002/11/25 05:40:05 hopper Exp $ */
00026 
00027 // For log see ../ChangeLog
00028 
00029 #ifndef _UNEVT_Event_H_
00030 #  include <UniEvent/Event.h>
00031 #endif
00032 #include <LCore/RefCountPtrT.h>
00033 
00034 #define _UNEVT_EventPtr_H_
00035 
00036 namespace strmod {
00037 namespace unievent {
00038 
00039 /** \class EventPtr Event.h UniEvent/Event.h
00040  * A smart pointer class that points an Event and handles the reference count.
00041  */
00042 class EventPtr : public lcore::RefCountPtrT<Event>
00043 {
00044  public:
00045    //! An easier way to refer to RefCountPtrT<Evemt>
00046    typedef lcore::RefCountPtrT<Event> super1;
00047    static const UNEVT_ClassIdent identifier;
00048 
00049    //@{
00050    /**
00051     * These all construct an EventPtr from the appropriate type and maintain the
00052     * reference count to the pointed at Event.
00053     */
00054    inline EventPtr(Event *eptr = 0);
00055    inline EventPtr(const EventPtr &b);
00056    inline EventPtr(const super1 &b);
00057    //@}
00058 
00059    //@{
00060    /**
00061     * These all set the value of an EventPtr value from the appropriate type and
00062     * maintain the reference count to the pointed at EVent.
00063     */
00064    inline const EventPtr &operator =(const EventPtr &b);
00065    inline const EventPtr &operator =(const super1 &b);
00066    inline const EventPtr &operator =(Event *b);
00067    //@}
00068 
00069  protected:
00070    virtual const lcore::ClassIdent *i_GetIdent() const  { return &identifier; }
00071 };
00072 
00073 //-----------------------------inline functions--------------------------------
00074 
00075 inline EventPtr::EventPtr(Event *eptr)
00076 {
00077    if (eptr) {
00078       i_SetPtr(eptr);
00079    }
00080 }
00081 
00082 inline EventPtr::EventPtr(const EventPtr &b)
00083 {
00084    if (b.GetPtr()) {
00085       i_SetPtr(b.GetPtr());
00086    }
00087 }
00088 
00089 inline EventPtr::EventPtr(const super1 &b)
00090 {
00091    if (b.GetPtr()) {
00092       i_SetPtr(b.GetPtr());
00093    }
00094 }
00095 
00096 inline const EventPtr &EventPtr::operator =(const EventPtr &b)
00097 {
00098    super1::operator =(b);
00099    return(*this);
00100 }
00101 
00102 inline const EventPtr &EventPtr::operator =(const super1 &b)
00103 {
00104    super1::operator =(b);
00105    return(*this);
00106 }
00107 
00108 inline const EventPtr &EventPtr::operator =(Event *b)
00109 {
00110    super1::operator =(b);
00111    return(*this);
00112 }
00113 
00114 } // namespace unievent
00115 } // namespace strmod
00116 
00117 #endif

Generated on Wed Jan 29 00:32:43 2003 for libNet by doxygen1.3-rc1