Practice Project
 All Classes Functions Pages
Particle.cc
1 #include <Particle.h>
2 #include <iostream>
3 
4 using namespace std;
5 
6 unsigned Particle::getNDaughters() const
7 {
8  unsigned counter = m_directDaughters.size();
9  for (auto & daughterPtr : m_directDaughters) {
10  counter += daughterPtr->getNDaughters();
11  }
12  return counter;
13 }
14 
15 void Particle::addDaughter(const Particle& particle)
16 {
17  cout << "Adding particle " << particle.getName()
18  << " to the particle " << m_name << endl;
19  m_directDaughters.push_back(&particle);
20 }
21 
22 std::string Particle::getName() const
23 {
24  return m_name;
25 }
std::string getName() const
Getter for the name of the particle.
Definition: Particle.cc:22
unsigned getNDaughters() const
Getter for Numer of Daughter Particles.
Definition: Particle.cc:6
void addDaughter(const Particle &particle)
Adding a daughter Particle to this Particle.
Definition: Particle.cc:15
This is a base class for particles in out Project.
Definition: Particle.h:9