ROOT  6.06/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 #ifndef ROOT_TMemFile
31 #include "TMemFile.h"
32 #endif
33 #ifndef ROOT_TMessage
34 #include "TMessage.h"
35 #endif
36 #ifndef ROOT_TUrl
37 #include "TUrl.h"
38 #endif
39 
40 
41 class TSocket;
42 class TArrayC;
43 
45 {
46 private:
47  TSocket *fSocket; // Socket to the parallel file merger server.
48  TUrl fServerLocation; // Url of the server.
49  Int_t fServerIdx; // Index of this socket/file on the server.
50  Int_t fServerVersion; // Protocol version used by the server.
51  TArrayC *fClassSent; // Record which StreamerInfo we already sent.
53 
54 public:
55  TParallelMergingFile(const char *filename, Option_t *option = "", const char *ftitle = "", Int_t compress = 1);
57 
58  virtual void Close(Option_t *option="");
60  virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0);
61  virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0) const;
62  virtual void WriteStreamerInfo();
63 
64  ClassDef(TParallelMergingFile,2); // TFile specialization that will semi-automatically upload its content to a merging server.
65 };
66 
67 #endif // ROOT_TParallelMergingFile
const char Option_t
Definition: RtypesCore.h:62
This class represents a WWW compatible URL.
Definition: TUrl.h:41
static const char * filename()
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:19
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.
ClassDef(TParallelMergingFile, 2)
virtual void Close(Option_t *option="")
Close a file.
#define name(a, b)
Definition: linkTestLib0.cpp:5
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:29