CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Utilities.h
Go to the documentation of this file.
1 #ifndef IOPool_Streamer_Utilties_h
2 #define IOPool_Streamer_Utilties_h
3 
4 // -*- C++ -*-
5 //
6 // This header presents several classes used internally by the
7 // Streamer package.
8 //
9 
10 #include "TBufferFile.h"
11 
16 
17 #include <iostream>
18 
19 namespace edm
20 {
21  class InitMsg;
22  edm::ProductRegistry getRegFromFile(std::string const& filename);
23  std::auto_ptr<SendJobHeader> readHeaderFromStream(std::ifstream& ist);
24  bool registryIsSubset(SendJobHeader const&, ProductRegistry const& reg);
25  bool registryIsSubset(SendJobHeader const& sd, SendJobHeader const& ref);
26  //bool registryIsSame(SendJobHeader const& sd, SendJobHeader const& ref);
27 
29  {
30  public:
33 
34  std::auto_ptr<SendJobHeader> decodeJobHeader(InitMsg const& msg);
35 
36  private:
37  TClass* desc_;
38  TBufferFile buf_;
39  };
40 
41  // ------------------------------------------------------------
42  // Below are a few utilities for putting event pointers and job
43  // header pointers onto the queue and extract them.
44 
46  {
47  public:
48  explicit JobHeaderInserter(EventBuffer& b) : buf_(&b) {}
49  void insert(InitMsg const& msg)
50  {
51  std::auto_ptr<SendJobHeader> p = decoder_.decodeJobHeader(msg);
53  void** v = (void**)b.buffer();
54  *v = p.release();
55  b.commit(sizeof(void*));
56  }
57  private:
60  };
61 
63  {
64  public:
65  explicit JobHeaderExtractor(EventBuffer& b):buf_(&b) { }
66  std::auto_ptr<SendJobHeader> extract()
67  {
69  std::auto_ptr<SendJobHeader> p((SendJobHeader*)b.buffer());
70  return p;
71  }
72  private:
74  };
75 
76  // -----------------
77 
79  {
80  public:
81  explicit EventExtractor(EventBuffer& b):buf_(&b) { }
83  {
85  FDEBUG(2) << "Extract: " << b.buffer() << " " << b.size() << std::endl;
87  FDEBUG(2) << "Extract: event ptr = " << (void*)p << std::endl;
88  return p;
89  }
90  private:
92  };
93 
94 }
95 
96 #endif
97 
EventBuffer * buf_
Definition: Utilities.h:58
JobHeaderInserter(EventBuffer &b)
Definition: Utilities.h:48
std::auto_ptr< SendJobHeader > readHeaderFromStream(std::ifstream &ist)
std::auto_ptr< SendJobHeader > decodeJobHeader(InitMsg const &msg)
Definition: Utilities.cc:61
std::auto_ptr< SendJobHeader > extract()
Definition: Utilities.h:66
void insert(InitMsg const &msg)
Definition: Utilities.h:49
EventBuffer * buf_
Definition: Utilities.h:91
EventExtractor(EventBuffer &b)
Definition: Utilities.h:81
#define FDEBUG(lev)
Definition: DebugMacros.h:18
EventBuffer * buf_
Definition: Utilities.h:73
edm::ProductRegistry getRegFromFile(std::string const &filename)
Definition: Utilities.cc:206
JobHeaderDecoder decoder_
Definition: Utilities.h:59
EventPrincipal * extract()
Definition: Utilities.h:82
bool registryIsSubset(SendJobHeader const &, ProductRegistry const &reg)
Definition: Utilities.cc:85
TBufferFile buf_
Definition: Utilities.h:38
double sd
double b
Definition: hdecay.h:120
JobHeaderExtractor(EventBuffer &b)
Definition: Utilities.h:65
author Stefano ARGIRO author Bill Tanenbaum
tuple filename
Definition: lut2db_cfg.py:20
mathSSE::Vec4< T > v