Files
epics-base/src/gdd/smartGDDPointer.cc
1998-10-23 19:24:26 +00:00

36 lines
707 B
C++

//
// Smart Pointer Class for GDD
// ( automatically takes care of referencing / unreferening a gdd each time that it is used )
//
// Author: Jeff Hill
//
#define epicsExportSharedSymbols
#include "smartGDDPointer.h"
//
// smartGDDPointer::set()
//
void smartGDDPointer::set (gdd *pNewValue)
{
int gddStatus;
//
// dont change the ref count (and
// potentially unref a gdd that we are
// still using if the pointer isnt changing
//
if (this->pValue==pNewValue) {
return;
}
if (this->pValue!=NULL) {
gddStatus = this->pValue->unreference();
assert (!gddStatus);
}
this->pValue = pNewValue;
if (this->pValue!=NULL) {
gddStatus = this->pValue->reference();
assert (!gddStatus);
}
}