CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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,
PtrMap
DataMap
 
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

Definition at line 18 of file StorableDoubleMap.h.

Referenced by counter.Counter::register().

template<typename T >
void StorableDoubleMap< T >::clear ( void  )

Definition at line 51 of file StorableDoubleMap.h.

References end.

Referenced by Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), Vispa.Views.WidgetView.WidgetView::setDataObjects(), BeautifulSoup.Tag::setString(), Vispa.Views.TreeView.TreeView::updateContent(), Vispa.Views.TableView.TableView::updateContent(), Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), Vispa.Views.PropertyView.PropertyView::updateContent(), and StorableDoubleMap< AbsOOTPileupCorrection >::~StorableDoubleMap().

52 {
53  const typename DataMap::iterator end = data_.end();
54  for (typename DataMap::iterator dit = data_.begin(); dit != end; ++dit)
55  {
56  const typename PtrMap::iterator pend = dit->second.end();
57  for (typename PtrMap::iterator pit = dit->second.begin();
58  pit != pend; ++pit)
59  delete pit->second;
60  }
61  data_.clear();
62 }
#define end
Definition: vmac.h:37
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.

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

Definition at line 76 of file StorableDoubleMap.h.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

78 {
79  typename DataMap::const_iterator dit = data_.find(category);
80  if (dit == data_.end()) throw cms::Exception(
81  "In StorableDoubleMap::get: unknown category");
82  typename PtrMap::const_iterator pit = dit->second.find(name);
83  if (pit == dit->second.end()) throw cms::Exception(
84  "In StorableDoubleMap::get: unknown name");
85  return pit->second;
86 }
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.

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:37
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