diff --git a/src/db/Makefile b/src/db/Makefile index d9edbb4a7..0a6b35bf6 100644 --- a/src/db/Makefile +++ b/src/db/Makefile @@ -63,6 +63,7 @@ LIBSRCS += dbChannelIO.cpp LIBSRCS += dbSubscriptionIO.cpp LIBSRCS += dbPutNotifyBlocker.cpp LIBSRCS += dbServiceIOReadNotifyCache.cpp +LIBSRCS += templateInstances.cpp LIBRARY_IOC = dbIoc DLL_LIBS = dbStaticIoc ca Com diff --git a/src/db/dbCAC.h b/src/db/dbCAC.h index b1695fee3..8e13724d0 100644 --- a/src/db/dbCAC.h +++ b/src/db/dbCAC.h @@ -17,6 +17,30 @@ * 1) This interface is preliminary and will change in the future */ +#ifndef dbCACh +#define dbCACh + +#ifdef epicsExportSharedSymbols +#define dbCACh_restore_epicsExportSharedSymbols +#undef epicsExportSharedSymbols +#endif + +#include "shareLib.h" + +#include "tsDLList.h" +#include "epicsSingleton.h" +#include "tsFreeList.h" +#include "resourceLib.h" + +#include "cacIO.h" + +#ifdef dbCACh_restore_epicsExportSharedSymbols +#define epicsExportSharedSymbols +#endif + +#include "shareLib.h" + +#include "db_access.h" #include "dbNotify.h" #include "dbEvent.h" #include "dbAddr.h" @@ -86,42 +110,6 @@ private: dbServicePrivateListOfIO & operator = ( const dbServicePrivateListOfIO & ); }; -class dbChannelIO : public cacChannel, public dbServicePrivateListOfIO { -public: - dbChannelIO ( cacChannelNotify ¬ify, - const dbAddr &addr, dbServiceIO &serviceIO ); - void destroy (); - void callReadNotify ( unsigned type, unsigned long count, - cacReadNotify ¬ify ); - void callStateNotify ( unsigned type, unsigned long count, - const struct db_field_log *pfl, cacStateNotify ¬ify ); - void show ( unsigned level ) const; - void * operator new ( size_t size); - void operator delete ( void *pCadaver, size_t size ); - const char *pName () const; -protected: - ~dbChannelIO (); // allocate only from pool -private: - dbServiceIO & serviceIO; - dbAddr addr; - void initiateConnect (); - ioStatus read ( unsigned type, unsigned long count, - cacReadNotify &, ioid * ); - void write ( unsigned type, unsigned long count, - const void *pvalue ); - ioStatus write ( unsigned type, unsigned long count, - const void *pvalue, cacWriteNotify &, ioid * ); - void subscribe ( unsigned type, unsigned long count, - unsigned mask, cacStateNotify ¬ify, ioid * ); - void ioCancel ( const ioid & ); - void ioShow ( const ioid &, unsigned level ) const; - short nativeType () const; - unsigned long nativeElementCount () const; - static epicsSingleton < tsFreeList < dbChannelIO > > pFreeList; - dbChannelIO ( const dbChannelIO & ); - dbChannelIO & operator = ( const dbChannelIO & ); -}; - // allow only one thread at a time to use the cache, but do not hold // lock when calling the callback class dbServiceIOReadNotifyCache { @@ -182,3 +170,5 @@ inline void dbServiceIO::callReadNotify ( struct dbAddr &addr, this->readNotifyCache.callReadNotify ( addr, type, count, notify ); } +#endif // dbCACh + diff --git a/src/db/dbChannelIO.cpp b/src/db/dbChannelIO.cpp index 6474968c3..3e4646db5 100644 --- a/src/db/dbChannelIO.cpp +++ b/src/db/dbChannelIO.cpp @@ -17,7 +17,6 @@ #include -#include "cacIO.h" #include "tsFreeList.h" #include "epicsMutex.h" #include "epicsEvent.h" @@ -27,21 +26,9 @@ #define epicsExportSharedSymbols #include "db_access_routines.h" #include "dbCAC.h" -#include "dbChannelIOIL.h" +#include "dbChannelIO.h" #include "dbPutNotifyBlocker.h" -#ifdef _MSC_VER -# pragma warning ( push ) -# pragma warning ( disable:4660 ) -#endif - -template class tsFreeList < dbChannelIO >; -template class epicsSingleton < tsFreeList < dbChannelIO > >; - -#ifdef _MSC_VER -# pragma warning ( pop ) -#endif - epicsSingleton < tsFreeList < dbChannelIO > > dbChannelIO::pFreeList; dbChannelIO::dbChannelIO ( cacChannelNotify ¬ify, diff --git a/src/db/dbChannelIO.h b/src/db/dbChannelIO.h new file mode 100644 index 000000000..093bb33ff --- /dev/null +++ b/src/db/dbChannelIO.h @@ -0,0 +1,108 @@ + +/* + * $Id$ + * + * + * L O S A L A M O S + * Los Alamos National Laboratory + * Los Alamos, New Mexico 87545 + * + * Copyright, 1986, The Regents of the University of California. + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 + * + * NOTES: + * 1) This interface is preliminary and will change in the future + */ + +#ifndef dbChannelIOh +#define dbChannelIOh + +class dbChannelIO : public cacChannel, public dbServicePrivateListOfIO { +public: + dbChannelIO ( cacChannelNotify ¬ify, + const dbAddr &addr, dbServiceIO &serviceIO ); + void destroy (); + void callReadNotify ( unsigned type, unsigned long count, + cacReadNotify ¬ify ); + void callStateNotify ( unsigned type, unsigned long count, + const struct db_field_log *pfl, cacStateNotify ¬ify ); + void show ( unsigned level ) const; + void * operator new ( size_t size); + void operator delete ( void *pCadaver, size_t size ); + const char *pName () const; +protected: + ~dbChannelIO (); // allocate only from pool +private: + dbServiceIO & serviceIO; + dbAddr addr; + void initiateConnect (); + ioStatus read ( unsigned type, unsigned long count, + cacReadNotify &, ioid * ); + void write ( unsigned type, unsigned long count, + const void *pvalue ); + ioStatus write ( unsigned type, unsigned long count, + const void *pvalue, cacWriteNotify &, ioid * ); + void subscribe ( unsigned type, unsigned long count, + unsigned mask, cacStateNotify ¬ify, ioid * ); + void ioCancel ( const ioid & ); + void ioShow ( const ioid &, unsigned level ) const; + short nativeType () const; + unsigned long nativeElementCount () const; + static epicsSingleton < tsFreeList < dbChannelIO > > pFreeList; + dbChannelIO ( const dbChannelIO & ); + dbChannelIO & operator = ( const dbChannelIO & ); +}; + + +inline unsigned long dbChannelIO::nativeElementCount () const +{ + if ( this->addr.no_elements >= 0u ) { + return static_cast < unsigned long > ( this->addr.no_elements ); + } + return 0u; +} + +inline void dbChannelIO::destroy () +{ + delete this; +} + +inline void * dbChannelIO::operator new ( size_t size ) +{ + return dbChannelIO::pFreeList->allocate ( size ); +} + +inline void dbChannelIO::operator delete ( void *pCadaver, size_t size ) +{ + dbChannelIO::pFreeList->release ( pCadaver, size ); +} + +inline const char *dbChannelIO::pName () const +{ + return addr.precord->name; +} + +inline short dbChannelIO::nativeType () const +{ + return this->addr.dbr_field_type; +} + +inline void dbChannelIO::callReadNotify ( unsigned type, unsigned long count, + cacReadNotify ¬ify ) +{ + this->serviceIO.callReadNotify ( this->addr, type, count, notify ); +} + +inline void dbChannelIO::callStateNotify ( unsigned type, unsigned long count, + const struct db_field_log *pfl, cacStateNotify ¬ify ) +{ + this->serviceIO.callStateNotify ( this->addr, type, count, pfl, notify ); +} + + +#endif // dbChannelIOh + diff --git a/src/db/dbChannelIOIL.h b/src/db/dbChannelIOIL.h deleted file mode 100644 index 83acdd7ba..000000000 --- a/src/db/dbChannelIOIL.h +++ /dev/null @@ -1,64 +0,0 @@ - - -/* - * $Id$ - * - * - * L O S A L A M O S - * Los Alamos National Laboratory - * Los Alamos, New Mexico 87545 - * - * Copyright, 1986, The Regents of the University of California. - * - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 - */ - - -inline unsigned long dbChannelIO::nativeElementCount () const -{ - if ( this->addr.no_elements >= 0u ) { - return static_cast < unsigned long > ( this->addr.no_elements ); - } - return 0u; -} - -inline void dbChannelIO::destroy () -{ - delete this; -} - -inline void * dbChannelIO::operator new ( size_t size ) -{ - return dbChannelIO::pFreeList->allocate ( size ); -} - -inline void dbChannelIO::operator delete ( void *pCadaver, size_t size ) -{ - dbChannelIO::pFreeList->release ( pCadaver, size ); -} - -inline const char *dbChannelIO::pName () const -{ - return addr.precord->name; -} - -inline short dbChannelIO::nativeType () const -{ - return this->addr.dbr_field_type; -} - -inline void dbChannelIO::callReadNotify ( unsigned type, unsigned long count, - cacReadNotify ¬ify ) -{ - this->serviceIO.callReadNotify ( this->addr, type, count, notify ); -} - -inline void dbChannelIO::callStateNotify ( unsigned type, unsigned long count, - const struct db_field_log *pfl, cacStateNotify ¬ify ) -{ - this->serviceIO.callStateNotify ( this->addr, type, count, pfl, notify ); -} - diff --git a/src/db/dbPutNotifyBlocker.cpp b/src/db/dbPutNotifyBlocker.cpp index dba4d0109..f65c4d19f 100644 --- a/src/db/dbPutNotifyBlocker.cpp +++ b/src/db/dbPutNotifyBlocker.cpp @@ -26,27 +26,14 @@ #include "epicsSingleton.h" #include "errMdef.h" -#include "cacIO.h" #include "caerr.h" // this needs to be eliminated #include "db_access.h" // this needs to be eliminated #define epicsExportSharedSymbols #include "dbCAC.h" -#include "dbChannelIOIL.h" +#include "dbChannelIO.h" #include "dbPutNotifyBlocker.h" -#ifdef _MSC_VER -# pragma warning ( push ) -# pragma warning ( disable:4660 ) -#endif - -template class tsFreeList < dbPutNotifyBlocker, 1024 >; -template class epicsSingleton < tsFreeList < dbPutNotifyBlocker, 1024 > >; - -#ifdef _MSC_VER -# pragma warning ( pop ) -#endif - epicsSingleton < tsFreeList < dbPutNotifyBlocker, 1024 > > dbPutNotifyBlocker::pFreeList; dbPutNotifyBlocker::dbPutNotifyBlocker ( dbChannelIO &chanIn ) : diff --git a/src/db/dbPutNotifyBlocker.h b/src/db/dbPutNotifyBlocker.h index c37f5f01b..e4d1594a6 100644 --- a/src/db/dbPutNotifyBlocker.h +++ b/src/db/dbPutNotifyBlocker.h @@ -18,6 +18,22 @@ #ifndef dbPutNotifyBlockerh #define dbPutNotifyBlockerh +#ifdef epicsExportSharedSymbols +#define dbPutNotifyBlockerh_restore_epicsExportSharedSymbols +#undef epicsExportSharedSymbols +#endif + +#include "shareLib.h" + +#include "tsFreeList.h" +#include "epicsSingleton.h" + +#ifdef dbPutNotifyBlockerh_restore_epicsExportSharedSymbols +#define epicsExportSharedSymbols +#endif + +#include "shareLib.h" + class dbPutNotifyBlocker : public dbBaseIO { public: dbPutNotifyBlocker ( dbChannelIO & chanIn ); diff --git a/src/db/dbServiceIO.cpp b/src/db/dbServiceIO.cpp index e825290e6..95246fd85 100644 --- a/src/db/dbServiceIO.cpp +++ b/src/db/dbServiceIO.cpp @@ -19,7 +19,6 @@ #include "epicsMutex.h" #include "tsFreeList.h" -#include "cacIO.h" #include "cadef.h" // this can be eliminated when the callbacks use the new interface #include "db_access.h" // should be eliminated here in the future #include "caerr.h" // should be eliminated here in the future @@ -30,21 +29,9 @@ #define epicsExportSharedSymbols #include "db_access_routines.h" #include "dbCAC.h" -#include "dbChannelIOIL.h" +#include "dbChannelIO.h" #include "dbPutNotifyBlocker.h" -#ifdef _MSC_VER -# pragma warning ( push ) -# pragma warning ( disable:4660 ) -#endif - -template class resTable < dbBaseIO, chronIntId >; -template class chronIntIdResTable < dbBaseIO >; - -#ifdef _MSC_VER -# pragma warning ( pop ) -#endif - class dbServiceIOLoadTimeInit { public: dbServiceIOLoadTimeInit (); diff --git a/src/db/dbServiceIOReadNotifyCache.cpp b/src/db/dbServiceIOReadNotifyCache.cpp index 2bf05c375..cbd1a9acd 100644 --- a/src/db/dbServiceIOReadNotifyCache.cpp +++ b/src/db/dbServiceIOReadNotifyCache.cpp @@ -8,7 +8,6 @@ #include "tsFreeList.h" #include "epicsSingleton.h" -#include "cacIO.h" #include "cadef.h" // this can be eliminated when the callbacks use the new interface #include "db_access.h" // should be eliminated here in the future diff --git a/src/db/dbSubscriptionIO.cpp b/src/db/dbSubscriptionIO.cpp index 6e0ac4d4c..48940a3e5 100644 --- a/src/db/dbSubscriptionIO.cpp +++ b/src/db/dbSubscriptionIO.cpp @@ -22,27 +22,14 @@ #include "tsFreeList.h" #include "epicsSingleton.h" -#include "cacIO.h" #include "db_access.h" // need to eliminate this #include "cadef.h" // this can be eliminated when the callbacks use the new interface #define epicsExportSharedSymbols #include "dbCAC.h" -#include "dbChannelIOIL.h" +#include "dbChannelIO.h" #include "db_access_routines.h" -#ifdef _MSC_VER -# pragma warning ( push ) -# pragma warning ( disable:4660 ) -#endif - -template class tsFreeList < dbSubscriptionIO >; -template class epicsSingleton < tsFreeList < dbSubscriptionIO > >; - -#ifdef _MSC_VER -# pragma warning ( pop ) -#endif - epicsSingleton < tsFreeList < dbSubscriptionIO > > dbSubscriptionIO::pFreeList; dbSubscriptionIO::dbSubscriptionIO ( dbServiceIO &serviceIO, dbChannelIO &chanIO, diff --git a/src/db/templateInstances.cpp b/src/db/templateInstances.cpp new file mode 100644 index 000000000..6f4947053 --- /dev/null +++ b/src/db/templateInstances.cpp @@ -0,0 +1,41 @@ + +/* + * $Id$ + * + * + * L O S A L A M O S + * Los Alamos National Laboratory + * Los Alamos, New Mexico 87545 + * + * Copyright, 1986, The Regents of the University of California. + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 + */ + +#define epicsExportSharedSymbols + +#include "dbCAC.h" +#include "dbChannelIO.h" +#include "dbPutNotifyBlocker.h" + + +#ifdef _MSC_VER +# pragma warning ( push ) +# pragma warning ( disable:4660 ) +#endif + +template class tsFreeList < dbChannelIO >; +template class epicsSingleton < tsFreeList < dbChannelIO > >; +template class tsFreeList < dbPutNotifyBlocker, 1024 >; +template class epicsSingleton < tsFreeList < dbPutNotifyBlocker, 1024 > >; +template class resTable < dbBaseIO, chronIntId >; +template class chronIntIdResTable < dbBaseIO >; +template class tsFreeList < dbSubscriptionIO >; +template class epicsSingleton < tsFreeList < dbSubscriptionIO > >; + +#ifdef _MSC_VER +# pragma warning ( pop ) +#endif