interim commit

This commit is contained in:
Marty Kraimer
2013-05-29 12:22:50 -04:00
parent 6d894788a3
commit 29df17d580
16 changed files with 189 additions and 169 deletions

View File

@ -20,12 +20,12 @@ SRC_DIRS += $(DATABASE)/pvAccess
INC += channelProviderLocal.h
INC += pvCopy.h
INC += monitorAlgorithm.h
INC += channelLocalDebugRecord.h
INC += channelLocalTraceRecord.h
LIBSRCS += channelProviderLocal.cpp
LIBSRCS += channelLocal.cpp
LIBSRCS += pvCopy.cpp
LIBSRCS += monitorFactory.cpp
LIBSRCS += channelLocalDebugRecord.cpp
LIBSRCS += channelLocalTraceRecord.cpp
include $(TOP)/configure/RULES

View File

@ -63,7 +63,6 @@ ExampleCounter::ExampleCounter(
ExampleCounter::~ExampleCounter()
{
destroy();
}
void ExampleCounter::destroy()

View File

@ -70,7 +70,6 @@ PowerSupplyRecordTest::PowerSupplyRecordTest(
PowerSupplyRecordTest::~PowerSupplyRecordTest()
{
destroy();
}
void PowerSupplyRecordTest::destroy()

View File

@ -38,7 +38,6 @@ PVDatabase::PVDatabase()
PVDatabase::~PVDatabase()
{
destroy();
}
void PVDatabase::destroy()

View File

@ -86,7 +86,15 @@ void PVRecord::destroy()
(*clientIter)->detach(getPtrSelf());
lock();
}
pvListenerList.clear();
std::list<PVListenerPtr>::iterator listenerIter;
while(true) {
listenerIter = pvListenerList.begin();
if(listenerIter==pvListenerList.end()) break;
pvListenerList.erase(listenerIter);
unlock();
(*listenerIter)->unlisten(getPtrSelf());
lock();
}
pvRecordStructure->destroy();
pvRecordStructure.reset();
convert.reset();
@ -491,6 +499,7 @@ void PVRecordStructure::destroy()
for(iter = pvRecordFields->begin() ; iter !=pvRecordFields->end(); iter++) {
(*iter)->destroy();
}
PVRecordField::destroy();
pvRecordFields.reset();
pvStructure.reset();
}

View File

@ -59,7 +59,6 @@ RecordListRecord::RecordListRecord(
RecordListRecord::~RecordListRecord()
{
destroy();
}
void RecordListRecord::destroy()
@ -92,9 +91,7 @@ bool RecordListRecord::init()
void RecordListRecord::process()
{
PVStringArrayPtr pvNames = PVDatabase::getMaster()->getRecordNames();
std::vector<String> const & xxx = pvNames->getVector();
size_t n = xxx.size();
names->put(0,n,xxx,0);
names->replace(pvNames->viewUnsafe());
String message("");
if(database->get().compare("master")!=0) {
message += " can only access master ";

View File

@ -65,7 +65,7 @@ public:
POINTER_DEFINITIONS(ChannelProcessLocal);
virtual ~ChannelProcessLocal()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "~ChannelProcessLocal() " << std::endl;
}
@ -75,7 +75,7 @@ public:
ChannelProcessRequester::shared_pointer const & channelProcessRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug);
ChannelLocalTracePtr const &channelLocalTrace);
virtual void process(bool lastRequest);
virtual void destroy();
virtual void lock() {thelock.lock();}
@ -89,14 +89,14 @@ private:
ChannelLocalPtr const &channelLocal,
ChannelProcessRequester::shared_pointer const & channelProcessRequester,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug,
ChannelLocalTracePtr const &channelLocalTrace,
int nProcess)
:
isDestroyed(false),
channelLocal(channelLocal),
channelProcessRequester(channelProcessRequester),
pvRecord(pvRecord),
channelLocalDebug(channelLocalDebug),
channelLocalTrace(channelLocalTrace),
thelock(mutex),
nProcess(nProcess)
{
@ -107,7 +107,7 @@ private:
ChannelLocalPtr channelLocal;
ChannelProcessRequester::shared_pointer channelProcessRequester,;
PVRecordPtr pvRecord;
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
Mutex mutex;
Lock thelock;
int nProcess;
@ -118,7 +118,7 @@ ChannelProcessLocalPtr ChannelProcessLocal::create(
ChannelProcessRequester::shared_pointer const & channelProcessRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
{
PVFieldPtr pvField;
PVStructurePtr pvOptions;
@ -142,9 +142,9 @@ ChannelProcessLocalPtr ChannelProcessLocal::create(
channelLocal,
channelProcessRequester,
pvRecord,
channelLocalDebug,
channelLocalTrace,
nProcess));
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelProcessLocal::create";
std::cout << " recordName " << pvRecord->getRecordName() << std::endl;
@ -157,7 +157,7 @@ ChannelProcessLocalPtr ChannelProcessLocal::create(
void ChannelProcessLocal::destroy()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelProcessLocal::destroy";
std::cout << " destroyed " << isDestroyed << std::endl;
@ -179,7 +179,7 @@ void ChannelProcessLocal::process(bool lastRequest)
channelProcessRequester->processDone(status);
return;
}
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelProcessLocal::process";
std::cout << " nProcess " << nProcess << std::endl;
@ -203,7 +203,7 @@ public:
POINTER_DEFINITIONS(ChannelGetLocal);
virtual ~ChannelGetLocal()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "~ChannelGetLocal()" << std::endl;
}
@ -213,7 +213,7 @@ public:
ChannelGetRequester::shared_pointer const & channelGetRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug);
ChannelLocalTracePtr const &channelLocalTrace);
virtual void get(bool lastRequest);
virtual void destroy();
virtual void lock() {thelock.lock();}
@ -231,7 +231,7 @@ private:
PVStructurePtr const&pvStructure,
BitSetPtr const & bitSet,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
:
firstTime(true),
isDestroyed(false),
@ -242,7 +242,7 @@ private:
pvStructure(pvStructure),
bitSet(bitSet),
pvRecord(pvRecord),
channelLocalDebug(channelLocalDebug),
channelLocalTrace(channelLocalTrace),
thelock(mutex)
{
thelock.unlock();
@ -256,7 +256,7 @@ private:
PVStructurePtr pvStructure;
BitSetPtr bitSet;
PVRecordPtr pvRecord;
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
Mutex mutex;
Lock thelock;
};
@ -266,7 +266,7 @@ ChannelGetLocalPtr ChannelGetLocal::create(
ChannelGetRequester::shared_pointer const & channelGetRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
{
PVCopyPtr pvCopy = PVCopy::create(
pvRecord,
@ -297,8 +297,8 @@ ChannelGetLocalPtr ChannelGetLocal::create(
pvStructure,
bitSet,
pvRecord,
channelLocalDebug));
if(channelLocalDebug->getLevel()>0)
channelLocalTrace));
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelGetLocal::create";
std::cout << " recordName " << pvRecord->getRecordName() << std::endl;
@ -311,7 +311,7 @@ ChannelGetLocalPtr ChannelGetLocal::create(
void ChannelGetLocal::destroy()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelGetLocal::destroy";
std::cout << " destroyed " << isDestroyed << std::endl;
@ -351,7 +351,7 @@ void ChannelGetLocal::get(bool lastRequest)
firstTime = false;
}
channelGetRequester->getDone(Status::Ok);
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelGetLocal::get" << std::endl;
}
@ -366,7 +366,7 @@ public:
POINTER_DEFINITIONS(ChannelPutLocal);
virtual ~ChannelPutLocal()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "~ChannelPutLocal()" << std::endl;
}
@ -376,7 +376,7 @@ public:
ChannelPutRequester::shared_pointer const & channelPutRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug);
ChannelLocalTracePtr const &channelLocalTrace);
virtual void put(bool lastRequest);
virtual void get();
virtual void destroy();
@ -395,7 +395,7 @@ private:
PVStructurePtr const&pvStructure,
BitSetPtr const & bitSet,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
:
isDestroyed(false),
callProcess(callProcess),
@ -405,7 +405,7 @@ private:
pvStructure(pvStructure),
bitSet(bitSet),
pvRecord(pvRecord),
channelLocalDebug(channelLocalDebug),
channelLocalTrace(channelLocalTrace),
thelock(mutex)
{
thelock.unlock();
@ -418,7 +418,7 @@ private:
PVStructurePtr pvStructure;
BitSetPtr bitSet;
PVRecordPtr pvRecord;
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
Mutex mutex;
Lock thelock;
};
@ -428,7 +428,7 @@ ChannelPutLocalPtr ChannelPutLocal::create(
ChannelPutRequester::shared_pointer const & channelPutRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
{
PVCopyPtr pvCopy = PVCopy::create(
pvRecord,
@ -459,10 +459,10 @@ ChannelPutLocalPtr ChannelPutLocal::create(
pvStructure,
bitSet,
pvRecord,
channelLocalDebug));
channelLocalTrace));
channelLocal->addChannelPut(put);
channelPutRequester->channelPutConnect(Status::Ok, put, pvStructure,bitSet);
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelPutLocal::create";
std::cout << " recordName " << pvRecord->getRecordName() << std::endl;
@ -472,7 +472,7 @@ ChannelPutLocalPtr ChannelPutLocal::create(
void ChannelPutLocal::destroy()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelPutLocal::destroy";
std::cout << " destroyed " << isDestroyed << std::endl;
@ -503,7 +503,7 @@ void ChannelPutLocal::get()
pvCopy->updateCopyFromBitSet(pvStructure, bitSet, false);
pvRecord->unlock();
channelPutRequester->getDone(Status::Ok);
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelPutLocal::get" << std::endl;
}
@ -527,7 +527,7 @@ void ChannelPutLocal::put(bool lastRequest)
pvRecord->endGroupPut();
pvRecord->unlock();
channelPutRequester->putDone(Status::Ok);
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelPutLocal::get" << std::endl;
}
@ -543,7 +543,7 @@ public:
POINTER_DEFINITIONS(ChannelPutGetLocal);
virtual ~ChannelPutGetLocal()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "~ChannelPutGetLocal()" << std::endl;
}
@ -553,7 +553,7 @@ public:
ChannelPutGetRequester::shared_pointer const & channelPutGetRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug);
ChannelLocalTracePtr const &channelLocalTrace);
virtual void putGet(bool lastRequest);
virtual void getPut();
virtual void getGet();
@ -576,7 +576,7 @@ private:
BitSetPtr const & putBitSet,
BitSetPtr const & getBitSet,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
:
isDestroyed(false),
callProcess(callProcess),
@ -589,7 +589,7 @@ private:
putBitSet(putBitSet),
getBitSet(getBitSet),
pvRecord(pvRecord),
channelLocalDebug(channelLocalDebug),
channelLocalTrace(channelLocalTrace),
thelock(mutex)
{
thelock.unlock();
@ -605,7 +605,7 @@ private:
BitSetPtr putBitSet;
BitSetPtr getBitSet;
PVRecordPtr pvRecord;
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
Mutex mutex;
Lock thelock;
};
@ -615,7 +615,7 @@ ChannelPutGetLocalPtr ChannelPutGetLocal::create(
ChannelPutGetRequester::shared_pointer const & channelPutGetRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
{
PVCopyPtr pvPutCopy = PVCopy::create(
pvRecord,
@ -655,8 +655,8 @@ ChannelPutGetLocalPtr ChannelPutGetLocal::create(
putBitSet,
getBitSet,
pvRecord,
channelLocalDebug));
if(channelLocalDebug->getLevel()>0)
channelLocalTrace));
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelPutGetLocal::create";
std::cout << " recordName " << pvRecord->getRecordName() << std::endl;
@ -670,7 +670,7 @@ ChannelPutGetLocalPtr ChannelPutGetLocal::create(
void ChannelPutGetLocal::destroy()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelPutGetLocal::destroy";
std::cout << " destroyed " << isDestroyed << std::endl;
@ -710,7 +710,7 @@ void ChannelPutGetLocal::putGet(bool lastRequest)
getBitSet->clear();
getBitSet->set(0);
channelPutGetRequester->putGetDone(Status::Ok);
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelPutGetLocal::putGet" << std::endl;
}
@ -732,7 +732,7 @@ void ChannelPutGetLocal::getPut()
putBitSet->clear();
putBitSet->set(0);
channelPutGetRequester->getPutDone(Status::Ok);
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelPutGetLocal::getPut" << std::endl;
}
@ -753,7 +753,7 @@ void ChannelPutGetLocal::getGet()
getBitSet->clear();
getBitSet->set(0);
channelPutGetRequester->getGetDone(Status::Ok);
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelPutGetLocal::getGet" << std::endl;
}
@ -780,25 +780,25 @@ ChannelLocal::ChannelLocal(
ChannelProviderLocalPtr const & provider,
ChannelRequester::shared_pointer const & requester,
PVRecordPtr const & pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
: provider(provider),
requester(requester),
pvRecord(pvRecord),
channelLocalDebug(channelLocalDebug),
channelLocalTrace(channelLocalTrace),
beingDestroyed(false)
{
}
ChannelLocal::~ChannelLocal()
{
if(channelLocalDebug->getLevel()>0) {
if(channelLocalTrace->getLevel()>0) {
std::cout << "~ChannelLocal()" << std::endl;
}
}
void ChannelLocal::destroy()
{
if(channelLocalDebug->getLevel()>0) {
if(channelLocalTrace->getLevel()>0) {
std::cout << "ChannelLocal::destroy() ";
std::cout << "beingDestroyed " << beingDestroyed << std::endl;
}
@ -808,42 +808,42 @@ void ChannelLocal::destroy()
beingDestroyed = true;
}
while(true) {
std::set<ChannelProcess::shared_pointer>::iterator it;
std::multiset<ChannelProcess::shared_pointer>::iterator it;
it = channelProcessList.begin();
if(it==channelProcessList.end()) break;
it->get()->destroy();
channelProcessList.erase(it);
}
while(true) {
std::set<ChannelGet::shared_pointer>::iterator it;
std::multiset<ChannelGet::shared_pointer>::iterator it;
it = channelGetList.begin();
if(it==channelGetList.end()) break;
it->get()->destroy();
channelGetList.erase(it);
}
while(true) {
std::set<ChannelPut::shared_pointer>::iterator it;
std::multiset<ChannelPut::shared_pointer>::iterator it;
it = channelPutList.begin();
if(it==channelPutList.end()) break;
it->get()->destroy();
channelPutList.erase(it);
}
while(true) {
std::set<ChannelPutGet::shared_pointer>::iterator it;
std::multiset<ChannelPutGet::shared_pointer>::iterator it;
it = channelPutGetList.begin();
if(it==channelPutGetList.end()) break;
it->get()->destroy();
channelPutGetList.erase(it);
}
while(true) {
std::set<ChannelRPC::shared_pointer>::iterator it;
std::multiset<ChannelRPC::shared_pointer>::iterator it;
it = channelRPCList.begin();
if(it==channelRPCList.end()) break;
it->get()->destroy();
channelRPCList.erase(it);
}
while(true) {
std::set<ChannelArray::shared_pointer>::iterator it;
std::multiset<ChannelArray::shared_pointer>::iterator it;
it = channelArrayList.begin();
if(it==channelArrayList.end()) break;
it->get()->destroy();
@ -855,7 +855,7 @@ void ChannelLocal::destroy()
void ChannelLocal::addChannelProcess(ChannelProcess::shared_pointer const & channelProcess)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::addChannelProcess() " << std::endl;
}
Lock xx(mutex);
@ -865,7 +865,7 @@ void ChannelLocal::addChannelProcess(ChannelProcess::shared_pointer const & chan
void ChannelLocal::addChannelGet(ChannelGet::shared_pointer const &channelGet)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::addChannelGet() " << std::endl;
}
Lock xx(mutex);
@ -875,7 +875,7 @@ void ChannelLocal::addChannelGet(ChannelGet::shared_pointer const &channelGet)
void ChannelLocal::addChannelPut(ChannelPut::shared_pointer const &channelPut)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::addChannelPut() " << std::endl;
}
Lock xx(mutex);
@ -885,7 +885,7 @@ void ChannelLocal::addChannelPut(ChannelPut::shared_pointer const &channelPut)
void ChannelLocal::addChannelPutGet(ChannelPutGet::shared_pointer const &channelPutGet)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::addChannelPutGet() " << std::endl;
}
Lock xx(mutex);
@ -895,7 +895,7 @@ void ChannelLocal::addChannelPutGet(ChannelPutGet::shared_pointer const &channel
void ChannelLocal::addChannelRPC(ChannelRPC::shared_pointer const &channelRPC)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::addChannelRPC() " << std::endl;
}
Lock xx(mutex);
@ -905,7 +905,7 @@ void ChannelLocal::addChannelRPC(ChannelRPC::shared_pointer const &channelRPC)
void ChannelLocal::addChannelArray(ChannelArray::shared_pointer const &channelArray)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::addChannelArray() " << std::endl;
}
Lock xx(mutex);
@ -915,7 +915,7 @@ void ChannelLocal::addChannelArray(ChannelArray::shared_pointer const &channelAr
void ChannelLocal::removeChannelProcess(ChannelProcess::shared_pointer const &ref)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::removeChannelProcess() " << std::endl;
}
Lock xx(mutex);
@ -925,7 +925,7 @@ void ChannelLocal::removeChannelProcess(ChannelProcess::shared_pointer const &re
void ChannelLocal::removeChannelGet(ChannelGet::shared_pointer const &ref)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::removeChannelGet() " << std::endl;
}
Lock xx(mutex);
@ -935,7 +935,7 @@ void ChannelLocal::removeChannelGet(ChannelGet::shared_pointer const &ref)
void ChannelLocal::removeChannelPut(ChannelPut::shared_pointer const &ref)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::removeChannelPut() " << std::endl;
}
Lock xx(mutex);
@ -945,7 +945,7 @@ void ChannelLocal::removeChannelPut(ChannelPut::shared_pointer const &ref)
void ChannelLocal::removeChannelPutGet(ChannelPutGet::shared_pointer const &ref)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::removeChannelPutGet() " << std::endl;
}
Lock xx(mutex);
@ -955,7 +955,7 @@ void ChannelLocal::removeChannelPutGet(ChannelPutGet::shared_pointer const &ref)
void ChannelLocal::removeChannelRPC(ChannelRPC::shared_pointer const &ref)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::removeChannelRPC() " << std::endl;
}
Lock xx(mutex);
@ -965,7 +965,7 @@ void ChannelLocal::removeChannelRPC(ChannelRPC::shared_pointer const &ref)
void ChannelLocal::removeChannelArray(ChannelArray::shared_pointer const &ref)
{
if(channelLocalDebug->getLevel()>1) {
if(channelLocalTrace->getLevel()>1) {
std::cout << "ChannelLocal::removeChannelArray() " << std::endl;
}
Lock xx(mutex);
@ -1044,7 +1044,7 @@ ChannelProcess::shared_pointer ChannelLocal::createChannelProcess(
channelProcessRequester,
pvRequest,
pvRecord,
channelLocalDebug);
channelLocalTrace);
return channelProcess;
}
@ -1058,7 +1058,7 @@ ChannelGet::shared_pointer ChannelLocal::createChannelGet(
channelGetRequester,
pvRequest,
pvRecord,
channelLocalDebug);
channelLocalTrace);
return channelGet;
}
@ -1072,7 +1072,7 @@ ChannelPut::shared_pointer ChannelLocal::createChannelPut(
channelPutRequester,
pvRequest,
pvRecord,
channelLocalDebug);
channelLocalTrace);
return channelPut;
}
@ -1086,7 +1086,7 @@ ChannelPutGet::shared_pointer ChannelLocal::createChannelPutGet(
channelPutGetRequester,
pvRequest,
pvRecord,
channelLocalDebug);
channelLocalTrace);
return channelPutGet;
}
@ -1109,7 +1109,7 @@ Monitor::shared_pointer ChannelLocal::createMonitor(
pvRecord,
monitorRequester,
pvRequest,
channelLocalDebug);
channelLocalTrace);
return monitor;
}

View File

@ -1,4 +1,4 @@
/* channelListDebugRecord.cpp */
/* channelListTraceRecord.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@ -9,7 +9,7 @@
* @date 2013.04.18
*/
#include <pv/channelLocalDebugRecord.h>
#include <pv/channelLocalTraceRecord.h>
using std::tr1::static_pointer_cast;
using namespace epics::pvData;
@ -18,8 +18,8 @@ using namespace std;
namespace epics { namespace pvDatabase {
ChannelLocalDebugRecordPtr ChannelLocalDebugRecord::create(
ChannelLocalDebugPtr const &channelLocalDebug,
ChannelLocalTraceRecordPtr ChannelLocalTraceRecord::create(
ChannelLocalTracePtr const &channelLocalTrace,
epics::pvData::String const & recordName)
{
FieldCreatePtr fieldCreate = getFieldCreate();
@ -31,31 +31,31 @@ ChannelLocalDebugRecordPtr ChannelLocalDebugRecord::create(
StructureConstPtr topStructure =
fieldCreate->createStructure(argNames,argFields);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(topStructure);
ChannelLocalDebugRecordPtr pvRecord(
new ChannelLocalDebugRecord(channelLocalDebug,recordName,pvStructure));
ChannelLocalTraceRecordPtr pvRecord(
new ChannelLocalTraceRecord(channelLocalTrace,recordName,pvStructure));
if(!pvRecord->init()) pvRecord.reset();
return pvRecord;
}
ChannelLocalDebugRecord::ChannelLocalDebugRecord(
ChannelLocalDebugPtr const &channelLocalDebug,
ChannelLocalTraceRecord::ChannelLocalTraceRecord(
ChannelLocalTracePtr const &channelLocalTrace,
epics::pvData::String const & recordName,
epics::pvData::PVStructurePtr const & pvStructure)
: PVRecord(recordName,pvStructure),
channelLocalDebug(channelLocalDebug)
channelLocalTrace(channelLocalTrace)
{
}
ChannelLocalDebugRecord::~ChannelLocalDebugRecord()
ChannelLocalTraceRecord::~ChannelLocalTraceRecord()
{
}
void ChannelLocalDebugRecord::destroy()
void ChannelLocalTraceRecord::destroy()
{
PVRecord::destroy();
}
bool ChannelLocalDebugRecord::init()
bool ChannelLocalTraceRecord::init()
{
initPVRecord();
PVStructurePtr pvStructure = getPVStructure();
@ -65,9 +65,9 @@ bool ChannelLocalDebugRecord::init()
return true;
}
void ChannelLocalDebugRecord::process()
void ChannelLocalTraceRecord::process()
{
channelLocalDebug->setLevel(pvValue->get());
channelLocalTrace->setLevel(pvValue->get());
}

View File

@ -1,4 +1,4 @@
/* channelLocalDebugRecord.h */
/* channelLocalTraceRecord.h */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
@ -8,39 +8,39 @@
* @author mrk
* @date 2013.04.18
*/
#ifndef CHANNELLOCALREBUGRECORD_H
#define CHANNELLOCALREBUGRECORD_H
#ifndef CHANNELLOCALTRACERECORD_H
#define CHANNELLOCALTRACERECORD_H
#include <pv/channelProviderLocal.h>
namespace epics { namespace pvDatabase {
class ChannelLocalDebugRecord;
typedef std::tr1::shared_ptr<ChannelLocalDebugRecord> ChannelLocalDebugRecordPtr;
class ChannelLocalTraceRecord;
typedef std::tr1::shared_ptr<ChannelLocalTraceRecord> ChannelLocalTraceRecordPtr;
class ChannelLocalDebugRecord :
class ChannelLocalTraceRecord :
public PVRecord
{
public:
POINTER_DEFINITIONS(ChannelLocalDebugRecord);
static ChannelLocalDebugRecordPtr create(
ChannelLocalDebugPtr const &channelLocalDebug,
POINTER_DEFINITIONS(ChannelLocalTraceRecord);
static ChannelLocalTraceRecordPtr create(
ChannelLocalTracePtr const &channelLocalTrace,
epics::pvData::String const & recordName);
virtual ~ChannelLocalDebugRecord();
virtual ~ChannelLocalTraceRecord();
virtual void destroy();
virtual bool init();
virtual void process();
private:
ChannelLocalDebugRecord(
ChannelLocalDebugPtr const &channelLocalDebug,
ChannelLocalTraceRecord(
ChannelLocalTracePtr const &channelLocalTrace,
epics::pvData::String const & recordName,
epics::pvData::PVStructurePtr const & pvStructure);
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
epics::pvData::PVIntPtr pvValue;
bool isDestroyed;
};
}}
#endif /* CHANNELLOCALREBUGRECORD_H */
#endif /* CHANNELLOCALTRACERECORD_H */

View File

@ -11,7 +11,7 @@
#include <pv/serverContext.h>
#include <pv/channelProviderLocal.h>
#include <pv/channelLocalDebugRecord.h>
#include <pv/channelLocalTraceRecord.h>
namespace epics { namespace pvDatabase {
@ -81,6 +81,8 @@ std::cout << "LocalChannelCTX::~LocalChannelCTX()" << std::endl;
// we need thead.waitForCompletion()
event.wait();
epicsThreadSleep(1.0);
std::cout << "LocalChannelCTX::run() calling channelProvider->destroy()" << std::endl;
if(channelProvider!=NULL) channelProvider->destroy();
ctx.reset();
channelProvider.reset();
delete thread;
@ -114,13 +116,13 @@ ChannelProviderLocalPtr getChannelProviderLocal()
ChannelProviderLocal::ChannelProviderLocal()
: pvDatabase(PVDatabase::getMaster()),
beingDestroyed(false),
channelLocalDebug(new ChannelLocalDebug())
channelLocalTrace(new ChannelLocalTrace())
{
}
ChannelProviderLocal::~ChannelProviderLocal()
{
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "~ChannelProviderLocal()" << std::endl;
}
@ -129,7 +131,7 @@ ChannelProviderLocal::~ChannelProviderLocal()
void ChannelProviderLocal::destroy()
{
Lock xx(mutex);
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelProviderLocal::destroy";
std::cout << " destroyed " << beingDestroyed << std::endl;
@ -156,6 +158,10 @@ ChannelFind::shared_pointer ChannelProviderLocal::channelFind(
ChannelFindRequester::shared_pointer const &channelFindRequester)
{
Lock xx(mutex);
if(channelLocalTrace->getLevel()>2)
{
std::cout << "ChannelProviderLocal::channelFind" << std::endl;
}
bool found = false;
ChannelLocalList::iterator iter;
for(iter = channelList.begin(); iter!=channelList.end(); ++iter)
@ -203,25 +209,19 @@ Channel::shared_pointer ChannelProviderLocal::createChannel(
String const &address)
{
Lock xx(mutex);
ChannelLocalList::iterator iter;
for(iter = channelList.begin(); iter!=channelList.end(); ++iter)
{
if((*iter)->getChannelName().compare(channelName)==0) {
return *iter;
}
}
PVRecordPtr pvRecord = pvDatabase->findRecord(channelName);
if(pvRecord.get()!=NULL) {
Channel::shared_pointer channel(new ChannelLocal(
getPtrSelf(),channelRequester,pvRecord,channelLocalDebug));
ChannelLocalPtr channel(new ChannelLocal(
getPtrSelf(),channelRequester,pvRecord,channelLocalTrace));
channelRequester->channelCreated(
Status::Ok,
channel);
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelProviderLocal::createChannel";
std::cout << " channelName " << channelName << std::endl;
}
channelList.insert(channel);
return channel;
}
Status notFoundStatus(Status::STATUSTYPE_ERROR,String("pv not found"));
@ -235,14 +235,19 @@ void ChannelProviderLocal::removeChannel(
Channel::shared_pointer const & channel)
{
Lock xx(mutex);
if(channelLocalTrace->getLevel()>0)
{
std::cout << "ChannelProviderLocal::removeChannel";
std::cout << " destroyed " << beingDestroyed << std::endl;
}
if(beingDestroyed) return;
ChannelLocalList::iterator iter;
for(iter = channelList.begin(); iter!=channelList.end(); ++iter)
{
if((*iter).get()==channel.get()) {
if(channelLocalDebug->getLevel()>1)
if(channelLocalTrace->getLevel()>1)
{
std::cout << "ChannelProviderLocal::createChannel";
std::cout << "ChannelProviderLocal::removeChannel";
std::cout << " channelName " << channel->getChannelName() << std::endl;
}
channelList.erase(iter);
@ -251,11 +256,11 @@ void ChannelProviderLocal::removeChannel(
}
}
void ChannelProviderLocal::createChannelLocalDebugRecord(
void ChannelProviderLocal::createChannelLocalTraceRecord(
String const &recordName)
{
ChannelLocalDebugRecordPtr pvRecord
= ChannelLocalDebugRecord::create(channelLocalDebug,recordName);
ChannelLocalTraceRecordPtr pvRecord
= ChannelLocalTraceRecord::create(channelLocalTrace,recordName);
PVDatabasePtr master = PVDatabase::getMaster();
bool result = master->addRecord(pvRecord);
if(!result) {

View File

@ -28,8 +28,8 @@
namespace epics { namespace pvDatabase {
class ChannelLocalDebug;
typedef std::tr1::shared_ptr<ChannelLocalDebug> ChannelLocalDebugPtr;
class ChannelLocalTrace;
typedef std::tr1::shared_ptr<ChannelLocalTrace> ChannelLocalTracePtr;
class MonitorFactory;
typedef std::tr1::shared_ptr<MonitorFactory> MonitorFactoryPtr;
@ -42,29 +42,29 @@ class ChannelProviderLocal;
typedef std::tr1::shared_ptr<ChannelProviderLocal> ChannelProviderLocalPtr;
class ChannelLocal;
typedef std::tr1::shared_ptr<ChannelLocal> ChannelLocalPtr;
typedef std::set<ChannelLocalPtr> ChannelLocalList;
typedef std::multiset<ChannelLocalPtr> ChannelLocalList;
extern MonitorFactoryPtr getMonitorFactory();
class MonitorLocal;
typedef std::tr1::shared_ptr<MonitorLocal> MonitorLocalPtr;
typedef std::set<MonitorLocalPtr> MonitorLocalList;
typedef std::multiset<MonitorLocalPtr> MonitorLocalList;
class ChannelLocalDebug {
class ChannelLocalTrace {
public:
ChannelLocalDebug()
: channelLocalDebugLevel(0)
ChannelLocalTrace()
: channelLocalTraceLevel(0)
{}
~ChannelLocalDebug(){}
~ChannelLocalTrace(){}
void setLevel(int level)
{
channelLocalDebugLevel = level;
channelLocalTraceLevel = level;
}
int getLevel()
{
return channelLocalDebugLevel;
return channelLocalTraceLevel;
}
private:
int channelLocalDebugLevel;
int channelLocalTraceLevel;
};
class MonitorFactory
@ -77,7 +77,7 @@ public:
PVRecordPtr const & pvRecord,
epics::pvData::MonitorRequester::shared_pointer const & monitorRequester,
epics::pvData::PVStructurePtr const & pvRequest,
ChannelLocalDebugPtr const &channelLocalDebug);
ChannelLocalTracePtr const &channelLocalTrace);
void registerMonitorAlgorithmCreate(
MonitorAlgorithmCreatePtr const &monitorAlgorithmCreate);
MonitorAlgorithmCreatePtr getMonitorAlgorithmCreate(
@ -86,8 +86,8 @@ private:
MonitorFactory();
friend class MonitorLocal;
friend MonitorFactoryPtr getMonitorFactory();
std::set<MonitorAlgorithmCreatePtr> monitorAlgorithmCreateList;
std::set<MonitorLocalPtr> monitorLocalList;
std::multiset<MonitorAlgorithmCreatePtr> monitorAlgorithmCreateList;
std::multiset<MonitorLocalPtr> monitorLocalList;
bool isDestroyed;
epics::pvData::Mutex mutex;
};
@ -118,7 +118,8 @@ public:
epics::pvData::String const &address);
void removeChannel(
epics::pvAccess::Channel::shared_pointer const &channel);
void createChannelLocalDebugRecord(epics::pvData::String const &recordName);
void createChannelLocalTraceRecord(epics::pvData::String const &recordName);
ChannelLocalTracePtr getChannelLocalTrace() { return channelLocalTrace;}
private:
shared_pointer getPtrSelf()
{
@ -130,7 +131,7 @@ private:
ChannelLocalList channelList;
epics::pvData::Mutex mutex;
bool beingDestroyed;
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
friend class ChannelProviderLocalRun;
};
@ -144,7 +145,7 @@ public:
ChannelProviderLocalPtr const &channelProvider,
epics::pvAccess::ChannelRequester::shared_pointer const & requester,
PVRecordPtr const & pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug
ChannelLocalTracePtr const &channelLocalTrace
);
virtual ~ChannelLocal();
virtual void destroy();
@ -211,14 +212,14 @@ private:
ChannelProviderLocalPtr provider;
epics::pvAccess::ChannelRequester::shared_pointer requester;
PVRecordPtr pvRecord;
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
bool beingDestroyed;
std::set<epics::pvAccess::ChannelProcess::shared_pointer> channelProcessList;
std::set<epics::pvAccess::ChannelGet::shared_pointer> channelGetList;
std::set<epics::pvAccess::ChannelPut::shared_pointer> channelPutList;
std::set<epics::pvAccess::ChannelPutGet::shared_pointer> channelPutGetList;
std::set<epics::pvAccess::ChannelRPC::shared_pointer> channelRPCList;
std::set<epics::pvAccess::ChannelArray::shared_pointer> channelArrayList;
std::multiset<epics::pvAccess::ChannelProcess::shared_pointer> channelProcessList;
std::multiset<epics::pvAccess::ChannelGet::shared_pointer> channelGetList;
std::multiset<epics::pvAccess::ChannelPut::shared_pointer> channelPutList;
std::multiset<epics::pvAccess::ChannelPutGet::shared_pointer> channelPutGetList;
std::multiset<epics::pvAccess::ChannelRPC::shared_pointer> channelRPCList;
std::multiset<epics::pvAccess::ChannelArray::shared_pointer> channelArrayList;
epics::pvData::Mutex mutex;
};

View File

@ -130,7 +130,7 @@ public:
MonitorLocal(
MonitorRequester::shared_pointer const & channelMonitorRequester,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug);
ChannelLocalTracePtr const &channelLocalTrace);
PVCopyPtr getPVCopy() { return pvCopy;}
PVCopyMonitorPtr getPVCopyMonitor() { return pvCopyMonitor;}
private:
@ -140,7 +140,7 @@ private:
}
MonitorRequester::shared_pointer monitorRequester;
PVRecordPtr pvRecord;
ChannelLocalDebugPtr channelLocalDebug;
ChannelLocalTracePtr channelLocalTrace;
bool isDestroyed;
bool firstMonitor;
PVCopyPtr pvCopy;
@ -153,10 +153,10 @@ private:
MonitorLocal::MonitorLocal(
MonitorRequester::shared_pointer const & channelMonitorRequester,
PVRecordPtr const &pvRecord,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
: monitorRequester(channelMonitorRequester),
pvRecord(pvRecord),
channelLocalDebug(channelLocalDebug),
channelLocalTrace(channelLocalTrace),
isDestroyed(false),
firstMonitor(true)
{
@ -314,7 +314,7 @@ std::cout << "MonitorFactory::destroy " << isDestroyed << std::endl;
if(isDestroyed) return;
isDestroyed = true;
while(true) {
std::set<MonitorLocalPtr>::iterator it;
std::multiset<MonitorLocalPtr>::iterator it;
it = monitorLocalList.begin();
if(it==monitorLocalList.end()) break;
monitorLocalList.erase(it);
@ -328,7 +328,7 @@ MonitorPtr MonitorFactory::createMonitor(
PVRecordPtr const & pvRecord,
MonitorRequester::shared_pointer const & monitorRequester,
PVStructurePtr const & pvRequest,
ChannelLocalDebugPtr const &channelLocalDebug)
ChannelLocalTracePtr const &channelLocalTrace)
{
Lock xx(mutex);
if(isDestroyed) {
@ -336,10 +336,10 @@ MonitorPtr MonitorFactory::createMonitor(
return nullMonitor;
}
MonitorLocalPtr monitor(new MonitorLocal(
monitorRequester,pvRecord,channelLocalDebug));
monitorRequester,pvRecord,channelLocalTrace));
bool result = monitor->init(pvRequest);
if(!result) return nullMonitor;
if(channelLocalDebug->getLevel()>0)
if(channelLocalTrace->getLevel()>0)
{
std::cout << "MonitorFactory::createMonitor";
std::cout << " recordName " << pvRecord->getRecordName() << std::endl;
@ -361,7 +361,7 @@ MonitorAlgorithmCreatePtr MonitorFactory::getMonitorAlgorithmCreate(
{
Lock xx(mutex);
if(isDestroyed) return nullMonitorAlgorithmCreate;
// std::set<MonitorAlgorithmCreatePtr>::iterator iter;
// std::multiset<MonitorAlgorithmCreatePtr>::iterator iter;
// for(iter = monitorAlgorithmCreateList.begin();
// iter!= monitorAlgorithmCreateList.end();
// ++iter)

View File

@ -194,16 +194,15 @@ static void testPVScalarArray(
BitSetPtr bitSet;
String builder;
size_t offset;
ConvertPtr convert = getConvert();
size_t n = 5;
DoubleArray values(n);
shared_vector<double> values(n);
pvRecord->lock_guard();
cout << endl;
pvStructureRecord = pvRecord->getPVRecordStructure()->getPVStructure();
pvValueRecord = pvStructureRecord->getScalarArrayField(valueNameRecord,scalarType);
for(size_t i=0; i<n; i++) values[i] = i;
convert->fromDoubleArray(pvValueRecord,0,n,get(values),0);
pvValueRecord->PVScalarArray::putFrom<pvDouble>(values);
StructureConstPtr structure = pvCopy->getStructure();
builder.clear(); structure->toString(&builder);
cout << "structure from copy" << endl << builder << endl;
@ -215,7 +214,7 @@ static void testPVScalarArray(
cout << "after initCopy pvValueCopy " << builder << endl;
cout << endl;
for(size_t i=0; i<n; i++) values[i] = i + .06;
convert->fromDoubleArray(pvValueRecord,0,n,get(values),0);
pvValueRecord->PVScalarArray::putFrom<pvDouble>(values);
pvCopy->updateCopySetBitSet(pvStructureCopy,bitSet,true);
builder.clear(); pvValueCopy->toString(&builder);
cout << "after put(i+ .06) pvValueCopy " << builder << endl;
@ -228,11 +227,13 @@ static void testPVScalarArray(
cout << "getCopyOffset() " << offset;
cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset();
cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset();
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl;
bitSet->clear();
for(size_t i=0; i<n; i++) values[i] = i + 1.0;
convert->fromDoubleArray(pvValueRecord,0,n,get(values),0);
pvValueRecord->PVScalarArray::putFrom<pvDouble>(values);
builder.clear();
bitSet->toString(&builder);
cout << "before updateCopyFromBitSet";
@ -241,6 +242,8 @@ static void testPVScalarArray(
builder.clear(); pvValueCopy->toString(&builder);
cout << " copyValue " << builder << endl;
cout << " bitSet " << builder;
builder.clear();
bitSet->toString(&builder);
cout << endl;
bitSet->set(0);
pvCopy->updateCopyFromBitSet(pvStructureCopy,bitSet,true);
@ -249,16 +252,20 @@ static void testPVScalarArray(
cout << " recordValue " << builder << endl;
builder.clear(); pvValueCopy->toString(&builder);
cout << " copyValue " << builder << endl;
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl;
for(size_t i=0; i<n; i++) values[i] = i + 2.0;
convert->fromDoubleArray(pvValueRecord,0,n,get(values),0);
pvValueRecord->PVScalarArray::putFrom<pvDouble>(values);
bitSet->set(0);
cout << "before updateRecord";
builder.clear(); pvValueRecord->toString(&builder);
cout << " recordValue " << builder << endl;
builder.clear(); pvValueCopy->toString(&builder);
cout << " copyValue " << builder << endl;
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl;
pvCopy->updateRecord(pvStructureCopy,bitSet,true);
@ -267,6 +274,8 @@ static void testPVScalarArray(
cout << " recordValue " << builder << endl;
builder.clear(); pvValueCopy->toString(&builder);
cout << " copyValue " << builder << endl;
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl;
}

View File

@ -122,7 +122,9 @@ int main(int argc,char *argv[])
cout << " current " << psr->getCurrent();
cout << endl;
}
psr->destroy();
PVDatabasePtr pvDatabase = PVDatabase::getMaster();
pvDatabase->addRecord(psr);
pvDatabase->destroy();
return 0;
}

View File

@ -33,7 +33,7 @@ int main(int argc,char *argv[])
{
PVDatabasePtr master = PVDatabase::getMaster();
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
channelProvider->createChannelLocalDebugRecord("channelLocalDebug");
channelProvider->createChannelLocalTraceRecord("channelLocalTrace");
String recordName("exampleCounter");
PVRecordPtr pvRecord = ExampleCounter::create(recordName);
bool result = master->addRecord(pvRecord);

View File

@ -62,7 +62,7 @@ int main(int argc,char *argv[])
{
PVDatabasePtr master = PVDatabase::getMaster();
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
channelProvider->createChannelLocalDebugRecord("channelLocalDebug");
channelProvider->createChannelLocalTraceRecord("channelLocalTrace");
StandardPVFieldPtr standardPVField = getStandardPVField();
String properties;
ScalarType scalarType;