library: libCore #include "TProcessID.h"

# TProcessID

class description - source file - inheritance tree (.pdf)

## class TProcessID : public TNamed

| Inheritance Chart:

`TObject`

<-

`TNamed`

<-

`TProcessID`

<-

`TProcessUUID` |

        public:

                             TProcessID()
                             TProcessID(const TProcessID& ref)
                     virtual ~TProcessID()
          static TProcessID* AddProcessID()
               static UInt_t AssignID(TObject* obj)
              static TClass* Class()
                 static void Cleanup()
                virtual void Clear(Option_t* option = "")
                       Int_t DecrementCount()
                       Int_t GetCount() const
               static UInt_t GetObjectCount()
                  TObjArray* GetObjects() const
                    TObject* GetObjectWithID(UInt_t uid)
          static TProcessID* GetProcessID(UShort_t pid)
          static TProcessID* GetProcessWithUID(UInt_t uid, void* obj)
          static TProcessID* GetSessionProcessID()
                       Int_t IncrementCount()
             virtual TClass* IsA() const
               static Bool_t IsValid(TProcessID* pid)
                 TProcessID& operator=(const TProcessID&)
                        void PutObjectWithID(TObject* obj, UInt_t uid = 0)
          static TProcessID* ReadProcessID(UShort_t pidf, TFile* file)
                virtual void RecursiveRemove(TObject* obj)
                 static void SetObjectCount(UInt_t number)
                virtual void ShowMembers(TMemberInspector& insp, char* parent)
                virtual void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)
             static UShort_t WriteProcessID(TProcessID* pid, TFile* file)

### Data Members

        protected:

                       Int_t fCount     !Reference count to this object (from TFile)
                  TObjArray* fObjects   !Array pointing to the referenced objects
          static TProcessID* fgPID      Pointer to current session ProcessID
           static TObjArray* fgPIDs     Table of ProcessIDs
              static TExMap* fgObjPIDs  Table pointer to pids
               static UInt_t fgNumber   Referenced objects count

## Class Description

     TProcessID

     A TProcessID identifies a ROOT job in a unique way in time and space.
     The TProcessID title consists of a TUUID object which provides a globally
     unique identifier (for more see TUUID.h).

     A TProcessID is automatically created by the TROOT constructor.
     When a TFile contains referenced objects (see TRef), the TProcessID
     object is written to the file.
     If a file has been written in multiple sessions (same machine or not),
     a TProcessID is written for each session.
     These objects are used by the class TRef to uniquely identified
     any TObject pointed by a TRef.

     When a referenced object is read from a file (its bit kIsReferenced is set),
     this object is entered into the objects table of the corresponding TProcessID.
     Each TFile has a list of TProcessIDs (see TFile::fProcessIDs) also
     accessible via TProcessID::fgPIDs (for all files).
     When this object is deleted, it is removed from the table via the cleanup
     mechanism invoked by the TObject destructor.

     Each TProcessID has a table (TObjArray *fObjects) that keeps track
     of all referenced objects. If a referenced object has a fUniqueID set,
     a pointer to this unique object may be found via fObjects->At(fUniqueID).
     In the same way, when a TRef::GetObject is called, GetObject uses
     its own fUniqueID to find the pointer to the referenced object.
     See TProcessID::GetObjectWithID and PutObjectWithID.

     When a referenced object is deleted, its slot in fObjects is set to null.

     See also TProcessUUID: a specialized TProcessID to manage the single list
     of TUUIDs.

TProcessID()

~TProcessID()

TProcessID(const TProcessID &ref) : TNamed(ref)

     TProcessID copy ctor.

TProcessID* AddProcessID()

     static function to add a new TProcessID to the list of PIDs

UInt_t AssignID(TObject *obj)

     static function returning the ID assigned to obj
     If the object is not yet referenced, its kIsReferenced bit is set
     and its fUniqueID set to the current number of referenced objects so far.

void Cleanup()

     static function (called by TROOT destructor) to delete all TProcessIDs

void Clear(Option_t *)

     delete the TObjArray pointing to referenced objects
     this function is called by TFile::Close("R")

Int_t DecrementCount()

TProcessID* GetProcessID(UShort_t pid)

     static function returning a pointer to TProcessID number pid in fgPIDs

TProcessID* GetProcessWithUID(UInt_t uid, void *obj)

     static function returning a pointer to TProcessID with its pid
     encoded in the highest byte of uid

TProcessID* GetSessionProcessID()

     static function returning the pointer to the session TProcessID

Int_t IncrementCount()

UInt_t GetObjectCount()

     Return the current referenced object count
     fgNumber is incremented everytime a new object is referenced

TObject* GetObjectWithID(UInt_t uidd)

    returns the TObject with unique identifier uid in the table of objects
    if (!fObjects) fObjects = new TObjArray(100);

Bool_t IsValid(TProcessID *pid)

     static function. return kTRUE if pid is a valid TProcessID

void PutObjectWithID(TObject *obj, UInt_t uid)

    stores the object at the uid th slot in the table of objects
    The object uniqueid is set as well as its kMustCleanup bit
    if (!fObjects) fObjects = new TObjArray(100);

TProcessID* ReadProcessID(UShort_t pidf, TFile *file)

    The TProcessID with number pidf is read from file. (static function)
    If the object is not already entered in the gROOT list, it is added.

void RecursiveRemove(TObject *obj)

     called by the object destructor
     remove reference to obj from the current table if it is referenced

void SetObjectCount(UInt_t number)

     static function to set the current referenced object count
     fgNumber is incremented everytime a new object is referenced

UShort_t WriteProcessID(TProcessID *pidd, TFile *file)

     static function
     Check if the ProcessID pid is already in the file.
     if not, add it and return the index  number in the local file list

### Inline Functions

                  Int_t GetCount() const
             TObjArray* GetObjects() const
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
            TProcessID& operator=(const TProcessID&)

Author: Rene Brun 28/09/2001
Last update: root/cont:$Name: $:$Id: TProcessID.cxx,v 1.27 2005/06/23 06:24:27 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *