Hybrid.h
Go to the documentation of this file.
1 /*
2  * Hybrid.h
3  *
4  * Created on: Sep 20, 2011
5  * Author: sdries
6  */
7 
8 #ifndef PROBLIB_HYBRIDPDF_H_
9 #define PROBLIB_HYBRIDPDF_H_
10 
11 #include "PDF.h"
12 
13 namespace pbl {
14 
15 class Hybrid: public PDF {
16 
17 public:
18 
19  Hybrid();
20 
21  Hybrid(const Hybrid& orig);
22 
23  virtual ~Hybrid();
24 
25  Hybrid& operator=(const Hybrid& other);
26 
27  Hybrid* clone() const;
28 
29  virtual double getLikelihood(const PDF& pdf) const;
30 
31  void clear();
32 
33  double getMaxDensity() const;
34 
35  void addPDF(const PDF& pdf, double priority);
36 
37  const std::vector<PDF*>& getPDFS() const;
38 
39  std::string toString(const std::string& indent = "") const;
40 
41 protected:
42 
43  struct HybridStruct {
44 
45  std::vector<PDF*> pdfs_;
46 
47  int n_ptrs_;
48 
49  HybridStruct() : n_ptrs_(1) { }
50 
51  HybridStruct(const HybridStruct& orig) : n_ptrs_(1) {
52 
53  for (std::vector<PDF*>::const_iterator it_pdf = orig.pdfs_.begin(); it_pdf != orig.pdfs_.end(); ++it_pdf) {
54  pdfs_.push_back((*it_pdf)->clone());
55  }
56  }
57 
59  for (std::vector<PDF*>::const_iterator it_pdf = pdfs_.begin(); it_pdf != pdfs_.end(); ++it_pdf) {
60  delete *it_pdf;
61  }
62  }
63  };
64 
66 
67  void cloneStruct();
68 
69 };
70 
71 }
72 
73 #endif /* HYBRIDPDF_H_ */
void cloneStruct()
Definition: Hybrid.cpp:80
Hybrid * clone() const
Definition: Hybrid.cpp:76
virtual ~Hybrid()
Definition: Hybrid.cpp:50
void addPDF(const PDF &pdf, double priority)
Definition: Hybrid.cpp:106
double getMaxDensity() const
Definition: Hybrid.cpp:101
const_iterator(const field< oT > &in_M, const bool at_end=false)
HybridStruct(const HybridStruct &orig)
Definition: Hybrid.h:51
const std::vector< PDF * > & getPDFS() const
Definition: Hybrid.cpp:122
Hybrid & operator=(const Hybrid &other)
Definition: Hybrid.cpp:60
virtual double getLikelihood(const PDF &pdf) const
Definition: Hybrid.cpp:87
Definition: PDF.h:47
void clear()
Definition: Hybrid.cpp:91
HybridStruct * ptr_
Definition: Hybrid.h:65
std::vector< PDF * > pdfs_
Definition: Hybrid.h:45
std::string toString(const std::string &indent="") const
Definition: Hybrid.cpp:127


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