19 control_word(f.control_word),
20#elif defined(USE_BIT_FIELDS)
23 s_ban_del(f.s_ban_del),
24 s_ban_sub(f.s_ban_sub),
25 s_ban_cop(f.s_ban_cop),
27 s_allow_del_at_zero_count(f.s_allow_del_at_zero_count),
34#elif defined(USE_BIT_FIELDS)
35 if (f.conparam.s_ban_cop == 2) {
37 if (f.s_ban_cop == 2) {
40 <<
"RegPassivePtr::RegPassivePtr(const RegPassivePtr& f):\n"
41 <<
"attempt to copy object whose s_ban_cop == 2.\n";
45 else if (f.get_s_ban_cop() == 1 && f.cpp->get_number_of_booked() > 0) {
46#elif defined(USE_BIT_FIELDS)
47 else if (f.conparam.s_ban_cop == 1 && f.cpp->get_number_of_booked() > 0) {
49 else if (f.s_ban_cop == 1 && f.cpp->get_number_of_booked() > 0) {
52 <<
"RegPassivePtr::RegPassivePtr(const RegPassivePtr& f):\n"
53 <<
"attempt to copy referred object whose s_ban_cop == 1.\n"
54 <<
"f.cpp->get_number_of_booked()=" << f.cpp->get_number_of_booked()
60RegPassivePtr& RegPassivePtr::operator=(const RegPassivePtr& f) {
63 if (f.get_s_ban_cop() == 2) {
64#elif defined(USE_BIT_FIELDS)
65 if (f.conparam.s_ban_cop == 2) {
67 if (f.s_ban_cop == 2) {
70 <<
"RegPassivePtr& RegPassivePtr::operator=(const RegPassivePtr& "
72 <<
"attempt to copy object whose s_ban_cop == 2.\n";
75 } else if (f.get_s_ban_cop() == 1 && f.cpp->get_number_of_booked() > 0) {
76#elif defined(USE_BIT_FIELDS)
77 } else if (f.conparam.s_ban_cop == 1 && f.cpp->get_number_of_booked() > 0) {
79 } else if (f.s_ban_cop == 1 && f.cpp->get_number_of_booked() > 0) {
82 <<
"RegPassivePtr& RegPassivePtr::operator=(const "
83 "RegPassivePtr& f):\n"
84 <<
"attempt to copy referred object whose s_ban_cop == 1.\n"
85 <<
"f.cpp->get_number_of_booked()=" << f.cpp->get_number_of_booked()
90 set_s_ban_cop(f.get_s_ban_cop());
91#ifdef USE_DELETE_AT_ZERO_COUNT
92 set_s_allow_del_at_zero_count(f.get_s_allow_del_at_zero_count());
94 set_s_ban_del(f.get_s_ban_del());
95 if (get_s_ban_sub() == 1)
96#elif defined(USE_BIT_FIELDS)
97 conparam.s_ban_cop = f.conparam.s_ban_cop;
98#ifdef USE_DELETE_AT_ZERO_COUNT
99 conparam.s_allow_del_at_zero_count = f.conparam.s_allow_del_at_zero_count;
101 conparam.s_ban_del = f.conparam.s_ban_del;
102 if (conparam.s_ban_sub == 1)
104 s_ban_cop = f.s_ban_cop;
105#ifdef USE_DELETE_AT_ZERO_COUNT
106 s_allow_del_at_zero_count = f.s_allow_del_at_zero_count;
108 s_ban_del = f.s_ban_del;
113 cpp != NULL && cpp->get_number_of_booked() > 0) {
115 <<
"RegPassivePtr& RegPassivePtr::operator=(const RegPassivePtr& "
117 <<
"self-assignment, s_ban_sub == 1, but the object is addressed.\n"
118 <<
"This can lead to loss of pointers to copied object, not only "
125 else if (get_s_ban_sub() == 2 && cpp != NULL &&
126 cpp->get_number_of_booked() > 0)
127#elif defined(USE_BIT_FIELDS)
128 else if (conparam.s_ban_sub == 2 && cpp != NULL &&
129 cpp->get_number_of_booked() > 0)
131 else if (s_ban_sub == 2 && cpp != NULL && cpp->get_number_of_booked() > 0)
135 <<
"RegPassivePtr& RegPassivePtr::operator=(const RegPassivePtr& "
137 <<
"s_ban_sub == 2, but the object is addressed.\n";
141 set_s_ban_sub(f.get_s_ban_sub());
142#elif defined(USE_BIT_FIELDS)
143 conparam.s_ban_sub = f.conparam.s_ban_sub;
145 s_ban_sub = f.s_ban_sub;
156std::ostream& operator<<(std::ostream& file, const RegPassivePtr& f) {
158#ifdef USE_CHAR_GETSETTERS_PARAMETERS
159 Ifile <<
"RegPassivePtr<X>: s_ban_del/sub/cop=" << int(f.get_s_ban_del())
160 <<
"/" << int(f.get_s_ban_sub()) <<
"/" << int(f.get_s_ban_cop());
162 Ifile <<
"RegPassivePtr<X>: s_ban_del/sub/cop=" << f.get_s_ban_del() <<
"/"
163 << f.get_s_ban_sub() <<
"/" << f.get_s_ban_cop();
165#elif defined USE_BIT_FIELDS
166 Ifile <<
"RegPassivePtr<X>: s_ban_del/sub/cop=" << f.conparam.s_ban_del <<
"/"
167 << f.conparam.s_ban_sub <<
"/" << f.conparam.s_ban_cop;
169#ifdef USE_CHAR_CONTROL_VARIABLES
170 Ifile <<
"RegPassivePtr<X>: s_ban_del/sub/cop=" << int(f.s_ban_del) <<
"/"
171 << int(f.s_ban_sub) <<
"/" << int(f.s_ban_cop);
173 Ifile <<
"RegPassivePtr<X>: s_ban_del/sub/cop=" << f.s_ban_del <<
"/"
174 << f.s_ban_sub <<
"/" << f.s_ban_cop;
182 if (RegPassivePtr::s_print_adr_cpp == 0) {
184 file <<
" cpp=NULL\n";
186 file <<
" cpp!=NULL\n";
189 file <<
" cpp=" << f.cpp <<
'\n';
193 Ifile <<
"cpp->number_of_registered=" << f.cpp->get_number_of_booked()
197#ifdef USE_DELETE_AT_ZERO_COUNT
200 Ifile <<
"s_allow_del_at_zero_count="
201#ifdef USE_CHAR_GETSETTERS_PARAMETERS
202 << int(f.get_s_allow_del_at_zero_count()) <<
'\n';
204 << f.get_s_allow_del_at_zero_count() <<
'\n';
206#elif defined(USE_BIT_FIELDS)
207 Ifile <<
"s_allow_del_at_zero_count=" << f.conparam.s_allow_del_at_zero_count
210#ifdef USE_CHAR_CONTROL_VARIABLES
211 Ifile <<
"s_allow_del_at_zero_count=" << int(f.s_allow_del_at_zero_count)
214 Ifile <<
"s_allow_del_at_zero_count=" << f.s_allow_del_at_zero_count <<
'\n';
231RegPassivePtr::~RegPassivePtr() {
234 cpp->change_rpp(NULL);
235 if (cpp->get_number_of_booked() == 0) {
240 if (s_ban_del_ignore == 0 && get_s_ban_del() == 1)
241#elif defined(USE_BIT_FIELDS)
242 if (s_ban_del_ignore == 0 && conparam.s_ban_del == 1)
244 if (s_ban_del_ignore == 0 && s_ban_del == 1)
247 mcerr <<
"Error in RegPassivePtr::~RegPassivePtr() "
248 <<
"s_ban_del == 1, but there are pointers to this class.\n";
249 mcerr <<
"cpp->number_of_registered=" << cpp->get_number_of_booked()
251 s_ban_del_ignore = 1;