//*-- Author : Valeriy Onuchin 11/09/2000 
//
//
////////////////////////////////////////////////////////////////////////////////
//
// rooObj corresponds to ooHandle(ooObj) class

#include "rooObjy.h"
#include <ooas.h>
#include <oo.h>
#include <TROOT.h>
#include <TBrowser.h>

ClassImp(rooObj)

////////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
 rooObj::rooObj()
{
   // default ctor

   fImp = new ooHandle(ooObj)();
}

//______________________________________________________________________________
 rooObj::~rooObj()
{
   // dtor.
   
   if(fImp) delete fImp;
   fImp = 0;
}

//______________________________________________________________________________
 rooObj::rooObj(const rooObj& objH)
{
   // copy ctor.

   fImp = new ooHandle(ooObj)(*((ooHandle(ooObj)*)objH.getImp()));
}

//______________________________________________________________________________
Bool_t rooObj::operator==(const rooObj& objH) const
{
   // Returns kTRUE if  handle references the specified basic
   // object, otherwise kFALSE

   return *((ooHandle(ooObj)*)fImp) == *((ooHandle(ooObj)*)objH.getImp()); 
}

//______________________________________________________________________________
Bool_t rooObj::operator!=(const rooObj& objH) const
{
   // Returns kTRUE if  handle does not reference the specified basic
   // object, otherwise kFALSE

   return *((ooHandle(ooObj)*)fImp) != *((ooHandle(ooObj)*)objH.getImp()); 
}

//______________________________________________________________________________
rooObj& rooObj::operator=(const rooObj& objH)
{
   //

   *((ooHandle(ooObj)*)fImp) = *((ooHandle(ooObj)*)objH.getImp());
   return *this; 
}

//______________________________________________________________________________
 Bool_t rooObj::checkin() const
{
   // Cheks in the basic object
   
   return ((ooHandle(ooObj)*)fImp)->checkin();
}

//______________________________________________________________________________
 Bool_t rooObj::checkout(Int_t mode) const
{
   // Checks out the basic object in the indicated mode
   
   return ((ooHandle(ooObj)*)fImp)->checkout((ooMode)mode);
}

//______________________________________________________________________________
 Bool_t rooObj::close() const
{
   // Closes the basic object referenced by the object reference or handle.
   
   return ((ooHandle(ooObj)*)fImp)->close();
}

//______________________________________________________________________________
 rooContObj rooObj::containedIn() const
{
   // Returns a handle of container that contains the referenced
   // basic object. 
   
   ooHandle(ooContObj) cont = ((ooHandle(ooObj)*)fImp)->containedIn();
   return rooContObj((void*)&cont);
}

//______________________________________________________________________________
//rooContObj& rooObj::containedIn(rooContObj& db) const
//{
   //
//   
//   ooHandle(ooContObj) cont;
//   cont = ((ooHandle(ooObj)*)fImp)->containedIn(cont);
//   db.setImp((void*)&cont);
//   return &db;
//}

//______________________________________________________________________________
// copy()

//______________________________________________________________________________
 void rooObj::delete_object()
{
   // Delete the object referenced by this handle

   ((ooHandle(ooObj)*)fImp)->delete_object();
}

//______________________________________________________________________________
 Bool_t rooObj::getDefaultVers(rooObj& refH) const
{
   // Returns object handle to default version of the basic object.

   ooHandle(ooObj)* obj = (ooHandle(ooObj)*)refH.getImp();
   return ((ooHandle(ooObj)*)fImp)->getDefaultVers(*obj);
}

//______________________________________________________________________________
 Bool_t rooObj::getNameObj(rooObjItr& itr) const
{
   // Initializes iterator itr to find all named basic objects in a given scope.
   
   ooItr(ooObj)* intItr = (ooItr(ooObj)*)itr.getImp();
   return ((ooHandle(ooObj)*)fImp)->getNameObj(*intItr);
}

//______________________________________________________________________________
 Bool_t rooObj::getNameScope(rooObjItr& itr) const
{
   // Initializes iterator itr to traverse basic objects that serve as a name
   // scope.

   ooItr(ooObj)* intItr = (ooItr(ooObj)*)itr.getImp();
   return ((ooHandle(ooObj)*)fImp)->getNameScope(*intItr);
}

//______________________________________________________________________________
 Bool_t rooObj::getNextVers(rooObj& next,Int_t openMode) const
{
   // Initializes next iterator to traverse all next versions of the
   // basic object. Objects of the iteration are automatically opened in mode
   // openMode. If no next versions exist, an empty iterator is returned (the
   // first next member function invocation will return kFALSE).
   
   ooHandle(ooObj)* obj =  (ooHandle(ooObj)*)next.getImp();
   return ((ooHandle(ooObj)*)fImp)->getNextVers(*obj,(ooMode)openMode);
}

//______________________________________________________________________________
 TString  rooObj::getObjName(const rooObj& scope) const
{
   // Returns the name of the basic object in the given scope.
   
   ooHandle(ooObj)* obj = (ooHandle(ooObj)*)scope.getImp();
   return TString(((ooHandle(ooObj)*)fImp)->getObjName(*obj));
}

//______________________________________________________________________________
 TString  rooObj::getObjName() const
{
   // Returns the name of the basic object in the given scope.
   
   return TString(((ooHandle(ooObj)*)fImp)->getObjName());
}

//______________________________________________________________________________
 Bool_t rooObj::getPrevVers(rooObj& prev) const
{
   // Returns object handle to previous version of the basic object.
   
   ooHandle(ooObj)* obj =  (ooHandle(ooObj)*)prev.getImp();
   return ((ooHandle(ooObj)*)fImp)->getPrevVers(*obj);
}

//______________________________________________________________________________
 Int_t rooObj::getVersStatus() const
{
   // Returns current versioning mode of referenced basic object.
   
   return ((ooHandle(ooObj)*)fImp)->getVersStatus();
}

//______________________________________________________________________________
 Bool_t rooObj::isValid() const
{
   // Checks the validity of an object handle, but does not check
   // the type. A value of kTRUE returned by isValid indicates only that
   // the object reference or handle is valid; that is, that it points to a 
   // basic object in the federated database; it does not indicate that the 
   // type of that basic object corresponds to the type of the object 
   // reference or handle.
   
   return ((ooHandle(ooObj)*)fImp)->isValid();
}

//______________________________________________________________________________
 Bool_t rooObj::is_null() const
{
   //  
   
   return ((ooHandle(ooObj)*)fImp)->is_null();
}

//______________________________________________________________________________
 Bool_t rooObj::lock(Int_t lockMode) const
{
   // Explicitly locks the basic object and propagates the lock to any basic
   // objects associated through links that have lock propagation enabled.
   
   return ((ooHandle(ooObj)*)fImp)->lock((ooLockMode)lockMode);
}

//______________________________________________________________________________
 Bool_t rooObj::lockNoProp(Int_t lockMode) const
{
   //  Explicitly locks the basic object without propagation semantics
   
   return ((ooHandle(ooObj)*)fImp)->lockNoProp((ooLockMode)lockMode);
}

//______________________________________________________________________________
 Bool_t rooObj::lookupObj( const rooObj& scope,
                                 const TString& name,
                                 Int_t openMode) const
{
   // Sets object handle to reference the basic object matching
   // the named name in the scope of the handle
   // scope, and opens the basic object in mode openMode (default is
   // kooRead). Default scope object is gooTopDB. 

   ooHandle(ooObj)* obj = (ooHandle(ooObj)*)scope.getImp();
   return ((ooHandle(ooObj)*)fImp)->lookupObj(*obj,name.Data(),(ooMode)openMode);
}

//______________________________________________________________________________
 Bool_t rooObj::lookupObj(const TString& name,Int_t openMode) const
{
   // Sets object handle to reference the basic object matching
   // the named name, and opens the basic object in mode openMode (default is
   // kooRead). Default scope object is gooTopDB. 
   
   return ((ooHandle(ooObj)*)fImp)->lookupObj(name.Data(),(ooMode)openMode);
}

//______________________________________________________________________________
 Bool_t rooObj::move(const rooObj& cont)
{
   // Moves the basic object to different container

   ooHandle(ooObj)* obj = (ooHandle(ooObj)*)cont.getImp();     
   return ((ooHandle(ooObj)*)fImp)->move(*obj);
}

//______________________________________________________________________________
 TString  rooObj::nameObj(const rooObj& scope,const TString& name) const
{
   // Assigns the referenced basic object the scope name name in the scope
   // specified by handle scope. Default scope is gooTopDB.
   
   ooHandle(ooObj)* obj = (ooHandle(ooObj)*)scope.getImp();
   return TString(((ooHandle(ooObj)*)fImp)->nameObj(*obj,name.Data()));
}

//______________________________________________________________________________
 TString  rooObj::nameObj(const TString& name) const
{
   // Assigns the referenced basic object the scope name name in the scope
   // of gooTopDB.
   
   return TString(((ooHandle(ooObj)*)fImp)->nameObj(name.Data()));
}

//______________________________________________________________________________
 Bool_t rooObj::open(Int_t openMode) const
{
   // Opens the referenced basic object in the access mode specified by
   // openMode.
   // Valid values for openMode are the constants kooRead and
   // kooUpdate. The default open mode is kooRead.
   // Any number of processes may open the same basic object for read
   // access as long as no process has it open for update access. No process
   // may open a basic object for update access if any other process has it
   // open for read access. No other process may open a basic object if any
   // other process has it open for update access unless MROW is in effect.
   // The access restrictions imposed by a process's access to a basic object
   // applies until the transaction in which the basic object was opened is
   // terminated (either committed or aborted).  
   
   return ((ooHandle(ooObj)*)fImp)->open((ooMode)openMode);
}

//______________________________________________________________________________
 Int_t rooObj::openMode() const
{
   // Returns the mode in which the basic object currently referenced has
   // been opened.
   
   return ((ooHandle(ooObj)*)fImp)->openMode();
}

//______________________________________________________________________________
 void rooObj::print(FILE* fp) const
{
   // Prints information about the object, including its object identifier
   // (OID), class, and open mode.
   
   ((ooHandle(ooObj)*)fImp)->print(fp);
}

//______________________________________________________________________________
 Bool_t rooObj::setDefaultVers() const
{
   // Sets default version to the current basic object.
   
   return ((ooHandle(ooObj)*)fImp)->setDefaultVers();
}

//______________________________________________________________________________
 Bool_t rooObj::setVersStatus(Int_t versMode) const
{
   // Sets the versioning mode for the referenced basic object to versMode.
   
   return ((ooHandle(ooObj)*)fImp)->setVersStatus((const ooVersMode)versMode);
}

//______________________________________________________________________________
 TString  rooObj::sprint() const
{
   // Returns a string representation of the object's identifier (OID). If a
   // pointer is passed in, sprint stores the string in the buffer; otherwise
   // the string is stored in a statically allocated buffer and should be copied
   // before the next call to sprint.
   
   return TString(((ooHandle(ooObj)*)fImp)->sprint());
}

//______________________________________________________________________________
 Int_t rooObj::typeN() const
{
   // Returns the type number of the referenced basic object.
   
   return ((ooHandle(ooObj)*)fImp)->typeN();
}

//______________________________________________________________________________
 TString  rooObj::typeName() const
{
   // Return string containing class name of the basic object currently
   // referenced
   
   return TString(((ooHandle(ooObj)*)fImp)->typeName());
}

//______________________________________________________________________________
 Bool_t rooObj::unnameObj(const rooObj& scope, const TString& name) const
{
   // Removes the basic object name name in the scope specified by scope.
   // Default scope object is gooTopDB.
   
   ooHandle(ooObj)* obj = (ooHandle(ooObj)*)scope.getImp();
   return ((ooHandle(ooObj)*)fImp)->unnameObj(*obj,name.Data());
}

//______________________________________________________________________________
 Bool_t rooObj::unnameObj(const TString& name) const
{
   // Removes the basic object name name in the scope specified by gooTopDB.
      
   return ((ooHandle(ooObj)*)fImp)->unnameObj(name.Data());
}

//______________________________________________________________________________
 Bool_t rooObj::update() const
{
   // Opens the referenced basic object in update access mode.
   
   return ((ooHandle(ooObj)*)fImp)->update();
}

//______________________________________________________________________________
 void rooObj::Print(Option_t *option)
{
   // print out persistent data for object referenced by this handle

   rooClassObject co(*this);
   rooShowData(co);  // global function defined in rooFunctions.h 
}

//______________________________________________________________________________
 void rooObj::Browse(TBrowser *b)
{
   // browse the object data

   rooClassObject co(*this);
   rooShowData(co);
}





ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.