<commit_before>// @(#)root/cont:$Name:  $:$Id: TRefArray.cxx,v 1.20 2005/03/26 07:02:14 brun Exp $
// Author: <NAME>  02/10/2001

/*************************************************************************
 * Copyright (C) 1995-2001, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRefArray                                                            //
//                                                                      //
// An array of references to TObjects. The array expands automatically  //
// when  objects are added (shrinking can be done by hand using Expand()//
//                                                                      //
// The TRefArray can be filled with:                                    //
//     array.Add(obj)                                                   //
//     array.AddAt(obj,i)                                               //
//     but not array[i] = obj  !!!                                      //
//                                                                      //
// The array elements can be retrieved with:                            //
//     TObject *obj = array.At(i);                                      //
//                                                                      //
// When a TRefArray is Streamed, only the pointer unique id is written, //
// not the referenced object. TRefArray may be assigned to different    //
// branches of one Tree or several Trees.                               //
// The branch containing the TRefArray can be read before or after the  //
// array (eg TClonesArray, STL vector,..) of the referenced objects.    //
//                                                                      //
// See an example in $ROOTSYS/test/Event.h                              //
//                                                                      //
// RESTRICTIONS when using TRefArray                                    //
// ---------------------------------                                    //
//  - Elements in a TRefArray cannot point to a TFile or TDirectory.    //
//  - All elements of a TRefArray must be set in the same process,      //
//    In particular, one cannot modify some elements of the array in    //
//    a different process.                                              //
// Use an array of TRef when one of the above restrictions is met.      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TRefArray.h"
#include "TRefTable.h"
#include "TError.h"
#include "TFile.h"
#include "TSystem.h"

ClassImp(TRefArray)

//______________________________________________________________________________
TRefArray::TRefArray()
{
   // default constructor

   fPID  = TProcessID::GetSessionProcessID();
   fUIDs = 0;
   fSize = 0;
   fLast = -1;
   fLowerBound = 0;
   Changed();
}

//______________________________________________________________________________
TRefArray::TRefArray(Int_t s, Int_t lowerBound)
{
   // Create an object array. Using s one can set the array size
   // and lowerBound can be used to set the array lowerbound
   // index (default is 0).

   if (s < 0) {
      Warning("TRefArray", "size (%d) < 0", s);
      s = TCollection::kInitCapacity;
   }

   fPID  = TProcessID::GetSessionProcessID();
   fUIDs = 0;
   Init(s, lowerBound);
}

//______________________________________________________________________________
TRefArray::TRefArray(const TRefArray &a) : TSeqCollection()
{
   // Create a copy of TRefArray a. Note, does not copy the kIsOwner flag.

   fPID  = TProcessID::GetSessionProcessID();
   fUIDs = 0;
   Init(a.fSize, a.fLowerBound);

   for (Int_t i = 0; i < fSize; i++)
      fUIDs[i] = a.fUIDs[i];

   fLast = a.fLast;
   fName = a.fName;
}<commit_msg>Fix a problem with the TRefArray copy constructor.<commit_after>// @(#)root/cont:$Name:  $:$Id: TRefArray.cxx,v 1.21 2005/11/16 20:03:58 pcanal Exp $
// Author: <NAME>  02/10/2001

/*************************************************************************
 * Copyright (C) 1995-2001, <NAME> and <NAME>.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRefArray                                                            //
//                                                                      //
// An array of references to TObjects. The array expands automatically  //
// when  objects are added (shrinking can be done by hand using Expand()//
//                                                                      //
// The TRefArray can be filled with:                                    //
//     array.Add(obj)                                                   //
//     array.AddAt(obj,i)                                               //
//     but not array[i] = obj  !!!                                      //
//                                                                      //
// The array elements can be retrieved with:                            //
//     TObject *obj = array.At(i);                                      //
//                                                                      //
// When a TRefArray is Streamed, only the pointer unique id is written, //
// not the referenced object. TRefArray may be assigned to different    //
// branches of one Tree or several Trees.                               //
// The branch containing the TRefArray can be read before or after the  //
// array (eg TClonesArray, STL vector,..) of the referenced objects.    //
//                                                                      //
// See an example in $ROOTSYS/test/Event.h                              //
//                                                                      //
// RESTRICTIONS when using TRefArray                                    //
// ---------------------------------                                    //
//  - Elements in a TRefArray cannot point to a TFile or TDirectory.    //
//  - All elements of a TRefArray must be set in the same process,      //
//    In particular, one cannot modify some elements of the array in    //
//    a different process.                                              //
// Use an array of TRef when one of the above restrictions is met.      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TRefArray.h"
#include "TRefTable.h"
#include "TError.h"
#include "TFile.h"
#include "TSystem.h"

ClassImp(TRefArray)

//______________________________________________________________________________
TRefArray::TRefArray()
{
   // default constructor

   fPID  = TProcessID::GetSessionProcessID();
   fUIDs = 0;
   fSize = 0;
   fLast = -1;
   fLowerBound = 0;
   Changed();
}

//______________________________________________________________________________
TRefArray::TRefArray(Int_t s, Int_t lowerBound)
{
   // Create an object array. Using s one can set the array size
   // and lowerBound can be used to set the array lowerbound
   // index (default is 0).

   if (s < 0) {
      Warning("TRefArray", "size (%d) < 0", s);
      s = TCollection::kInitCapacity;
   }

   fPID  = TProcessID::GetSessionProcessID();
   fUIDs = 0;
   Init(s, lowerBound);
}

//______________________________________________________________________________
TRefArray::TRefArray(const TRefArray &a) : TSeqCollection()
{
   // Create a copy of TRefArray a. 

   fPID  = a.fPID;
   fUIDs = 0;
   Init(a.fSize, a.fLowerBound);

   for (Int_t i = 0; i < fSize; i++)
      fUIDs[i] = a.fUIDs[i];

   fLast = a.fLast;
   fName = a.fName;
}
{'fraction_non_alphanumeric': 0.16335948315643747, 'fraction_numerical': 0.009921550530687587, 'mean_word_length': 1.0402447634737586, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 86, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7112129', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1834, 'n_words': 594}