Assign.hGo to the documentation of this file.00001
00002
00003 #ifndef _ASSIGN_H
00004 #define _ASSIGN_H
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <stream.h>
00026 #include "../Boolean.h"
00027 #include "../macros.h"
00028 #include "../p-assert.h"
00029 #include "Wrapper.h"
00030 #include "UntypedAssign.h"
00031
00032 template <class T> class Assign : public UntypedAssign {
00033 public:
00034 INLINE Assign(Listable *elem);
00035
00036
00037 INLINE Assign(Wrapper *w);
00038
00039
00040 INLINE Assign(const Assign<T> & a);
00041
00042
00043 INLINE Assign(const UntypedAssign & a);
00044
00045
00046 INLINE ~Assign();
00047
00048
00049 INLINE T & operator = (T *elem);
00050
00051
00052 };
00053
00054
00055
00056
00057
00058 template <class T>
00059 INLINE
00060 Assign<T>::Assign(Listable *elem)
00061 {
00062 #if 0
00063 _used = False;
00064 #endif
00065
00066
00067
00068
00069 _elem.modify( *elem );
00070
00071 _wrap = get_wrap(elem);
00072 if (_wrap)
00073 _wrap->ref_inc();
00074 }
00075
00076 template <class T>
00077 INLINE
00078 Assign<T>::Assign(Wrapper *w)
00079 {
00080 #if 0
00081 _used = False;
00082 #endif
00083
00084 _elem.clear();
00085
00086 _wrap = w;
00087 if (_wrap)
00088 _wrap->ref_inc();
00089 }
00090
00091 template <class T>
00092 INLINE
00093 Assign<T>::Assign(const Assign<T> & a)
00094 {
00095 #if 0
00096 _used = a._used;
00097 #endif
00098 _elem = a._elem;
00099
00100 _wrap = a._wrap;
00101 if (_wrap)
00102 _wrap->ref_inc();
00103 }
00104
00105 template <class T>
00106 INLINE
00107 Assign<T>::Assign(const UntypedAssign & a)
00108 {
00109 #if 0
00110 _used = a._used;
00111 #endif
00112
00113 _elem = a._elem;
00114
00115 _wrap = a._wrap;
00116 if (_wrap)
00117 _wrap->ref_inc();
00118 }
00119
00120 template <class T>
00121 INLINE
00122 Assign<T>::~Assign()
00123 {
00124 #if 0
00125 p_assert( _used, "Assign<T>::~Assign: error not used in an assignment" );
00126 #endif
00127 }
00128
00129 template <class T>
00130 INLINE T &
00131 Assign<T>::operator = (T *new_elem)
00132 {
00133 set_pulled( (Listable *) new_elem, 0 );
00134
00135 #if 0
00136 _used = True;
00137 #endif
00138
00139
00140
00141
00142 _wrap->object((Listable *) new_elem);
00143
00144 return *new_elem;
00145 }
00146
00147 #endif
|