Helios++
Helios software for LiDAR simulations
RandomNoiseSource.h
1 #pragma once
2 
3 #include <string>
4 #include <RandomnessGenerator.h>
5 #include <noise/NoiseSource.h>
6 
15 template <typename RealType>
16 class RandomNoiseSource: public NoiseSource<RealType>{
17 public:
18 protected:
19  // *** ATTRIBUTES *** //
20  // ******************** //
25 
26 public:
27  // *** CONSTRUCTION *** //
28  // ********************** //
34  rg(rg)
35  {}
41  explicit RandomNoiseSource(std::string const & seed):
42  rg(RandomnessGenerator<RealType>(seed))
43  {}
47  explicit RandomNoiseSource():
48  rg(RandomnessGenerator<RealType>())
49  {}
50 
51  // *** NOISE CONFIGURATION FUNCTIONS *** //
52  // *************************************** //
57  virtual std::string getRandomNoiseType() = 0;
58 
59  // *** STREAM OPERATORS *** //
60  // ************************** //
64  template<typename _RealType>
65  friend std::ostream& operator << (
66  std::ostream &out,
68  );
69 };
70 
71 // *** STREAM OPERATORS *** //
72 // ************************** //
73 template<typename RealType>
74 std::ostream& operator << (std::ostream &out, RandomNoiseSource<RealType> &ns){
75  out << static_cast<NoiseSource<RealType>&>(ns);
76  out << "\tRandomNoiseSource:\n"
77  << "\t\trandomNoiseType = " << ns.getRandomNoiseType() << "\n";
78  return out;
79 }
80 
Class to handle a noise source.
Definition: NoiseSource.h:17
Abstract class for random noise handling.
Definition: RandomNoiseSource.h:16
RandomnessGenerator< RealType > rg
RandomnessGenerator to be used to generate random noise.
Definition: RandomNoiseSource.h:24
virtual std::string getRandomNoiseType()=0
Obtain the random noise type.
RandomNoiseSource(RandomnessGenerator< RealType > const &rg)
Create a RandomNoiseSource using received RandomnessGenerator.
Definition: RandomNoiseSource.h:33
RandomNoiseSource(std::string const &seed)
Create a RandomNoiseSource using received seed.
Definition: RandomNoiseSource.h:41
RandomNoiseSource()
Create a RandomNoiseSource using default RandomnessGenerator.
Definition: RandomNoiseSource.h:47
friend std::ostream & operator<<(std::ostream &out, RandomNoiseSource< _RealType > &ns)
Output stream behavior.
Class to generate random numbers.
Definition: RandomnessGenerator.h:34