src
bfl_constants.h
Go to the documentation of this file.
1
// $Id$
2
// Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com>
3
//
4
// This program is free software; you can redistribute it and/or modify
5
// it under the terms of the GNU Lesser General Public License as published by
6
// the Free Software Foundation; either version 2.1 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
//
18
#ifndef __BFL_CONSTANTS_H__
19
#define __BFL_CONSTANTS_H__
20
21
#define NUMERIC_PRECISION 0.000000001
22
23
#pragma warning( disable : 4996)
24
25
#ifndef M_PI
26
#define M_PI 3.141592653589793284626433832795
27
#endif
28
29
// Check if double is probability value (maybe this should be solved
30
// by a type probability_t or something. Needs thinking.
31
#include <iostream>
32
#include <cmath>
33
#include <cassert>
34
35
namespace
BFL
36
{
37
using namespace
std
;
39
class
Probability
40
{
41
public
:
42
Probability
(){};
43
Probability
(
double
p)
44
{
45
#ifndef _MSC_VER
46
assert(std::isfinite(p) != 0);
47
#endif
48
assert( p >= 0 );
49
_prob = p;
50
};
51
virtual
~Probability
(){};
52
/*
53
ostream & operator<< (ostream & stream)
54
{
55
stream << this->getValue() << endl;
56
return stream;
57
};
58
59
istream & operator>> (istream & stream)
60
{
61
double value;
62
stream >> value;
63
_prob = Probability(value);
64
return stream;
65
};
66
*/
67
friend
ostream &
operator<<
(ostream & stream,
Probability
& prob);
68
69
friend
istream &
operator>>
(istream & stream,
Probability
& prob);
70
71
double
getValue
()
const
{
return
_prob;} ;
72
double
&
getValue
() {
return
_prob;} ;
73
74
operator
double(){
return
_prob;};
75
Probability
operator *(
Probability
p)
76
{
return
((
Probability
) (this->_prob * (
double
) p));};
77
Probability
operator /(
Probability
p)
78
{
return
((
Probability
) (this->_prob / (
double
) p));};
79
80
81
private
:
82
double
_prob
;
83
};
84
85
}
// End namespace
86
101
#endif
102
103
BFL::Probability::getValue
double getValue() const
Definition:
bfl_constants.h:71
BFL::operator<<
ostream & operator<<(ostream &stream, Probability &prob)
Definition:
bfl_toolkit.cpp:62
std
BFL::Probability::Probability
Probability()
Definition:
bfl_constants.h:42
BFL::Probability::Probability
Probability(double p)
Definition:
bfl_constants.h:43
BFL
Definition:
compare_filters/nonlinearanalyticconditionalgaussianmobile.cpp:24
BFL::Probability::~Probability
virtual ~Probability()
Definition:
bfl_constants.h:51
BFL::operator>>
istream & operator>>(istream &stream, Probability &prob)
Definition:
bfl_toolkit.cpp:68
BFL::Probability
Class representing a probability (a double between 0 and 1)
Definition:
bfl_constants.h:39
BFL::Probability::getValue
double & getValue()
Definition:
bfl_constants.h:72
BFL::Probability::_prob
double _prob
Definition:
bfl_constants.h:78
bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Mon Feb 28 2022 21:56:33