GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
genie::GHepVirtualListFolder Class Reference

A singleton class to manage all named GHepVirtualLists. More...

#include <GHepVirtualListFolder.h>

Collaboration diagram for genie::GHepVirtualListFolder:
Collaboration graph
[legend]

Classes

struct  Cleaner
 

Public Member Functions

void AddToVirtualList (string listname, GHepParticle *p)
 
bool VirtualListExists (string listname)
 
void RemoveList (string listname)
 
void Clear (void)
 
GHepVirtualListVirtualList (string listname)
 

Static Public Member Functions

static GHepVirtualListFolderInstance (void)
 

Private Member Functions

 GHepVirtualListFolder ()
 
 GHepVirtualListFolder (const GHepVirtualListFolder &config_pool)
 
virtual ~GHepVirtualListFolder ()
 
void AddVirtualList (string listname)
 

Private Attributes

map< string, GHepVirtualList * > fVirtualListMap
 

Static Private Attributes

static GHepVirtualListFolderfInstance = 0
 

Friends

struct Cleaner
 

Detailed Description

A singleton class to manage all named GHepVirtualLists.

Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Created:
July 16, 2005
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 32 of file GHepVirtualListFolder.h.

Constructor & Destructor Documentation

GHepVirtualListFolder::GHepVirtualListFolder ( )
private

Definition at line 20 of file GHepVirtualListFolder.cxx.

References fInstance.

Referenced by Instance().

21 {
22  fInstance = 0;
23 }
static GHepVirtualListFolder * fInstance
genie::GHepVirtualListFolder::GHepVirtualListFolder ( const GHepVirtualListFolder config_pool)
private
GHepVirtualListFolder::~GHepVirtualListFolder ( )
privatevirtual

Definition at line 25 of file GHepVirtualListFolder.cxx.

References Clear(), and fInstance.

26 {
27  this->Clear();
28  fInstance = 0;
29 }
static GHepVirtualListFolder * fInstance

Member Function Documentation

void GHepVirtualListFolder::AddToVirtualList ( string  listname,
GHepParticle p 
)

Definition at line 43 of file GHepVirtualListFolder.cxx.

References AddVirtualList(), fVirtualListMap, and VirtualListExists().

44 {
45 // Adds a particle to the named virtual list - if the list does not exists it
46 // creates it first.
47 // The virtual list has no ownership of its
48  bool exists = this->VirtualListExists(listname);
49 
50  if(!exists) this->AddVirtualList(listname);
51 
52  int n = fVirtualListMap[listname]->GetEntries();
53  GHepVirtualList * vl = fVirtualListMap[listname];
54  (*vl)[n] = (TObject*)p;
55 }
bool VirtualListExists(string listname)
A GHepVirtualList is a &#39;virtual&#39; collection of GHepParticles. Is virtual because it does not own but ...
map< string, GHepVirtualList * > fVirtualListMap
void GHepVirtualListFolder::AddVirtualList ( string  listname)
private

Definition at line 104 of file GHepVirtualListFolder.cxx.

References fVirtualListMap.

Referenced by AddToVirtualList().

105 {
106  GHepVirtualList * vl = new GHepVirtualList;
107  fVirtualListMap.insert(
108  map<string, GHepVirtualList *>::value_type(listname,vl) );
109 }
A GHepVirtualList is a &#39;virtual&#39; collection of GHepParticles. Is virtual because it does not own but ...
map< string, GHepVirtualList * > fVirtualListMap
void GHepVirtualListFolder::Clear ( void  )

Definition at line 82 of file GHepVirtualListFolder.cxx.

References fVirtualListMap.

Referenced by genie::EventGenerator::ProcessEventRecord(), and ~GHepVirtualListFolder().

83 {
84 // removes all virtual lists
85 
86  map<string, GHepVirtualList *>::iterator vlmiter;
87  for (vlmiter = fVirtualListMap.begin();
88  vlmiter != fVirtualListMap.end(); ++vlmiter) {
89  GHepVirtualList * vlist = vlmiter->second;
90  if(vlist) delete vlist;
91  vlist = 0;
92  }
93  fVirtualListMap.clear();
94 }
A GHepVirtualList is a &#39;virtual&#39; collection of GHepParticles. Is virtual because it does not own but ...
map< string, GHepVirtualList * > fVirtualListMap
GHepVirtualListFolder * GHepVirtualListFolder::Instance ( void  )
static
void GHepVirtualListFolder::RemoveList ( string  listname)

Definition at line 65 of file GHepVirtualListFolder.cxx.

References fVirtualListMap.

66 {
67 // removes the input virtual list (if it exists)
68 
69  bool exists = (fVirtualListMap.count(listname) == 1);
70  if(!exists) return;
71 
72  map<string, GHepVirtualList *>::iterator
73  vlmiter = fVirtualListMap.find(listname);
74 
75  GHepVirtualList * vlist = vlmiter->second;
76  if(vlist) delete vlist;
77  vlist = 0;
78 
79  fVirtualListMap.erase(listname);
80 }
A GHepVirtualList is a &#39;virtual&#39; collection of GHepParticles. Is virtual because it does not own but ...
map< string, GHepVirtualList * > fVirtualListMap
GHepVirtualList * GHepVirtualListFolder::VirtualList ( string  listname)

Definition at line 96 of file GHepVirtualListFolder.cxx.

References fVirtualListMap, and VirtualListExists().

97 {
98  bool exists = this->VirtualListExists(listname);
99 
100  if(!exists) return 0;
101  else return fVirtualListMap[listname];
102 }
bool VirtualListExists(string listname)
map< string, GHepVirtualList * > fVirtualListMap
bool GHepVirtualListFolder::VirtualListExists ( string  listname)

Definition at line 57 of file GHepVirtualListFolder.cxx.

References fVirtualListMap.

Referenced by AddToVirtualList(), and VirtualList().

58 {
59 // checks whether a virtual list exists
60 
61  bool exists = (fVirtualListMap.count(listname) == 1);
62  return exists;
63 }
map< string, GHepVirtualList * > fVirtualListMap

Friends And Related Function Documentation

friend struct Cleaner
friend

Definition at line 65 of file GHepVirtualListFolder.h.

Member Data Documentation

GHepVirtualListFolder * GHepVirtualListFolder::fInstance = 0
staticprivate
map<string, GHepVirtualList *> genie::GHepVirtualListFolder::fVirtualListMap
private

The documentation for this class was generated from the following files: