many improvements
This commit is contained in:
@@ -55,6 +55,7 @@ GLOMBOBJ += $(BUILDDIR)casMonEvent.o
|
||||
GLOMBOBJ += $(BUILDDIR)outBuf.o
|
||||
GLOMBOBJ += $(BUILDDIR)inBuf.o
|
||||
GLOMBOBJ += $(BUILDDIR)casEventMask.o
|
||||
GLOMBOBJ += $(BUILDDIR)ioBlocked.o
|
||||
|
||||
GLOMBOBJ += $(BUILDDIR)caServerOS.o
|
||||
GLOMBOBJ += $(BUILDDIR)casDGOS.o
|
||||
@@ -73,19 +74,19 @@ excas: $(OBJS) $(DEPLIBS)
|
||||
#
|
||||
# fast link (without waiting for library build)
|
||||
#
|
||||
nolib: $(OBJS) $(GLOMBOBJ) $(DEPLIBSWOCAS)
|
||||
fexcas: $(OBJS) $(GLOMBOBJ) $(DEPLIBSWOCAS)
|
||||
$(LINK.cc) -o $@ $(OBJS) $(GLOMBOBJ) $(DEPLIBSWOCAS)
|
||||
|
||||
#
|
||||
# build with purify
|
||||
#
|
||||
purify: $(OBJS) $(GLOMBOBJ) $(DEPLIBSWOCAS)
|
||||
$(PURIFY) -best-effort $(LINK.cc) -o $@ $(OBJS) $(GLOMBOBJ) $(DEPLIBSWOCAS)
|
||||
pexcas: $(OBJS) $(DEPLIBS)
|
||||
$(PURIFY) $(LINK.cc) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
clean::
|
||||
@$(RM) excas
|
||||
@$(RM) nolib
|
||||
@$(RM) purify
|
||||
@$(RM) fexcas
|
||||
@$(RM) pexcas
|
||||
@$(RM) -rf Templates.DB
|
||||
@$(RM) core
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ unsigned exAsyncPV::maxSimultAsyncOps () const
|
||||
//
|
||||
caStatus exAsyncPV::read (const casCtx &ctx, gdd &valueIn)
|
||||
{
|
||||
exAsyncIO *pIO;
|
||||
exAsyncReadIO *pIO;
|
||||
|
||||
pIO = new exAsyncReadIO(ctx, *this, valueIn);
|
||||
if (!pIO) {
|
||||
@@ -36,7 +36,7 @@ caStatus exAsyncPV::read (const casCtx &ctx, gdd &valueIn)
|
||||
//
|
||||
caStatus exAsyncPV::write (const casCtx &ctx, gdd &valueIn)
|
||||
{
|
||||
exAsyncIO *pIO;
|
||||
exAsyncWriteIO *pIO;
|
||||
|
||||
pIO = new exAsyncWriteIO(ctx, *this, valueIn);
|
||||
if (!pIO) {
|
||||
@@ -53,11 +53,18 @@ caStatus exAsyncPV::write (const casCtx &ctx, gdd &valueIn)
|
||||
void exAsyncWriteIO::expire()
|
||||
{
|
||||
caStatus status;
|
||||
status = this->pv.update(*this->getValuePtr());
|
||||
this->clrValue();
|
||||
status = this->pv.update(this->value);
|
||||
this->postIOCompletion (status);
|
||||
}
|
||||
|
||||
//
|
||||
// exAsyncWriteIO::name()
|
||||
//
|
||||
const char *exAsyncWriteIO::name() const
|
||||
{
|
||||
return "exAsyncWriteIO";
|
||||
}
|
||||
|
||||
//
|
||||
// exAsyncReadIO::expire()
|
||||
// (a virtual function that runs when the base timer expires)
|
||||
@@ -65,17 +72,24 @@ void exAsyncWriteIO::expire()
|
||||
void exAsyncReadIO::expire()
|
||||
{
|
||||
caStatus status;
|
||||
gdd *pValue = this->getValuePtr();
|
||||
|
||||
//
|
||||
// map between the prototype in and the
|
||||
// current value
|
||||
//
|
||||
status = exServer::read(this->pv, *pValue);
|
||||
status = exServer::read(this->pv, this->proto);
|
||||
|
||||
//
|
||||
// post IO completion
|
||||
//
|
||||
this->postIOCompletion(status);
|
||||
this->postIOCompletion(status, this->proto);
|
||||
}
|
||||
|
||||
//
|
||||
// exAsyncReadIO::name()
|
||||
//
|
||||
const char *exAsyncReadIO::name() const
|
||||
{
|
||||
return "exAsyncReadIO";
|
||||
}
|
||||
|
||||
|
||||
+14
-5
@@ -103,7 +103,7 @@ void exScanTimer::expire ()
|
||||
//
|
||||
// exScanTimer::again()
|
||||
//
|
||||
osiBool exScanTimer::again()
|
||||
osiBool exScanTimer::again() const
|
||||
{
|
||||
return osiTrue;
|
||||
}
|
||||
@@ -111,11 +111,19 @@ osiBool exScanTimer::again()
|
||||
//
|
||||
// exScanTimer::delay()
|
||||
//
|
||||
const osiTime exScanTimer::delay()
|
||||
const osiTime exScanTimer::delay() const
|
||||
{
|
||||
return pv.getScanRate();
|
||||
}
|
||||
|
||||
//
|
||||
// exScanTimer::name()
|
||||
//
|
||||
const char *exScanTimer::name() const
|
||||
{
|
||||
return "exScanTimer";
|
||||
}
|
||||
|
||||
//
|
||||
// exPV::update ()
|
||||
//
|
||||
@@ -135,11 +143,12 @@ caStatus exPV::update(gdd &valueIn)
|
||||
return S_casApp_noSupport;
|
||||
}
|
||||
|
||||
# if DEBUG
|
||||
printf("%s = %f\n",
|
||||
this->info.getName().string, valueIn);
|
||||
# if DEBUG
|
||||
printf("Setting %s too:\n", this->info.getName().string());
|
||||
valueIn.dump();
|
||||
# endif
|
||||
|
||||
|
||||
if (valueIn.isScalar()) {
|
||||
pNewValue = &valueIn;
|
||||
pNewValue->reference();
|
||||
|
||||
+19
-14
@@ -49,8 +49,7 @@ exServer::exServer(unsigned pvMaxNameLength, unsigned pvCountEstimate,
|
||||
//
|
||||
// exServer::pvExistTest()
|
||||
//
|
||||
caStatus exServer::pvExistTest(const casCtx &ctxIn, const char *pPVName,
|
||||
gdd &canonicalPVName)
|
||||
pvExistReturn exServer::pvExistTest(const casCtx &ctxIn, const char *pPVName)
|
||||
{
|
||||
const pvInfo *pPVI;
|
||||
|
||||
@@ -58,24 +57,20 @@ caStatus exServer::pvExistTest(const casCtx &ctxIn, const char *pPVName,
|
||||
if (pPVI) {
|
||||
if (pPVI->getIOType()==excasIoAsync) {
|
||||
exAsyncExistIO *pIO;
|
||||
pIO = new exAsyncExistIO(pPVI, ctxIn, canonicalPVName);
|
||||
pIO = new exAsyncExistIO(*pPVI, ctxIn);
|
||||
if (pIO) {
|
||||
return S_casApp_asyncCompletion;
|
||||
return pvExistReturn(S_casApp_asyncCompletion);
|
||||
}
|
||||
else {
|
||||
return S_casApp_noMemory;
|
||||
return pvExistReturn(S_casApp_noMemory);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// there are no name aliases in this
|
||||
// server's PV name syntax
|
||||
//
|
||||
canonicalPVName.put (pPVI->getName());
|
||||
return S_casApp_success;
|
||||
const char *pName = pPVI->getName();
|
||||
return pvExistReturn(S_casApp_success, pName);
|
||||
}
|
||||
|
||||
return S_casApp_pvNotFound;
|
||||
return pvExistReturn(S_casApp_pvNotFound);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -138,7 +133,7 @@ void exServer::show (unsigned level)
|
||||
// destroy so the exAsyncIO class will hang around until the
|
||||
// casAsyncIO::destroy() is called
|
||||
//
|
||||
void exAsyncIOTimer::destroy()
|
||||
void exOSITimer::destroy()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -148,9 +143,19 @@ void exAsyncIOTimer::destroy()
|
||||
//
|
||||
void exAsyncExistIO::expire()
|
||||
{
|
||||
const char *pName = pvi.getName();
|
||||
|
||||
//
|
||||
// post IO completion
|
||||
//
|
||||
this->postIOCompletion(S_cas_success);
|
||||
this->postIOCompletion (pvExistReturn(S_cas_success, pName));
|
||||
}
|
||||
|
||||
//
|
||||
// exAsyncExistIO::name()
|
||||
//
|
||||
const char *exAsyncExistIO::name() const
|
||||
{
|
||||
return "exAsyncExistIO";
|
||||
}
|
||||
|
||||
|
||||
+46
-38
@@ -97,12 +97,9 @@ public:
|
||||
exScanTimer (double delayIn, exPV &pvIn) :
|
||||
pv(pvIn), osiTimer(delayIn) {}
|
||||
void expire ();
|
||||
osiBool again();
|
||||
const osiTime delay();
|
||||
const char *name()
|
||||
{
|
||||
return "exScanTimer";
|
||||
}
|
||||
osiBool again() const;
|
||||
const osiTime delay() const;
|
||||
const char *name() const;
|
||||
private:
|
||||
exPV &pv;
|
||||
};
|
||||
@@ -188,8 +185,7 @@ public:
|
||||
exServer(unsigned pvMaxNameLength, unsigned pvCountEstimate=0x3ff,
|
||||
unsigned maxSimultaneousIO=1u);
|
||||
void show (unsigned level);
|
||||
caStatus pvExistTest (const casCtx &ctxIn, const char *pPVName,
|
||||
gdd &canonicalPVName);
|
||||
pvExistReturn pvExistTest (const casCtx &ctxIn, const char *pPVName);
|
||||
casPV *createPV (const casCtx &ctxIn, const char *pPVName);
|
||||
|
||||
static const pvInfo *findPV(const char *pName);
|
||||
@@ -281,46 +277,44 @@ public:
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// exAsyncIOTimer
|
||||
// exOSITimer
|
||||
//
|
||||
class exAsyncIOTimer : public osiTimer {
|
||||
// a special version of osiTimer which is only to be used
|
||||
// within an exAsyncIO. The destroy() method is replaced
|
||||
// so that the timer destroy() will not destroy the
|
||||
// exAsyncIO until the casAsyncIO has completed
|
||||
//
|
||||
class exOSITimer : public osiTimer {
|
||||
public:
|
||||
exAsyncIOTimer (osiTime delayIn) : osiTimer(delayIn) {}
|
||||
exOSITimer() : osiTimer(osiTime(0.010)) {} // 10 mSec
|
||||
|
||||
//
|
||||
// this is a noop that postpones the timer expiration
|
||||
// destroy so this object will hang around until the
|
||||
// casAsyncIO::destroy() is called
|
||||
//
|
||||
void destroy();
|
||||
|
||||
const char *name()
|
||||
{
|
||||
return "exAsyncIOTimer";
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// exAsyncIO()
|
||||
//
|
||||
class exAsyncIO : public casAsyncIO, public exAsyncIOTimer {
|
||||
public:
|
||||
exAsyncIO(const casCtx &ctxIn, gdd *pValue = 0) :
|
||||
casAsyncIO(ctxIn, pValue),
|
||||
exAsyncIOTimer(osiTime(0.010)) {} // 10 mSec
|
||||
};
|
||||
|
||||
//
|
||||
// exAsyncWriteIO
|
||||
//
|
||||
class exAsyncWriteIO : public exAsyncIO {
|
||||
class exAsyncWriteIO : public casAsyncWriteIO, public exOSITimer {
|
||||
public:
|
||||
//
|
||||
// exAsyncWriteIO()
|
||||
//
|
||||
exAsyncWriteIO(const casCtx &ctxIn, exAsyncPV &pvIn, gdd &valueIn) :
|
||||
exAsyncIO(ctxIn, &valueIn), pv(pvIn) {}
|
||||
casAsyncWriteIO(ctxIn), pv(pvIn), value(valueIn)
|
||||
{
|
||||
this->value.reference();
|
||||
}
|
||||
|
||||
~exAsyncWriteIO()
|
||||
{
|
||||
this->value.unreference();
|
||||
}
|
||||
|
||||
//
|
||||
// expire()
|
||||
@@ -328,20 +322,32 @@ public:
|
||||
// see exAsyncPV.cc
|
||||
//
|
||||
void expire();
|
||||
|
||||
const char *name() const;
|
||||
|
||||
private:
|
||||
exAsyncPV &pv;
|
||||
gdd &value;
|
||||
};
|
||||
|
||||
//
|
||||
// exAsyncReadIO
|
||||
//
|
||||
class exAsyncReadIO : public exAsyncIO {
|
||||
class exAsyncReadIO : public casAsyncReadIO, public exOSITimer {
|
||||
public:
|
||||
//
|
||||
// exAsyncReadIO()
|
||||
//
|
||||
exAsyncReadIO(const casCtx &ctxIn, exAsyncPV &pvIn, gdd &protoIn) :
|
||||
exAsyncIO(ctxIn, &protoIn), pv(pvIn) {}
|
||||
casAsyncReadIO(ctxIn), pv(pvIn), proto(protoIn)
|
||||
{
|
||||
this->proto.reference();
|
||||
}
|
||||
|
||||
~exAsyncReadIO()
|
||||
{
|
||||
this->proto.unreference();
|
||||
}
|
||||
|
||||
//
|
||||
// expire()
|
||||
@@ -350,25 +356,24 @@ public:
|
||||
//
|
||||
void expire();
|
||||
|
||||
const char *name() const;
|
||||
|
||||
private:
|
||||
exAsyncPV &pv;
|
||||
gdd &proto;
|
||||
};
|
||||
|
||||
//
|
||||
// exAsyncExistIO
|
||||
// (PV exist async IO)
|
||||
//
|
||||
class exAsyncExistIO : public exAsyncIO {
|
||||
class exAsyncExistIO : public casAsyncPVExistIO, public exOSITimer {
|
||||
public:
|
||||
//
|
||||
// exAsyncExistIO()
|
||||
//
|
||||
exAsyncExistIO(const pvInfo *pPVI,
|
||||
const casCtx &ctxIn, gdd &canonicalPVName) :
|
||||
exAsyncIO(ctxIn, &canonicalPVName)
|
||||
{
|
||||
canonicalPVName.put (pPVI->getName());
|
||||
}
|
||||
exAsyncExistIO(const pvInfo &pviIn, const casCtx &ctxIn) :
|
||||
casAsyncPVExistIO(ctxIn), pvi(pviIn) {}
|
||||
|
||||
//
|
||||
// expire()
|
||||
@@ -376,7 +381,10 @@ public:
|
||||
// see exServer.cc
|
||||
//
|
||||
void expire();
|
||||
|
||||
const char *name() const;
|
||||
private:
|
||||
const pvInfo &pvi;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
//
|
||||
// main()
|
||||
// (example single threaded ca server tool main loop)
|
||||
//
|
||||
int main (int argc, const char **argv)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user