Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TKeySQL.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/sql:$Id$
0002 // Author: Sergey Linev  20/11/2005
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TKeySQL
0013 #define ROOT_TKeySQL
0014 
0015 #include "TKey.h"
0016 
0017 class TSQLFile;
0018 
0019 class TKeySQL final : public TKey {
0020 
0021 private:
0022    TKeySQL(const TKeySQL &) = delete;
0023    TKeySQL &operator=(const TKeySQL &) = delete;
0024 
0025 protected:
0026    TKeySQL() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
0027 
0028    using TKey::Read;
0029 
0030    void StoreKeyObject(const void *obj, const TClass *cl);
0031    void *ReadKeyObject(void *obj, const TClass *expectedClass);
0032 
0033    Long64_t fKeyId{-1}; ///<!  key identifier in KeysTables
0034    Long64_t fObjId{-1}; ///<!  stored object identifier
0035 
0036 public:
0037    TKeySQL(TDirectory *mother, const TObject *obj, const char *name, const char *title = nullptr);
0038    TKeySQL(TDirectory *mother, const void *obj, const TClass *cl, const char *name, const char *title = nullptr);
0039    TKeySQL(TDirectory *mother, Long64_t keyid, Long64_t objid, const char *name, const char *title,
0040            const char *keydatetime, Int_t cycle, const char *classname);
0041    ~TKeySQL() override = default;
0042 
0043    Bool_t IsKeyModified(const char *keyname, const char *keytitle, const char *keydatime, Int_t cycle, const char *classname);
0044 
0045    Long64_t GetDBKeyId() const { return fKeyId; }
0046    Long64_t GetDBObjId() const { return fObjId; }
0047    Long64_t GetDBDirId() const;
0048 
0049    // redefined TKey Methods
0050    void Delete(Option_t *option = "") final;
0051    void DeleteBuffer() final {}
0052    void FillBuffer(char *&) final {}
0053    char *GetBuffer() const final { return nullptr; }
0054    Long64_t GetSeekKey() const final { return GetDBObjId() > 0 ? GetDBObjId() : 0; }
0055    Long64_t GetSeekPdir() const final { return GetDBDirId() > 0 ? GetDBDirId() : 0; }
0056    void Keep() final {}
0057 
0058    Int_t Read(TObject *obj) final;
0059    TObject *ReadObj() final;
0060    TObject *ReadObjWithBuffer(char *bufferRead) final;
0061    void *ReadObjectAny(const TClass *expectedClass) final;
0062 
0063    void ReadBuffer(char *&) final {}
0064    Bool_t ReadFile() final { return kTRUE; }
0065    void SetBuffer() final { fBuffer =  nullptr; }
0066    Int_t WriteFile(Int_t = 1, TFile * = nullptr) final { return 0; }
0067 
0068    ClassDefOverride(TKeySQL, 1) // a special TKey for SQL data base
0069 };
0070 
0071 #endif