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  <20202021  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  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: pvData Introspection: Change Structure at run time
From: Marty Kraimer via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Mon, 27 Jul 2020 14:33:23 -0400
Consider using  a union field
https://github.com/epics-base/exampleCPP/blob/master/database/src/exampleDatabase.cpp

Has some examples of how to create a union .

One example is:
static void createVariantUnionArrayRecord(
    PVDatabasePtr const &master,
    string const &recordName)
{
    StructureConstPtr top = fieldCreate->createFieldBuilder()->
         add("timeStamp",standardField->timeStamp()) ->
         addArray("value",fieldCreate->createVariantUnion())->
         createStructure();
    PVStructurePtr pvStructure = pvDataCreate->createPVStructure(top);
    PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
    bool result = master->addRecord(pvRecord);
    if(!result) cout<< "record " << recordName << " not added" << endl;
}

field "value" can be made into any pvType you want. In your case you can make it a structure.
What "value" is can be changed at run time.

On 7/27/20 1:23 PM, Madden, Timothy J. via Tech-talk wrote:
Folks

Most of the interfaces for Structure require a StructureConstPtr data type.
This is a pointer to an immutable structure.

Suppose I wish the structure to change at run time. What do we do? 

Tim Madden
APS




References:
pvData Introspection: Change Structure at run time Madden, Timothy J. via Tech-talk

Navigate by Date:
Prev: EDM fonts on Raspian ... Ernesto Paiser via Tech-talk
Next: asyn TracMask + asynMotor : function= John Dobbins 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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: pvData Introspection: Change Structure at run time Kasemir, Kay via Tech-talk
Next: EDM fonts on Raspian ... Ernesto Paiser 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  <20202021  2022  2023  2024 
ANJ, 27 Jul 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·