CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
StorableDoubleMap< T > Class Template Reference

#include <StorableDoubleMap.h>

Public Types

typedef T value_type
 

Public Member Functions

void add (const std::string &name, const std::string &category, std::auto_ptr< T > ptr)
 
void clear ()
 
bool empty () const
 
bool exists (const std::string &name, const std::string &category) const
 
const Tget (const std::string &name, const std::string &category) const
 
bool operator!= (const StorableDoubleMap &r) const
 
bool operator== (const StorableDoubleMap &r) const
 
 ~StorableDoubleMap ()
 

Private Types

typedef std::map< std::string, PtrMapDataMap
 
typedef std::map< std::string, T * > PtrMap
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, unsigned)
 

Private Attributes

DataMap data_
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename T>
class StorableDoubleMap< T >

Definition at line 11 of file StorableDoubleMap.h.

Member Typedef Documentation

template<typename T>
typedef std::map<std::string, PtrMap> StorableDoubleMap< T >::DataMap
private

Definition at line 37 of file StorableDoubleMap.h.

template<typename T>
typedef std::map<std::string, T*> StorableDoubleMap< T >::PtrMap
private

Definition at line 36 of file StorableDoubleMap.h.

template<typename T>
typedef T StorableDoubleMap< T >::value_type

Definition at line 14 of file StorableDoubleMap.h.

Constructor & Destructor Documentation

template<typename T>
StorableDoubleMap< T >::~StorableDoubleMap ( )
inline

Definition at line 16 of file StorableDoubleMap.h.

16 {clear();}

Member Function Documentation

template<typename T>
void StorableDoubleMap< T >::add ( const std::string &  name,
const std::string &  category,
std::auto_ptr< T ptr 
)
inline
template<typename T >
void StorableDoubleMap< T >::clear ( void  )
template<typename T>
bool StorableDoubleMap< T >::empty ( ) const
inline
template<typename T >
bool StorableDoubleMap< T >::exists ( const std::string &  name,
const std::string &  category 
) const

Definition at line 65 of file StorableDoubleMap.h.

References StorableDoubleMap< T >::data_.

Referenced by StorableDoubleMap< AbsOOTPileupCorrection >::empty().

67 {
68  typename DataMap::const_iterator dit = data_.find(category);
69  if (dit == data_.end())
70  return false;
71  else
72  return !(dit->second.find(name) == dit->second.end());
73 }
template<typename T >
const T * StorableDoubleMap< T >::get ( const std::string &  name,
const std::string &  category 
) const
template<typename T>
bool StorableDoubleMap< T >::operator!= ( const StorableDoubleMap< T > &  r) const
inline

Definition at line 32 of file StorableDoubleMap.h.

33  {return !(*this == r);}
template<typename T >
bool StorableDoubleMap< T >::operator== ( const StorableDoubleMap< T > &  r) const

Definition at line 89 of file StorableDoubleMap.h.

References StorableDoubleMap< T >::data_, and end.

Referenced by StorableDoubleMap< AbsOOTPileupCorrection >::empty().

90 {
91  if (data_.size() != r.data_.size())
92  return false;
93  typename DataMap::const_iterator dit = data_.begin();
94  const typename DataMap::const_iterator end = data_.end();
95  typename DataMap::const_iterator rit = r.data_.begin();
96  for (; dit != end; ++dit, ++rit)
97  {
98  if (dit->first != rit->first)
99  return false;
100  if (dit->second.size() != rit->second.size())
101  return false;
102  typename PtrMap::const_iterator pit = dit->second.begin();
103  const typename PtrMap::const_iterator pend = dit->second.end();
104  typename PtrMap::const_iterator rpit = rit->second.begin();
105  for (; pit != pend; ++pit, ++rpit)
106  {
107  if (pit->first != rpit->first)
108  return false;
109  if (*(pit->second) != *(rpit->second))
110  return false;
111  }
112  }
113  return true;
114 }
#define end
Definition: vmac.h:39
template<typename T>
template<class Archive >
void StorableDoubleMap< T >::serialize ( Archive &  ar,
unsigned   
)
inlineprivate

Definition at line 43 of file StorableDoubleMap.h.

44  {
45  ar & data_;
46  }

Friends And Related Function Documentation

template<typename T>
friend class boost::serialization::access
friend

Definition at line 40 of file StorableDoubleMap.h.

Member Data Documentation

template<typename T>
DataMap StorableDoubleMap< T >::data_
private