00001 #ifndef CDBROOREADONLY_NAME_ID_COLLECTION_R_RDL
00002 #define CDBROOREADONLY_NAME_ID_COLLECTION_R_RDL
00003
00004
00005
00006
00007 #include "CdbBase/CdbCPtr.hh"
00008 #include "CdbBase/CdbItr.hh"
00009
00010 #include "CdbRooReadonly/CdbRooRoPersistentCollectionR.hh"
00011 #include "CdbRooReadonly/CdbRooRoVectorCollectionR.hh"
00012
00013 #include <iostream>
00014 #include <string>
00015 #include <vector>
00016 #include <map>
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 template< class T >
00036 class CdbRooRoNameIdCollectionR : public CdbRooRoPersistentCollectionR {
00037
00038 private:
00039
00040
00041
00042 CdbRooRoNameIdCollectionR<T>& operator=( const CdbRooRoNameIdCollectionR<T>& theOther );
00043
00044 public:
00045
00046
00047
00048
00049
00050 CdbRooRoNameIdCollectionR( );
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 CdbRooRoNameIdCollectionR( const CdbRooRoNameIdCollectionR<T>& theOther );
00071
00072
00073
00074 virtual ~CdbRooRoNameIdCollectionR( );
00075
00076 UInt_t size( ) const { return _indexById.size( ); }
00077
00078 virtual CdbStatus add( const T& theObject );
00079
00080 virtual CdbStatus find( UShort_t theId,
00081 T& theObject ) const;
00082
00083 virtual CdbStatus find( UShort_t theId,
00084 CdbCPtr< T >& theObjectPtr ) const;
00085
00086 virtual CdbStatus find( const std::string& theName,
00087 T& theObject ) const;
00088
00089 virtual CdbStatus find( const std::string& theName,
00090 CdbCPtr< T >& theObjectPtr ) const;
00091
00092
00093
00094 void identifiers( std::vector<UShort_t>& theCollection ) const;
00095
00096
00097
00098 void names( std::vector<std::string>& theCollection ) const;
00099
00100
00101
00102 CdbItr< UShort_t > iterator_identifiers( ) const;
00103
00104
00105
00106 CdbItr< std::string > iterator_names( ) const;
00107
00108 virtual void dump( std::ostream& o,
00109 const std::string& indent = "" ) const;
00110
00111 protected:
00112
00113
00114
00115
00116
00117
00118
00119 virtual CdbStatus storeSubCollectionsAt( const CdbRooRoCollectionAddressR& theCollectionAddress,
00120 const CdbCPtr<TFile>& theFilePtr,
00121 Int_t& theNumBytesStored );
00122 private:
00123
00124
00125
00126 CdbRooRoVectorCollectionR<T> _objects;
00127
00128
00129
00130
00131 std::map<UShort_t,UInt_t> _indexById;
00132
00133
00134
00135 std::map<std::string,UInt_t> _indexByName;
00136
00137 ClassDefT(CdbRooRoNameIdCollectionR<T>,1);
00138 };
00139
00140
00141
00142 #ifndef __CINT__
00143 #include "CdbRooReadonly/CdbRooRoNameIdCollectionR.cc"
00144 #endif
00145 #endif