CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenericObjectOwner.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_GenericObjectOwner_h
2 #define FWCore_Framework_GenericObjectOwner_h
3 // -*- C++ -*-
4 //
5 // Package: Framework
6 // Class : GenericObjectOwner
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Sun Feb 3 19:43:16 EST 2008
19 //
20 
21 // system include files
22 #include <string>
23 #include "Reflex/Object.h"
24 
25 // user include files
27 
28 // forward declarations
29 namespace edm {
31 {
32 
33  public:
35  explicit GenericObjectOwner(Reflex::Object const& iObject,
36  bool iOwnData=true):
37  m_object(iObject), m_ownData(iOwnData) {}
39 
40  // ---------- const member functions ---------------------
41  Reflex::Object object() const;
42 
43  // ---------- static member functions --------------------
44 
45  // ---------- member functions ---------------------------
46  void swap(GenericObjectOwner&);
47  void release();
48 
49  private:
50  GenericObjectOwner(GenericObjectOwner const&); // stop default
51 
52  GenericObjectOwner const& operator=(GenericObjectOwner const&); // stop default
53 
54  // ---------- member data --------------------------------
55  Reflex::Object m_object;
56  bool m_ownData;
57 };
58 
59  //Need to specialize OrphanHandle because we don't actually have a long lived GenericObjectOwner
60  template <>
62  public:
63  // Default constructed handles are invalid.
65 
67  prod_(h.prod_.object(),false), id_(h.id_) {}
68 
69  OrphanHandle(Reflex::Object const& prod, ProductID const& id):
70  prod_(prod,false), id_(id) {}
71 
72  //~OrphanHandle();
73 
75  prod_.swap(other.prod_);
76  std::swap(id_,other.id_);
77  }
78 
79 
81  {
83  swap(temp);
84  return *this;
85  }
86 
87  bool isValid() const {return 0 !=prod_.object().Address();}
88 
89  GenericObjectOwner const* product() const {return &prod_;}
90  GenericObjectOwner const* operator->() const {return product();}
91  GenericObjectOwner const& operator*() const {return prod_;}
92 
93  ProductID id() const {return id_;}
94 
95 
96  private:
99  };
100 
101  template<>
103  Event::put<GenericObjectOwner>(std::auto_ptr<GenericObjectOwner> product, std::string const& productInstanceName);
104 
105 }
106 #endif
GenericObjectOwner const & operator=(GenericObjectOwner const &)
void swap(OrphanHandleBase &other)
void swap(GenericObjectOwner &)
GenericObjectOwner const & operator*() const
GenericObjectOwner const * product() const
Reflex::Object object() const
OrphanHandle(Reflex::Object const &prod, ProductID const &id)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
OrphanHandle< GenericObjectOwner > & operator=(OrphanHandle< GenericObjectOwner > const &rhs)
GenericObjectOwner(Reflex::Object const &iObject, bool iOwnData=true)
GenericObjectOwner const * operator->() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T const * product() const
Definition: OrphanHandle.h:57
list object
Definition: dbtoconf.py:77
void swap(OrphanHandle< GenericObjectOwner > &other)
OrphanHandle(OrphanHandle< GenericObjectOwner > const &h)