Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 09:09:52

0001 
0002 /*************************************************************************
0003  * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
0004  * All rights reserved.                                                  *
0005  *                                                                       *
0006  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0007  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0008  *************************************************************************/
0009 
0010 #ifndef ROOT_TNetXNGFile
0011 #define ROOT_TNetXNGFile
0012 
0013 ////////////////////////////////////////////////////////////////////////////////
0014 //                                                                            //
0015 // TNetXNGFile                                                                //
0016 //                                                                            //
0017 // Authors: Justin Salmon, Lukasz Janyst                                      //
0018 //          CERN, 2013                                                        //
0019 //                                                                            //
0020 ////////////////////////////////////////////////////////////////////////////////
0021 
0022 #include "TFile.h"
0023 #include "TSemaphore.h"
0024 
0025 namespace XrdCl {
0026    class File;
0027    class URL;
0028 }
0029 class XrdSysCondVar;
0030 
0031 
0032 /// Enables access to XRootD files using the new client.
0033 class TNetXNGFile: public TFile {
0034 private:
0035    XrdCl::File            *fFile;        // Underlying XRootD file
0036    XrdCl::URL             *fUrl;         // URL of the current file
0037    int                     fMode;        // Open mode of the current file
0038    XrdSysCondVar          *fInitCondVar; // Used to block an async open request
0039    // if requested
0040    Int_t                   fReadvIorMax; // Max size of a single readv chunk
0041    Int_t                   fReadvIovMax; // Max number of readv chunks
0042    Int_t                   fQueryReadVParams;
0043    TString                 fNewUrl;
0044 
0045 public:
0046    TNetXNGFile();
0047    TNetXNGFile(const char *url, const char *lurl, Option_t *mode, const char *title,
0048                Int_t compress, Int_t netopt, Bool_t parallelopen);
0049    TNetXNGFile(const char *url, Option_t *mode = "", const char *title = "",
0050                Int_t compress = 1, Int_t netopt = 0, Bool_t parallelopen = kFALSE);
0051 
0052    virtual ~TNetXNGFile();
0053 
0054    void     Init(Bool_t create) override;
0055    void     Close(const Option_t *option = "") override;
0056    void     Seek(Long64_t offset, ERelativeTo position = kBeg) override;
0057    virtual void     SetAsyncOpenStatus(EAsyncOpenStatus status);
0058    Long64_t GetSize() const override;
0059    Int_t    ReOpen(Option_t *modestr) override;
0060    Bool_t   IsOpen() const override;
0061    Bool_t   WriteBuffer(const char *buffer, Int_t length) override;
0062    void     Flush() override;
0063    Bool_t   ReadBuffer(char *buffer, Int_t length) override;
0064    Bool_t   ReadBuffer(char *buffer, Long64_t position, Int_t length) override;
0065    Bool_t   ReadBuffers(char *buffer, Long64_t *position, Int_t *length,
0066                         Int_t nbuffs) override;
0067    TString  GetNewUrl() override { return fNewUrl; }
0068 
0069 private:
0070    virtual Bool_t IsUseable() const;
0071    virtual Bool_t GetVectorReadLimits();
0072    virtual void   SetEnv();
0073 
0074    TNetXNGFile(const TNetXNGFile &other);             // Not implemented
0075    TNetXNGFile &operator =(const TNetXNGFile &other); // Not implemented
0076 
0077    ClassDefOverride(TNetXNGFile, 0)   // ROOT class definition
0078 };
0079 
0080 #endif // ROOT_TNetXNGFile