VGM Version 5.3
Loading...
Searching...
No Matches
VVolume.cxx
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The BaseVGM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
12//
13// Class VVolume
14// ---------------
15// The abstract base class for volumes.
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
19#include "VGM/solids/ISolid.h"
21
23
24//_____________________________________________________________________________
25std::ostream& operator<<(std::ostream& out, const VGM::IVolume& volume)
26{
27 out << "Volume: "
28 << "\"" << volume.Name() << "\""
29 << " material "
30 << "\"" << volume.MaterialName() << "\""
31 << " solid "
32 << "\"" << VGM::SolidTypeName(volume.Solid()->Type()) << "\" "
33 << volume.NofDaughters() << " daughters: ";
34
35 for (int i = 0; i < volume.NofDaughters(); i++) {
36 out << "\"" << volume.Daughter(i)->Name() << "\" ";
37 }
38
39 return out;
40}
41
42//_____________________________________________________________________________
44 : VGM::IVolume(), fSolid(solid), fDaughters()
45{
47}
48
49//_____________________________________________________________________________
51{
53}
54
55//_____________________________________________________________________________
56BaseVGM::VVolume::VVolume(const VVolume& rhs) : VGM::IVolume(rhs)
57{
59}
60
61//_____________________________________________________________________________
63{
64 //
65
66 // Delete daughters
67 for (unsigned int i = 0; i < fDaughters.size(); i++) {
68 delete fDaughters[i];
69 }
70}
71
72//_____________________________________________________________________________
73VGM::ISolid* BaseVGM::VVolume::Solid() const { return fSolid; }
74
75//_____________________________________________________________________________
76int BaseVGM::VVolume::NofDaughters() const { return fDaughters.size(); }
77
78//_____________________________________________________________________________
80{
81 return fDaughters[i];
82}
83
84//_____________________________________________________________________________
86{
87 fDaughters.push_back(daughter);
88}
89
90//_____________________________________________________________________________
91void BaseVGM::VVolume::ResetSolid(VGM::ISolid* solid) { fSolid = solid; }
std::ostream & operator<<(std::ostream &out, const VGM::IVolume &volume)
Definition VVolume.cxx:25
The abstract base class for volumes.
Definition VVolume.h:36
virtual VGM::ISolid * Solid() const
Return the associated solid.
Definition VVolume.cxx:73
virtual void ResetSolid(VGM::ISolid *solid)
Definition VVolume.cxx:91
virtual void AddDaughter(VGM::IPlacement *daughter)
Add the specified daughter.
Definition VVolume.cxx:85
virtual VGM::IPlacement * Daughter(int i) const
Return the i-th daughter.
Definition VVolume.cxx:79
virtual ~VVolume()
Definition VVolume.cxx:62
virtual int NofDaughters() const
Return the number of volume daughters.
Definition VVolume.cxx:76
The VGM interface to positions of volumes.
Definition IPlacement.h:44
virtual std::string Name() const =0
Return the name of this placement.
The VGM interface to solids.
Definition ISolid.h:58
virtual SolidType Type() const =0
Return the type of this solid.
The VGM interface to volumes.
Definition IVolume.h:32
virtual ISolid * Solid() const =0
Return the associated solid.
virtual std::string MaterialName() const =0
Return the name of the associated material.
virtual std::string Name() const =0
Return the name of this volume.
virtual IPlacement * Daughter(int i) const =0
Return the i-th daughter.
virtual int NofDaughters() const =0
Return the number of volume daughters.
VGM interfaces.
Definition VMedium.h:28
std::string SolidTypeName(VGM::SolidType typeId)
Definition solid.cxx:27