EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  <19992000  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  <19992000  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: String PVs and the Portable CA Server.
From: [email protected]
To: [email protected]
Cc: [email protected]
Date: Thu, 22 Jul 1999 14:57:09 -0700 (PDT)
Hi Brian,

>My origional attempt at getting strings to work were with aitEnumFixedString.
>My memory is foggy as to why I wasn't able to get it to work then--but I didn't
>get Fixed Strings to work either.  I remember finally settling on aitEnumString
>because I was able to Put into the PV and get the put value into my code.  Also,
>once Put, other clients could Get without problem.

OK, I don't allow puts (yet) so thanks for the heads-up on this.

>What I need to do now is have my server change what a client Gets based on what
>the server application is doing.  I can see the appropriate string in the scan
>method for the PV, but I can't copy it into the smartGDDPointer so clients can
>see it properly.  I really don't care if the PV is a aitEnumString or a
>aitEnumFixedString--I just want it to be a string.  If you, or anyone else, has
>a small snippet of code from the scan method which shows how to put a string
>into a smartGDDPointer, I'd be a very happy man!

Sorry, no joy...  I don't use smartGDDPointers - maybe I should be?  
I use regular gdds instead.

A little bit of code that probably won't help you but I'll be a sport
and include it anyway:

>From my PV constructor:
        ........
	type_e = aitEnumFixedString;
        nelem  = 1;
	dbvalue_ps = memory allocated to hold the SLC database value
        ........
        // Create general data descriptor objects for the current
        // SLC database get value.  Abort if allocation error.

        get_po = new gdd(gddAppType_value,    /* value type            */
                         type_e,              /* primitive type        */
                         1,                   /* 1 dimensional array   */
                         &nelem);
        assert(get_po != 0);

        // Put the pointer to SLC database data in the get GDD.  
        // This prevents the unnecessary copy from the SLC database
        // structure to the gdd object.  First define a destructor
        // for the database value so that the value space is deleted
        // only after all references are removed.

        dbvalue_destruct_po = new SLCcasPVgddDestructor_C(dbvalue_ps);
        assert(dbvalue_destruct_po != 0);
        dbvalue_destruct_po->reference();
        get_po->putRef(dbvalue_ps, type_e, dbvalue_destruct_po);

        // Initialize timestamp in GDD.  I notice the GDD init
        // routine does not do this for some reason.  Also, initialize
        // status/severity to indicate that data is undefined.

        const aitTimeStamp * time_po = getCurrTime();
        get_po->setTimeStamp(time_po);
        get_po->setStatSevr(UDF_ALARM, INVALID_ALARM);
	........

>From my PV destructor:
	........
        if (get_po) 
        {
            get_po->unreference();
            get_po = 0;
        }

        // Dereference the DB value destructor.  It'll be freed as soon
        // as EVERYONE has dereferenced.
        if (dbvalue_destruct_po) 
        {
           dbvalue_destruct_po->destroy(0);
           dbvalue_destruct_po = 0;
           dbvalue_ps          = 0;
        }
        .........


In the PV read method, the data area, status, severity, and timestamp are 
updated.  The read function table routine for getting a value is then simple:

caStatus SLCcasPV_C::getValue(gdd &value_ro) 
{       value_ro.put(get_po);            return S_cas_success;  }

There is code for monitoring but I'll leave it out.

Hope you get better help from somebody else!

Stephanie


Navigate by Date:
Prev: Re: String PVs and the Portable CA Server. Brian Tieman
Next: How do you know if you are accessing a shared resource? Steven M Beard
Index: 1994  1995  1996  1997  1998  <19992000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: String PVs and the Portable CA Server. Peregrine McGehee
Next: FW: NI VXIpc SBC and VxWorks Jeff Hill
Index: 1994  1995  1996  1997  1998  <19992000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·