Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4DataVector.hh
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4DataVector.hh 67970 2013-03-13 10:10:06Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 class header file
32 // ------------------------------------------------------------
33 //
34 // Class Description:
35 //
36 // Utility class providing similar behaviour of vector<G4double>.
37 // It includes additional methods for compatibility with Rogue Wave
38 // collection.
39 //
40 
41 #ifndef G4DataVector_h
42 #define G4DataVector_h 1
43 
44 #include "globals.hh"
45 #include <vector>
46 #include "G4ios.hh"
47 #include <iostream>
48 #include <fstream>
49 
50 class G4DataVector : public std::vector<G4double>
51 {
52 
53  public: // with description
54 
55  G4DataVector();
56  // Default constructor.
57 
58  explicit G4DataVector(size_t cap);
59  // Constructor given a 'capacity' defining the initial number of elements.
60 
61  G4DataVector(size_t cap, G4double value);
62  // Constructor given a 'capacity' defining the initial number of elements
63  // and initialising them to 'value'.
64 
65  virtual ~G4DataVector();
66  // Empty destructor
67 
68  inline void insertAt(size_t, const G4double&);
69  // Insert an element at given position
70 
71  inline size_t index(const G4double&);
72  // Returns back index of the element same as given value
73 
74  inline G4bool contains(const G4double&) const;
75  // Returns 'true' if it contains the element same as given value
76 
77  inline G4bool remove(const G4double&);
78  // Removes the first element same as given value
79 
80  inline size_t removeAll(const G4double&);
81  // Remove all elements same as given value
82 
83  enum {T_G4DataVector = 100};
84 
85  G4bool Store(std::ofstream& fOut, G4bool ascii=false);
86  G4bool Retrieve(std::ifstream& fIn, G4bool ascii=false);
87  // To store/retrieve persistent data to/from file streams.
88 
89  friend std::ostream& operator<<(std::ostream&, const G4DataVector&);
90 };
91 
92 #include "G4DataVector.icc"
93 
94 #endif
G4bool Store(std::ofstream &fOut, G4bool ascii=false)
Definition: G4DataVector.cc:61
G4bool contains(const G4double &) const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
Definition: G4DataVector.cc:86
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
const XML_Char int const XML_Char * value
Definition: expat.h:331
size_t index(const G4double &)
size_t removeAll(const G4double &)
void insertAt(size_t, const G4double &)
friend std::ostream & operator<<(std::ostream &, const G4DataVector &)
virtual ~G4DataVector()
Definition: G4DataVector.cc:57