TKeySQL.h

Go to the documentation of this file.
00001 // @(#)root/sql:$Id: TKeySQL.h 26606 2008-12-02 20:36:09Z pcanal $
00002 // Author: Sergey Linev  20/11/2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 
00013 #ifndef ROOT_TKeySQL
00014 #define ROOT_TKeySQL
00015 
00016 
00017 /////////////////////////////////////////////////////////////////////////
00018 //                                                                     //
00019 // TKeySQL is TKey class from TSQLFile                                 //
00020 //                                                                     //
00021 /////////////////////////////////////////////////////////////////////////
00022 
00023 
00024 #ifndef ROOT_TKey
00025 #include "TKey.h"
00026 #endif
00027 
00028 class TSQLFile;
00029 
00030 class TKeySQL : public TKey {
00031     
00032 private:
00033    TKeySQL(const TKeySQL&);            // TKeySQL objects are not copiable.
00034    TKeySQL& operator=(const TKeySQL&); // TKeySQL objects are not copiable.
00035    
00036 protected:
00037    TKeySQL();
00038 
00039    virtual Int_t     Read(const char *name) { return TKey::Read(name); }
00040    void              StoreKeyObject(const void* obj, const TClass* cl);
00041    void*             ReadKeyObject(void* obj, const TClass* expectedClass);
00042   
00043    Long64_t          fKeyId;    //!  key identifier in KeysTables
00044    Long64_t          fObjId;    //!  stored object identifer
00045 
00046 public:
00047    TKeySQL(TDirectory* mother, const TObject* obj, const char* name, const char* title = 0);
00048    TKeySQL(TDirectory* mother, const void* obj, const TClass* cl, const char* name, const char* title = 0);
00049    TKeySQL(TDirectory* mother, Long64_t keyid, Long64_t objid, 
00050            const char* name, const char* title,
00051            const char* keydatetime, Int_t cycle, const char* classname);
00052    virtual ~TKeySQL();
00053 
00054    Bool_t            IsKeyModified(const char* keyname, const char* keytitle, const char* keydatime, Int_t cycle, const char* classname);
00055   
00056    Long64_t          GetDBKeyId() const { return fKeyId; }
00057    Long64_t          GetDBObjId() const { return fObjId; }
00058    Long64_t          GetDBDirId() const;
00059 
00060    // redefined TKey Methods
00061    virtual void      Delete(Option_t *option="");
00062    virtual void      DeleteBuffer() {}
00063    virtual void      FillBuffer(char *&) {}
00064    virtual char     *GetBuffer() const { return 0; }
00065    virtual Long64_t  GetSeekKey() const  { return GetDBObjId() > 0 ? GetDBObjId() : 0; }
00066    virtual Long64_t  GetSeekPdir() const { return GetDBDirId() > 0 ? GetDBDirId() : 0; }
00067    virtual void      Keep() {}
00068 
00069    virtual Int_t     Read(TObject* obj);
00070    virtual TObject  *ReadObj();
00071    virtual TObject  *ReadObjWithBuffer(char *bufferRead);
00072    virtual void     *ReadObjectAny(const TClass *expectedClass);
00073   
00074    virtual void      ReadBuffer(char *&) {}
00075    virtual void      ReadFile() {}
00076    virtual void      SetBuffer() { fBuffer = 0; }
00077    virtual Int_t     WriteFile(Int_t =1, TFile* = 0) { return 0; }
00078 
00079    ClassDef(TKeySQL,1) // a special TKey for SQL data base
00080 };
00081 
00082 #endif

Generated on Tue Jul 5 14:26:59 2011 for ROOT_528-00b_version by  doxygen 1.5.1