00001 #ifndef _STR_StrChunkPtrT_H_ // -*-c++-*-
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifdef __GNUG__
00022 # pragma interface
00023 #endif
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef _STR_StrChunkPtr_H_
00035 # include <StrMod/StrChunkPtr.h>
00036 #endif
00037 #ifndef _STR_StrChunk_H_
00038 # include <StrMod/StrChunk.h>
00039 #endif
00040
00041 #define _STR_StrChunkPtrT_H_
00042
00043 namespace strmod {
00044 namespace strmod {
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 template <class Chunk>
00062 class StrChunkPtrT : public StrChunkPtr
00063 {
00064 public:
00065
00066 typedef StrChunkPtr super1;
00067
00068
00069
00070
00071
00072
00073 inline StrChunkPtrT(const StrChunkPtrT<Chunk> &b) : super1(b) { }
00074 inline StrChunkPtrT(const lcore::RefCountPtrT<Chunk> &b) : super1(b.GetPtr()) { }
00075 inline StrChunkPtrT(Chunk *stptr = 0) : super1(stptr) { }
00076
00077
00078
00079
00080
00081
00082 inline Chunk &operator *() const;
00083 inline Chunk *operator ->() const;
00084
00085
00086
00087 inline Chunk *GetPtr() const;
00088
00089
00090
00091
00092
00093
00094 inline const StrChunkPtrT<Chunk> &operator =(const StrChunkPtrT<Chunk> &b);
00095 inline const StrChunkPtrT<Chunk> &operator =(const lcore::RefCountPtrT<Chunk> &b);
00096 inline const StrChunkPtrT<Chunk> &operator =(Chunk *b);
00097
00098
00099 protected:
00100
00101 inline virtual lcore::ReferenceCounting *i_CheckType(lcore::ReferenceCounting *p) const;
00102 };
00103
00104
00105
00106 template <class Chunk>
00107 inline Chunk &StrChunkPtrT<Chunk>::operator *() const
00108 {
00109 return(*GetPtr());
00110 }
00111
00112 template <class Chunk>
00113 inline Chunk *StrChunkPtrT<Chunk>::operator ->() const
00114 {
00115 return(GetPtr());
00116 }
00117
00118 template <class Chunk>
00119 inline Chunk *StrChunkPtrT<Chunk>::GetPtr() const
00120 {
00121 return(static_cast<Chunk *>(super1::GetPtr()));
00122 }
00123
00124 template <class Chunk>
00125 inline const StrChunkPtrT<Chunk> &
00126 StrChunkPtrT<Chunk>::operator =(const StrChunkPtrT<Chunk> &b)
00127 {
00128 super1::operator =(b);
00129 return(*this);
00130 }
00131
00132 template <class Chunk>
00133 inline const StrChunkPtrT<Chunk> &
00134 StrChunkPtrT<Chunk>::operator =(const lcore::RefCountPtrT<Chunk> &b)
00135 {
00136 super1::operator =(b);
00137 return(*this);
00138 }
00139
00140 template <class Chunk>
00141 inline const StrChunkPtrT<Chunk> &
00142 StrChunkPtrT<Chunk>::operator =(Chunk *b)
00143 {
00144 super1::operator =(b);
00145 return(*this);
00146 }
00147
00148 template <class Chunk>
00149 inline lcore::ReferenceCounting *
00150 StrChunkPtrT<Chunk>::i_CheckType(lcore::ReferenceCounting *p) const
00151 {
00152 return(((p != 0) && p->AreYouA(Chunk::identifier)) ? p : 0);
00153 }
00154
00155 }
00156 }
00157
00158 #endif