Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef __CONDITIONAL_PDF__
00031 #define __CONDITIONAL_PDF__
00032
00033 #include "pdf.h"
00034 #include <vector>
00035 #include <cassert>
00036 namespace BFL
00037 {
00038
00040
00049 template <typename Var, typename CondArg> class ConditionalPdf : public Pdf<Var>
00050 {
00051 public:
00053
00058 ConditionalPdf(int dimension=0, unsigned int num_conditional_arguments=0);
00059
00060
00061
00063 virtual ~ConditionalPdf();
00064
00066 virtual ConditionalPdf<Var,CondArg>* Clone() const;
00067
00069
00071 unsigned int NumConditionalArgumentsGet() const;
00072
00074
00079 virtual void NumConditionalArgumentsSet(unsigned int numconditionalarguments);
00080
00082
00085 const std::vector<CondArg>& ConditionalArgumentsGet() const;
00086
00088
00091 virtual void ConditionalArgumentsSet(std::vector<CondArg> ConditionalArguments);
00092
00094
00097 const CondArg& ConditionalArgumentGet(unsigned int n_argument) const;
00098
00100
00104 virtual void ConditionalArgumentSet(unsigned int n_argument, const CondArg& argument);
00105
00106 private:
00108 unsigned int _NumConditionalArguments;
00110 std::vector<CondArg> _ConditionalArguments;
00111 };
00112
00113
00114
00115 template<typename Var, typename CondArg>
00116 ConditionalPdf<Var,CondArg>::ConditionalPdf(int dim, unsigned int num_args)
00117 : Pdf<Var>(dim)
00118 , _NumConditionalArguments(num_args)
00119 , _ConditionalArguments(num_args)
00120 {}
00121
00122
00123 template<typename Var, typename CondArg>
00124 ConditionalPdf<Var,CondArg>::~ConditionalPdf()
00125 {}
00126
00127
00128 template<typename Var, typename CondArg>
00129 ConditionalPdf<Var,CondArg>* ConditionalPdf<Var,CondArg>::Clone() const
00130 {
00131 return new ConditionalPdf(*this);
00132 }
00133
00134 template<typename Var, typename CondArg> inline unsigned int
00135 ConditionalPdf<Var,CondArg>::NumConditionalArgumentsGet() const
00136 {
00137 return _NumConditionalArguments;
00138 }
00139
00140 template<typename Var, typename CondArg> inline void
00141 ConditionalPdf<Var,CondArg>::NumConditionalArgumentsSet(unsigned int numconditionalarguments)
00142 {
00143 if (numconditionalarguments != _NumConditionalArguments)
00144 {
00145 _NumConditionalArguments = numconditionalarguments;
00146 this->_ConditionalArguments.resize(_NumConditionalArguments);
00147 }
00148 }
00149
00150
00151 template<typename Var, typename CondArg> const std::vector<CondArg>&
00152 ConditionalPdf<Var,CondArg>::ConditionalArgumentsGet() const
00153 {
00154 return _ConditionalArguments;
00155 }
00156
00157 template<typename Var, typename CondArg> void
00158 ConditionalPdf<Var,CondArg>::ConditionalArgumentsSet(std::vector<CondArg> condargs)
00159 {
00160 assert (condargs.size() == _NumConditionalArguments);
00161 this->_ConditionalArguments = condargs;
00162 }
00163
00164 template<typename Var, typename CondArg> const CondArg&
00165 ConditionalPdf<Var,CondArg>::ConditionalArgumentGet(unsigned int n_argument) const
00166 {
00167 assert( n_argument < _NumConditionalArguments );
00168
00169 return _ConditionalArguments[n_argument];
00170 }
00171
00172 template<typename Var, typename CondArg> void
00173 ConditionalPdf<Var,CondArg>::ConditionalArgumentSet(unsigned int n_argument,
00174 const CondArg& argument)
00175 {
00176 assert ( n_argument < _NumConditionalArguments );
00177
00178 this->_ConditionalArguments[n_argument]= argument;
00179 }
00180
00181 }
00182 #endif // __CONDITIONAL_PDF__
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 Thu Feb 11 2016 22:31:56