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 += channelProviderLocal.h
INC += pvCopy.h INC += pvCopy.h
INC += monitorAlgorithm.h INC += monitorAlgorithm.h
INC += channelLocalDebugRecord.h INC += channelLocalTraceRecord.h
LIBSRCS += channelProviderLocal.cpp LIBSRCS += channelProviderLocal.cpp
LIBSRCS += channelLocal.cpp LIBSRCS += channelLocal.cpp
LIBSRCS += pvCopy.cpp LIBSRCS += pvCopy.cpp
LIBSRCS += monitorFactory.cpp LIBSRCS += monitorFactory.cpp
LIBSRCS += channelLocalDebugRecord.cpp LIBSRCS += channelLocalTraceRecord.cpp
include $(TOP)/configure/RULES include $(TOP)/configure/RULES

View File

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

View File

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

View File

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

View File

@ -86,7 +86,15 @@ void PVRecord::destroy()
(*clientIter)->detach(getPtrSelf()); (*clientIter)->detach(getPtrSelf());
lock(); 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->destroy();
pvRecordStructure.reset(); pvRecordStructure.reset();
convert.reset(); convert.reset();
@ -491,6 +499,7 @@ void PVRecordStructure::destroy()
for(iter = pvRecordFields->begin() ; iter !=pvRecordFields->end(); iter++) { for(iter = pvRecordFields->begin() ; iter !=pvRecordFields->end(); iter++) {
(*iter)->destroy(); (*iter)->destroy();
} }
PVRecordField::destroy();
pvRecordFields.reset(); pvRecordFields.reset();
pvStructure.reset(); pvStructure.reset();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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