Directory moves. src/RTEMS/ => src/libCom/RTEMS/ src/as/ => src/ioc/as/ src/bpt/ => src/ioc/bpt/ src/ca/ => src/ca/client/ src/cap5/ => src/ca/client/perl/ src/cas/ => src/ca/legacy/pcas/ src/catools/ => src/ca/client/tools/ src/db/ => src/ioc/db/ src/dbStatic/ => src/ioc/dbStatic/ src/dbtools/ => src/ioc/dbtemplate/ src/dev/softDev/ => src/std/dev/ src/dev/testDev/ => src/std/test/ src/excas/ => src/ca/legacy/pcas/ex/ src/gdd/ => src/ca/legacy/gdd/ src/makeBaseApp/ => src/template/base/ src/makeBaseExt/ => src/template/ext/ src/misc/ => src/ioc/misc/ src/rec/ => src/std/rec/ src/registry/ => src/ioc/registry/ src/rsrv/ => src/ioc/rsrv/ src/softIoc/ => src/std/softIoc/ src/toolsComm/ => src/libCom/tools/
105 lines
2.6 KiB
C++
105 lines
2.6 KiB
C++
/*************************************************************************\
|
|
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
|
* National Laboratory.
|
|
* Copyright (c) 2002 The Regents of the University of California, as
|
|
* Operator of Los Alamos National Laboratory.
|
|
* EPICS BASE Versions 3.13.7
|
|
* and higher are distributed subject to a Software License Agreement found
|
|
* in file LICENSE that is included with this distribution.
|
|
\*************************************************************************/
|
|
|
|
/*
|
|
*
|
|
*
|
|
* 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
|
|
*/
|
|
|
|
#ifndef sgAutoPtrh
|
|
#define sgAutoPtrh
|
|
|
|
template < class T >
|
|
class sgAutoPtr {
|
|
public:
|
|
sgAutoPtr ( epicsGuard < epicsMutex > &,
|
|
struct CASG &, tsDLList < syncGroupNotify > & );
|
|
~sgAutoPtr ();
|
|
sgAutoPtr < T > & operator = ( T * );
|
|
T * operator -> ();
|
|
T & operator * ();
|
|
T * get ();
|
|
T * release ();
|
|
private:
|
|
tsDLList < syncGroupNotify > & list;
|
|
T * pNotify;
|
|
struct CASG & sg;
|
|
epicsGuard < epicsMutex > & guard;
|
|
sgAutoPtr & operator = ( const sgAutoPtr & );
|
|
};
|
|
|
|
template < class T >
|
|
inline sgAutoPtr < T > :: sgAutoPtr (
|
|
epicsGuard < epicsMutex > & guardIn,
|
|
struct CASG & sgIn, tsDLList < syncGroupNotify > & listIn ) :
|
|
list ( listIn ), pNotify ( 0 ), sg ( sgIn ), guard ( guardIn )
|
|
{
|
|
}
|
|
|
|
template < class T >
|
|
inline sgAutoPtr < T > :: ~sgAutoPtr ()
|
|
{
|
|
if ( this->pNotify ) {
|
|
list.remove ( *this->pNotify );
|
|
pNotify->destroy ( this->guard, this->sg );
|
|
}
|
|
}
|
|
|
|
template < class T >
|
|
inline sgAutoPtr < T > & sgAutoPtr < T > :: operator = ( T * pNotifyIn )
|
|
{
|
|
if ( this->pNotify ) {
|
|
list.remove ( *this->pNotify );
|
|
pNotify->destroy ( this->guard, this->sg );
|
|
}
|
|
this->pNotify = pNotifyIn;
|
|
list.add ( *this->pNotify );
|
|
return *this;
|
|
}
|
|
|
|
template < class T >
|
|
inline T * sgAutoPtr < T > :: operator -> ()
|
|
{
|
|
return this->pNotify;
|
|
}
|
|
|
|
template < class T >
|
|
inline T & sgAutoPtr < T > :: operator * ()
|
|
{
|
|
assert ( this->pNotify );
|
|
return * this->pNotify;
|
|
}
|
|
|
|
template < class T >
|
|
inline T * sgAutoPtr < T > :: release ()
|
|
{
|
|
T * pTmp = this->pNotify;
|
|
this->pNotify = 0;
|
|
return pTmp;
|
|
}
|
|
|
|
template < class T >
|
|
inline T * sgAutoPtr < T > :: get ()
|
|
{
|
|
return this->pNotify;
|
|
}
|
|
|
|
#endif // sgAutoPtrh
|