This is Unofficial EPICS BASE Doxygen Site
autoPtrRecycle.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE Versions 3.13.7
7 * and higher are distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 
11 /*
12  *
13  *
14  * L O S A L A M O S
15  * Los Alamos National Laboratory
16  * Los Alamos, New Mexico 87545
17  *
18  * Copyright, The Regents of the University of California.
19  *
20  *
21  * Author Jeffrey O. Hill
22  * johill@lanl.gov
23  * 505 665 1831
24  */
25 
26 #ifndef autoPtrRecycleh
27 #define autoPtrRecycleh
28 
29 template < class T >
31 public:
34  cacRecycle &, T * );
35  ~autoPtrRecycle ();
36  T & operator * () const;
37  T * operator -> () const;
38  T * get () const;
39  T * release ();
40 private:
41  T * p;
42  cacRecycle & r;
45  // not implemented
46  autoPtrRecycle ( const autoPtrRecycle & );
47  autoPtrRecycle & operator = ( const autoPtrRecycle & );
48 };
49 
50 template < class T >
53  cacRecycle & rIn, T * pIn ) :
54  p ( pIn ), r ( rIn ), ioTable ( tbl ), guard ( guardIn ) {}
55 
56 template < class T >
58 {
59  if ( this->p ) {
60  baseNMIU *pb = this->p;
61  this->ioTable.remove ( *pb );
62  pb->destroy ( this->guard, this->r );
63  }
64 }
65 
66 template < class T >
68 {
69  return * this->p;
70 }
71 
72 template < class T >
74 {
75  return this->p;
76 }
77 
78 template < class T >
79 inline T * autoPtrRecycle<T>::get () const
80 {
81  return this->p;
82 }
83 
84 template < class T >
86 {
87  T *pTmp = this->p;
88  this->p = 0;
89  return pTmp;
90 }
91 
92 #endif // #ifdef autoPtrRecycleh
T & operator*() const
Definition: netIO.h:44
Definition: cac.h:50
virtual void destroy(epicsGuard< epicsMutex > &, class cacRecycle &)=0
T * remove(const ID &idIn)
Definition: resourceLib.h:297
T * get() const
autoPtrRecycle(epicsGuard< epicsMutex > &, chronIntIdResTable< baseNMIU > &, cacRecycle &, T *)
T * operator->() const