BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/MdcRecoUtil/MdcRecoUtil/AstStringMap.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: AstStringMap.h,v 1.4 2010/03/25 09:55:57 zhangy Exp $
4//
5// Description:
6// This class is meant to be used to store an unowned pointer to
7// and object that you reference with a std::string key.
8//
9// Environment:
10// This software was developed for the BaBar collaboration. If you
11// use all or part of it, please give an appropriate acknowledgement.
12//
13// Author List:
14// Stephen J. Gowdy Originator
15//
16// Copyright Information:
17// Copyright (C) 2004 Stanford Linear Accelerator Center
18//
19// History:
20// Migration for BESIII MDC
21//
22//------------------------------------------------------------------------
23
24#ifndef ASTSTRINGMAP_H
25#define ASTSTRINGMAP_H
26
27//-------------
28// C Headers --
29//-------------
30extern "C" {
31}
32
33//---------------
34// C++ Headers --
35//---------------
36#include <iosfwd>
37#include <map>
38#include <string>
39#include <vector>
40
41//----------------------
42// Base Class Headers --
43//----------------------
44
45//-------------------------------
46// Collaborating Class Headers --
47//-------------------------------
48
49//------------------------------------
50// Collaborating Class Declarations --
51//------------------------------------
52
53// ---------------------
54// -- Class Interface --
55// ---------------------
56
57
58/**
59 * This class is meant to be used to store an unowned pointer to
60 * and object that you reference with a std::string key.
61 *
62 * This software was developed for the BaBar collaboration. If you
63 * use all or part of it, please give an appropriate acknowledgement.
64 *
65 * Copyright (C) 2004 Stanford Linear Accelerator Center
66//
67// History:
68// Migration for BESIII MDC
69 *
70 * @see Template
71 *
72 * @version $Id: AstStringMap.h,v 1.4 2010/03/25 09:55:57 zhangy Exp $
73 *
74 * @author Stephen J. Gowdy Originator;
75 */
76
77template<class T>
79
80 //--------------------
81 // Declarations --
82 //--------------------
83
84 // Typedefs, consts, and enums
85
86 //--------------------
87 // Instance Members --
88 //--------------------
89
90 public:
91
92 // Constructors
94
95 // Destructor
96 virtual ~AstStringMap( );
97
98 // Operators
99
100 /**
101 * Find object using a string key.
102 *
103 * @param key String to use to lookup object
104 * @return Pointer to object (0 if no object found)
105 *
106 */
107 virtual T* operator[]( const std::string& key ) const;
108
109 // Selectors (const)
110 virtual int size() const;
111
112 // Modifiers
113
114 /**
115 * Store a new reference to a pointer with a string as key
116 *
117 * @param key String to be used as a key for object
118 * @return reference for user to set to new object pointer
119 *
120 * @see Template#myFunction
121 */
122 virtual T*& insert( const std::string& key );
123
124 virtual void clear();
125
126 protected:
127
128 // Helper functions
129 inline int stringToBucket( const std::string& key ) const;
130 //CHANGE inline uint64_t stringToInt( const std::string& key ) const;
131 inline unsigned stringToInt( const std::string& key ) const;
132
133 private:
134
135 // Friends
136 //friend std::ostream& operator<<<T>( std::ostream& stream,
137 friend std::ostream& operator<<( std::ostream& stream,
138 const AstStringMap< T >& map );
139
140 // Data members
141
142 // Here we map strings upto and including eight characters to a 64 bit int
143 std::map< unsigned, T* > _intMap;
144 // for output, remember the string
145 std::map< unsigned, std::string > _intStringMap;
146
147 // Here we have a std::map for each letter for longer strings
148 std::vector< std::map< std::string, T* > > _stringMap;
149
150 // Note: if your class needs a copy constructor or an assignment operator,
151 // make one of the following public and implement it.
152 AstStringMap( const AstStringMap<T>& ); // Copy Constructor
153 AstStringMap<T>& operator= ( const AstStringMap<T>& );
154
155 //------------------
156 // Static Members --
157 //------------------
158
159 public:
160
161 // Selectors (const)
162
163 // Modifiers
164
165 private:
166
167 // Data members
168
169};
170
171
172/**
173 * Output contents of map to ostream, requires operator<< for T
174 *
175 * @param stream Stream to output on
176 * @param map Map to output contents of
177 * @return reference to stream
178 *
179 * @see Template#myFunction
180 */
181template < class T >
182std::ostream&
183operator<<( std::ostream& stream, const AstStringMap< T >& map );
184
185//SKIP #ifdef BES_COMP_INST
186//SKIP #include "MdcTrkRecon/Tools/AstStringMap.cxx"
187#include "AstStringMap.icc"
188//SKIP #endif // BES_COMP_INST
189
190
191#endif // ASTSTRINGMAP_H
std::ostream & operator<<(std::ostream &stream, const AstStringMap< T > &map)
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition: Taupair.h:42
virtual int size() const
virtual void clear()
virtual T *& insert(const std::string &key)
unsigned stringToInt(const std::string &key) const
int stringToBucket(const std::string &key) const
virtual ~AstStringMap()
virtual T * operator[](const std::string &key) const
friend std::ostream & operator<<(std::ostream &stream, const AstStringMap< T > &map)