Home | Develop | Download | Contact
Buffer.hpp
1 /*
2  * Buffer.hpp
3  *
4  * Copyright 2018 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
32 #ifndef __PDS_BUFFER_HPP__
33 #define __PDS_BUFFER_HPP__
34 
35 #include <string>
36 
46 namespace Pds{
47 
55 template<typename Datum>
56 class Buffer
57 {
58 
59 private:
61  unsigned int nel;
62 
64  Datum *data;
65 
67  unsigned int front;
68 
69 
70 public:
71 
82  Buffer(void);
83 
90  Buffer(unsigned int Nel);
91 
99 
105 public:
119  Datum &operator[](const unsigned int &id)
120  {
121  return this->data[(this->front+id)%this->nel];
122  }
123 
124 
133  bool Push(const Datum &Dat);
138 public:
149  void Print(const std::string &str="") const;
150 
156  bool IsEmpty(void) const;
160 }; // Class Buffer
161 
162 } // namespace Pds
163 
164 
169 #endif
170 
La clase tipo Pds::Buffer . Esta clase genera un objeto con dos parametros Nlin y Ncol....
Definition: Buffer.hpp:57
Datum * data
Definition: Buffer.hpp:64
unsigned int front
Definition: Buffer.hpp:67
unsigned int nel
Definition: Buffer.hpp:61
Buffer(void)
Crea un objeto vacio de tipo Pds::Buffer.
bool IsEmpty(void) const
Retorna true si el objeto esta vacio y false si no.
Buffer(unsigned int Nel)
Crea un objeto de tipo Pds::Buffer.
void Print(const std::string &str="") const
Muestra en pantalla el contenido de Pds::Buffer, elementos separados por tabulador.
Datum & operator[](const unsigned int &id)
Lee y escribe datos en la memoria en el Pds::Buffer.
Definition: Buffer.hpp:119
Buffer(const Pds::Buffer< Datum > &B)
Crea un objeto de tipo Pds::Buffer de otro.
bool Push(const Datum &Dat)
Empuja un nuevo dato en la memoria del Pds::Buffer.
Nombre de espacion para PDS (Procesamiento Digital de Senales)

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed