CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StoreManagerTrait.h
Go to the documentation of this file.
1 #ifndef UtilAlgos_StoreManagerTrait_h
2 #define UtilAlgos_StoreManagerTrait_h
3 /* \class helper::CollectionStoreManager
4  *
5  * \author: Luca Lista, INFN
6  *
7  */
14 #include <memory>
15 #include "boost/static_assert.hpp"
16 #include "boost/type_traits.hpp"
17 
18 namespace helper {
19 
20  template<typename Collection>
23  template<typename I>
24  static value_type convert( const I & i ) {
25  return value_type( * * i );
26  }
27  };
28 
29  template<typename T>
30  struct IteratorToObjectConverter<edm::OwnVector<T> > {
31  typedef std::auto_ptr<T> value_type;
32  template<typename I>
33  static value_type convert( const I & i ) {
34  return value_type( (*i)->clone() );
35  }
36  };
37 
38  template<typename C>
41  template<typename I>
42  static value_type convert( const I & i ) {
43  return value_type( * i );
44  }
45  };
46 
47  template<typename T>
50  template<typename I>
51  static value_type convert( const I & i ) {
52  return value_type( * i );
53  }
54  };
55 
56 
57  template<typename T>
60  template<typename I>
61  static value_type convert( const I & i ) {
62  return value_type( * i );
63  }
64  };
65 
66 
67 
68  template<typename OutputCollection,
69  typename ClonePolicy = IteratorToObjectConverter<OutputCollection> >
71  typedef OutputCollection collection;
72  template<typename C>
74  selected_( new OutputCollection ) {
75  }
76  template<typename I>
77  void cloneAndStore( const I & begin, const I & end, edm::Event & ) {
78  using namespace std;
79  for( I i = begin; i != end; ++ i ) {
81  selected_->push_back( v );
82  }
83  }
85  return evt.put( selected_ );
86  }
87  size_t size() const { return selected_->size(); }
88  private:
89  std::auto_ptr<collection> selected_;
90  };
91 
92  template<typename OutputCollection, typename EdmFilter>
93  struct ObjectSelectorBase : public EdmFilter {
95  this-> template produces<OutputCollection>();
96  }
97  };
98 
99  template<typename OutputCollection, typename EdmFilter=edm::EDFilter>
103  };
104 
105 }
106 
107 #endif
108 
int i
Definition: DBlmapReader.cc:9
static value_type convert(const I &i)
ObjectSelectorBase(const edm::ParameterSet &)
Collection::value_type value_type
edm::OrphanHandle< collection > put(edm::Event &evt)
void cloneAndStore(const I &begin, const I &end, edm::Event &)
CollectionStoreManager(const edm::Handle< C > &h)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
const std::complex< double > I
Definition: I.h:8
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
#define end
Definition: vmac.h:37
Container::value_type value_type
std::auto_ptr< collection > selected_
#define begin
Definition: vmac.h:30
edm::RefVector< Container > RefVector