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: | Re: PVStructure vs Structure |
From: | "Kasemir, Kay via Tech-talk" <tech-talk at aps.anl.gov> |
To: | "Madden, Timothy J." <tmadden at anl.gov>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Fri, 10 Jun 2022 14:49:21 +0000 |
I guess another reason for the PVData vs. PVField design was that pvDataCPP and pvDataJava aimed to have almost exactly the same API for both C++ and Java, which gives you the lowest common denominator of both languages.
In Java, there is runtime type info. Given any Object, you can check if it's instanceof PVStructure or PVString or ...
With plain C, you can't check the type of a void *. With C++, there is now runtime type info, but I assume the safest approach was a DIY type info API that allows you to check if the data read from a PV is a PVStructure or PVStructureArray or ...
-Kay
From: Madden, Timothy J. <tmadden at anl.gov>
Sent: Friday, June 10, 2022 10:43 AM To: Kasemir, Kay <kasemirk at ornl.gov>; tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: [EXTERNAL] Re: PVStructure vs Structure
Thank you Kay.
From: Kasemir, Kay <kasemirk at ornl.gov>
Sent: Friday, June 10, 2022 7:38 AM To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>; Madden, Timothy J. <tmadden at anl.gov> Subject: Re: PVStructure vs Structure
> In pvData, we have PVStructures which I guess define data structures, and Structures which have something to do with introspection.
> What exactly is the difference?
Good question.
In the original pvDataCPP/pvDataJava code, there was a distinction between describing what the data looks like, and a container that actually holds that data.
This has been a stumbling block for me as well because from just the naming in the API I couldn't tell what's what.
In most cases, you need the container:
A server needs to hold the data that it wants to serve.
A client needs to hold the data that it received.
The only case where just need the type info is for the "pvinfo" command.
On the protocol level, a client also receives just the type info when it first connects to a PV, but within a millisecond it then needs to create the container to hold the data.
In the second wave of implementing the protocol, we contemplated just having the container classes. For the "pvinfo" case you would then get a container that happens to be empty. OK, a few wasted "zero" bytes, but cuts the source code and API roughly in half!
With the new Java implementation, that's actually the case, there are only "containers", so a server looks like
https://github.com/ControlSystemStudio/phoebus/blob/master/core/pva/src/test/java/org/epics/pva/server/ServerDemo.java
For the new C++ implementation, the API is also real simple, no step-1-build-description, step-2-build-container:
https://github.com/mdavidsaver/pvxs/blob/master/example/simplesrv.cpp
I'm not sure to which extend the new C++ implementation might internally still have description-without-data, but as an end user you don't really see that.
-Kay
|