Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  Index 2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: RE: EPICS base V4: iocCore database
From: Jeff Hill <johill@lanl.gov>
To: 'Benjamin Franksen' <benjamin.franksen@bessy.de>
Cc: 'Marty Kraimer' <mrk@aps.anl.gov>, 'Andrew Johnson' <anj@aps.anl.gov>, 'Bob Dalesio' <ldalesio@lanl.gov>, 'Ralph Lange' <Ralph.Lange@mail.bessy.de>, 'Eric Norum' <norume@aps.anl.gov>, 'Ken Evans' <evans@aps.anl.gov>, 'Ned Arnold' <nda@aps.anl.gov>, 'Matej Sekoranja' <matej.sekoranja@ijs.si>
Date: Wed, 23 Feb 2005 11:14:53 -0700
> However, I could not find any link on the web where I 
> can download code or a documentation of the API.

The document I sent out yesterday covers the entire API. Of
course it's not a reference manual and is instead a tutorial, but
I believe that it *is* a comprehensive description of how the
interface is used.

I have attached the source code for the interface. I am happy to
send also the source code for the support library, but felt that
you should initially see only the interface so that it's clear
where the interface stops and the implementation begins. 

Jeff

> -----Original Message-----
> From: Benjamin Franksen [mailto:benjamin.franksen@bessy.de]
> Sent: Wednesday, February 23, 2005 10:34 AM
> To: Jeff Hill
> Cc: 'Marty Kraimer'; 'Andrew Johnson'; 'Bob Dalesio'; 'Ralph
> Lange'; 'Eric Norum'; 'Ken Evans'; 'Ned Arnold'; 'Matej
> Sekoranja'
> Subject: Re: EPICS base V4: iocCore database
> 
> Dear Jeff & Ralph,
> 
> you both have worked for quite some time now on DataAccess. You
> even made
> performance measurements on several machines under several
OSes,
> as I gather
> from the talk I found on the web. However, I could not find any
> link on the
> web where I can download code or a documentation of the API.
> 
> Providing these would help a lot to lift the discussion to a
> more constructive
> level.
> 
> Ben
//
// $Id: daPropertyId.h,v 1.7 2005/02/16 00:03:03 jhill Exp $
//
// Authors: Jeff Hill, johill@lanl.gov
//          Ralph Lange, Ralph.Lange@aps.anl.gov

#ifndef daPropertyId_h
#define daPropertyId_h

#include "shareLib.h"

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
namespace da {
#endif

class stringSegment;
class propertyCatalog;

class epicsShareClass propertyId {
public:
    propertyId ( const char * pName );
    propertyId ( const stringSegment & );
    propertyId ( const propertyId & in ) ;

    propertyId & operator = ( const propertyId & rhs ) ;

    bool operator == ( const propertyId & rhs ) const ;
    bool operator != ( const propertyId & rhs ) const ;

    void getName ( stringSegment & ) const;

    unsigned identifier () const;

private:
    const class propertyCode * pAC;
    propertyId (); // NO compiler default constructor
};

// built in property id's
epicsShareExtern propertyId propertyIdPrecision; // precision
epicsShareExtern propertyId propertyIdEnumeration; // enumeration

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
} // end of namespace da
#endif

#endif // ifndef daPropertyId_h

//
// $Id: daEnum.h,v 1.10 2005/02/18 01:11:31 jhill Exp $
//
// Authors: Jeff Hill, johill@lanl.gov
//          Ralph Lange, Ralph.Lange@aps.anl.gov

#ifndef daEnum_h
#define daEnum_h

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
namespace da {
#endif

class stringSegment;

class enumViewer {
public:
    virtual void reveal ( 
        const int state, const stringSegment & )  = 0;
};

class enumStateSet {
public:
    virtual unsigned numberOfStates () const = 0;
    virtual void traverse ( enumViewer & ea ) const = 0;
    virtual bool matchingState ( const stringSegment & label, int & state ) const = 0;
    virtual bool matchingState ( const int state, stringSegment & label ) const = 0;

    // return false only if unsuccessful
    virtual bool removeAllStates () = 0;
    virtual bool removeState ( int state ) = 0;
    virtual bool setLabel ( int state, const stringSegment & ) = 0;
};

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
} // end of namespace da
#endif

#endif // daEnum_h
//
// $Id: daStream.h,v 1.6 2005/02/17 21:43:41 jhill Exp $
//
// Authors: Jeff Hill, johill@lanl.gov
//          Ralph Lange, Ralph.Lange@aps.anl.gov
//

#ifndef streamPosition_h
#define streamPosition_h

#include <cstdlib>

#include "shareLib.h"

class epicsTime;

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
namespace da {
#endif

using namespace std;

class streamPosition {
public:
    // returns the number of elements in the stream
    virtual size_t length () const = 0;
    // get current position
    virtual size_t position () const = 0;
    // set the current stream position
    // (returns false if request cant be satisfied)
    virtual bool movePosition ( size_t newPosition ) = 0;
    // returns the number of immediately viewable 
    // elements after the current position.
    virtual size_t viewable () = 0;
    // remove all elements from current position to the 
    // end of the stream
    virtual bool prune () = 0;
    // flush cached output entries 
    virtual void flush () = 0;
};

epicsShareExtern class propertyCatalog & voidCatalog;

enum streamWriteStatus { 
    swsSuccess = 0, 
    swsUnableToExtend = 1
};

class streamWrite {
public:
    virtual streamWriteStatus write ( 
        const double &, const propertyCatalog & = voidCatalog ) = 0;
    virtual streamWriteStatus write ( 
        const int &, const propertyCatalog & = voidCatalog ) = 0;
    virtual streamWriteStatus write ( 
        const long &, const propertyCatalog & = voidCatalog ) = 0;
    virtual streamWriteStatus write ( 
        const unsigned &, const propertyCatalog & = voidCatalog ) = 0;
    virtual streamWriteStatus write ( 
        const unsigned long &, const propertyCatalog & = voidCatalog ) = 0;
    virtual streamWriteStatus write ( 
        const epicsTime &, const propertyCatalog & = voidCatalog ) = 0;
    virtual streamWriteStatus write ( 
        const class stringSegment &, const propertyCatalog & = voidCatalog ) = 0;
};

enum streamReadStatus { 
    srsSuccess = 0, 
    srsOutOfRangeLow = 1, 
    srsOutOfRangeHigh = 2, 
    srsIncompatible = 3, 
    srsIncomplete = 4
};

class streamRead {
public:
    virtual streamReadStatus read ( 
        double &, const propertyCatalog & = voidCatalog ) const = 0;
    virtual streamReadStatus read ( 
        int &, const propertyCatalog & = voidCatalog ) const = 0;
    virtual streamReadStatus read ( 
        long &, const propertyCatalog & = voidCatalog ) const = 0;
    virtual streamReadStatus read ( 
        unsigned &, const propertyCatalog & = voidCatalog ) const = 0;
    virtual streamReadStatus read ( 
        unsigned long &, const propertyCatalog & = voidCatalog ) const = 0;
    virtual streamReadStatus read ( 
        epicsTime &, const propertyCatalog & = voidCatalog ) const = 0;
    virtual streamReadStatus read ( 
        class stringSegment &, const propertyCatalog & = voidCatalog ) const = 0;
};

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
} // end of namespace dataAccess
#endif

#endif // ifdef streamPosition_h
//
// $Id: daString.h,v 1.9 2005/02/16 19:39:48 jhill Exp $
//
// Authors: Jeff Hill, johill@lanl.gov
//          Ralph Lange, Ralph.Lange@aps.anl.gov
//

#ifndef daString_h
#define daString_h

#include "dataAccess.h"
#include "daStream.h"

class epicsTime;

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
namespace da {
#endif

enum stringDiff { sdBelow, sdEqual, sdAbove };

class stringSegment : 
    public streamPosition, 
    public streamRead,
    public streamWrite {
public:
    virtual bool getChar ( unsigned & inChar ) const  = 0;
    virtual bool putChar ( unsigned outChar )  = 0;
    virtual stringDiff compare ( const stringSegment & ) const  = 0;
};

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
} // end of namespace da
#endif

#endif // ifndef daString_h
//
// $Id: dataAccess.h,v 1.13 2005/02/18 01:11:31 jhill Exp $
//
// Authors: Jeff Hill, johill@lanl.gov
//          Ralph Lange, Ralph.Lange@aps.anl.gov

#ifndef dataAccess_h
#define dataAccess_h

#include <cstdlib>

#include "shareLib.h"

class epicsTime;

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
namespace da {
#endif

using namespace std;

class propertyId;
class propertyViewer; 
class propertyManipulator;
class arraySegment;
class arrayViewer;
class arrayManipulator;
class stringSegment;
class enumStateSet;

enum traverseModifyStatus { 
    tmsSuccess, 
    tmsOutOfRangeLow, 
    tmsOutOfRangeHigh, 
    tmsInvalidState
};

class propertyCatalog {
public:
    virtual void traverse ( propertyViewer & ) const = 0;
    virtual traverseModifyStatus traverse ( propertyManipulator & ) = 0;
    // false returned when the property does not exist, otherwise true
    virtual bool find ( const propertyId & id, propertyViewer & ) const = 0;
};

epicsShareExtern propertyCatalog & voidCatalog;

class propertyViewer {
public:
    virtual void reveal ( const propertyId &, 
        const double &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const int &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const unsigned int &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const long &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const unsigned long &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const epicsTime &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const stringSegment &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const enumStateSet & )  = 0;
    virtual void reveal ( const propertyId &, 
        const arraySegment &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        const propertyCatalog & )  = 0;
};

class propertyManipulator {
public:
    virtual void reveal ( const propertyId &, 
        float &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        double &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        char &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        signed char &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        unsigned char &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        short &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        unsigned short &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        int &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        unsigned int &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        long &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        unsigned long &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        epicsTime &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        stringSegment &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        enumStateSet & )  = 0;
    virtual void reveal ( const propertyId &, 
        arraySegment &, const propertyCatalog & = voidCatalog )  = 0;
    virtual void reveal ( const propertyId &, 
        propertyCatalog & )  = 0;
};

class arrayBounds {
public:
    struct bound {
        size_t first;
        size_t count;
    };
    virtual unsigned numberOfDimensions () const  = 0; 
    virtual bound getBound ( unsigned dimension ) const  = 0;
    // returns false if the request cant be or will not be completed
    virtual bool setNumberOfDimensions ( unsigned num ) = 0;
    virtual bool setDimension ( unsigned dimension, const bound & ) = 0;
};

epicsShareExtern arrayBounds & arrayBoundsScalar;

enum sliceTraverseStatus {
    stsSuccess = 0,
    stsSliceOutOfBounds = 1,
    stsSliceIndexOutOfBounds = 2
};

class arraySegment : 
    public arrayBounds {
public:
    virtual void traverse ( arrayViewer & ) const = 0;
    virtual void traverse ( arrayManipulator & ) = 0;
    virtual sliceTraverseStatus traverse ( 
        const arrayBounds & slice, 
        const arrayBounds::bound & sliceSeqIndex,
        arrayViewer & ) const = 0;
    virtual sliceTraverseStatus traverse ( 
        const arrayBounds & slice, 
        const arrayBounds::bound & sliceSeqIndex,
        arrayManipulator & ) = 0;
};

class arrayViewer
{
public:
    virtual void reveal ( const float *, size_t nElem )  = 0;
    virtual void reveal ( const double *, size_t nElem )  = 0;
    virtual void reveal ( const char *, size_t nElem )  = 0;
    virtual void reveal ( const signed char *, size_t nElem )  = 0;
    virtual void reveal ( const unsigned char *, size_t nElem )  = 0;
    virtual void reveal ( const short *, size_t nElem )  = 0;
    virtual void reveal ( const unsigned short *, size_t nElem )  = 0;
    virtual void reveal ( const int *, size_t nElem )  = 0;
    virtual void reveal ( const unsigned int *, size_t nElem )  = 0;
    virtual void reveal ( const long *, size_t nElem )  = 0;
    virtual void reveal ( const unsigned long *, size_t nElem )  = 0;
    virtual void reveal ( const stringSegment *, size_t nElem )  = 0;
    virtual void reveal ( const propertyCatalog *, size_t nElem )  = 0;
};

class arrayManipulator
{
public:
    virtual void reveal ( float *, size_t nElem )  = 0;
    virtual void reveal ( double *, size_t nElem )  = 0;
    virtual void reveal ( char *, size_t nElem )  = 0;
    virtual void reveal ( signed char *, size_t nElem )  = 0;
    virtual void reveal ( unsigned char *, size_t nElem )  = 0;
    virtual void reveal ( short *, size_t nElem )  = 0;
    virtual void reveal ( unsigned short *, size_t nElem )  = 0;
    virtual void reveal ( int *, size_t nElem )  = 0;
    virtual void reveal ( unsigned int *pArray, size_t nElem )  = 0;
    virtual void reveal ( long *, size_t nElem )  = 0;
    virtual void reveal ( unsigned long *, size_t nElem )  = 0;
    virtual void reveal ( stringSegment *, size_t nElem )  = 0;
    virtual void reveal ( propertyCatalog *, size_t nElem )  = 0;
};

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
} // end of namespace da
#endif

#endif // ifdef dataAccess_h
//
// $Id: daAssign.h,v 1.10 2005/02/18 16:59:33 jhill Exp $
//
// Authors: Jeff Hill, johill@lanl.gov
//          Ralph Lange, Ralph.Lange@aps.anl.gov

#ifndef daAssign_h
#define daAssign_h

#include "shareLib.h"

#include "dataAccess.h"

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
namespace da {
#endif

// numeric assignments here must 
// track with logic elsewhere
enum assignStatus { 
    asSuccess = 0, 
    asOutOfRangeLow = 1, 
    asOutOfRangeHigh = 2, 
    asInvalidState = 3,
    asIncompatibleTypes = 4, 
    asElementIndexOverflow = 5,
    asUndefinedElements = 6,
    asUndefinedProperty = 7,
    asUnableToExtend = 8,
    asSliceOutOfBounds = 9,
    asSliceIndexOutOfBounds = 10,
    asUnexpected = 11
};

epicsShareFunc assignStatus assign ( 
    propertyCatalog & lhs, const propertyCatalog & rhs );

epicsShareFunc assignStatus assign ( 
    propertyCatalog & lhs, 
    const stringSegment & rhs, const propertyCatalog & rhsMeta );

epicsShareFunc assignStatus assign ( 
    stringSegment & lhs, const propertyCatalog & lhsMeta, 
    const propertyCatalog & rhs ) ;

epicsShareFunc assignStatus assign ( 
    arraySegment & lhs, const propertyCatalog & lhsMeta, 
    const arraySegment & rhs, const propertyCatalog & rhsMeta );

epicsShareFunc void throwException ( assignStatus );

epicsShareFunc inline void throwExceptionIfUnsuccessful ( 
    assignStatus stat )
{
    if ( stat != asSuccess ) {
        throwException ( stat );
    }
}

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
} // end of namespace da
#endif

#endif // ifndef daAssign_h

//
// $Id: daEquiv.h,v 1.5 2005/02/18 16:59:34 jhill Exp $
//
// Authors: Jeff Hill, johill@lanl.gov
//          Ralph Lange, Ralph.Lange@aps.anl.gov

#ifndef daEquiv_h
#define daEquiv_h

#include "dataAccess.h"

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
namespace da {
#endif

// numeric assignments here must 
// track with logic elsewhere
enum equivStatus { 
    esEqual = 0, 
    esNotEqual = 1, 
    esIncompatible = 2, 
    esElementIndexOverflow = 3,
    esUndefinedElements = 4, 
    esUndefinedProperty = 5
};

// comparison primitives
epicsShareFunc equivStatus equiv ( 
    const propertyCatalog & lhs, const propertyCatalog & rhsMeta );

epicsShareFunc equivStatus equiv ( 
    const propertyCatalog & lhs, 
    const stringSegment & rhs, const propertyCatalog & rhsMeta );

epicsShareFunc equivStatus equiv ( 
    const arraySegment & lhs, const propertyCatalog & lhsMeta, 
    const arraySegment & rhs, const propertyCatalog & rhsMeta );

epicsShareFunc void throwException ( equivStatus );

epicsShareFunc inline bool equivStatusToBool ( 
    equivStatus stat )
{
    if ( stat == esEqual ) {
        return true;
    }
    else if ( stat == esNotEqual ) {
        return false;
    }
    else {
        throwException ( stat );
    }
}

#if ! defined ( __GNUC__ ) || __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95 )
} // end of namespace da
#endif

#endif // ifndef daEquiv_h


Replies:
dataAccess Marty Kraimer
References:
Re: EPICS base V4: iocCore database Benjamin Franksen

Navigate by Date:
Prev: Re: EPICS base V4 Benjamin Franksen
Next: RE: EPICS base V4 Jeff Hill
Index: 2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Re: EPICS base V4: iocCore database Benjamin Franksen
Next: dataAccess Marty Kraimer
Index: 2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·