conversions.h
Go to the documentation of this file.
1 /************************************************************************
2  * Copyright (C) 2012 Eindhoven University of Technology (TU/e). *
3  * All rights reserved. *
4  ************************************************************************
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions *
7  * are met: *
8  * *
9  * 1. Redistributions of source code must retain the above *
10  * copyright notice, this list of conditions and the following *
11  * disclaimer. *
12  * *
13  * 2. Redistributions in binary form must reproduce the above *
14  * copyright notice, this list of conditions and the following *
15  * disclaimer in the documentation and/or other materials *
16  * provided with the distribution. *
17  * *
18  * THIS SOFTWARE IS PROVIDED BY TU/e "AS IS" AND ANY EXPRESS OR *
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
21  * ARE DISCLAIMED. IN NO EVENT SHALL TU/e OR CONTRIBUTORS BE LIABLE *
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
24  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
28  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
29  * DAMAGE. *
30  * *
31  * The views and conclusions contained in the software and *
32  * documentation are those of the authors and should not be *
33  * interpreted as representing official policies, either expressed or *
34  * implied, of TU/e. *
35  ************************************************************************/
36 
37 #ifndef PROBLIB_CONVERSIONS_H_
38 #define PROBLIB_CONVERSIONS_H_
39 
40 #include "problib/PDF.h"
41 
42 #include "problib/pdfs/Gaussian.h"
43 #include "problib/pdfs/Mixture.h"
44 #include "problib/pdfs/Hybrid.h"
45 #include "problib/pdfs/PMF.h"
46 
47 #include "problib/datatypes.h"
48 
49 namespace pbl {
50 
51 /* * * * * * * CONVERSION * * * * * * */
52 
58 void PDFtoMsg(const PDF& pdf, problib::PDF& msg);
59 
65 problib::PDF PDFtoMsg(const PDF& pdf);
66 
72 PDF* msgToPDF(const problib::PDF& msg);
73 
80 Gaussian* msgToGaussian(const problib::PDF& msg);
81 
88 Mixture* msgToMixture(const problib::PDF& msg);
89 
96 PMF* msgToPMF(const problib::PDF& msg);
97 
103 const Gaussian* PDFtoGaussian(const PDF& pdf);
104 
110 const Mixture* PDFtoMixture(const PDF& pdf);
111 
117 const Uniform* PDFtoUniform(const PDF& pdf);
118 
119 
125 const PMF* PDFtoPMF(const PDF& pdf);
126 
127 /* * * * * * * OTHER * * * * * * */
128 
129 std::string typeToName(PDF::PDFType type);
130 
131 /* * * * * * * SERIALIZATION AND DESERIALIZATION * * * * * * */
132 
133 void serialize(const PDF& gauss, problib::PDF& msg);
134 
135 PDF* deserialize(const problib::PDF& msg, int type, int& i_data);
136 
137 void serialize_gaussian(const Gaussian& gauss, problib::PDF& msg);
138 
139 Gaussian* deserialize_gaussian(const problib::PDF& msg, int& i_data);
140 
141 void serialize_mixture(const Mixture& mix, problib::PDF& msg);
142 
143 Mixture* deserialize_mixture(const problib::PDF& msg, int& i_data);
144 
145 void serialize_uniform(const Uniform& uniform, problib::PDF& msg);
146 
147 Uniform* deserialize_uniform(const problib::PDF& msg, int& i_data);
148 
149 void serialize_hybrid(const Hybrid& hybrid, problib::PDF& msg);
150 
151 Hybrid *deserialize_hybrid(const problib::PDF& msg, int& i_data);
152 
153 void serialize_discrete(const PMF& pmf, problib::PDF& msg);
154 
155 PMF* deserialize_discrete(const problib::PDF& msg);
156 
157 PDF* deserialize_exact(const problib::PDF& msg);
158 
159 }
160 
161 #endif /* CONVERSIONS_H_ */
PDF * msgToPDF(const problib::PDF &msg)
Converts a PDF ROS message to a PDF object.
Definition: conversions.cpp:58
Gaussian * msgToGaussian(const problib::PDF &msg)
Converts a PDF ROS message to a Gaussian object if the message represents a Gaussian.
Definition: conversions.cpp:63
This class represents the weighted sum of a finite set of probability density functions.
Definition: Mixture.h:54
void serialize_hybrid(const Hybrid &hybrid, problib::PDF &msg)
Gaussian * deserialize_gaussian(const problib::PDF &msg, int &i_data)
This class represents a multi-variate Gaussian (Normal) distribution.
Definition: Gaussian.h:51
const PMF * PDFtoPMF(const PDF &pdf)
Casts a PDF object to a PMF if the PDF represents a PMF.
std::string typeToName(PDF::PDFType type)
const Uniform * PDFtoUniform(const PDF &pdf)
Casts a PDF object to a Uniform distribution if the PDF represents a Uniform distribution.
PMF * deserialize_discrete(const problib::PDF &msg)
void serialize_mixture(const Mixture &mix, problib::PDF &msg)
void serialize(const PDF &gauss, problib::PDF &msg)
void serialize_discrete(const PMF &pmf, problib::PDF &msg)
void serialize_uniform(const Uniform &uniform, problib::PDF &msg)
Hybrid * deserialize_hybrid(const problib::PDF &msg, int &i_data)
void serialize_gaussian(const Gaussian &gauss, problib::PDF &msg)
This class represents a hyper-cube shaped uniform distribution.
Definition: Uniform.h:51
Definition: PDF.h:47
PMF * msgToPMF(const problib::PDF &msg)
Converts a PDF ROS message to a PMF object if the message represents a PMF.
Definition: conversions.cpp:79
Uniform * deserialize_uniform(const problib::PDF &msg, int &i_data)
PDF * deserialize_exact(const problib::PDF &msg)
Mixture * msgToMixture(const problib::PDF &msg)
Converts a PDF ROS message to a Mixture object if the message represents a Mixture.
Definition: conversions.cpp:71
const Mixture * PDFtoMixture(const PDF &pdf)
Casts a PDF object to a Mixture if the PDF represents a Mixture.
Definition: conversions.cpp:86
Mixture * deserialize_mixture(const problib::PDF &msg, int &i_data)
PDF * deserialize(const problib::PDF &msg, int type, int &i_data)
This class represents a discrete probability distribution (or probability mass function). Currently, this PMF can only take strings as values.
Definition: PMF.h:52
PDFType
Definition: PDF.h:51
const Gaussian * PDFtoGaussian(const PDF &pdf)
Casts a PDF object to a Gaussian if the PDF represents a Gaussian.
Definition: conversions.cpp:93
void PDFtoMsg(const PDF &pdf, problib::PDF &msg)
Converts a PDF object to a ROS message.
Definition: conversions.cpp:41


problib
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:19