This is Unofficial EPICS BASE Doxygen Site
bhe.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 is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 
10 /*
11  *
12  * L O S A L A M O S
13  * Los Alamos National Laboratory
14  * Los Alamos, New Mexico 87545
15  *
16  * Copyright, 1986, The Regents of the University of California.
17  *
18  * Author: Jeff Hill
19  */
20 
21 #ifndef INC_bhe_H
22 #define INC_bhe_H
23 
24 #include "tsDLList.h"
25 #include "tsFreeList.h"
26 #include "epicsTime.h"
27 #include "compilerDependencies.h"
28 
29 #include "libCaAPI.h"
30 #include "inetAddrID.h"
31 #include "caProto.h"
32 
33 class tcpiiu;
34 class bheMemoryManager;
35 
36 // using a pure abstract wrapper class around the free list avoids
37 // Tornado 2.0.1 GNU compiler bugs
38 class LIBCA_API bheMemoryManager {
39 public:
40  virtual ~bheMemoryManager ();
41  virtual void * allocate ( size_t ) = 0;
42  virtual void release ( void * ) = 0;
43 };
44 
45 class bhe : public tsSLNode < bhe >, public inetAddrID {
46 public:
47  LIBCA_API bhe (
48  epicsMutex &, const epicsTime & initialTimeStamp,
49  unsigned initialBeaconNumber, const inetAddrID & addr );
50  LIBCA_API ~bhe ();
51  LIBCA_API bool updatePeriod (
53  const epicsTime & programBeginTime,
54  const epicsTime & currentTime, ca_uint32_t beaconNumber,
55  unsigned protocolRevision );
56  LIBCA_API double period ( epicsGuard < epicsMutex > & ) const;
57  LIBCA_API epicsTime updateTime ( epicsGuard < epicsMutex > & ) const;
58  LIBCA_API void show ( unsigned level ) const;
59  LIBCA_API void show ( epicsGuard < epicsMutex > &, unsigned /* level */ ) const;
60  LIBCA_API void registerIIU ( epicsGuard < epicsMutex > &, tcpiiu & );
61  LIBCA_API void unregisterIIU ( epicsGuard < epicsMutex > &, tcpiiu & );
62  LIBCA_API void * operator new ( size_t size, bheMemoryManager & );
63 #ifdef CXX_PLACEMENT_DELETE
64  LIBCA_API void operator delete ( void *, bheMemoryManager & );
65 #endif
66 private:
67  epicsTime timeStamp;
68  double averagePeriod;
69  epicsMutex & mutex;
70  tcpiiu * pIIU;
71  ca_uint32_t lastBeaconNumber;
72  void beaconAnomalyNotify ( epicsGuard < epicsMutex > & );
73  void logBeacon ( const char * pDiagnostic,
74  const double & currentPeriod,
75  const epicsTime & currentTime );
76  void logBeaconDiscard ( unsigned beaconAdvance,
77  const epicsTime & currentTime );
78  bhe ( const bhe & );
79  bhe & operator = ( const bhe & );
80  LIBCA_API void operator delete ( void * );
81 };
82 
83 // using a wrapper class around the free list avoids
84 // Tornado 2.0.1 GNU compiler bugs
86 public:
88  void * allocate ( size_t );
89  void release ( void * );
90 private:
92  bheFreeStore ( const bheFreeStore & );
93  bheFreeStore & operator = ( const bheFreeStore & );
94 };
95 
96 inline void * bhe::operator new ( size_t size,
97  bheMemoryManager & mgr )
98 {
99  return mgr.allocate ( size );
100 }
101 
102 #ifdef CXX_PLACEMENT_DELETE
103 inline void bhe::operator delete ( void * pCadaver,
104  bheMemoryManager & mgr )
105 {
106  mgr.release ( pCadaver );
107 }
108 #endif
109 
110 #endif // ifndef INC_bhe_H
111 
112 
unsigned int ca_uint32_t
Definition: caProto.h:76
bheFreeStore()
Definition: bhe.h:87
epicsMutex mutex
Definition: pvAccess.cpp:71
char * allocate(unsigned int n)
Definition: antelope.c:230
Definition: bhe.h:45
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
Compiler specific declarations.