18 template <
typename TmplParticleCollection>
19 Packer<TmplParticleCollection>::Packer(NTablePtr nTablePtr)
20 : m_nTablePtr(nTablePtr),
21 m_particlePoolPtr(new ParticlePool),
22 m_particleCollectionPtr(
23 new ParticleCollection(m_particlePoolPtr)
29 template <
typename TmplParticleCollection>
30 Packer<TmplParticleCollection>::Packer(
31 ParticlePoolPtr particlePoolPtr,
34 : m_nTablePtr(nTablePtr),
35 m_particlePoolPtr(particlePoolPtr),
36 m_particleCollectionPtr(
37 new ParticleCollection(m_particlePoolPtr)
43 template <
typename TmplParticleCollection>
44 Packer<TmplParticleCollection>::~Packer()
48 template <
typename TmplParticleCollection>
49 void Packer<TmplParticleCollection>::setNTablePtr(NTablePtr nTablePtr)
51 m_nTablePtr = nTablePtr;
54 template <
typename TmplParticleCollection>
55 typename Packer<TmplParticleCollection>::NTable &Packer<TmplParticleCollection>::getNTable()
57 return *(m_nTablePtr);
60 template <
typename TmplParticleCollection>
61 const typename Packer<TmplParticleCollection>::NTable &
62 Packer<TmplParticleCollection>::getNTable()
const
67 template <
typename TmplParticleCollection>
68 typename Packer<TmplParticleCollection>::ParticlePool &
69 Packer<TmplParticleCollection>::getParticlePool()
71 return *m_particlePoolPtr;
74 template <
typename TmplParticleCollection>
75 typename Packer<TmplParticleCollection>::ParticlePoolPtr
76 Packer<TmplParticleCollection>::getParticlePoolPtr()
78 return m_particlePoolPtr;
81 template <
typename TmplParticleCollection>
82 const typename Packer<TmplParticleCollection>::ParticlePool &
83 Packer<TmplParticleCollection>::getParticlePool()
const
85 return *m_particlePoolPtr;
88 template <
typename TmplParticleCollection>
89 typename Packer<TmplParticleCollection>::ParticleCollection &
90 Packer<TmplParticleCollection>::getParticleCollection()
92 return *m_particleCollectionPtr;
95 template <
typename TmplParticleCollection>
96 const typename Packer<TmplParticleCollection>::ParticleCollection &
97 Packer<TmplParticleCollection>::getParticleCollection()
const
99 return *m_particleCollectionPtr;
102 template <
typename TmplParticleCollection>
103 typename Packer<TmplParticleCollection>::Particle &
104 Packer<TmplParticleCollection>::constructParticle(
const Particle &particle)
106 return getParticleCollection().createParticle(particle);
109 template <
typename TmplParticleCollection>
110 typename Packer<TmplParticleCollection>::ParticleIterator
111 Packer<TmplParticleCollection>::getParticleIterator()
113 return getParticleCollection().getParticleIterator();
116 template <
typename TmplParticleCollection>
117 typename Packer<TmplParticleCollection>::ParticleConstIterator
118 Packer<TmplParticleCollection>::getParticleIterator()
const
120 return getParticleCollection().getParticleIterator();
123 template <
typename TmplParticleCollection>
125 Packer<TmplParticleCollection>::getNumParticles()
const
127 return getParticleCollection().getNumParticles();
130 template <
typename TmplParticleCollection>
131 int Packer<TmplParticleCollection>::getNextParticleId()
133 return static_cast<int>(getNTable().getNumParticles());
137 template <
typename TmplParticleCollection>
138 typename Packer<TmplParticleCollection>::Particle &
139 Packer<TmplParticleCollection>::createAndInsertParticle(
140 const Particle &particle
143 Particle *pParticle = &(constructParticle(particle));
144 pParticle->setId(getNextParticleId());
145 m_idSet.insert(pParticle->getId());
146 getNTable().insert(pParticle);
150 template <
typename TmplParticleCollection>
151 bool Packer<TmplParticleCollection>::contains(
const Particle &particle)
const
153 return (m_idSet.find(particle.getID()) != m_idSet.end());