client: simplify monitor type handling

I think the original logic is correct, but I'm not sure.
Cleverness to avoiding storing a Structure pointer is a
premature optimization anyway.
This commit is contained in:
Michael Davidsaver
2018-07-15 19:22:43 -07:00
parent 99f68dac04
commit 8644f4230d
2 changed files with 5 additions and 1 deletions

View File

@@ -155,6 +155,7 @@ void MonitorFIFO::open(const pvd::StructureConstPtr& type)
opened = true;
needConnected = true;
this->type = type;
if(conf.ignoreRequestMask) {
selectMask.clear();
@@ -187,6 +188,7 @@ void MonitorFIFO::close()
opened = false;
needClosed = true;
selectMask.clear();
type.reset();
}
void MonitorFIFO::finish()
@@ -227,7 +229,7 @@ bool MonitorFIFO::tryPost(const pvData::PVStructure& value,
empty.pop_front();
} else if(force) {
// allocate an extra element
elem.reset(new MonitorElement(pvd::getPVDataCreate()->createPVStructure(inuse.back()->pvStructurePtr->getStructure())));
elem.reset(new MonitorElement(pvd::getPVDataCreate()->createPVStructure(type)));
}
if(elem) {

View File

@@ -388,6 +388,8 @@ private:
size_t freeHighLevel;
epicsInt32 flowCount;
epics::pvData::StructureConstPtr type; // NULL if not opened
typedef std::list<MonitorElementPtr> buffer_t;
// we allocate one extra buffer element to hold data when post()
// while all elements poll()'d. So there will always be one