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

StrChunkPtr.h

00001 #ifndef _STR_StrChunkPtr_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++/StrMod/StrMod/StrChunkPtr.h,v 1.14 2002/11/25 05:40:05 hopper Exp $ */
00026 
00027 // For a change log see ../ChangeLog
00028 // 
00029 // Revision 1.5  1998/11/03 00:27:06  hopper
00030 // Changed operator bool to the more proper (with my bool.h) bool_cst.
00031 //
00032 // Revision 1.4  1996/08/24 13:01:39  hopper
00033 // Added new operator ! method as a counterpart to the operator bool
00034 // conversion.
00035 //
00036 // Revision 1.3  1996/07/07 20:57:27  hopper
00037 // Fixed bug in StrChunkPtr::i_CheckType
00038 //
00039 // Revision 1.2  1996/07/05 19:46:25  hopper
00040 // Various changed to make implementing StrChunkPtrT template easier and
00041 // more efficient.
00042 //
00043 // Revision 1.1  1996/06/29 06:55:50  hopper
00044 // New class StrChunkPtr that acts as a reference counted pointer to
00045 // StrChunk
00046 //
00047 
00048 #include <cassert>
00049 #include <LCore/Protocol.h>
00050 #include <LCore/RefCountPtrT.h>
00051 #ifndef _STR_STR_ClassIdent_H_
00052 #  include <StrMod/STR_ClassIdent.h>
00053 #endif
00054 #ifndef _STR_StrChunk_H_
00055 #  include <StrMod/StrChunk.h>
00056 #endif
00057 
00058 #define _STR_StrChunkPtr_H_
00059 
00060 namespace strmod {
00061 namespace strmod {
00062 
00063 class StrChunk;
00064 
00065 /** \class StrChunkPtr StrChunkPtr.h StrMod/StrChunkPtr.h
00066  * A smart pointer class that points a StrChunks and handles their reference
00067  * counts.
00068  */
00069 class StrChunkPtr : public lcore::RefCountPtrT<StrChunk>
00070 {
00071  public:
00072    //! An easier way to refer to RefCountPtrT<StrChunk>
00073    typedef lcore::RefCountPtrT<StrChunk> super1;
00074    static const STR_ClassIdent identifier;
00075 
00076    //@{
00077    /**
00078     * These all construct a StrChunkPtr from the appropriate type and maintain
00079     * the reference count to the pointed at StrChunk.
00080     */
00081    inline StrChunkPtr(const StrChunkPtr &b);
00082    inline StrChunkPtr(const super1 &b);
00083    inline StrChunkPtr(StrChunk *stptr = 0);
00084    //@}
00085 
00086    //! See class Protocol
00087    inline virtual int AreYouA(const lcore::ClassIdent &cid) const;
00088 
00089    //@{
00090    /**
00091     * These all set a StrChunkPtrs value from the appropriate type and
00092     * maintain the reference count to the pointed at StrChunk.
00093     */
00094    inline const StrChunkPtr &operator =(const StrChunkPtr &b);
00095    inline const StrChunkPtr &operator =(const super1 &b);
00096    inline const StrChunkPtr &operator =(StrChunk *b);
00097    //@}
00098 
00099  protected:
00100    virtual const lcore::ClassIdent *i_GetIdent() const { return(&identifier); }
00101 };
00102 
00103 //-----------------------------inline functions--------------------------------
00104 
00105 inline StrChunkPtr::StrChunkPtr(const StrChunkPtr &b) : super1(b)
00106 {
00107 }
00108 
00109 inline StrChunkPtr::StrChunkPtr(const super1 &b) : super1(b)
00110 {
00111 }
00112 
00113 inline StrChunkPtr::StrChunkPtr(StrChunk *stptr) : super1(stptr)
00114 {
00115 }
00116 
00117 inline int StrChunkPtr::AreYouA(const lcore::ClassIdent &cid) const
00118 {
00119    return((identifier == cid) || Protocol::AreYouA(cid));
00120 }
00121 
00122 inline const StrChunkPtr &StrChunkPtr::operator =(const StrChunkPtr &b)
00123 {
00124    super1::operator =(b);
00125    return(*this);
00126 }
00127 
00128 inline const StrChunkPtr &StrChunkPtr::operator =(const super1 &b)
00129 {
00130    super1::operator =(b);
00131    return(*this);
00132 }
00133 
00134 inline const StrChunkPtr &StrChunkPtr::operator =(StrChunk *b)
00135 {
00136    super1::operator =(b);
00137    return(*this);
00138 }
00139 
00140 }  // namespace strmod
00141 }  // namespace strmod
00142 
00143 #endif

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