EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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  <20232024  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  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: Get the type of a PV in C++ API
From: Michael Davidsaver via Tech-talk <tech-talk at aps.anl.gov>
To: Eusebio Naif Al-Soliman Fuentes <eunaif at correo.ugr.es>
Cc: Tech Talk <tech-talk at aps.anl.gov>
Date: Fri, 3 Nov 2023 08:56:22 -0700
On 11/3/23 02:39, Eusebio Naif Al-Soliman Fuentes via Tech-talk wrote:
Hello Ralph.
First of all, thanks for your reply. I know the existence of PVXS library and I have already used it succesfully on my project. The problem is that, at the moment, I've noticed that it's slow for our project

Can you elaborate on what "slow" means in this context?
Connection time, execution time?  Only "get".  Also "monitor"?


and I'm looking for a solution with the first-generation API.
It could also be an error in my code, what I'm doing at the moment is this:
pvxs::Valuereply=ctxt.get(var_name_str).exec()->wait();
pvxs::TypeCodetype_var=reply["value"].type();

With pvDataCPP, you probably want to investigate the "getAs" and "putFrom" methods which
attempt to conversion between the actual and requested types.

http://epics-base.github.io/pvDataCPP/classepics_1_1pv_data_1_1_p_v_scalar.html#a74927e168beec554c2de4db735d0fb58

http://epics-base.github.io/pvDataCPP/classepics_1_1pv_data_1_1_p_v_scalar_array.html#a9b2ea80c2688aaa92cda94c4dfccbe0f



Thanks, Eusebio.

---

Saludos/Best regards

*University of Granada *

Eusebio Naif Al-Soliman Fuentes
*MSc. Data Science and Computer Engineering*__

eunaif at correo.ugr.es



El 2023-11-02 15:01, Ralph Lange via Tech-talk escribió:
Not an answer to your question, but...

That library you are using is part of the first generation of user-facing
libraries.
Meanwhile, there's a second generation (both for C++ and Java) with more
modern and language-specific API designs. Better usability, easier to work
with, better performance.
These second-generation libraries are stable; they will be replacing the
older generation.
For your use case: The C++ second-generation library is called PVXS -
https://urldefense.com/v3/__https://mdavidsaver.github.io/pvxs/__;!!D9dNQwwGXtA!QvJCJFvFjdyKLmOVaaoqQ-_7p7M-QOxB1j1874UChwdwp4EIbx70WhtalgizLcJWAVZmwNrzC6XHFczTXw-W7sCO$ <https://urldefense.com/v3/__https://mdavidsaver.github.io/pvxs/__;!!D9dNQwwGXtA!QvJCJFvFjdyKLmOVaaoqQ-_7p7M-QOxB1j1874UChwdwp4EIbx70WhtalgizLcJWAVZmwNrzC6XHFczTXw-W7sCO$>

For any new development - please start there. It will save you from
migrating your application at some point in the near future.

Cheers,
~Ralph


On Thu, 2 Nov 2023 at 12:46, Eusebio Naif Al-Soliman Fuentes via Tech-talk <
tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>> wrote:

Hello everybody.

I have a small question. In the pvaClient library for C++ (
https://urldefense.com/v3/__https://docs.epics-controls.org/projects/pvaclient-cpp/en/latest/__;!!D9dNQwwGXtA!QvJCJFvFjdyKLmOVaaoqQ-_7p7M-QOxB1j1874UChwdwp4EIbx70WhtalgizLcJWAVZmwNrzC6XHFczTX6fDGW9p$ <https://urldefense.com/v3/__https://docs.epics-controls.org/projects/pvaclient-cpp/en/latest/__;!!D9dNQwwGXtA!QvJCJFvFjdyKLmOVaaoqQ-_7p7M-QOxB1j1874UChwdwp4EIbx70WhtalgizLcJWAVZmwNrzC6XHFczTX6fDGW9p$> ) there
are many examples to get the value and other fields of a PV.

However, in order to get the value as a double, like in this example
https://urldefense.com/v3/__https://github.com/epics-rip/exampleCPP/blob/master/exampleClient/src/examplePvaClientGet.cpp__;!!D9dNQwwGXtA!QvJCJFvFjdyKLmOVaaoqQ-_7p7M-QOxB1j1874UChwdwp4EIbx70WhtalgizLcJWAVZmwNrzC6XHFczTXz1KPekp$ <https://urldefense.com/v3/__https://github.com/epics-rip/exampleCPP/blob/master/exampleClient/src/examplePvaClientGet.cpp__;!!D9dNQwwGXtA!QvJCJFvFjdyKLmOVaaoqQ-_7p7M-QOxB1j1874UChwdwp4EIbx70WhtalgizLcJWAVZmwNrzC6XHFczTXz1KPekp$> ,
you have to previously know that the PV value is a double. Is there any
method to get the type (int, long, double...) of the value field? Something
like ->getType().

Thanks in advance.
--

Saludos/Best regards

*University of Granada  *

Eusebio Naif Al-Soliman Fuentes
*MSc. Data Science and Computer Engineering*

eunaif at correo.ugr.es <mailto:eunaif at correo.ugr.es>


References:
Get the type of a PV in C++ API Eusebio Naif Al-Soliman Fuentes via Tech-talk
Re: Get the type of a PV in C++ API Ralph Lange via Tech-talk
Re: Get the type of a PV in C++ API Eusebio Naif Al-Soliman Fuentes via Tech-talk

Navigate by Date:
Prev: Re: record with constant input link Rolf Keitel via Tech-talk
Next: Re: record with constant input link Gerrit Kühn via Tech-talk
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  <20232024 
Navigate by Thread:
Prev: Re: Get the type of a PV in C++ API Veseli, Sinisa via Tech-talk
Next: Re: Get the type of a PV in C++ API Michael Davidsaver via Tech-talk
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  <20232024 
ANJ, 03 Nov 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·