Logo ROOT   6.10/09
Reference Guide
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 
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.
47 
48 public:
49  TParallelMergingFile(const char *filename, Option_t *option = "", const char *ftitle = "", Int_t compress = 1);
51 
52  virtual void Close(Option_t *option="");
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
const char Option_t
Definition: RtypesCore.h:62
This class represents a WWW compatible URL.
Definition: TUrl.h:35
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
A TMemFile is like a normal TFile except that it reads and writes only from memory.
Definition: TMemFile.h:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual void WriteStreamerInfo()
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
TParallelMergingFile(const char *filename, Option_t *option="", const char *ftitle="", Int_t compress=1)
Constructor.
~TParallelMergingFile()
Destructor.
Bool_t UploadAndReset()
Upload the current file data to the merging server.
virtual void Close(Option_t *option="")
Close a file.
virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0)
Write memory objects to this file and upload them to the parallel merge server.
Array of chars or bytes (8 bits per element).
Definition: TArrayC.h:27