source: XMLIO_V2/dev/common/src/xmlio/circular_buffer.hpp @ 219

Last change on this file since 219 was 219, checked in by hozdoba, 13 years ago

Préparation nouvelle arborescence

File size: 2.1 KB
Line 
1#ifndef __XMLIO_CCircularBuffer__
2#define __XMLIO_CCircularBuffer__
3
4/// xmlioserver headers ///
5#include "xmlioserver_spl.hpp"
6#include "linear_buffer.hpp"
7
8namespace xmlioserver
9{
10   namespace comm
11   {
12      /// ////////////////////// Déclarations ////////////////////// ///
13      class CCircularBuffer
14         : public CBuffer
15      {
16
17            /// Définition de type ///
18            typedef CBuffer SuperClass;
19
20         public :
21
22            /// Construteurs ///
23            explicit CCircularBuffer(StdSize size = BUFFER_SERVER_SIZE);
24            CCircularBuffer(const CCircularBuffer & cbuffer);
25            CCircularBuffer(const CCircularBuffer * const cbuffer);
26
27            /// Mutateurs ///
28            virtual void clear(void);
29
30            char * prepareNextData(StdSize data_size);
31            StdSize prepareNextDataPosition(StdSize data_size);
32
33            void appendRequest(const CLinearBuffer & brequest);
34
35            void updateNbRequests(StdSize data_begin, StdSize data_end);
36
37            /// Test ///
38            bool hasRequest(void) const ;
39            bool isAvailable(StdSize data_size) const;
40
41            /// Accesseurs ///
42            CLinearBuffer getNextRequest(void);
43            StdSize getNumberOfRequest(void) const;
44
45            StdSize getReadPosition(void) const;
46            StdSize getWritePosition(void) const;
47            StdSize getUnusedPosition(void) const;
48
49            /// Sortie fichier ascii ///
50            virtual void printToTextFile (const StdString & filename);
51            virtual void printToTextStream (StdOStream & ostr);
52
53            /// Destructeur ///
54            virtual ~CCircularBuffer(void);
55
56         private :
57
58            /// Mutateurs privés ///
59            void movePWrite(StdSize data_size);
60            void movePRead(StdSize data_size);
61
62            /// Accesseurs privés ///
63            StdSize getNextRequestSize(void) const;
64
65            /// Propriétés privées ///
66            StdSize p_write, p_read, p_unused, nbrequest;
67
68      }; // class CCircularBuffer
69   } // namespace comm
70} // namespace xmlioserver
71
72#endif // __XMLIO_CCircularBuffer__
Note: See TracBrowser for help on using the repository browser.