1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 <2009> 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 <2009> 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Channel Access Portable Server, passing by pointer in read/write methods |
From: | "Malitsky, Nikolay D" <[email protected]> |
To: | <[email protected]> |
Date: | Thu, 25 Jun 2009 14:37:18 -0400 |
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 |