apply reftrack to PVField

This commit is contained in:
Michael Davidsaver
2017-08-29 16:39:42 -05:00
parent aca8da5891
commit 9ae221ca0c
3 changed files with 13 additions and 2 deletions

View File

@@ -24,6 +24,7 @@
#include <pv/pvData.h>
#include <pv/factory.h>
#include <pv/serializeHelper.h>
#include <pv/reftrack.h>
using std::tr1::static_pointer_cast;
using std::size_t;
@@ -607,7 +608,10 @@ PVDataCreatePtr PVDataCreate::getPVDataCreate()
static Mutex mutex;
Lock xx(mutex);
if(pvDataCreate.get()==0) pvDataCreate = PVDataCreatePtr(new PVDataCreate());
if(pvDataCreate.get()==0) {
registerRefCounter("PVField", &PVField::num_instances);
pvDataCreate = PVDataCreatePtr(new PVDataCreate());
}
return pvDataCreate;
}

View File

@@ -17,6 +17,7 @@
#include <pv/lock.h>
#include <pv/pvData.h>
#include <pv/factory.h>
#include <pv/reftrack.h>
using std::tr1::const_pointer_cast;
using std::size_t;
@@ -24,15 +25,20 @@ using std::string;
namespace epics { namespace pvData {
size_t PVField::num_instances;
PVField::PVField(FieldConstPtr field)
: parent(NULL),field(field),
fieldOffset(0), nextFieldOffset(0),
immutable(false)
{
REFTRACE_INCREMENT(num_instances);
}
PVField::~PVField()
{ }
{
REFTRACE_DECREMENT(num_instances);
}
size_t PVField::getFieldOffset() const

View File

@@ -271,6 +271,7 @@ public:
void copy(const PVField& from);
void copyUnchecked(const PVField& from);
static size_t num_instances; // use atomic::get() or volatile* access
protected:
PVField::shared_pointer getPtrSelf()
{