Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TParallelMergingFile.h
Go to the documentation of this file.
1 // @(#)root/net:$Id$
2 // Author: Philippe Canal October 2011.
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2011, Rene Brun, Fons Rademakers and al. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TParallelMergingFile
13 #define ROOT_TParallelMergingFile
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TParallelMergingFile //
19 // //
20 // Specialization of TMemFile to connect to a parallel file merger. //
21 // Upon a call to UploadAndReset, the content already written to the //
22 // file is upload to the server and the object implementing the function//
23 // ResetAfterMerge (like TTree) are reset. //
24 // The parallel file merger will then collate the information coming //
25 // from this client and any other client in to the file described by //
26 // the filename of this object. //
27 // //
28 //////////////////////////////////////////////////////////////////////////
29 
30 #include "TMemFile.h"
31 #include "TMessage.h"
32 #include "TUrl.h"
33 
34 
35 class TSocket;
36 class TArrayC;
37 
38 class TParallelMergingFile : public TMemFile
39 {
40 private:
41  TSocket *fSocket; // Socket to the parallel file merger server.
42  TUrl fServerLocation; // Url of the server.
43  Int_t fServerIdx; // Index of this socket/file on the server.
44  Int_t fServerVersion; // Protocol version used by the server.
45  TArrayC *fClassSent; // Record which StreamerInfo we already sent.
46  TMessage fMessage;
47 
48 public:
49  TParallelMergingFile(const char *filename, Option_t *option = "", const char *ftitle = "", Int_t compress = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault);
50  ~TParallelMergingFile();
51 
52  virtual void Close(Option_t *option="");
53  Bool_t UploadAndReset();
54  virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0);
55  virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0) const;
56  virtual void WriteStreamerInfo();
57 
58  ClassDef(TParallelMergingFile, 0); // TFile specialization that will semi-automatically upload its content to a merging server.
59 };
60 
61 #endif // ROOT_TParallelMergingFile