Hello,
I am considering the Channel Access Portable Server for supporting the
C++ middle layer servers.
The associated PVs will maintain one-dimensional arrays of characters.
Their lengths can be
significant. So, passing by pointer in read/write methods would
be a preferable way. The ‘write’ case
looks straightforward (as described in the tutorial, p.35):
class my PV : public casPV {
….
gdd* pValue;
};
caStatus myPV::write(const casCtx& ctx, gdd &value){
…
pValue->unreference();
pValue = &value;
pValue->reference();
…
}
The ‘read’ case looks trickier (Probably, because it is not
explained).
In short, CORBA addresses such case by using the additional wrappers,
e.g. gdd_var objects,
in the ‘read’ method. However, the signature of this method
is already defined by the basis
class casPV. Fortunately, it seems we can still use the gdd-based
approach using another
mechanism, the pv-associated destructor, e.g. myPVReadDestructor:
caStatus myPV::read(const casCtx& ctx, gdd &value){
…
value.putRef(pValue->dataPointer(), new myPVReadDestructor(pValue));
pValue->reference();
}
where :
myPVReadDestructor::run(…){
pValue->unreference();
}
Any comments and suggestions about a better solution.
Thank you,
Nikolay