TKeyXML.h

Go to the documentation of this file.
00001 // @(#)root/xml:$Id: TKeyXML.h 26606 2008-12-02 20:36:09Z pcanal $
00002 // Author: Sergey Linev  10.05.2004
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, 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 #ifndef ROOT_TKeyXML
00013 #define ROOT_TKeyXML
00014 
00015 #ifndef ROOT_TXMLEngine
00016 #include "TXMLEngine.h"
00017 #endif
00018 #ifndef ROOT_TKey
00019 #include "TKey.h"
00020 #endif
00021 
00022 class TXMLFile;
00023 
00024 class TKeyXML : public TKey {
00025 
00026 private:
00027    TKeyXML(const TKeyXML&);            // TKeyXML objects are not copiable.
00028    TKeyXML& operator=(const TKeyXML&); // TKeyXML objects are not copiable.
00029    
00030 protected:
00031    TKeyXML();
00032     
00033 public:
00034    TKeyXML(TDirectory* mother, Long64_t keyid, const TObject* obj, const char* name = 0, const char* title = 0);
00035    TKeyXML(TDirectory* mother, Long64_t keyid, const void* obj, const TClass* cl, const char* name, const char* title = 0);
00036    TKeyXML(TDirectory* mother, Long64_t keyid, XMLNodePointer_t keynode);
00037    virtual ~TKeyXML();
00038    
00039    // redefined TKey Methods
00040    virtual void      Delete(Option_t *option="");
00041    virtual void      DeleteBuffer() {}
00042    virtual void      FillBuffer(char *&) {}
00043    virtual char     *GetBuffer() const { return 0; }
00044    virtual Long64_t  GetSeekKey() const  { return fKeyNode ? 1024 : 0;}
00045    virtual Long64_t  GetSeekPdir() const { return fKeyNode ? 1024 : 0;}
00046    //virtual ULong_t   Hash() const { return 0; }
00047    virtual void      Keep() {}
00048    //virtual void      ls(Option_t* ="") const;
00049    //virtual void      Print(Option_t* ="") const {}
00050    
00051    virtual Int_t     Read(TObject* tobj);
00052    virtual TObject  *ReadObj();
00053    virtual TObject  *ReadObjWithBuffer(char *bufferRead);
00054    virtual void     *ReadObjectAny(const TClass *expectedClass);
00055    
00056    virtual void      ReadBuffer(char *&) {}
00057    virtual void      ReadFile() {}
00058    virtual void      SetBuffer() { fBuffer = 0; }
00059    virtual Int_t     WriteFile(Int_t =1, TFile* = 0) { return 0; }
00060    
00061    // TKeyXML specific methods
00062    
00063    XMLNodePointer_t  KeyNode() const { return fKeyNode; }
00064    Long64_t          GetKeyId() const { return fKeyId; }
00065    Bool_t            IsSubdir() const { return fSubdir; }
00066    void              SetSubir() { fSubdir = kTRUE; }
00067    void              UpdateObject(TObject* obj);
00068    void              UpdateAttributes();
00069    
00070 protected:
00071    virtual Int_t     Read(const char *name) { return TKey::Read(name); }
00072    void              StoreObject(const void* obj, const TClass* cl);
00073    void              StoreKeyAttributes();
00074    TXMLEngine*       XMLEngine();
00075    
00076    void*             XmlReadAny(void* obj, const TClass* expectedClass);
00077    
00078    XMLNodePointer_t  fKeyNode;  //! node with stored object
00079    Long64_t          fKeyId;    //! unique identifier of key for search methods
00080    Bool_t            fSubdir;   //! indicates that key contains subdirectory
00081    
00082    ClassDef(TKeyXML,1) // a special TKey for XML files      
00083 };
00084 
00085 #endif

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