EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 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: write to a single element of an array field
From: Ben Franksen via Core-talk <core-talk at aps.anl.gov>
To: "core-talk at aps.anl.gov" <core-talk at aps.anl.gov>
Date: Wed, 18 Mar 2020 20:47:08 +0100
The way we distinguish between how much information is contained in a
db_field_log using its 'type' member looks a bit questionable to me.
What I observe is that the case distinctions are strewn all over the
place and in quite a repetitive manner. For instance, this sort of code:

    if (!pfl || pfl->type == dbfl_type_rec)
        field_type = paddr->field_type;
    else
        field_type = pfl->field_type;

can be found in many places in dbAccess.c. This should perhaps be
cleaned up using a hand full of macros(*).

Furthermore, the distinction is not consequently reflected in the data
structures. This comment is from db_field_log.h:

 * dbfl_type_rec - Reference to record
 *  The field log stores no data itself.  Data must instead be taken
 *  via the dbChannel* which must always be provided along
 *  with the field log.
 *  For this type only the 'type' and 'ctx' members are used.

This suggests a refactor:

(a) The meta data should be contained (as a sub-struct) in both struct
    dbfl_val and struct dbfl_ref and not as direct members of
    db_field_log.

(b) The "dbChannel* which must always be provided along with the field
    log" should be a member of the field log as a member of the union
    (possibly wrapped in a struct dbfl_rec).

I am thinking of making refactors along these lines before I further
embark on the planned additions.

(*) I assume that we still cannot use proper inline functions (as
defined in C99) in C code due to limitations in Microsoft's VS? I
googled a bit and it looks as if VS understands __inline, though it is
unclear what the exact semantics are.

Cheers
Ben


________________________________

Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Dr. Volkmar Dietz, stv. Vorsitzende Dr. Jutta Koch-Unterseher
Geschäftsführung: Prof. Dr. Bernd Rech (Sprecher), Prof. Dr. Jan Lüning, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin

Attachment: pEpkey.asc
Description: application/pgp-keys


Replies:
Re: write to a single element of an array field Ben Franksen via Core-talk
Re: write to a single element of an array field Ben Franksen via Core-talk
References:
Re: write to a single element of an array field Ben Franksen via Core-talk

Navigate by Date:
Prev: IOC build fails after removing an iocBoot dir from Git Konrad, Martin via Core-talk
Next: Re: IOC build fails after removing an iocBoot dir from Git Johnson, Andrew N. via Core-talk
Index: 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: write to a single element of an array field Zimoch Dirk (PSI) via Core-talk
Next: Re: write to a single element of an array field Ben Franksen via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 19 Mar 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·