Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNRopeRep.h

Go to the documentation of this file.
00001 /* 00002 * Copyright (c) 1997 00003 * Silicon Graphics Computer Systems, Inc. 00004 * 00005 * Permission to use, copy, modify, distribute and sell this software 00006 * and its documentation for any purpose is hereby granted without fee, 00007 * provided that the above copyright notice appear in all copies and 00008 * that both that copyright notice and this permission notice appear 00009 * in supporting documentation. Silicon Graphics makes no 00010 * representations about the suitability of this software for any 00011 * purpose. It is provided "as is" without express or implied warranty. 00012 * 00013 * Heavily modified by KOM/Darmstadt University of Technology, 2000 00014 */ 00015 #ifndef _R_ROPE_REP_H 00016 #define _R_ROPE_REP_H 00017 00018 #include "MNRopeRefCount.h" 00019 #include "MNProtectedVar.h" 00020 00058 struct MNRopeRep 00059 : public MNRopeRefCount 00060 { 00061 public: 00062 typedef ProtectedPtr<uchar_t*> ProtectedUCharPtr; 00063 00064 enum { 00065 _S_max_rope_depth = 45 00066 }; 00067 enum _Tag { 00068 _S_leaf, _S_concat, _S_substringfn, _S_function 00069 }; 00070 00071 size_t _M_size; 00072 _Tag _M_tag:8; 00073 bool _M_is_balanced:8; 00074 unsigned char _M_depth; 00075 00084 ProtectedUCharPtr _M_c_string; 00085 00086 MNRopeRep(_Tag __t, int __d, bool __b, size_t __size) 00087 : MNRopeRefCount(1) 00088 , _M_size(__size) 00089 , _M_tag(__t) 00090 , _M_is_balanced(__b) 00091 , _M_depth(__d) 00092 , _M_c_string(0) 00093 { } 00094 00095 virtual ~MNRopeRep( ) 00096 { } 00097 00098 static void _S_free_string( uchar_t*, size_t __len); 00099 00100 void _M_free_c_string(); 00101 void _M_free_tree(); 00102 00103 void _M_unref_nonnil() 00104 { 00105 if (0 == _M_decr()) _M_free_tree(); 00106 } 00107 00108 void _M_ref_nonnil() 00109 { 00110 _M_incr(); 00111 } 00112 00113 static void _S_unref(MNRopeRep* __t) 00114 { 00115 if (0 != __t) { 00116 __t->_M_unref_nonnil(); 00117 } 00118 } 00119 00120 static void _S_ref(MNRopeRep* __t) 00121 { 00122 if (0 != __t) __t->_M_incr(); 00123 } 00124 00125 static void _S_free_if_unref(MNRopeRep* __t) 00126 { 00127 if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree(); 00128 } 00129 }; 00130 00132 00133 #endif /* _R_ROPE_REP_H */ 00134

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8