Main Page
Namespaces
Classes
Files
Examples
File List
File Members
include
ar_track_alvar
Bitset.h
Go to the documentation of this file.
1
/*
2
* This file is part of ALVAR, A Library for Virtual and Augmented Reality.
3
*
4
* Copyright 2007-2012 VTT Technical Research Centre of Finland
5
*
6
* Contact: VTT Augmented Reality Team <alvar.info@vtt.fi>
7
* <http://www.vtt.fi/multimedia/alvar.html>
8
*
9
* ALVAR is free software; you can redistribute it and/or modify it under the
10
* terms of the GNU Lesser General Public License as published by the Free
11
* Software Foundation; either version 2.1 of the License, or (at your option)
12
* any later version.
13
*
14
* This library is distributed in the hope that it will be useful, but WITHOUT
15
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
17
* for more details.
18
*
19
* You should have received a copy of the GNU Lesser General Public License
20
* along with ALVAR; if not, see
21
* <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>.
22
*/
23
24
#ifndef BITSET_H
25
#define BITSET_H
26
33
#include "
Alvar.h
"
34
#include <iostream>
35
#include <deque>
36
#include <string>
37
#include <sstream>
38
#include <iomanip>
39
40
namespace
alvar
{
41
62
class
ALVAR_EXPORT
Bitset
{
63
protected
:
64
std::deque<bool>
bits
;
65
66
public
:
68
int
Length
();
72
std::ostream &
Output
(std::ostream &os)
const
;
74
void
clear();
78
void
push_back(
const
bool
bit);
83
void
push_back(
const
unsigned
char
b,
const
int
bit_count=8);
88
void
push_back(
const
unsigned
short
s,
const
int
bit_count=16);
93
void
push_back(
const
unsigned
long
l,
const
int
bit_count=32);
97
void
push_back_meaningful(
const
unsigned
long
l);
101
void
fill_zeros_left(
const
size_t
bit_count);
105
void
push_back(std::string s);
107
bool
pop_front();
109
bool
pop_back();
113
void
flip(
size_t
pos);
115
std::string hex();
117
unsigned
long
ulong();
119
unsigned
char
uchar();
121
inline
std::deque<bool>&
GetBits
()
122
{
123
return
bits;
124
}
125
};
126
135
class
ALVAR_EXPORT
BitsetExt
:
public
Bitset
{
136
protected
:
137
bool
verbose
;
138
void
hamming_enc_block(
unsigned
long
block_len, std::deque<bool>::iterator &iter);
139
int
hamming_dec_block(
unsigned
long
block_len, std::deque<bool>::iterator &iter);
140
public
:
142
BitsetExt
();
144
BitsetExt
(
bool
_verbose);
146
void
SetVerbose(
bool
_verbose);
148
static
int
count_hamming_enc_len(
int
block_len,
int
dec_len);
150
static
int
count_hamming_dec_len(
int
block_len,
int
enc_len);
152
void
hamming_enc(
int
block_len);
154
int
hamming_dec(
int
block_len);
155
};
156
157
}
// namespace alvar
158
159
#endif
alvar
Main ALVAR namespace.
Definition:
Alvar.h:174
Output
Output
alvar::BitsetExt::verbose
bool verbose
Definition:
Bitset.h:137
alvar::Bitset::bits
std::deque< bool > bits
Definition:
Bitset.h:64
alvar::Bitset
Bitset is a basic class for handling bit sequences
Definition:
Bitset.h:62
ALVAR_EXPORT
#define ALVAR_EXPORT
Definition:
Alvar.h:168
alvar::Bitset::GetBits
std::deque< bool > & GetBits()
The Bitset as 'deque<bool>'.
Definition:
Bitset.h:121
alvar::BitsetExt
An extended Bitset ( BitsetExt ) for handling e.g. Hamming encoding/decoding.
Definition:
Bitset.h:135
Length
Length
Alvar.h
This file defines library export definitions, version numbers and build information.
ar_track_alvar
Author(s): Scott Niekum
autogenerated on Mon Jun 10 2019 12:47:03