GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef GF2VEC_H
12 #define GF2VEC_H
13 
14 #include <cstdint>
15 #include <vector>
16 
17 class GF2Vec
18 {
19 private:
20  //! The vector vec
21  std::vector<uint8_t> vec;
22 
23  //! Resize the vector
24  void resize(int size);
25 
26 public:
27  //! Default constructor
28  GF2Vec() {}
29 
30  //! Constructs a vector of length "size" with all 0 entries
31  GF2Vec(int size);
32 
33  //! Returns the vector
34  std::vector<uint8_t> get_vec();
35 
36  //! Returns the size of the vector
37  int size();
38 
39  //! Resets the vector with the given input
40  void set_vec(const std::vector<uint8_t>);
41 
42  //! Access the ith element
43  uint8_t& operator[](int i);
44 
45  //! Overloading the operator '='
46  void operator=(GF2Vec x);
47 
48  //! Obtain a subvector between the indices i to j
49  GF2Vec sub_vector(int i, int j);
50 
51  //! Overloading the operator '+'
52  friend GF2Vec operator+(GF2Vec a, GF2Vec b);
53 
54  //! Overloading the operator '*'
55  friend uint8_t operator*(GF2Vec a, GF2Vec b);
56 
57  //! Prints the vector
58  void print_vec();
59 };
60 
61 #endif // #ifndef GF2VEC_H
Definition: gf2vec.h:18
int size()
Returns the size of the vector.
friend GF2Vec operator+(GF2Vec a, GF2Vec b)
Overloading the operator '+'.
GF2Vec sub_vector(int i, int j)
Obtain a subvector between the indices i to j.
GF2Vec(int size)
Constructs a vector of length "size" with all 0 entries.
friend uint8_t operator*(GF2Vec a, GF2Vec b)
Overloading the operator '*'.
std::vector< uint8_t > get_vec()
Returns the vector.
GF2Vec()
Default constructor.
Definition: gf2vec.h:28
void set_vec(const std::vector< uint8_t >)
Resets the vector with the given input.
void print_vec()
Prints the vector.
uint8_t & operator[](int i)
Access the ith element.
void operator=(GF2Vec x)
Overloading the operator '='.