00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #include "UgliGeometry/UgliPlnHandle.h"
00013 #include "UgliGeometry/UgliPlnNode.h"
00014
00015
00016 #include "MessageService/MsgService.h"
00017 CVSID("$Id: UgliPlnHandle.cxx,v 1.7 2008/01/18 21:07:48 rhatcher Exp $");
00018
00019 #include <cassert>
00020
00021
00022 ClassImp(UgliPlnHandle)
00023
00024
00025 UgliPlnHandle::UgliPlnHandle()
00026 : fUgliPlnNode(0),fGeoPlnNode(0)
00027 {
00028
00029
00030 MSG("Ugli",Msg::kError) <<
00031 "UgliPlnHandle created by default ctor" << endl;
00032
00033 }
00034
00035
00036 UgliPlnHandle::~UgliPlnHandle()
00037 {
00038
00039 if ( fUgliPlnNode || fGeoPlnNode ) {
00040 #ifdef VERBOSE_MSG
00041 MSG("Ugli",Msg::kVerbose)
00042 << "destroy handle to " << GetPlexPlaneId() << endl;
00043 #endif
00044 if ( fUgliPlnNode ) {
00045 fUgliPlnNode->DecrementRef();
00046 fUgliPlnNode = 0;
00047 }
00048 else {
00049 fGeoPlnNode->DecrementRef();
00050 fGeoPlnNode = 0;
00051 }
00052 }
00053 #ifdef VERBOSE_MSG
00054 else
00055 MSG("Ugli",Msg::kVerbose)
00056 << "destroy handle to <no-node>" << endl;
00057 #endif
00058
00059 }
00060
00061
00062 UgliPlnHandle::UgliPlnHandle(UgliPlnNode* node)
00063 : fUgliPlnNode(node),fGeoPlnNode(0)
00064 {
00065
00066
00067 if (fUgliPlnNode) {
00068 fUgliPlnNode->IncrementRef();
00069 #ifdef VERBOSE_MSG
00070 MSG("Ugli",Msg::kVerbose)
00071 << "create handle to " << GetPlexPlaneId() << endl;
00072 #endif
00073 }
00074 #ifdef VERBOSE_MSG
00075 else
00076 MSG("Ugli",Msg::kVerbose) << "create handle to <no-node>" << endl;
00077 #endif
00078
00079 }
00080
00081
00082 UgliPlnHandle::UgliPlnHandle(GeoPlnNode* node)
00083 : fUgliPlnNode(0),fGeoPlnNode(node)
00084 {
00085
00086
00087 if (fGeoPlnNode) {
00088 fGeoPlnNode->IncrementRef();
00089 #ifdef VERBOSE_MSG
00090 MSG("Ugli",Msg::kVerbose)
00091 << "create geo handle to " << GetPlexPlaneId() << endl;
00092 #endif
00093 }
00094 #ifdef VERBOSE_MSG
00095 else
00096 MSG("Ugli",Msg::kVerbose) << "create geo handle to <no-node>" << endl;
00097 #endif
00098
00099 }
00100
00101
00102 UgliPlnHandle::UgliPlnHandle(const UgliPlnHandle &that)
00103 : UgliPlnABC(),fUgliPlnNode(that.fUgliPlnNode),
00104 fGeoPlnNode(that.fGeoPlnNode)
00105 {
00106
00107 if (fUgliPlnNode || fGeoPlnNode) {
00108 if ( fUgliPlnNode ) fUgliPlnNode->IncrementRef();
00109 if ( fGeoPlnNode ) fGeoPlnNode->IncrementRef();
00110 #ifdef VERBOSE_MSG
00111 MSG("Ugli",Msg::kVerbose) << "copy ctor to " << GetPlexPlaneId() << endl;
00112 #endif
00113 }
00114 #ifdef VERBOSE_MSG
00115 else
00116 MSG("Ugli",Msg::kVerbose) << "copy ctor to <no-node>" << endl;
00117 #endif
00118
00119 }
00120
00121
00122 UgliPlnHandle& UgliPlnHandle::operator=(const UgliPlnHandle& that)
00123 {
00124
00125
00126 if ( this == &that ) return *this;
00127
00128 if ( fUgliPlnNode || fGeoPlnNode ) {
00129 if ( fUgliPlnNode ) fUgliPlnNode->DecrementRef();
00130 if ( fGeoPlnNode ) fGeoPlnNode->DecrementRef();
00131 #ifdef VERBOSE_MSG
00132 MSG("Ugli",Msg::kVerbose)
00133 << "assignment from " << GetPlexPlaneId() << endl;
00134 #endif
00135 }
00136 #ifdef VERBOSE_MSG
00137 else
00138 MSG("Ugli",Msg::kVerbose) << "assignment from <no-node>" << endl;
00139 #endif
00140
00141 fUgliPlnNode = that.fUgliPlnNode;
00142 fGeoPlnNode = that.fGeoPlnNode;
00143
00144 if ( fUgliPlnNode || fGeoPlnNode ) {
00145 if ( fUgliPlnNode ) fUgliPlnNode->IncrementRef();
00146 if ( fGeoPlnNode ) fGeoPlnNode->IncrementRef();
00147 #ifdef VERBOSE_MSG
00148 MSG("Ugli",Msg::kVerbose)
00149 << "assignment to " << GetPlexPlaneId() << endl;
00150 #endif
00151 }
00152 #ifdef VERBOSE_MSG
00153 else
00154 MSG("Ugli",Msg::kVerbose) << "assignment to <no-node> " << endl;
00155 #endif
00156
00157 return *this;
00158 }
00159
00160