Tezzeret  1
Tezzeret
GmManagedRingBuffer.hpp
1 /*
2  * GmRingBuffer.hpp
3  *
4  * Created on: Jul 23, 2016
5  * Author: rcram
6  */
7 
8 #ifndef GMMANAGEDRINGBUFFER_HPP_
9 #define GMMANAGEDRINGBUFFER_HPP_
10 
11 #ifdef acs
12 #include <ti/sysbios/knl/Semaphore.h>
13 #endif
14 
15 #include "GmRingBuffer.hpp"
16 #ifdef linux
17 #include <pthread.h>
18 #endif
19 
20 namespace Geometrics
21 {
22 
23  // This is just a buffer with some synchronization.
25  {
26  public:
27  // Statically defined buffer...
28  CManagedRingBuffer (Semaphore_Handle hasItemsSemaphore,
29  int iMaxItems,
30  int iItemSize,
31  Bool bOkToOverrun,
32  Bool bNotices,
33  UInt8 *puiBuffer,
34  UInt32 uiBufferSize);
35 
36  // Buffer will be allocated on heap.
37  CManagedRingBuffer (Semaphore_Handle hasItemsSemaphore,
38  int iMaxItems,
39  int iItemSize,
40  Bool bOkToOverrun,
41  Bool bNotices);
43  int WriteRecord (UInt8 *pcSource,
44  int iSize);
45  int ReadRecord (UInt8 *pcDestination,
46  int iSize);
47 
48  #ifdef linux
49  private:
50  pthread_mutex_t m_mutex;
51  #endif
52 
53  private:
54  Semaphore_Handle mHasItemsSemaphore;
55  };
56 
57 }
58 #endif /* GMRINGBUFFER_HPP_ */
Definition: GmManagedRingBuffer.hpp:25
Definition: GmRingBuffer.hpp:33
GmApp/GmLoggingApp.hpp>
Definition: Analogs.hpp:47