GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
gf2vec.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef GF2VEC_H
24 #define GF2VEC_H
25 
26 #include <vector>
27 
28 class GF2Vec
29 {
30 private:
31  //! The vector vec
32  std::vector<char> vec;
33 
34  //! Resize the vector
35  void resize(int size);
36 
37 public:
38  //! Default constructor
39  GF2Vec() {}
40 
41  //! Constructs a vector of length "size" with all 0 entries
42  GF2Vec(int size);
43 
44  //! Returns the vector
45  std::vector<char> get_vec();
46 
47  //! Returns the size of the vector
48  int size();
49 
50  //! Resets the vector with the given input
51  void set_vec(const std::vector<char>);
52 
53  //! Access the ith element
54  char & operator [](int i);
55 
56  //! Overloading the operator '='
57  void operator=(GF2Vec x);
58 
59  //! Obtain a subvector between the indices i to j
60  GF2Vec sub_vector(int i, int j);
61 
62  //! Overloading the operator '+'
63  friend GF2Vec operator+(GF2Vec a, GF2Vec b);
64 
65  //! Overloading the operator '*'
66  friend char operator*(GF2Vec a, GF2Vec b);
67 
68  //! Prints the vector
69  void print_vec();
70 };
71 
72 #endif // #ifndef GF2VEC_H
GF2Vec sub_vector(int i, int j)
Obtain a subvector between the indices i to j.
int size()
Returns the size of the vector.
char & operator[](int i)
Access the ith element.
std::vector< char > get_vec()
Returns the vector.
void operator=(GF2Vec x)
Overloading the operator '='.
void print_vec()
Prints the vector.
friend GF2Vec operator+(GF2Vec a, GF2Vec b)
Overloading the operator '+'.
friend char operator*(GF2Vec a, GF2Vec b)
Overloading the operator '*'.
void set_vec(const std::vector< char >)
Resets the vector with the given input.
Definition: gf2vec.h:28
GF2Vec()
Default constructor.
Definition: gf2vec.h:39