summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/data/data_buffer.hh
diff options
context:
space:
mode:
authordufourj2005-05-01 15:37:34 +0000
committerdufourj2005-05-01 15:37:34 +0000
commitaecaf24c22013482de84ac6567249bec5ae7c78e (patch)
tree1aeb3d2ced48f6cdda6d39665fdb4062d83189da /2005/i/robert/src/data/data_buffer.hh
parent714e86c96ff93fb78d4340cb607c12927091417b (diff)
DataBuffer :
Rajout du type de données Socket : Non-bloquant
Diffstat (limited to '2005/i/robert/src/data/data_buffer.hh')
-rw-r--r--2005/i/robert/src/data/data_buffer.hh25
1 files changed, 19 insertions, 6 deletions
diff --git a/2005/i/robert/src/data/data_buffer.hh b/2005/i/robert/src/data/data_buffer.hh
index 11724d8..5e6b55d 100644
--- a/2005/i/robert/src/data/data_buffer.hh
+++ b/2005/i/robert/src/data/data_buffer.hh
@@ -33,19 +33,33 @@
/// écriture.
class DataBuffer : public DataInput, public DataOutput
{
+ public:
+ /// Type de données possible du buffer.
+ enum dataType_e {
+ NoType,
+ Image
+ };
+ private:
/// Buffer de données.
uint8_t *buffer_;
/// Taille alloué en mémoire pour le buffer.
unsigned size_;
/// Position du début et de la fin des données dans le buffer.
unsigned headPos_, tailPos_;
+ /// Type de données du buffer.
+ dataType_e type_;
+ /// Augmente la taille du buffer pour correspondre à size.
+ void grow (const unsigned size);
+ /// Echange les buffers.
+ void swap (DataBuffer &d);
public:
/// Constructeur par défaut.
DataBuffer (void);
/// Constructeur par recopie.
DataBuffer (const DataBuffer &d);
/// Constructeur avec données.
- DataBuffer (uint8_t *data, unsigned size, unsigned sizeAllocated);
+ DataBuffer (uint8_t *data, unsigned size, unsigned sizeAllocated,
+ dataType_e type = NoType);
/// Destructeur par défaut.
~DataBuffer (void) { delete [] buffer_; }
/// Surcharge de l'opérateur d'affectation
@@ -58,10 +72,9 @@ class DataBuffer : public DataInput, public DataOutput
void write (const uint8_t *buf, unsigned size);
/// Taille utile du buffer.
unsigned size (void) const { return tailPos_ - headPos_; }
- private:
- /// Augmente la taille du buffer pour correspondre à size.
- void grow (const unsigned size);
- /// Echange les buffers.
- void swap (DataBuffer &d);
+ /// Type de données du buffer.
+ dataType_e type (void) const { return type_; }
+ /// Change le type de données du buffer.
+ void setType (const dataType_e type) { type_ = type; }
};
#endif // data_buffer_hh