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